New theme manager from trunk, backported to 2.0-ongoing

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2110 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Doug McLain 2007-07-05 05:33:40 +00:00
parent 0518b045c6
commit 291a186cba
60 changed files with 4186 additions and 849 deletions

View file

@ -748,7 +748,7 @@ libraries['flac'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local
#
conf = Configure (libraries['flac'])
if conf.CheckLib ('FLAC', 'FLAC__seekable_stream_decoder_set_read_callback', language='CXX'):
if conf.CheckLib ('FLAC', 'FLAC__seekable_stream_decoder_init', language='CXX'):
conf.env.Append(CCFLAGS='-DHAVE_FLAC')
use_flac = True
else:
@ -1119,7 +1119,6 @@ env = conf.Finish()
# generate the per-user and system rc files from the same source
rcbuild = env.SubstInFile ('ardour.rc','ardour.rc.in', SUBST_DICT = subst_dict)
sysrcbuild = env.SubstInFile ('ardour_system.rc','ardour.rc.in', SUBST_DICT = subst_dict)
# add to the substitution dictionary
@ -1136,9 +1135,7 @@ the_revision = env.Command ('frobnicatory_decoy', [], create_stored_revision)
env.Alias('revision', the_revision)
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour_system.rc'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.rc'))
Default (rcbuild)
Default (sysrcbuild)
# source tarball

View file

@ -106,7 +106,6 @@ simpleline.cc
canvas-simplerect.c
simplerect.cc
canvas-waveview.c
color_manager.cc
crossfade_edit.cc
crossfade_view.cc
curvetest.cc
@ -195,9 +194,11 @@ streamview.cc
audio_streamview.cc
tape_region_view.cc
tempo_dialog.cc
theme_manager.cc
time_axis_view.cc
time_axis_view_item.cc
time_selection.cc
ui_config.cc
utils.cc
version.cc
visual_time_axis.cc
@ -316,10 +317,11 @@ if env['NLS']:
i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
# 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'), 'ardour2_ui_default.conf'))
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.colors'))
# data files
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
@ -334,8 +336,8 @@ env.Alias ('tarball', env.Distribute (env['DISTTREE'],
'ardour.sh.in',
'ardev_common.sh.in',
'ardev', 'ardbg',
'ardour2_ui.rc', 'splash.png',
'ardour.menus', 'ardour.bindings.in', 'ardour.colors',
'ardour2_ui_dark.rc', 'ardour2_ui_light.rc', 'splash.png',
'ardour.menus', 'ardour.bindings.in', 'ardour2_ui_default.conf',
'editor_xpms'
] +
gtkardour_files +

View file

@ -34,7 +34,7 @@
#include "svn_revision.h"
#include "about.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
//#include "ardour_ui.h"
#include "i18n.h"

View file

@ -1,107 +0,0 @@
cWaveForm 0.0 0.0 0.0 0.80
cWaveFormClip 1.0 0.0 0.0 0.90
cMutedWaveForm 0.35 0.35 0.35 1.0
cSelectedFrameBase 0.71 0.57 0.66 1.0
cFrameBase 0.75 0.75 0.76 1.0
cAudioTrackBase 0.78 0.83 0.85 0.41
cAudioTrackOutline 0.00 0.00 0.00 1.00
cAudioBusBase 0.86 0.82 0.92 0.41
cMeterBar 0.40 0.40 0.45 1.0
cTempoBar 0.45 0.45 0.50 1.0
cMarkerBar 0.50 0.50 0.55 1.0
cRangeMarkerBar 0.55 0.55 0.59 1.0
cTransportMarkerBar 0.60 0.60 0.64 1.0
cTimeStretchFill 0.89 0.71 0.71 0.59
cTimeStretchOutline 0.39 0.39 0.39 0.59
cAutomationLine 0.27 0.74 0.35 1.0
cLeftPanAutomationLine 0.87 0.44 0.11 1.0
cRightPanAutomationLine 0.03 0.26 0.73 1.0
cRedirectAutomationLine 0.48 0.64 0.98 1.0
cControlPointFill 0 0 0 1.0
cControlPointOutline 0 0 0 1.0
cEnteredControlPointOutline 1.0 0.21 0.21 1.0
cEnteredControlPointSelected 0.00 1.00 0.00 1.00
cEnteredControlPoint 1.00 0.00 0.00 1.00
cControlPointSelected 0.91 0.04 0.04 1.00
cControlPoint 0.00 0.00 0.00 1.00
cAutomationTrackFill 0.63 0.63 0.81 0.41
cAutomationTrackOutline 0.16 0.16 0.16 1.0
cCrossfadeEditorBase 0.16 0.18 0.29 1.0
cCrossfadeEditorLine 0 0 0 1.0
cSelectedCrossfadeEditorLine 0 0.86 0.86 1.0
cCrossfadeEditorLineShading 0 0.63 0.82 0.33
cCrossfadeEditorPointFill 0 1.0 0 1.0
cCrossfadeEditorPointOutline 0 0 1.0 1.0
cCrossfadeEditorWave 1.0 1.0 1.0 0.16
cSelectedCrossfadeEditorWave 0.98 0.92 0.08 0.63
cCrossfadeLine 0 0 0 1.0
cActiveCrossfade 0.91 0.93 0.24 0.47
cInactiveCrossfade 0 0 0 0
cLocationMarker 0.77 0.96 0.07 1.0
cLocationRange 0.29 0.48 0.35 1.0
cLocationCDMarker 0.12 0.91 0.77 1.0
cLocationLoop 0.21 0.59 0.31 1.0
cLocationPunch 0.49 0.23 0.23 1.0
cVerboseCanvasCursor 0.96 0.95 0.08 0.74
cRangeDragBarRect 0.59 0.59 0.59 0.78
cRangeDragBarRectFill 0.78 0.82 0.70 0.43
cRangeDragRect 0.59 0.59 0.59 0.78
cRangeDragRectFill 0.51 0.78 0.59 0.78
cTransportDragRect 0.59 0.59 0.59 0.78
cTransportDragRectFill 0.78 0.78 0.78 1.43
cMarkerDragLine 0 0.31 0 0.98
cTransportLoopRect 0.12 0.47 0.16 0.98
cTransportLoopRectFill 0.12 0.47 0.16 0.98
cTransportPunchRect 0.43 0.16 0.16 0.90
cTransportPunchRectFill 0.43 0.16 0.16 0.90
cPunchInLine 0.66 0.00 0.00 1.00
cPunchOutLine 0.66 0.00 0.00 1.00
cZoomRect 0.59 0.59 0.59 0.78
cZoomRectFill 0.78 0.82 0.70 0.43
cRubberBandRect 0.08 1.00 0.52 0.59
cRubberBandRectFill 0.78 0.78 0.78 0.35
cFirstActionMessage 0.00 0.00 0.00 1.00
cEnteredGainLine 0.87 0.39 0.39 1.00
cEnteredAutomationLine 0.87 0.39 0.39 1.00
cEnteredMarker 0.87 0.39 0.39 1.00
cMeterMarker 0.95 0.26 0.36 1.00
cTempoMarker 0.95 0.26 0.36 1.00
cMeasureLineBeat 0.45 0.45 0.45 0.40
cMeasureLineBar 0.55 0.55 0.60 0.55
cGhostTrackBaseOutline 0.00 0.00 0.00 1.00
cGhostTrackBaseFill 0.27 0.00 0.49 0.50
cGhostTrackWave 0.0 3.00 0.0 0.30
cGhostTrackWaveClip 1.0 0.0 0.0 0.0
cGhostTrackZeroLine 0.9 0.0 0.9 0.40
cImageTrackBase 0.87 0.87 0.85 1.00
cImageTrackOutline 0.00 0.00 0.00 1.00
cMarkerTrackBase 0.87 0.87 0.85 1.00
cMarkerTrackOutline 0.00 0.00 0.00 1.00
cZeroLine 0.71 0.71 0.71 1.00
cGainLine 0.00 1.00 0.00 1.00
cGainLineInactive 0.06 0.06 0.06 1.00
cRecordingRectFill 0.90 0.78 0.78 1.00
cRecordingRectOutline 0.31 0.16 0.16 1.00
cSelectionRectFill 0.91 0.96 0.83 0.47
cSelectionRectOutline 0.39 0.39 0.39 0.59
cSelectionEndFill 0.39 0.39 0.39 0.70
cSelectionEndOutline 0.39 0.39 0.39 1.0
cSelectionStartFill 0.39 0.39 0.39 0.70
cSelectionStartOutline 0.39 0.39 0.39 1.0
cVestigialFrameFill 0.27 0.00 0.49 0.06
cVestigialFrameOutline 0.00 0.00 0.00 1.00
cTimeAxisFrameFill 0.27 0.00 0.49 0.06
cTimeAxisFrameOutline 0.00 0.00 0.00 1.00
cNameHighlightFill 0.00 0.00 1.00 1.00
cNameHighlightOutline 0.49 0.00 1.00 0.59
cFrameHandleStartFill 0.49 0.00 1.00 0.59
cFrameHandleStartOutline 0.00 0.00 0.00 1.00
cFrameHandleEndFill 0.49 0.00 1.00 0.59
cFrameHandleEndOutline 0.00 0.00 0.00 1.00
cTrimHandleLockedStart 0.92 0.06 0.06 0.16
cTrimHandleLockedEnd 0.92 0.06 0.06 0.16
cTrimHandleStart 0.10 0.00 1.00 0.27
cTrimHandleEnd 0.10 0.00 1.00 0.27
cEditCursor 0.00 0.00 1.00 1.00
cPlayHead 1.00 0.00 0.00 1.00

View file

@ -238,7 +238,7 @@
<menuitem action='ToggleOptionsEditor'/>
<menuitem action='ToggleInspector'/>
<menuitem action='ToggleLocations'/>
<menuitem action='ToggleColorManager'/>
<menuitem action='ToggleThemeManager'/>
<menuitem action='ToggleBigClock'/>
<separator/>
</menu>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Ardour>
<Canvas>
<Option name="waveform" value="000000cc"/>
<Option name="clipped waveform" value="ff0000e5"/>
<Option name="region base" value="bfbfc1aa"/>
<Option name="selected region base" value="b591a8ff"/>
<Option name="audio track base" value="c6d3d868"/>
<Option name="audio bus base" value="dbd1ea68"/>
<Option name="midi track base" value="ff8f8f3d"/>
<Option name="midi bus base" value="ff0000ee"/>
<Option name="time-stretch-fill" value="e2b5b596"/>
<Option name="time-stretch-outline" value="63636396"/>
<Option name="automation line" value="44bc59ff"/>
<Option name="processor automation line" value="7aa3f9ff"/>
<Option name="control point fill" value="000000ff"/>
<Option name="control point outline" value="000000ff"/>
<Option name="entered control point outline" value="ff0000ee"/>
<Option name="entered control point selected" value="ff3535ff"/>
<Option name="entered control point" value="000000cc"/>
<Option name="control point selected" value="00ff00ff"/>
<Option name="control point" value="ff0000ff"/>
<Option name="automation track fill" value="a0a0ce68"/>
<Option name="automation track outline" value="282828ff"/>
<Option name="crossfade editor base" value="282d49ff"/>
<Option name="crossfade editor line" value="000000ff"/>
<Option name="selected crossfade editor line" value="00dbdbff"/>
<Option name="crossfade editor line shading" value="00a0d154"/>
<Option name="crossfade editor point fill" value="00ff00ff"/>
<Option name="crossfade editor point outline" value="0000ffff"/>
<Option name="crossfade editor wave" value="ffffff28"/>
<Option name="selected crossfade editor wave" value="f9ea14a0"/>
<Option name="crossfade line" value="000000ff"/>
<Option name="active crossfade" value="e8ed3d77"/>
<Option name="inactive crossfade" value="e8ed3d77"/>
<Option name="location marker" value="c4f411ff"/>
<Option name="location range" value="497a59ff"/>
<Option name="location cd marker" value="1ee8c4ff"/>
<Option name="location loop" value="35964fff"/>
<Option name="location punch" value="7c3a3aff"/>
<Option name="verbose canvas cursor" value="f4f214bc"/>
<Option name="marker label" value="000000ff"/>
<Option name="marker bar separator" value="30303088"/>
<Option name="tempo bar" value="72727fff"/>
<Option name="meterbar" value="666672ff"/>
<Option name="markerbar" value="7f7f8cff"/>
<Option name="rangemarker bar" value="8c8c96ff"/>
<Option name="TransportMarkerBar" value="9898a3ff"/>
<Option name="RangeDragBarRect" value="969696c6"/>
<Option name="RangeDragRect" value="82c696c6"/>
<Option name="TransportDragRect" value="969696c6"/>
<Option name="MarkerDragLine" value="004f00f9"/>
<Option name="TransportLoopRect" value="1e7728f9"/>
<Option name="TransportPunchRect" value="6d2828e5"/>
<Option name="PunchLine" value="a80000ff"/>
<Option name="ZoomRect" value="c6d1b26d"/>
<Option name="RubberBandRect" value="c6c6c659"/>
<Option name="EnteredGainLine" value="dd6363ff"/>
<Option name="EnteredAutomationLine" value="dd6363ff"/>
<Option name="EnteredMarker" value="dd6363ff"/>
<Option name="MeterMarker" value="f2425bff"/>
<Option name="TempoMarker" value="f2425bff"/>
<Option name="MeasureLineBeat" value="72727266"/>
<Option name="MeasureLineBar" value="8c8c988c"/>
<Option name="GhostTrackBase" value="44007c7f"/>
<Option name="GhostTrackWave" value="02fd004c"/>
<Option name="GhostTrackWaveClip" value="ff000000"/>
<Option name="GhostTrackZeroLine" value="e500e566"/>
<Option name="ImageTrack" value="ddddd8ff"/>
<Option name="MarkerTrack" value="ddddd8ff"/>
<Option name="ZeroLine" value="b5b5b5ff"/>
<Option name="GainLine" value="ff00ff00"/>
<Option name="GainLineInactive" value="f0f0ffff"/>
<Option name="RecordingRect" value="e5c6c6ff"/>
<Option name="SelectionRect" value="e8f4d377"/>
<Option name="Selection" value="636363b2"/>
<Option name="VestigialFrame" value="44007c0f"/>
<Option name="TimeAxisFrame" value="44007c0f"/>
<Option name="NameHighlightFill" value="0000ffff"/>
<Option name="NameHighlightOutline" value="7c00ff96"/>
<Option name="FrameHandle" value="7c00ff96"/>
<Option name="TrimHandleLocked" value="ea0f0f28"/>
<Option name="TrimHandle" value="1900ff44"/>
<Option name="EditCursor" value="0000ffff"/>
<Option name="PlayHead" value="ff0000ff"/>
</Canvas>
</Ardour>

File diff suppressed because it is too large Load diff

View file

@ -75,7 +75,7 @@
#include "about.h"
#include "utils.h"
#include "gui_thread.h"
#include "color_manager.h"
#include "theme_manager.h"
#include "engine_dialog.h"
#include "i18n.h"
@ -87,15 +87,16 @@ using namespace Gtk;
using namespace sigc;
ARDOUR_UI *ARDOUR_UI::theArdourUI = 0;
UIConfiguration *ARDOUR_UI::ui_config = 0;
sigc::signal<void,bool> ARDOUR_UI::Blink;
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
sigc::signal<void,nframes_t> ARDOUR_UI::Clock;
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),
secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, false, true),
@ -159,13 +160,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
theArdourUI = this;
}
/* load colors */
color_manager = new ColorManager();
std::string color_file = ARDOUR::find_config_file("ardour.colors");
color_manager->load (color_file);
ui_config = new UIConfiguration();
theme_manager = new ThemeManager();
editor = 0;
mixer = 0;
@ -562,6 +558,7 @@ If you still wish to quit, please use the\n\n\
}
engine->stop (true);
Config->save_state();
ARDOUR_UI::config()->save_state();
quit ();
}
@ -1464,6 +1461,12 @@ ARDOUR_UI::do_engine_start ()
return 0;
}
void
ARDOUR_UI::setup_theme ()
{
theme_manager->setup_theme();
}
gint
ARDOUR_UI::start_engine ()
{

View file

@ -61,6 +61,7 @@
#include "audio_clock.h"
#include "ardour_dialog.h"
#include "editing.h"
#include "ui_config.h"
class AudioClock;
class PublicEditor;
@ -73,7 +74,7 @@ class About;
class AddRouteDialog;
class NewSessionDialog;
class LocationUI;
class ColorManager;
class ThemeManager;
namespace Gtkmm2ext {
class TearOff;
@ -93,10 +94,12 @@ namespace ALSA {
#define FRAME_NAME "BaseFrame"
extern sigc::signal<void> ColorsChanged;
class ARDOUR_UI : public Gtkmm2ext::UI
{
public:
ARDOUR_UI (int *argcp, char **argvp[], string rcfile);
ARDOUR_UI (int *argcp, char **argvp[]);
~ARDOUR_UI();
void show ();
@ -127,7 +130,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
_will_create_new_session_automatically = yn;
}
bool new_session(std::string path = string());
bool new_session(std::string path = string());
gint cmdline_new_session (string path);
int unload_session ();
void close_session();
@ -140,12 +143,13 @@ class ARDOUR_UI : public Gtkmm2ext::UI
static ARDOUR::gain_t slider_position_to_gain (double pos);
static ARDOUR_UI *instance () { return theArdourUI; }
static UIConfiguration *config () { return ui_config; }
PublicEditor& the_editor(){return *editor;}
Mixer_UI* the_mixer() { return mixer; }
void toggle_location_window ();
void toggle_color_manager ();
void toggle_theme_manager ();
void toggle_big_clock_window ();
void toggle_connection_editor ();
void toggle_route_params_window ();
@ -213,6 +217,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void save_keybindings ();
void setup_profile ();
void setup_theme ();
protected:
friend class PublicEditor;
@ -595,7 +600,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
int create_location_ui ();
void handle_locations_change (ARDOUR::Location*);
ColorManager* color_manager;
static UIConfiguration *ui_config;
ThemeManager *theme_manager;
/* Options window */

View file

@ -43,7 +43,7 @@
#include "audio_clock.h"
#include "actions.h"
#include "utils.h"
#include "color_manager.h"
#include "theme_manager.h"
#include "i18n.h"
@ -76,7 +76,7 @@ ARDOUR_UI::setup_windows ()
setup_transport();
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 (transport_frame, false, false);

View file

@ -34,7 +34,7 @@
#include "public_editor.h"
#include "route_params_ui.h"
#include "sfdb_ui.h"
#include "color_manager.h"
#include "theme_manager.h"
#include "i18n.h"
@ -324,17 +324,17 @@ ARDOUR_UI::toggle_location_window ()
}
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) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
if (tact->get_active()) {
color_manager->show_all ();
color_manager->present ();
theme_manager->show_all ();
theme_manager->present ();
} else {
color_manager->hide ();
theme_manager->hide ();
}
}
}

