From 2e582e03e433d4fab22b8dcd1d46b9caef387cb5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 17 Jan 2006 16:40:57 +0000 Subject: a metric boatload of changes; plugin UIs work, adding tracks work, redirect list is useful again, and more git-svn-id: svn://localhost/trunk/ardour2@273 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour2_ui.rc | 49 +++++-- gtk2_ardour/automation_time_axis.cc | 1 - gtk2_ardour/axis_view.cc | 1 + gtk2_ardour/editor.cc | 26 ++-- gtk2_ardour/editor_canvas.cc | 6 - gtk2_ardour/editor_route_list.cc | 2 +- gtk2_ardour/mixer_ui.cc | 49 +++---- gtk2_ardour/plugin_ui.cc | 62 ++------- gtk2_ardour/plugin_ui.h | 5 - gtk2_ardour/po/SConscript | 2 +- gtk2_ardour/redirect_box.cc | 254 +++++++++++++++--------------------- gtk2_ardour/redirect_box.h | 31 +++-- gtk2_ardour/route_params_ui.cc | 5 - 13 files changed, 216 insertions(+), 277 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc index 248d5d00ad..0edce5a2c8 100644 --- a/gtk2_ardour/ardour2_ui.rc +++ b/gtk2_ardour/ardour2_ui.rc @@ -627,13 +627,26 @@ style "automation_track_controls_base" # Plugin Editors style "plugin_slider" { - font_name ="sans medium 10" + font_name ="sans bold 10" - fg[NORMAL] = { 0.45, 0.45, 0.45 } - fg[ACTIVE] = { 0.45, 0.45, 0.45 } - fg[INSENSITIVE] = {0.0, 0.0, 0.0 } # matches default_base - fg[SELECTED] = { 0.45, 0.45, 0.45 } - fg[PRELIGHT] = { 0.45, 0.45, 0.45 } + # the slider itself. the inactive part is INSENSITIVE, + # the active part is something else. + + fg[NORMAL] = { 0.37, 0.43, 0.52 } + fg[ACTIVE] = { 0.37, 0.43, 0.52 } + fg[INSENSITIVE] = {0.40, 0.40, 0.40 } # matches default_base + fg[SELECTED] = { 0.37, 0.43, 0.52 } + fg[PRELIGHT] = { 0.37, 0.43, 0.52 } + + # draws the outer rectangle around the slider + + bg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0.80, 0.80, 0.80 } + bg[INSENSITIVE] = {0.80, 0.80, 0.80 } + bg[SELECTED] = { 0.80, 0.80, 0.80 } + bg[PRELIGHT] = { 0.80, 0.80, 0.80 } + + # the numeric display text[NORMAL] = { 0.80, 0.80, 0.80 } text[ACTIVE] = { 0.80, 0.80, 0.80 } @@ -655,6 +668,25 @@ style "track_list_display" = "small_bold_text" base[SELECTED] = { 0, 0, 0 } } +style "redirect_list_display" = "small_bold_text" +{ + text[NORMAL] = { 0.80, 0.80, 0.80 } + text[ACTIVE] = { 0.0, 0.0, 0.9 } + text[INSENSITIVE] = { 0, 0, 0 } + text[SELECTED] = { 0.9, 0.0, 0.0 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[INSENSITIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } + + # these two are explicitly used by the cell renderer for the + # text + + fg[NORMAL] = { 0.2, 0.2, 0.2 } # used for inactive + fg[ACTIVE] = { 0.0, 0.5, 0.5 } # used for active +} + # MixerPanZone: # # the NORMAL fg color is used for the pan puck @@ -790,6 +822,7 @@ style "region_list_whole_file" fg[NORMAL] = { 1.0, 0, 0 } } + #--------------------------------------------------------------- widget "*FirstActionMessage" style "first_action_message" widget "*VerboseCanvasCursor" style "verbose_canvas_cursor" @@ -1047,8 +1080,8 @@ widget "*TrackListDisplay.*" style "small_bold_text" widget "*EditGroupList" style "track_list_display" widget "*RegionListDisplay" style "small_bold_entry" widget "*RegionListDisplay.*" style "small_bold_text" -widget "*MixerRedirectSelector" style "small_bold_entry" -widget "*MixerRedirectSelector.*" style "small_bold_text" +widget "*RedirectSelector" style "redirect_list_display" +widget "*RedirectSelector.*" style "redirect_list_display" widget "*MixerTrackNameArea" style "default_base" widget "*MixerTrackCommentArea" style "option_entry" widget "*MixerPanZone" style "pan_zone" diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 8fe378f1b1..cb30465fca 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -435,7 +435,6 @@ AutomationTimeAxisView::hide_clicked () hide (); } - void AutomationTimeAxisView::build_display_menu () { diff --git a/gtk2_ardour/axis_view.cc b/gtk2_ardour/axis_view.cc index 6b8b5e59fa..e69fdf0540 100644 --- a/gtk2_ardour/axis_view.cc +++ b/gtk2_ardour/axis_view.cc @@ -48,6 +48,7 @@ list AxisView::used_colors; AxisView::AxisView (ARDOUR::Session& sess) : _session(sess) { _selected = false; + _marked_for_display = true; } AxisView::~AxisView() diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2ec5c21a61..e7409b4329 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -598,13 +598,13 @@ Editor::Editor (AudioEngine& eng) region_list_model->set_sort_column (0, SORT_ASCENDING); region_list_display.set_model (region_list_model); - CellRendererText* renderer = manage( new CellRendererText() ); - region_list_display.append_column (_("Regions"), *renderer); + region_list_display.append_column (_("Regions"), region_list_columns.name); region_list_display.set_headers_visible (false); region_list_display.get_selection()->set_select_function (mem_fun (*this, &Editor::region_list_selection_filter)); TreeViewColumn* tv_col = region_list_display.get_column(0); + CellRendererText* renderer = dynamic_cast(region_list_display.get_column_cell_renderer (0)); tv_col->add_attribute(renderer->property_text(), region_list_columns.name); tv_col->add_attribute(renderer->property_foreground_gdk(), region_list_columns.color_); @@ -2065,12 +2065,13 @@ Editor::set_state (const XMLNode& node) { const XMLProperty* prop; XMLNode* geometry; - int x, y, width, height, xoff, yoff; + int x, y, xoff, yoff; + Gdk::Geometry g; if ((geometry = find_named_node (node, "geometry")) == 0) { - width = default_width; - height = default_height; + g.base_width = default_width; + g.base_height = default_height; x = 1; y = 1; xoff = 0; @@ -2078,16 +2079,17 @@ Editor::set_state (const XMLNode& node) } else { - width = atoi(geometry->property("x_size")->value()); - height = atoi(geometry->property("y_size")->value()); + g.base_width = atoi(geometry->property("x_size")->value()); + g.base_height = atoi(geometry->property("y_size")->value()); x = atoi(geometry->property("x_pos")->value()); y = atoi(geometry->property("y_pos")->value()); xoff = atoi(geometry->property("x_off")->value()); yoff = atoi(geometry->property("y_off")->value()); } - set_default_size(width, height); - move (x, y-yoff); + set_geometry_hints (vpacker, g, Gdk::HINT_BASE_SIZE); + set_default_size (g.base_width, g.base_height); + move (x, y); if ((prop = node.property ("zoom-focus"))) { set_zoom_focus ((ZoomFocus) atoi (prop->value())); @@ -3333,9 +3335,6 @@ Editor::duplicate_dialog (bool dup_region) entry.select_region (0, entry.get_text_length()); entry.grab_focus (); - // GTK2FIX - // win.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)); - switch (win.run ()) { case RESPONSE_ACCEPT: @@ -3762,9 +3761,6 @@ Editor::edit_xfade (Crossfade* xfade) ensure_float (cew); - // GTK2FIX - // cew.signal_delete_event().connect (mem_fun (cew, &ArdourDialog::wm_doi_event_stop)); - switch (cew.run ()) { case RESPONSE_ACCEPT: break; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index d999c1187e..8db3ce7556 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -373,12 +373,6 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc) } } - RefPtr screen = get_screen(); - - if (!screen) { - screen = Gdk::Screen::get_default(); - } - double last_canvas_unit = ceil ((double) max_frames / frames_per_unit); track_canvas.set_scroll_region (0.0, 0.0, max (last_canvas_unit, canvas_width), pos); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 4ea2f54fab..28953386b0 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -253,7 +253,7 @@ Editor::redisplay_route_list () bool visible = (*i)[route_display_columns.visible]; if (visible) { - tv->set_marked_for_display (false); + tv->set_marked_for_display (true); position += tv->show_at (position, n, &edit_controls_vbox); position += track_spacing; } else { diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 317f383170..cc82f0c5e0 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -51,6 +51,7 @@ using namespace Gtk; using namespace Glib; using namespace Gtkmm2ext; using namespace sigc; +using namespace std; Mixer_UI::Mixer_UI (AudioEngine& eng) : Window (Gtk::WINDOW_TOPLEVEL), @@ -146,8 +147,8 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) rhs_pane1.set_data ("collapse-direction", (gpointer) 0); list_hpane.set_data ("collapse-direction", (gpointer) 1); - rhs_pane1.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast(&rhs_pane1))); - list_hpane.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast(&list_hpane))); + rhs_pane1.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast(&rhs_pane1))); + list_hpane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast(&list_hpane))); global_vpacker.pack_start (list_hpane, true, true); @@ -158,7 +159,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) add_accel_group (ActionManager::ui_manager->get_accel_group()); - signal_delete_event().connect (bind (ptr_fun (just_hide_it), static_cast(this))); + signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast(this))); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press)); @@ -215,25 +216,22 @@ Mixer_UI::add_strip (Route* route) strip->set_width (_strip_width); show_strip (strip); + no_track_list_redisplay = true; + TreeModel::Row row = *(track_display_model->append()); row[track_display_columns.text] = route->name(); - if (strip->route().master() || strip->route().control()) { - row[track_display_columns.visible] = true; - } else { - row[track_display_columns.visible] = (strip->marked_for_display() || strip->packed()); - } + row[track_display_columns.visible] = true; row[track_display_columns.route] = route; row[track_display_columns.strip] = strip; + no_track_list_redisplay = false; + redisplay_track_list (); + route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip)); strip->GoingAway.connect (bind (mem_fun(*this, &Mixer_UI::remove_strip), strip)); strip->signal_button_release_event().connect (bind (mem_fun(*this, &Mixer_UI::strip_button_release_event), strip)); - -// if (width() < gdk_screen_width()) { -// set_size_request (width() + (_strip_width == Wide ? 75 : 50), height()); -// } } void @@ -523,6 +521,12 @@ Mixer_UI::redisplay_track_list () for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) { MixerStrip* strip = (*i)[track_display_columns.strip]; + if (strip == 0) { + cerr << "row with text = " << (*i)[track_display_columns.text] << " has no strip\n"; + /* we're in the middle of changing a row, don't worry */ + continue; + } + bool visible = (*i)[track_display_columns.visible]; if (visible) { @@ -545,7 +549,7 @@ Mixer_UI::redisplay_track_list () strip_packer.pack_start (*strip, false, false); } strip->set_packed (true); - strip->show (); + strip->show_all (); } } else { @@ -824,12 +828,13 @@ Mixer_UI::set_state (const XMLNode& node) { const XMLProperty* prop; XMLNode* geometry; - int x, y, width, height, xoff, yoff; + Gdk::Geometry g; + int x, y, xoff, yoff; if ((geometry = find_named_node (node, "geometry")) == 0) { - width = default_width; - height = default_height; + g.base_width = default_width; + g.base_height = default_height; x = 1; y = 1; xoff = 0; @@ -837,17 +842,17 @@ Mixer_UI::set_state (const XMLNode& node) } else { - width = atoi(geometry->property("x_size")->value().c_str()); - height = atoi(geometry->property("y_size")->value().c_str()); + g.base_width = atoi(geometry->property("x_size")->value().c_str()); + g.base_height = atoi(geometry->property("y_size")->value().c_str()); x = atoi(geometry->property("x_pos")->value().c_str()); y = atoi(geometry->property("y_pos")->value().c_str()); xoff = atoi(geometry->property("x_off")->value().c_str()); yoff = atoi(geometry->property("y_off")->value().c_str()); } - - set_default_size(width, height); - // GTK2FIX - // set_uposition(x, y-yoff); + + set_geometry_hints (global_vpacker, g, Gdk::HINT_BASE_SIZE); + set_default_size(g.base_width, g.base_height); + move (x, y); if ((prop = node.property ("narrow-strips"))) { if (prop->value() == "yes") { diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 4641d88aeb..ee0a67b9ef 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -135,7 +135,10 @@ PluginUI::PluginUI (AudioEngine &engine, PluginInsert& pi, bool scrollable) HBox* constraint_hbox = manage (new HBox); HBox* smaller_hbox = manage (new HBox); + Label* combo_label = manage (new Label (_("Presets"))); + combo_label->set_use_markup (true); + smaller_hbox->pack_start (*combo_label, false, false, 10); smaller_hbox->pack_start (combo, false, false); smaller_hbox->pack_start (save_button, false, false); @@ -143,12 +146,6 @@ PluginUI::PluginUI (AudioEngine &engine, PluginInsert& pi, bool scrollable) constraint_hbox->pack_start (*smaller_hbox, true, false); constraint_hbox->pack_end (bypass_button, false, false); -// name_ebox.add (*text_hbox); -// info_vbox.pack_start (name_ebox, false, false); -// info_vbox.pack_start (makerinfo_label, false, false); -// info_vbox.pack_start (paraminfo_label, false, false, 5); - -// settings_box.pack_start (info_vbox, false, false, 10); settings_box.pack_end (*constraint_hbox, false, false); pack_start (settings_box, false, false); @@ -165,9 +162,6 @@ PluginUI::PluginUI (AudioEngine &engine, PluginInsert& pi, bool scrollable) } else { pack_start (hpacker, false, false); - - // this is a hack to get the theme right - name_ebox.set_name ("PluginNameBox"); } insert.active_changed.connect (mem_fun(*this, &PluginUI::redirect_active_changed)); @@ -228,6 +222,9 @@ PluginUI::build (AudioEngine &engine) hpacker.pack_start(*bt_frame, true, true); box = manage (new VBox); + box->set_border_width (5); + box->set_spacing (1); + frame = manage (new Frame); frame->set_name ("BaseFrame"); frame->add (*box); @@ -348,42 +345,6 @@ PluginUI::build (AudioEngine &engine) output_update (); - string pname = plugin.name(); - - if (pname.length() > 24) { - pname = pname.substr (0, 24); - pname += "..."; - ARDOUR_UI::instance()->tooltips().set_tip(name_ebox, plugin.name()); - } - - - nameinfo_label.set_text (pname); - nameinfo_label.set_name ("PluginNameInfo"); - nameinfo_label.set_alignment (0.0, 0.0); - - string maker = plugin.maker(); - string::size_type email_pos; - - if ((email_pos = maker.find_first_of ('<')) != string::npos) { - maker = maker.substr (0, email_pos - 1); - } - - if (maker.length() > 32) { - maker = maker.substr (0, 32); - maker += " ..."; - } - - makerinfo_label.set_text (maker); - makerinfo_label.set_name ("PluginMakerInfo"); - makerinfo_label.set_alignment (0.0, 0.0); - - snprintf (info, sizeof(info),"[ %u %s | %u %s ]", - n_ins, ngettext(_("in"), _("ins"), n_ins), - n_outs, ngettext(_("out"), _("outs"), n_outs)); - paraminfo_label.set_text (info); - paraminfo_label.set_name ("PluginParameterInfo"); - paraminfo_label.set_alignment (0.0, 0.0); - output_table.show_all (); button_table.show_all (); } @@ -397,7 +358,7 @@ PluginUI::ControlUI::ControlUI () /* don't fix the height, it messes up the bar controllers */ - set_size_request_to_display_given_text (automate_button, X_("longenuff"), 2, -1); + set_size_request_to_display_given_text (automate_button, X_("longenuff"), 2, 2); ignore_change = 0; display = 0; @@ -552,14 +513,11 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, MIDI::Contr Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2); control_ui->clickbox->set_print_func (integer_printer, 0); } else { -// control_ui->control = new HSliderController (ARDOUR_UI::instance()->plugin_ui_slider_pix(), -// control_ui->adjustment, -// mcontrol); - sigc::slot pslot = sigc::bind (mem_fun(*this, &PluginUI::print_parameter), (uint32_t) port_index); control_ui->control = new BarController (*control_ui->adjustment, mcontrol, pslot); - control_ui->control->set_size_request (200, 15); + // should really match the height of the text in the automation button+label + control_ui->control->set_size_request (200, 22); control_ui->control->set_name (X_("PluginSlider")); control_ui->control->set_style (BarController::LeftToRight); control_ui->control->set_use_parent (true); @@ -588,7 +546,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, MIDI::Contr } control_ui->pack_start (control_ui->automate_button, false, false); -control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &PluginUI::control_adjustment_changed), control_ui)); + control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &PluginUI::control_adjustment_changed), control_ui)); control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &PluginUI::astate_clicked), control_ui, (uint32_t) port_index)); automation_state_changed (control_ui); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 0b4cb82560..aa01871124 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -101,8 +101,6 @@ class PluginUI : public PlugUIBase, public Gtk::VBox ARDOUR::AudioEngine &engine; Gtk::HBox settings_box; Gtk::HBox hpacker; - Gtk::VBox info_vbox; - Gtk::EventBox name_ebox; Gtk::Table button_table; Gtk::Table output_table; @@ -111,9 +109,6 @@ class PluginUI : public PlugUIBase, public Gtk::VBox Gtk::Adjustment hAdjustment; Gtk::Adjustment vAdjustment; Gtk::Viewport scroller_view; - Gtk::Label nameinfo_label; - Gtk::Label paraminfo_label; - Gtk::Label makerinfo_label; Gtk::Menu* automation_menu; bool setting_name_status; diff --git a/gtk2_ardour/po/SConscript b/gtk2_ardour/po/SConscript index d2a42d2f91..868f123988 100644 --- a/gtk2_ardour/po/SConscript +++ b/gtk2_ardour/po/SConscript @@ -47,5 +47,5 @@ for lang in languages[:]: env.Alias('install', env.InstallAs (os.path.join (modir, moname), lang + '.mo')) env.Alias ('tarball', env.Distribute (env['DISTTREE'], - [ 'SConscript' ] + + [ 'SConscript', 'gtk_ardour.pot' ] + glob.glob('*.po'))) diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 895cb84f34..1d0ed0507a 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -68,7 +68,10 @@ using namespace Glib; using namespace Gtkmm2ext; RedirectBox* RedirectBox::_current_redirect_box = 0; - +RefPtr RedirectBox::paste_action; +bool RedirectBox::get_colors = true; +Gdk::Color* RedirectBox::active_redirect_color; +Gdk::Color* RedirectBox::inactive_redirect_color; RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelector &plugsel, RouteRedirectSelection & rsel, bool owner_is_mixer) @@ -78,13 +81,22 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec _placement(pcmnt), _plugin_selector(plugsel), _rr_selection(rsel) - //redirect_display (1) { + if (get_colors) { + active_redirect_color = new Gdk::Color; + inactive_redirect_color = new Gdk::Color; + set_color (*active_redirect_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false )); + set_color (*inactive_redirect_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); + get_colors = false; + } + _width = Wide; redirect_menu = 0; send_action_menu = 0; redirect_drag_in_progress = false; - + no_redirect_redisplay = false; + ignore_delete = false; + model = ListStore::create(columns); RefPtr selection = redirect_display.get_selection(); @@ -92,8 +104,8 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec selection->signal_changed().connect (mem_fun (*this, &RedirectBox::selection_changed)); redirect_display.set_model (model); - redirect_display.append_column ("WHY?", columns.text); - redirect_display.set_name ("MixerRedirectSelector"); + redirect_display.append_column (X_("notshown"), columns.text); + redirect_display.set_name ("RedirectSelector"); redirect_display.set_headers_visible (false); redirect_display.set_reorderable (true); redirect_display.set_size_request (-1, 48); @@ -102,73 +114,61 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec redirect_display.add_object_drag (columns.redirect.index(), "redirects"); redirect_display.signal_object_drop.connect (mem_fun (*this, &RedirectBox::object_drop)); - // Does this adequately replace the drag start/stop signal handlers? - model->signal_rows_reordered().connect (mem_fun (*this, &RedirectBox::redirects_reordered)); + TreeViewColumn* name_col = redirect_display.get_column(0); + CellRendererText* renderer = dynamic_cast(redirect_display.get_column_cell_renderer (0)); + name_col->add_attribute(renderer->property_foreground_gdk(), columns.color); + redirect_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + model->signal_row_deleted().connect (mem_fun (*this, &RedirectBox::row_deleted)); redirect_scroller.add (redirect_display); redirect_eventbox.add (redirect_scroller); + pack_start (redirect_eventbox, true, true); - _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redirects_changed)); + _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redisplay_redirects)); redirect_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this)); - //redirect_eventbox.signal_leave_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::leave_box), this)); - - redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button)); - redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button)); - //redirect_display.signal_button_release_event().connect_after (ptr_fun (do_not_propagate)); - set_stuff_from_route (); + redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button_press_event), false); + redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button_press_event)); /* start off as a passthru strip. we'll correct this, if necessary, in update_diskstream_display(). */ - //set_name ("AudioTrackStripBase"); - /* now force an update of all the various elements */ - redirects_changed (0); - - //add_events (Gdk::BUTTON_RELEASE_MASK); + redisplay_redirects (0); } RedirectBox::~RedirectBox () { -// GoingAway(); /* EMIT_SIGNAL */ - } void RedirectBox::object_drop (string type, uint32_t cnt, void** ptr) { - if (type != "redirects") { + if (type != "redirects" || cnt == 0 || ptr == 0) { return; } -} -void -RedirectBox::set_stuff_from_route () -{ -} + /* do something with the dropped redirects */ -void -RedirectBox::set_title (const std::string & title) -{ - redirect_display.get_column(0)->set_title (title); -} + list redirects; -void -RedirectBox::set_title_shown (bool flag) -{ + for (uint32_t n = 0; n < cnt; ++n) { + redirects.push_back ((Redirect*) ptr[n]); + } + + paste_redirect_list (redirects); } - void RedirectBox::update() { - redirects_changed(0); + redisplay_redirects (0); } @@ -180,10 +180,9 @@ RedirectBox::set_width (Width w) } _width = w; - redirects_changed(0); + redisplay_redirects (0); } - void RedirectBox::remove_redirect_gui (Redirect *redirect) { @@ -239,6 +238,8 @@ RedirectBox::show_redirect_menu (gint arg) redirect_menu = build_redirect_menu (); } + paste_action->set_sensitive (!_rr_selection.redirects.empty()); + redirect_menu->popup (1, 0); } @@ -254,84 +255,58 @@ RedirectBox::redirect_drag_end (GdkDragContext *context) redirect_drag_in_progress = false; } -gint -RedirectBox::redirect_button (GdkEventButton *ev) -{ - Redirect *redirect; - TreeModel::Row row = *(redirect_display.get_selection()->get_selected()); - - if (row) - redirect = row[columns.redirect]; - - switch (ev->type) { - case GDK_BUTTON_PRESS: - if (ev->button == 3) { - show_redirect_menu (0); // Handle the context-click menu here as well - return TRUE; - } - else - return FALSE; - - case GDK_2BUTTON_PRESS: - if (ev->state != 0) { - return FALSE; +bool +RedirectBox::redirect_button_press_event (GdkEventButton *ev) +{ + TreeIter iter; + TreeModel::Path path; + TreeViewColumn* column; + int cellx; + int celly; + Redirect* redirect = 0; + int ret = false; + bool selected = false; + + if (redirect_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + if ((iter = model->get_iter (path))) { + redirect = (*iter)[columns.redirect]; + selected = redirect_display.get_selection()->is_selected (iter); } - /* might be edit event, see below */ - break; - - case GDK_BUTTON_RELEASE: - break; - - default: - /* shouldn't be here, but gcc complains */ - return FALSE; + } - + if (redirect && Keyboard::is_delete_event (ev)) { Glib::signal_idle().connect (bind (mem_fun(*this, &RedirectBox::idle_delete_redirect), redirect)); - return TRUE; - - } else if (redirect && (Keyboard::is_edit_event (ev) || ev->type == GDK_2BUTTON_PRESS)) { + ret = true; + + } else if (redirect && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS && ev->state == 0))) { if (_session.engine().connected()) { /* XXX giving an error message here is hard, because we may be in the midst of a button press */ edit_redirect (redirect); } - return TRUE; - + ret = true; + } else if (Keyboard::is_context_menu_event (ev)) { - show_redirect_menu(0); - return TRUE; //stop_signal (*clist, "button-release-event"); - } else { - switch (ev->button) { - case 1: - return FALSE; - break; - - case 2: - if (redirect) { - redirect->set_active (!redirect->active(), this); - } - break; + show_redirect_menu(0); + ret = true; - case 3: - break; + } else if (redirect && ev->button == 2 && ev->state == 0) { + + redirect->set_active (!redirect->active(), this); + ret = true; - default: - return FALSE; - } - } + } - return TRUE; + return ret; } Menu * RedirectBox::build_redirect_menu () { redirect_menu = dynamic_cast(ActionManager::get_widget("/redirectmenu") ); - redirect_menu->signal_map_event().connect (mem_fun(*this, &RedirectBox::redirect_menu_map_handler)); redirect_menu->set_name ("ArdourContextMenu"); show_all_children(); @@ -349,14 +324,6 @@ RedirectBox::selection_changed () } } -gint -RedirectBox::redirect_menu_map_handler (GdkEventAny *ev) -{ - // GTK2FIX - // popup_act_grp->get_action("paste")->set_sensitive (!_rr_selection.redirects.empty()); - return FALSE; -} - void RedirectBox::select_all_redirects () { @@ -503,12 +470,18 @@ RedirectBox::send_io_finished (IOSelector::Result r, Redirect* redirect, IOSelec } void -RedirectBox::redirects_changed (void *src) +RedirectBox::redisplay_redirects (void *src) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::redirects_changed), src)); - - //redirect_display.freeze (); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::redisplay_redirects), src)); + + if (no_redirect_redisplay) { + return; + } + + ignore_delete = true; model->clear (); + ignore_delete = false; + redirect_active_connections.clear (); redirect_name_connections.clear (); @@ -522,7 +495,6 @@ RedirectBox::redirects_changed (void *src) build_redirect_tooltip(redirect_eventbox, _("Post-fader inserts, sends & plugins:")); break; } - //redirect_display.thaw (); } void @@ -631,23 +603,21 @@ RedirectBox::show_redirect_active (Redirect *redirect, void *src) (*iter)[columns.text] = redirect_name (*redirect); if (redirect->active()) { - redirect_display.get_selection()->select (iter); + (*iter)[columns.color] = *active_redirect_color; } else { - redirect_display.get_selection()->unselect (iter); + (*iter)[columns.color] = *inactive_redirect_color; } } void -RedirectBox::redirects_reordered (const TreeModel::Path& path,const TreeModel::iterator& iter ,int* hmm) +RedirectBox::row_deleted (const Gtk::TreeModel::Path& path) { - /* this is called before the reorder has been done, so just queue - something for idle time. - */ - - Glib::signal_idle().connect (mem_fun(*this, &RedirectBox::compute_redirect_sort_keys)); + if (!ignore_delete) { + compute_redirect_sort_keys (); + } } -gint +void RedirectBox::compute_redirect_sort_keys () { uint32_t sort_key = 0; @@ -655,13 +625,13 @@ RedirectBox::compute_redirect_sort_keys () for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { Redirect *redirect = (*iter)[columns.redirect]; - redirect->set_sort_key (sort_key, this); + redirect->set_sort_key (sort_key); sort_key++; } if (_route.sort_redirects ()) { - redirects_changed (0); + redisplay_redirects (0); /* now tell them about the problem */ @@ -673,7 +643,6 @@ You cannot reorder this set of redirects\n\ in that way because the inputs and\n\ outputs do not work correctly.")); - dialog.get_vbox()->pack_start (label); dialog.add_button (Stock::OK, RESPONSE_ACCEPT); @@ -682,14 +651,8 @@ outputs do not work correctly.")); dialog.set_modal (true); dialog.show_all (); - // GTK2FIX - //dialog.realize(); - //dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH)); - dialog.run (); } - - return FALSE; } void @@ -842,19 +805,24 @@ RedirectBox::paste_redirects () return; } - RedirectSelection& sel (_rr_selection.redirects); - list others; + paste_redirect_list (_rr_selection.redirects); +} + +void +RedirectBox::paste_redirect_list (list& redirects) +{ + list copies; - for (list::iterator i = sel.begin(); i != sel.end(); ++i) { + for (list::iterator i = redirects.begin(); i != redirects.end(); ++i) { Redirect* copy = Redirect::clone (**i); copy->set_placement (_placement, this); - others.push_back (copy); + copies.push_back (copy); } - if (_route.add_redirects (others, this)) { - for (list::iterator i = others.begin(); i != others.end(); ++i) { + if (_route.add_redirects (copies, this)) { + for (list::iterator i = copies.begin(); i != copies.end(); ++i) { delete *i; } @@ -1083,22 +1051,6 @@ RedirectBox::enter_box (GdkEventCrossing *ev, RedirectBox* rb) return false; } -bool -RedirectBox::leave_box (GdkEventCrossing *ev, RedirectBox* rb) -{ - switch (ev->detail) { - case GDK_NOTIFY_INFERIOR: - break; - - case GDK_NOTIFY_VIRTUAL: - /* fallthru */ - default: - _current_redirect_box = 0; - } - - return false; -} - void RedirectBox::register_actions () { @@ -1116,7 +1068,7 @@ RedirectBox::register_actions () ActionManager::plugin_selection_sensitive_actions.push_back(act); act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy)); ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); + paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename)); ActionManager::plugin_selection_sensitive_actions.push_back(act); ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (RedirectBox::rb_select_all)); @@ -1199,6 +1151,8 @@ RedirectBox::rb_paste () if (_current_redirect_box == 0) { return; } + + _current_redirect_box->paste_redirects (); } void diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index d94ad20487..bc162fac17 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -69,9 +69,6 @@ class RedirectBox : public Gtk::HBox void set_width (Width); - void set_title (const std::string & title); - void set_title_shown (bool flag); - void update(); void select_all_redirects (); @@ -99,18 +96,24 @@ class RedirectBox : public Gtk::HBox RouteRedirectSelection & _rr_selection; struct ModelColumns : public Gtk::TreeModel::ColumnRecord { - ModelColumns () { - add (text); + ModelColumns () { + add (text); add (redirect); - } - Gtk::TreeModelColumn text; - Gtk::TreeModelColumn redirect; + add (color); + } + Gtk::TreeModelColumn text; + Gtk::TreeModelColumn redirect; + Gtk::TreeModelColumn color; }; ModelColumns columns; Glib::RefPtr model; void selection_changed (); + + static bool get_colors; + static Gdk::Color* active_redirect_color; + static Gdk::Color* inactive_redirect_color; Gtk::EventBox redirect_eventbox; Gtk::HBox redirect_hpacker; @@ -139,18 +142,22 @@ class RedirectBox : public Gtk::HBox void choose_plugin (); void insert_plugin_chosen (ARDOUR::Plugin *); - gint redirect_button (GdkEventButton *); - void redirects_changed (void *); + bool no_redirect_redisplay; + bool ignore_delete; + + bool redirect_button_press_event (GdkEventButton *); + void redisplay_redirects (void* src); void show_redirect_active (ARDOUR::Redirect *, void *); void show_redirect_name (void*, ARDOUR::Redirect *); void add_redirect_to_display (ARDOUR::Redirect *); + void row_deleted (const Gtk::TreeModel::Path& path); string redirect_name (ARDOUR::Redirect&); void remove_redirect_gui (ARDOUR::Redirect *); void redirects_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); - gint compute_redirect_sort_keys (); + void compute_redirect_sort_keys (); vector redirect_active_connections; vector redirect_name_connections; @@ -169,6 +176,8 @@ class RedirectBox : public Gtk::HBox void for_selected_redirects (void (RedirectBox::*pmf)(ARDOUR::Redirect*)); void get_selected_redirects (vector&); + static Glib::RefPtr paste_action; + void paste_redirect_list (std::list& redirects); void activate_redirect (ARDOUR::Redirect*); void deactivate_redirect (ARDOUR::Redirect*); diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 7987496a81..07f3bf865d 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -217,11 +217,6 @@ RouteParams_UI::setup_redirect_boxes() pre_redirect_box = new RedirectBox(PreFader, *session, *_route, *_plugin_selector, _rr_selection); post_redirect_box = new RedirectBox(PostFader, *session, *_route, *_plugin_selector, _rr_selection); - pre_redirect_box->set_title(_("Pre Redirects")); - pre_redirect_box->set_title_shown (true); - post_redirect_box->set_title(_("Post Redirects")); - post_redirect_box->set_title_shown (true); - pre_redir_hpane.add1 (*pre_redirect_box); post_redir_hpane.add1 (*post_redirect_box); -- cgit v1.2.3