diff options
25 files changed, 0 insertions, 5880 deletions
diff --git a/gtk2_ardour/ardour_image_compositor_socket.h b/gtk2_ardour/ardour_image_compositor_socket.h deleted file mode 100644 index 88e9e377b8..0000000000 --- a/gtk2_ardour/ardour_image_compositor_socket.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - - -#ifndef __ardour_image_comp_h__ -#define __ardour_image_comp_h__ - -#include <string> - -namespace ardourvis -{ - /** Simple version number */ - const int32_t MSG_VERSION = 1 ; - - /** the default port we use */ - const int32_t DEFAULT_PORT = 30000 ; - - /** the maximum buffer size we will use to send receive a message (image data handled differently) */ - const int32_t MAX_MSG_SIZE = 256 ; - - /** the number of characters used for a value describing the characters within a textual data element */ - const int32_t TEXT_SIZE_CHARS = 3 ; - - /** the number of characters we use for time values within a message */ - const int32_t TIME_VALUE_CHARS = 10 ; - - /** the number of charachters we use for other value data, ie image width/height values */ - const int32_t IMAGE_SIZE_CHARS = 3 ; - - /** the number of characters used to for the size of the image data message */ - const int32_t IMAGE_DATA_MESSAGE_SIZE_CHARS = 32 ; - - // ------------------------------------------------------------------------- // - // Main Actions - // we join the action chars with items to create the message - // with the exception of the return values, all messages begin with one - // of these message parts - - /** Insert an Item */ - const std::string INSERT_ITEM = "IN" ; - - /** Remove an Item */ - const std::string REMOVE_ITEM = "RM" ; - - /** Rename a named item */ - const std::string RENAME_ITEM = "MV" ; - - /** Request some aditional data */ - const std::string REQUEST_DATA = "RQ" ; - - /** Return of a data request */ - const std::string RETURN_DATA = "RD" ; - - /** Update a item */ - const std::string ITEM_UPDATE = "IU" ; - - /** Select an Item */ - const std::string ITEM_SELECTED = "IS" ; - - /** Sesion Action */ - const std::string SESSION_ACTION = "SA" ; - - /** Sesion Action */ - const std::string SHUTDOWN = "SD" ; - - - // ------------------------------------------------------------------------- // - // Return values - const std::string RETURN_TRUE = "RT1" ; - const std::string RETURN_FALSE = "RT0" ; - - - - // ------------------------------------------------------------------------- // - // Updateable attributes - - /** Update the position of a time axis item */ - const std::string POSITION_CHANGE = "PC" ; - - /** Update the duration of a time axis item */ - const std::string DURATION_CHANGE = "DC" ; - - /** Enable the position lock constraint no a time axis item */ - const std::string POSITION_LOCK_CHANGE = "PL" ; - - /** Enable the duration lock constraint no a time axis item */ - const std::string DURATION_LOCK_CHANGE = "PL" ; - - /** Update the Maximum duration of a time axis item (_Upper _Duration) */ - const std::string MAX_DURATION_CHANGE = "UD" ; - - /** Enable the Maximum duration constraint of a time axis item (_Enable _Upper (Duration)) */ - const std::string MAX_DURATION_ENABLE_CHANGE = "EU" ; - - /** Update the Minimum duration of a time axis item (_Lowerr _Duration) */ - const std::string MIN_DURATION_CHANGE = "LD" ; - - /** Enable the Minimum duration constraint of a time axis item (_Enable _Lower (Duration)) */ - const std::string MIN_DURATION_ENABLE_CHANGE = "EL" ; - - /** Refresh the image data of an imageframe item (original image has been altered?) */ - const std::string IMAGE_REFRESH = "IR" ; - - /** the session sample rate has changed */ - const std::string SAMPLE_RATE_CHANGE = "RC" ; - - - - // ------------------------------------------------------------------------- // - // Requestable data items - - /** RGB data of the iamge */ - // this is probably a bad choice of string ! - const std::string IMAGE_RGB_DATA = "ID" ; - - /** the (path) name of the Ardour session */ - const std::string SESSION_NAME = "SN" ; - - /** the current sample rate */ - const std::string SAMPLE_RATE = "SR" ; - - /** the (path) name of the image compositor session */ - const std::string COMPOSITOR_SESSION = "CS" ; - - - // ------------------------------------------------------------------------- // - // Session Actions - follwed by session path - - /** Close a session */ - const std::string CLOSE_SESSION = "CS" ; - - /** Open a session */ - const std::string OPEN_SESSION = "OS" ; - - - - // ------------------------------------------------------------------------- // - // Items - - const std::string IMAGEFRAME_TIME_AXIS = "IT" ; - const std::string MARKER_TIME_AXIS = "MT" ; - const std::string IMAGEFRAME_ITEM = "II" ; - const std::string MARKER_ITEM = "MI" ; - - /** or an ImageFrameTimeAxisGroup */ - const std::string IMAGEFRAME_GROUP = "IG" ; - -} /* namespace ardour_visual */ - -#endif /* __ardour_image_comp_socket_h__ */ diff --git a/gtk2_ardour/canvas.h b/gtk2_ardour/canvas.h index 1bf3be96d2..1139da55cc 100644 --- a/gtk2_ardour/canvas.h +++ b/gtk2_ardour/canvas.h @@ -34,7 +34,6 @@ namespace Gnome { class Line; class Points; class Pixbuf; - class ImageFrame; class LineSet; } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 13c2eeb3cd..919d6e0781 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -188,14 +188,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_internal_edit (bool yn); bool toggle_internal_editing_from_double_click (GdkEvent*); -#ifdef WITH_CMT - void add_imageframe_time_axis(const std::string & track_name, void*) ; - void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ; - void connect_to_image_compositor() ; - void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ; - TimeAxisView* get_named_time_axis(const std::string & name) ; -#endif /* WITH_CMT */ - void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>); void add_to_idle_resize (TimeAxisView*, int32_t); @@ -1454,15 +1446,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void queue_visual_videotimeline_update (); void embed_audio_from_video (std::string, framepos_t n = 0); - bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); - bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*); - bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); - bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); - bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*); - bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*); - bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*); - bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*); - PBD::Signal0<void> EditorFreeze; PBD::Signal0<void> EditorThaw; @@ -1912,47 +1895,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void nudge_track (bool use_edit_point, bool forwards); -#ifdef WITH_CMT - void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ; - void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ; - - void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ; - void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ; - - void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ; - void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ; - void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ; - - gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv); - gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta); - gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv); - gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv); - - gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta); - gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv); - gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv); - gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv); - - void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; - void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; - void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; - void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; - void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; - void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; - - void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; - void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; - void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; - void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; - void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; - void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; - - void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ; - void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ; - - ImageFrameSocketHandler* image_socket_listener ; -#endif - static const int32_t default_width = 995; static const int32_t default_height = 765; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index c4b07eb738..1a6dc863e1 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -37,11 +37,9 @@ #include "waveview.h" #include "simplerect.h" #include "simpleline.h" -#include "imageframe.h" #include "waveview_p.h" #include "simplerect_p.h" #include "simpleline_p.h" -#include "imageframe_p.h" #include "canvas_impl.h" #include "canvas-noevent-text.h" #include "editing.h" @@ -89,14 +87,12 @@ static void ardour_canvas_type_init() Glib::wrap_register(gnome_canvas_simpleline_get_type(), &Gnome::Canvas::SimpleLine_Class::wrap_new); Glib::wrap_register(gnome_canvas_simplerect_get_type(), &Gnome::Canvas::SimpleRect_Class::wrap_new); Glib::wrap_register(gnome_canvas_waveview_get_type(), &Gnome::Canvas::WaveView_Class::wrap_new); - // Glib::wrap_register(gnome_canvas_imageframe_get_type(), &Gnome::Canvas::ImageFrame_Class::wrap_new); // Register the gtkmm gtypes: (void) Gnome::Canvas::WaveView::get_type(); (void) Gnome::Canvas::SimpleLine::get_type(); (void) Gnome::Canvas::SimpleRect::get_type(); - (void) Gnome::Canvas::ImageFrame::get_type(); } void diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index 303bddb103..fb1995659c 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -53,18 +53,6 @@ enum ItemType { RightFrameHandle, StartCrossFadeItem, EndCrossFadeItem, - -#ifdef WITH_CMT - MarkerViewItem, - MarkerTimeAxisItem, - MarkerViewHandleStartItem, - MarkerViewHandleEndItem, - ImageFrameItem, - ImageFrameTimeAxisItem, - ImageFrameHandleStartItem, - ImageFrameHandleEndItem, -#endif - CrossfadeViewItem, /* don't remove this */ diff --git a/gtk2_ardour/imageframe.h b/gtk2_ardour/imageframe.h deleted file mode 100644 index a752cdbce0..0000000000 --- a/gtk2_ardour/imageframe.h +++ /dev/null @@ -1,156 +0,0 @@ -// -*- c++ -*- -#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_H -#define _LIBGNOMECANVASMM_IMAGEFRAME_H - -#include <glibmm.h> - - -/* rect.h - * - * Copyright (C) 1998 EMC Capital Management Inc. - * Developed by Havoc Pennington <hp@pobox.com> - * - * Copyright (C) 1999 The Gtk-- Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <stdint.h> -#include <libgnomecanvasmm/item.h> -#include <libgnomecanvasmm/group.h> -#include <libgnomecanvasmm/shape.h> - -#include <libgnomecanvas/libgnomecanvas.h> -#include <gtk/gtkenums.h> - -#ifdef __cplusplus -extern "C" { -#endif -#include <libart_lgpl/art_misc.h> -#ifdef __cplusplus -} -#endif - -#include <libart_lgpl/art_pixbuf.h> - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame; -typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass; -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -namespace Gnome -{ - -namespace Canvas -{ class ImageFrame_Class; } // namespace Canvas - -} // namespace Gnome -namespace Gnome -{ - -namespace Canvas -{ - -//class Group; - - -class ImageFrame : public Item -{ - public: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef ImageFrame CppObjectType; - typedef ImageFrame_Class CppClassType; - typedef GnomeCanvasImageFrame BaseObjectType; - typedef GnomeCanvasImageFrameClass BaseClassType; -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - virtual ~ImageFrame(); - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -private: - friend class ImageFrame_Class; - static CppClassType rect_class_; - - // noncopyable - ImageFrame(const ImageFrame&); - ImageFrame& operator=(const ImageFrame&); - -protected: - explicit ImageFrame(const Glib::ConstructParams& construct_params); - explicit ImageFrame(GnomeCanvasImageFrame* castitem); - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -public: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - static GType get_type() G_GNUC_CONST; - static GType get_base_type() G_GNUC_CONST; -#endif - - ///Provides access to the underlying C GtkObject. - GnomeCanvasImageFrame* gobj() { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); } - - ///Provides access to the underlying C GtkObject. - const GnomeCanvasImageFrame* gobj() const { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); } - - -public: - //C++ methods used to invoke GTK+ virtual functions: - -protected: - //GTK+ Virtual Functions (override these to change behaviour): - - //Default Signal Handlers:: - - -private: - - -public: - ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h); - explicit ImageFrame(Group& parent); - - Glib::PropertyProxy<double> property_x(); - Glib::PropertyProxy_ReadOnly<double> property_x() const; - Glib::PropertyProxy<double> property_y(); - Glib::PropertyProxy_ReadOnly<double> property_y() const; - Glib::PropertyProxy<double> property_width(); - Glib::PropertyProxy_ReadOnly<double> property_width() const; - Glib::PropertyProxy<double> property_drawwidth(); - Glib::PropertyProxy_ReadOnly<double> property_drawwidth() const; - Glib::PropertyProxy<double> property_height(); - Glib::PropertyProxy_ReadOnly<double> property_height() const; - Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ; - Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const; - -}; - -} /* namespace Canvas */ -} /* namespace Gnome */ - -namespace Glib -{ - /** @relates Gnome::Canvas::ImageFrame - * @param object The C instance - * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. - * @result A C++ instance that wraps this C instance. - */ - Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy = false); -} -#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_H */ - diff --git a/gtk2_ardour/imageframe_p.h b/gtk2_ardour/imageframe_p.h deleted file mode 100644 index e37a6eaa64..0000000000 --- a/gtk2_ardour/imageframe_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2000-2007 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -// -*- c++ -*- -#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_P_H -#define _LIBGNOMECANVASMM_IMAGEFRAME_P_H - -#include <glibmm/class.h> - -namespace Gnome -{ - -namespace Canvas -{ - -class ImageFrame_Class : public Glib::Class -{ -public: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef ImageFrame CppObjectType; - typedef GnomeCanvasImageFrame BaseObjectType; - typedef GnomeCanvasImageFrameClass BaseClassType; - typedef Shape_Class CppClassParent; - typedef GnomeCanvasItemClass BaseClassParent; - - friend class ImageFrame; -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - const Glib::Class& init(); - - static void class_init_function(void* g_class, void* class_data); - - static Glib::ObjectBase* wrap_new(GObject*); - -protected: - - //Callbacks (default signal handlers): - //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. - //You could prevent the original default signal handlers being called by overriding the *_impl method. - - //Callbacks (virtual functions): -}; - - -} // namespace Canvas - -} // namespace Gnome - -#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_P_H */ - diff --git a/gtk2_ardour/imageframe_socket_handler.h b/gtk2_ardour/imageframe_socket_handler.h deleted file mode 100644 index d12b8285ef..0000000000 --- a/gtk2_ardour/imageframe_socket_handler.h +++ /dev/null @@ -1,703 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_imageframe_socket_handler_h__ -#define __ardour_gtk_imageframe_socket_handler_h__ - -#include <string> -#include <list> -#include "ardour_image_compositor_socket.h" - -class TimeAxisViewItem ; -class ImageFrameView ; -class MarkerView ; -class ImageFrameTimeAxisGroup ; -class Editor ; - -/** - * ImageFrameSocketHandler defines the handler between Ardour and an Image Compositor - * As this is purely visual, we do all processing within the main gtk loop via - * message passing through a socket. - * - */ -class ImageFrameSocketHandler : public sigc::trackable -{ - public: - /** - * Constructs a new ImageFrameSocketHandler to handle communication between Ardour and the Image Compositor - * - * @param ed the PublicEditor - */ - ImageFrameSocketHandler(PublicEditor& ed) ; - - /** - * Descructor - * this will shutdown the socket if open - */ - virtual ~ImageFrameSocketHandler() ; - - /** - * Returns the instance of the ImageFrameSocketHandler - * the instance should first be created with createInstance - * - * @return the instance of the ImageFrameSocketHandler - */ - static ImageFrameSocketHandler* get_instance() ; - - /** - * call back to handle doing the processing work - * This method is added to the gdk main loop and called when there is data - * upon the socket. - * - */ - static void image_socket_callback(void *arg, int32_t fd, GdkInputCondition cond) ; - - /** - * Attempt to connect to the image compositor on the specified host and port - * - * @param hostIp the ip address of the image compositor host - * @param port the oprt number to attemp the connection on - * @return true if the connection was a succees - * false otherwise - */ - bool connect(const char * hostIp, int32_t port) ; - - /** - * Closes the connection to th Image Compositor - * - */ - void close_connection() ; - /** - * Returns true if this ImagFrameSocketHandler is currently connected to rthe image compositor - * - * @return true if connected to the image compositor - */ - bool is_connected() ; - - /** - * Sets the tag used to describe this input within gtk - * this is returned when gdk_input_add is called and is required to remove the input - * - * @param tag the gdk input tag of this input - */ - void set_gdk_input_tag(int tag) ; - - /** - * Returns the gdk input tag of this input - * - * @return the gdk input tag of this input - * @see setGdkInputTag - */ - int get_gdk_input_tag() ; - - - /** - * Returns the socket file descriptor - * - * @return the Sockt file descriptor - */ - int get_socket_descriptor() ; - - - //---------------------------------------------------------------------------------------// - // Handle Sending messages to the Image Compositor - - //---------------------------- - // ImageFrameTimeAxis Messages - - /** - * Sends a message stating that the named image frame time axis has been removed - * - * @param track_id the unique id of the removed image frame time axis - * @param src the identity of the object that initiated the change - */ - void send_imageframe_time_axis_removed(const std::string & track_id, void* src) ; - - /** - * Sends a message indicating that an ImageFrameTimeAxis has been renamed - * - * @param new_id the new name, or Id, of the track - * @param old_id the old name, or Id, of the track - * @param src the identity of the object that initiated the change - * @param time_axis the time axis that has changed - */ - void send_imageframe_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameTimeAxis* time_axis) ; - - //------------------------ - // MarkerTimeAxis Messages - - /** - * Sends a message stating that the named marker time axis has been removed - * - * @param track_id the unique id of the removed image frame time axis - * @param src the identity of the object that initiated the change - */ - void send_marker_time_axis_removed(const std::string & track_id, void* src) ; - - /** - * Sends a message indicating that an MarkerTimeAxis has been renamed - * - * @param new_id the new name, or Id, of the track - * @param old_id the old name, or Id, of the track - * @param src the identity of the object that initiated the change - * @param time_axis the time axis that has changed - */ - void send_marker_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerTimeAxis* time_axis) ; - - - //--------------------------------- - // ImageFrameTimeAxisGroup Messages - - /** - * Sends a message stating that the group has been removed - * - * @param group_id the unique id of the removed image frame time axis - * @param src the identity of the object that initiated the change - * @param group the group that has changed - */ - void send_imageframe_time_axis_group_removed(const std::string & group_id, void* src, ImageFrameTimeAxisGroup* group) ; - - /** - * Send a message indicating that an ImageFrameTimeAxisGroup has been renamed - * - * @param new_id the new name, or Id, of the group - * @param old_id the old name, or Id, of the group - * @param src the identity of the object that initiated the change - * @param group the group that has changed - */ - void send_imageframe_time_axis_group_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameTimeAxisGroup* group) ; - - - //--------------------------------- - // ImageFrameView Messages - - /** - * Send an Image Frame View Item position changed message - * - * @param pos the new position value - * @param src the identity of the object that initiated the change - * @param item the time axis item whos position has changed - */ - void send_imageframe_view_position_change(nframes_t pos, void* src, ImageFrameView* item) ; - - /** - * Send a Image Frame View item duration changed message - * - * @param dur the the new duration value - * @param src the identity of the object that initiated the change - * @param item the item which has had a duration change - */ - void send_imageframe_view_duration_change(nframes_t dur, void* src, ImageFrameView* item) ; - - /** - * Send a message indicating that an ImageFrameView has been renamed - * - * @param item the ImageFrameView which has been renamed - * @param src the identity of the object that initiated the change - * @param item the renamed item - */ - void send_imageframe_view_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameView* item) ; - - /** - * Send a message indicating that an ImageFrameView item has been removed message - * - * @param item_id the id of the item that was removed - * @param src the identity of the object that initiated the change - * @param item the removed item - */ - void send_imageframe_view_removed(const std::string & item_id, void* src, ImageFrameView* item) ; - - //--------------------------------- - // MarkerView Messages - - /** - * Send a Marker View Item position changed message - * - * @param pos the new position value - * @param src the identity of the object that initiated the change - * @param item the time axis item whos position has changed - */ - void send_marker_view_position_change(nframes_t pos, void* src, MarkerView* item) ; - - /** - * Send a Marker View item duration changed message - * - * @param dur the new duration value - * @param src the identity of the object that initiated the change - * @param item the time axis item whos position has changed - */ - void send_marker_view_duration_change(nframes_t dur, void* src, MarkerView* item) ; - - /** - * Send a message indicating that a MarkerView has been renamed - * - * @param new_id the new_id of the object - * @param old_id the old_id of the object - * @param src the identity of the object that initiated the change - * @param item the MarkerView which has been renamed - */ - void send_marker_view_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerView* item) ; - - /** - * Send a message indicating that a MarkerView item has been removed message - * - * @param item_id the id of the item that was removed - * @param src the identity of the object that initiated the change - * @param item the MarkerView which has been removed - */ - void send_marker_view_removed(const std::string & item_id, void* src, MarkerView* item) ; - - - //---------------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted if the socket connection is shutdown at the other end */ - sigc::signal<void> CompositorSocketShutdown ; - - /** Emitted as a generic error is captured from the socket connection to the animatic compositor */ - sigc::signal<void> CompositorSocketError ; - - - protected: - - - private: - /* I dont like friends :-( */ - friend class Editor; - - /** - * Create an new instance of the ImageFrameSocketHandler, if one does not already exist - * - * @param ed the Ardour PublicEditor - */ - static ImageFrameSocketHandler* create_instance(PublicEditor& ed) ; - - //---------------------------------------------------------------------------------------// - // Message breakdown ie avoid a big if...then...else - - /** - * Handle insert item requests - * - * @param msg the received message - */ - void handle_insert_message(const char* msg) ; - - /** - * Handle remove item requests - * - * @param msg the received message - */ - void handle_remove_message(const char* msg) ; - - /** - * Handle rename item requests - * - * @param msg the received message - */ - void handle_rename_message(const char* msg) ; - - /** - * Handle a request for session information - * - * @param msg the received message - */ - void handle_request_data(const char* msg) ; - - /** - * Handle the update of a particular item - * - * @param msg the received message - */ - void handle_item_update_message(const char* msg) ; - - /** - * Handle the selection of an Item - * - * @param msg the received message - */ - void handle_item_selected(const char* msg) ; - - /** - * Handle s session action message - * - * @param msg the received message - */ - void handle_session_action(const char* msg) ; - - //---------------------------------------------------------------------------------------// - // handlers for specific insert procedures - - /** - * Handle the insertion of a new ImaegFrameTimeAxis - * - * @param msg the received message - */ - void handle_insert_imageframe_time_axis(const char* msg) ; - - /** - * Handle the insertion of a new MarkerTimeAxis - * - * @param msg the received message - */ - void handle_insert_marker_time_axis(const char* msg) ; - - /** - * Handle the insertion of a time axis group (a scene) - * - * @param msg the received message - */ - void handle_insert_imageframe_group(const char* msg) ; - - /** - * Handle the insertion of a new ImageFrameItem - * - * @param msg the received message - */ - void handle_insert_imageframe_view(const char* msg) ; - - /** - * Handle the insertion of a new MarkerItem - * - * @param msg the received message - */ - void handle_insert_marker_view(const char* msg) ; - - //---------------------------------------------------------------------------------------// - // handlers for specific removal procedures - - /** - * Handle the removal of an ImageTimeAxis - * - * @param msg the received message - */ - void handle_remove_imageframe_time_axis(const char* msg) ; - - /** - * Handle the removal of an MarkerTimeAxis - * - * @param msg the received message - */ - void handle_remove_marker_time_axis(const char* msg) ; - - /** - * Handle the removal of an ImageFrameTimeAxisGroup - * - * @param msg the received message - */ - void handle_remove_imageframe_time_axis_group(const char* msg) ; - - /** - * Handle the removal of an ImageFrameItem - * - * @param msg the received message - */ - void handle_remove_imageframe_view(const char* msg) ; - - /** - * Handle the removal of an MarkerItem - * - * @param msg the received message - */ - void handle_remove_marker_view(const char* msg) ; - - //---------------------------------------------------------------------------------------// - // handlers for the specific rename procedures - - /** - * Handle the renaming of an ImageTimeAxis - * - * @param msg the received message - */ - void handle_rename_imageframe_time_axis(const char* msg) ; - - /** - * Handle the renaming of an MarkerTimeAxis - * - * @param msg the received message - */ - void handle_rename_marker_time_axis(const char* msg) ; - - /** - * Handle the renaming of an ImageFrameItem - * - * @param msg the received message - */ - void handle_rename_imageframe_time_axis_group(const char* msg) ; - - /** - * Handle the renaming of an ImageFrameItem - * - * @param msg the received message - */ - void handle_rename_imageframe_view(const char* msg) ; - - /** - * Handle the renaming of an Marker - * - * @param msg the received message - */ - void handle_rename_marker_view(const char* msg) ; - - //---------------------------------------------------------------------------------------// - // handlers for data request - - /** - * Handle a request for the sessnio naem fo the current session - * We return a failure state if no session is open - * - * @param msg the received message - */ - void handle_session_name_request(const char* msg) ; - - - //---------------------------------------------------------------------------------------// - // handlers for specific item update changes - - /** - * Handle ImageFrameView positional changes - * - * @param msg the received message - */ - void handle_imageframe_view_position_update(const char* msg) ; - - /** - * Handle ImageFrameView Duration changes - * - * @param msg the received message - */ - void handle_imageframe_view_duration_update(const char* msg) ; - - /** - * Handle ImageFrameView Position Lock Constraint changes - * - * @param msg the received message - */ - void handle_imageframe_position_lock_update(const char* msg) ; - - /** - * Handle ImageFrameView Maximum Duration changes - * - * @param msg the received message - */ - void handle_imageframe_view_max_duration_update(const char* msg) ; - - /** - * Handle image frame max duration enable constraint changes - * - * @param msg the received message - */ - void handle_imageframe_view_max_duration_enable_update(const char* msg) ; - - /** - * Handle ImageFrameView Minimum Duration changes - * - * @param msg the received message - */ - void handle_imageframe_view_min_duration_update(const char* msg) ; - - /** - * Handle image frame min duration enable constraint changes - * - * @param msg the received message - */ - void handle_imageframe_view_min_duration_enable_update(const char* msg) ; - - - /** - * Handle MarkerView position changes - * - * @param msg the received message - */ - void handle_marker_view_position_update(const char* msg) ; - - /** - * Handle MarkerView duration changes - * - * @param msg the received message - */ - void handle_marker_view_duration_update(const char* msg) ; - - /** - * Handle MarkerView Position Lock Constraint changes - * - * @param msg the received message - */ - void handle_marker_view_position_lock_update(const char* msg) ; - - /** - * Handle MarkerView maximum duration changes - * - * @param msg the received message - */ - void handle_marker_view_max_duration_update(const char* msg) ; - - /** - * Handle MarkerView minimum duration changes - * - * @param msg the received message - */ - void handle_marker_view_min_duration_update(const char* msg) ; - - - - //---------------------------------------------------------------------------------------// - // handlers for Session Actions - - /** - * Handle the opening of a named audio session - * - * @param msg the received message - */ - void handle_open_session(const char* msg) ; - - /** - * Handle the closing of a named audio session - * - * @param msg the received message - */ - void handle_closed_session(const char* msg) ; - - //---------------------------------------------------------------------------------------// - // handlers for the shutdown of the Image Compositor - - /** - * Handle the shutdown message from the image compositor - * - * @param msg the received message - */ - void handle_shutdown(const char* msg) ; - - - //---------------------------------------------------------------------------------------// - // convenince methods to break up messages - - /** - * Returns part of the received message as a std::string - * - * @param start the start character - * @param num_chars the number of characters to read - * @param the message to break apart - * @return the sub std::string of the message - */ - std::string get_message_part(int start, int32_t num_chars, const char* msg) ; - - - /** - * break up am image item description message - * we break the mesage up into the parent Image Track id and size, - * the parent group id and size, and the image id and size - * - * @param track_id - * @param track_id_size - * @param scene_id - * @param scene_id_size - * @param item_id - * @param item_id_size - */ - void decompose_imageframe_item_desc(const char* msg, int& position, std::string& track_id, int& track_id_size, std::string& scene_id, int& scene_id_size, std::string& item_id, int& item_id_size) ; - - /** - * Compose a description of the specified image frame view - * The description consists of the parent track name size and name, - * the parent group name size and name, and the item name size and name - * - * @param ifv the item to compose a description of - * @param buffer the buffer to write the description - */ - void compose_imageframe_item_desc(ImageFrameView* ifv, std::ostringstream& buffer) ; - - /** - * Compose a description of the specified marker view - * The description consists of the parent track name size and name, - * and the item name size and name - * - * @param mv the item to compose a description of - * @param buffer the buffer to write the description - */ - void compose_marker_item_desc(MarkerView* mv, std::ostringstream& buffer) ; - - - /** - * Returns the ImageFrameView from the specified description - * The errcode parameter is used to indicate the item which caused - * an error on failure of this method - * 0 = suces - * 1 = the track item was not found - * 2 = the group item was not found - * 3 = the imageframe item was not found - * - * @paran track_id the track on which the item is placed - * @param group_id the group in which the item is a member - * @param item_id the id of the item - * @param int32_t reference used for error codes on failure - * @param errmsg populated with a description of the error on failure - * @return the described item on success, 0 otherwise - */ - ImageFrameView* get_imageframe_view_from_desc(const std::string & track_id, const std::string & group_ud, const std::string & item_id, int& errcode, std::string& errmsg) ; - - //---------------------------------------------------------------------------------------// - // Convenince Message Send Methods - - /** - * Sends a message throught the socket - * - * @param msg the message to send - * @return the return value of the socket call - */ - int send_message(const std::string & msg) ; - - /** - * Reads a message from the Socket - * - * @param msg a std::string to populate with the received message - * @return the return value from the socket call - */ - int read_message(std::string& msg) ; - - /** - * Convenience method to compose and send a success messasge back to the Image Compositor - * - */ - void send_return_success() ; - - /** - * Convenience method to compose and send a failure messasge back to the Image Compositor - * - * @param msg the failure message - */ - void send_return_failure(const std::string& msg) ; - - //---------------------------------------------------------------------------------------// - // Memebr Data - - /** Our instance of the socket handler, singleton */ - static ImageFrameSocketHandler* _instance ; - - /** The Ardour PublicEditor */ - PublicEditor& thePublicEditor ; - - /** the socket file descriptor */ - int theArdourToCompositorSocket ; - - /** This stores the 'tag' returned from gdk_input_add, which is required for removing the input */ - int theGdkInputTag ; - -} ; /* class ImageFrameSocketHandler */ - -#endif /* __ardour_gtk_imageframe_socket_handler_h__ */ diff --git a/gtk2_ardour/imageframe_time_axis.cc b/gtk2_ardour/imageframe_time_axis.cc deleted file mode 100644 index 3b3d9bffde..0000000000 --- a/gtk2_ardour/imageframe_time_axis.cc +++ /dev/null @@ -1,422 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <string> -#include <algorithm> - -#include "pbd/error.h" - -#include <gtkmm/menu.h> - -#include <gtkmm2ext/utils.h> -#include <gtkmm2ext/gtk_ui.h> - -#include "ardour/session.h" -#include "ardour/utils.h" - -#include "public_editor.h" -#include "imageframe_time_axis.h" -#include "simplerect.h" -#include "enums.h" -#include "imageframe_time_axis_view.h" -#include "imageframe_time_axis_group.h" -#include "marker_time_axis_view.h" -#include "imageframe_view.h" -#include "marker_time_axis.h" -#include "marker_view.h" -#include "gui_thread.h" -#include "canvas_impl.h" - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; - -/** - * Constructs a new ImageFrameTimeAxis. - * - * @param track_id the track name/id - * @param ed the PublicEditor - * @param sess the current session - * @param canvas the parent canvas item - */ -ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) - : AxisView(sess), - VisualTimeAxis(track_id, ed, sess, canvas) -{ - _color = unique_random_color() ; - - selection_group = new ArdourCanvas::Group (*canvas_display); - selection_group->hide(); - - // intialize our data items - y_position = -1 ; - - /* create our new image frame view */ - view = new ImageFrameTimeAxisView(*this) ; - - /* create the Image Frame Edit Menu */ - create_imageframe_menu() ; - - // set the initial time axis text label - label_view() ; - - // set the initial height of this time axis - set_height(hNormal) ; - - TimeAxisView::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, _1), gui_context()); -} - -/** - * Destructor - * Responsible for destroying any child image items that may have been added to thie time axis - */ -ImageFrameTimeAxis::~ImageFrameTimeAxis () -{ - CatchDeletion (this); - - // Destroy all the marker views we may have associaited with this TimeAxis - for(MarkerTimeAxisList::iterator iter = marker_time_axis_list.begin(); iter != marker_time_axis_list.end(); ++iter) - { - MarkerTimeAxis* mta = *iter ; - MarkerTimeAxisList::iterator next = iter ; - next++ ; - - marker_time_axis_list.erase(iter) ; - - delete mta ; - mta = 0 ; - - iter = next ; - } - - delete image_action_menu ; - image_action_menu = 0 ; - - delete selection_group; - selection_group = 0 ; - - // Destroy our Axis View helper - delete view ; - view = 0 ; -} - -//---------------------------------------------------------------------------------------// -// ui methods & data - -/** - * Sets the height of this TrackView to one of ths TrackHeghts - * - * @param h - */ -void -ImageFrameTimeAxis::set_height (uint32_t h) -{ - VisualTimeAxis::set_height(h) ; - - // tell out view helper of the change too - if(view != 0) - { - view->set_height((double) height) ; - } - - // tell those interested that we have had our height changed - gui_changed("track_height",(void*)0); /* EMIT_SIGNAL */ -} - -/** - * Sets the number of samples per unit that are used. - * This is used to determine the siezes of items upon this time axis - * - * @param spu the number of samples per unit - */ -void -ImageFrameTimeAxis::set_samples_per_unit(double spu) -{ - TimeAxisView::set_samples_per_unit (editor.get_current_zoom()); - - if(view) { - view->set_samples_per_unit(spu) ; - } -} - - -/** - * Returns the available height for images to be drawn onto - * - * @return the available height for an image item to be drawn onto - */ -int -ImageFrameTimeAxis::get_image_display_height() -{ - return(height - (gint)TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) ; -} - - -/** - * Show the popup edit menu - * - * @param button the mouse button pressed - * @param time when to show the popup - * @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none - * @param with_item true if an item has been selected upon the time axis, used to set context menu - */ -void -ImageFrameTimeAxis::popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) -{ - if (!imageframe_menu) - { - create_imageframe_menu() ; - } - - if(with_item) - { - imageframe_item_menu->set_sensitive(true) ; - } - else - { - imageframe_item_menu->set_sensitive(false) ; - } - - imageframe_menu->popup(button,time) ; -} - -/** - * convenience method to select a new track color and apply it to the view and view items - * - */ -void -ImageFrameTimeAxis::select_track_color() -{ - if (choose_time_axis_color()) - { - if (view) - { - view->apply_color (_color) ; - } - } -} - -/** - * Handles the building of the popup menu - */ -void -ImageFrameTimeAxis::build_display_menu() -{ - using namespace Menu_Helpers; - using Gtk::Menu; - - /* get the size menu ready */ - - build_size_menu(); - - /* prepare it */ - - TimeAxisView::build_display_menu () ; - - /* now fill it with our stuff */ - - MenuList& items = display_menu->items(); - - items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &ImageFrameTimeAxis::start_time_axis_rename))); - - image_action_menu = new Menu() ; - image_action_menu->set_name ("ArdourContextMenu"); - MenuList image_items = image_action_menu->items() ; - - items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Height"), *size_menu)); - items.push_back (MenuElem (_("Color"), sigc::mem_fun(*this, &ImageFrameTimeAxis::select_track_color))); - - items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Remove"), sigc::bind(sigc::mem_fun(*this, &VisualTimeAxis::remove_this_time_axis), (void*)this))) ; -} - -/** - * handles the building of the ImageFrameView sub menu - */ -void -ImageFrameTimeAxis::create_imageframe_menu() -{ - using namespace Menu_Helpers; - using Gtk::Menu; - - imageframe_menu = manage(new Menu) ; - imageframe_menu->set_name ("ArdourContextMenu"); - MenuList& items = imageframe_menu->items(); - - imageframe_item_menu = manage(new Menu) ; - imageframe_item_menu->set_name ("ArdourContextMenu"); - MenuList& imageframe_sub_items = imageframe_item_menu->items() ; - - /* duration menu */ - Menu* duration_menu = manage(new Menu) ; - duration_menu->set_name ("ArdourContextMenu"); - MenuList& duration_items = duration_menu->items() ; - - if(view) - { - duration_items.push_back(MenuElem (_("0.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 0.5))) ; - duration_items.push_back(MenuElem (_("1 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.0))) ; - duration_items.push_back(MenuElem (_("1.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.5))) ; - duration_items.push_back(MenuElem (_("2 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.0))) ; - duration_items.push_back(MenuElem (_("2.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.5))) ; - duration_items.push_back(MenuElem (_("3 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 3.0))) ; - //duration_items.push_back(SeparatorElem()) ; - //duration_items.push_back(MenuElem (_("custom"), sigc::mem_fun(*this, &ImageFrameTimeAxis::set_imageframe_duration_custom))) ; - } - - imageframe_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ; - - imageframe_sub_items.push_back(SeparatorElem()) ; - if(view) - { - imageframe_sub_items.push_back(MenuElem (_("Remove Frame"), sigc::bind(sigc::mem_fun (view, &ImageFrameTimeAxisView::remove_selected_imageframe_item), (void*)this))) ; - } - - items.push_back(MenuElem(_("Image Frame"), *imageframe_item_menu)) ; - items.push_back(MenuElem (_("Rename Track"), sigc::mem_fun(*this,&ImageFrameTimeAxis::start_time_axis_rename))) ; - - imageframe_menu->show_all() ; -} - - - - -//---------------------------------------------------------------------------------------// -// Marker Time Axis Methods - -/** - * Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis - * - * @param marker_track the MarkerTimeAxis to add - * @param src the identity of the object that initiated the change - * @return true if the addition was a success, - * false otherwise - */ -bool -ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) -{ - bool ret = false ; - - if(get_named_marker_time_axis(marker_track->name()) != 0) - { - ret = false ; - } - else - { - marker_time_axis_list.push_back(marker_track) ; - MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */ - ret = true ; - } - - return(ret) ; -} - -/** - * Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis - * - * @param track_id the track_id of the MarkerTimeAxis to search for - * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis - */ -MarkerTimeAxis* -ImageFrameTimeAxis::get_named_marker_time_axis(const string & track_id) -{ - MarkerTimeAxis* mta = 0 ; - - for (MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i) - { - if (((MarkerTimeAxis*)*i)->name() == track_id) - { - mta = ((MarkerTimeAxis*)*i) ; - break ; - } - } - return(mta) ; -} - -/** - * Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis - * - * @param track_id the track id of the MarkerTimeAxis to remove - * @param src the identity of the object that initiated the change - * @return the removed MarkerTimeAxis - */ -MarkerTimeAxis* -ImageFrameTimeAxis::remove_named_marker_time_axis(const string & track_id, void* src) -{ - MarkerTimeAxis* mta = 0 ; - - for(MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i) - { - if (((MarkerTimeAxis*)*i)->name() == track_id) - { - mta = ((MarkerTimeAxis*)*i) ; - - // the iterator is invalid after this call, so we can no longer use it as is. - marker_time_axis_list.erase(i) ; - - MarkerTimeAxisRemoved(mta->name(), src) ; /* EMIT_SIGNAL */ - break ; - } - } - - return(mta) ; -} - -/** - * Removes the specified MarkerTimeAxis from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis - * Note that the MarkerTimeAxis is not deleted, only removed from the list os associated tracks - * - * @param mta the TimeAxis to remove - * @param src the identity of the object that initiated the change - */ -void -ImageFrameTimeAxis::remove_time_axis_view (TimeAxisView* tav) -{ - MarkerTimeAxisView* mtav = dynamic_cast<MarkerTimeAxisView*> (tav); - - if (!mtav) { - return; - } - - MarkerTimeAxisList::iterator i; - - if ((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end()) { - // note that we dont delete the object itself, we just remove it from our list - marker_time_axis_list.erase(i) ; - MarkerTimeAxisRemoved (mta->name(), src) ; /* EMIT_SIGNAL */ - } -} - - -//---------------------------------------------------------------------------------------// -// Parent/Child helper object accessors - -/** - * Returns the view helper of this TimeAxis - * - * @return the view helper of this TimeAxis - */ -ImageFrameTimeAxisView* -ImageFrameTimeAxis::get_view() -{ - return(view) ; -} diff --git a/gtk2_ardour/imageframe_time_axis.h b/gtk2_ardour/imageframe_time_axis.h deleted file mode 100644 index 52c2f73e67..0000000000 --- a/gtk2_ardour/imageframe_time_axis.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_imageframe_time_axis_h__ -#define __ardour_imageframe_time_axis_h__ - -#include <list> - -//#include <libgnomecanvas.h> - -#include "ardour_dialog.h" -#include "enums.h" -#include "time_axis_view.h" -#include "canvas.h" -#include "visual_time_axis.h" - -namespace ARDOUR -{ - class Session ; -} -namespace Gtk { - class Menu; -} - -class PublicEditor ; -class ImageFrameView ; -class ImageFrameTimeAxisView ; -class MarkersTimeAxisView ; -class MarkerTimeAxis; - -/** - * ImageFrameTimeAxis defines a visual time axis view for holding and arranging image items. - * - */ -class ImageFrameTimeAxis : public VisualTimeAxis -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new ImageFrameTimeAxis. - * - * @param track_id the track name/id - * @param ed the PublicEditor - * @param sess the current session - * @param canvas the parent canvas item - */ - ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ; - - /** - * Destructor - * Responsible for destroying any child image items that may have been added to thie time axis - */ - virtual ~ImageFrameTimeAxis() ; - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of this TrackView to one of ths TrackHeghts - * - * @param h the number of pixels to set the height too - */ - virtual void set_height(uint32_t h) ; - - /** - * Sets the number of samples per unit that are used. - * This is used to determine the siezes of items upon this time axis - * - * @param spu the number of samples per unit - */ - virtual void set_samples_per_unit(double spu) ; - - /** - * Returns the available height for images to be drawn onto - * - * @return the available height for an image item to be drawn onto - */ - int get_image_display_height() ; - - - /** - * Show the popup edit menu - * - * @param button the mouse button pressed - * @param time when to show the popup - * @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none - * @param with_item true if an item has been selected upon the time axis, used to set context menu - */ - void popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) ; - - - //---------------------------------------------------------------------------------------// - // Marker Time Axis Methods - - /** - * Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis - * - * @param marker_track the MarkerTimeAxis to add - * @param src the identity of the object that initiated the change - * @return true if the addition was a success, - * false otherwise - */ - bool add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) ; - - /** - * Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis - * - * @param track_id the track_id of the MarkerTimeAxis to search for - * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis - */ - MarkerTimeAxis* get_named_marker_time_axis(const std::string & track_id) ; - - /** - * Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis - * - * @param track_id the track id of the MarkerTimeAxis to remove - * @param src the identity of the object that initiated the change - * @return the removed MarkerTimeAxis - */ - MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ; - - /** - * Potentially removes a MarkerTimeAxisView from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis - * - * @param tav the TimeAxis to remove - * @param src the identity of the object that initiated the change - */ - void remove_time_axis_view (TimeAxisView* av); - - - //---------------------------------------------------------------------------------------// - // Parent/Child helper object accessors - - /** - * Returns the view helper of this TimeAxis - * - * @return the view helper of this TimeAxis - */ - ImageFrameTimeAxisView* get_view() ; - - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted when a Marker Time Axis is Added, or associated with, this time axis */ - sigc::signal<void,MarkerTimeAxis*,void*> MarkerTimeAxisAdded ; - - /** Emitted when a Marker Time Axis is removed, from this time axis */ - sigc::signal<void,std::string,void*> MarkerTimeAxisRemoved ; - - protected: - - private: - /** - * convenience method to select a new track color and apply it to the view and view items - * - */ - void select_track_color() ; - - /** - * Handles the building of the popup menu - */ - virtual void build_display_menu() ; - - /** - * handles the building of the ImageFrameView sub menu - */ - void create_imageframe_menu() ; - - /* We may have multiple marker views, but each marker view should only be associated with one timeaxisview */ - typedef std::list<MarkerTimeAxis*> MarkerTimeAxisList ; - MarkerTimeAxisList marker_time_axis_list; - - /* the TimeAxis view helper */ - ImageFrameTimeAxisView *view ; - - // popup menu widgets - Gtk::Menu *image_action_menu ; - Gtk::Menu *imageframe_menu ; - Gtk::Menu *imageframe_item_menu ; - -}; /* class ImageFrameTimeAxis */ - -#endif /* __ardour_imageframe_time_axis_h__ */ - diff --git a/gtk2_ardour/imageframe_time_axis_group.cc b/gtk2_ardour/imageframe_time_axis_group.cc deleted file mode 100644 index c42452bafe..0000000000 --- a/gtk2_ardour/imageframe_time_axis_group.cc +++ /dev/null @@ -1,461 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <algorithm> - -#include <gtkmm.h> -#include <gtkmm2ext/gtk_ui.h> - -#include "imageframe_time_axis_group.h" -#include "imageframe_time_axis_view.h" -#include "imageframe_view.h" -#include "imageframe_time_axis.h" -#include "canvas-simplerect.h" -#include "region_selection.h" -#include "public_editor.h" -#include "gui_thread.h" - -#include "i18n.h" - -using namespace ARDOUR; - -PBD::Signal1<void,ImageFrameTimeAxisGroup*> ImageFrameTimeAxisGroup::CatchDeletion; - -//---------------------------------------------------------------------------------------// -// Constructor / Desctructor - -/** - * Constructs a new ImageFrameTimeAxisGroup. - * - * @param iftav the parent ImageFrameTimeAxis of this view helper - * @param group_id the unique name/id of this group - */ -ImageFrameTimeAxisGroup::ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav, const string & group_id) - : _view_helper(iftav), _group_id(group_id) -{ - selected_imageframe_item = 0; - is_selected = false; - - ImageFrameView::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, _1), gui_context()); -} - -/** - * Destructor - * Responsible for destroying any Items that may have been added to this group - * - */ -ImageFrameTimeAxisGroup::~ImageFrameTimeAxisGroup() -{ - // Destroy all the ImageFramViews that we have - for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter) - { - ImageFrameView* ifv = *iter; - - ImageFrameViewList::iterator next = iter; - next++; - - imageframe_views.erase(iter); - - delete ifv; - ifv = 0; - - iter = next; - } - - CatchDeletion; /* EMIT_SIGNAL */ -} - - -//---------------------------------------------------------------------------------------// -// Name/Id Accessors/Mutators - -/** - * Set the name/Id of this group. - * - * @param new_name the new name of this group - * @param src the identity of the object that initiated the change - */ -void -ImageFrameTimeAxisGroup::set_group_name(const string & new_name, void* src) -{ - if(_group_id != new_name) - { - std::string temp_name = _group_id; - _group_id = new_name; - NameChanged(_group_id, temp_name, src); /* EMIT_SIGNAL */ - } -} - -/** - * Returns the id of this group - * The group id must be unique upon a time axis - * - * @return the id of this group - */ -std::string -ImageFrameTimeAxisGroup::get_group_name() const -{ - return(_group_id); -} - - -//---------------------------------------------------------------------------------------// -// ui methods & data - -/** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ -int -ImageFrameTimeAxisGroup::set_item_heights(gdouble h) -{ - /* limit the values to something sane-ish */ - if (h < 10.0 || h > 1000.0) - { - return(-1); - } - - // set the heights of all the imaeg frame views within the group - for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer) - { - (*citer)->set_height(h); - } - - return(0); -} - -/** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ -int -ImageFrameTimeAxisGroup::set_item_samples_per_units(gdouble spp) -{ - if(spp < 1.0) - { - return(-1); - } - - for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer) - { - (*citer)->set_samples_per_unit(spp); - } - - return(0); -} - -/** - * Sets the color of the items contained uopn this view helper - * - * @param color the new base color - */ -void -ImageFrameTimeAxisGroup::apply_item_color(Gdk::Color& color) -{ - region_color = color; - for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); citer++) - { - (*citer)->set_color (region_color); - } -} - - - -//---------------------------------------------------------------------------------------// -// child ImageFrameView methods - -/** - * Adds an ImageFrameView to the list of items upon this time axis view helper - * the new ImageFrameView is returned - * - * @param item_id the unique id of the new item - * @param image_id the id/name of the image data we are usin - * @param start the position the new item should be placed upon the time line - * @param duration the duration the new item should be placed upon the timeline - * @param rgb_data the rgb data of the image - * @param width the original image width of the rgb_data (not the size to display) - * @param height the irigianl height of the rgb_data - * @param num_channels the number of channles within the rgb_data - * @param src the identity of the object that initiated the change - */ -ImageFrameView* -ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, framepos_t start, framecnt_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) -{ - ImageFrameView* ifv = 0; - - //check that there is not already an imageframe with that id - if(get_named_imageframe_item(frame_id) == 0) - { - ifv = new ImageFrameView(frame_id, - _view_helper.canvas_item()->property_parent(), - &(_view_helper.trackview()), - this, - _view_helper.trackview().editor.get_current_zoom(), - region_color, - start, - duration, - rgb_data, - width, - height, - num_channels); - - imageframe_views.push_front(ifv); - ImageFrameAdded(ifv, src); /* EMIT_SIGNAL */ - } - - return(ifv); -} - - -/** - * Returns the named ImageFrameView or 0 if the named view does not exist on this view helper - * - * @param item_id the unique id of the item to search for - * @return the named ImageFrameView, or 0 if it is not held upon this view - */ -ImageFrameView* -ImageFrameTimeAxisGroup::get_named_imageframe_item(const string & frame_id) -{ - ImageFrameView* ifv = 0; - - for (ImageFrameViewList::const_iterator i = imageframe_views.begin(); i != imageframe_views.end(); ++i) - { - if (((ImageFrameView*)*i)->get_item_name() == frame_id) - { - ifv = ((ImageFrameView*)*i); - break; - } - } - return(ifv); -} - -/** - * Removes the currently selected ImageFrameView - * - * @param src the identity of the object that initiated the change - * @todo need to remoev this, the selected item within group is no longer - * used in favour of a time axis selected item - * @see add_imageframe_view - */ -void -ImageFrameTimeAxisGroup::remove_selected_imageframe_item(void* src) -{ - std::string frame_id; - - if(selected_imageframe_item) - { - ImageFrameViewList::iterator i; - - if((i = find(imageframe_views.begin(), imageframe_views.end(), selected_imageframe_item)) != imageframe_views.end()) - { - imageframe_views.erase(i); - frame_id = selected_imageframe_item->get_item_name(); - - // note that we delete the item here - delete(selected_imageframe_item); - selected_imageframe_item = 0; - - std::string track_id = _view_helper.trackview().name(); - ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */ - } - } - else - { - //cerr << "No Selected ImageFrame" << endl; - } -} - - -/** - * Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper - * - * @param item_id the ImageFrameView unique id to remove - * @param src the identity of the object that initiated the change - * @see add_imageframe_view - */ -ImageFrameView* -ImageFrameTimeAxisGroup::remove_named_imageframe_item(const string & frame_id, void* src) -{ - ImageFrameView* removed = 0; - - for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter) - { - ImageFrameView* tempItem = *iter; - if(tempItem->get_item_name() == frame_id) - { - removed = tempItem; - imageframe_views.erase(iter); - - if (removed == selected_imageframe_item) - { - selected_imageframe_item = 0; - } - - std::string track_id = _view_helper.trackview().name(); - ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */ - - // break from the for loop - break; - } - iter++; - } - - return(removed); -} - -/** - * Removes ifv from the list of ImageFrameViews upon this TimeAxis. - * if ifv is not upon this TimeAxis, this method takes no action - * - * @param ifv the ImageFrameView to remove - */ -void -ImageFrameTimeAxisGroup::remove_imageframe_item (ImageFrameView* ifv) -{ - ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisGroup::remove_imageframe_item, ifv, src) - - ImageFrameViewList::iterator i; - - if((i = find (imageframe_views.begin(), imageframe_views.end(), ifv)) != imageframe_views.end()) { - imageframe_views.erase(i); - - std::string frame_id = ifv->get_item_name(); - std::string track_id = _view_helper.trackview().name(); - ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */ - } -} - -//---------------------------------------------------------------------------------------// -// Selected group methods - -/** - * Sets the currently selected item upon this time axis - * - * @param ifv the item to set selected - */ -//void -//ImageFrameTimeAxisGroup::set_selected_imageframe_item(ImageFrameView* ifv) -//{ -// if(selected_imageframe_item) -// { -// selected_imageframe_item->set_selected(false, this); -// } -// -// selected_imageframe_item = ifv; -// -// if(!ifv->get_selected()) -// { -// selected_imageframe_item->set_selected(true, this); -// } -//} - - -/** - * Sets the currently selected item upon this time axis to the named item - * - * @param item_id the name/id of the item to set selected - */ -//void -//ImageFrameTimeAxisGroup::set_selected_imageframe_item(std::string frame_id) -//{ -// selected_imageframe_item = get_named_imageframe_item(frame_id); -//} - - -/** - * Returns the currently selected item upon this time axis - * - * @return the currently selected item pon this time axis - */ -// ImageFrameView* -// ImageFrameTimeAxisGroup::get_selected_imageframe_item() -// { - // return(selected_imageframe_item); -// } - - - -/** - * Returns whether this grou pis currently selected - * - * @returns true if this group is currently selected - */ -bool -ImageFrameTimeAxisGroup::get_selected() const -{ - return(is_selected); -} - - -/** - * Sets he selected state of this group - * - * @param yn set true if this group is selected, false otherwise - */ -void -ImageFrameTimeAxisGroup::set_selected(bool yn) -{ - is_selected = yn; -} - - - -//---------------------------------------------------------------------------------------// -// Handle time axis removal - -/** - * Handles the Removal of this VisualTimeAxis - * This _needs_ to be called to alert others of the removal properly, ie where the source - * of the removal came from. - * - * XXX Although im not too happy about this method of doing things, I cant think of a cleaner method - * just now to capture the source of the removal - * - * @param src the identity of the object that initiated the change - */ -void -ImageFrameTimeAxisGroup::remove_this_group(void* src) -{ - /* - defer to idle loop, otherwise we'll delete this object - while we're still inside this function ... - */ - Glib::signal_idle().connect(sigc::bind(ptr_fun(&ImageFrameTimeAxisGroup::idle_remove_this_group), this, src)); -} - -/** - * Callback used to remove this group during the gtk idle loop - * This is used to avoid deleting the obejct while inside the remove_this_group - * method - * - * @param group the ImageFrameTimeAxisGroup to remove - * @param src the identity of the object that initiated the change - */ -gint -ImageFrameTimeAxisGroup::idle_remove_this_group(ImageFrameTimeAxisGroup* group, void* src) -{ - delete group; - group = 0; - group->GroupRemoved(group->get_group_name(), src); /* EMIT_SIGNAL */ - return(false); -} - diff --git a/gtk2_ardour/imageframe_time_axis_group.h b/gtk2_ardour/imageframe_time_axis_group.h deleted file mode 100644 index c1ec26e912..0000000000 --- a/gtk2_ardour/imageframe_time_axis_group.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_imageframe_time_axis_group_h__ -#define __ardour_imageframe_time_axis_group_h__ - -#include <list> -#include <cmath> - -#include <gdkmm/color.h> - -#include <libgnomecanvas/libgnomecanvas.h> -#include <jack/jack.h> -#include "ardour/types.h" -#include "imageframe_time_axis_view.h" - -class PublicEditor ; -class ImageFrameView ; - -/** - * ImageFrameTimeAxisGroup defines a group/scene of ImageFrame view that can appear upon a time axis - * At the moment this is a bit bare, we really want to add some kind of time constraints upon - * items atht are added to the group, ie bounded by the start and end of the scene, which itself - * needs fleshed out. - * A viewable object may also be useful... - * - */ -class ImageFrameTimeAxisGroup : public sigc::trackable -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new ImageFrameTimeAxisGroup. - * - * @param iftav the parent ImageFrameTimeAxis of this view helper - * @param group_id the unique name/id of this group - */ - ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav, const std::string & group_id) ; - - /** - * Destructor - * Responsible for destroying any Items that may have been added to this group - * - */ - virtual ~ImageFrameTimeAxisGroup() ; - - - //---------------------------------------------------------------------------------------// - // Name/Id Accessors/Mutators - - /** - * Set the name/Id of this group. - * - * @param new_name the new name of this group - * @param src the identity of the object that initiated the change - */ - void set_group_name(const std::string & new_name, void* src) ; - - /** - * Returns the id of this group - * The group id must be unique upon a time axis - * - * @return the id of this group - */ - std::string get_group_name() const ; - - - //---------------------------------------------------------------------------------------// - // Parent/Child helper object accessors - - /** - * Returns the TimeAxisView thatt his object is acting as a helper for - * - * @return the TimeAxisView that this object is acting as a view helper for - */ - ImageFrameTimeAxisView& get_view() const { return _view_helper ; } - - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ - int set_item_heights(gdouble) ; - - /** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ - int set_item_samples_per_units(gdouble spu) ; - - /** - * Sets the color of the items contained uopn this view helper - * - * @param color the new base color - */ - void apply_item_color(Gdk::Color&) ; - - - //---------------------------------------------------------------------------------------// - // child ImageFrameView methods - - /** - * Adds an ImageFrameView to the list of items upon this time axis view helper - * the new ImageFrameView is returned - * - * @param item_id the unique id of the new item - * @param image_id the id/name of the image data we are usin - * @param start the position the new item should be placed upon the time line - * @param duration the duration the new item should be placed upon the timeline - * @param rgb_data the rgb data of the image - * @param width the original image width of the rgb_data (not the size to display) - * @param height the irigianl height of the rgb_data - * @param num_channels the number of channles within the rgb_data - * @param src the identity of the object that initiated the change - */ - ImageFrameView* add_imageframe_item(const std::string & item_id, nframes_t start, nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) ; - - /** - * Returns the named ImageFrameView or 0 if the named view does not exist on this view helper - * - * @param item_id the unique id of the item to search for - * @return the named ImageFrameView, or 0 if it is not held upon this view - */ - ImageFrameView* get_named_imageframe_item(const std::string & item_id) ; - - /** - * Removes the currently selected ImageFrameView - * - * @param src the identity of the object that initiated the change - * @see add_imageframe_view - */ - void remove_selected_imageframe_item(void* src) ; - - /** - * Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper - * - * @param item_id the ImageFrameView unique id to remove - * @param src the identity of the object that initiated the change - * @see add_imageframe_view - */ - ImageFrameView* remove_named_imageframe_item(const std::string & item_id, void* src) ; - - /** - * Removes ifv from the list of ImageFrameViews upon this TimeAxis. - * if ifv is not upon this TimeAxis, this method takes no action - * - * @param ifv the ImageFrameView to remove - */ - void remove_imageframe_item(ImageFrameView*, void* src) ; - - - //---------------------------------------------------------------------------------------// - // Selected group methods - - - // removed in favour of a track level selectewd item - // this is simply easier to manage a singularly selected item, rather than - // a selected item within each group - - /** - * Sets the currently selected item upon this time axis - * - * @param ifv the item to set selected - */ - //void set_selected_imageframe_item(ImageFrameView* ifv) ; - - /** - * Sets the currently selected item upon this time axis to the named item - * - * @param item_id the name/id of the item to set selected - */ - //void set_selected_imageframe_item(std::string item_id) ; - - /** - * Returns the currently selected item upon this time axis - * - * @return the currently selected item pon this time axis - */ - //ImageFrameView* get_selected_imageframe_item() ; - - /** - * Returns whether this grou pis currently selected - * - * @returns true if this group is currently selected - */ - bool get_selected() const ; - - /** - * Sets he selected state of this group - * - * @param yn set true if this group is selected, false otherwise - */ - void set_selected(bool yn) ; - - //---------------------------------------------------------------------------------------// - // Handle group removal - - /** - * Handles the Removal of this VisualTimeAxis - * This _needs_ to be called to alert others of the removal properly, ie where the source - * of the removal came from. - * - * XXX Although im not too happy about this method of doing things, I cant think of a cleaner method - * just now to capture the source of the removal - * - * @param src the identity of the object that initiated the change - */ - virtual void remove_this_group(void* src) ; - - //---------------------------------------------------------------------------------// - // Emitted Signals - - static sigc::signal<void,ImageFrameTimeAxisGroup*> CatchDeletion; - - /** - * Emitted when this Group has been removed - * This is different to the CatchDeletion signal in that this signal - * is emitted during the deletion of this Time Axis, and not during - * the destructor, this allows us to capture the source of the deletion - * event - */ - sigc::signal<void,std::string,void*> GroupRemoved ; - - /** Emitted when we have changed the name of this TimeAxis */ - sigc::signal<void,std::string,std::string,void*> NameChanged ; - - /** Emitted when an ImageFrameView is added to this group */ - sigc::signal<void, ImageFrameView*, void*> ImageFrameAdded ; - - /** Emitted when an ImageFrameView is removed from this group */ - sigc::signal<void, const std::string &, const std::string &, const std::string &, void*> ImageFrameRemoved ; - - protected: - - - private: - /** - * convenience method to re-get the samples per unit and tell items upon this view - * - */ - void reset_samples_per_unit() ; - - /** - * Callback used to remove this group during the gtk idle loop - * This is used to avoid deleting the obejct while inside the remove_this_group - * method - * - * @param group the ImageFrameTimeAxisGroup to remove - * @param src the identity of the object that initiated the change - */ - static gint idle_remove_this_group(ImageFrameTimeAxisGroup* group, void* src) ; - - /** The list of ImageFrameViews held by this view helper */ - typedef std::list<ImageFrameView *> ImageFrameViewList ; - ImageFrameViewList imageframe_views ; - - /** the currently selected time axis item upon this time axis */ - ImageFrameView* selected_imageframe_item ; - - /** the view helper that this object is acting as a container upon on */ - ImageFrameTimeAxisView& _view_helper ; - - /** the is of this group */ - std::string _group_id ; - - /* XXX why are these different? */ - Gdk::Color region_color ; - uint32_t stream_base_color ; - - /** indicates if this group is currently selected */ - bool is_selected ; - -} ; /* class ImageFrameTimeAxisGroup */ - -#endif /* __ardour_imageframe_time_axis_group_h__ */ diff --git a/gtk2_ardour/imageframe_time_axis_view.cc b/gtk2_ardour/imageframe_time_axis_view.cc deleted file mode 100644 index 8df7a91612..0000000000 --- a/gtk2_ardour/imageframe_time_axis_view.cc +++ /dev/null @@ -1,437 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <algorithm> - -#include <gtkmm.h> - -#include <gtkmm2ext/gtk_ui.h> - -#include "imageframe_time_axis_view.h" -#include "imageframe_time_axis_group.h" -#include "imageframe_view.h" -#include "imageframe_time_axis.h" -#include "canvas-simplerect.h" -#include "region_selection.h" -#include "public_editor.h" -#include "rgb_macros.h" -#include "gui_thread.h" -#include "ardour_ui.h" - -#include "i18n.h" - -using namespace ARDOUR ; -using namespace Editing; - -//---------------------------------------------------------------------------------------// -// Constructor / Desctructor - -/** - * Constructs a new ImageFrameTimeAxisView. - * - * @param ifta the parent ImageFrameTimeAxis of this view helper - */ -ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv) - : _trackview (tv), - canvas_group (*_trackview.canvas_display), - canvas_rect (canvas_group, 0.0, 0.0, 1000000.0, tv.current_height()) -{ - region_color = _trackview.color() ; - stream_base_color = ARDOUR_UI::config()->canvasvar_ImageTrack.get() ; - - canvas_rect.property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ImageTrack.get(); - canvas_rect.property_fill_color_rgba() = stream_base_color; - - canvas_rect.signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_imageframe_view_event), (ArdourCanvas::Item*) &canvas_rect, &tv)); - - _samples_per_unit = _trackview.editor.get_current_zoom() ; - - _trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &ImageFrameTimeAxisView::reset_samples_per_unit)) ; - - selected_imageframe_group = 0 ; - selected_imageframe_view = 0 ; - - ImageFrameTimeAxisGroup::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, _1), gui_context()); -} - -/** - * Destructor - * Responsible for destroying all items tat may have been added to this time axis - */ -ImageFrameTimeAxisView::~ImageFrameTimeAxisView() -{ - // Destroy all the ImageFrameGroups that we have - - for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter) - { - ImageFrameTimeAxisGroup* iftag = (*iter) ; - - ImageFrameGroupList::iterator next = iter ; - next++ ; - - // remove the front element - imageframe_groups.erase(iter) ; - - delete iftag ; - iftag = 0 ; - - iter = next ; - } - -} - - -//---------------------------------------------------------------------------------------// -// ui methods & data - -/** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ -int -ImageFrameTimeAxisView::set_height (gdouble h) -{ - /* limit the values to something sane-ish */ - if (h < 10.0 || h > 1000.0) { - return(-1) ; - } - - canvas_rect.property_y2() = h ; - - - for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer) - { - (*citer)->set_item_heights(h) ; - } - - return(0) ; -} - -/** - * Sets the position of this view helper on the canvas - * - * @param x the x position upon the canvas - * @param y the y position npon the canvas - */ -int -ImageFrameTimeAxisView::set_position (gdouble x, gdouble y) - -{ - canvas_group.property_x() = x; - canvas_group.property_y() = y; - - return 0; -} - -/** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ -int -ImageFrameTimeAxisView::set_samples_per_unit (gdouble spp) -{ - if (spp < 1.0) { - return(-1) ; - } - - _samples_per_unit = spp; - - for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer) - { - (*citer)->set_item_samples_per_units(spp) ; - } - - return(0) ; -} - -/** - * Sets the color of the items contained uopn this view helper - * - * @param color the new base color - */ -void -ImageFrameTimeAxisView::apply_color(Gdk::Color& color) -{ - region_color = color ; - for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); citer++) - { - (*citer)->apply_item_color(region_color) ; - } -} - - -/** - * convenience method to re-get the samples per unit and tell items upon this view - * - */ -void -ImageFrameTimeAxisView::reset_samples_per_unit () -{ - set_samples_per_unit (_trackview.editor.get_current_zoom()); -} - - -//---------------------------------------------------------------------------------------// -// Child ImageFrameTimeAxisGroup Accessors/Mutators - -/** - * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper - * the new ImageFrameTimeAxisGroup is returned - * - * @param group_id the unique id of the new group - * @param src the identity of the object that initiated the change - */ -ImageFrameTimeAxisGroup* -ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src) -{ - ImageFrameTimeAxisGroup* iftag = 0 ; - - //check that there is not already a group with that id - if(get_named_imageframe_group(group_id) != 0) - { - // iftag = 0 ; - } - else - { - iftag = new ImageFrameTimeAxisGroup(*this, group_id) ; - imageframe_groups.push_front(iftag) ; - ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */ - } - - return(iftag) ; -} - -/** - * Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper - * - * @param group_id the unique id of the group to search for - * @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view - */ -ImageFrameTimeAxisGroup* -ImageFrameTimeAxisView::get_named_imageframe_group(std::string group_id) -{ - ImageFrameTimeAxisGroup* iftag = 0 ; - - for(ImageFrameGroupList::iterator i = imageframe_groups.begin(); i != imageframe_groups.end(); ++i) - { - if (((ImageFrameTimeAxisGroup*)*i)->get_group_name() == group_id) - { - iftag = ((ImageFrameTimeAxisGroup*)*i) ; - break ; - } - } - - return(iftag) ; -} - - -/** - * Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper - * - * @param group_id the ImageFrameTimeAxisGroup unique id to remove - * @param src the identity of the object that initiated the change - * @see add_imageframe_group - */ -ImageFrameTimeAxisGroup* -ImageFrameTimeAxisView::remove_named_imageframe_group(std::string group_id, void* src) -{ - ImageFrameTimeAxisGroup* removed = 0 ; - - for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter) - { - if(((ImageFrameTimeAxisGroup*)*iter)->get_group_name() == group_id) - { - removed = (*iter) ; - imageframe_groups.erase(iter) ; - - if(removed == selected_imageframe_group) - { - selected_imageframe_group = 0 ; - } - - ImageFrameGroupRemoved(removed->get_group_name(), src) ; /* EMIT_SIGNAL */ - - // break from the for loop - break ; - } - iter++ ; - } - - return(removed) ; -} - - -/** - * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis. - * - * @param iftag the ImageFrameView to remove - */ -void -ImageFrameTimeAxisView::remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) -{ - ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisView::remove_imageframe_group, iftag, src) - - ImageFrameGroupList::iterator i; - if((i = find (imageframe_groups.begin(), imageframe_groups.end(), iftag)) != imageframe_groups.end()) - { - imageframe_groups.erase(i) ; - - ImageFrameGroupRemoved(iftag->get_group_name(), src) ; /* EMIT_SIGNAL */ - } -} - - - - -//---------------------------------------------------------------------------------------// -// Selected group methods - -/** - * Sets the currently selected group upon this time axis - * - * @param ifv the item to set selected - */ -void -ImageFrameTimeAxisView::set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) -{ - if(selected_imageframe_group) - { - selected_imageframe_group->set_selected(false) ; - } - - selected_imageframe_group = iftag ; - selected_imageframe_group->set_selected(true) ; -} - -/** - * Clears the currently selected image frame group unpo this time axis - * -*/ -void -ImageFrameTimeAxisView::clear_selected_imageframe_group() -{ - if(selected_imageframe_group) - { - selected_imageframe_group->set_selected(false) ; - } - selected_imageframe_group = 0 ; -} - -/** - * Returns the currently selected group upon this time axis - * - * @return the currently selected group upon this time axis - */ -ImageFrameTimeAxisGroup* -ImageFrameTimeAxisView::get_selected_imageframe_group() const -{ - return(selected_imageframe_group) ; -} - -//---------------------------------------------------------------------------------------// -// Selected item methods - -/** - * Sets the currently selected imag frame view item - * - * @param iftag the group the selected item is part - * @param ifv the selected item - */ -void -ImageFrameTimeAxisView::set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) -{ - set_selected_imageframe_group(iftag) ; - - if(selected_imageframe_view) - { - selected_imageframe_view->set_selected(false) ; - } - - selected_imageframe_view = ifv ; - selected_imageframe_view->set_selected(true) ; -} - -/** - * Clears the currently selected image frame view item - * - */ -void -ImageFrameTimeAxisView::clear_selected_imageframe_item(bool clear_group) -{ - if(clear_group) - { - clear_selected_imageframe_group() ; - } - - if(selected_imageframe_view) - { - selected_imageframe_view->set_selected(false) ; - } - selected_imageframe_view = 0 ; -} - -/** - * Returns the currently selected image frame view item upon this time axis - * - * @return the currently selected image frame view item - */ -ImageFrameView* -ImageFrameTimeAxisView::get_selected_imageframe_view() const -{ - return(selected_imageframe_view) ; -} - - - - -void -ImageFrameTimeAxisView::set_imageframe_duration_sec(double sec) -{ - if (selected_imageframe_group && selected_imageframe_view) { - selected_imageframe_view->set_duration ((sec * _trackview.editor.session()->frame_rate()), this); - } -} - - - -/** - * Removes the currently selected ImageFrame view item - * - * @param src the identity of the object that initiated the change - * @see add_imageframe_group - */ -void -ImageFrameTimeAxisView::remove_selected_imageframe_item(void* src) -{ - if(selected_imageframe_group && selected_imageframe_view) - { - ImageFrameView* temp_item = selected_imageframe_view ; - selected_imageframe_group->remove_imageframe_item(temp_item, src) ; - - // XXX although we have removed the item from the group, we need the group id still set within the - // item as the remove method requires this data when telling others about the deletion - // to fully specify the item we need the track, group and item id - selected_imageframe_view->remove_this_item(src) ; - clear_selected_imageframe_item(false) ; - } -} - diff --git a/gtk2_ardour/imageframe_time_axis_view.h b/gtk2_ardour/imageframe_time_axis_view.h deleted file mode 100644 index 1191068c1d..0000000000 --- a/gtk2_ardour/imageframe_time_axis_view.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_imageframe_time_axis_view_h__ -#define __ardour_imageframe_time_axis_view_h__ - -#include <list> -#include <cmath> - -#include <gdkmm/color.h> - -#include <jack/jack.h> - -#include <libgnomecanvasmm.h> -#include "canvas.h" -#include "simplerect.h" - - -class PublicEditor ; -class ImageFrameTimeAxis ; -class ImageFrameView ; -class ImageFrameTimeAxisGroup ; - -/** - * ImageFrameTimeAxisView defines the time axis view helper - * This object is responsible for the time axis canvas view, and - * maintains the list of items that have been added to it - * - */ -class ImageFrameTimeAxisView : public sigc::trackable -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new ImageFrameTimeAxisView. - * - * @param ifta the parent ImageFrameTimeAxis of this view helper - */ - ImageFrameTimeAxisView(ImageFrameTimeAxis& ifta) ; - - /** - * Destructor - * Responsible for destroying all items tat may have been added to this time axis - */ - ~ImageFrameTimeAxisView () ; - - //---------------------------------------------------------------------------------------// - // Parent/Child helper object accessors - - /** - * Returns the TimeAxisView thatt his object is acting as a helper for - * - * @return the TimeAxisView that this object is acting as a view helper for - */ - ImageFrameTimeAxis& trackview() { return _trackview; } - - /** - * - */ - ArdourCanvas::Group * canvas_item() { return &canvas_group; } - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ - int set_height(gdouble) ; - - /** - * Sets the position of this view helper on the canvas - * - * @param x the x position upon the canvas - * @param y the y position upon the canvas - */ - int set_position(gdouble x, gdouble y) ; - - /** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ - int set_samples_per_unit(gdouble spu) ; - - /** - * Returns the current samples per unit of this time axis view helper - * - * @return the current samples per unit of this time axis view helper - */ - gdouble get_samples_per_unit() { return _samples_per_unit; } - - /** - * Sets the color of the items contained uopn this view helper - * - * @param color the new base color - */ - void apply_color (Gdk::Color&) ; - - //---------------------------------------------------------------------------------------// - // Child ImageFrameTimeAxisGroup Accessors/Mutators - - /** - * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper - * the new ImageFrameTimeAxisGroup is returned - * - * @param group_id the unique id of the new group - * @param src the identity of the object that initiated the change - */ - ImageFrameTimeAxisGroup* add_imageframe_group(std::string group_id, void* src) ; - - /** - * Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper - * - * @param group_id the unique id of the group to search for - * @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view - */ - ImageFrameTimeAxisGroup* get_named_imageframe_group(std::string group_id) ; - - /** - * Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper - * - * @param group_id the ImageFrameTimeAxisGroup unique id to remove - * @param src the identity of the object that initiated the change - * @see add_imageframe_group - */ - ImageFrameTimeAxisGroup* remove_named_imageframe_group(std::string group_id, void* src) ; - - /** - * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis. - * - * @param iftag the ImageFrameView to remove - */ - void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ; - - - //---------------------------------------------------------------------------------------// - // Selected group methods - - /** - * Sets the currently selected group upon this time axis - * - * @param ifv the item to set selected - */ - void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ; - - /** - * Clears the currently selected image frame group unpo this time axis - * - */ - void clear_selected_imageframe_group() ; - - /** - * Returns the currently selected group upon this time axis - * - * @return the currently selected group upon this time axis - */ - ImageFrameTimeAxisGroup* get_selected_imageframe_group() const ; - - - /** - * Sets the duration of the selected ImageFrameView to the specified number of seconds - * - * @param sec the duration to set the ImageFrameView to, in seconds - */ - void set_imageframe_duration_sec(double sec) ; - - //---------------------------------------------------------------------------------------// - // Selected item methods - - /** - * Sets the currently selected image frame view item - * - * @param iftag the group the selected item is part - * @param ifv the selected item - */ - void set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) ; - - /** - * Clears the currently selected image frame view item - * - * @param clear_group set true if the selected parent group of the item should be cleared also - */ - void clear_selected_imageframe_item(bool clear_group) ; - - /** - * Returns the currently selected image frame view item upon this time axis - * - * @return the currently selected image frame view item - */ - ImageFrameView* get_selected_imageframe_view() const ; - - - - /** - * Removes the currently selected ImageFrameTimeAxisGroup - * - * @param src the identity of the object that initiated the change - * @see add_imageframe_group - */ - void remove_selected_imageframe_item(void* src) ; - - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted when and ImageFrameGroup is added to this time axis */ - sigc::signal<void,ImageFrameTimeAxisGroup*,void*> ImageFrameGroupAdded ; - - /** Emitted when an ImageFrameGroup is removed from this time axis */ - sigc::signal<void,std::string,void*> ImageFrameGroupRemoved ; - - protected: - - - private: - /** - * convenience method to re-get the samples per unit and tell items upon this view - * - */ - void reset_samples_per_unit() ; - - /** - * The list of ImageFrameViews held by this view helper */ - typedef std::list<ImageFrameTimeAxisGroup *> ImageFrameGroupList ; - ImageFrameGroupList imageframe_groups ; - - /** the currently selected time axis item upon this time axis */ - ImageFrameTimeAxisGroup* selected_imageframe_group ; - - /** - * thecurrently selected image frame view - * we keep this here so that we only have one per view, not one per group - */ - ImageFrameView* selected_imageframe_view ; - - - - /* the TimeAxisView that this object is acting as the view helper for */ - ImageFrameTimeAxis& _trackview ; - - ArdourCanvas::Group canvas_group ; - ArdourCanvas::SimpleRect canvas_rect; /* frame around the whole thing */ - - /** the current samples per unit */ - double _samples_per_unit ; - - /* XXX why are these different? */ - Gdk::Color region_color ; - uint32_t stream_base_color ; - -} ; /* class ImageFrameTimeAxisView */ - -#endif /* __ardour_imageframe_time_axis_view_h__ */ diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc deleted file mode 100644 index 9b9a8c2bdb..0000000000 --- a/gtk2_ardour/imageframe_view.cc +++ /dev/null @@ -1,371 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <algorithm> -#include <cmath> - -#include <gtkmm.h> -#include <gtkmm2ext/gtk_ui.h> - -#include "imageframe_time_axis.h" -#include "imageframe_time_axis_group.h" -#include "marker_time_axis.h" -#include "marker_time_axis_view.h" -#include "public_editor.h" -#include "utils.h" -#include "imageframe_view.h" -#include "imageframe.h" -#include "canvas_impl.h" -#include "gui_thread.h" - -using namespace ARDOUR; -using namespace Gtk; - -sigc::signal<void,ImageFrameView*> ImageFrameView::GoingAway; - -/** - * Constructs a new ImageFrameView upon the canvas - * - * @param item_id unique id of this item - * @param parent the parent canvas item - * @param tv the time axis view that this item is to be placed upon - * @param group the ImageFrameGroup that this item is a member of - * @param spu the current samples per canvas unit - * @param start the start frame ogf this item - * @param duration the duration of this item - * @param rgb_data the rgb data of the image - * @param width the width of the original rgb_data image data - * @param height the width of the origianl rgb_data image data - * @param num_channels the number of color channels within rgb_data - */ -ImageFrameView::ImageFrameView(const string & item_id, - ArdourCanvas::Group *parent, - ImageFrameTimeAxis* tv, - ImageFrameTimeAxisGroup* item_group, - double spu, - Gdk::Color& basic_color, - framepos_t start, - framecnt_t duration, - unsigned char* rgb_data, - uint32_t width, - uint32_t height, - uint32_t num_channels) - : TimeAxisViewItem(item_id, *parent, *tv, spu, basic_color, start, duration, - TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText| - TimeAxisViewItem::ShowNameHighlight| - TimeAxisViewItem::ShowFrame| - TimeAxisViewItem::ShowHandles)) - -{ - the_parent_group = item_group; - set_name_text(item_id); - - image_data_width = width; - image_data_height = height; - image_data_num_channels = num_channels; - - //This should be art_free'd once the ArtPixBuf is destroyed - this should happen when we destroy the imageframe canvas item - unsigned char* the_rgb_data = (unsigned char*) art_alloc(width*height*num_channels); - memcpy(the_rgb_data, rgb_data, (width*height*num_channels)); - - ArtPixBuf* pbuf; - pbuf = art_pixbuf_new_rgba(the_rgb_data, width, height, (num_channels * width)); - imageframe = 0; - - //calculate our image width based on the track height - double im_ratio = (double)width/(double)height; - double im_width = ((double)(trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) * im_ratio); - - imageframe = new ImageFrame (*group, pbuf, 1.0, 1.0, ANCHOR_NW, im_width, (trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE)); - - frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_start_handle_event), frame_handle_start, this)); - frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_end_handle_event), frame_handle_end, this)); - group->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_item_view_event), imageframe, this)); - - frame_handle_start->raise_to_top(); - frame_handle_end->raise_to_top(); - - set_position(start, this); - set_duration(duration, this); - - MarkerView::CatchDeletion.connect (*this, boost::bind (&ImageFrameView::remove_marker_view_item, this, _1), gui_context()); -} - -/** - * Destructor - * Reposible for removing and destroying all marker items associated with this item - */ -ImageFrameView::~ImageFrameView() -{ - CatchDeletion (this); - - // destroy any marker items we have associated with this item - - for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) - { - MarkerView* mv = (*iter); - - MarkerViewList::iterator next = iter; - next++; - - // remove the item from our marker list - // the current iterator becomes invalid after this point, so we cannot call next upon it - // luckily enough, we already have next - marker_view_list.erase(iter); - - // remove the item from the marker time axis - MarkerTimeAxisView* mtav = dynamic_cast<MarkerTimeAxis*>(&mv->get_time_axis_view())->get_view(); - if(mtav) - { - mtav->remove_marker_view(mv, this); - } - - mv->set_marked_item(0); - delete mv; - mv = 0; - - // set our iterator to next, as we have invalided the current iterator with the call to erase - iter = next; - } - - // if we are the currently selected item withi the parent track, we need to se-select - if(the_parent_group) - { - if(the_parent_group->get_view().get_selected_imageframe_view() == this) - { - the_parent_group->get_view().clear_selected_imageframe_item(false); - } - } - - delete imageframe; - imageframe = 0; -} - - -//---------------------------------------------------------------------------------------// -// Position and duration Accessors/Mutators - -/** - * Set the position of this item to the specified value - * - * @param pos the new position - * @param src the identity of the object that initiated the change - * @return true if the position change was a success, false otherwise - */ -bool -ImageFrameView::set_position(framepos_t pos, void* src, double* delta) -{ - framepos_t old_pos = frame_position; - - // do the standard stuff - bool ret = TimeAxisViewItem::set_position(pos, src, delta); - - // everything went ok with the standard stuff? - if (ret) { - /* move each of our associated markers with this ImageFrameView */ - for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) - { - // calculate the offset of the marker - MarkerView* mv = (MarkerView*)*i; - framepos_t marker_old_pos = mv->get_position(); - - mv->set_position(pos + (marker_old_pos - old_pos), src); - } - } - - return(ret); -} - -/** - * Sets the duration of this item - * - * @param dur the new duration of this item - * @param src the identity of the object that initiated the change - * @return true if the duration change was succesful, false otherwise - */ -bool -ImageFrameView::set_duration(framepos_t dur, void* src) -{ - /* do the standard stuff */ - bool ret = TimeAxisViewItem::set_duration(dur, src); - - // eveything went ok with the standard stuff? - if(ret) - { - /* handle setting the sizes of our canvas itesm based on the new duration */ - imageframe->property_drawwidth() = trackview.editor.frame_to_pixel(get_duration()); - } - - return(ret); -} - -//---------------------------------------------------------------------------------------// -// Parent Component Methods - -/** - * Sets the parent ImageFrameTimeAxisGroup of thie item - * each Item must be part of exactly one group (or 'scene') upon the timeline - * - * @param group the new parent group - */ -void -ImageFrameView::set_time_axis_group(ImageFrameTimeAxisGroup* group) -{ - the_parent_group = group; -} - -/** - * Returns the parent group of this item - * - * @return the parent group of this item - */ -ImageFrameTimeAxisGroup* -ImageFrameView::get_time_axis_group() -{ - return(the_parent_group); -} - - -//---------------------------------------------------------------------------------------// -// ui methods - -/** - * Set the height of this item - * - * @param h the new height - */ -void -ImageFrameView::set_height (gdouble h) -{ - // set the image size - // @todo might have to re-get the image data, for a large height...hmmm. - double im_ratio = (double)image_data_width/(double)image_data_height; - - imageframe->property_width() = (h - TimeAxisViewItem::NAME_Y_OFFSET) * im_ratio; - imageframe->property_height() = h - TimeAxisViewItem::NAME_Y_OFFSET; - - frame->raise_to_top(); - imageframe->raise_to_top(); - name_highlight->raise_to_top(); - name_pixbuf->raise_to_top(); - frame_handle_start->raise_to_top(); - frame_handle_end->raise_to_top(); - - name_pixbuf->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET; - frame->property_y2() = h; - - name_highlight->property_y1() = (gdouble) h - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; - name_highlight->property_y2() = (gdouble) h - 1.0; -} - - -//---------------------------------------------------------------------------------------// -// MarkerView methods - -/** - * Adds a markerView to the list of marker views associated with this item - * - * @param item the marker item to add - * @param src the identity of the object that initiated the change - */ -void -ImageFrameView::add_marker_view_item(MarkerView* item, void* src) -{ - marker_view_list.push_back(item); - MarkerViewAdded(item, src); /* EMIT_SIGNAL */ -} - -/** - * Removes the named marker view from the list of marker view associated with this item - * The Marker view is not destroyed on removal, so the caller must handle the item themself - * - * @param markId the id/name of the item to remove - * @param src the identity of the object that initiated the change - * @return the removed marker item - */ -MarkerView* -ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src) -{ - MarkerView* mv = 0; - MarkerViewList::iterator i = marker_view_list.begin(); - - while(i != marker_view_list.end()) - { - if (((MarkerView*)*i)->get_item_name() == markerId) - { - mv = (*i); - - marker_view_list.erase(i); - - MarkerViewRemoved(mv,src); /* EMIT_SIGNAL */ - - // iterator is now invalid, but since we should only ever have - // one item with the specified name, things are ok, and we can - // break from the while loop - break; - } - i++; - } - - return(mv); -} - -/** - * Removes item from the list of marker views assocaited with this item - * This method will do nothing if item if not assiciated with this item - * - * @param item the item to remove - * @param src the identity of the object that initiated the change - */ -void -ImageFrameView::remove_marker_view_item (MarkerView* mv) -{ - ENSURE_GUI_THREAD (*this, &ImageFrameView::remove_marker_view_item, mv, src) - - MarkerViewList::iterator i; - - if ((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) { - marker_view_list.erase(i); - MarkerViewRemoved (mv, src); /* EMIT_SIGNAL */ - } -} - -/** - * Determines if the named marker is one of those associated with this item - * - * @param markId the id/name of the item to search for - */ -bool -ImageFrameView::has_marker_view_item(const string & mname) -{ - bool result = false; - - for (MarkerViewList::const_iterator ci = marker_view_list.begin(); ci != marker_view_list.end(); ++ci) - { - if (((MarkerView*)*ci)->get_item_name() == mname) - { - result = true; - - // found the item, so we can break the for loop - break; - } - } - - return(result); -} diff --git a/gtk2_ardour/imageframe_view.h b/gtk2_ardour/imageframe_view.h deleted file mode 100644 index 49b29038c4..0000000000 --- a/gtk2_ardour/imageframe_view.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __gtk_ardour_imageframe_view_h__ -#define __gtk_ardour_imageframe_view_h__ - -#include <string> -#include <gdkmm/color.h> -#include <libgnomecanvas/libgnomecanvas.h> -#include <sigc++/signal.h> -#include <list> - -#include "canvas.h" -#include "enums.h" -#include "time_axis_view_item.h" -#include "marker_view.h" - -class ImageFrameTimeAxis; -class ImageFrameTimeAxisGroup ; - -/** - * An ImageFrameItem to display an image upon the ardour time line - * - */ -class ImageFrameView : public TimeAxisViewItem -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new ImageFrameView upon the canvas - * - * @param item_id unique id of this item - * @param parent the parent canvas item - * @param tv the time axis view that this item is to be placed upon - * @param group the ImageFrameGroup that this item is a member of - * @param spu the current samples per canvas unit - * @param start the start frame ogf this item - * @param duration the duration of this item - * @param rgb_data the rgb data of the image - * @param width the width of the original rgb_data image data - * @param height the width of the origianl rgb_data image data - * @param num_channels the number of color channels within rgb_data - */ - ImageFrameView(const std::string & item_id, - ArdourCanvas::Group *parent, - ImageFrameTimeAxis *tv, - ImageFrameTimeAxisGroup* group, - double spu, - Gdk::Color& base_color, - framepos_t start, - framecnt_t duration, - unsigned char* rgb_data, - uint32_t width, - uint32_t height, - uint32_t num_channels) ; - - /** - * Destructor - * Reposible for removing and destroying all marker items associated with this item - */ - ~ImageFrameView() ; - - static PBD::Signal1<void,ImageFrameView*> CatchDeletion; - - //---------------------------------------------------------------------------------------// - // Position and duration Accessors/Mutators - - /** - * Set the position of this item to the specified value - * - * @param pos the new position - * @param src the identity of the object that initiated the change - * @return true if the position change was a success, false otherwise - */ - virtual bool set_position(framepos_t pos, void* src, double* delta = 0) ; - - /** - * Sets the duration of this item - * - * @param dur the new duration of this item - * @param src the identity of the object that initiated the change - * @return true if the duration change was succesful, false otherwise - */ - virtual bool set_duration(framepos_t dur, void* src) ; - - //---------------------------------------------------------------------------------------// - // Parent Component Methods - - /** - * Sets the parent ImageFrameTimeAxisGroup of thie item - * each Item must be part of exactly one group (or 'scene') upon the timeline - * - * @param group the new parent group - */ - void set_time_axis_group(ImageFrameTimeAxisGroup* group) ; - - /** - * Returns the parent group of this item - * - * @return the parent group of this item - */ - ImageFrameTimeAxisGroup* get_time_axis_group() ; - - //---------------------------------------------------------------------------------------// - // ui methods - - /** - * Set the height of this item - * - * @param h the new height - */ - virtual void set_height(gdouble h) ; - - - //---------------------------------------------------------------------------------------// - // MarkerView methods - - /** - * Adds a markerView to the list of marker views associated with this item - * - * @param item the marker item to add - * @param src the identity of the object that initiated the change - */ - void add_marker_view_item(MarkerView* item, void* src) ; - - /** - * Removes the named marker view from the list of marker view associated with this item - * The Marker view is not destroyed on removal, so the caller must handle the item themself - * - * @param markId the id/name of the item to remove - * @param src the identity of the object that initiated the change - * @return the removed marker item - */ - MarkerView* remove_named_marker_view_item(const std::string & markId, void* src) ; - - /** - * Removes item from the list of marker views assocaited with this item - * This method will do nothing if item if not assiciated with this item - * The Marker view is not destroyed on removal, so the caller must handle the item themself - * - * @param item the item to remove - * @param src the identity of the object that initiated the change - */ - void remove_marker_view_item(MarkerView* item, void* src) ; - - /** - * Determines if the named marker is one of those associated with this item - * - * @param markId the id/name of the item to search for - */ - bool has_marker_view_item(const std::string & markId) ; - - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted when a marker Item is added to this Item */ - sigc::signal<void,MarkerView*,void*> MarkerViewAdded ; - - /** Emitted when a Marker Item is added to this Item */ - sigc::signal<void,MarkerView*,void*> MarkerViewRemoved ; - - private: - /** the list of MarkerViews associated with this item */ - typedef std::list<MarkerView*> MarkerViewList ; - MarkerViewList marker_view_list ; - - - /** The parent group that this item is a member of */ - ImageFrameTimeAxisGroup* the_parent_group ; - - // ------- Image data ----------- - - /** the image data that we display */ - //unsigned char* the_rgb_data ; - - /** The width of the image contained within the_rgb_data */ - uint32_t image_data_width ; - - /** The height of the image contained within the_rgb_data */ - uint32_t image_data_height ; - - /** the number of channels contained in the_rgb_data */ - uint32_t image_data_num_channels ; - - - // ------- Our canvas element ----------- - - /** the CanvasImageFrame to display the image */ - ArdourCanvas::ImageFrame* imageframe ; - -} ; /* class ImageFrameView */ - -#endif /* __gtk_ardour_imageframe_view_h__ */ diff --git a/gtk2_ardour/marker_time_axis.cc b/gtk2_ardour/marker_time_axis.cc deleted file mode 100644 index dd827b4c3c..0000000000 --- a/gtk2_ardour/marker_time_axis.cc +++ /dev/null @@ -1,281 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <string> - -#include "pbd/error.h" - -#include <gtkmm/menu.h> - -#include <gtkmm2ext/utils.h> - -#include "ardour/session.h" -#include "ardour/utils.h" - -#include "ardour_ui.h" -#include "public_editor.h" -#include "imageframe_time_axis.h" -#include "selection.h" -#include "imageframe_time_axis_view.h" -#include "marker_time_axis_view.h" -#include "imageframe_view.h" -#include "marker_time_axis.h" -#include "canvas_impl.h" - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; - -//---------------------------------------------------------------------------------------// -// Constructor / Desctructor - -/** - * Constructs a new MarkerTimeAxis - * - * @param ed the PublicEditor - * @param sess the current session - * @param canvas the parent canvas item - * @param name the name/id of this time axis - * @param tav the associated track view that this MarkerTimeAxis is marking up - */ -MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas, const string & name, TimeAxisView* tav) - : AxisView(sess), - VisualTimeAxis(name, ed, sess, canvas) -{ - /* the TimeAxisView these markers are associated with */ - marked_time_axis = tav ; - - _color = unique_random_color() ; - time_axis_name = name ; - - selection_group = new Group (*canvas_display); - selection_group->hide(); - - // intialize our data items - marker_menu = 0 ; - - y_position = -1 ; - - /* create our new marker time axis strip view */ - view = new MarkerTimeAxisView(*this) ; - - // set the initial time axis text label - label_view() ; - - // set the initial height of this time axis - set_height(hSmall) ; -} - -/** - * Destructor - * Responsible for destroying any marker items upon this time axis - */ -MarkerTimeAxis::~MarkerTimeAxis() -{ - CatchDeletion (this); /* EMIT_SIGNAL */ - - // destroy the view helper - // this handles removing and destroying individual marker items - - if(view) { - delete view ; - view = 0 ; - } -} - - -//---------------------------------------------------------------------------------------// -// ui methods & data - -void -MarkerTimeAxis::set_height (uint32_t h) -{ - VisualTimeAxis::set_height(h) ; - - // tell out view helper of the change too - if (view != 0) - { - view->set_height((double) height) ; - } - - // tell those interested that we have had our height changed - gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */ -} - -/** - * Sets the number of samples per unit that are used. - * This is used to determine the sizes of items upon this time axis - * - * @param spu the number of samples per unit - */ -void -MarkerTimeAxis::set_samples_per_unit(double spu) -{ - TimeAxisView::set_samples_per_unit (editor.get_current_zoom()); - - if (view) { - view->set_samples_per_unit(spu) ; - } -} - -/** - * Show the popup edit menu - * - * @param button the mouse button pressed - * @param time when to show the popup - * @param clicked_mv the MarkerView that the event ocured upon, or 0 if none - * @param with_item true if an item has been selected upon the time axis, used to set context menu - */ -void -MarkerTimeAxis::popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item) -{ - if (!marker_menu) - { - build_marker_menu() ; - } - - if (with_item) - { - marker_item_menu->set_sensitive(true) ; - } - else - { - marker_item_menu->set_sensitive(false) ; - } - - marker_menu->popup(button,time) ; -} - - -/** - * convenience method to select a new track color and apply it to the view and view items - * - */ -void -MarkerTimeAxis::select_track_color() -{ - if(VisualTimeAxis::choose_time_axis_color()) - { - if(view) - { - view->apply_color(_color) ; - } - } -} - -/** - * Handles the building of the popup menu - */ -void -MarkerTimeAxis::build_display_menu() -{ - using namespace Menu_Helpers; - - /* get the size menu ready */ - build_size_menu() ; - - /* prepare it */ - TimeAxisView::build_display_menu(); - - /* now fill it with our stuff */ - MenuList& items = display_menu->items(); - - items.push_back(MenuElem (_("Rename"), sigc::mem_fun(*this, &VisualTimeAxis::start_time_axis_rename))); - - items.push_back(SeparatorElem()) ; - items.push_back(MenuElem (_("Height"), *size_menu)); - items.push_back(MenuElem (_("Color"), sigc::mem_fun(*this, &MarkerTimeAxis::select_track_color))); - items.push_back(SeparatorElem()) ; - - items.push_back(MenuElem (_("Remove"), sigc::bind(sigc::mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this))); -} - -/** - * handles the building of the MarkerView sub menu - */ -void -MarkerTimeAxis::build_marker_menu() -{ - using namespace Menu_Helpers; - using Gtk::Menu; - - marker_menu = manage(new Menu) ; - marker_menu->set_name ("ArdourContextMenu"); - MenuList& items = marker_menu->items(); - - marker_item_menu = manage(new Menu) ; - marker_item_menu->set_name ("ArdourContextMenu"); - MenuList& marker_sub_items = marker_item_menu->items() ; - - /* duration menu */ - Menu* duration_menu = manage(new Menu) ; - duration_menu->set_name ("ArdourContextMenu"); - MenuList& duration_items = duration_menu->items() ; - - if(view) - { - duration_items.push_back(MenuElem (_("1 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ; - duration_items.push_back(MenuElem (_("1.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.5))) ; - duration_items.push_back(MenuElem (_("2 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.0))) ; - duration_items.push_back(MenuElem (_("2.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.5))) ; - duration_items.push_back(MenuElem (_("3 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 3.0))) ; - } - //duration_items.push_back(SeparatorElem()) ; - //duration_items.push_back(MenuElem (_("custom"), sigc::mem_fun(*this, &ImageFrameTimeAxis::set_marker_duration_custom))) ; - - marker_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ; - - marker_sub_items.push_back(SeparatorElem()) ; - marker_sub_items.push_back(MenuElem (_("Remove Marker"), sigc::bind(sigc::mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ; - - items.push_back(MenuElem(_("Marker"), *marker_item_menu)) ; - items.push_back(MenuElem (_("Rename Track"), sigc::mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ; - - marker_menu->show_all() ; -} - - - -/** - * Returns the view helper of this TimeAxis - * - * @return the view helper of this TimeAxis - */ -MarkerTimeAxisView* -MarkerTimeAxis::get_view() -{ - return(view) ; -} - -/** - * Returns the TimeAxisView that this markerTimeAxis is marking up - * - * @return the TimeAXisView that this MarkerTimeAxis is marking - */ -TimeAxisView* -MarkerTimeAxis::get_marked_time_axis() -{ - return(marked_time_axis) ; -} - - - - diff --git a/gtk2_ardour/marker_time_axis.h b/gtk2_ardour/marker_time_axis.h deleted file mode 100644 index bb30bc24db..0000000000 --- a/gtk2_ardour/marker_time_axis.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_marker_time_axis_h__ -#define __ardour_marker_time_axis_h__ - -#include <string> -#include <libgnomecanvas/libgnomecanvas.h> - -#include "ardour_dialog.h" -#include "route_ui.h" -#include "enums.h" -#include "time_axis_view.h" -#include "canvas.h" -#include "visual_time_axis.h" - -namespace ARDOUR { - class Session; -} - -class PublicEditor; -class ImageFrameView ; -class ImageFrameTimeAxisView ; -class MarkerTimeAxisView ; -class MarkerView ; - -/** - * MarkerTimeAxis defines a visual time axis for holding marker items associated with other time axis, and time axis items. - * - * The intention of this time axis is to allow markers with duration to be arranged on the time line - * to add additional timing information to items on an associated time axis, for instance the addition - * of effect duration and timings - */ -class MarkerTimeAxis : public VisualTimeAxis -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new MarkerTimeAxis - * - * @param ed the PublicEditor - * @param sess the current session - * @param canvas the parent canvas item - * @param name the name/id of this time axis - * @param tav the associated track view that this MarkerTimeAxis is marking up - */ - MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ; - - /** - * Destructor - * Responsible for destroying any marker items upon this time axis - */ - virtual ~MarkerTimeAxis() ; - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of this TrackView to one of the defined TrackHeights - * - * @param h the number of pixels to set the height to - */ - virtual void set_height(uint32_t h) ; - - /** - * Sets the number of samples per unit that are used. - * This is used to determine the sizes of items upon this time axis - * - * @param spu the number of samples per unit - */ - virtual void set_samples_per_unit(double spu) ; - - - /** - * Show the popup edit menu - * - * @param button the mouse button pressed - * @param time when to show the popup - * @param clicked_mv the MarkerView that the event ocured upon, or 0 if none - * @param with_item true if an item has been selected upon the time axis, used to set context menu - */ - void popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item) ; - - - //---------------------------------------------------------------------------------------// - // Parent/Child helper object accessors - - /** - * Returns the view helper of this TimeAxis - * - * @return the view helper of this TimeAxis - */ - MarkerTimeAxisView* get_view() ; - - /** - * Returns the TimeAxisView that this markerTimeAxis is marking up - * - * @return the TimeAXisView that this MarkerTimeAxis is marking - */ - TimeAxisView* get_marked_time_axis() ; - - - private: - - /** - * convenience method to select a new track color and apply it to the view and view items - * - */ - void select_track_color() ; - - /** - * Handles the building of the popup menu - */ - virtual void build_display_menu() ; - - /** - * handles the building of the MarkerView sub menu - */ - void build_marker_menu() ; - - /** The associated TimeAxis that this MarkerTimeAxis is marking up */ - TimeAxisView* marked_time_axis ; - - /** Our time axis view helper */ - MarkerTimeAxisView *view ; - - /** the popup menu available by clicking upon this time axis */ - Gtk::Menu *marker_menu ; - - /** specialized sub menu available when clicking upon and item upon this time axis */ - Gtk::Menu *marker_item_menu ; - - -} ; /* class MarkerTimeAxis */ - -#endif /* __ardour_imageframe_time_axis_h__ */ - diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc deleted file mode 100644 index b1eb7066cd..0000000000 --- a/gtk2_ardour/marker_time_axis_view.cc +++ /dev/null @@ -1,389 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <algorithm> - -#include <gtkmm.h> -#include <gtkmm2ext/gtk_ui.h> - -#include "marker_time_axis_view.h" -#include "marker_time_axis.h" -#include "marker_view.h" -#include "imageframe_view.h" -#include "imageframe_time_axis.h" -#include "canvas-simplerect.h" -#include "public_editor.h" -#include "rgb_macros.h" -#include "gui_thread.h" -#include "ardour_ui.h" - -#include "i18n.h" - -using namespace ARDOUR ; -using namespace Editing; - -//---------------------------------------------------------------------------------------// -// Constructor / Desctructor - -/** - * Construct a new MarkerTimeAxisView helper time axis helper - * - * @param mta the TimeAxsiView that this objbect is the helper for - */ -MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv) - : _trackview (tv) -{ - region_color = _trackview.color(); - stream_base_color = ARDOUR_UI::config()->canvasvar_MarkerTrack.get(); - - canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display); - - canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); - canvas_rect->property_x1() = 0.0; - canvas_rect->property_y1() = 0.0; - canvas_rect->property_x2() = max_framepos; - canvas_rect->property_y2() = (double)20; - canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get(); - canvas_rect->property_fill_color_rgba() = stream_base_color; - - canvas_rect->signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview)); - - _samples_per_unit = _trackview.editor.get_current_zoom() ; - - _trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit)); - MarkerView::CatchDeletion.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, _1), gui_context()); -} - -/** - * Destructor - * Reposinsibly for destroying all marker items that may have been added to this time axis view - * - */ -MarkerTimeAxisView::~MarkerTimeAxisView() -{ - // destroy everything upon this view - for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) - { - MarkerView* mv = (*iter) ; - - MarkerViewList::iterator next = iter ; - next++ ; - marker_view_list.erase(iter) ; - - delete mv ; - mv = 0 ; - - iter = next ; - } - - delete canvas_rect; - canvas_rect = 0 ; - - delete canvas_group; - canvas_group = 0 ; -} - - -//---------------------------------------------------------------------------------------// -// ui methods & data - -/** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ -int -MarkerTimeAxisView::set_height(gdouble h) -{ - if (h < 10.0 || h > 1000.0) { - return -1; - } - - canvas_rect->property_y2() = h; - - for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) { - (*i)->set_y_position_and_height(0, h); - } - - return 0; -} - -/** - * Sets the position of this view helper on the canvas - * - * @param x the x position upon the canvas - * @param y the y position upon the canvas - */ -int -MarkerTimeAxisView::set_position(gdouble x, gdouble y) -{ - canvas_group->property_x() = x; - canvas_group->property_y() = y; - return 0; -} - -/** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ -int -MarkerTimeAxisView::set_samples_per_unit(gdouble spp) -{ - if(spp < 1.0) { - return -1 ; - } - - _samples_per_unit = spp ; - - for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) - { - (*i)->set_samples_per_unit(spp) ; - } - return(0) ; -} - -/** - * Sets the color of the items contained upon this view helper - * - * @param color the new base color - */ -void -MarkerTimeAxisView::apply_color(Gdk::Color& color) -{ - region_color = color; - - for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); i++) - { - (*i)->set_color (region_color) ; - } -} - - -//---------------------------------------------------------------------------------------// -// Child MarkerView Accessors/Mutators - -/** - * Adds a marker view to the list of items upon this time axis view helper - * the new MarkerView is returned - * - * @param ifv the ImageFrameView that the new item is marking up - * @param mark_text the text to be displayed uopn the new marker item - * @param mark_id the unique id of the new item - * @param start the position the new item should be placed upon the time line - * @param duration the duration the new item should be placed upon the timeline - * @param src the identity of the object that initiated the change - */ -MarkerView* -MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, framepos_t start, framecnt_t dur, void* src) -{ - if(ifv->has_marker_view_item(mark_id)) - { - return(0) ; - } - - MarkerView* mv = new MarkerView(canvas_group, - &_trackview, - ifv, - _trackview.editor.get_current_zoom(), - region_color, - mark_type, - mark_id, - start, - dur) ; - - ifv->add_marker_view_item(mv, src) ; - marker_view_list.push_front(mv) ; - - MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */ - - return(mv) ; -} - -/** - * Returns the named MarkerView or 0 if the named marker does not exist - * - * @param item_id the unique id of the item to search for - * @return the named MarkerView, or 0 if it is not held upon this view - */ -MarkerView* -MarkerTimeAxisView::get_named_marker_view(std::string item_id) -{ - MarkerView* mv = 0 ; - - for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) - { - if(((MarkerView*)*i)->get_item_name() == item_id) - { - mv = ((MarkerView*)*i) ; - break ; - } - } - return(mv) ; -} - -/** - * Removes the currently selected MarverView - * Note that this method actually destroys the MarkerView too. - * We assume that since we own the object, we are allowed to do this - * - * @param src the identity of the object that initiated the change - * @see add_marker_view - */ -void -MarkerTimeAxisView::remove_selected_marker_view(void* src) -{ - std::string removed ; - - if (selected_time_axis_item) - { - MarkerViewList::iterator i ; - if((i = find (marker_view_list.begin(), marker_view_list.end(), selected_time_axis_item)) != marker_view_list.end()) - { - marker_view_list.erase(i) ; - - MarkerViewRemoved(selected_time_axis_item->get_item_name(),src) ; /* EMIT_SIGNAL */ - - delete(selected_time_axis_item) ; - selected_time_axis_item = 0 ; - } - } - else - { - //No selected marker view - } -} - -/** - * Removes and returns the named MarkerView from the list of MarkerView held by this view helper - * - * @param item_id the MarkerView unique id to remove - * @param src the identity of the object that initiated the change - * @see add_marker_view - */ -MarkerView* -MarkerTimeAxisView::remove_named_marker_view(std::string item_id, void* src) -{ - MarkerView* mv = 0 ; - - MarkerViewList::iterator i = marker_view_list.begin() ; - - for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) - { - if(((MarkerView*)*i)->get_item_name() == item_id) - { - mv = ((MarkerView*)*i) ; - marker_view_list.erase(i) ; - - MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */ - - // break from the for loop - break; - } - i++ ; - } - - return(mv) ; -} - -/** - * Removes mv from the list of MarkerView upon this TimeAxis - * - * @param mv the MarkerView to remove - * @param src the identity of the object that initiated the change - */ -void -MarkerTimeAxisView::remove_marker_view (MarkerView* mv) -{ - ENSURE_GUI_THREAD (*this, &MarkerTimeAxisView::remove_marker_view, mv, src) - - MarkerViewList::iterator i; - - if((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) { - marker_view_list.erase(i) ; - - // Assume this remove happened locally, else use remove_named_marker_time_axis - // let listeners know that the named MarkerTimeAxis has been removed - MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */ - } -} - -/** - * Sets the duration of the selected MarkerView to the specified number of seconds - * - * @param sec the duration to set the MArkerView to, in seconds - */ -void -MarkerTimeAxisView::set_marker_duration_sec(double sec) -{ - if(get_selected_time_axis_item() != 0) - { - get_selected_time_axis_item()->set_duration((sec * _trackview.editor.session()->frame_rate()), this); - } -} - - -//---------------------------------------------------------------------------------------// -// Selected item methods - -/** - * Sets the currently selected item upon this time axis - * - * @param mv the item to set selected - */ -void -MarkerTimeAxisView::set_selected_time_axis_item(MarkerView* mv) -{ - selected_time_axis_item = mv ; -} - -/** - * Clears any selected item upon this time axis - * - */ -void -MarkerTimeAxisView::clear_selected_time_axis_item() -{ - selected_time_axis_item = 0 ; -} - -/** - * Returnsthe currently selected item upon this time axis - * - * @return the currently selected item pon this time axis - */ -MarkerView* -MarkerTimeAxisView::get_selected_time_axis_item() -{ - return(selected_time_axis_item) ; -} - - - - -/** - * convenience method to re-get the samples per unit and tell items upon this view - * - */ -void -MarkerTimeAxisView::reset_samples_per_unit () -{ - set_samples_per_unit(_trackview.editor.get_current_zoom()) ; -} diff --git a/gtk2_ardour/marker_time_axis_view.h b/gtk2_ardour/marker_time_axis_view.h deleted file mode 100644 index caf022178b..0000000000 --- a/gtk2_ardour/marker_time_axis_view.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_marker_time_axis_view_h__ -#define __ardour_marker_time_axis_view_h__ - -#include <list> -#include <gdkmm/color.h> -#include <libgnomecanvasmm/group.h> - -#include "ardour/location.h" -#include "simplerect.h" -#include "canvas.h" - -class PublicEditor; -class MarkerTimeAxis; -class ImageFrameView ; -class MarkerView ; -class TimeAxisView ; -class TimeAxisViewItem ; - -/** - * A view helper for handling MarkerView objects. - * This object is responsible for the time axis canvas view, and - * maintains the list of items that have been added to it - */ -class MarkerTimeAxisView : public sigc::trackable -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Construct a new MarkerTimeAxisView helper time axis helper - * - * @param mta the TimeAxsiView that this objbect is the helper for - */ - MarkerTimeAxisView(MarkerTimeAxis& mta) ; - - /** - * Destructor - * Reposinsibly for destroying all marker items that may have been added to this time axis view - * - */ - ~MarkerTimeAxisView () ; - - //---------------------------------------------------------------------------------------// - // Parent/Child helper object accessors - - /** - * Returns the TimeAxisView thatt his object is acting as a helper for - * - * @return the TimeAxisView that this object is acting as a view helper for - */ - MarkerTimeAxis& trackview() { return _trackview; } - - /** - * - */ - ArdourCanvas::Item *canvas_item() { return canvas_group; } - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of the time axis view and the item upon it - * - * @param height the new height - */ - int set_height(gdouble height) ; - - /** - * Sets the position of this view helper on the canvas - * - * @param x the x position upon the canvas - * @param y the y position upon the canvas - */ - int set_position(gdouble x, gdouble y) ; - - /** - * Sets the current samples per unit. - * this method tells each item upon the time axis of the change - * - * @param spu the new samples per canvas unit value - */ - int set_samples_per_unit(gdouble spu) ; - - /** - * Returns the current samples per unit of this time axis view helper - * - * @return the current samples per unit of this time axis view helper - */ - gdouble get_samples_per_unit() { return _samples_per_unit; } - - /** - * Sets the color of the items contained upon this view helper - * - * @param color the new base color - */ - void apply_color(Gdk::Color& color) ; - - //---------------------------------------------------------------------------------------// - // Child MarkerView Accessors/Mutators - - /** - * Adds a marker view to the list of items upon this time axis view helper - * the new MarkerView is returned - * - * @param ifv the ImageFrameView that the new item is marking up - * @param mark_text the text to be displayed uopn the new marker item - * @param mark_id the unique id of the new item - * @param start the position the new item should be placed upon the time line - * @param duration the duration the new item should be placed upon the timeline - * @param src the identity of the object that initiated the change - */ - MarkerView* add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, nframes_t start, nframes_t dur, void* src) ; - - /** - * Returns the named MarkerView or 0 if the named marker does not exist - * - * @param item_id the unique id of the item to search for - * @return the named MarkerView, or 0 if it is not held upon this view - */ - MarkerView* get_named_marker_view(std::string item_id) ; - - /** - * Removes the currently selected MarverView - * Note that this method actually destroys the MarkerView too. - * We assume that since we own the object, we are allowed to do this - * - * @param src the identity of the object that initiated the change - * @see add_marker_view - */ - void remove_selected_marker_view(void* src) ; - - /** - * Removes and returns the named MarkerView from the list of MarkerView held by this view helper - * - * @param item_id the MarkerView unique id to remove - * @param src the identity of the object that initiated the change - * @see add_marker_view - */ - MarkerView* remove_named_marker_view(std::string item_id, void* src) ; - - /** - * Removes mv from the list of MarkerView upon this TimeAxis - * - * @param mv the MarkerView to remove - * @param src the identity of the object that initiated the change - */ - void remove_marker_view(MarkerView* item, void* src) ; - - //---------------------------------------------------------------------------------------// - // Selected item methods - - /** - * Sets the currently selected item upon this time axis - * - * @param mv the item to set selected - */ - void set_selected_time_axis_item(MarkerView* mv) ; - - /** - * Clears any selected item upon this time axis - * - */ - void clear_selected_time_axis_item() ; - - /** - * Returnsthe currently selected item upon this time axis - * - * @return the currently selected item pon this time axis - */ - MarkerView* get_selected_time_axis_item() ; - - - /** - * Sets the duration of the selected MarkerView to the specified number of seconds - * - * @param sec the duration to set the MArkerView to, in seconds - */ - void set_marker_duration_sec(double sec) ; - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted when a MarkerView is Added */ - sigc::signal<void,MarkerView*,void*> MarkerViewAdded ; - - /** Emitted when a MarkerView Item is removed */ - sigc::signal<void,std::string,void*> MarkerViewRemoved ; - - private: - /** - * convenience method to re-get the samples per unit and tell items upon this view - * - */ - void reset_samples_per_unit() ; - - /** The list of items held by this time axis view helper */ - typedef std::list<MarkerView *> MarkerViewList ; - MarkerViewList marker_view_list; - - /** the currently selected time axis item upon this time axis */ - MarkerView* selected_time_axis_item ; - - /* the TimeAxisView that this object is acting as the view helper for */ - MarkerTimeAxis& _trackview ; - - ArdourCanvas::Group *canvas_group ; - ArdourCanvas::SimpleRect *canvas_rect ; /* frame around the whole thing */ - - /** the current samples per unit */ - double _samples_per_unit; - - /* XXX why are these different? */ - Gdk::Color region_color; - uint32_t stream_base_color; - -}; /* class MarkerTimeAxisView */ - -#endif /* __ardour_marker_time_axis_view_h__ */ diff --git a/gtk2_ardour/marker_view.cc b/gtk2_ardour/marker_view.cc deleted file mode 100644 index 4bd842341b..0000000000 --- a/gtk2_ardour/marker_view.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <gtkmm.h> - -#include "imageframe_time_axis.h" -#include "imageframe_view.h" -#include "canvas-simplerect.h" -#include "public_editor.h" -#include "marker_view.h" - -using namespace ARDOUR ; - -PBD::Signal1<void,MarkerView*> MarkerView::CatchDeletion - -//---------------------------------------------------------------------------------------// -// Constructor / Desctructor - -/** - * Constructs a new MarkerView - * - * @param parent the parent canvas item - * @param tv the parent TimeAxisView of this item - * @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with - * @param spu the current samples per unit - * @param base_color - * @param mark_type the marker type/name text, eg fade out, pan up etc. - * @param mark_id unique name/id of this item - * @param start the start time of this item - * @param duration the duration of this item - */ -MarkerView::MarkerView(ArdourCanvas::Group *parent, - TimeAxisView* tv, - ImageFrameView* marked, - double spu, - Gdk::Color& basic_color, - std::string mark_type, - std::string mark_id, - framepos_t start, - framecnt_t duration) - : TimeAxisViewItem(mark_id, *parent,*tv,spu,basic_color,start,duration) -{ - mark_type_text = mark_type ; - marked_item = marked ; - - // set the canvas item text to the marker type, not the id - set_name_text(mark_type_text) ; - - // hook up our canvas events - - if (frame_handle_start) { - frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_start_handle_event), frame_handle_start, this)); - frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_end_handle_event), frame_handle_end, this)); - } - group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_item_view_event), group, this)); - - set_position(start, this) ; - set_duration(duration, this) ; -} - -/** - * Destructor - * Destroys this Marker Item and removes the association between itself and the item it is marking. - */ -MarkerView::~MarkerView() -{ - // remove the association our marked may still have to us - if(marked_item) - { - marked_item->remove_marker_view_item(this, this) ; - } -} - - -//---------------------------------------------------------------------------------------// -// Marker Type Methods - -/** - * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. - * - * @param type_text the marker type text of this item - */ -void -MarkerView::set_mark_type_text(std::string type_text) -{ - mark_type_text = type_text ; - MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */ -} - -/** - * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. - * - * @return the marker type text of this item - */ -std::string -MarkerView::get_mark_type_text() const -{ - return(mark_type_text) ; -} - - -//---------------------------------------------------------------------------------------// -// Marked Item Methods - -ImageFrameView* -MarkerView::set_marked_item(ImageFrameView* item) -{ - ImageFrameView* temp = marked_item ; - marked_item = item ; - - MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */ - return(temp) ; -} - -ImageFrameView* -MarkerView::get_marked_item() -{ - return(marked_item) ; -} diff --git a/gtk2_ardour/marker_view.h b/gtk2_ardour/marker_view.h deleted file mode 100644 index 38088b078a..0000000000 --- a/gtk2_ardour/marker_view.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __gtk_ardour_marker_view_h__ -#define __gtk_ardour_marker_view_h__ - -#include <string> -#include "time_axis_view_item.h" - -#include "canvas.h" - -namespace Gdk { - class Color; -} - -class MarkerTimeAxisView ; -class ImageFrameView ; - -/** - * MarkerView defines a marker item that may be placed upon a MarkerTimeAxis. - * - * The aim of the MarkerView is to provide additional timing details for visual based time axis. - * The MarkerView item is associated with one other TimeAxisViewItem and has a start and a duration. - */ -class MarkerView : public TimeAxisViewItem -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Constructs a new MarkerView - * - * @param parent the parent canvas item - * @param tv the parent TimeAxisView of this item - * @param marked the Item that this item is to be assciated (marking) with - * @param spu the current samples per unit - * @param base_color - * @param mark_type the marker type/name text, eg fade out, pan up etc. - * @param mark_id unique name/id of this item - * @param start the start time of this item - * @param duration the duration of this item - */ - MarkerView(ArdourCanvas::Group *parent, - TimeAxisView *tv, - ImageFrameView* marked, - double spu, - Gdk::Color& base_color, - std::string mark_type, - std::string mark_id, - nframes_t start, - nframes_t duration) ; - - /** - * Destructor - * Destroys this Marker Item and removes the association between itself and the item it is marking. - */ - ~MarkerView() ; - - static PBD::Signal1<void,MarkerView*> CatchDeletion; - - //---------------------------------------------------------------------------------------// - // Marker Type Methods - - /** - * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. - * - * @param type_text the marker type text of this item - */ - void set_mark_type_text(std::string type_text) ; - - /** - * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. - * - * @return the marker type text of this item - */ - std::string get_mark_type_text() const ; - - - //---------------------------------------------------------------------------------------// - // Marked Item Methods - - /** - * Returns the time axis item being marked by this item - * - * @return the time axis item being marked by this item - */ - ImageFrameView* get_marked_item() ; - - /** - * Sets the time axis item being marker by this item - * - * @param item the time axis item to be marked by this item - * @return the previously marked item, or 0 if no previous marked item exists - */ - ImageFrameView* set_marked_item(ImageFrameView* item) ; - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** Emitted when the mark type text is changed */ - sigc::signal<void,std::string,void*> MarkTypeChanged ; - - /** Emitted when the Marked Item is changed */ - sigc::signal<void,ImageFrameView*,void*> MarkedItemChanged ; - - - protected: - - private: - /** the unique name/id of this item */ - std::string mark_type_text ; - - /* a pointer to the time axis item this marker is assoiated(marking up) with */ - ImageFrameView* marked_item ; - -} ; /* class MarkerView */ - - -#endif /* __gtk_ardour_imageframe_view_h__ */ diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 96310d7488..b5f8503458 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -69,11 +69,7 @@ class AutomationTimeAxisView; class ControlPoint; class DragManager; class Editor; -class ImageFrameTimeAxis; -class ImageFrameView; class Marker; -class MarkerTimeAxis; -class MarkerView; class MeterMarker; class MouseCursors; class PlaylistSelector; @@ -355,17 +351,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0; virtual bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*) = 0; -#ifdef WITH_CMT - virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; - virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0; - virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; - virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; - virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0; - virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; - virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; - virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; -#endif - static const int window_border_width; static const int container_border_width; static const int vertical_spacing; diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc deleted file mode 100644 index 3961bf8be1..0000000000 --- a/gtk2_ardour/visual_time_axis.cc +++ /dev/null @@ -1,419 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <cstdlib> -#include <cmath> -#include <algorithm> -#include <string> -#include <vector> - -#include "pbd/error.h" -#include "pbd/stl_delete.h" -#include "pbd/whitespace.h" - -#include <gtkmm2ext/utils.h> -#include <gtkmm2ext/selector.h> -#include <gtkmm2ext/gtk_ui.h> -#include <gtkmm2ext/choice.h> - -#include "ardour/session.h" -#include "ardour/utils.h" -#include "ardour/processor.h" -#include "ardour/location.h" - -#include "ardour_ui.h" -#include "public_editor.h" -#include "imageframe_time_axis.h" -#include "imageframe_time_axis_view.h" -#include "marker_time_axis_view.h" -#include "imageframe_view.h" -#include "marker_time_axis.h" -#include "marker_view.h" -#include "utils.h" -#include "prompter.h" -#include "rgb_macros.h" -#include "canvas_impl.h" - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; - -/** - * Abstract Constructor for base visual time axis classes - * - * @param name the name/Id of thie TimeAxis - * @param ed the Ardour PublicEditor - * @param sess the current session - * @param canvas the parent canvas object - */ -VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas) - : AxisView(sess), - TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas), - visual_button (_("v")), - size_button (_("h")) -{ - time_axis_name = name ; - _color = unique_random_color() ; - - name_entry.signal_activate().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_changed)) ; - name_entry.signal_button_press_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_press_handler)) ; - name_entry.signal_button_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_release_handler)) ; - name_entry.signal_key_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_key_release_handler)) ; - - size_button.set_name("TrackSizeButton") ; - visual_button.set_name("TrackVisualButton") ; - hide_button.set_name("TrackRemoveButton") ; - hide_button.add(*(Gtk::manage(new Gtk::Image(get_xpm("small_x.xpm"))))); - size_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VisualTimeAxis::size_click)) ; - visual_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::visual_click)) ; - hide_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::hide_click)) ; - ARDOUR_UI::instance()->set_tip(size_button,_("Display Height")) ; - ARDOUR_UI::instance()->set_tip(visual_button, _("Visual options")) ; - ARDOUR_UI::instance()->set_tip(hide_button, _("Hide this track")) ; - - controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - - /* remove focus from the buttons */ - size_button.unset_flags(Gtk::CAN_FOCUS) ; - hide_button.unset_flags(Gtk::CAN_FOCUS) ; - visual_button.unset_flags(Gtk::CAN_FOCUS) ; - - set_height (hNormal) ; -} - -/** - * VisualTimeAxis Destructor - * - */ -VisualTimeAxis::~VisualTimeAxis() -{ -} - - -//---------------------------------------------------------------------------------------// -// Name/Id Accessors/Mutators - -void -VisualTimeAxis::set_time_axis_name(const string & name, void* src) -{ - std::string old_name = time_axis_name ; - - if(name != time_axis_name) - { - time_axis_name = name ; - label_view() ; - editor.route_name_changed(this) ; - - NameChanged(time_axis_name, old_name, src) ; /* EMIT_SIGNAL */ - } -} - -std::string -VisualTimeAxis::name() const -{ - return(time_axis_name) ; -} - - -//---------------------------------------------------------------------------------------// -// ui methods & data - -/** - * Sets the height of this TrackView to one of the defined TrackHeghts - * - * @param h - */ -void -VisualTimeAxis::set_height(uint32_t h) -{ - TimeAxisView::set_height(h); - - if (h >= hNormal) { - other_button_hbox.show_all() ; - } else if (h >= hSmaller) { - other_button_hbox.hide_all() ; - } else if (h >= hSmall) { - other_button_hbox.hide_all() ; - } -} - -/** - * Handle the visuals button click - * - */ -void -VisualTimeAxis::visual_click() -{ - popup_display_menu(0); -} - - -/** - * Handle the hide buttons click - * - */ -void -VisualTimeAxis::hide_click() -{ - // LAME fix for hide_button display refresh - hide_button.set_sensitive(false); - - editor.hide_track_in_display (*this); - - hide_button.set_sensitive(true); -} - - -/** - * Allows the selection of a new color for this TimeAxis - * - */ -void -VisualTimeAxis::select_track_color () -{ - if(choose_time_axis_color()) - { - //Does nothing at this abstract point - } -} - -/** - * Provides a color chooser for the selection of a new time axis color. - * - */ -bool -VisualTimeAxis::choose_time_axis_color() -{ - bool picked ; - Gdk::Color color ; - gdouble current[4] ; - Gdk::Color current_color ; - - current[0] = _color.get_red() / 65535.0 ; - current[1] = _color.get_green() / 65535.0 ; - current[2] = _color.get_blue() / 65535.0 ; - current[3] = 1.0 ; - - current_color.set_rgb_p (current[0],current[1],current[2]); - color = Gtkmm2ext::UI::instance()->get_color(_("Color Selection"),picked, ¤t_color) ; - - if (picked) - { - set_time_axis_color(color) ; - } - return(picked) ; -} - -/** - * Sets the color of this TimeAxis to the specified color c - * - * @param c the new TimeAxis color - */ -void -VisualTimeAxis::set_time_axis_color(Gdk::Color c) -{ - _color = c ; -} - -void -VisualTimeAxis::set_selected_regionviews (RegionSelection& regions) -{ - // Not handled by purely visual TimeAxis -} - -//---------------------------------------------------------------------------------------// -// Handle time axis removal - -/** - * Handles the Removal of this VisualTimeAxis - * - * @param src the identity of the object that initiated the change - */ -void -VisualTimeAxis::remove_this_time_axis(void* src) -{ - vector<string> choices; - - std::string prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n\n(This action cannot be undone, and the session file will be overwritten)"), time_axis_name); - - choices.push_back (_("No, do nothing.")); - choices.push_back (_("Yes, remove it.")); - - Gtkmm2ext::Choice prompter (prompt, choices); - - if (prompter.run () == 1) { - /* - defer to idle loop, otherwise we'll delete this object - while we're still inside this function ... - */ - Glib::signal_idle().connect(sigc::bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src)); - } -} - -/** - * Callback used to remove this time axis during the gtk idle loop - * This is used to avoid deleting the obejct while inside the remove_this_time_axis - * method - * - * @param ta the VisualTimeAxis to remove - * @param src the identity of the object that initiated the change - */ -gint -VisualTimeAxis::idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) -{ - ta->VisualTimeAxisRemoved(ta->name(), src) ; /* EMIT_SIGNAL */ - delete ta ; - ta = 0 ; - return(false) ; -} - - - - -//---------------------------------------------------------------------------------------// -// Handle TimeAxis rename - -/** - * Construct a new prompt to receive a new name for this TimeAxis - * - * @see finish_time_axis_rename() - */ -void -VisualTimeAxis::start_time_axis_rename() -{ - ArdourPrompter name_prompter; - - name_prompter.set_prompt (_("new name: ")) ; - name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); - name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); - name_prompter.show_all() ; - - switch (name_prompter.run ()) { - case Gtk::RESPONSE_ACCEPT: - string result; - name_prompter.get_result (result); - if (result.length()) { - if (editor.get_named_time_axis(result) != 0) { - ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); - return ; - } - - set_time_axis_name(result, this) ; - } - } - label_view() ; -} - -/** - * Handles the new name for this TimeAxis from the name prompt - * - * @see start_time_axis_rename() - */ - -void -VisualTimeAxis::label_view() -{ - name_label.set_text (time_axis_name); - name_entry.set_text (time_axis_name); - ARDOUR_UI::instance()->set_tip (name_entry, Glib::Markup::escape_text (time_axis_name)); -} - - -//---------------------------------------------------------------------------------------// -// Handle name entry signals - -void -VisualTimeAxis::name_entry_changed() -{ - TimeAxisView::name_entry_changed (); - - string x = name_entry.get_text (); - - if (x == time_axis_name) { - return; - } - - strip_whitespace_edges(x); - - if (x.length() == 0) { - name_entry.set_text (time_axis_name); - return; - } - - if (!editor.get_named_time_axis(x)) { - set_time_axis_name (x, this); - } else { - ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); - name_entry.set_text(time_axis_name); - } -} - -bool -VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev) -{ - if (ev->button == 3) { - return true; - } - return false -} - -bool -VisualTimeAxis::name_entry_button_release_handler(GdkEventButton *ev) -{ - return false; -} - -bool -VisualTimeAxis::name_entry_key_release_handler(GdkEventKey* ev) -{ - switch (ev->keyval) { - case GDK_Tab: - case GDK_Up: - case GDK_Down: - name_entry_changed (); - return true; - - default: - break; - } - - return false; -} - - -//---------------------------------------------------------------------------------------// -// Super class methods not handled by VisualTimeAxis - -void -VisualTimeAxis::show_timestretch (framepos_t start, framepos_t end, int layers, int layer) -{ - // Not handled by purely visual TimeAxis -} - -void -VisualTimeAxis::hide_timestretch() -{ - // Not handled by purely visual TimeAxis -} - - diff --git a/gtk2_ardour/visual_time_axis.h b/gtk2_ardour/visual_time_axis.h deleted file mode 100644 index a692482b49..0000000000 --- a/gtk2_ardour/visual_time_axis.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_visual_time_axis_h__ -#define __ardour_visual_time_axis_h__ - -#include <gtkmm/box.h> -#include <gtkmm/button.h> - -#include <gtkmm2ext/selector.h> - -#include "ardour_dialog.h" -#include "route_ui.h" -#include "enums.h" -#include "time_axis_view.h" -#include "canvas.h" - -namespace ARDOUR -{ - class Session ; -} - -class PublicEditor; -class ImageFrameView; -class ImageFrameTimeAxisView; -class MarkersTimeAxisView; -class TimeSelection; -class RegionSelection; -class MarkerTimeAxis; -class TimeAxisViewStrip; - -/** - * Base Abstact Class for TimeAxis views that operate purely within the visual domain. - * - * This class provides many of the common methods required for visual TimeAxis views. The aim is - * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these - * methods have a better home further up the class heirarchy, and in fact some are replication of - * methods found within RouteUI. This, however, has been required due to various problems with previous - * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes, - * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the - * compilers all agree on hos do to do stuff... - */ -class VisualTimeAxis : public TimeAxisView -{ - public: - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * VisualTimeAxis Destructor - * - */ - virtual ~VisualTimeAxis() ; - - //---------------------------------------------------------------------------------------// - // Name/Id Accessors/Mutators - - /** - * Returns the name of this TimeAxis - * - * @return the name of this TimeAxis - */ - virtual std::string name() const ; - - /** - * Sets the name of this TimeAxis - * - * @param name the new name of this TimeAxis - * @param src the identity of the object that initiated the change - */ - virtual void set_time_axis_name(const std::string & name, void* src) ; - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Sets the height of this TrackView to one of the defined TrackHeghts - * - * @param h the number of pixels to set the height to - */ - virtual void set_height (uint32_t); - - //---------------------------------------------------------------------------------------// - // Selection Methods - // selection methods are not handled by visual time axis object yet... - - /** - * Not implemented - */ - virtual void set_selected_regionviews(RegionSelection&) ; - - - //---------------------------------------------------------------------------------// - // Emitted Signals - - /** - * Emitted when we have changed the gui, and what we have shanged - */ - sigc::signal<void,const std::string &,void*> gui_changed ; - - /** - * Emitted when this Visual Time Axis has been removed - * This is different to the CatchDeletion signal in that this signal - * is emitted during the deletion of this Time Axis, and not during - * the destructor, this allows us to capture the source of the deletion - * event - */ - sigc::signal<void,const std::string &,void*> VisualTimeAxisRemoved ; - - /** - * Emitted when we have changed the name of this TimeAxis - */ - sigc::signal<void,const std::string &,const std::string &,void*> NameChanged ; - - /** - * Emitted when this time axis has been selected for removal - */ - //sigc::signal<void,std::std::string,void*> VisualTimeAxisRemoved ; - - //---------------------------------------------------------------------------------------// - // Constructor / Desctructor - - /** - * Abstract Constructor for base visual time axis classes - * - * @param name the name/Id of thie TimeAxis - * @param ed the Ardour PublicEditor - * @param sess the current session - * @param canvas the parent canvas object - */ - VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ; - - - //---------------------------------------------------------------------------------------// - // Handle time axis removal - - /** - * Handles the Removal of this VisualTimeAxis - * - * @param src the identity of the object that initiated the change - */ - virtual void remove_this_time_axis(void* src) ; - - /** - * Callback used to remove this time axis during the gtk idle loop - * This is used to avoid deleting the obejct while inside the remove_this_time_axis - * method - * - * @param ta the VisualTimeAxis to remove - * @param src the identity of the object that initiated the change - */ - static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ; - - - - //---------------------------------------------------------------------------------------// - // ui methods & data - - /** - * Handle the visuals button click - * - */ - void visual_click() ; - - /** - * Handle the hide buttons click - * - */ - void hide_click() ; - - /** - * Allows the selection of a new color for this TimeAxis - * - */ - virtual void select_track_color() ; - - /** - * Provides a color chooser for the selection of a new time axis color. - * - */ - bool choose_time_axis_color() ; - - /** - * Sets the color of this TimeAxis to the specified color c - * - * @param c the new TimeAxis color - */ - void set_time_axis_color(Gdk::Color c) ; - - - //---------------------------------------------------------------------------------------// - // Handle TimeAxis rename - - /** - * Construct a new prompt to receive a new name for this TimeAxis - * - * @see finish_time_axis_rename() - */ - void start_time_axis_rename() ; - - /** - * Handles the new name for this TimeAxis from the name prompt - * - * @see start_time_axis_rename() - */ - virtual void label_view() ; - - - //---------------------------------------------------------------------------------------// - // Handle name entry signals - - void name_entry_changed() ; - bool name_entry_key_release_handler(GdkEventKey*) ; - - //---------------------------------------------------------------------------------------// - // VisualTimeAxis Widgets - Gtk::HBox other_button_hbox ; - Gtk::Button hide_button ; - Gtk::Button visual_button ; - Gtk::Button size_button ; - - /** the name of this TimeAxis object */ - std::string time_axis_name ; - - //---------------------------------------------------------------------------------------// - // Super class methods not handled by VisualTimeAxis - - /** - * Not handled by purely Visual TimeAxis - * - * @todo should VisualTimeAxis handle this? - */ - void show_timestretch (nframes_t start, nframes_t end, int layers, int layer); - - /** - * Not handle by purely visual TimeAxis - * @see show_timestratch - */ - virtual void hide_timestretch() ; - - private: - -}; - -#endif /* __ardour_visual_time_axis_h__ */ - |