/[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 3089 by schoenebeck, Sun Jan 15 19:18:39 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  class DimRegionChooser : public Gtk::DrawingArea  class DimRegionChooser : public Gtk::DrawingArea
40  {  {
41  public:  public:
42      DimRegionChooser();      DimRegionChooser(Gtk::Window& window);
43      virtual ~DimRegionChooser();      virtual ~DimRegionChooser();
44    
     void set_fromto(int from, int to);  
   
45      void set_region(gig::Region* region);      void set_region(gig::Region* region);
46    
47      sigc::signal<void> signal_sel_changed();      sigc::signal<void>& signal_dimregion_selected();
48        sigc::signal<void>& signal_region_changed();
49    
50      gig::DimensionRegion* get_dimregion() { return dimreg; }      gig::DimensionRegion* get_main_dimregion() const;
51        void get_dimregions(const gig::Region* region, bool stereo,
52                            std::set<gig::DimensionRegion*>& dimregs) const;
53        bool select_dimregion(gig::DimensionRegion* dimrgn);
54    
55        // those 3 are ATM only relevant when resizing custom dimension region zones
56        void setModifyBothChannels(bool b);
57        void setModifyAllDimensionRegions(bool b);
58        void setModifyAllRegions(bool b);
59    
60  protected:  protected:
61      virtual void on_realize();  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
62      virtual bool on_expose_event(GdkEventExpose* e);      virtual bool on_expose_event(GdkEventExpose* e);
63      virtual void on_size_request(GtkRequisition* requisition);  #else
64        virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
65    #endif
66      virtual bool on_button_press_event(GdkEventButton* event);      virtual bool on_button_press_event(GdkEventButton* event);
67      virtual bool on_button_release_event(GdkEventButton* event);      virtual bool on_button_release_event(GdkEventButton* event);
68      virtual bool on_motion_notify_event(GdkEventMotion* event);      virtual bool on_motion_notify_event(GdkEventMotion* event);
69      virtual bool on_focus(Gtk::DirectionType direction);      virtual bool on_focus(Gtk::DirectionType direction);
70        bool onKeyPressed(GdkEventKey* key);
71        bool onKeyReleased(GdkEventKey* key);
72        void refresh_all();
73        void split_dimension_zone();
74        void delete_dimension_zone();
75        void resetSelectedZones();
76    
77      Glib::RefPtr<Gdk::GC> gc;      Gdk::RGBA red, black, white;
     Gdk::Color blue, red, black, white, green;  
78    
79      gig::Instrument* instrument;      gig::Instrument* instrument;
80      gig::Region* region;      gig::Region* region;
     int dimregno;  
81    
82      sigc::signal<void> sel_changed_signal;      sigc::signal<void> dimregion_selected;
83        sigc::signal<void> region_changed;
84    
85      gig::DimensionRegion* dimreg;      // those 3 are ATM only relevant when resizing custom dimension region zones
86        bool modifybothchannels;
87        bool modifyalldimregs;
88        bool modifyallregions;
89    
90        //std::set<gig::DimensionRegion*> dimregs; ///< Reflects which dimension regions are currently selected.
91      int focus_line;      int focus_line;
92      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];  
93      int label_width;      int label_width;
94        bool labels_changed;
95      int nbDimensions;      int nbDimensions;
96    
97        // the "main" dimension region is the one that is used to i.e. evaluate the
98        // precise custom velocity splits (could also be interpreted for focus stuff,
99        // i.e. keyboard arrow key navigation)
100        // NOTE: these may *not* necessarily currently be selected !
101        gig::dimension_t maindimtype;
102        std::map<gig::dimension_t,int> maindimcase;
103        int maindimregno;
104    
105      // information needed during a resize      // information needed during a resize
106      struct {      struct {
107          bool active;          bool active;
# Line 77  protected: Line 114  protected:
114          int min;          int min;
115          int max;          int max;
116          int dimension;          int dimension;
117          int offset;          gig::dimension_def_t dimensionDef;
118            int zone;
119      } resize;      } resize;
120    
121        bool multiSelectKeyDown;
122    
123      bool cursor_is_resize;      bool cursor_is_resize;
124      bool is_in_resize_zone(double x, double y);      bool is_in_resize_zone(double x, double y);
125        void update_after_resize();
126    
127      int h;      int h;
128      int w;  
129        Glib::RefPtr<Gtk::ActionGroup> actionGroup;
130        Glib::RefPtr<Gtk::UIManager> uiManager;
131        Gtk::Menu* popup_menu_inside_dimregion;
132        Gtk::Menu* popup_menu_outside_dimregion;
133  };  };
134    
135  #endif  #endif

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

  ViewVC Help
Powered by ViewVC