#include "public_editor.h"
#include "audio_time_axis.h"
#include "streamview.h"
-#include "canvas-simplerect.h"
+#include "simplerect.h"
#include "playlist_selector.h"
#include "plugin_selector.h"
#include "plugin_ui.h"
#include "prompter.h"
#include "crossfade_view.h"
#include "gui_thread.h"
+#include "canvas_impl.h"
#include <ardour/audio_track.h>
#include "i18n.h"
using namespace ARDOUR;
-using namespace sigc;
+//using namespace sigc;
using namespace LADSPA;
using namespace Gtk;
using namespace Editing;
" ",
" "};
-AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Widget *canvas)
+AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas)
: AxisView(sess),
RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
playlist_button (_("p")),
size_button (_("h")), // height
automation_button (_("a")),
- visual_button (_("v")),
- redirect_window ("redirect window"),
- redirect_display (1)
+ visual_button (_("v"))
+
{
_has_state = true;
subplugin_menu.set_name ("ArdourContextMenu");
visual_button.set_name ("TrackVisualButton");
hide_button.set_name ("TrackRemoveButton");
- hide_button.add (*(manage (new Pixmap (small_x_xpm))));
+ hide_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(small_x_xpm)))));
_route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
_route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
_route.panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans));
- solo_button->button_press_event.connect (mem_fun(*this, &RouteUI::solo_press));
- solo_button->button_release_event.connect (mem_fun(*this, &RouteUI::solo_release));
- mute_button->button_press_event.connect (mem_fun(*this, &RouteUI::mute_press));
- mute_button->button_release_event.connect (mem_fun(*this, &RouteUI::mute_release));
- rec_enable_button->button_press_event.connect (mem_fun(*this, &RouteUI::rec_enable_press));
- edit_group_button.button_release_event.connect (mem_fun(*this, &AudioTimeAxisView::edit_click));
+ solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press));
+ solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release));
+ mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press));
+ mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
+ rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
+ edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click));
playlist_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::playlist_click));
automation_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::automation_click));
- size_button.button_release_event.connect (mem_fun(*this, &AudioTimeAxisView::size_click));
+ size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click));
visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
- name_entry.activate.connect (mem_fun(*this, &AudioTimeAxisView::name_entry_activated));
- name_entry.signal_focus_out_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_focus_out_handler));
- name_entry.button_press_event.connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_press_handler));
- name_entry.button_release_event.connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_release_handler));
- name_entry.key_release_event.connect (mem_fun(*this, &AudioTimeAxisView::name_entry_key_release_handler));
+ name_entry.signal_activate().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_activated));
+ name_entry.signal_button_press_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_press_handler));
+ name_entry.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_release_handler));
+ name_entry.signal_key_release_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_key_release_handler));
if (is_audio_track()) {
controls_table.attach (*rec_enable_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
mute_changed(0);
redirects_changed (0);
reset_redirect_automation_curves ();
- edit_group_menu_radio_group = 0;
y_position = -1;
ensure_xml_node ();
bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
if (_route.edit_group() == 0) {
- static_cast<RadioMenuItem*>(items.back())->set_active ();
+ static_cast<RadioMenuItem*>(&items.back())->set_active ();
}
_session.foreach_edit_group (this, &AudioTimeAxisView::add_edit_group_menu_item);
items.push_back (RadioMenuElem (edit_group_menu_radio_group,
eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
if (_route.edit_group() == eg) {
- static_cast<RadioMenuItem*>(items.back())->set_active ();
+ static_cast<RadioMenuItem*>(&items.back())->set_active ();
}
}
#endif
if (timestretch_rect == 0) {
- timestretch_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display),
- gnome_canvas_simplerect_get_type(),
- "x1", 0.0,
- "y1", 0.0,
- "x2", 0.0,
- "y2", 0.0,
- "fill_color_rgba", color_map[cTimeStretchFill],
- "outline_color_rgba" , color_map[cTimeStretchOutline],
- NULL);
- }
-
- gnome_canvas_item_show (timestretch_rect);
- gnome_canvas_item_raise_to_top (timestretch_rect);
-
+ timestretch_rect = new SimpleRect (*canvas_display);
+ timestretch_rect->property_x1() = 0.0;
+ timestretch_rect->property_y1() = 0.0;
+ timestretch_rect->property_x2() = 0.0;
+ timestretch_rect->property_y2() = 0.0;
+ timestretch_rect->property_fill_color_rgba() = color_map[cTimeStretchFill];
+ timestretch_rect->property_outline_color_rgba() = color_map[cTimeStretchOutline];
+ }
+
+ timestretch_rect->show ();
+ timestretch_rect->raise_to_top ();
+
x1 = start / editor.get_current_zoom();
x2 = (end - 1) / editor.get_current_zoom();
y2 = height - 2;
- gtk_object_set (GTK_OBJECT(timestretch_rect),
- "x1", x1,
- "y1", 1.0,
- "x2", x2,
- "y2", y2,
- NULL);
+ timestretch_rect->property_x1() = x1;
+ timestretch_rect->property_y1() = 1.0;
+ timestretch_rect->property_x2() = x2;
+ timestretch_rect->property_y2() = y2;
}
void
TimeAxisView::hide_timestretch ();
if (timestretch_rect) {
- gnome_canvas_item_hide (timestretch_rect);
+ timestretch_rect->hide ();
}
}
automation_items.push_back (CheckMenuElem (_("gain"),
mem_fun(*this, &AudioTimeAxisView::toggle_gain_track)));
- gain_automation_item = static_cast<CheckMenuItem*> (automation_items.back());
+ gain_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
gain_automation_item->set_active(show_gain_automation);
automation_items.push_back (CheckMenuElem (_("pan"),
mem_fun(*this, &AudioTimeAxisView::toggle_pan_track)));
- pan_automation_item = static_cast<CheckMenuItem*> (automation_items.back());
+ pan_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
pan_automation_item->set_active(show_pan_automation);
automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
waveform_menu->set_name ("ArdourContextMenu");
waveform_items.push_back (CheckMenuElem (_("Show waveforms"), mem_fun(*this, &AudioTimeAxisView::toggle_waveforms)));
- waveform_item = static_cast<CheckMenuItem *> (waveform_items.back());
+ waveform_item = static_cast<CheckMenuItem *> (&waveform_items.back());
ignore_toggle = true;
waveform_item->set_active (editor.show_waveforms());
ignore_toggle = false;
RadioMenuItem::Group group;
waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
- traditional_item = static_cast<RadioMenuItem *> (waveform_items.back());
+ traditional_item = static_cast<RadioMenuItem *> (&waveform_items.back());
waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
- rectified_item = static_cast<RadioMenuItem *> (waveform_items.back());
+ rectified_item = static_cast<RadioMenuItem *> (&waveform_items.back());
items.push_back (MenuElem (_("Waveform"), *waveform_menu));
RadioMenuItem::Group align_group;
alignment_items.push_back (RadioMenuElem (align_group, _("align with existing material"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), ExistingMaterial)));
- align_existing_item = dynamic_cast<RadioMenuItem*>(alignment_items.back());
+ align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
if (get_diskstream()->alignment_style() == ExistingMaterial) {
align_existing_item->set_active();
}
alignment_items.push_back (RadioMenuElem (align_group, _("align with capture time"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), CaptureTime)));
- align_capture_item = dynamic_cast<RadioMenuItem*>(alignment_items.back());
+ align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
if (get_diskstream()->alignment_style() == CaptureTime) {
align_capture_item->set_active();
}
items.push_back (SeparatorElem());
items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
- route_active_menu_item = dynamic_cast<CheckMenuItem *> (items.back());
+ route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
route_active_menu_item->set_active (_route.active());
items.push_back (SeparatorElem());
AudioTimeAxisView::rename_current_playlist ()
{
ArdourPrompter prompter (true);
+ string name;
AudioPlaylist *pl;
DiskStream *ds;
prompter.set_prompt (_("Name for playlist"));
prompter.set_initial_text (pl->name());
- prompter.done.connect (Main::quit.slot());
- prompter.show_all ();
-
- Main::run ();
- if (prompter.status == Gtkmm2ext::Prompter::entered) {
- string name;
+ switch (prompter.run ()) {
+ case GTK_RESPONSE_ACCEPT:
prompter.get_result (name);
pl->set_name (name);
+ break;
+
+ default:
+ break;
}
}
{
AudioPlaylist *pl;
DiskStream *ds;
+ string name;
if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
return;
}
-
+
ArdourPrompter prompter (true);
string new_name = Playlist::bump_name (pl->name(), _session);
-
+
prompter.set_prompt (_("Name for playlist"));
prompter.set_initial_text (new_name);
- prompter.done.connect (Main::quit.slot());
prompter.show_all ();
- Main::run ();
-
- if (prompter.status == Gtkmm2ext::Prompter::entered) {
- string name;
+ switch (prompter.run ()) {
+ case GTK_RESPONSE_ACCEPT:
prompter.get_result (name);
-
ds->use_copy_playlist ();
-
pl = ds->playlist();
pl->set_name (name);
+ break;
+
+ default:
+ break;
}
}
{
AudioPlaylist *pl;
DiskStream *ds;
+ string name;
if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
return;
prompter.set_prompt (_("Name for playlist"));
prompter.set_initial_text (new_name);
- prompter.done.connect (Main::quit.slot());
- prompter.show_all ();
-
- Main::run ();
-
- if (prompter.status == Gtkmm2ext::Prompter::entered) {
- string name;
+
+ switch (prompter.run ()) {
+ case GTK_RESPONSE_ACCEPT:
prompter.get_result (name);
-
ds->use_new_playlist ();
-
pl = ds->playlist();
pl->set_name (name);
+ break;
+
+ default:
+ break;
}
}
AudioTimeAxisView::toggle_waveforms ()
{
if (view && waveform_item && !ignore_toggle) {
- view->set_show_waveforms (waveform_item->is_active());
+ view->set_show_waveforms (waveform_item->get_active());
}
}
speed = get_diskstream()->speed();
}
- jack_nframes_t start_adjusted = (jack_nframes_t) (start * speed);
- jack_nframes_t end_adjusted = (jack_nframes_t) (end * speed);
-
+ jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
+ jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
+
if (view && touched (top, bot)) {
view->get_selectables (start_adjusted, end_adjusted, results);
}
return FALSE;
}
-gint
-AudioTimeAxisView::name_entry_focus_out_handler (GdkEventFocus* ev)
-{
- name_entry_changed ();
- return TRUE;
-}
-
gint
AudioTimeAxisView::name_entry_key_release_handler (GdkEventKey* ev)
{
{
string x;
- ARDOUR_UI::generic_focus_out_event (0);
-
x = name_entry.get_text ();
if (x == _route.name()) {
XMLProperty* prop;
AutomationLine* line;
- gain_track = new GainAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("gain"),
+ gain_track = new GainAutomationTimeAxisView (_session,
+ _route,
+ editor,
+ *this,
+ parent_canvas,
+ _("gain"),
_route.gain_automation_curve());
-
- line = new AutomationGainLine ("automation gain", _session, *gain_track,
- gain_track->canvas_display,
- _route.gain_automation_curve(),
- PublicEditor::canvas_control_point_event,
- PublicEditor::canvas_line_event);
+ line = new AutomationGainLine ("automation gain",
+ _session,
+ *gain_track,
+ *gain_track->canvas_display,
+ _route.gain_automation_curve());
+
line->set_line_color (color_map[cAutomationLine]);
AutomationLine* line;
line = new AutomationPanLine ("automation pan", _session, *pan_track,
- pan_track->canvas_display,
- (*p)->automation(),
- PublicEditor::canvas_control_point_event,
- PublicEditor::canvas_line_event);
+ *pan_track->canvas_display,
+ (*p)->automation());
if (p == _route.panner().begin()) {
/* first line is a nice orange */
if (showit != gain_track->marked_for_display()) {
if (showit) {
gain_track->set_marked_for_display (true);
- gnome_canvas_item_show (gain_track->canvas_display);
+ gain_track->canvas_display->show();
gain_track->get_state_node()->add_property ("shown", X_("yes"));
} else {
gain_track->set_marked_for_display (false);
if (showit != pan_track->marked_for_display()) {
if (showit) {
pan_track->set_marked_for_display (true);
- gnome_canvas_item_show (pan_track->canvas_display);
+ pan_track->canvas_display->show();
pan_track->get_state_node()->add_property ("shown", X_("yes"));
} else {
pan_track->set_marked_for_display (false);
if ((ran = find_redirect_automation_node (redirect, what)) == 0) {
fatal << _("programming error: ")
- << compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
+ << string_compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
redirect->name(), what)
<< endmsg;
/*NOTREACHED*/
ral = new RedirectAutomationLine (name,
*redirect, what, _session, *ran->view,
- ran->view->canvas_display, redirect->automation_list (what),
- PublicEditor::canvas_control_point_event,
- PublicEditor::canvas_line_event);
+ *ran->view->canvas_display, redirect->automation_list (what));
ral->set_line_color (color_map[cRedirectAutomationLine]);
ral->queue_reset ();
string name = r->describe_parameter (*i);
items.push_back (CheckMenuElem (name));
- mitem = dynamic_cast<CheckMenuItem*> (items.back());
+ mitem = dynamic_cast<CheckMenuItem*> (&items.back());
if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
mitem->set_active(true);
}
- mitem->toggled.connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
+ mitem->signal_toggled().connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
}
/* add the menu for this redirect, because the subplugin
if (showit) {
ran->view->set_marked_for_display (true);
- gnome_canvas_item_show (ran->view->canvas_display);
+ ran->view->canvas_display->show();
} else {
rai->redirect->mark_automation_visible (ran->what, true);
ran->view->set_marked_for_display (false);
float speed = ds->speed();
if (speed != 1.0f) {
for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
- (*i).start = (jack_nframes_t)floor( (float) (*i).start * speed);
- (*i).end = (jack_nframes_t)floor( (float) (*i).end * speed);
+ (*i).start = session_frame_to_track_frame((*i).start, speed);
+ (*i).end = session_frame_to_track_frame((*i).end, speed);
}
}
}
if (get_diskstream()->speed() != 1.0f)
- pos = (jack_nframes_t) floor( (float) pos * get_diskstream()->speed() );
+ pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
_session.add_undo (playlist->get_memento());
playlist->paste (**p, pos, times);
playlist_menu = new Menu;
playlist_menu->set_name ("ArdourContextMenu");
- playlist_items.push_back (MenuElem (compose (_("Current: %1"), get_diskstream()->playlist()->name())));
+ playlist_items.push_back (MenuElem (string_compose (_("Current: %1"), get_diskstream()->playlist()->name())));
playlist_items.push_back (SeparatorElem());
playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &AudioTimeAxisView::rename_current_playlist)));