View file

@ -208,7 +208,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));
ActionManager::session_sensitive_actions.push_back (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));
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);

View file

@ -46,9 +46,12 @@
#include "utils.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
#define MUTED_ALPHA 0x50
using namespace sigc;
using namespace ARDOUR;
using namespace PBD;
@ -378,9 +381,9 @@ AudioRegionView::region_muted ()
for (uint32_t n=0; n < waves.size(); ++n) {
if (_region->muted()) {
waves[n]->property_wave_color() = color_map[cMutedWaveForm];
waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
} else {
waves[n]->property_wave_color() = color_map[cWaveForm];
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
}
}
}
@ -669,18 +672,18 @@ AudioRegionView::set_colors ()
RegionView::set_colors();
if (gain_line) {
gain_line->set_line_color (audio_region()->envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]);
gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
}
for (uint32_t n=0; n < waves.size(); ++n) {
if (_region->muted()) {
waves[n]->property_wave_color() = color_map[cMutedWaveForm];
waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
} else {
waves[n]->property_wave_color() = color_map[cWaveForm];
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
}
waves[n]->property_clip_color() = color_map[cWaveFormClip];
waves[n]->property_zero_color() = color_map[cZeroLine];
waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
}
}
@ -818,9 +821,9 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
wave->property_height() = (double) ht;
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = _region->muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm];
wave->property_clip_color() = color_map[cWaveFormClip];
wave->property_zero_color() = color_map[cZeroLine];
wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get();
wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
wave->property_region_start() = _region->start();
wave->property_rectified() = (bool) (_flags & WaveformRectified);
wave->property_logscaled() = (bool) (_flags & WaveformLogScaled);
@ -864,7 +867,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
zero_line = new ArdourCanvas::SimpleLine (*group);
zero_line->property_x1() = (gdouble) 1.0;
zero_line->property_x2() = (gdouble) (_region->length() / samples_per_unit) - 1.0;
zero_line->property_color_rgba() = (guint) color_map[cZeroLine];
zero_line->property_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get();
manage_zero_line ();
}
}
@ -1066,9 +1069,9 @@ AudioRegionView::add_ghost (AutomationTimeAxisView& atv)
wave->property_x() = 0.0;
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = color_map[cGhostTrackWave];
wave->property_clip_color() = color_map[cGhostTrackWaveClip];
wave->property_zero_color() = color_map[cGhostTrackZeroLine];
wave->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get();
wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get();
wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get();
wave->property_region_start() = _region->start();
ghost->waves.push_back(wave);
@ -1121,7 +1124,7 @@ void
AudioRegionView::envelope_active_changed ()
{
if (gain_line) {
gain_line->set_line_color (audio_region()->envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]);
gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
}
}
@ -1148,22 +1151,9 @@ AudioRegionView::set_waveview_data_src()
}
void
AudioRegionView::color_handler (ColorID id, uint32_t val)
AudioRegionView::color_handler ()
{
switch (id) {
case cMutedWaveForm:
case cWaveForm:
case cWaveFormClip:
case cZeroLine:
set_colors ();
break;
case cGainLineInactive:
case cGainLine:
envelope_active_changed();
break;
default:
break;
}
set_colors ();
envelope_active_changed();
}

View file

