Tarrasch Chess GUI / src / PgnDialog.h

 * Custom dialog - Pgn browser
 *  Author:  Bill Forster
 *  Licence: See licencing information in ChessPosition.cpp
 *  Copyright 2010, Triple Happy Ltd.  All rights reserved.
#ifndef PGN_DIALOG_H
#define PGN_DIALOG_H
#include "wx/spinctrl.h"
#include "wx/statline.h"
#include "wx/accel.h"
#include "SuspendEngine.h"
#include "GamesCache.h"
#include "GameDocument.h"
#include "Repository.h"

// Control identifiers
    ID_PGN_DIALOG_FILE      = 10000,
    ID_PGN_DIALOG_SESSION   = 10002,
    ID_BOARD2GAME           = 10003,
    ID_REORDER              = 10005,
    ID_ADD_TO_CLIPBOARD     = 10006,
    ID_SAVE_ALL_TO_A_FILE   = 10007

// PgnDialog class declaration
class PgnDialog: public wxDialog
    DECLARE_CLASS( PgnDialog )

    GamesCache *gc;
    GamesCache *gc_clipboard;


    // Constructors
        wxWindow    *parent,
        GamesCache  *gc,
        GamesCache  *gc_clipboard,
        wxWindowID  id,
        const wxPoint& pos = wxDefaultPosition,
        const wxSize& size = wxDefaultSize,

    // Member initialisation
    void Init();

    // Creation
    bool Create
        wxWindow        *parent,
        wxWindowID      id,
        const wxString& caption = wxT("Pgn browser"),
        const wxPoint&  pos = wxDefaultPosition,
        const wxSize&   size = wxDefaultSize,

    // Creates the controls and sizers
    void CreateControls();

    // Sets the validators for the dialog controls
    void SetDialogValidators();

    // Sets the help text for the dialog controls
    void SetDialogHelp();

    // PgnDialog event handler declarations

    // wxEVT_UPDATE_UI event handler for ID_???
    //void On???Update( wxUpdateUIEvent& event );

    void OnListSelected( wxListEvent &event );
    void OnListColClick( wxListEvent &event );

    // wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
    void OnOkClick( wxCommandEvent& event );

    void OnBoard2Game( wxCommandEvent& event );
    void OnRenumber( wxCommandEvent& event );
    void OnSelectAll( wxCommandEvent& event );
    void OnEditGameDetails( wxCommandEvent& event );
    void OnCopy( wxCommandEvent& event );
    void OnAddToClipboard( wxCommandEvent& event );
    void OnSaveAllToAFile( wxCommandEvent& event );
    void OnCut( wxCommandEvent& event );
    void OnDelete( wxCommandEvent& event );
    void OnPaste( wxCommandEvent& event );
    void OnSave( wxCommandEvent& event );
    void OnCancel( wxCommandEvent& event );
    void OnHelpClick( wxCommandEvent& event );
//  void OnClose( wxCloseEvent& event );
//  void SaveColumns();
    bool ShowModalOk();

    // Return true if a game has been selected
    bool LoadGame( GameLogic *gl, GameDocument& gd, int &file_game_idx );

    // Helpers
    GameDocument *GetFocusGame( int &idx );
    void DeselectOthers( GameDocument *selected_game );
    void OnOk();

    // PgnDialog member variables
    wxListCtrl  *list_ctrl;
    GameDocument *selected_game;
    void         SyncCacheOrderBefore();
    void         SyncCacheOrderAfter();
    void         CopyOrAdd( bool clear_clipboard );

    // Data members
    wxWindowID  id;
    int file_game_idx;
    SuspendEngine   suspendor;  // the mere presence of this var suspends the engine during the dialog

#endif    // PGN_DIALOG_H
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.