Subversion Repositories oidplus

Rev

Rev 745 | Rev 747 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 745 Rev 746
Line 16... Line 16...
16
(* The program "PatchCRT" by Kennedy Software                  *)
16
(* The program "PatchCRT" by Kennedy Software                  *)
17
(* WON'T work because it somehow breaks our "_Pause" function. *)
17
(* WON'T work because it somehow breaks our "_Pause" function. *)
18
(* Instead, use the tool "TPPATCH" by Andreas Bauer.           *)
18
(* Instead, use the tool "TPPATCH" by Andreas Bauer.           *)
19
 
19
 
20
uses
20
uses
21
  Dos, Crt, StrList, VtsFuncs, VtsCui, OidFile, OidUtils;
21
  Dos, Crt, Drivers, StrList, VtsFuncs, VtsCui, OidFile, OidUtils;
22
 
22
 
23
const
23
const
24
  VERSIONINFO            = 'Revision: 2022-02-15';
24
  VERSIONINFO            = 'Revision: 2022-02-15';
25
  DEFAULT_STATUSBAR      = '(C)2020-2022 ViaThinkSoft. Licensed under the terms of the Apache 2.0 license.';
25
  DEFAULT_STATUSBAR      = '(C)2020-2022 ViaThinkSoft. Licensed under the terms of the Apache 2.0 license.';
26
  TITLEBAR_LEFT_TEXT     = 'OIDplus';
26
  TITLEBAR_LEFT_TEXT     = 'OIDplus';
Line 38... Line 38...
38
  TREEVIEW_WIDTH         = 80;
38
  TREEVIEW_WIDTH         = 80;
39
  OID_EXTENSION          = '.OID';
39
  OID_EXTENSION          = '.OID';
40
  TREEVIEW_FILENAME      = 'OIDTREE.TXT';
40
  TREEVIEW_FILENAME      = 'OIDTREE.TXT';
41
 
41
 
42
procedure _Pause;
42
procedure _Pause;
43
var
-
 
44
  bakX, bakY: integer;
-
 
45
begin
43
begin
46
  bakX := WhereX;
-
 
47
  bakY := WhereY;
-
 
48
  DrawStatusBar('Press any key to continue');
44
  DrawStatusBar('Press any key to continue');
49
  GoToXY(bakX, bakY);
45
  CursorOn;
50
  ReadKey;
46
  ReadKey;
-
 
47
  CursorOff;
51
  DrawStatusBar(DEFAULT_STATUSBAR);
48
  DrawStatusBar(DEFAULT_STATUSBAR);
52
end;
49
end;
53
 
50
 
54
function _WriteOidFile(filename: string; oid: POid; ShowErrorMessage: boolean): boolean;
51
function _WriteOidFile(filename: string; oid: POid; ShowErrorMessage: boolean): boolean;
55
var
52
var
Line 167... Line 164...
167
    end
164
    end
168
    else if res = menuIdNew then
165
    else if res = menuIdNew then
169
    begin
166
    begin
170
      (* "NEW" item was selected *)
167
      (* "NEW" item was selected *)
171
      sInput := '';
168
      sInput := '';
-
 
169
      CursorOn;
172
      repeat
170
      repeat
173
        if QueryVal(sInput,
171
        if QueryVal(sInput,
174
                    SINGLE_LINE_BOX_PADDING_INNER,
172
                    SINGLE_LINE_BOX_PADDING_INNER,
175
                    ScreenHeight div 2,
173
                    ScreenHeight div 2,
176
                    ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
174
                    ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
Line 195... Line 193...
195
            break;
193
            break;
196
          end;
194
          end;
197
        end
195
        end
198
        else break;
196
        else break;
199
      until false;
197
      until false;
-
 
198
      CursorOff;
200
    end
199
    end
201
    else if res = menuIdSave then
200
    else if res = menuIdSave then
202
    begin
201
    begin
203
      (* "SAVE" item was selected *)
202
      (* "SAVE" item was selected *)
204
      AsnEditor := true;
203
      AsnEditor := true;
Line 212... Line 211...
212
    end
211
    end
213
    else
212
    else
214
    begin
213
    begin
215
      DrawStatusBar('Note: Remove the text to delete the ASN.1 identifier');
214
      DrawStatusBar('Note: Remove the text to delete the ASN.1 identifier');
216
      sInput := ListGetElement(oid^.ASNIDs, res);
215
      sInput := ListGetElement(oid^.ASNIDs, res);
-
 
216
          CursorOn;
217
      repeat
217
      repeat
218
        if QueryVal(sInput,
218
        if QueryVal(sInput,
219
                    SINGLE_LINE_BOX_PADDING_INNER,
219
                    SINGLE_LINE_BOX_PADDING_INNER,
220
                    ScreenHeight div 2,
220
                    ScreenHeight div 2,
221
                    ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
221
                    ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
Line 246... Line 246...
246
            break;
246
            break;
247
          end;
247
          end;
248
        end
248
        end
249
        else break;
249
        else break;
250
      until false;
250
      until false;
-
 
251
          CursorOff;
251
    end;
252
    end;
252
  until false;
253
  until false;
253
end;
254
end;
254
 
255
 
255
function DescEditor(oid: POID): boolean;
256
function DescEditor(oid: POID): boolean;
Line 258... Line 259...
258
begin
259
begin
259
  DescEditor := false;
260
  DescEditor := false;
260
 
261
 
261
  DrawStatusBar('Note: Press Ctrl+Return for a line-break.');
262
  DrawStatusBar('Note: Press Ctrl+Return for a line-break.');
262
  sInput := oid^.description;
263
  sInput := oid^.description;
-
 
264
  CursorOn;
263
  if QueryVal(sInput,
265
  if QueryVal(sInput,
264
              DESCEDIT_PADDING,
266
              DESCEDIT_PADDING,
265
              ScreenHeight div 2 - DESCEDIT_LINES div 2,
267
              ScreenHeight div 2 - DESCEDIT_LINES div 2,
266
              ScreenWidth - (DESCEDIT_PADDING-1)*2,
268
              ScreenWidth - (DESCEDIT_PADDING-1)*2,
267
              DESCEDIT_LINES,
269
              DESCEDIT_LINES,
Line 269... Line 271...
269
              2) then
271
              2) then
270
  begin
272
  begin
271
    oid^.description := sInput;
273
    oid^.description := sInput;
272
    DescEditor := true; (* request caller to save <oid> *)
274
    DescEditor := true; (* request caller to save <oid> *)
273
  end;
275
  end;
-
 
276
  CursorOff;
274
end;
277
end;
275
 
278
 
276
function NextPossibleFileID: string;
279
function NextPossibleFileID: string;
277
var
280
var
278
  DirInfo: SearchRec;
281
  DirInfo: SearchRec;
Line 328... Line 331...
328
  sInput: string;
331
  sInput: string;
329
begin
332
begin
330
  NumIdEditor := false;
333
  NumIdEditor := false;
331
  sInput := '';
334
  sInput := '';
332
 
335
 
-
 
336
  CursorOn;
333
  repeat
337
  repeat
334
    if QueryVal(sInput,
338
    if QueryVal(sInput,
335
                SINGLE_LINE_BOX_PADDING_INNER,
339
                SINGLE_LINE_BOX_PADDING_INNER,
336
                ScreenHeight div 2,
340
                ScreenHeight div 2,
337
                ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
341
                ScreenWidth - (SINGLE_LINE_BOX_PADDING_INNER-1)*2,
Line 365... Line 369...
365
        if parentOID^.DotNotation = '' then
369
        if parentOID^.DotNotation = '' then
366
          oid^.DotNotation := sInput
370
          oid^.DotNotation := sInput
367
        else
371
        else
368
          oid^.DotNotation := parentOID^.DotNotation + '.' + sInput;
372
          oid^.DotNotation := parentOID^.DotNotation + '.' + sInput;
369
        NumIdEditor := true; (* request caller to save <oid> *)
373
        NumIdEditor := true; (* request caller to save <oid> *)
370
        Exit;
374
        Break;
371
      end;
375
      end;
372
    end
376
    end
373
    else
377
    else
374
    begin
378
    begin
375
      Exit;
379
      Break;
376
    end;
380
    end;
377
  until false;
381
  until false;
-
 
382
  CursorOff;
378
end;
383
end;
379
 
384
 
380
function NewOidEditor(oid: POID): boolean;
385
function NewOidEditor(oid: POID): boolean;
381
var
386
var
382
  newfilename: string;
387
  newfilename: string;
Line 467... Line 472...
467
begin
472
begin
468
  repeat
473
  repeat
469
    ShowMessage('Are you sure you want to delete this OID? (Y/N)', 'DELETE OID', true);
474
    ShowMessage('Are you sure you want to delete this OID? (Y/N)', 'DELETE OID', true);
470
    DrawStatusBar('Y=Yes, N=No');
475
    DrawStatusBar('Y=Yes, N=No');
471
 
476
 
-
 
477
    CursorOn;
472
    sc := ReadKey;
478
    sc := ReadKey;
-
 
479
    CursorOff;
473
    if sc = #0 then
480
    if sc = #0 then
474
    begin
481
    begin
475
      (* Extended key. Nothing we care about. *)
482
      (* Extended key. Nothing we care about. *)
476
      ReadKey;
483
      ReadKey;
477
      continue;
484
      continue;
Line 807... Line 814...
807
procedure OP_ReturnToMSDOS;
814
procedure OP_ReturnToMSDOS;
808
begin
815
begin
809
  ClrScr;
816
  ClrScr;
810
  TextBackground(Black);
817
  TextBackground(Black);
811
  TextColor(LightGray);
818
  TextColor(LightGray);
-
 
819
  ClrScr; (*Important, so that the DOS command prompt is also LightGray *)
-
 
820
 
812
  WriteLn('Thank you for using OIDplus for DOS.');
821
  WriteLn('Thank you for using OIDplus for DOS.');
813
  WriteLn('');
822
  WriteLn('');
814
end;
823
end;
815
 
824
 
816
function _GetTreeViewLine(oid: POID; indent: integer): string;
825
function _GetTreeViewLine(oid: POID; indent: integer): string;
Line 980... Line 989...
980
 
989
 
981
  OP_ReturnToMSDOS;
990
  OP_ReturnToMSDOS;
982
end;
991
end;
983
 
992
 
984
begin
993
begin
-
 
994
  InitVideo; (* sets ScreenWidth and ScreenHeight *)
-
 
995
  CursorOff;
985
  OP_MainMenu;
996
  OP_MainMenu;
-
 
997
  DoneVideo;
986
end.
998
end.