Skip to content

Commit eca191d

Browse files
Merge pull request #2 from Ripjetski6502/dev
Dev
2 parents eac41fb + 9c35c6d commit eca191d

File tree

6 files changed

+88
-45
lines changed

6 files changed

+88
-45
lines changed

bin/fullappdemo.xex

557 Bytes
Binary file not shown.

src/a8defines.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface
1414

1515
const
1616
// Version
17-
LIB_VERSION = '1.1.0';
17+
LIB_VERSION = '1.1.1';
1818

1919
// Window Record and Memory Alloc
2020
WRECSZ = 10;

src/a8libgadg.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ function GList(bN, x, y, bE, bI, bV, bS: Byte; pS: TStringArray): Byte;
484484
// Set drawing position
485485
xp := 0;
486486
yp := 0;
487-
bEnd := Min(bStart + bV - 1, bS - 1);
487+
bEnd := WMin(bStart + bV - 1, bS - 1);
488488

489489
for bL := 0 to bS - 1 do
490490
begin

src/a8libmisc.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface
2525
// --------------------------------------------------
2626
function IKC2ATA(bN: Byte): Byte;
2727
function WaitKCX(bI: Byte): Word;
28-
function Min(x, y: Byte): Byte;
28+
function WMin(x, y: Byte): Byte;
2929

3030
implementation
3131

@@ -140,9 +140,9 @@ function WaitKCX(bI: Byte): Word;
140140
Poke(KEYPCH, KNONE);
141141
end;
142142

143-
function Min(x, y: Byte): Byte;
143+
function WMin(x, y: Byte): Byte;
144144
(*
145-
@description: Min returns the smallest value of X and Y.
145+
@description: WMin returns the smallest value of X and Y.
146146
147147
*)
148148
begin

src/a8libstr.pas

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,7 @@ procedure StrAI(pS: PByte; bS: Byte);
6666
// Process each element
6767
for bL := 0 to bS - 1 do
6868
begin
69-
if (pS^ >= 0) and (pS^ <= 31) then
70-
begin
71-
pS^ := pS^ + 64;
72-
end
73-
else if (pS^ >= 32) and (pS^ <= 95) then
74-
begin
75-
pS^ := pS^ - 32;
76-
end
77-
else if (pS^ >= 128) and (pS^ <= 159) then
78-
begin
79-
pS^ := pS^ + 64;
80-
end
81-
else if (pS^ >= 160) and (pS^ <= 223) then
82-
begin
83-
pS^ := pS^ - 32;
84-
end;
85-
69+
pS^ := byte(ata2int(char(pS^)));
8670
// Increment pointer to next char
8771
Inc(pS);
8872
end;
@@ -96,25 +80,7 @@ procedure StrAI(pS: PByte; bS: Byte);
9680
// ------------------------------------------------------------
9781
function CharAI(bC: Byte): Byte;
9882
begin
99-
if (bC >= 0) and (bC <= 31) then
100-
begin
101-
Result := bC + 64;
102-
end
103-
else if (bC >= 32) and (bC <= 95) then
104-
begin
105-
Result := bC - 32;
106-
end
107-
else if (bC >= 128) and (bC <= 159) then
108-
begin
109-
Result := bC + 64;
110-
end
111-
else if (bC >= 160) and (bC <= 223) then
112-
begin
113-
Result := bC - 32;
114-
end
115-
else begin
116-
Result := bC;
117-
end;
83+
Result := byte(ata2int(char(bC)));
11884
end;
11985

12086

src/fullappdemo.pas

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Pull in include files
1212
uses
13-
Crt, a8defines, a8defwin, a8libmisc, a8libstr, a8libwin, a8libgadg, a8libmenu;
13+
crt, sysutils, a8defines, a8defwin, a8libmisc, a8libstr, a8libwin, a8libgadg, a8libmenu;
1414

1515
// Variables
1616
var
@@ -43,7 +43,7 @@ function FileInput: Boolean;
4343
selected_list: Byte;
4444
read_list: Byte;
4545
bM: Byte;
46-
tmp: Byte;
46+
i, tmp: Byte;
4747

4848
begin
4949
Result:= false;
@@ -56,7 +56,7 @@ function FileInput: Boolean;
5656
FillChar(@selected_file[tmp + 1], FILE_SIZE - tmp, CHSPACE );
5757

5858
win_file:=WOpen(5, 4, 30, 16, WOFF);
59-
WOrn(win_file, WPTOP, WPLFT, 'Choose file');
59+
WOrn(win_file, WPTOP, WPLFT, 'Choose a file');
6060

6161

6262
WPrint(win_file, 2, 2, WOFF, 'File:');
@@ -73,13 +73,35 @@ function FileInput: Boolean;
7373

