diff options
author | David Robillard <d@drobilla.net> | 2010-01-28 04:16:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-28 04:16:30 +0000 |
commit | cd9c2adf12076194e8ea6c1cb2eb5ab641fb96ef (patch) | |
tree | d41de06b9f3639359012dc958c3b18055fe1259e /src/gui/PropertiesWindow.hpp | |
parent | 80838b9dcfde1e5d9760ae4d3123a45854a47c32 (diff) | |
download | ingen-cd9c2adf12076194e8ea6c1cb2eb5ab641fb96ef.tar.gz ingen-cd9c2adf12076194e8ea6c1cb2eb5ab641fb96ef.tar.bz2 ingen-cd9c2adf12076194e8ea6c1cb2eb5ab641fb96ef.zip |
Universal properties window.
Instead of custom designed limited dialogs for each object type, this
replacement is built dynamically and shows all properties of an object.
Preliminary work, this version allows the user to wreck things by
changing properties that shouldn't ever be changed manually.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2385 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/PropertiesWindow.hpp')
-rw-r--r-- | src/gui/PropertiesWindow.hpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp new file mode 100644 index 00000000..d2f619f9 --- /dev/null +++ b/src/gui/PropertiesWindow.hpp @@ -0,0 +1,96 @@ +/* This file is part of Ingen. + * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> + * + * 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 + */ + +#ifndef PROPERTIES_WINDOW_HPP +#define PROPERTIES_WINDOW_HPP + +#include <gtkmm.h> +#include <libglademm.h> +#include "raul/SharedPtr.hpp" +#include "client/NodeModel.hpp" +#include "Window.hpp" + +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + + +/** Node properties window. + * + * Loaded by libglade as a derived object. + * + * \ingroup GUI + */ +class PropertiesWindow : public Window +{ +public: + PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + + void present(SharedPtr<ObjectModel> model) { set_object(model); Gtk::Window::present(); } + void set_object(SharedPtr<ObjectModel> model); + +private: + /** Record of a property (row in the table) */ + struct Record { + Raul::Atom value; + Gtk::ComboBox* type_widget; + Gtk::Alignment* value_widget; + int row; + }; + + /** Columns for type combo in treeview */ + class TypeColumns : public Gtk::TreeModel::ColumnRecord { + public: + TypeColumns() { add(type); add(choice); } + + Gtk::TreeModelColumn<Raul::Atom::Type> type; + Gtk::TreeModelColumn<Glib::ustring> choice; + }; + + Gtk::Widget* create_value_widget(const Raul::URI& uri, const Raul::Atom& value); + + void on_show(); + + void property_changed(const Raul::URI& predicate, const Raul::Atom& value); + + void value_edited(const Raul::URI& predicate); + + void cancel_clicked(); + void apply_clicked(); + void ok_clicked(); + + typedef std::map<Raul::URI, Record> Records; + Records _records; + + TypeColumns _type_cols; + Glib::RefPtr<Gtk::ListStore> _type_choices; + + SharedPtr<ObjectModel> _model; + sigc::connection _property_connection; + Gtk::VBox* _vbox; + Gtk::ScrolledWindow* _scrolledwindow; + Gtk::Table* _table; + Gtk::Button* _cancel_button; + Gtk::Button* _apply_button; + Gtk::Button* _ok_button; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // PROPERTIES_WINDOW_HPP |