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

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

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

revision 1303 by persson, Sun Aug 26 09:29:52 2007 UTC revision 3364 by schoenebeck, Tue Nov 14 18:07:25 2017 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006-2017 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 21  Line 21 
21  #define GIGEDIT_DIMREGIONCHOOSER_H  #define GIGEDIT_DIMREGIONCHOOSER_H
22    
23  #include <gtkmm/drawingarea.h>  #include <gtkmm/drawingarea.h>
24  #include <gdkmm/colormap.h>  #include <gtkmm/menu.h>
25  #include <gdkmm/window.h>  #include <gdkmm/window.h>
26    
27  #include <gig.h>  #include "compat.h"
28    
29    #ifdef LIBGIG_HEADER_FILE
30    # include LIBGIG_HEADER_FILE(gig.h)
31    #else
32    # include <gig.h>
33    #endif
34    
35    #if USE_GTKMM_BUILDER
36    # include <gtkmm/builder.h>
37    #else
38    # include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4
39    #endif
40    
41    #include <set>
42    #include <map>
43    
44    #include "global.h"
45    
46  class DimRegionChooser : public Gtk::DrawingArea  class DimRegionChooser : public Gtk::DrawingArea
47  {  {
48  public:  public:
49      DimRegionChooser();      DimRegionChooser(Gtk::Window& window);
50      virtual ~DimRegionChooser();      virtual ~DimRegionChooser();
51    
52      void set_region(gig::Region* region);      void set_region(gig::Region* region);
53    
54      sigc::signal<void> signal_dimregion_selected();      sigc::signal<void>& signal_dimregion_selected();
55      sigc::signal<void> signal_region_changed();      sigc::signal<void>& signal_region_changed();
56    
57      gig::DimensionRegion* get_dimregion() { return dimreg; }      gig::DimensionRegion* get_main_dimregion() const;
58        void get_dimregions(const gig::Region* region, bool stereo,
59                            std::set<gig::DimensionRegion*>& dimregs) const;
60        bool select_dimregion(gig::DimensionRegion* dimrgn);
61        void select_next_dimzone(bool add = false);
62        void select_prev_dimzone(bool add = false);
63        void select_next_dimension();
64        void select_prev_dimension();
65    
66        // those 3 are ATM only relevant when resizing custom dimension region zones
67        // and for painting those auto selected zones with gray hatched pattern
68        void setModifyBothChannels(bool b);
69        void setModifyAllDimensionRegions(bool b);
70        void setModifyAllRegions(bool b);
71    
72  protected:  protected:
73      virtual void on_realize();  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
74      virtual bool on_expose_event(GdkEventExpose* e);      virtual bool on_expose_event(GdkEventExpose* e);
75      virtual void on_size_request(GtkRequisition* requisition);  #else
76        virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
77    #endif
78      virtual bool on_button_press_event(GdkEventButton* event);      virtual bool on_button_press_event(GdkEventButton* event);
79      virtual bool on_button_release_event(GdkEventButton* event);      virtual bool on_button_release_event(GdkEventButton* event);
80      virtual bool on_motion_notify_event(GdkEventMotion* event);      virtual bool on_motion_notify_event(GdkEventMotion* event);
81      virtual bool on_focus(Gtk::DirectionType direction);      virtual bool on_focus(Gtk::DirectionType direction);
82    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
83      Glib::RefPtr<Gdk::GC> gc;      bool onKeyPressed(Gdk::EventKey& key);
84      Gdk::Color blue, red, black, white, green;      bool onKeyReleased(Gdk::EventKey& key);
85    #else
86        bool onKeyPressed(GdkEventKey* key);
87        bool onKeyReleased(GdkEventKey* key);
88    #endif
89        void refresh_all();
90        void split_dimension_zone();
91        void delete_dimension_zone();
92        void resetSelectedZones();
93        void select_dimzone_by_dir(int dir, bool add = false);
94        void drawIconsFor(gig::dimension_t dimension, uint zone,
95                          const Cairo::RefPtr<Cairo::Context>& cr,
96                          int x, int y, int w, int h);
97    
98        Gdk::RGBA red, blue, black, white;
99        Glib::RefPtr<Gdk::Pixbuf> blueHatchedPatternARGB;
100        Cairo::RefPtr<Cairo::SurfacePattern> blueHatchedSurfacePattern;
101        Glib::RefPtr<Gdk::Pixbuf> blueHatchedPattern2ARGB;
102        Cairo::RefPtr<Cairo::SurfacePattern> blueHatchedSurfacePattern2;
103        Glib::RefPtr<Gdk::Pixbuf> grayBlueHatchedPatternARGB;
104        Cairo::RefPtr<Cairo::SurfacePattern> grayBlueHatchedSurfacePattern;
105    
106      gig::Instrument* instrument;      gig::Instrument* instrument;
107      gig::Region* region;      gig::Region* region;
     int dimregno;  
108    
109      sigc::signal<void> dimregion_selected;      sigc::signal<void> dimregion_selected;
110      sigc::signal<void> region_changed;      sigc::signal<void> region_changed;
111    
112      gig::DimensionRegion* dimreg;      // those 3 are ATM only relevant when resizing custom dimension region zones
113        // and for painting those auto selected zones with gray hatched pattern
114        bool modifybothchannels;
115        bool modifyalldimregs;
116        bool modifyallregions;
117    
118      int focus_line;      int focus_line;
119      int dimvalue[256];      std::map<gig::dimension_t, std::set<int> > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected.
120      int label_width;      int label_width;
121        bool labels_changed;
122      int nbDimensions;      int nbDimensions;
123    
124        // the "main" dimension region is the one that is used to i.e. evaluate the
125        // precise custom velocity splits (could also be interpreted for focus stuff,
126        // i.e. keyboard arrow key navigation)
127        // NOTE: these may *not* necessarily currently be selected !
128        gig::dimension_t maindimtype;
129        DimensionCase maindimcase;
130        int maindimregno;
131    
132      // information needed during a resize      // information needed during a resize
133      struct {      struct {
134          bool active;          bool active;
# Line 76  protected: Line 141  protected:
141          int min;          int min;
142          int max;          int max;
143          int dimension;          int dimension;
144          int offset;          gig::dimension_def_t dimensionDef;
145            int zone;
146      } resize;      } resize;
147    
148        bool multiSelectKeyDown;
149        bool primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key
150        bool shiftKeyDown;
151    
152      bool cursor_is_resize;      bool cursor_is_resize;
153      bool is_in_resize_zone(double x, double y);      bool is_in_resize_zone(double x, double y);
154        void update_after_resize();
155    
156      int h;      int h;
157      int w;  
158        Glib::RefPtr<ActionGroup> actionGroup;
159    #if USE_GTKMM_BUILDER
160        Glib::RefPtr<Gtk::Builder> uiManager;
161    #else
162        Glib::RefPtr<Gtk::UIManager> uiManager;
163    #endif
164        Gtk::Menu* popup_menu_inside_dimregion;
165        Gtk::Menu* popup_menu_outside_dimregion;
166    
167    private:
168        Glib::RefPtr<Action> actionDeleteDimZone;
169        Glib::RefPtr<Action> actionSplitDimZone;
170  };  };
171    
172  #endif  #endif

Legend:
Removed from v.1303  
changed lines
  Added in v.3364

  ViewVC Help
Powered by ViewVC