/*
    CaPriCe Forever - Amstrad CPC 464/664/6128 emulator
    Copyright (C) 2014-2017 by Frédéric Coste

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef TFormCheatScriptsH
#define TFormCheatScriptsH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ComCtrls.hpp>
#include <Vcl.Dialogs.hpp>
#include "..\Emulator\TEmulator.h"
#include "..\Settings\TSettings.h"
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TFormCheatScripts : public TForm
{
__published:	// Composants gérés par l'EDI
  TPageControl *PageControl;
  TTabSheet *TabSheetScripts;
  TTabSheet *TabSheetCode;
  TSaveDialog *SaveDialog;
  TListBox *ListBoxScripts;
  TGroupBox *GroupBoxSelectedScript;
  TTabSheet *TabSheetInstructions;
  TMemo *MemoCode;
  TMemo *MemoInstructions;
  TLabel *LabelSelectedScript;
  TPanel *PanelButtonExecute;
  TPanel *PanelButtonNew;
  TPanel *PanelButtonSave;
  TPanel *PanelButtonDelete;
  void __fastcall FormShow(TObject *Sender);
  void __fastcall FormDestroy(TObject *Sender);
  void __fastcall ListBoxScriptsClick(TObject *Sender);
  void __fastcall ListBoxScriptsDblClick(TObject *Sender);
  void __fastcall PageControlDrawTab(TCustomTabControl *Control, int TabIndex, const TRect &Rect,
          bool Active);
  void __fastcall PanelButtonMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
  void __fastcall PanelButtonMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
  void __fastcall PanelButtonExecuteClick(TObject *Sender);
  void __fastcall PanelButtonNewClick(TObject *Sender);
  void __fastcall PanelButtonSaveClick(TObject *Sender);
  void __fastcall PanelButtonDeleteClick(TObject *Sender);
  void __fastcall FormHide(TObject *Sender);
  void __fastcall FormResize(TObject *Sender);

private:	// Déclarations utilisateur
  //
  // Members
  //
  TSettings* mSettingsP;
  TList* mListActions;
  bool mExecuteInProgress;
  int mCurrentActionIndex;
  AnsiString mSelectedScriptFilename;

  //
  // Methods
  //
  void __fastcall WMMove(TMessage &Message);
  void __fastcall SetSettings(TSettings* Value);
  void __fastcall UpdateScriptsList(void);
  void __fastcall LoadScript(AnsiString Filename);
  bool __fastcall OnCPCEvent(tULong Condition, tNativeCPC* NativeCPCP);
  void __fastcall ExecuteScript(void);
  void __fastcall StopScript(void);

public:		// Déclarations utilisateur
  //
  // Properties
  //
  __property TSettings* Settings = { write=SetSettings };

  //
  // API
  //
  __fastcall TFormCheatScripts(TComponent* Owner);
  void __fastcall ExecuteScript(AnsiString Filename);
  void __fastcall StopCurrentScript(void);

#pragma option push -vi-
BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_MOVE, TMessage, WMMove);
END_MESSAGE_MAP(TForm)
#pragma option pop
};
//---------------------------------------------------------------------------
extern PACKAGE TFormCheatScripts *FormCheatScripts;
//---------------------------------------------------------------------------
#endif
