actually connect Editor to config state change system
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 1 Oct 2006 13:06:43 +0000 (13:06 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 1 Oct 2006 13:06:43 +0000 (13:06 +0000)
git-svn-id: svn://localhost/ardour2/trunk@937 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor_actions.cc
gtk2_ardour/utils.cc

index 9ab4f0767698378a535a979c5d6bfecf196d8eb9..7a3ebfc13059495418743260e2f4a801a44d3fc1 100644 (file)
@@ -850,6 +850,8 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                map_meter_hold ();
        } else if (PARAM_IS ("meter-falloff")) {
                map_meter_falloff ();
+       } else if (PARAM_IS ("verify-remove-last-capture")) {
+               ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
        }
 
 #undef PARAM_IS
index 071f18d3ec4a3bf6c492ea1e34a41a4f626535e0..9ab8efb742ba7cb45f2ad634f430c54b4a5221db 100644 (file)
@@ -692,9 +692,10 @@ Editor::Editor (AudioEngine& eng)
        ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true));
        ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll));
 
+       Config->ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed));
+
        constructed = true;
        instant_save ();
-
 }
 
 Editor::~Editor()
@@ -1175,8 +1176,7 @@ Editor::connect_to_session (Session *t)
                loc->set_name (_("Punch"));
        }
 
-       update_loop_range_view (true);
-       update_punch_range_view (true);
+       Config->map_parameters (mem_fun (*this, &Editor::parameter_changed));
        
        session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved));
        
index b61c2c049be738e7d21f92a7f1c42b388bc3ad28..b36e4ff7f91fb7350dbbd49a3aedc2ea1e028de3 100644 (file)
@@ -489,33 +489,38 @@ Editor::update_smpte_mode ()
        ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode));
 
        RefPtr<Action> act;
