author | smatz |
Sat, 13 Dec 2008 16:16:44 +0000 | |
changeset 10417 | a1a609566853 |
parent 10201 | 4c181fbe8f2a |
child 10426 | 4a77f7049b5e |
permissions | -rw-r--r-- |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
2 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
3 |
/** @file osk_gui.cpp The On Screen Keyboard GUI */ |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
4 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
6 |
#include "openttd.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
7 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
8 |
#include "textbuf_gui.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
9 |
#include "window_gui.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
10 |
#include "string_func.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
11 |
#include "strings_func.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
12 |
#include "debug.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
13 |
#include "window_func.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
14 |
#include "gfx_func.h" |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
15 |
#include "querystring_gui.h" |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
16 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
17 |
#include "table/sprites.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
18 |
#include "table/strings.h" |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
19 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
20 |
enum OskWidgets { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
21 |
OSK_WIDGET_TEXT = 3, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
22 |
OSK_WIDGET_CANCEL = 5, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
23 |
OSK_WIDGET_OK, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
24 |
OSK_WIDGET_BACKSPACE, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
25 |
OSK_WIDGET_SPECIAL, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
26 |
OSK_WIDGET_CAPS, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
27 |
OSK_WIDGET_SHIFT, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
28 |
OSK_WIDGET_SPACE, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
29 |
OSK_WIDGET_LEFT, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
30 |
OSK_WIDGET_RIGHT, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
31 |
OSK_WIDGET_LETTERS |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
32 |
}; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
33 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
34 |
char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
35 |
static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES]; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
36 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
37 |
enum { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
38 |
KEYS_NONE, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
39 |
KEYS_SHIFT, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
40 |
KEYS_CAPS |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
41 |
}; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
42 |
static byte _keystate = KEYS_NONE; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
43 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
44 |
struct OskWindow : public Window { |
9239
3f036ca62305
(svn r13105) -Fix [FS#2015]: the title of a query window would (sometimes) change when the on screen keyboard was opened.
rubidium
parents:
9217
diff
changeset
|
45 |
StringID caption; ///< the caption for this window. |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
46 |
QueryString *qs; ///< text-input |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
47 |
int text_btn; ///< widget number of parent's text field |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
48 |
int ok_btn; ///< widget number of parent's ok button (=0 when ok shouldn't be passed on) |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
49 |
int cancel_btn; ///< widget number of parent's cancel button (=0 when cancel shouldn't be passed on; text will be reverted to original) |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
50 |
Textbuf *text; ///< pointer to parent's textbuffer (to update caret position) |
9897
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
51 |
char *orig_str_buf; ///< Original string. |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
52 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
53 |
OskWindow(const WindowDesc *desc, QueryStringBaseWindow *parent, int button, int cancel, int ok) : Window(desc) |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
54 |
{ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
55 |
this->parent = parent; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
56 |
assert(parent != NULL); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
57 |
|
9239
3f036ca62305
(svn r13105) -Fix [FS#2015]: the title of a query window would (sometimes) change when the on screen keyboard was opened.
rubidium
parents:
9217
diff
changeset
|
58 |
this->caption = (parent->widget[button].data != STR_NULL) ? parent->widget[button].data : parent->caption; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
59 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
60 |
this->qs = parent; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
61 |
this->text_btn = button; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
62 |
this->cancel_btn = cancel; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
63 |
this->ok_btn = ok; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
64 |
this->text = &parent->text; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
65 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
66 |
/* make a copy in case we need to reset later */ |
9897
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
67 |
this->orig_str_buf = strdup(this->qs->text.buf); |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
68 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
69 |
SetBit(_no_scroll, SCROLL_EDIT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
70 |
/* Not needed by default. */ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
71 |
this->DisableWidget(OSK_WIDGET_SPECIAL); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
72 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
73 |
this->FindWindowPlacementAndResize(desc); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
74 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
75 |
|
9897
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
76 |
~OskWindow() |
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
77 |
{ |
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
78 |
free(this->orig_str_buf); |
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
79 |
} |
4d9a6ff6703e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium
parents:
9778
diff
changeset
|
80 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
81 |
/** |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
82 |
* Only show valid characters; do not show characters that would |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
83 |
* only insert a space when we have a spacebar to do that or |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
84 |
* characters that are not allowed to be entered. |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
85 |
*/ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
86 |
void ChangeOskDiabledState(bool shift) |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
87 |
{ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
88 |
for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
89 |
this->SetWidgetDisabledState(OSK_WIDGET_LETTERS + i, |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
90 |
!IsValidChar(_keyboard[shift][i], this->qs->afilter) || _keyboard[shift][i] == ' '); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
91 |
} |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
92 |
this->SetWidgetDisabledState(OSK_WIDGET_SPACE, !IsValidChar(' ', this->qs->afilter)); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
93 |
} |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
94 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
95 |
virtual void OnPaint() |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
96 |
{ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
97 |
bool shift = HasBit(_keystate, KEYS_CAPS) ^ HasBit(_keystate, KEYS_SHIFT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
98 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
99 |
this->LowerWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
100 |
this->SetWidgetLoweredState(OSK_WIDGET_SHIFT, HasBit(_keystate, KEYS_SHIFT)); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
101 |
this->SetWidgetLoweredState(OSK_WIDGET_CAPS, HasBit(_keystate, KEYS_CAPS)); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
102 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
103 |
this->ChangeOskDiabledState(shift); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
104 |
|
9239
3f036ca62305
(svn r13105) -Fix [FS#2015]: the title of a query window would (sometimes) change when the on screen keyboard was opened.
rubidium
parents:
9217
diff
changeset
|
105 |
SetDParam(0, this->caption); |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9239
diff
changeset
|
106 |
this->DrawWidgets(); |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
107 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
108 |
for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
109 |
DrawCharCentered(_keyboard[shift][i], |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
110 |
this->widget[OSK_WIDGET_LETTERS + i].left + 8, |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
111 |
this->widget[OSK_WIDGET_LETTERS + i].top + 3, |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
112 |
TC_BLACK); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
113 |
} |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
114 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
115 |
this->qs->DrawEditBox(this, OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
116 |
} |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
117 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
118 |
virtual void OnClick(Point pt, int widget) |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
119 |
{ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
120 |
/* clicked a letter */ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
121 |
if (widget >= OSK_WIDGET_LETTERS) { |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
122 |
bool shift = HasBit(_keystate, KEYS_CAPS) ^ HasBit(_keystate, KEYS_SHIFT); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
123 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
124 |
WChar c = _keyboard[shift][widget - OSK_WIDGET_LETTERS]; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
125 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
126 |
if (!IsValidChar(c, this->qs->afilter)) return; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
127 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
128 |
if (InsertTextBufferChar(&this->qs->text, c)) this->InvalidateWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
129 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
130 |
if (HasBit(_keystate, KEYS_SHIFT)) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
131 |
ToggleBit(_keystate, KEYS_SHIFT); |
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9760
diff
changeset
|
132 |
this->widget[OSK_WIDGET_SHIFT].color = HasBit(_keystate, KEYS_SHIFT) ? COLOUR_WHITE : COLOUR_GREY; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
133 |
this->SetDirty(); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
134 |
} |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
135 |
return; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
136 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
137 |
|
9216
514f9d11c5d0
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
glx
parents:
9179
diff
changeset
|
138 |
bool delete_this = false; |
514f9d11c5d0
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
glx
parents:
9179
diff
changeset
|
139 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
140 |
switch (widget) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
141 |
case OSK_WIDGET_BACKSPACE: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
142 |
if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
143 |
break; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
144 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
145 |
case OSK_WIDGET_SPECIAL: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
146 |
/* |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
147 |
* Anything device specific can go here. |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
148 |
* The button itself is hidden by default, and when you need it you |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
149 |
* can not hide it in the create event. |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
150 |
*/ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
151 |
break; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
152 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
153 |
case OSK_WIDGET_CAPS: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
154 |
ToggleBit(_keystate, KEYS_CAPS); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
155 |
this->SetDirty(); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
156 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
157 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
158 |
case OSK_WIDGET_SHIFT: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
159 |
ToggleBit(_keystate, KEYS_SHIFT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
160 |
this->SetDirty(); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
161 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
162 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
163 |
case OSK_WIDGET_SPACE: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
164 |
if (InsertTextBufferChar(&this->qs->text, ' ')) this->InvalidateWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
165 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
166 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
167 |
case OSK_WIDGET_LEFT: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
168 |
if (MoveTextBufferPos(&this->qs->text, WKC_LEFT)) this->InvalidateWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
169 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
170 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
171 |
case OSK_WIDGET_RIGHT: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
172 |
if (MoveTextBufferPos(&this->qs->text, WKC_RIGHT)) this->InvalidateWidget(OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
173 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
174 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
175 |
case OSK_WIDGET_OK: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
176 |
if (this->qs->orig == NULL || strcmp(this->qs->text.buf, this->qs->orig) != 0) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
177 |
/* pass information by simulating a button press on parent window */ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
178 |
if (this->ok_btn != 0) { |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
179 |
this->parent->OnClick(pt, this->ok_btn); |
9217
2380c4fe788c
(svn r13083) -Fix (r13042): another segmentation fault when OskWindow's parent closes it
glx
parents:
9216
diff
changeset
|
180 |
/* Window gets deleted when the parent window removes itself. */ |
2380c4fe788c
(svn r13083) -Fix (r13042): another segmentation fault when OskWindow's parent closes it
glx
parents:
9216
diff
changeset
|
181 |
return; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
182 |
} |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
183 |
} |
9216
514f9d11c5d0
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
glx
parents:
9179
diff
changeset
|
184 |
delete_this = true; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
185 |
break; |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
186 |
|
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
187 |
case OSK_WIDGET_CANCEL: |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
188 |
if (this->cancel_btn != 0) { // pass a cancel event to the parent window |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
189 |
this->parent->OnClick(pt, this->cancel_btn); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
190 |
/* Window gets deleted when the parent window removes itself. */ |
9217
2380c4fe788c
(svn r13083) -Fix (r13042): another segmentation fault when OskWindow's parent closes it
glx
parents:
9216
diff
changeset
|
191 |
return; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
192 |
} else { // or reset to original string |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
193 |
strcpy(qs->text.buf, this->orig_str_buf); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
194 |
UpdateTextBufferSize(&qs->text); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
195 |
MoveTextBufferPos(&qs->text, WKC_END); |
9216
514f9d11c5d0
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
glx
parents:
9179
diff
changeset
|
196 |
delete_this = true; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
197 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
198 |
break; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
199 |
} |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
200 |
/* make sure that the parent window's textbox also gets updated */ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
201 |
if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); |
9216
514f9d11c5d0
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
glx
parents:
9179
diff
changeset
|
202 |
if (delete_this) delete this; |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
203 |
} |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
204 |
|
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
205 |
virtual void OnMouseLoop() |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
206 |
{ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
207 |
this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
208 |
/* make the caret of the parent window also blink */ |
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
209 |
this->parent->InvalidateWidget(this->text_btn); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
210 |
} |
9399
3090d36f3436
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
9317
diff
changeset
|
211 |
|
3090d36f3436
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
9317
diff
changeset
|
212 |
virtual void OnInvalidateData(int) |
3090d36f3436
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
9317
diff
changeset
|
213 |
{ |
3090d36f3436
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
9317
diff
changeset
|
214 |
this->InvalidateWidget(OSK_WIDGET_TEXT); |
3090d36f3436
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
9317
diff
changeset
|
215 |
} |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
216 |
}; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
217 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
218 |
static const Widget _osk_widgets[] = { |
9760
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
219 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
220 |
{ WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 0, 255, 0, 13, STR_012D, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
221 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 255, 14, 29, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
222 |
{ WWT_EDITBOX, RESIZE_NONE, COLOUR_GREY, 2, 253, 16, 27, 0x0, STR_NULL}, |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
223 |
|
9760
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
224 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 255, 30, 139, 0x0, STR_NULL}, |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
225 |
|
9760
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
226 |
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 3, 108, 35, 46, STR_012E_CANCEL, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
227 |
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 111, 216, 35, 46, STR_012F_OK, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
228 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 219, 252, 35, 46, SPR_OSK_BACKSPACE, STR_NULL}, |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
229 |
|
9760
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
230 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 27, 67, 82, SPR_OSK_SPECIAL, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
231 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 36, 85, 100, SPR_OSK_CAPS, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
232 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 27, 103, 118, SPR_OSK_SHIFT, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
233 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
234 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 75, 189, 121, 136, STR_EMPTY, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
235 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
236 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 121, 136, SPR_OSK_LEFT, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
237 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 121, 136, SPR_OSK_RIGHT, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
238 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
239 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 3, 18, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
240 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 21, 36, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
241 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 39, 54, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
242 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 57, 72, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
243 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 75, 90, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
244 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 93, 108, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
245 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 111, 126, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
246 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 129, 144, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
247 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 147, 162, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
248 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 165, 180, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
249 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 183, 198, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
250 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 201, 216, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
251 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
252 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 49, 64, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
253 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
254 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 30, 45, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
255 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 48, 63, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
256 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 66, 81, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
257 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 84, 99, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
258 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 102, 117, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
259 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 120, 135, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
260 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 138, 153, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
261 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 156, 171, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
262 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 174, 189, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
263 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 192, 207, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
264 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 210, 225, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
265 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 228, 243, 67, 82, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
266 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
267 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 39, 54, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
268 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 57, 72, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
269 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 75, 90, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
270 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 93, 108, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
271 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 111, 126, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
272 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 129, 144, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
273 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 147, 162, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
274 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 165, 180, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
275 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 183, 198, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
276 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 201, 216, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
277 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
278 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 85, 100, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
279 |
|
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
280 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 30, 45, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
281 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 48, 63, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
282 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 66, 81, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
283 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 84, 99, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
284 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 102, 117, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
285 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 120, 135, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
286 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 138, 153, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
287 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 156, 171, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
288 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 174, 189, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
289 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 192, 207, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
290 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 210, 225, 103, 118, 0x0, STR_NULL}, |
92202f8b455a
(svn r13896) -Codechange: Replace numbers with Colours enum on newgrf, order and osk guis
belugas
parents:
9399
diff
changeset
|
291 |
{ WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 228, 243, 103, 118, 0x0, STR_NULL}, |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
292 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
293 |
{ WIDGETS_END}, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
294 |
}; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
295 |
|
9317
f14eb8815829
(svn r13185) -Codechange: remove everything related to the WindowProc callbacks.
rubidium
parents:
9314
diff
changeset
|
296 |
static const WindowDesc _osk_desc = { |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
297 |
WDP_CENTER, WDP_CENTER, 256, 140, 256, 140, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
298 |
WC_OSK, WC_NONE, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
299 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
300 |
_osk_widgets, |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
301 |
}; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
302 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
303 |
/** |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
304 |
* Retrieve keyboard layout from language string or (if set) config file. |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
305 |
* Also check for invalid characters. |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
306 |
*/ |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
307 |
void GetKeyboardLayout() |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
308 |
{ |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
309 |
char keyboard[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
310 |
char errormark[2][OSK_KEYBOARD_ENTRIES + 1]; // used for marking invalid chars |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
311 |
bool has_error = false; // true when an invalid char is detected |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
312 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
313 |
if (StrEmpty(_keyboard_opt[0])) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
314 |
GetString(keyboard[0], STR_OSK_KEYBOARD_LAYOUT, lastof(keyboard[0])); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
315 |
} else { |
10201
4c181fbe8f2a
(svn r14414) -Fix: replace instances of strncpy with strecpy as strncpy doesn't guarantee the resulting string is '\0'-terminated.
rubidium
parents:
9897
diff
changeset
|
316 |
strecpy(keyboard[0], _keyboard_opt[0], lastof(keyboard[0])); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
317 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
318 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
319 |
if (StrEmpty(_keyboard_opt[1])) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
320 |
GetString(keyboard[1], STR_OSK_KEYBOARD_LAYOUT_CAPS, lastof(keyboard[1])); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
321 |
} else { |
10201
4c181fbe8f2a
(svn r14414) -Fix: replace instances of strncpy with strecpy as strncpy doesn't guarantee the resulting string is '\0'-terminated.
rubidium
parents:
9897
diff
changeset
|
322 |
strecpy(keyboard[1], _keyboard_opt[1], lastof(keyboard[1])); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
323 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
324 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
325 |
for (uint j = 0; j < 2; j++) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
326 |
const char *kbd = keyboard[j]; |
8739
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
327 |
bool ended = false; |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
328 |
for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
329 |
_keyboard[j][i] = Utf8Consume(&kbd); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
330 |
|
8739
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
331 |
/* Be lenient when the last characters are missing (is quite normal) */ |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
332 |
if (_keyboard[j][i] == '\0' || ended) { |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
333 |
ended = true; |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
334 |
_keyboard[j][i] = ' '; |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
335 |
continue; |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
336 |
} |
2cdee97876a8
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
rubidium
parents:
8737
diff
changeset
|
337 |
|
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
338 |
if (IsPrintable(_keyboard[j][i])) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
339 |
errormark[j][i] = ' '; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
340 |
} else { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
341 |
has_error = true; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
342 |
errormark[j][i] = '^'; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
343 |
_keyboard[j][i] = ' '; |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
344 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
345 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
346 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
347 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
348 |
if (has_error) { |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
349 |
ShowInfoF("The keyboard layout you selected contains invalid chars. Please check those chars marked with ^."); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
350 |
ShowInfoF("Normal keyboard: %s", keyboard[0]); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
351 |
ShowInfoF(" %s", errormark[0]); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
352 |
ShowInfoF("Caps Lock: %s", keyboard[1]); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
353 |
ShowInfoF(" %s", errormark[1]); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
354 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
355 |
} |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
356 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
357 |
/** |
9314
9ba6a9620a69
(svn r13182) -Doc: add documentation to mostly rail_gui related functions. Patch by Alberth.
rubidium
parents:
9273
diff
changeset
|
358 |
* Show the on-screen keyboard (osk) associated with a given textbox |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
359 |
* @param parent pointer to the Window where this keyboard originated from |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
360 |
* @param q querystr_d pointer to the query string of the parent, which is |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
361 |
* shared for both windows |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
362 |
* @param button widget number of parent's textbox |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
363 |
* @param cancel widget number of parent's cancel button (0 if cancel events |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
364 |
* should not be passed) |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
365 |
* @param ok widget number of parent's ok button (0 if ok events should not |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
366 |
* be passed) |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
367 |
*/ |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
368 |
void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok) |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
369 |
{ |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
370 |
DeleteWindowById(WC_OSK, 0); |
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
371 |
|
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
372 |
GetKeyboardLayout(); |
9179
780666b686ed
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
9171
diff
changeset
|
373 |
new OskWindow(&_osk_desc, parent, button, cancel, ok); |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
diff
changeset
|
374 |
} |