updated french translation from raphael
[ardour2.git] / gtk2_ardour / marker_view.cc
blobd82554f891e919322276f87acf66715161977348
1 /*
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.
20 #include <gtkmm.h>
22 #include "imageframe_time_axis.h"
23 #include "imageframe_view.h"
24 #include "canvas-simplerect.h"
25 #include "public_editor.h"
26 #include "marker_view.h"
28 using namespace ARDOUR ;
29 using namespace sigc;
31 sigc::signal<void,MarkerView*> MarkerView::GoingAway;
33 //---------------------------------------------------------------------------------------//
34 // Constructor / Desctructor
36 /**
37 * Constructs a new MarkerView
39 * @param parent the parent canvas item
40 * @param tv the parent TimeAxisView of this item
41 * @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with
42 * @param spu the current samples per unit
43 * @param base_color
44 * @param mark_type the marker type/name text, eg fade out, pan up etc.
45 * @param mark_id unique name/id of this item
46 * @param start the start time of this item
47 * @param duration the duration of this item
49 MarkerView::MarkerView(ArdourCanvas::Group *parent,
50 TimeAxisView* tv,
51 ImageFrameView* marked,
52 double spu,
53 Gdk::Color& basic_color,
54 std::string mark_type,
55 std::string mark_id,
56 nframes_t start,
57 nframes_t duration)
58 : TimeAxisViewItem(mark_id, *parent,*tv,spu,basic_color,start,duration)
60 mark_type_text = mark_type ;
61 marked_item = marked ;
63 // set the canvas item text to the marker type, not the id
64 set_name_text(mark_type_text) ;
66 // hook up our canvas events
68 frame_handle_start->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_start_handle_event), frame_handle_start, this));
69 frame_handle_end->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_end_handle_event), frame_handle_end, this));
70 group->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_item_view_event), group, this));
72 set_position(start, this) ;
73 set_duration(duration, this) ;
76 /**
77 * Destructor
78 * Destroys this Marker Item and removes the association between itself and the item it is marking.
80 MarkerView::~MarkerView()
82 // remove the association our marked may still have to us
83 if(marked_item)
85 marked_item->remove_marker_view_item(this, this) ;
90 //---------------------------------------------------------------------------------------//
91 // Marker Type Methods
93 /**
94 * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc.
96 * @param type_text the marker type text of this item
98 void
99 MarkerView::set_mark_type_text(std::string type_text)
101 mark_type_text = type_text ;
102 MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */
106 * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc.
108 * @return the marker type text of this item
110 std::string
111 MarkerView::get_mark_type_text() const
113 return(mark_type_text) ;
117 //---------------------------------------------------------------------------------------//
118 // Marked Item Methods
120 ImageFrameView*
121 MarkerView::set_marked_item(ImageFrameView* item)
123 ImageFrameView* temp = marked_item ;
124 marked_item = item ;
126 MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */
127 return(temp) ;
130 ImageFrameView*
131 MarkerView::get_marked_item()
133 return(marked_item) ;