eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/wxwin Makefile.am auxframes.h auxframes.c...


From: eliot-dev
Subject: [Eliot-dev] eliot/wxwin Makefile.am auxframes.h auxframes.c...
Date: Mon, 26 Dec 2005 18:14:46 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         
Changes by:     Antoine Fraboulet <address@hidden>      05/12/26 18:14:46

Modified files:
        wxwin          : Makefile.am auxframes.h auxframes.cc 
Added files:
        wxwin          : gfxresult.h gfxresult.cc 

Log message:
        - new auxframes update scheme
        - new auxframe : gfxresult
        - need some modification in mainframe.[h|cc] to take care of the update

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/Makefile.am.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/auxframes.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/auxframes.cc.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/gfxresult.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/gfxresult.cc.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: eliot/wxwin/Makefile.am
diff -u eliot/wxwin/Makefile.am:1.7 eliot/wxwin/Makefile.am:1.8
--- eliot/wxwin/Makefile.am:1.7 Fri Nov  4 20:00:06 2005
+++ eliot/wxwin/Makefile.am     Mon Dec 26 18:14:46 2005
@@ -27,6 +27,7 @@
 eliot_SOURCES = \
     configdb.cc configdb.h \
     gfxboard.cc gfxboard.h \
+    gfxresult.cc gfxresult.h \
     printout.cc printout.h \
     confdimdlg.cc confdimdlg.h \
     confsearch.cc confsearch.h \
Index: eliot/wxwin/auxframes.cc
diff -u eliot/wxwin/auxframes.cc:1.16 eliot/wxwin/auxframes.cc:1.17
--- eliot/wxwin/auxframes.cc:1.16       Mon Dec 26 15:02:26 2005
+++ eliot/wxwin/auxframes.cc    Mon Dec 26 18:14:46 2005
@@ -1,13 +1,14 @@
 /* Eliot                                                                     */
 /* Copyright (C) 1999  Antoine Fraboulet                                     */
-/* address@hidden                                                 */
 /*                                                                           */
-/* This program is free software; you can redistribute it and/or modify      */
+/* This file is part of Eliot.                                               */
+/*                                                                           */
+/* Eliot 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 2 of the License, or         */
 /* (at your option) any later version.                                       */
 /*                                                                           */
-/* This program is distributed in the hope that it will be useful,           */
+/* Eliot 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.                              */
@@ -16,8 +17,15 @@
 /* along with this program; if not, write to the Free Software               */
 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
*/
 
+/**
+ *  \file   auxframes.cc
+ *  \brief  Window Frames used in Eliot
+ *  \author Antoine Fraboulet
+ *  \date   2005
+ */
+
 #include <iostream>
-using namespace std;
+#include <sstream>
 
 #include "wx/sizer.h"
 #include "wx/button.h"
@@ -31,6 +39,7 @@
 #include "dic.h"
 #include "dic_search.h"
 #include "training.h"
+#include "player.h"
 #include "game.h"
 
 #include "configdb.h"
@@ -69,6 +78,7 @@
         Show(TRUE);
         Raise();
         show = 1;
+       Reload();
     }
     else
     {
@@ -84,6 +94,8 @@
 #define MINH 50
 
     wxSize size;
+    //debug("  %s::Reload() - %s\n",(const char*)classname.mb_str(),(const 
char*)name.mb_str());
+
     Move(config.getFramePos(classname));
     size = config.getFrameSize(classname);
 
@@ -109,7 +121,6 @@
     AuxFrame(parent, ID_Frame_Board, wxT("Grille"), FRAMEBOARD)
 {
     board = new GfxBoard(this, iGame);
-
     wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
     sizer->Add(board, 1, wxEXPAND, 0);
     SetAutoLayout(TRUE);
@@ -121,6 +132,7 @@
 void
 BoardFrame::Refresh(refresh_t force)
 {
+    //debug("    BoardFrame::Refresh\n");
     if (force == REFRESH)
         board->Refresh(GfxBoard::BOARD_REFRESH);
     else
@@ -137,9 +149,9 @@
 {
     tiles = new wxListCtrl(this, -1);
     tiles->SetSingleStyle(wxLC_LIST);
-    tiles->SetColumnWidth(0, wxLIST_AUTOSIZE);
-    tiles->SetFont(config.getFont(LISTFONT));
-    tiles->SetToolTip(wxT("Lettre, nombre restant"));
+    //tiles->SetColumnWidth(0, wxLIST_AUTOSIZE);
+    //tiles->SetFont(config.getFont(LISTFONT));
+    //tiles->SetToolTip(wxT("Lettre, nombre restant"));
 
     wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
     sizer->Add(tiles, 1, wxEXPAND | wxALL, 1);
@@ -150,18 +162,28 @@
 
 void
 BagFrame::Refresh(refresh_t force)
-{
-    int index;
+{ 
+    //debug("    BagFrame::Refresh\n");
+    int n,index;
     wxString buf;
+#ifdef DEBUG
+    wxChar format[] = wxT("%c:%2d[%2d]");
+#else
     wxChar format[] = wxT("%c:%2d");
+#endif
 
     tiles->ClearAll();
 
-    const list<Tile>& allTiles = Tile::getAllTiles();
-    list<Tile>::const_iterator it;
+    std::list<Tile>::const_iterator it;
+    const std::list<Tile>& allTiles = Tile::getAllTiles();
     for (index = 0, it = allTiles.begin(); it != allTiles.end(); index++, it++)
     {
-        buf.Printf(format, it->toChar(), m_game.getBag().in(*it));
+       n = m_game.getBag().in(*it);
+#ifdef DEBUG
+        buf.Printf(format, it->toChar(), n, n - it->maxNumber());
+#else
+        buf.Printf(format, it->toChar(), n);
+#endif
         tiles->InsertItem(index,buf);
     }
 }
@@ -184,6 +206,7 @@
 void
 SearchFrame::Refresh(refresh_t force)
 {
+    //debug("    SearchFrame::Refresh\n");
 }
 
 /****************************************************************/
@@ -244,16 +267,9 @@
 void
 VerifFrame::Refresh(refresh_t force)
 {
+    //debug("    VerifFrame::Refresh\n");
 }
 
-/** *******************************************************************
- **
- **
- **
- **
- **
- ** ********************************************************************/
-
 /****************************************************************/
 /* AUXFRAMELIST */
 /****************************************************************/
@@ -267,10 +283,13 @@
   EVT_BUTTON        (ButtonCopyID , AuxFrameList::OnCopy)
 END_EVENT_TABLE()
 
-AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString 
_classname):
+AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString 
_classname, Game *g):
   AuxFrame(parent, _id, _name, _classname)
 
 {
+    game = g;
+    savedword = "";
+
     wxBoxSizer *sizer_v = new wxBoxSizer(wxVERTICAL);
     listbox = new wxListBox(this, ListBoxID);
     listbox->SetFont(config.getFont(LISTFONT));
@@ -314,125 +333,278 @@
     listbox->Show(TRUE);
 }
 
+void
+AuxFrameList::Refresh(refresh_t force)
+{
+    //debug("    %s : Refresh start\n",(const char*)name.mb_str());
+    if (game == NULL)
+       {
+           listbox->Clear();
+           listbox->Append(wxT("Pas de partie en cours"));
+           //debug("  %s : Refresh end - no game\n",(const 
char*)name.mb_str());
+           return;
+       }
+    if (game->getDic() == NULL)
+       {
+           listbox->Clear();
+           listbox->Append(wxT("Pas de dictionnaire"));
+           //debug("  %s : Refresh end - no dictionnary\n",(const 
char*)name.mb_str());
+           return;
+       }
+    if (show == 0)
+       {
+           //debug("  %s : Refresh end - no window\n",(const 
char*)name.mb_str());
+           return;
+       }
+    noresult = true;
+    refresh();
+    if (noresult == true)
+       {
+           //debug("      %s : noresult == true\n",(const char*)name.mb_str());
+           listbox->Clear();
+           listbox->Append(wxT("Aucun resultat"));
+       }
+    //debug("  %s : Refresh end\n",(const char*)name.mb_str());
+}
+
 /****************************************************************/
 /* PLUS1 FRAME */
 /****************************************************************/
 
