summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-06-23 19:41:58 +0000
committerDavid Robillard <d@drobilla.net>2008-06-23 19:41:58 +0000
commit11148a825b0363908ed18427e99392fc7047f747 (patch)
tree6e4e416bc60465e62311451a5d893a0abdc7df9d /src
parentc2af33c189d0e9c2c957f9e73d7995302faf7df9 (diff)
downloadingen-11148a825b0363908ed18427e99392fc7047f747.tar.gz
ingen-11148a825b0363908ed18427e99392fc7047f747.tar.bz2
ingen-11148a825b0363908ed18427e99392fc7047f747.zip
Move widget embedding down to FlowCanvas.
git-svn-id: http://svn.drobilla.net/lad/ingen@1274 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/OSCClientReceiver.cpp2
-rw-r--r--src/libs/engine/JackAudioDriver.hpp6
-rw-r--r--src/libs/engine/QueuedEventSource.cpp2
-rw-r--r--src/libs/engine/QueuedEventSource.hpp16
-rw-r--r--src/libs/gui/NodeModule.cpp102
-rw-r--r--src/libs/gui/NodeModule.hpp8
6 files changed, 42 insertions, 94 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 3f5447d0..8cad1754 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -35,7 +35,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port)
, _listen_port(listen_port)
, _st(NULL)
{
- start(false); // true = dump, false = shutup
+ start(true); // true = dump, false = shutup
}
diff --git a/src/libs/engine/JackAudioDriver.hpp b/src/libs/engine/JackAudioDriver.hpp
index 3beb775a..facdb580 100644
--- a/src/libs/engine/JackAudioDriver.hpp
+++ b/src/libs/engine/JackAudioDriver.hpp
@@ -108,7 +108,11 @@ public:
SampleCount sample_rate() const { return _sample_rate; }
bool is_activated() const { return _is_activated; }
- inline SampleCount frame_time() const { return jack_frame_time(_client); }
+ inline SampleCount frame_time() const {
+ const SampleCount t = jack_frame_time(_client);
+ std::cerr << "Frame time: " << t << std::endl;
+ return t;
+ }
class PortRegistrationFailedException : public std::exception {};
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 4b63b6c4..690397ae 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -62,6 +62,8 @@ QueuedEventSource::push_queued(QueuedEvent* const ev)
{
assert(!ev->is_prepared());
+ cerr << "[QueuedEventSource] Pushing queued @ " << ev->time() << endl;
+
if (_events[_back] != NULL) {
cerr << "[QueuedEventSource] Error: Queue is full! Event is lost, please report!" << endl;
delete ev;
diff --git a/src/libs/engine/QueuedEventSource.hpp b/src/libs/engine/QueuedEventSource.hpp
index 4c23f226..df3c74a7 100644
--- a/src/libs/engine/QueuedEventSource.hpp
+++ b/src/libs/engine/QueuedEventSource.hpp
@@ -58,7 +58,9 @@ public:
protected:
void push_queued(QueuedEvent* const ev);
- inline void push_stamped(Event* const ev) { _stamped_queue.push(ev); }
+ inline void push_stamped(Event* const ev) {
+ std::cerr << "[QueuedEventSource] Pushing stamped @ " << ev->time() << std::endl;
+ _stamped_queue.push(ev); }
Event* pop_earliest_queued_before(const SampleCount time);
inline Event* pop_earliest_stamped_before(const SampleCount time);
@@ -96,9 +98,15 @@ QueuedEventSource::pop_earliest_stamped_before(const SampleCount time)
{
Event* ret = NULL;
- if (!_stamped_queue.empty() && _stamped_queue.front()->time() < time) {
- ret = _stamped_queue.front();
- _stamped_queue.pop();
+ if (!_stamped_queue.empty()) {
+ if (_stamped_queue.front()->time() < time) {
+ ret = _stamped_queue.front();
+ std::cerr << "[QueuedEventSource] Popping event @ " << _stamped_queue.front()->time() << std::endl;
+ _stamped_queue.pop();
+ } else {
+ std::cerr << "[QueuedEventSource] Next event is past " << time
+ << " (@ " << _stamped_queue.front()->time() << ")" << std::endl;
+ }
}
return ret;
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 40103a65..e2caa521 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -40,11 +40,7 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
: FlowCanvas::Module(canvas, node->path().name())
, _node(node)
, _gui_widget(NULL)
- , _gui_container(NULL)
- , _gui_item(NULL)
, _gui_window(NULL)
- , _last_gui_request_width(0)
- , _last_gui_request_height(0)
{
assert(_node);
@@ -129,76 +125,46 @@ NodeModule::embed_gui(bool embed)
cerr << "LV2 GUI already popped up, cannot embed" << endl;
return;
}
-
- GtkWidget* c_widget = NULL;
-
- if (!_gui_item) {
-
- const PluginModel* const plugin = dynamic_cast<const PluginModel*>(_node->plugin());
- assert(plugin);
-
- _plugin_ui = plugin->ui(App::instance().world(), _node);
- if (_plugin_ui) {
- c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance());
- _gui_widget = Glib::wrap(c_widget);
- assert(_gui_widget);
-
- if (_gui_container)
- delete _gui_container;
-
- _gui_container = manage(new Gtk::EventBox());
- _gui_container->set_name("ingen_embedded_node_gui_container");
- _gui_container->set_border_width(2);
- _gui_container->add(*_gui_widget);
- _gui_container->show_all();
-
- const double y = 4 + _canvas_title.property_text_height();
- _gui_item = new Gnome::Canvas::Widget(*this, 2.0, y, *_gui_container);
- }
+ if (!_plugin_ui) {
+ const PluginModel* const pm = dynamic_cast<const PluginModel*>(_node->plugin());
+ assert(pm);
+ _plugin_ui = pm->ui(App::instance().world(), _node);
}
- if (_gui_item) {
-
+ if (_plugin_ui) {
+ GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance());
+ _gui_widget = Glib::wrap(c_widget);
assert(_gui_widget);
- _gui_widget->show_all();
- _gui_item->show();
- Gtk::Requisition r = _gui_container->size_request();
- gui_size_request(&r, true);
+ Gtk::Container* container = new Gtk::EventBox();
+ container->set_name("ingen_embedded_node_gui_container");
+ container->add(*_gui_widget);
+ FlowCanvas::Module::embed(container);
+ } else {
+ cerr << "ERROR: Failed to create LV2 UI" << endl;
+ }
- _gui_item->raise_to_top();
+ if (_gui_widget) {
+ _gui_widget->show_all();
- _gui_container->signal_size_request().connect(sigc::bind(
- sigc::mem_fun(this, &NodeModule::gui_size_request), false));
-
- for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
+ for (PortModelList::const_iterator p = _node->ports().begin();
+ p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
App::instance().engine()->enable_port_broadcasting((*p)->path());
-
- } else {
- cerr << "ERROR: Failed to create canvas item for LV2 UI" << endl;
}
} else { // un-embed
- if (_gui_item) {
- delete _gui_item;
- _gui_item = NULL;
- _gui_container = NULL; // managed
- _gui_widget = NULL; // managed
- _plugin_ui.reset();
- }
-
- _ports_y_offset = 0;
- _minimum_width = 0; // resize() takes care of it..
+ FlowCanvas::Module::embed(NULL);
+ _plugin_ui.reset();
for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
App::instance().engine()->disable_port_broadcasting((*p)->path());
}
- if (embed && _gui_item) {
+ if (embed && _embed_item) {
initialise_gui_values();
set_base_color(0x212222FF);
} else {
@@ -210,32 +176,6 @@ NodeModule::embed_gui(bool embed)
void
-NodeModule::gui_size_request(Gtk::Requisition* r, bool force)
-{
- if (!force && _last_gui_request_width == r->width && _last_gui_request_height == r->height)
- return;
-
- if (r->width + 4 > _width)
- set_minimum_width(r->width + 4);
-
- _ports_y_offset = r->height + 2;
-
- resize();
-
- Gtk::Allocation allocation;
- allocation.set_width(r->width + 4);
- allocation.set_height(r->height + 4);
-
- _gui_container->size_allocate(allocation);
- _gui_item->property_width() = _width - 4;
- _gui_item->property_height() = r->height;
-
- _last_gui_request_width = r->width;
- _last_gui_request_height = r->height;
-}
-
-
-void
NodeModule::rename()
{
set_name(_node->path().name());
diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp
index 595cb1e1..413020f5 100644
--- a/src/libs/gui/NodeModule.hpp
+++ b/src/libs/gui/NodeModule.hpp
@@ -68,6 +68,7 @@ protected:
void on_double_click(GdkEventButton* ev);
void show_control_window();
+ void embed_gui(bool embed);
bool popup_gui();
void on_gui_window_close();
@@ -78,9 +79,6 @@ protected:
void remove_port(SharedPtr<PortModel> port);
void value_changed(uint32_t index, const Atom& value);
-
- void embed_gui(bool embed);
- void gui_size_request(Gtk::Requisition* req, bool force);
void initialise_gui_values();
void create_menu();
@@ -89,11 +87,7 @@ protected:
NodeMenu* _menu;
SharedPtr<PluginUI> _plugin_ui;
Gtk::Widget* _gui_widget;
- Gtk::Container* _gui_container;
- Gnome::Canvas::Widget* _gui_item; ///< iff embedded
Gtk::Window* _gui_window; ///< iff popped up
- int _last_gui_request_width;
- int _last_gui_request_height;
};