Changeset 1274
- Timestamp:
- 06/23/08 12:41:58 (3 months ago)
- Files:
-
- flowcanvas/flowcanvas/Module.hpp (modified) (3 diffs)
- flowcanvas/src/Module.cpp (modified) (2 diffs)
- ingen/src/libs/client/OSCClientReceiver.cpp (modified) (1 diff)
- ingen/src/libs/engine/JackAudioDriver.hpp (modified) (1 diff)
- ingen/src/libs/engine/QueuedEventSource.cpp (modified) (1 diff)
- ingen/src/libs/engine/QueuedEventSource.hpp (modified) (2 diffs)
- ingen/src/libs/gui/NodeModule.cpp (modified) (4 diffs)
- ingen/src/libs/gui/NodeModule.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
flowcanvas/flowcanvas/Module.hpp
r1206 r1274 89 89 90 90 void fit_canvas(); 91 92 void embed(Gtk::Container* widget); 91 93 92 94 double _border_width; … … 104 106 Gnome::Canvas::Rect* _stacked_border; 105 107 Gnome::Canvas::Pixbuf* _icon_box; 108 Gtk::Container* _embed_container; 109 Gnome::Canvas::Widget* _embed_item; 106 110 107 111 private: … … 114 118 const std::string& _name; 115 119 }; 120 121 void embed_size_request(Gtk::Requisition* req, bool force); 122 123 int _last_embed_request_width; 124 int _last_embed_request_height; 116 125 }; 117 126 flowcanvas/src/Module.cpp
r1206 r1274 58 58 , _stacked_border(NULL) 59 59 , _icon_box(NULL) 60 , _embed_container(NULL) 61 , _embed_item(NULL) 62 , _last_embed_request_width(0) 63 , _last_embed_request_height(0) 60 64 { 61 65 _module_box.property_fill_color_rgba() = MODULE_FILL_COLOUR; … … 419 423 } 420 424 425 426 427 /** Embed a widget on the module. 428 * 429 * Resize may need to be called after this to ensure the module 430 * displays correctly. 431 */ 432 void 433 Module::embed(Gtk::Container* widget) 434 { 435 if (!widget) { 436 delete _embed_item; 437 _embed_item = NULL; 438 _ports_y_offset = 0; 439 _minimum_width = 0; // resize() will takes care of this 440 return; 441 } else { 442 _embed_container = manage(widget); 443 } 444 445 _embed_container->set_border_width(2); 446 _embed_container->show_all(); 447 448 const double y = 4 + _canvas_title.property_text_height(); 449 delete _embed_item; 450 _embed_item = new Gnome::Canvas::Widget(*this, 2.0, y, *_embed_container); 451 _embed_item->show(); 452 453 Gtk::Requisition r = _embed_container->size_request(); 454 embed_size_request(&r, true); 455 456 _embed_item->raise_to_top(); 457 458 _embed_container->signal_size_request().connect(sigc::bind( 459 sigc::mem_fun(this, &Module::embed_size_request), false)); 460 } 461 462 463 void 464 Module::embed_size_request(Gtk::Requisition* r, bool force) 465 { 466 if (!force && _last_embed_request_width == r->width && _last_embed_request_height == r->height) 467 return; 468 469 if (r->width + 4 > _width) 470 set_minimum_width(r->width + 4); 471 472 _ports_y_offset = r->height + 2; 473 474 resize(); 475 476 Gtk::Allocation allocation; 477 allocation.set_width(r->width + 4); 478 allocation.set_height(r->height + 4); 479 480 _embed_container->size_allocate(allocation); 481 _embed_item->property_width() = _width - 4; 482 _embed_item->property_height() = r->height; 483 484 _last_embed_request_width = r->width; 485 _last_embed_request_height = r->height; 486 } 487 421 488 422 489 /** Resize the module to fit its contents best. ingen/src/libs/client/OSCClientReceiver.cpp
r1248 r1274 36 36 , _st(NULL) 37 37 { 38 start( false); // true = dump, false = shutup38 start(true); // true = dump, false = shutup 39 39 } 40 40 ingen/src/libs/engine/JackAudioDriver.hpp
r1230 r1274 109 109 bool is_activated() const { return _is_activated; } 110 110 111 inline SampleCount frame_time() const { return jack_frame_time(_client); } 111 inline SampleCount frame_time() const { 112 const SampleCount t = jack_frame_time(_client); 113 std::cerr << "Frame time: " << t << std::endl; 114 return t; 115 } 112 116 113 117 class PortRegistrationFailedException : public std::exception {}; ingen/src/libs/engine/QueuedEventSource.cpp
r827 r1274 62 62 { 63 63 assert(!ev->is_prepared()); 64 65 cerr << "[QueuedEventSource] Pushing queued @ " << ev->time() << endl; 64 66 65 67 if (_events[_back] != NULL) { ingen/src/libs/engine/QueuedEventSource.hpp
r827 r1274 59 59 protected: 60 60 void push_queued(QueuedEvent* const ev); 61 inline void push_stamped(Event* const ev) { _stamped_queue.push(ev); } 61 inline void push_stamped(Event* const ev) { 62 std::cerr << "[QueuedEventSource] Pushing stamped @ " << ev->time() << std::endl; 63 _stamped_queue.push(ev); } 62 64 63 65 Event* pop_earliest_queued_before(const SampleCount time); … … 97 99 Event* ret = NULL; 98 100 99 if (!_stamped_queue.empty() && _stamped_queue.front()->time() < time) { 100 ret = _stamped_queue.front(); 101 _stamped_queue.pop(); 101 if (!_stamped_queue.empty()) { 102 if (_stamped_queue.front()->time() < time) { 103 ret = _stamped_queue.front(); 104 std::cerr << "[QueuedEventSource] Popping event @ " << _stamped_queue.front()->time() << std::endl; 105 _stamped_queue.pop(); 106 } else { 107 std::cerr << "[QueuedEventSource] Next event is past " << time 108 << " (@ " << _stamped_queue.front()->time() << ")" << std::endl; 109 } 102 110 } 103 111 ingen/src/libs/gui/NodeModule.cpp
r1273 r1274 41 41 , _node(node) 42 42 , _gui_widget(NULL) 43 , _gui_container(NULL)44 , _gui_item(NULL)45 43 , _gui_window(NULL) 46 , _last_gui_request_width(0)47 , _last_gui_request_height(0)48 44 { 49 45 assert(_node); … … 130 126 return; 131 127 } 132 133 GtkWidget* c_widget = NULL; 134 135 if (!_gui_item) { 136 137 const PluginModel* const plugin = dynamic_cast<const PluginModel*>(_node->plugin()); 138 assert(plugin); 139 140 _plugin_ui = plugin->ui(App::instance().world(), _node); 141 142 if (_plugin_ui) { 143 c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance()); 144 _gui_widget = Glib::wrap(c_widget); 145 assert(_gui_widget); 146 147 if (_gui_container) 148 delete _gui_container; 149 150 _gui_container = manage(new Gtk::EventBox()); 151 _gui_container->set_name("ingen_embedded_node_gui_container"); 152 _gui_container->set_border_width(2); 153 _gui_container->add(*_gui_widget); 154 _gui_container->show_all(); 155 156 const double y = 4 + _canvas_title.property_text_height(); 157 _gui_item = new Gnome::Canvas::Widget(*this, 2.0, y, *_gui_container); 158 } 159 } 160 161 if (_gui_item) { 162 128 129 if (!_plugin_ui) { 130 const PluginModel* const pm = dynamic_cast<const PluginModel*>(_node->plugin()); 131 assert(pm); 132 _plugin_ui = pm->ui(App::instance().world(), _node); 133 } 134 135 if (_plugin_ui) { 136 GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance()); 137 _gui_widget = Glib::wrap(c_widget); 163 138 assert(_gui_widget); 139 140 Gtk::Container* container = new Gtk::EventBox(); 141 container->set_name("ingen_embedded_node_gui_container"); 142 container->add(*_gui_widget); 143 FlowCanvas::Module::embed(container); 144 } else { 145 cerr << "ERROR: Failed to create LV2 UI" << endl; 146 } 147 148 if (_gui_widget) { 164 149 _gui_widget->show_all(); 165 _gui_item->show(); 166 167 Gtk::Requisition r = _gui_container->size_request(); 168 gui_size_request(&r, true); 169 170 _gui_item->raise_to_top(); 171 172 _gui_container->signal_size_request().connect(sigc::bind( 173 sigc::mem_fun(this, &NodeModule::gui_size_request), false)); 174 175 for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) 150 151 for (PortModelList::const_iterator p = _node->ports().begin(); 152 p != _node->ports().end(); ++p) 176 153 if ((*p)->type().is_control() && (*p)->is_output()) 177 154 App::instance().engine()->enable_port_broadcasting((*p)->path()); 178 179 } else {180 cerr << "ERROR: Failed to create canvas item for LV2 UI" << endl;181 155 } 182 156 183 157 } else { // un-embed 184 158 185 if (_gui_item) { 186 delete _gui_item; 187 _gui_item = NULL; 188 _gui_container = NULL; // managed 189 _gui_widget = NULL; // managed 190 _plugin_ui.reset(); 191 } 192 193 _ports_y_offset = 0; 194 _minimum_width = 0; // resize() takes care of it.. 159 FlowCanvas::Module::embed(NULL); 160 _plugin_ui.reset(); 195 161 196 162 for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) … … 199 165 } 200 166 201 if (embed && _ gui_item) {167 if (embed && _embed_item) { 202 168 initialise_gui_values(); 203 169 set_base_color(0x212222FF); … … 207 173 208 174 resize(); 209 }210 211 212 void213 NodeModule::gui_size_request(Gtk::Requisition* r, bool force)214 {215 if (!force && _last_gui_request_width == r->width && _last_gui_request_height == r->height)216 return;217 218 if (r->width + 4 > _width)219 set_minimum_width(r->width + 4);220 221 _ports_y_offset = r->height + 2;222 223 resize();224 225 Gtk::Allocation allocation;226 allocation.set_width(r->width + 4);227 allocation.set_height(r->height + 4);228 229 _gui_container->size_allocate(allocation);230 _gui_item->property_width() = _width - 4;231 _gui_item->property_height() = r->height;232 233 _last_gui_request_width = r->width;234 _last_gui_request_height = r->height;235 175 } 236 176 ingen/src/libs/gui/NodeModule.hpp
r1216 r1274 69 69 70 70 void show_control_window(); 71 void embed_gui(bool embed); 71 72 bool popup_gui(); 72 73 void on_gui_window_close(); … … 79 80 80 81 void value_changed(uint32_t index, const Atom& value); 81 82 void embed_gui(bool embed);83 void gui_size_request(Gtk::Requisition* req, bool force);84 82 void initialise_gui_values(); 85 83 … … 90 88 SharedPtr<PluginUI> _plugin_ui; 91 89 Gtk::Widget* _gui_widget; 92 Gtk::Container* _gui_container;93 Gnome::Canvas::Widget* _gui_item; ///< iff embedded94 90 Gtk::Window* _gui_window; ///< iff popped up 95 int _last_gui_request_width;96 int _last_gui_request_height;97 91 }; 98 92
