Compilation fixes for the Unicode build of wxWidgets

This commit is contained in:
Olivier Teulière 2005-01-01 15:42:55 +00:00
parent f8074f5e02
commit f6157c71b9
13 changed files with 542 additions and 523 deletions

View file

@ -57,7 +57,7 @@ Dans les 2 cas, les
- pour la cross-compilation depuis GNU/Linux, configurer avec la ligne
de commande suivante :
CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ \
./configure --host=i586-mingx32msvc --build=i386-linux \
./configure --host=i586-mingw32msvc --build=i386-linux \
--with-wx-config=/path/to/wx-config
en prenant soin d'indiquer le chemin correct vers le fichier
'wx-config' de l'installation de wxWindows.

View file

@ -16,11 +16,18 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: auxframes.cc,v 1.3 2004/06/22 21:04:08 ipkiss Exp $ */
/* $Id: auxframes.cc,v 1.4 2005/01/01 15:42:55 ipkiss Exp $ */
#include <iostream>
using namespace std;
#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"
@ -32,19 +39,12 @@ using namespace std;
#include "mainframe.h"
#include "searchpanel.h"
#include "wx/sizer.h"
#include "wx/button.h"
#include "wx/intl.h"
#include "wx/clipbrd.h"
#include "wx/dataobj.h"
/****************************************************************/
/* AUXFRAME */
/****************************************************************/
AuxFrame::AuxFrame(wxFrame* parent, int _id, wxString _name, wxString _classname):
wxFrame(parent, -1, wxString("Eliot: ") + _name, wxPoint(-1,-1), wxSize(-1,-1),
wxFrame(parent, -1, wxT("Eliot: ") + _name, wxPoint(-1,-1), wxSize(-1,-1),
wxRESIZE_BORDER | wxCAPTION | wxFRAME_FLOAT_ON_PARENT, _classname)
{
frameid = (frames_id_t)_id;
@ -66,7 +66,7 @@ void
AuxFrame::SwitchDisplay()
{
if (show == 0)
{
{
Show(TRUE);
Raise();
show = 1;
@ -92,7 +92,7 @@ AuxFrame::Reload()
size.SetWidth(MINW);
if (size.GetHeight() < MINH)
size.SetHeight(MINH);
SetClientSize(size);
Refresh();
if (show) { Show(FALSE); Show(TRUE); }
@ -103,7 +103,7 @@ AuxFrame::Reload()
/****************************************************************/
BoardFrame::BoardFrame(wxFrame* parent, Game _game):
AuxFrame(parent, ID_Frame_Board, "Grille", FRAMEBOARD)
AuxFrame(parent, ID_Frame_Board, wxT("Grille"), FRAMEBOARD)
{
board = new GfxBoard(this,_game);
@ -129,14 +129,14 @@ BoardFrame::Refresh(refresh_t force)
/****************************************************************/
BagFrame::BagFrame(wxFrame* parent, Game _game):
AuxFrame(parent, ID_Frame_Bag, "sac", FRAMEBAG)
AuxFrame(parent, ID_Frame_Bag, wxT("sac"), FRAMEBAG)
{
game = _game;
tiles = new wxListCtrl(this,-1);
tiles->SetSingleStyle(wxLC_LIST);
tiles->SetColumnWidth(0,wxLIST_AUTOSIZE);
tiles->SetFont(config.getFont(LISTFONT));
tiles->SetToolTip("Lettre, nombre restant");
tiles->SetToolTip(wxT("Lettre, nombre restant"));
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add(tiles, 1, wxEXPAND | wxALL, 1);
@ -150,14 +150,14 @@ BagFrame::Refresh(refresh_t force)
{
char c;
wxString buf;
wxChar format[] = "%c:%2d";
wxChar format[] = wxT("%c:%2d");
tiles->ClearAll();
buf.Printf(format,'?',Game_getcharinbag(game,'?'),0);
tiles->InsertItem(0,buf);
for(c = 'A'; c <= 'Z'; c++)
for(c = 'A'; c <= 'Z'; c++)
{
buf.Printf(format,c,Game_getcharinbag(game,c));
tiles->InsertItem(1 + c - 'A',buf);
@ -169,7 +169,7 @@ BagFrame::Refresh(refresh_t force)
/****************************************************************/
SearchFrame::SearchFrame(wxFrame *parent, Dictionary _dic):
AuxFrame(parent,ID_Frame_Search,"recherche",FRAMESEARCH)
AuxFrame(parent,ID_Frame_Search, wxT("recherche"),FRAMESEARCH)
{
panel = new SearchPanel(this, _dic);
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
@ -199,13 +199,13 @@ BEGIN_EVENT_TABLE(VerifFrame, AuxFrame)
END_EVENT_TABLE()
VerifFrame::VerifFrame(wxFrame* parent, Dictionary _dic):
AuxFrame(parent, ID_Frame_Verif, "vérification",FRAMEVERIF)
AuxFrame(parent, ID_Frame_Verif, wxT("vérification"),FRAMEVERIF)
{
dic = _dic;
word = new wxTextCtrl(this,Word_Id,wxString(""));
word = new wxTextCtrl(this,Word_Id,wxT(""));
word->SetFont(config.getFont(LISTFONT));
word->SetToolTip("Mot à vérifier");
result = new wxStaticText(this,Result_Id,wxString(""));
word->SetToolTip(wxT("Mot à 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);
@ -222,13 +222,13 @@ VerifFrame::verif()
{
if (dic == NULL)
{
result->SetLabel(wxString("pas de dictionnaire"));
result->SetLabel(wxT("pas de dictionnaire"));
return;
}
if (Dic_search_word(dic,(const char*) word->GetValue()))
result->SetLabel(wxString("existe"));
if (Dic_search_word(dic, word->GetValue().mb_str()))
result->SetLabel(wxT("existe"));
else
result->SetLabel(wxString("n'existe pas"));
result->SetLabel(wxT("n'existe pas"));
}
void
@ -273,7 +273,7 @@ AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString _c
listbox->SetToolTip(name);
sizer_v->Add(listbox, 1, wxEXPAND | wxALL, 1);
button = new wxButton(this,ButtonCopyID,"Copier",wxPoint(0,0),wxSize(-1,-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 );
@ -292,13 +292,13 @@ AuxFrameList::OnCopy(wxCommandEvent& event)
if (wxTheClipboard->Open())
{
textdata = "";
textdata = wxT("");
for(int i=0; i < listbox->GetCount(); i++)
{
textdata << listbox->GetString(i) << "\n";
textdata << listbox->GetString(i) << wxT("\n");
}
wxTextDataObject* ptr = new wxTextDataObject(textdata);
wxTheClipboard->AddData(ptr);
wxTheClipboard->AddData(ptr);
wxTheClipboard->Close();
}
}
@ -315,7 +315,7 @@ AuxFrameList::Waiting()
/****************************************************************/
Plus1Frame::Plus1Frame(wxFrame* parent, Game _game):
AuxFrameList(parent,ID_Frame_Plus1,wxString("Tirage + 1"),FRAMEPLUS1)
AuxFrameList(parent,ID_Frame_Plus1,wxT("Tirage + 1"),FRAMEPLUS1)
{
rack[0] = '\0';
game = _game;
@ -330,26 +330,26 @@ Plus1Frame::Refresh(refresh_t force)
if (Game_getdic(game) == NULL)
return;
Game_getplayedrack(game,Game_getnrounds(game),rack2);
if (strcmp(rack,rack2) == 0)
return;
strcpy(rack,rack2);
Waiting();
Dic_search_7pl1(Game_getdic(game),rack,buff,config.getJokerPlus1());
Dic_search_7pl1(Game_getdic(game),rack,buff,config.getJokerPlus1());
int resnum = 0;
wxString res[LETTERS*(RES_7PL1_MAX+1)];
res[resnum++] = wxString("Tirage: ") + wxString(rack);
res[resnum++] = wxString(wxT("Tirage: ")) + wxU(rack);
for(i=0; i < LETTERS; i++)
{
if (i && buff[i][0][0])
res[resnum++] = wxString("+") + wxString((char)(i+'A'-1));
res[resnum++] = wxString(wxT("+")) + (wxChar)(i+'A'-1);
for(j=0; j < RES_7PL1_MAX && buff[i][j][0]; j++)
res[resnum++] = wxString(" ") + wxString(buff[i][j]);
res[resnum++] = wxString(wxT(" ")) + wxU(buff[i][j]);
}
listbox->Set(resnum,res);
}
@ -359,7 +359,7 @@ Plus1Frame::Refresh(refresh_t force)
/****************************************************************/
BenjFrame::BenjFrame(wxFrame* parent,Game _game, wxListCtrl* _results):
AuxFrameList(parent,ID_Frame_Benj,wxString("benjamins"), FRAMEBENJ)
AuxFrameList(parent,ID_Frame_Benj,wxT("benjamins"), FRAMEBENJ)
{
game = _game;
results = _results;
@ -390,7 +390,7 @@ BenjFrame::Refresh(refresh_t force)
int resnum = 0;
wxString res[RES_BENJ_MAX];
for(i=0; (i < RES_BENJ_MAX) && (wordlist[i][0]); i++)
res[resnum++] = wxString(wordlist[i]);
res[resnum++] = wxU(wordlist[i]);
listbox->Set(resnum,res);
}
@ -400,7 +400,7 @@ BenjFrame::Refresh(refresh_t force)
/****************************************************************/
RaccFrame::RaccFrame(wxFrame* parent,Game _game, wxListCtrl* _results):
AuxFrameList(parent,ID_Frame_Racc,wxString("raccords"), FRAMERACC)
AuxFrameList(parent,ID_Frame_Racc,wxT("raccords"), FRAMERACC)
{
game = _game;
results = _results;
@ -432,7 +432,7 @@ RaccFrame::Refresh(refresh_t force)
wxString res[RES_RACC_MAX];
for(i=0; (i < RES_RACC_MAX) && (wordlist[i][0]); i++)
{
res[resnum++] = wxString(wordlist[i]);
res[resnum++] = wxU(wordlist[i]);
}
listbox->Set(resnum,res);
}

View file

@ -16,7 +16,9 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: confdimdlg.cc,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: confdimdlg.cc,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
#include "wx/printdlg.h"
#include "ewx.h"
@ -27,8 +29,6 @@
#include "printout.h"
#include "confdimdlg.h"
#include "wx/printdlg.h"
enum {
Button_Ok,
Button_Cancel,
@ -60,13 +60,13 @@ max(int i,int j)
ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
: wxDialog(parent,-1,wxString("Eliot : Impression"))
: wxDialog(parent,-1,wxT("Eliot : Impression"))
{
int i;
wxString choices[3];
choices[0] = "gauche";
choices[1] = "centré";
choices[2] = "droite";
choices[0] = wxT("gauche");
choices[1] = wxT("centré");
choices[2] = wxT("droite");
wxStaticText* Hcomment[5];
wxRect Hcommentrect[5];
wxRect Htitlerect[5];
@ -78,10 +78,10 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
wxStaticText* Tunit[5];
wxRect Tjustrect[5];
wxRect Tspacesrect[5];
printdata = pd;
pagesetupdata = psd;
//
// Head
// Hcomment Htitle Hjust Hspaces
@ -106,7 +106,7 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
// ------------
// Text Section
// ------------
// ------------
#define TFONT wxPoint(HSPACE, Hcommentrect[4].GetBottom() + 2*VSPACE)
#define TCOMMENTY(i) (i==0 ? bfonttextrect.GetBottom() + VSPACE : \
VSPACE + Tcommentrect[i-1].GetBottom())
@ -118,74 +118,74 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
#define ESPSIZE wxSize(spacerect.GetRight() - spacerect.GetLeft(),-1)
wxStaticText* justif = new wxStaticText(this,-1,"Justification",wxPoint(0,0));
wxStaticText* justif = new wxStaticText(this,-1,wxT("Justification"),wxPoint(0,0));
wxRect justifrect = justif->GetRect();
wxStaticText* space = new wxStaticText(this,-1,"Espacement",wxPoint(0,0));
wxStaticText* space = new wxStaticText(this,-1,wxT("Espacement"),wxPoint(0,0));
wxRect spacerect = space->GetRect();
// heading, first part
bfontheader = new wxButton(this,Button_FontHeader,"Caractères",HFONT);
bfontheader = new wxButton(this,Button_FontHeader,wxT("Caractères"),HFONT);
wxRect bfontheadrect = bfontheader->GetRect();
for(i=0; i<5; i++)
for(i=0; i<5; i++)
{
wxString txt;
txt << "Titre colonne " << (i+1);
txt << wxT("Titre colonne ") << (i+1);
Hcomment[i] = new wxStaticText(this,-1,txt,HCOMMENT(i));
Hcommentrect[i] = Hcomment[i]->GetRect();
}
// text, first part
bfonttext = new wxButton(this,Button_FontText,"Caractères",TFONT);
bfonttext = new wxButton(this,Button_FontText,wxT("Caractères"),TFONT);
wxRect bfonttextrect = bfonttext->GetRect();
for(i=0; i<5; i++)
for(i=0; i<5; i++)
{
wxString txt;
txt << "Texte colonne " << (i+1);
txt << wxT("Texte colonne ") << (i+1);
Tcomment[i] = new wxStaticText(this,-1,txt,TCOMMENT(i),wxSize(-1,-1));
Tcommentrect[i] = Tcomment[i]->GetRect();
}
// heading, second part
for(i=0; i<5; i++)
for(i=0; i<5; i++)
{
Htitle[i] = new wxTextCtrl(this,-1,"",HTITLE(i),wxSize(100,-1));
Htitle[i] = new wxTextCtrl(this,-1,wxT(""),HTITLE(i),wxSize(100,-1));
Htitlerect[i] = Htitle[i]->GetRect();
Htitle[i]->SetToolTip("Texte du titre de la colonne");
Htitle[i]->SetToolTip(wxT("Texte du titre de la colonne"));
Hjust[i] = new wxChoice(this,-1,HJUST(i),wxSize(-1,-1),3,choices);
Hjustrect[i] = Hjust[i]->GetRect();
Hjust[i]->SetToolTip("Justification du titre de la colonne");
Hjust[i]->SetToolTip(wxT("Justification du titre de la colonne"));
Hspaces[i] = new wxTextCtrl(this,-1,"00",HSPACES(i),ESPSIZE);
Hspaces[i] = new wxTextCtrl(this,-1,wxT("00"),HSPACES(i),ESPSIZE);
Hspacesrect[i] = Hspaces[i]->GetRect();
Hspaces[i]->SetToolTip("Espacement des caractères du titre");
Hspaces[i]->SetToolTip(wxT("Espacement des caractères du titre"));
}
// text, second part
for(i=0; i<5; i++)
for(i=0; i<5; i++)
{
Tdim[i] = new wxTextCtrl(this,-1,"",TDIM(i),wxSize(50,-1));
Tdim[i] = new wxTextCtrl(this,-1,wxT(""),TDIM(i),wxSize(50,-1));
Tdimrect[i] = Tdim[i]->GetRect();
Tdim[i]->SetToolTip("Dimension intérieure de la colonne (en mm)");
Tdim[i]->SetToolTip(wxT("Dimension intérieure de la colonne (en mm)"));
Tunit[i] = new wxStaticText(this,-1,"mm",
Tunit[i] = new wxStaticText(this,-1,wxT("mm"),
wxPoint(Tdimrect[i].GetRight()+
HSPACE,TCOMMENTY(i)+2),
wxSize(-1,-1));
Tjust[i] = new wxChoice(this,-1,TJUST(i),wxSize(-1,-1),3,choices);
Tjustrect[i] = Tjust[i]->GetRect();
Tjust[i]->SetToolTip("Justification du texte de la colonne");
Tjust[i]->SetToolTip(wxT("Justification du texte de la colonne"));
Tspaces[i] = new wxTextCtrl(this,-1,"",TSPACES(i),ESPSIZE);
Tspaces[i] = new wxTextCtrl(this,-1,wxT(""),TSPACES(i),ESPSIZE);
Tspacesrect[i] = Tspaces[i]->GetRect();
Tspaces[i]->SetToolTip("Espacement des caractères");
Tspaces[i]->SetToolTip(wxT("Espacement des caractères"));
}
justif->Move(wxPoint(Tjustrect[0].GetLeft(),bfontheadrect.GetBottom()
justif->Move(wxPoint(Tjustrect[0].GetLeft(),bfontheadrect.GetBottom()
- (justifrect.GetBottom() - justifrect.GetTop())));
justifrect = justif->GetRect();
space->Move(wxPoint(Tspacesrect[0].GetLeft(),justifrect.GetTop()));
@ -233,45 +233,45 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
#define DIM wxSize(30,-1)
// Left part
wxStaticText* dyh1text = new wxStaticText(this,-1,"Titre esp. sup.",DYH1COMMENT,wxSize(-1,-1));
wxStaticText* dyh1text = new wxStaticText(this,-1,wxT("Titre esp. sup."),DYH1COMMENT,wxSize(-1,-1));
wxRect dyh1textrect = dyh1text->GetRect();
wxStaticText* dyt1text = new wxStaticText(this,-1,"Texte esp. sup.",DYT1COMMENT,wxSize(-1,-1));
wxStaticText* dyt1text = new wxStaticText(this,-1,wxT("Texte esp. sup."),DYT1COMMENT,wxSize(-1,-1));
wxRect dyt1textrect = dyt1text->GetRect();
wxStaticText* dxbegintext = new wxStaticText(this,-1,"Texte esp. gauche.",DXBEGINCOMMENT,wxSize(-1,-1));
wxStaticText* dxbegintext = new wxStaticText(this,-1,wxT("Texte esp. gauche."),DXBEGINCOMMENT,wxSize(-1,-1));
wxRect dxbegintextrect = dxbegintext->GetRect();
dyh1 = new wxTextCtrl(this,-1,"00",DYH1TEXT,DIM);
dyh1 = new wxTextCtrl(this,-1,wxT("00"),DYH1TEXT,DIM);
wxRect dyh1rect = dyh1->GetRect();
wxStaticText* dyh1mm = new wxStaticText(this,-1,"mm",DYH1UNIT,wxSize(-1,-1));
wxStaticText* dyh1mm = new wxStaticText(this,-1,wxT("mm"),DYH1UNIT,wxSize(-1,-1));
wxRect dyh1mmrect = dyh1mm->GetRect();
dyt1 = new wxTextCtrl(this,-1,"00",DYT1TEXT,DIM);
dyt1 = new wxTextCtrl(this,-1,wxT("00"),DYT1TEXT,DIM);
wxRect dyt1rect = dyt1->GetRect();
wxStaticText* dyt1mm = new wxStaticText(this,-1,"mm",DYT1UNIT,wxSize(-1,-1));
wxStaticText* dyt1mm = new wxStaticText(this,-1,wxT("mm"),DYT1UNIT,wxSize(-1,-1));
wxRect dyt1mmrect = dyt1mm->GetRect();
dxbegin = new wxTextCtrl(this,-1,"00",DXBEGINTEXT,DIM);
dxbegin = new wxTextCtrl(this,-1,wxT("00"),DXBEGINTEXT,DIM);
wxRect dxbeginrect = dxbegin->GetRect();
wxStaticText* dxbeginmm = new wxStaticText(this,-1,"mm",DXBEGINUNIT,wxSize(-1,-1));
wxStaticText* dxbeginmm = new wxStaticText(this,-1,wxT("mm"),DXBEGINUNIT,wxSize(-1,-1));
wxRect dxbeginmmrect = dxbeginmm->GetRect();
// Right part
wxStaticText* dyh2text = new wxStaticText(this,-1,"Titre esp. inf.",DYH2COMMENT,wxSize(-1,-1));
wxStaticText* dyh2text = new wxStaticText(this,-1,wxT("Titre esp. inf."),DYH2COMMENT,wxSize(-1,-1));
wxRect dyh2textrect = dyh2text->GetRect();
wxStaticText* dyt2text = new wxStaticText(this,-1,"Texte esp. inf.",DYT2COMMENT,wxSize(-1,-1));
wxStaticText* dyt2text = new wxStaticText(this,-1,wxT("Texte esp. inf."),DYT2COMMENT,wxSize(-1,-1));
wxRect dyt2textrect = dyt2text->GetRect();
wxStaticText* dxendtext = new wxStaticText(this,-1,"Texte esp. droit.",DXENDCOMMENT,wxSize(-1,-1));
wxStaticText* dxendtext = new wxStaticText(this,-1,wxT("Texte esp. droit."),DXENDCOMMENT,wxSize(-1,-1));
wxRect dxendtextrect = dxendtext->GetRect();
dyh2 = new wxTextCtrl(this,-1,"00",DYH2TEXT,DIM);
dyh2 = new wxTextCtrl(this,-1,wxT("00"),DYH2TEXT,DIM);
wxRect dyh2rect = dyh2->GetRect();
wxStaticText* dyh2mm = new wxStaticText(this,-1,"mm",DYH2UNIT,wxSize(-1,-1));
wxStaticText* dyh2mm = new wxStaticText(this,-1,wxT("mm"),DYH2UNIT,wxSize(-1,-1));
wxRect dyh2mmrect = dyh2mm->GetRect();
dyt2 = new wxTextCtrl(this,-1,"00",DYT2TEXT,DIM);
dyt2 = new wxTextCtrl(this,-1,wxT("00"),DYT2TEXT,DIM);
wxRect dyt2rect = dyt2->GetRect();
wxStaticText* dyt2mm = new wxStaticText(this,-1,"mm",DYT2UNIT,wxSize(-1,-1));
wxStaticText* dyt2mm = new wxStaticText(this,-1,wxT("mm"),DYT2UNIT,wxSize(-1,-1));
wxRect dyt2mmrect = dyt2mm->GetRect();
dxend = new wxTextCtrl(this,-1,"00",DXENDTEXT,DIM);
dxend = new wxTextCtrl(this,-1,wxT("00"),DXENDTEXT,DIM);
wxRect dxendrect = dxend->GetRect();
wxStaticText* dxendmm = new wxStaticText(this,-1,"mm",DXENDUNIT,wxSize(-1,-1));
wxStaticText* dxendmm = new wxStaticText(this,-1,wxT("mm"),DXENDUNIT,wxSize(-1,-1));
wxRect dxendmmrect = dxendmm->GetRect();
// shutdown warnings
@ -288,25 +288,25 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
#define BCANCELPOINT wxPoint(Tspacesrect[0].GetRight() - CANCELWIDTH,BPOS)
//#define BCANCELPOINT wxPoint(dxendmmrect.GetRight() - CANCELWIDTH,BPOS)
bprinter = new wxButton(this,Button_Printer,"Imprimante",BPRINTERPOINT);
bprinter = new wxButton(this,Button_Printer,wxT("Imprimante"),BPRINTERPOINT);
wxRect bprinterrect = bprinter->GetRect();
bprinter->SetToolTip("Configurer l'imprimante");
bprinter->SetToolTip(wxT("Configurer l'imprimante"));
bpage = new wxButton(this,Button_Page,"Page",BPAGEPOINT);
bpage = new wxButton(this,Button_Page,wxT("Page"),BPAGEPOINT);
// wxRect bpagerect = bpage->GetRect();
bpage->SetToolTip("Configurer la taille de page");
bcancel = new wxButton(this,Button_Cancel,"Annuler");
bpage->SetToolTip(wxT("Configurer la taille de page"));
bcancel = new wxButton(this,Button_Cancel,wxT("Annuler"));
wxRect bcancelrect = bcancel->GetRect();
bcancel->Move(BCANCELPOINT);
bcancelrect = bcancel->GetRect();
bcancel->SetToolTip("Annuler les dernier changements et quitter");
bok = new wxButton(this,Button_Ok,"Quitter");
bcancel->SetToolTip(wxT("Annuler les dernier changements et quitter"));
bok = new wxButton(this,Button_Ok,wxT("Quitter"));
wxRect bokrect = bok->GetRect();
bok->Move(BOKPOINT);
bokrect = bok->GetRect();
bok->SetToolTip("Enregistrer les changements et quitter");
bok->SetToolTip(wxT("Enregistrer les changements et quitter"));
#define DLGWIDTH (bcancelrect.GetRight() + HSPACE)
#define DLGHEIGHT (bokrect.GetBottom() + VSPACE)
@ -332,7 +332,7 @@ ConfDimDlg::get(wxTextCtrl* t)
{
wxString str;
str = t->GetValue();
return atoi((const char*)str);
return atoi(str.mb_str());
}
void
@ -387,7 +387,7 @@ ConfDimDlg::writeconf()
for(i=0; i<5; i++) {
wxString str;
str = Tdim[i]->GetValue();
config.setDxText(i,atoi((const char*)str));
config.setDxText(i,atoi(str.mb_str()));
switch (Tjust[i]->GetSelection()) {
case -1: break;
case 0: config.setJustifT(i,LEFT); break;

View file

@ -16,44 +16,44 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: configdb.cc,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: configdb.cc,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
#include <iostream>
#include "ewx.h"
#include "configdb.h"
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#include "wx/settings.h"
#include "wx/settings.h"
using namespace std;
#define DIM 200
#define PREFIX "/"
#define DICPATH PREFIX"Fichiers/Dictionnaire_Chemin"
#define DICNAME PREFIX"Fichiers/Dictionnaire_Nom"
#define TILEPATH PREFIX"Fichiers/Lettres_Chemin"
#define TILENAME PREFIX"Fichiers/Lettres_Nom"
#define DICPATH wxT(PREFIX"Fichiers/Dictionnaire_Chemin")
#define DICNAME wxT(PREFIX"Fichiers/Dictionnaire_Nom")
#define TILEPATH wxT(PREFIX"Fichiers/Lettres_Chemin")
#define TILENAME wxT(PREFIX"Fichiers/Lettres_Nom")
///////////////////////////
//
// Print
//
///////////////////////////
#define ORIENT PREFIX"Print/Page_Orientation"
#define MARGINX PREFIX"Print/Page_MargeGauche"
#define MARGINY PREFIX"Print/Page_MargeHaute"
#define ORIENT wxT(PREFIX"Print/Page_Orientation")
#define MARGINX wxT(PREFIX"Print/Page_MargeGauche")
#define MARGINY wxT(PREFIX"Print/Page_MargeHaute")
#define HNAME PREFIX"Print/Header/Nom/"
#define HDIM PREFIX"Print/Header/Dimensions/"
#define HJUST PREFIX"Print/Header/Justification/"
#define HSPACE PREFIX"Print/Header/Espacement/"
#define HNAME wxT(PREFIX"Print/Header/Nom/")
#define HDIM wxT(PREFIX"Print/Header/Dimensions/")
#define HJUST wxT(PREFIX"Print/Header/Justification/")
#define HSPACE wxT(PREFIX"Print/Header/Espacement/")
#define TDIM PREFIX"Print/Text/Dimensions/"
#define TJUST PREFIX"Print/Text/Justification/"
#define TSPACE PREFIX"Print/Text/Espacement/"
#define TDIM wxT(PREFIX"Print/Text/Dimensions/")
#define TJUST wxT(PREFIX"Print/Text/Justification/")
#define TSPACE wxT(PREFIX"Print/Text/Espacement/")
#define MISC PREFIX"Divers/"
#define MISC wxT(PREFIX"Divers/")
ConfigDB::ConfigDB()
{
@ -91,40 +91,40 @@ long ConfigDB::Read(const wxString& key, long def)
return res;
}
#define FPOINTSIZE ".PointSize"
#define FFAMILY ".Family"
#define FSTYLE ".Style"
#define FWEIGHT ".Weight"
#define FUNDERLINE ".Underline"
#define FFACENAME ".FaceName"
#define FENCODING ".Encoding"
#define FPOINTSIZE wxT(".PointSize")
#define FFAMILY wxT(".Family")
#define FSTYLE wxT(".Style")
#define FWEIGHT wxT(".Weight")
#define FUNDERLINE wxT(".Underline")
#define FFACENAME wxT(".FaceName")
#define FENCODING wxT(".Encoding")
wxFont ConfigDB::Read(const wxString& key, wxFont def)
{
return wxFont(Read(key + FPOINTSIZE,(long)def.GetPointSize()),
Read(key + FFAMILY ,(long)def.GetFamily()),
Read(key + FSTYLE ,(long)def.GetStyle()),
Read(key + FWEIGHT ,(long)def.GetWeight()),
Read(key + FUNDERLINE,(long)def.GetUnderlined()),
ReadStr(key + FFACENAME ,def.GetFaceName())
//,Read(key + FENCODING ,def.GetDefaultEncoding())
);
return wxFont(Read(key + FPOINTSIZE,(long)def.GetPointSize()),
Read(key + FFAMILY ,(long)def.GetFamily()),
Read(key + FSTYLE ,(long)def.GetStyle()),
Read(key + FWEIGHT ,(long)def.GetWeight()),
Read(key + FUNDERLINE,(long)def.GetUnderlined()),
ReadStr(key + FFACENAME ,def.GetFaceName())
//,Read(key + FENCODING ,def.GetDefaultEncoding())
);
}
void ConfigDB::Write(const wxString& key, wxFont font)
{
pConfig->Write(key + FPOINTSIZE,(long)font.GetPointSize());
pConfig->Write(key + FFAMILY ,(long)font.GetFamily());
pConfig->Write(key + FSTYLE ,(long)font.GetStyle());
pConfig->Write(key + FWEIGHT ,(long)font.GetWeight());
pConfig->Write(key + FUNDERLINE,(long)font.GetUnderlined());
pConfig->Write(key + FFACENAME ,font.GetFaceName());
//pConfig->Write(key + FENCODING ,font.GetDefaultEncoding());
pConfig->Write(key + FPOINTSIZE,(long)font.GetPointSize());
pConfig->Write(key + FFAMILY ,(long)font.GetFamily());
pConfig->Write(key + FSTYLE ,(long)font.GetStyle());
pConfig->Write(key + FWEIGHT ,(long)font.GetWeight());
pConfig->Write(key + FUNDERLINE,(long)font.GetUnderlined());
pConfig->Write(key + FFACENAME ,font.GetFaceName());
//pConfig->Write(key + FENCODING ,font.GetDefaultEncoding());
}
#define CR ".R"
#define CG ".G"
#define CB ".B"
#define CR wxT(".R")
#define CG wxT(".G")
#define CB wxT(".B")
wxColour ConfigDB::Read(const wxString& key, wxColour def)
{
@ -145,7 +145,7 @@ wxString ConfigDB::ReadStr(const wxString& key, wxString def)
{
wxString res;
/*
/*
wxString msg;
msg << "want to read -" << key << "-";
wxMessageBox(msg, "Eliot configDB", wxICON_INFORMATION | wxOK);
@ -188,22 +188,22 @@ void ConfigDB::Write(const wxString& key, wxString str)
wxString ConfigDB::getDicPath()
{
return ReadStr(DICPATH,wxString("//"));
return ReadStr(DICPATH,wxT("//"));
}
wxString ConfigDB::getDicName()
{
return ReadStr(DICNAME,wxString("Aucun Dictionnaire"));
return ReadStr(DICNAME,wxT("Aucun Dictionnaire"));
}
wxString ConfigDB::getTilePath()
{
return ReadStr(TILEPATH,wxString("//"));
return ReadStr(TILEPATH,wxT("//"));
}
wxString ConfigDB::getTileName()
{
return ReadStr(TILENAME,wxString(""));
return ReadStr(TILENAME,wxT(""));
}
void ConfigDB::setDicPath(wxString dpath, wxString dname)
@ -237,7 +237,7 @@ void ConfigDB::setDxBegin(long d)
long ConfigDB::getDxText(int i)
{
long int res;
switch (i)
switch (i)
{
case 0: res = Read(TDIM"texte/1",10L); break;
case 1: res = Read(TDIM"texte/2",30L); break;
@ -252,7 +252,7 @@ long ConfigDB::getDxText(int i)
void ConfigDB::setDxText(int i, long v)
{
wxString key;
key << TDIM << "texte/" << (i+1);
key << TDIM << wxT("texte/") << (i+1);
if (i<5)
Write(key,v);
}
@ -310,14 +310,14 @@ void ConfigDB::setDyH2(long d)
wxString ConfigDB::getNameH(int i)
{
wxString res;
switch (i)
switch (i)
{
case 0: res = ReadStr(wxString(HNAME)+wxString("1"),wxString("Num")); break;
case 1: res = ReadStr(wxString(HNAME)+wxString("2"),wxString("Tirage")); break;
case 2: res = ReadStr(wxString(HNAME)+wxString("3"),wxString("Solution")); break;
case 3: res = ReadStr(wxString(HNAME)+wxString("4"),wxString("Pos")); break;
case 4: res = ReadStr(wxString(HNAME)+wxString("5"),wxString("Pts")); break;
default: res = ""; break;
case 0: res = ReadStr(wxString(HNAME) + wxT("1"), wxT("Num")); break;
case 1: res = ReadStr(wxString(HNAME) + wxT("2"), wxT("Tirage")); break;
case 2: res = ReadStr(wxString(HNAME) + wxT("3"), wxT("Solution")); break;
case 3: res = ReadStr(wxString(HNAME) + wxT("4"), wxT("Pos")); break;
case 4: res = ReadStr(wxString(HNAME) + wxT("5"), wxT("Pts")); break;
default: res = wxT(""); break;
}
return res;
}
@ -338,11 +338,11 @@ void ConfigDB::setNameH(int i, wxString str)
enum Justif ConfigDB::StrToJust(const wxString& str)
{
enum Justif res;
if (str.CmpNoCase("gauche") == 0)
if (str.CmpNoCase(wxT("gauche")) == 0)
res = LEFT;
else if (str.CmpNoCase("centre") == 0)
else if (str.CmpNoCase(wxT("centre")) == 0)
res = CENTER;
else if (str.CmpNoCase("droite") == 0)
else if (str.CmpNoCase(wxT("droite")) == 0)
res = RIGHT;
else
res = LEFT;
@ -353,16 +353,16 @@ wxString ConfigDB::JustToStr(enum Justif j)
{
wxString res;
switch (j) {
case LEFT: res = "gauche"; break;
case CENTER: res = "centre"; break;
case RIGHT: res = "droite"; break;
case LEFT: res = wxT("gauche"); break;
case CENTER: res = wxT("centre"); break;
case RIGHT: res = wxT("droite"); break;
}
return res;
}
enum Justif ConfigDB::getJustif(const wxString& key)
{
return StrToJust(ReadStr(key,wxString("gauche")));
return StrToJust(ReadStr(key,wxT("gauche")));
}
void ConfigDB::setJustif(const wxString& key, enum Justif j)
@ -464,7 +464,7 @@ void ConfigDB::setFontDefault()
setFont(LISTFONT ,fsys);
setFont(PRINTHFONT,FHEADERDEF);
setFont(PRINTTFONT,FTEXTDEF);
}
}
void ConfigDB::setFont(wxString key, wxFont font)
{
@ -530,7 +530,7 @@ ConfigDB::getColour(wxString key)
////////////////////////////////////////////////////////
//
// PRINTING
// PRINTING
//
////////////////////////////////////////////////////////
@ -558,11 +558,11 @@ long ConfigDB::getOrientation()
{
long res;
wxString str;
str = ReadStr(ORIENT,"paysage");
if (str.CmpNoCase("portrait") == 0)
str = ReadStr(ORIENT,wxT("paysage"));
if (str.CmpNoCase(wxT("portrait")) == 0)
res = wxPORTRAIT;
else if (str.CmpNoCase("paysage") == 0)
else if (str.CmpNoCase(wxT("paysage")) == 0)
res = wxLANDSCAPE;
else
res = wxPORTRAIT;
@ -571,11 +571,11 @@ long ConfigDB::getOrientation()
void ConfigDB::setOrientation(long o)
{
switch (o)
switch (o)
{
case wxLANDSCAPE: Write(ORIENT,wxString("paysage")); break;
case wxLANDSCAPE: Write(ORIENT,wxT("paysage")); break;
case wxPORTRAIT: // fall through
default: Write(ORIENT,wxString("portrait")); break;
default: Write(ORIENT,wxT("portrait")); break;
}
}
@ -620,11 +620,11 @@ void ConfigDB::setPrintLineScale(float s)
//
////////////////////////////////////////////////////////
#define PX "/x"
#define PY "/y"
#define SW "/w"
#define SH "/h"
#define SHOW "/show"
#define PX wxT("/x")
#define PY wxT("/y")
#define SW wxT("/w")
#define SH wxT("/h")
#define SHOW wxT("/show")
#define CONFIG_DEFAULT_X 150L
#define CONFIG_DEFAULT_Y 150L
@ -639,7 +639,7 @@ wxPoint ConfigDB::getFramePos(wxString frame)
pos.x = Read(keyX,CONFIG_DEFAULT_X);
pos.y = Read(keyY,CONFIG_DEFAULT_Y);
#ifdef FRAME_TRACE
cerr << "configdb::getFramePos " << frame
cerr << "configdb::getFramePos " << frame
<< " \tx:" << pos.x << " y:" << pos.y << endl;
#endif
return pos;
@ -648,7 +648,7 @@ wxPoint ConfigDB::getFramePos(wxString frame)
void ConfigDB::setFramePos(wxString frame, wxPoint pos)
{
#ifdef FRAME_TRACE
cerr << "configdb::setFramePos " << frame
cerr << "configdb::setFramePos " << frame
<< " \tx:" << pos.x << " y:" << pos.y << endl;
#endif
wxString keyX(frame + PX);
@ -665,16 +665,16 @@ wxSize ConfigDB::getFrameSize(wxString frame)
size.x = Read(keyX,CONFIG_DEFAULT_W);
size.y = Read(keyY,CONFIG_DEFAULT_H);
#ifdef FRAME_TRACE
cerr << "configdb::getFrameSize " << frame
cerr << "configdb::getFrameSize " << frame
<< " \tw:" << size.x << " h:" << size.y << endl;
#endif
#endif
return size;
}
void ConfigDB::setFrameSize(wxString frame, wxSize size)
{
#ifdef FRAME_TRACE
cerr << "configdb::setFrameSize " << frame
cerr << "configdb::setFrameSize " << frame
<< " \tw:" << size.x << " h:" << size.y << endl;
#endif
wxString keyX(frame + SW);
@ -697,14 +697,14 @@ void ConfigDB::setFrameShow(wxString frame, int s)
void ConfigDB::setFrameDefault()
{
setFrameSize(FRAMEBOARD ,wxSize(450,450));
setFrameSize(FRAMEVERIF ,wxSize(150,50));
setFrameSize(FRAMESEARCH,wxSize(350,300));
setFrameSize(FRAMEPLUS1 ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMERACC ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMEBENJ ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMEBAG ,wxSize(150,40));
setFrameSize(APPNAME ,wxSize(410,200));
setFrameSize(FRAMEBOARD ,wxSize(450,450));
setFrameSize(FRAMEVERIF ,wxSize(150,50));
setFrameSize(FRAMESEARCH ,wxSize(350,300));
setFrameSize(FRAMEPLUS1 ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMERACC ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMEBENJ ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMEBAG ,wxSize(150,40));
setFrameSize(wxT(APPNAME),wxSize(410,200));
setFramePos(FRAMEBOARD ,wxPoint(58,76));
setFramePos(FRAMEVERIF ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
@ -713,7 +713,7 @@ void ConfigDB::setFrameDefault()
setFramePos(FRAMERACC ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
setFramePos(FRAMEBENJ ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
setFramePos(FRAMEBAG ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
setFramePos(APPNAME ,wxPoint(500,9));
setFramePos(wxT(APPNAME),wxPoint(500,9));
setFrameShow(FRAMEBOARD ,1L);
setFrameShow(FRAMEVERIF ,0L);
@ -736,49 +736,49 @@ void ConfigDB::setFrameDefault()
void ConfigDB::setJokerPlus1(bool val)
{
wxString key;
key = wxString(MISC) + wxString("JokersDans7plus1");
key = wxString(MISC) + wxT("JokersDans7plus1");
Write(key,val);
}
bool ConfigDB::getJokerPlus1()
{
wxString key;
key = wxString(MISC) + wxString("JokersDans7plus1");
key = wxString(MISC) + wxT("JokersDans7plus1");
return Read(key,(bool)FALSE);
}
void ConfigDB::setRackChecking(bool val)
{
wxString key;
key = wxString(MISC) + wxString("VerificationTirages");
key = wxString(MISC) + wxT("VerificationTirages");
Write(key,val);
}
bool ConfigDB::getRackChecking()
{
wxString key;
key = wxString(MISC) + wxString("VerificationTirages");
key = wxString(MISC) + wxT("VerificationTirages");
return Read(key,(bool)FALSE);
}
////////////////////////////////////////////////////////
//
//
//
//
////////////////////////////////////////////////////////
#define INIT "/Initialized"
#define INIT wxT("/Initialized")
void
ConfigDB::setFirstDefault()
{
if (Read(wxString(INIT),0L))
if (Read(INIT,0L))
return;
setFontDefault();
setColourDefault();
setFrameDefault();
Write(wxString(INIT),1L);
Write(INIT,1L);
}

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: configdb.h,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: configdb.h,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
// -*-C++-*-
@ -33,64 +33,64 @@
#define BUTTON_FONT wxFont(8,wxDEFAULT,wxNORMAL,wxNORMAL)
#define BOARD "Board"
#define BCOLOURLINES BOARD"/Lines"
#define BCOLOURWX2 BOARD"/Wx2"
#define BCOLOURWX3 BOARD"/Wx3"
#define BCOLOURLX2 BOARD"/Lx2"
#define BCOLOURLX3 BOARD"/Lx3"
#define BCOLOURBACKGROUND BOARD"/Background"
#define BCOLOURLETTERS BOARD"/Letters"
#define BCOLOURTSTLETTERS BOARD"/TstLetters"
#define BOARDFONT BOARD"/Font"
#define BCOLOURLINES wxT(BOARD"/Lines")
#define BCOLOURWX2 wxT(BOARD"/Wx2")
#define BCOLOURWX3 wxT(BOARD"/Wx3")
#define BCOLOURLX2 wxT(BOARD"/Lx2")
#define BCOLOURLX3 wxT(BOARD"/Lx3")
#define BCOLOURBACKGROUND wxT(BOARD"/Background")
#define BCOLOURLETTERS wxT(BOARD"/Letters")
#define BCOLOURTSTLETTERS wxT(BOARD"/TstLetters")
#define BOARDFONT wxT(BOARD"/Font")
#define LIST "List"
#define LISTFONT LIST"/Font"
#define LISTFONT wxT(LIST"/Font")
#define PRINT "Print"
#define PHEADER PRINT"/Header"
#define PRINTHFONT PHEADER"/Font"
#define PRINTHFONT wxT(PHEADER"/Font")
#define PTEXT PRINT"/Text"
#define PRINTTFONT PTEXT"/Font"
#define PRINTTFONT wxT(PTEXT"/Font")
#define FRAME "Frames/"
#define FRAMEBOARD FRAME"Board"
#define FRAMEVERIF FRAME"Verif"
#define FRAMESEARCH FRAME"Search"
#define FRAMEPLUS1 FRAME"Plus1"
#define FRAMERACC FRAME"Racc"
#define FRAMEBENJ FRAME"Benj"
#define FRAMEBAG FRAME"Bag"
#define FRAMEBOARD wxT(FRAME"Board")
#define FRAMEVERIF wxT(FRAME"Verif")
#define FRAMESEARCH wxT(FRAME"Search")
#define FRAMEPLUS1 wxT(FRAME"Plus1")
#define FRAMERACC wxT(FRAME"Racc")
#define FRAMEBENJ wxT(FRAME"Benj")
#define FRAMEBAG wxT(FRAME"Bag")
enum Justif { LEFT, CENTER, RIGHT };
class ConfigDB
class ConfigDB
{
private:
wxConfigBase* pConfig;
enum Justif StrToJust(const wxString&);
wxString JustToStr(enum Justif);
enum Justif getJustif(const wxString&);
enum Justif getJustif(const wxString&);
void setJustif(const wxString&, enum Justif);
bool Read(const wxString&, bool);
long Read(const wxString&, long);
wxFont Read(const wxString&, wxFont);
wxColour Read(const wxString&, wxColour);
wxString ReadStr(const wxString&, wxString);
void Write(const wxString&, bool);
void Write(const wxString&, long);
void Write(const wxString&, wxFont);
void Write(const wxString&, wxColour);
void Write(const wxString&, wxString);
public:
ConfigDB();
wxFont ChooseFont(wxFrame*,wxFont);
wxColour ChooseColour(wxFrame*,wxColour);
// Dictionary
wxString getDicPath();
wxString getDicName();
@ -102,7 +102,7 @@ public:
// page setup
long getOrientation();
void setOrientation(long);
// game drawing
long getDxBegin();
long getDxText(int);
@ -110,7 +110,7 @@ public:
void setDxBegin(long);
void setDxText(int,long);
void setDxEnd(long);
long getDyH1();
long getDyH2();
long getDyT1();
@ -119,25 +119,25 @@ public:
void setDyH2(long);
void setDyT1(long);
void setDyT2(long);
int getSpacesH(int);
int getSpacesT(int);
void setSpacesH(int,int);
void setSpacesT(int,int);
enum Justif getJustifH(int);
enum Justif getJustifT(int);
void setJustifH(int, enum Justif);
void setJustifT(int, enum Justif);
wxString getNameH(int);
void setNameH(int, wxString);
long getMarginX();
long getMarginY();
void setMarginX(long);
void setMarginY(long);
wxFont getFont(wxString);
void setFont(wxString,wxFont);
void setFontDefault();
@ -145,13 +145,13 @@ public:
wxColour getColour(wxString);
void setColour(wxString,wxColour);
void setColourDefault();
wxPrintData getPrintData();
void setPrintData(wxPrintData);
wxPageSetupData getPageSetupData();
void setPageSetupData(wxPageSetupData);
/**
/**
* frames
*/
wxSize getFrameSize(wxString);
@ -171,7 +171,7 @@ public:
void setPrintLineScale(float);
void setFirstDefault();
};
#endif

View file

@ -16,15 +16,15 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: confsearch.cc,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: confsearch.cc,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
#include "wx/button.h"
#include "wx/sizer.h"
#include "ewx.h"
#include "configdb.h"
#include "confsearch.h"
#include "wx/button.h"
#include "wx/sizer.h"
enum {
Button_Ok,
Button_Cancel,
@ -40,16 +40,16 @@ END_EVENT_TABLE()
ConfSearchDlg::ConfSearchDlg(wxWindow* parent)
: wxDialog(parent,-1,wxString("Configuration recherche"))
: wxDialog(parent,-1,wxT("Configuration recherche"))
{
joker_searching = new wxCheckBox(this,CheckBox_Joker,"Recherche sur joker dans 7+1");
rack_checking = new wxCheckBox(this,CheckBox_Rack,"Vérification de la validité des tirages");
bcancel = new wxButton(this,Button_Cancel,"Annuler",wxPoint(-1,-1));
bcancel->SetToolTip("Annuler les dernier changements et quitter");
bok = new wxButton(this,Button_Ok,"Quitter",wxPoint(-1,-1));
bok->SetToolTip("Enregistrer les changements et quitter");
joker_searching = new wxCheckBox(this,CheckBox_Joker,wxT("Recherche sur joker dans 7+1"));
rack_checking = new wxCheckBox(this,CheckBox_Rack,wxT("Vérification de la validité des tirages"));
bcancel = new wxButton(this,Button_Cancel,wxT("Annuler"),wxPoint(-1,-1));
bcancel->SetToolTip(wxT("Annuler les dernier changements et quitter"));
bok = new wxButton(this,Button_Ok,wxT("Quitter"),wxPoint(-1,-1));
bok->SetToolTip(wxT("Enregistrer les changements et quitter"));
wxBoxSizer *bsizer = new wxBoxSizer( wxHORIZONTAL);
bsizer->Add(bok, 1, wxALL, 1);

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: ewx.h,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: ewx.h,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
#ifndef __EWX__
#define __EWX__
@ -41,5 +41,23 @@
#include "config.h"
#define APPNAME "Eliot"
#define DATE "$Date: 2004/04/08 09:43:06 $"
#define DATE "$Date: 2005/01/01 15:42:55 $"
#endif
/* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
#if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
#if wxUSE_UNICODE
# define wxU(utf8) wxString(utf8, wxConvUTF8)
#else
# define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
#endif
#else // ENABLE_NLS && ENABLE_UTF8
#if wxUSE_UNICODE
# define wxU(ansi) wxString(ansi, *wxConvCurrent)
#else
# define wxU(ansi) ansi
#endif
#endif

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: gfxboard.cc,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: gfxboard.cc,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
#include <string.h>
#include <math.h>
@ -38,9 +38,9 @@ END_EVENT_TABLE()
#define LINE_WIDTH 2
#define BOARD_SIZE 17
GfxBoard::GfxBoard(wxFrame *parent, Game _game) :
GfxBoard::GfxBoard(wxFrame *parent, Game _game) :
wxWindow(parent, -1)
{
{
bmp = NULL;
game = _game;
board_size = 0;
@ -68,7 +68,7 @@ GfxBoard::OnSize(wxSizeEvent& e)
TopLeft = wxPoint((size.GetWidth() - (board_size - tile_size/2)) / 2,
(size.GetHeight() - (board_size - tile_size/2)) / 2);
if (bmp)
{
delete bmp;
@ -79,12 +79,12 @@ GfxBoard::OnSize(wxSizeEvent& e)
void
GfxBoard::CreateBMP()
{
if (!bmp)
if (!bmp)
{
wxSize bs = GetClientSize();
bmp=new wxBitmap(bs.x,bs.y);
if (bmp)
{
if (bmp)
{
wxMemoryDC memDC;
memDC.SelectObject(* bmp);
DrawBoard(&memDC);
@ -93,19 +93,19 @@ GfxBoard::CreateBMP()
}
}
void
void
GfxBoard::OnPaint(wxPaintEvent&)
{
wxPaintDC dc(this);
CreateBMP();
if (bmp)
if (bmp)
{
int vX,vY,vW,vH;
int vX,vY,vW,vH;
wxMemoryDC memDC;
memDC.SelectObject(* bmp);
wxRegionIterator upd(GetUpdateRegion());
wxRegionIterator upd(GetUpdateRegion());
while (upd)
{
@ -115,11 +115,11 @@ GfxBoard::OnPaint(wxPaintEvent&)
vH = upd.GetH();
dc.Blit(vX,vY,vW,vH,&memDC,vX,vY,wxCOPY);
upd ++ ;
}
}
memDC.SelectObject(wxNullBitmap);
}
else
}
else
{
DrawBoard(&dc);
}
@ -127,7 +127,7 @@ GfxBoard::OnPaint(wxPaintEvent&)
void
GfxBoard::Refresh(board_refresh_t force)
{
{
wxClientDC dc(this);
CreateBMP();
@ -149,9 +149,9 @@ GfxBoard::Refresh(board_refresh_t force)
return;
}
if (bmp)
if (bmp)
{
int vX,vY,vW,vH;
int vX,vY,vW,vH;
wxMemoryDC memDC;
memDC.SelectObject(* bmp);
@ -164,8 +164,8 @@ GfxBoard::Refresh(board_refresh_t force)
dc.Blit(vX,vY,vW,vH,&memDC,vX,vY,wxCOPY);
memDC.SelectObject(wxNullBitmap);
}
else
}
else
{
DrawBoard(&dc);
}
@ -183,11 +183,11 @@ GfxBoard::DrawTile(wxDC *dc, wxString& wxs, int row, int column)
tile_size + 2*LINE_WIDTH,
tile_size + 2*LINE_WIDTH);
const char* ptr = wxs.c_str();
if (wxs.Len() && isalnum(*ptr))
const char* ptr = wxs.mb_str();
if (wxs.Len() && isalnum(*ptr))
{
//
//
// letter
dc->GetTextExtent(wxs,&width,&height);
posx = TopLeft.x + column*(tile_size+LINE_WIDTH) + LINE_WIDTH + (tile_size - width) / 2;
@ -202,14 +202,14 @@ GfxBoard::DrawBoard(wxDC *dc)
wxString wxs;
int attr;
int row,column;
left = BOARD_MAX;
right = BOARD_MIN;
top = BOARD_MAX;
bottom = BOARD_MIN;
wxFont font = config.getFont(BOARDFONT);
wxColour colLines = config.getColour(wxString(BCOLOURLINES));
wxColour colLetters = config.getColour(wxString(BCOLOURLETTERS));
wxColour colTestLetters = config.getColour(wxString(BCOLOURTSTLETTERS));
@ -218,7 +218,7 @@ GfxBoard::DrawBoard(wxDC *dc)
wxColour colWx2 = config.getColour(wxString(BCOLOURWX2));
wxColour colLx3 = config.getColour(wxString(BCOLOURLX3));
wxColour colLx2 = config.getColour(wxString(BCOLOURLX2));
wxPen *LinesPen = wxThePenList->FindOrCreatePen(colLines, 1, wxSOLID);
wxBrush *BackgroundBrush = wxTheBrushList->FindOrCreateBrush(colBackground, wxSOLID);
wxBrush *Wx3Brush = wxTheBrushList->FindOrCreateBrush(colWx3, wxSOLID);
@ -237,58 +237,57 @@ GfxBoard::DrawBoard(wxDC *dc)
// lines
// dc->DrawRectangle(TopLeft.x,TopLeft.y,board_size - tile_size/2, board_size - tile_size/2);
for(row=BOARD_MIN; row < BOARD_MAX; row++)
for(row=BOARD_MIN; row < BOARD_MAX; row++)
{
// vertical
dc->DrawLine(TopLeft.x + (row+1)*(tile_size+LINE_WIDTH),
dc->DrawLine(TopLeft.x + (row+1)*(tile_size+LINE_WIDTH),
TopLeft.y + tile_size + LINE_WIDTH,
TopLeft.x + (row+1)*(tile_size+LINE_WIDTH),
TopLeft.x + (row+1)*(tile_size+LINE_WIDTH),
TopLeft.y + BOARD_MAX * (tile_size+LINE_WIDTH));
// horizontal row <-> line
dc->DrawLine(TopLeft.x + tile_size+LINE_WIDTH,
TopLeft.y + (row+1)*(tile_size+LINE_WIDTH),
dc->DrawLine(TopLeft.x + tile_size+LINE_WIDTH,
TopLeft.y + (row+1)*(tile_size+LINE_WIDTH),
TopLeft.x + BOARD_MAX * (tile_size+LINE_WIDTH),
TopLeft.y + (row+1)*(tile_size+LINE_WIDTH));
}
// 1 2 3 4 5 ...
// A B C D
for(row=BOARD_MIN; row <= BOARD_MAX; row++)
// 1 2 3 4 5 ...
// A B C D
for(row=BOARD_MIN; row <= BOARD_MAX; row++)
{
wxString str;
wxs.sprintf("%d",row);
wxs.Printf(wxT("%d"), row);
DrawTile(dc,wxs,0,row);
wxs.sprintf("%c",row + 'A' - 1);
wxs.Printf(wxT("%c"), row + 'A' - 1);
DrawTile(dc,wxs,row,0);
}
dc->SetTextForeground(colLetters);
for(row=BOARD_MIN; row <= BOARD_MAX; row++)
for(row=BOARD_MIN; row <= BOARD_MAX; row++)
{
for(column=BOARD_MIN; column <= BOARD_MAX; column++)
for(column=BOARD_MIN; column <= BOARD_MAX; column++)
{
if (Game_getboardlettermultiplier(game,row,column) == 2)
if (Game_getboardlettermultiplier(game,row,column) == 2)
{
dc->SetBrush(*Lx2Brush);
dc->SetTextBackground(colLx2);
}
else if (Game_getboardlettermultiplier(game,row,column) == 3)
}
else if (Game_getboardlettermultiplier(game,row,column) == 3)
{
dc->SetBrush(*Lx3Brush);
dc->SetTextBackground(colLx3);
}
else if (Game_getboardwordmultiplier(game,row,column) == 2)
}
else if (Game_getboardwordmultiplier(game,row,column) == 2)
{
dc->SetBrush(*Wx2Brush);
dc->SetTextBackground(colWx2);
}
else if (Game_getboardwordmultiplier(game,row,column) == 3)
}
else if (Game_getboardwordmultiplier(game,row,column) == 3)
{
dc->SetBrush(*Wx3Brush);
dc->SetTextBackground(colWx3);
}
wxs = Game_getboardchar(game,row,column);
wxs = (wxChar)Game_getboardchar(game,row,column);
attr = Game_getboardcharattr(game,row,column);
if ((paintedboard_char[row - BOARD_MIN][column - BOARD_MIN] != wxs.GetChar(0)) ||
(paintedboard_attr[row - BOARD_MIN][column - BOARD_MIN] != attr))
@ -315,6 +314,6 @@ GfxBoard::DrawBoard(wxDC *dc)
dc->SetTextBackground(colBackground);
}
}
dc->SetFont(wxNullFont);
}

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: main.cc,v 1.3 2004/06/26 10:40:02 ipkiss Exp $ */
/* $Id: main.cc,v 1.4 2005/01/01 15:42:55 ipkiss Exp $ */
#ifdef WIN32 // mingw32 hack
# undef Yield
@ -54,9 +54,9 @@ bool
EliotApp::OnInit()
{
srand(time(NULL));
SetVendorName("Afrab");
SetAppName(wxString("eliot") + wxString("-") + wxString(VERSION));
SetClassName("eliot");
SetVendorName(wxT("Afrab"));
SetAppName(wxString(wxT("eliot")) + wxString(wxT("-")) + wxString(wxT(VERSION)));
SetClassName(wxT("eliot"));
wxConfigBase* config = wxConfigBase::Get();
config = NULL;
@ -66,8 +66,8 @@ EliotApp::OnInit()
#endif
ConfigDB configdb;
configdb.setFirstDefault();
MainFrame *mainframe = new MainFrame(configdb.getFramePos(APPNAME),
configdb.getFrameSize(APPNAME));
MainFrame *mainframe = new MainFrame(configdb.getFramePos(wxT(APPNAME)),
configdb.getFrameSize(wxT(APPNAME)));
mainframe->SetIcon( wxICON(eliot) );
mainframe->Show(TRUE);
SetTopWindow(mainframe);

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: mainframe.cc,v 1.3 2004/08/07 18:10:42 ipkiss Exp $ */
/* $Id: mainframe.cc,v 1.4 2005/01/01 15:42:55 ipkiss Exp $ */
#include <stdlib.h>
#include <stdio.h>
@ -24,6 +24,13 @@
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"
@ -35,13 +42,6 @@ using namespace std;
#include "printout.h"
#include "mainframe.h"
#include "wx/intl.h"
#include "wx/menu.h"
#include "wx/statusbr.h"
#include "wx/sizer.h"
#include "wx/filedlg.h"
#include "wx/msgdlg.h"
#ifdef ENABLE_SAVE_POSTSCRIPT
#include "wx/dcps.h"
#endif
@ -143,20 +143,20 @@ END_EVENT_TABLE()
******************************* */
MainFrame::MainFrame(wxPoint pos_, wxSize size_)
: wxFrame((wxFrame *) NULL, -1, "Eliot", wxPoint(-1,-1),
size_, wxDEFAULT_FRAME_STYLE, wxString("Eliot"))
: wxFrame((wxFrame *) NULL, -1, wxT("Eliot"), wxPoint(-1,-1),
size_, wxDEFAULT_FRAME_STYLE, wxT("Eliot"))
{
wxSysColourChangedEvent event;
Dictionary dic = NULL;
wxString dicpath = config.getDicPath();
Dic_load(&dic, (const char*)dicpath);
Dic_load(&dic, dicpath.mb_str());
game = Game_create(dic);
Game_training_start(game);
rack = new wxTextCtrl(this,Rack_ID,wxString(""),wxPoint(-1,-1),wxSize(-1,-1),wxTE_PROCESS_ENTER);
rack->SetToolTip("Tirage");
rack = new wxTextCtrl(this,Rack_ID,wxT(""),wxPoint(-1,-1),wxSize(-1,-1),wxTE_PROCESS_ENTER);
rack->SetToolTip(wxT("Tirage"));
results = new wxListCtrl(this,ListCtrl_ID);
#if defined(ENABLE_LC_NO_HEADER)
@ -164,11 +164,11 @@ MainFrame::MainFrame(wxPoint pos_, wxSize size_)
#else
results->SetSingleStyle(wxLC_REPORT | wxLC_SINGLE_SEL);
#endif
results->InsertColumn(0,"Sol");
results->InsertColumn(1,"*");
results->InsertColumn(2,"Pos");
results->InsertColumn(3,"Pts");
results->SetToolTip("Résultats de la recherche");
results->InsertColumn(0,wxT("Sol"));
results->InsertColumn(1,wxT("*"));
results->InsertColumn(2,wxT("Pos"));
results->InsertColumn(3,wxT("Pts"));
results->SetToolTip(wxT("Résultats de la recherche"));
InitFrames();
InitMenu();
@ -178,16 +178,16 @@ MainFrame::MainFrame(wxPoint pos_, wxSize size_)
statusbar->SetStatusWidths(2,ww);
UpdateStatusBar();
b_rackrandomset = new wxButton(this,Button_SetRack," Tirage ");
b_rackrandomset->SetToolTip("Tirage aléatoire");
b_rackrandomnew = new wxButton(this,Button_SetNew," Complément ");
b_rackrandomnew->SetToolTip("Complément aléatoire du tirage");
b_search = new wxButton(this,Button_Search," Rechercher ");
b_search->SetToolTip("Recherche sur le tirage courant");
b_back = new wxButton(this,Button_PlayBack," Arrière ");
b_back->SetToolTip("Revenir un coup en arrière");
b_play = new wxButton(this,Button_Play," Jouer ");
b_play->SetToolTip("Jouer le mot sélectionné");
b_rackrandomset = new wxButton(this,Button_SetRack,wxT(" Tirage "));
b_rackrandomset->SetToolTip(wxT("Tirage aléatoire"));
b_rackrandomnew = new wxButton(this,Button_SetNew,wxT(" Complément "));
b_rackrandomnew->SetToolTip(wxT("Complément aléatoire du tirage"));
b_search = new wxButton(this,Button_Search,wxT(" Rechercher "));
b_search->SetToolTip(wxT("Recherche sur le tirage courant"));
b_back = new wxButton(this,Button_PlayBack,wxT(" Arrière "));
b_back->SetToolTip(wxT("Revenir un coup en arrière"));
b_play = new wxButton(this,Button_Play,wxT(" Jouer "));
b_play->SetToolTip(wxT("Jouer le mot sélectionné"));
wxBoxSizer *buttonsizer = new wxBoxSizer(wxHORIZONTAL);
buttonsizer->Add(b_rackrandomset, 1, wxEXPAND | wxTOP | wxBOTTOM | wxLEFT , 1);
@ -210,7 +210,7 @@ MainFrame::MainFrame(wxPoint pos_, wxSize size_)
mainsizer->SetSizeHints(this);
SetClientSize(size_);
Move(config.getFramePos(APPNAME));
Move(config.getFramePos(wxT(APPNAME)));
}
/** ******************************
@ -227,8 +227,8 @@ MainFrame::~MainFrame()
Dic_destroy(dic);
}
config.setFramePos(APPNAME,GetPosition());
config.setFrameSize(APPNAME,GetClientSize());
config.setFramePos(wxT(APPNAME),GetPosition());
config.setFrameSize(wxT(APPNAME),GetClientSize());
Game_destroy(game);
}
@ -243,65 +243,65 @@ MainFrame::InitMenu()
{
// menus
wxMenu *menu_game = new wxMenu;
menu_game->Append(Menu_Game_New,"Nouvelle","Démarrer une nouvelle partie");
menu_game->Append(Menu_Game_Open,"Charger...","Charger une partie");
menu_game->Append(Menu_Game_Save,"Sauver...","Sauver cette partie");
menu_game->Append(Menu_Game_New,wxT("Nouvelle"),wxT("Démarrer 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,"Imprimer...","Imprimer cette partie");
menu_game->Append(Menu_Game_PrintPreview,"Préimpression","Préimpression de la partie");
menu_game->Append(Menu_Game_Print,wxT("Imprimer..."),wxT("Imprimer cette partie"));
menu_game->Append(Menu_Game_PrintPreview,wxT("Préimpression"),wxT("Préimpression de la partie"));
#ifdef ENABLE_SAVE_POSTSCRIPT
menu_game->AppendSeparator();
menu_game->Append(Menu_Game_PrintPS,"Imprimer du PostScript","Imprimer dans un fichier PostScript");
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,"Dictionnaire","Choix du dictionnaire");
menu_conf_game->Append(Menu_Conf_Game_Search,"Recherche","Options de recherche");
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_conf_board_colour = new wxMenu;
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Background,"Fond","Couleur du fond");
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lines,"Lignes","Couleur des lignes");
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->AppendSeparator();
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Letters,"Lettres jouées","Lettres jouées sur la grille");
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_TestLetters,"Lettres provisoires","Lettres du mot à jouer");
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_TestLetters,wxT("Lettres provisoires"),wxT("Lettres du mot à jouer"));
menu_conf_board_colour->AppendSeparator();
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Wx2,"Mot compte double","Mot compte double");
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Wx3,"Mot compte triple","Mot compte triple");
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lx2,"Lettre compte double","Lettre compte double");
menu_conf_board_colour->Append(Menu_Conf_Aspect_BoardColour_Lx3,"Lettre compte triple","Lettre compte triple");
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,"Couleurs d'origine","Retrouver les couleurs d'origine");
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;
menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Search,"Lettres de recherche","Police de caractères pour les recherches");
menu_conf_board_font->Append(Menu_Conf_Aspect_Font_Board,"Lettres de la grille","Police de caractères de la grille");
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_Board,wxT("Lettres de la grille"),wxT("Police de caractères de la grille"));
//
wxMenu *menu_conf = new wxMenu;
menu_conf->Append(Menu_Conf_Game,"Jeu",menu_conf_game,"Configuration du jeu");
menu_conf->Append(Menu_Conf_Aspect_Font,"Fonte des lettres",menu_conf_board_font,"Modification des fontes");
menu_conf->Append(Menu_Conf_Aspect_BoardColour,"Couleurs de la grille",menu_conf_board_colour,"Modification des couleurs");
menu_conf->Append(Menu_Conf_Print,"Impression","Dimensions de la partie");
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,"Grille","Grille de jeu");
menu_frame->Append(Menu_ShowVerif,"Vérification","Vérification d'un mot dans le dictionnaire");
menu_frame->Append(Menu_ShowSearch,"Recherche","Recherche dans le dictionnaire");
menu_frame->Append(Menu_ShowBoard,wxT("Grille"),wxT("Grille de jeu"));
menu_frame->Append(Menu_ShowVerif,wxT("Vérification"),wxT("Vérification 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,"Tirage + 1","Lettres du tirage plus une");
menu_frame->Append(Menu_ShowRacc,"Raccords","Raccords sur un mot de la recherche");
menu_frame->Append(Menu_ShowBenj,"Benjamins","Benjamins sur un mot de la recherche");
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,"Sac","Lettres restantes dans le sac");
menu_frame->Append(Menu_ShowBag,wxT("Sac"),wxT("Lettres restantes dans le sac"));
//
wxMenu *menu_quit = new wxMenu;
menu_quit->Append(Menu_Quit_Apropos,"A propos...","A propos d'Eliot");
menu_quit->Append(Menu_Quit_Confirm,"Quitter","Quitter");
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,"Partie");
menu_bar->Append(menu_conf,"Configuration");
menu_bar->Append(menu_frame,"Fenêtres");
menu_bar->Append(menu_quit,"Quitter");
menu_bar->Append(menu_game,wxT("Partie"));
menu_bar->Append(menu_conf,wxT("Configuration"));
menu_bar->Append(menu_frame,wxT("Fenêtres"));
menu_bar->Append(menu_quit,wxT("Quitter"));
SetMenuBar(menu_bar);
}
@ -321,17 +321,17 @@ MainFrame::OnCloseWindow(wxCloseEvent&)
void
MainFrame::UpdateStatusBar()
{
wxString text="";
wxString text;
text << config.getDicName();
text << " ";
text << wxT(" ");
text << config.getTileName();
statusbar->SetStatusText(text,0);
text = "";
text << "coup:" << (Game_getnrounds(game) + 1)
<< " "
<< "points:" << Game_getplayerpoints(game, 0);
text = wxT("");
text << wxT("coup:") << (Game_getnrounds(game) + 1)
<< wxT(" ")
<< wxT("points:") << Game_getplayerpoints(game, 0);
statusbar->SetStatusText(text,1);
}
@ -344,7 +344,7 @@ MainFrame::OnMenuGameNew(wxCommandEvent&)
{
Game_init(game);
Game_training_start(game);
rack->SetValue(wxString(""));
rack->SetValue(wxT(""));
results->DeleteAllItems();
UpdateStatusBar();
UpdateFrames();
@ -359,19 +359,19 @@ void
MainFrame::OnMenuGameOpen(wxCommandEvent&)
{
wxString txt;
wxFileDialog dialog(this,"Ouvrir une partie", "","","*",wxOPEN);
wxFileDialog dialog(this,wxT("Ouvrir une partie"), wxT(""),wxT(""),wxT("*"),wxOPEN);
if (Game_getdic(game) == NULL) {
wxMessageBox("Il n'y a pas de dictionnaire sélectionné", "Eliot: erreur",
wxMessageBox(wxT("Il n'y a pas de dictionnaire sélectionné"), wxT("Eliot: erreur"),
wxICON_INFORMATION | wxOK);
return;
}
if (dialog.ShowModal() == wxID_OK)
{
FILE* fin;
if ((fin = fopen((const char*)dialog.GetPath(),"r")) == NULL)
if ((fin = fopen(dialog.GetPath().mb_str(), "r")) == NULL)
{
txt << "Impossible d'ouvrir" << dialog.GetPath();
wxMessageDialog msg(this, txt, "Ouverture d'une partie");
txt << wxT("Impossible d'ouvrir") << dialog.GetPath();
wxMessageDialog msg(this, txt, wxT("Ouverture d'une partie"));
msg.ShowModal();
return ;
}
@ -382,13 +382,13 @@ MainFrame::OnMenuGameOpen(wxCommandEvent&)
break;
case 1:
{
wxMessageDialog msg(this,"Format de fichier inconnu","Chargement de partie");
wxMessageDialog msg(this,wxT("Format de fichier inconnu"),wxT("Chargement de partie"));
msg.ShowModal();
}
break;
default:
{
wxMessageDialog msg(this,"Erreur pendant la lecture de la partie","chargement de partie");
wxMessageDialog msg(this,wxT("Erreur pendant la lecture de la partie"),wxT("chargement de partie"));
msg.ShowModal();
}
break;
@ -397,7 +397,7 @@ MainFrame::OnMenuGameOpen(wxCommandEvent&)
}
char r[RACK_SIZE_MAX];
Game_getplayedrack(game,Game_getnrounds(game),r);
rack->SetValue(wxString(r));
rack->SetValue(wxU(r));
results->DeleteAllItems();
UpdateStatusBar();
UpdateFrames();
@ -412,14 +412,14 @@ void
MainFrame::OnMenuGameSave(wxCommandEvent& WXUNUSED(event))
{
wxString txt;
wxFileDialog dialog(this, "Sauver une partie", "", "", "*",wxSAVE|wxOVERWRITE_PROMPT);
wxFileDialog dialog(this, wxT("Sauver une partie"), wxT(""), wxT(""), wxT("*"),wxSAVE|wxOVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{
FILE* fout;
if ((fout = fopen((const char*)dialog.GetPath(),"w")) == NULL)
if ((fout = fopen(dialog.GetPath().mb_str(),"w")) == NULL)
{
txt << "Impossible de créer " << dialog.GetPath();
wxMessageDialog msg(this, txt, "Sauvegarde de la partie");
txt << wxT("Impossible de créer ") << dialog.GetPath();
wxMessageDialog msg(this, txt, wxT("Sauvegarde de la partie"));
msg.ShowModal();
return ;
}
@ -440,7 +440,7 @@ MainFrame::OnMenuGamePrint(wxCommandEvent& WXUNUSED(event))
wxPrinter printer(&printDialogData);
GamePrintout printout(game);
if (!printer.Print(this,&printout,TRUE))
wxMessageBox("Impression non effectuée.");
wxMessageBox(wxT("Impression non effectuée."));
}
/** ******************************
@ -459,12 +459,12 @@ MainFrame::OnMenuGamePrintPreview(wxCommandEvent& WXUNUSED(event))
if (!preview->Ok())
{
delete preview;
msg << "Problème de prévisualisation.\n"
<< "Il se peut que l'imprimante par défaut soit mal initialisée";
wxMessageBox(msg,"Impression (prévisualisation)", wxOK);
msg << wxT("Problème de prévisualisation.\n")
<< wxT("Il se peut que l'imprimante par défaut soit mal initialisée");
wxMessageBox(msg,wxT("Impression (prévisualisation)"), wxOK);
return;
}
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Impression",
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, wxT("Impression"),
wxPoint(-1, -1), wxSize(600, 550));
frame->Centre(wxBOTH);
frame->Initialize();
@ -481,38 +481,38 @@ MainFrame::OnMenuGamePrintPS(wxCommandEvent& WXUNUSED(event))
{
#ifdef ENABLE_SAVE_POSTSCRIPT
wxString txt;
wxFileDialog dialog(this, "Imprimer dans un fichier PostScript", "", "", "*.ps",wxSAVE|wxOVERWRITE_PROMPT);
wxFileDialog dialog(this, wxT("Imprimer dans un fichier PostScript"), wxT(""), wxT(""), wxT("*.ps"),wxSAVE|wxOVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{
wxPostScriptDC printps(dialog.GetPath(),FALSE,this);
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())
{
wxPrintData printdataPS;
printdataPS.SetPrintMode(wxPRINT_MODE_FILE);
printdataPS.SetFilename(dialog.GetPath());
printdataPS.SetPaperId(wxPAPER_A4);
printdataPS.SetQuality(wxPRINT_QUALITY_HIGH);
printdataPS.SetOrientation(wxPORTRAIT);
wxPrintDialogData printDialogData(printdataPS);
wxPostScriptPrinter printer(&printDialogData);
GamePrintout printout(game);
if (!printer.Print(this,&printout,FALSE))
{
wxMessageBox("Impression non effectuée.");
wxMessageBox(wxT("Impression non effectuée."));
}
else
{
wxString msg;
msg << "Dessin effectué dans " << dialog.GetPath() << "\n";
wxMessageBox(msg,"Sauvegarde PostScript", wxOK);
msg << wxT("Dessin effectué dans ") << dialog.GetPath() << wxT("\n");
wxMessageBox(msg,wxT("Sauvegarde PostScript"), wxOK);
}
}
else
{
wxString msg;
msg << "impossible d'initialiser le traitement PostScript.\n";
wxMessageBox(msg,"Sauvegarde PostScript", wxOK);
msg << wxT("impossible d'initialiser le traitement PostScript.\n");
wxMessageBox(msg,wxT("Sauvegarde PostScript"), wxOK);
}
}
#endif
@ -532,11 +532,11 @@ MainFrame::OnMenuConfGameDic(wxCommandEvent& WXUNUSED(event))
{
wxString txt,msg,dicpath;
Dictionary dic,dicold;
wxFileDialog dialog(this,"Choisir un dictionnaire", "","*.dawg","*.dawg",wxOPEN);
wxFileDialog dialog(this,wxT("Choisir un dictionnaire"), wxT(""),wxT("*.dawg"),wxT("*.dawg"),wxOPEN);
if (dialog.ShowModal() == wxID_OK)
{
wxString dicpath = dialog.GetPath();
int res=Dic_load(&dic,(const char*)dicpath);
int res=Dic_load(&dic, dicpath.mb_str());
if (res == 0)
{
/* cas normal */
@ -550,14 +550,14 @@ MainFrame::OnMenuConfGameDic(wxCommandEvent& WXUNUSED(event))
switch (res)
{
case 0: /* cas normal */ break;
case 1: msg << "chargement: problème d'ouverture de " << dicpath << "\n"; break;
case 2: msg << "chargement: mauvais en-tête de dictionnaire\n"; break;
case 3: msg << "chargement: problème 3 d'allocation mémoire\n"; break;
case 4: msg << "chargement: problème 4 d'allocation mémoire\n"; break;
case 5: msg << "chargement: problème de lecture des arcs du dictionnaire\n"; break;
default: msg << "chargement: problème non-répertorié\n"; break;
case 1: msg << wxT("chargement: problème d'ouverture de ") << dicpath << wxT("\n"); break;
case 2: msg << wxT("chargement: mauvais en-tête de dictionnaire\n"); break;
case 3: msg << wxT("chargement: problème 3 d'allocation mémoire\n"); break;
case 4: msg << wxT("chargement: problème 4 d'allocation mémoire\n"); break;
case 5: msg << wxT("chargement: problème de lecture des arcs du dictionnaire\n"); break;
default: msg << wxT("chargement: problème non-répertorié\n"); break;
}
wxMessageDialog dlg(NULL,msg,APPNAME);
wxMessageDialog dlg(NULL, msg, wxT(APPNAME));
dlg.ShowModal();
}
}
@ -610,11 +610,11 @@ MainFrame::OnMenuConfAspectFont(wxCommandEvent& event)
{
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 = wxString("Default"); break;
case Menu_Conf_Aspect_Font_Default: attr = wxT("Default"); break;
default: INCOMPLETE; break;
}
if (attr == wxString("Default"))
if (attr == wxString(wxT("Default")))
config.setFontDefault();
else
config.setFont(attr,config.ChooseFont(this,config.getFont(attr)));
@ -646,11 +646,11 @@ MainFrame::OnMenuConfAspectBoardColour(wxCommandEvent& event)
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_Default: attr = wxString("Default"); break;
case Menu_Conf_Aspect_BoardColour_Default: attr = wxT("Default"); break;
default: INCOMPLETE; break;
}
if (attr == wxString("Default"))
if (attr == wxString(wxT("Default")))
config.setColourDefault();
else
config.setColour(attr,config.ChooseColour(this,config.getColour(attr)));
@ -667,14 +667,14 @@ MainFrame::OnMenuQuitApropos(wxCommandEvent& WXUNUSED(event))
{
wxString msg;
msg << "Eliot\n© Antoine Fraboulet 1999-2004\n\n";
msg << "This program is free software; you can redistribute it and/or modify\n";
msg << "it under the terms of the GNU General Public License as published by\n";
msg << "the Free Software Foundation; either version 2 of the License, or\n";
msg << "(at your option) any later version.\n\n";
msg << "Version " << VERSION << "\n";
msg << wxT("Eliot\n© 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, "A propos d'Eliot", wxICON_INFORMATION | wxOK);
wxMessageBox(msg, wxT("A propos d'Eliot"), wxICON_INFORMATION | wxOK);
}
void
@ -713,21 +713,21 @@ MainFrame::OnSetRack(wxCommandEvent& event)
case 0x00: /* ok */
break;
case 0x01:
msg << "Le sac ne contient plus assez de lettres." << "\n";
wxMessageBox(msg,"Correction du tirage", wxICON_INFORMATION | wxOK);
msg << wxT("Le sac ne contient plus assez de lettres.") << wxT("\n");
wxMessageBox(msg,wxT("Correction du tirage"), wxICON_INFORMATION | wxOK);
break;
case 0x02:
{
msg << "Le tirage doit contenir au moins 2 consonnes et 2 voyelles" << "\n";
wxMessageDialog dlg(this, msg, "Correction du tirage");
msg << wxT("Le tirage doit contenir au moins 2 consonnes et 2 voyelles") << wxT("\n");
wxMessageDialog dlg(this, msg, wxT("Correction du tirage"));
dlg.ShowModal();
}
break;
case 0x03:
{
msg << "Le tirage doit contenir au moins 2 consonnes et 2 voyelles" << "\n"
<< "mais le sac ne contient plus assez de lettres" << "\n" << "\n";
wxMessageDialog dlg(this, msg, "Correction du tirage");
msg << wxT("Le tirage doit contenir au moins 2 consonnes et 2 voyelles") << wxT("\n")
<< wxT("mais le sac ne contient plus assez de lettres") << wxT("\n") << wxT("\n");
wxMessageDialog dlg(this, msg, wxT("Correction du tirage"));
dlg.ShowModal();
}
break;
@ -737,7 +737,7 @@ MainFrame::OnSetRack(wxCommandEvent& event)
}
Game_getplayedrack(game,Game_getnrounds(game),r);
rack->SetValue(wxString(r));
rack->SetValue(wxU(r));
Game_removetestplay(game);
results->DeleteAllItems();
UpdateFrames();
@ -758,10 +758,10 @@ MainFrame::Search()
results->SetFont(config.getFont(LISTFONT));
for(i=0; i < Game_getnresults(game); i++)
{
wxChar word[WORD_SIZE_MAX];
wxChar bonus;
wxChar coord1[3], coord2[3], coord[6];
wxChar pts[6];
char word[WORD_SIZE_MAX];
char bonus;
char coord1[3], coord2[3], coord[6];
char pts[6];
Game_getsearchedword (game,i,word);
Game_getsearchedfirstcoord (game,i,coord1);
@ -770,11 +770,11 @@ MainFrame::Search()
bonus = Game_getsearchedbonus(game,i) ? '*' : ' ';
sprintf(pts,"%3d",Game_getsearchedpoints(game,i));
long tmp = results->InsertItem(i,word);
long tmp = results->InsertItem(i,wxU(word));
results->SetItemData(tmp,i);
tmp = results->SetItem(i,1,bonus);
tmp = results->SetItem(i,2,coord);
tmp = results->SetItem(i,3,pts);
tmp = results->SetItem(i,1,(wxChar)bonus);
tmp = results->SetItem(i,2,wxU(coord));
tmp = results->SetItem(i,3,wxU(pts));
}
for(i=0; i < 4; i++)
@ -795,29 +795,29 @@ MainFrame::OnSearch(wxCommandEvent& WXUNUSED(event))
char r[RACK_SIZE_MAX];
if (Game_getdic(game) == NULL)
{
wxMessageBox("Vous devez choisir un dictionnaire","Eliot: erreur",wxICON_INFORMATION | wxOK);
wxMessageBox(wxT("Vous devez choisir un dictionnaire"),wxT("Eliot: erreur"),wxICON_INFORMATION | wxOK);
return;
}
Game_removetestplay(game);
switch (Game_training_setrackmanual(game,config.getRackChecking(),(const char*)rack->GetValue()))
switch (Game_training_setrackmanual(game, config.getRackChecking(), rack->GetValue().mb_str()))
{
case 0x00: break;
case 0x01:
msg << "Le sac ne contient pas assez de lettres" << "\n"
<< "pour assurer le tirage.";
wxMessageBox(msg,"Correction du tirage", wxICON_INFORMATION | wxOK);
msg << wxT("Le sac ne contient pas assez de lettres") << wxT("\n")
<< wxT("pour assurer le tirage.");
wxMessageBox(msg,wxT("Correction du tirage"), wxICON_INFORMATION | wxOK);
return;
case 0x02:
msg << "Le tirage doit contenir au moins 2 consonnes et 2 voyelles" << "\n";
wxMessageBox(msg,"Correction du tirage", wxICON_INFORMATION | wxOK);
msg << wxT("Le tirage doit contenir au moins 2 consonnes et 2 voyelles") << wxT("\n");
wxMessageBox(msg,wxT("Correction du tirage"), wxICON_INFORMATION | wxOK);
return;
default: statusbar->SetStatusText("Le tirage a été modifié manuellement",0); break;
default: statusbar->SetStatusText(wxT("Le tirage a été modifié manuellement"),0); break;
}
Game_getplayedrack(game,Game_getnrounds(game),r);
rack->SetValue(wxString(r));
rack->SetValue(wxU(r));
Search();
@ -837,7 +837,7 @@ MainFrame::Play(int n)
Game_training_playresult(game,n);
Game_getplayedrack(game,Game_getnrounds(game),r);
rack->SetValue(wxString(r));
rack->SetValue(wxU(r));
results->DeleteAllItems();
UpdateStatusBar();
UpdateFrames();

View file

@ -16,10 +16,12 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: printout.cc,v 1.2 2004/08/07 18:10:42 ipkiss Exp $ */
/* $Id: printout.cc,v 1.3 2005/01/01 15:42:55 ipkiss Exp $ */
#include <stdio.h>
#include <wx/wx.h>
#include "ewx.h"
#include "dic.h"
@ -28,7 +30,7 @@
#include "configdb.h"
#include "printout.h"
bool
bool
GamePrintout::OnPrintPage(int page)
{
wxDC *dc = GetDC();
@ -43,13 +45,13 @@ GamePrintout::OnPrintPage(int page)
return FALSE;
}
bool
bool
GamePrintout::HasPage(int pageNum)
{
return pageNum == 1;
}
bool
bool
GamePrintout::OnBeginDocument(int startPage, int endPage)
{
if (!wxPrintout::OnBeginDocument(startPage, endPage))
@ -58,7 +60,7 @@ GamePrintout::OnBeginDocument(int startPage, int endPage)
return TRUE;
}
void
void
GamePrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
{
*minPage = 1;
@ -71,12 +73,12 @@ void
GamePrintout::SetSpaces(wxString* str, int spaces)
{
size_t i;
wxString strs = "";
wxString strs = wxT("");
if (str->Len() == 0)
return ;
for(i=0; i < (str->Len()-1); i++) {
strs = strs + str->GetChar(i);
strs = strs + wxString(' ',spaces);
strs = strs + wxString(wxChar(' '), spaces);
}
strs = strs + str->GetChar(str->Len() - 1);
*str = strs;
@ -91,7 +93,7 @@ GamePrintout::DrawStringJustif(wxDC *dc, wxString *str, long x, long y, long w,
SetSpaces(str,spaces);
dc->GetTextExtent(*str,&wtext,&htext);
switch (justif)
switch (justif)
{
case LEFT:
break;
@ -113,7 +115,7 @@ GamePrintout::DrawHeadingLine(wxDC *dc, long heightH, float mmToLogical)
x = config.getMarginX() + config.getDxBegin();
y = config.getMarginY() + config.getDyT1();
for(i=0; i<5; i++)
for(i=0; i<5; i++)
{
w = config.getDxText(i);
str = config.getNameH(i);
@ -145,12 +147,12 @@ GamePrintout::DrawTextLine(wxDC *dc, int numline, long basey, long heightT, floa
long x,y,w;
char buff[400];
wxString str;
x = config.getMarginX() + config.getDxBegin();
y = basey + config.getDyT1()
+ numline * (config.getDyT1() + heightT + config.getDyT2());
w = config.getDxText(0);
str = "";
str = wxT("");
// num
if (numline < Game_getnrounds(game)) {
str << (numline + 1);
@ -160,28 +162,28 @@ GamePrintout::DrawTextLine(wxDC *dc, int numline, long basey, long heightT, floa
DIM(1);
if (numline < Game_getnrounds(game)) {
Game_getplayedrack(game,numline,buff);
str = buff;
str = wxU(buff);
DRW(1);
}
// word
DIM(2);
if ((numline > 0) && (numline <= Game_getnrounds(game))) {
Game_getplayedword(game,numline - 1,buff);
str = buff;
str = wxU(buff);
DRW(2);
}
// pos
DIM(3);
if ((numline > 0) && (numline <= Game_getnrounds(game))) {
Game_getplayedcoord(game,numline - 1,buff);
str = buff;
str = wxU(buff);
DRW(3);
}
// pts
DIM(4);
if ((numline > 0) && (numline <= Game_getnrounds(game))) {
sprintf(buff,"%d",Game_getplayedpoints(game,numline - 1));
str = buff;
str = wxU(buff);
DRW(4);
}
// total points
@ -193,10 +195,10 @@ GamePrintout::DrawTextLine(wxDC *dc, int numline, long basey, long heightT, floa
#undef DRW
}
void
void
GamePrintout::DrawPage(wxDC *dc)
{
/*
/*
* Scaling.
*/
// Get the logical pixels per inch of screen and printer
@ -231,10 +233,10 @@ GamePrintout::DrawPage(wxDC *dc)
wxFont Hfont = config.getFont(PRINTHFONT);
wxFont Tfont = config.getFont(PRINTTFONT);
wxColour *wxBlack = wxTheColourDatabase->FindColour("BLACK");
wxColour *wxWhite = wxTheColourDatabase->FindColour("WHITE");
wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID);
wxColour wxBlack = wxTheColourDatabase->Find(wxT("BLACK"));
wxColour wxWhite = wxTheColourDatabase->Find(wxT("WHITE"));
wxPen *blackPen = wxThePenList->FindOrCreatePen(wxBlack, 1, wxSOLID);
wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(wxWhite, wxSOLID);
dc->SetPen(* blackPen);
dc->SetBrush(* whiteBrush);
@ -260,10 +262,10 @@ GamePrintout::DrawGameLines(wxDC *dc, long heightH, long heightT,
long col,lin, StartX, StartY;
long HeadHeight, LineHeight;
long TextStart, TextHeight, TextBottom, TextRight;
float SCALE = config.getPrintLineScale();
dc->SetUserScale(SCALE,SCALE);
nTextLines = Game_getnrounds(game) + 2;
StartX = config.getMarginX();
StartY = config.getMarginY();

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: printout.h,v 1.1 2004/04/08 09:43:06 afrab Exp $ */
/* $Id: printout.h,v 1.2 2005/01/01 15:42:55 ipkiss Exp $ */
// -*- C++ -*-
#ifndef _PRINTOUT_H
@ -38,8 +38,8 @@ private:
void DrawGameLines(wxDC*, long, long, float, float, float);
public:
GamePrintout(Game g, char* title= APPNAME) : wxPrintout(title) { game = g; }
GamePrintout(Game g, char* title= APPNAME) : wxPrintout(wxU(title)) { game = g; }
bool OnPrintPage(int);
bool HasPage(int);
bool OnBeginDocument(int startPage, int endPage);

View file

@ -16,21 +16,21 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* $Id: searchpanel.cc,v 1.3 2004/06/22 21:04:09 ipkiss Exp $ */
/* $Id: searchpanel.cc,v 1.4 2005/01/01 15:42:55 ipkiss Exp $ */
#include <string.h>
#include "ewx.h"
#include "dic.h"
#include "dic_search.h"
#include "searchpanel.h"
#include "configdb.h"
#include "wx/panel.h"
#include "wx/textctrl.h"
#include "wx/listbox.h"
#include "wx/sizer.h"
#include "wx/intl.h"
#include "ewx.h"
#include "dic.h"
#include "dic_search.h"
#include "searchpanel.h"
#include "configdb.h"
enum {
ID_PANEL_CROSS,
ID_PANEL_PLUS1,
@ -64,12 +64,12 @@ BEGIN_EVENT_TABLE(SimpleSearchPanel, wxPanel)
EVT_TEXT_ENTER(ID_TEXT, SimpleSearchPanel::compute_enter)
END_EVENT_TABLE()
SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic)
SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic)
: wxPanel(parent,id)
{
dic_ = dic;
t = new wxTextCtrl(this,ID_TEXT,"",wxPoint(0,0),wxSize(-1,-1),wxTE_PROCESS_ENTER);
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));
@ -85,14 +85,14 @@ SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic)
sizer->SetSizeHints(this);
}
int
int
SimpleSearchPanel::check()
{
wxString msg("");
wxString msg = wxT("");
if (dic_ == NULL)
{
l->Clear();
msg << "Pas de dictionnaire";
msg << wxT("Pas de dictionnaire");
l->Append(msg);
return 0;
}
@ -125,23 +125,23 @@ PCross::compute_enter(wxCommandEvent&)
if (t->GetValue().Len() >= DIC_WORD_MAX)
{
wxString msg("");
msg << "La recherche est limitée à " << DIC_WORD_MAX - 1 << " lettres";
wxString msg = wxT("");
msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 << wxT(" lettres");
l->Append(msg);
return;
}
strncpy(rack,t->GetValue().c_str(),DIC_WORD_MAX);
strncpy(rack,t->GetValue().mb_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++] = wxString(buff[i]);
res[resnum++] = wxU(buff[i]);
l->Set(resnum,res);
if (l->GetCount() == 0)
l->Append("Aucun résultat");
l->Append(wxT("Aucun résultat"));
}
// ************************************************************
@ -169,13 +169,13 @@ PPlus1::compute_enter(wxCommandEvent&)
if (t->GetValue().Len() >= DIC_WORD_MAX)
{
wxString msg("");
msg << "La recherche est limitée à " << DIC_WORD_MAX - 1 << " lettres";
wxString msg = wxT("");
msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 << wxT(" lettres");
l->Append(msg);
return;
}
strncpy(rack,t->GetValue().c_str(),DIC_WORD_MAX);
strncpy(rack,t->GetValue().mb_str(),DIC_WORD_MAX);
Dic_search_7pl1(dic_,rack,buff,TRUE);
int resnum = 0;
@ -183,14 +183,14 @@ PPlus1::compute_enter(wxCommandEvent&)
for(i=0; i < LETTERS; i++)
{
if (i && buff[i][0][0])
res[resnum++] = wxString("+") + wxString((char)(i+'A'-1));
res[resnum++] = wxString(wxT("+")) + (wxChar)(i+'A'-1);
for(j=0; j < RES_7PL1_MAX && buff[i][j][0]; j++)
res[resnum++] = wxString(" ") + wxString(buff[i][j]);
res[resnum++] = wxString(wxT(" ")) + wxU(buff[i][j]);
}
l->Set(resnum,res);
if (l->GetCount() == 0)
l->Append("Aucun résultat");
l->Append(wxT("Aucun résultat"));
}
// ************************************************************
@ -216,17 +216,17 @@ PRegExp::compute_enter(wxCommandEvent&)
if (!check())
return;
strncpy(re,t->GetValue().c_str(),DIC_WORD_MAX);
strncpy(re, t->GetValue().mb_str(),DIC_WORD_MAX);
Dic_search_RegE(dic_,re,buff);
int resnum = 0;
wxString res[RES_REGE_MAX];
for(i=0; i < RES_REGE_MAX && buff[i][0]; i++)
res[resnum++] = wxString(buff[i]);
res[resnum++] = wxU(buff[i]);
l->Set(resnum,res);
if (l->GetCount() == 0)
l->Append("Aucun résultat");
l->Append(wxT("Aucun résultat"));
}
// ************************************************************
@ -236,10 +236,10 @@ PRegExp::compute_enter(wxCommandEvent&)
SearchPanel::SearchPanel(wxFrame *parent, Dictionary dic) :
wxNotebook(parent, -1)
{
AddPage(new PCross(this,ID_PANEL_CROSS,dic),"Mots croisés");
AddPage(new PPlus1(this,ID_PANEL_PLUS1,dic),"Plus 1");
AddPage(new PRegExp(this,ID_PANEL_REGEXP,dic),"Exp. Rationnelle");
SetSelection(0);
AddPage(new PCross(this,ID_PANEL_CROSS,dic),wxT("Mots croisés"));
AddPage(new PPlus1(this,ID_PANEL_PLUS1,dic),wxT("Plus 1"));
AddPage(new PRegExp(this,ID_PANEL_REGEXP,dic),wxT("Exp. Rationnelle"));
SetSelection(0);
}
SearchPanel::~SearchPanel()