equal
deleted
inserted
replaced
7 #include "variables.h" |
7 #include "variables.h" |
8 #include "hal.h" |
8 #include "hal.h" |
9 #include <stdarg.h> |
9 #include <stdarg.h> |
10 #include "console.h" |
10 #include "console.h" |
11 |
11 |
|
12 #ifdef WIN32 |
|
13 #include <windows.h> |
|
14 #endif |
|
15 |
12 // ** main console ** // |
16 // ** main console ** // |
13 static bool _iconsole_inited; |
17 static bool _iconsole_inited; |
14 static byte* _iconsole_buffer[80]; |
18 static byte* _iconsole_buffer[80]; |
15 static byte _iconsole_cbuffer[80]; |
19 static byte _iconsole_cbuffer[80]; |
16 static byte _iconsole_cmdline[255]; |
20 static byte _iconsole_cmdline[255]; |
46 |
50 |
47 /* *************** */ |
51 /* *************** */ |
48 /* end of header */ |
52 /* end of header */ |
49 /* *************** */ |
53 /* *************** */ |
50 |
54 |
51 void IConsoleClearCommand() |
55 static void IConsoleAppendClipboard() |
|
56 { |
|
57 #ifdef WIN32 |
|
58 if (IsClipboardFormatAvailable(CF_TEXT)) { |
|
59 byte * data; |
|
60 HGLOBAL cbuf; |
|
61 int i; |
|
62 |
|
63 OpenClipboard(NULL); |
|
64 cbuf = GetClipboardData(CF_TEXT); |
|
65 data = (byte *) GlobalLock(cbuf); |
|
66 |
|
67 i=0; |
|
68 while (IS_INT_INSIDE(data[i], 32, 256)) { |
|
69 _iconsole_cmdline[_iconsole_cmdpos]=data[i]; |
|
70 i++; |
|
71 _iconsole_cmdpos++; |
|
72 } |
|
73 |
|
74 GlobalUnlock(cbuf); |
|
75 CloseClipboard(); |
|
76 } |
|
77 #endif |
|
78 } |
|
79 |
|
80 static void IConsoleClearCommand() |
52 { |
81 { |
53 int i; |
82 int i; |
54 for (i=0; i<255; i++) _iconsole_cmdline[i]=0; |
83 for (i=0; i<255; i++) _iconsole_cmdline[i]=0; |
55 _iconsole_cmdpos=0; |
84 _iconsole_cmdpos=0; |
56 SetWindowDirty(_iconsole_win); |
85 SetWindowDirty(_iconsole_win); |
102 _iconsole_mode=ICONSOLE_CLOSED; |
131 _iconsole_mode=ICONSOLE_CLOSED; |
103 break; |
132 break; |
104 |
133 |
105 case WE_KEYPRESS: |
134 case WE_KEYPRESS: |
106 e->keypress.cont=false; |
135 e->keypress.cont=false; |
|
136 if (e->keypress.keycode == (WKC_CTRL | 'V')) |
|
137 { |
|
138 IConsoleAppendClipboard(); |
|
139 SetWindowDirty(w); |
|
140 } else |
107 if (e->keypress.keycode == (WKC_UP)) |
141 if (e->keypress.keycode == (WKC_UP)) |
108 { |
142 { |
109 IConsoleCmdBufferNavigate(+1); |
143 IConsoleCmdBufferNavigate(+1); |
110 SetWindowDirty(w); |
144 SetWindowDirty(w); |
111 } else |
145 } else |