diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-04-22 22:53:39 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:41 -0400 |
commit | a48fada3c7743824783c44e5ee04e910e80e6c4b (patch) | |
tree | a3a2c295614362bcac1f48679b626eaf3549b037 /gtk2_ardour | |
parent | 02f2b90e969daa81a96b07c73ba5e7e57a75f7d8 (diff) |
move new fractional pane utility functions into libs/gtkmm2ext
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index fdd0a2b3be..90a0944df5 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -1861,25 +1861,6 @@ Mixer_UI::set_state (const XMLNode& node, int version) return 0; } -float -paned_position_as_fraction (Gtk::Paned& paned, bool h) -{ - const guint pos = gtk_paned_get_position (const_cast<GtkPaned*>(static_cast<const Paned*>(&paned)->gobj())); - return (double) pos / (h ? paned.get_allocation().get_height() : paned.get_allocation().get_width()); -} - -void -gtk_paned_set_position_as_fraction (Gtk::Paned& paned, float fraction, bool h) -{ - gint v = (h ? paned.get_allocation().get_height() : paned.get_allocation().get_width()); - - if (v < 1) { - return; - } - - paned.set_position ((guint) floor (fraction * v)); -} - XMLNode& Mixer_UI::get_state () { @@ -1984,7 +1965,7 @@ Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which) } } else { if ((done[0] = (allocation.get_height() > 1.0/pos))) { - gtk_paned_set_position_as_fraction (rhs_pane1, pos, true); + paned_set_position_as_fraction (rhs_pane1, pos, true); } } } @@ -2007,7 +1988,7 @@ Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which) } } else { if ((done[1] = (allocation.get_height() > 1.0/pos))) { - gtk_paned_set_position_as_fraction (rhs_pane2, pos, true); + paned_set_position_as_fraction (rhs_pane2, pos, true); } } } @@ -2030,7 +2011,7 @@ Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which) } } else { if ((done[2] = (allocation.get_width() > 1.0/pos))) { - gtk_paned_set_position_as_fraction (list_hpane, pos, false); + paned_set_position_as_fraction (list_hpane, pos, false); } } } @@ -2053,7 +2034,7 @@ Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which) } } else { if ((done[3] = (allocation.get_width() > 1.0/pos))) { - gtk_paned_set_position_as_fraction (inner_pane, pos, false); + paned_set_position_as_fraction (inner_pane, pos, false); } } } |