Do not use key_shifts anymore.

This commit is contained in:
David Capello 2010-10-20 00:07:27 -03:00
parent 9e4972fc53
commit 39e7fc5fea
6 changed files with 21 additions and 16 deletions

View File

@ -463,7 +463,7 @@ int Frame::get_action(int x, int y)
(x < cpos->x2) &&
(y >= pos->y1+this->border_width.b) &&
(y < cpos->y1))
|| (key_shifts & KB_ALT_FLAG))) {
|| (key[KEY_ALT]))) {
action = WINDOW_MOVE;
}
/* resize */

View File

@ -32,16 +32,17 @@ JMessage jmessage_new(int type)
msg->type = type;
msg->any.widgets = jlist_new();
msg->any.shifts = key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG);
msg->any.shifts =
(key[KEY_LSHIFT] || key[KEY_RSHIFT] ? KB_SHIFT_FLAG: 0) |
(key[KEY_LCONTROL] || key[KEY_RCONTROL] ? KB_CTRL_FLAG: 0) |
(key[KEY_ALT] ? KB_ALT_FLAG: 0);
/* printf("type=%02d ", type); */
/* if (key_shifts & KB_SHIFT_FLAG) */
/* printf("KB_SHIFT_FLAG "); */
/* if (key_shifts & KB_CTRL_FLAG) */
/* printf("KB_CTRL_FLAG "); */
/* if (key_shifts & KB_ALT_FLAG) */
/* printf("KB_ALT_FLAG "); */
/* printf("\n"); */
// printf("type=%02d ", type);
// if (msg->any.shifts & KB_SHIFT_FLAG) printf("KB_SHIFT_FLAG ");
// if (msg->any.shifts & KB_CTRL_FLAG) printf("KB_CTRL_FLAG ");
// if (msg->any.shifts & KB_ALT_FLAG) printf("KB_ALT_FLAG ");
// printf("\n");
// fflush(stdout);
return msg;
}

View File

@ -73,7 +73,7 @@ int main(int argc, char *argv[])
if (!mask)
mask = mask_new ();
if (key_shifts & KB_ALT_FLAG) {
if (key[KEY_ALT]) {
if (first & 1)
mask_replace (mask,
MIN (xbeg, xend),

View File

@ -17,7 +17,7 @@
*/
#include <cmath>
#include <allegro.h> // TODO avoid to include this for key_shifts
#include <allegro.h> // TODO avoid to include this for key[]
#ifndef M_PI
#define M_PI 3.14159265358979323846
@ -81,7 +81,7 @@ public:
points[1] = point;
// Square aspect
if (key_shifts & KB_SHIFT_FLAG) { // TODO avoid direct access to key_shifts
if (key[KEY_LSHIFT] || key[KEY_RSHIFT]) {
int dx = points[1].x - m_center.x;
int dy = points[1].y - m_center.y;
int minsize = MIN(ABS(dx), ABS(dy));
@ -125,7 +125,7 @@ public:
}
// Center
if (key_shifts & KB_CTRL_FLAG) { // TODO avoid direct access to key_shifts
if (key[KEY_LCONTROL] || key[KEY_RCONTROL]) {
int rx = points[1].x - m_center.x;
int ry = points[1].y - m_center.y;
points[0].x = m_center.x - rx;

View File

@ -481,7 +481,7 @@ static bool interactive_transform(Editor* editor,
/* button pressed */
if (jmouse_b(0)) {
/* left button+shift || middle button = scroll movement */
if ((jmouse_b(0) == 1 && (key_shifts & KB_SHIFT_FLAG)) ||
if ((jmouse_b(0) == 1 && (key[KEY_LSHIFT] || key[KEY_RSHIFT])) ||
(jmouse_b(0) == 4)) {
JWidget view = jwidget_get_view(editor);
int scroll_x, scroll_y;

View File

@ -39,7 +39,11 @@ bool Editor::editor_keys_toset_zoom(int scancode)
{
if ((m_sprite) &&
(this->hasMouse()) &&
!(key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))) {
!key[KEY_LSHIFT] &&
!key[KEY_RSHIFT] &&
!key[KEY_LCONTROL] &&
!key[KEY_RCONTROL] &&
!key[KEY_ALT]) {
JWidget view = jwidget_get_view(this);
JRect vp = jview_get_viewport_position(view);
int x, y, zoom;