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

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

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

revision 2169 by persson, Sun Mar 6 07:51:04 2011 UTC revision 2844 by persson, Sun Sep 20 08:49:40 2015 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006-2011 Andreas Persson   * Copyright (C) 2006-2015 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 22  Line 22 
22    
23  #include <vector>  #include <vector>
24    
25    #include <gtkmm/box.h>
26  #include <gtkmm/drawingarea.h>  #include <gtkmm/drawingarea.h>
27  #include <gtkmm/uimanager.h>  #include <gtkmm/uimanager.h>
28  #include <gdkmm/window.h>  #include <gdkmm/window.h>
# Line 47  public: Line 48  public:
48      void update(gig::Instrument* instrument);      void update(gig::Instrument* instrument);
49      gig::Region* first();      gig::Region* first();
50      gig::Region* next();      gig::Region* next();
51      bool operator() (gig::Region* x, gig::Region* y) {      bool operator() (gig::Region* x, gig::Region* y) const {
52          return x->KeyRange.low < y->KeyRange.low;          return x->KeyRange.low < y->KeyRange.low;
53      }      }
54  };  };
# Line 73  public: Line 74  public:
74      sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();      sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
75    
76      gig::Region* get_region() { return region; }      gig::Region* get_region() { return region; }
77        void set_region(gig::Region* region);
78    
79      void on_note_on_event(int key, int velocity);      void on_note_on_event(int key, int velocity);
80      void on_note_off_event(int key, int velocity);      void on_note_off_event(int key, int velocity);
# Line 82  public: Line 84  public:
84  protected:  protected:
85  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
86      virtual bool on_expose_event(GdkEventExpose* e);      virtual bool on_expose_event(GdkEventExpose* e);
87  #endif  #else
88      virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);      virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
89    #endif
90      virtual bool on_button_press_event(GdkEventButton* event);      virtual bool on_button_press_event(GdkEventButton* event);
91      virtual bool on_button_release_event(GdkEventButton* event);      virtual bool on_button_release_event(GdkEventButton* event);
92      virtual bool on_motion_notify_event(GdkEventMotion* event);      virtual bool on_motion_notify_event(GdkEventMotion* event);
# Line 109  protected: Line 112  protected:
112      SortedRegions regions;      SortedRegions regions;
113    
114      bool is_black_key(int key);      bool is_black_key(int key);
115      void draw_key(int key, const Gdk::RGBA& color);      void draw_keyboard(const Cairo::RefPtr<Cairo::Context>& cr,
116      void draw_digit(int key);                         int clip_low, int clip_high);
117        void draw_regions(const Cairo::RefPtr<Cairo::Context>& cr,
118                          int clip_low, int clip_high);
119        void draw_key(const Cairo::RefPtr<Cairo::Context>& cr, int key);
120        void draw_digit(const Cairo::RefPtr<Cairo::Context>& cr, int key);
121      void motion_resize_region(int x, int y);      void motion_resize_region(int x, int y);
122      void motion_move_region(int x, int y);      void motion_move_region(int x, int y);
123        void update_after_resize();
124        void update_after_move(int pos);
125        void invalidate_key(int key);
126    
127        // returns the leftmost pixel of a key
128        int key_to_x(double k, int w) const {
129            return int(k * w / 128.0 + 0.5);
130        }
131    
132        // returns the key given a pixel
133        int x_to_key(double x, int w) const {
134            return int(x / w * 128.0);
135        }
136    
137        // returns the key given a pixel. If the pixel is the border
138        // between two keys, the key to the ríght is always returned.
139        int x_to_key_right(double x, int w) const {
140            return int(ceil((x + 0.5) / w * 128.0)) - 1;
141        }
142    
143      // information needed during a resize      // information needed during a resize
144      struct {      struct {
# Line 132  protected: Line 158  protected:
158      // information needed during a region move      // information needed during a region move
159      struct {      struct {
160          bool active;          bool active;
161          double from_x;          int offset;
         int pos;  
         bool touch_left;  
         bool touch_right;  
162      } move;      } move;
163    
164      bool cursor_is_resize;      bool cursor_is_resize;
# Line 155  protected: Line 178  protected:
178      Glib::RefPtr<Gtk::ActionGroup> actionGroup;      Glib::RefPtr<Gtk::ActionGroup> actionGroup;
179      Glib::RefPtr<Gtk::UIManager> uiManager;      Glib::RefPtr<Gtk::UIManager> uiManager;
180    
181      // properties of the virtaul keyboard      // properties of the virtual keyboard
182      ChoiceEntry<virt_keyboard_mode_t> m_VirtKeybModeChoice;      ChoiceEntry<virt_keyboard_mode_t> m_VirtKeybModeChoice;
183      Gtk::Label m_VirtKeybVelocityLabelDescr;      Gtk::Label m_VirtKeybVelocityLabelDescr;
184      Gtk::Label m_VirtKeybVelocityLabel;      Gtk::Label m_VirtKeybVelocityLabel;
185      Gtk::Label m_VirtKeybOffVelocityLabelDescr;      Gtk::Label m_VirtKeybOffVelocityLabelDescr;
186      Gtk::Label m_VirtKeybOffVelocityLabel;      Gtk::Label m_VirtKeybOffVelocityLabel;
187      int currentActiveKey;      int currentActiveKey;
188        bool key_pressed[128];
189    
190      DimensionManager dimensionManager;      DimensionManager dimensionManager;
191  };  };

Legend:
Removed from v.2169  
changed lines
  Added in v.2844

  ViewVC Help
Powered by ViewVC