summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-19 18:51:06 +0000
committerDavid Robillard <d@drobilla.net>2008-08-19 18:51:06 +0000
commite16206982d074e62956de00eeef611478f01c430 (patch)
tree388bc6e5ad9220cf9cdedf865a2d45856f418ae4 /src/libs/gui
parent14764da12f3808da0c40b643ac8224716f060729 (diff)
downloadingen-e16206982d074e62956de00eeef611478f01c430.tar.gz
ingen-e16206982d074e62956de00eeef611478f01c430.tar.bz2
ingen-e16206982d074e62956de00eeef611478f01c430.zip
Preliminary connecting via HTTP in Gtk client.
Better handling of overflowed client event receive buffer. Store fixes, complain only once about orphans, don't request an orphan parent over and over. git-svn-id: http://svn.drobilla.net/lad/ingen@1447 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/ConnectWindow.cpp26
-rw-r--r--src/libs/gui/ConnectWindow.hpp2
-rw-r--r--src/libs/gui/ControlPanel.cpp2
-rw-r--r--src/libs/gui/Makefile.am6
-rw-r--r--src/libs/gui/NodeControlWindow.cpp2
-rw-r--r--src/libs/gui/NodeMenu.cpp2
-rw-r--r--src/libs/gui/NodeModule.cpp8
-rw-r--r--src/libs/gui/NodePropertiesWindow.cpp2
-rw-r--r--src/libs/gui/PatchCanvas.cpp5
-rw-r--r--src/libs/gui/PatchTreeWindow.cpp2
-rw-r--r--src/libs/gui/PatchWindow.cpp4
11 files changed, 35 insertions, 26 deletions
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index 03f8408a..eb095af5 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -29,6 +29,7 @@
#include "engine/Engine.hpp"
#include "engine/QueuedEngineInterface.hpp"
#include "client/OSCClientReceiver.hpp"
+#include "client/HTTPClientReceiver.hpp"
#include "client/OSCEngineSender.hpp"
#include "client/ThreadedSigClientInterface.hpp"
#include "client/ClientStore.hpp"
@@ -143,7 +144,9 @@ ConnectWindow::set_connecting_widget_states()
void
ConnectWindow::connect(bool existing)
{
- assert(!_attached);
+ if (_attached)
+ _attached = false;
+
assert(!App::instance().client());
_connect_stage = 0;
@@ -153,15 +156,22 @@ ConnectWindow::connect(bool existing)
if (_mode == CONNECT_REMOTE) {
if (!existing) {
- const string url = (_widgets_loaded ? _url_entry->get_text() : "osc.udp://localhost:16180");
+ const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri());
world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url));
}
-
- // FIXME: static args
+
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
- SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci));
- App::instance().attach(tsci, client);
+ SharedPtr<Raul::Deletable> client;
+
+ const string& uri = world->engine->uri();
+ const string& scheme = uri.substr(0, uri.find(":"));
+ if (scheme == "osc.udp" || scheme == "osc.tcp")
+ client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port
+ else if (scheme == "http")
+ client = SharedPtr<HTTPClientReceiver>(new HTTPClientReceiver(world, uri, tsci));
+ App::instance().attach(tsci, client);
+
Glib::signal_timeout().connect(
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
@@ -377,7 +387,7 @@ ConnectWindow::gtk_callback()
assert(App::instance().client());
App::instance().client()->signal_response_ok.connect(
- sigc::mem_fun(this, &ConnectWindow::response_ok_received));
+ sigc::mem_fun(this, &ConnectWindow::on_response));
_ping_id = abs(rand()) / 2 * 2; // avoid -1
App::instance().engine()->set_next_response_id(_ping_id);
@@ -391,7 +401,7 @@ ConnectWindow::gtk_callback()
++_connect_stage;
} else if (_connect_stage == 1) {
- if (_attached) {
+ if (_attached || App::instance().client()->enabled()) {
App::instance().engine()->activate();
++_connect_stage;
} else {
diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp
index 8410783d..fb75d4b2 100644
--- a/src/libs/gui/ConnectWindow.hpp
+++ b/src/libs/gui/ConnectWindow.hpp
@@ -53,7 +53,7 @@ public:
void set_connected_to(SharedPtr<Shared::EngineInterface> engine);
void start(Ingen::Shared::World* world);
- void response_ok_received(int32_t id) { if (id == _ping_id) _attached = true; }
+ void on_response(int32_t id) { _attached = true; }
private:
enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL };
diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp
index 84f1163a..032f5758 100644
--- a/src/libs/gui/ControlPanel.cpp
+++ b/src/libs/gui/ControlPanel.cpp
@@ -69,7 +69,7 @@ ControlPanel::init(SharedPtr<NodeModel> node, uint32_t poly)
_voice_control_box->hide();
}
- for (PortModelList::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) {
+ for (NodeModel::Ports::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) {
add_port(*i);
}
diff --git a/src/libs/gui/Makefile.am b/src/libs/gui/Makefile.am
index fa956fca..48063d35 100644
--- a/src/libs/gui/Makefile.am
+++ b/src/libs/gui/Makefile.am
@@ -23,7 +23,8 @@ libingen_gui_la_CXXFLAGS = \
@LIBLO_CFLAGS@ \
@REDLANDMM_CFLAGS@ \
@RAUL_CFLAGS@ \
- @SLV2_CFLAGS@
+ @SLV2_CFLAGS@ \
+ @SOUP_CFLAGS@
libingen_gui_la_LDFLAGS = -no-undefined -module -avoid-version
@@ -40,7 +41,8 @@ libingen_gui_la_LIBADD = \
@LIBLO_LIBS@ \
@REDLANDMM_LIBS@ \
@RAUL_LIBS@ \
- @SLV2_LIBS@
+ @SLV2_LIBS@ \
+ @SOUP_LIBS@
libingen_gui_la_SOURCES = \
gui.hpp \
diff --git a/src/libs/gui/NodeControlWindow.cpp b/src/libs/gui/NodeControlWindow.cpp
index 95a07b2b..293d28f5 100644
--- a/src/libs/gui/NodeControlWindow.cpp
+++ b/src/libs/gui/NodeControlWindow.cpp
@@ -114,7 +114,7 @@ NodeControlWindow::resize()
void
NodeControlWindow::on_show()
{
- for (PortModelList::const_iterator i = _node->ports().begin();
+ for (NodeModel::Ports::const_iterator i = _node->ports().begin();
i != _node->ports().end(); ++i)
if ((*i)->type().is_control() && (*i)->is_input())
App::instance().engine()->request_port_value((*i)->path());
diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp
index 05139540..529eb52c 100644
--- a/src/libs/gui/NodeMenu.cpp
+++ b/src/libs/gui/NodeMenu.cpp
@@ -141,7 +141,7 @@ bool
NodeMenu::has_control_inputs()
{
const NodeModel* const nm = (NodeModel*)_object.get();
- for (PortModelList::const_iterator i = nm->ports().begin(); i != nm->ports().end(); ++i)
+ for (NodeModel::Ports::const_iterator i = nm->ports().begin(); i != nm->ports().end(); ++i)
if ((*i)->is_input() && (*i)->type().is_control())
return true;
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 21415be9..b3898b94 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -90,7 +90,7 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n
for (GraphObject::Variables::const_iterator m = node->variables().begin(); m != node->variables().end(); ++m)
ret->set_variable(m->first, m->second);
- for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) {
+ for (NodeModel::Ports::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) {
ret->add_port(*p, false);
}
@@ -151,7 +151,7 @@ NodeModule::embed_gui(bool embed)
if (_gui_widget) {
_gui_widget->show_all();
- for (PortModelList::const_iterator p = _node->ports().begin();
+ for (NodeModel::Ports::const_iterator p = _node->ports().begin();
p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", true);
@@ -162,7 +162,7 @@ NodeModule::embed_gui(bool embed)
FlowCanvas::Module::embed(NULL);
_plugin_ui.reset();
- for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
+ for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false);
}
@@ -262,7 +262,7 @@ void
NodeModule::initialise_gui_values()
{
uint32_t index=0;
- for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) {
+ for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) {
if ((*p)->type().is_control())
value_changed(index, (*p)->value());
++index;
diff --git a/src/libs/gui/NodePropertiesWindow.cpp b/src/libs/gui/NodePropertiesWindow.cpp
index 9848d872..ae2c23b5 100644
--- a/src/libs/gui/NodePropertiesWindow.cpp
+++ b/src/libs/gui/NodePropertiesWindow.cpp
@@ -53,8 +53,6 @@ NodePropertiesWindow::set_node(SharedPtr<NodeModel> node_model)
_node_polyphonic_toggle->set_active(node_model->polyphonic());
const PluginModel* pm = dynamic_cast<const PluginModel*>(node_model->plugin());
- assert(pm);
-
if (pm) {
_plugin_type_label->set_text(pm->type_uri());
_plugin_uri_label->set_text(pm->uri());
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index f527041b..5d064124 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -269,7 +269,7 @@ PatchCanvas::build()
}
// Create pseudo modules for ports (ports on this canvas, not on our module)
- for (PortModelList::const_iterator i = _patch->ports().begin();
+ for (NodeModel::Ports::const_iterator i = _patch->ports().begin();
i != _patch->ports().end(); ++i) {
add_port(*i);
}
@@ -590,8 +590,7 @@ PatchCanvas::paste()
clipboard.new_patch("/", _patch->poly());
ClashAvoider avoider(*App::instance().store().get(), _patch->path(), clipboard, &clipboard);
- parser->parse_string(App::instance().world(), &avoider, str, "/",
- boost::optional<Glib::ustring>(), (Glib::ustring)_patch->path());
+ parser->parse_string(App::instance().world(), &avoider, str, "/", _patch->path());
for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) {
cout << "************ OBJECT: " << i->first << endl;
diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp
index ee831cb3..87393cec 100644
--- a/src/libs/gui/PatchTreeWindow.cpp
+++ b/src/libs/gui/PatchTreeWindow.cpp
@@ -89,7 +89,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
Gtk::TreeModel::Row row = *iter;
if (pm->path() == "/") {
SharedPtr<OSCEngineSender> osc_sender = PtrCast<OSCEngineSender>(App::instance().engine());
- string root_name = osc_sender ? osc_sender->engine_url() : "Internal";
+ string root_name = osc_sender ? osc_sender->uri() : "Internal";
// Hack off trailing '/' if it's there (ugly)
//if (root_name.substr(root_name.length()-1,1) == "/")
// root_name = root_name.substr(0, root_name.length()-1);
diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp
index 125adeea..01f74436 100644
--- a/src/libs/gui/PatchWindow.cpp
+++ b/src/libs/gui/PatchWindow.cpp
@@ -210,7 +210,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
_menu_view_control_window->property_sensitive() = false;
- for (PortModelList::const_iterator p = patch->ports().begin();
+ for (NodeModel::Ports::const_iterator p = patch->ports().begin();
p != patch->ports().end(); ++p) {
if ((*p)->type().is_control() && (*p)->is_input()) {
_menu_view_control_window->property_sensitive() = true;
@@ -257,7 +257,7 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port)
bool found_control = false;
- for (PortModelList::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) {
+ for (NodeModel::Ports::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) {
if ((*i)->type().is_control() && (*i)->is_input()) {
found_control = true;
break;