move all (G)UI related configuration parameters into UIConfiguration, not RCConfiguration
[ardour.git] / gtk2_ardour / main_clock.cc
1 /*
2     Copyright (C) 2012 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "ardour_ui.h"
21 #include "main_clock.h"
22
23 #include "i18n.h"
24
25 using namespace Gtk;
26
27 MainClock::MainClock (
28         const std::string& clock_name,
29         bool is_transient,
30         const std::string& widget_name,
31         bool editable,
32         bool follows_playhead,
33         bool primary,
34         bool duration,
35         bool with_info
36         )
37         : AudioClock (clock_name, is_transient, widget_name, editable, follows_playhead, duration, with_info)
38           , _primary (primary)
39 {
40
41 }
42
43 void
44 MainClock::build_ops_menu ()
45 {
46         using namespace Menu_Helpers;
47
48         AudioClock::build_ops_menu ();
49
50         MenuList& ops_items = ops_menu->items();
51         ops_items.push_back (SeparatorElem ());
52         ops_items.push_back (CheckMenuElem (_("Display delta to edit cursor"), sigc::mem_fun (*this, &MainClock::display_delta_to_edit_cursor)));
53         Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem *> (&ops_items.back());
54         if (_primary) {
55                 if (ARDOUR_UI::config()->get_primary_clock_delta_edit_cursor ()) {
56                         ARDOUR_UI::config()->set_primary_clock_delta_edit_cursor (false);
57                         c->set_active (true);
58                 }
59         } else {
60                 if (ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ()) {
61                         ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (false);
62                         c->set_active (true);
63                 }
64         }
65 }
66
67 void
68 MainClock::display_delta_to_edit_cursor ()
69 {
70         if (_primary) {
71                 ARDOUR_UI::config()->set_primary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_primary_clock_delta_edit_cursor ());
72         } else {
73                 ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ());
74         }
75 }