@ -33,7 +33,6 @@
#include "enums.h"
#include "waveview.h"
#include "canvas.h"
#include "color.h"
namespace ARDOUR {
class AudioRegion;
@ -145,7 +144,7 @@ class AudioRegionView : public RegionView
void reset_width_dependent_items (double pixel_width);
void set_waveview_data_src();
void color_handler (ColorID, uint32_t);
void color_handler ();
vector<GnomeCanvasWaveViewCache*> wave_caches;
vector<ArdourCanvas::WaveView *> waves;

View file

@ -46,7 +46,6 @@
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
#include "color.h"
#include "i18n.h"
@ -62,12 +61,12 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv)
_waveform_shape = Traditional;
if (tv.is_audio_track())
stream_base_color = color_map[cAudioTrackBase];
stream_base_color = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
else
stream_base_color = color_map[cAudioBusBase];
stream_base_color = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->property_outline_color_rgba() = color_map[cAudioTrackOutline];
canvas_rect->property_outline_color_rgba() = RGBA_BLACK;
_amplitude_above_axis = 1.0;
@ -526,12 +525,12 @@ AudioStreamView::setup_rec_box ()
switch (_trackview.audio_track()->mode()) {
case Normal:
xend = xstart;
fill_color = color_map[cRecordingRectFill];
fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
break;
case Destructive:
xend = xstart + 2;
fill_color = color_map[cRecordingRectFill];
fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
/* make the recording rect translucent to allow
the user to see the peak data coming in, etc.
*/
@ -544,7 +543,7 @@ AudioStreamView::setup_rec_box ()
rec_rect->property_y1() = 1.0;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = (double) _trackview.height - 1;
rec_rect->property_outline_color_rgba() = color_map[cRecordingRectOutline];
rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
rec_rect->property_fill_color_rgba() = fill_color;
RecBoxInfo recbox;
@ -767,25 +766,15 @@ AudioStreamView::reveal_xfades_involving (AudioRegionView& rv)
}
void
AudioStreamView::color_handler (ColorID id, uint32_t val)
AudioStreamView::color_handler ()
{
switch (id) {
case cAudioTrackBase:
if (_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = val;
}
break;
case cAudioBusBase:
if (!_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = val;
}
break;
case cAudioTrackOutline:
canvas_rect->property_outline_color_rgba() = val;
break;
default:
break;
if (_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
}
if (!_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
}
}

View file

@ -28,7 +28,6 @@
#include <ardour/location.h>
#include "enums.h"
#include "simplerect.h"
#include "color.h"
#include "streamview.h"
namespace Gdk {
@ -97,7 +96,7 @@ class AudioStreamView : public StreamView
void add_crossfade_weak (boost::weak_ptr<ARDOUR::Crossfade>);
void remove_crossfade (boost::shared_ptr<ARDOUR::Crossfade>);
void color_handler (ColorID id, uint32_t val);
void color_handler ();
double _amplitude_above_axis;

View file

@ -359,7 +359,7 @@ AudioTimeAxisView::add_gain_automation_child ()
*gain_track->canvas_display,
_route->gain_automation_curve());
line->set_line_color (color_map[cAutomationLine]);
line->set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
gain_track->add_line (*line);
@ -439,11 +439,9 @@ AudioTimeAxisView::update_pans ()
(*p)->automation());
if (p == _route->panner().begin()) {
/* first line is a nice orange */
line->set_line_color (color_map[cLeftPanAutomationLine]);
line->set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
} else {
/* second line is a nice blue */
line->set_line_color (color_map[cRightPanAutomationLine]);
line->set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
}
pan_track->add_line (*line);

View file

@ -38,7 +38,6 @@
#include "enums.h"
#include "route_time_axis.h"
#include "canvas.h"
#include "color.h"
namespace ARDOUR {
class Session;

View file

@ -69,8 +69,8 @@ ControlPoint::ControlPoint (AutomationLine& al)
item = new Canvas::SimpleRect (line.canvas_group());
item->property_draw() = true;
item->property_fill() = false;
item->property_fill_color_rgba() = color_map[cControlPointFill];
item->property_outline_color_rgba() = color_map[cControlPointOutline];
item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get();
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
item->property_outline_pixels() = 1;
item->set_data ("control_point", this);
item->signal_event().connect (mem_fun (this, &ControlPoint::event_handler));
@ -97,7 +97,7 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool dummy_arg_to_force_s
item = new Canvas::SimpleRect (line.canvas_group());
item->property_fill() = false;
item->property_outline_color_rgba() = color_map[cEnteredControlPointOutline];
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredControlPointOutline.get();
item->property_outline_pixels() = 1;
/* NOTE: no event handling in copied ControlPoints */
@ -148,10 +148,10 @@ ControlPoint::show_color (bool entered, bool hide_too)
{
if (entered) {
if (selected) {
item->property_outline_color_rgba() = color_map[cEnteredControlPointSelected];
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredControlPointSelected.get();
set_visible(true);
} else {
item->property_outline_color_rgba() = color_map[cEnteredControlPoint];
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredControlPoint.get();
if (hide_too) {
set_visible(false);
}
@ -159,10 +159,10 @@ ControlPoint::show_color (bool entered, bool hide_too)
} else {
if (selected) {
item->property_outline_color_rgba() = color_map[cControlPointSelected];
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get();
set_visible(true);
} else {
item->property_outline_color_rgba() = color_map[cControlPoint];
item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPoint.get();
if (hide_too) {
set_visible(false);
}
@ -1137,7 +1137,7 @@ AutomationLine::set_selected_points (PointSelection& points)
}
void AutomationLine::set_colors() {
set_line_color( color_map[cAutomationLine] );
set_line_color( ARDOUR_UI::config()->canvasvar_AutomationLine.get() );
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->show_color (false, !points_visible);
}

View file

@ -74,11 +74,11 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
base_rect->property_x1() = 0.0;
base_rect->property_y1() = 0.0;
base_rect->property_x2() = editor.frame_to_pixel (max_frames);
base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline];
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackOutline.get();
/* outline ends and bottom */
base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
base_rect->property_fill_color_rgba() = color_map[cAutomationTrackFill];
//base_rect->property_fill_color_rgba() = color_map[cEnteredControlPoint];
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackFill.get();
//base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredControlPoint.get();
base_rect->set_data ("trackview", this);
@ -182,7 +182,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
/* make sure labels etc. are correct */
automation_state_changed ();
ColorChanged.connect (mem_fun (*this, &AutomationTimeAxisView::color_handler));
ColorsChanged.connect (mem_fun (*this, &AutomationTimeAxisView::color_handler));
}
AutomationTimeAxisView::~AutomationTimeAxisView ()
@ -821,24 +821,9 @@ AutomationTimeAxisView::set_colors () {
}
void
AutomationTimeAxisView::color_handler (ColorID id, uint32_t val) {
switch (id) {
case cGhostTrackWave:
case cGhostTrackWaveClip:
case cGhostTrackZeroLine:
case cControlPoint:
case cControlPointFill:
case cControlPointOutline:
case cAutomationLine:
set_colors ();
break;
default:
break;
}
AutomationTimeAxisView::color_handler ()
{
set_colors();
}

View file

@ -142,7 +142,7 @@ class AutomationTimeAxisView : public TimeAxisView {
void exited ();
void set_colors ();
void color_handler (ColorID, uint32_t);
void color_handler ();
static Pango::FontDescription* name_font;
static bool have_name_font;

82
gtk2_ardour/canvas_vars.h Normal file
View file

@ -0,0 +1,82 @@
CANVAS_VARIABLE(canvasvar_WaveForm, "waveform")
CANVAS_VARIABLE(canvasvar_WaveFormClip, "clipped waveform")
CANVAS_VARIABLE(canvasvar_FrameBase, "region base")
CANVAS_VARIABLE(canvasvar_SelectedFrameBase, "selected region base")
CANVAS_VARIABLE(canvasvar_AudioTrackBase, "audio track base")
CANVAS_VARIABLE(canvasvar_AudioBusBase, "audio bus base")
CANVAS_VARIABLE(canvasvar_MidiTrackBase, "midi track base")
CANVAS_VARIABLE(canvasvar_MidiBusBase, "midi bus base")
CANVAS_VARIABLE(canvasvar_TimeStretchFill, "time-stretch-fill")
CANVAS_VARIABLE(canvasvar_TimeStretchOutline, "time-stretch-outline")
CANVAS_VARIABLE(canvasvar_AutomationLine, "automation line")
CANVAS_VARIABLE(canvasvar_RedirectAutomationLine, "processor automation line")
CANVAS_VARIABLE(canvasvar_ControlPointFill, "control point fill")
CANVAS_VARIABLE(canvasvar_ControlPointOutline, "control point outline")
CANVAS_VARIABLE(canvasvar_EnteredControlPointOutline, "entered control point outline")
CANVAS_VARIABLE(canvasvar_EnteredControlPointSelected, "entered control point selected")
CANVAS_VARIABLE(canvasvar_EnteredControlPoint, "entered control point")
CANVAS_VARIABLE(canvasvar_ControlPointSelected, "control point selected")
CANVAS_VARIABLE(canvasvar_ControlPoint, "control point")
CANVAS_VARIABLE(canvasvar_AutomationTrackFill, "automation track fill")
CANVAS_VARIABLE(canvasvar_AutomationTrackOutline, "automation track outline")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorBase, "crossfade editor base")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorLine, "crossfade editor line")
CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorLine, "selected crossfade editor line")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorLineShading, "crossfade editor line shading")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorPointFill, "crossfade editor point fill")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorPointOutline, "crossfade editor point outline")
CANVAS_VARIABLE(canvasvar_CrossfadeEditorWave, "crossfade editor wave")
CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorWave, "selected crossfade editor wave")
CANVAS_VARIABLE(canvasvar_CrossfadeLine, "crossfade line")
CANVAS_VARIABLE(canvasvar_ActiveCrossfade, "active crossfade")
CANVAS_VARIABLE(canvasvar_InactiveCrossfade, "inactive crossfade")
CANVAS_VARIABLE(canvasvar_LocationMarker, "location marker")
CANVAS_VARIABLE(canvasvar_LocationRange, "location range")
CANVAS_VARIABLE(canvasvar_LocationCDMarker, "location cd marker")
CANVAS_VARIABLE(canvasvar_LocationLoop, "location loop")
CANVAS_VARIABLE(canvasvar_LocationPunch, "location punch")
CANVAS_VARIABLE(canvasvar_VerboseCanvasCursor, "verbose canvas cursor")
CANVAS_VARIABLE(canvasvar_MarkerLabel, "marker label")
CANVAS_VARIABLE(canvasvar_MarkerBarSeparator, "marker bar separator")
CANVAS_VARIABLE(canvasvar_TempoBar, "tempo bar")
CANVAS_VARIABLE(canvasvar_MeterBar, "meterbar")
CANVAS_VARIABLE(canvasvar_MarkerBar, "markerbar")
CANVAS_VARIABLE(canvasvar_RangeMarkerBar, "rangemarker bar")
CANVAS_VARIABLE(canvasvar_TransportMarkerBar, "TransportMarkerBar")
CANVAS_VARIABLE(canvasvar_RangeDragBarRect, "RangeDragBarRect")
CANVAS_VARIABLE(canvasvar_RangeDragRect, "RangeDragRect")
CANVAS_VARIABLE(canvasvar_TransportDragRect, "TransportDragRect")
CANVAS_VARIABLE(canvasvar_MarkerDragLine, "MarkerDragLine")
CANVAS_VARIABLE(canvasvar_TransportLoopRect, "TransportLoopRect")
CANVAS_VARIABLE(canvasvar_TransportPunchRect, "TransportPunchRect")
CANVAS_VARIABLE(canvasvar_PunchLine, "PunchLine")
CANVAS_VARIABLE(canvasvar_ZoomRect, "ZoomRect")
CANVAS_VARIABLE(canvasvar_RubberBandRect, "RubberBandRect")
CANVAS_VARIABLE(canvasvar_EnteredGainLine, "EnteredGainLine")
CANVAS_VARIABLE(canvasvar_EnteredAutomationLine, "EnteredAutomationLine")
CANVAS_VARIABLE(canvasvar_EnteredMarker, "EnteredMarker")
CANVAS_VARIABLE(canvasvar_MeterMarker, "MeterMarker")
CANVAS_VARIABLE(canvasvar_TempoMarker, "TempoMarker")
CANVAS_VARIABLE(canvasvar_MeasureLineBeat, "MeasureLineBeat")
CANVAS_VARIABLE(canvasvar_MeasureLineBar, "MeasureLineBar")
CANVAS_VARIABLE(canvasvar_GhostTrackBase, "GhostTrackBase")
CANVAS_VARIABLE(canvasvar_GhostTrackWave, "GhostTrackWave")
CANVAS_VARIABLE(canvasvar_GhostTrackWaveClip, "GhostTrackWaveClip")
CANVAS_VARIABLE(canvasvar_GhostTrackZeroLine, "GhostTrackZeroLine")
CANVAS_VARIABLE(canvasvar_ImageTrack, "ImageTrack")
CANVAS_VARIABLE(canvasvar_MarkerTrack, "MarkerTrack")
CANVAS_VARIABLE(canvasvar_ZeroLine, "ZeroLine")
CANVAS_VARIABLE(canvasvar_GainLine, "GainLine")
CANVAS_VARIABLE(canvasvar_GainLineInactive, "GainLineInactive")
CANVAS_VARIABLE(canvasvar_RecordingRect, "RecordingRect")
CANVAS_VARIABLE(canvasvar_SelectionRect, "SelectionRect")
CANVAS_VARIABLE(canvasvar_Selection, "Selection")
CANVAS_VARIABLE(canvasvar_VestigialFrame, "VestigialFrame")
CANVAS_VARIABLE(canvasvar_TimeAxisFrame, "TimeAxisFrame")
CANVAS_VARIABLE(canvasvar_NameHighlightFill, "NameHighlightFill")
CANVAS_VARIABLE(canvasvar_NameHighlightOutline, "NameHighlightOutline")
CANVAS_VARIABLE(canvasvar_FrameHandle, "FrameHandle")
CANVAS_VARIABLE(canvasvar_TrimHandleLocked, "TrimHandleLocked")
CANVAS_VARIABLE(canvasvar_TrimHandle, "TrimHandle")
CANVAS_VARIABLE(canvasvar_EditCursor, "EditCursor")
CANVAS_VARIABLE(canvasvar_PlayHead, "PlayHead")

