textbox.cの実装を強化。
それなりに入力処理はできるようになった。コンソールには使えるくらいに。
対応しているのは、印字可能文字とタブ、バックスペース、改行。
@@ -14,16 +14,23 @@ | ||
14 | 14 | return textbox; |
15 | 15 | } |
16 | 16 | |
17 | -//bpp==0:自動選択(現在のシステムシートの設定に合わせる) | |
17 | +//bpp==0:?????I??(???݂̃V?X?e???V?[?g?̐ݒ?ɍ??킹??) | |
18 | 18 | uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent) |
19 | 19 | { |
20 | 20 | if(textbox == Null){ |
21 | 21 | #ifdef CHNOSPROJECT_DEBUG_TEXTBOX |
22 | - debug("TextBox_SetBuffer:Null textbox."); | |
23 | - return 1; | |
22 | + debug("TextBox_SetBuffer:Null textbox.\n"); | |
24 | 23 | #endif |
24 | + return 1; | |
25 | 25 | } |
26 | 26 | |
27 | + if(xchars < 4 + 1 || ychars < 1){ | |
28 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
29 | + debug("TextBox_SetBuffer:Too small textbox.\n"); | |
30 | + #endif | |
31 | + return 2; | |
32 | + } | |
33 | + | |
27 | 34 | textbox->chars.x = xchars; |
28 | 35 | textbox->chars.y = ychars; |
29 | 36 | textbox->size_text_buf = textbox->chars.x * textbox->chars.y; |
@@ -32,10 +39,10 @@ | ||
32 | 39 | Sheet_SetBuffer(textbox->sheet, Null, xchars << 3, ychars << 4, bpp); |
33 | 40 | Sheet_SetParent(textbox->sheet, parent); |
34 | 41 | |
35 | - textbox->sheet->Drawing.Fill_Rectangle(textbox->sheet, textbox->backcol, 0, 0, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1); | |
42 | + Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, 0, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1); | |
36 | 43 | |
37 | 44 | textbox->text_buf = System_Memory_Allocate(textbox->size_text_buf); |
38 | - textbox->text_buf[0] = Null; | |
45 | + textbox->text_buf[0] = 0x00; | |
39 | 46 | |
40 | 47 | textbox->flags.bit.textbuffer_configured = True; |
41 | 48 |
@@ -46,31 +53,231 @@ | ||
46 | 53 | { |
47 | 54 | if(textbox == Null){ |
48 | 55 | #ifdef CHNOSPROJECT_DEBUG_TEXTBOX |
49 | - debug("TextBox_Show:Null textbox."); | |
50 | - return 1; | |
56 | + debug("TextBox_Show:Null textbox.\n"); | |
51 | 57 | #endif |
58 | + return 1; | |
52 | 59 | } |
53 | 60 | |
61 | + if(textbox->sheet == Null){ | |
62 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
63 | + debug("TextBox_Show:Null textbox sheet.\n"); | |
64 | + #endif | |
65 | + return 2; | |
66 | + } | |
67 | + | |
54 | 68 | return Sheet_Show(textbox->sheet, height, px, py); |
55 | 69 | } |
56 | 70 | |
57 | -uint TextBox_Put_Character(UI_TextBox *textbox, uchar c) | |
71 | +//char??n?????Ƃ??\?B | |
72 | +//Break???̃L?[?R?[?h?͖??????ĉ??????͂??Ȃ??ikeyid?ړn???????œ??͂??ł???悤?ɂ??邽?߁j?B | |
73 | +//?^?u?????́A?L?^???I?t?̎??̂ݓ??͉\?B | |
74 | +uint TextBox_Put_Character(UI_TextBox *textbox, ushort keyid) | |
58 | 75 | { |
59 | 76 | uchar s[2]; |
77 | + uint i; | |
60 | 78 | |
61 | - s[0] = c; | |
62 | - s[1] = 0x00; | |
79 | + if(textbox == Null){ | |
80 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
81 | + debug("TextBox_Put_Character:Null textbox.\n"); | |
82 | + #endif | |
83 | + return 1; | |
84 | + } | |
63 | 85 | |
64 | - #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
65 | - debug("TextBox_Put_Character:put [%c].\n", c); | |
66 | - #endif | |
86 | + if(textbox->sheet == Null){ | |
87 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
88 | + debug("TextBox_Put_Character:Null textbox sheet.\n"); | |
89 | + #endif | |
90 | + return 2; | |
91 | + } | |
67 | 92 | |
68 | - textbox->sheet->Drawing.Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s); | |
69 | - Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1); | |
93 | + if(!(keyid & KEYID_MASK_BREAK)){ | |
94 | + if(keyid & KEYID_MASK_EXTENDED){ /*???䕶??*/ | |
95 | + switch(keyid & KEYID_MASK_ID){ | |
96 | + case KEYID_ENTER: | |
97 | +/* | |
98 | + if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\n')){ | |
99 | + textbox->location_cursor.x = 0; | |
100 | + textbox->location_cursor.y += 16; | |
101 | + } | |
102 | +*/ | |
103 | + TextBox_Put_Character(textbox, '\n'); | |
104 | + break; | |
105 | + case KEYID_BACKSPACE: | |
106 | +/* | |
107 | + if(textbox->location_cursor.x <= 0 && textbox->location_cursor.y <= 0){ | |
108 | + break; | |
109 | + } | |
110 | + if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){ | |
111 | + textbox->location_cursor.x -= 8; | |
112 | + } | |
113 | + if(textbox->location_cursor.x < 0){ | |
114 | + textbox->location_cursor.x = 0; | |
115 | + textbox->location_cursor.y -= 16; | |
116 | + if(textbox->flags.bit.record_input_text){ | |
117 | + for(i = 0; i < textbox->using_text_buf; i++){ | |
118 | + if(textbox->text_buf[textbox->using_text_buf - i - 1] == '\n'){ | |
119 | + break; | |
120 | + } | |
121 | + textbox->location_cursor.x += 8; | |
122 | + if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){ | |
123 | + textbox->location_cursor.x = 0; | |
124 | + } | |
125 | + if(textbox->using_text_buf - i - 1 == 0){ | |
126 | + break; | |
127 | + } | |
128 | + } | |
129 | + } else{ | |
130 | + textbox->location_cursor.x = (int)textbox->sheet->size.x - 8; | |
131 | + } | |
132 | + } | |
133 | +*/ | |
134 | + TextBox_Put_Character(textbox, '\b'); | |
135 | + break; | |
136 | + case KEYID_TAB: | |
137 | +/* | |
138 | + if(!textbox->flags.bit.record_input_text && TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){ | |
139 | + textbox->location_cursor.x += 8 * (4 - ((textbox->location_cursor.x >> 3) & 3)); | |
140 | + } | |
141 | + if(textbox->location_cursor.x > (int)textbox->sheet->size.x){ | |
142 | + textbox->location_cursor.x = 8 * 4; | |
143 | + textbox->location_cursor.y += 16; | |
144 | + } else if(textbox->location_cursor.x == (int)textbox->sheet->size.x){ | |
145 | + textbox->location_cursor.x = 0; | |
146 | + textbox->location_cursor.y += 16; | |
147 | + } | |
148 | +*/ | |
149 | + TextBox_Put_Character(textbox, '\t'); | |
150 | + break; | |
151 | + } | |
152 | + return 0; | |
153 | + } else{ /*ASCII????*/ | |
154 | + s[0] = keyid & KEYID_MASK_ID; | |
155 | + s[1] = 0x00; | |
156 | + if(s[0] == '\n'){ | |
157 | + if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\n')){ | |
158 | + textbox->location_cursor.x = 0; | |
159 | + textbox->location_cursor.y += 16; | |
160 | + } | |
161 | + } else if(s[0] == '\b'){ | |
162 | + if(!(textbox->location_cursor.x <= 0 && textbox->location_cursor.y <= 0)){ | |
163 | + if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){ | |
164 | + textbox->location_cursor.x -= 8; | |
165 | + } | |
166 | + if(textbox->location_cursor.x < 0){ | |
167 | + textbox->location_cursor.x = 0; | |
168 | + textbox->location_cursor.y -= 16; | |
169 | + if(textbox->flags.bit.record_input_text){ | |
170 | + for(i = 0; i < textbox->using_text_buf; i++){ | |
171 | + if(textbox->text_buf[textbox->using_text_buf - i - 1] == '\n'){ | |
172 | + break; | |
173 | + } | |
174 | + textbox->location_cursor.x += 8; | |
175 | + if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){ | |
176 | + textbox->location_cursor.x = 0; | |
177 | + } | |
178 | + if(textbox->using_text_buf - i - 1 == 0){ | |
179 | + break; | |
180 | + } | |
181 | + } | |
182 | + } else{ | |
183 | + textbox->location_cursor.x = (int)textbox->sheet->size.x - 8; | |
184 | + } | |
185 | + } | |
186 | + } | |
187 | + } else if(s[0] == '\t'){ | |
188 | + if(!textbox->flags.bit.record_input_text && TextBox_Internal_Put_Character_TextBuffer(textbox, '\t')){ | |
189 | + textbox->location_cursor.x += 8 * (4 - ((textbox->location_cursor.x >> 3) & 3)); | |
190 | + } | |
191 | + if(textbox->location_cursor.x > (int)textbox->sheet->size.x){ | |
192 | + textbox->location_cursor.x = 8 * 4; | |
193 | + textbox->location_cursor.y += 16; | |
194 | + } else if(textbox->location_cursor.x == (int)textbox->sheet->size.x){ | |
195 | + textbox->location_cursor.x = 0; | |
196 | + textbox->location_cursor.y += 16; | |
197 | + } | |
198 | + } else if(TextBox_Internal_Put_Character_TextBuffer(textbox, s[0])){ | |
199 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
200 | + debug("TextBox_Put_Character:put [%c].\n", s[0]); | |
201 | + #endif | |
202 | + Sheet_Drawing_Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s); | |
203 | + Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1); | |
204 | + textbox->location_cursor.x += 8; | |
205 | + if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){ | |
206 | + textbox->location_cursor.x = 0; | |
207 | + textbox->location_cursor.y += 16; | |
208 | + } | |
209 | + } | |
210 | + } | |
211 | + if(textbox->location_cursor.y >= (int)textbox->sheet->size.y - (16 - 1)){ | |
212 | + Sheet_Drawing_Scroll_Vertical(textbox->sheet, 16); | |
213 | + Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, (int)textbox->sheet->size.y - 16, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1); | |
214 | + textbox->location_cursor.y -= 16; | |
215 | + Sheet_RefreshSheet_All(textbox->sheet); | |
216 | + } | |
217 | + Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1); | |
218 | + Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1); | |
219 | + } | |
70 | 220 | |
71 | - textbox->location_cursor.x += 8; | |
72 | 221 | return 0; |
73 | 222 | } |
74 | 223 | |
224 | +uint TextBox_Put_String(UI_TextBox *textbox, const uchar s[]) | |
225 | +{ | |
226 | + uint i; | |
75 | 227 | |
228 | + for(i = 0; s[i] != 0x00; i++){ | |
229 | + TextBox_Put_Character(textbox, s[i]); | |
230 | + } | |
231 | + return 0; | |
232 | +} | |
76 | 233 | |
234 | +bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c) | |
235 | +{ | |
236 | + if(!textbox->flags.bit.record_input_text){ | |
237 | + return True; | |
238 | + } | |
239 | + | |
240 | + switch(c){ | |
241 | + case '\b': | |
242 | + if(textbox->using_text_buf > 0){ | |
243 | + textbox->using_text_buf--; | |
244 | + textbox->text_buf[textbox->using_text_buf] = 0x00; | |
245 | + return True; | |
246 | + } | |
247 | + break; | |
248 | + default: | |
249 | + if(textbox->using_text_buf < textbox->size_text_buf - 1){ | |
250 | + textbox->text_buf[textbox->using_text_buf] = c; | |
251 | + textbox->using_text_buf++; | |
252 | + textbox->text_buf[textbox->using_text_buf] = 0x00; | |
253 | + return True; | |
254 | + } | |
255 | + break; | |
256 | + } | |
257 | + return False; | |
258 | +} | |
259 | + | |
260 | +//False->True?Ńo?b?t?@???Z?b?g?B | |
261 | +bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable) | |
262 | +{ | |
263 | + bool old; | |
264 | + | |
265 | + if(textbox == Null){ | |
266 | + #ifdef CHNOSPROJECT_DEBUG_TEXTBOX | |
267 | + debug("TextBox_SetEnable_RecordInputText:Null textbox.\n"); | |
268 | + #endif | |
269 | + return 1; | |
270 | + } | |
271 | + | |
272 | + old = textbox->flags.bit.record_input_text; | |
273 | + | |
274 | + if(old != enable){ | |
275 | + if(enable){ | |
276 | + textbox->text_buf[0] = 0x00; | |
277 | + textbox->using_text_buf = 0; | |
278 | + } | |
279 | + textbox->flags.bit.record_input_text = enable; | |
280 | + } | |
281 | + | |
282 | + return old; | |
283 | +} |
@@ -26,6 +26,7 @@ | ||
26 | 26 | uint rand(void); |
27 | 27 | uint isqrt(uint n); |
28 | 28 | uint CFunction_ExtractBits(uint source, uint start, uint end); |
29 | +uint CFunction_MemoryMove(void *destination, uint destination_size, void *source, uint source_size); | |
29 | 30 | int snprintf(uchar s[], uint n, const uchar format[], ...); |
30 | 31 | int vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[]); |
31 | 32 | // |
@@ -290,6 +291,7 @@ | ||
290 | 291 | uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1); |
291 | 292 | uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]); |
292 | 293 | uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c); |
294 | +uint Sheet_Drawing_Scroll_Vertical(UI_Sheet *sheet, int vpx); | |
293 | 295 | // |
294 | 296 | uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1); |
295 | 297 | uint Sheet_Drawing_Put_String_Invalid(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]); |
@@ -362,7 +364,10 @@ | ||
362 | 364 | UI_TextBox *TextBox_Initialise(void); |
363 | 365 | uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent); |
364 | 366 | uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py); |
365 | -uint TextBox_Put_Character(UI_TextBox *textbox, uchar c); | |
367 | +uint TextBox_Put_Character(UI_TextBox *textbox, ushort keyid); | |
368 | +uint TextBox_Put_String(UI_TextBox *textbox, const uchar s[]); | |
369 | +bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c); | |
370 | +bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable); | |
366 | 371 | |
367 | 372 | /*timer.c タイマー関連*/ |
368 | 373 | UI_TimerControl *Initialise_ProgrammableIntervalTimer(void); |
@@ -125,6 +125,62 @@ | ||
125 | 125 | return (source >> start) & ~(0xffffffff << (end - start + 1)); |
126 | 126 | } |
127 | 127 | |
128 | +//source番地からの、destination_sizeを超えないsource_sizeバイトを、destination番地へ移動させる。 | |
129 | +//メモリ範囲が重なっていてもデータは破壊されない。 | |
130 | +//同一番地へコピーする場合は何もしない。 | |
131 | +//戻り値は、コピーしたバイト数。 | |
132 | +uint CFunction_MemoryMove(void *destination, uint destination_size, void *source, uint source_size) | |
133 | +{ | |
134 | + uint move_size, i; | |
135 | + void *temp; | |
136 | + | |
137 | + if(destination == source){ | |
138 | + return 0; | |
139 | + } | |
140 | + | |
141 | + if(destination_size <= source_size){ | |
142 | + move_size = destination_size; | |
143 | + } else{ | |
144 | + move_size = source_size; | |
145 | + } | |
146 | + | |
147 | + if((uint)source < (uint)destination && (uint)source + source_size > (uint)destination){ | |
148 | + //sourceを上書きしてしまう場合、一度バッファに退避させた後コピーする。 | |
149 | + temp = System_Memory_Allocate(move_size); | |
150 | + i = 0; | |
151 | + if(move_size >= 4){ | |
152 | + for(; i < move_size - (4 - 1); i += 4){ | |
153 | + ((uint *)temp)[i >> 2] = ((uint *)source)[i >> 2]; | |
154 | + } | |
155 | + } | |
156 | + if(i != move_size){ | |
157 | + for(; i < move_size; i++){ | |
158 | + ((uchar *)temp)[i] = ((uchar *)source)[i]; | |
159 | + } | |
160 | + } | |
161 | + } else{ | |
162 | + temp = source; | |
163 | + } | |
164 | + | |
165 | + i = 0; | |
166 | + if(move_size >= 4){ | |
167 | + for(; i < move_size - (4 - 1); i += 4){ | |
168 | + ((uint *)destination)[i >> 2] = ((uint *)temp)[i >> 2]; | |
169 | + } | |
170 | + } | |
171 | + if(i != move_size){ | |
172 | + for(; i < move_size; i++){ | |
173 | + ((uchar *)destination)[i] = ((uchar *)temp)[i]; | |
174 | + } | |
175 | + } | |
176 | + | |
177 | + if(temp != source){ | |
178 | + System_Memory_Free(temp, move_size); | |
179 | + } | |
180 | + | |
181 | + return move_size; | |
182 | +} | |
183 | + | |
128 | 184 | //引数(uchar s[], uint n, const uchar format[], ...) |
129 | 185 | // s :結果を書き込む文字列の先頭アドレスを指定します。 |
130 | 186 | // n :s[]の大きさを指定します。(n - 1)番目以降の文字は書き込まれません。 |
@@ -29,6 +29,7 @@ | ||
29 | 29 | Sheet_Drawing_Put_String(vramsheet, 10, 10, 0x000000, "Welcome to CHNOSProject!"); |
30 | 30 | |
31 | 31 | if(disp_ctrl->display_mode == DISPLAYMODE_VBE_LINEAR){ |
32 | + i = 0; | |
32 | 33 | Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 1, 0x000000, "Please Select the VideoMode Number."); |
33 | 34 | Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 2, 0x000000, "(Use cursor Up or Down, Select Enter.)"); |
34 | 35 | Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1); |
@@ -110,6 +111,8 @@ | ||
110 | 111 | textbox = TextBox_Initialise(); |
111 | 112 | TextBox_SetBuffer(textbox, 20, 6, 8, testsheet); |
112 | 113 | TextBox_Show(textbox, 0, 4, 24); |
114 | + TextBox_Put_Character(textbox, '>'); | |
115 | + TextBox_SetEnable_RecordInputText(textbox, True); | |
113 | 116 | |
114 | 117 | |
115 | 118 | Drawing08_Put_String(testsheet->vram, testsheet->size.x, 4, 4, 0xffffff, "TestSheet"); |
@@ -172,36 +175,14 @@ | ||
172 | 175 | data = FIFO32_MyTaskFIFO_Get(); |
173 | 176 | if(SIGNAL_KEY_OFFSET <= data && data <= (SIGNAL_KEY_OFFSET + 0xFFFF)){ |
174 | 177 | data -= SIGNAL_KEY_OFFSET; |
178 | + TextBox_Put_Character(textbox, data); | |
175 | 179 | if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){ |
176 | - if((data & KEYID_MASK_ID) == KEYID_CURSOR_U){ | |
177 | - if(data & KEYID_MASK_STATE_SHIFT){ | |
178 | - Sheet_Slide_Relative(testsheet, 5, -5); | |
179 | - } else{ | |
180 | - Sheet_Slide_Relative(testsheet, 0, -5); | |
181 | - } | |
182 | - } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_D){ | |
183 | - if(data & KEYID_MASK_STATE_SHIFT){ | |
184 | - Sheet_Slide_Relative(testsheet, -5, 5); | |
185 | - } else{ | |
186 | - Sheet_Slide_Relative(testsheet, 0, 5); | |
187 | - } | |
188 | - } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_L){ | |
189 | - if(data & KEYID_MASK_STATE_SHIFT){ | |
190 | - Sheet_Slide_Relative(testsheet, -5, -5); | |
191 | - } else{ | |
192 | - Sheet_Slide_Relative(testsheet, -5, 0); | |
193 | - } | |
194 | - } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_R){ | |
195 | - if(data & KEYID_MASK_STATE_SHIFT){ | |
196 | - Sheet_Slide_Relative(testsheet, 5, 5); | |
197 | - } else{ | |
198 | - Sheet_Slide_Relative(testsheet, 5, 0); | |
199 | - } | |
200 | - } else if((data & KEYID_MASK_ID) == KEYID_ENTER){ | |
201 | - Sheet_Slide_Absolute(testsheet, disp_ctrl->xsize >> 1, disp_ctrl->ysize >> 1); | |
180 | + if((data & KEYID_MASK_ID) == KEYID_ENTER){ | |
181 | + TextBox_SetEnable_RecordInputText(textbox, False); | |
182 | + TextBox_Put_String(textbox, textbox->text_buf); | |
183 | + TextBox_Put_Character(textbox, '>'); | |
184 | + TextBox_SetEnable_RecordInputText(textbox, True); | |
202 | 185 | } |
203 | - } else if(!(data & KEYID_MASK_BREAK) && !(data & KEYID_MASK_EXTENDED)){ | |
204 | - TextBox_Put_Character(textbox, data & KEYID_MASK_ID); | |
205 | 186 | } |
206 | 187 | } else if(data == 11){ |
207 | 188 | Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24, 8 + (20 * 8) - 1, 24 + (16 * 2) - 1); |
@@ -17,6 +17,7 @@ | ||
17 | 17 | //つまり、FIFOで受け取って、バイアスを引いたら、KEYID_EXTENDEDフラグを調べる。 |
18 | 18 | //次に、BREAKフラグを調べる。 |
19 | 19 | //そして、下位7ビットのみを参照する。 |
20 | +//KEYID==0x0000は、ID未処理であることを示し、どの文字を表すこともない。 | |
20 | 21 | |
21 | 22 | #define KEYID_MASK_ID 0x007f |
22 | 23 | #define KEYID_MASK_BREAK 0x0080 |
@@ -3,19 +3,69 @@ | ||
3 | 3 | |
4 | 4 | uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1) |
5 | 5 | { |
6 | + if(sheet == Null){ | |
7 | + return 1; | |
8 | + } | |
9 | + | |
10 | + if(sheet->vram == Null){ | |
11 | + return 2; | |
12 | + } | |
13 | + | |
6 | 14 | return sheet->Drawing.Fill_Rectangle(sheet, c, px0, py0, px1, py1); |
7 | 15 | } |
8 | 16 | |
9 | 17 | uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]) |
10 | 18 | { |
19 | + if(sheet == Null){ | |
20 | + return 1; | |
21 | + } | |
22 | + | |
23 | + if(sheet->vram == Null){ | |
24 | + return 2; | |
25 | + } | |
26 | + | |
11 | 27 | return sheet->Drawing.Put_String(sheet, x, y, fc, s); |
12 | 28 | } |
13 | 29 | |
14 | 30 | uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c) |
15 | 31 | { |
32 | + if(sheet == Null){ | |
33 | + return 1; | |
34 | + } | |
35 | + | |
36 | + if(sheet->vram == Null){ | |
37 | + return 2; | |
38 | + } | |
39 | + | |
16 | 40 | return sheet->Drawing.Draw_Point(sheet, x, y, c); |
17 | 41 | } |
18 | 42 | |
43 | +uint Sheet_Drawing_Scroll_Vertical(UI_Sheet *sheet, int vpx) | |
44 | +{ | |
45 | + if(sheet == Null){ | |
46 | + return 1; | |
47 | + } | |
48 | + | |
49 | + if(sheet->vram == Null){ | |
50 | + return 2; | |
51 | + } | |
52 | + | |
53 | + if(vpx > 0){ | |
54 | + if((uint)vpx >= sheet->size.y){ | |
55 | + return 3; | |
56 | + } | |
57 | + CFunction_MemoryMove(sheet->vram, sheet->vramsize, (void *)((uint)sheet->vram + (sheet->size.x * vpx * (sheet->bpp >> 3))), sheet->vramsize - (sheet->size.x * vpx * (sheet->bpp >> 3))); | |
58 | + } else if(vpx < 0){ | |
59 | + vpx = -vpx; | |
60 | + if((uint)vpx >= sheet->size.y){ | |
61 | + return 4; | |
62 | + } | |
63 | + CFunction_MemoryMove((void *)((uint)sheet->vram + (sheet->size.x * vpx * (sheet->bpp >> 3))), sheet->vramsize - (sheet->size.x * vpx * (sheet->bpp >> 3)), sheet->vram, sheet->vramsize); | |
64 | + } | |
65 | + | |
66 | + return 0; | |
67 | +} | |
68 | + | |
19 | 69 | //invalid |
20 | 70 | uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1) |
21 | 71 | { |
@@ -21,7 +21,7 @@ | ||
21 | 21 | //#define CHNOSPROJECT_DEBUG_MULTITASK |
22 | 22 | //#define CHNOSPROJECT_DEBUG_PCI |
23 | 23 | //#define CHNOSPROJECT_DEBUG_COMMON_STRUCT |
24 | - #define CHNOSPROJECT_DEBUG_TEXTBOX | |
24 | + //#define CHNOSPROJECT_DEBUG_TEXTBOX | |
25 | 25 | #endif |
26 | 26 | |
27 | 27 | /*defines*/ |
@@ -354,3 +354,4 @@ | ||
354 | 354 | #define SHEET_MAX_YSIZE 65535 |
355 | 355 | #define SHEET_MAX_CHILDREN 255 |
356 | 356 | #define SHEET_LOCATION_NOCHANGE 0x7ffffffe |
357 | + |
@@ -466,7 +466,7 @@ | ||
466 | 466 | struct UI_SHEET *child; //children lowest height |
467 | 467 | DATA_Location2D location; |
468 | 468 | DATA_Location2DU size; |
469 | - ushort bpp; //0:Text(16col) 1:8bit 2:16bit 3:32bit | |
469 | + ushort bpp; | |
470 | 470 | union UI_SHEET_FLAGS { |
471 | 471 | ushort flags; |
472 | 472 | struct UI_SHEET_FLAGS_BITS { |
@@ -569,11 +569,13 @@ | ||
569 | 569 | DATA_Location2DU chars; |
570 | 570 | uchar *text_buf; |
571 | 571 | uint size_text_buf; |
572 | + uint using_text_buf; | |
572 | 573 | union UI_TEXT_BOX_FLAGS { |
573 | 574 | uint flags; |
574 | 575 | struct UI_TEXT_BOX_BITS { |
575 | 576 | unsigned initialized : 1; |
576 | 577 | unsigned textbuffer_configured : 1; |
578 | + unsigned record_input_text : 1; | |
577 | 579 | } bit; |
578 | 580 | } flags; |
579 | 581 | } UI_TextBox; |