/trunk_dos/OIDFILE.PAS |
---|
3,7 → 3,7 |
(************************************************) |
(* OIDFILE.PAS *) |
(* Author: Daniel Marschall *) |
(* Revision: 2022-02-13 *) |
(* Revision: 2022-02-14 *) |
(* License: Apache 2.0 *) |
(* This file contains: *) |
(* - Functions to handle an OID ASCII format *) |
21,13 → 21,14 |
DotNotation: string; |
ASNIds: PStringList; |
Description: string; |
SubIds: PStringList; |
Parent: string; |
SubIds: PStringList; (* first 8 chars are FileId, followed by Dot-Notation *) |
Parent: string; (* First 8 chars are FileId, followed by Dot-Notation *) |
end; |
procedure InitOidDef(oid: POid); |
procedure FreeOidDef(oid: POid); |
procedure ClearOidDef(oid: POid); |
procedure WriteOidFile(filename: string; oid: POid); |
procedure InitOidDef(oid: POid); |
procedure ReadOidFile(filename: string; oid: POid); |
implementation |
38,6 → 39,16 |
const |
WANT_VERS = '2022'; |
procedure InitOidDef(oid: POid); |
begin |
oid^.FileId := ''; |
oid^.DotNotation := ''; |
oid^.Description := ''; |
oid^.Parent := ''; |
InitList(oid^.ASNIds); |
InitList(oid^.SubIds); |
end; |
procedure FreeOidDef(oid: POid); |
begin |
FreeList(oid^.ASNIds); |
44,6 → 55,12 |
FreeList(oid^.SubIds); |
end; |
procedure ClearOidDef(oid: POid); |
begin |
FreeOidDef(oid); |
InitOidDef(oid); |
end; |
procedure WriteOidFile(filename: string; oid: POid); |
var |
f: Text; |
89,16 → 106,6 |
Close(f); |
end; |
procedure InitOidDef(oid: POid); |
begin |
oid^.FileId := ''; |
oid^.DotNotation := ''; |
oid^.Description := ''; |
oid^.Parent := ''; |
InitList(oid^.ASNIds); |
InitList(oid^.SubIds); |
end; |
procedure ReadOidFile(filename: string; oid: POid); |
var |
f: Text; |
105,8 → 112,7 |
line, cmd: string; |
version: string; |
begin |
FreeOidDef(oid); |
InitOidDef(oid); |
ClearOidDef(oid); |
version := ''; |
Assign(f, filename); |
157,8 → 163,7 |
if (version <> WANT_VERS) or (oid^.FileId = '') then |
begin |
(* Invalidate everything *) |
FreeOidDef(oid); |
InitOidDef(oid); |
ClearOidDef(oid); |
end; |
Close(f); |
/trunk_dos/OIDPLUS.PAS |
---|
3,7 → 3,7 |
(************************************************) |
(* OIDPLUS.PAS *) |
(* Author: Daniel Marschall *) |
(* Revision: 2022-02-13 *) |
(* Revision: 2022-02-14 *) |
(* License: Apache 2.0 *) |
(* This file contains: *) |
(* - "OIDplus for DOS" program *) |
13,7 → 13,7 |
Dos, Crt, StrList, VtsFuncs, VtsCui, OidFile, OidUtils; |
const |
VERSIONINFO = 'Revision: 2022-02-13'; |
VERSIONINFO = 'Revision: 2022-02-14'; |
DEFAULT_STATUSBAR = '(C)2020-2022 ViaThinkSoft. Licensed under the terms of the Apache 2.0 license.'; |
DISKIO_SOUND_DEBUGGING = false; |
DISKIO_SOUND_DELAY = 500; |
249,7 → 249,7 |
2) then |
begin |
oid^.description := sInput; |
DescEditor := true; (* enable write file *) |
DescEditor := true; (* request caller to save @oid *) |
end; |
end; |
347,7 → 347,7 |
oid^.DotNotation := sInput |
else |
oid^.DotNotation := parentOID^.DotNotation + '.' + sInput; |
NumIdEditor := true; |
NumIdEditor := true; (* request caller to save @oid *) |
Exit; |
end; |
end |
368,17 → 368,19 |
InitOidDef(@newoid); |
newoid.FileId := NextPossibleFileID; |
newoid.Parent := oid^.FileId + oid^.DotNotation; |
if not NumIdEditor(@newoid, oid) then exit; |
if not AsnEditor(@newoid) then exit; |
if not DescEditor(@newoid) then exit; |
if NumIdEditor(@newoid, oid) and |
AsnEditor(@newoid) and |
DescEditor(@newoid) then |
begin |
newfilename := newoid.FileId + '.OID'; |
_WriteOidFile(newfilename, @newoid); |
(* Add link to original file and enable the saving of it *) |
ListAppend(oid^.SubIds, newoid.FileId + newoid.DotNotation); |
NewOidEditor := true; |
NewOidEditor := true; (* request caller to save @oid *) |
end; |
FreeOidDef(@newoid); |
end; |
procedure DeleteChildrenRecursive(oid: POID); |
var |
576,6 → 578,8 |
ListAppend(subfiles, ID_DELETE); |
end; |
(* Show menu *) |
subselres := DrawSelectionList(menuX, menuY, |
ScreenWidth-2, |
NAVBAR_SIZE, |
583,6 → 587,9 |
true, |
'SELECT ACTION', |
1); |
(* Process user selection *) |
if subselres = -1 then |
begin |
exit; |