2 Copyright (C) 2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "imageframe_time_axis.h"
24 #include "imageframe_view.h"
25 #include "canvas-simplerect.h"
26 #include "public_editor.h"
27 #include "marker_view.h"
29 using namespace ARDOUR ;
32 sigc::signal<void,MarkerView*> MarkerView::GoingAway;
34 //---------------------------------------------------------------------------------------//
35 // Constructor / Desctructor
38 * Constructs a new MarkerView
40 * @param parent the parent canvas item
41 * @param tv the parent TimeAxisView of this item
42 * @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with
43 * @param spu the current samples per unit
45 * @param mark_type the marker type/name text, eg fade out, pan up etc.
46 * @param mark_id unique name/id of this item
47 * @param start the start time of this item
48 * @param duration the duration of this item
50 MarkerView::MarkerView(GnomeCanvasGroup *parent,
52 ImageFrameView* marked,
54 GdkColor& basic_color,
55 std::string mark_type,
58 jack_nframes_t duration)
59 : TimeAxisViewItem(mark_id, parent,*tv,spu,basic_color,start,duration)
61 mark_type_text = mark_type ;
62 marked_item = marked ;
64 // set the canvas item text to the marker type, not the id
65 set_name_text(mark_type_text) ;
67 // hoo up our canvas events
68 gtk_signal_connect (GTK_OBJECT(frame_handle_start), "event",
69 (GtkSignalFunc) PublicEditor::canvas_markerview_start_handle_event,
72 gtk_signal_connect (GTK_OBJECT(frame_handle_end), "event",
73 (GtkSignalFunc) PublicEditor::canvas_markerview_end_handle_event,
76 gtk_signal_connect (GTK_OBJECT(group), "event",
77 (GtkSignalFunc) PublicEditor::canvas_markerview_item_view_event, this);
79 /* handle any specific details required by the initial start end duration values */
80 set_position(start, this) ;
81 set_duration(duration, this) ;
86 * Destroys this Marker Item and removes the association between itself and the item it is marking.
88 MarkerView::~MarkerView()
90 // remove the association our marked may still have to us
93 marked_item->remove_marker_view_item(this, this) ;
98 //---------------------------------------------------------------------------------------//
99 // Marker Type Methods
102 * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc.
104 * @param type_text the marker type text of this item
107 MarkerView::set_mark_type_text(std::string type_text)
109 mark_type_text = type_text ;
110 MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */
114 * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc.
116 * @return the marker type text of this item
119 MarkerView::get_mark_type_text() const
121 return(mark_type_text) ;
125 //---------------------------------------------------------------------------------------//
126 // Marked Item Methods
129 MarkerView::set_marked_item(ImageFrameView* item)
131 ImageFrameView* temp = marked_item ;
134 MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */
139 MarkerView::get_marked_item()
141 return(marked_item) ;