mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
New theme manager, with option to select between dark and light theme. Cleanups to ardours handling of the ui rc file during startup, and changed the monitoring options to be global instead of session specific. More details about the theme stuff comign to ardour-dev
git-svn-id: svn://localhost/ardour2/trunk@1917 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0931c3b612
commit
e1f57ba8f0
17 changed files with 1678 additions and 136 deletions
|
|
@ -107,7 +107,6 @@ simpleline.cc
|
||||||
canvas-simplerect.c
|
canvas-simplerect.c
|
||||||
simplerect.cc
|
simplerect.cc
|
||||||
canvas-waveview.c
|
canvas-waveview.c
|
||||||
color_manager.cc
|
|
||||||
crossfade_edit.cc
|
crossfade_edit.cc
|
||||||
crossfade_view.cc
|
crossfade_view.cc
|
||||||
curvetest.cc
|
curvetest.cc
|
||||||
|
|
@ -185,6 +184,7 @@ send_ui.cc
|
||||||
streamview.cc
|
streamview.cc
|
||||||
audio_streamview.cc
|
audio_streamview.cc
|
||||||
tempo_dialog.cc
|
tempo_dialog.cc
|
||||||
|
theme_manager.cc
|
||||||
time_axis_view.cc
|
time_axis_view.cc
|
||||||
time_axis_view_item.cc
|
time_axis_view_item.cc
|
||||||
route_time_axis.cc
|
route_time_axis.cc
|
||||||
|
|
@ -325,7 +325,8 @@ if env['NLS']:
|
||||||
i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
|
i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
|
||||||
|
|
||||||
# configuration files
|
# configuration files
|
||||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui.rc'))
|
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_dark.rc'))
|
||||||
|
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_light.rc'))
|
||||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
|
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
|
||||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
|
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
|
||||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.colors'))
|
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.colors'))
|
||||||
|
|
@ -343,7 +344,7 @@ env.Alias ('tarball', env.Distribute (env['DISTTREE'],
|
||||||
'ardour.sh.in',
|
'ardour.sh.in',
|
||||||
'ardev_common.sh.in',
|
'ardev_common.sh.in',
|
||||||
'ardev', 'ardbg',
|
'ardev', 'ardbg',
|
||||||
'ardour2_ui.rc', 'splash.png',
|
'ardour2_ui_dark.rc', 'ardour2_ui_light.rc', 'splash.png',
|
||||||
'ardour.menus', 'ardour.bindings.in', 'ardour.colors',
|
'ardour.menus', 'ardour.bindings.in', 'ardour.colors',
|
||||||
'editor_xpms'
|
'editor_xpms'
|
||||||
] +
|
] +
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@
|
||||||
<menuitem action='ToggleOptionsEditor'/>
|
<menuitem action='ToggleOptionsEditor'/>
|
||||||
<menuitem action='ToggleInspector'/>
|
<menuitem action='ToggleInspector'/>
|
||||||
<menuitem action='ToggleLocations'/>
|
<menuitem action='ToggleLocations'/>
|
||||||
<menuitem action='ToggleColorManager'/>
|
<menuitem action='ToggleThemeManager'/>
|
||||||
<menuitem action='ToggleBigClock'/>
|
<menuitem action='ToggleBigClock'/>
|
||||||
<separator/>
|
<separator/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
1525
gtk2_ardour/ardour2_ui_light.rc
Normal file
1525
gtk2_ardour/ardour2_ui_light.rc
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -81,7 +81,7 @@
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
#include "color_manager.h"
|
#include "theme_manager.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -97,10 +97,11 @@ sigc::signal<void,bool> ARDOUR_UI::Blink;
|
||||||
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
|
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
|
||||||
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
|
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
|
||||||
sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock;
|
sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock;
|
||||||
|
sigc::signal<int,string> ThemeChanged;
|
||||||
|
|
||||||
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
|
||||||
|
|
||||||
: Gtkmm2ext::UI (X_("Ardour"), argcp, argvp, rcfile),
|
: Gtkmm2ext::UI (X_("Ardour"), argcp, argvp),
|
||||||
|
|
||||||
primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, false, true),
|
primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, false, true),
|
||||||
secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, false, true),
|
secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, false, true),
|
||||||
|
|
@ -166,11 +167,11 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
||||||
|
|
||||||
/* load colors */
|
/* load colors */
|
||||||
|
|
||||||
color_manager = new ColorManager();
|
theme_manager = new ThemeManager();
|
||||||
|
|
||||||
std::string color_file = ARDOUR::find_config_file("ardour.colors");
|
std::string color_file = ARDOUR::find_config_file("ardour.colors");
|
||||||
|
|
||||||
color_manager->load (color_file);
|
theme_manager->load (color_file);
|
||||||
|
|
||||||
editor = 0;
|
editor = 0;
|
||||||
mixer = 0;
|
mixer = 0;
|
||||||
|
|
@ -207,6 +208,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
||||||
gettimeofday (&last_peak_grab, 0);
|
gettimeofday (&last_peak_grab, 0);
|
||||||
gettimeofday (&last_shuttle_request, 0);
|
gettimeofday (&last_shuttle_request, 0);
|
||||||
|
|
||||||
|
ThemeChanged.connect (mem_fun(*this, &ARDOUR_UI::load_rcfile));
|
||||||
|
|
||||||
ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
|
ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
|
||||||
ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
|
ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
|
||||||
|
|
||||||
|
|
@ -1503,6 +1506,30 @@ ARDOUR_UI::do_engine_start ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ARDOUR_UI::setup_theme ()
|
||||||
|
{
|
||||||
|
string rcfile;
|
||||||
|
char* env;
|
||||||
|
|
||||||
|
if ((env = getenv ("ARDOUR2_UI_RC")) != 0 && strlen (env)) {
|
||||||
|
rcfile = env;
|
||||||
|
} else {
|
||||||
|
rcfile = Config->get_ui_rc_file();
|
||||||
|
}
|
||||||
|
|
||||||
|
rcfile = find_config_file (rcfile);
|
||||||
|
|
||||||
|
if (rcfile.empty()) {
|
||||||
|
warning << _("Without a UI style file, ardour will look strange.\n Please set ARDOUR2_UI_RC to point to a valid UI style file") << endmsg;
|
||||||
|
} else {
|
||||||
|
cerr << "Loading ui configuration file " << rcfile << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeChanged (rcfile); //EMIT SIGNAL
|
||||||
|
theme_manager->setup_theme_buttons();
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
ARDOUR_UI::start_engine ()
|
ARDOUR_UI::start_engine ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class About;
|
||||||
class AddRouteDialog;
|
class AddRouteDialog;
|
||||||
class NewSessionDialog;
|
class NewSessionDialog;
|
||||||
class LocationUI;
|
class LocationUI;
|
||||||
class ColorManager;
|
class ThemeManager;
|
||||||
|
|
||||||
namespace Gtkmm2ext {
|
namespace Gtkmm2ext {
|
||||||
class TearOff;
|
class TearOff;
|
||||||
|
|
@ -91,12 +91,14 @@ namespace ALSA {
|
||||||
class MultiChannelDevice;
|
class MultiChannelDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern sigc::signal<int,string> ThemeChanged;
|
||||||
|
|
||||||
#define FRAME_NAME "BaseFrame"
|
#define FRAME_NAME "BaseFrame"
|
||||||
|
|
||||||
class ARDOUR_UI : public Gtkmm2ext::UI
|
class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ARDOUR_UI (int *argcp, char **argvp[], string rcfile);
|
ARDOUR_UI (int *argcp, char **argvp[]);
|
||||||
~ARDOUR_UI();
|
~ARDOUR_UI();
|
||||||
|
|
||||||
void show ();
|
void show ();
|
||||||
|
|
@ -140,7 +142,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
Mixer_UI* the_mixer() { return mixer; }
|
Mixer_UI* the_mixer() { return mixer; }
|
||||||
|
|
||||||
void toggle_location_window ();
|
void toggle_location_window ();
|
||||||
void toggle_color_manager ();
|
void toggle_theme_manager ();
|
||||||
void toggle_big_clock_window ();
|
void toggle_big_clock_window ();
|
||||||
void toggle_connection_editor ();
|
void toggle_connection_editor ();
|
||||||
void toggle_route_params_window ();
|
void toggle_route_params_window ();
|
||||||
|
|
@ -214,6 +216,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
void save_keybindings ();
|
void save_keybindings ();
|
||||||
|
|
||||||
void setup_profile ();
|
void setup_profile ();
|
||||||
|
void setup_theme ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class PublicEditor;
|
friend class PublicEditor;
|
||||||
|
|
@ -595,7 +598,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
int create_location_ui ();
|
int create_location_ui ();
|
||||||
void handle_locations_change (ARDOUR::Location*);
|
void handle_locations_change (ARDOUR::Location*);
|
||||||
|
|
||||||
ColorManager* color_manager;
|
ThemeManager* theme_manager;
|
||||||
|
|
||||||
/* Options window */
|
/* Options window */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
#include "audio_clock.h"
|
#include "audio_clock.h"
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "color_manager.h"
|
#include "theme_manager.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ ARDOUR_UI::setup_windows ()
|
||||||
setup_transport();
|
setup_transport();
|
||||||
build_menu_bar ();
|
build_menu_bar ();
|
||||||
|
|
||||||
color_manager->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleColorManager")));
|
theme_manager->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleThemeManager")));
|
||||||
|
|
||||||
top_packer.pack_start (menu_bar_base, false, false);
|
top_packer.pack_start (menu_bar_base, false, false);
|
||||||
top_packer.pack_start (transport_frame, false, false);
|
top_packer.pack_start (transport_frame, false, false);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "route_params_ui.h"
|
#include "route_params_ui.h"
|
||||||
#include "sfdb_ui.h"
|
#include "sfdb_ui.h"
|
||||||
#include "color_manager.h"
|
#include "theme_manager.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -325,17 +325,17 @@ ARDOUR_UI::toggle_location_window ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::toggle_color_manager ()
|
ARDOUR_UI::toggle_theme_manager ()
|
||||||
{
|
{
|
||||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleColorManager"));
|
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleThemeManager"));
|
||||||
if (act) {
|
if (act) {
|
||||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||||
|
|
||||||
if (tact->get_active()) {
|
if (tact->get_active()) {
|
||||||
color_manager->show_all ();
|
theme_manager->show_all ();
|
||||||
color_manager->present ();
|
theme_manager->present ();
|
||||||
} else {
|
} else {
|
||||||
color_manager->hide ();
|
theme_manager->hide ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ ARDOUR_UI::install_actions ()
|
||||||
act = ActionManager::register_toggle_action (common_actions, X_("ToggleBigClock"), _("Big Clock"), mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window));
|
act = ActionManager::register_toggle_action (common_actions, X_("ToggleBigClock"), _("Big Clock"), mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window));
|
||||||
ActionManager::session_sensitive_actions.push_back (act);
|
ActionManager::session_sensitive_actions.push_back (act);
|
||||||
act = ActionManager::register_action (common_actions, X_("About"), _("About"), mem_fun(*this, &ARDOUR_UI::show_splash));
|
act = ActionManager::register_action (common_actions, X_("About"), _("About"), mem_fun(*this, &ARDOUR_UI::show_splash));
|
||||||
act = ActionManager::register_toggle_action (common_actions, X_("ToggleColorManager"), _("Colors"), mem_fun(*this, &ARDOUR_UI::toggle_color_manager));
|
act = ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), mem_fun(*this, &ARDOUR_UI::toggle_theme_manager));
|
||||||
ActionManager::session_sensitive_actions.push_back (act);
|
ActionManager::session_sensitive_actions.push_back (act);
|
||||||
act = ActionManager::register_action (common_actions, X_("AddAudioTrack"), _("Add Audio Track"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1, ARDOUR::Normal, 1));
|
act = ActionManager::register_action (common_actions, X_("AddAudioTrack"), _("Add Audio Track"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1, ARDOUR::Normal, 1));
|
||||||
ActionManager::session_sensitive_actions.push_back (act);
|
ActionManager::session_sensitive_actions.push_back (act);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
#include <ardour/session_route.h>
|
#include <ardour/session_route.h>
|
||||||
#include <ardour/dB.h>
|
#include <ardour/dB.h>
|
||||||
|
|
||||||
|
#include <gtkmm/style.h>
|
||||||
|
#include <gdkmm/color.h>
|
||||||
#include <gtkmm2ext/utils.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
#include <gtkmm2ext/fastmeter.h>
|
#include <gtkmm2ext/fastmeter.h>
|
||||||
#include <gtkmm2ext/stop_signal.h>
|
#include <gtkmm2ext/stop_signal.h>
|
||||||
|
|
@ -101,6 +103,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
|
||||||
gain_display.signal_focus_in_event().connect (mem_fun (*this, &GainMeter::gain_focused), false);
|
gain_display.signal_focus_in_event().connect (mem_fun (*this, &GainMeter::gain_focused), false);
|
||||||
gain_display.signal_focus_out_event().connect (mem_fun (*this, &GainMeter::gain_focused), false);
|
gain_display.signal_focus_out_event().connect (mem_fun (*this, &GainMeter::gain_focused), false);
|
||||||
|
|
||||||
|
gain_display_box.set_name ("MeterMetricsStrip");
|
||||||
gain_display_box.set_homogeneous (true);
|
gain_display_box.set_homogeneous (true);
|
||||||
gain_display_box.set_spacing (2);
|
gain_display_box.set_spacing (2);
|
||||||
gain_display_box.pack_start (gain_display, true, true);
|
gain_display_box.pack_start (gain_display, true, true);
|
||||||
|
|
@ -227,6 +230,7 @@ GainMeter::set_width (Width w)
|
||||||
Glib::RefPtr<Gdk::Pixmap>
|
Glib::RefPtr<Gdk::Pixmap>
|
||||||
GainMeter::render_metrics (Gtk::Widget& w)
|
GainMeter::render_metrics (Gtk::Widget& w)
|
||||||
{
|
{
|
||||||
|
cerr << "GainMeter::render_metrics() called, red = " << w.get_style()->get_bg(Gtk::STATE_NORMAL).get_red() << endl;//DEBUG
|
||||||
Glib::RefPtr<Gdk::Window> win (w.get_window());
|
Glib::RefPtr<Gdk::Window> win (w.get_window());
|
||||||
Glib::RefPtr<Gdk::GC> fg_gc (w.get_style()->get_fg_gc (Gtk::STATE_NORMAL));
|
Glib::RefPtr<Gdk::GC> fg_gc (w.get_style()->get_fg_gc (Gtk::STATE_NORMAL));
|
||||||
Glib::RefPtr<Gdk::GC> bg_gc (w.get_style()->get_bg_gc (Gtk::STATE_NORMAL));
|
Glib::RefPtr<Gdk::GC> bg_gc (w.get_style()->get_bg_gc (Gtk::STATE_NORMAL));
|
||||||
|
|
@ -268,9 +272,21 @@ GainMeter::render_metrics (Gtk::Widget& w)
|
||||||
gint
|
gint
|
||||||
GainMeter::meter_metrics_expose (GdkEventExpose *ev)
|
GainMeter::meter_metrics_expose (GdkEventExpose *ev)
|
||||||
{
|
{
|
||||||
|
static Glib::RefPtr<Gtk::Style> meter_style;
|
||||||
|
bool style_changed = false;
|
||||||
|
|
||||||
|
if (!meter_style ||
|
||||||
|
meter_style->get_bg(Gtk::STATE_NORMAL).get_red() != meter_metric_area.get_style()->get_bg(Gtk::STATE_NORMAL).get_red() ||
|
||||||
|
meter_style->get_bg(Gtk::STATE_NORMAL).get_green() != meter_metric_area.get_style()->get_bg(Gtk::STATE_NORMAL).get_green() ||
|
||||||
|
meter_style->get_bg(Gtk::STATE_NORMAL).get_blue() != meter_metric_area.get_style()->get_bg(Gtk::STATE_NORMAL).get_blue()) {
|
||||||
|
meter_style = meter_metric_area.get_style();
|
||||||
|
style_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Window> win (meter_metric_area.get_window());
|
Glib::RefPtr<Gdk::Window> win (meter_metric_area.get_window());
|
||||||
Glib::RefPtr<Gdk::GC> fg_gc (meter_metric_area.get_style()->get_fg_gc (Gtk::STATE_NORMAL));
|
Glib::RefPtr<Gdk::GC> fg_gc (meter_style->get_fg_gc (Gtk::STATE_NORMAL));
|
||||||
Glib::RefPtr<Gdk::GC> bg_gc (meter_metric_area.get_style()->get_bg_gc (Gtk::STATE_NORMAL));
|
Glib::RefPtr<Gdk::GC> bg_gc (meter_style->get_bg_gc (Gtk::STATE_NORMAL));
|
||||||
|
|
||||||
GdkRectangle base_rect;
|
GdkRectangle base_rect;
|
||||||
GdkRectangle draw_rect;
|
GdkRectangle draw_rect;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
@ -285,7 +301,7 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev)
|
||||||
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
||||||
std::map<string,Glib::RefPtr<Gdk::Pixmap> >::iterator i = metric_pixmaps.find (meter_metric_area.get_name());
|
std::map<string,Glib::RefPtr<Gdk::Pixmap> >::iterator i = metric_pixmaps.find (meter_metric_area.get_name());
|
||||||
|
|
||||||
if (i == metric_pixmaps.end()) {
|
if (i == metric_pixmaps.end() || style_changed) {
|
||||||
pixmap = render_metrics (meter_metric_area);
|
pixmap = render_metrics (meter_metric_area);
|
||||||
} else {
|
} else {
|
||||||
pixmap = i->second;
|
pixmap = i->second;
|
||||||
|
|
@ -293,7 +309,7 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev)
|
||||||
|
|
||||||
gdk_rectangle_intersect (&ev->area, &base_rect, &draw_rect);
|
gdk_rectangle_intersect (&ev->area, &base_rect, &draw_rect);
|
||||||
win->draw_rectangle (bg_gc, true, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height);
|
win->draw_rectangle (bg_gc, true, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height);
|
||||||
win->draw_drawable (bg_gc, pixmap, draw_rect.x, draw_rect.y, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height);
|
win->draw_drawable (fg_gc, pixmap, draw_rect.x, draw_rect.y, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include <gtkmm/button.h>
|
#include <gtkmm/button.h>
|
||||||
#include <gtkmm/table.h>
|
#include <gtkmm/table.h>
|
||||||
#include <gtkmm/drawingarea.h>
|
#include <gtkmm/drawingarea.h>
|
||||||
|
#include <gdkmm/colormap.h>
|
||||||
|
|
||||||
#include <ardour/types.h>
|
#include <ardour/types.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,29 +58,6 @@ extern int curvetest (string);
|
||||||
|
|
||||||
static ARDOUR_UI *ui = 0;
|
static ARDOUR_UI *ui = 0;
|
||||||
|
|
||||||
string
|
|
||||||
which_ui_rcfile ()
|
|
||||||
{
|
|
||||||
string rcfile;
|
|
||||||
char* env;
|
|
||||||
|
|
||||||
if ((env = getenv ("ARDOUR2_UI_RC")) != 0 && strlen (env)) {
|
|
||||||
rcfile = env;
|
|
||||||
} else {
|
|
||||||
rcfile = "ardour2_ui.rc";
|
|
||||||
}
|
|
||||||
|
|
||||||
rcfile = find_config_file (rcfile);
|
|
||||||
|
|
||||||
if (rcfile.empty()) {
|
|
||||||
warning << _("Without a UI style file, ardour will look strange.\n Please set ARDOUR2_UI_RC to point to a valid UI style file") << endmsg;
|
|
||||||
} else {
|
|
||||||
cerr << "Loading ui configuration file " << rcfile << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rcfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
show_ui_callback (void *arg)
|
show_ui_callback (void *arg)
|
||||||
{
|
{
|
||||||
|
|
@ -195,7 +172,7 @@ int main (int argc, char *argv[])
|
||||||
ARDOUR::AudioEngine *engine = NULL;
|
ARDOUR::AudioEngine *engine = NULL;
|
||||||
vector<Glib::ustring> null_file_list;
|
vector<Glib::ustring> null_file_list;
|
||||||
|
|
||||||
Glib::thread_init();
|
Glib::thread_init();
|
||||||
gtk_set_locale ();
|
gtk_set_locale ();
|
||||||
|
|
||||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||||
|
|
@ -253,7 +230,7 @@ int main (int argc, char *argv[])
|
||||||
PBD::ID::init ();
|
PBD::ID::init ();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
|
ui = new ARDOUR_UI (&argc, &argv);
|
||||||
} catch (failed_constructor& err) {
|
} catch (failed_constructor& err) {
|
||||||
error << _("could not create ARDOUR GUI") << endmsg;
|
error << _("could not create ARDOUR GUI") << endmsg;
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
@ -293,6 +270,7 @@ int main (int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->setup_theme ();
|
||||||
ui->start_engine ();
|
ui->start_engine ();
|
||||||
|
|
||||||
if (maybe_load_session ()) {
|
if (maybe_load_session ()) {
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,21 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <gtkmm/stock.h>
|
#include <gtkmm/stock.h>
|
||||||
|
#include <gtkmm2ext/gtk_ui.h>
|
||||||
|
#include <gtkmm/settings.h>
|
||||||
|
|
||||||
#include "color_manager.h"
|
#include <ardour/configuration.h>
|
||||||
|
|
||||||
|
#include "theme_manager.h"
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
|
#include "ardour_ui.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
using namespace ARDOUR;
|
||||||
|
|
||||||
/* the global color map */
|
/* the global color map */
|
||||||
|
|
||||||
|
|
@ -51,8 +57,10 @@ static const char *color_id_strs[] = {
|
||||||
sigc::signal<void> ColorsChanged;
|
sigc::signal<void> ColorsChanged;
|
||||||
sigc::signal<void,ColorID,uint32_t> ColorChanged;
|
sigc::signal<void,ColorID,uint32_t> ColorChanged;
|
||||||
|
|
||||||
ColorManager::ColorManager()
|
ThemeManager::ThemeManager()
|
||||||
: ArdourDialog ("ColorManager")
|
: ArdourDialog ("ThemeManager"),
|
||||||
|
dark_button ("Dark Theme"),
|
||||||
|
light_button ("Light Theme")
|
||||||
{
|
{
|
||||||
color_list = ListStore::create (columns);
|
color_list = ListStore::create (columns);
|
||||||
color_display.set_model (color_list);
|
color_display.set_model (color_list);
|
||||||
|
|
@ -70,26 +78,36 @@ ColorManager::ColorManager()
|
||||||
|
|
||||||
scroller.add (color_display);
|
scroller.add (color_display);
|
||||||
scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
|
scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
RadioButton::Group group = dark_button.get_group();
|
||||||
|
light_button.set_group(group);
|
||||||
|
theme_selection_hbox.set_homogeneous(false);
|
||||||
|
theme_selection_hbox.pack_start (dark_button);
|
||||||
|
theme_selection_hbox.pack_start (light_button);
|
||||||
|
|
||||||
|
get_vbox()->set_homogeneous(false);
|
||||||
|
get_vbox()->pack_start (theme_selection_hbox, PACK_SHRINK);
|
||||||
get_vbox()->pack_start (scroller);
|
get_vbox()->pack_start (scroller);
|
||||||
|
|
||||||
color_display.signal_button_press_event().connect (mem_fun (*this, &ColorManager::button_press_event), false);
|
color_display.signal_button_press_event().connect (mem_fun (*this, &ThemeManager::button_press_event), false);
|
||||||
|
|
||||||
color_dialog.get_colorsel()->set_has_opacity_control (true);
|
color_dialog.get_colorsel()->set_has_opacity_control (true);
|
||||||
color_dialog.get_colorsel()->set_has_palette (true);
|
color_dialog.get_colorsel()->set_has_palette (true);
|
||||||
|
|
||||||
color_dialog.get_ok_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
|
color_dialog.get_ok_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
|
||||||
color_dialog.get_cancel_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
|
color_dialog.get_cancel_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
|
||||||
|
dark_button.signal_clicked().connect (bind (mem_fun (*this, &ThemeManager::load_rc), 1));
|
||||||
|
light_button.signal_clicked().connect (bind (mem_fun (*this, &ThemeManager::load_rc), 2));
|
||||||
|
|
||||||
set_size_request (-1, 400);
|
set_size_request (-1, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorManager::~ColorManager()
|
ThemeManager::~ThemeManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ColorManager::load (string path)
|
ThemeManager::load (string path)
|
||||||
{
|
{
|
||||||
ifstream in (path.c_str());
|
ifstream in (path.c_str());
|
||||||
|
|
||||||
|
|
@ -151,17 +169,18 @@ ColorManager::load (string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorsChanged(); /* emit signal */
|
ColorsChanged(); /* emit signal */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ColorManager::save (string path)
|
ThemeManager::save (string path)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ColorManager::button_press_event (GdkEventButton* ev)
|
ThemeManager::button_press_event (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
TreeModel::Path path;
|
TreeModel::Path path;
|
||||||
|
|
@ -223,3 +242,33 @@ ColorManager::button_press_event (GdkEventButton* ev)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ThemeManager::load_rc(int which)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (which == 1) {
|
||||||
|
Config->set_ui_rc_file("ardour2_ui_dark.rc");
|
||||||
|
cerr << "dark theme selected" << endl;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Config->set_ui_rc_file("ardour2_ui_light.rc");
|
||||||
|
cerr << "light theme selected" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeChanged(find_config_file(Config->get_ui_rc_file())); //EMIT SIGNAL
|
||||||
|
|
||||||
|
cerr << "load_rc() called " << find_config_file(Config->get_ui_rc_file()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ThemeManager::setup_theme_buttons ()
|
||||||
|
{
|
||||||
|
if (Config->get_ui_rc_file() == "ardour2_ui_dark.rc") {
|
||||||
|
dark_button.set_active();
|
||||||
|
} else {
|
||||||
|
light_button.set_active();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -24,17 +24,22 @@
|
||||||
#include <gtkmm/liststore.h>
|
#include <gtkmm/liststore.h>
|
||||||
#include <gtkmm/scrolledwindow.h>
|
#include <gtkmm/scrolledwindow.h>
|
||||||
#include <gtkmm/colorselection.h>
|
#include <gtkmm/colorselection.h>
|
||||||
|
#include <gtkmm/radiobutton.h>
|
||||||
|
#include <gtkmm/rc.h>
|
||||||
#include "ardour_dialog.h"
|
#include "ardour_dialog.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
||||||
class ColorManager : public ArdourDialog
|
|
||||||
|
class ThemeManager : public ArdourDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorManager();
|
ThemeManager();
|
||||||
~ColorManager();
|
~ThemeManager();
|
||||||
|
|
||||||
int load (std::string path);
|
int load (std::string path);
|
||||||
int save (std::string path);
|
int save (std::string path);
|
||||||
|
void load_rc (int which);
|
||||||
|
void setup_theme_buttons ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
|
struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||||
|
|
@ -58,6 +63,9 @@ class ColorManager : public ArdourDialog
|
||||||
Glib::RefPtr<Gtk::ListStore> color_list;
|
Glib::RefPtr<Gtk::ListStore> color_list;
|
||||||
Gtk::ColorSelectionDialog color_dialog;
|
Gtk::ColorSelectionDialog color_dialog;
|
||||||
Gtk::ScrolledWindow scroller;
|
Gtk::ScrolledWindow scroller;
|
||||||
|
Gtk::HBox theme_selection_hbox;
|
||||||
|
Gtk::RadioButton dark_button;
|
||||||
|
Gtk::RadioButton light_button;
|
||||||
|
|
||||||
bool button_press_event (GdkEventButton*);
|
bool button_press_event (GdkEventButton*);
|
||||||
};
|
};
|
||||||
|
|
@ -78,7 +78,7 @@ CONFIG_VARIABLE (bool, mute_affects_pre_fader, "mute-affects-pre-fader", true)
|
||||||
CONFIG_VARIABLE (bool, mute_affects_post_fader, "mute-affects-post-fader", true)
|
CONFIG_VARIABLE (bool, mute_affects_post_fader, "mute-affects-post-fader", true)
|
||||||
CONFIG_VARIABLE (bool, mute_affects_control_outs, "mute-affects-control-outs", true)
|
CONFIG_VARIABLE (bool, mute_affects_control_outs, "mute-affects-control-outs", true)
|
||||||
CONFIG_VARIABLE (bool, mute_affects_main_outs, "mute-affects-main-outs", true)
|
CONFIG_VARIABLE (bool, mute_affects_main_outs, "mute-affects-main-outs", true)
|
||||||
CONFIG_VARIABLE (MonitorModel, monitoring_model, "monitoring-model", SoftwareMonitoring)
|
CONFIG_VARIABLE (MonitorModel, monitoring_model, "monitoring-model", ExternalMonitoring)
|
||||||
CONFIG_VARIABLE (SoloModel, solo_model, "solo-model", InverseMute)
|
CONFIG_VARIABLE (SoloModel, solo_model, "solo-model", InverseMute)
|
||||||
CONFIG_VARIABLE (bool, solo_latched, "solo-latched", true)
|
CONFIG_VARIABLE (bool, solo_latched, "solo-latched", true)
|
||||||
CONFIG_VARIABLE (bool, latched_record_enable, "latched-record-enable", false)
|
CONFIG_VARIABLE (bool, latched_record_enable, "latched-record-enable", false)
|
||||||
|
|
@ -143,6 +143,9 @@ CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true)
|
||||||
CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)
|
CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)
|
||||||
CONFIG_VARIABLE (string, possible_audio_file_regexp, "possible-audio-file-regexp", "\\.(wav|aiff|caf|w64|L|R)$")
|
CONFIG_VARIABLE (string, possible_audio_file_regexp, "possible-audio-file-regexp", "\\.(wav|aiff|caf|w64|L|R)$")
|
||||||
|
|
||||||
|
/* Theme */
|
||||||
|
CONFIG_VARIABLE (string, ui_rc_file, "ui-rc-file", "ardour2_ui_dark.rc")
|
||||||
|
|
||||||
/* BWAV */
|
/* BWAV */
|
||||||
|
|
||||||
CONFIG_VARIABLE (string, bwf_country_code, "bwf-country-code", "US")
|
CONFIG_VARIABLE (string, bwf_country_code, "bwf-country-code", "US")
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type();
|
||||||
#include <pbd/abstract_ui.cc> /* instantiate the template */
|
#include <pbd/abstract_ui.cc> /* instantiate the template */
|
||||||
|
|
||||||
|
|
||||||
UI::UI (string namestr, int *argc, char ***argv, string rcfile)
|
UI::UI (string namestr, int *argc, char ***argv)
|
||||||
: AbstractUI<UIRequest> (namestr, true)
|
: AbstractUI<UIRequest> (namestr, true)
|
||||||
{
|
{
|
||||||
theMain = new Main (argc, argv);
|
theMain = new Main (argc, argv);
|
||||||
|
|
@ -99,7 +99,7 @@ UI::UI (string namestr, int *argc, char ***argv, string rcfile)
|
||||||
|
|
||||||
register_thread (pthread_self(), X_("GUI"));
|
register_thread (pthread_self(), X_("GUI"));
|
||||||
|
|
||||||
load_rcfile (rcfile);
|
//load_rcfile (rcfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::~UI ()
|
UI::~UI ()
|
||||||
|
|
@ -129,76 +129,7 @@ UI::load_rcfile (string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
RC rc (path.c_str());
|
RC rc (path.c_str());
|
||||||
|
RC::reset_styles(Gtk::Settings::get_default());
|
||||||
/* have to pack widgets into a toplevel window so that styles will stick */
|
|
||||||
|
|
||||||
Window temp_window (WINDOW_TOPLEVEL);
|
|
||||||
HBox box;
|
|
||||||
Label a_widget1;
|
|
||||||
Label a_widget2;
|
|
||||||
Label a_widget3;
|
|
||||||
Label a_widget4;
|
|
||||||
RefPtr<Gtk::Style> style;
|
|
||||||
RefPtr<TextBuffer> buffer (errors->text().get_buffer());
|
|
||||||
|
|
||||||
box.pack_start (a_widget1);
|
|
||||||
box.pack_start (a_widget2);
|
|
||||||
box.pack_start (a_widget3);
|
|
||||||
box.pack_start (a_widget4);
|
|
||||||
|
|
||||||
error_ptag = buffer->create_tag();
|
|
||||||
error_mtag = buffer->create_tag();
|
|
||||||
fatal_ptag = buffer->create_tag();
|
|
||||||
fatal_mtag = buffer->create_tag();
|
|
||||||
warning_ptag = buffer->create_tag();
|
|
||||||
warning_mtag = buffer->create_tag();
|
|
||||||
info_ptag = buffer->create_tag();
|
|
||||||
info_mtag = buffer->create_tag();
|
|
||||||
|
|
||||||
a_widget1.set_name ("FatalMessage");
|
|
||||||
a_widget1.ensure_style ();
|
|
||||||
style = a_widget1.get_style();
|
|
||||||
|
|
||||||
fatal_ptag->property_font_desc().set_value(style->get_font());
|
|
||||||
fatal_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
|
|
||||||
fatal_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
|
|
||||||
fatal_mtag->property_font_desc().set_value(style->get_font());
|
|
||||||
fatal_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
|
|
||||||
fatal_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
|
|
||||||
|
|
||||||
a_widget2.set_name ("ErrorMessage");
|
|
||||||
a_widget2.ensure_style ();
|
|
||||||
style = a_widget2.get_style();
|
|
||||||
|
|
||||||
error_ptag->property_font_desc().set_value(style->get_font());
|
|
||||||
error_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
|
|
||||||
error_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
|
|
||||||
error_mtag->property_font_desc().set_value(style->get_font());
|
|
||||||
error_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
|
|
||||||
error_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
|
|
||||||
|
|
||||||
a_widget3.set_name ("WarningMessage");
|
|
||||||
a_widget3.ensure_style ();
|
|
||||||
style = a_widget3.get_style();
|
|
||||||
|
|
||||||
warning_ptag->property_font_desc().set_value(style->get_font());
|
|
||||||
warning_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
|
|
||||||
warning_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
|
|
||||||
warning_mtag->property_font_desc().set_value(style->get_font());
|
|
||||||
warning_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
|
|
||||||
warning_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
|
|
||||||
|
|
||||||
a_widget4.set_name ("InfoMessage");
|
|
||||||
a_widget4.ensure_style ();
|
|
||||||
style = a_widget4.get_style();
|
|
||||||
|
|
||||||
info_ptag->property_font_desc().set_value(style->get_font());
|
|
||||||
info_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
|
|
||||||
info_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
|
|
||||||
info_mtag->property_font_desc().set_value(style->get_font());
|
|
||||||
info_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
|
|
||||||
info_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ struct UIRequest : public BaseUI::BaseRequestObject {
|
||||||
class UI : public Receiver, public AbstractUI<UIRequest>
|
class UI : public Receiver, public AbstractUI<UIRequest>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UI (string name, int *argc, char **argv[], string rcfile);
|
UI (string name, int *argc, char **argv[]);
|
||||||
virtual ~UI ();
|
virtual ~UI ();
|
||||||
|
|
||||||
static UI *instance() { return theGtkUI; }
|
static UI *instance() { return theGtkUI; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue