mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
Turn Theme Manager into an OptionEditor (no direct use of Gtk)
This commit is contained in:
parent
1d97a0fb3e
commit
30c785dc37
4 changed files with 120 additions and 202 deletions
|
|
@ -437,6 +437,17 @@ ARDOUR_UI::parameter_changed (std::string p)
|
||||||
}
|
}
|
||||||
} else if (p == "layered-record-mode") {
|
} else if (p == "layered-record-mode") {
|
||||||
layered_button.set_active (_session->config.get_layered_record_mode ());
|
layered_button.set_active (_session->config.get_layered_record_mode ());
|
||||||
|
} else if (p == "show-waveform-clipping") {
|
||||||
|
ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping());
|
||||||
|
} else if (p == "waveform-gradient-depth") {
|
||||||
|
ArdourCanvas::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth());
|
||||||
|
} else if (p == "flat-buttons") {
|
||||||
|
bool flat = UIConfiguration::instance().get_flat_buttons();
|
||||||
|
if (ArdourButton::flat_buttons () != flat) {
|
||||||
|
ArdourButton::set_flat_buttons (flat);
|
||||||
|
/* force a redraw */
|
||||||
|
gtk_rc_reset_styles (gtk_settings_get_default());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3674,9 +3674,8 @@ if (!ARDOUR::Profile->get_mixbus()) {
|
||||||
|
|
||||||
/* and now the theme manager */
|
/* and now the theme manager */
|
||||||
|
|
||||||
ThemeManager* tm = manage (new ThemeManager);
|
|
||||||
add_option (_("Theme"), new OptionEditorHeading (_("Theme")));
|
add_option (_("Theme"), new OptionEditorHeading (_("Theme")));
|
||||||
add_page (_("Theme"), *tm);
|
add_option (_("Theme"), new ThemeManager);
|
||||||
|
|
||||||
add_option (_("Theme/Colors"), new OptionEditorHeading (_("Colors")));
|
add_option (_("Theme/Colors"), new OptionEditorHeading (_("Colors")));
|
||||||
add_option (_("Theme/Colors"), new ColorThemeManager);
|
add_option (_("Theme/Colors"), new ColorThemeManager);
|
||||||
|
|
|
||||||
|
|
@ -50,183 +50,125 @@ using namespace ARDOUR;
|
||||||
using namespace ARDOUR_UI_UTILS;
|
using namespace ARDOUR_UI_UTILS;
|
||||||
|
|
||||||
ThemeManager::ThemeManager()
|
ThemeManager::ThemeManager()
|
||||||
: flat_buttons (_("Draw \"flat\" buttons"))
|
|
||||||
, blink_rec_button (_("Blink Rec-Arm buttons"))
|
|
||||||
, region_color_button (_("Color regions using their track's color"))
|
|
||||||
, show_clipping_button (_("Show waveform clipping"))
|
|
||||||
, waveform_gradient_depth (0, 1.0, 0.05)
|
|
||||||
, waveform_gradient_depth_label (_("Waveforms color gradient depth"))
|
|
||||||
, timeline_item_gradient_depth (0, 1.0, 0.05)
|
|
||||||
, timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
|
|
||||||
, all_dialogs (_("All floating windows are dialogs"))
|
|
||||||
, transients_follow_front (_("Transient windows follow front window."))
|
|
||||||
, floating_monitor_section (_("Float detached monitor-section window"))
|
|
||||||
, icon_set_label (_("Icon Set"))
|
|
||||||
{
|
{
|
||||||
Gtk::HBox* hbox;
|
Gtk::HBox* hbox;
|
||||||
|
BoolOption* bo;
|
||||||
/* various buttons */
|
|
||||||
|
|
||||||
set_homogeneous (false);
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
pack_start (all_dialogs, PACK_SHRINK);
|
bo = new BoolOption (
|
||||||
pack_start (transients_follow_front, PACK_SHRINK);
|
"all-floating-windows-are-dialogs",
|
||||||
#endif
|
_("All floating windows are dialogs"),
|
||||||
if (!Profile->get_mixbus()) {
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_all_floating_windows_are_dialogs),
|
||||||
pack_start (floating_monitor_section, PACK_SHRINK);
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_all_floating_windows_are_dialogs)
|
||||||
}
|
);
|
||||||
pack_start (flat_buttons, PACK_SHRINK);
|
bo->add_to_page (this);
|
||||||
pack_start (blink_rec_button, PACK_SHRINK);
|
bo->set_state_from_config ();
|
||||||
pack_start (region_color_button, PACK_SHRINK);
|
Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
|
||||||
pack_start (show_clipping_button, PACK_SHRINK);
|
_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
|
||||||
|
|
||||||
vector<string> icon_sets = ::get_icon_sets ();
|
|
||||||
|
|
||||||
if (icon_sets.size() > 1) {
|
|
||||||
Gtkmm2ext::set_popdown_strings (icon_set_dropdown, icon_sets);
|
|
||||||
icon_set_dropdown.set_active_text (UIConfiguration::instance().get_icon_set());
|
|
||||||
|
|
||||||
hbox = Gtk::manage (new Gtk::HBox());
|
|
||||||
hbox->set_spacing (6);
|
|
||||||
Gtk::Alignment* align = Gtk::manage (new Gtk::Alignment);
|
|
||||||
align->set (0, 0.5);
|
|
||||||
align->add (icon_set_dropdown);
|
|
||||||
hbox->pack_start (icon_set_label, false, false);
|
|
||||||
hbox->pack_start (*align, true, true);
|
|
||||||
pack_start (*hbox, PACK_SHRINK);
|
|
||||||
}
|
|
||||||
|
|
||||||
hbox = Gtk::manage (new Gtk::HBox());
|
|
||||||
hbox->set_spacing (6);
|
|
||||||
hbox->pack_start (waveform_gradient_depth, true, true);
|
|
||||||
hbox->pack_start (waveform_gradient_depth_label, false, false);
|
|
||||||
pack_start (*hbox, PACK_SHRINK);
|
|
||||||
|
|
||||||
hbox = Gtk::manage (new Gtk::HBox());
|
|
||||||
hbox->set_spacing (6);
|
|
||||||
hbox->pack_start (timeline_item_gradient_depth, true, true);
|
|
||||||
hbox->pack_start (timeline_item_gradient_depth_label, false, false);
|
|
||||||
pack_start (*hbox, PACK_SHRINK);
|
|
||||||
|
|
||||||
show_all ();
|
|
||||||
|
|
||||||
waveform_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
|
|
||||||
timeline_item_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
|
|
||||||
|
|
||||||
set_ui_to_state();
|
|
||||||
|
|
||||||
flat_buttons.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_flat_buttons_toggled));
|
|
||||||
blink_rec_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_blink_rec_arm_toggled));
|
|
||||||
region_color_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_region_color_toggled));
|
|
||||||
show_clipping_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_show_clip_toggled));
|
|
||||||
waveform_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_waveform_gradient_depth_change));
|
|
||||||
timeline_item_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_timeline_item_gradient_depth_change));
|
|
||||||
all_dialogs.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_all_dialogs_toggled));
|
|
||||||
transients_follow_front.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_transients_follow_front_toggled));
|
|
||||||
floating_monitor_section.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_floating_monitor_section_toggled));
|
|
||||||
icon_set_dropdown.signal_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_icon_set_changed));
|
|
||||||
|
|
||||||
Gtkmm2ext::UI::instance()->set_tip (all_dialogs,
|
|
||||||
string_compose (_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
|
|
||||||
"This may help with some window managers. This requires a restart of %1 to take effect"),
|
"This may help with some window managers. This requires a restart of %1 to take effect"),
|
||||||
PROGRAM_NAME));
|
PROGRAM_NAME));
|
||||||
Gtkmm2ext::UI::instance()->set_tip (transients_follow_front,
|
|
||||||
string_compose (_("Make transient windows follow the front window when toggling between the editor and mixer.\n"
|
bo = new BoolOption (
|
||||||
|
"transients-follow-front",
|
||||||
|
_("Transient windows follow front window."),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_transients_follow_front),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_transients_follow_front)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
|
||||||
|
_("Make transient windows follow the front window when toggling between the editor and mixer.\n"
|
||||||
"This requires a restart of %1 to take effect"), PROGRAM_NAME));
|
"This requires a restart of %1 to take effect"), PROGRAM_NAME));
|
||||||
Gtkmm2ext::UI::instance()->set_tip (floating_monitor_section,
|
#endif
|
||||||
string_compose (_("When detaching the monitoring section, mark it as \"Utility\" window to stay in front.\n"
|
|
||||||
|
if (!Profile->get_mixbus()) {
|
||||||
|
bo = new BoolOption (
|
||||||
|
"floating-monitor-section",
|
||||||
|
_("Float detached monitor-section window"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_floating_monitor_section),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_floating_monitor_section)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), string_compose (
|
||||||
|
_("When detaching the monitoring section, mark it as \"Utility\" window to stay in front.\n"
|
||||||
"This requires a restart of %1 to take effect"), PROGRAM_NAME));
|
"This requires a restart of %1 to take effect"), PROGRAM_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"blink-rec-arm",
|
||||||
|
_("Blink Rec-Arm buttons"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_blink_rec_arm),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_blink_rec_arm)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"color-regions-using-track-color",
|
||||||
|
_("Color regions using their track's color"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_color_regions_using_track_color),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_color_regions_using_track_color)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"show-waveform-clipping",
|
||||||
|
_("Show waveform clipping"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_waveform_clipping),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_waveform_clipping)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"flat-buttons",
|
||||||
|
_("Draw \"flat\" buttons"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_flat_buttons),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_flat_buttons)
|
||||||
|
);
|
||||||
|
bo->add_to_page (this);
|
||||||
|
bo->set_state_from_config ();
|
||||||
|
|
||||||
|
vector<string> icon_sets = ::get_icon_sets ();
|
||||||
|
if (icon_sets.size() > 1) {
|
||||||
|
ComboOption<std::string>* io = new ComboOption<std::string> (
|
||||||
|
"icon-set", _("Icon Set"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_icon_set),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_icon_set)
|
||||||
|
);
|
||||||
|
for (vector<string>::const_iterator i = icon_sets.begin (); i != icon_sets.end (); ++i) {
|
||||||
|
io->add (*i, *i);
|
||||||
|
}
|
||||||
|
io->add_to_page (this);
|
||||||
|
io->set_state_from_config ();
|
||||||
|
}
|
||||||
|
|
||||||
|
HSliderOption *hs = new HSliderOption(
|
||||||
|
"timeline-item-gradient-depth",
|
||||||
|
_("Waveforms color gradient depth"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_gradient_depth),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_gradient_depth),
|
||||||
|
0, 1.0, 0.05
|
||||||
|
);
|
||||||
|
hs->scale().set_update_policy (Gtk::UPDATE_DELAYED);
|
||||||
|
hs->add_to_page (this);
|
||||||
|
hs->set_state_from_config ();
|
||||||
|
|
||||||
|
hs = new HSliderOption(
|
||||||
|
"timeline-item-gradient-depth",
|
||||||
|
_("Timeline item gradient depth"),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_timeline_item_gradient_depth),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_timeline_item_gradient_depth),
|
||||||
|
0, 1.0, 0.05
|
||||||
|
);
|
||||||
|
hs->scale().set_update_policy (Gtk::UPDATE_DELAYED);
|
||||||
|
hs->add_to_page (this);
|
||||||
|
hs->set_state_from_config ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ThemeManager::on_flat_buttons_toggled ()
|
ThemeManager::set_state_from_config ()
|
||||||
{
|
{
|
||||||
UIConfiguration::instance().set_flat_buttons (flat_buttons.get_active());
|
|
||||||
ArdourButton::set_flat_buttons (flat_buttons.get_active());
|
|
||||||
/* force a redraw */
|
|
||||||
gtk_rc_reset_styles (gtk_settings_get_default());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_blink_rec_arm_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_blink_rec_arm (blink_rec_button.get_active());
|
|
||||||
UIConfiguration::instance().ParameterChanged("blink-rec-arm");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_region_color_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_color_regions_using_track_color (region_color_button.get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_show_clip_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_show_waveform_clipping (show_clipping_button.get_active());
|
|
||||||
// "show-waveform-clipping" was a session config key
|
|
||||||
ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_all_dialogs_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_all_floating_windows_are_dialogs (all_dialogs.get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_transients_follow_front_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_transients_follow_front (transients_follow_front.get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_floating_monitor_section_toggled ()
|
|
||||||
{
|
|
||||||
UIConfiguration::instance().set_floating_monitor_section (floating_monitor_section.get_active());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_waveform_gradient_depth_change ()
|
|
||||||
{
|
|
||||||
double v = waveform_gradient_depth.get_value();
|
|
||||||
|
|
||||||
UIConfiguration::instance().set_waveform_gradient_depth (v);
|
|
||||||
ArdourCanvas::WaveView::set_global_gradient_depth (v);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_timeline_item_gradient_depth_change ()
|
|
||||||
{
|
|
||||||
double v = timeline_item_gradient_depth.get_value();
|
|
||||||
|
|
||||||
UIConfiguration::instance().set_timeline_item_gradient_depth (v);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::on_icon_set_changed ()
|
|
||||||
{
|
|
||||||
string new_set = icon_set_dropdown.get_active_text();
|
|
||||||
UIConfiguration::instance().set_icon_set (new_set);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ThemeManager::set_ui_to_state()
|
|
||||||
{
|
|
||||||
/* there is no need to block signal handlers, here,
|
|
||||||
* all elements check if the value has changed and ignore NOOPs
|
|
||||||
*/
|
|
||||||
all_dialogs.set_active (UIConfiguration::instance().get_all_floating_windows_are_dialogs());
|
|
||||||
transients_follow_front.set_active (UIConfiguration::instance().get_transients_follow_front());
|
|
||||||
floating_monitor_section.set_active (UIConfiguration::instance().get_floating_monitor_section());
|
|
||||||
flat_buttons.set_active (UIConfiguration::instance().get_flat_buttons());
|
|
||||||
blink_rec_button.set_active (UIConfiguration::instance().get_blink_rec_arm());
|
|
||||||
region_color_button.set_active (UIConfiguration::instance().get_color_regions_using_track_color());
|
|
||||||
show_clipping_button.set_active (UIConfiguration::instance().get_show_waveform_clipping());
|
|
||||||
waveform_gradient_depth.set_value(UIConfiguration::instance().get_waveform_gradient_depth());
|
|
||||||
timeline_item_gradient_depth.set_value(UIConfiguration::instance().get_timeline_item_gradient_depth());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,52 +20,18 @@
|
||||||
#ifndef __ardour_gtk_theme_manager_h__
|
#ifndef __ardour_gtk_theme_manager_h__
|
||||||
#define __ardour_gtk_theme_manager_h__
|
#define __ardour_gtk_theme_manager_h__
|
||||||
|
|
||||||
#include <gtkmm/treeview.h>
|
#include "option_editor.h"
|
||||||
#include <gtkmm/treestore.h>
|
|
||||||
#include <gtkmm/scrolledwindow.h>
|
|
||||||
#include <gtkmm/radiobutton.h>
|
|
||||||
#include <gtkmm/button.h>
|
|
||||||
#include <gtkmm/scale.h>
|
|
||||||
#include <gtkmm/rc.h>
|
|
||||||
|
|
||||||
#include "ui_config.h"
|
#include "ui_config.h"
|
||||||
|
|
||||||
class ArdourDialog;
|
class ArdourDialog;
|
||||||
|
|
||||||
class ThemeManager : public Gtk::VBox
|
class ThemeManager : public OptionEditorMiniPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ThemeManager();
|
ThemeManager();
|
||||||
|
|
||||||
void on_flat_buttons_toggled ();
|
void parameter_changed (std::string const &) {}
|
||||||
void on_blink_rec_arm_toggled ();
|
void set_state_from_config ();
|
||||||
void on_region_color_toggled ();
|
|
||||||
void on_show_clip_toggled ();
|
|
||||||
void on_waveform_gradient_depth_change ();
|
|
||||||
void on_timeline_item_gradient_depth_change ();
|
|
||||||
void on_all_dialogs_toggled ();
|
|
||||||
void on_transients_follow_front_toggled ();
|
|
||||||
void on_floating_monitor_section_toggled ();
|
|
||||||
void on_icon_set_changed ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Gtk::CheckButton flat_buttons;
|
|
||||||
Gtk::CheckButton blink_rec_button;
|
|
||||||
Gtk::CheckButton region_color_button;
|
|
||||||
Gtk::CheckButton show_clipping_button;
|
|
||||||
Gtk::HScale waveform_gradient_depth;
|
|
||||||
Gtk::Label waveform_gradient_depth_label;
|
|
||||||
Gtk::HScale timeline_item_gradient_depth;
|
|
||||||
Gtk::Label timeline_item_gradient_depth_label;
|
|
||||||
Gtk::CheckButton all_dialogs;
|
|
||||||
Gtk::CheckButton transients_follow_front;
|
|
||||||
Gtk::CheckButton floating_monitor_section;
|
|
||||||
Gtk::CheckButton gradient_waveforms;
|
|
||||||
Gtk::Label icon_set_label;
|
|
||||||
Gtk::ComboBoxText icon_set_dropdown;
|
|
||||||
|
|
||||||
void colors_changed ();
|
|
||||||
void set_ui_to_state ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_gtk_theme_manager_h__ */
|
#endif /* __ardour_gtk_theme_manager_h__ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue