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 86 by alloc, Sun Jan 14 20:19:08 2007 UTC vs.
Revision 87 by alloc, Sun Jan 14 22:59:34 2007 UTC

# Line 74 | Line 74 | type
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;
# Line 102 | Line 103 | type
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);
# Line 165 | Line 167 | begin
167          2) + CrLf + 'Perhaps not an Oni-.dat-file?');
168    end;
169    UpdateStatBar;
170 +  UpdateConLists;
171   end;
172  
173  
# Line 225 | Line 228 | begin
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 <      hint := 'Window: ' + MDITab.MDIChildren[tabIndex].Caption + #13+#10 +
238 <            'Selected File: ';
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 + TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName
243 >        hint := hint + 'Selected File: ' +
244 >              TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName
245        else
246 <        hint := hint + 'None';
246 >        hint := hint + 'Selected File: none';
247      end
248      else
249        hint := 'Window: ' + MDITab.MDIChildren[tabIndex].Caption;
# Line 319 | Line 327 | begin
327    else
328    begin
329      Self.Caption      := 'Oni Un/Packer ' + version;
330 <    statbar.Panels.Items[0].Text := 'Nothing loaded';
331 <    statbar.Panels.Items[1].Text := 'Files: -';
332 <    statbar.Panels.Items[2].Text := 'Extensions: -';
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;
336   end;
337  
338  
# Line 362 | Line 371 | begin
371   end;
372  
373  
374 + procedure TForm_Main.menu_conns_itemClick(Sender: TObject);
375 + var
376 +  name: String;
377 +  i: Integer;
378 + begin
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;
391 + end;
392 +
393 +
394   procedure TForm_Main.UpdateConLists;
395   var
396    i: Integer;
397 +  entry: TTBItem;
398   begin
399 <  for i := 0 to MDITab.MDIChildCount - 1 do
400 <    if MDITab.MDIChildren[i] is TForm_ToolTemplate then
401 <      TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList;
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;
417   end;
418  
419  

Diff Legend

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