From 93850c202de8b073a1ce1dd8bd246d407bce4e2f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 30 Sep 2008 16:50:21 +0000 Subject: Flatten ingen source directory heirarchy a bit. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1551 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchView.cpp | 194 --------------------------------------------- 1 file changed, 194 deletions(-) delete mode 100644 src/libs/gui/PatchView.cpp (limited to 'src/libs/gui/PatchView.cpp') diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp deleted file mode 100644 index 13689806..00000000 --- a/src/libs/gui/PatchView.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen 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. - * - * 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "PatchView.hpp" -#include "PatchCanvas.hpp" -#include "LoadPluginWindow.hpp" -#include "NewSubpatchWindow.hpp" -#include "LoadSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" -#include "PatchPropertiesWindow.hpp" -#include "PatchTreeWindow.hpp" -#include "GladeFactory.hpp" - -namespace Ingen { -namespace GUI { - - -PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::Box(cobject), - _breadcrumb_container(NULL), - _enable_signal(true) -{ - property_visible() = false; - - xml->get_widget("patch_view_breadcrumb_container", _breadcrumb_container); - xml->get_widget("patch_view_toolbar", _toolbar); - xml->get_widget("patch_view_process_but", _process_but); - xml->get_widget("patch_view_poly_spin", _poly_spin); - xml->get_widget("patch_view_clear_but", _clear_but); - xml->get_widget("patch_view_destroy_but", _destroy_but); - xml->get_widget("patch_view_refresh_but", _refresh_but); - xml->get_widget("patch_view_save_but", _save_but); - xml->get_widget("patch_view_zoom_full_but", _zoom_full_but); - xml->get_widget("patch_view_zoom_normal_but", _zoom_normal_but); - xml->get_widget("patch_view_edit_mode_but", _edit_mode_but); - xml->get_widget("patch_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); - -} - - -void -PatchView::set_patch(SharedPtr patch) -{ - assert(!_canvas); // FIXME: remove - - //cerr << "Creating view for " << patch->path() << endl; - - assert(_breadcrumb_container); // ensure created - - _patch = patch; - _canvas = SharedPtr(new PatchCanvas(patch, 1600*2, 1200*2)); - _canvas->build(); - - _canvas_scrolledwindow->add(*_canvas); - - _poly_spin->set_value(patch->poly()); - _destroy_but->set_sensitive(patch->path() != "/"); - - for (GraphObject::Properties::const_iterator i = patch->properties().begin(); - i != patch->properties().end(); ++i) - property_changed(i->first, i->second); - - // Connect model signals to track state - patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed)); - - // Connect widget signals to do things - _process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled)); - _clear_but->signal_clicked().connect(sigc::mem_fun(this, &PatchView::clear_clicked)); - _refresh_but->signal_clicked().connect(sigc::mem_fun(this, &PatchView::refresh_clicked)); - - _zoom_normal_but->signal_clicked().connect(sigc::bind(sigc::mem_fun( - _canvas.get(), &PatchCanvas::set_zoom), 1.0)); - - _zoom_full_but->signal_clicked().connect( - sigc::mem_fun(_canvas.get(), &PatchCanvas::zoom_full)); - - patch->signal_editable.connect(sigc::mem_fun( - *this, &PatchView::on_editable_sig)); - - _edit_mode_but->signal_toggled().connect(sigc::mem_fun( - *this, &PatchView::editable_toggled)); - - _poly_spin->signal_value_changed().connect( - sigc::mem_fun(*this, &PatchView::poly_changed)); - - _canvas->grab_focus(); -} - - -PatchView::~PatchView() -{ - //cerr << "Destroying view for " << _patch->path() << endl; -} - - -SharedPtr -PatchView::create(SharedPtr patch) - -{ - const Glib::RefPtr& xml = GladeFactory::new_glade_reference("patch_view_box"); - PatchView* result = NULL; - xml->get_widget_derived("patch_view_box", result); - assert(result); - result->set_patch(patch); - return SharedPtr(result); -} - - -void -PatchView::on_editable_sig(bool editable) -{ - _edit_mode_but->set_active(editable); - _canvas->lock(!editable); -} - - -void -PatchView::editable_toggled() -{ - const bool editable = _edit_mode_but->get_active(); - _patch->set_editable(editable); - _canvas->lock(!editable); -} - - -void -PatchView::process_toggled() -{ - if (!_enable_signal) - return; - - App::instance().engine()->set_property(_patch->path(), "ingen:enabled", - (bool)_process_but->get_active()); -} - - -void -PatchView::poly_changed() -{ - App::instance().engine()->set_property(_patch->path(), "ingen:polyphony", - _poly_spin->get_value_as_int()); -} - - -void -PatchView::clear_clicked() -{ - App::instance().engine()->clear_patch(_patch->path()); -} - - -void -PatchView::refresh_clicked() -{ - App::instance().engine()->request_object(_patch->path()); -} - - -void -PatchView::property_changed(const std::string& predicate, const Raul::Atom& value) -{ - _enable_signal = false; - if (predicate == "ingen:enabled" && value.type() == Atom::BOOL) - _process_but->set_active(value.get_bool()); - _enable_signal = true; -} - - -} // namespace GUI -} // namespace Ingen -- cgit v1.2.1