Use signal_toggled instead of signal_clicked in ThemeManager so a theme is only ...
[ardour.git] / gtk2_ardour / editor.cc
index 6ed5561804fa835e5611919365ba47c2dfd2d99e..61250c1289126010153f80a1969669c58326f7e5 100644 (file)
@@ -137,8 +137,8 @@ static const gchar *_zoom_focus_strings[] = {
        N_("Left"),
        N_("Right"),
        N_("Center"),
-       N_("Playhead"),
-       N_("Edit Cursor"),
+       N_("Play"),
+       N_("Edit"),
        0
 };
 
@@ -312,11 +312,11 @@ Editor::Editor ()
        _dragging_playhead = false;
        _dragging_hscrollbar = false;
 
-       location_marker_color = color_map[cLocationMarker];
-       location_range_color = color_map[cLocationRange];
-       location_cd_marker_color = color_map[cLocationCDMarker];
-       location_loop_color = color_map[cLocationLoop];
-       location_punch_color = color_map[cLocationPunch];
+       location_marker_color = Config->canvasvar_LocationMarker.get();
+       location_range_color = Config->canvasvar_LocationRange.get();
+       location_cd_marker_color = Config->canvasvar_LocationCDMarker.get();
+       location_loop_color = Config->canvasvar_LocationLoop.get();
+       location_punch_color = Config->canvasvar_LocationPunch.get();
 
        range_marker_drag_rect = 0;
        marker_drag_line = 0;
@@ -447,7 +447,7 @@ Editor::Editor ()
        edit_packer.attach (edit_vscrollbar,         3, 4, 1, 2,    FILL,        FILL|EXPAND, 0, 0);
 
        edit_packer.attach (time_button_frame,       0, 2, 0, 1,    FILL,        FILL, 0, 0);
-       edit_packer.attach (time_canvas_event_box,   2, 3, 0, 1,    FILL|EXPAND, FILL, 0, 0);
+       edit_packer.attach (time_canvas_event_box,   2, 4, 0, 1,    FILL|EXPAND, FILL, 0, 0);
 
        edit_packer.attach (controls_layout,         1, 2, 1, 2,    FILL,        FILL|EXPAND, 0, 0);
        edit_packer.attach (track_canvas_event_box,  2, 3, 1, 2,    FILL|EXPAND, FILL|EXPAND, 0, 0);
@@ -628,10 +628,10 @@ Editor::Editor ()
 
        nlabel = manage (new Label (_("Regions")));
        nlabel->set_angle (-90);
-               the_notebook.append_page (region_list_scroller, *nlabel);
+       the_notebook.append_page (region_list_scroller, *nlabel);
        nlabel = manage (new Label (_("Tracks/Busses")));
        nlabel->set_angle (-90);
-               the_notebook.append_page (route_list_scroller, *nlabel);
+       the_notebook.append_page (route_list_scroller, *nlabel);
        nlabel = manage (new Label (_("Snapshots")));
        nlabel->set_angle (-90);
        the_notebook.append_page (snapshot_display_scroller, *nlabel);
@@ -812,6 +812,9 @@ Editor::show_window ()
 {
        show_all ();
        present ();
+       
+       /* re-hide editor list if necessary */
+       editor_list_button_toggled ();
 
        /* now reset all audio_time_axis heights, because widgets might need
           to be re-hidden
@@ -842,9 +845,9 @@ Editor::instant_save ()
        }
 
        if (session) {
-               session->add_instant_xml(get_state(), session->path());
+               session->add_instant_xml(get_state());
        } else {
-               Config->add_instant_xml(get_state(), get_user_ardour_path());
+               Config->add_instant_xml(get_state());
        }
 }
 
@@ -1966,6 +1969,22 @@ Editor::set_state (const XMLNode& node)
                        tact->set_active (yn);
                }
        }
+       
+       if ((prop = node.property ("show-editor-list"))) {
+
+               Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
+               assert(act);
+               if (act) {
+
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+                       bool yn = (prop->value() == X_("yes"));
+
+                       /* do it twice to force the change */
+                       
+                       tact->set_active (!yn);
+                       tact->set_active (yn);
+               }
+       }
 
 
        return 0;
@@ -2037,6 +2056,12 @@ Editor::get_state ()
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
                node->add_property (X_("show-editor-mixer"), tact->get_active() ? "yes" : "no");
        }
+       
+       act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               node->add_property (X_("show-editor-list"), tact->get_active() ? "yes" : "no");
+       }
 
        return *node;
 }
@@ -2059,7 +2084,7 @@ Editor::trackview_by_y_position (double y)
 }
 
 void
-Editor::snap_to (nframes_t& start, int32_t direction, bool for_mark)
+Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
 {
        Location* before = 0;
        Location* after = 0;
@@ -2068,11 +2093,11 @@ Editor::snap_to (nframes_t& start, int32_t direction, bool for_mark)
                return;
        }
 
-       const nframes_t one_second = session->frame_rate();
-       const nframes_t one_minute = session->frame_rate() * 60;
-       const nframes_t one_smpte_second = (nframes_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame());
-       nframes_t one_smpte_minute = (nframes_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60);
-       nframes_t presnap = start;
+       const nframes64_t one_second = session->frame_rate();
+       const nframes64_t one_minute = session->frame_rate() * 60;
+       const nframes64_t one_smpte_second = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame());
+       nframes64_t one_smpte_minute = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60);
+       nframes64_t presnap = start;
 
        switch (snap_type) {
        case SnapToFrame:
@@ -2394,7 +2419,7 @@ Editor::setup_toolbar ()
        ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session"));
 
        zoom_focus_selector.set_name ("ZoomFocusSelector");
-       Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Edit Cursor", FUDGE, 0);
+       Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Center", FUDGE, 0);
        set_popdown_strings (zoom_focus_selector, zoom_focus_strings);
        zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
        ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
@@ -2862,9 +2887,9 @@ Editor::zoom_focus_selection_done ()
                focus_type = ZoomFocusRight;
        } else if (choice == _("Center")) {
                focus_type = ZoomFocusCenter;
-       } else if (choice == _("Playhead")) {
+       } else if (choice == _("Play")) {
                focus_type = ZoomFocusPlayhead;
-       } else if (choice == _("Edit Cursor")) {
+       } else if (choice == _("Edit")) {
                focus_type = ZoomFocusEdit;
        } 
        
@@ -3624,3 +3649,4 @@ Editor::edit_cursor_position(bool sync)
 
        return edit_cursor->current_frame;
 }
+