summaryrefslogtreecommitdiff
path: root/gtk2_ardour/luadialog.cc
diff options
context:
space:
mode:
authorNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-04-03 15:38:54 -0500
committerNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-06-01 09:55:25 -0500
commit112a1ab1c42ffce4822dbb1bbe4c26c95dbce63d (patch)
tree426978e57da05e8872032ccd7939e47280d98e8f /gtk2_ardour/luadialog.cc
parent37fe6b8ba1f0714d362f337b2fd3a63739d41fc1 (diff)
add Gtk::ColorButton widget to LuaDialog and add ability to change multiple route colors at a time
Diffstat (limited to 'gtk2_ardour/luadialog.cc')
-rw-r--r--gtk2_ardour/luadialog.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk2_ardour/luadialog.cc b/gtk2_ardour/luadialog.cc
index 90464d26af..943b077b77 100644
--- a/gtk2_ardour/luadialog.cc
+++ b/gtk2_ardour/luadialog.cc
@@ -22,6 +22,7 @@
#include "ardour/dB.h"
#include "ardour/rc_configuration.h"
+#include "gtk2_ardour/stripable_colorpicker.h"
#include "gtkmm2ext/utils.h"
@@ -169,6 +170,34 @@ protected:
Gtk::HSeparator _sep;
};
+class LuaColorPicker : public LuaDialogWidget
+{
+public:
+ LuaColorPicker (std::string const& key)
+ : LuaDialogWidget (key, "", 0, 1)
+ {}
+
+ Gtk::Widget* widget ()
+ {
+ return &_cs;
+ }
+ void assign (luabridge::LuaRef* rv) const {
+ uint32_t rgba = ARDOUR_UI_UTILS::gdk_color_to_rgba(_cs.get_color());
+ (*rv)[_key] = rgba;
+ }
+protected:
+ Gtk::ColorButton _cs;
+};
+/*
+local a = {
+ {type = "color", key = "col", title = ""}
+}
+
+local rv = LuaDialog.Dialog("", a):run()
+
+print(rv['col'])
+*/
+
class LuaDialogCheckbox : public LuaDialogWidget
{
public:
@@ -675,6 +704,8 @@ Dialog::Dialog (std::string const& title, luabridge::LuaRef lr)
path = i.value ()["path"].cast<std::string> ();
}
w = new LuaFileChooser (key, title, Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, path);
+ } else if (type == "color") {
+ w = new LuaColorPicker (key);
}
if (w) {