KeyEvents.c File Reference

#include "KeyEvents.h"

Include dependency graph for KeyEvents.c:

Go to the source code of this file.

Defines

#define CTRL_KEY   1000
#define SHIFT_KEY   2000
#define VK_SLEEP   0x5F
#define SCI_VK_CANCEL   65288
#define SCI_VK_PAUSE   65299
#define SCI_VK_SLEEP   65300
#define SCI_VK_INSERT   65379
#define SCI_VK_DELETE   65535
#define SCI_VK_END   65367
#define SCI_VK_HOME   65360
#define SCI_VK_PRIOR   65365
#define SCI_VK_NEXT   65366
#define SCI_VK_BACK   65289
#define SCI_VK_NUMLOCK   65407
#define SCI_VK_SCROLL   65300
#define SCI_VK_SNAPSHOT   0
#define SCI_VK_TAB   65289
#define SCI_VK_ESCAPE   65307
#define SCI_VK_CLEAR   65408
#define SCI_VK_LEFT   65361
#define SCI_VK_F1   65470

Functions

int check_pointer_win __PARAMS ((int *x1, int *y1, int *win))
BOOL IsASpecialKey (UINT vk)
UINT GetScilabSpecialKeyCode (UINT vk)
BOOL is_dead_key (int vk)
void ON_EVENT_GRAPH_WM_KEYUP (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
void ON_EVENT_GRAPH_WM_KEYDOWN (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)


Define Documentation

#define CTRL_KEY   1000

Definition at line 9 of file KeyEvents.c.

Referenced by ON_EVENT_GRAPH_WM_KEYDOWN(), ON_EVENT_GRAPH_WM_KEYUP(), ON_EVENT_GRAPH_WM_LBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_LBUTTONUP(), ON_EVENT_GRAPH_WM_MBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_MBUTTONUP(), ON_EVENT_GRAPH_WM_MOUSEMOVE(), ON_EVENT_GRAPH_WM_RBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_RBUTTONUP(), reset_left_click_counter(), reset_middle_click_counter(), and reset_right_click_counter().

#define SCI_VK_BACK   65289

Definition at line 25 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_CANCEL   65288

Definition at line 16 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_CLEAR   65408

Definition at line 31 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_DELETE   65535

Definition at line 20 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_END   65367

Definition at line 21 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_ESCAPE   65307

Definition at line 30 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_F1   65470

Definition at line 33 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_HOME   65360

Definition at line 22 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_INSERT   65379

Definition at line 19 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_LEFT   65361

Definition at line 32 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_NEXT   65366

Definition at line 24 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_NUMLOCK   65407

Definition at line 26 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_PAUSE   65299

Definition at line 17 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_PRIOR   65365

Definition at line 23 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_SCROLL   65300

Definition at line 27 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_SLEEP   65300

Definition at line 18 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_SNAPSHOT   0

Definition at line 28 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SCI_VK_TAB   65289

Definition at line 29 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode().

#define SHIFT_KEY   2000

Definition at line 10 of file KeyEvents.c.

Referenced by ON_EVENT_GRAPH_WM_LBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_LBUTTONUP(), ON_EVENT_GRAPH_WM_MBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_MBUTTONUP(), ON_EVENT_GRAPH_WM_MOUSEMOVE(), ON_EVENT_GRAPH_WM_RBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_RBUTTONUP(), reset_left_click_counter(), reset_middle_click_counter(), and reset_right_click_counter().

#define VK_SLEEP   0x5F

Definition at line 12 of file KeyEvents.c.

Referenced by GetScilabSpecialKeyCode(), and IsASpecialKey().


Function Documentation

int check_pointer_win __PARAMS ( (int *x1, int *y1, int *win)   ) 

UINT GetScilabSpecialKeyCode ( UINT  vk  ) 

Definition at line 162 of file KeyEvents.c.

References SCI_VK_BACK, SCI_VK_CANCEL, SCI_VK_CLEAR, SCI_VK_DELETE, SCI_VK_END, SCI_VK_ESCAPE, SCI_VK_F1, SCI_VK_HOME, SCI_VK_INSERT, SCI_VK_LEFT, SCI_VK_NEXT, SCI_VK_NUMLOCK, SCI_VK_PAUSE, SCI_VK_PRIOR, SCI_VK_SCROLL, SCI_VK_SLEEP, SCI_VK_SNAPSHOT, SCI_VK_TAB, UINT, and VK_SLEEP.

Referenced by ON_EVENT_GRAPH_WM_KEYDOWN(), and ON_EVENT_GRAPH_WM_KEYUP().

00163 {
00164         UINT ScilabSpecialKeyCode=0;
00165 
00166         if (vk == VK_CANCEL)  ScilabSpecialKeyCode=SCI_VK_CANCEL;
00167         if (vk == VK_PAUSE)  ScilabSpecialKeyCode=SCI_VK_PAUSE;
00168         if (vk == VK_SLEEP)  ScilabSpecialKeyCode=SCI_VK_SLEEP; 
00169         if (vk == VK_INSERT) ScilabSpecialKeyCode=SCI_VK_INSERT;
00170         if (vk == VK_DELETE) ScilabSpecialKeyCode=SCI_VK_DELETE;
00171         if (vk == VK_END)  ScilabSpecialKeyCode=SCI_VK_END;
00172         if (vk == VK_HOME)  ScilabSpecialKeyCode=SCI_VK_HOME;
00173         if (vk == VK_PRIOR)  ScilabSpecialKeyCode=SCI_VK_PRIOR;
00174         if (vk == VK_NEXT)  ScilabSpecialKeyCode=SCI_VK_NEXT;
00175         if (vk == VK_BACK)  ScilabSpecialKeyCode=SCI_VK_BACK;
00176         if (vk == VK_NUMLOCK)  ScilabSpecialKeyCode=SCI_VK_NUMLOCK; 
00177         if (vk == VK_SCROLL)  ScilabSpecialKeyCode=SCI_VK_SCROLL; 
00178         if (vk == VK_SNAPSHOT ) ScilabSpecialKeyCode=SCI_VK_SNAPSHOT;
00179         if (vk == VK_TAB)   ScilabSpecialKeyCode=SCI_VK_TAB;
00180         if (vk ==  VK_ESCAPE ) ScilabSpecialKeyCode=SCI_VK_ESCAPE;
00181   if (vk == VK_CLEAR ) ScilabSpecialKeyCode=SCI_VK_CLEAR;
00182         if ( (vk>=VK_LEFT) && (vk<=VK_DOWN) )  ScilabSpecialKeyCode= (SCI_VK_LEFT-VK_LEFT)+vk;
00183         if ( (vk>=VK_F1) && (vk<=VK_F24) )  ScilabSpecialKeyCode= (SCI_VK_F1-VK_F1)+vk;
00184 
00185         return ScilabSpecialKeyCode;
00186 }

Here is the caller graph for this function:

BOOL is_dead_key ( int  vk  ) 

Definition at line 188 of file KeyEvents.c.

References code, FALSE, and TRUE.

Referenced by ON_EVENT_GRAPH_WM_KEYDOWN(), and ON_EVENT_GRAPH_WM_KEYUP().

00189 { 
00190         unsigned int code = MapVirtualKey ( vk, 2 ); 
00191 
00192         // Windows 95 retourne 0x8000, NT retourne 0x80000000 
00193         return (code & 0x80008000) ? TRUE : FALSE; 
00194 } 

Here is the caller graph for this function:

BOOL IsASpecialKey ( UINT  vk  ) 

Definition at line 136 of file KeyEvents.c.

References FALSE, TRUE, and VK_SLEEP.

Referenced by ON_EVENT_GRAPH_WM_KEYDOWN(), and ON_EVENT_GRAPH_WM_KEYUP().

00137 {
00138         BOOL bOK=FALSE;
00139 
00140         if (vk == VK_CANCEL) return TRUE;
00141         if (vk == VK_PAUSE) return TRUE;
00142         if (vk == VK_SLEEP) return TRUE;
00143         if (vk == VK_INSERT) return TRUE;
00144         if (vk == VK_DELETE) return TRUE;
00145         if (vk == VK_END) return TRUE;
00146         if (vk == VK_HOME) return TRUE;
00147         if (vk == VK_PRIOR) return TRUE;
00148         if (vk == VK_NEXT) return TRUE;
00149         if (vk == VK_BACK) return TRUE;
00150         if (vk == VK_NUMLOCK) return TRUE;
00151         if (vk == VK_SCROLL) return TRUE;
00152         if (vk == VK_TAB) return TRUE;
00153         if (vk == VK_ESCAPE ) return TRUE;
00154         if (vk == VK_SNAPSHOT ) return TRUE;
00155         if (vk == VK_CLEAR ) return TRUE;
00156         if ( (vk>=VK_LEFT) && (vk<=VK_DOWN) ) return TRUE;
00157         if ( (vk>=VK_F1) && (vk<=VK_F24) ) return TRUE;
00158 
00159         return FALSE;
00160 }

Here is the caller graph for this function:

void ON_EVENT_GRAPH_WM_KEYDOWN ( HWND  hwnd,
UINT  vk,
BOOL  fDown,
int  cRepeat,
UINT  flags 
)

Definition at line 89 of file KeyEvents.c.

References Char, check_pointer_win(), CTRL_KEY, BCG::CurWindow, GetScilabSpecialKeyCode(), is_dead_key(), IsASpecialKey(), KeyState, memset(), PushClickQueue(), UINT, x, and y.

Referenced by GetEventKeyboardAndMouse().

00090 {
00091         if ( is_dead_key (vk) )
00092         {
00093                 // Nothing to do
00094         }
00095         else
00096         {
00097                 if (IsASpecialKey(vk))
00098                 {
00099                         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00100                         int x,y,iwin;
00101                         check_pointer_win(&x,&y,&iwin);
00102                         PushClickQueue (ScilabGC->CurWindow, x,y,(int)GetScilabSpecialKeyCode(vk),0,0);
00103                 }
00104                 else
00105                 {
00106                         WORD Char=0;
00107                         BYTE KeyState[256]; // Etat des 256 touches du clavier 
00108                         memset ( KeyState, 0, sizeof(KeyState) ); 
00109                         if ( GetKeyboardState ( KeyState ) ) 
00110                         {
00111                                 int RetToAscii=0;
00112                                 int x,y,iwin;
00113                                 struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00114                                 int CodeKey=0;
00115 
00116                                 RetToAscii=ToAscii ( (UINT) vk,MapVirtualKey(vk, 0), KeyState, &Char, 0 );
00117                                 if (RetToAscii)
00118                                 {
00119                                         if (GetKeyState (VK_CONTROL) < 0)
00120                                         {
00121                                                 if ((Char>=1) && (Char<=29))
00122                                                 {
00123                                                         CodeKey=('a'-1+Char)+CTRL_KEY;
00124                                                 }
00125                                         }
00126                                         else CodeKey=Char;
00127 
00128                                         check_pointer_win(&x,&y,&iwin);
00129                                         PushClickQueue (ScilabGC->CurWindow, x,y,(int)CodeKey,0,0);
00130                                 }
00131                         }
00132                 }
00133         }
00134 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ON_EVENT_GRAPH_WM_KEYUP ( HWND  hwnd,
UINT  vk,
BOOL  fDown,
int  cRepeat,
UINT  flags 
)

Definition at line 42 of file KeyEvents.c.

References Char, check_pointer_win(), CTRL_KEY, BCG::CurWindow, GetScilabSpecialKeyCode(), is_dead_key(), IsASpecialKey(), KeyState, memset(), PushClickQueue(), UINT, x, and y.

Referenced by GetEventKeyboardAndMouse().

00043 {
00044         if ( is_dead_key (vk) )
00045         {
00046                 // Nothing to do
00047         }
00048         else
00049         {
00050                 if (IsASpecialKey(vk))
00051                 {
00052                         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00053                         int x,y,iwin;
00054                         check_pointer_win(&x,&y,&iwin);
00055                         PushClickQueue (ScilabGC->CurWindow, x,y,-(int)GetScilabSpecialKeyCode(vk),0,1);
00056                 }
00057                 else
00058                 {
00059                         WORD Char=0;
00060                         BYTE KeyState[256]; // Etat des 256 touches du clavier 
00061                         memset ( KeyState, 0, sizeof(KeyState) ); 
00062                         if ( GetKeyboardState ( KeyState ) ) 
00063                         {
00064                                 int RetToAscii=0;
00065                                 int x,y,iwin;
00066                                 struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00067                                 int CodeKey=0;
00068 
00069                                 RetToAscii=ToAscii ( (UINT) vk,MapVirtualKey(vk, 0), KeyState, &Char, 0 );
00070                                 if (RetToAscii)
00071                                 {
00072                                         if (GetKeyState (VK_CONTROL) < 0)
00073                                         {
00074                                                 if ((Char>=1) && (Char<=29))
00075                                                 {
00076                                                         CodeKey=('a'-1+Char)+CTRL_KEY;
00077                                                 }
00078                                         }
00079                                         else CodeKey=Char;
00080 
00081                                         check_pointer_win(&x,&y,&iwin);
00082                                         PushClickQueue (ScilabGC->CurWindow, x,y,-(int)CodeKey,0,1);
00083                                 }
00084                         }
00085                 }
00086         }
00087 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 15:57:44 2007 for Scilab [trunk] by  doxygen 1.5.1