/[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 2894 - (hide annotations) (download) (as text)
Sat Apr 30 14:42:14 2016 UTC (8 years ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4710 byte(s)
* Enabled auto save & restore of window size & position of all
  remaining windows.
* Bumped version (1.0.0.svn7).

1 schoenebeck 1225 /* -*- c++ -*-
2 schoenebeck 2894 * Copyright (C) 2006 - 2016 Andreas Persson
3 schoenebeck 1225 *
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 persson 2579 #include <glibmm/property.h>
24 persson 2844 #include <gtkmm/box.h>
25 schoenebeck 1225 #include <gtkmm/window.h>
26     #include <gtkmm/layout.h>
27     #include <gtkmm/button.h>
28     #include <gtkmm/buttonbox.h>
29     #include <gtkmm/treeview.h>
30     #include <gtkmm/liststore.h>
31     #include <gtkmm/scrolledwindow.h>
32 schoenebeck 2562 #include <gtkmm/checkbutton.h>
33 schoenebeck 1225
34     #include <gig.h>
35 schoenebeck 2562 #include <set>
36 schoenebeck 2894 #include "ManagedWindow.h"
37 schoenebeck 1225
38 schoenebeck 2562 class DimTypeCellRenderer : public Gtk::CellRendererText {
39     public:
40     Glib::PropertyProxy<gig::dimension_t> propertyDimType() {
41     return m_propertyDimType.get_proxy();
42     }
43    
44     Glib::PropertyProxy<int> propertyUsageCount() {
45     return m_propertyUsageCount.get_proxy();
46     }
47    
48     Glib::PropertyProxy<int> propertyTotalRegions() {
49     return m_propertyTotalRegions.get_proxy();
50     }
51    
52     DimTypeCellRenderer();
53     protected:
54     void typeChanged();
55     void statsChanged();
56     private:
57     Glib::Property<gig::dimension_t> m_propertyDimType;
58     Glib::Property<int> m_propertyUsageCount;
59     Glib::Property<int> m_propertyTotalRegions;
60     };
61    
62     class IntSetCellRenderer : public Gtk::CellRendererText {
63     public:
64     Glib::PropertyProxy<std::set<int> > propertyValue() {
65     return m_propertyValue.get_proxy();
66     }
67    
68     IntSetCellRenderer();
69     protected:
70     void valueChanged();
71     private:
72     Glib::Property<std::set<int> > m_propertyValue;
73     };
74    
75 schoenebeck 2894 class DimensionManager : public ManagedWindow {
76 schoenebeck 1225 public:
77 schoenebeck 1322 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
78     sigc::signal<void, gig::Region*> region_changed_signal;
79 schoenebeck 1225
80     DimensionManager();
81     void show(gig::Region* region);
82 persson 1677 void set_region(gig::Region* region);
83 schoenebeck 2894
84     // implementation for abstract methods of interface class "ManagedWindow"
85     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->dimensionManagerWindowX; }
86     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->dimensionManagerWindowY; }
87     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->dimensionManagerWindowW; }
88     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->dimensionManagerWindowH; }
89    
90 schoenebeck 1225 protected:
91     gig::Region* region;
92     Gtk::VBox vbox;
93     Gtk::HButtonBox buttonBox;
94     Gtk::ScrolledWindow scrolledWindow;
95     Gtk::TreeView treeView;
96     Gtk::Button addButton;
97     Gtk::Button removeButton;
98 schoenebeck 2562 Gtk::CheckButton allRegionsCheckBox;
99 schoenebeck 1225
100 schoenebeck 2562 DimTypeCellRenderer m_cellRendererDimType;
101     IntSetCellRenderer m_cellRendererIntSet;
102    
103 schoenebeck 1225 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
104     public:
105     ModelColumns() {
106 schoenebeck 2562 add(m_type);
107 schoenebeck 1225 add(m_bits);
108     add(m_zones);
109     add(m_description);
110 schoenebeck 2562 add(m_usageCount);
111     add(m_totalRegions);
112 schoenebeck 1225 }
113    
114 schoenebeck 2562 Gtk::TreeModelColumn<gig::dimension_t> m_type;
115     Gtk::TreeModelColumn<std::set<int> > m_bits;
116     Gtk::TreeModelColumn<std::set<int> > m_zones;
117 schoenebeck 1225 Gtk::TreeModelColumn<Glib::ustring> m_description;
118 schoenebeck 2562 Gtk::TreeModelColumn<int> m_usageCount;
119     Gtk::TreeModelColumn<int> m_totalRegions;
120 schoenebeck 1225 } tableModel;
121    
122     class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {
123     public:
124     ComboModelColumns() {
125     add(m_type_id);
126     add(m_type_name);
127     }
128    
129     Gtk::TreeModelColumn<int> m_type_id;
130     Gtk::TreeModelColumn<Glib::ustring> m_type_name;
131     } comboModel;
132    
133     Glib::RefPtr<Gtk::ListStore> refTableModel;
134 schoenebeck 2641 bool ignoreColumnClicked; //HACK: Prevents that onColumnClicked() gets called multiple times or at times where it is not desired
135 schoenebeck 1225
136 schoenebeck 2562 void onAllRegionsCheckBoxToggled();
137 schoenebeck 2641 void onColumnClicked();
138 schoenebeck 1225 void refreshManager();
139     void addDimension();
140     void removeDimension();
141 schoenebeck 2562 bool allRegions() const;
142 schoenebeck 1225 };
143    
144     #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC