/[svn]/gigedit/trunk/src/gigedit/dimensionmanager.h
ViewVC logotype

Contents of /gigedit/trunk/src/gigedit/dimensionmanager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2562 - (show annotations) (download) (as text)
Mon May 19 18:06:57 2014 UTC (9 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3918 byte(s)
* 'Dimension Manager' dialog: added support for viewing and editing
  dimensions of all regions simultaniously.

1 /* -*- c++ -*-
2 * Copyright (C) 2006, 2007 Andreas Persson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with program; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #ifndef GIGEDIT_DIMENSIONMANAGER_H
21 #define GIGEDIT_DIMENSIONMANAGER_H
22
23 #include <gtkmm/window.h>
24 #include <gtkmm/layout.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/buttonbox.h>
27 #include <gtkmm/treeview.h>
28 #include <gtkmm/liststore.h>
29 #include <gtkmm/scrolledwindow.h>
30 #include <gtkmm/checkbutton.h>
31
32 #include <gig.h>
33 #include <set>
34
35 class DimTypeCellRenderer : public Gtk::CellRendererText {
36 public:
37 Glib::PropertyProxy<gig::dimension_t> propertyDimType() {
38 return m_propertyDimType.get_proxy();
39 }
40
41 Glib::PropertyProxy<int> propertyUsageCount() {
42 return m_propertyUsageCount.get_proxy();
43 }
44
45 Glib::PropertyProxy<int> propertyTotalRegions() {
46 return m_propertyTotalRegions.get_proxy();
47 }
48
49 DimTypeCellRenderer();
50 protected:
51 void typeChanged();
52 void statsChanged();
53 private:
54 Glib::Property<gig::dimension_t> m_propertyDimType;
55 Glib::Property<int> m_propertyUsageCount;
56 Glib::Property<int> m_propertyTotalRegions;
57 };
58
59 class IntSetCellRenderer : public Gtk::CellRendererText {
60 public:
61 Glib::PropertyProxy<std::set<int> > propertyValue() {
62 return m_propertyValue.get_proxy();
63 }
64
65 IntSetCellRenderer();
66 protected:
67 void valueChanged();
68 private:
69 Glib::Property<std::set<int> > m_propertyValue;
70 };
71
72 class DimensionManager : public Gtk::Window {
73 public:
74 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
75 sigc::signal<void, gig::Region*> region_changed_signal;
76
77 DimensionManager();
78 void show(gig::Region* region);
79 void set_region(gig::Region* region);
80 protected:
81 gig::Region* region;
82 Gtk::VBox vbox;
83 Gtk::HButtonBox buttonBox;
84 Gtk::ScrolledWindow scrolledWindow;
85 Gtk::TreeView treeView;
86 Gtk::Button addButton;
87 Gtk::Button removeButton;
88 Gtk::CheckButton allRegionsCheckBox;
89
90 DimTypeCellRenderer m_cellRendererDimType;
91 IntSetCellRenderer m_cellRendererIntSet;
92
93 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
94 public:
95 ModelColumns() {
96 add(m_type);
97 add(m_bits);
98 add(m_zones);
99 add(m_description);
100 add(m_usageCount);
101 add(m_totalRegions);
102 }
103
104 Gtk::TreeModelColumn<gig::dimension_t> m_type;
105 Gtk::TreeModelColumn<std::set<int> > m_bits;
106 Gtk::TreeModelColumn<std::set<int> > m_zones;
107 Gtk::TreeModelColumn<Glib::ustring> m_description;
108 Gtk::TreeModelColumn<int> m_usageCount;
109 Gtk::TreeModelColumn<int> m_totalRegions;
110 } tableModel;
111
112 class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {
113 public:
114 ComboModelColumns() {
115 add(m_type_id);
116 add(m_type_name);
117 }
118
119 Gtk::TreeModelColumn<int> m_type_id;
120 Gtk::TreeModelColumn<Glib::ustring> m_type_name;
121 } comboModel;
122
123 Glib::RefPtr<Gtk::ListStore> refTableModel;
124
125 void onAllRegionsCheckBoxToggled();
126 void refreshManager();
127 void addDimension();
128 void removeDimension();
129 bool allRegions() const;
130 };
131
132 #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC