[Summary] Allow to set waveform colour in the Preference Panel

This commit is contained in:
Nikolay 2014-12-12 11:03:16 +02:00
parent fe8c5164ec
commit 9a9f9eb878
21 changed files with 136 additions and 8 deletions

View file

@ -432,7 +432,9 @@ ARDOUR_UI::parameter_changed (std::string p)
? ArdourCanvas::WaveView::Rectified : ArdourCanvas::WaveView::Normal);
} else if (p == "show-waveform-clipping") {
ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping());
}
} else if ( p == "waveform fill" ) {
the_editor ().update_waveform_color();
}
}
void

View file

@ -1432,7 +1432,7 @@ AudioRegionView::set_some_waveform_colors (vector<ArdourCanvas::WaveView*>& wave
}
}
for (vector<ArdourCanvas::WaveView*>::iterator w = waves_to_color.begin(); w != waves_to_color.end(); ++w) {
for (vector<ArdourCanvas::WaveView*>::iterator w = waves_to_color.begin(); w != waves_to_color.end(); ++w) {
(*w)->set_fill_color (fill);
(*w)->set_outline_color (outline);
(*w)->set_clip_color (clip);

View file

@ -1227,6 +1227,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void temporal_zoom_by_slider ();
void wave_form_zoom ();
void update_temporal_zoom_slider ();
void update_waveform_color ();
void insert_region_list_selection (float times);

View file

@ -1905,6 +1905,14 @@ Editor::update_temporal_zoom_slider ()
_temporal_zoom_adjustment.set_value(value);
}
void
Editor::update_waveform_color ()
{
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->update_waveform_color ();
}
}
bool
Editor::choose_new_marker_name(string &name) {

View file

@ -284,7 +284,6 @@
95F9DFE01A35F3310007E953 /* waves_clean_up_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */; };
95F9DFE11A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */; };
95F9DFE21A35F3310007E953 /* waves_excessive_split_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFDA1A35F3310007E953 /* waves_excessive_split_dialog.xml */; };
95F9DFE31A35F3310007E953 /* waves_export_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFDB1A35F3310007E953 /* waves_export_dialog.xml */; };
95F9DFE41A35F3310007E953 /* waves_file_exists_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFDC1A35F3310007E953 /* waves_file_exists_dialog.xml */; };
95F9DFE51A35F3310007E953 /* waves_how_to_import_dialog_1.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFDD1A35F3310007E953 /* waves_how_to_import_dialog_1.xml */; };
95F9DFE61A35F3310007E953 /* waves_how_to_import_dialog_2.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFDE1A35F3310007E953 /* waves_how_to_import_dialog_2.xml */; };
@ -1145,7 +1144,6 @@
95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_clean_up_dialog.xml; sourceTree = "<group>"; };
95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_connect_to_backend_error_dialog.xml; sourceTree = "<group>"; };
95F9DFDA1A35F3310007E953 /* waves_excessive_split_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_excessive_split_dialog.xml; sourceTree = "<group>"; };
95F9DFDB1A35F3310007E953 /* waves_export_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_export_dialog.xml; sourceTree = "<group>"; };
95F9DFDC1A35F3310007E953 /* waves_file_exists_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_file_exists_dialog.xml; sourceTree = "<group>"; };
95F9DFDD1A35F3310007E953 /* waves_how_to_import_dialog_1.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_how_to_import_dialog_1.xml; sourceTree = "<group>"; };
95F9DFDE1A35F3310007E953 /* waves_how_to_import_dialog_2.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_how_to_import_dialog_2.xml; sourceTree = "<group>"; };
@ -1842,7 +1840,6 @@
95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */,
95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */,
95F9DFDA1A35F3310007E953 /* waves_excessive_split_dialog.xml */,
95F9DFDB1A35F3310007E953 /* waves_export_dialog.xml */,
95F9DFDC1A35F3310007E953 /* waves_file_exists_dialog.xml */,
95F9DFDD1A35F3310007E953 /* waves_how_to_import_dialog_1.xml */,
95F9DFDE1A35F3310007E953 /* waves_how_to_import_dialog_2.xml */,
@ -2428,7 +2425,6 @@
432793A8194F003A003C9FEA /* resize_right_cursor.png in Resources */,
432793A9194F003A003C9FEA /* resize_top_cursor.png in Resources */,
432793AA194F003A003C9FEA /* resize_top_left_cursor.png in Resources */,
95F9DFE31A35F3310007E953 /* waves_export_dialog.xml in Resources */,
432793AB194F003A003C9FEA /* resize_top_right_cursor.png in Resources */,
432793AC194F003A003C9FEA /* sae.png in Resources */,
432793AD194F003A003C9FEA /* sessionlock.png in Resources */,

View file

@ -312,6 +312,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void set_video_timeline_height (const int h) = 0;
virtual void embed_audio_from_video (std::string, framepos_t n = 0, bool lock_position_to_video = true) = 0;
virtual void export_video (bool range = false) = 0;
virtual void update_waveform_color () = 0;
virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0;

View file

@ -544,6 +544,12 @@ RegionView::set_colors ()
}
}
void
RegionView::update_color ()
{
TimeAxisViewItem::update_color ();
}
void
RegionView::set_frame_color ()
{

View file

@ -122,7 +122,8 @@ class RegionView : public TimeAxisViewItem
void hide_silent_frames ();
ARDOUR::frameoffset_t snap_frame_to_frame (ARDOUR::frameoffset_t) const;
void update_color ();
protected:
/** Allows derived types to specify their visibility requirements

View file

@ -2817,3 +2817,11 @@ RouteTimeAxisView::on_record_state_changed ()
if ( (_session->record_status()==Session::Recording) && (_route->record_enabled()) )
end_name_edit (RESPONSE_CANCEL);
}
void
RouteTimeAxisView::update_waveform_color ()
{
if (_view) {
_view->update_waveform_color ();
}
}

View file

@ -162,6 +162,7 @@ public:
PBD::Signal3<void, const PBD::ID&, const PBD::ID&, bool> relative_tracks_reorder_request;
void route_rec_enable_changed();
void update_waveform_color ();
protected:
friend class StreamView;

View file

@ -532,6 +532,14 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
}
}
void
StreamView::update_waveform_color ()
{
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
(*i)->update_color ();
}
}
/** Get selectable things within a given range.
* @param start Start time in session frames.

View file

@ -100,6 +100,7 @@ public:
void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
void set_selected_regionviews (RegionSelection&);
void update_waveform_color ();
void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);

View file

@ -1299,3 +1299,8 @@ TrackViewList::filter_to_unique_playlists ()
}
return ts;
}
void
TimeAxisView::update_waveform_color () {
}

View file

@ -205,6 +205,8 @@ class TimeAxisView : public virtual AxisView
SelectionRect* get_selection_rect(uint32_t id);
static uint32_t preset_height (Height);
virtual void update_waveform_color ();
protected:
/* The Standard LHS Controls */

View file

@ -673,6 +673,12 @@ TimeAxisViewItem::set_colors()
set_trim_handle_colors();
}
void
TimeAxisViewItem::update_color()
{
set_colors ();
}
void
TimeAxisViewItem::set_name_text_color ()
{

View file

@ -188,6 +188,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
virtual void set_colors();
virtual void set_frame_color();
virtual void update_color();
virtual void set_frame_gradient ();
void set_trim_handle_colors();

View file

@ -59,6 +59,8 @@ TracksControlPanel::TracksControlPanel ()
, _stereo_out_button(get_waves_button ("stereo_out_button"))
, _name_tracks_after_driver(get_waves_button ("name_tracks_after_driver_button"))
, _reset_tracks_name_to_default(get_waves_button ("reset_tracks_name_to_default_button"))
, _color_adjustment(get_adjustment ("color_adjustment"))
, _color_box(get_container ("color_box"))
, _obey_mmc_commands_button (get_waves_button ("obey_mmc_commands_button"))
, _send_mmc_commands_button (get_waves_button ("send_mmc_commands_button"))
, _dc_bias_against_denormals_button (get_waves_button ("dc_bias_against_denormals_button"))

View file

@ -71,6 +71,8 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
WavesButton& _browse_button;
WavesButton& _name_tracks_after_driver;
WavesButton& _reset_tracks_name_to_default;
Gtk::Adjustment& _color_adjustment;
Gtk::Container& _color_box;
WavesButton& _obey_mmc_commands_button;
WavesButton& _send_mmc_commands_button;
WavesButton& _dc_bias_against_denormals_button;

View file

@ -158,6 +158,7 @@ TracksControlPanel::init ()
populate_output_channels ();
populate_midi_ports ();
populate_default_session_path ();
display_waveform_color_fader ();
// Init session Settings
populate_bit_depth_dropdown();
@ -549,6 +550,37 @@ TracksControlPanel::populate_pre_record_buffer_dropdown()
_pre_record_buffer_dropdown.set_text( str_time );
}
#define UINT_TO_RGB(u,r,g,b) { (*(r)) = ((u)>>16)&0xff; (*(g)) = ((u)>>8)&0xff; (*(b)) = (u)&0xff; }
#define UINT_TO_RGBA(u,r,g,b,a) { UINT_TO_RGB(((u)>>8),r,g,b); (*(a)) = (u)&0xff; }
void
TracksControlPanel::display_waveform_color_fader ()
{
// get waveform color from preferences
uint32_t color_uint32 = ARDOUR_UI::config()->get_canvasvar_WaveFormFill(); // rgba
uint32_t r,g,b, a;
UINT_TO_RGBA(color_uint32, &r, &g, &b, &a);
uint32_t grey = round (0.21*r + 0.72*g + 0.07*b);
Gdk::Color color; // 8 bytes
color.set_grey_p ( (double)grey/255 );
_color_box.modify_bg (Gtk::STATE_NORMAL, color );
_color_adjustment.set_value (grey);
_color_adjustment.signal_value_changed().connect (mem_fun (*this, &TracksControlPanel::color_adjustment_changed));
}
void
TracksControlPanel::color_adjustment_changed ()
{
int grey = _color_adjustment.get_value(); // 0..255
Gdk::Color color; // 8 bytes
color.set_grey_p ( (double)grey/255 );
_color_box.modify_bg (Gtk::STATE_NORMAL, color );
}
void
TracksControlPanel::refresh_session_settings_info()
{
@ -1094,6 +1126,9 @@ TracksControlPanel::display_general_preferences ()
display_denormal_protection ();
}
#define RGB_TO_UINT(r,g,b) ((((guint)(r))<<16)|(((guint)(g))<<8)|((guint)(b)))
#define RGB_TO_RGBA(x,a) (((x) << 8) | ((((guint)a) & 0xff)))
#define RGBA_TO_UINT(r,g,b,a) RGB_TO_RGBA(RGB_TO_UINT(r,g,b), a)
void
TracksControlPanel::save_general_preferences ()
{
@ -1109,6 +1144,16 @@ TracksControlPanel::save_general_preferences ()
dbg_msg ("TracksControlPanel::general_preferences ():\nUnexpected WaveFormShape !");
break;
}
uint32_t grey = _color_adjustment.get_value();
// uint32_t color_uint32 = (value<<24)+(value<<16)+(value<<8)+255;
uint32_t color_uint32 = RGBA_TO_UINT(grey, grey, grey, 255);
// Do not change order.
ARDOUR_UI::config()->set_canvasvar_RecWaveFormFill (color_uint32);
ARDOUR_UI::config()->set_canvasvar_SelectedWaveFormFill (color_uint32);
ARDOUR_UI::config()->set_canvasvar_ZeroLine (color_uint32);
ARDOUR_UI::config()->set_canvasvar_WaveFormFill (color_uint32); // Must be the last! because it triggers waveform update in ARDOUR_UI
selected_item = _peak_hold_time_dropdown.get_current_item ();
switch (selected_item) {
@ -1722,7 +1767,9 @@ TracksControlPanel::on_parameter_changed (const std::string& parameter_name)
display_history_depth ();
} else if (parameter_name == "save-history-depth") {
display_saved_history_depth ();
}
} else if (parameter_name == "waveform fill") {
display_waveform_color_fader ();
}
}
void

View file

@ -96,6 +96,8 @@
void populate_output_channels();
void populate_midi_ports();
void populate_default_session_path();
void display_waveform_color_fader();
void color_adjustment_changed();
// Session Settings
void populate_file_type_dropdown();

View file

@ -864,6 +864,34 @@
data="1"/>
</DropdownMenu>
</Dropdown>
</HBox>
<HBox>
<Label style="parameter_label"
text="Waveform Color"
horzalignment="end"/>
<VBox style="parameter_spacing"/>
<Adjustment id="color_adjustment"
minvalue="0"
maxvalue="255"
initialvalue="255"
step="1"
pageincrement="1"/>
<Fader id="color_fader"
adjustment="color_adjustment"
facesource="horizontal_zoom_fader_face.png"
handlesource="zoom_fader_handle.png"
activehandlesource="zoom_fader_handle_active.png"
x="1"
y="1"
minposx="20"
minposy="13"
maxposx="66"
maxposy="13"/>
<VBox width="10"/>
<EventBox id="color_box"
width="20"
height="10"
bgnormal="#ffffff"/>
</HBox>
<HBox>
<Label style="parameter_label"