82 |
protected: |
protected: |
83 |
#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 |
84 |
virtual bool on_expose_event(GdkEventExpose* e); |
virtual bool on_expose_event(GdkEventExpose* e); |
85 |
#endif |
#else |
86 |
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
87 |
|
#endif |
88 |
virtual bool on_button_press_event(GdkEventButton* event); |
virtual bool on_button_press_event(GdkEventButton* event); |
89 |
virtual bool on_button_release_event(GdkEventButton* event); |
virtual bool on_button_release_event(GdkEventButton* event); |
90 |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
110 |
SortedRegions regions; |
SortedRegions regions; |
111 |
|
|
112 |
bool is_black_key(int key); |
bool is_black_key(int key); |
113 |
void draw_key(int key, const Gdk::RGBA& color); |
void draw_keyboard(const Cairo::RefPtr<Cairo::Context>& cr, |
114 |
void draw_digit(int key); |
int clip_low, int clip_high); |
115 |
|
void draw_regions(const Cairo::RefPtr<Cairo::Context>& cr, |
116 |
|
int clip_low, int clip_high); |
117 |
|
void draw_key(const Cairo::RefPtr<Cairo::Context>& cr, int key); |
118 |
|
void draw_digit(const Cairo::RefPtr<Cairo::Context>& cr, int key); |
119 |
void motion_resize_region(int x, int y); |
void motion_resize_region(int x, int y); |
120 |
void motion_move_region(int x, int y); |
void motion_move_region(int x, int y); |
121 |
|
void update_after_resize(); |
122 |
|
void update_after_move(int pos); |
123 |
|
void invalidate_key(int key); |
124 |
|
|
125 |
|
// returns the leftmost pixel of a key |
126 |
|
int key_to_x(double k, int w) const { |
127 |
|
return int(k * w / 128.0 + 0.5); |
128 |
|
} |
129 |
|
|
130 |
|
// returns the key given a pixel |
131 |
|
int x_to_key(double x, int w) const { |
132 |
|
return int(x / w * 128.0); |
133 |
|
} |
134 |
|
|
135 |
|
// returns the key given a pixel. If the pixel is the border |
136 |
|
// between two keys, the key to the ríght is always returned. |
137 |
|
int x_to_key_right(double x, int w) const { |
138 |
|
return int(ceil((x + 0.5) / w * 128.0)) - 1; |
139 |
|
} |
140 |
|
|
141 |
// information needed during a resize |
// information needed during a resize |
142 |
struct { |
struct { |
156 |
// information needed during a region move |
// information needed during a region move |
157 |
struct { |
struct { |
158 |
bool active; |
bool active; |
159 |
double from_x; |
int offset; |
|
int pos; |
|
|
bool touch_left; |
|
|
bool touch_right; |
|
160 |
} move; |
} move; |
161 |
|
|
162 |
bool cursor_is_resize; |
bool cursor_is_resize; |
176 |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
177 |
Glib::RefPtr<Gtk::UIManager> uiManager; |
Glib::RefPtr<Gtk::UIManager> uiManager; |
178 |
|
|
179 |
// properties of the virtaul keyboard |
// properties of the virtual keyboard |
180 |
ChoiceEntry<virt_keyboard_mode_t> m_VirtKeybModeChoice; |
ChoiceEntry<virt_keyboard_mode_t> m_VirtKeybModeChoice; |
181 |
Gtk::Label m_VirtKeybVelocityLabelDescr; |
Gtk::Label m_VirtKeybVelocityLabelDescr; |
182 |
Gtk::Label m_VirtKeybVelocityLabel; |
Gtk::Label m_VirtKeybVelocityLabel; |
183 |
Gtk::Label m_VirtKeybOffVelocityLabelDescr; |
Gtk::Label m_VirtKeybOffVelocityLabelDescr; |
184 |
Gtk::Label m_VirtKeybOffVelocityLabel; |
Gtk::Label m_VirtKeybOffVelocityLabel; |
185 |
int currentActiveKey; |
int currentActiveKey; |
186 |
|
bool key_pressed[128]; |
187 |
|
|
188 |
DimensionManager dimensionManager; |
DimensionManager dimensionManager; |
189 |
}; |
}; |