-Plus1Frame::Plus1Frame(wxFrame* parent, Game& iGame):
-    AuxFrameList(parent, ID_Frame_Plus1, wxT("Tirage + 1"), FRAMEPLUS1),
-    m_game(iGame)
-{
-    m_rack[0] = '\0';
-}
-
 void
-Plus1Frame::Refresh(refresh_t force)
+Plus1Frame::refresh()
 {
-    int  i, j;
-    string rack2;
-    char buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX];
-
-    rack2 = m_game.getPlayerRack(0);
-
-    if (m_rack == rack2)
-        return;
+    std::string rack;
+    //debug("      Plus1Frame::refresh start\n");
+    rack = game->getCurrentPlayer().getCurrentRack().toString();
+    assert(0);
+    //debug("         CurrentPlayer -> rack : %s\n",rack.c_str());
+
+    if (savedword == rack)
+       {
+           noresult = false; // keep old results
+           //debug("      Plus1Frame::refresh end, no change\n");
+           return;
+       }
+    savedword = rack;
 
-    m_rack = rack2;
-
-    Waiting();
-    Dic_search_7pl1(m_game.getDic(), m_rack.c_str(), buff, 
config.getJokerPlus1());
+    char buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX];
+    Dic_search_7pl1(game->getDic(), rack.c_str(), buff, 
config.getJokerPlus1());
 
-    int resnum = 0;
+    listbox->Clear();
     wxString res[DIC_LETTERS*(RES_7PL1_MAX+1)];
-    // wxString(wxT) added for clean compile with wx2.4
-    res[resnum++] = wxString(wxT("Tirage: ")) + wxString(wxU(m_rack.c_str()));
-    for (i = 0; i < DIC_LETTERS; i++)
+    int resnum = 0;
+    res[resnum++] = wxString(wxT("Tirage: ")) + wxString(wxU(rack.c_str()));
+    for (int i = 0; i < DIC_LETTERS; i++)
     {
         if (i && buff[i][0][0])
-            res[resnum++] = wxString(wxT("+")) + (wxChar)(i + 'A' - 1);
-        for (j = 0; j < RES_7PL1_MAX && buff[i][j][0]; j++)
-            res[resnum++] = wxString(wxT("  ")) + wxU(buff[i][j]);
+           {
+               res[resnum++] = wxString(wxT("+")) + (wxChar)(i + 'A' - 1);
+               noresult = false;
+           }
+       for (int j = 0; j < RES_7PL1_MAX && buff[i][j][0]; j++)
+           {
+               res[resnum++] = wxString(wxT("  ")) + wxU(buff[i][j]);
+               noresult = false;
+           }
     }
     listbox->Set(resnum, res);
+    //debug("      Plus1Frame::refresh end\n");
 }
 
 /****************************************************************/
 /*  BENJAMINS */
 /****************************************************************/
 
-BenjFrame::BenjFrame(wxFrame* parent, Game& iGame, wxListCtrl* _results):
-    AuxFrameList(parent, ID_Frame_Benj, wxT("benjamins"), FRAMEBENJ),
-    m_game(iGame)
+void
+BenjFrame::refresh()
 {
-    results = _results;
+    std::string word;
+
+    if (game->getMode() != Game::kTRAINING)
+       return;
+
+    word = ((Training*)game)->getTestPlayWord();
+    if (savedword == word)
+       {
+           noresult = false; // keep old results
+           return;
+       }
+    savedword = word;
+    //debug("   BenjFrame::refresh : %s\n",word.c_str());
+    char wordlist[RES_BENJ_MAX][DIC_WORD_MAX];
+    Dic_search_Benj(game->getDic(), word.c_str(), wordlist);
+
+    wxString res[RES_BENJ_MAX];
+    int resnum = 0;
+    for (int i = 0; (i < RES_BENJ_MAX) && (wordlist[i][0]); i++)
+       {
+           res[resnum++] = wxU(wordlist[i]);
+           //debug("      BenjFrame : %s (%d)\n",wordlist[i],resnum);
+           noresult = false;
+       }
+    listbox->Set(resnum, res);
 }
 
+
+/****************************************************************/
+/* RACC FRAME */
+/****************************************************************/
+
 void
-BenjFrame::Refresh(refresh_t force)
+RaccFrame::refresh()
 {
-    int i;
-    char wordlist[RES_BENJ_MAX][DIC_WORD_MAX];
-    long item = -1;
-    item = results->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-    // item can be -1
+    std::string word;
 
-    if (item < 0)
-    {
-        listbox->Clear();
-        return;
-    }
+    if (game->getMode() != Game::kTRAINING)
+       return;
 
-    Waiting();
-    Dic_search_Benj(m_game.getDic(),
-                   ((Training&)m_game).getSearchedWord(item).c_str(), 
wordlist);
+    word = ((Training*)game)->getTestPlayWord();
+    if (savedword == word)
+       {
+           noresult = false; // keep old results
+           return;
+       }
+    savedword = word;
+    //debug("   RaccFrame::refresh : %s\n",word.c_str());
+    char wordlist[RES_RACC_MAX][DIC_WORD_MAX];
+    Dic_search_Racc(game->getDic(), word.c_str(), wordlist);
 
+    wxString res[RES_RACC_MAX];
     int resnum = 0;
-    wxString res[RES_BENJ_MAX];
-    for (i = 0; (i < RES_BENJ_MAX) && (wordlist[i][0]); i++)
-        res[resnum++] = wxU(wordlist[i]);
+    for (int i = 0; (i < RES_RACC_MAX) && (wordlist[i][0]); i++)
+       {
+           res[resnum++] = wxU(wordlist[i]);
+           //debug("      RaccFrame : %s (%d)\n",wordlist[i],resnum);
+           noresult = false;
+       }
     listbox->Set(resnum, res);
 }
 
+/****************************************************************/
+/* AUXFRAMETEXT */
+/****************************************************************/
+
+AuxFrameText::AuxFrameText(wxFrame* parent, int _id, wxString _name, wxString 
_classname, int _style):
+  AuxFrame(parent, _id, _name, _classname)
+
+{
+    wxBoxSizer *sizer_v = new wxBoxSizer(wxVERTICAL);
+    wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+
+    wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+               wxFONTWEIGHT_NORMAL, false, wxString(wxT("Courier New")), 
wxFONTENCODING_SYSTEM);
+
+    textbox = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, 
wxDefaultSize, _style);
+    textbox->SetFont(font);
+
+    sizer_v->Add(textbox, 1, wxEXPAND | wxALL, 1);
+    sizer->Add(sizer_v, 1, wxEXPAND, 0);
+
+    SetAutoLayout(TRUE);
+    SetSizer(sizer);
+    sizer->Fit(this);
+    sizer->SetSizeHints(this);
+}
 
 /****************************************************************/
-/* RACC FRAME */
+/* GAME FRAME */
 /****************************************************************/
 
-RaccFrame::RaccFrame(wxFrame* parent, Game& iGame, wxListCtrl* _results):
-    AuxFrameList(parent, ID_Frame_Racc, wxT("raccords"), FRAMERACC),
+GameFrame::GameFrame(wxFrame* parent, Game& iGame):
+    AuxFrameText(parent, ID_Frame_Game, wxT("partie"), FRAMEGAME, 
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP),
     m_game(iGame)
 {
-    results = _results;
+    textbox->Clear();
+    textbox->AppendText(wxT(""));
 }
 
 void
