/[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 3409 - (show annotations) (download) (as text)
Tue Jan 23 16:30:56 2018 UTC (6 years, 2 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 /* -*- c++ -*-
2 * Copyright (C) 2006 - 2017 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 "compat.h"
24 #include <glibmm/property.h>
25 #include <gtkmm/box.h>
26 #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 #include <gtkmm/checkbutton.h>
34
35 #ifdef LIBGIG_HEADER_FILE
36 # include LIBGIG_HEADER_FILE(gig.h)
37 #else
38 # include <gig.h>
39 #endif
40
41 #include <set>
42 #include "ManagedWindow.h"
43
44 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 class DimensionManager : public ManagedWindow {
82 public:
83 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
84 sigc::signal<void, gig::Region*> region_changed_signal;
85
86 DimensionManager();
87 void show(gig::Region* region);
88 void set_region(gig::Region* region);
89
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 protected:
97 gig::Region* region;
98 VBox vbox;
99 HButtonBox buttonBox;
100 Gtk::ScrolledWindow scrolledWindow;
101 Gtk::TreeView treeView;
102 Gtk::Button addButton;
103 Gtk::Button removeButton;
104 Gtk::CheckButton allRegionsCheckBox;
105
106 DimTypeCellRenderer m_cellRendererDimType;
107 IntSetCellRenderer m_cellRendererIntSet;
108
109 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
110 public:
111 ModelColumns() {
112 add(m_type);
113 add(m_bits);
114 add(m_zones);
115 add(m_description);
116 add(m_usageCount);
117 add(m_totalRegions);
118 }
119
120 Gtk::TreeModelColumn<gig::dimension_t> m_type;
121 Gtk::TreeModelColumn<std::set<int> > m_bits;
122 Gtk::TreeModelColumn<std::set<int> > m_zones;
123 Gtk::TreeModelColumn<Glib::ustring> m_description;
124 Gtk::TreeModelColumn<int> m_usageCount;
125 Gtk::TreeModelColumn<int> m_totalRegions;
126 } 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 bool ignoreColumnClicked; //HACK: Prevents that onColumnClicked() gets called multiple times or at times where it is not desired
141
142 void onAllRegionsCheckBoxToggled();
143 void on_show_tooltips_changed();
144 void onColumnClicked();
145 void refreshManager();
146 void addDimension();
147 void removeDimension();
148 bool allRegions() const;
149 };
150
151 #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC