mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
dramatically simplify maximi[sz]ation code, ripping out all the old pane sizing stuff that seems to be a left over from gtk1 (!)
git-svn-id: svn://localhost/ardour2/branches/3.0@11344 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
275e710e67
commit
d707fa06b7
3 changed files with 43 additions and 113 deletions
|
|
@ -592,26 +592,17 @@ ARDOUR_UI::editor_realized ()
|
||||||
void
|
void
|
||||||
ARDOUR_UI::maximise_editing_space ()
|
ARDOUR_UI::maximise_editing_space ()
|
||||||
{
|
{
|
||||||
if (!editor) {
|
if (editor) {
|
||||||
return;
|
editor->maximise_editing_space ();
|
||||||
}
|
|
||||||
|
|
||||||
transport_tearoff->set_visible (false);
|
|
||||||
editor->maximise_editing_space ();
|
|
||||||
if (Config->get_keep_tearoffs()) {
|
|
||||||
transport_tearoff->set_visible (true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::restore_editing_space ()
|
ARDOUR_UI::restore_editing_space ()
|
||||||
{
|
{
|
||||||
if (!editor) {
|
if (editor) {
|
||||||
return;
|
editor->restore_editing_space ();
|
||||||
}
|
}
|
||||||
|
|
||||||
transport_tearoff->set_visible (true);
|
|
||||||
editor->restore_editing_space ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#include "pbd/enumwriter.h"
|
#include "pbd/enumwriter.h"
|
||||||
#include "pbd/memento_command.h"
|
#include "pbd/memento_command.h"
|
||||||
#include "pbd/unknown_type.h"
|
#include "pbd/unknown_type.h"
|
||||||
|
#include "pbd/stacktrace.h"
|
||||||
|
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
#include <gtkmm/image.h>
|
#include <gtkmm/image.h>
|
||||||
|
|
@ -330,6 +331,7 @@ Editor::Editor ()
|
||||||
|
|
||||||
current_interthread_info = 0;
|
current_interthread_info = 0;
|
||||||
_show_measures = true;
|
_show_measures = true;
|
||||||
|
_maximised = false;
|
||||||
show_gain_after_trim = false;
|
show_gain_after_trim = false;
|
||||||
|
|
||||||
have_pending_keyboard_selection = false;
|
have_pending_keyboard_selection = false;
|
||||||
|
|
@ -554,10 +556,6 @@ Editor::Editor ()
|
||||||
_the_notebook.set_tab_pos (Gtk::POS_RIGHT);
|
_the_notebook.set_tab_pos (Gtk::POS_RIGHT);
|
||||||
_the_notebook.show_all ();
|
_the_notebook.show_all ();
|
||||||
|
|
||||||
post_maximal_editor_width = 0;
|
|
||||||
post_maximal_horizontal_pane_position = 0;
|
|
||||||
post_maximal_editor_height = 0;
|
|
||||||
post_maximal_vertical_pane_position = 0;
|
|
||||||
_notebook_shrunk = false;
|
_notebook_shrunk = false;
|
||||||
|
|
||||||
editor_summary_pane.pack1(edit_packer);
|
editor_summary_pane.pack1(edit_packer);
|
||||||
|
|
@ -2367,6 +2365,13 @@ Editor::set_state (const XMLNode& node, int /*version*/)
|
||||||
_regions->set_state (**i);
|
_regions->set_state (**i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((prop = node.property ("maximised"))) {
|
||||||
|
bool yn = string_is_affirmative (prop->value());
|
||||||
|
if (yn) {
|
||||||
|
ActionManager::do_action ("Common", "ToggleMaximalEditor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2399,8 +2404,6 @@ Editor::get_state ()
|
||||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&edit_pane)->gobj()));
|
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&edit_pane)->gobj()));
|
||||||
geometry->add_property("edit-horizontal-pane-pos", string(buf));
|
geometry->add_property("edit-horizontal-pane-pos", string(buf));
|
||||||
geometry->add_property("notebook-shrunk", _notebook_shrunk ? "1" : "0");
|
geometry->add_property("notebook-shrunk", _notebook_shrunk ? "1" : "0");
|
||||||
snprintf(buf,sizeof(buf), "%d",pre_maximal_horizontal_pane_position);
|
|
||||||
geometry->add_property("pre-maximal-horizontal-pane-position", string(buf));
|
|
||||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&editor_summary_pane)->gobj()));
|
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&editor_summary_pane)->gobj()));
|
||||||
geometry->add_property("edit-vertical-pane-pos", string(buf));
|
geometry->add_property("edit-vertical-pane-pos", string(buf));
|
||||||
|
|
||||||
|
|
@ -2428,6 +2431,7 @@ Editor::get_state ()
|
||||||
node->add_property ("y-origin", buf);
|
node->add_property ("y-origin", buf);
|
||||||
|
|
||||||
node->add_property ("show-measures", _show_measures ? "yes" : "no");
|
node->add_property ("show-measures", _show_measures ? "yes" : "no");
|
||||||
|
node->add_property ("maximised", _maximised ? "yes" : "no");
|
||||||
node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
|
node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
|
||||||
node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no");
|
node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no");
|
||||||
node->add_property ("xfades-visible", _xfade_visibility ? "yes" : "no");
|
node->add_property ("xfades-visible", _xfade_visibility ? "yes" : "no");
|
||||||
|
|
@ -3509,10 +3513,6 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
|
||||||
_notebook_shrunk = string_is_affirmative (prop->value ());
|
_notebook_shrunk = string_is_affirmative (prop->value ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geometry && (prop = geometry->property ("pre-maximal-horizontal-pane-position"))) {
|
|
||||||
pre_maximal_horizontal_pane_position = atoi (prop->value ());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!geometry || (prop = geometry->property ("edit-horizontal-pane-pos")) == 0) {
|
if (!geometry || (prop = geometry->property ("edit-horizontal-pane-pos")) == 0) {
|
||||||
/* initial allocation is 90% to canvas, 10% to notebook */
|
/* initial allocation is 90% to canvas, 10% to notebook */
|
||||||
pos = (int) floor (alloc.get_width() * 0.90f);
|
pos = (int) floor (alloc.get_width() * 0.90f);
|
||||||
|
|
@ -3523,9 +3523,6 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
|
||||||
|
|
||||||
if (GTK_WIDGET(edit_pane.gobj())->allocation.width > pos) {
|
if (GTK_WIDGET(edit_pane.gobj())->allocation.width > pos) {
|
||||||
edit_pane.set_position (pos);
|
edit_pane.set_position (pos);
|
||||||
if (pre_maximal_horizontal_pane_position == 0) {
|
|
||||||
pre_maximal_horizontal_pane_position = pos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done = (Pane) (done | Horizontal);
|
done = (Pane) (done | Horizontal);
|
||||||
|
|
@ -3541,12 +3538,12 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
|
||||||
pos = (int) floor (alloc.get_height() * 0.90f);
|
pos = (int) floor (alloc.get_height() * 0.90f);
|
||||||
snprintf (buf, sizeof(buf), "%d", pos);
|
snprintf (buf, sizeof(buf), "%d", pos);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pos = atoi (prop->value());
|
pos = atoi (prop->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_WIDGET(editor_summary_pane.gobj())->allocation.height > pos) {
|
if (GTK_WIDGET(editor_summary_pane.gobj())->allocation.height > pos) {
|
||||||
editor_summary_pane.set_position (pos);
|
editor_summary_pane.set_position (pos);
|
||||||
pre_maximal_vertical_pane_position = pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done = (Pane) (done | Vertical);
|
done = (Pane) (done | Vertical);
|
||||||
|
|
@ -3897,98 +3894,40 @@ Editor::session_state_saved (string)
|
||||||
void
|
void
|
||||||
Editor::maximise_editing_space ()
|
Editor::maximise_editing_space ()
|
||||||
{
|
{
|
||||||
/* these calls will leave each tearoff visible *if* it is torn off
|
if (_maximised) {
|
||||||
*/
|
return;
|
||||||
|
|
||||||
_mouse_mode_tearoff->set_visible (false);
|
|
||||||
_tools_tearoff->set_visible (false);
|
|
||||||
_zoom_tearoff->set_visible (false);
|
|
||||||
|
|
||||||
pre_maximal_horizontal_pane_position = edit_pane.get_position ();
|
|
||||||
pre_maximal_vertical_pane_position = editor_summary_pane.get_position ();
|
|
||||||
pre_maximal_editor_width = this->get_width ();
|
|
||||||
pre_maximal_editor_height = this->get_height ();
|
|
||||||
|
|
||||||
if (post_maximal_horizontal_pane_position == 0) {
|
|
||||||
post_maximal_horizontal_pane_position = edit_pane.get_width();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (post_maximal_vertical_pane_position == 0) {
|
|
||||||
post_maximal_vertical_pane_position = editor_summary_pane.get_height();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fullscreen ();
|
fullscreen ();
|
||||||
|
|
||||||
if (post_maximal_editor_width) {
|
if (!Config->get_keep_tearoffs()) {
|
||||||
edit_pane.set_position (post_maximal_horizontal_pane_position -
|
/* these calls will leave each tearoff visible *if* it is torn off,
|
||||||
abs(post_maximal_editor_width - pre_maximal_editor_width));
|
but invisible otherwise.
|
||||||
} else {
|
*/
|
||||||
edit_pane.set_position (post_maximal_horizontal_pane_position);
|
_mouse_mode_tearoff->set_visible (false);
|
||||||
|
_tools_tearoff->set_visible (false);
|
||||||
|
_zoom_tearoff->set_visible (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hack: we must do this in an idle handler for it to work; see comment in
|
_maximised = true;
|
||||||
restore_editing_space()
|
|
||||||
*/
|
|
||||||
|
|
||||||
Glib::signal_idle().connect (
|
|
||||||
sigc::bind (
|
|
||||||
sigc::mem_fun (*this, &Editor::idle_reset_vertical_pane_position),
|
|
||||||
post_maximal_vertical_pane_position
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Config->get_keep_tearoffs()) {
|
|
||||||
_mouse_mode_tearoff->set_visible (true);
|
|
||||||
_tools_tearoff->set_visible (true);
|
|
||||||
if (Config->get_show_zoom_tools ()) {
|
|
||||||
_zoom_tearoff->set_visible (true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
Editor::idle_reset_vertical_pane_position (int p)
|
|
||||||
{
|
|
||||||
editor_summary_pane.set_position (p);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::restore_editing_space ()
|
Editor::restore_editing_space ()
|
||||||
{
|
{
|
||||||
// user changed width/height of panes during fullscreen
|
if (!_maximised) {
|
||||||
|
return;
|
||||||
if (post_maximal_horizontal_pane_position != edit_pane.get_position()) {
|
|
||||||
post_maximal_horizontal_pane_position = edit_pane.get_position();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (post_maximal_vertical_pane_position != editor_summary_pane.get_position()) {
|
|
||||||
post_maximal_vertical_pane_position = editor_summary_pane.get_position();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unfullscreen();
|
unfullscreen();
|
||||||
|
|
||||||
_mouse_mode_tearoff->set_visible (true);
|
if (!Config->get_keep_tearoffs()) {
|
||||||
_tools_tearoff->set_visible (true);
|
_mouse_mode_tearoff->set_visible (true);
|
||||||
if (Config->get_show_zoom_tools ()) {
|
_tools_tearoff->set_visible (true);
|
||||||
_zoom_tearoff->set_visible (true);
|
_zoom_tearoff->set_visible (true);
|
||||||
}
|
}
|
||||||
post_maximal_editor_width = this->get_width();
|
|
||||||
post_maximal_editor_height = this->get_height();
|
|
||||||
|
|
||||||
edit_pane.set_position (pre_maximal_horizontal_pane_position + abs(this->get_width() - pre_maximal_editor_width));
|
_maximised = false;
|
||||||
|
|
||||||
/* This is a bit of a hack, but it seems that if you set the vertical pane position
|
|
||||||
here it gets reset to some wrong value after this method has finished. Doing
|
|
||||||
the setup in an idle callback seems to work.
|
|
||||||
*/
|
|
||||||
Glib::signal_idle().connect (
|
|
||||||
sigc::bind (
|
|
||||||
sigc::mem_fun (*this, &Editor::idle_reset_vertical_pane_position),
|
|
||||||
pre_maximal_vertical_pane_position
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -5445,10 +5384,16 @@ Editor::notebook_tab_clicked (GdkEventButton* ev, Gtk::Widget* page)
|
||||||
/* double-click on a notebook tab shrinks or expands the notebook */
|
/* double-click on a notebook tab shrinks or expands the notebook */
|
||||||
|
|
||||||
if (_notebook_shrunk) {
|
if (_notebook_shrunk) {
|
||||||
edit_pane.set_position (pre_maximal_horizontal_pane_position);
|
if (pre_notebook_shrink_pane_width) {
|
||||||
|
edit_pane.set_position (*pre_notebook_shrink_pane_width);
|
||||||
|
}
|
||||||
_notebook_shrunk = false;
|
_notebook_shrunk = false;
|
||||||
} else {
|
} else {
|
||||||
pre_maximal_horizontal_pane_position = edit_pane.get_position ();
|
pre_notebook_shrink_pane_width = edit_pane.get_position();
|
||||||
|
|
||||||
|
/* this expands the LHS of the edit pane to cover the notebook
|
||||||
|
PAGE but leaves the tabs visible.
|
||||||
|
*/
|
||||||
edit_pane.set_position (edit_pane.get_position() + page->get_width());
|
edit_pane.set_position (edit_pane.get_position() + page->get_width());
|
||||||
_notebook_shrunk = true;
|
_notebook_shrunk = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,14 +525,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
|
|
||||||
void update_join_object_range_location (double, double);
|
void update_join_object_range_location (double, double);
|
||||||
|
|
||||||
int post_maximal_editor_width;
|
boost::optional<int> pre_notebook_shrink_pane_width;
|
||||||
int post_maximal_editor_height;
|
|
||||||
int post_maximal_horizontal_pane_position;
|
|
||||||
int post_maximal_vertical_pane_position;
|
|
||||||
int pre_maximal_horizontal_pane_position;
|
|
||||||
int pre_maximal_vertical_pane_position;
|
|
||||||
int pre_maximal_editor_width;
|
|
||||||
int pre_maximal_editor_height;
|
|
||||||
void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
|
void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
|
||||||
|
|
||||||
Gtk::Notebook _the_notebook;
|
Gtk::Notebook _the_notebook;
|
||||||
|
|
@ -543,8 +537,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
Gtk::HPaned edit_pane;
|
Gtk::HPaned edit_pane;
|
||||||
Gtk::VPaned editor_summary_pane;
|
Gtk::VPaned editor_summary_pane;
|
||||||
|
|
||||||
bool idle_reset_vertical_pane_position (int);
|
|
||||||
|
|
||||||
Gtk::EventBox meter_base;
|
Gtk::EventBox meter_base;
|
||||||
Gtk::HBox meter_box;
|
Gtk::HBox meter_box;
|
||||||
Gtk::EventBox marker_base;
|
Gtk::EventBox marker_base;
|
||||||
|
|
@ -1451,6 +1443,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
bool _follow_playhead;
|
bool _follow_playhead;
|
||||||
/// true if we scroll the tracks rather than the playhead
|
/// true if we scroll the tracks rather than the playhead
|
||||||
bool _stationary_playhead;
|
bool _stationary_playhead;
|
||||||
|
/// true if we are in fullscreen mode
|
||||||
|
bool _maximised;
|
||||||
|
|
||||||
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
|
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
|
||||||
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
|
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue