X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fluadialog.cc;h=80fe253f747a33ca9e001f626e84760bed5d77de;hb=95f2e4199b8f500beab4fae262715a237e14902b;hp=943b077b7721bdafc0a4566a8b14c1de7450954f;hpb=112a1ab1c42ffce4822dbb1bbe4c26c95dbce63d;p=ardour.git diff --git a/gtk2_ardour/luadialog.cc b/gtk2_ardour/luadialog.cc index 943b077b77..80fe253f74 100644 --- a/gtk2_ardour/luadialog.cc +++ b/gtk2_ardour/luadialog.cc @@ -22,13 +22,13 @@ #include "ardour/dB.h" #include "ardour/rc_configuration.h" -#include "gtk2_ardour/stripable_colorpicker.h" #include "gtkmm2ext/utils.h" #include "widgets/ardour_dropdown.h" #include "widgets/slider_controller.h" +#include "stripable_colorpicker.h" #include "ardour_dialog.h" #include "luadialog.h" #include "splash.h" @@ -40,7 +40,7 @@ using namespace LuaDialog; * Simple Message Dialog */ Message::Message (std::string const& title, std::string const& msg, Message::MessageType mt, Message::ButtonType bt) - : _message_dialog (msg, false, to_gtk_mt (mt), to_gtk_bt (bt), true) + : _message_dialog (msg, true, to_gtk_mt (mt), to_gtk_bt (bt), true) { _message_dialog.set_title (title); } @@ -188,15 +188,6 @@ public: protected: Gtk::ColorButton _cs; }; -/* -local a = { - {type = "color", key = "col", title = ""} -} - -local rv = LuaDialog.Dialog("", a):run() - -print(rv['col']) -*/ class LuaDialogCheckbox : public LuaDialogWidget { @@ -529,18 +520,13 @@ public: : LuaDialogWidget (key, title) , _fc (a) { + Gtkmm2ext::add_volume_shortcuts (_fc); 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); - } + _fc.set_filename (path); break; case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER: break; @@ -725,7 +711,14 @@ Dialog::Dialog (std::string const& title, luabridge::LuaRef lr) Gtk::Table* table = Gtk::manage (new Gtk::Table ()); table->set_col_spacings (20); table->set_row_spacings (8); - _ad.get_vbox ()->pack_start (*table); + table->signal_size_allocate ().connect (sigc::mem_fun (this, &Dialog::table_size_alloc)); + + _scroller.set_shadow_type(Gtk::SHADOW_NONE); + _scroller.set_border_width(0); + _scroller.add (*table); + _scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER); + + _ad.get_vbox ()->pack_start (_scroller); int row = 0; int last_end = -1; @@ -786,3 +779,13 @@ Dialog::run (lua_State *L) luabridge::push (L, rv); return 1; } + +void +Dialog::table_size_alloc (Gtk::Allocation& allocation) +{ + /* XXX: consider using 0.75 * screen-height instead of 512 */ + if (allocation.get_height () > 512) { + _scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + _ad.set_size_request (-1, 512); + } +}