#include "ardour/dB.h"
#include "ardour/rc_configuration.h"
-#include "gtkmm2ext/slider_controller.h"
#include "gtkmm2ext/utils.h"
+#include "widgets/ardour_dropdown.h"
+#include "widgets/slider_controller.h"
+
#include "ardour_dialog.h"
-#include "ardour_dropdown.h"
#include "luadialog.h"
#include "utils.h"
: LuaDialogWidget (key, title)
, _db_adjustment (ARDOUR::gain_to_slider_position_with_max (1.0, ARDOUR::Config->get_max_gain ()), 0, 1, 0.01, 0.1)
{
- _db_slider = Gtk::manage (new Gtkmm2ext::HSliderController (&_db_adjustment, boost::shared_ptr<PBD::Controllable> (), 220, 18));
+ _db_slider = Gtk::manage (new ArdourWidgets::HSliderController (&_db_adjustment, boost::shared_ptr<PBD::Controllable> (), 220, 18));
_fader_centering_box.pack_start (*_db_slider, true, false);
}
Gtk::Adjustment _db_adjustment;
- Gtkmm2ext::HSliderController* _db_slider;
+ ArdourWidgets::HSliderController* _db_slider;
Gtk::Entry _db_display;
Gtk::HBox _box;
Gtk::VBox _fader_centering_box;
_rv = rv;
}
- ArdourDropdown _dd;
+ ArdourWidgets::ArdourDropdown _dd;
std::vector<luabridge::LuaRef*> _refs;
luabridge::LuaRef* _rv;
};
+class LuaFileChooser : public LuaDialogWidget
+{
+public:
+ LuaFileChooser (std::string const& key, std::string const& title, Gtk::FileChooserAction a, const std::string& path)
+ : LuaDialogWidget (key, title)
+ , _fc (a)
+ {
+ if (!path.empty ()) {
+ switch (a) {
+ case Gtk::FILE_CHOOSER_ACTION_OPEN:
+ case Gtk::FILE_CHOOSER_ACTION_SAVE:
+ if (Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR|Glib::FILE_TEST_EXISTS)) {
+ _fc.set_filename (path);
+ }
+ break;
+ case Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER:
+ if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) {
+ _fc.set_filename (path);
+ }
+ break;
+ case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER:
+ break;
+ }
+ }
+ }
+
+ Gtk::Widget* widget ()
+ {
+ return &_fc;
+ }
+
+ void assign (luabridge::LuaRef* rv) const
+ {
+ (*rv)[_key] = std::string (_fc.get_filename ());
+ }
+
+protected:
+ Gtk::FileChooserButton _fc;
+};
+
+
/*******************************************************************************
* Lua Parameter Dialog
dflt = i.value ()["default"].cast<std::string> ();
}
_widgets.push_back (new LuaDialogDropDown (key, title, i.value ()["values"], dflt));
+ } else if (type == "file") {
+ std::string path;
+ if (i.value ()["path"].isString ()) {
+ path = i.value ()["path"].cast<std::string> ();
+ }
+ _widgets.push_back (new LuaFileChooser (key, title, Gtk::FILE_CHOOSER_ACTION_OPEN, path));
+ } else if (type == "folder") {
+ std::string path;
+ if (i.value ()["path"].isString ()) {
+ path = i.value ()["path"].cast<std::string> ();
+ }
+ _widgets.push_back (new LuaFileChooser (key, title, Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, path));
}
}
case Gtk::RESPONSE_ACCEPT:
break;
default:
- lua_pushnil (L);
+ lua_pushnil (L);
return 1;
}