mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Update color stripable color-picker(s)
* consistent behavior (Route, VCA) * non-modal * a single color picker for each RouteUI/VCA at most * fix bug: VCA picker staying around even when VCA was deleted
This commit is contained in:
parent
7a709f23f1
commit
05dfc1fdc1
7 changed files with 123 additions and 33 deletions
|
|
@ -243,6 +243,8 @@ RouteUI::reset ()
|
||||||
delete mute_menu;
|
delete mute_menu;
|
||||||
mute_menu = 0;
|
mute_menu = 0;
|
||||||
|
|
||||||
|
_color_picker.reset ();
|
||||||
|
|
||||||
denormal_menu_item = 0;
|
denormal_menu_item = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1604,13 +1606,7 @@ RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check)
|
||||||
void
|
void
|
||||||
RouteUI::choose_color ()
|
RouteUI::choose_color ()
|
||||||
{
|
{
|
||||||
bool picked;
|
_color_picker.popup (_route);
|
||||||
Gdk::Color c (gdk_color_from_rgba (_route->presentation_info().color()));
|
|
||||||
Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &c);
|
|
||||||
|
|
||||||
if (picked) {
|
|
||||||
set_color (gdk_color_to_rgba (color));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the route's own color. This may not be used for display if
|
/** Set the route's own color. This may not be used for display if
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include <gtkmm/textview.h>
|
#include <gtkmm/textview.h>
|
||||||
|
#include <gtkmm/colorselection.h>
|
||||||
|
|
||||||
#include "gtkmm2ext/widget_state.h"
|
#include "gtkmm2ext/widget_state.h"
|
||||||
|
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
|
|
||||||
#include "axis_view.h"
|
#include "axis_view.h"
|
||||||
#include "selectable.h"
|
#include "selectable.h"
|
||||||
|
#include "stripable_colorpicker.h"
|
||||||
#include "window_manager.h"
|
#include "window_manager.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
@ -336,6 +338,8 @@ private:
|
||||||
std::vector<ArdourButton*> _invert_buttons;
|
std::vector<ArdourButton*> _invert_buttons;
|
||||||
Gtk::Menu* _invert_menu;
|
Gtk::Menu* _invert_menu;
|
||||||
|
|
||||||
|
StripableColorDialog _color_picker;
|
||||||
|
|
||||||
static void set_showing_sends_to (boost::shared_ptr<ARDOUR::Route>);
|
static void set_showing_sends_to (boost::shared_ptr<ARDOUR::Route>);
|
||||||
static boost::weak_ptr<ARDOUR::Route> _showing_sends_to;
|
static boost::weak_ptr<ARDOUR::Route> _showing_sends_to;
|
||||||
|
|
||||||
|
|
|
||||||
71
gtk2_ardour/stripable_colorpicker.cc
Normal file
71
gtk2_ardour/stripable_colorpicker.cc
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stripable_colorpicker.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
using namespace Gtk;
|
||||||
|
using namespace ARDOUR_UI_UTILS;
|
||||||
|
|
||||||
|
StripableColorDialog::StripableColorDialog ()
|
||||||
|
{
|
||||||
|
signal_response().connect (sigc::mem_fun (*this, &StripableColorDialog::finish_color_edit));
|
||||||
|
}
|
||||||
|
|
||||||
|
StripableColorDialog::~StripableColorDialog ()
|
||||||
|
{
|
||||||
|
reset ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StripableColorDialog::reset ()
|
||||||
|
{
|
||||||
|
hide ();
|
||||||
|
_stripable.reset ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StripableColorDialog::popup (boost::shared_ptr<ARDOUR::Stripable> s)
|
||||||
|
{
|
||||||
|
if (_stripable == s) {
|
||||||
|
/* keep modified color */
|
||||||
|
present ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_stripable = s;
|
||||||
|
|
||||||
|
get_colorsel()->set_has_opacity_control (false);
|
||||||
|
get_colorsel()->set_has_palette (true);
|
||||||
|
|
||||||
|
Gdk::Color c = gdk_color_from_rgba (_stripable->presentation_info().color ());
|
||||||
|
|
||||||
|
get_colorsel()->set_previous_color (c);
|
||||||
|
get_colorsel()->set_current_color (c);
|
||||||
|
|
||||||
|
present ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StripableColorDialog::finish_color_edit (int response)
|
||||||
|
{
|
||||||
|
if (_stripable && response == RESPONSE_OK) {
|
||||||
|
_stripable->presentation_info().set_color (gdk_color_to_rgba (get_colorsel()->get_current_color()));
|
||||||
|
}
|
||||||
|
reset ();
|
||||||
|
}
|
||||||
40
gtk2_ardour/stripable_colorpicker.h
Normal file
40
gtk2_ardour/stripable_colorpicker.h
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __gtkardour_stripable_colorpicker_h__
|
||||||
|
#define __gtkardour_stripable_colorpicker_h__
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gtkmm/colorselection.h>
|
||||||
|
#include "ardour/stripable.h"
|
||||||
|
|
||||||
|
class StripableColorDialog : public Gtk::ColorSelectionDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StripableColorDialog ();
|
||||||
|
~StripableColorDialog ();
|
||||||
|
void reset ();
|
||||||
|
void popup (boost::shared_ptr<ARDOUR::Stripable> s);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void finish_color_edit (int response);
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Stripable> _stripable;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtkmm/stock.h>
|
#include <gtkmm/stock.h>
|
||||||
#include <gtkmm/colorselection.h>
|
|
||||||
|
|
||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
|
||||||
|
|
@ -526,30 +525,7 @@ VCAMasterStrip::state_id () const
|
||||||
void
|
void
|
||||||
VCAMasterStrip::start_color_edit ()
|
VCAMasterStrip::start_color_edit ()
|
||||||
{
|
{
|
||||||
Gtk::ColorSelectionDialog* color_dialog = new Gtk::ColorSelectionDialog;
|
_color_picker.popup (_vca);
|
||||||
|
|
||||||
color_dialog->get_colorsel()->set_has_opacity_control (false);
|
|
||||||
color_dialog->get_colorsel()->set_has_palette (true);
|
|
||||||
|
|
||||||
Gdk::Color c = gdk_color_from_rgba (_vca->presentation_info().color ());
|
|
||||||
|
|
||||||
color_dialog->get_colorsel()->set_previous_color (c);
|
|
||||||
color_dialog->get_colorsel()->set_current_color (c);
|
|
||||||
|
|
||||||
color_dialog->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &VCAMasterStrip::finish_color_edit), color_dialog));
|
|
||||||
color_dialog->present ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
VCAMasterStrip::finish_color_edit (int response, Gtk::ColorSelectionDialog* dialog)
|
|
||||||
{
|
|
||||||
switch (response) {
|
|
||||||
case RESPONSE_OK:
|
|
||||||
_vca->presentation_info().set_color (gdk_color_to_rgba (dialog->get_colorsel()->get_current_color()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_when_idle (dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,13 @@
|
||||||
|
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/menuitem.h>
|
#include <gtkmm/menuitem.h>
|
||||||
|
#include <gtkmm/colorselection.h>
|
||||||
|
|
||||||
#include "ardour_button.h"
|
#include "ardour_button.h"
|
||||||
#include "axis_view.h"
|
#include "axis_view.h"
|
||||||
#include "control_slave_ui.h"
|
#include "control_slave_ui.h"
|
||||||
#include "gain_meter.h"
|
#include "gain_meter.h"
|
||||||
|
#include "stripable_colorpicker.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class GainControl;
|
class GainControl;
|
||||||
|
|
@ -107,7 +109,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
|
||||||
void update_bottom_padding ();
|
void update_bottom_padding ();
|
||||||
|
|
||||||
void start_color_edit ();
|
void start_color_edit ();
|
||||||
void finish_color_edit (int, Gtk::ColorSelectionDialog*);
|
StripableColorDialog _color_picker;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ gtk2_ardour_sources = [
|
||||||
'stereo_panner_editor.cc',
|
'stereo_panner_editor.cc',
|
||||||
'streamview.cc',
|
'streamview.cc',
|
||||||
'strip_silence_dialog.cc',
|
'strip_silence_dialog.cc',
|
||||||
|
'stripable_colorpicker.cc',
|
||||||
'sys_ex.cc',
|
'sys_ex.cc',
|
||||||
'tape_region_view.cc',
|
'tape_region_view.cc',
|
||||||
'tempo_curve.cc',
|
'tempo_curve.cc',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue