From fba5f18124ff7364ed9354e6b111923ab90b8a8b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 13 Nov 2009 14:45:16 +0000 Subject: more tweaks/fixes for region layer editor git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6077 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour2_ui.rc | 3 + gtk2_ardour/ardour2_ui_dark.rc.in | 3 + gtk2_ardour/ardour2_ui_light.rc.in | 3 + gtk2_ardour/editor.cc | 3 + gtk2_ardour/region_layering_order_editor.cc | 90 +++++++++++++++++++++-------- gtk2_ardour/region_layering_order_editor.h | 8 ++- 6 files changed, 82 insertions(+), 28 deletions(-) diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc index d873220140..110b94163a 100644 --- a/gtk2_ardour/ardour2_ui.rc +++ b/gtk2_ardour/ardour2_ui.rc @@ -1464,6 +1464,9 @@ widget "*NewSessionChannelChoice" style:highest "medium_bold_entry" widget "*NewSessionMainButton" style:highest "larger_bold_text" widget "*NewSessionMainButton*" style:highest "larger_bold_text" widget "*NewSessionMainLabel" style:highest "larger_bold_text" +widget "*RegionLayeringOrderEditorLabel" style:highest "medium_text" +widget "*RegionLayeringOrderEditorNameLabel" style:highest "medium_bold_text" +widget "*RegionLayeringOrderEditorClock" style:highest "default_clock_display" widget "*LocationEditRowClock" style:highest "location_rows_clock" widget "*LocationEditNameLabel" style:highest "medium_text" widget "*LocationEditSetButton" style:highest "location_row_button" diff --git a/gtk2_ardour/ardour2_ui_dark.rc.in b/gtk2_ardour/ardour2_ui_dark.rc.in index 3e8bb2cbf5..8896523a68 100644 --- a/gtk2_ardour/ardour2_ui_dark.rc.in +++ b/gtk2_ardour/ardour2_ui_dark.rc.in @@ -1458,6 +1458,9 @@ widget "*RegionEditorEntry" style:highest "medium_entry" widget "*RegionEditorClock" style:highest "default_clock_display" widget "*RegionEditorToggleButton" style:highest "paler_red_when_active" widget "*RegionEditorToggleButton*" style:highest "paler_red_when_active" +widget "*RegionLayeringOrderEditorLabel" style:highest "medium_text" +widget "*RegionLayeringOrderEditorNameLabel" style:highest "medium_bold_text" +widget "*RegionLayeringOrderEditorClock" style:highest "default_clock_display" widget "*MixerStripSpeedBase" style:highest "small_entry" widget "*MixerStripSpeedBase*" style:highest "small_entry" widget "*MixerStripSpeedBaseNotOne" style:highest "small_red_on_black_entry" diff --git a/gtk2_ardour/ardour2_ui_light.rc.in b/gtk2_ardour/ardour2_ui_light.rc.in index 2a6844c6d0..40d82316af 100644 --- a/gtk2_ardour/ardour2_ui_light.rc.in +++ b/gtk2_ardour/ardour2_ui_light.rc.in @@ -1462,6 +1462,9 @@ widget "*RegionEditorEntry" style:highest "medium_entry" widget "*RegionEditorClock" style:highest "default_clock_display" widget "*RegionEditorToggleButton" style:highest "paler_red_when_active" widget "*RegionEditorToggleButton*" style:highest "paler_red_when_active" +widget "*RegionLayeringOrderEditorLabel" style:highest "medium_text" +widget "*RegionLayeringOrderEditorNameLabel" style:highest "medium_bold_text" +widget "*RegionLayeringOrderEditorClock" style:highest "default_clock_display" widget "*MixerStripSpeedBase" style:highest "small_entry" widget "*MixerStripSpeedBase*" style:highest "small_entry" widget "*MixerStripSpeedBaseNotOne" style:highest "small_red_on_black_entry" diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index bbb589e74f..c78ea9540e 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5120,6 +5120,9 @@ void Editor::change_region_layering_order (nframes64_t position) { if (clicked_regionview == 0) { + if (layering_order_editor) { + layering_order_editor->hide (); + } return; } diff --git a/gtk2_ardour/region_layering_order_editor.cc b/gtk2_ardour/region_layering_order_editor.cc index 17434c112d..e38e920639 100644 --- a/gtk2_ardour/region_layering_order_editor.cc +++ b/gtk2_ardour/region_layering_order_editor.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include "i18n.h" @@ -12,7 +13,7 @@ using namespace Gtk; using namespace ARDOUR; RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) -: ArdourDialog (pe, _("RegionLayeringOrderEditor"), false, false) + : ArdourDialog (pe, _("RegionLayeringOrderEditor"), false, false) , playlist () , position () , in_row_change (false) @@ -20,9 +21,9 @@ RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) , layering_order_columns () , layering_order_model (Gtk::ListStore::create (layering_order_columns)) , layering_order_display () - , clock ("layer dialog", true, "TransportClock", false, false, false) + , clock ("layer dialog", true, "RegionLayeringOrderEditorClock", false, false, false) , scroller () - , the_editor(pe) + , editor (pe) { set_name ("RegionLayeringOrderEditorWindow"); @@ -30,7 +31,6 @@ RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) layering_order_display.append_column (_("Region Name"), layering_order_columns.name); layering_order_display.set_headers_visible (true); - layering_order_display.set_headers_clickable (true); layering_order_display.set_reorderable (false); layering_order_display.set_rules_hint (true); @@ -38,21 +38,51 @@ RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scroller.add (layering_order_display); - Gtk::Table* table = manage (new Gtk::Table (7, 11)); - table->set_size_request (300, 250); - table->attach (scroller, 0, 7, 0, 5); - clock.set_mode (AudioClock::BBT); - HBox* hbox = manage (new HBox); - hbox->pack_start (clock, true, false); - get_vbox()->set_spacing (6); - get_vbox()->pack_start (label, false, false); - get_vbox()->pack_start (*hbox, false, false); - get_vbox()->pack_start (*table); + Gtk::Table* scroller_table = manage (new Gtk::Table); + scroller_table->set_size_request (300, 250); + scroller_table->attach (scroller, 0, 1, 0, 1); + scroller_table->set_col_spacings (5); + scroller_table->set_row_spacings (5); + scroller_table->set_border_width (5); + + track_label.set_name ("RegionLayeringOrderEditorLabel"); + track_label.set_text (_("Track:")); + clock_label.set_name ("RegionLayeringOrderEditorLabel"); + clock_label.set_text (_("Position:")); + track_name_label.set_name ("RegionLayeringOrderEditorNameLabel"); + clock.set_mode (AudioClock::BBT); + + Gtk::Alignment* track_alignment = manage (new Gtk::Alignment); + track_alignment->set (1.0, 0.5); + track_alignment->add (track_label); + + Gtk::Alignment* clock_alignment = manage (new Gtk::Alignment); + clock_alignment->set (1.0, 0.5); + clock_alignment->add (clock_label); + + Gtk::Table* info_table = manage (new Gtk::Table (2, 2)); + info_table->set_col_spacings (5); + info_table->set_row_spacings (5); + info_table->set_border_width (5); + info_table->attach (*track_alignment, 0, 1, 0, 1, FILL, FILL); + info_table->attach (track_name_label, 1, 2, 0, 1, FILL, FILL); + info_table->attach (*clock_alignment, 0, 1, 1, 2, FILL, FILL); + info_table->attach (clock, 1, 2, 1, 2, FILL, FILL); + + HBox* info_hbox = manage (new HBox); + + info_hbox->pack_start (*info_table, true, false); + + get_vbox()->set_spacing (5); + get_vbox()->pack_start (*info_hbox, false, false); + get_vbox()->pack_start (*scroller_table, true, true); + + info_table->set_name ("RegionLayeringOrderTable"); + scroller_table->set_name ("RegionLayeringOrderTable"); - table->set_name ("RegionLayeringOrderTable"); layering_order_display.set_name ("RegionLayeringOrderDisplay"); layering_order_display.signal_row_activated ().connect (mem_fun (*this, &RegionLayeringOrderEditor::row_activated)); @@ -137,7 +167,7 @@ RegionLayeringOrderEditor::refill () void RegionLayeringOrderEditor::set_context (const string& a_name, Session* s, const boost::shared_ptr & pl, nframes64_t pos) { - label.set_text (a_name); + track_name_label.set_text (a_name); clock.set_session (s); clock.set (pos, true, 0, 0); @@ -153,22 +183,32 @@ RegionLayeringOrderEditor::set_context (const string& a_name, Session* s, const bool RegionLayeringOrderEditor::on_key_press_event (GdkEventKey* ev) { - if (ev->keyval == GDK_Return) { - Keyboard::magic_widget_grab_focus (); - } + bool handled = false; - bool result = key_press_focus_accelerator_handler (*this, ev); + /* in general, we want shortcuts working while in this + dialog. However, we'd like to treat "return" specially + since it is used for row activation. So .. + + for return: try normal handling first + then try the editor (to get accelerators/shortcuts) + then try normal handling (for keys other than return) + */ if (ev->keyval == GDK_Return) { - Keyboard::magic_widget_drop_focus (); + handled = ArdourDialog::on_key_press_event (ev); + } + + if (!handled) { + handled = key_press_focus_accelerator_handler (editor, ev); } - if (!result) { - result = ArdourDialog::on_key_press_event (ev); + if (!handled) { + handled = ArdourDialog::on_key_press_event (ev); } - return result; + + return handled; } - + void RegionLayeringOrderEditor::maybe_present () { diff --git a/gtk2_ardour/region_layering_order_editor.h b/gtk2_ardour/region_layering_order_editor.h index c242672a60..595b010591 100644 --- a/gtk2_ardour/region_layering_order_editor.h +++ b/gtk2_ardour/region_layering_order_editor.h @@ -35,7 +35,7 @@ class RegionLayeringOrderEditor : public ArdourDialog nframes64_t position; bool in_row_change; uint32_t regions_at_position; - + sigc::connection playlist_modified_connection; struct LayeringOrderColumns : public Gtk::TreeModel::ColumnRecord { @@ -50,9 +50,11 @@ class RegionLayeringOrderEditor : public ArdourDialog Glib::RefPtr layering_order_model; Gtk::TreeView layering_order_display; AudioClock clock; - Gtk::Label label; + Gtk::Label track_label; + Gtk::Label track_name_label; + Gtk::Label clock_label; Gtk::ScrolledWindow scroller; // Available layers - PublicEditor& the_editor; + PublicEditor& editor; void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); void refill (); -- cgit v1.2.3