source: oup/current/Main.pas@ 87

Last change on this file since 87 was 87, checked in by alloc, 18 years ago
File size: 19.7 KB
Line 
1unit Main;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
8 MPHexEditor, ToolWin, ImgList, Tabs,
9 MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI,
10 Data, Functions, DataStructures, OniDataClass, Exporters,
11 Helper_LevelDB, Settings, Template,
12 BinEdit, Extractor, Preview, RawEdit, TxmpReplace;
13
14type
15 TForm_Main = class(TForm)
16 saved: TSaveDialog;
17 opend: TOpenDialog;
18 statbar: TStatusBar;
19 MenuImages: TImageList;
20 DockTop: TTBDock;
21 MainMenu: TTBToolbar;
22 menu_main: TTBSubmenuItem;
23 menu_loadfile: TTBItem;
24 menu_sep1: TTBSeparatorItem;
25 menu_settings: TTBItem;
26 menu_sep4: TTBSeparatorItem;
27 menu_exit: TTBItem;
28 menu_convert: TTBSubmenuItem;
29 menu_createdb: TTBItem;
30 menu_createlvl: TTBItem;
31 menu_tools: TTBSubmenuItem;
32 menu_preview: TTBItem;
33 menu_binedit: TTBItem;
34 menu_rawedit: TTBItem;
35 menu_txmpreplace: TTBItem;
36 menu_extractor: TTBItem;
37 menu_filecompare: TTBItem;
38 menu_levelstructedit: TTBItem;
39 menu_windows: TTBSubmenuItem;
40 menu_windows_cascade: TTBItem;
41 menu_windows_tile: TTBItem;
42 menu_windows_closeall: TTBItem;
43 menu_sep3: TTBSeparatorItem;
44 menu_windows_next: TTBItem;
45 menu_windows_previous: TTBItem;
46 menu_sep2: TTBSeparatorItem;
47 menu_About: TTBItem;
48 Toolbar: TTBToolbar;
49 tbOpen: TTBItem;
50 DockLeft: TTBDock;
51 DockRight: TTBDock;
52 DockBottom: TTBDock;
53 MDIToolbar: TTBToolbar;
54 TBControlItem1: TTBControlItem;
55 MDITab: TMDITab;
56 menu_view: TTBSubmenuItem;
57 menu_view_mdibar: TTBItem;
58 menu_view_statusbar: TTBItem;
59 menu_view_toolbar: TTBItem;
60 tb_separator1: TTBSeparatorItem;
61 tb_preview: TTBItem;
62 tb_structure: TTBItem;
63 tb_compare: TTBItem;
64 tb_extractor: TTBItem;
65 tb_txmpreplacer: TTBItem;
66 tb_rawedit: TTBItem;
67 tb_datedit: TTBItem;
68 menu_windows_tilevert: TTBItem;
69 tb_meta: TTBItem;
70 menu_meta: TTBItem;
71 TBSeparatorItem1: TTBSeparatorItem;
72 tb_db2dat: TTBItem;
73 tb_dat2db: TTBItem;
74 menu_loaddb: TTBItem;
75 tb_opendb: TTBItem;
76 Images_Close: TImageList;
77 menu_conns: TTBSubmenuItem;
78 procedure UpdateConLists;
79 procedure LoadFile(typedb: Boolean);
80 function TryCloseAll: Boolean;
81 procedure menu_AboutClick(Sender: TObject);
82 procedure menu_settingsClick(Sender: TObject);
83 procedure menu_filecompareClick(Sender: TObject);
84 procedure menu_raweditClick(Sender: TObject);
85 procedure menu_createlvlClick(Sender: TObject);
86 procedure menu_extractorClick(Sender: TObject);
87 procedure menu_createdbClick(Sender: TObject);
88 procedure menu_windows_previousClick(Sender: TObject);
89 procedure menu_windows_nextClick(Sender: TObject);
90 procedure menu_windows_tileClick(Sender: TObject);
91 function open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
92 procedure menu_windows_closeallClick(Sender: TObject);
93 procedure menu_windows_cascadeClick(Sender: TObject);
94 procedure menu_bineditClick(Sender: TObject);
95 procedure menu_loadfileClick(Sender: TObject);
96 procedure menu_txmpreplaceClick(Sender: TObject);
97 procedure menu_exitClick(Sender: TObject);
98 procedure menu_previewClick(Sender: TObject);
99 procedure FormClose(Sender: TObject; var Action: TCloseAction);
100 procedure FormResize(Sender: TObject);
101 procedure FormCreate(Sender: TObject);
102 procedure UpdateStatBar;
103 procedure menu_view_mdibarClick(Sender: TObject);
104 procedure menu_view_statusbarClick(Sender: TObject);
105 procedure menu_view_toolbarClick(Sender: TObject);
106 procedure menu_conns_itemClick(Sender: TObject);
107 procedure MDITabDrawTab(Control: TCustomTabControl; TabIndex: Integer;
108 const Rect: TRect; Active: Boolean);
109 procedure ActivateTools(active: Boolean);
110 procedure MDITabMouseUp(Sender: TObject; Button: TMouseButton;
111 Shift: TShiftState; X, Y: Integer);
112 procedure menu_windows_tilevertClick(Sender: TObject);
113 procedure menu_metaClick(Sender: TObject);
114 procedure ToolbarDockChanged(Sender: TObject);
115 procedure menu_loaddbClick(Sender: TObject);
116 procedure MDITabMouseMove(Sender: TObject; Shift: TShiftState; X,
117 Y: Integer);
118 private
119 public
120 end;
121
122var
123 Form_Main: TForm_Main;
124
125implementation
126
127{$R *.dfm}
128
129
130
131procedure TForm_Main.FormCreate(Sender: TObject);
132begin
133 Self.Caption := 'Oni Un/Packer ' + version;
134 Self.FormResize(Self);
135
136 if FileExists(ExtractFilepath(Application.EXEname) + '\oniunpacker.ini') then
137 begin
138 AssignFile(AppSettingsFile, ExtractFilepath(Application.EXEname) +
139 '\oniunpacker.ini');
140 Reset(AppSettingsFile);
141 Read(AppSettingsFile, AppSettings);
142 CloseFile(AppSettingsFile);
143 end
144 else
145 begin
146 AppSettings.DatPath := 'D:\Spiele\Oni\GameDataFolder';
147 AppSettings.ExtractPath := 'C:\Dokumente und Einstellungen\Administrator\Desktop';
148 AppSettings.FilenumbersAsHex := False;
149 AppSettings.CharSet := DEFAULT_CHARSET;
150 AppSettings.HideUnusedData := False;
151 end;
152
153 if MidStr(ParamStr(1), 1, 3) = 'opf' then
154 begin
155 ShowMessage('Load OPF-File: ' + ParamStr(2));
156 end
157 else if MidStr(ParamStr(1), 1, 4) = 'oldb' then
158 begin
159 if CreateDataConnection(ParamStr(2), ODB_ADB) = nil then
160 ShowMessage('Error while loading the file:' + CrLf + ParamStr(
161 2) + CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
162 end
163 else if MidStr(ParamStr(1), 1, 3) = 'dat' then
164 begin
165 if CreateDataConnection(ParamStr(2), ODB_Dat) = nil then
166 ShowMessage('Error while loading the file:' + CrLf + ParamStr(
167 2) + CrLf + 'Perhaps not an Oni-.dat-file?');
168 end;
169 UpdateStatBar;
170 UpdateConLists;
171end;
172
173
174
175
176procedure TForm_Main.FormResize(Sender: TObject);
177const
178 MinWidth: Integer = 750;
179 MinHeight: Integer = 500;
180begin
181 if Self.Width < MinWidth then
182 Self.Width := MinWidth;
183 if Self.Height < MinHeight then
184 Self.Height := MinHeight;
185 statbar.Panels.Items[0].Width := Self.Width - 200;
186 MDITab.Width := Self.Width - 20;
187end;
188
189
190
191
192procedure TForm_Main.MDITabDrawTab(Control: TCustomTabControl;
193 TabIndex: Integer; const Rect: TRect; Active: Boolean);
194var
195 x, y: Integer;
196 iconindex: Integer;
197 caption: String;
198begin
199 iconindex := TMDITab(Control).Glyphs[TabIndex];
200 caption := TMDITab(Control).Captions[TabIndex];
201 if active then
202 begin
203 Control.Canvas.Font.Style := Control.Canvas.Font.Style + [fsItalic];
204 y := Rect.Top + 1;
205 end else
206 y := Rect.Top;
207 if iconindex >= 0 then
208 begin
209 TMDITab(Control).Images.Draw(Control.Canvas, Rect.Left + 4, y, iconindex);
210 x := Rect.Left + 26;
211 end else
212 x := Rect.Left + 4;
213 Control.Canvas.TextOut(x, y + 2, caption);
214 if active then
215 Images_Close.Draw(Control.Canvas, Rect.Right - 18, y, 0)
216 else
217 Images_Close.Draw(Control.Canvas, Rect.Right - 18, y, 1);
218end;
219
220
221procedure TForm_Main.MDITabMouseMove(Sender: TObject; Shift: TShiftState; X,
222 Y: Integer);
223var
224 pt: TPoint;
225 tabIndex: Integer;
226 hint: String;
227begin
228 pt.X := X;
229 pt.Y := Y;
230 tabIndex := MDITab.GetTabAtPos(pt);
231 hint := '';
232
233 if tabIndex >= 0 then
234 begin
235 if MDITab.MDIChildren[tabIndex] is TForm_ToolTemplate then
236 begin
237 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection <> nil then
238 hint := 'Connection: ' +
239 ExtractFileName(TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection.FileName) + #13+#10
240 else
241 hint := 'Connection: none' + #13+#10;
242 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.ID >= 0 then
243 hint := hint + 'Selected File: ' +
244 TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName
245 else
246 hint := hint + 'Selected File: none';
247 end
248 else
249 hint := 'Window: ' + MDITab.MDIChildren[tabIndex].Caption;
250 if hint <> MDITab.Hint then
251 begin
252 MDITab.Hint := hint;
253 MDITab.ShowHint := True;
254 end;
255 end
256 else
257 begin
258 MDITab.ShowHint := False;
259 MDITab.Hint := '';
260 end;
261end;
262
263procedure TForm_Main.MDITabMouseUp(Sender: TObject; Button: TMouseButton;
264 Shift: TShiftState; X, Y: Integer);
265var
266 pt: TPoint;
267 tabIndex: Integer;
268 tabRect: TRect;
269 tabX, tabY, tabWidth: Integer;
270begin
271 pt.X := X;
272 pt.Y := Y;
273 tabIndex := MDITab.GetTabAtPos(pt);
274
275// if (Button = mbRight) and (tabIndex >= 0) then
276// MDITab.MDIChildren[tabIndex].Close;
277
278 if (Button = mbLeft) and (tabIndex >= 0) then
279 begin
280 tabrect := MDITab.TabRect(tabIndex);
281 tabX := X - tabrect.Left;
282 tabY := Y - tabrect.Top;
283 tabwidth := tabrect.Right - tabrect.Left;
284 if (tabY >= 4) and (tabY <= 17) then
285 if (tabX >= tabwidth - 19) and (tabX <= tabwidth - 7) then
286 MDITab.MDIChildren[tabIndex].Close;
287 end;
288end;
289
290
291
292
293procedure TForm_Main.FormClose(Sender: TObject; var Action: TCloseAction);
294begin
295 AssignFile(AppSettingsFile, ExtractFilepath(Application.EXEname) + '\oniunpacker.ini');
296 if FileExists(ExtractFilepath(Application.EXEname) + '\oniunpacker.ini') then
297 Reset(AppSettingsFile)
298 else
299 Rewrite(AppSettingsFile);
300 Write(AppSettingsFile, AppSettings);
301 CloseFile(AppSettingsFile);
302 Action := caFree;
303end;
304
305
306
307procedure TForm_Main.ActivateTools(active: Boolean);
308begin
309 menu_tools.Enabled := active;
310 tb_preview.Enabled := active;
311 tb_datedit.Enabled := active;
312 tb_rawedit.Enabled := active;
313 tb_txmpreplacer.Enabled := active;
314 tb_extractor.Enabled := active;
315// tb_compare.Enabled := active;
316// tb_structure.Enabled := active;
317end;
318
319procedure TForm_Main.UpdateStatBar;
320begin
321 if Length(DataConnections) > 0 then
322 begin
323 Self.Caption := 'Oni Un/Packer ' + version;
324 ActivateTools(True);
325 statbar.Panels.Items[1].Text := 'Connections: ' + IntToStr(Length(DataConnections));
326 end
327 else
328 begin
329 Self.Caption := 'Oni Un/Packer ' + version;
330 statbar.Panels.Items[0].Text := '';
331 statbar.Panels.Items[1].Text := 'Connections: -';
332 statbar.Panels.Items[2].Text := '';
333 ActivateTools(False);
334 end;
335 menu_conns.Enabled := Length(DataConnections) > 0;
336end;
337
338
339
340
341procedure TForm_Main.ToolbarDockChanged(Sender: TObject);
342var
343 toolbar: TTBToolbar;
344 position: TTBDockPosition;
345 mode: TTBItemDisplayMode;
346 i: Integer;
347 isEnabled: Boolean;
348begin
349 toolbar := TTBToolbar(Sender);
350 if toolbar.Floating then
351 mode := nbdmImageAndText
352 else begin
353 position := toolbar.CurrentDock.Position;
354 if position in [dpLeft, dpRight] then
355 mode := nbdmDefault
356 else
357 mode := nbdmImageAndText;
358 end;
359 for i := 0 to toolbar.Items.Count - 1 do
360 toolbar.Items.Items[i].DisplayMode := mode;
361end;
362
363function TForm_Main.TryCloseAll: Boolean;
364begin
365 menu_windows_closeallClick(Self);
366 Application.ProcessMessages;
367 if MDITab.MDIChildCount = 0 then
368 Result := True
369 else
370 Result := False;
371end;
372
373
374procedure TForm_Main.menu_conns_itemClick(Sender: TObject);
375var
376 name: String;
377 i: Integer;
378begin
379 name := TTBItem(Sender).Caption;
380 if MessageBox(Handle, PChar('Do you really want to close data-connection to' +#13+#10+
381 name + '?'), PChar('Close?'), MB_YESNO + MB_ICONQUESTION) = ID_YES then
382 begin
383 for i := 0 to High(DataConnections) do
384 if ExtractFileName(DataConnections[i].FileName) = name then
385 begin
386 CloseDataConnection(DataConnections[i]);
387 Break;
388 end;
389 end;
390 UpdateConLists;
391end;
392
393
394procedure TForm_Main.UpdateConLists;
395var
396 i: Integer;
397 entry: TTBItem;
398begin
399 if MDITab.MDIChildCount > 0 then
400 for i := 0 to MDITab.MDIChildCount - 1 do
401 if MDITab.MDIChildren[i] is TForm_ToolTemplate then
402 TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList;
403
404 menu_conns.Clear;
405 if Length(DataConnections) > 0 then
406 begin
407 for i := 0 to High(DataConnections) do
408 begin
409 entry := TTBItem.Create(menu_conns);
410 entry.Caption := ExtractFileName(DataConnections[i].FileName);
411 entry.Name := 'menu_conn_' + IntToStr(i);
412 entry.OnClick := menu_conns_itemClick;
413 menu_conns.Add(entry);
414 entry := nil;
415 end;
416 end;
417end;
418
419
420procedure TForm_Main.LoadFile(typedb: Boolean);
421var
422 ext: String;
423begin
424 opend.InitialDir := AppSettings.DatPath;
425 opend.Filter := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';
426 if typedb then
427 opend.FilterIndex := 3
428 else
429 opend.FilterIndex := 2;
430 if opend.Execute then
431 begin
432 ext := ExtractFileExt(opend.FileName);
433 if ext = '.dat' then
434 begin
435 if CreateDataConnection(opend.FileName, ODB_Dat) <> nil then
436 UpdateConLists;
437 end else if ext = '.oldb' then
438 begin
439 if CreateDataConnection(opend.FileName, ODB_ADB) <> nil then
440 UpdateConLists;
441 end else
442 ShowMessage('Incompatible file');
443 AppSettings.DatPath := ExtractFilepath(opend.FileName);
444 end;
445 UpdateStatBar;
446end;
447
448
449 {#################################}
450 {##### Main-Menu-Handlers #####}
451 {#################################}
452procedure TForm_Main.menu_loaddbClick(Sender: TObject);
453begin
454 LoadFile(True);
455end;
456
457procedure TForm_Main.menu_loadfileClick(Sender: TObject);
458begin
459 LoadFile(False);
460end;
461
462
463
464
465procedure TForm_Main.menu_settingsClick(Sender: TObject);
466begin
467 Form_Settings.Visible := True;
468 Self.Enabled := False;
469end;
470
471
472
473
474procedure TForm_Main.menu_exitClick(Sender: TObject);
475begin
476 Self.Close;
477end;
478
479 {####################################}
480 {##### Converters-Menu-Handlers #####}
481 {####################################}
482procedure TForm_Main.menu_createdbClick(Sender: TObject);
483begin
484{ if Assigned(OniDataConnection) then
485 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' +
486 'Do you want to close it to continue?'), PChar('Close file?'),
487 MB_YESNO + MB_ICONQUESTION) = ID_NO then
488 Exit
489 else begin
490 if TryCloseAll then
491 begin
492 CloseDataConnection;
493 UpdateStatBar;
494 end else
495 Exit;
496 end;
497 opend.Filter := 'Oni-Dat-Files|*.dat';
498 saved.Filter := 'OUP-Level-DB (*.oldb)|*.oldb';
499 saved.DefaultExt := 'oldb';
500 if opend.Execute then
501 if saved.Execute then
502 Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName);
503}end;
504
505
506
507
508procedure TForm_Main.menu_createlvlClick(Sender: TObject);
509begin
510{ if Assigned(OniDataConnection) then
511 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' +
512 'Do you want to close it to continue?'), PChar('Close file?'),
513 MB_YESNO + MB_ICONQUESTION) = ID_NO then
514 Exit
515 else begin
516 if TryCloseAll then
517 begin
518 CloseDataConnection;
519 UpdateStatBar;
520 end else
521 Exit;
522 end;
523 opend.Filter := 'OUP-Level-DB (*.oldb)|*.oldb';
524 saved.Filter := 'Oni-Dat-Files|*.dat';
525 saved.DefaultExt := 'dat';
526 if opend.Execute then
527 if saved.Execute then
528 Form_LevelDB.CreateLevel(opend.FileName, saved.FileName);
529}end;
530
531 {#################################}
532 {##### Tools-Menu-Handlers #####}
533 {#################################}
534procedure TForm_Main.menu_previewClick(Sender: TObject);
535begin
536 open_child('preview', -1);
537end;
538
539
540procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject);
541begin
542 open_child('txmpreplace', -1);
543end;
544
545
546procedure TForm_Main.menu_bineditClick(Sender: TObject);
547begin
548 open_child('binedit', -1);
549end;
550
551
552procedure TForm_Main.menu_raweditClick(Sender: TObject);
553begin
554 open_child('rawedit', -1);
555end;
556
557
558procedure TForm_Main.menu_extractorClick(Sender: TObject);
559begin
560 open_child('extractor', -1);
561end;
562
563
564procedure TForm_Main.menu_metaClick(Sender: TObject);
565begin
566 ShowMessage('TBD');
567end;
568
569
570procedure TForm_Main.menu_filecompareClick(Sender: TObject);
571begin
572 open_child('compare', -1);
573end;
574
575
576 {#################################}
577 {##### View-Menu-Handlers #####}
578 {#################################}
579procedure TForm_Main.menu_view_mdibarClick(Sender: TObject);
580begin
581 menu_view_mdibar.Checked := not menu_view_mdibar.Checked;
582 mditoolbar.Visible := menu_view_mdibar.Checked;
583end;
584
585
586
587
588procedure TForm_Main.menu_view_statusbarClick(Sender: TObject);
589begin
590 menu_view_statusbar.Checked := not menu_view_statusbar.Checked;
591 statbar.Visible := menu_view_statusbar.Checked;
592end;
593
594
595
596
597procedure TForm_Main.menu_view_toolbarClick(Sender: TObject);
598begin
599 menu_view_toolbar.Checked := not menu_view_toolbar.Checked;
600 Toolbar.Visible := menu_view_toolbar.Checked;
601end;
602
603
604
605 {#################################}
606 {##### Window-Menu-Handlers #####}
607 {#################################}
608procedure TForm_Main.menu_windows_cascadeClick(Sender: TObject);
609begin
610 Self.Cascade;
611end;
612
613
614
615procedure TForm_Main.menu_windows_tileClick(Sender: TObject);
616begin
617 Self.TileMode := tbHorizontal;
618 Self.Tile;
619end;
620
621procedure TForm_Main.menu_windows_tilevertClick(Sender: TObject);
622begin
623 Self.TileMode := tbVertical;
624 Self.Tile;
625end;
626
627
628procedure TForm_Main.menu_windows_closeallClick(Sender: TObject);
629begin
630 MDITab.CloseAll;
631end;
632
633
634
635procedure TForm_Main.menu_windows_nextClick(Sender: TObject);
636begin
637 if MDIChildCount > 1 then
638 if MDITab.TabIndex = MDITab.MDIChildCount - 1 then
639 MDITab.MDIChildren[0].BringToFront
640 else
641 MDITab.MDIChildren[MDITab.TabIndex + 1].BringToFront;
642end;
643
644
645
646procedure TForm_Main.menu_windows_previousClick(Sender: TObject);
647begin
648 if MDIChildCount > 1 then
649 if MDITab.TabIndex = 0 then
650 MDITab.MDIChildren[MDITab.MDIChildCount - 1].BringToFront
651 else
652 MDITab.MDIChildren[MDITab.TabIndex - 1].BringToFront;
653end;
654
655
656
657
658
659
660procedure TForm_Main.menu_AboutClick(Sender: TObject);
661begin
662 ShowMessage('Will be implemented later ;)');
663end;
664
665
666
667
668function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
669var
670 toolform: TForm_ToolTemplate;
671 i: Integer;
672 tag: Integer;
673 caption_end: String;
674 iconindex: Integer;
675begin
676 Result := nil;
677
678 tag := 1;
679 if MDIChildCount > 0 then
680 for i := 0 to MDIChildCount - 1 do
681 if MDIChildren[i].Tag >= tag then
682 tag := MDIChildren[i].Tag + 1;
683
684 iconindex := -1;
685 caption_end := IntToStr(tag) + ' ';
686
687 if window_context = 'binedit' then
688 begin
689 toolform := TForm_BinEdit.Create(Self);
690 toolform.Caption := 'Binary .dat-Editor ' + caption_end;
691 iconindex := 5;
692 end;
693 if window_context = 'extractor' then
694 begin
695 toolform := TForm_Extractor.Create(Self);
696 toolform.Caption := 'Extractor ' + caption_end;
697 iconindex := 8;
698 end;
699 if window_context = 'preview' then
700 begin
701 toolform := TForm_Preview.Create(Self);
702 toolform.Caption := 'Preview-Window ' + caption_end;
703 iconindex := 4;
704 end;
705 if window_context = 'rawedit' then
706 begin
707 toolform := TForm_RawEdit.Create(Self);
708 toolform.Caption := 'Binary .raw-Editor ' + caption_end;
709 iconindex := 6;
710 end;
711 if window_context = 'txmpreplace' then
712 begin
713 toolform := TForm_TxmpReplace.Create(Application);
714 toolform.Caption := 'TXMP Replacer ' + caption_end;
715 iconindex := 7;
716 end;
717
718 if Assigned(toolform) then
719 begin
720 toolform.Name := window_context + IntToStr(tag);
721 toolform.Tag := tag;
722 MDITab.AddTab(TForm(toolform), iconindex);
723 toolform.Caption := AnsiReplaceStr(toolform.Caption, ' ', '');
724 if fileid > -1 then
725 toolform.SelectFileID(fileid);
726 Result := toolform;
727 end;
728end;
729
730end.
Note: See TracBrowser for help on using the repository browser.