8c33627dc487e7e7b9c5d0734e58bbf9b43281ca
[ardour.git] / gtk2_ardour / theme_manager.cc
1 /*
2     Copyright (C) 2000-2007 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 <cmath>
21 #include <errno.h>
22
23 #include "fix_carbon.h"
24
25 #include "pbd/gstdio_compat.h"
26
27 #include <gtkmm/settings.h>
28
29 #include "gtkmm2ext/gtk_ui.h"
30 #include "gtkmm2ext/utils.h"
31
32 #include "pbd/compose.h"
33
34 #include "ardour/profile.h"
35
36 #include "canvas/wave_view.h"
37
38 #include "ardour_button.h"
39 #include "ardour_dialog.h"
40 #include "theme_manager.h"
41 #include "ui_config.h"
42 #include "utils.h"
43
44 #include "pbd/i18n.h"
45
46 using namespace std;
47 using namespace Gtk;
48 using namespace PBD;
49 using namespace ARDOUR;
50 using namespace ARDOUR_UI_UTILS;
51
52 ThemeManager::ThemeManager()
53 {
54         BoolOption* bo;
55
56 #ifndef __APPLE__
57         bo = new BoolOption (
58                         "all-floating-windows-are-dialogs",
59                         _("All floating windows are dialogs"),
60                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_all_floating_windows_are_dialogs),
61                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_all_floating_windows_are_dialogs)
62                         );
63         bo->add_to_page (this);
64         bo->set_state_from_config ();
65         Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
66                                 _("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
67                                         "This may help with some window managers. This requires a restart of %1 to take effect"),
68                                 PROGRAM_NAME));
69
70         bo = new BoolOption (
71                         "transients-follow-front",
72                         _("Transient windows follow front window."),
73                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_transients_follow_front),
74                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_transients_follow_front)
75                         );
76         bo->add_to_page (this);
77         bo->set_state_from_config ();
78         Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
79                                 _("Make transient windows follow the front window when toggling between the editor and mixer.\n"
80                                         "This requires a restart of %1 to take effect"), PROGRAM_NAME));
81 #endif
82
83         if (!Profile->get_mixbus()) {
84                 bo = new BoolOption (
85                                 "floating-monitor-section",
86                                 _("Float detached monitor-section window"),
87                                 sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_floating_monitor_section),
88                                 sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_floating_monitor_section)
89                                 );
90                 bo->add_to_page (this);
91                 bo->set_state_from_config ();
92                 Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
93                                         _("When detaching the monitoring section, mark it as \"Utility\" window to stay in front.\n"
94                                                 "This requires a restart of %1 to take effect"), PROGRAM_NAME));
95         }
96
97         bo = new BoolOption (
98                         "flat-buttons",
99                         _("Draw \"flat\" buttons"),
100                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_flat_buttons),
101                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_flat_buttons)
102                         );
103         bo->add_to_page (this);
104         bo->set_state_from_config ();
105
106         vector<string> icon_sets = ::get_icon_sets ();
107         if (icon_sets.size() > 1) {
108                 ComboOption<std::string>* io = new ComboOption<std::string> (
109                                 "icon-set", _("Icon Set"),
110                                 sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_icon_set),
111                                 sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_icon_set)
112                                 );
113                 for (vector<string>::const_iterator i = icon_sets.begin (); i != icon_sets.end (); ++i) {
114                         io->add (*i, *i);
115                 }
116                 io->add_to_page (this);
117                 io->set_state_from_config ();
118         }
119
120         HSliderOption *hs = new HSliderOption(
121                         "timeline-item-gradient-depth",
122                         _("Waveforms color gradient depth"),
123                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_gradient_depth),
124                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_gradient_depth),
125                         0, 1.0, 0.05
126                         );
127         hs->scale().set_update_policy (Gtk::UPDATE_DELAYED);
128         hs->add_to_page (this);
129         hs->set_state_from_config ();
130
131         hs = new HSliderOption(
132                         "timeline-item-gradient-depth",
133                         _("Timeline item gradient depth"),
134                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_timeline_item_gradient_depth),
135                         sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_timeline_item_gradient_depth),
136                         0, 1.0, 0.05
137                         );
138         hs->scale().set_update_policy (Gtk::UPDATE_DELAYED);
139         hs->add_to_page (this);
140         hs->set_state_from_config ();
141 }
142
143 void
144 ThemeManager::set_state_from_config ()
145 {
146 }