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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1225 by schoenebeck, Sun Jun 10 10:56:11 2007 UTC revision 2894 by schoenebeck, Sat Apr 30 14:42:14 2016 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006 - 2016 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 20  Line 20 
20  #ifndef GIGEDIT_DIMENSIONMANAGER_H  #ifndef GIGEDIT_DIMENSIONMANAGER_H
21  #define GIGEDIT_DIMENSIONMANAGER_H  #define GIGEDIT_DIMENSIONMANAGER_H
22    
23    #include <glibmm/property.h>
24    #include <gtkmm/box.h>
25  #include <gtkmm/window.h>  #include <gtkmm/window.h>
26  #include <gtkmm/layout.h>  #include <gtkmm/layout.h>
27  #include <gtkmm/button.h>  #include <gtkmm/button.h>
# Line 27  Line 29 
29  #include <gtkmm/treeview.h>  #include <gtkmm/treeview.h>
30  #include <gtkmm/liststore.h>  #include <gtkmm/liststore.h>
31  #include <gtkmm/scrolledwindow.h>  #include <gtkmm/scrolledwindow.h>
32    #include <gtkmm/checkbutton.h>
33    
34  #include <gig.h>  #include <gig.h>
35    #include <set>
36    #include "ManagedWindow.h"
37    
38  class DimensionManager : public Gtk::Window {  class DimTypeCellRenderer : public Gtk::CellRendererText {
39  public:  public:
40      // triggered on all changes (i.e. dimension added or removed)      Glib::PropertyProxy<gig::dimension_t> propertyDimType() {
41      sigc::signal<void> articulation_changed_signal;          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    class DimensionManager : public ManagedWindow {
76    public:
77        sigc::signal<void, gig::Region*> region_to_be_changed_signal;
78        sigc::signal<void, gig::Region*> region_changed_signal;
79    
80      DimensionManager();      DimensionManager();
81      void show(gig::Region* region);      void show(gig::Region* region);
82        void set_region(gig::Region* region);
83    
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  protected:  protected:
91      gig::Region* region;      gig::Region* region;
92      Gtk::VBox vbox;      Gtk::VBox vbox;
# Line 45  protected: Line 95  protected:
95      Gtk::TreeView treeView;      Gtk::TreeView treeView;
96      Gtk::Button addButton;      Gtk::Button addButton;
97      Gtk::Button removeButton;      Gtk::Button removeButton;
98        Gtk::CheckButton allRegionsCheckBox;
99    
100        DimTypeCellRenderer m_cellRendererDimType;
101        IntSetCellRenderer m_cellRendererIntSet;
102    
103      class ModelColumns : public Gtk::TreeModel::ColumnRecord {      class ModelColumns : public Gtk::TreeModel::ColumnRecord {
104      public:      public:
105          ModelColumns() {          ModelColumns() {
106              add(m_dim_type);              add(m_type);
107              add(m_bits);              add(m_bits);
108              add(m_zones);              add(m_zones);
109              add(m_description);              add(m_description);
110              add(m_definition);              add(m_usageCount);
111                add(m_totalRegions);
112          }          }
113    
114          Gtk::TreeModelColumn<Glib::ustring> m_dim_type;          Gtk::TreeModelColumn<gig::dimension_t> m_type;
115          Gtk::TreeModelColumn<int> m_bits;          Gtk::TreeModelColumn<std::set<int> > m_bits;
116          Gtk::TreeModelColumn<int> m_zones;          Gtk::TreeModelColumn<std::set<int> > m_zones;
117          Gtk::TreeModelColumn<Glib::ustring> m_description;          Gtk::TreeModelColumn<Glib::ustring> m_description;
118          Gtk::TreeModelColumn<gig::dimension_def_t*> m_definition;          Gtk::TreeModelColumn<int> m_usageCount;
119            Gtk::TreeModelColumn<int> m_totalRegions;
120      } tableModel;      } tableModel;
121    
122      class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {      class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {
# Line 75  protected: Line 131  protected:
131      } comboModel;      } comboModel;
132    
133      Glib::RefPtr<Gtk::ListStore> refTableModel;      Glib::RefPtr<Gtk::ListStore> refTableModel;
134        bool ignoreColumnClicked; //HACK: Prevents that onColumnClicked() gets called multiple times or at times where it is not desired
135    
136        void onAllRegionsCheckBoxToggled();
137        void onColumnClicked();
138      void refreshManager();      void refreshManager();
139      void addDimension();      void addDimension();
140      void removeDimension();      void removeDimension();
141        bool allRegions() const;
142  };  };
143    
144  #endif // GIGEDIT_DIMENSIONMANAGER_H  #endif // GIGEDIT_DIMENSIONMANAGER_H

Legend:
Removed from v.1225  
changed lines
  Added in v.2894

  ViewVC Help
Powered by ViewVC