summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/NodeControlWindow.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-21 05:53:27 +0000
committerDavid Robillard <d@drobilla.net>2006-06-21 05:53:27 +0000
commitadac9032064d973ff6cfe1f94d8619c71fe199a3 (patch)
treeb2427a03222042cb79ff530ab1ad7c612475e7b7 /src/progs/ingenuity/NodeControlWindow.cpp
parent9e6189fadd0fa1ff3636b50e84549da01fdbe7ba (diff)
downloadingen-adac9032064d973ff6cfe1f94d8619c71fe199a3.tar.gz
ingen-adac9032064d973ff6cfe1f94d8619c71fe199a3.tar.bz2
ingen-adac9032064d973ff6cfe1f94d8619c71fe199a3.zip
Reorganized directory tree/names
git-svn-id: http://svn.drobilla.net/lad/ingen@73 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/NodeControlWindow.cpp')
-rw-r--r--src/progs/ingenuity/NodeControlWindow.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/progs/ingenuity/NodeControlWindow.cpp b/src/progs/ingenuity/NodeControlWindow.cpp
new file mode 100644
index 00000000..405a1f99
--- /dev/null
+++ b/src/progs/ingenuity/NodeControlWindow.cpp
@@ -0,0 +1,127 @@
+/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
+ *
+ * Om is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Om is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License alongCont
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "NodeControlWindow.h"
+#include "GladeFactory.h"
+#include "NodeController.h"
+#include "ControlGroups.h"
+#include "PatchWindow.h"
+#include <iostream>
+#include <cmath>
+using std::cerr; using std::cout; using std::endl;
+
+namespace OmGtk {
+
+
+/** Create a node control window and load a new ControlPanel for it.
+ */
+NodeControlWindow::NodeControlWindow(NodeController* node, size_t poly)
+: m_node(node),
+ m_position_stored(false),
+ m_x(0), m_y(0)
+{
+ assert(m_node != NULL);
+
+ property_resizable() = true;
+ set_border_width(5);
+
+ set_title(m_node->path() + " Controls");
+
+ Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("warehouse_win");
+ xml->get_widget_derived("control_panel_vbox", m_control_panel);
+ m_control_panel->reparent(*this);
+
+ m_control_panel->init(m_node, poly);
+
+ show_all_children();
+ resize();
+
+ // FIXME: not working
+ set_icon_from_file(string(PKGDATADIR) + "/om-icon.png");
+
+ m_callback_enabled = true;
+}
+
+
+/** Create a node control window and with an existing ControlPanel.
+ */
+NodeControlWindow::NodeControlWindow(NodeController* node, ControlPanel* panel)
+: m_node(node),
+ m_control_panel(panel)
+{
+ assert(m_node != NULL);
+
+ property_resizable() = true;
+ set_border_width(5);
+
+ set_title(m_node->path() + " Controls");
+
+ m_control_panel->reparent(*this);
+
+ show_all_children();
+ resize();
+
+ m_callback_enabled = true;
+}
+
+
+NodeControlWindow::~NodeControlWindow()
+{
+ delete m_control_panel;
+}
+
+
+void
+NodeControlWindow::resize()
+{
+ pair<int,int> controls_size = m_control_panel->ideal_size();
+ /*int width = 400;
+ int height = controls_size.second
+ + ((m_node->polyphonic()) ? 4 : 40);*/
+ int width = controls_size.first;
+ int height = controls_size.second;
+
+ if (height > property_screen().get_value()->get_height() - 64)
+ height = property_screen().get_value()->get_height() - 64;
+ if (width > property_screen().get_value()->get_width() - 64)
+ width = property_screen().get_value()->get_width() - 64;
+
+ //cerr << "Resizing to: " << width << " x " << height << endl;
+
+ Gtk::Window::resize(width, height);
+}
+
+
+void
+NodeControlWindow::on_show()
+{
+ if (m_position_stored)
+ move(m_x, m_y);
+
+ Gtk::Window::on_show();
+}
+
+
+void
+NodeControlWindow::on_hide()
+{
+ m_position_stored = true;
+ get_position(m_x, m_y);
+ Gtk::Window::on_hide();
+}
+
+
+} // namespace OmGtk