2 Copyright (C) 2000-2004 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sigc++/bind.h>
24 #include <pbd/lockmonitor.h>
25 #include <gtkmm2ext/gtk_ui.h>
26 #include <gtkmm2ext/utils.h>
27 #include <gtkmm2ext/stop_signal.h>
29 #include <ardour/audioengine.h>
30 #include <ardour/session.h>
31 #include <ardour/session_route.h>
32 #include <ardour/diskstream.h>
33 #include <ardour/plugin_manager.h>
36 #include "mixer_strip.h"
37 #include "plugin_selector.h"
38 #include "ardour_ui.h"
41 #include "gui_thread.h"
45 using namespace ARDOUR;
47 using namespace Gtkmm2ext;
50 Mixer_UI::Mixer_UI (AudioEngine& eng)
51 : Window (Gtk::WINDOW_TOPLEVEL),
57 XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
60 scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
61 scroller_base.set_name ("MixerWindow");
62 scroller_base.signal_button_release_event().connect (mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
63 // add as last item of strip packer
64 strip_packer.pack_end (scroller_base, true, true);
66 scroller.add (strip_packer);
67 scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
69 track_display_model = ListStore::create (track_display_columns);
70 track_display.set_model (track_display_model);
71 track_display.append_column (_("Strips"), track_display_columns.text);
72 track_display.set_name (X_("MixerTrackDisplayList"));
73 track_display.get_selection()->set_mode (Gtk::SELECTION_MULTIPLE);
74 track_display.set_reorderable (true);
75 track_display.set_size_request (75, -1);
76 track_display.set_headers_visible (true);
77 track_display.set_headers_clickable (true);
78 track_display_scroller.add (track_display);
79 track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
81 group_display_model = ListStore::create (group_display_columns);
82 group_display.set_model (group_display_model);
83 group_display.append_column (_("active"), group_display_columns.active);
84 group_display.append_column (_("groupname"), group_display_columns.text);
85 group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
86 group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
88 /* use checkbox for the active column */
90 CellRendererToggle *active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (0));
91 active_cell->property_activatable() = true;
92 active_cell->property_radio() = false;
94 group_display.set_name ("MixerGroupList");
95 group_display.set_reorderable (true);
96 group_display.set_size_request (true);
97 group_display_scroller.add (group_display);
98 group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
100 snapshot_display_model = ListStore::create (group_display_columns);
101 snapshot_display.set_model (snapshot_display_model);
102 snapshot_display.append_column (X_("mixgroups"), snapshot_display_columns.visible_name);
103 snapshot_display.set_name ("MixerSnapshotDisplayList");
104 snapshot_display.set_size_request (75, -1);
105 snapshot_display.set_reorderable (true);
106 snapshot_display_scroller.add (snapshot_display);
107 snapshot_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
109 group_display_vbox.pack_start (group_display_button, false, false);
110 group_display_vbox.pack_start (group_display_scroller, true, true);
112 track_display_frame.set_name("BaseFrame");
113 track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
114 track_display_frame.add(track_display_scroller);
116 group_display_frame.set_name ("BaseFrame");
117 group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
118 group_display_frame.add (group_display_vbox);
120 rhs_pane1.add1 (track_display_frame);
121 rhs_pane1.add2 (rhs_pane2);
123 rhs_pane2.add1 (group_display_frame);
124 rhs_pane2.add2 (snapshot_display_scroller);
126 list_vpacker.pack_start (rhs_pane1, true, true);
128 global_hpacker.pack_start (scroller, true, true);
129 global_hpacker.pack_start (out_packer, false, false);
131 list_hpane.add1(list_vpacker);
132 list_hpane.add2(global_hpacker);
134 rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
135 static_cast<Gtk::Paned*> (&rhs_pane1)));
136 rhs_pane2.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
137 static_cast<Gtk::Paned*> (&rhs_pane2)));
138 list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
139 static_cast<Gtk::Paned*> (&list_hpane)));
142 rhs_pane1.set_data ("collapse-direction", (gpointer) 0);
143 rhs_pane2.set_data ("collapse-direction", (gpointer) 0);
144 list_hpane.set_data ("collapse-direction", (gpointer) 1);
146 rhs_pane1.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&rhs_pane1)));
147 rhs_pane2.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&rhs_pane2)));
148 list_hpane.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&list_hpane)));
150 global_vpacker.pack_start (list_hpane, true, true);
152 add (global_vpacker);
153 set_name ("MixerWindow");
154 set_title (_("ardour: mixer"));
155 set_wmclass (_("ardour_mixer"), "Ardour");
157 signal_delete_event().connect (bind (ptr_fun (just_hide_it), static_cast<Gtk::Window *>(this)));
158 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
160 track_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::track_display_selection_changed));
161 track_display_model->signal_rows_reordered().connect (mem_fun (*this, &Mixer_UI::track_display_reordered_proxy));
162 track_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::track_display_button_press));
164 group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press));
165 group_display.get_selection()->signal_changed().connect (mem_fun (*this, &Mixer_UI::group_display_selection_changed));
167 snapshot_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::snapshot_display_selection_changed));
168 snapshot_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::snapshot_display_button_press));
170 _plugin_selector = new PluginSelector (PluginManager::the_manager());
171 _plugin_selector->signal_delete_event().connect (bind (ptr_fun (just_hide_it),
172 static_cast<Window *> (_plugin_selector)));
174 signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
176 _selection.RoutesChanged.connect (mem_fun(*this, &Mixer_UI::follow_strip_selection));
179 Mixer_UI::~Mixer_UI ()
184 Mixer_UI::ensure_float (Window& win)
186 win.set_transient_for (*this);
190 Mixer_UI::show_window ()
194 /* now reset each strips width so the right widgets are shown */
197 TreeModel::Children rows = track_display_model->children();
198 TreeModel::Children::iterator ri;
200 for (ri = rows.begin(); ri != rows.end(); ++ri) {
201 ms = (*ri)[track_display_columns.strip];
202 ms->set_width (ms->get_width());
207 Mixer_UI::add_strip (Route* route)
209 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_strip), route));
213 if (route->hidden()) {
217 strip = new MixerStrip (*this, *session, *route);
218 strips.push_back (strip);
220 strip->set_width (_strip_width);
223 TreeModel::Row row = *(track_display_model->append());
224 row[track_display_columns.text] = route->name();
225 row[track_display_columns.route] = route;
226 row[track_display_columns.strip] = strip;
228 if (strip->marked_for_display() || strip->packed()) {
229 track_display.get_selection()->select (row);
232 route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
233 strip->GoingAway.connect (bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
235 strip->signal_button_release_event().connect (bind (mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
237 // if (width() < gdk_screen_width()) {
238 // set_size_request (width() + (_strip_width == Wide ? 75 : 50), height());
243 Mixer_UI::remove_strip (MixerStrip* strip)
245 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
247 TreeModel::Children rows = track_display_model->children();
248 TreeModel::Children::iterator ri;
249 list<MixerStrip *>::iterator i;
251 if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
255 for (ri = rows.begin(); ri != rows.end(); ++ri) {
256 if ((*ri)[track_display_columns.strip] == strip) {
257 track_display_model->erase (ri);
264 Mixer_UI::follow_strip_selection ()
266 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
267 (*i)->set_selected (_selection.selected (&(*i)->route()));
272 Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
274 if (ev->button == 1) {
276 /* this allows the user to click on the strip to terminate comment
277 editing. XXX it needs improving so that we don't select the strip
281 ARDOUR_UI::instance()->allow_focus (false);
283 if (_selection.selected (&strip->route())) {
284 _selection.remove (&strip->route());
286 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
287 _selection.add (&strip->route());
289 _selection.set (&strip->route());
298 Mixer_UI::connect_to_session (Session* sess)
302 string wintitle = _("ardour: mixer: ");
303 wintitle += session->name();
304 set_title (wintitle);
307 // track_display_list.freeze ();
309 track_display_model.clear ();
311 session->foreach_route (this, &Mixer_UI::add_strip);
313 // track_display_list.thaw ();
315 session->going_away.connect (mem_fun(*this, &Mixer_UI::disconnect_from_session));
316 session->RouteAdded.connect (mem_fun(*this, &Mixer_UI::add_strip));
317 session->mix_group_added.connect (mem_fun(*this, &Mixer_UI::add_mix_group));
319 session->foreach_mix_group(this, &Mixer_UI::add_mix_group);
321 session->StateSaved.connect (mem_fun(*this, &Mixer_UI::session_state_saved));
322 redisplay_snapshots ();
324 _plugin_selector->set_session (session);
330 Mixer_UI::disconnect_from_session ()
332 ENSURE_GUI_THREAD(mem_fun(*this, &Mixer_UI::disconnect_from_session));
334 group_display_model->clear ();
335 set_title (_("ardour: mixer"));
337 hide_all_strips (false);
341 Mixer_UI::hide_all_strips (bool with_select)
343 TreeModel::Children rows = track_display_model->children();
344 TreeModel::Children::iterator i;
347 // track_display_list.freeze ();
349 for (i = rows.begin(); i != rows.end(); ++i) {
351 TreeModel::Row row = (*i);
352 MixerStrip* ms = row[track_display_columns.strip];
355 track_display.get_selection()->unselect (i);
361 // track_display_list.thaw ();
365 Mixer_UI::unselect_all_strips ()
367 hide_all_strips (false);
371 Mixer_UI::select_all_strips ()
373 TreeModel::Children rows = track_display_model->children();
374 TreeModel::Children::iterator i;
376 for (i = rows.begin(); i != rows.end(); ++i) {
377 track_display.get_selection()->select (i);
382 Mixer_UI::strip_select_op (bool audiotrack, bool select)
385 TreeModel::Children rows = track_display_model->children();
386 TreeModel::Children::iterator i;
389 // track_display_list.freeze ();
391 for (i = rows.begin(); i != rows.end(); ++i) {
392 ms = (*i)[track_display_columns.strip];
394 if (ms->is_audio_track() == audiotrack) {
396 track_display.get_selection()->select (i);
398 track_display.get_selection()->unselect (i);
403 // track_display_list.thaw ();
407 Mixer_UI::select_all_audiotrack_strips ()
409 strip_select_op (true, true);
412 Mixer_UI::unselect_all_audiotrack_strips ()
414 strip_select_op (true, false);
418 Mixer_UI::select_all_audiobus_strips ()
420 strip_select_op (false, true);
424 Mixer_UI::unselect_all_audiobus_strips ()
426 strip_select_op (false, false);
430 Mixer_UI::show_strip (MixerStrip* ms)
434 if (ms->route().master() || ms->route().control()) {
435 out_packer.pack_start (*ms, false, false);
437 strip_packer.pack_start (*ms, false, false);
439 ms->set_packed (true);
446 Mixer_UI::hide_strip (MixerStrip* ms)
449 if (ms->route().master() || ms->route().control()) {
450 out_packer.remove (*ms);
452 strip_packer.remove (*ms);
454 ms->set_packed (false);
459 Mixer_UI::start_updating ()
461 screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun(*this, &Mixer_UI::update_strips));
462 fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun(*this, &Mixer_UI::fast_update_strips));
467 Mixer_UI::stop_updating ()
469 screen_update_connection.disconnect();
470 fast_screen_update_connection.disconnect();
475 Mixer_UI::update_strips ()
477 if (is_mapped () && session) {
478 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
485 Mixer_UI::fast_update_strips ()
487 if (is_mapped () && session) {
488 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
489 (*i)->fast_update ();
495 Mixer_UI::snapshot_display_selection_changed ()
497 TreeModel::iterator i = snapshot_display.get_selection()->get_selected();
499 Glib::ustring snap_name = (*i)[snapshot_display_columns.real_name];
501 if (session->snap_name() == snap_name) {
505 ARDOUR_UI::instance()->load_session(session->path(), string (snap_name));
509 Mixer_UI::snapshot_display_button_press (GdkEventButton* ev)
515 Mixer_UI::track_display_selection_changed ()
518 TreeModel::Children rows = track_display_model->children();
519 TreeModel::Children::iterator i;
520 Glib::RefPtr<TreeSelection> selection = track_display.get_selection();
522 for (i = rows.begin(); i != rows.end(); ++i) {
523 if (selection->is_selected (i)) {
524 strip->set_marked_for_display (true);
527 strip->set_marked_for_display (false);
532 track_display_reordered ();
536 Mixer_UI::select_strip_op (MixerStrip *strip, bool yn)
538 TreeModel::Children rows = track_display_model->children();
539 TreeModel::Children::iterator i;
540 Glib::RefPtr<TreeSelection> selection = track_display.get_selection();
542 for (i = rows.begin(); i != rows.end(); ++i) {
543 if ((*i)[track_display_columns.strip] == strip) {
545 selection->select (*i);
547 selection->unselect (*i);
555 Mixer_UI::unselect_strip_in_display (MixerStrip *strip)
557 select_strip_op (strip, true);
560 Mixer_UI::select_strip_in_display (MixerStrip *strip)
562 select_strip_op (strip, false);
566 Mixer_UI::track_display_reordered_proxy (const TreeModel::Path& path, const TreeModel::iterator& i, int* n)
568 track_display_reordered ();
572 Mixer_UI::track_display_reordered ()
574 TreeModel::Children rows = track_display_model->children();
575 TreeModel::Children::iterator i;
578 for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
579 MixerStrip* strip = (*i)[track_display_columns.strip];
581 if (strip->marked_for_display()) {
582 strip->route().set_order_key (N_("signal"), order);
583 strip_packer.reorder_child (*strip, -1); /* put at end */
589 Mixer_UI::track_column_click (gint col)
591 if (track_menu == 0) {
595 track_menu->popup (0, 0);
599 Mixer_UI::build_track_menu ()
601 using namespace Menu_Helpers;
604 track_menu = new Menu;
605 track_menu->set_name ("ArdourContextMenu");
606 MenuList& items = track_menu->items();
607 track_menu->set_name ("ArdourContextMenu");
609 items.push_back (MenuElem (_("Show All"), mem_fun(*this, &Mixer_UI::select_all_strips)));
610 items.push_back (MenuElem (_("Hide All"), mem_fun(*this, &Mixer_UI::unselect_all_strips)));
611 items.push_back (MenuElem (_("Show All AudioTrack MixerStrips"), mem_fun(*this, &Mixer_UI::select_all_audiotrack_strips)));
612 items.push_back (MenuElem (_("Hide All AudioTrack MixerStrips"), mem_fun(*this, &Mixer_UI::unselect_all_audiotrack_strips)));
613 items.push_back (MenuElem (_("Show All AudioBus MixerStrips"), mem_fun(*this, &Mixer_UI::select_all_audiobus_strips)));
614 items.push_back (MenuElem (_("Hide All AudioBus MixerStrips"), mem_fun(*this, &Mixer_UI::unselect_all_audiobus_strips)));
619 Mixer_UI::strip_name_changed (void* src, MixerStrip* mx)
621 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::strip_name_changed), src, mx));
623 TreeModel::Children rows = track_display_model->children();
624 TreeModel::Children::iterator i;
626 for (i = rows.begin(); i != rows.end(); ++i) {
627 if ((*i)[track_display_columns.strip] == mx) {
628 (*i)[track_display_columns.text] = mx->route().name();
633 error << _("track display list item for renamed strip not found!") << endmsg;
637 Mixer_UI::new_mix_group ()
639 ArdourPrompter prompter;
642 prompter.set_prompt (_("Name for new mix group"));
643 prompter.show_all ();
645 switch (prompter.run ()) {
646 case GTK_RESPONSE_ACCEPT:
647 prompter.get_result (result);
648 if (result.length()) {
649 session->add_mix_group (result);
657 //Mixer_UI::group_display_button_clicked ()
665 Mixer_UI::group_display_button_press (GdkEventButton* ev)
670 TreeModel::Path path;
671 TreeViewColumn* column;
675 if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
679 switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
681 /* active column click */
683 if ((iter = group_display_model->get_iter (path))) {
684 /* path points to a valid node */
685 if ((group = (*iter)[group_display_columns.group]) != 0) {
686 group->set_active (!group->is_active (), this);
692 if (Keyboard::is_edit_event (ev)) {
693 // RouteGroup* group = (RouteGroup *) group_display.row(row).get_data ();
694 // edit_mix_group (group);
697 /* allow regular select to occur */
707 Mixer_UI::group_display_selection_changed ()
709 TreeModel::iterator i;
710 TreeModel::Children rows = group_display_model->children();
711 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
713 for (i = rows.begin(); i != rows.end(); ++i) {
716 group = (*i)[group_display_columns.group];
718 if (selection->is_selected (i)) {
719 group->set_hidden (true, this);
721 group->set_hidden (true, this);
725 track_display_reordered ();
729 Mixer_UI::group_flags_changed (void* src, RouteGroup* group)
731 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::group_flags_changed), src, group));
737 TreeModel::Children rows = group_display_model->children();
738 TreeModel::Children::iterator gi;
739 TreeModel::Children::iterator ti;
741 for (gi = rows.begin(); gi != rows.end(); ++gi) {
742 if ((*gi)[group_display_columns.group] == group) {
747 if (gi == rows.end()) {
751 rows = track_display_model->children();
753 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
754 if ((*i)->route().mix_group() == group) {
755 if (group->is_hidden ()) {
756 unselect_strip_in_display(*i);
757 group_display.get_selection()->unselect (*gi);
759 select_strip_in_display(*i);
760 group_display.get_selection()->select (*gi);
767 Mixer_UI::add_mix_group (RouteGroup* group)
770 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_mix_group), group));
772 TreeModel::Row row = *(group_display_model->append());
773 row[group_display_columns.active] = group->is_active();
774 row[group_display_columns.text] = group->name();
775 row[group_display_columns.group] = group;
777 group->FlagsChanged.connect (bind (mem_fun(*this, &Mixer_UI::group_flags_changed), group));
781 Mixer_UI::redisplay_snapshots ()
787 vector<string*>* states;
788 if ((states = session->possible_states()) == 0) {
792 snapshot_display_model.clear ();
794 for (vector<string*>::iterator i = states->begin(); i != states->end(); ++i) {
795 string statename = *(*i);
796 TreeModel::Row row = *(snapshot_display_model->append());
797 row[snapshot_display_columns.visible_name] = statename;
798 row[snapshot_display_columns.real_name] = statename;
805 Mixer_UI::session_state_saved (string snap_name)
807 ENSURE_GUI_THREAD (bind (mem_fun(*this, &Mixer_UI::session_state_saved), snap_name));
808 redisplay_snapshots ();
812 Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
814 using namespace Menu_Helpers;
816 if (Keyboard::is_context_menu_event (ev)) {
817 ARDOUR_UI::instance()->add_route();
825 Mixer_UI::set_strip_width (Width w)
829 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
836 Mixer_UI::set_state (const XMLNode& node)
838 const XMLProperty* prop;
840 int x, y, width, height, xoff, yoff;
842 if ((geometry = find_named_node (node, "geometry")) == 0) {
844 width = default_width;
845 height = default_height;
853 width = atoi(geometry->property("x_size")->value().c_str());
854 height = atoi(geometry->property("y_size")->value().c_str());
855 x = atoi(geometry->property("x_pos")->value().c_str());
856 y = atoi(geometry->property("y_pos")->value().c_str());
857 xoff = atoi(geometry->property("x_off")->value().c_str());
858 yoff = atoi(geometry->property("y_off")->value().c_str());
861 set_default_size(width, height);
863 // set_uposition(x, y-yoff);
865 if ((prop = node.property ("narrow-strips"))) {
866 if (prop->value() == "yes") {
867 set_strip_width (Narrow);
869 set_strip_width (Wide);
877 Mixer_UI::get_state (void)
879 XMLNode* node = new XMLNode ("Mixer");
882 Glib::RefPtr<Gdk::Window> win = get_window();
884 int x, y, xoff, yoff, width, height;
885 win->get_root_origin(x, y);
886 win->get_position(xoff, yoff);
887 win->get_size(width, height);
889 XMLNode* geometry = new XMLNode ("geometry");
891 snprintf(buf, sizeof(buf), "%d", width);
892 geometry->add_property(X_("x_size"), string(buf));
893 snprintf(buf, sizeof(buf), "%d", height);
894 geometry->add_property(X_("y_size"), string(buf));
895 snprintf(buf, sizeof(buf), "%d", x);
896 geometry->add_property(X_("x_pos"), string(buf));
897 snprintf(buf, sizeof(buf), "%d", y);
898 geometry->add_property(X_("y_pos"), string(buf));
899 snprintf(buf, sizeof(buf), "%d", xoff);
900 geometry->add_property(X_("x_off"), string(buf));
901 snprintf(buf, sizeof(buf), "%d", yoff);
902 geometry->add_property(X_("y_off"), string(buf));
904 snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane1)->gobj()));
905 geometry->add_property(X_("mixer_rhs_pane1_pos"), string(buf));
906 snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane2)->gobj()));
907 geometry->add_property(X_("mixer_rhs_pane2_pos"), string(buf));
908 snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&list_hpane)->gobj()));
909 geometry->add_property(X_("mixer_list_hpane_pos"), string(buf));
911 node->add_child_nocopy (*geometry);
914 node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no");
921 Mixer_UI::pane_allocation_handler (Allocation& alloc, Gtk::Paned* which)
924 XMLProperty* prop = 0;
926 XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
929 static int32_t done[3] = { 0, 0, 0 };
931 if ((geometry = find_named_node (*node, "geometry")) == 0) {
932 width = default_width;
933 height = default_height;
935 width = atoi(geometry->property("x_size")->value());
936 height = atoi(geometry->property("y_size")->value());
939 if (which == static_cast<Gtk::Paned*> (&rhs_pane1)) {
945 if (!geometry || (prop = geometry->property("mixer_rhs_pane1_pos")) == 0) {
947 snprintf (buf, sizeof(buf), "%d", pos);
949 pos = atoi (prop->value());
952 if ((done[0] = GTK_WIDGET(rhs_pane1.gobj())->allocation.height > pos)) {
953 rhs_pane1.set_position (pos);
956 } else if (which == static_cast<Gtk::Paned*> (&rhs_pane2)) {
962 if (!geometry || (prop = geometry->property("mixer_rhs_pane2_pos")) == 0) {
964 snprintf (buf, sizeof(buf), "%d", pos);
966 pos = atoi (prop->value());
969 if ((done[1] = GTK_WIDGET(rhs_pane2.gobj())->allocation.height > pos)) {
970 rhs_pane2.set_position (pos);
973 } else if (which == static_cast<Gtk::Paned*> (&list_hpane)) {
979 if (!geometry || (prop = geometry->property("mixer_list_hpane_pos")) == 0) {
981 snprintf (buf, sizeof(buf), "%d", pos);
983 pos = atoi (prop->value());
986 if ((done[2] = GTK_WIDGET(list_hpane.gobj())->allocation.width > pos)) {
987 list_hpane.set_position (pos);