View file

@ -1,38 +0,0 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk_ardour_color_h__
#define __gtk_ardour_color_h__
#include <sigc++/signal.h>
#undef COLORID
#define COLORID(a) a,
enum ColorID {
#include "colors.h"
};
#undef COLORID
typedef std::map<ColorID,int> ColorMap;
extern ColorMap color_map;
extern sigc::signal<void> ColorsChanged;
extern sigc::signal<void,ColorID,uint32_t> ColorChanged;
#endif /* __gtk_ardour_color_h__ */

View file

@ -1,223 +0,0 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cmath>
#include <iostream>
#include <fstream>
#include <errno.h>
#include <gtkmm/stock.h>
#include "color_manager.h"
#include "rgb_macros.h"
#include "i18n.h"
using namespace std;
using namespace Gtk;
using namespace PBD;
/* the global color map */
ColorMap color_map;
/* lookup table of color IDs as strings */
#undef COLORID
#define COLORID(s) #s,
static const char *color_id_strs[] = {
#include "colors.h"
};
#undef COLORID
/* global color change signals */
sigc::signal<void> ColorsChanged;
sigc::signal<void,ColorID,uint32_t> ColorChanged;
ColorManager::ColorManager()
: ArdourDialog ("ColorManager")
{
color_list = ListStore::create (columns);
color_display.set_model (color_list);
color_display.append_column (_("Object"), columns.name);
color_display.append_column (_("Color"), columns.color);
color_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
color_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
color_display.set_reorderable (false);
color_display.get_selection()->set_mode (SELECTION_NONE);
color_display.set_headers_visible (true);
CellRenderer* color_cell = color_display.get_column_cell_renderer (1);
TreeViewColumn* color_column = color_display.get_column (1);
color_column->add_attribute (color_cell->property_cell_background_gdk(), columns.gdkcolor);
scroller.add (color_display);
scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
get_vbox()->pack_start (scroller);
color_display.signal_button_press_event().connect (mem_fun (*this, &ColorManager::button_press_event), false);
color_dialog.get_colorsel()->set_has_opacity_control (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_cancel_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
set_size_request (-1, 400);
}
ColorManager::~ColorManager()
{
}
int
ColorManager::load (string path)
{
ifstream in (path.c_str());
if (!in) {
error << string_compose (_("cannot open color definition file %1: %2"), path, strerror(errno)) << endmsg;
return -1;
}
while (in) {
string name;
double r, g, b, a;
in >> name; if (!in) break;
in >> r; if (!in) break;
in >> g; if (!in) break;
in >> b; if (!in) break;
in >> a; if (!in) break;
for (uint32_t i = 0; i < sizeof (color_id_strs)/sizeof(color_id_strs[0]); ++i) {
if (name == color_id_strs[i]) {
/* set color map */
int ir,ig,ib,ia;
int rgba;
ir = (int) floor (r * 255.0);
ig = (int) floor (g * 255.0);
ib = (int) floor (b * 255.0);
ia = (int) floor (a * 255.0);
rgba = RGBA_TO_UINT (ir, ig, ib, ia);
color_map[(ColorID)i] = rgba;
/* set up list entry */
Gdk::Color col;
col.set_rgb_p (r,g,b);
TreeModel::Row row = *(color_list->append());
/* all the color names are prefixed by 'c' to avoid
naming collisions when used as enums. trim
this leading character from the displayed
value.
*/
row[columns.name] = name.substr (1);
row[columns.color] = "";
row[columns.id] = (ColorID) i;
row[columns.gdkcolor] = col;
row[columns.rgba] = rgba;
break;
}
}
}
ColorsChanged(); /* emit signal */
return 0;
}
int
ColorManager::save (string path)
{
return 0;
}
bool
ColorManager::button_press_event (GdkEventButton* ev)
{
TreeIter iter;
TreeModel::Path path;
TreeViewColumn* column;
int cellx;
int celly;
if (!color_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
return false;
}
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
case 0:
/* allow normal processing to occur */
return false;
case 1: /* color */
if ((iter = color_list->get_iter (path))) {
ColorID edit_color_id = (*iter)[columns.id];
int r,g, b, a;
uint32_t rgba;
Gdk::Color color;
ResponseType result = (ResponseType) color_dialog.run();
switch (result) {
case RESPONSE_CANCEL:
break;
case RESPONSE_ACCEPT:
color = color_dialog.get_colorsel()->get_current_color();
a = color_dialog.get_colorsel()->get_current_alpha();
r = (int) floor (color.get_red_p() * 255.0);
g = (int) floor (color.get_green_p() * 255.0);
b = (int) floor (color.get_blue_p() * 255.0);
rgba = RGBA_TO_UINT(r,g,b,a);
(*iter)[columns.rgba] = rgba;
(*iter)[columns.gdkcolor] = color;
color_map[edit_color_id] = rgba;
ColorChanged (edit_color_id, rgba);
break;
default:
break;
}
color_dialog.hide ();
}
return true;
default:
break;
}
return false;
}

View file

@ -1,128 +0,0 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* no guard clauses here */
COLORID(cWaveForm)
COLORID(cWaveFormClip)
COLORID(cMutedWaveForm)
COLORID(cSelectedFrameBase)
COLORID(cFrameBase)
COLORID(cAudioTrackBase)
COLORID(cAudioTrackOutline)
COLORID(cAudioBusBase)
COLORID(cTimeStretchFill)
COLORID(cTimeStretchOutline)
COLORID(cAutomationLine)
COLORID(cLeftPanAutomationLine)
COLORID(cRightPanAutomationLine)
COLORID(cRedirectAutomationLine)
COLORID(cControlPointFill)
COLORID(cControlPointOutline)
COLORID(cEnteredControlPointOutline)
COLORID(cEnteredControlPointSelected)
COLORID(cEnteredControlPoint)
COLORID(cControlPointSelected)
COLORID(cControlPoint)
COLORID(cAutomationTrackFill)
COLORID(cAutomationTrackOutline)
COLORID(cCrossfadeEditorBase)
COLORID(cCrossfadeEditorLine)
COLORID(cSelectedCrossfadeEditorLine)
COLORID(cCrossfadeEditorLineShading)
COLORID(cCrossfadeEditorPointFill)
COLORID(cCrossfadeEditorPointOutline)
COLORID(cCrossfadeEditorWave)
COLORID(cSelectedCrossfadeEditorWave)
COLORID(cCrossfadeLine)
COLORID(cActiveCrossfade)
COLORID(cInactiveCrossfade)
COLORID(cLocationMarker)
COLORID(cLocationRange)
COLORID(cLocationCDMarker)
COLORID(cLocationLoop)
COLORID(cLocationPunch)
COLORID(cVerboseCanvasCursor)
COLORID(cTempoBar)
COLORID(cMeterBar)
COLORID(cMarkerBar)
COLORID(cRangeMarkerBar)
COLORID(cTransportMarkerBar)
COLORID(cRangeDragBarRect)
COLORID(cRangeDragBarRectFill)
COLORID(cRangeDragRect)
COLORID(cRangeDragRectFill)
COLORID(cTransportDragRect)
COLORID(cTransportDragRectFill)
COLORID(cMarkerDragLine)
COLORID(cTransportLoopRect)
COLORID(cTransportLoopRectFill)
COLORID(cTransportPunchRect)
COLORID(cTransportPunchRectFill)
COLORID(cPunchInLine)
COLORID(cPunchOutLine)
COLORID(cZoomRect)
COLORID(cZoomRectFill)
COLORID(cRubberBandRect)
COLORID(cRubberBandRectFill)
COLORID(cFirstActionMessage)
COLORID(cEnteredGainLine)
COLORID(cEnteredAutomationLine)
COLORID(cEnteredMarker)
COLORID(cMeterMarker)
COLORID(cTempoMarker)
COLORID(cMeasureLineBeat)
COLORID(cMeasureLineBar)
COLORID(cGhostTrackBaseOutline)
COLORID(cGhostTrackBaseFill)
COLORID(cGhostTrackWave)
COLORID(cGhostTrackWaveClip)
COLORID(cGhostTrackZeroLine)
COLORID(cImageTrackBase)
COLORID(cImageTrackOutline)
COLORID(cMarkerTrackBase)
COLORID(cMarkerTrackOutline)
COLORID(cZeroLine)
COLORID(cGainLine)
COLORID(cGainLineInactive)
COLORID(cRecordingRectFill)
COLORID(cRecordingRectOutline)
COLORID(cSelectionRectFill)
COLORID(cSelectionRectOutline)
COLORID(cSelectionEndFill)
COLORID(cSelectionEndOutline)
COLORID(cSelectionStartFill)
COLORID(cSelectionStartOutline)
COLORID(cVestigialFrameFill)
COLORID(cVestigialFrameOutline)
COLORID(cTimeAxisFrameFill)
COLORID(cTimeAxisFrameOutline)
COLORID(cNameHighlightFill)
COLORID(cNameHighlightOutline)
COLORID(cFrameHandleStartFill)
COLORID(cFrameHandleStartOutline)
COLORID(cFrameHandleEndFill)
COLORID(cFrameHandleEndOutline)
COLORID(cTrimHandleLockedStart)
COLORID(cTrimHandleLockedEnd)
COLORID(cTrimHandleStart)
COLORID(cTrimHandleEnd)
COLORID(cEditCursor)
COLORID(cPlayHead)

View file

