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

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

  ViewVC Help
Powered by ViewVC