From de135f4ea01015f0117d6fcdfd60b109f138f75d Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Sat, 27 Aug 2011 21:16:40 +0000 Subject: [PATCH] fpchess: Some fixes git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1845 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpchess/mainform.lfm | 22 ++++++++++++------ applications/fpchess/mainform.pas | 5 +++- applications/fpchess/mod_fics.pas | 28 +++++++++++------------ applications/fpchess/mod_singleplayer.pas | 2 +- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/applications/fpchess/mainform.lfm b/applications/fpchess/mainform.lfm index 6e8c01d9b..5e7820deb 100644 --- a/applications/fpchess/mainform.lfm +++ b/applications/fpchess/mainform.lfm @@ -1,7 +1,7 @@ object formChess: TformChess - Left = 216 + Left = 318 Height = 433 - Top = 164 + Top = 123 Width = 360 ActiveControl = notebookMain Caption = 'FP Chess 0.1' @@ -123,8 +123,9 @@ object formChess: TformChess Left = 8 Height = 21 Top = 74 - Width = 338 + Width = 346 ItemHeight = 0 + OnChange = comboGameModeSelect OnSelect = comboGameModeSelect TabOrder = 5 Text = 'comboGameMode' @@ -168,8 +169,8 @@ object formChess: TformChess end end object pageGame: TPage - ClientWidth = 360 - ClientHeight = 433 + ClientWidth = 720 + ClientHeight = 866 object Label5: TLabel AnchorSideRight.Control = pageGame AnchorSideRight.Side = asrBottom @@ -201,10 +202,17 @@ object formChess: TformChess Caption = 'labelTime' ParentColor = False end + object memoDebug: TMemo + Left = 8 + Height = 106 + Top = 440 + Width = 344 + TabOrder = 0 + end end object pageWebservice: TPage - ClientWidth = 360 - ClientHeight = 433 + ClientWidth = 720 + ClientHeight = 866 object Label8: TLabel Left = 0 Height = 32 diff --git a/applications/fpchess/mainform.pas b/applications/fpchess/mainform.pas index b12a344be..8562a7312 100644 --- a/applications/fpchess/mainform.pas +++ b/applications/fpchess/mainform.pas @@ -46,6 +46,7 @@ type editWebServiceAI: TLabeledEdit; labelPos: TLabel; editPlayerName: TLabeledEdit; + memoDebug: TMemo; pageStart: TPage; notebookMain: TNotebook; panelModules: TPanel; @@ -121,7 +122,7 @@ begin if ANewIndex = gSelectedModuleIndex then Exit; lModule := GetChessModule(gSelectedModuleIndex); - if lModule <> nil then lModule.FreeUserInterface(); + if lModule <> nil then lModule.HideUserInterface(); GetChessModule(ANewIndex).ShowUserInterface(panelModules); end; @@ -170,7 +171,9 @@ begin begin comboGameMode.ItemIndex := 0; UpdateChessModulesUI(0); + gSelectedModuleIndex := 0; end; + gChessModulesDebugOutputDestiny := memoDebug.Lines; end; procedure TformChess.btnQuitClick(Sender: TObject); diff --git a/applications/fpchess/mod_fics.pas b/applications/fpchess/mod_fics.pas index b4ec9769d..2cb1820e9 100644 --- a/applications/fpchess/mod_fics.pas +++ b/applications/fpchess/mod_fics.pas @@ -20,9 +20,9 @@ uses type - { TSinglePlayerChessModule } + { TFICSChessModule } - TSinglePlayerChessModule = class(TChessModule) + TFICSChessModule = class(TChessModule) public SecondPlayerName: string; constructor Create(); @@ -38,9 +38,9 @@ type implementation -{ TSinglePlayerChessModule } +{ TFICSChessModule } -constructor TSinglePlayerChessModule.Create; +constructor TFICSChessModule.Create; begin inherited Create; @@ -48,7 +48,7 @@ begin Kind := cmkSinglePlayer; end; -procedure TSinglePlayerChessModule.CreateUserInterface; +procedure TFICSChessModule.CreateUserInterface; begin { textSecondPlayerName := TStaticText.Create(nil); textSecondPlayerName.SetBounds(20, 20, 180, 50); @@ -59,48 +59,48 @@ begin editSecondPlayerName.Text := 'Second player';} end; -procedure TSinglePlayerChessModule.ShowUserInterface(AParent: TWinControl); +procedure TFICSChessModule.ShowUserInterface(AParent: TWinControl); begin { textSecondPlayerName.Parent := AParent; editSecondPlayerName.Parent := AParent;} end; -procedure TSinglePlayerChessModule.HideUserInterface(); +procedure TFICSChessModule.HideUserInterface(); begin { textSecondPlayerName.Parent := nil; editSecondPlayerName.Parent := nil;} end; -procedure TSinglePlayerChessModule.FreeUserInterface; +procedure TFICSChessModule.FreeUserInterface; begin { textSecondPlayerName.Free; editSecondPlayerName.Free;} end; -procedure TSinglePlayerChessModule.PrepareForGame; +procedure TFICSChessModule.PrepareForGame; begin // SecondPlayerName := editSecondPlayerName.Text; - ChessModuleDebugLn('[TSinglePlayerChessModule.PrepareForGame]'); + ChessModuleDebugLn('[TFICSChessModule.PrepareForGame]'); end; -function TSinglePlayerChessModule.IsMovingAllowedNow: Boolean; +function TFICSChessModule.IsMovingAllowedNow: Boolean; begin Result := not (vChessGame.IsWhitePlayerTurn xor vChessGame.FirstPlayerIsWhite); end; -function TSinglePlayerChessModule.GetSecondPlayerName: string; +function TFICSChessModule.GetSecondPlayerName: string; begin // Result := SecondPlayerName; end; // If a move came, it is because the local player did a move // so send this move and start listening for a move -procedure TSinglePlayerChessModule.HandleOnMove(AFrom, ATo: TPoint); +procedure TFICSChessModule.HandleOnMove(AFrom, ATo: TPoint); begin end; initialization - RegisterChessModule(TSinglePlayerChessModule.Create); + RegisterChessModule(TFICSChessModule.Create); end. diff --git a/applications/fpchess/mod_singleplayer.pas b/applications/fpchess/mod_singleplayer.pas index 93cd3105c..e873d5f8a 100644 --- a/applications/fpchess/mod_singleplayer.pas +++ b/applications/fpchess/mod_singleplayer.pas @@ -65,7 +65,7 @@ begin editSecondPlayerName.Parent := nil; end; -procedure TSinglePlayerChessModule.FreeUserInterface; +procedure TSinglePlayerChessModule.FreeUserInterface(); begin textSecondPlayerName.Free; editSecondPlayerName.Free;