@ -48,7 +48,6 @@
#include "canvas_impl.h"
#include "simplerect.h"
#include "waveview.h"
#include "color.h"
using namespace std;
using namespace ARDOUR;
@ -129,23 +128,23 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d
toplevel->property_x2() = 10.0;
toplevel->property_y2() = 10.0;
toplevel->property_fill() = true;
toplevel->property_fill_color_rgba() = color_map[cCrossfadeEditorBase];
toplevel->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorBase.get();
toplevel->property_outline_pixels() = 0;
toplevel->signal_event().connect (mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line = new ArdourCanvas::Line (*(canvas->root()));
fade[Out].line->property_width_pixels() = 1;
fade[Out].line->property_fill_color_rgba() = color_map[cCrossfadeEditorLine];
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[Out].shading->property_fill_color_rgba() = color_map[cCrossfadeEditorLineShading];
fade[Out].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[In].line = new ArdourCanvas::Line (*(canvas->root()));
fade[In].line->property_width_pixels() = 1;
fade[In].line->property_fill_color_rgba() = color_map[cCrossfadeEditorLine];
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[In].shading->property_fill_color_rgba() = color_map[cCrossfadeEditorLineShading];
fade[In].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[In].shading->signal_event().connect (mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[In].line->signal_event().connect (mem_fun (*this, &CrossfadeEditor::curve_event));
@ -454,8 +453,8 @@ CrossfadeEditor::make_point ()
p->box = new ArdourCanvas::SimpleRect (*(canvas->root()));
p->box->property_fill() = true;
p->box->property_fill_color_rgba() = color_map[cCrossfadeEditorPointFill];
p->box->property_outline_color_rgba() = color_map[cCrossfadeEditorPointOutline];
p->box->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointFill.get();
p->box->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointOutline.get();
p->box->property_outline_pixels() = 1;
p->curve = fade[current].line;
@ -976,15 +975,15 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
if (wf == In) {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = color_map[cSelectedCrossfadeEditorWave];
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = color_map[cCrossfadeEditorWave];
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
}
fade[In].line->property_fill_color_rgba() = color_map[cSelectedCrossfadeEditorLine];
fade[Out].line->property_fill_color_rgba() = color_map[cCrossfadeEditorLine];
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].shading->hide();
fade[In].shading->show();
@ -999,15 +998,15 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
} else {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = color_map[cCrossfadeEditorWave];
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = color_map[cSelectedCrossfadeEditorWave];
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
}
fade[Out].line->property_fill_color_rgba() = color_map[cSelectedCrossfadeEditorLine];
fade[In].line->property_fill_color_rgba() = color_map[cCrossfadeEditorLine];
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].shading->hide();
fade[Out].shading->show();
@ -1049,9 +1048,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
double spu;
if (which == In) {
color = color_map[cSelectedCrossfadeEditorWave];
color = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
} else {
color = color_map[cCrossfadeEditorWave];
color = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
}
ht = canvas->get_allocation().get_height() / (double) nchans;

View file

@ -31,6 +31,7 @@
#include "audio_region_view.h"
#include "utils.h"
#include "canvas_impl.h"
#include "ardour_ui.h"
using namespace sigc;
using namespace ARDOUR;
@ -61,11 +62,11 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
_visible = true;
fade_in = new Line (*group);
fade_in->property_fill_color_rgba() = color_map[cCrossfadeLine];
fade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get();
fade_in->property_width_pixels() = 1;
fade_out = new Line (*group);
fade_out->property_fill_color_rgba() = color_map[cCrossfadeLine];
fade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get();
fade_out->property_width_pixels() = 1;
set_height (get_time_axis_view().height);
@ -84,6 +85,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
crossfade_changed (Change (~0));
crossfade->StateChanged.connect (mem_fun(*this, &CrossfadeView::crossfade_changed));
ColorsChanged.connect (mem_fun (*this, &CrossfadeView::color_handler));
}
CrossfadeView::~CrossfadeView ()
@ -217,14 +219,20 @@ void
CrossfadeView::active_changed ()
{
if (crossfade->active()) {
frame->property_fill_color_rgba() = color_map[cActiveCrossfade];
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
} else {
frame->property_fill_color_rgba() = color_map[cInactiveCrossfade];
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_InactiveCrossfade.get();
}
redraw_curves ();
}
void
CrossfadeView::color_handler ()
{
active_changed ();
}
void
CrossfadeView::set_valid (bool yn)
{

View file

@ -77,6 +77,7 @@ struct CrossfadeView : public TimeAxisViewItem
void crossfade_changed (ARDOUR::Change);
void active_changed ();
void redraw_curves ();
void color_handler ();
};
#endif /* __gtk_ardour_crossfade_view_h__ */

View file

@ -311,11 +311,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 = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
range_marker_drag_rect = 0;
marker_drag_line = 0;
@ -1649,7 +1649,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
region_mute_item->set_active();
fooc.block (false);
}
items.push_back (CheckMenuElem (_("Opaque")));
region_opaque_item = static_cast<CheckMenuItem*>(&items.back());
fooc = region_opaque_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_opaque));
@ -1658,7 +1658,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
region_opaque_item->set_active();
fooc.block (false);
}
items.push_back (CheckMenuElem (_("Original position"), mem_fun(*this, &Editor::naturalize)));
if (region->at_natural_position()) {
items.back().set_sensitive (false);

View file

@ -1851,6 +1851,7 @@ class Editor : public PublicEditor
Glib::RefPtr<Gtk::Action> redo_action;
void history_changed ();
void color_handler ();
};
#endif /* __ardour_editor_h__ */

View file

@ -126,7 +126,6 @@ Editor::initialize_canvas ()
verbose_canvas_cursor = new ArdourCanvas::Text (*track_canvas.root());
verbose_canvas_cursor->property_font_desc() = *font;
verbose_canvas_cursor->property_anchor() = ANCHOR_NW;
verbose_canvas_cursor->property_fill_color_rgba() = color_map[cVerboseCanvasCursor];
delete font;
@ -150,34 +149,25 @@ Editor::initialize_canvas ()
transport_marker_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height * 4.0);
tempo_bar = new ArdourCanvas::SimpleRect (*tempo_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
tempo_bar->property_fill_color_rgba() = color_map[cTempoBar];
tempo_bar->property_outline_pixels() = 0;
meter_bar = new ArdourCanvas::SimpleRect (*meter_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
meter_bar->property_fill_color_rgba() = color_map[cMeterBar];
meter_bar->property_outline_pixels() = 0;
marker_bar = new ArdourCanvas::SimpleRect (*marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
marker_bar->property_fill_color_rgba() = color_map[cMarkerBar];
marker_bar->property_outline_pixels() = 0;
range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
range_marker_bar->property_fill_color_rgba() = color_map[cRangeMarkerBar];
range_marker_bar->property_outline_pixels() = 0;
transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
transport_marker_bar->property_fill_color_rgba() = color_map[cTransportMarkerBar];
transport_marker_bar->property_outline_pixels() = 0;
range_bar_drag_rect = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
range_bar_drag_rect->property_fill_color_rgba() = color_map[cRangeDragBarRectFill];
range_bar_drag_rect->property_outline_color_rgba() = color_map[cRangeDragBarRect];
range_bar_drag_rect->property_outline_pixels() = 0;
range_bar_drag_rect->hide ();
transport_bar_drag_rect = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0);
transport_bar_drag_rect ->property_fill_color_rgba() = color_map[cTransportDragRectFill];
transport_bar_drag_rect->property_outline_color_rgba() = color_map[cTransportDragRect];
transport_bar_drag_rect->property_outline_pixels() = 0;
transport_bar_drag_rect->hide ();
@ -186,24 +176,17 @@ Editor::initialize_canvas ()
marker_drag_line = new ArdourCanvas::Line (*track_canvas.root());
marker_drag_line->property_width_pixels() = 1;
marker_drag_line->property_fill_color_rgba() = color_map[cMarkerDragLine];
marker_drag_line->property_points() = marker_drag_line_points;
marker_drag_line->hide();
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0);
range_marker_drag_rect->property_fill_color_rgba() = color_map[cRangeDragRectFill];
range_marker_drag_rect->property_outline_color_rgba() = color_map[cRangeDragRect];
range_marker_drag_rect->hide ();
transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0);
transport_loop_range_rect->property_fill_color_rgba() = color_map[cTransportLoopRectFill];
transport_loop_range_rect->property_outline_color_rgba() = color_map[cTransportLoopRect];
transport_loop_range_rect->property_outline_pixels() = 1;
transport_loop_range_rect->hide();
transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0);
transport_punch_range_rect->property_fill_color_rgba() = color_map[cTransportPunchRectFill];
transport_punch_range_rect->property_outline_color_rgba() = color_map[cTransportPunchRect];
transport_punch_range_rect->property_outline_pixels() = 0;
transport_punch_range_rect->hide();
@ -214,7 +197,6 @@ Editor::initialize_canvas ()
transport_punchin_line->property_y1() = 0.0;
transport_punchin_line->property_x2() = 0.0;
transport_punchin_line->property_y2() = 0.0;
transport_punchin_line->property_color_rgba() = color_map[cPunchInLine];
transport_punchin_line->hide ();
transport_punchout_line = new ArdourCanvas::SimpleLine (*time_line_group);
@ -222,13 +204,10 @@ Editor::initialize_canvas ()
transport_punchout_line->property_y1() = 0.0;
transport_punchout_line->property_x2() = 0.0;
transport_punchout_line->property_y2() = 0.0;
transport_punchout_line->property_color_rgba() = color_map[cPunchOutLine];
transport_punchout_line->hide();
// used to show zoom mode active zooming
zoom_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0);
zoom_rect->property_fill_color_rgba() = color_map[cZoomRectFill];
zoom_rect->property_outline_color_rgba() = color_map[cZoomRect];
zoom_rect->property_outline_pixels() = 1;
zoom_rect->hide();
@ -236,8 +215,6 @@ Editor::initialize_canvas ()
// used as rubberband rect
rubberband_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0);
rubberband_rect->property_outline_color_rgba() = color_map[cRubberBandRect];
rubberband_rect->property_fill_color_rgba() = (guint32) color_map[cRubberBandRectFill];
rubberband_rect->property_outline_pixels() = 1;
rubberband_rect->hide();
@ -247,48 +224,22 @@ Editor::initialize_canvas ()
range_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
transport_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
/* separator lines */
tempo_line = new ArdourCanvas::SimpleLine (*tempo_group, 0, timebar_height, max_canvas_coordinate, timebar_height);
tempo_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255);
meter_line = new ArdourCanvas::SimpleLine (*meter_group, 0, timebar_height, max_canvas_coordinate, timebar_height);
meter_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255);
marker_line = new ArdourCanvas::SimpleLine (*marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height);
marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255);
range_marker_line = new ArdourCanvas::SimpleLine (*range_marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height);
range_marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255);
transport_marker_line = new ArdourCanvas::SimpleLine (*transport_marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height);
transport_marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255);
ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_loop_range_view), false));
ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_punch_range_view), false));
double time_height = timebar_height * 5;
double time_width = FLT_MAX/frames_per_unit;
time_canvas.set_scroll_region(0.0, 0.0, time_width, time_height);
if (!color_map[cEditCursor]) {
warning << _("edit cursor color not defined, check your ardour.colors file!") << endmsg;
color_map[cEditCursor] = RGBA_TO_UINT (30,30,30,255);
}
if (!color_map[cPlayHead]) {
warning << _("playhead color not defined, check your ardour.colors file!") << endmsg;
color_map[cPlayHead] = RGBA_TO_UINT (0,0,0,255);
}
edit_cursor = new Cursor (*this, &Editor::canvas_edit_cursor_event);
edit_cursor->canvas_item.property_fill_color_rgba() = color_map[cEditCursor];
playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event);
playhead_cursor->canvas_item.property_fill_color_rgba() = color_map[cPlayHead];
initial_ruler_update_required = true;
track_canvas.signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate));
ColorsChanged.connect (mem_fun (*this, &Editor::color_handler));
color_handler();
}
void
@ -734,3 +685,65 @@ Editor::canvas_horizontally_scrolled ()
redisplay_tempo (!_dragging_hscrollbar);
}
void
Editor::color_handler()
{
edit_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditCursor.get();
playhead_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_PlayHead.get();
verbose_canvas_cursor->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get();
meter_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MeterBar.get();
meter_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
tempo_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TempoBar.get();
tempo_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBar.get();
marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
range_marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeMarkerBar.get();
range_marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
transport_marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportMarkerBar.get();
transport_marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
range_bar_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
range_bar_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
transport_bar_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportDragRect.get();
transport_bar_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportDragRect.get();
marker_drag_line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerDragLine.get();
range_marker_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragRect.get();
range_marker_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragRect.get();
transport_loop_range_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportLoopRect.get();
transport_loop_range_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportLoopRect.get();
transport_punch_range_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportPunchRect.get();
transport_punch_range_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportPunchRect.get();
transport_punchin_line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_PunchLine.get();
transport_punchout_line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_PunchLine.get();
zoom_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ZoomRect.get();
zoom_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ZoomRect.get();
rubberband_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RubberBandRect.get();
rubberband_rect->property_fill_color_rgba() = (guint32) ARDOUR_UI::config()->canvasvar_RubberBandRect.get();
location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
refresh_location_display ();
redisplay_tempo (true);
if (session)
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
}

View file

@ -1130,7 +1130,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (mouse_mode == MouseGain) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
line->property_fill_color_rgba() = color_map[cEnteredGainLine];
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredGainLine.get();
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
}
@ -1144,7 +1144,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
line->property_fill_color_rgba() = color_map[cEnteredAutomationLine];
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get();
}
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
@ -1230,7 +1230,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
break;
}
marker->set_color_rgba (color_map[cEnteredMarker]);
marker->set_color_rgba (ARDOUR_UI::config()->canvasvar_EnteredMarker.get());
// fall through
case MeterMarkerItem:
case TempoMarkerItem:
@ -2217,7 +2217,7 @@ Editor::start_meter_marker_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof(name), "%g/%g", meter_marker->meter().beats_per_bar(), meter_marker->meter().note_divisor ());
MeterMarker* new_marker = new MeterMarker(*this, *meter_group, color_map[cMeterMarker], name,
MeterMarker* new_marker = new MeterMarker(*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), name,
*new MeterSection(meter_marker->meter()));
drag_info.item = &new_marker->the_item();
@ -2348,7 +2348,7 @@ Editor::start_tempo_marker_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof (name), "%.2f", tempo_marker->tempo().beats_per_minute());
TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, color_map[cTempoMarker], name,
TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), name,
*new TempoSection(tempo_marker->tempo()));
drag_info.item = &new_marker->the_item();
@ -3198,7 +3198,6 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
rv->get_canvas_group()->raise_to_top();
rv->get_time_axis_view().canvas_display->raise_to_top();
cursor_group->raise_to_top();
rv->fake_set_opaque (true);
}
@ -4050,7 +4049,7 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
begin_reversible_command (trim_type);
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
(*i)->fake_set_opaque(false);
(*i)->fake_set_opaque(false);
(*i)->region()->freeze ();
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);

View file

@ -42,7 +42,7 @@
#include "tempo_dialog.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "color.h"
#include "ardour_ui.h"
#include "time_axis_view.h"
#include "i18n.h"
@ -80,11 +80,11 @@ Editor::draw_metric_marks (const Metrics& metrics)
if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ());
metric_marks.push_back (new MeterMarker (*this, *meter_group, color_map[cMeterMarker], buf,
metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), buf,
*(const_cast<MeterSection*>(ms))));
} else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) {
snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute());
metric_marks.push_back (new TempoMarker (*this, *tempo_group, color_map[cTempoMarker], buf,
metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), buf,
*(const_cast<TempoSection*>(ts))));
}
@ -249,9 +249,9 @@ Editor::draw_measures ()
case TempoMap::Beat:
if ((*i).beat == 1) {
color = color_map[cMeasureLineBar];
color = ARDOUR_UI::config()->canvasvar_MeasureLineBar.get();
} else {
color = color_map[cMeasureLineBeat];
color = ARDOUR_UI::config()->canvasvar_MeasureLineBeat.get();
if (beat_density > 2.0) {
/* only draw beat lines if the gaps between beats are large.

View file

@ -83,6 +83,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
ignore_toggle = false;
meter_menu = 0;
next_release_selects = false;
style_changed = true;
gain_slider = manage (new VSliderController (slider,
&gain_adjustment,
@ -202,6 +203,8 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
ResetAllPeakDisplays.connect (mem_fun(*this, &GainMeter::reset_peak_display));
ResetGroupPeakDisplays.connect (mem_fun(*this, &GainMeter::reset_group_peak_display));
UI::instance()->theme_changed.connect (mem_fun(*this, &GainMeter::on_theme_changed));
}
void
@ -264,9 +267,14 @@ GainMeter::render_metrics (Gtk::Widget& w)
gint
GainMeter::meter_metrics_expose (GdkEventExpose *ev)
{
static Glib::RefPtr<Gtk::Style> meter_style;
if (style_changed) {
meter_style = meter_metric_area.get_style();
}
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> bg_gc (meter_metric_area.get_style()->get_bg_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_style->get_fg_gc (Gtk::STATE_NORMAL));
GdkRectangle base_rect;
GdkRectangle draw_rect;
gint width, height;
@ -281,7 +289,7 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev)
Glib::RefPtr<Gdk::Pixmap> pixmap;
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);
} else {
pixmap = i->second;
@ -289,11 +297,18 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev)
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_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);
style_changed = false;
return true;
}
void
GainMeter::on_theme_changed()
{
style_changed = true;
}
GainMeter::~GainMeter ()
{
if (meter_menu) {

View file

@ -185,6 +185,9 @@ class GainMeter : public Gtk::VBox
static Glib::RefPtr<Gdk::Pixbuf> slider;
static Glib::RefPtr<Gdk::Pixbuf> rail;
static int setup_slider_pix ();
void on_theme_changed ();
bool style_changed;
};
#endif /* __ardour_gtk_gain_meter_h__ */

View file

@ -22,6 +22,7 @@
#include "ghostregion.h"
#include "automation_time_axis.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
using namespace Editing;
using namespace ArdourCanvas;
@ -43,8 +44,8 @@ GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos)
base_rect->property_y1() = (double) 0.0;
base_rect->property_y2() = (double) trackview.height;
base_rect->property_outline_what() = (guint32) 0;
base_rect->property_outline_color_rgba() = color_map[cGhostTrackBaseOutline];
base_rect->property_fill_color_rgba() = color_map[cGhostTrackBaseFill];
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
group->lower_to_bottom ();
atv.add_ghost (this);
@ -91,10 +92,13 @@ GhostRegion::set_height ()
void
GhostRegion::set_colors ()
{
for (uint32_t n=0; n < waves.size(); ++n) {
waves[n]->property_wave_color() = color_map[cGhostTrackWave];
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
waves[n]->property_clip_color() = color_map[cGhostTrackWaveClip];
waves[n]->property_zero_color() = color_map[cGhostTrackZeroLine];
for (uint32_t n=0; n < waves.size(); ++n) {
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get();
waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get();
waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get();
}
}

View file

@ -32,6 +32,7 @@
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
@ -52,9 +53,9 @@ ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv)
canvas_rect (canvas_group, 0.0, 0.0, 1000000.0, tv.height)
{
region_color = _trackview.color() ;
stream_base_color = color_map[cImageTrackBase] ;
stream_base_color = ARDOUR_UI::config()->canvasvar_ImageTrack.get() ;
canvas_rect.property_outline_color_rgba() = color_map[cImageTrackOutline];
canvas_rect.property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ImageTrack.get();
canvas_rect.property_fill_color_rgba() = stream_base_color;
canvas_rect.signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_imageframe_view_event), (ArdourCanvas::Item*) &canvas_rect, &tv));

View file

@ -57,29 +57,6 @@ extern int curvetest (string);
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
show_ui_callback (void *arg)
{
@ -252,7 +229,7 @@ int main (int argc, char *argv[])
PBD::ID::init ();
try {
ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
ui = new ARDOUR_UI (&argc, &argv);
} catch (failed_constructor& err) {
error << _("could not create ARDOUR GUI") << endmsg;
exit (1);

View file

@ -24,6 +24,7 @@
#include "public_editor.h"
#include "utils.h"
#include "canvas_impl.h"
#include "ardour_ui.h"
#include "i18n.h"
@ -255,7 +256,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
}
text->property_y() = 0.0;
text->property_anchor() = Gtk::ANCHOR_NW;
text->property_fill_color() = "black";
text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerLabel.get();
editor.ZoomChanged.connect (mem_fun (*this, &Marker::reposition));

View file

@ -31,6 +31,7 @@
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
@ -49,7 +50,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
: _trackview (tv)
{
region_color = _trackview.color();
stream_base_color = color_map[cMarkerTrackBase];
stream_base_color = ARDOUR_UI::config()->canvasvar_MarkerTrack.get();
canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
@ -58,7 +59,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
canvas_rect->property_y1() = 0.0;
canvas_rect->property_x2() = max_frames;
canvas_rect->property_y2() = (double)20;
canvas_rect->property_outline_color_rgba() = color_map[cMarkerTrackOutline];
canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get();
canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));

View file

@ -44,6 +44,7 @@
#include "utils.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
@ -150,7 +151,7 @@ RegionView::init (Gdk::Color& basic_color, bool wfd)
set_colors ();
ColorChanged.connect (mem_fun (*this, &RegionView::color_handler));
ColorsChanged.connect (mem_fun (*this, &RegionView::color_handler));
/* XXX sync mark drag? */
}
@ -371,7 +372,7 @@ RegionView::set_frame_color ()
if (_region->opaque()) {
fill_opacity = 130;
} else {
fill_opacity = 60;
fill_opacity = 0;
}
TimeAxisViewItem::set_frame_color ();
@ -383,7 +384,7 @@ RegionView::fake_set_opaque (bool yn)
if (yn) {
fill_opacity = 130;
} else {
fill_opacity = 60;
fill_opacity = 0;
}
TimeAxisViewItem::set_frame_color ();

View file

@ -31,7 +31,6 @@
#include "enums.h"
#include "waveview.h"
#include "canvas.h"
#include "color.h"
class TimeAxisView;
class RegionEditor;
@ -73,7 +72,7 @@ class RegionView : public TimeAxisViewItem
bool set_position(nframes_t pos, void* src, double* delta = 0);
void fake_set_opaque (bool yn);
virtual void show_region_editor () = 0;
virtual void hide_region_editor();
@ -106,7 +105,7 @@ class RegionView : public TimeAxisViewItem
void region_moved (void *);
virtual void region_muted ();
void region_locked ();
void region_opacity ();
void region_opacity ();
void region_layered ();
void region_renamed ();
void region_sync_changed ();
@ -119,7 +118,7 @@ class RegionView : public TimeAxisViewItem
virtual void set_frame_color ();
virtual void reset_width_dependent_items (double pixel_width);
virtual void color_handler (ColorID, uint32_t) {}
virtual void color_handler () {}
boost::shared_ptr<ARDOUR::Region> _region;

View file

@ -193,7 +193,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
}
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
ColorChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
}
RouteTimeAxisView::~RouteTimeAxisView ()
@ -594,8 +594,8 @@ RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end)
timestretch_rect->property_y1() = 0.0;
timestretch_rect->property_x2() = 0.0;
timestretch_rect->property_y2() = 0.0;
timestretch_rect->property_fill_color_rgba() = color_map[cTimeStretchFill];
timestretch_rect->property_outline_color_rgba() = color_map[cTimeStretchOutline];
timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
}
timestretch_rect->show ();
@ -1359,17 +1359,14 @@ RouteTimeAxisView::map_frozen ()
}
void
RouteTimeAxisView::color_handler (ColorID id, uint32_t val)
RouteTimeAxisView::color_handler ()
{
switch (id) {
case cTimeStretchOutline:
timestretch_rect->property_outline_color_rgba() = val;
break;
case cTimeStretchFill:
timestretch_rect->property_fill_color_rgba() = val;
break;
default:
break;
if (timestretch_rect) {
timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
}
if (timestretch_rect) {
timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
}
}
@ -1541,7 +1538,7 @@ RouteTimeAxisView::add_redirect_automation_curve (boost::shared_ptr<Redirect> re
*redirect, what, _session, *ran->view,
*ran->view->canvas_display, redirect->automation_list (what));
ral->set_line_color (color_map[cRedirectAutomationLine]);
ral->set_line_color (ARDOUR_UI::config()->canvasvar_RedirectAutomationLine.get());
ral->queue_reset ();
ran->view->add_line (*ral);

View file

@ -38,7 +38,6 @@
#include "enums.h"
#include "time_axis_view.h"
#include "canvas.h"
#include "color.h"
namespace ARDOUR {
class Session;
@ -199,7 +198,7 @@ protected:
void map_frozen ();
void color_handler (ColorID, uint32_t);
void color_handler ();
void region_view_added (RegionView*);
void add_ghost_to_redirect (RegionView*, AutomationTimeAxisView*);

View file

@ -40,7 +40,6 @@
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
#include "color.h"
using namespace ARDOUR;
using namespace PBD;
@ -77,7 +76,7 @@ StreamView::StreamView (RouteTimeAxisView& tv)
_trackview.session().RecordStateChanged.connect (mem_fun (*this, &StreamView::sess_rec_enable_changed));
}
ColorChanged.connect (mem_fun (*this, &StreamView::color_handler));
ColorsChanged.connect (mem_fun (*this, &StreamView::color_handler));
}
StreamView::~StreamView ()