7474
// file
7575
read_file:= GInput(win_file, 8, 2, GFILE, 12, selected_file);
76+
if (read_file <> XESC) then
77+
begin
78+
for i:=0 to Length(list_files) - 1 do
79+
begin
80+
if list_files[i] = Trim(selected_file) then
81+
begin
82+
selected_list:= i + 1;
83+
GList(win_file, 2, 5, GDISP, selected_list, 8, Length(list_files), list_files);
84+
end;
85+
end;
86+
end
87+
else if (read_file = XESC) then
88+
begin
89+
bM:= XESC;
90+
break;
91+
end;
7692

7793
// Drives combo
7894
read_drive:= GCombo(win_file, 21, 5, GEDIT, selected_drive, 8, list_drives);
7995
if (read_drive <> XESC) then
8096
begin
8197
selected_drive := read_drive;
98+
end
99+
else if (read_drive = XESC) then
100+
begin
101+
bM:= XESC;
102+
break;
82103
end;
104+
83105
GCombo(win_file, 21, 5, GDISP, selected_drive, 8, list_drives);
84106

85107
// Files List
@@ -92,7 +114,13 @@ function FileInput: Boolean;
92114
SetLength(selected_file, FILE_SIZE);
93115
FillChar(@selected_file[tmp + 1], FILE_SIZE - tmp, CHSPACE );
94116
WPrint(win_file, 8, 2, WOFF, selected_file);
117+
end
118+
else if (read_list = XESC) then
119+
begin
120+
bM:= XESC;
121+
break;
95122
end;
123+
96124
GList(win_file, 2, 5, GDISP, selected_list, 8, Length(list_files), list_files);
97125

98126
// Buttons to confirm
@@ -228,15 +256,39 @@ function FormInput: Boolean;
228256

229257
// Edit fields
230258
bA := GInput(bW1, 8, 2, GNUMER, 27, cA);
259+
if (bA = XESC) then
260+
begin
261+
bM:= XESC;
262+
break;
263+
end;
231264
bB := GInput(bW1, 8, 3, GALPHA, 27, cB);
265+
if (bB = XESC) then
266+
begin
267+
bM:= XESC;
268+
break;
269+
end;
232270
bC := GInput(bW1, 8, 4, GALNUM, 27, cC);
271+
if (bC = XESC) then
272+
begin
273+
bM:= XESC;
274+
break;
275+
end;
233276
bD := GInput(bW1, 8, 5, GANY, 27, cD);
234-
277+
if (bD = XESC) then
278+
begin
279+
bM:= XESC;
280+
break;
281+
end;
235282
// ----- Spinner Input -----
236283
bV := GSpin(bW1, 8, 6, 0, 100, bVp, GEDIT);
237284
if (bV <> XESC) then
238285
begin
239286
bVp := bV;
287+
end
288+
else if (bV = XESC) then
289+
begin
290+
bM:= XESC;
291+
break;
240292
end;
241293

242294
// ----- Display Radio Buttons - horizontal -----
@@ -250,6 +302,11 @@ function FormInput: Boolean;
250302
if (bRA <> XESC) then
251303
begin
252304
bRAp := bRA;
305+
end
306+
else if (bRA = XESC) then
307+
begin
308+
bM:= XESC;
309+
break;
253310
end;
254311

255312
// Redisplay buttons
@@ -262,6 +319,11 @@ function FormInput: Boolean;
262319
if (bRB <> XESC) then
263320
begin
264321
bRBp := bRB;
322+
end
323+
else if (bRB = XESC) then
324+
begin
325+
bM:= XESC;
326+
break;
265327
end;
266328

267329
// Redisplay buttons
@@ -280,6 +342,11 @@ function FormInput: Boolean;
280342
if (bCha <> XESC) and (bCha <> XTAB) then
281343
begin
282344
bChap := bCha;
345+
end
346+
else if (bCha = XESC) then
347+
begin
348+
bM:= XESC;
349+
break;
283350
end;
284351
// until (bCha = XESC) or (bCha = XTAB) or (bCha = XNONE);
285352

@@ -292,6 +359,11 @@ function FormInput: Boolean;
292359
if (bChb <> XESC) then
293360
begin
294361
bChbp := bChb;
362+
end
363+
else if (bChb = XESC) then
364+
begin
365+
bM:= XESC;
366+
break;
295367
end;
296368
// until (bChb = XESC) or (bChb = XTAB) or (bCha = XNONE);
297369

@@ -304,6 +376,11 @@ function FormInput: Boolean;
304376
if (bChc <> XESC) then
305377
begin
306378
bChcp := bChc;
379+
end
380+
else if (bChc = XESC) then
381+
begin
382+
bM:= XESC;
383+
break;
307384
end;
308385
// until (bChc = XESC) or (bChc = XTAB) or (bCha = XNONE);
309386

0 commit comments

Comments
 (0)