+       const char* action = 0;
 
        float frames = Config->get_smpte_frames_per_second();
        bool drop = Config->get_smpte_drop_frames();
 
        if ((frames < 23.976 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
+               action = X_("Smpte23976");
        else if ((frames < 24 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte24"));
+               action = X_("Smpte24");
        else if ((frames < 24.976 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte24976"));
+               action = X_("Smpte24976");
        else if ((frames < 25 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte25"));
+               action = X_("Smpte25");
        else if ((frames < 29.97 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte2997"));
+               action = X_("Smpte2997");
        else if ((frames < 29.97 * 1.0005) && drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop"));
+               action = X_("Smpte2997drop");
        else if ((frames < 30 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte30"));
+               action = X_("Smpte30");
        else if ((frames < 30 * 1.0005) && drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop"));
+               action = X_("Smpte30drop");
        else if ((frames < 59.94 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte5994"));
+               action = X_("Smpte5994");
        else if ((frames < 60 * 1.0005) && !drop)
-               act = ActionManager::get_action (X_("Editor"), X_("Smpte60"));
-       else
-               cerr << "Unexpected SMPTE value (" << frames << (drop ? "drop" : "") << ") in update_smpte_mode.  Menu is probably wrong\n" << endl;
-               
+               action = X_("Smpte60");
+       else {
+               fatal << string_compose (_("programming error: Unexpected SMPTE value (%1, drop = %2) in update_smpte_mode.  Menu is probably wrong."),
+                                        frames, drop) << endmsg;
+               /*NOTREACHED*/
+       }
+
+       act = ActionManager::get_action (X_("Editor"), action);
 
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
@@ -531,28 +536,31 @@ Editor::update_video_pullup ()
        ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup));
 
        RefPtr<Action> act;
+       const char* action = 0;
 
        float pullup = Config->get_video_pullup();
 
        if ( pullup < (-4.1667 - 0.1) * 0.99) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1"));
+               action = X_("PullupMinus4Minus1");
        } else if ( pullup < (-4.1667) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4"));
+               action = X_("PullupMinus4");
        } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1"));
+               action = X_("PullupMinus4Plus1");
        } else if ( pullup < (-0.1) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1"));
+               action = X_("PullupMinus1");
        } else if (pullup > (4.1667 + 0.1) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1"));
+               action = X_("PullupPlus4Plus1");
        } else if ( pullup > (4.1667) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4"));
+               action = X_("PullupPlus4");
        } else if ( pullup > (4.1667 - 0.1) * 0.99) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1"));
+               action = X_("PullupPlus4Minus1");
        } else if ( pullup > (0.1) * 0.99 ) {
-               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1"));
-       } else
-               act = ActionManager::get_action (X_("Editor"), X_("PullupNone"));
+               action = X_("PullupPlus1");
+       } else {
+               action = X_("PullupNone");
+       }
 
+       act = ActionManager::get_action (X_("Editor"), action);
 
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
@@ -560,7 +568,6 @@ Editor::update_video_pullup ()
                        ract->set_active (true);
                }
        }
-
 }
 
 void
@@ -705,59 +712,64 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup)
           active.
        */
 
-       if (session) {
+       const char* action = 0;
 
-               RefPtr<Action> act;
-
-               float pull = 0.0;
-
-               switch (pullup) {
-                       case Session::pullup_Plus4Plus1:{
-                               pull = 4.1667 + 0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1"));
-                       } break;
-                       case Session::pullup_Plus4:{
-                               pull = 4.1667;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4"));
-                       } break;
-                       case Session::pullup_Plus4Minus1:{
-                               pull = 4.1667 - 0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1"));
-                       } break;
-                       case Session::pullup_Plus1:{
-                               pull = 0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1"));
-                       } break;
-                       case Session::pullup_None:{
-                               pull = 0.0;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupNone"));
-                       } break;
-                       case Session::pullup_Minus1:{
-                               pull = -0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1"));
-                       } break;
-                       case Session::pullup_Minus4Plus1:{
-                               pull = -4.1667 + 0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1"));
-                       } break;
-                       case Session::pullup_Minus4:{
-                               pull = -4.1667;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4"));
-                       } break;
-                       case Session::pullup_Minus4Minus1:{
-                               pull = -4.1667 - 0.1;
-                               act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1"));
-                       } break;
-                       default:
-                               cerr << "Session received unexpected pullup type" << endl;
+       RefPtr<Action> act;
+       
+       float pull = 0.0;
+       
+       switch (pullup) {
+       case Session::pullup_Plus4Plus1:
+               pull = 4.1667 + 0.1;
+               action = X_("PullupPlus4Plus1");
+               break;
+       case Session::pullup_Plus4:
+               pull = 4.1667;
+               action = X_("PullupPlus4");
+               break;
+       case Session::pullup_Plus4Minus1:
+               pull = 4.1667 - 0.1;
+               action = X_("PullupPlus4Minus1");
+               break;
+       case Session::pullup_Plus1:
+               pull = 0.1;
+               action = X_("PullupPlus1");
+               break;
+       case Session::pullup_None:
+               pull = 0.0;
+               action = X_("PullupNone");
+               break;
+       case Session::pullup_Minus1:
+               pull = -0.1;
+               action = X_("PullupMinus1");
+               break;
+       case Session::pullup_Minus4Plus1:
+               pull = -4.1667 + 0.1;
+               action = X_("PullupMinus4Plus1");
+               break;
+       case Session::pullup_Minus4:
+               pull = -4.1667;
+               action = X_("PullupMinus4");
+               break;
+       case Session::pullup_Minus4Minus1:
+               pull = -4.1667 - 0.1;
+               action = X_("PullupMinus4Minus1");
+               break;
+       default:
+               fatal << string_compose (_("programming error: %1"), "Session received unexpected pullup type") << endmsg;
+               /*NOTREACHED*/
+       }
+       
+       act = ActionManager::get_action (X_("Editor"), action);
+       
+       if (act) {
+               RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+               if (ract && ract->get_active()) {
+                       Config->set_video_pullup ( pull );
                }
                
-               if (act) {
-                       RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
-                       if (ract && ract->get_active()) {
-                               Config->set_video_pullup ( pull );
-                       }
-               } else  cerr << "Editor::video_pullup_chosen could not find action to match pullup." << endl;
+       } else  {
+               error << string_compose (_("programming error: %1"), "Editor::video_pullup_chosen could not find action to match pullup.") << endmsg;
        }
 }
 
@@ -807,10 +819,7 @@ Editor::parameter_changed (const char* parameter_name)
                ActionManager::map_some_state ("Editor", "toggle-auto-xfade", &Configuration::get_auto_xfade);
        } else if (PARAM_IS ("edit-mode")) {
                edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
-       } else if (PARAM_IS ("native-file-data-format")) {
        }
 
-
-
 #undef PARAM_IS
 }
index 7e58d0e2f7ef3ee9c7f0b5fe3f8cd29520ab6c99..1e283a6973310a749f9fa659fba9de653e764560 100644 (file)
@@ -71,8 +71,7 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font
                        break;
                }
                
-               ustr.erase (last);
-               --last;
+               ustr.erase (last--);
        }
 
        return ustr;