2004-04-08 11:43:06 +02:00
|
|
|
|
/* Eliot */
|
|
|
|
|
/* Copyright (C) 1999 Antoine Fraboulet */
|
|
|
|
|
/* Antoine.Fraboulet@free.fr */
|
|
|
|
|
/* */
|
|
|
|
|
/* This program is free software; you can redistribute it and/or modify */
|
|
|
|
|
/* it under the terms of the GNU General Public License as published by */
|
|
|
|
|
/* the Free Software Foundation; either version 2 of the License, or */
|
|
|
|
|
/* (at your option) any later version. */
|
|
|
|
|
/* */
|
|
|
|
|
/* This program is distributed in the hope that it will be useful, */
|
|
|
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
|
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
|
|
|
/* GNU General Public License for more details. */
|
|
|
|
|
/* */
|
|
|
|
|
/* You should have received a copy of the GNU General Public License */
|
|
|
|
|
/* along with this program; if not, write to the Free Software */
|
2005-10-23 16:53:42 +02:00
|
|
|
|
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2005-01-01 16:42:55 +01:00
|
|
|
|
#include "wx/sizer.h"
|
|
|
|
|
#include "wx/button.h"
|
|
|
|
|
#include "wx/intl.h"
|
|
|
|
|
|
|
|
|
|
#include "wx/clipbrd.h"
|
|
|
|
|
#include "wx/dataobj.h"
|
|
|
|
|
|
2004-04-08 11:43:06 +02:00
|
|
|
|
#include "ewx.h"
|
|
|
|
|
|
|
|
|
|
#include "dic.h"
|
|
|
|
|
#include "dic_search.h"
|
2005-03-29 10:22:55 +02:00
|
|
|
|
#include "training.h"
|
2004-04-08 11:43:06 +02:00
|
|
|
|
#include "game.h"
|
|
|
|
|
|
|
|
|
|
#include "configdb.h"
|
|
|
|
|
#include "auxframes.h"
|
|
|
|
|
#include "mainframe.h"
|
|
|
|
|
#include "searchpanel.h"
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* AUXFRAME */
|
|
|
|
|
/****************************************************************/
|
2005-01-01 16:42:55 +01:00
|
|
|
|
|
2004-04-08 11:43:06 +02:00
|
|
|
|
AuxFrame::AuxFrame(wxFrame* parent, int _id, wxString _name, wxString _classname):
|
2005-02-05 12:14:56 +01:00
|
|
|
|
wxFrame(parent, -1, wxU("Eliot: ") + _name, wxPoint(-1, -1), wxSize(-1, -1),
|
|
|
|
|
wxRESIZE_BORDER | wxCAPTION | wxFRAME_FLOAT_ON_PARENT, _classname)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
|
|
|
|
frameid = (frames_id_t)_id;
|
|
|
|
|
name = _name;
|
|
|
|
|
classname = _classname;
|
|
|
|
|
show = config.getFrameShow(classname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AuxFrame::~AuxFrame()
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
wxPoint p = GetPosition();
|
|
|
|
|
wxSize s = GetClientSize();
|
|
|
|
|
config.setFramePos(classname, p);
|
|
|
|
|
config.setFrameSize(classname, s);
|
|
|
|
|
config.setFrameShow(classname, show);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
AuxFrame::SwitchDisplay()
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (show == 0)
|
2005-01-01 16:42:55 +01:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Show(TRUE);
|
|
|
|
|
Raise();
|
|
|
|
|
show = 1;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
2005-02-05 12:14:56 +01:00
|
|
|
|
else
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Show(FALSE);
|
|
|
|
|
show = 0;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
AuxFrame::Reload()
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
#define MINW 50
|
|
|
|
|
#define MINH 50
|
2004-06-20 22:00:09 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
wxSize size;
|
|
|
|
|
Move(config.getFramePos(classname));
|
|
|
|
|
size = config.getFrameSize(classname);
|
2004-06-20 22:00:09 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (size.GetWidth() < MINW)
|
|
|
|
|
size.SetWidth(MINW);
|
|
|
|
|
if (size.GetHeight() < MINH)
|
|
|
|
|
size.SetHeight(MINH);
|
2005-01-01 16:42:55 +01:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
SetClientSize(size);
|
|
|
|
|
Refresh();
|
|
|
|
|
if (show)
|
|
|
|
|
{
|
|
|
|
|
Show(FALSE);
|
|
|
|
|
Show(TRUE);
|
|
|
|
|
}
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* BOARD FRAME */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
BoardFrame::BoardFrame(wxFrame* parent, Game& iGame):
|
|
|
|
|
AuxFrame(parent, ID_Frame_Board, wxT("Grille"), FRAMEBOARD)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
BoardFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (force == REFRESH)
|
|
|
|
|
board->Refresh(BOARD_REFRESH);
|
|
|
|
|
else
|
|
|
|
|
board->Refresh(BOARD_FORCE_REFRESH);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* BAG FRAME */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
BagFrame::BagFrame(wxFrame* parent, Game& iGame):
|
|
|
|
|
AuxFrame(parent, ID_Frame_Bag, wxT("sac"), FRAMEBAG),
|
|
|
|
|
m_game(iGame)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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"));
|
|
|
|
|
|
|
|
|
|
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
|
sizer->Add(tiles, 1, wxEXPAND | wxALL, 1);
|
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
|
SetSizer(sizer);
|
|
|
|
|
sizer->Fit(this);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
BagFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
2005-04-19 18:20:24 +02:00
|
|
|
|
int index;
|
2005-02-05 12:14:56 +01:00
|
|
|
|
wxString buf;
|
|
|
|
|
wxChar format[] = wxT("%c:%2d");
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
tiles->ClearAll();
|
2005-01-01 16:42:55 +01:00
|
|
|
|
|
2005-04-19 18:20:24 +02:00
|
|
|
|
const list<Tile>& allTiles = Tile::getAllTiles();
|
|
|
|
|
list<Tile>::const_iterator it;
|
|
|
|
|
for (index = 0, it = allTiles.begin(); it != allTiles.end(); index++, it++)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-11-05 00:26:03 +01:00
|
|
|
|
buf.Printf(format, it->toChar(), m_game.getBag().in(*it));
|
2005-04-19 18:20:24 +02:00
|
|
|
|
tiles->InsertItem(index,buf);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* RECHERCHE */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
SearchFrame::SearchFrame(wxFrame *parent, Dictionary _dic):
|
2005-02-05 12:14:56 +01:00
|
|
|
|
AuxFrame(parent, ID_Frame_Search, wxT("recherche"), FRAMESEARCH)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
panel = new SearchPanel(this, _dic);
|
|
|
|
|
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
|
sizer->Add(panel, 1, wxEXPAND, 0);
|
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
|
SetSizer(sizer);
|
|
|
|
|
sizer->Fit(this);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
SearchFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* VERIF FRAME */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Word_Id,
|
|
|
|
|
Result_Id,
|
2004-04-08 11:43:06 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(VerifFrame, AuxFrame)
|
|
|
|
|
EVT_TEXT(Word_Id, VerifFrame::OnText)
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
VerifFrame::VerifFrame(wxFrame* parent, Dictionary _dic):
|
2005-02-05 12:14:56 +01:00
|
|
|
|
AuxFrame(parent, ID_Frame_Verif, wxT("v<EFBFBD>rification"), FRAMEVERIF)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
dic = _dic;
|
|
|
|
|
word = new wxTextCtrl(this, Word_Id, wxT(""));
|
|
|
|
|
word->SetFont(config.getFont(LISTFONT));
|
|
|
|
|
word->SetToolTip(wxT("Mot <20> v<>rifier"));
|
|
|
|
|
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);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
VerifFrame::verif()
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (dic == NULL)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
result->SetLabel(wxT("pas de dictionnaire"));
|
|
|
|
|
return;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (Dic_search_word(dic, word->GetValue().mb_str()))
|
|
|
|
|
result->SetLabel(wxT("existe"));
|
|
|
|
|
else
|
|
|
|
|
result->SetLabel(wxT("n'existe pas"));
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
VerifFrame::OnText(wxCommandEvent&)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
verif();
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
VerifFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** *******************************************************************
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** ********************************************************************/
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* AUXFRAMELIST */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
ListBoxID,
|
|
|
|
|
ButtonCopyID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(AuxFrameList, AuxFrame)
|
2005-02-05 12:14:56 +01:00
|
|
|
|
EVT_BUTTON (ButtonCopyID , AuxFrameList::OnCopy)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString _classname):
|
|
|
|
|
AuxFrame(parent, _id, _name, _classname)
|
|
|
|
|
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
AuxFrameList::OnCopy(wxCommandEvent& event)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
wxString textdata;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (wxTheClipboard->Open())
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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();
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
AuxFrameList::Waiting()
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
listbox->Clear();
|
|
|
|
|
listbox->Show(TRUE);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* PLUS1 FRAME */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Plus1Frame::Plus1Frame(wxFrame* parent, Game& iGame):
|
|
|
|
|
AuxFrameList(parent, ID_Frame_Plus1, wxT("Tirage + 1"), FRAMEPLUS1),
|
|
|
|
|
m_game(iGame)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
m_rack[0] = '\0';
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Plus1Frame::Refresh(refresh_t force)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
int i, j;
|
2005-03-29 09:00:39 +02:00
|
|
|
|
string rack2;
|
2005-04-09 21:16:56 +02:00
|
|
|
|
char buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX];
|
2005-01-01 16:42:55 +01:00
|
|
|
|
|
2005-04-02 23:21:30 +02:00
|
|
|
|
rack2 = m_game.getPlayerRack(0);
|
2005-01-01 16:42:55 +01:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
if (m_rack == rack2)
|
|
|
|
|
return;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
m_rack = rack2;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Waiting();
|
|
|
|
|
Dic_search_7pl1(m_game.getDic(), m_rack.c_str(), buff, config.getJokerPlus1());
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
int resnum = 0;
|
2005-04-09 21:16:56 +02:00
|
|
|
|
wxString res[DIC_LETTERS*(RES_7PL1_MAX+1)];
|
2005-03-29 10:05:18 +02:00
|
|
|
|
// wxString(wxT) added for clean compile with wx2.4
|
|
|
|
|
res[resnum++] = wxString(wxT("Tirage: ")) + wxString(wxU(m_rack.c_str()));
|
2005-04-09 21:16:56 +02:00
|
|
|
|
for (i = 0; i < DIC_LETTERS; i++)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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]);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
2005-02-05 12:14:56 +01:00
|
|
|
|
listbox->Set(resnum, res);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* BENJAMINS */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
BenjFrame::BenjFrame(wxFrame* parent, Game& iGame, wxListCtrl* _results):
|
|
|
|
|
AuxFrameList(parent, ID_Frame_Benj, wxT("benjamins"), FRAMEBENJ),
|
|
|
|
|
m_game(iGame)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
results = _results;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
BenjFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
if (item < 0)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
listbox->Clear();
|
|
|
|
|
return;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Waiting();
|
2005-03-29 10:22:55 +02:00
|
|
|
|
Dic_search_Benj(m_game.getDic(),
|
|
|
|
|
((Training&)m_game).getSearchedWord(item).c_str(), wordlist);
|
2005-02-05 12:14:56 +01:00
|
|
|
|
|
|
|
|
|
int resnum = 0;
|
|
|
|
|
wxString res[RES_BENJ_MAX];
|
|
|
|
|
for (i = 0; (i < RES_BENJ_MAX) && (wordlist[i][0]); i++)
|
|
|
|
|
res[resnum++] = wxU(wordlist[i]);
|
|
|
|
|
listbox->Set(resnum, res);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* RACC FRAME */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
RaccFrame::RaccFrame(wxFrame* parent, Game& iGame, wxListCtrl* _results):
|
|
|
|
|
AuxFrameList(parent, ID_Frame_Racc, wxT("raccords"), FRAMERACC),
|
|
|
|
|
m_game(iGame)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
results = _results;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
RaccFrame::Refresh(refresh_t force)
|
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
if (item < 0)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
listbox->Clear();
|
|
|
|
|
return;
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
Waiting();
|
2005-03-29 10:22:55 +02:00
|
|
|
|
Dic_search_Racc(m_game.getDic(),
|
|
|
|
|
((Training&)m_game).getSearchedWord(item).c_str(), wordlist);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
|
int resnum = 0;
|
|
|
|
|
wxString res[RES_RACC_MAX];
|
|
|
|
|
for (i = 0; (i < RES_RACC_MAX) && (wordlist[i][0]); i++)
|
2004-04-08 11:43:06 +02:00
|
|
|
|
{
|
2005-02-05 12:14:56 +01:00
|
|
|
|
res[resnum++] = wxU(wordlist[i]);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
2005-02-05 12:14:56 +01:00
|
|
|
|
listbox->Set(resnum, res);
|
2004-04-08 11:43:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/****************************************************************/
|