Changeset 6 for trunk/Forms


Ignore:
Timestamp:
Dec 25, 2010, 9:31:21 PM (14 years ago)
Author:
george
Message:
  • Activated generation of language files.
  • Added: Full screen mode.
Location:
trunk/Forms
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemEdit.lfm

    r5 r6  
    11object ItemEditForm: TItemEditForm
    2   Left = 287
     2  Left = 295
    33  Height = 429
    4   Top = 175
     4  Top = 174
    55  Width = 558
    66  ActiveControl = Panel1
  • trunk/Forms/UItemEdit.pas

    r5 r6  
    4646procedure TItemEditForm.ButtonSaveClick(Sender: TObject);
    4747begin
     48
     49  MainForm.LoadItemList;
    4850  Close;
    4951end;
  • trunk/Forms/UItemView.lfm

    r3 r6  
    22  Left = 337
    33  Height = 416
    4   Top = 140
     4  Top = 135
    55  Width = 552
    66  Caption = 'Zobrazení položky'
  • trunk/Forms/UItemView.pas

    r3 r6  
    8686
    8787    for I := Panel1.ControlCount - 1 downto 0 do
    88       Panel1.Controls[I].Destroy;
     88      Panel1.Controls[I].Free;
    8989
    9090    // Load column names
     
    114114    Properties.Destroy;
    115115  end else ShowMessage('Objekt nenalezen');
    116   ObjectInfo.Destroy;
     116  ObjectInfo.Free;
    117117end;
    118118
  • trunk/Forms/UMainForm.lfm

    r5 r6  
    11object MainForm: TMainForm
    2   Left = 317
     2  Left = 332
    33  Height = 445
    4   Top = 97
     4  Top = 106
    55  Width = 649
     6  ActiveControl = Panel1
    67  Caption = 'ChronIS'
    7   ClientHeight = 445
     8  ClientHeight = 422
    89  ClientWidth = 649
     10  Menu = MainMenu1
    911  OnClose = FormClose
    1012  OnCreate = FormCreate
     
    1416  object Panel1: TPanel
    1517    Left = 0
    16     Height = 445
     18    Height = 422
    1719    Top = 0
    1820    Width = 184
    1921    Align = alLeft
    2022    BevelOuter = bvNone
    21     ClientHeight = 445
     23    ClientHeight = 422
    2224    ClientWidth = 184
    2325    TabOrder = 0
     
    2628      Height = 14
    2729      Top = 4
    28       Width = 47
     30      Width = 46
    2931      Caption = 'Skupiny:'
    3032      ParentColor = False
     
    3234    object TreeView1: TTreeView
    3335      Left = 8
    34       Height = 421
     36      Height = 398
    3537      Top = 19
    3638      Width = 176
     
    4648  object Panel2: TPanel
    4749    Left = 189
    48     Height = 445
     50    Height = 422
    4951    Top = 0
    5052    Width = 460
    5153    Align = alClient
    5254    BevelOuter = bvNone
    53     ClientHeight = 445
     55    ClientHeight = 422
    5456    ClientWidth = 460
    5557    TabOrder = 1
     
    6466    object ListView1: TListView
    6567      Left = 3
    66       Height = 389
     68      Height = 366
    6769      Top = 19
    6870      Width = 450
    6971      Anchors = [akTop, akLeft, akRight, akBottom]
    7072      Columns = <>
    71       ItemIndex = -1
    7273      PopupMenu = PopupMenuItem
    7374      ReadOnly = True
     
    8384      Left = 3
    8485      Height = 25
    85       Top = 416
     86      Top = 393
    8687      Width = 75
    8788      Action = AItemAdd
     
    9293      Left = 83
    9394      Height = 25
    94       Top = 416
     95      Top = 393
    9596      Width = 75
    9697      Action = AItemDelete
     
    101102  object Splitter1: TSplitter
    102103    Left = 184
    103     Height = 445
     104    Height = 422
    104105    Top = 0
    105106    Width = 5
     
    154155      Caption = 'Upravit'
    155156      OnExecute = AObjectEditExecute
     157    end
     158    object AExit: TAction
     159      Caption = 'Exit'
     160      OnExecute = AExitExecute
     161    end
     162    object AToggleFullscreen: TAction
     163      Caption = 'Fullscreen mode F11'
     164      OnExecute = AToggleFullscreenExecute
     165      ShortCut = 122
    156166    end
    157167  end
     
    174184    object MenuItem2: TMenuItem
    175185      Action = AItemAdd
     186      OnClick = AItemAddExecute
    176187    end
    177188  end
     
    185196    object MenuItem10: TMenuItem
    186197      Action = AObjectEdit
     198      OnClick = AObjectEditExecute
    187199    end
    188200  end
     
    193205    object MenuItem5: TMenuItem
    194206      Action = AObjectGroupAddGroup
     207      OnClick = AObjectGroupAddGroupExecute
    195208    end
    196209    object MenuItem7: TMenuItem
     
    199212    object MenuItem8: TMenuItem
    200213      Action = AObjectGroupEdit
     214      OnClick = AObjectGroupEditExecute
    201215    end
    202216    object MenuItem6: TMenuItem
     
    275289    }
    276290  end
     291  object MainMenu1: TMainMenu
     292    left = 456
     293    top = 120
     294    object MenuItem13: TMenuItem
     295      Caption = 'Server'
     296      object MenuItem14: TMenuItem
     297        Action = AExit
     298      end
     299    end
     300    object MenuItem11: TMenuItem
     301      Caption = 'View'
     302      object MenuItem15: TMenuItem
     303        Action = AToggleFullscreen
     304      end
     305    end
     306    object MenuItem12: TMenuItem
     307      Caption = 'Help'
     308    end
     309  end
    277310end
  • trunk/Forms/UMainForm.pas

    r5 r6  
    2121
    2222  TMainForm = class(TForm)
     23    AToggleFullscreen: TAction;
     24    AExit: TAction;
    2325    AObjectEdit: TAction;
    2426    AObjectDelete: TAction;
     
    3840    Label2: TLabel;
    3941    ListView1: TListView;
     42    MainMenu1: TMainMenu;
    4043    MenuItem1: TMenuItem;
    4144    MenuItem10: TMenuItem;
     45    MenuItem11: TMenuItem;
     46    MenuItem12: TMenuItem;
     47    MenuItem13: TMenuItem;
     48    MenuItem14: TMenuItem;
     49    MenuItem15: TMenuItem;
    4250    MenuItem2: TMenuItem;
    4351    MenuItem3: TMenuItem;
     
    5563    Splitter1: TSplitter;
    5664    TreeView1: TTreeView;
     65    procedure AExitExecute(Sender: TObject);
    5766    procedure AItemAddExecute(Sender: TObject);
    5867    procedure AItemEditExecute(Sender: TObject);
     
    6170    procedure AObjectGroupAddGroupExecute(Sender: TObject);
    6271    procedure AObjectGroupEditExecute(Sender: TObject);
     72    procedure AToggleFullscreenExecute(Sender: TObject);
    6373    procedure ButtonAddClick(Sender: TObject);
    6474    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    7383    procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
    7484  private
     85    OriginalBounds: TRect;
     86    OriginalWindowState: TWindowState;
     87    ScreenBounds: TRect;
    7588    procedure LoadConfiguration;
    7689  public
     
    103116  I3: Integer;
    104117begin
    105   if FileExists(ConfigFileName) then begin
     118  if FileExists(ConfigFileName) then try
    106119    ReadXMLFile(Config, ConfigFileName);
    107120    for I1 := 0 to Config.ChildNodes.Count - 1 do
     
    124137      end;
    125138    end;
    126     Config.Destroy;
     139  finally
     140    Config.Free;
    127141  end;
    128142end;
     
    139153procedure TMainForm.FormDestroy(Sender: TObject);
    140154begin
    141   TreeState.Destroy;
    142   Database.Destroy;
    143   PersistentForm.Destroy;
     155  TreeState.Free;
     156  Database.Free;
     157  PersistentForm.Free;
    144158end;
    145159
     
    182196end;
    183197
     198procedure TMainForm.AToggleFullscreenExecute(Sender: TObject);
     199begin
     200   if BorderStyle <> bsNone then begin
     201    // To full screen
     202    OriginalWindowState := WindowState;
     203    OriginalBounds := BoundsRect;
     204
     205    BorderStyle := bsNone;
     206    ScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect;
     207    with ScreenBounds do
     208      SetBounds(Left, Top, Right - Left, Bottom - Top) ;
     209  end else begin
     210    // From full screen
     211    {$IFDEF MSWINDOWS}
     212    BorderStyle := bsSizeable;
     213    {$ENDIF}
     214    if OriginalWindowState = wsMaximized then
     215      WindowState := wsMaximized
     216    else
     217      with OriginalBounds do
     218        SetBounds(Left, Top, Right - Left, Bottom - Top) ;
     219    {$IFDEF LINUX}
     220    BorderStyle := bsSizeable;
     221    {$ENDIF}
     222  end;
     223end;
     224
    184225procedure TMainForm.AItemEditExecute(Sender: TObject);
    185226begin
     
    190231begin
    191232  ItemAddForm.Show;
     233end;
     234
     235procedure TMainForm.AExitExecute(Sender: TObject);
     236begin
     237  Close;
    192238end;
    193239
     
    259305    TopItem.ImageIndex := 0;
    260306    TopItem.SelectedIndex := 0;
    261     DbRows := Database.Query('SELECT * FROM `ObjectGroup`');
    262     for I := 0 to DbRows.Count - 1 do begin
    263       NewNode := AddChild(TopItem, DbRows[I].Values['Name']);
    264       NewNode.ImageIndex := 0;
    265       NewNode.SelectedIndex := 0;
    266       NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id']));
    267       ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']);
    268       for O := 0 to ObjectDbRows.Count - 1 do begin
    269         NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']);
    270         NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id']));
    271         NewObjectNode.ImageIndex := 1;
    272         NewObjectNode.SelectedIndex := 1;
    273       end;
    274       ObjectDbRows.Destroy;
    275     end;
    276     TopItem.Expand(True);
    277     DbRows.Destroy;
     307    try
     308      DbRows := Database.Query('SELECT * FROM `ObjectGroup`');
     309      for I := 0 to DbRows.Count - 1 do begin
     310        NewNode := AddChild(TopItem, DbRows[I].Values['Name']);
     311        NewNode.ImageIndex := 0;
     312        NewNode.SelectedIndex := 0;
     313        NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id']));
     314        try
     315          ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']);
     316          for O := 0 to ObjectDbRows.Count - 1 do begin
     317            NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']);
     318            NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id']));
     319            NewObjectNode.ImageIndex := 1;
     320            NewObjectNode.SelectedIndex := 1;
     321          end;
     322        finally
     323          ObjectDbRows.Free;
     324        end;
     325      end;
     326      TopItem.Expand(True);
     327    finally
     328      DbRows.Free;
     329    end;
    278330    TreeState.LoadTree(TreeView1);
    279331  end;
     
    295347    Visible := True;
    296348    Clear;
     349    try
    297350    DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(Integer(TreeView1.Selected.Data)));
    298351    if DbRows.Count = 1 then begin
     
    300353
    301354      // Load column names
    302       Properties := Database.Query('SELECT * FROM `Property` WHERE `Object`=' +
    303         DbRows[0].Values['Id']);
    304       Columns.Clear;
    305       NewColumn := Columns.Add;
    306       NewColumn.Caption := 'Id';
    307       for I := 0 to Properties.Count - 1 do begin
     355      try
     356        Properties := Database.Query('SELECT * FROM `Property` WHERE `Object`=' +
     357          DbRows[0].Values['Id']);
     358        Columns.Clear;
    308359        NewColumn := Columns.Add;
    309         NewColumn.Caption := Properties[I].Values['Name'];
     360        NewColumn.Caption := 'Id';
     361        for I := 0 to Properties.Count - 1 do begin
     362          NewColumn := Columns.Add;
     363          NewColumn.Caption := Properties[I].Values['Name'];
     364        end;
     365      finally
     366        Properties.Free;
    310367      end;
    311368
     
    313370
    314371      // Load items
     372      try
    315373      Values := Database.Query('SELECT * FROM `' + DbRows[0].Values['Schema'] + '`.`' +
    316374        DbRows[0].Values['Table'] + '`');
     
    323381        end;
    324382      end;
    325       Values.Destroy;
    326       Properties.Destroy;
    327     end;
    328     DbRows.Destroy;
     383      finally
     384        Values.Free;
     385      end;
     386    end;
     387    finally
     388      DbRows.Free;
     389    end;
    329390  end;
    330391end;
Note: See TracChangeset for help on using the changeset viewer.