Remove <gtkmm.h> include from header files.
[ardour.git] / gtk2_ardour / mixer_strip.cc
index e233a1674873141bd953b1141e76841c07535c14..1b0c82975c88556ef4694c976844c28ac0b8a13a 100644 (file)
 
 #include <sigc++/bind.h>
 
+#include <gtkmm/messagedialog.h>
+
 #include "pbd/convert.h"
 #include "pbd/enumwriter.h"
 #include "pbd/replace_all.h"
 #include "pbd/stacktrace.h"
 
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/choice.h>
-#include <gtkmm2ext/doi.h>
-#include <gtkmm2ext/slider_controller.h>
-#include <gtkmm2ext/bindable_button.h>
-
 #include "ardour/amp.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioengine.h"
 #include "ardour/vca.h"
 #include "ardour/vca_manager.h"
 
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/menu_elems.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/doi.h"
+
+#include "widgets/tooltips.h"
+
 #include "ardour_window.h"
+#include "enums_convert.h"
 #include "mixer_strip.h"
 #include "mixer_ui.h"
 #include "keyboard.h"
-#include "ardour_button.h"
 #include "public_editor.h"
 #include "send_ui.h"
 #include "io_selector.h"
 #include "gui_thread.h"
 #include "route_group_menu.h"
 #include "meter_patterns.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtk;
 using namespace Gtkmm2ext;
@@ -431,7 +432,7 @@ MixerStrip::vca_assign (boost::shared_ptr<ARDOUR::VCA> vca)
 {
        boost::shared_ptr<Slavable> sl = boost::dynamic_pointer_cast<Slavable> ( route() );
        if (sl)
-               sl->assign(vca, false);
+               sl->assign(vca);
 }
 
 void
@@ -741,9 +742,9 @@ MixerStrip::set_stuff_from_route ()
 {
        /* if width is not set, it will be set by the MixerUI or editor */
 
-       string str = gui_property ("strip-width");
-       if (!str.empty()) {
-               set_width_enum (Width (string_2_enum (str, _width)), this);
+       Width width;
+       if (get_gui_property ("strip-width", width)) {
+               set_width_enum (width, this);
        }
 }
 
@@ -762,7 +763,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
        _width = w;
 
        if (_width_owner == this) {
-               set_gui_property ("strip-width", enum_2_string (_width));
+               set_gui_property ("strip-width", _width);
        }
 
        set_button_names ();
@@ -776,14 +777,10 @@ MixerStrip::set_width_enum (Width w, void* owner)
                        show_sends_button->set_text (_("Aux"));
                }
 
-               gpm.gain_automation_style_button.set_text (
-                               gpm.astyle_string(gain_automation->automation_style()));
                gpm.gain_automation_state_button.set_text (
                                gpm.astate_string(gain_automation->automation_state()));
 
                if (_route->panner()) {
-                       ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
-                                       panners.astyle_string(_route->panner()->automation_style()));
                        ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
                                        panners.astate_string(_route->panner()->automation_state()));
                }
@@ -802,15 +799,11 @@ MixerStrip::set_width_enum (Width w, void* owner)
                        show_sends_button->set_text (_("Snd"));
                }
 
-               gpm.gain_automation_style_button.set_text (
-                               gpm.short_astyle_string(gain_automation->automation_style()));
                gpm.gain_automation_state_button.set_text (
                                gpm.short_astate_string(gain_automation->automation_state()));
                gain_meter().setup_meters (); // recalc meter width
 
                if (_route->panner()) {
-                       ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
-                       panners.short_astyle_string(_route->panner()->automation_style()));
                        ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
                        panners.short_astate_string(_route->panner()->automation_state()));
                }
@@ -838,12 +831,7 @@ void
 MixerStrip::set_packed (bool yn)
 {
        _packed = yn;
-
-       if (_packed) {
-               set_gui_property ("visible", true);
-       } else {
-               set_gui_property ("visible", false);
-       }
+       set_gui_property ("visible", _packed);
 }
 
 
