fix math bug with numthreads computation
[ardour2.git] / gtk2_ardour / marker_view.cc
blob23397d6776e96597264e0ee0d28c21091775c8e7
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 ;
30 PBD::Signal1<void,MarkerView*> MarkerView::CatchDeletion
32 //---------------------------------------------------------------------------------------//
33 // Constructor / Desctructor
35 /**
36 * Constructs a new MarkerView
38 * @param parent the parent canvas item
39 * @param tv the parent TimeAxisView of this item
40 * @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with
41 * @param spu the current samples per unit
42 * @param base_color
43 * @param mark_type the marker type/name text, eg fade out, pan up etc.
44 * @param mark_id unique name/id of this item
45 * @param start the start time of this item
46 * @param duration the duration of this item
48 MarkerView::MarkerView(ArdourCanvas::Group *parent,
49 TimeAxisView* tv,
50 ImageFrameView* marked,
51 double spu,
52 Gdk::Color& basic_color,
53 std::string mark_type,
54 std::string mark_id,
55 nframes_t start,
56 nframes_t duration)
57 : TimeAxisViewItem(mark_id, *parent,*tv,spu,basic_color,start,duration)
59 mark_type_text = mark_type ;
60 marked_item = marked ;
62 // set the canvas item text to the marker type, not the id
63 set_name_text(mark_type_text) ;
65 // hook up our canvas events
67 frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_start_handle_event), frame_handle_start, this));
68 frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_end_handle_event), frame_handle_end, this));
69 group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_item_view_event), group, this));
71 set_position(start, this) ;
72 set_duration(duration, this) ;
75 /**
76 * Destructor
77 * Destroys this Marker Item and removes the association between itself and the item it is marking.
79 MarkerView::~MarkerView()
81 // remove the association our marked may still have to us
82 if(marked_item)
84 marked_item->remove_marker_view_item(this, this) ;
89 //---------------------------------------------------------------------------------------//
90 // Marker Type Methods
92 /**
93 * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc.
95 * @param type_text the marker type text of this item
97 void
98 MarkerView::set_mark_type_text(std::string type_text)
100 mark_type_text = type_text ;
101 MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */
105 * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc.
107 * @return the marker type text of this item
109 std::string
110 MarkerView::get_mark_type_text() const
112 return(mark_type_text) ;
116 //---------------------------------------------------------------------------------------//
117 // Marked Item Methods
119 ImageFrameView*
120 MarkerView::set_marked_item(ImageFrameView* item)
122 ImageFrameView* temp = marked_item ;
123 marked_item = item ;
125 MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */
126 return(temp) ;
129 ImageFrameView*
130 MarkerView::get_marked_item()
132 return(marked_item) ;