Changeset 46 for trunk/Forms


Ignore:
Timestamp:
Aug 16, 2014, 11:02:07 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for switching large icons in toolbar.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r43 r46  
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 595
     7  ClientHeight = 592
    88  ClientWidth = 775
    99  Menu = MainMenu1
     
    1717  object PaintBox1: TPaintBox
    1818    Left = 0
    19     Height = 537
     19    Height = 531
    2020    Top = 32
    2121    Width = 775
     
    3232  object StatusBar1: TStatusBar
    3333    Left = 0
    34     Height = 26
    35     Top = 569
     34    Height = 29
     35    Top = 563
    3636    Width = 775
    3737    Panels = <   
     
    5555    Images = Core.ImageListSmall
    5656    ParentShowHint = False
     57    PopupMenu = PopupMenuToolbar
    5758    ShowHint = True
    5859    TabOrder = 1
     
    125126        Action = AZoomOut
    126127      end
     128      object MenuItem19: TMenuItem
     129        Caption = '-'
     130      end
     131      object MenuItem20: TMenuItem
     132        Action = AToolBarBigIcons
     133      end
    127134    end
    128135    object MenuItem8: TMenuItem
     
    164171      ShortCut = 16449
    165172    end
     173    object AToolBarBigIcons: TAction
     174      Caption = 'Toolbar big icons'
     175      OnExecute = AToolBarBigIconsExecute
     176    end
     177  end
     178  object PopupMenuToolbar: TPopupMenu
     179    left = 452
     180    top = 98
     181    object MenuItem18: TMenuItem
     182      Action = AToolBarBigIcons
     183    end
    166184  end
    167185end
  • trunk/Forms/UFormMain.lrt

    r43 r46  
    33TFORMMAIN.MENUITEM5.CAPTION=-
    44TFORMMAIN.MENUITEM10.CAPTION=View
     5TFORMMAIN.MENUITEM19.CAPTION=-
    56TFORMMAIN.MENUITEM8.CAPTION=Tools
    67TFORMMAIN.MENUITEM16.CAPTION=Help
     
    89TFORMMAIN.AZOOMOUT.CAPTION=Zoom out
    910TFORMMAIN.AZOOMALL.CAPTION=Zoom all
     11TFORMMAIN.ATOOLBARBIGICONS.CAPTION=Toolbar big icons
  • trunk/Forms/UFormMain.pas

    r43 r46  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   UGame, LCLType, Menus, ActnList, ComCtrls, types, dateutils;
     9  UGame, LCLType, Menus, ActnList, ComCtrls, types, dateutils, XMLConf;
    1010
    1111const
     
    1717
    1818  TFormMain = class(TForm)
     19    AToolBarBigIcons: TAction;
    1920    AZoomIn: TAction;
    2021    AZoomAll: TAction;
     
    3132    MenuItem16: TMenuItem;
    3233    MenuItem17: TMenuItem;
     34    MenuItem18: TMenuItem;
     35    MenuItem19: TMenuItem;
    3336    MenuItem2: TMenuItem;
     37    MenuItem20: TMenuItem;
    3438    MenuItem3: TMenuItem;
    3539    MenuItem4: TMenuItem;
     
    4044    MenuItem9: TMenuItem;
    4145    PaintBox1: TPaintBox;
     46    PopupMenuToolbar: TPopupMenu;
    4247    StatusBar1: TStatusBar;
    4348    Timer1: TTimer;
     
    4853    ToolButton4: TToolButton;
    4954    ToolButton5: TToolButton;
     55    procedure AToolBarBigIconsExecute(Sender: TObject);
    5056    procedure AZoomAllExecute(Sender: TObject);
    5157    procedure AZoomInExecute(Sender: TObject);
     
    5662    procedure FormDestroy(Sender: TObject);
    5763    procedure FormShow(Sender: TObject);
     64    procedure MenuItem19Click(Sender: TObject);
    5865    procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
    5966      Shift: TShiftState; X, Y: Integer);
     
    7784    RedrawPending: Boolean;
    7885  public
     86    procedure LoadConfig(Config: TXmlConfig; Path: string);
     87    procedure SaveConfig(Config: TXmlConfig; Path: string);
     88    procedure ReloadView;
    7989    procedure Redraw;
    8090  end;
     
    8696
    8797uses
    88   UFormNew, UFormMove, UCore;
     98  UCore;
    8999
    90100resourcestring
     
    132142      NewCaption := Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + IntToStr(Core.Game.TurnCounter) + ' - ' + NewCaption;
    133143    Caption := NewCaption;
     144  end;
     145end;
     146
     147procedure TFormMain.LoadConfig(Config: TXmlConfig; Path: string);
     148begin
     149  with Config do begin
     150    AToolBarBigIcons.Checked := GetValue(Path + '/LargeIcons', False);
     151  end;
     152end;
     153
     154procedure TFormMain.SaveConfig(Config: TXmlConfig; Path: string);
     155begin
     156  with Config do begin
     157    SetValue(Path + '/LargeIcons', AToolBarBigIcons.Checked);
     158  end;
     159end;
     160
     161procedure TFormMain.ReloadView;
     162begin
     163  if AToolBarBigIcons.Checked then begin
     164    ToolBar1.Images := Core.ImageListLarge;
     165    ToolBar1.ButtonWidth := 32 + 7;
     166    ToolBar1.ButtonHeight := 32 + 6;
     167    ToolBar1.Height := 32 + 10;
     168  end else begin
     169    ToolBar1.ButtonWidth := 16 + 7;
     170    ToolBar1.ButtonHeight := 16 + 6;
     171    ToolBar1.Height := 16 + 10;
     172    ToolBar1.Images := Core.ImageListSmall;
    134173  end;
    135174end;
     
    165204  end;
    166205  Redraw;
     206end;
     207
     208procedure TFormMain.AToolBarBigIconsExecute(Sender: TObject);
     209begin
     210  AToolBarBigIcons.Checked := not AToolBarBigIcons.Checked;
     211  ReloadView;
    167212end;
    168213
     
    194239begin
    195240  Core.Game.Running := False;
     241  SaveConfig(Core.XMLConfig1, 'FormMain');
    196242end;
    197243
     
    202248procedure TFormMain.FormShow(Sender: TObject);
    203249begin
    204   Redraw;
     250  LoadConfig(Core.XMLConfig1, 'FormMain');
     251  ReloadView;
     252  Redraw;
     253end;
     254
     255procedure TFormMain.MenuItem19Click(Sender: TObject);
     256begin
     257
    205258end;
    206259
Note: See TracChangeset for help on using the changeset viewer.