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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2562 - (hide 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 schoenebeck 1225 /* -*- 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 schoenebeck 2562 #include <gtkmm/checkbutton.h>
31 schoenebeck 1225
32     #include <gig.h>
33 schoenebeck 2562 #include <set>
34 schoenebeck 1225
35 schoenebeck 2562 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 schoenebeck 1225 class DimensionManager : public Gtk::Window {
73     public:
74 schoenebeck 1322 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
75     sigc::signal<void, gig::Region*> region_changed_signal;
76 schoenebeck 1225
77     DimensionManager();
78     void show(gig::Region* region);
79 persson 1677 void set_region(gig::Region* region);
80 schoenebeck 1225 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 schoenebeck 2562 Gtk::CheckButton allRegionsCheckBox;
89 schoenebeck 1225
90 schoenebeck 2562 DimTypeCellRenderer m_cellRendererDimType;
91     IntSetCellRenderer m_cellRendererIntSet;
92    
93 schoenebeck 1225 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
94     public:
95     ModelColumns() {
96 schoenebeck 2562 add(m_type);
97 schoenebeck 1225 add(m_bits);
98     add(m_zones);
99     add(m_description);
100 schoenebeck 2562 add(m_usageCount);
101     add(m_totalRegions);
102 schoenebeck 1225 }
103    
104 schoenebeck 2562 Gtk::TreeModelColumn<gig::dimension_t> m_type;
105     Gtk::TreeModelColumn<std::set<int> > m_bits;
106     Gtk::TreeModelColumn<std::set<int> > m_zones;
107 schoenebeck 1225 Gtk::TreeModelColumn<Glib::ustring> m_description;
108 schoenebeck 2562 Gtk::TreeModelColumn<int> m_usageCount;
109     Gtk::TreeModelColumn<int> m_totalRegions;
110 schoenebeck 1225 } 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 schoenebeck 2562 void onAllRegionsCheckBoxToggled();
126 schoenebeck 1225 void refreshManager();
127     void addDimension();
128     void removeDimension();
129 schoenebeck 2562 bool allRegions() const;
130 schoenebeck 1225 };
131    
132     #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC