From 789cbb21810802adc478de3134fa42950c5e8569 Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Fri, 15 Jun 2007 22:08:27 +0000 Subject: Major Theme Manager changes, see ardour-dev git-svn-id: svn://localhost/ardour2/trunk@1987 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.colors | 2 +- gtk2_ardour/ardour2_ui_dark.rc | 5 +- gtk2_ardour/ardour_ui.cc | 6 +- gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/audio_region_view.cc | 56 ++++++------ gtk2_ardour/audio_region_view.h | 2 +- gtk2_ardour/audio_streamview.cc | 38 +++----- gtk2_ardour/audio_streamview.h | 2 +- gtk2_ardour/audio_time_axis.cc | 6 +- gtk2_ardour/automation_line.cc | 16 ++-- gtk2_ardour/automation_time_axis.cc | 33 +++---- gtk2_ardour/automation_time_axis.h | 2 +- gtk2_ardour/color.h | 38 -------- gtk2_ardour/colors.h | 137 ---------------------------- gtk2_ardour/crossfade_edit.cc | 34 +++---- gtk2_ardour/crossfade_view.cc | 16 +++- gtk2_ardour/crossfade_view.h | 1 + gtk2_ardour/editor.cc | 11 ++- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_canvas.cc | 104 +++++++++++++-------- gtk2_ardour/editor_mouse.cc | 10 +- gtk2_ardour/editor_tempodisplay.cc | 10 +- gtk2_ardour/ghostregion.cc | 14 ++- gtk2_ardour/ghostregion.h | 1 + gtk2_ardour/imageframe_time_axis_view.cc | 4 +- gtk2_ardour/marker.cc | 4 +- gtk2_ardour/marker_time_axis_view.cc | 4 +- gtk2_ardour/midi_streamview.cc | 37 +++----- gtk2_ardour/midi_streamview.h | 2 +- gtk2_ardour/region_view.cc | 2 +- gtk2_ardour/region_view.h | 2 +- gtk2_ardour/route_time_axis.cc | 27 +++--- gtk2_ardour/route_time_axis.h | 2 +- gtk2_ardour/streamview.cc | 2 +- gtk2_ardour/streamview.h | 2 +- gtk2_ardour/theme_manager.cc | 127 ++++++++------------------ gtk2_ardour/theme_manager.h | 9 +- gtk2_ardour/time_axis_view.cc | 54 ++++++----- gtk2_ardour/time_axis_view.h | 2 +- gtk2_ardour/time_axis_view_item.cc | 39 ++++---- libs/ardour/ardour/canvas_vars.h | 81 ++++++++++++++++ libs/ardour/ardour/configuration.h | 12 ++- libs/ardour/ardour/configuration_variable.h | 4 +- libs/ardour/ardour/configuration_vars.h | 1 + libs/ardour/configuration.cc | 52 +++++++++-- 45 files changed, 468 insertions(+), 547 deletions(-) delete mode 100644 gtk2_ardour/color.h delete mode 100644 gtk2_ardour/colors.h create mode 100644 libs/ardour/ardour/canvas_vars.h diff --git a/gtk2_ardour/ardour.colors b/gtk2_ardour/ardour.colors index c247195c7e..87f53d9d92 100644 --- a/gtk2_ardour/ardour.colors +++ b/gtk2_ardour/ardour.colors @@ -1,6 +1,6 @@ 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 +cMutedWaveForm 0.0 0.0 0.0 0.30 cSelectedFrameBase 0.71 0.57 0.66 1.0 cFrameBase 0.75 0.75 0.76 1.0 cAudioTrackOutline 0.00 0.00 0.00 1.00 diff --git a/gtk2_ardour/ardour2_ui_dark.rc b/gtk2_ardour/ardour2_ui_dark.rc index 29243d7d78..631ef4b92e 100644 --- a/gtk2_ardour/ardour2_ui_dark.rc +++ b/gtk2_ardour/ardour2_ui_dark.rc @@ -80,7 +80,7 @@ style "marker_text" style "time_axis_view_item_name" { - font_name = "sans 9" + font_name = "sans 6" } style "default_base" = "medium_text" @@ -122,9 +122,6 @@ style "default_base" = "medium_text" engine "clearlooks" { menubarstyle = 0 # 0 = flat, 1 = sunken, 2 = flat gradient - menuitemstyle = 0 # 0 = flat, 1 = 3d-ish (gradient), 2 = 3d-ish (button) - listviewitemstyle = 0 # 0 = flat, 1 = 3d-ish (gradient) - progressbarstyle = 1 # 0 = candy bar, 1 = fancy candy bar, 2 = flat } } diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e47362be88..74baad2857 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -169,9 +169,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) theme_manager = new ThemeManager(); - std::string color_file = ARDOUR::find_config_file("ardour.colors"); + //std::string color_file = ARDOUR::find_config_file("ardour.colors"); - theme_manager->load (color_file); + //theme_manager->load (color_file); editor = 0; mixer = 0; @@ -1527,7 +1527,7 @@ ARDOUR_UI::setup_theme () } ThemeChanged (rcfile); //EMIT SIGNAL - theme_manager->setup_theme_buttons(); + theme_manager->setup_theme(); } gint diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index fc4114554c..08485d9ca3 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -57,6 +57,7 @@ #include #include #include +#include #include "audio_clock.h" #include "ardour_dialog.h" diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 3fb1a016e4..991f15075a 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -48,6 +48,8 @@ #include "i18n.h" +#define MUTED_ALPHA 0x50 + using namespace sigc; using namespace ARDOUR; using namespace PBD; @@ -390,9 +392,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(Config->canvasvar_WaveForm.get(), MUTED_ALPHA); } else { - waves[n]->property_wave_color() = color_map[cWaveForm]; + waves[n]->property_wave_color() = Config->canvasvar_WaveForm.get(); } } } @@ -699,18 +701,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() ? Config->canvasvar_GainLine.get() : 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(Config->canvasvar_WaveForm.get(), MUTED_ALPHA); } else { - waves[n]->property_wave_color() = color_map[cWaveForm]; + waves[n]->property_wave_color() = 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() = Config->canvasvar_WaveFormClip.get(); + waves[n]->property_zero_color() = Config->canvasvar_ZeroLine.get(); } } @@ -848,9 +850,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(Config->canvasvar_WaveForm.get(), MUTED_ALPHA) : Config->canvasvar_WaveForm.get(); + wave->property_clip_color() = Config->canvasvar_WaveFormClip.get(); + wave->property_zero_color() = Config->canvasvar_ZeroLine.get(); wave->property_region_start() = _region->start(); wave->property_rectified() = (bool) (_flags & WaveformRectified); wave->property_logscaled() = (bool) (_flags & WaveformLogScaled); @@ -894,7 +896,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) Config->canvasvar_ZeroLine.get(); manage_zero_line (); } } @@ -1096,9 +1098,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() = Config->canvasvar_GhostTrackWave.get(); + wave->property_clip_color() = Config->canvasvar_GhostTrackWaveClip.get(); + wave->property_zero_color() = Config->canvasvar_GhostTrackZeroLine.get(); wave->property_region_start() = _region->start(); ghost->waves.push_back(wave); @@ -1151,7 +1153,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() ? Config->canvasvar_GainLine.get() : Config->canvasvar_GainLineInactive.get()); } } @@ -1178,22 +1180,16 @@ 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 cMutedWaveForm: + //case cWaveForm: + //case cWaveFormClip: + //case cZeroLine: + set_colors (); - case cGainLineInactive: - case cGainLine: - envelope_active_changed(); - break; + //case cGainLineInactive: + //case cGainLine: + envelope_active_changed(); - default: - break; - } } diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 1facc652a9..4d31cfbe29 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -163,7 +163,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 wave_caches; diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 573ed0ceba..a95c0ba648 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -64,12 +64,12 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv) _waveform_shape = Traditional; if (tv.is_track()) - stream_base_color = color_map[cAudioTrackBase]; + stream_base_color = Config->canvasvar_AudioTrackBase.get(); else - stream_base_color = color_map[cAudioBusBase]; + stream_base_color = 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; @@ -520,12 +520,12 @@ AudioStreamView::setup_rec_box () switch (_trackview.audio_track()->mode()) { case Normal: xend = xstart; - fill_color = color_map[cRecordingRectFill]; + fill_color = Config->canvasvar_RecordingRect.get(); break; case Destructive: xend = xstart + 2; - fill_color = color_map[cRecordingRectFill]; + fill_color = Config->canvasvar_RecordingRect.get(); /* make the recording rect translucent to allow the user to see the peak data coming in, etc. */ @@ -538,7 +538,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() = Config->canvasvar_RecordingRect.get(); rec_rect->property_fill_color_rgba() = fill_color; rec_rect->lower_to_bottom(); @@ -761,26 +761,18 @@ 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; + //case cAudioTrackBase: + if (_trackview.is_track()) { + canvas_rect->property_fill_color_rgba() = Config->canvasvar_AudioTrackBase.get(); + } - default: - break; + //case cAudioBusBase: + if (!_trackview.is_track()) { + canvas_rect->property_fill_color_rgba() = Config->canvasvar_AudioBusBase.get(); } + } void diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index 2baf1a6f66..c8c9d5c4f6 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -97,7 +97,7 @@ class AudioStreamView : public StreamView void add_crossfade_weak (boost::weak_ptr); void remove_crossfade (boost::shared_ptr); - void color_handler (ColorID id, uint32_t val); + void color_handler (); void update_contents_y_position_and_height (); diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index d37b164ed1..b515180f2f 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -379,7 +379,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 (Config->canvasvar_AutomationLine.get()); gain_track->add_line (*line); @@ -460,10 +460,10 @@ AudioTimeAxisView::update_pans () if (p == _route->panner().begin()) { /* first line is a nice orange */ - line->set_line_color (color_map[cLeftPanAutomationLine]); + line->set_line_color (Config->canvasvar_AutomationLine.get()); } else { /* second line is a nice blue */ - line->set_line_color (color_map[cRightPanAutomationLine]); + line->set_line_color (Config->canvasvar_AutomationLine.get()); } pan_track->add_line (*line); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index a729161911..683a767935 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -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() = Config->canvasvar_ControlPointFill.get(); + item->property_outline_color_rgba() = 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() = 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() = Config->canvasvar_EnteredControlPointSelected.get(); set_visible(true); } else { - item->property_outline_color_rgba() = color_map[cEnteredControlPoint]; + item->property_outline_color_rgba() = 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() = Config->canvasvar_ControlPointSelected.get(); set_visible(true); } else { - item->property_outline_color_rgba() = color_map[cControlPoint]; + item->property_outline_color_rgba() = Config->canvasvar_ControlPoint.get(); if (hide_too) { set_visible(false); } @@ -1148,7 +1148,7 @@ AutomationLine::set_selected_points (PointSelection& points) } void AutomationLine::set_colors() { - set_line_color( color_map[cAutomationLine] ); + set_line_color( Config->canvasvar_AutomationLine.get() ); for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { (*i)->show_color (false, !points_visible); } diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 45103ec7f1..04ac1ee076 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -74,11 +74,11 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptrproperty_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() = 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() = Config->canvasvar_AutomationTrackFill.get(); + //base_rect->property_fill_color_rgba() = Config->canvasvar_EnteredControlPoint.get(); base_rect->set_data ("trackview", this); @@ -182,7 +182,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr - -#undef COLORID -#define COLORID(a) a, -enum ColorID { - #include "colors.h" -}; -#undef COLORID - -typedef std::map ColorMap; -extern ColorMap color_map; - -extern sigc::signal ColorsChanged; -extern sigc::signal ColorChanged; - -#endif /* __gtk_ardour_color_h__ */ diff --git a/gtk2_ardour/colors.h b/gtk2_ardour/colors.h deleted file mode 100644 index 05571f4af7..0000000000 --- a/gtk2_ardour/colors.h +++ /dev/null @@ -1,137 +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(cMidiTrackBase) -COLORID(cMidiTrackOutline) -COLORID(cMidiBusBase) -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(cMarkerLabel) -COLORID(cTempoBar) -COLORID(cTempoSeparator) -COLORID(cMeterBar) -COLORID(cMeterSeparator) -COLORID(cMarkerBar) -COLORID(cMarkerSeparator) -COLORID(cRangeMarkerBar) -COLORID(cRangeMarkerSeparator) -COLORID(cTransportMarkerBar) -COLORID(cTransportMarkerSeparator) -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) - diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index badbc0f105..349297f8cd 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -129,23 +129,23 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr 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() = 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() = 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() = 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() = 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() = 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 +454,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() = Config->canvasvar_CrossfadeEditorPointFill.get(); + p->box->property_outline_color_rgba() = Config->canvasvar_CrossfadeEditorPointOutline.get(); p->box->property_outline_pixels() = 1; p->curve = fade[current].line; @@ -976,15 +976,15 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) if (wf == In) { for (vector::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { - (*i)->property_wave_color() = color_map[cSelectedCrossfadeEditorWave]; + (*i)->property_wave_color() = Config->canvasvar_SelectedCrossfadeEditorWave.get(); } for (vector::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { - (*i)->property_wave_color() = color_map[cCrossfadeEditorWave]; + (*i)->property_wave_color() = 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() = Config->canvasvar_SelectedCrossfadeEditorLine.get(); + fade[Out].line->property_fill_color_rgba() = Config->canvasvar_CrossfadeEditorLine.get(); fade[Out].shading->hide(); fade[In].shading->show(); @@ -999,15 +999,15 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) } else { for (vector::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { - (*i)->property_wave_color() = color_map[cCrossfadeEditorWave]; + (*i)->property_wave_color() = Config->canvasvar_CrossfadeEditorWave.get(); } for (vector::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { - (*i)->property_wave_color() = color_map[cSelectedCrossfadeEditorWave]; + (*i)->property_wave_color() = 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() = Config->canvasvar_SelectedCrossfadeEditorLine.get(); + fade[In].line->property_fill_color_rgba() = Config->canvasvar_CrossfadeEditorLine.get(); fade[In].shading->hide(); fade[Out].shading->show(); @@ -1049,9 +1049,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr region, WhichFade wh double spu; if (which == In) { - color = color_map[cSelectedCrossfadeEditorWave]; + color = Config->canvasvar_SelectedCrossfadeEditorWave.get(); } else { - color = color_map[cCrossfadeEditorWave]; + color = Config->canvasvar_CrossfadeEditorWave.get(); } ht = canvas->get_allocation().get_height() / (double) nchans; diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index 261b2b3ca4..d2fdd94e03 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -61,11 +61,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() = 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() = Config->canvasvar_CrossfadeLine.get(); fade_out->property_width_pixels() = 1; set_y_position_and_height (0, get_time_axis_view().height); @@ -84,6 +84,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 () @@ -219,14 +220,20 @@ void CrossfadeView::active_changed () { if (crossfade->active()) { - frame->property_fill_color_rgba() = color_map[cActiveCrossfade]; + frame->property_fill_color_rgba() = Config->canvasvar_ActiveCrossfade.get(); } else { - frame->property_fill_color_rgba() = color_map[cInactiveCrossfade]; + frame->property_fill_color_rgba() = Config->canvasvar_InactiveCrossfade.get(); } redraw_curves (); } +void +CrossfadeView::color_handler () +{ + active_changed (); +} + void CrossfadeView::set_valid (bool yn) { @@ -262,3 +269,4 @@ CrossfadeView::fake_hide () { group->hide(); } + diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h index 02f3cd0df2..39ca8bf1c3 100644 --- a/gtk2_ardour/crossfade_view.h +++ b/gtk2_ardour/crossfade_view.h @@ -79,6 +79,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__ */ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index d77736a41f..ddf724e7a0 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -312,11 +312,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 = Config->canvasvar_LocationMarker.get(); + location_range_color = Config->canvasvar_LocationRange.get(); + location_cd_marker_color = Config->canvasvar_LocationCDMarker.get(); + location_loop_color = Config->canvasvar_LocationLoop.get(); + location_punch_color = Config->canvasvar_LocationPunch.get(); range_marker_drag_rect = 0; marker_drag_line = 0; @@ -3649,3 +3649,4 @@ Editor::edit_cursor_position(bool sync) return edit_cursor->current_frame; } + diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 739feb957e..eee7c701cb 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -351,6 +351,7 @@ class Editor : public PublicEditor private: /// The session that we are editing, or 0 + void color_handler (); ARDOUR::Session *session; bool constructed; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 0c11092af6..2aa76d4a85 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -138,7 +138,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]; verbose_cursor_visible = false; @@ -160,44 +159,30 @@ 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_what() = (0x1 | 0x8); tempo_bar->property_outline_pixels() = 1; - tempo_bar->property_outline_color_rgba() = color_map[cTempoSeparator]; 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_what() = (0x1 | 0x8); meter_bar->property_outline_pixels() = 1; - meter_bar->property_outline_color_rgba() = color_map[cMeterSeparator]; 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_what() = (0x1 | 0x8); marker_bar->property_outline_pixels() = 1; - marker_bar->property_outline_color_rgba() = color_map[cMarkerSeparator]; 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_what() = (0x1 | 0x8); range_marker_bar->property_outline_pixels() = 1; - range_marker_bar->property_outline_color_rgba() = color_map[cRangeMarkerSeparator]; 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_what() = (0x1 | 0x8); transport_marker_bar->property_outline_pixels() = 1; - transport_marker_bar->property_outline_color_rgba() = color_map[cTransportMarkerSeparator]; 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 (); @@ -206,24 +191,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(); @@ -234,7 +212,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); @@ -242,13 +219,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(); @@ -256,8 +230,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(); @@ -273,25 +245,16 @@ Editor::initialize_canvas () 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 +697,64 @@ Editor::canvas_horizontally_scrolled () redisplay_tempo (!_dragging_hscrollbar); } +void +Editor::color_handler() +{ + edit_cursor->canvas_item.property_fill_color_rgba() = Config->canvasvar_EditCursor.get(); + playhead_cursor->canvas_item.property_fill_color_rgba() = Config->canvasvar_PlayHead.get(); + verbose_canvas_cursor->property_fill_color_rgba() = Config->canvasvar_VerboseCanvasCursor.get(); + + meter_bar->property_fill_color_rgba() = Config->canvasvar_MeterBar.get(); + meter_bar->property_outline_color_rgba() = Config->canvasvar_MeterBar.get(); + + tempo_bar->property_fill_color_rgba() = Config->canvasvar_TempoBar.get(); + tempo_bar->property_outline_color_rgba() = Config->canvasvar_TempoBar.get(); + + marker_bar->property_fill_color_rgba() = Config->canvasvar_MarkerBar.get(); + marker_bar->property_outline_color_rgba() = Config->canvasvar_MarkerBar.get(); + + range_marker_bar->property_fill_color_rgba() = Config->canvasvar_RangeMarkerBar.get(); + range_marker_bar->property_outline_color_rgba() = Config->canvasvar_RangeMarkerBar.get(); + + transport_marker_bar->property_fill_color_rgba() = Config->canvasvar_TransportMarkerBar.get(); + transport_marker_bar->property_outline_color_rgba() = Config->canvasvar_TransportMarkerBar.get(); + + range_bar_drag_rect->property_fill_color_rgba() = Config->canvasvar_RangeDragBarRect.get(); + range_bar_drag_rect->property_outline_color_rgba() = Config->canvasvar_RangeDragBarRect.get(); + + transport_bar_drag_rect->property_fill_color_rgba() = Config->canvasvar_TransportDragRect.get(); + transport_bar_drag_rect->property_outline_color_rgba() = Config->canvasvar_TransportDragRect.get(); + + marker_drag_line->property_fill_color_rgba() = Config->canvasvar_MarkerDragLine.get(); + + range_marker_drag_rect->property_fill_color_rgba() = Config->canvasvar_RangeDragRect.get(); + range_marker_drag_rect->property_outline_color_rgba() = Config->canvasvar_RangeDragRect.get(); + + transport_loop_range_rect->property_fill_color_rgba() = Config->canvasvar_TransportLoopRect.get(); + transport_loop_range_rect->property_outline_color_rgba() = Config->canvasvar_TransportLoopRect.get(); + + transport_punch_range_rect->property_fill_color_rgba() = Config->canvasvar_TransportPunchRect.get(); + transport_punch_range_rect->property_outline_color_rgba() = Config->canvasvar_TransportPunchRect.get(); + + transport_punchin_line->property_color_rgba() = Config->canvasvar_PunchLine.get(); + transport_punchout_line->property_color_rgba() = Config->canvasvar_PunchLine.get(); + + zoom_rect->property_fill_color_rgba() = Config->canvasvar_ZoomRect.get(); + zoom_rect->property_outline_color_rgba() = Config->canvasvar_ZoomRect.get(); + + rubberband_rect->property_outline_color_rgba() = Config->canvasvar_RubberBandRect.get(); + rubberband_rect->property_fill_color_rgba() = (guint32) Config->canvasvar_RubberBandRect.get(); + + location_marker_color = Config->canvasvar_LocationMarker.get(); + location_range_color = Config->canvasvar_LocationRange.get(); + location_cd_marker_color = Config->canvasvar_LocationCDMarker.get(); + location_loop_color = Config->canvasvar_LocationLoop.get(); + location_punch_color = 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 +} + diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 22bb6e8a08..2f671c77eb 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1087,7 +1087,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ if (mouse_mode == MouseGain) { ArdourCanvas::Line *line = dynamic_cast (item); if (line) - line->property_fill_color_rgba() = color_map[cEnteredGainLine]; + line->property_fill_color_rgba() = Config->canvasvar_EnteredGainLine.get(); if (is_drawable()) { track_canvas.get_window()->set_cursor (*fader_cursor); } @@ -1101,7 +1101,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ { ArdourCanvas::Line *line = dynamic_cast (item); if (line) - line->property_fill_color_rgba() = color_map[cEnteredAutomationLine]; + line->property_fill_color_rgba() = Config->canvasvar_EnteredAutomationLine.get(); } if (is_drawable()) { track_canvas.get_window()->set_cursor (*fader_cursor); @@ -1188,7 +1188,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ if ((marker = static_cast (item->get_data ("marker"))) == 0) { break; } - marker->set_color_rgba (color_map[cEnteredMarker]); + marker->set_color_rgba (Config->canvasvar_EnteredMarker.get()); // fall through case MeterMarkerItem: case TempoMarkerItem: @@ -2179,7 +2179,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, Config->canvasvar_MeterMarker.get(), name, *new MeterSection(meter_marker->meter())); drag_info.item = &new_marker->the_item(); @@ -2310,7 +2310,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, Config->canvasvar_TempoMarker.get(), name, *new TempoSection(tempo_marker->tempo())); drag_info.item = &new_marker->the_item(); diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 7fe8759639..c1cc2bb3a8 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -70,7 +70,7 @@ void Editor::draw_metric_marks (const Metrics& metrics) { - const MeterSection *ms; + const MeterSection *ms; const TempoSection *ts; char buf[64]; @@ -80,11 +80,11 @@ Editor::draw_metric_marks (const Metrics& metrics) if ((ms = dynamic_cast(*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, Config->canvasvar_MeterMarker.get(), buf, *(const_cast(ms)))); } else if ((ts = dynamic_cast(*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, Config->canvasvar_TempoMarker.get(), buf, *(const_cast(ts)))); } @@ -249,9 +249,9 @@ Editor::draw_measures () case TempoMap::Beat: if ((*i).beat == 1) { - color = color_map[cMeasureLineBar]; + color = Config->canvasvar_MeasureLineBar.get(); } else { - color = color_map[cMeasureLineBeat]; + color = Config->canvasvar_MeasureLineBeat.get(); if (beat_density > 2.0) { /* only draw beat lines if the gaps between beats are large. diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 844338cd45..c9b4217b24 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -25,6 +25,7 @@ using namespace Editing; using namespace ArdourCanvas; +using namespace ARDOUR; GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos) : trackview (atv) @@ -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() = Config->canvasvar_GhostTrackBase.get(); + base_rect->property_fill_color_rgba() = Config->canvasvar_GhostTrackBase.get(); group->lower_to_bottom (); atv.add_ghost (this); @@ -91,10 +92,13 @@ GhostRegion::set_height () void GhostRegion::set_colors () { + base_rect->property_outline_color_rgba() = Config->canvasvar_GhostTrackBase.get(); + base_rect->property_fill_color_rgba() = Config->canvasvar_GhostTrackBase.get(); + for (uint32_t n=0; n < waves.size(); ++n) { - waves[n]->property_wave_color() = color_map[cGhostTrackWave]; + waves[n]->property_wave_color() = Config->canvasvar_GhostTrackWave.get(); - waves[n]->property_clip_color() = color_map[cGhostTrackWaveClip]; - waves[n]->property_zero_color() = color_map[cGhostTrackZeroLine]; + waves[n]->property_clip_color() = Config->canvasvar_GhostTrackWaveClip.get(); + waves[n]->property_zero_color() = Config->canvasvar_GhostTrackZeroLine.get(); } } diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index 1e32add794..16d945f543 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "canvas.h" #include "simplerect.h" diff --git a/gtk2_ardour/imageframe_time_axis_view.cc b/gtk2_ardour/imageframe_time_axis_view.cc index 91575f3cc5..895254450f 100644 --- a/gtk2_ardour/imageframe_time_axis_view.cc +++ b/gtk2_ardour/imageframe_time_axis_view.cc @@ -52,9 +52,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 = Config->canvasvar_ImageTrack.get() ; - canvas_rect.property_outline_color_rgba() = color_map[cImageTrackOutline]; + canvas_rect.property_outline_color_rgba() = 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)); diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 244079af41..0325bcfc31 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -28,6 +28,8 @@ #include "i18n.h" +using namespace ARDOUR; + Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation, Type type, nframes_t frame, bool handle_events) @@ -253,7 +255,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_rgba() = color_map[cMarkerLabel]; + text->property_fill_color_rgba() = Config->canvasvar_MarkerLabel.get(); editor.ZoomChanged.connect (mem_fun (*this, &Marker::reposition)); diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc index 34acf51fbf..cbd363a021 100644 --- a/gtk2_ardour/marker_time_axis_view.cc +++ b/gtk2_ardour/marker_time_axis_view.cc @@ -49,7 +49,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv) : _trackview (tv) { region_color = _trackview.color(); - stream_base_color = color_map[cMarkerTrackBase]; + stream_base_color = Config->canvasvar_MarkerTrack.get(); canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display); @@ -58,7 +58,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() = 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)); diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index c99f6ca777..503e6195a9 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -56,12 +56,12 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) : StreamView (tv) { if (tv.is_track()) - stream_base_color = color_map[cMidiTrackBase]; + stream_base_color = Config->canvasvar_MidiTrackBase.get(); else - stream_base_color = color_map[cMidiBusBase]; + stream_base_color = Config->canvasvar_MidiBusBase.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; //use_rec_regions = tv.editor.show_waveforms_recording (); use_rec_regions = true; @@ -216,14 +216,14 @@ MidiStreamView::setup_rec_box () assert(_trackview.midi_track()->mode() == Normal); xend = xstart; - fill_color = color_map[cRecordingRectFill]; + fill_color = Config->canvasvar_RecordingRect.get(); ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group); rec_rect->property_x1() = xstart; 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() = Config->canvasvar_RecordingRect.get(); rec_rect->property_fill_color_rgba() = fill_color; rec_rect->lower_to_bottom(); @@ -409,24 +409,17 @@ MidiStreamView::rec_data_range_ready (boost::shared_ptr data, jack_n } void -MidiStreamView::color_handler (ColorID id, uint32_t val) +MidiStreamView::color_handler () { - switch (id) { - case cMidiTrackBase: - if (_trackview.is_midi_track()) { - canvas_rect->property_fill_color_rgba() = val; - } - break; - case cMidiBusBase: - if (!_trackview.is_midi_track()) { - canvas_rect->property_fill_color_rgba() = val; - } - break; - case cMidiTrackOutline: - canvas_rect->property_outline_color_rgba() = val; - break; - default: - break; + //case cMidiTrackBase: + if (_trackview.is_midi_track()) { + canvas_rect->property_fill_color_rgba() = Config->canvasvar_MidiTrackBase.get(); + } + + //case cMidiBusBase: + if (!_trackview.is_midi_track()) { + canvas_rect->property_fill_color_rgba() = Config->canvasvar_MidiBusBase.get();; } } + diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index d2885b4391..480b968e50 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -68,7 +68,7 @@ class MidiStreamView : public StreamView void redisplay_diskstream (); - void color_handler (ColorID id, uint32_t val); + void color_handler (); }; #endif /* __ardour_midi_streamview_h__ */ diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 2d3346df56..523f5e57b2 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -146,7 +146,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? */ } diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index 6277354519..26d7cdde86 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -117,7 +117,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 _region; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 4de34d61d5..c56be02366 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -197,7 +197,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 () @@ -599,8 +599,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() = Config->canvasvar_TimeStretchFill.get(); + timestretch_rect->property_outline_color_rgba() = Config->canvasvar_TimeStretchOutline.get(); } timestretch_rect->show (); @@ -1367,18 +1367,17 @@ 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; + //case cTimeStretchOutline: + if (timestretch_rect) { + timestretch_rect->property_outline_color_rgba() = Config->canvasvar_TimeStretchOutline.get(); + } + //case cTimeStretchFill: + if (timestretch_rect) { + timestretch_rect->property_fill_color_rgba() = Config->canvasvar_TimeStretchFill.get(); } + } void @@ -1549,7 +1548,7 @@ RouteTimeAxisView::add_redirect_automation_curve (boost::shared_ptr 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 (Config->canvasvar_RedirectAutomationLine.get()); ral->queue_reset (); ran->view->add_line (*ral); diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index cf522df789..368e29d0a0 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -199,7 +199,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*); diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index aa8767ac13..305b5c3240 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -80,7 +80,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 () diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index f83b35191d..7011801560 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -121,7 +121,7 @@ protected: virtual void playlist_modified_weak (boost::weak_ptr); virtual void playlist_modified (boost::shared_ptr); - virtual void color_handler (ColorID, uint32_t) = 0; + virtual void color_handler () = 0; virtual void update_contents_y_position_and_height (); diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index e98c170e10..6d512a71e0 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -39,23 +39,9 @@ using namespace Gtk; using namespace PBD; using namespace ARDOUR; -/* 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 ColorsChanged; -sigc::signal ColorChanged; +sigc::signal ColorChanged; ThemeManager::ThemeManager() : ArdourDialog ("ThemeManager"), @@ -106,73 +92,6 @@ ThemeManager::~ThemeManager() { } -int -ThemeManager::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; - } - - cerr << "Loading color definition file " << path << endl; - - 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 ThemeManager::save (string path) { @@ -187,6 +106,8 @@ ThemeManager::button_press_event (GdkEventButton* ev) TreeViewColumn* column; int cellx; int celly; + + ARDOUR::ConfigVariable *ccvar; if (!color_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { return false; @@ -200,11 +121,16 @@ ThemeManager::button_press_event (GdkEventButton* ev) 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; + 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_current_color (color); + color_dialog.get_colorsel()->set_previous_color (color); + color_dialog.get_colorsel()->set_current_alpha (a * 256); + color_dialog.get_colorsel()->set_previous_alpha (a * 256); ResponseType result = (ResponseType) color_dialog.run(); switch (result) { @@ -218,13 +144,15 @@ ThemeManager::button_press_event (GdkEventButton* ev) b = (int) floor (color.get_blue_p() * 255.0); rgba = RGBA_TO_UINT(r,g,b,a); - + cerr << (*iter)[columns.name] << " == " << hex << rgba << endl; (*iter)[columns.rgba] = rgba; (*iter)[columns.gdkcolor] = color; - color_map[edit_color_id] = rgba; + ccvar = (*iter)[columns.pVar]; + ccvar->set(rgba); - ColorChanged (edit_color_id, rgba); + //ColorChanged (rgba); + ColorsChanged();//EMIT SIGNAL break; default: @@ -260,12 +188,34 @@ ThemeManager::load_rc(int which) ThemeChanged(find_config_file(Config->get_ui_rc_file())); //EMIT SIGNAL cerr << "load_rc() called " << find_config_file(Config->get_ui_rc_file()) << endl; + } void -ThemeManager::setup_theme_buttons () +ThemeManager::setup_theme () { + int r, g, b, a; + for (std::vector *>::iterator i = Config->canvas_colors.begin(); i != 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; + + //cerr << (*i)->name() << " == " << rgba << endl; + } + cerr << "ThemeManager::setup_theme () called" << endl; + ColorsChanged(); //EMIT SIGNAL + if (getenv ("ARDOUR2_UI_RC")) { return; } @@ -275,5 +225,6 @@ ThemeManager::setup_theme_buttons () } else if (Config->get_ui_rc_file() == "ardour2_ui_light.rc") { light_button.set_active(); } + } diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h index 8bb8fa9fce..a8a70b6c9a 100644 --- a/gtk2_ardour/theme_manager.h +++ b/gtk2_ardour/theme_manager.h @@ -26,8 +26,8 @@ #include #include #include +#include #include "ardour_dialog.h" -#include "color.h" class ThemeManager : public ArdourDialog @@ -36,10 +36,9 @@ class ThemeManager : public ArdourDialog ThemeManager(); ~ThemeManager(); - int load (std::string path); int save (std::string path); void load_rc (int which); - void setup_theme_buttons (); + void setup_theme (); private: struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { @@ -47,14 +46,14 @@ class ThemeManager : public ArdourDialog add (name); add (color); add (gdkcolor); - add (id); + add (pVar); add (rgba); } Gtk::TreeModelColumn name; Gtk::TreeModelColumn color; Gtk::TreeModelColumn gdkcolor; - Gtk::TreeModelColumn id; + Gtk::TreeModelColumn *> pVar; Gtk::TreeModelColumn rgba; }; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 63ff062268..b2121b26fb 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -152,7 +152,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() @@ -787,20 +787,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() = Config->canvasvar_SelectionRect.get(); + rect->rect->property_outline_color_rgba() = Config->canvasvar_Selection.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() = Config->canvasvar_Selection.get(); + rect->start_trim->property_outline_color_rgba() = 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() = Config->canvasvar_Selection.get(); + rect->end_trim->property_outline_color_rgba() = Config->canvasvar_Selection.get(); free_selection_rects.push_front (rect); @@ -1056,23 +1056,31 @@ 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::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) { + + (*i)->rect->property_fill_color_rgba() = Config->canvasvar_SelectionRect.get(); + (*i)->rect->property_outline_color_rgba() = Config->canvasvar_Selection.get(); + + (*i)->start_trim->property_fill_color_rgba() = Config->canvasvar_Selection.get(); + (*i)->start_trim->property_outline_color_rgba() = Config->canvasvar_Selection.get(); + + (*i)->end_trim->property_fill_color_rgba() = Config->canvasvar_Selection.get(); + (*i)->end_trim->property_outline_color_rgba() = Config->canvasvar_Selection.get(); + } + + for (list::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) { + + (*i)->rect->property_fill_color_rgba() = Config->canvasvar_SelectionRect.get(); + (*i)->rect->property_outline_color_rgba() = Config->canvasvar_Selection.get(); + + (*i)->start_trim->property_fill_color_rgba() = Config->canvasvar_Selection.get(); + (*i)->start_trim->property_outline_color_rgba() = Config->canvasvar_Selection.get(); + + (*i)->end_trim->property_fill_color_rgba() = Config->canvasvar_Selection.get(); + (*i)->end_trim->property_outline_color_rgba() = Config->canvasvar_Selection.get(); } } diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 1f401967eb..299971f1ee 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -305,7 +305,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 */ diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 0e66ab2bae..b5c85f9b13 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -39,6 +39,7 @@ using namespace std; using namespace Editing; using namespace Glib; using namespace PBD; +using namespace ARDOUR; //------------------------------------------------------------------------------ /** Initialize const static memeber data */ @@ -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; + // why? fill_opacity = 60; 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() = Config->canvasvar_VestigialFrame.get(); + vestigial_frame->property_fill_color_rgba() = 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() = Config->canvasvar_TimeAxisFrame.get(); + frame->property_fill_color_rgba() = 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() = Config->canvasvar_NameHighlightFill.get(); + name_highlight->property_fill_color_rgba() = 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() = Config->canvasvar_FrameHandle.get(); + frame_handle_start->property_fill_color_rgba() = 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() = Config->canvasvar_FrameHandle.get(); + frame_handle_end->property_fill_color_rgba() = Config->canvasvar_FrameHandle.get(); } else { frame_handle_start = 0; @@ -797,11 +798,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(Config->canvasvar_SelectedFrameBase.get(), &r, &g, &b, &a); + frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, a); } 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(Config->canvasvar_FrameBase.get(), &r, &g, &b, &a); + frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, a); } } } @@ -815,11 +816,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() = Config->canvasvar_TrimHandleLocked.get(); + frame_handle_end->property_fill_color_rgba() = 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() = Config->canvasvar_TrimHandle.get(); + frame_handle_end->property_fill_color_rgba() = Config->canvasvar_TrimHandle.get(); } } } diff --git a/libs/ardour/ardour/canvas_vars.h b/libs/ardour/ardour/canvas_vars.h new file mode 100644 index 0000000000..4a3c510682 --- /dev/null +++ b/libs/ardour/ardour/canvas_vars.h @@ -0,0 +1,81 @@ +CANVAS_VARIABLE(canvasvar_WaveForm, "waveform", 0x000000cc) +CANVAS_VARIABLE(canvasvar_WaveFormClip, "clipped aveform", 0xff0000e5) +CANVAS_VARIABLE(canvasvar_FrameBase, "region base", 0xbfbfc1ff) +CANVAS_VARIABLE(canvasvar_SelectedFrameBase, "selected region base", 0xb591a8ff) +CANVAS_VARIABLE(canvasvar_AudioTrackBase, "audio track base", 0xc6d3d868) +CANVAS_VARIABLE(canvasvar_AudioBusBase, "audio bus base", 0xdbd1ea68) +CANVAS_VARIABLE(canvasvar_MidiTrackBase, "midi track base", 0x00000033) +CANVAS_VARIABLE(canvasvar_MidiBusBase, "midi bus base", 0xff0000ee) +CANVAS_VARIABLE(canvasvar_TimeStretchFill, "time-stretch-fill", 0xe2b5b596) +CANVAS_VARIABLE(canvasvar_TimeStretchOutline, "time-stretch-outline", 0x63636396) +CANVAS_VARIABLE(canvasvar_AutomationLine, "automation line", 0x44bc59ff) +CANVAS_VARIABLE(canvasvar_RedirectAutomationLine, "redirect automation line", 0x7aa3f9ff) +CANVAS_VARIABLE(canvasvar_ControlPointFill, "control point fill", 0x000000ff) +CANVAS_VARIABLE(canvasvar_ControlPointOutline, "control point outline", 0x000000ff) +CANVAS_VARIABLE(canvasvar_EnteredControlPointOutline, "entered control point outline", 0xff0000ee) +CANVAS_VARIABLE(canvasvar_EnteredControlPointSelected, "entered control point selected", 0xff3535ff) +CANVAS_VARIABLE(canvasvar_EnteredControlPoint, "entered control point", 0x000000cc) +CANVAS_VARIABLE(canvasvar_ControlPointSelected, "control point selected", 0x00ff00ff) +CANVAS_VARIABLE(canvasvar_ControlPoint, "control point", 0xff0000ff) +CANVAS_VARIABLE(canvasvar_AutomationTrackFill, "automation track fill", 0xa0a0ce68) +CANVAS_VARIABLE(canvasvar_AutomationTrackOutline, "automation track outline", 0x282828ff) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorBase, "crossfade editor base", 0x282d49ff) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorLine, "crossfade editor line", 0x000000ff) +CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorLine, "selected crossfade editor line", 0x00dbdbff) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorLineShading, "crossfade editor line shading", 0x00a0d154) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorPointFill, "crossfade editor point fill", 0x00ff00ff) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorPointOutline, "crossfade editor point outline", 0x0000ffff) +CANVAS_VARIABLE(canvasvar_CrossfadeEditorWave, "crossfade editor wave", 0xffffff28) +CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorWave, "selected crossfade editor wave", 0xf9ea14a0) +CANVAS_VARIABLE(canvasvar_CrossfadeLine, "crossfade line", 0x000000ff) +CANVAS_VARIABLE(canvasvar_ActiveCrossfade, "active crossfade", 0xe8ed3d77) +CANVAS_VARIABLE(canvasvar_InactiveCrossfade, "inactive crossfade", 0xe8ed3d77) +CANVAS_VARIABLE(canvasvar_LocationMarker, "location marker", 0xc4f411ff) +CANVAS_VARIABLE(canvasvar_LocationRange, "location range", 0x497a59ff) +CANVAS_VARIABLE(canvasvar_LocationCDMarker, "location cd marker", 0x1ee8c4ff) +CANVAS_VARIABLE(canvasvar_LocationLoop, "location loop", 0x35964fff) +CANVAS_VARIABLE(canvasvar_LocationPunch, "location punch", 0x7c3a3aff) +CANVAS_VARIABLE(canvasvar_VerboseCanvasCursor, "verbose canvas cursor", 0xf4f214bc) +CANVAS_VARIABLE(canvasvar_MarkerLabel, "marker label", 0xc4f411ff) +CANVAS_VARIABLE(canvasvar_TempoBar, "tempo bar", 0x72727fff) +CANVAS_VARIABLE(canvasvar_MeterBar, "meterbar", 0x666672ff) +CANVAS_VARIABLE(canvasvar_MarkerBar, "markerbar", 0x7f7f8cff) +CANVAS_VARIABLE(canvasvar_RangeMarkerBar, "rangemarker bar", 0x8c8c96ff) +CANVAS_VARIABLE(canvasvar_TransportMarkerBar, "TransportMarkerBar", 0x9898a3ff) +CANVAS_VARIABLE(canvasvar_RangeDragBarRect, "RangeDragBarRect", 0x969696c6) +CANVAS_VARIABLE(canvasvar_RangeDragRect, "RangeDragRect", 0x82c696c6) +CANVAS_VARIABLE(canvasvar_TransportDragRect, "TransportDragRect", 0x969696c6) +CANVAS_VARIABLE(canvasvar_MarkerDragLine, "MarkerDragLine", 0x004f00f9) +CANVAS_VARIABLE(canvasvar_TransportLoopRect, "TransportLoopRect", 0x1e7728f9) +CANVAS_VARIABLE(canvasvar_TransportPunchRect, "TransportPunchRect", 0x6d2828e5) +CANVAS_VARIABLE(canvasvar_PunchLine, "PunchLine", 0xa80000ff) +CANVAS_VARIABLE(canvasvar_ZoomRect, "ZoomRect", 0xc6d1b26d) +CANVAS_VARIABLE(canvasvar_RubberBandRect, "RubberBandRect", 0xc6c6c659) +CANVAS_VARIABLE(canvasvar_EnteredGainLine, "EnteredGainLine", 0xdd6363ff) +CANVAS_VARIABLE(canvasvar_EnteredAutomationLine, "EnteredAutomationLine", 0xdd6363ff) +CANVAS_VARIABLE(canvasvar_EnteredMarker, "EnteredMarker", 0xdd6363ff) +CANVAS_VARIABLE(canvasvar_MeterMarker, "MeterMarker", 0xf2425bff) +CANVAS_VARIABLE(canvasvar_TempoMarker, "TempoMarker", 0xf2425bff) +CANVAS_VARIABLE(canvasvar_MeasureLineBeat, "MeasureLineBeat", 0x72727266) +CANVAS_VARIABLE(canvasvar_MeasureLineBar, "MeasureLineBar", 0x8c8c988c) +CANVAS_VARIABLE(canvasvar_GhostTrackBase, "GhostTrackBase", 0x44007c7f) +CANVAS_VARIABLE(canvasvar_GhostTrackWave, "GhostTrackWave", 0x02fd004c) +CANVAS_VARIABLE(canvasvar_GhostTrackWaveClip, "GhostTrackWaveClip", 0xff000000) +CANVAS_VARIABLE(canvasvar_GhostTrackZeroLine, "GhostTrackZeroLine", 0xe500e566) +CANVAS_VARIABLE(canvasvar_ImageTrack, "ImageTrack", 0xddddd8ff) +CANVAS_VARIABLE(canvasvar_MarkerTrack, "MarkerTrack", 0xddddd8ff) +CANVAS_VARIABLE(canvasvar_ZeroLine, "ZeroLine", 0xb5b5b5ff) +CANVAS_VARIABLE(canvasvar_GainLine, "GainLine", 0xff00ff00) +CANVAS_VARIABLE(canvasvar_GainLineInactive, "GainLineInactive", 0xf0f0fff) +CANVAS_VARIABLE(canvasvar_RecordingRect, "RecordingRect", 0xe5c6c6ff) +CANVAS_VARIABLE(canvasvar_SelectionRect, "SelectionRect", 0xe8f4d377) +CANVAS_VARIABLE(canvasvar_Selection, "Selection", 0x636363b2) +CANVAS_VARIABLE(canvasvar_VestigialFrame, "VestigialFrame", 0x44007c0f) +CANVAS_VARIABLE(canvasvar_TimeAxisFrame, "TimeAxisFrame", 0x44007c0f) +CANVAS_VARIABLE(canvasvar_NameHighlightFill, "NameHighlightFill", 0x0000ffff) +CANVAS_VARIABLE(canvasvar_NameHighlightOutline, "NameHighlightOutline", 0x7c00ff96) +CANVAS_VARIABLE(canvasvar_FrameHandle, "FrameHandle", 0x7c00ff96) +CANVAS_VARIABLE(canvasvar_TrimHandleLocked, "TrimHandleLocked", 0xea0f0f28) +CANVAS_VARIABLE(canvasvar_TrimHandle, "TrimHandle", 0x1900ff44) +CANVAS_VARIABLE(canvasvar_EditCursor, "EditCursor", 0x0000ffff) +CANVAS_VARIABLE(canvasvar_PlayHead, "PlayHead", 0xff0000ff) diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 31cb74ab33..ecc5494690 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -54,6 +54,8 @@ class Configuration : public Stateful std::map midi_ports; + std::vector *> canvas_colors; + void map_parameters (sigc::slot theSlot); int load_state (); @@ -61,8 +63,9 @@ class Configuration : public Stateful int set_state (const XMLNode&); XMLNode& get_state (void); - XMLNode& get_variables (sigc::slot); + XMLNode& get_variables (sigc::slot, std::string which_node = "Config"); void set_variables (const XMLNode&, ConfigVariableBase::Owner owner); + void pack_canvasvars (); void set_current_owner (ConfigVariableBase::Owner); @@ -83,7 +86,12 @@ class Configuration : public Stateful #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - + +#undef CANVAS_VARIABLE +#define CANVAS_VARIABLE(var,name,value) ConfigVariable var; // <-- is this really so bad? +#include "ardour/canvas_vars.h" +#undef CANVAS_VARIABLE + private: /* declare variables */ diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index fa149672be..fa6701250a 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -65,7 +65,7 @@ class ConfigVariable : public ConfigVariableBase ConfigVariable (std::string str) : ConfigVariableBase (str) {} ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {} - virtual bool set (T val, Owner owner) { + virtual bool set (T val, Owner owner = ARDOUR::ConfigVariableBase::Config) { if (val == value) { miss (); return false; @@ -92,7 +92,7 @@ class ConfigVariable : public ConfigVariableBase bool set_from_node (const XMLNode& node, Owner owner) { - if (node.name() == "Config") { + if (node.name() == "Config" || node.name() == "Canvas") { /* ardour.rc */ diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 8ba9830841..b78421b48f 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -160,3 +160,4 @@ CONFIG_VARIABLE (string, bwf_organization_code, "bwf-organization-code", "US") /* these variables have custom set() methods (e.g. path globbing) */ CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand) + diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index c8d71c5155..58d702e3d9 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -51,7 +51,12 @@ Configuration::Configuration () #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator), #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL + +#undef CANVAS_VARIABLE +#define CANVAS_VARIABLE(var,name,value) var (name,value), // <-- is this really so bad? +#include "ardour/canvas_vars.h" +#undef CANVAS_VARIABLE current_owner (ConfigVariableBase::Default) { @@ -120,6 +125,7 @@ Configuration::load_state () } } + pack_canvasvars(); return 0; } @@ -162,7 +168,8 @@ Configuration::get_state () root->add_child_nocopy(m->second->get_state()); } - root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate))); + root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate), "Config")); + root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate), "Canvas")); if (_extra_xml) { root->add_child_copy (*_extra_xml); @@ -174,23 +181,28 @@ Configuration::get_state () } XMLNode& -Configuration::get_variables (sigc::slot predicate) +Configuration::get_variables (sigc::slot predicate, std::string which_node) { XMLNode* node; LocaleGuard lg (X_("POSIX")); - node = new XMLNode("Config"); + node = new XMLNode(which_node); #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL -#define CONFIG_VARIABLE(type,var,name,value) \ - if (predicate (var.owner())) { var.add_to_node (*node); } -#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \ - if (predicate (var.owner())) { var.add_to_node (*node); } +#define CONFIG_VARIABLE(type,var,Name,value) \ + if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }} +#define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \ + if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }} #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - + +#undef CANVAS_VARIABLE +#define CANVAS_VARIABLE(var,Name,value) if (node->name() == "Canvas") { if (predicate (ConfigVariableBase::Config)) { var.add_to_node (*node); }} +#include "ardour/canvas_vars.h" +#undef CANVAS_VARIABLE + return *node; } @@ -222,7 +234,7 @@ Configuration::set_state (const XMLNode& root) warning << _("ill-formed MIDI port specification in ardour rcfile (ignored)") << endmsg; } - } else if (node->name() == "Config") { + } else if (node->name() == "Config" || node->name() == "Canvas" ) { set_variables (*node, ConfigVariableBase::Config); @@ -252,10 +264,30 @@ Configuration::set_variables (const XMLNode& node, ConfigVariableBase::Owner own if (var.set_from_node (node, owner)) { \ ParameterChanged (name); \ } + #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL +#undef CANVAS_VARIABLE +#define CANVAS_VARIABLE(var,name,value) \ + if (var.set_from_node (node, owner)) { \ + ParameterChanged (name); \ + } +#include "ardour/canvas_vars.h" +#undef CANVAS_VARIABLE + +} + +void +Configuration::pack_canvasvars () +{ +#undef CANVAS_VARIABLE +#define CANVAS_VARIABLE(var,name,value) canvas_colors.push_back(&var); +#include "ardour/canvas_vars.h" +#undef CANVAS_VARIABLE + cerr << "Configuration::pack_canvasvars () called, canvas_colors.size() = " << canvas_colors.size() << endl; + } Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node) -- cgit v1.2.3