@@ -1106,11 +1094,7 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR:
        input_menu_bundles.push_back (b);
 
        MenuList& citems = input_menu.items();
-
-       std::string n = b->name ();
-       replace_all (n, "_", " ");
-
-       citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
+       citems.push_back (MenuElemNoMnemonic (b->name (), sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
 }
 
 void
@@ -1134,21 +1118,17 @@ MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR
        output_menu_bundles.push_back (b);
 
        MenuList& citems = output_menu.items();
-
-       std::string n = b->name ();
-       replace_all (n, "_", " ");
-
-       citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
+       citems.push_back (MenuElemNoMnemonic (b->name (), sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
 }
 
 void
 MixerStrip::update_diskstream_display ()
 {
-        if (is_track() && input_selector) {
-                        input_selector->hide_all ();
-        }
+       if (is_track() && input_selector) {
+               input_selector->hide_all ();
+       }
 
-        route_color_changed ();
+       route_color_changed ();
 }
 
 void
@@ -1166,7 +1146,6 @@ MixerStrip::connect_to_pan ()
        boost::shared_ptr<Pannable> p = _route->pannable ();
 
        p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
-       p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
 
        /* This call reduncant, PannerUI::set_panner() connects to _panshell->Changed itself
         * However, that only works a panner was previously set.
@@ -1641,6 +1620,7 @@ MixerStrip::route_group_changed ()
 void
 MixerStrip::route_color_changed ()
 {
+       using namespace ARDOUR_UI_UTILS;
        name_button.modify_bg (STATE_NORMAL, color());
        number_label.set_fixed_colors (gdk_color_to_rgba (color()), gdk_color_to_rgba (color()));
        reset_strip_style ();
@@ -1687,13 +1667,26 @@ MixerStrip::build_route_ops_menu ()
 
        items.push_back (MenuElem (_("Outputs..."), sigc::mem_fun (*this, &RouteUI::edit_output_configuration)));
 
-       items.push_back (SeparatorElem());
+       if (!Profile->get_mixbus()) {
+               items.push_back (SeparatorElem());
+       }
 
-       if (!_route->is_master()) {
+       if (!_route->is_master()
+#ifdef MIXBUS
+                       && !_route->mixbus()
+#endif
+                       ) {
+               if (Profile->get_mixbus()) {
+                       items.push_back (SeparatorElem());
+               }
                items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
        }
-       items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
-       rename_menu_item = &items.back();
+
+       if (!Profile->get_mixbus()) {
+               items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
+               /* do not allow rename if the track is record-enabled */
+               items.back().set_sensitive (!is_track() || !track()->rec_enable_control()->get_value());
+       }
 
        items.push_back (SeparatorElem());
        items.push_back (CheckMenuElem (_("Active")));
@@ -1761,8 +1754,6 @@ MixerStrip::name_button_button_press (GdkEventButton* ev)
        if (ev->button == 1 || ev->button == 3) {
                list_route_operations ();
 
-               /* do not allow rename if the track is record-enabled */
-               rename_menu_item->set_sensitive (!is_track() || !track()->rec_enable_control()->get_value());
                if (ev->button == 1) {
                        Gtkmm2ext::anchored_menu_popup(route_ops_menu, &name_button, "",
                                                       1, ev->time);
@@ -1782,8 +1773,6 @@ MixerStrip::number_button_button_press (GdkEventButton* ev)
        if (  ev->button == 3 ) {
                list_route_operations ();
 
-               /* do not allow rename if the track is record-enabled */
-               rename_menu_item->set_sensitive (!is_track() || !track()->rec_enable_control()->get_value());
                route_ops_menu->popup (1, ev->time);
 
                return true;
@@ -1845,7 +1834,7 @@ MixerStrip::name_changed ()
                if (track_number == 0) {
                        number_label.set_text ("-");
                } else {
-                       number_label.set_text (PBD::to_string (abs(_route->track_number ()), std::dec));
+                       number_label.set_text (PBD::to_string (abs(_route->track_number ())));
                }
        } else {
                number_label.set_text ("");