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

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

  ViewVC Help
Powered by ViewVC