[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/wxwin auxframes.cc auxframes.h gfxresult.... [multibyt
From: |
eliot-dev |
Subject: |
[Eliot-dev] eliot/wxwin auxframes.cc auxframes.h gfxresult.... [multibyte] |
Date: |
Wed, 28 Dec 2005 20:10:57 +0000 |
CVSROOT: /sources/eliot
Module name: eliot
Branch: multibyte
Changes by: Olivier Teulière <address@hidden> 05/12/28 20:10:57
Modified files:
wxwin : auxframes.cc auxframes.h gfxresult.cc
gfxresult.h mainframe.cc searchpanel.cc
Log message:
Compilation fixes for the wxWidgets interface.
The interface is still untested though.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/auxframes.cc.diff?only_with_tag=multibyte&tr1=1.19&tr2=1.19.2.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/auxframes.h.diff?only_with_tag=multibyte&tr1=1.5&tr2=1.5.2.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/gfxresult.cc.diff?only_with_tag=multibyte&tr1=1.3&tr2=1.3.2.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/gfxresult.h.diff?only_with_tag=multibyte&tr1=1.2&tr2=1.2.2.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/mainframe.cc.diff?only_with_tag=multibyte&tr1=1.17&tr2=1.17.2.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/wxwin/searchpanel.cc.diff?only_with_tag=multibyte&tr1=1.14&tr2=1.14.2.1&r1=text&r2=text
Patches:
Index: eliot/wxwin/auxframes.cc
diff -u /dev/null eliot/wxwin/auxframes.cc:1.19.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/auxframes.cc Wed Dec 28 20:10:56 2005
@@ -0,0 +1,610 @@
+/* Eliot */
+/* Copyright (C) 1999 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* 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>
+#include <sstream>
+
+#include "wx/sizer.h"
+#include "wx/button.h"
+#include "wx/intl.h"
+
+#include "wx/clipbrd.h"
+#include "wx/dataobj.h"
+
+#include "ewx.h"
+
+#include "dic.h"
+#include "dic_search.h"
+#include "training.h"
+#include "player.h"
+#include "game.h"
+
+#include "configdb.h"
+#include "auxframes.h"
+#include "mainframe.h"
+#include "searchpanel.h"
+
+/****************************************************************/
+/* AUXFRAME */
+/****************************************************************/
+
+AuxFrame::AuxFrame(wxFrame* parent, int _id, wxString _name, wxString
_classname):
+ wxFrame(parent, -1, wxU("Eliot: ") + _name, wxPoint(-1, -1), wxSize(-1,
-1),
+ wxRESIZE_BORDER | wxCAPTION | wxFRAME_FLOAT_ON_PARENT, _classname)
+{
+ frameid = (frames_id_t)_id;
+ name = _name;
+ classname = _classname;
+ show = config.getFrameShow(classname);
+}
+
+AuxFrame::~AuxFrame()
+{
+ wxPoint p = GetPosition();
+ wxSize s = GetClientSize();
+ config.setFramePos(classname, p);
+ config.setFrameSize(classname, s);
+ config.setFrameShow(classname, show);
+}
+
+void
+AuxFrame::SwitchDisplay()
+{
+ if (show == 0)
+ {
+ Show(TRUE);
+ Raise();
+ show = 1;
+ Reload();
+ }
+ else
+ {
+ Show(FALSE);
+ show = 0;
+ }
+}
+
+void
+AuxFrame::Reload()
+{
+#define MINW 50
+#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);
+
+ if (size.GetWidth() < MINW)
+ size.SetWidth(MINW);
+ if (size.GetHeight() < MINH)
+ size.SetHeight(MINH);
+
+ SetClientSize(size);
+ Refresh();
+ if (show)
+ {
+ Show(FALSE);
+ Show(TRUE);
+ }
+}
+
+/****************************************************************/
+/* BOARD FRAME */
+/****************************************************************/
+
+BoardFrame::BoardFrame(wxFrame* parent, Game& iGame):
+ 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);
+ SetSizer(sizer);
+ sizer->Fit(this);
+ sizer->SetSizeHints(this);
+}
+
+void
+BoardFrame::Refresh(refresh_t force)
+{
+ //debug(" BoardFrame::Refresh\n");
+ if (force == REFRESH)
+ board->Refresh(GfxBoard::BOARD_REFRESH);
+ else
+ board->Refresh(GfxBoard::BOARD_FORCE_REFRESH);
+}
+
+/****************************************************************/
+/* BAG FRAME */
+/****************************************************************/
+
+BagFrame::BagFrame(wxFrame* parent, Game& iGame):
+ AuxFrame(parent, ID_Frame_Bag, wxT("sac"), FRAMEBAG),
+ m_game(iGame)
+{
+ 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"));
+
+#ifdef DEBUG
+ wxFont font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+ wxFONTWEIGHT_NORMAL, false, wxString(wxT("Courier New")),
wxFONTENCODING_SYSTEM);
+ tiles->SetFont(font);
+#endif
+
+ wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+ sizer->Add(tiles, 1, wxEXPAND | wxALL, 1);
+ SetAutoLayout(TRUE);
+ SetSizer(sizer);
+ sizer->Fit(this);
+}
+
+void
+BagFrame::Refresh(refresh_t force)
+{
+ //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();
+
+ std::list<Tile>::const_iterator it;
+ const std::list<Tile>& allTiles = Tile::getAllTiles();
+ for (index = 0, it = allTiles.begin(); it != allTiles.end(); index++, 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);
+ }
+}
+
+/****************************************************************/
+/* RECHERCHE */
+/****************************************************************/
+
+SearchFrame::SearchFrame(wxFrame *parent, Dictionary _dic):
+ AuxFrame(parent, ID_Frame_Search, wxT("recherche"), FRAMESEARCH)
+{
+ panel = new SearchPanel(this, _dic);
+ wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+ sizer->Add(panel, 1, wxEXPAND, 0);
+ SetAutoLayout(TRUE);
+ SetSizer(sizer);
+ sizer->Fit(this);
+}
+
+void
+SearchFrame::Refresh(refresh_t force)
+{
+ //debug(" SearchFrame::Refresh\n");
+}
+
+/****************************************************************/
+/* VERIF FRAME */
+/****************************************************************/
+
+enum
+{
+ Word_Id,
+ Result_Id,
+};
+
+BEGIN_EVENT_TABLE(VerifFrame, AuxFrame)
+ EVT_TEXT(Word_Id, VerifFrame::OnText)
+END_EVENT_TABLE()
+
+VerifFrame::VerifFrame(wxFrame* parent, Dictionary _dic):
+// XXX: AuxFrame(parent, ID_Frame_Verif, wxT("vérification"), FRAMEVERIF)
+ AuxFrame(parent, ID_Frame_Verif, wxT("verification"), FRAMEVERIF)
+{
+ dic = _dic;
+ word = new wxTextCtrl(this, Word_Id, wxT(""));
+ word->SetFont(config.getFont(LISTFONT));
+// XXX: word->SetToolTip(wxT("Mot à vérifier"));
+ word->SetToolTip(wxT("Mot a verifier"));
+ result = new wxStaticText(this, Result_Id, wxT(""));
+ result->SetFont(config.getFont(LISTFONT));
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ sizer->Add(word, 1, wxEXPAND | wxALL, 1);
+ sizer->Add(result, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 1);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizer);
+ sizer->Fit(this);
+ sizer->SetSizeHints(this);
+}
+
+void
+VerifFrame::verif()
+{
+ if (dic == NULL)
+ {
+ result->SetLabel(wxT("pas de dictionnaire"));
+ return;
+ }
+ if (Dic_search_word(dic, word->GetValue().c_str()))
+ result->SetLabel(wxT("existe"));
+ else
+ result->SetLabel(wxT("n'existe pas"));
+}
+
+void
+VerifFrame::OnText(wxCommandEvent&)
+{
+ verif();
+}
+
+void
+VerifFrame::Refresh(refresh_t force)
+{
+ //debug(" VerifFrame::Refresh\n");
+}
+
+/****************************************************************/
+/* AUXFRAMELIST */
+/****************************************************************/
+
+enum {
+ ListBoxID,
+ ButtonCopyID
+};
+
+BEGIN_EVENT_TABLE(AuxFrameList, AuxFrame)
+ EVT_BUTTON (ButtonCopyID , AuxFrameList::OnCopy)
+END_EVENT_TABLE()
+
+AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString
_classname, Game *g):
+ AuxFrame(parent, _id, _name, _classname)
+
+{
+ game = g;
+ savedword = L"";
+
+ wxBoxSizer *sizer_v = new wxBoxSizer(wxVERTICAL);
+ listbox = new wxListBox(this, ListBoxID);
+ listbox->SetFont(config.getFont(LISTFONT));
+ listbox->SetToolTip(name);
+ sizer_v->Add(listbox, 1, wxEXPAND | wxALL, 1);
+
+ button = new wxButton(this, ButtonCopyID, wxT("Copier"), wxPoint(0, 0),
wxSize(-1, -1));
+ sizer_v->Add(button, 0, wxEXPAND | wxALL, 1);
+
+ wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+ sizer->Add(sizer_v, 1, wxEXPAND, 0);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizer);
+ sizer->Fit(this);
+ sizer->SetSizeHints(this);
+}
+
+void
+AuxFrameList::OnCopy(wxCommandEvent& event)
+{
+ wxString textdata;
+
+ if (wxTheClipboard->Open())
+ {
+ textdata = wxT("");
+ for (int i = 0; i < listbox->GetCount(); i++)
+ {
+ textdata << listbox->GetString(i) << wxT("\n");
+ }
+ wxTextDataObject* ptr = new wxTextDataObject(textdata);
+ wxTheClipboard->AddData(ptr);
+ wxTheClipboard->Close();
+ }
+}
+
+void
+AuxFrameList::Waiting()
+{
+ listbox->Clear();
+ 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 */
+/****************************************************************/
+
+void
+Plus1Frame::refresh()
+{
+ //debug(" Plus1Frame::refresh start\n");
+ std::wstring rack = game->getCurrentPlayer().getCurrentRack().toString();
+ //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;
+
+ wchar_t buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX];
+ Dic_search_7pl1(game->getDic(), rack.c_str(), buff,
config.getJokerPlus1());
+
+ listbox->Clear();
+ wxString res[DIC_LETTERS*(RES_7PL1_MAX+1)];
+ 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);
+ 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 */
+/****************************************************************/
+
+void
+BenjFrame::refresh()
+{
+ if (game->getMode() != Game::kTRAINING)
+ return;
+
+ std::wstring word = static_cast<Training*>(game)->getTestPlayWord();
+ if (savedword == word)
+ {
+ noresult = false; // keep old results
+ return;
+ }
+ savedword = word;
+ //debug(" BenjFrame::refresh : %s\n",word.c_str());
+ wchar_t 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
+RaccFrame::refresh()
+{
+ if (game->getMode() != Game::kTRAINING)
+ return;
+
+ std::wstring word = static_cast<Training*>(game)->getTestPlayWord();
+ if (savedword == word)
+ {
+ noresult = false; // keep old results
+ return;
+ }
+ savedword = word;
+ //debug(" RaccFrame::refresh : %s\n",word.c_str());
+ wchar_t wordlist[RES_RACC_MAX][DIC_WORD_MAX];
+ Dic_search_Racc(game->getDic(), word.c_str(), wordlist);
+
+ wxString res[RES_RACC_MAX];
+ int resnum = 0;
+ 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);
+}
+
+/****************************************************************/
+/* GAME FRAME */
+/****************************************************************/
+
+GameFrame::GameFrame(wxFrame* parent, Game& iGame):
+ AuxFrameText(parent, ID_Frame_Game, wxT("partie"), FRAMEGAME,
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP),
+ m_game(iGame)
+{
+ textbox->Clear();
+ textbox->AppendText(wxT(""));
+}
+
+void
+GameFrame::Refresh(refresh_t force)
+{
+ std::ostringstream mos;
+ m_game.save(mos);
+#ifdef DEBUG
+ mos << std::string(30,'-') << std::endl;
+ mos << "Player History\n";
+ mos << m_game.getPlayer(0).toString();
+ mos << std::string(30,'-') << std::endl;
+ mos << "Game History\n";
+ mos << m_game.getHistory().toString();
+#endif
+ textbox->Clear();
+ textbox->AppendText( wxU( mos.str().c_str() ) );
+}
+
+/****************************************************************/
+/* RESULT FRAME */
+/****************************************************************/
+
+BEGIN_EVENT_TABLE(ResultFrame, AuxFrame)
+END_EVENT_TABLE()
+
+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 /dev/null eliot/wxwin/auxframes.h:1.5.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/auxframes.h Wed Dec 28 20:10:56 2005
@@ -0,0 +1,257 @@
+/* Eliot */
+/* Copyright (C) 1999 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* 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.h
+ * \brief Window Frames used in Eliot
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
+#ifndef _AUXFRAMES_H
+#define _AUXFRAMES_H
+
+#include "wx/frame.h"
+#include "wx/listctrl.h"
+#include "wx/textctrl.h"
+#include "wx/stattext.h"
+#include "wx/listbox.h"
+#include "wx/button.h"
+
+#include "searchpanel.h"
+#include "gfxboard.h"
+#include "gfxresult.h"
+
+#define MIN_FRAME_ID 0
+#define MAX_FRAME_ID 9
+
+typedef enum {
+ ID_Frame_Verif = MIN_FRAME_ID + 0,
+ ID_Frame_Search = MIN_FRAME_ID + 1,
+ ID_Frame_Plus1 = MIN_FRAME_ID + 2,
+ 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_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;
+ frames_id_t frameid;
+ wxString name, classname;
+ ConfigDB config;
+
+public:
+ 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;
+ wstring 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;
+public:
+ BoardFrame(wxFrame*, Game&);
+ void Refresh(refresh_t force = REFRESH);
+};
+
+/**
+ * Frame to display the tiles left in the bag
+ */
+
+class BagFrame: public AuxFrame
+{
+private:
+ Game& m_game;
+ wxListCtrl *tiles;
+public:
+ BagFrame(wxFrame*, Game&);
+ void Refresh(refresh_t force = REFRESH);
+};
+
+/**
+ * Several research tool in a panel widget within the frame
+ */
+
+class SearchFrame: public AuxFrame
+{
+private:
+ SearchPanel *panel;
+public:
+ SearchFrame(wxFrame*, Dictionary);
+ void Refresh(refresh_t force = REFRESH);
+};
+
+/**
+ * Frame to verify if a word is in the dictionary
+ */
+
+class VerifFrame: public AuxFrame
+{
+protected:
+ Dictionary dic;
+ wxTextCtrl *word;
+ wxStaticText *result;
+ void verif();
+public:
+ VerifFrame(wxFrame*, Dictionary);
+ void OnText(wxCommandEvent& event);
+ void Refresh(refresh_t force = REFRESH);
+ DECLARE_EVENT_TABLE()
+};
+
+/**
+ * Displays the list of 7+1 for the current search
+ */
+
+class Plus1Frame: public AuxFrameList
+{
+protected:
+ virtual void refresh();
+public:
+ 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 BenjFrame: public AuxFrameList
+{
+protected:
+ virtual void refresh();
+public:
+ 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 RaccFrame: public AuxFrameList
+{
+protected:
+ virtual void refresh();
+public:
+ RaccFrame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Racc,
wxT("raccords"), FRAMERACC, g) {};
+};
+
+/**
+ * Displays the current game
+ */
+
+class GameFrame: public AuxFrameText
+{
+protected:
+ Game& m_game;
+public:
+ 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:
Index: eliot/wxwin/gfxresult.cc
diff -u /dev/null eliot/wxwin/gfxresult.cc:1.3.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/gfxresult.cc Wed Dec 28 20:10:56 2005
@@ -0,0 +1,234 @@
+/* Eliot */
+/* Copyright (C) 1999 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+/**
+ * \file reslist.cc
+ * \brief Search results list view
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
+#include <wx/wx.h>
+
+#include "ewx.h"
+#include "dic.h"
+#include "game.h"
+#include "player.h"
+#include "training.h"
+#include "configdb.h"
+#include "gfxresult.h"
+#include "mainframe.h"
+
+/* ************************************************** */
+/* ************************************************** */
+
+enum {
+ ListCtrl_ID = 11000
+};
+
+BEGIN_EVENT_TABLE(GfxResult, wxControl)
+ EVT_SIZE(GfxResult::OnSize)
+ EVT_LIST_ITEM_SELECTED (ListCtrl_ID, GfxResult::OnListCtrlSelected)
+ EVT_LIST_ITEM_ACTIVATED (ListCtrl_ID, GfxResult::OnListCtrlActivated)
+END_EVENT_TABLE()
+
+/* ************************************************** */
+/* ************************************************** */
+
+GfxResult::GfxResult(wxFrame *parent, MainFrame* _mf, Game* _game) :
+ wxControl(parent, wxWindowID(234), wxDefaultPosition, wxDefaultSize,
+ wxNO_BORDER | wxFULL_REPAINT_ON_RESIZE)
+{
+ mf = _mf;
+ game = _game;
+ savedrack = L"";
+ results = new wxListCtrl(this, ListCtrl_ID);
+#if defined(ENABLE_LC_NO_HEADER)
+ results->SetSingleStyle(wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL);
+#else
+ results->SetSingleStyle(wxLC_REPORT | wxLC_SINGLE_SEL);
+#endif
+ results->InsertColumn(0, wxT("Sol"));
+ results->InsertColumn(1, wxT("*"));
+ results->InsertColumn(2, wxT("Pos"));
+ results->InsertColumn(3, wxT("Pts"));
+ results->SetToolTip(wxT("Resultats de la recherche"));
+
+ wxBoxSizer *sizer_v = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer *sizer_h = new wxBoxSizer(wxHORIZONTAL);
+
+ sizer_v->Add(results, 1, wxEXPAND, 0);
+ sizer_h->Add(sizer_v, 1, wxEXPAND, 0);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizer_h);
+ sizer_h->Fit(this);
+ sizer_h->SetSizeHints(this);
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+GfxResult::~GfxResult(void)
+{
+ //debug(" GfxResult::~GfxResult\n");
+ Show(false);
+ Show(true);
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::SetGame(Game* g)
+{
+ game = g;
+ savedrack = L"";
+ results->DeleteAllItems();
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::Refresh()
+{
+ if (game == NULL)
+ return;
+
+ debug(" GfxResult::Refresh : ");
+ std::wstring rack = game->getCurrentPlayer().getCurrentRack().toString();
+
+ if (savedrack != rack)
+ {
+ debug("changed (%ls -> %ls)",savedrack.c_str(),rack.c_str());
+ savedrack = rack;
+ results->DeleteAllItems();
+ }
+ else
+ {
+ debug("unchanged");
+ }
+ debug("\n");
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::Search()
+{
+ debug("GfxResult::Search()\n");
+ if (game == NULL)
+ return;
+
+ ((Training*)game)->search();
+
+ results->DeleteAllItems();
+ results->SetFont(config.getFont(LISTFONT));
+
+ const Results &res = ((Training*)game)->getResults();
+ debug(" GfxResult::Search size = %d\n",res.size());
+ for (int i = 0; i < res.size(); i++)
+ {
+ Round r = res.get(i);
+ //debug(" adding %s\n",r.toString().c_str());
+ wxString pts;
+ wxString word = wxU(r.getWord().c_str());
+ wxString coords = wxU(r.getCoord().toString().c_str());
+ wxChar bonus = r.getBonus() ? wxT('*') : wxT(' ');
+ pts << r.getPoints();
+
+ long tmp = results->InsertItem(i, word);
+ results->SetItemData(tmp, i);
+ tmp = results->SetItem(i, 1, bonus);
+ tmp = results->SetItem(i, 2, coords);
+ tmp = results->SetItem(i, 3, pts);
+ }
+
+ for (int i = 0; i < 4; i++)
+ results->SetColumnWidth(i, wxLIST_AUTOSIZE);
+
+ //results->Show();
+
+ if (res.size() > 0)
+ {
+ results->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED
| wxLIST_MASK_STATE);
+ ((Training*)game)->testPlay(0);
+ }
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+int
+GfxResult::GetSelected()
+{
+ int item = -1;
+ item = results->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED);
+ //debug("GfxResult::GetSelected = %d\n",item);
+ return item;
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::OnListCtrlSelected(wxListEvent& event)
+{
+ //debug(" GfxResult::OnListCtrlSelected\n");
+ if (event.m_itemIndex > -1)
+ {
+ mf->TestPlay(event.m_itemIndex);
+ }
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::OnListCtrlActivated(wxListEvent& event)
+{
+ //debug(" GfxResult::OnListCtrlActivated");
+ if (event.m_itemIndex > -1)
+ {
+ mf->Play(1);
+ results->DeleteAllItems();
+ }
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+void
+GfxResult::OnSize(wxSizeEvent& e)
+{
+ int w,h;
+ GetClientSize(&w,&h);
+ results->SetClientSize(w,h);
+ //debug(" GfxResult::OnSize (%d,%d)\n",w,h);
+}
+
+/* ************************************************** */
+/* ************************************************** */
+
+/// Local Variables:
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:
Index: eliot/wxwin/gfxresult.h
diff -u /dev/null eliot/wxwin/gfxresult.h:1.2.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/gfxresult.h Wed Dec 28 20:10:56 2005
@@ -0,0 +1,68 @@
+/* Eliot */
+/* Copyright (C) 2005 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+/**
+ * \file reslist.h
+ * \brief Search results list view
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
+#ifndef _RESLIST_H
+#define _RESLIST_H
+
+#include <string>
+#include <wx/listctrl.h>
+
+class MainFrame;
+
+
+class GfxResult : public wxControl
+{
+ private:
+ MainFrame *mf;
+ std::wstring savedrack;
+ Game *game;
+ wxListCtrl *results;
+ ConfigDB config;
+
+ public:
+ GfxResult(wxFrame*, MainFrame*, Game*);
+ ~GfxResult();
+
+ void SetGame(Game*);
+ void Search();
+ int GetSelected();
+ void Refresh();
+
+ void OnSize(wxSizeEvent& e);
+ void OnListCtrlSelected(wxListEvent& event);
+ void OnListCtrlActivated(wxListEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+
+#endif
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:
Index: eliot/wxwin/mainframe.cc
diff -u /dev/null eliot/wxwin/mainframe.cc:1.17.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/mainframe.cc Wed Dec 28 20:10:56 2005
@@ -0,0 +1,1065 @@
+/* Eliot */
+/* Copyright (C) 1999 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+/**
+ * \file mainframe.cc
+ * \brief Main frame for the Eliot GUI
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+#include "wx/intl.h"
+#include "wx/menu.h"
+#include "wx/statusbr.h"
+#include "wx/sizer.h"
+#include "wx/filedlg.h"
+#include "wx/msgdlg.h"
+
+#include "ewx.h"
+
+#include "dic.h"
+#include "game.h"
+#include "game_factory.h"
+#include "player.h"
+
+#include "configdb.h"
+#include "confdimdlg.h"
+#include "confsearch.h"
+#include "printout.h"
+#include "mainframe.h"
+
+#ifdef ENABLE_SAVE_POSTSCRIPT
+#include "wx/dcps.h"
+#endif
+
+enum
+{
+ Menu_Game_New = 1000,
+ Menu_Game_Open,
+ Menu_Game_Save,
+ Menu_Game_Print,
+ Menu_Game_PrintPreview,
+ Menu_Game_PrintPS,
+
+ Menu_Conf_Game = 2000,
+ Menu_Conf_Game_Dic,
+ Menu_Conf_Game_Tiles,
+ Menu_Conf_Game_Search,
+ Menu_Conf_Print,
+ Menu_Conf_Aspect = 2100,
+ Menu_Conf_Tile,
+ Menu_Conf_Aspect_BoardColour_DrawTiles,
+ Menu_Conf_Aspect_Font,
+ Menu_Conf_Aspect_Font_Search = 2110,
+ Menu_Conf_Aspect_Font_Board = 2111,
+ Menu_Conf_Aspect_Font_Default = 2112,
+ Menu_Conf_Aspect_BoardColour = 2200,
+ Menu_Conf_Aspect_BoardColour_Lines = 2201,
+ Menu_Conf_Aspect_BoardColour_Wx2 = 2202,
+ Menu_Conf_Aspect_BoardColour_Wx3 = 2203,
+ Menu_Conf_Aspect_BoardColour_Lx2 = 2204,
+ Menu_Conf_Aspect_BoardColour_Lx3 = 2205,
+ Menu_Conf_Aspect_BoardColour_Background = 2206,
+ Menu_Conf_Aspect_BoardColour_Letters = 2207,
+ Menu_Conf_Aspect_BoardColour_TestLetters = 2208,
+ Menu_Conf_Aspect_BoardColour_TileBack = 2209,
+ Menu_Conf_Aspect_BoardColour_TestTileBack = 2210,
+ Menu_Conf_Aspect_BoardColour_Default = 2211,
+
+#define IDBASE 3300
+ Menu_ShowVerif = (IDBASE + ID_Frame_Verif),
+ Menu_ShowSearch = (IDBASE + ID_Frame_Search),
+ Menu_ShowPlus1 = (IDBASE + ID_Frame_Plus1),
+ Menu_ShowRacc = (IDBASE + ID_Frame_Racc),
+ Menu_ShowBenj = (IDBASE + ID_Frame_Benj),
+ Menu_ShowBag = (IDBASE + ID_Frame_Bag),
+ Menu_ShowBoard = (IDBASE + ID_Frame_Board),
+ Menu_ShowGame = (IDBASE + ID_Frame_Game),
+ Menu_ShowResult = (IDBASE + ID_Frame_Result),
+
+ Menu_Quit_Apropos = 4000,
+ Menu_Quit_Confirm,
+
+ Button_SetRack = 10000,
+ Button_SetNew,
+ Button_SetManual,
+ Button_Search,
+ Button_Play,
+ Button_PlayBack,
+
+ ListCtrl_ID = 11000,
+ Rack_ID,
+ Status_ID,
+};
+
+BEGIN_EVENT_TABLE(MainFrame, wxFrame)
+ //
+ EVT_MENU(Menu_Game_New, MainFrame::OnMenuGameNew)
+ EVT_MENU(Menu_Game_Open, MainFrame::OnMenuGameOpen)
+ EVT_MENU(Menu_Game_Save, MainFrame::OnMenuGameSave)
+ EVT_MENU(Menu_Game_Print, MainFrame::OnMenuGamePrint)
+ EVT_MENU(Menu_Game_PrintPreview, MainFrame::OnMenuGamePrintPreview)
+ EVT_MENU(Menu_Game_PrintPS, MainFrame::OnMenuGamePrintPS)
+ //
+ EVT_MENU(Menu_Conf_Game_Dic, MainFrame::OnMenuConfGameDic)
+ EVT_MENU(Menu_Conf_Game_Search, MainFrame::OnMenuConfGameSearch)
+ //
+ EVT_MENU(Menu_Conf_Print, MainFrame::OnMenuConfPrint)
+ //
+ EVT_MENU_RANGE(Menu_Conf_Aspect_Font_Search,
Menu_Conf_Aspect_Font_Default, MainFrame::OnMenuConfAspectFont)
+ EVT_MENU_RANGE(Menu_Conf_Aspect_BoardColour_Lines,
Menu_Conf_Aspect_BoardColour_Default, MainFrame::OnMenuConfAspectBoardColour)
+ EVT_MENU_RANGE(Menu_ShowVerif, Menu_ShowResult, MainFrame::OnMenuShowFrame)
+ //
+ EVT_MENU(Menu_Quit_Apropos, MainFrame::OnMenuQuitApropos)
+ EVT_MENU(Menu_Quit_Confirm, MainFrame::OnMenuQuitConfirm)
+ //
+ EVT_BUTTON(Button_Play, MainFrame::OnPlay)
+ EVT_BUTTON(Button_SetRack, MainFrame::OnSetRack)
+ EVT_BUTTON(Button_SetNew, MainFrame::OnSetRack)
+ EVT_BUTTON(Button_Search, MainFrame::OnSearch)
+ EVT_BUTTON(Button_PlayBack, MainFrame::OnPlay)
+ //
+ EVT_TEXT_ENTER(Rack_ID, MainFrame::OnSearch)
+ //
+ EVT_CLOSE(MainFrame::OnCloseWindow)
+ //
+END_EVENT_TABLE()
+
+// ******************************
+//
+// ******************************
+
+MainFrame::MainFrame(wxPoint pos_, wxSize size_)
+ : wxFrame((wxFrame *) NULL, -1, wxT("Eliot"), wxPoint(-1, -1),
+ size_, wxDEFAULT_FRAME_STYLE, wxT("Eliot")),
+ m_dic(NULL), m_game(NULL)
+{
+ reslist = NULL;
+ statusbar = NULL;
+ for(int i=0 ; i < MAX_FRAME_ID; i++)
+ auxframes_ptr[i] = NULL;
+
+ wxString dicpath = config.getDicPath();
+ Dic_load(&m_dic, dicpath.mb_str());
+ if (m_dic == NULL)
+ {
+ wxCommandEvent event;
+ OnMenuConfGameDic(event);
+ }
+ m_game = GameFactory::Instance()->createTraining(m_dic);
+ if (m_game)
+ {
+ m_game->start();
+ }
+
+ wxBoxSizer *listsizer = new wxBoxSizer(wxVERTICAL);
+ rack = new wxTextCtrl(this, Rack_ID, wxU(""), wxPoint(-1, -1), wxSize(-1,
-1), wxTE_PROCESS_ENTER);
+ listsizer->Add(rack , 0 , wxEXPAND | wxALL, 1);
+ rack->SetToolTip(wxT("Tirage"));
+#ifdef ENABLE_RESLIST_IN_MAIN
+ reslist = new GfxResult(this,(MainFrame*)this,m_game);
+ listsizer->Add(reslist, 1, wxEXPAND | wxLEFT | wxRIGHT, 1);
+#endif
+
+ InitMenu();
+
+ statusbar = CreateStatusBar(2, 0, Status_ID);
+ int ww[2] = {-1, 160};
+ statusbar->SetStatusWidths(2, ww);
+ UpdateStatusBar();
+
+ b_rackrandomset = new wxButton(this, Button_SetRack, wxT(" Tirage "));
+ b_rackrandomnew = new wxButton(this, Button_SetNew, wxT(" Complement "));
+ b_search = new wxButton(this, Button_Search, wxT(" Rechercher "));
+ b_back = new wxButton(this, Button_PlayBack, wxT(" Arriere "));
+ b_play = new wxButton(this, Button_Play, wxT(" Jouer "));
+
+ b_rackrandomset->SetToolTip(wxT("Tirage aleatoire"));
+ b_rackrandomnew->SetToolTip(wxT("Complement aleatoire du tirage"));
+ b_search->SetToolTip( wxT("Recherche sur le tirage courant"));
+ b_back->SetToolTip( wxT("Revenir un coup en arriere"));
+ b_play->SetToolTip( wxT("Jouer le mot selectionne"));
+
+ wxBoxSizer *buttonsizer = new wxBoxSizer(wxHORIZONTAL);
+ buttonsizer->Add(b_rackrandomset, 1, wxEXPAND | wxTOP | wxBOTTOM | wxLEFT
, 1);
+ buttonsizer->Add(b_rackrandomnew, 1, wxEXPAND | wxTOP | wxBOTTOM
, 1);
+ buttonsizer->Add(b_search, 1, wxEXPAND | wxTOP | wxBOTTOM
, 1);
+ buttonsizer->Add(b_back, 1, wxEXPAND | wxTOP | wxBOTTOM
, 1);
+ buttonsizer->Add(b_play, 1, wxEXPAND | wxTOP | wxBOTTOM |
wxRIGHT, 1);
+
+ wxBoxSizer *mainsizer = new wxBoxSizer(wxVERTICAL);
+ mainsizer->Add(listsizer , 1, wxEXPAND | wxVERTICAL, 0);
+ mainsizer->Add(buttonsizer, 0, wxEXPAND , 0);
+
+ SetAutoLayout(TRUE);
+ SetSizer(mainsizer);
+ mainsizer->Fit(this);
+ mainsizer->SetSizeHints(this);
+
+ SetClientSize(size_);
+ Move(config.getFramePos(wxT(APPNAME)));
+
+ InitFrames();
+}
+
+// ******************************
+//
+// ******************************
+
+MainFrame::~MainFrame()
+{
+ config.setFramePos(wxT(APPNAME), GetPosition());
+ config.setFrameSize(wxT(APPNAME), GetClientSize());
+
+ if (m_game != NULL)
+ {
+ GameFactory::Instance()->releaseGame(*m_game);
+ m_game = NULL;
+ }
+
+ if (m_dic)
+ {
+ Dic_destroy(m_dic);
+ }
+}
+
+// ******************************
+//
+// ******************************
+
+void
+MainFrame::InitMenu()
+{
+ // menus
+ wxMenu *menu_game = new wxMenu;
+// XXX: menu_game->Append(Menu_Game_New, wxT("Nouvelle"), wxT("Démarrer une
nouvelle partie"));
+ menu_game->Append(Menu_Game_New, wxT("Nouvelle"), wxT("Demarrer une
nouvelle partie"));
+ menu_game->Append(Menu_Game_Open, wxT("Charger..."), wxT("Charger une
partie"));
+ menu_game->Append(Menu_Game_Save, wxT("Sauver..."), wxT("Sauver cette
partie"));
+ menu_game->AppendSeparator();
+ menu_game->Append(Menu_Game_Print, wxT("Imprimer..."), wxT("Imprimer cette
partie"));
+// XXX: menu_game->Append(Menu_Game_PrintPreview, wxT("Préimpression"),
wxT("Préimpression de la partie"));
+ menu_game->Append(Menu_Game_PrintPreview, wxT("Preimpression"),
wxT("Preimpression de la partie"));
+#ifdef ENABLE_SAVE_POSTSCRIPT
+ menu_game->AppendSeparator();
+ menu_game->Append(Menu_Game_PrintPS, wxT("Imprimer du PostScript"),
wxT("Imprimer dans un fichier PostScript"));
+#endif
+ //
+ wxMenu *menu_conf_game = new wxMenu;
+ menu_conf_game->Append(Menu_Conf_Game_Dic, wxT("Dictionnaire"), wxT("Choix
du dictionnaire"));
+ menu_conf_game->Append(Menu_Conf_Game_Search, wxT("Recherche"),
wxT("Options de recherche"));
+ //
+ wxMenu *menu_tileback = new wxMenu;
+ menu_tileback->Append(Menu_Conf_Aspect_BoardColour_Letters ,
wxT("Lettres jouees"), wxT("Lettres jouees sur la grille"));
+ menu_tileback->Append(Menu_Conf_Aspect_BoardColour_TestLetters ,
wxT("Lettres provisoires"), wxT("Lettres du mot a jouer"));
+ menu_tileback->AppendSeparator();
+ //menu_tileback->Append(Menu_Conf_Aspect_BoardColour_DrawTiles ,
wxT("Dessiner les pions"), wxT("Dessiner les pions sur la grille"));
+ menu_tileback->Append(Menu_Conf_Aspect_BoardColour_TileBack ,
wxT("Fonds lettres jouees"), wxT("Fonds des pions sur la grille"));
+ menu_tileback->Append(Menu_Conf_Aspect_BoardColour_TestTileBack,
wxT("Fonds lettres provisoires"), wxT("Fonds des pions sur la grille"));
+ //
+ wxMenu *menu_conf_board_colour = new wxMenu;
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Background,
wxT("Fond"), wxT("Couleur du fond"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lines,
wxT("Lignes"), wxT("Couleur des lignes"));
+ menu_conf_board_colour->Append(Menu_Conf_Tile, wxT("Pions et lettres"),
menu_tileback, wxT("Pions et lettres"));
+ menu_conf_board_colour->AppendSeparator();
+// XXX:
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Letters,
wxT("Lettres jouées"), wxT("Lettres jouées sur la grille"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Letters,
wxT("Lettres jouees"), wxT("Lettres jouees sur la grille"));
+// XXX:
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_TestLetters,
wxT("Lettres provisoires"), wxT("Lettres du mot à jouer"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_TestLetters,
wxT("Lettres provisoires"), wxT("Lettres du mot a jouer"));
+ menu_conf_board_colour->AppendSeparator();
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Wx2, wxT("Mot
compte double"), wxT("Mot compte double"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Wx3, wxT("Mot
compte triple"), wxT("Mot compte triple"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lx2,
wxT("Lettre compte double"), wxT("Lettre compte double"));
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lx3,
wxT("Lettre compte triple"), wxT("Lettre compte triple"));
+ menu_conf_board_colour->AppendSeparator();
+ menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Default,
wxT("Couleurs d'origine"), wxT("Retrouver les couleurs d'origine"));
+ //
+ wxMenu *menu_conf_board_font = new wxMenu;
+// XXX: menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Search,
wxT("Lettres de recherche"), wxT("Police de caractères pour les recherches"));
+ menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Search, wxT("Lettres de
recherche"), wxT("Police de caracteres pour les recherches"));
+// XXX: menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Board,
wxT("Lettres de la grille"), wxT("Police de caractères de la grille"));
+ menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Board, wxT("Lettres de
la grille"), wxT("Police de caracteres de la grille"));
+ //
+ wxMenu *menu_conf = new wxMenu;
+ menu_conf->Append(Menu_Conf_Game, wxT("Jeu"), menu_conf_game,
wxT("Configuration du jeu"));
+ menu_conf->Append(Menu_Conf_Aspect_Font, wxT("Fonte des lettres"),
menu_conf_board_font, wxT("Modification des fontes"));
+ menu_conf->Append(Menu_Conf_Aspect_BoardColour, wxT("Couleurs de la
grille"), menu_conf_board_colour, wxT("Modification des couleurs"));
+ menu_conf->Append(Menu_Conf_Print, wxT("Impression"), wxT("Dimensions de
la partie"));
+ //
+ wxMenu *menu_frame = new wxMenu;
+ menu_frame->Append(Menu_ShowBoard, wxT("Grille"), wxT("Grille de jeu"));
+// XXX: menu_frame->Append(Menu_ShowVerif, wxT("Vérification"),
wxT("Vérification d'un mot dans le dictionnaire"));
+ menu_frame->Append(Menu_ShowVerif, wxT("Verification"), wxT("Verification
d'un mot dans le dictionnaire"));
+ menu_frame->Append(Menu_ShowSearch, wxT("Recherche"), wxT("Recherche dans
le dictionnaire"));
+ menu_frame->AppendSeparator();
+ menu_frame->Append(Menu_ShowPlus1, wxT("Tirage + 1"), wxT("Lettres du
tirage plus une"));
+ menu_frame->Append(Menu_ShowRacc, wxT("Raccords"), wxT("Raccords sur un
mot de la recherche"));
+ menu_frame->Append(Menu_ShowBenj, wxT("Benjamins"), wxT("Benjamins sur un
mot de la recherche"));
+ menu_frame->AppendSeparator();
+ menu_frame->Append(Menu_ShowBag, wxT("Sac"), wxT("Lettres restantes dans
le sac"));
+ menu_frame->AppendSeparator();
+ menu_frame->Append(Menu_ShowGame, wxT("Partie"), wxT("Partie"));
+#ifndef ENABLE_RESLIST_IN_MAIN
+ menu_frame->Append(Menu_ShowResult, wxT("Resultats"), wxT("Resultats"));
+#endif
+ //
+ wxMenu *menu_quit = new wxMenu;
+ menu_quit->Append(Menu_Quit_Apropos, wxT("A propos..."), wxT("A propos
d'Eliot"));
+ menu_quit->Append(Menu_Quit_Confirm, wxT("Quitter"), wxT("Quitter"));
+ //
+ wxMenuBar *menu_bar = new wxMenuBar;
+ menu_bar->Append(menu_game, wxT("Partie"));
+ menu_bar->Append(menu_conf, wxT("Configuration"));
+// XXX: menu_bar->Append(menu_frame, wxT("Fenêtres"));
+ menu_bar->Append(menu_frame, wxT("Fenetres"));
+ menu_bar->Append(menu_quit, wxT("Quitter"));
+
+ SetMenuBar(menu_bar);
+}
+
+// *******************
+//
+// *******************
+
+void
+MainFrame::OnCloseWindow(wxCloseEvent&)
+{
+ this->Destroy();
+}
+
+// *******************
+// NEW
+// *******************
+
+void
+MainFrame::OnMenuGameNew(wxCommandEvent&)
+{
+ if (m_dic == NULL)
+ {
+// XXX: wxMessageBox(wxT("Il n'y a pas de dictionnaire sélectionné"),
wxT("Eliot: erreur"),
+ wxMessageBox(wxT("Il n'y a pas de dictionnaire selectionne"),
wxT("Eliot: erreur"),
+ wxICON_INFORMATION | wxOK);
+ return;
+ }
+
+ TODO("selection du type de partie dans OnMenuGameNew\n");
+
+ if (m_game != NULL)
+ {
+ GameFactory::Instance()->releaseGame(*m_game);
+ m_game = NULL;
+ }
+
+ m_game = GameFactory::Instance()->createTraining(m_dic);
+ m_game->start();
+ rack->SetValue(wxU(""));
+ InitFrames();
+#ifdef ENABLE_RESLIST_IN_MAIN
+ reslist->SetGame(m_game);
+#endif
+ UpdateStatusBar();
+ UpdateFrames(AuxFrame::FORCE_REFRESH);
+}
+
+// *******************
+// OPEN
+// *******************
+
+void
+MainFrame::OnMenuGameOpen(wxCommandEvent&)
+{
+ wxString txt;
+ wxFileDialog dialog(this, wxT("Ouvrir une partie"), wxT(""), wxT(""),
wxT("*"), wxOPEN);
+ if (m_dic == NULL)
+ {
+// XXX: wxMessageBox(wxT("Il n'y a pas de dictionnaire sélectionné"),
wxT("Eliot: erreur"),
+ wxMessageBox(wxT("Il n'y a pas de dictionnaire selectionne"),
wxT("Eliot: erreur"),
+ wxICON_INFORMATION | wxOK);
+ return;
+ }
+ if (dialog.ShowModal() != wxID_OK)
+ {
+ return;
+ }
+
+ if (m_game != NULL)
+ {
+ GameFactory::Instance()->releaseGame(*m_game);
+ m_game = NULL;
+ }
+
+ FILE* fin;
+
+ if ((fin = fopen(dialog.GetPath().mb_str(), "r")) == NULL)
+ {
+ txt << wxT("Impossible d'ouvrir") << dialog.GetPath();
+ wxMessageDialog msg(this, txt, wxT("Ouverture d'une partie"));
+ msg.ShowModal();
+ return ;
+ }
+
+ m_game = Game::load(fin, m_dic);
+ fclose(fin);
+
+ if (m_game == NULL)
+ {
+ wxMessageDialog msg(this,
+ wxT("Erreur pendant la lecture de la partie"),
+ wxT("chargement de partie"));
+ msg.ShowModal();
+ return;
+ }
+
+#if 0
+ // FIXME
+ if (m_game->getHistory().getSize() == 0)
+ {
+ wxMessageDialog msg(this,
+ wxT("Erreur pendant la lecture de la partie"),
+ wxT("La partie est vide"));
+ msg.ShowModal();
+ return;
+ }
+#endif
+
+ std::string r = "";
+#if 0
+ // FIXME
+ if (m_game->getHistory().getSize() >= 0)
+ {
+ r = m_game->getCurrentPlayer().getCurrentRack().toString();
+ }
+#endif
+
+ rack->SetValue(wxU(r.c_str()));
+ // update gfxboard and all frames
+ InitFrames();
+ // update status bar
+#ifdef ENABLE_RESLIST_IN_MAIN
+ reslist->SetGame(m_game);
+#endif
+ UpdateStatusBar();
+ UpdateFrames(AuxFrame::FORCE_REFRESH);
+}
+
+// *******************
+// SAVE
+// *******************
+
+void
+MainFrame::OnMenuGameSave(wxCommandEvent& WXUNUSED(event))
+{
+ wxFileDialog dialog(this, wxT("Sauver une partie"), wxT(""), wxT(""),
wxT("*"), wxSAVE|wxOVERWRITE_PROMPT);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ ofstream fout(dialog.GetPath().mb_str());
+ if (fout.rdstate() == ios::failbit)
+ {
+ wxString txt;
+// XXX: txt << wxT("Impossible de créer ") << dialog.GetPath();
+ txt << wxT("Impossible de creer ") << dialog.GetPath();
+ wxMessageDialog msg(this, txt, wxT("Sauvegarde de la partie"));
+ msg.ShowModal();
+ return ;
+ }
+ m_game->save(fout);
+ fout.close();
+ }
+}
+
+// *******************
+// PRINT
+// *******************
+
+void
+MainFrame::OnMenuGamePrint(wxCommandEvent& WXUNUSED(event))
+{
+ // TODO: gray out the menu instead...
+ if (m_game == NULL)
+ {
+ wxMessageBox(wxT("Pas de partie en cours"), wxT("Eliot: erreur"),
+ wxICON_INFORMATION | wxOK);
+ return;
+ }
+ wxPrintDialogData printDialogData(config.getPrintData());
+ wxPrinter printer(&printDialogData);
+ GamePrintout printout(*m_game);
+ if (!printer.Print(this, &printout, TRUE))
+// XXX: wxMessageBox(wxT("Impression non effectuée."));
+ wxMessageBox(wxT("Impression non effectuee."));
+}
+
+void
+MainFrame::OnMenuGamePrintPreview(wxCommandEvent& WXUNUSED(event))
+{
+ // TODO: gray out the menu instead...
+ if (m_game == NULL)
+ {
+ wxMessageBox(wxT("Pas de partie en cours"), wxT("Eliot: erreur"),
+ wxICON_INFORMATION | wxOK);
+ return;
+ }
+ wxPrintData printdata = config.getPrintData();
+
+ wxString msg;
+ wxPrintPreview *preview = new wxPrintPreview(new GamePrintout(*m_game),
+ new GamePrintout(*m_game), &
printdata);
+ if (!preview->Ok())
+ {
+ delete preview;
+// XXX: msg << wxT("Problème de prévisualisation.\n")
+ msg << wxT("Probleme de previsualisation.\n")
+// XXX: << wxT("Il se peut que l'imprimante par défaut soit mal
initialisée");
+ << wxT("Il se peut que l'imprimante par defaut soit mal
initialisee");
+// XXX: wxMessageBox(msg, wxT("Impression (prévisualisation)"), wxOK);
+ wxMessageBox(msg, wxT("Impression (previsualisation)"), wxOK);
+ return;
+ }
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, this,
wxT("Impression"),
+ wxPoint(-1, -1), wxSize(600,
550));
+ frame->Centre(wxBOTH);
+ frame->Initialize();
+ frame->Show(TRUE);
+}
+
+void
+MainFrame::OnMenuGamePrintPS(wxCommandEvent& WXUNUSED(event))
+{
+#ifdef ENABLE_SAVE_POSTSCRIPT
+ // TODO: gray out the menu instead...
+ if (m_game == NULL)
+ {
+ wxMessageBox(wxT("Pas de partie en cours"), wxT("Eliot: erreur"),
+ wxICON_INFORMATION | wxOK);
+ return;
+ }
+ wxString txt;
+ wxFileDialog dialog(this, wxT("Imprimer dans un fichier PostScript"),
wxT(""), wxT(""), wxT("*.ps"), wxSAVE|wxOVERWRITE_PROMPT);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxPrintData printdataPS;
+ printdataPS.SetPrintMode(wxPRINT_MODE_FILE);
+ printdataPS.SetFilename(dialog.GetPath());
+ printdataPS.SetPaperId(wxPAPER_A4);
+ printdataPS.SetQuality(wxPRINT_QUALITY_HIGH);
+ printdataPS.SetOrientation(wxPORTRAIT);
+
+ wxPostScriptDC printps(printdataPS);
+ if (printps.Ok())
+ {
+ wxPrintDialogData printDialogData(printdataPS);
+ wxPostScriptPrinter printer(&printDialogData);
+ GamePrintout printout(*m_game);
+ if (!printer.Print(this, &printout, FALSE))
+ {
+// XXX: wxMessageBox(wxT("Impression non effectuée."));
+ wxMessageBox(wxT("Impression non effectuee."));
+ }
+ else
+ {
+ wxString msg;
+// XXX: msg << wxT("Dessin effectué dans ") << dialog.GetPath()
<< wxT("\n");
+ msg << wxT("Dessin effectue dans ") << dialog.GetPath() <<
wxT("\n");
+ wxMessageBox(msg, wxT("Sauvegarde PostScript"), wxOK);
+ }
+ }
+ else
+ {
+ wxString msg;
+ msg << wxT("impossible d'initialiser le traitement PostScript.\n");
+ wxMessageBox(msg, wxT("Sauvegarde PostScript"), wxOK);
+ }
+ }
+#endif
+}
+
+
+// *******************
+// Dictionnary Loading
+// *******************
+
+void
+MainFrame::OnMenuConfGameDic(wxCommandEvent& WXUNUSED(event))
+{
+ wxString txt, msg, dicpath;
+ wxFileDialog dialog(this, wxT("Choisir un dictionnaire"), wxT(""),
wxT("*.dawg"), wxT("*.dawg"), wxOPEN);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxString dicpath = dialog.GetPath();
+ Dictionary dic;
+ int res = Dic_load(&dic, dicpath.mb_str());
+ if (res == 0)
+ {
+ if (m_dic)
+ {
+ Dic_destroy(m_dic);
+ }
+
+ m_dic = dic;
+ config.setDicPath(dialog.GetPath(),
::wxFileNameFromPath(dialog.GetPath()));
+ }
+ else
+ {
+ switch (res)
+ {
+ case 0: /* cas normal */ break;
+// XXX: case 1: msg << wxT("chargement: problème d'ouverture de
") << dicpath << wxT("\n"); break;
+ case 1: msg << wxT("chargement: probleme d'ouverture de ") <<
dicpath << wxT("\n"); break;
+// XXX: case 2: msg << wxT("chargement: mauvais en-tête de
dictionnaire\n"); break;
+ case 2: msg << wxT("chargement: mauvais en-tete de
dictionnaire\n"); break;
+// XXX: case 3: msg << wxT("chargement: problème 3 d'allocation
mémoire\n"); break;
+ case 3: msg << wxT("chargement: probleme 3 d'allocation
memoire\n"); break;
+// XXX: case 4: msg << wxT("chargement: problème 4 d'allocation
mémoire\n"); break;
+ case 4: msg << wxT("chargement: probleme 4 d'allocation
memoire\n"); break;
+// XXX: case 5: msg << wxT("chargement: problème de lecture des
arcs du dictionnaire\n"); break;
+ case 5: msg << wxT("chargement: probleme de lecture des arcs
du dictionnaire\n"); break;
+// XXX: default: msg << wxT("chargement: problème
non-répertorié\n"); break;
+ default: msg << wxT("chargement: probleme non-repertorie\n");
break;
+ }
+ wxMessageDialog dlg(NULL, msg, wxT(APPNAME));
+ dlg.ShowModal();
+ }
+ }
+ UpdateStatusBar();
+ UpdateFrames();
+}
+
+// ****************
+// MENU CONF SEARCH
+// ****************
+
+void
+MainFrame::OnMenuConfGameSearch(wxCommandEvent& WXUNUSED(event))
+{
+ ConfSearchDlg dlg(this);
+ dlg.ShowModal();
+}
+
+// ****************
+// MENU CONF PRINT
+// ****************
+
+void
+MainFrame::OnMenuConfPrint(wxCommandEvent& WXUNUSED(event))
+{
+ ConfDimDlg dlg(this, config.getPrintData(), config.getPageSetupData());
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ config.setPrintData(dlg.getPrintData());
+ config.setPageSetupData(dlg.getPageSetupData());
+ }
+}
+
+// ****************
+// MENU CONF FONTS
+// ****************
+
+void
+MainFrame::OnMenuConfAspectFont(wxCommandEvent& event)
+{
+ int id;
+ wxString attr;
+
+ id = event.GetId();
+ if (! GetMenuBar()->FindItem(id))
+ return;
+
+ switch (id)
+ {
+ case Menu_Conf_Aspect_Font_Search: attr = wxString(LISTFONT); break;
+ case Menu_Conf_Aspect_Font_Board: attr = wxString(BOARDFONT); break;
+ case Menu_Conf_Aspect_Font_Default: attr = wxU("Default"); break;
+ default: INCOMPLETE; break;
+ }
+
+ if (attr == wxU("Default"))
+ config.setFontDefault();
+ else
+ config.setFont(attr, config.ChooseFont(this, config.getFont(attr)));
+
+ UpdateFrames(AuxFrame::FORCE_REFRESH);
+}
+
+// ************************
+// MENU CONF BOARD COLOURS
+// ************************
+
+void
+MainFrame::OnMenuConfAspectBoardColour(wxCommandEvent& event)
+{
+ int id;
+ wxString attr;
+
+ id = event.GetId();
+ if (! GetMenuBar()->FindItem(id))
+ return;
+
+ switch (id)
+ {
+ case Menu_Conf_Aspect_BoardColour_Lines: attr =
wxString(BCOLOURLINES); break;
+ case Menu_Conf_Aspect_BoardColour_Wx2: attr =
wxString(BCOLOURWX2); break;
+ case Menu_Conf_Aspect_BoardColour_Wx3: attr =
wxString(BCOLOURWX3); break;
+ case Menu_Conf_Aspect_BoardColour_Lx2: attr =
wxString(BCOLOURLX2); break;
+ case Menu_Conf_Aspect_BoardColour_Lx3: attr =
wxString(BCOLOURLX3); break;
+ case Menu_Conf_Aspect_BoardColour_Background: attr =
wxString(BCOLOURBACKGROUND); break;
+ case Menu_Conf_Aspect_BoardColour_Letters: attr =
wxString(BCOLOURLETTERS); break;
+ case Menu_Conf_Aspect_BoardColour_TestLetters: attr =
wxString(BCOLOURTSTLETTERS); break;
+ case Menu_Conf_Aspect_BoardColour_TileBack: attr =
wxString(BTILEBACKGROUND); break;
+ case Menu_Conf_Aspect_BoardColour_TestTileBack: attr =
wxString(BTSTTILEBACKGROUND); break;
+ case Menu_Conf_Aspect_BoardColour_Default: attr = wxU("Default");
break;
+ default: INCOMPLETE; break;
+ }
+
+ if (attr == wxU("Default"))
+ config.setColourDefault();
+ else
+ config.setColour(attr, config.ChooseColour(this,
config.getColour(attr)));
+
+ UpdateFrames(AuxFrame::FORCE_REFRESH);
+}
+
+//**************************************************************************************
+// MENU QUIT
+//**************************************************************************************
+
+void
+MainFrame::OnMenuQuitApropos(wxCommandEvent& WXUNUSED(event))
+{
+ wxString msg;
+ // XXX: msg << wxT("Eliot\n© Antoine Fraboulet 1999-2004\n\n");
+ msg << wxT("Eliot\nCopyright Antoine Fraboulet 1999-2004\n\n");
+ msg << wxT("This program is free software; you can redistribute it and/or
modify\n");
+ msg << wxT("it under the terms of the GNU General Public License as
published by\n");
+ msg << wxT("the Free Software Foundation; either version 2 of the License,
or\n");
+ msg << wxT("(at your option) any later version.\n\n");
+ msg << wxT("Version ") << wxT(VERSION) << wxT("\n");
+ wxMessageBox(msg, wxT("A propos d'Eliot"), wxICON_INFORMATION | wxOK);
+}
+
+void
+MainFrame::OnMenuQuitConfirm(wxCommandEvent& WXUNUSED(event))
+{
+ Close(TRUE);
+}
+
+
+//**************************************************************************************
+// BUTTONS
+//**************************************************************************************
+
+void
+MainFrame::OnSetRack(wxCommandEvent& event)
+{
+ int id;
+ // TODO Game::set_rack_mode -> PlayedRack::set_rack_mode
+ Game::set_rack_mode mode = Game::RACK_NEW;
+ debug("OnSetRack ");
+ switch ((id = event.GetId()))
+ {
+ case Button_SetRack:
+ mode = Game::RACK_ALL;
+ debug("PlayedRack::RACK_ALL\n");
+ break;
+ case Button_SetNew:
+ mode = Game::RACK_NEW;
+ debug("PlayedRack::RACK_NEW\n");
+ break;
+ case Button_SetManual:
+ mode = Game::RACK_MANUAL;
+ debug("PlayedRack::RACK_MANUAL\n");
+ break;
+ default:
+ return;
+ }
+ SetRack(mode);
+}
+
+void
+MainFrame::OnSearch(wxCommandEvent& WXUNUSED(event))
+{
+ Search();
+}
+
+void
+MainFrame::OnTextEnter(wxCommandEvent& WXUNUSED(event))
+{
+ debug("MainFrame::OnTextEnter -> %s\n",(const
char*)rack->GetValue().mb_str());
+ SetRack(Game::RACK_MANUAL,rack->GetValue());
+ Search();
+}
+
+void
+MainFrame::OnPlay(wxCommandEvent& event)
+{
+ int dir = 1;
+ int id = event.GetId();
+ switch (id)
+ {
+ case Button_Play:
+ dir = 1;
+ break;
+ case Button_PlayBack:
+ dir = -1;
+ break;
+ default:
+ break;
+ }
+ Play(dir);
+}
+
+//*********************************
+// SPECIAL FRAMES
+//*********************************
+
+void
+MainFrame::InitFrames()
+{
+ debug("InitFrames start : \n");
+ if (m_game == NULL)
+ {
+ debug("m_game == NULL\n");
+ return;
+ }
+
+ for(int i=0 ; i < MAX_FRAME_ID; i++)
+ {
+ if (auxframes_ptr[i] != NULL)
+ {
+ debug(" delete frame %d\n",i);
+ delete auxframes_ptr[i];
+ }
+ }
+
+ auxframes_ptr[ ID_Frame_Verif ] = new VerifFrame (this, m_game->getDic());
+ debug("0 : Verif\n");
+ auxframes_ptr[ ID_Frame_Search ] = new SearchFrame(this, m_game->getDic());
+ debug("1 : Search\n");
+ auxframes_ptr[ ID_Frame_Plus1 ] = new Plus1Frame (this, m_game);
+ debug("2 : Plus1\n");
+ auxframes_ptr[ ID_Frame_Racc ] = new RaccFrame (this, m_game);
+ debug("3 : Racc\n");
+ auxframes_ptr[ ID_Frame_Benj ] = new BenjFrame (this, m_game);
+ debug("4 : Benj\n");
+ auxframes_ptr[ ID_Frame_Bag ] = new BagFrame (this, *m_game);
+ debug("5 : Bag\n");
+ auxframes_ptr[ ID_Frame_Board ] = new BoardFrame (this, *m_game);
+ debug("6 : Board\n");
+ auxframes_ptr[ ID_Frame_Game ] = new GameFrame (this, *m_game);
+ debug("7 : Game\n");
+#ifndef ENABLE_RESLIST_IN_MAIN
+ auxframes_ptr[ ID_Frame_Result ] = new ResultFrame(this, m_game);
+ debug("8 : Result\n");
+#endif
+
+ for (int i = MIN_FRAME_ID; i < MAX_FRAME_ID; i++)
+ {
+ if (auxframes_ptr[i] != NULL)
+ {
+ auxframes_ptr[i]->Reload();
+ debug("reload %d\n",i);
+ }
+ }
+ debug("InitFrames end ok.\n");
+}
+
+void
+MainFrame::OnMenuShowFrame(wxCommandEvent& event)
+{
+ int id;
+ id = event.GetId();
+
+ if (!GetMenuBar()->FindItem(id))
+ return;
+ id -= IDBASE;
+
+ if ((id < 0) || (id >= MAX_FRAME_ID))
+ {
+ INCOMPLETE;
+ return;
+ }
+
+ if (auxframes_ptr[id] == NULL)
+ {
+ debug("ShowFrame: auxframes_ptr[%d] == NULL\n", id);
+ return;
+ }
+ auxframes_ptr[id]->SwitchDisplay();
+ debug("ShowFrame: SwitchDisplay frame %d\n",id);
+}
+
+// *********************************
+// UPDATES
+// *********************************
+
+void
+MainFrame::UpdateFrames(AuxFrame::refresh_t force)
+{
+ for (int id = 0; id < MAX_FRAME_ID; id++)
+ {
+ if (auxframes_ptr[id])
+ {
+ auxframes_ptr[id]->Refresh(force);
+ }
+ }
+#ifdef ENABLE_RESLIST_IN_MAIN
+ if (reslist)
+ {
+ reslist->Refresh();
+ }
+#endif
+}
+
+void
+MainFrame::UpdateStatusBar()
+{
+ wxString text;
+ if (statusbar)
+ {
+ text = config.getDicName() + wxT(" ") + config.getTileName();
+ statusbar->SetStatusText(text, 0);
+
+ if (m_game)
+ {
+ text = wxT("");
+ text << wxT("coup:") << (m_game->getHistory().getSize() + 1) <<
wxT(" ");
+ text << wxT("points:") << (m_game->getCurrentPlayer().getPoints());
+ statusbar->SetStatusText(text, 1);
+ }
+ }
+}
+
+// *********************************
+// ACTIONS
+// *********************************
+
+// Can come from a
+// BUTTON ALL -> mode = Game::RACK_ALL, srack = empty
+// BUTTON NEW -> mode = Game::RACK_NEW, srack = empty
+// TEXT_ENTER -> mode = Game::RACK_MANUAL, srack = letters
+// Play -> mode = Game::RACK_MANUAL, srack = letters
+
+void
+MainFrame::SetRack(Game::set_rack_mode mode, wxString srack)
+{
+ int res = 0;
+ wxString msg;
+ bool check = config.getRackChecking();
+
+ std::wstring str = srack.c_str();
+ res = static_cast<Training*>(m_game)->setRack(mode, check, str);
+
+ switch (res)
+ {
+ case 0x00: /* ok */
+ debug("SetRack Ok :: ");
+ break;
+ case 0x01:
+ msg = wxT("Le sac ne contient pas assez de lettres\npour assurer
le tirage.");
+ wxMessageBox(msg, wxT("Correction du tirage"), wxICON_INFORMATION
| wxOK);
+ return;
+ case 0x02:
+ msg = wxT("Le tirage doit contenir au moins 2 consonnes et 2
voyelles.\n");
+ wxMessageBox(msg, wxT("Correction du tirage"), wxICON_INFORMATION
| wxOK);
+ return;
+ case 0x03:
+ msg = wxT("Le tirage doit contenir au moins 2 consonnes et 2
voyelles\n");
+ msg += wxT("mais le sac ne contient plus assez de lettres.\n\n");
+ wxMessageBox(msg, wxT("Correction du tirage"), wxICON_INFORMATION |
wxOK);
+ break;
+ default:
+ statusbar->SetStatusText(wxT("Le tirage a ete modifie
manuellement"), 0);
+ break;
+ }
+
+ std::wstring r = m_game->getCurrentPlayer().getCurrentRack().toString();
+ debug("MainFrame::SetRack : setvalue %ls\n",r.c_str());
+ rack->SetValue(wxU(r.c_str()));
+ UpdateFrames();
+ UpdateStatusBar();
+}
+
+void
+MainFrame::Search()
+{
+ ((Training*)m_game)->removeTestPlay();
+#ifdef ENABLE_RESLIST_IN_MAIN
+ reslist->Search();
+#else
+ if (auxframes_ptr[ ID_Frame_Result ])
+ {
+ ((ResultFrame*)(auxframes_ptr[ ID_Frame_Result ]))->Search();
+ }
+#endif
+ UpdateFrames();
+ UpdateStatusBar();
+}
+
+void
+MainFrame::Play(int n)
+{
+ ((Training*)m_game)->removeTestPlay();
+ if (n < 0)
+ {
+ debug("MainFrame::Play back %d\n",n);
+ m_game->back(- n);
+ }
+ else
+ {
+ int n=0;
+ debug("MainFrame::Play +%d\n",n);
+#ifdef ENABLE_RESLIST_IN_MAIN
+ n = reslist->GetSelected();
+#else
+ n = auxframes_ptr[ ID_Frame_Result ]->GetSelected();
+#endif
+ if (n > -1)
+ {
+ ((Training*)m_game)->playResult(n);
+ }
+ }
+ wxString r =
wxU(m_game->getCurrentPlayer().getCurrentRack().toString().c_str());
+ rack->SetValue(r);
+ UpdateFrames();
+ UpdateStatusBar();
+}
+
+void
+MainFrame::TestPlay(int n)
+{
+ ((Training*)m_game)->removeTestPlay();
+ ((Training*)m_game)->testPlay(n);
+ UpdateFrames();
+ UpdateStatusBar();
+}
+
+/****************************************************************/
+/****************************************************************/
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:
Index: eliot/wxwin/searchpanel.cc
diff -u /dev/null eliot/wxwin/searchpanel.cc:1.14.2.1
--- /dev/null Wed Dec 28 20:10:57 2005
+++ eliot/wxwin/searchpanel.cc Wed Dec 28 20:10:57 2005
@@ -0,0 +1,373 @@
+/* Eliot */
+/* Copyright (C) 1999 Antoine Fraboulet */
+/* */
+/* 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. */
+/* */
+/* 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. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+/**
+ * \file searchpanel.cc
+ * \brief Panel used in Eliot search window
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
+#include <string.h>
+#include "wx/wx.h"
+
+#include "ewx.h"
+#include "dic.h"
+#include "dic_search.h"
+#include "regexp.h"
+#include "searchpanel.h"
+#include "tile.h"
+#include "configdb.h"
+
+enum {
+ ID_PANEL_CROSS,
+ ID_PANEL_PLUS1,
+ ID_PANEL_REGEXP,
+
+ ID_LIST,
+ ID_TEXT,
+ ID_OPTION1,
+ ID_OPTION2,
+ ID_OPTION3
+};
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+class SimpleSearchPanel : public wxPanel
+{
+protected:
+ ConfigDB config;
+ Dictionary dic;
+ wxTextCtrl *t;
+ wxListBox *l;
+ wxBoxSizer *sizer;
+
+ int check_dic();
+ void check_end();
+ void panel_build();
+ virtual void panel_options() = 0;
+public:
+ SimpleSearchPanel(wxWindow* parent, int id, Dictionary d) :
wxPanel(parent,id) { dic = d; };
+ virtual void compute_char(wxCommandEvent&) {};
+ virtual void compute_enter(wxCommandEvent&) {};
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(SimpleSearchPanel, wxPanel)
+ EVT_TEXT (ID_TEXT , SimpleSearchPanel::compute_char)
+ EVT_TEXT_ENTER(ID_TEXT , SimpleSearchPanel::compute_enter)
+ EVT_TEXT_ENTER(ID_OPTION1, SimpleSearchPanel::compute_enter)
+ EVT_TEXT_ENTER(ID_OPTION2, SimpleSearchPanel::compute_enter)
+ EVT_TEXT_ENTER(ID_OPTION3, SimpleSearchPanel::compute_enter)
+END_EVENT_TABLE()
+
+void SimpleSearchPanel::panel_build()
+{
+ t = new
wxTextCtrl(this,ID_TEXT,wxT(""),wxPoint(0,0),wxSize(-1,-1),wxTE_PROCESS_ENTER);
+ t->SetFont(config.getFont(LISTFONT));
+ l = new wxListBox(this,ID_LIST);
+ l->SetFont(config.getFont(LISTFONT));
+ l->Show(TRUE);
+
+ sizer = new wxBoxSizer( wxVERTICAL );
+ sizer->Add(t, 0, wxEXPAND | wxALL, 0);
+ panel_options();
+ sizer->Add(l, 1, wxEXPAND | wxALL, 0);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizer);
+ sizer->Fit(this);
+ sizer->SetSizeHints(this);
+}
+
+int
+SimpleSearchPanel::check_dic()
+{
+ wxString msg = wxT("");
+ if (dic == NULL)
+ {
+ l->Clear();
+ msg << wxT("Pas de dictionnaire");
+ l->Append(msg);
+ return 0;
+ }
+ return 1;
+}
+
+void
+SimpleSearchPanel::check_end()
+{
+ if (l->GetCount() == 0)
+ {
+ l->Append(wxT("Aucun resultat"));
+ }
+}
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+class PCross : public SimpleSearchPanel
+{
+protected:
+ virtual void panel_options() {};
+public:
+ void compute_char(wxCommandEvent&) { };
+ void compute_enter(wxCommandEvent&);
+ PCross(wxWindow* parent, int id, Dictionary d) :
SimpleSearchPanel(parent,id,d) { panel_build(); };
+};
+
+void
+PCross::compute_enter(wxCommandEvent&)
+{
+ int i;
+ wchar_t rack[DIC_WORD_MAX];
+ wchar_t buff[RES_CROS_MAX][DIC_WORD_MAX];
+
+ if (!check_dic())
+ return;
+
+ if (t->GetValue().Len() >= DIC_WORD_MAX)
+ {
+ wxString msg = wxT("");
+// XXX: msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 <<
wxT(" lettres");
+ msg << wxT("La recherche est limitee a ") << DIC_WORD_MAX - 1 << wxT("
lettres");
+ l->Append(msg);
+ return;
+ }
+
+ wcsncpy(rack, t->GetValue().c_str(), DIC_WORD_MAX);
+ Dic_search_Cros(dic,rack,buff);
+
+ int resnum = 0;
+ wxString res[RES_CROS_MAX];
+ for(i=0; i < RES_CROS_MAX && buff[i][0]; i++)
+ res[resnum++] = wxU(buff[i]);
+ l->Set(resnum,res);
+ check_end();
+}
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+class PPlus1 : public SimpleSearchPanel
+{
+protected:
+ virtual void panel_options() {};
+public:
+ void compute_char(wxCommandEvent&) { };
+ void compute_enter(wxCommandEvent&);
+ PPlus1(wxWindow* parent, int id, Dictionary dic) :
SimpleSearchPanel(parent,id,dic) { panel_build(); };
+};
+
+void
+PPlus1::compute_enter(wxCommandEvent&)
+{
+ int i,j;
+ wchar_t rack[DIC_WORD_MAX];
+ wchar_t buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX];
+
+ if (!check_dic())
+ return;
+
+ if (t->GetValue().Len() >= DIC_WORD_MAX)
+ {
+ wxString msg = wxT("");
+// XXX: msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 <<
wxT(" lettres");
+ msg << wxT("La recherche est limitee a ") << DIC_WORD_MAX - 1 << wxT("
lettres");
+ l->Append(msg);
+ return;
+ }
+
+ wcsncpy(rack, t->GetValue().c_str(), DIC_WORD_MAX);
+ Dic_search_7pl1(dic,rack,buff,TRUE);
+
+ int resnum = 0;
+ wxString res[DIC_LETTERS*(RES_7PL1_MAX+1)];
+ for(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]);
+ }
+ l->Set(resnum,res);
+ check_end();
+}
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+class PRegExp : public SimpleSearchPanel
+{
+protected:
+ wxTextCtrl *omin;
+ wxTextCtrl *omax;
+ struct search_RegE_list_t llist;
+
+ virtual void build_letter_lists();
+ virtual void panel_options();
+public:
+ void compute_char(wxCommandEvent&) { };
+ void compute_enter(wxCommandEvent&);
+ PRegExp(wxWindow* parent, int id, Dictionary d) :
SimpleSearchPanel(parent,id,d) { panel_build(); };
+};
+
+void
+PRegExp::build_letter_lists()
+{
+ int i;
+ std::list<Tile> all_tiles;
+
+ memset (&llist,0,sizeof(llist));
+
+ llist.minlength = 1;
+ llist.maxlength = 15;
+
+ llist.symbl[0] = RE_ALL_MATCH;
+ llist.symbl[1] = RE_VOWL_MATCH;
+ llist.symbl[2] = RE_CONS_MATCH;
+ llist.symbl[3] = RE_USR1_MATCH;
+ llist.symbl[5] = RE_USR2_MATCH;
+
+ llist.valid[0] = 1; // all letters
+ llist.valid[1] = 1; // vowels
+ llist.valid[2] = 1; // consonants
+ llist.valid[3] = 0; // user defined list 1
+ llist.valid[4] = 0; // user defined list 2
+
+ for(i=0; i < DIC_SEARCH_REGE_LIST; i++)
+ {
+ memset(llist.letters[i],0,sizeof(llist.letters[i]));
+ }
+
+ const std::list<Tile>& allTiles = Tile::getAllTiles();
+ std::list<Tile>::const_iterator it;
+ for (it = allTiles.begin(); it != allTiles.end(); it++)
+ {
+ if (! it->isJoker() && ! it->isEmpty())
+ {
+ // all tiles
+ llist.letters[0][it->toCode()] = 1;
+ // vowels
+ if (it->isVowel())
+ {
+ llist.letters[1][it->toCode()] = 1;
+ }
+ // consonants
+ if (it->isConsonant())
+ {
+ llist.letters[2][it->toCode()] = 1;
+ }
+ }
+ }
+}
+
+void
+PRegExp::panel_options()
+{
+ wxStaticText *otmin;
+ wxStaticText *otmax;
+
+ otmin = new wxStaticText(this,wxID_ANY,wxT("Longueur min."));
+ omin = new wxTextCtrl(this,ID_OPTION1,wxT(
"1"),wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
+ otmax = new wxStaticText(this,wxID_ANY,wxT("max."));
+ omax = new
wxTextCtrl(this,ID_OPTION2,wxT("15"),wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
+
+ wxBoxSizer *s = new wxBoxSizer( wxHORIZONTAL );
+ s->Add(otmin, 0, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, 4);
+ s->Add(omin , 1, wxALIGN_CENTRE_VERTICAL, 0);
+ s->Add(otmax, 0, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, 4);
+ s->Add(omax , 1, wxALIGN_CENTRE_VERTICAL, 0);
+ sizer->Add(s, 0, wxEXPAND | wxALL, 1);
+}
+
+
+#define DIC_RE_MAX (3*DIC_WORD_MAX) // yes, it's 3
+
+void
+PRegExp::compute_enter(wxCommandEvent&)
+{
+ wchar_t re[DIC_RE_MAX];
+ wchar_t buff[RES_REGE_MAX][DIC_WORD_MAX];
+
+ if (!check_dic())
+ return;
+
+ build_letter_lists();
+ wcsncpy(re, t->GetValue().c_str(),DIC_RE_MAX);
+ debug("PRegExp::compute_enter for %ls",re);
+
+ int lmin = atoi((const char*)omin->GetValue().mb_str());
+ int lmax = atoi((const char*)omax->GetValue().mb_str());
+ if (lmax <= (DIC_WORD_MAX - 1) && lmin >= 1 && lmin <= lmax)
+ {
+ llist.minlength = lmin;
+ llist.maxlength = lmax;
+ debug(" length %d,%d",lmin,lmax);
+ }
+ else
+ {
+ debug(" bad length -%s,%s-",
+ (const char*)omin->GetValue().mb_str(),
+ (const char*)omax->GetValue().mb_str());
+ }
+ debug("\n");
+
+ Dic_search_RegE(dic,re,buff,&llist);
+
+ int resnum = 0;
+ wxString res[RES_REGE_MAX];
+ for(int i=0; i < RES_REGE_MAX && buff[i][0]; i++)
+ res[resnum++] = wxU(buff[i]);
+
+ l->Set(resnum,res);
+ check_end();
+}
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+SearchPanel::SearchPanel(wxFrame *parent, Dictionary dic) :
+ wxNotebook(parent, -1)
+{
+ AddPage(new PCross (this,ID_PANEL_CROSS ,dic),wxT("Mots croises"));
+ AddPage(new PPlus1 (this,ID_PANEL_PLUS1 ,dic),wxT("Plus 1"));
+ AddPage(new PRegExp(this,ID_PANEL_REGEXP,dic),wxT("Exp. Rationnelle"));
+ SetSelection(2);
+}
+
+SearchPanel::~SearchPanel()
+{
+}
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+
+/// Local Variables:
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/wxwin auxframes.cc auxframes.h gfxresult.... [multibyte],
eliot-dev <=