View file

@ -27,7 +27,6 @@
#include "enums.h"
#include "simplerect.h"
#include "canvas.h"
#include "color.h"
namespace Gdk {
class Color;
@ -120,7 +119,7 @@ protected:
virtual void playlist_changed (boost::weak_ptr<ARDOUR::Diskstream>);
virtual void playlist_modified ();
virtual void color_handler (ColorID, uint32_t) = 0;
virtual void color_handler () = 0;
RouteTimeAxisView& _trackview;

View file

@ -0,0 +1,248 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cmath>
#include <iostream>
#include <fstream>
#include <errno.h>
#include <gtkmm/stock.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm/settings.h>
#include "theme_manager.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "i18n.h"
using namespace std;
using namespace Gtk;
using namespace PBD;
using namespace ARDOUR;
sigc::signal<void> ColorsChanged;
sigc::signal<void,uint32_t> ColorChanged;
ThemeManager::ThemeManager()
: ArdourDialog ("ThemeManager"),
dark_button ("Dark Theme"),
light_button ("Light Theme")
{
color_list = ListStore::create (columns);
color_display.set_model (color_list);
color_display.append_column (_("Object"), columns.name);
color_display.append_column (_("Color"), columns.color);
color_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
color_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
color_display.set_reorderable (false);
color_display.get_selection()->set_mode (SELECTION_NONE);
color_display.set_headers_visible (true);
CellRenderer* color_cell = color_display.get_column_cell_renderer (1);
TreeViewColumn* color_column = color_display.get_column (1);
color_column->add_attribute (color_cell->property_cell_background_gdk(), columns.gdkcolor);
scroller.add (color_display);
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);
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_palette (true);
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));
dark_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled));
light_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_light_theme_button_toggled));
set_size_request (-1, 400);
setup_theme ();
}
ThemeManager::~ThemeManager()
{
}
int
ThemeManager::save (string path)
{
return 0;
}
bool
ThemeManager::button_press_event (GdkEventButton* ev)
{
TreeIter iter;
TreeModel::Path path;
TreeViewColumn* column;
int cellx;
int celly;
UIConfigVariable<uint32_t> *ccvar;
if (!color_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
return false;
}
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
case 0:
/* allow normal processing to occur */
return false;
case 1: /* color */
if ((iter = color_list->get_iter (path))) {
int r,g, b, a;
uint32_t rgba = (*iter)[columns.rgba];
Gdk::Color color;
UINT_TO_RGBA (rgba, &r, &g, &b, &a);
color.set_rgb_p (r / 255.0, g / 255.0, b / 255.0);
color_dialog.get_colorsel()->set_previous_color (color);
color_dialog.get_colorsel()->set_current_color (color);
color_dialog.get_colorsel()->set_previous_alpha (a * 256);
color_dialog.get_colorsel()->set_current_alpha (a * 256);
ResponseType result = (ResponseType) color_dialog.run();
switch (result) {
case RESPONSE_CANCEL:
break;
case RESPONSE_ACCEPT:
color = color_dialog.get_colorsel()->get_current_color();
a = color_dialog.get_colorsel()->get_current_alpha();
r = (int) floor (color.get_red_p() * 255.0);
g = (int) floor (color.get_green_p() * 255.0);
b = (int) floor (color.get_blue_p() * 255.0);
rgba = RGBA_TO_UINT(r,g,b,a>>8);
//cerr << (*iter)[columns.name] << " == " << hex << rgba << endl;
//cerr << "a = " << a << endl;
(*iter)[columns.rgba] = rgba;
(*iter)[columns.gdkcolor] = color;
ccvar = (*iter)[columns.pVar];
ccvar->set(rgba);
//ColorChanged (rgba);
ColorsChanged();//EMIT SIGNAL
break;
default:
break;
}
color_dialog.hide ();
}
return true;
default:
break;
}
return false;
}
void
load_rc_file (const string& filename, bool themechange)
{
std::string rcfile = find_config_file(filename);
if(!rcfile.length())
{
warning << string_compose(_("Unable to find UI style file %1. Ardour will look strange"), rcfile) << endmsg;
return;
}
info << "Loading ui configuration file " << rcfile << endmsg;
Gtkmm2ext::UI::instance()->load_rcfile (rcfile, themechange);
}
void
ThemeManager::on_dark_theme_button_toggled()
{
if (!dark_button.get_active()) return;
ARDOUR_UI::config()->ui_rc_file.set("ardour2_ui_dark.rc");
load_rc_file (ARDOUR_UI::config()->ui_rc_file.get(), true);
}
void
ThemeManager::on_light_theme_button_toggled()
{
if (!light_button.get_active()) return;
ARDOUR_UI::config()->ui_rc_file.set("ardour2_ui_light.rc");
load_rc_file (ARDOUR_UI::config()->ui_rc_file.get(), true);
}
void
ThemeManager::setup_theme ()
{
int r, g, b, a;
for (std::vector<UIConfigVariable<uint32_t> *>::iterator i = ARDOUR_UI::config()->canvas_colors.begin(); i != ARDOUR_UI::config()->canvas_colors.end(); i++) {
TreeModel::Row row = *(color_list->append());
Gdk::Color col;
uint32_t rgba = (*i)->get();
UINT_TO_RGBA (rgba, &r, &g, &b, &a);
//cerr << (*i)->name() << " == " << hex << rgba << ": " << hex << r << " " << hex << g << " " << hex << b << endl;
col.set_rgb_p (r / 255.0, g / 255.0, b / 255.0);
row[columns.name] = (*i)->name();
row[columns.color] = "";
row[columns.pVar] = *i;
row[columns.rgba] = rgba;
row[columns.gdkcolor] = col;
}
ColorsChanged.emit();
bool env_defined = false;
string rcfile = Glib::getenv("ARDOUR2_UI_RC", env_defined);
if(!env_defined) {
rcfile = ARDOUR_UI::config()->ui_rc_file.get();
}
if (rcfile == "ardour2_ui_dark.rc") {
dark_button.set_active();
} else if (rcfile == "ardour2_ui_light.rc") {
light_button.set_active();
}
load_rc_file(rcfile, false);
}

View file

@ -24,17 +24,22 @@
#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/colorselection.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/rc.h>
#include "ardour_dialog.h"
#include "color.h"
#include "ui_config.h"
class ColorManager : public ArdourDialog
class ThemeManager : public ArdourDialog
{
public:
ColorManager();
~ColorManager();
ThemeManager();
~ThemeManager();
int load (std::string path);
int save (std::string path);
void setup_theme ();
void on_dark_theme_button_toggled ();
void on_light_theme_button_toggled ();
private:
struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
@ -42,14 +47,14 @@ class ColorManager : public ArdourDialog
add (name);
add (color);
add (gdkcolor);
add (id);
add (pVar);
add (rgba);
}
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> color;
Gtk::TreeModelColumn<Gdk::Color> gdkcolor;
Gtk::TreeModelColumn<ColorID> id;
Gtk::TreeModelColumn<UIConfigVariable<uint32_t> *> pVar;
Gtk::TreeModelColumn<uint32_t> rgba;
};
@ -58,10 +63,12 @@ class ColorManager : public ArdourDialog
Glib::RefPtr<Gtk::ListStore> color_list;
Gtk::ColorSelectionDialog color_dialog;
Gtk::ScrolledWindow scroller;
Gtk::HBox theme_selection_hbox;
Gtk::RadioButton dark_button;
Gtk::RadioButton light_button;
bool button_press_event (GdkEventButton*);
};
#endif /* __ardour_gtk_color_manager_h__ */

View file

@ -149,7 +149,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
ColorChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
}
TimeAxisView::~TimeAxisView()
@ -784,20 +784,20 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect->rect->property_y1() = 0.0;
rect->rect->property_x2() = 0.0;
rect->rect->property_y2() = 0.0;
rect->rect->property_fill_color_rgba() = color_map[cSelectionRectFill];
rect->rect->property_outline_color_rgba() = color_map[cSelectionRectOutline];
rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
rect->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
rect->start_trim = new SimpleRect (*selection_group);
rect->start_trim->property_x1() = 0.0;
rect->start_trim->property_x2() = 0.0;
rect->start_trim->property_fill_color_rgba() = color_map[cSelectionStartFill];
rect->start_trim->property_outline_color_rgba() = color_map[cSelectionStartOutline];
rect->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->end_trim = new SimpleRect (*selection_group);
rect->end_trim->property_x1() = 0.0;
rect->end_trim->property_x2() = 0.0;
rect->end_trim->property_fill_color_rgba() = color_map[cSelectionEndFill];
rect->end_trim->property_outline_color_rgba() = color_map[cSelectionEndOutline];
rect->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
free_selection_rects.push_front (rect);
@ -1053,23 +1053,30 @@ TimeAxisView::hide_name_entry ()
}
void
TimeAxisView::color_handler (ColorID id, uint32_t val)
TimeAxisView::color_handler ()
{
switch (id) {
case cSelectionRectFill:
break;
case cSelectionRectOutline:
break;
case cSelectionStartFill:
break;
case cSelectionStartOutline:
break;
case cSelectionEndFill:
break;
case cSelectionEndOutline:
break;
default:
break;
for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
(*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
(*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
}
for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
(*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
(*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
(*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
}
}

View file

@ -40,7 +40,6 @@
#include "enums.h"
#include "editing.h"
#include "canvas.h"
#include "color.h"
namespace ARDOUR {
class Session;
@ -321,7 +320,7 @@ class TimeAxisView : public virtual AxisView
static bool need_size_info;
void set_height_pixels (uint32_t h);
void color_handler (ColorID, uint32_t);
void color_handler ();
}; /* class TimeAxisView */

View file

@ -32,6 +32,7 @@
#include "utils.h"
#include "canvas_impl.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "i18n.h"
@ -133,7 +134,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame_position = start ;
item_duration = duration ;
name_connected = false;
fill_opacity = 60;
fill_opacity = 0;
position_locked = false ;
max_item_duration = ARDOUR::max_frames;
min_item_duration = 0 ;
@ -150,8 +151,8 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
vestigial_frame->property_y1() = (double) 1.0;
vestigial_frame->property_x2() = 2.0;
vestigial_frame->property_y2() = (double) trackview.height;
vestigial_frame->property_outline_color_rgba() = color_map[cVestigialFrameOutline];
vestigial_frame->property_fill_color_rgba() = color_map[cVestigialFrameFill];
vestigial_frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get();
vestigial_frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get();
vestigial_frame->hide ();
if (visibility & ShowFrame) {
@ -160,8 +161,8 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame->property_y1() = (double) 1.0;
frame->property_x2() = (double) trackview.editor.frame_to_pixel(duration);
frame->property_y2() = (double) trackview.height;
frame->property_outline_color_rgba() = color_map[cTimeAxisFrameOutline];
frame->property_fill_color_rgba() = color_map[cTimeAxisFrameFill];
frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
/* by default draw all 4 edges */
@ -196,8 +197,8 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
}
name_highlight->property_y1() = (double) (trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE);
name_highlight->property_y2() = (double) (trackview.height - 1);
name_highlight->property_outline_color_rgba() = color_map[cNameHighlightFill];
name_highlight->property_fill_color_rgba() = color_map[cNameHighlightOutline];
name_highlight->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_NameHighlightFill.get();
name_highlight->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_NameHighlightOutline.get();
name_highlight->set_data ("timeaxisviewitem", this);
@ -229,16 +230,16 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame_handle_start->property_x2() = (double) TimeAxisViewItem::GRAB_HANDLE_LENGTH;
frame_handle_start->property_y1() = (double) 1.0;
frame_handle_start->property_y2() = (double) TimeAxisViewItem::GRAB_HANDLE_LENGTH+1;
frame_handle_start->property_outline_color_rgba() = color_map[cFrameHandleStartOutline];
frame_handle_start->property_fill_color_rgba() = color_map[cFrameHandleStartFill];
frame_handle_start->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
frame_handle_end = new ArdourCanvas::SimpleRect (*group);
frame_handle_end->property_x1() = (double) (trackview.editor.frame_to_pixel(get_duration())) - (TimeAxisViewItem::GRAB_HANDLE_LENGTH);
frame_handle_end->property_x2() = (double) trackview.editor.frame_to_pixel(get_duration());
frame_handle_end->property_y1() = (double) 1;
frame_handle_end->property_y2() = (double) TimeAxisViewItem::GRAB_HANDLE_LENGTH + 1;
frame_handle_end->property_outline_color_rgba() = color_map[cFrameHandleEndOutline];
frame_handle_end->property_fill_color_rgba() = color_map[cFrameHandleEndFill];
frame_handle_end->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
} else {
frame_handle_start = 0;
@ -794,11 +795,11 @@ TimeAxisViewItem::set_frame_color()
uint32_t r,g,b,a;
if (_selected && should_show_selection) {
UINT_TO_RGBA(color_map[cSelectedFrameBase], &r, &g, &b, &a);
frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, fill_opacity);
UINT_TO_RGBA(ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get(), &r, &g, &b, &a);
frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, fill_opacity ? fill_opacity : a);// Lets still use the theme's opacity value if Opaque is not set
} else {
UINT_TO_RGBA(color_map[cFrameBase], &r, &g, &b, &a);
frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, fill_opacity);
UINT_TO_RGBA(ARDOUR_UI::config()->canvasvar_FrameBase.get(), &r, &g, &b, &a);
frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, fill_opacity ? fill_opacity : a);
}
}
}
@ -812,11 +813,11 @@ TimeAxisViewItem::set_trim_handle_colors()
{
if (frame_handle_start) {
if (position_locked) {
frame_handle_start->property_fill_color_rgba() = color_map[cTrimHandleLockedStart];
frame_handle_end->property_fill_color_rgba() = color_map[cTrimHandleLockedEnd];
frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
} else {
frame_handle_start->property_fill_color_rgba() = color_map[cTrimHandleStart];
frame_handle_end->property_fill_color_rgba() = color_map[cTrimHandleEnd];
frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
}
}
}

