ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/releases/0.33a/Main.pas
(Generate patch)

Comparing oup/current/Main.pas (file contents):
Revision 45 by alloc, Sat Dec 23 00:03:50 2006 UTC vs.
Revision 51 by alloc, Sat Dec 23 22:16:42 2006 UTC

# Line 7 | Line 7 | uses
7    Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
8    MPHexEditor, ToolWin, ImgList, Tabs,
9    MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI,
10 <  Code_Functions, Data, Code_DataStructures, Code_OniDataClass,
11 <  Helper_LevelDB, Code_Exporters, Settings, Tool_Template,
12 <  Tool_BinEdit, Tool_Extractor, Tool_Preview, Tool_RawEdit, Tool_TxmpReplace;
10 >  Data, Functions, DataStructures, OniDataClass, Exporters,
11 >  Helper_LevelDB, Settings, Template,
12 >  BinEdit, Extractor, Preview, RawEdit, TxmpReplace;
13  
14   type
15    TForm_Main = class(TForm)
# Line 65 | Line 65 | type
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      function TryCloseAll: Boolean;
75      procedure menu_AboutClick(Sender: TObject);
76      procedure menu_settingsClick(Sender: TObject);
# Line 76 | Line 82 | type
82      procedure menu_windows_previousClick(Sender: TObject);
83      procedure menu_windows_nextClick(Sender: TObject);
84      procedure menu_windows_tileClick(Sender: TObject);
85 <    function open_child(window_context: String; fileid: Integer): Boolean;
85 >    function open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
86      procedure menu_windows_closeallClick(Sender: TObject);
87      procedure menu_windows_cascadeClick(Sender: TObject);
88      procedure menu_bineditClick(Sender: TObject);
# Line 96 | Line 102 | type
102      procedure ActivateTools(active: Boolean);
103      procedure MDITabMouseUp(Sender: TObject; Button: TMouseButton;
104        Shift: TShiftState; X, Y: Integer);
105 +    procedure menu_windows_tilevertClick(Sender: TObject);
106 +    procedure menu_metaClick(Sender: TObject);
107 +    procedure ToolbarDockChanged(Sender: TObject);
108    private
109    public
110    end;
# Line 277 | Line 286 | end;
286  
287  
288  
289 + procedure TForm_Main.ToolbarDockChanged(Sender: TObject);
290 + var
291 +  toolbar: TTBToolbar;
292 +  position: TTBDockPosition;
293 +  mode: TTBItemDisplayMode;
294 +  i: Integer;
295 +  isEnabled: Boolean;
296 + begin
297 +  toolbar := TTBToolbar(Sender);
298 +  if toolbar.Floating then
299 +    mode := nbdmImageAndText
300 +  else begin
301 +    position := toolbar.CurrentDock.Position;
302 +    if position in [dpLeft, dpRight] then
303 +      mode := nbdmDefault
304 +    else
305 +      mode := nbdmImageAndText;
306 +  end;
307 +  for i := 0 to toolbar.Items.Count - 1 do
308 +    toolbar.Items.Items[i].DisplayMode := mode;
309 + end;
310 +
311   function TForm_Main.TryCloseAll: Boolean;
312   begin
313    menu_windows_closeallClick(Self);
# Line 423 | Line 454 | begin
454   end;
455  
456  
457 + procedure TForm_Main.menu_metaClick(Sender: TObject);
458 + begin
459 +  ShowMessage('TBD');
460 + end;
461 +
462 +
463   procedure TForm_Main.menu_filecompareClick(Sender: TObject);
464   begin
465    open_child('compare', -1);
# Line 474 | Line 511 | begin
511    Self.Tile;
512   end;
513  
514 + procedure TForm_Main.menu_windows_tilevertClick(Sender: TObject);
515 + begin
516 +  Self.TileMode := tbVertical;
517 +  Self.Tile;
518 + end;
519  
520  
521   procedure TForm_Main.menu_windows_closeallClick(Sender: TObject);
# Line 516 | Line 558 | end;
558  
559  
560  
561 < function TForm_Main.open_child(window_context: String; fileid: Integer): Boolean;
561 > function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
562   var
563    toolform: TForm_ToolTemplate;
564    i:       Integer;
565    tag:     Integer;
566    iconindex: Integer;
567   begin
568 <  Result := True;
568 >  Result := nil;
569  
570    tag := 1;
571    if MDIChildCount > 0 then
# Line 537 | Line 579 | begin
579    begin
580      toolform         := TForm_BinEdit.Create(Self);
581      toolform.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
582 <    iconindex        := 0;
582 >    iconindex        := 4;
583    end;
584    if window_context = 'extractor' then
585    begin
586      toolform         := TForm_Extractor.Create(Self);
587      toolform.Caption := 'Extractor ' + IntToStr(tag);
588 +    iconindex        := 7;
589    end;
590    if window_context = 'preview' then
591    begin
592      toolform         := TForm_Preview.Create(Self);
593      toolform.Caption := 'Preview-Window ' + IntToStr(tag);
594 +    iconindex        := 3;
595    end;
596    if window_context = 'rawedit' then
597    begin
598      toolform         := TForm_RawEdit.Create(Self);
599      toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
600 +    iconindex        := 5;
601    end;
602    if window_context = 'txmpreplace' then
603    begin
604      toolform         := TForm_TxmpReplace.Create(Application);
605      toolform.Caption := 'TXMP Replacer ' + IntToStr(tag);
606 +    iconindex        := 6;
607    end;
608  
609    if Assigned(toolform) then
# Line 567 | Line 613 | begin
613      MDITab.AddTab(TForm(toolform), iconindex);
614      if fileid > -1 then
615        toolform.SelectFileID(fileid);
616 +    Result := toolform;
617    end;
618   end;
619  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)