summaryrefslogtreecommitdiffstats
path: root/src/gui/GraphView.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-11-24 13:44:03 +0100
committerDavid Robillard <d@drobilla.net>2018-11-24 13:44:03 +0100
commita7d83f19b08eb4c6f79a82fe60c2b86db13f4420 (patch)
treed9b620bfba1e7462df4ddb3f6225cc5216c0ca81 /src/gui/GraphView.cpp
parentd63edc742cebd685f8a05936682210aa5c1e69a9 (diff)
downloadingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.tar.gz
ingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.tar.bz2
ingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.zip
Squashed 'waflib/' changes from 6e726eb1..5ea8f99f
5ea8f99f Improve test output spacing 0e23b29f Raise exception when test suite fails to ensure non-zero exit status d6de073b Show run time of unit tests 5b655541 Add short configure option for ultra-strict flags 4687ba6d Use gtest-like test output 258903d9 Fix failure count in test group summaries da07e738 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d
Diffstat (limited to 'src/gui/GraphView.cpp')
-rw-r--r--src/gui/GraphView.cpp154
1 files changed, 0 insertions, 154 deletions
diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp
deleted file mode 100644
index e6361249..00000000
--- a/src/gui/GraphView.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <cassert>
-#include <fstream>
-
-#include "ingen/Interface.hpp"
-#include "ingen/client/GraphModel.hpp"
-
-#include "App.hpp"
-#include "LoadPluginWindow.hpp"
-#include "NewSubgraphWindow.hpp"
-#include "GraphCanvas.hpp"
-#include "GraphTreeWindow.hpp"
-#include "GraphView.hpp"
-#include "WidgetFactory.hpp"
-
-namespace Ingen {
-
-using namespace Client;
-
-namespace GUI {
-
-GraphView::GraphView(BaseObjectType* cobject,
- const Glib::RefPtr<Gtk::Builder>& xml)
- : Gtk::Box(cobject)
- , _app(nullptr)
- , _breadcrumb_container(nullptr)
- , _enable_signal(true)
-{
- property_visible() = false;
-
- xml->get_widget("graph_view_breadcrumb_container", _breadcrumb_container);
- xml->get_widget("graph_view_toolbar", _toolbar);
- xml->get_widget("graph_view_process_but", _process_but);
- xml->get_widget("graph_view_poly_spin", _poly_spin);
- xml->get_widget("graph_view_scrolledwindow", _canvas_scrolledwindow);
-
- _toolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS);
- _canvas_scrolledwindow->property_hadjustment().get_value()->set_step_increment(10);
- _canvas_scrolledwindow->property_vadjustment().get_value()->set_step_increment(10);
-}
-
-GraphView::~GraphView()
-{
- _canvas_scrolledwindow->remove();
-}
-
-void
-GraphView::init(App& app)
-{
- _app = &app;
-}
-
-void
-GraphView::set_graph(SPtr<const GraphModel> graph)
-{
- assert(!_canvas); // FIXME: remove
-
- assert(_breadcrumb_container); // ensure created
-
- _graph = graph;
- _canvas = SPtr<GraphCanvas>(new GraphCanvas(*_app, graph, 1600*2, 1200*2));
- _canvas->build();
-
- _canvas_scrolledwindow->add(_canvas->widget());
-
- _poly_spin->set_range(1, 128);
- _poly_spin->set_increments(1, 4);
- _poly_spin->set_value(graph->internal_poly());
-
- for (const auto& p : graph->properties()) {
- property_changed(p.first, p.second);
- }
-
- // Connect model signals to track state
- graph->signal_property().connect(
- sigc::mem_fun(this, &GraphView::property_changed));
-
- // Connect widget signals to do things
- _process_but->signal_toggled().connect(
- sigc::mem_fun(this, &GraphView::process_toggled));
-
- _poly_spin->signal_value_changed().connect(
- sigc::mem_fun(*this, &GraphView::poly_changed));
-
- _canvas->widget().grab_focus();
-}
-
-SPtr<GraphView>
-GraphView::create(App& app, SPtr<const GraphModel> graph)
-{
- GraphView* result = nullptr;
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win");
- xml->get_widget_derived("graph_view_box", result);
- result->init(app);
- result->set_graph(graph);
- return SPtr<GraphView>(result);
-}
-
-void
-GraphView::process_toggled()
-{
- if (!_enable_signal) {
- return;
- }
-
- _app->set_property(_graph->uri(),
- _app->uris().ingen_enabled,
- _app->forge().make((bool)_process_but->get_active()));
-}
-
-void
-GraphView::poly_changed()
-{
- const int poly = _poly_spin->get_value_as_int();
- if (_enable_signal && poly != (int)_graph->internal_poly()) {
- _app->set_property(_graph->uri(),
- _app->uris().ingen_polyphony,
- _app->forge().make(poly));
- }
-}
-
-void
-GraphView::property_changed(const URI& predicate, const Atom& value)
-{
- _enable_signal = false;
- if (predicate == _app->uris().ingen_enabled) {
- if (value.type() == _app->uris().forge.Bool) {
- _process_but->set_active(value.get<int32_t>());
- }
- } else if (predicate == _app->uris().ingen_polyphony) {
- if (value.type() == _app->uris().forge.Int) {
- _poly_spin->set_value(value.get<int32_t>());
- }
- }
- _enable_signal = true;
-}
-
-} // namespace GUI
-} // namespace Ingen