Changeset 172 for oup


Ignore:
Timestamp:
Apr 9, 2007, 1:52:14 AM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Main.pas

    r139 r172  
    727727
    728728function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate;
     729type
     730  TTemplate = class of TForm_ToolTemplate;
     731  TTool = record
     732      name: String;
     733      icon: Integer;
     734      caption: String;
     735      classt: TTemplate;
     736  end;
     737const
     738  Tools: array[0..4] of TTool = (
     739    (name: 'binedit';     icon: 5; caption: 'Binary .dat-Editor'; classt: TForm_BinEdit),
     740    (name: 'extractor';   icon: 8; caption: 'Extractor';          classt: TForm_Extractor),
     741    (name: 'preview';     icon: 4; caption: 'Preview-Window';     classt: TForm_Preview),
     742    (name: 'rawedit';     icon: 6; caption: 'Binary .raw-Editor'; classt: TForm_RawEdit),
     743    (name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer';      classt: TForm_TxmpReplace)
     744  );
    729745var
    730746  toolform:    TForm_ToolTemplate;
    731747  i:           Integer;
    732748  tag:         Integer;
    733   caption_end: String;
    734749  iconindex:   Integer;
    735750begin
     
    743758
    744759  iconindex := -1;
    745   caption_end := IntToStr(tag) + '       ';
    746760
    747761  toolform := nil;
    748762
    749   if window_context = 'binedit' then
    750   begin
    751     toolform         := TForm_BinEdit.Create(Self);
    752     toolform.Caption := 'Binary .dat-Editor ' + caption_end;
    753     iconindex        := 5;
    754   end;
    755   if window_context = 'extractor' then
    756   begin
    757     toolform         := TForm_Extractor.Create(Self);
    758     toolform.Caption := 'Extractor ' + caption_end;
    759     iconindex        := 8;
    760   end;
    761   if window_context = 'preview' then
    762   begin
    763     toolform         := TForm_Preview.Create(Self);
    764     toolform.Caption := 'Preview-Window ' + caption_end;
    765     iconindex        := 4;
    766   end;
    767   if window_context = 'rawedit' then
    768   begin
    769     toolform         := TForm_RawEdit.Create(Self);
    770     toolform.Caption := 'Binary .raw-Editor ' + caption_end;
    771     iconindex        := 6;
    772   end;
    773   if window_context = 'txmpreplace' then
    774   begin
    775     toolform         := TForm_TxmpReplace.Create(Self);
    776     toolform.Caption := 'TXMP Replacer ' + caption_end;
    777     iconindex        := 7;
     763  for i := 0 to High(Tools) do
     764    if Tools[i].name = window_context then
     765      Break;
     766  if i < Length(Tools) then
     767  begin
     768    toolform         := TTemplate(Tools[i].classt).Create(Self);
     769    toolform.Caption := Tools[i].caption + ' ' + IntToStr(tag) + '       ';
     770    iconindex        := Tools[i].icon;
     771  end else begin
     772    ShowMessage('WindowContext not found!');
    778773  end;
    779774
Note: See TracChangeset for help on using the changeset viewer.