/[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 3409 - (hide annotations) (download) (as text)
Tue Jan 23 16:30:56 2018 UTC (6 years, 3 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4834 byte(s)
* Added new main menu item "View" -> "Tooltips for Beginners" which allows
  to disable tooltips intended for newbies only (default: on).
* Bumped version (1.1.0.svn3).

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

  ViewVC Help
Powered by ViewVC