diff --git a/gtk2_ardour/cue_editor.cc b/gtk2_ardour/cue_editor.cc index 17bedca994..a815160493 100644 --- a/gtk2_ardour/cue_editor.cc +++ b/gtk2_ardour/cue_editor.cc @@ -189,6 +189,28 @@ CueEditor::instant_save() region_ui_settings.samples_per_pixel = samples_per_pixel; region_ui_settings.grid_type = grid_type (); + /* If we're inside an ArdourWindow, get it's geometry */ + Gtk::Widget* toplevel = contents().get_toplevel (); + ArdourWindow* aw = dynamic_cast (toplevel); + + if (aw) { + Glib::RefPtr win (aw->get_window()); + + if (win) { + gint x, y; + gint wx, wy; + gint width, height, depth; + + aw->get_window()->get_geometry (x, y, width, height, depth); + aw->get_window()->get_origin (wx, wy); + + region_ui_settings.height = height; + region_ui_settings.width = width; + region_ui_settings.x = wx; + region_ui_settings.y = wy;; + } + } + std::pair res (ARDOUR_UI::instance()->region_ui_settings_manager.insert (std::make_pair (_region->id(), region_ui_settings))); if (!res.second) { @@ -1232,6 +1254,16 @@ CueEditor::set_from_rsu (RegionUISettings& rsu) set_draw_length (rsu.draw_length); set_draw_velocity (rsu.draw_velocity); set_draw_channel (rsu.channel); + + if (rsu.width > 0) { + /* If we're inside an ArdourWindow, set it's geometry */ + Gtk::Widget* toplevel = contents().get_toplevel (); + ArdourWindow* aw = dynamic_cast (toplevel); + if (aw) { + aw->move (rsu.x, rsu.y); + aw->set_size_request (rsu.width, rsu.height); + } + } } void @@ -1862,4 +1894,3 @@ CueEditor::metric_get_bbt (std::vector& marks, sample break; } } - diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index efe330ecf9..a90376f7e0 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -820,6 +820,5 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider, bool temporary_zoom_focus_change; bool _dragging_playhead; - }; diff --git a/gtk2_ardour/pianoroll.cc b/gtk2_ardour/pianoroll.cc index 3c6c75841f..b74454dac1 100644 --- a/gtk2_ardour/pianoroll.cc +++ b/gtk2_ardour/pianoroll.cc @@ -639,6 +639,8 @@ Pianoroll::canvas_allocate (Gtk::Allocation alloc) } update_grid (); + + instant_save (); } timepos_t @@ -2100,3 +2102,5 @@ Pianoroll::parameter_changed (std::string param) } } } + + diff --git a/gtk2_ardour/region_ui_settings.cc b/gtk2_ardour/region_ui_settings.cc index d208c5f03e..4aa6751e4a 100644 --- a/gtk2_ardour/region_ui_settings.cc +++ b/gtk2_ardour/region_ui_settings.cc @@ -47,6 +47,10 @@ RegionUISettings::RegionUISettings () , channel (0) , note_min (32) , note_max (96) + , width (-1) + , height (-1) + , x (-1) + , y (-1) { } @@ -70,6 +74,11 @@ RegionUISettings::get_state () const node->set_property (X_("note-min"), note_min); node->set_property (X_("note-max"), note_max); + node->set_property (X_("width"), width); + node->set_property (X_("height"), height); + node->set_property (X_("x"), x); + node->set_property (X_("y"), y); + return *node; } @@ -94,6 +103,10 @@ RegionUISettings::set_state (XMLNode const & state, int) state.get_property (X_("channel"), channel); state.get_property (X_("note-min"), note_min); state.get_property (X_("note-max"), note_max); + state.get_property (X_("width"), width); + state.get_property (X_("height"), height); + state.get_property (X_("x"), x); + state.get_property (X_("y"), y); return 0; } diff --git a/gtk2_ardour/region_ui_settings.h b/gtk2_ardour/region_ui_settings.h index 87fd417d84..3dadd4c856 100644 --- a/gtk2_ardour/region_ui_settings.h +++ b/gtk2_ardour/region_ui_settings.h @@ -41,7 +41,11 @@ struct RegionUISettings Editing::MouseMode mouse_mode; Temporal::timepos_t x_origin; Temporal::BBT_Offset recording_length; - + int width; + int height; + int x; + int y; + /* MIDI specific */ Editing::GridType draw_length;