-RaccFrame::Refresh(refresh_t force)
+GameFrame::Refresh(refresh_t force)
 {
-    int i;
-    char wordlist[RES_RACC_MAX][DIC_WORD_MAX];
-    long item = -1;
-    item = results->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-    // item can be -1
+    std::ostringstream mos;
+    m_game.save(mos);
+#ifdef DEBUG
+    mos << std::string(30,'-') << std::endl;
+    mos << "Player History\n";
+    //FIXME1    mos << m_game.getPlayer(0).getHistory().toString();
+    mos << std::string(30,'-') << std::endl;
+    mos << "Game History\n";
+    //FIXME1    mos << m_game.getHistory().toString();
+#endif
+    textbox->Clear();
+    textbox->AppendText( wxU( mos.str().c_str() ) );
+}
 
-    if (item < 0)
-    {
-        listbox->Clear();
-        return;
-    }
+/****************************************************************/
+/* RESULT FRAME */
+/****************************************************************/
 
-    Waiting();
-    Dic_search_Racc(m_game.getDic(),
-                   ((Training&)m_game).getSearchedWord(item).c_str(), 
wordlist);
+BEGIN_EVENT_TABLE(ResultFrame, AuxFrame)
+END_EVENT_TABLE()
 
-    int resnum = 0;
-    wxString res[RES_RACC_MAX];
-    for (i = 0; (i < RES_RACC_MAX) && (wordlist[i][0]); i++)
-    {
-        res[resnum++] = wxU(wordlist[i]);
-    }
-    listbox->Set(resnum, res);
+ResultFrame::ResultFrame(wxFrame* parent, Game* iGame):
+    AuxFrame(parent, ID_Frame_Result, wxT("recherche"), FRAMERESULT)
+{
+    reslist = new GfxResult(this, (MainFrame*)parent, iGame);
+
+    wxBoxSizer *sizer_v = new wxBoxSizer(wxVERTICAL);
+    wxBoxSizer *sizer   = new wxBoxSizer(wxHORIZONTAL);
+
+    sizer_v->Add(reslist, 1, wxEXPAND, 0);
+    sizer->Add  (sizer_v, 1, wxEXPAND | wxALL, 2);
+
+    SetAutoLayout(TRUE);
+    SetSizer(sizer);
+    sizer->Fit(this);
+    sizer->SetSizeHints(this);
+    //debug("ResultFrame created\n");
 }
 
+void
+ResultFrame::Refresh(refresh_t WXUNUSED(force))
+{
+    if (reslist != NULL)
+       {
+           reslist->Show(false);
+           //debug("ResultFrame refresh\n");
+           reslist->Refresh();
+           reslist->Show(true);
+       }
+}
+
+void
+ResultFrame::Search()
+{
+    if (reslist != NULL)
+       {
+           reslist->Search();
+       }
+}
+
+int
+ResultFrame::GetSelected()
+{
+    if (reslist != NULL)
+       {
+           return reslist->GetSelected();
+       }
+    return -1;
+}
+
+void
+ResultFrame::OnSize(wxSizeEvent& e)
+{
+    int w,h;
+    GetClientSize(&w,&h);
+    //debug("ResultFrame::OnSize (%d,%d)\n",w,h);
+}
 
 /****************************************************************/
 /****************************************************************/
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:
Index: eliot/wxwin/auxframes.h
diff -u eliot/wxwin/auxframes.h:1.4 eliot/wxwin/auxframes.h:1.5
--- eliot/wxwin/auxframes.h:1.4 Fri Nov  4 20:00:06 2005
+++ eliot/wxwin/auxframes.h     Mon Dec 26 18:14:46 2005
@@ -1,13 +1,14 @@
 /* Eliot                                                                     */
 /* Copyright (C) 1999  Antoine Fraboulet                                     */
