Rev 9896 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9896 | Rev 9898 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | (* |
1 | (* |
2 | Copyright 2020-2021 Anton Krotov |
2 | Copyright 2020-2021, 2023 Anton Krotov |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | This file is part of fb2read. |
4 | This file is part of fb2read. |
5 | 5 | ||
Line 19... | Line 19... | ||
19 | 19 | ||
Line 20... | Line 20... | ||
20 | MODULE SearchForm; |
20 | MODULE SearchForm; |
Line 21... | Line 21... | ||
21 | 21 | ||
Line 22... | Line 22... | ||
22 | IMPORT |
22 | IMPORT |
Line 23... | Line 23... | ||
23 | 23 | ||
Line 47... | Line 47... | ||
47 | 47 | ||
Line 48... | Line 48... | ||
48 | VAR |
48 | VAR |
49 | 49 | ||
50 | PID, Slot: INTEGER; |
50 | PID, Slot: INTEGER; |
51 | Stack: ARRAY 1000000 OF CHAR; |
51 | Stack: ARRAY 1000000 OF CHAR; |
Line 52... | Line 52... | ||
52 | Window: W.TWindow; |
52 | Window: W.tWindow; |
53 | str: STRING; |
53 | str: STRING; |
54 | 54 | ||
Line 78... | Line 78... | ||
78 | 78 | ||
79 | PROCEDURE DrawWindow; |
79 | PROCEDURE DrawWindow; |
80 | BEGIN |
80 | BEGIN |
81 | SU.GetSystemColors; |
81 | SU.GetSystemColors; |
82 | SU.WindowRedrawStatus(1); |
82 | SU.WindowRedrawStatus(1); |
83 | SU.DefineAndDrawWindow(Window.Left, Window.Top, Window.Width, Window.Height, |
83 | SU.DefineAndDrawWindow(Window.left, Window.top, Window.width, Window.height, |
84 | SU.winColor, LSL(ORD({0, 1}), 4) + 4, Window.Caption); |
84 | SU.winColor, LSL(ORD({0, 1}), 4) + 4, Window.caption); |
85 | buttons; |
85 | buttons; |
86 | SU.WindowRedrawStatus(2) |
86 | SU.WindowRedrawStatus(2) |
Line 87... | Line 87... | ||
87 | END DrawWindow; |
87 | END DrawWindow; |
88 | 88 | ||
89 | 89 | ||
90 | PROCEDURE close* (ok: BOOLEAN); |
90 | PROCEDURE close* (ok: BOOLEAN); |
91 | VAR |
91 | VAR |
92 | pid, i, j, k, n: INTEGER; |
92 | pid, i, j, k, n: INTEGER; |
Line 93... | Line 93... | ||
93 | found: BOOLEAN; |
93 | found: BOOLEAN; |
94 | str0: STRING; |
94 | str0: STRING; |
95 | u: S.UTF8; |
95 | u: Encoding.tUtf8; |
Line 96... | Line 96... | ||
96 | 96 | ||
97 | BEGIN |
97 | BEGIN |
98 | found := TRUE; |
98 | found := TRUE; |
99 | box_lib.edit_box_get_value(text, str); |
99 | box_lib.edit_box_get_value(text, str); |
100 | 100 | ||
101 | IF ok THEN |
101 | IF ok THEN |
102 | IF str # "" THEN |
102 | IF str # "" THEN |
103 | j := 0; |
103 | j := 0; |
104 | i := 0; |
104 | i := 0; |
105 | WHILE str[i] # 0X DO |
105 | WHILE str[i] # 0X DO |
106 | u := Encode.CP866[ORD(str[i])].utf8; |
106 | u := Encoding.cp866[ORD(str[i])].utf8; |
107 | n := Encode.CP866[ORD(str[i])].len; |
107 | n := Encoding.cp866[ORD(str[i])].len; |
Line 146... | Line 146... | ||
146 | VAR |
146 | VAR |
147 | scrWidth, scrHeight, key: INTEGER; |
147 | scrWidth, scrHeight, key: INTEGER; |
Line 148... | Line 148... | ||
148 | 148 | ||
149 | BEGIN |
149 | BEGIN |
150 | SU.SetEventsMask({0, 1, 2, 5, 30, 31}); |
150 | SU.SetEventsMask({0, 1, 2, 5, 30, 31}); |
151 | W.InitWindow(Window, 0, 0, 320, 140, "Search"); |
151 | W.init(Window, 0, 0, 320, 140, "Search"); |
152 | SU.GetScreenSize(scrWidth, scrHeight); |
152 | SU.GetScreenSize(scrWidth, scrHeight); |
153 | Window.Left := (scrWidth - Window.Width) DIV 2; |
153 | Window.left := (scrWidth - Window.width) DIV 2; |
Line 154... | Line 154... | ||
154 | Window.Top := (scrHeight - Window.Height) DIV 2; |
154 | Window.top := (scrHeight - Window.height) DIV 2; |
155 | 155 | ||
156 | DrawWindow; |
156 | DrawWindow; |
157 | WHILE TRUE DO |
157 | WHILE TRUE DO |
158 | CASE SU.WaitForEvent() OF |
158 | CASE SU.WaitForEvent() OF |
159 | |1: DrawWindow |
159 | |1: DrawWindow |
160 | |2: key := K.sysfunc1(2); |
160 | |2: key := SU.GetKey(); |
161 | IF key DIV 65536 = 28 THEN |
161 | IF key DIV 65536 = 28 THEN (* enter *) |
162 | close(TRUE) |
162 | close(TRUE) |
163 | ELSIF key DIV 65536 = 1 THEN |
163 | ELSIF key DIV 65536 = 1 THEN (* esc *) |
164 | close(FALSE) |
164 | close(FALSE) |
165 | ELSE |
165 | ELSE |
166 | box_lib.edit_box_key_safe(text, key) |
166 | box_lib.edit_box_key_safe(text, key) |