From e0bebc82cd9615048d33fcdaa94c3eadf899b89f Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Sun, 28 Aug 2011 06:32:54 +0000 Subject: [PATCH] fpchess: Improves the UI git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1847 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpchess/mainform.lfm | 81 +++++++++++++++++++------------ applications/fpchess/mainform.pas | 20 +++++++- 2 files changed, 69 insertions(+), 32 deletions(-) diff --git a/applications/fpchess/mainform.lfm b/applications/fpchess/mainform.lfm index 5e7820deb..cd0ff6d04 100644 --- a/applications/fpchess/mainform.lfm +++ b/applications/fpchess/mainform.lfm @@ -1,26 +1,26 @@ object formChess: TformChess Left = 318 - Height = 433 + Height = 500 Top = 123 Width = 360 ActiveControl = notebookMain Caption = 'FP Chess 0.1' - ClientHeight = 433 + ClientHeight = 500 ClientWidth = 360 OnCreate = FormCreate LCLVersion = '0.9.31' object notebookMain: TNotebook Left = 0 - Height = 433 + Height = 500 Top = 0 Width = 360 - PageIndex = 0 + PageIndex = 1 Align = alClient TabOrder = 0 TabStop = True object pageStart: TPage ClientWidth = 360 - ClientHeight = 433 + ClientHeight = 500 object Label1: TLabel Left = 0 Height = 32 @@ -62,7 +62,7 @@ object formChess: TformChess object btnQuit: TBitBtn Left = 24 Height = 30 - Top = 392 + Top = 456 Width = 304 Caption = 'Quit' OnClick = btnQuitClick @@ -132,8 +132,8 @@ object formChess: TformChess end object panelModules: TPanel Left = 8 - Height = 121 - Top = 224 + Height = 177 + Top = 232 Width = 344 BevelOuter = bvNone TabOrder = 6 @@ -161,7 +161,7 @@ object formChess: TformChess object btnStartGame: TBitBtn Left = 24 Height = 30 - Top = 352 + Top = 416 Width = 304 Caption = 'Start game' OnClick = btnStartGameClick @@ -169,23 +169,8 @@ object formChess: TformChess end end object pageGame: TPage - ClientWidth = 720 - ClientHeight = 866 - object Label5: TLabel - AnchorSideRight.Control = pageGame - AnchorSideRight.Side = asrBottom - Left = 0 - Height = 32 - Top = 8 - Width = 360 - Alignment = taCenter - Anchors = [akTop, akLeft, akRight] - AutoSize = False - Caption = 'Playing' - Font.Height = -19 - ParentColor = False - ParentFont = False - end + ClientWidth = 360 + ClientHeight = 500 object labelPos: TLabel Left = 8 Height = 17 @@ -203,16 +188,49 @@ object formChess: TformChess ParentColor = False end object memoDebug: TMemo + AnchorSideRight.Control = pageGame + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = pageGame + AnchorSideBottom.Side = asrBottom Left = 8 - Height = 106 - Top = 440 - Width = 344 + Height = 71 + Top = 424 + Width = 347 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Right = 5 + BorderSpacing.Bottom = 5 TabOrder = 0 end + object btnResign: TBitBtn + Left = 176 + Height = 30 + Top = 8 + Width = 75 + Caption = 'Resign' + TabOrder = 1 + end + object btnQuitGame: TBitBtn + Left = 272 + Height = 30 + Top = 8 + Width = 75 + Caption = 'Quit' + OnClick = btnQuitGameClick + TabOrder = 2 + end + object btnGameNewGame: TBitBtn + Left = 80 + Height = 30 + Top = 8 + Width = 75 + Caption = 'New Game' + OnClick = btnGameNewGameClick + TabOrder = 3 + end end object pageWebservice: TPage - ClientWidth = 720 - ClientHeight = 866 + ClientWidth = 1440 + ClientHeight = 1732 object Label8: TLabel Left = 0 Height = 32 @@ -285,6 +303,7 @@ object formChess: TformChess end end object timerChessTimer: TTimer + Enabled = False OnTimer = timerChessTimerTimer left = 296 top = 152 diff --git a/applications/fpchess/mainform.pas b/applications/fpchess/mainform.pas index 488b31f1f..ca08ead75 100644 --- a/applications/fpchess/mainform.pas +++ b/applications/fpchess/mainform.pas @@ -27,6 +27,9 @@ type { TformChess } TformChess = class(TForm) + btnGameNewGame: TBitBtn; + btnResign: TBitBtn; + btnQuitGame: TBitBtn; btnQuit: TBitBtn; btnStartGame: TBitBtn; btnPlayAgainstAI: TButton; @@ -38,7 +41,6 @@ type Label1: TLabel; labelTime: TLabel; Label2: TLabel; - Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; @@ -54,7 +56,9 @@ type spinPlayerTime: TSpinEdit; timerChessTimer: TTimer; pageWebservice: TPage; + procedure btnGameNewGameClick(Sender: TObject); procedure btnQuitClick(Sender: TObject); + procedure btnQuitGameClick(Sender: TObject); procedure btnStartGameClick(Sender: TObject); procedure comboGameModeSelect(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -181,6 +185,18 @@ begin Close; end; +procedure TformChess.btnGameNewGameClick(Sender: TObject); +begin + notebookMain.PageIndex := INT_PAGE_START; + + timerChessTimer.Enabled := False; +end; + +procedure TformChess.btnQuitGameClick(Sender: TObject); +begin + Close; +end; + procedure TformChess.btnStartGameClick(Sender: TObject); var lModule: TChessModule; @@ -192,6 +208,8 @@ begin gSelectedModuleIndex := comboGameMode.ItemIndex; lModule := GetChessModule(gSelectedModuleIndex); lModule.PrepareForGame(); + + timerChessTimer.Enabled := True; end; procedure TformChess.comboGameModeSelect(Sender: TObject);