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

Comparing oup/current/Main.pas (file contents):
Revision 54 by alloc, Mon Dec 25 03:04:47 2006 UTC vs.
Revision 82 by alloc, Sun Jan 14 00:48:40 2007 UTC

# Line 73 | Line 73 | type
73      tb_dat2db: TTBItem;
74      menu_loaddb: TTBItem;
75      tb_opendb: TTBItem;
76 +    Images_Close: TImageList;
77      procedure LoadFile(typedb: Boolean);
78      function TryCloseAll: Boolean;
79      procedure menu_AboutClick(Sender: TObject);
# Line 204 | Line 205 | begin
205    end else
206      x := Rect.Left + 4;
207    Control.Canvas.TextOut(x, y + 2, caption);
208 +  if active then
209 +    Images_Close.Draw(Control.Canvas, Rect.Right - 18, y, 0)
210 +  else
211 +    Images_Close.Draw(Control.Canvas, Rect.Right - 18, y, 1);
212   end;
213  
214  
# Line 215 | Line 220 | procedure TForm_Main.MDITabMouseUp(Sende
220    Shift: TShiftState; X, Y: Integer);
221   var
222    pt: TPoint;
223 <  index: Integer;
223 >  tabIndex: Integer;
224 >  tabRect: TRect;
225 >  tabX, tabY, tabWidth: Integer;
226   begin
227    pt.X := X;
228    pt.Y := Y;
229 <  index := MDITab.GetTabAtPos(pt);
230 <  if (Button = mbRight) and (index >= 0) then
231 <    MDITab.MDIChildren[index].Close;
229 >  tabIndex := MDITab.GetTabAtPos(pt);
230 >  if (Button = mbRight) and (tabIndex >= 0) then
231 >    MDITab.MDIChildren[tabIndex].Close;
232 >
233 >  if (Button = mbLeft) and (tabIndex >= 0) then
234 >  begin
235 >    tabrect := MDITab.TabRect(tabIndex);
236 >    tabX := X - tabrect.Left;
237 >    tabY := Y - tabrect.Top;
238 >    tabwidth := tabrect.Right - tabrect.Left;
239 >    if (tabY >= 4) and (tabY <= 17) then
240 >      if (tabX >= tabwidth - 19) and (tabX <= tabwidth - 7) then
241 >        MDITab.MDIChildren[tabIndex].Close;
242 >  end;
243   end;
244  
245   procedure TForm_Main.FormClose(Sender: TObject; var Action: TCloseAction);
# Line 580 | Line 598 | end;
598  
599   function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
600   var
601 <  toolform: TForm_ToolTemplate;
602 <  i:       Integer;
603 <  tag:     Integer;
604 <  iconindex: Integer;
601 >  toolform:    TForm_ToolTemplate;
602 >  i:           Integer;
603 >  tag:         Integer;
604 >  caption_end: String;
605 >  iconindex:   Integer;
606   begin
607    Result := nil;
608  
# Line 594 | Line 613 | begin
613          tag := MDIChildren[i].Tag + 1;
614  
615    iconindex := -1;
616 +  caption_end := IntToStr(tag) + '       ';
617  
618    if window_context = 'binedit' then
619    begin
620      toolform         := TForm_BinEdit.Create(Self);
621 <    toolform.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
621 >    toolform.Caption := 'Binary .dat-Editor ' + caption_end;
622      iconindex        := 5;
623    end;
624    if window_context = 'extractor' then
625    begin
626      toolform         := TForm_Extractor.Create(Self);
627 <    toolform.Caption := 'Extractor ' + IntToStr(tag);
627 >    toolform.Caption := 'Extractor ' + caption_end;
628      iconindex        := 8;
629    end;
630    if window_context = 'preview' then
631    begin
632      toolform         := TForm_Preview.Create(Self);
633 <    toolform.Caption := 'Preview-Window ' + IntToStr(tag);
633 >    toolform.Caption := 'Preview-Window ' + caption_end;
634      iconindex        := 4;
635    end;
636    if window_context = 'rawedit' then
637    begin
638      toolform         := TForm_RawEdit.Create(Self);
639 <    toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
639 >    toolform.Caption := 'Binary .raw-Editor ' + caption_end;
640      iconindex        := 6;
641    end;
642    if window_context = 'txmpreplace' then
643    begin
644      toolform         := TForm_TxmpReplace.Create(Application);
645 <    toolform.Caption := 'TXMP Replacer ' + IntToStr(tag);
645 >    toolform.Caption := 'TXMP Replacer ' + caption_end;
646      iconindex        := 7;
647    end;
648  
# Line 631 | Line 651 | begin
651      toolform.Name    := window_context + IntToStr(tag);
652      toolform.Tag     := tag;
653      MDITab.AddTab(TForm(toolform), iconindex);
654 +    toolform.Caption := AnsiReplaceStr(toolform.Caption, '       ', '');
655      if fileid > -1 then
656        toolform.SelectFileID(fileid);
657      Result := toolform;

Diff Legend

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