summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/gui/NodeModule.cpp38
-rw-r--r--src/libs/gui/NodeModule.hpp1
2 files changed, 28 insertions, 11 deletions
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index e5f568a1..aad1c873 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -102,7 +102,7 @@ NodeModule::embed_gui(bool embed)
// FIXME: leaks?
GtkWidget* c_widget = NULL;
- Gtk::EventBox* container = NULL;
+ Gtk::Bin* container = NULL;
if (!_gui_item) {
cerr << "Embedding LV2 GUI" << endl;
@@ -115,9 +115,17 @@ NodeModule::embed_gui(bool embed)
assert(_gui);
/* Kludge, show in window to get size */
- container = new Gtk::EventBox();
+ container = new Gtk::Alignment();
container->add(*_gui);
container->show_all();
+ /*Gdk::Color color;
+ color.set_red((_color & 0xFF000000) >> 24);
+ color.set_green((_color & 0x00FF0000) >> 16);
+ color.set_blue((_color & 0xFF000000) >> 8);
+ container->modify_bg(Gtk::STATE_NORMAL, color);
+ container->modify_bg(Gtk::STATE_ACTIVE, color);
+ container->modify_bg(Gtk::STATE_PRELIGHT, color);
+ container->modify_bg(Gtk::STATE_SELECTED, color);*/
const double y = 4 + _canvas_title.property_text_height();
_gui_item = new Gnome::Canvas::Widget(*this, 2.0, y, *container);
@@ -127,22 +135,16 @@ NodeModule::embed_gui(bool embed)
if (_gui_item) {
assert(_gui);
cerr << "Created canvas item" << endl;
- _gui->show();
_gui->show_all();
_gui_item->show();
GtkRequisition r;
gtk_widget_size_request(c_widget, &r);
- cerr << "Size request: " << r.width << "x" << r.height << endl;
+ gui_size_request(&r);
- if (r.width + 4 > _width)
- set_width(r.width + 4);
-
- _height = max(_height, (double)r.height);
- _gui_item->property_width() = _width - 4;
- _gui_item->property_height() = r.height;
_gui_item->raise_to_top();
- _ports_y_offset = r.height + 2;
+
+ _gui->signal_size_request().connect(sigc::mem_fun(this, &NodeModule::gui_size_request));
} else {
cerr << "*** Failed to create canvas item" << endl;
@@ -157,6 +159,20 @@ NodeModule::embed_gui(bool embed)
resize();
}
+
+
+void
+NodeModule::gui_size_request(Gtk::Requisition* r)
+{
+ if (r->width + 4 > _width)
+ set_width(r->width + 4);
+
+ _gui_item->property_width() = _width - 4;
+ _gui_item->property_height() = r->height;
+ _ports_y_offset = r->height + 2;
+
+ resize();
+}
void
diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp
index d414ca9a..8bc1bb52 100644
--- a/src/libs/gui/NodeModule.hpp
+++ b/src/libs/gui/NodeModule.hpp
@@ -78,6 +78,7 @@ protected:
void remove_port(SharedPtr<PortModel> port);
void embed_gui(bool embed);
+ void gui_size_request(Gtk::Requisition* req);
SharedPtr<NodeModel> _node;
NodeMenu* _menu;