-/* address@hidden                                                 */
 /*                                                                           */
-/* This program is free software; you can redistribute it and/or modify      */
+/* This file is part of Eliot.                                               */
+/*                                                                           */
+/* Eliot 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 2 of the License, or         */
 /* (at your option) any later version.                                       */
 /*                                                                           */
-/* This program is distributed in the hope that it will be useful,           */
+/* Eliot 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.                              */
@@ -16,12 +17,16 @@
 /* along with this program; if not, write to the Free Software               */
 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
*/
 
-// -*- C++ -*-
+/**
+ *  \file   auxframes.h
+ *  \brief  Window Frames used in Eliot
+ *  \author Antoine Fraboulet
+ *  \date   2005
+ */
+
 #ifndef _AUXFRAMES_H
 #define _AUXFRAMES_H
 
-#include "searchpanel.h"
-#include "gfxboard.h"
 #include "wx/frame.h"
 #include "wx/listctrl.h"
 #include "wx/textctrl.h"
@@ -29,13 +34,12 @@
 #include "wx/listbox.h"
 #include "wx/button.h"
 
-#define MIN_FRAME_ID 0
-#define MAX_FRAME_ID 7
+#include "searchpanel.h"
+#include "gfxboard.h"
+#include "gfxresult.h"
 
-typedef enum {
-    REFRESH,
-    FORCE_REFRESH
-} refresh_t;
+#define MIN_FRAME_ID 0
+#define MAX_FRAME_ID 9
 
 typedef enum {
     ID_Frame_Verif   = MIN_FRAME_ID + 0,
@@ -44,46 +48,98 @@
     ID_Frame_Racc    = MIN_FRAME_ID + 3,
     ID_Frame_Benj    = MIN_FRAME_ID + 4,
     ID_Frame_Bag     = MIN_FRAME_ID + 5,
-    ID_Frame_Board   = MIN_FRAME_ID + 6
+    ID_Frame_Board   = MIN_FRAME_ID + 6,
+    ID_Frame_Game    = MIN_FRAME_ID + 7,
+    ID_Frame_Result  = MIN_FRAME_ID + 8
 } frames_id_t;
 
-/** ******************************
+/**
+ * Generic AuxFrame :
+ *       - BoardFrame
+ *       - BagFrame
+ *       - SearchFrame
+ *       - VerifFrame
+ *       - ResultFrame
+ * derived to AuxFrameList :
+ *       - Plus1Frame
+ *       - BenjFrame
+ *       - RaccFrame
+ * derived to AuxFrameText :
+ *       - GameFrame
  *
- ****************************** */
+ */
 
 class AuxFrame: public wxFrame
 {
 protected:
-    int show;
+    int         show;
     frames_id_t frameid;
-    wxString name, classname;
-    ConfigDB   config;
+    wxString    name, classname;
+    ConfigDB    config;
 
 public:
-    AuxFrame(wxFrame*, int, wxString, wxString);
+    AuxFrame (wxFrame*, int, wxString, wxString);
     ~AuxFrame();
 
+    typedef enum {
+       REFRESH,
+       FORCE_REFRESH
+    } refresh_t;
+
     void SwitchDisplay();
     void Reload();
     virtual void Refresh(refresh_t force = REFRESH) {};
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Generic auxframe that includes a list and a """copy""" button
+ */
+
+class AuxFrameList: public AuxFrame
+{
+protected:
+    bool      noresult;
+    string    savedword;
+    Game      *game;
+    wxButton  *button;
+    wxListBox *listbox;
+    void Waiting();
+    virtual void refresh() = 0;
+public:
+    AuxFrameList(wxFrame*, int, wxString, wxString, Game*);
+    void OnCopy(wxCommandEvent& event);
+    void Refresh(refresh_t force = REFRESH);
+    DECLARE_EVENT_TABLE()
+};
+
+/**
+ * Generic auxframe that includes a text area
+ */
+
+class AuxFrameText: public AuxFrame
+{
+ protected:
+    wxTextCtrl *textbox;
+ public:
+    AuxFrameText(wxFrame*, int, wxString, wxString, int);
+};
+
+/**
+ * Frame to display the game board
+ */
 
 class BoardFrame: public AuxFrame
 {
 protected:
-    GfxBoard* board;
+    GfxBoard *board;
 public:
     BoardFrame(wxFrame*, Game&);
     void Refresh(refresh_t force = REFRESH);
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Frame to display the tiles left in the bag
+ */
 
 class BagFrame: public AuxFrame
 {
@@ -95,9 +151,9 @@
     void Refresh(refresh_t force = REFRESH);
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Several research tool in a panel widget within the frame
+ */
 
 class SearchFrame: public AuxFrame
 {
@@ -108,13 +164,13 @@
     void Refresh(refresh_t force = REFRESH);
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Frame to verify if a word is in the dictionary
+ */
 
 class VerifFrame: public AuxFrame
 {
-private:
+protected:
     Dictionary dic;
     wxTextCtrl *word;
     wxStaticText *result;
@@ -126,63 +182,76 @@
     DECLARE_EVENT_TABLE()
 };
 
+/**
+ * Displays the list of 7+1 for the current search
+ */
 
-/** **********************************************************
-**************************************************************
-*********************************************************** */
-
-class AuxFrameList: public AuxFrame
+class Plus1Frame: public AuxFrameList
 {
 protected:
-    wxListBox *listbox;
-    wxButton *button;
+    virtual void refresh();
 public:
-    AuxFrameList(wxFrame*, int, wxString, wxString);
-    void OnCopy(wxCommandEvent& event);
-    void Waiting();
-    DECLARE_EVENT_TABLE()
+    Plus1Frame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Plus1, 
wxT("Tirage + 1"), FRAMEPLUS1, g) {};
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Displays the list of benjamins for the current selected word
+ */
 
-class Plus1Frame: public AuxFrameList
+class BenjFrame: public AuxFrameList
 {
 protected:
-    Game& m_game;
-    string m_rack;
+    virtual void refresh();
 public:
-    Plus1Frame(wxFrame*, Game&);
-    void Refresh(refresh_t force = REFRESH);
+    BenjFrame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Benj, 
wxT("benjamins"), FRAMEBENJ, g) {};
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Displays the list of possible glue letter for the current selected word
+ */
 
-class BenjFrame: public AuxFrameList
+class RaccFrame: public AuxFrameList
 {
 protected:
-    Game& m_game;
-    wxListCtrl* results;
+    virtual void refresh();
 public:
-    BenjFrame(wxFrame*, Game&, wxListCtrl*);
-    void Refresh(refresh_t force = REFRESH);
+    RaccFrame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Racc, 
wxT("raccords"), FRAMERACC, g) {};
 };
 
-/** ******************************
- *
- ****************************** */
+/**
+ * Displays the current game
+ */
 
-class RaccFrame: public AuxFrameList
+class GameFrame: public AuxFrameText
 {
 protected:
     Game& m_game;
-    wxListCtrl* results;
 public:
-    RaccFrame(wxFrame*, Game&, wxListCtrl*);
+    GameFrame(wxFrame*, Game&);
     void Refresh(refresh_t force = REFRESH);
 };
 
+/**
+ * Displays the list of possible words searched for the given rack and board
+ */
+
+class ResultFrame: public AuxFrame
+{
+ protected:
+    GfxResult *reslist;
+ public:
+    ResultFrame(wxFrame*, Game*);
+    void Search();
+    int  GetSelected();
+    void Refresh(refresh_t force = REFRESH);
+    void OnSize(wxSizeEvent& e);
+    DECLARE_EVENT_TABLE()
+};
+
 #endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]