View file

@ -435,8 +435,7 @@ class TimeAxisViewItem : public Selectable
*/
bool show_vestigial;
uint32_t fill_opacity;
uint32_t fill_opacity;
uint32_t fill_color ;
uint32_t frame_color_r ;
uint32_t frame_color_g ;

221
gtk2_ardour/ui_config.cc Normal file
View file

@ -0,0 +1,221 @@
/*
Copyright (C) 1999-2006 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <unistd.h>
#include <cstdio> /* for snprintf, grrr */
#include <pbd/failed_constructor.h>
#include <pbd/xml++.h>
#include <pbd/error.h>
#include <ardour/ardour.h>
#include "ui_config.h"
#include "i18n.h"
using namespace std;
using namespace PBD;
using namespace ARDOUR;
UIConfiguration::UIConfiguration ()
:
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,name,val) var (name,val),
#define CANVAS_VARIABLE(var,name) var (name),
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
hack(true)
{
load_state();
}
UIConfiguration::~UIConfiguration ()
{
}
int
UIConfiguration::load_state ()
{
bool found = false;
std::string rcfile = find_config_file ("ardour2_ui_default.conf");
if (rcfile.length())
{
XMLTree tree;
found = true;
cerr << string_compose (_("loading default ui configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile.c_str())) {
error << string_compose(_("Ardour: cannot read default ui configuration file \"%1\""), rcfile) << endmsg;
return -1;
}
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: default ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
}
rcfile = find_config_file ("ardour2_ui.conf");
if (rcfile.length())
{
XMLTree tree;
found = true;
cerr << string_compose (_("loading user ui configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile)) {
error << string_compose(_("Ardour: cannot read ui configuration file \"%1\""), rcfile) << endmsg;
return -1;
}
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: user ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
}
if (!found)
error << "Ardour: could not find any ui configuration file, canvas will look broken." << endmsg;
pack_canvasvars();
return 0;
}
int
UIConfiguration::save_state()
{
XMLTree tree;
string rcfile;
rcfile = get_user_ardour_path ();
rcfile += "ardour2_ui.conf";
if (rcfile.length()) {
tree.set_root (&get_state());
if (!tree.write (rcfile.c_str())){
error << string_compose (_("UI config file %1 not saved"), rcfile) << endmsg;
return -1;
}
}
return 0;
}
XMLNode&
UIConfiguration::get_state ()
{
XMLNode* root;
LocaleGuard lg (X_("POSIX"));
root = new XMLNode("Ardour");
root->add_child_nocopy (get_variables ("UI"));
root->add_child_nocopy (get_variables ("Canvas"));
if (_extra_xml) {
root->add_child_copy (*_extra_xml);
}
return *root;
}
XMLNode&
UIConfiguration::get_variables (std::string which_node)
{
XMLNode* node;
LocaleGuard lg (X_("POSIX"));
node = new XMLNode(which_node);
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,Name,value) if (node->name() == "UI") { var.add_to_node (*node); }
#define CANVAS_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
return *node;
}
int
UIConfiguration::set_state (const XMLNode& root)
{
if (root.name() != "Ardour") {
return -1;
}
XMLNodeList nlist = root.children();
XMLNodeConstIterator niter;
XMLNode *node;
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
node = *niter;
if (node->name() == "Canvas" || node->name() == "UI") {
set_variables (*node);
} else if (node->name() == "extra") {
_extra_xml = new XMLNode (*node);
}
}
return 0;
}
void
UIConfiguration::set_variables (const XMLNode& node)
{
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,name,val) \
if (var.set_from_node (node)) { \
ParameterChanged (name); \
}
#define CANVAS_VARIABLE(var,name) \
if (var.set_from_node (node)) { \
ParameterChanged (name); \
}
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
}
void
UIConfiguration::pack_canvasvars ()
{
#undef CANVAS_VARIABLE
#define CANVAS_VARIABLE(var,name) canvas_colors.push_back(&var);
#include "canvas_vars.h"
#undef CANVAS_VARIABLE
cerr << "Configuration::pack_canvasvars () called, canvas_colors.size() = " << canvas_colors.size() << endl;
}

137
gtk2_ardour/ui_config.h Normal file
View file

@ -0,0 +1,137 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_ui_configuration_h__
#define __ardour_ui_configuration_h__
#include <sstream>
#include <ostream>
#include <iostream>
#include <pbd/stateful.h>
#include <pbd/xml++.h>
using namespace PBD;
template<class T>
class UIConfigVariable
{
public:
UIConfigVariable (std::string str) : _name (str) {}
UIConfigVariable (std::string str, T val) : _name (str), value(val) {}
std::string name() const { return _name; }
bool set (T val) {
if (val == value) {
return false;
}
value = val;
return true;
}
T get() const {
return value;
}
void add_to_node (XMLNode& node) {
std::stringstream ss;
ss << std::hex;
ss.fill('0');
ss.width(8);
ss << value;
XMLNode* child = new XMLNode ("Option");
child->add_property ("name", _name);
child->add_property ("value", ss.str());
node.add_child_nocopy (*child);
}
bool set_from_node (const XMLNode& node) {
const XMLProperty* prop;
XMLNodeList nlist;
XMLNodeConstIterator niter;
XMLNode* child;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
child = *niter;
if (child->name() == "Option") {
if ((prop = child->property ("name")) != 0) {
if (prop->value() == _name) {
if ((prop = child->property ("value")) != 0) {
std::stringstream ss;
ss << std::hex;
ss << prop->value();
ss >> value;
return true;
}
}
}
}
}
return false;
}
protected:
T get_for_save() { return value; }
std::string _name;
T value;
};
class UIConfiguration : public Stateful
{
public:
UIConfiguration();
~UIConfiguration();
std::vector<UIConfigVariable<uint32_t> *> canvas_colors;
int load_state ();
int save_state ();
int set_state (const XMLNode&);
XMLNode& get_state (void);
XMLNode& get_variables (std::string);
void set_variables (const XMLNode&);
void pack_canvasvars ();
sigc::signal<void,const char*> ParameterChanged;
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,name,val) UIConfigVariable<Type> var;
#define CANVAS_VARIABLE(var,name) UIConfigVariable<uint32_t> var;
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
private:
XMLNode& state ();
bool hack;
};
#endif /* __ardour_ui_configuration_h__ */

View file

@ -0,0 +1,2 @@
UI_CONFIG_VARIABLE(std::string, ui_rc_file, "ui-rc-file", "ardour2_ui_dark.rc")

View file

@ -156,7 +156,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro
void clear_sync_position ();
void set_hidden (bool yn);
void set_muted (bool yn);
void set_opaque (bool yn);
void set_opaque (bool yn);
void set_locked (bool yn);
virtual uint32_t read_data_count() const { return _read_data_count; }

View file

@ -586,7 +586,7 @@ Region::set_opaque (bool yn)
} else {
_flags = Flag (_flags & ~Opaque);
}
send_change (OpacityChanged);
send_change (OpacityChanged);
}
}

View file

@ -61,7 +61,7 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type();
#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)
{
theMain = new Main (argc, argv);
@ -99,7 +99,6 @@ UI::UI (string namestr, int *argc, char ***argv, string rcfile)
register_thread (pthread_self(), X_("GUI"));
load_rcfile (rcfile);
}
UI::~UI ()
@ -114,7 +113,7 @@ UI::caller_is_ui_thread ()
}
int
UI::load_rcfile (string path)
UI::load_rcfile (string path, bool themechange)
{
if (path.length() == 0) {
return -1;
@ -129,6 +128,12 @@ UI::load_rcfile (string path)
}
RC rc (path.c_str());
RC::reset_styles(Gtk::Settings::get_default());
theme_changed.emit();
if (themechange) {
return 0; //Don't continue on every time there is a theme change
}
/* have to pack widgets into a toplevel window so that styles will stick */

View file

@ -87,7 +87,7 @@ struct UIRequest : public BaseUI::BaseRequestObject {
class UI : public Receiver, public AbstractUI<UIRequest>
{
public:
UI (string name, int *argc, char **argv[], string rcfile);
UI (string name, int *argc, char **argv[]);
virtual ~UI ();
static UI *instance() { return theGtkUI; }
@ -107,7 +107,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
bool running ();
void quit ();
void kill ();
int load_rcfile (string);
int load_rcfile (string, bool themechange = false);
void run (Receiver &old_receiver);
void set_state (Gtk::Widget *w, Gtk::StateType state);
@ -132,6 +132,8 @@ class UI : public Receiver, public AbstractUI<UIRequest>
sigc::signal<void> starting;
sigc::signal<void> stopping;
sigc::signal<void> theme_changed;
static bool just_hide_it (GdkEventAny *, Gtk::Window *);
static pthread_t the_gui_thread() { return gui_thread; }