summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-08-02 15:17:38 +0200
committerRobin Gareus <robin@gareus.org>2018-08-02 15:17:38 +0200
commit77d1982d1d6e22d1369d078790a84a7d525331af (patch)
tree64aaa36dce5486edc780a16062864c9585f1e76c /gtk2_ardour
parent5006c731c7fe28763ee0ef3223ef3430b5ea412e (diff)
Add scrollbar to LuaDialog
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/luadialog.cc19
-rw-r--r--gtk2_ardour/luadialog.h3
2 files changed, 21 insertions, 1 deletions
diff --git a/gtk2_ardour/luadialog.cc b/gtk2_ardour/luadialog.cc
index d1383f505e..5932b234df 100644
--- a/gtk2_ardour/luadialog.cc
+++ b/gtk2_ardour/luadialog.cc
@@ -710,7 +710,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;
@@ -771,3 +778,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);
+ }
+}
diff --git a/gtk2_ardour/luadialog.h b/gtk2_ardour/luadialog.h
index a022a8b6f6..f0bacdc387 100644
--- a/gtk2_ardour/luadialog.h
+++ b/gtk2_ardour/luadialog.h
@@ -89,7 +89,10 @@ public:
private:
Dialog (Dialog const&); // prevent copy construction
+ void table_size_alloc (Gtk::Allocation&);
+
ArdourDialog _ad;
+ Gtk::ScrolledWindow _scroller;
typedef std::vector<LuaDialogWidget*> DialogWidgets;
DialogWidgets _widgets;
std::string _title;