diff options
Diffstat (limited to 'gtk2_ardour')
44 files changed, 219 insertions, 1427 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index f5f4c62dac..d039f67c0e 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -60,7 +60,6 @@ AddRouteDialog::AddRouteDialog (Session* s) set_session (s); set_name ("AddRouteDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); diff --git a/gtk2_ardour/add_video_dialog.cc b/gtk2_ardour/add_video_dialog.cc index 395e16142c..a005b74467 100644 --- a/gtk2_ardour/add_video_dialog.cc +++ b/gtk2_ardour/add_video_dialog.cc @@ -68,7 +68,6 @@ AddVideoDialog::AddVideoDialog (Session* s) { set_session (s); set_name ("AddVideoDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (true); diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index c0e1708781..87b48d986a 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -34,12 +34,15 @@ sigc::signal<void> ArdourDialog::CloseAllDialogs; ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator) : Dialog (title, modal, use_seperator) + , _splash_pushed (false) { init (); + set_position (Gtk::WIN_POS_MOUSE); } ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator) : Dialog (title, parent, modal, use_seperator) + , _splash_pushed (false) { init (); set_position (Gtk::WIN_POS_CENTER_ON_PARENT); @@ -47,6 +50,13 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool ArdourDialog::~ArdourDialog () { + if (_splash_pushed) { + Splash* spl = Splash::instance(); + + if (spl) { + spl->pop_front(); + } + } } bool @@ -73,15 +83,16 @@ ArdourDialog::on_unmap () void ArdourDialog::on_show () { + Dialog::on_show (); + // never allow the splash screen to obscure any dialog Splash* spl = Splash::instance(); - if (spl) { + if (spl && spl->is_visible()) { spl->pop_back_for (*this); + _splash_pushed = true; } - - Dialog::on_show (); } void diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index 4f53662c23..1008f63000 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -46,6 +46,7 @@ class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr static void close_all_dialogs () { CloseAllDialogs(); } private: + bool _splash_pushed; void init (); static sigc::signal<void> CloseAllDialogs; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index eebd35aefb..c138fb1567 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -933,7 +933,6 @@ ARDOUR_UI::ask_about_saving_session (const vector<string>& actions) window.get_vbox()->pack_start (dhbox); window.set_name (_("Prompter")); - window.set_position (Gtk::WIN_POS_MOUSE); window.set_modal (true); window.set_resizable (false); @@ -1367,8 +1366,6 @@ ARDOUR_UI::open_recent_session () while (true) { - session_selector_window->set_position (WIN_POS_MOUSE); - ResponseType r = (ResponseType) session_selector_window->run (); switch (r) { @@ -3246,7 +3243,6 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) if (add_route_dialog == 0) { add_route_dialog = new AddRouteDialog (_session); - add_route_dialog->set_position (WIN_POS_MOUSE); if (float_window) { add_route_dialog->set_transient_for (*float_window); } @@ -3771,12 +3767,14 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual image->show(); hbox->show(); - switch (dialog.run ()) { + switch (dialog.run()) { case RESPONSE_ACCEPT: return 0; default: - return 1; + break; } + + return 1; } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 66335bb55b..3d3dacd868 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -142,17 +142,6 @@ ARDOUR_UI::install_actions () sigc::mem_fun (*editor, &PublicEditor::export_video)); ActionManager::session_sensitive_actions.push_back (act); -#ifdef WITH_CMT - - std::string anicomp_file_path; - - if (PBD::find_file_in_search_path (Glib::getenv("PATH"), "AniComp", anicomp_file_path)) { - act = ActionManager::register_action (main_actions, X_("aniConnect"), _("Connect"), (sigc::mem_fun (*editor, &PublicEditor::connect_to_image_compositor))); - ActionManager::session_sensitive_actions.push_back (act); - } - -#endif - act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc index 616cfbcb66..6330ecd6ac 100644 --- a/gtk2_ardour/ardour_window.cc +++ b/gtk2_ardour/ardour_window.cc @@ -35,6 +35,7 @@ ArdourWindow::ArdourWindow (string title) { set_title (title); init (); + set_position (Gtk::WIN_POS_MOUSE); } ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/) @@ -75,5 +76,15 @@ void ArdourWindow::init () { set_border_width (10); + + /* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but + they should be considered part of the same "window level" as a dialog. This + works on X11 and Quartz, in that: + + (a) utility & dialog windows are considered to be part of the same level + (b) they will float above normal windows without any particular effort + */ + + set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); } diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 6f90480457..424d81e901 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -76,9 +76,6 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox void lower_box_realized (); void cocoa_view_resized (); void on_realize (); - bool on_map_event (GdkEventAny*); - bool on_focus_in_event (GdkEventFocus*); - bool on_focus_out_event (GdkEventFocus*); void forward_key_event (GdkEventKey*); bool on_window_show (const std::string& /*title*/); @@ -93,7 +90,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox int prefwidth; Gtk::HBox top_box; - Gtk::EventBox low_box; + Gtk::HBox low_box; Gtk::VBox vpacker; Gtk::Label automation_mode_label; Gtk::ComboBoxText automation_mode_selector; @@ -105,6 +102,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox NSWindow* cocoa_window; NSView* au_view; + NSRect last_au_frame; /* Carbon */ diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index f394e305c8..7bebcee84f 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -1,5 +1,3 @@ -#include <gtkmm/stock.h> - #undef Marker #define Marker FuckYouAppleAndYourLackOfNameSpaces @@ -50,6 +48,26 @@ static const gchar* _automation_mode_strings[] = { 0 }; +static void +dump_view_tree (NSView* view, int depth) +{ + NSArray* subviews = [view subviews]; + unsigned long cnt = [subviews count]; + + for (int d = 0; d < depth; d++) { + cerr << '\t'; + } + NSRect frame = [view frame]; + cerr << " view @ " << frame.origin.x << ", " << frame.origin.y + << ' ' << frame.size.width << " x " << frame.size.height + << endl; + + for (unsigned long i = 0; i < cnt; ++i) { + NSView* subview = [subviews objectAtIndex:i]; + dump_view_tree (subview, depth+1); + } +} + @implementation NotificationObject - (NotificationObject*) initWithPluginUI: (AUPluginUI*) apluginui andCocoaParent: (NSWindow*) cp andTopLevelParent: (NSWindow*) tlp @@ -170,13 +188,16 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert) top_box.show (); low_box.show (); - _activating_from_app = false; cocoa_parent = 0; - _notify = 0; cocoa_window = 0; - carbon_window = 0; + +#ifdef WITH_CARBBON + _activating_from_app = false; + _notify = 0; au_view = 0; editView = 0; + carbon_window = 0; +#endif /* prefer cocoa, fall back to cocoa, but use carbon if its there */ @@ -227,6 +248,7 @@ AUPluginUI::~AUPluginUI () bool AUPluginUI::test_carbon_view_support () { +#ifdef WITH_CARBON bool ret = false; carbon_descriptor.componentType = kAudioUnitCarbonViewComponentType; @@ -253,6 +275,9 @@ AUPluginUI::test_carbon_view_support () } return ret; +#else + return false; +#endif } bool @@ -282,7 +307,7 @@ AUPluginUI::plugin_class_valid (Class pluginClass) int AUPluginUI::create_cocoa_view () { - BOOL wasAbleToLoadCustomView = NO; + bool wasAbleToLoadCustomView = false; AudioUnitCocoaViewInfo* cocoaViewInfo = NULL; UInt32 numberOfClasses = 0; UInt32 dataSize; @@ -380,7 +405,7 @@ AUPluginUI::create_cocoa_view () free (cocoaViewInfo); } - wasAbleToLoadCustomView = YES; + wasAbleToLoadCustomView = true; } } @@ -390,14 +415,16 @@ AUPluginUI::create_cocoa_view () au->get_au())); au_view = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()]; DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("view created @ %1\n", au_view)); - [(AUGenericView *)au_view setShowsExpertParameters:YES]; + [(AUGenericView *)au_view setShowsExpertParameters:1]; } // Get the initial size of the new AU View's frame NSRect rect = [au_view frame]; + prefheight = rect.size.height; + prefwidth = rect.size.width; low_box.set_size_request (rect.size.width, rect.size.height); - + return 0; } @@ -406,14 +433,11 @@ AUPluginUI::cocoa_view_resized () { GtkRequisition topsize = top_box.size_request (); NSWindow* window = get_nswindow (); - NSSize oldContentSize= [window contentRectForFrameRect:[window frame]].size; - NSSize newContentSize= [au_view frame].size; NSRect windowFrame= [window frame]; - - oldContentSize.height -= topsize.height; + NSRect new_frame = [au_view frame]; - float dy = oldContentSize.height - newContentSize.height; - float dx = oldContentSize.width - newContentSize.width; + float dy = last_au_frame.size.height - new_frame.size.height; + float dx = last_au_frame.size.width - new_frame.size.width; windowFrame.origin.y += dy; windowFrame.origin.x += dx; @@ -427,12 +451,30 @@ AUPluginUI::cocoa_view_resized () NSUInteger old_auto_resize = [au_view autoresizingMask]; [au_view setAutoresizingMask:NSViewNotSizable]; - [window setFrame:windowFrame display:YES]; + [window setFrame:windowFrame display:1]; + + /* Some stupid AU Views change the origin of the original AU View + when they are resized (I'm looking at you AUSampler). If the origin + has been moved, move it back. + */ + + if (last_au_frame.origin.x != new_frame.origin.x || + last_au_frame.origin.y != new_frame.origin.y) { + new_frame.origin = last_au_frame.origin; + [au_view setFrame:new_frame]; + /* also be sure to redraw the topbox because this can + also go wrong. + */ + top_box.queue_draw (); + } + [au_view setAutoresizingMask:old_auto_resize]; [[NSNotificationCenter defaultCenter] addObserver:_notify selector:@selector(auViewResized:) name:NSViewFrameDidChangeNotification object:au_view]; + + last_au_frame = new_frame; } int @@ -526,7 +568,6 @@ AUPluginUI::activate () #ifdef WITH_CARBON ActivateWindow (carbon_window, TRUE); #endif - // [cocoa_parent makeKeyAndOrderFront:nil]; } void @@ -603,7 +644,7 @@ AUPluginUI::parent_cocoa_window () return -1; } - [win setAutodisplay:YES]; // turn of GTK stuff for this window + [win setAutodisplay:1]; // turn of GTK stuff for this window Gtk::Container* toplevel = get_toplevel(); @@ -620,7 +661,9 @@ AUPluginUI::parent_cocoa_window () NSPoint origin = { 0, a.height }; [au_view setFrameOrigin:origin]; - [view addSubview:au_view positioned:NSWindowBelow relativeTo:nil]; + [view addSubview:au_view positioned:NSWindowBelow relativeTo:nil]; + + last_au_frame = [au_view frame]; // watch for size changes of the view @@ -633,23 +676,6 @@ AUPluginUI::parent_cocoa_window () return 0; } -static void -dump_view_tree (NSView* view, int depth) -{ - NSArray* subviews = [view subviews]; - unsigned long cnt = [subviews count]; - - for (int d = 0; d < depth; d++) { - cerr << '\t'; - } - cerr << " view @ " << view << endl; - - for (unsigned long i = 0; i < cnt; ++i) { - NSView* subview = [subviews objectAtIndex:i]; - dump_view_tree (subview, depth+1); - } -} - void AUPluginUI::forward_key_event (GdkEventKey* ev) { @@ -681,7 +707,7 @@ AUPluginUI::on_realize () NSWindow* win = get_nswindow (); if (win) { - [win setShowsResizeIndicator:NO]; + [win setShowsResizeIndicator:0]; } } @@ -695,12 +721,6 @@ AUPluginUI::lower_box_realized () } } -bool -AUPluginUI::on_map_event (GdkEventAny*) -{ - return false; -} - void AUPluginUI::on_window_hide () { @@ -710,8 +730,14 @@ AUPluginUI::on_window_hide () ActivateWindow (carbon_window, FALSE); } #endif - hide_all (); + +#if 0 + NSArray* wins = [NSApp windows]; + for (uint32_t i = 0; i < [wins count]; i++) { + id win = [wins objectAtIndex:i]; + } +#endif } bool @@ -753,19 +779,4 @@ create_au_gui (boost::shared_ptr<PluginInsert> plugin_insert, VBox** box) return aup; } -bool -AUPluginUI::on_focus_in_event (GdkEventFocus*) -{ - //cerr << "au plugin focus in\n"; - //Keyboard::magic_widget_grab_focus (); - return false; -} - -bool -AUPluginUI::on_focus_out_event (GdkEventFocus*) -{ - //cerr << "au plugin focus out\n"; - //Keyboard::magic_widget_drop_focus (); - return false; -} diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 169c66874b..bfce754b70 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1540,7 +1540,6 @@ AudioRegionView::show_region_editor () } editor->present (); - editor->set_position (Gtk::WIN_POS_MOUSE); editor->show_all(); } diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index 88e6d87e01..29635c8488 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -21,6 +21,13 @@ #ifndef __ardour_gtk_automation_controller_h__ #define __ardour_gtk_automation_controller_h__ +#ifdef YES +#undef YES +#endif +#ifdef NO +#undef NO +#endif + #include <boost/shared_ptr.hpp> #include <gtkmm.h> diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc index e9cddbd754..c7754f69cc 100644 --- a/gtk2_ardour/bundle_manager.cc +++ b/gtk2_ardour/bundle_manager.cc @@ -115,7 +115,6 @@ BundleEditorMatrix::add_channel (boost::shared_ptr<Bundle> b, DataType t) if (b == _bundle) { NameChannelDialog d; - d.set_position (Gtk::WIN_POS_MOUSE); if (d.run () != Gtk::RESPONSE_ACCEPT) { return; @@ -162,7 +161,6 @@ void BundleEditorMatrix::rename_channel (BundleChannel bc) { NameChannelDialog d (bc.bundle, bc.channel); - d.set_position (Gtk::WIN_POS_MOUSE); if (d.run () != Gtk::RESPONSE_ACCEPT) { return; diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 214ba7fb06..c545a02b46 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -105,7 +105,6 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, d set_wmclass (X_("ardour_automationedit"), PROGRAM_NAME); set_name ("CrossfadeEditWindow"); - set_position (Gtk::WIN_POS_MOUSE); add_accel_group (ActionManager::ui_manager->get_accel_group()); diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc index 2782122dbf..3d72e080ed 100644 --- a/gtk2_ardour/edit_note_dialog.cc +++ b/gtk2_ardour/edit_note_dialog.cc @@ -146,16 +146,13 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n) add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT); set_default_response (Gtk::RESPONSE_ACCEPT); - - show_all (); } -int -EditNoteDialog::run () +void +EditNoteDialog::done (int r) { - int const r = Dialog::run (); if (r != RESPONSE_ACCEPT) { - return r; + return; } /* These calls mean that if a value is entered using the keyboard @@ -227,6 +224,4 @@ EditNoteDialog::run () for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) { (*i)->set_selected ((*i)->selected()); // change color } - - return r; } diff --git a/gtk2_ardour/edit_note_dialog.h b/gtk2_ardour/edit_note_dialog.h index 11fd70a91c..59e53722a0 100644 --- a/gtk2_ardour/edit_note_dialog.h +++ b/gtk2_ardour/edit_note_dialog.h @@ -28,11 +28,11 @@ class NoteBase; class EditNoteDialog : public ArdourDialog { public: - EditNoteDialog (MidiRegionView *, std::set<NoteBase*>); + EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n); - int run (); - -private: + void done (int); + + private: MidiRegionView* _region_view; std::set<NoteBase*> _events; Gtk::SpinButton _channel; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index bad7fb06ca..33f23951b8 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -119,10 +119,6 @@ #include "i18n.h" -#ifdef WITH_CMT -#include "imageframe_socket_handler.h" -#endif - using namespace std; using namespace ARDOUR; using namespace PBD; @@ -270,10 +266,6 @@ Editor::Editor () , _toolbar_viewport (*manage (new Gtk::Adjustment (0, 0, 1e10)), *manage (new Gtk::Adjustment (0, 0, 1e10))) -#ifdef WITH_CMT - , image_socket_listener(0) -#endif - /* nudge */ , nudge_clock (new AudioClock (X_("nudge"), false, X_("nudge"), true, false, true)) @@ -768,18 +760,6 @@ Editor::Editor () Editor::~Editor() { -#ifdef WITH_CMT - if(image_socket_listener) { - if(image_socket_listener->is_connected()) - { - image_socket_listener->close_connection() ; - } - - delete image_socket_listener ; - image_socket_listener = 0 ; - } -#endif - delete button_bindings; delete _routes; delete _route_groups; @@ -3333,8 +3313,6 @@ Editor::duplicate_range (bool with_dialog) win.add_button (_("Duplicate"), RESPONSE_ACCEPT); win.set_default_response (RESPONSE_ACCEPT); - win.set_position (WIN_POS_MOUSE); - spinner.grab_focus (); switch (win.run ()) { @@ -5417,7 +5395,6 @@ Editor::change_region_layering_order (bool from_context_menu) if (layering_order_editor == 0) { layering_order_editor = new RegionLayeringOrderEditor (*this); - layering_order_editor->set_position (WIN_POS_MOUSE); } layering_order_editor->set_context (clicked_routeview->name(), _session, clicked_routeview, pl, position); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index f9bbd6ef1a..0647b17089 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -97,14 +97,25 @@ class BundleManager; class ButtonJoiner; class ControlPoint; class DragManager; +class EditNoteDialog; +class EditorCursor; +class EditorGroupTabs; +class EditorLocations; +class EditorRegions; +class EditorRoutes; +class EditorRouteGroups; +class EditorSnapshots; +class EditorSummary; class GroupedButtons; class GUIObjectState; class Marker; class MidiRegionView; class MixerStrip; +class MouseCursors; class NoteBase; class PlaylistSelector; class PluginSelector; +class ProgressReporter; class RhythmFerret; class Selection; class SoundFileOmega; @@ -113,29 +124,9 @@ class TempoLines; class TimeAxisView; class TimeFXDialog; class TimeSelection; -class EditorGroupTabs; -class EditorRoutes; -class EditorRouteGroups; -class EditorRegions; -class EditorLocations; -class EditorSnapshots; -class EditorSummary; class RegionLayeringOrderEditor; -class ProgressReporter; -class EditorCursor; -class MouseCursors; class VerboseCursor; -/* <CMT Additions> */ -class ImageFrameView; -class ImageFrameTimeAxisView; -class ImageFrameTimeAxis; -class MarkerTimeAxis ; -class MarkerView ; -class ImageFrameSocketHandler ; -class TimeAxisViewItem ; -/* </CMT Additions> */ - class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public Gtkmm2ext::VisibilityTracker { public: @@ -1506,7 +1497,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void edit_tempo_marker (ArdourCanvas::Item*); void edit_meter_marker (ArdourCanvas::Item*); void edit_control_point (ArdourCanvas::Item*); - void edit_notes (std::set<NoteBase*> const & s); + void edit_notes (TimeAxisViewItem&); void marker_menu_edit (); void marker_menu_remove (); @@ -2110,7 +2101,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool _following_mixer_selection; int time_fx (ARDOUR::RegionList&, float val, bool pitching); - + void note_edit_done (int, EditNoteDialog*); void toggle_sound_midi_notes (); /** Flag for a bit of a hack wrt control point selection; see set_selected_control_point_from_click */ diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index abc6ea96ad..4acd04a318 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -79,10 +79,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) temporal_zoom_step (false); zoom_focus = temp_focus; return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { direction = GDK_SCROLL_LEFT; goto retry; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y); @@ -108,10 +108,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) temporal_zoom_step (true); zoom_focus = temp_focus; return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { direction = GDK_SCROLL_RIGHT; goto retry; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y); diff --git a/gtk2_ardour/editor_imageframe.cc b/gtk2_ardour/editor_imageframe.cc deleted file mode 100644 index e36250f8b5..0000000000 --- a/gtk2_ardour/editor_imageframe.cc +++ /dev/null @@ -1,1113 +0,0 @@ -/* - Copyright (C) 2000-2003 Paul Davis - Written by Colin Law, CMT, Glasgow - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "imageframe_view.h" -#include "imageframe_time_axis.h" -#include "imageframe_time_axis_view.h" -#include "imageframe_time_axis_group.h" -#include "marker_time_axis_view.h" -#include "marker_time_axis.h" -#include "marker_view.h" -#include "editor.h" -#include "i18n.h" - -#include <gtkmm2ext/gtk_ui.h> -#include "pbd/error.h" - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <unistd.h> -#include <arpa/inet.h> - -#include "imageframe_socket_handler.h" -#include "ardour_image_compositor_socket.h" -#include "public_editor.h" -#include "gui_thread.h" - -using namespace Gtk; -using namespace PBD; -using namespace std; - -TimeAxisView* -Editor::get_named_time_axis(const string & name) -{ - TimeAxisView* tav = 0 ; - - for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) - { - if (((TimeAxisView*)*i)->name() == name) - { - tav = ((TimeAxisView*)*i) ; - break ; - } - } - return(tav) ; -} - -/* <CMT Additions file="editor.cc"> */ - -void -Editor::add_imageframe_time_axis(const string & track_name, void* src) -{ - // check for duplicate name - if(get_named_time_axis(track_name)) - { - warning << "Repeated time axis name" << std::endl ; - } - else - { - Gtkmm2ext::UI::instance()->call_slot (boost::bind (&Editor::handle_new_imageframe_time_axis_view, this,track_name, src)); - } -} - -void -Editor::connect_to_image_compositor() -{ - if(image_socket_listener == 0) - { - image_socket_listener = ImageFrameSocketHandler::create_instance(*this) ; - } - - if(image_socket_listener->is_connected() == true) - { - return ; - } - - // XXX should really put this somewhere safe - const char * host_ip = "127.0.0.1" ; - - bool retcode = image_socket_listener->connect(host_ip, ardourvis::DEFAULT_PORT) ; - - if(retcode == false) - { - // XXX need to get some return status here - warning << "Image Compositor Connection attempt failed" << std::endl ; - return ; - } - - // add the socket to the gui loop, and keep the retuned tag value of the input - gint tag = gdk_input_add(image_socket_listener->get_socket_descriptor(), GDK_INPUT_READ,ImageFrameSocketHandler::image_socket_callback,image_socket_listener) ; - image_socket_listener->set_gdk_input_tag(tag) ; -} - -void -Editor::scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) -{ - // GTK2FIX - //framepos_t offset = static_cast<framepos_t>(frames_per_unit * (edit_hscroll_slider_width/2)) ; - framepos_t offset = 0; - - framepos_t x_pos = 0 ; - - if (item->get_position() < offset) { - x_pos = 0 ; - } else { - x_pos = item->get_position() - offset + (item->get_duration() / 2); - } - - reset_x_origin (x_pos); -} - -void -Editor::add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void* src) -{ - // Can we only sigc::bind 2 data Items? - // @todo we really want to sigc::bind the src attribute too, for the moment tracks can only be added remotely, - // so this is not too much of an issue, however will need to be looked at again - Gtkmm2ext::UI::instance()->call_slot (boost::bind (&Editor::handle_new_imageframe_marker_time_axis_view, this, track_name, marked_track)); -} - -void -Editor::popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item) -{ - ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ; - - if(ifta) - { - ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_selected_imageframe_group() ; - - if(iftag) - { - ImageFrameView* selected_ifv = ifta->get_view()->get_selected_imageframe_view() ; - ifta->popup_imageframe_edit_menu(button, time, selected_ifv, with_item) ; - } - } -} - -void -Editor::popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item) -{ - MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(clicked_axisview) ; - - if(mta) - { - MarkerView* selected_mv = mta->get_view()->get_selected_time_axis_item() ; - if(selected_mv) - { - mta->popup_marker_time_axis_edit_menu(button,time, selected_mv, with_item) ; - } - } -} -/* </CMT Additions file="editor.cc"> */ - -/* <CMT Additions file="editor_canvas_events.cc"> */ -bool -Editor::canvas_imageframe_item_view_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv) -{ - gint ret = FALSE ; - ImageFrameTimeAxisGroup* iftag = 0 ; - - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &ifv->get_time_axis_view(); - iftag = ifv->get_time_axis_group() ; - dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv); - ret = button_press_handler (item, event, ImageFrameItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler (item, event, ImageFrameItem) ; - break ; - case GDK_MOTION_NOTIFY: - ret = motion_handler (item, event, ImageFrameItem) ; - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_imageframe_start_handle_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv) -{ - gint ret = FALSE ; - ImageFrameTimeAxisGroup* iftag = 0 ; - - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &ifv->get_time_axis_view() ; - iftag = ifv->get_time_axis_group() ; - dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv); - - ret = button_press_handler (item, event, ImageFrameHandleStartItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler (item, event, ImageFrameHandleStartItem) ; - break; - case GDK_MOTION_NOTIFY: - ret = motion_handler (item, event, ImageFrameHandleStartItem) ; - break ; - case GDK_ENTER_NOTIFY: - ret = enter_handler (item, event, ImageFrameHandleStartItem) ; - break ; - case GDK_LEAVE_NOTIFY: - ret = leave_handler (item, event, ImageFrameHandleStartItem) ; - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_imageframe_end_handle_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv) -{ - gint ret = FALSE ; - ImageFrameTimeAxisGroup* iftag = 0 ; - - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &ifv->get_time_axis_view() ; - iftag = ifv->get_time_axis_group() ; - dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv); - - ret = button_press_handler (item, event, ImageFrameHandleEndItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler (item, event, ImageFrameHandleEndItem) ; - break ; - case GDK_MOTION_NOTIFY: - ret = motion_handler (item, event, ImageFrameHandleEndItem) ; - break ; - case GDK_ENTER_NOTIFY: - ret = enter_handler (item, event, ImageFrameHandleEndItem) ; - break ; - case GDK_LEAVE_NOTIFY: - ret = leave_handler (item, event, ImageFrameHandleEndItem); - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_imageframe_view_event (GdkEvent* event, ArdourCanvas::Item* item, ImageFrameTimeAxis* ifta) -{ - gint ret = FALSE ; - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = ifta ; - ret = button_press_handler (item, event, ImageFrameTimeAxisItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler (item, event, ImageFrameTimeAxisItem) ; - break ; - case GDK_MOTION_NOTIFY: - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_marker_time_axis_view_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerTimeAxis* mta) -{ - gint ret = FALSE ; - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = mta ; - ret = button_press_handler(item, event, MarkerTimeAxisItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler(item, event, MarkerTimeAxisItem) ; - break ; - case GDK_MOTION_NOTIFY: - default: - break ; - } - return(ret) ; -} - - -bool -Editor::canvas_markerview_item_view_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta) -{ - gint ret = FALSE ; - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &mta->get_time_axis_view() ; - dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta); - ret = button_press_handler(item, event, MarkerViewItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler(item, event, MarkerViewItem) ; - break ; - case GDK_MOTION_NOTIFY: - ret = motion_handler(item, event, MarkerViewItem) ; - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_markerview_start_handle_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta) -{ - gint ret = FALSE ; - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &mta->get_time_axis_view() ; - dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta) ; - ret = button_press_handler(item, event, MarkerViewHandleStartItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler(item, event, MarkerViewHandleStartItem) ; - break ; - case GDK_MOTION_NOTIFY: - ret = motion_handler(item, event, MarkerViewHandleStartItem) ; - break ; - case GDK_ENTER_NOTIFY: - ret = enter_handler(item, event, MarkerViewHandleStartItem) ; - break ; - case GDK_LEAVE_NOTIFY: - ret = leave_handler(item, event, MarkerViewHandleStartItem) ; - break ; - default: - break ; - } - return(ret) ; -} - -bool -Editor::canvas_markerview_end_handle_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta) -{ - gint ret = FALSE ; - switch (event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - clicked_axisview = &mta->get_time_axis_view() ; - dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta) ; - ret = button_press_handler(item, event, MarkerViewHandleEndItem) ; - break ; - case GDK_BUTTON_RELEASE: - ret = button_release_handler(item, event, MarkerViewHandleEndItem) ; - break ; - case GDK_MOTION_NOTIFY: - ret = motion_handler(item, event, MarkerViewHandleEndItem) ; - break ; - case GDK_ENTER_NOTIFY: - ret = enter_handler(item, event, MarkerViewHandleEndItem) ; - break ; - case GDK_LEAVE_NOTIFY: - ret = leave_handler(item, event, MarkerViewHandleEndItem) ; - break ; - default: - break ; - } - return(ret) ; -} - - -/* </CMT Additions file="editor_canvas_events.cc"> */ - - -/* - --------------------------------------------------------------------------------------------------- - --------------------------------------------------------------------------------------------------- - --------------------------------------------------------------------------------------------------- -*/ - - - -/* <CMT Additions file="editor_mouse.cc"> */ - -void -Editor::start_imageframe_grab(ArdourCanvas::Item* item, GdkEvent* event) -{ - ImageFrameView* ifv = ((ImageFrameTimeAxis*)clicked_axisview)->get_view()->get_selected_imageframe_view() ; - drag_info.copy = false ; - drag_info.item = item ; - drag_info.data = ifv ; - drag_info.motion_callback = &Editor::imageframe_drag_motion_callback; - drag_info.finished_callback = &Editor::timeaxis_item_drag_finished_callback; - drag_info.last_frame_position = ifv->get_position() ; - - drag_info.source_trackview = &ifv->get_time_axis_view() ; - drag_info.dest_trackview = drag_info.source_trackview; - - /* this is subtle. raising the regionview itself won't help, - because raise_to_top() just puts the item on the top of - its parent's stack. so, we need to put the trackview canvas_display group - on the top, since its parent is the whole canvas. - - however, this hides the measure bars within that particular trackview, - so move them to the top afterwards. - */ - - drag_info.item->raise_to_top(); - drag_info.source_trackview->canvas_display->raise_to_top(); - //time_line_group->raise_to_top(); - cursor_group->raise_to_top (); - - start_grab(event) ; - - drag_info.pointer_frame_offset = pixel_to_sample(drag_info.grab_x) - drag_info.last_frame_position; -} - - -void -Editor::start_markerview_grab(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = ((MarkerTimeAxis*)clicked_axisview)->get_view()->get_selected_time_axis_item() ; - drag_info.copy = false ; - drag_info.item = item ; - drag_info.data = mv ; - drag_info.motion_callback = &Editor::markerview_drag_motion_callback; - drag_info.finished_callback = &Editor::timeaxis_item_drag_finished_callback; - drag_info.last_frame_position = mv->get_position() ; - - drag_info.source_trackview = &mv->get_time_axis_view() ; - drag_info.dest_trackview = drag_info.source_trackview; - - /* this is subtle. raising the regionview itself won't help, - because raise_to_top() just puts the item on the top of - its parent's stack. so, we need to put the trackview canvas_display group - on the top, since its parent is the whole canvas. - - however, this hides the measure bars within that particular trackview, - so move them to the top afterwards. - */ - - drag_info.item->raise_to_top(); - drag_info.source_trackview->canvas_display->raise_to_top(); - //time_line_group->raise_to_top(); - cursor_group->raise_to_top (); - - start_grab(event) ; - - drag_info.pointer_frame_offset = pixel_to_sample(drag_info.grab_x) - drag_info.last_frame_position ; -} - - -void -Editor::markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) -{ - double cx, cy ; - - MarkerView* mv = reinterpret_cast<MarkerView*>(drag_info.data) ; - framepos_t pending_region_position ; - framepos_t pointer_frame ; - - pointer_frame = canvas_event_frame(event, &cx, &cy) ; - - snap_to(pointer_frame) ; - - if (pointer_frame > (framepos_t) drag_info.pointer_frame_offset) - { - pending_region_position = pointer_frame - drag_info.pointer_frame_offset ; - snap_to(pending_region_position) ; - - // we dont allow marker items to extend beyond, or in front of the marked items so - // cap the value to the marked items position and duration - if((pending_region_position + mv->get_duration()) >= ((mv->get_marked_item()->get_position()) + (mv->get_marked_item()->get_duration()))) - { - pending_region_position = (mv->get_marked_item()->get_position() + mv->get_marked_item()->get_duration()) - (mv->get_duration()) ; - } - else if(pending_region_position <= mv->get_marked_item()->get_position()) - { - pending_region_position = mv->get_marked_item()->get_position() ; - } - } - else - { - pending_region_position = mv->get_marked_item()->get_position() ; - } - - drag_info.last_frame_position = pending_region_position ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - mv->set_position(pending_region_position, 0) ; - - show_verbose_time_cursor(pending_region_position) ; -} - -void -Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) -{ - double cx, cy ; - - ImageFrameView* ifv = reinterpret_cast<ImageFrameView*>(drag_info.data) ; - - framepos_t pending_region_position; - framepos_t pointer_frame; - - pointer_frame = canvas_event_frame(event, &cx, &cy) ; - - snap_to(pointer_frame) ; - - if (pointer_frame > (framepos_t) drag_info.pointer_frame_offset) - { - pending_region_position = pointer_frame - drag_info.pointer_frame_offset ; - snap_to(pending_region_position) ; - } - else - { - pending_region_position = 0 ; - } - - drag_info.grab_x = cx; - //drag_info.last_frame_position = pending_region_position ; - drag_info.current_pointer_frame = pending_region_position ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - ifv->set_position(pending_region_position, 0) ; - - show_verbose_time_cursor(pending_region_position) ; -} - -void -Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* event) -{ - framepos_t where ; - TimeAxisViewItem* tavi = reinterpret_cast<TimeAxisViewItem*>(drag_info.data) ; - - bool item_x_movement = (drag_info.last_frame_position != tavi->get_position()) ; - - hide_verbose_canvas_cursor() ; - - /* no x or y movement either means the regionview hasn't been moved, or has been moved - but is back in it's original position/trackview.*/ - - if(!item_x_movement && event && event->type == GDK_BUTTON_RELEASE) - { - /* No motion: either set the current region, or align the clicked region - with the current one. - */ - return; - } - - if(item_x_movement) - { - /* base the new region position on the current position of the regionview.*/ - where = drag_info.current_pointer_frame ; - - // final call to set position after the motion to tell interested parties of the new position - tavi->set_position(where, this) ; - } - else - { - //where = tavi->get_position() ; - } - -/* - //locate so user can audition the edit - if ( !session->transport_rolling() && Config->get_always_play_range()) { - locate_with_edit_preroll ( arv->region()->position() ); - } -*/ -} - - -void -Editor::imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) -{ - // get the selected item from the parent time axis - ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ; - if(ifta) - { - ImageFrameView* ifv = ifta->get_view()->get_selected_imageframe_view() ; - - if (ifv == 0) { - fatal << _("programming error: no ImageFrameView selected") << endmsg; - /*NOTREACHED*/ - return ; - } - - drag_info.item = ifv->get_canvas_frame() ; - drag_info.data = ifv; - drag_info.grab_x = event->motion.x; - drag_info.cumulative_x_drag = 0; - drag_info.motion_callback = &Editor::imageframe_start_handle_trim_motion ; - drag_info.finished_callback = &Editor::imageframe_start_handle_end_trim ; - - start_grab(event) ; - - show_verbose_time_cursor(ifv->get_position(), 10) ; - } -} - -void -Editor::imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) -{ - // get the selected item from the parent time axis - ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ; - - if(ifta) - { - ImageFrameView* ifv = ifta->get_view()->get_selected_imageframe_view() ; - - if (ifv == 0) - { - fatal << _("programming error: no ImageFrameView selected") << endmsg ; - /*NOTREACHED*/ - return ; - } - - drag_info.item = ifv->get_canvas_frame() ; - drag_info.data = ifv ; - drag_info.grab_x = event->motion.x ; - drag_info.cumulative_x_drag = 0 ; - drag_info.motion_callback = &Editor::imageframe_end_handle_trim_motion ; - drag_info.finished_callback = &Editor::imageframe_end_handle_end_trim ; - - start_grab(event, trimmer_cursor) ; - - show_verbose_time_cursor(ifv->get_position() + ifv->get_duration(), 10) ; - } -} - -void -Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) -{ - ImageFrameView* ifv = reinterpret_cast<ImageFrameView*> (drag_info.data) ; - - framepos_t start = 0 ; - framepos_t end = 0 ; - framepos_t pointer_frame = canvas_event_frame(event) ; - - // chekc th eposition of the item is not locked - if(!ifv->get_position_locked()) { - snap_to(pointer_frame) ; - - if(pointer_frame != drag_info.last_pointer_frame) { - start = ifv->get_position() ; - end = ifv->get_position() + ifv->get_duration() ; - - if (pointer_frame > end) { - start = end ; - } else { - start = pointer_frame ; - } - - // are we getting bigger or smaller? - framepos_t new_dur_val = end - start ; - - // start handle, so a smaller pointer frame increases our component size - if(pointer_frame <= drag_info.grab_frame) - { - if(ifv->get_max_duration_active() && (new_dur_val > ifv->get_max_duration())) - { - new_dur_val = ifv->get_max_duration() ; - start = end - new_dur_val ; - } - else - { - // current values are ok - } - } - else - { - if(ifv->get_min_duration_active() && (new_dur_val < ifv->get_min_duration())) - { - new_dur_val = ifv->get_min_duration() ; - start = end - new_dur_val ; - } - else - { - // current values are ok - } - } - - drag_info.last_pointer_frame = pointer_frame ; - - /* re-calculatethe duration and position of the imageframeview */ - drag_info.cumulative_x_drag = new_dur_val ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - ifv->set_duration(new_dur_val, 0) ; - ifv->set_position(start, 0) ; - } - } - - show_verbose_time_cursor(start, 10) ; -} - -void -Editor::imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) -{ - ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ; - - if (drag_info.cumulative_x_drag == 0) - { - /* just a click */ - } - else - { - framepos_t temp = ifv->get_position() + ifv->get_duration() ; - - ifv->set_position((framepos_t) (temp - drag_info.cumulative_x_drag), this) ; - ifv->set_duration((framepos_t) drag_info.cumulative_x_drag, this) ; - } -} - -void -Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) -{ - ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ; - - framepos_t start = 0 ; - framepos_t end = 0 ; - framepos_t pointer_frame = canvas_event_frame(event) ; - framepos_t new_dur_val = 0 ; - - snap_to(pointer_frame) ; - - if (pointer_frame != drag_info.last_pointer_frame) - { - start = ifv->get_position() ; - end = ifv->get_position() + ifv->get_duration() ; - if (pointer_frame < start) - { - end = start ; - } - else - { - end = pointer_frame ; - } - - new_dur_val = end - start ; - - // are we getting bigger or smaller? - if(pointer_frame >= drag_info.last_pointer_frame) - { - if(ifv->get_max_duration_active() && (new_dur_val > ifv->get_max_duration())) - { - new_dur_val = ifv->get_max_duration() ; - } - } - else - { - if(ifv->get_min_duration_active() && (new_dur_val < ifv->get_min_duration())) - { - new_dur_val = ifv->get_min_duration() ; - } - } - - drag_info.last_pointer_frame = pointer_frame ; - drag_info.cumulative_x_drag = new_dur_val ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - ifv->set_duration(new_dur_val, 0) ; - } - - show_verbose_time_cursor(new_dur_val, 10) ; -} - - -void -Editor::imageframe_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* event) -{ - ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ; - - if (drag_info.cumulative_x_drag == 0) - { - /* just a click */ - } - else - { - framepos_t new_duration = (framepos_t)drag_info.cumulative_x_drag ; - if((new_duration <= ifv->get_max_duration()) && (new_duration >= ifv->get_min_duration())) - { - ifv->set_duration(new_duration, this) ; - } - } -} - - -void -Editor::markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->get_selected_time_axis_item() ; - - if (mv == 0) - { - fatal << _("programming error: no MarkerView selected") << endmsg ; - /*NOTREACHED*/ - return ; - } - - drag_info.item = mv->get_canvas_frame() ; - drag_info.data = mv; - drag_info.grab_x = event->motion.x; - - drag_info.cumulative_x_drag = 0 ; - drag_info.motion_callback = &Editor::markerview_start_handle_trim_motion ; - drag_info.finished_callback = &Editor::markerview_start_handle_end_trim ; - - start_grab(event, trimmer_cursor) ; -} - -void -Editor::markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->get_selected_time_axis_item() ; - if (mv == 0) - { - fatal << _("programming error: no MarkerView selected") << endmsg ; - /*NOTREACHED*/ - return ; - } - - drag_info.item = mv->get_canvas_frame() ; - drag_info.data = mv ; - drag_info.grab_x = event->motion.x ; - drag_info.cumulative_x_drag = 0 ; - - drag_info.motion_callback = &Editor::markerview_end_handle_trim_motion ; - drag_info.finished_callback = &Editor::markerview_end_handle_end_trim ; - - start_grab(event, trimmer_cursor) ; -} - - -void -Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - - framepos_t start = 0 ; - framepos_t end = 0 ; - framepos_t pointer_frame = canvas_event_frame(event) ; - - // chekc th eposition of the item is not locked - if(!mv->get_position_locked()) - { - snap_to(pointer_frame) ; - if(pointer_frame != drag_info.last_pointer_frame) - { - start = mv->get_position() ; - end = mv->get_position() + mv->get_duration() ; - - if (pointer_frame > end) - { - start = end ; - } - else - { - start = pointer_frame ; - } - - // are we getting bigger or smaller? - framepos_t new_dur_val = end - start ; - - if(pointer_frame <= drag_info.grab_frame) - { - if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration())) - { - new_dur_val = mv->get_max_duration() ; - start = end - new_dur_val ; - } - else - { - // current values are ok - } - } - else - { - if(mv->get_min_duration_active() && (new_dur_val < mv->get_min_duration())) - { - new_dur_val = mv->get_min_duration() ; - start = end - new_dur_val ; - } - else - { - // current values are ok - } - } - - drag_info.last_pointer_frame = pointer_frame ; - - /* re-calculatethe duration and position of the imageframeview */ - drag_info.cumulative_x_drag = new_dur_val ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - mv->set_duration(new_dur_val, 0) ; - mv->set_position(start, 0) ; - } - } - - show_verbose_time_cursor(start, 10) ; -} - -void -Editor::markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - - if (drag_info.cumulative_x_drag == 0) - { - /* just a click */ - } - else - { - framepos_t temp = mv->get_position() + mv->get_duration() ; - - mv->set_position((framepos_t) (temp - drag_info.cumulative_x_drag), this) ; - mv->set_duration((framepos_t) drag_info.cumulative_x_drag, this) ; - } -} - -void -Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - - framepos_t start = 0 ; - framepos_t end = 0 ; - framepos_t pointer_frame = canvas_event_frame(event) ; - framepos_t new_dur_val = 0 ; - - snap_to(pointer_frame) ; - - if (pointer_frame != drag_info.last_pointer_frame) - { - start = mv->get_position() ; - end = mv->get_position() + mv->get_duration() ; - - if(pointer_frame < start) - { - end = start ; - } - else - { - end = pointer_frame ; - } - - new_dur_val = end - start ; - - // are we getting bigger or smaller? - if(pointer_frame >= drag_info.last_pointer_frame) - { - // we cant extend beyond the item we are marking - ImageFrameView* marked_item = mv->get_marked_item() ; - framepos_t marked_end = marked_item->get_position() + marked_item->get_duration() ; - - if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration())) - { - if((start + mv->get_max_duration()) > marked_end) - { - new_dur_val = marked_end - start ; - } - else - { - new_dur_val = mv->get_max_duration() ; - } - } - else if(end > marked_end) - { - new_dur_val = marked_end - start ; - } - } - else - { - if(mv->get_min_duration_active() && (new_dur_val < mv->get_min_duration())) - { - new_dur_val = mv->get_min_duration() ; - } - } - - - drag_info.last_pointer_frame = pointer_frame ; - drag_info.cumulative_x_drag = new_dur_val ; - - // we treat this as a special case, usually we want to send the identitiy of the caller - // but in this case, that would trigger our socket handler to handle the event, sending - // notification to the image compositor. This would be fine, except that we have not - // finished the drag, we therefore do not want to sent notification until we have - // completed the drag, only then do we want the image compositor notofied. - // We therefore set the caller identity to the special case of 0 - mv->set_duration(new_dur_val, 0) ; - } - - show_verbose_time_cursor(new_dur_val, 10) ; -} - - -void -Editor::markerview_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* event) -{ - MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - - if (drag_info.cumulative_x_drag == 0) - { - /* just a click */ - } - else - { - framepos_t new_duration = (framepos_t)drag_info.cumulative_x_drag ; - mv->set_duration(new_duration, this) ; - } -} - - -/* </CMT Additions file="editor_mouse.cc"> */ - - - - - - - -/* <CMT Additions file="editor_route_list.cc"> */ - -void -Editor::handle_new_imageframe_time_axis_view(const string & track_name, void* src) -{ - ImageFrameTimeAxis* iftav ; - iftav = new ImageFrameTimeAxis(track_name, *this, *session, *track_canvas) ; - iftav->set_time_axis_name(track_name, this) ; - track_views.push_back(iftav) ; - - TreeModel::Row row = *(route_display_model->append()); - - row[route_display_columns.text] = iftav->name(); - row[route_display_columns.tv] = iftav; - route_list_display.get_selection()->select (row); - - iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ; -} - -void -Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) -{ - MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->session(), *track_canvas, track_name, marked_track) ; - ((ImageFrameTimeAxis*)marked_track)->add_marker_time_axis(mta, this) ; - track_views.push_back(mta) ; - - TreeModel::Row row = *(route_display_model->append()); - - row[route_display_columns.text] = mta->name(); - row[route_display_columns.tv] = mta; - route_list_display.get_selection()->select (row); -} - - -/* </CMT Additions file="editor_route_list.cc"> */ diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index ff28f7b56a..c9a151f96e 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -17,7 +17,6 @@ */ -#include <sigc++/retype.h> #include <cstdlib> #include <cmath> diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 0e4b54c7a2..e75d51313e 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1001,10 +1001,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT } if (internal_editing ()) { - if (event->type == GDK_2BUTTON_PRESS && event->button.button == 1) { - Glib::RefPtr<Action> act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit")); - act->activate (); - } break; } @@ -1140,31 +1136,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT break; } -#ifdef WITH_CMT - case ImageFrameHandleStartItem: - imageframe_start_handle_op(item, event) ; - return(true) ; - break ; - case ImageFrameHandleEndItem: - imageframe_end_handle_op(item, event) ; - return(true) ; - break ; - case MarkerViewHandleStartItem: - markerview_item_start_handle_op(item, event) ; - return(true) ; - break ; - case MarkerViewHandleEndItem: - markerview_item_end_handle_op(item, event) ; - return(true) ; - break ; - case MarkerViewItem: - start_markerview_grab(item, event) ; - break ; - case ImageFrameItem: - start_imageframe_grab(item, event) ; - break ; -#endif - case MarkerBarItem: break; @@ -1510,14 +1481,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT edit_control_point (item); break; - case NoteItem: - { - NoteBase* e = reinterpret_cast<NoteBase*> (item->get_data ("notebase")); - assert (e); - edit_notes (e->region_view().selection ()); - break; - } - default: break; } @@ -1601,21 +1564,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT popup_control_point_context_menu (item, event); break; -#ifdef WITH_CMT - case ImageFrameItem: - popup_imageframe_edit_menu(1, event->button.time, item, true) ; - break ; - case ImageFrameTimeAxisItem: - popup_imageframe_edit_menu(1, event->button.time, item, false) ; - break ; - case MarkerViewItem: - popup_marker_time_axis_edit_menu(1, event->button.time, item, true) ; - break ; - case MarkerTimeAxisItem: - popup_marker_time_axis_edit_menu(1, event->button.time, item, false) ; - break ; -#endif - default: break; } @@ -1895,19 +1843,11 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case StartSelectionTrimItem: -#ifdef WITH_CMT - case ImageFrameHandleStartItem: - case MarkerViewHandleStartItem: -#endif if (is_drawable()) { set_canvas_cursor (_cursors->left_side_trim); } break; case EndSelectionTrimItem: -#ifdef WITH_CMT - case ImageFrameHandleEndItem: - case MarkerViewHandleEndItem: -#endif if (is_drawable()) { set_canvas_cursor (_cursors->right_side_trim); } @@ -2082,13 +2022,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type) case EndSelectionTrimItem: case PlayheadCursorItem: -#ifdef WITH_CMT - case ImageFrameHandleStartItem: - case ImageFrameHandleEndItem: - case MarkerViewHandleStartItem: - case MarkerViewHandleEndItem: -#endif - _over_region_trim_target = false; if (is_drawable()) { @@ -2376,7 +2309,6 @@ Editor::edit_control_point (ArdourCanvas::Item* item) } ControlPointDialog d (p); - d.set_position (Gtk::WIN_POS_MOUSE); ensure_float (d); if (d.run () != RESPONSE_ACCEPT) { @@ -2387,19 +2319,33 @@ Editor::edit_control_point (ArdourCanvas::Item* item) } void -Editor::edit_notes (MidiRegionView::Selection const & s) +Editor::edit_notes (TimeAxisViewItem& tavi) { + MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(&tavi); + + if (!mrv) { + return; + } + + MidiRegionView::Selection const & s = mrv->selection(); + if (s.empty ()) { return; } - EditNoteDialog d (&(*s.begin())->region_view(), s); - d.set_position (Gtk::WIN_POS_MOUSE); - ensure_float (d); + EditNoteDialog* d = new EditNoteDialog (&(*s.begin())->region_view(), s); + d->show_all (); + ensure_float (*d); - d.run (); + d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &Editor::note_edit_done), d)); } +void +Editor::note_edit_done (int r, EditNoteDialog* d) +{ + d->done (r); + delete d; +} void Editor::visible_order_range (int* low, int* high) const diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 1bd1a5c82e..4037f7a83d 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2377,7 +2377,6 @@ Editor::rename_region () d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); d.set_size_request (300, -1); - d.set_position (Gtk::WIN_POS_MOUSE); entry.set_text (rs.front()->region()->name()); entry.select_region (0, -1); diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 400f427ee5..5e1c72af97 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -192,7 +192,6 @@ Editor::mouse_add_new_tempo_event (framepos_t frame) TempoMap& map(_session->tempo_map()); TempoDialog tempo_dialog (map, frame, _("add")); - tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); //this causes compiz to display no border. //tempo_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); @@ -235,8 +234,6 @@ Editor::mouse_add_new_meter_event (framepos_t frame) TempoMap& map(_session->tempo_map()); MeterDialog meter_dialog (map, frame, _("add")); - meter_dialog.set_position (Gtk::WIN_POS_MOUSE); - //this causes compiz to display no border.. //meter_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); @@ -292,8 +289,6 @@ Editor::edit_meter_section (MeterSection* section) { MeterDialog meter_dialog (*section, _("done")); - meter_dialog.set_position (Gtk::WIN_POS_MOUSE); - ensure_float (meter_dialog); switch (meter_dialog.run()) { @@ -324,8 +319,6 @@ Editor::edit_tempo_section (TempoSection* section) { TempoDialog tempo_dialog (*section, _("done")); - tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); - ensure_float (tempo_dialog); switch (tempo_dialog.run ()) { diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index 417f793f3a..309e3af48f 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -91,7 +91,6 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) set_session (s); set_name ("ExportVideoDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); diff --git a/gtk2_ardour/export_video_infobox.cc b/gtk2_ardour/export_video_infobox.cc index a7508702c2..92180462d4 100644 --- a/gtk2_ardour/export_video_infobox.cc +++ b/gtk2_ardour/export_video_infobox.cc @@ -33,7 +33,6 @@ ExportVideoInfobox::ExportVideoInfobox (Session* s) set_session (s); set_name ("ExportVideoInfobox"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index db165b8b3c..544963f666 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -224,8 +224,6 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr< add (_selector); - set_position (Gtk::WIN_POS_MOUSE); - io_name_changed (this); show_all (); diff --git a/gtk2_ardour/midi_port_dialog.cc b/gtk2_ardour/midi_port_dialog.cc index 4aaa620399..f4c7e5a26b 100644 --- a/gtk2_ardour/midi_port_dialog.cc +++ b/gtk2_ardour/midi_port_dialog.cc @@ -42,7 +42,6 @@ MidiPortDialog::MidiPortDialog () set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); - set_position (Gtk::WIN_POS_MOUSE); set_name (N_("MidiPortDialog")); vector<string> str = internationalize (PACKAGE, mode_strings); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index e5a48994f8..d681bb43de 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3755,8 +3755,6 @@ MidiRegionView::edit_patch_change (PatchChange* pc) { PatchChangeDialog d (&_source_relative_time_converter, trackview.session(), *pc->patch (), instrument_info(), Gtk::Stock::APPLY, true); - d.set_position (Gtk::WIN_POS_MOUSE); - int response = d.run(); switch (response) { diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 1b0db3edb5..69e9bcad5f 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -515,7 +515,6 @@ MidiTimeAxisView::toggle_channel_selector () _channel_selector->set_default_channel_color (); } - _channel_selector->set_position (WIN_POS_MOUSE); _channel_selector->show_all (); } else { _channel_selector->cycle_visibility (); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 90d2a2912a..79d4b224f6 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1358,7 +1358,6 @@ void MixerStrip::setup_comment_editor () { comment_window = new ArdourWindow (""); // title will be reset to show route - comment_window->set_position (Gtk::WIN_POS_MOUSE); comment_window->set_skip_taskbar_hint (true); comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing)); comment_window->set_default_size (400, 200); diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index 9331674159..e792fcba7d 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -342,7 +342,7 @@ NoteBase::event_handler (GdkEvent* ev) case GDK_BUTTON_PRESS: set_mouse_fractions (ev); if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state) && _selected) { - show_channel_selector(); + _region.get_time_axis_view().editor().edit_notes (_region); return true; } break; diff --git a/gtk2_ardour/playlist_selector.cc b/gtk2_ardour/playlist_selector.cc index b0bc515a61..cdc144d1b7 100644 --- a/gtk2_ardour/playlist_selector.cc +++ b/gtk2_ardour/playlist_selector.cc @@ -44,7 +44,6 @@ PlaylistSelector::PlaylistSelector () { rui = 0; - set_position (WIN_POS_MOUSE); set_name ("PlaylistSelectorWindow"); set_modal(true); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 5bca4c7be0..81adf40896 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -66,7 +66,6 @@ PluginSelector::PluginSelector (PluginManager& mgr) , manager (mgr) { - set_position (Gtk::WIN_POS_MOUSE); set_name ("PluginSelectorWindow"); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 2dd8741a13..8868279cf5 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -82,11 +82,10 @@ using namespace Gtkmm2ext; using namespace Gtk; PluginUIWindow::PluginUIWindow ( - Gtk::Window* win, boost::shared_ptr<PluginInsert> insert, bool scrollable, bool editor) - : parent (win) + : ArdourWindow (string()) , was_visible (false) , _keyboard_focused (false) #ifdef AUDIOUNIT_SUPPORT @@ -96,7 +95,6 @@ PluginUIWindow::PluginUIWindow ( { bool have_gui = false; - Label* label = manage (new Label()); label->set_markup ("<b>THIS IS THE PLUGIN UI</b>"); @@ -147,7 +145,6 @@ PluginUIWindow::PluginUIWindow ( signal_unmap_event().connect (sigc::mem_fun (*pu, &GenericPluginUI::stop_updating)); } - // set_position (Gtk::WIN_POS_MOUSE); set_name ("PluginEditor"); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); @@ -171,18 +168,9 @@ PluginUIWindow::~PluginUIWindow () } void -PluginUIWindow::set_parent (Gtk::Window* win) -{ - parent = win; -} - -void PluginUIWindow::on_map () { Window::on_map (); -#ifdef __APPLE__ - set_keep_above (true); -#endif // __APPLE__ } bool @@ -226,19 +214,25 @@ PluginUIWindow::on_show () } if (_pluginui) { +#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) + if (pre_deactivate_x >= 0) { + move (pre_deactivate_x, pre_deactivate_y); + } +#endif + if (_pluginui->on_window_show (_title)) { Window::on_show (); } } - - if (parent) { - // set_transient_for (*parent); - } } void PluginUIWindow::on_hide () { +#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) + get_position (pre_deactivate_x, pre_deactivate_y); +#endif + Window::on_hide (); if (_pluginui) { @@ -560,7 +554,6 @@ PlugUIBase::latency_button_clicked () if (!latency_gui) { latency_gui = new LatencyGUI (*(insert.get()), insert->session().frame_rate(), insert->session().get_block_size()); latency_dialog = new ArdourWindow (_("Edit Latency")); - latency_dialog->set_position (WIN_POS_MOUSE); /* use both keep-above and transient for to try cover as many different WM's as possible. */ diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 6b886cf268..be03e6ede4 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -50,6 +50,7 @@ #include "automation_controller.h" #include "ardour_button.h" +#include "ardour_window.h" namespace ARDOUR { class PluginInsert; @@ -278,11 +279,10 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox bool integer_printer (char* buf, Gtk::Adjustment &, ControlUI *); }; -class PluginUIWindow : public Gtk::Window +class PluginUIWindow : public ArdourWindow { public: - PluginUIWindow (Gtk::Window*, - boost::shared_ptr<ARDOUR::PluginInsert> insert, + PluginUIWindow (boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false, bool editor=true); ~PluginUIWindow (); diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 16088786cd..335861883c 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -1183,7 +1183,6 @@ ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams) dialog.add_button (Stock::OK, RESPONSE_ACCEPT); dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); dialog.set_modal (true); dialog.show_all (); @@ -1550,7 +1549,6 @@ outputs will not work correctly.")); dialog.add_button (Stock::OK, RESPONSE_ACCEPT); dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); dialog.set_modal (true); dialog.show_all (); @@ -2094,20 +2092,16 @@ ProcessorBox::toggle_edit_processor (boost::shared_ptr<Processor> processor) /* these are both allowed to be null */ - Container* toplevel = get_toplevel(); - Window* win = dynamic_cast<Gtk::Window*>(toplevel); - Window* w = get_processor_ui (plugin_insert); if (w == 0) { - plugin_ui = new PluginUIWindow (win, plugin_insert); + plugin_ui = new PluginUIWindow (plugin_insert); plugin_ui->set_title (generate_processor_title (plugin_insert)); set_processor_ui (plugin_insert, plugin_ui); } else { plugin_ui = dynamic_cast<PluginUIWindow *> (w); - plugin_ui->set_parent (win); } gidget = plugin_ui; @@ -2155,9 +2149,7 @@ ProcessorBox::toggle_edit_generic_processor (boost::shared_ptr<Processor> proces return; } - Container* toplevel = get_toplevel(); - Window* win = dynamic_cast<Gtk::Window*>(toplevel); - PluginUIWindow* plugin_ui = new PluginUIWindow(win, plugin_insert, true, false); + PluginUIWindow* plugin_ui = new PluginUIWindow (plugin_insert, true, false); plugin_ui->set_title(generate_processor_title (plugin_insert)); if (plugin_ui->is_visible()) { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index d95b29d814..c76dd35196 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -288,6 +288,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0; virtual framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next) = 0; virtual Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position) = 0; + virtual void edit_notes (TimeAxisViewItem&) = 0; virtual void queue_visual_videotimeline_update () = 0; virtual void toggle_ruler_video (bool) = 0; @@ -299,14 +300,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual void embed_audio_from_video (std::string, framepos_t n = 0) = 0; virtual void export_video () = 0; -#ifdef WITH_CMT - virtual void connect_to_image_compositor() = 0; - virtual void add_imageframe_time_axis(const std::string & track_name, void*) = 0; - virtual void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) = 0; - virtual void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) = 0; - virtual TimeAxisView* get_named_time_axis(const std::string & name) = 0; -#endif - virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0; virtual void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&, PBD::PropertyID) const = 0; diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc index 945219d4f2..bba72fb4a8 100644 --- a/gtk2_ardour/route_group_dialog.cc +++ b/gtk2_ardour/route_group_dialog.cc @@ -50,7 +50,6 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) set_modal (true); set_skip_taskbar_hint (true); set_resizable (true); - set_position (Gtk::WIN_POS_MOUSE); set_name (N_("RouteGroupDialog")); VBox* main_vbox = manage (new VBox); diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 0922ec75ba..99adff68e9 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -25,6 +25,10 @@ #include "ardour/ardour.h" #include "ardour/filesystem_paths.h" +#ifdef check +#undef check +#endif + #include "gui_thread.h" #include "splash.h" @@ -96,15 +100,33 @@ Splash::~Splash () void Splash::pop_back_for (Gtk::Window& win) { +#ifdef __APPLE__ + /* April 2013: window layering on OS X is a bit different to X Window. at present, + the "restack()" functionality in GDK will only operate on windows in the same + "level" (e.g. two normal top level windows, or two utility windows) and will not + work across them. The splashscreen is on its own "StatusWindowLevel" so restacking + is not going to work. + + So for OS X, we just hide ourselves. + */ + hide(); +#else set_keep_above (false); get_window()->restack (win.get_window(), false); - win.signal_hide().connect (sigc::mem_fun (*this, &Splash::pop_front)); +#endif } void Splash::pop_front () { + +#ifdef __APPLE__ + if (get_window()) { + show (); + } +#else set_keep_above (true); +#endif } void diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index 2f35772deb..0774252a44 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -82,7 +82,6 @@ StepEditor::start_step_editing () step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos); step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length()); - step_editor->set_position (WIN_POS_MOUSE); step_editor->present (); } diff --git a/gtk2_ardour/system_exec.cc b/gtk2_ardour/system_exec.cc index 1f178a6c68..566c87dfbb 100644 --- a/gtk2_ardour/system_exec.cc +++ b/gtk2_ardour/system_exec.cc @@ -38,6 +38,8 @@ using namespace std; void * interposer_thread (void *arg); +static void close_fd (int* fd) { if (!fd) return; if (*fd >= 0) ::close (*fd); *fd = -1; } + SystemExec::SystemExec (std::string c, std::string a) : cmd(c) { @@ -483,18 +485,18 @@ SystemExec::start (int stderr_mode) pid=r; /* check if execve was successful. */ - ::close(pok[1]); + close_fd(&pok[1]); char buf; for ( ;; ) { ssize_t n = ::read(pok[0], &buf, 1 ); if ( n==1 ) { /* child process returned from execve */ pid=0; - ::close(pok[0]); - ::close(pin[1]); - ::close(pin[0]); - ::close(pout[1]); - ::close(pout[0]); + close_fd(&pok[0]); + close_fd(&pin[1]); + close_fd(&pin[0]); + close_fd(&pout[1]); + close_fd(&pout[0]); pin[1] = -1; return -3; } else if ( n==-1 ) { @@ -503,7 +505,7 @@ SystemExec::start (int stderr_mode) } break; } - ::close(pok[0]); + close_fd(&pok[0]); /* child started successfully */ #if 0 @@ -519,17 +521,17 @@ SystemExec::start (int stderr_mode) } if (r == 0) { /* 2nd child process - catch stdout */ - ::close(pin[1]); - ::close(pout[1]); + close_fd(&pin[1]); + close_fd(&pout[1]); output_interposer(); exit(0); } - ::close(pout[1]); - ::close(pin[0]); - ::close(pout[0]); + close_fd(&pout[1]); + close_fd(&pin[0]); + close_fd(&pout[0]); #else /* use pthread */ - ::close(pout[1]); - ::close(pin[0]); + close_fd(&pout[1]); + close_fd(&pin[0]); int rv = pthread_create(&thread_id_tt, NULL, interposer_thread, this); thread_active=true; @@ -543,15 +545,15 @@ SystemExec::start (int stderr_mode) } /* child process - exec external process */ - ::close(pok[0]); + close_fd(&pok[0]); ::fcntl(pok[1], F_SETFD, FD_CLOEXEC); - ::close(pin[1]); + close_fd(&pin[1]); if (pin[0] != STDIN_FILENO) { ::dup2(pin[0], STDIN_FILENO); } - ::close(pin[0]); - ::close(pout[0]); + close_fd(&pin[0]); + close_fd(&pout[0]); if (pout[1] != STDOUT_FILENO) { ::dup2(pout[1], STDOUT_FILENO); } @@ -569,7 +571,7 @@ SystemExec::start (int stderr_mode) } if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) { - ::close(pout[1]); + close_fd(&pout[1]); } if (nicelevel !=0) { @@ -596,7 +598,7 @@ SystemExec::start (int stderr_mode) /* if we reach here something went wrong.. */ char buf = 0; (void) ::write(pok[1], &buf, 1 ); - (void) ::close(pok[1]); + close_fd(&pok[1]); exit(-1); return -1; } @@ -631,11 +633,10 @@ void SystemExec::close_stdin() { if (pin[1]<0) return; - ::close(pin[0]); - ::close(pin[1]); - ::close(pout[0]); - ::close(pout[1]); - pin[1] = - 1; // mark as closed + close_fd(&pin[0]); + close_fd(&pin[1]); + close_fd(&pout[0]); + close_fd(&pout[1]); } int diff --git a/gtk2_ardour/time_fx_dialog.cc b/gtk2_ardour/time_fx_dialog.cc index 1fd52cebc3..15d46f10ad 100644 --- a/gtk2_ardour/time_fx_dialog.cc +++ b/gtk2_ardour/time_fx_dialog.cc @@ -68,7 +68,6 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch) set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); - set_position (Gtk::WIN_POS_MOUSE); set_name (N_("TimeFXDialog")); if (pitching) { diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc index 5ac73a581b..f3373c0376 100644 --- a/gtk2_ardour/transcode_video_dialog.cc +++ b/gtk2_ardour/transcode_video_dialog.cc @@ -77,7 +77,6 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) aborted = false; set_name ("TranscodeVideoDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); diff --git a/gtk2_ardour/video_server_dialog.cc b/gtk2_ardour/video_server_dialog.cc index 5ee4c02844..8838409ccf 100644 --- a/gtk2_ardour/video_server_dialog.cc +++ b/gtk2_ardour/video_server_dialog.cc @@ -53,7 +53,6 @@ VideoServerDialog::VideoServerDialog (Session* s) set_session (s); set_name ("VideoServerDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); |