mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 05:35:47 +01:00
add window geometry to region UI settings, and save after changes
Changes are detected in Pianoroll::canvas_allocate(), which is a proxy for window geometry. Since Pianoroll doesn't own a window, this is not necessarily ideal, but it works.
This commit is contained in:
parent
fc7e237352
commit
4b94f96ebf
5 changed files with 54 additions and 3 deletions
|
|
@ -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<ArdourWindow*> (toplevel);
|
||||
|
||||
if (aw) {
|
||||
Glib::RefPtr<Gdk::Window> 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<RegionUISettingsManager::iterator,bool> 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<ArdourWindow*> (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<ArdourCanvas::Ruler::Mark>& marks, sample
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -820,6 +820,5 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
|||
|
||||
bool temporary_zoom_focus_change;
|
||||
bool _dragging_playhead;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue