/*
- Copyright (C) 2003 Paul Davis
+ 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
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <algorithm>
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
+#include "ardour_ui.h"
#include "i18n.h"
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
-
+
/**
* Construct a new MarkerTimeAxisView helper time axis helper
*
: _trackview (tv)
{
region_color = _trackview.color();
- stream_base_color = color_map[cMarkerTrackBase];
+ 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() = 1000000.0;
+ canvas_rect->property_x2() = max_frames;
canvas_rect->property_y2() = (double)20;
- canvas_rect->property_outline_color_rgba() = color_map[cMarkerTrackOutline];
+ 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 (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));
+
+ 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 (mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
+ _trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
}
/**
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 ;
}
-
- if(canvas_rect)
- {
- delete canvas_rect;
- canvas_rect = 0 ;
- }
-
- if(canvas_group)
- {
- delete canvas_group;
- canvas_group = 0 ;
- }
+
+ delete canvas_rect;
+ canvas_rect = 0 ;
+
+ delete canvas_group;
+ canvas_group = 0 ;
}
int
MarkerTimeAxisView::set_height(gdouble h)
{
- if (h < 10.0 || h > 1000.0)
- {
- return -1 ;
+ 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_height(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 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
if(spp < 1.0) {
return -1 ;
}
-
+
_samples_per_unit = spp ;
for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
//---------------------------------------------------------------------------------------//
// 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 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, nframes_t start, nframes_t dur, void* src)
{
{
return(0) ;
}
-
+
MarkerView* mv = new MarkerView(canvas_group,
&_trackview,
ifv,
mark_id,
start,
dur) ;
-
+
ifv->add_marker_view_item(mv, src) ;
marker_view_list.push_front(mv) ;
-
- mv->GoingAway.connect(bind (mem_fun(*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ;
-
+
+ mv->GoingAway.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, (void*)this));
+
MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
-
+
return(mv) ;
}
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)
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) ;
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) ;
}
void
MarkerTimeAxisView::remove_marker_view(MarkerView* mv, void* src)
{
- ENSURE_GUI_THREAD(bind (mem_fun(*this, &MarkerTimeAxisView::remove_marker_view), mv, src));
-
+ 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 */
{
if(get_selected_time_axis_item() != 0)
{
- get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+ get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.session()->frame_rate()), this) ;
}
}
{
selected_time_axis_item = 0 ;
}
-
+
/**
* Returnsthe currently selected item upon this time axis
*