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 - pour la cross-compilation depuis GNU/Linux, configurer avec la ligne
de commande suivante : de commande suivante :
CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ \ 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 --with-wx-config=/path/to/wx-config
en prenant soin d'indiquer le chemin correct vers le fichier en prenant soin d'indiquer le chemin correct vers le fichier
'wx-config' de l'installation de wxWindows. 'wx-config' de l'installation de wxWindows.

View file

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

View file

@ -16,7 +16,9 @@
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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" #include "ewx.h"
@ -27,8 +29,6 @@
#include "printout.h" #include "printout.h"
#include "confdimdlg.h" #include "confdimdlg.h"
#include "wx/printdlg.h"
enum { enum {
Button_Ok, Button_Ok,
Button_Cancel, Button_Cancel,
@ -60,13 +60,13 @@ max(int i,int j)
ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd) ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
: wxDialog(parent,-1,wxString("Eliot : Impression")) : wxDialog(parent,-1,wxT("Eliot : Impression"))
{ {
int i; int i;
wxString choices[3]; wxString choices[3];
choices[0] = "gauche"; choices[0] = wxT("gauche");
choices[1] = "centré"; choices[1] = wxT("centré");
choices[2] = "droite"; choices[2] = wxT("droite");
wxStaticText* Hcomment[5]; wxStaticText* Hcomment[5];
wxRect Hcommentrect[5]; wxRect Hcommentrect[5];
wxRect Htitlerect[5]; wxRect Htitlerect[5];
@ -78,10 +78,10 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
wxStaticText* Tunit[5]; wxStaticText* Tunit[5];
wxRect Tjustrect[5]; wxRect Tjustrect[5];
wxRect Tspacesrect[5]; wxRect Tspacesrect[5];
printdata = pd; printdata = pd;
pagesetupdata = psd; pagesetupdata = psd;
// //
// Head // Head
// Hcomment Htitle Hjust Hspaces // Hcomment Htitle Hjust Hspaces
@ -106,7 +106,7 @@ ConfDimDlg::ConfDimDlg(wxWindow* parent, wxPrintData pd, wxPageSetupData psd)
// ------------ // ------------
// Text Section // Text Section
// ------------ // ------------
#define TFONT wxPoint(HSPACE, Hcommentrect[4].GetBottom() + 2*VSPACE) #define TFONT wxPoint(HSPACE, Hcommentrect[4].GetBottom() + 2*VSPACE)
#define TCOMMENTY(i) (i==0 ? bfonttextrect.GetBottom() + VSPACE : \ #define TCOMMENTY(i) (i==0 ? bfonttextrect.GetBottom() + VSPACE : \
VSPACE + Tcommentrect[i-1].GetBottom()) 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) #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(); 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(); wxRect spacerect = space->GetRect();
// heading, first part // 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(); wxRect bfontheadrect = bfontheader->GetRect();
for(i=0; i<5; i++) for(i=0; i<5; i++)
{ {
wxString txt; wxString txt;
txt << "Titre colonne " << (i+1); txt << wxT("Titre colonne ") << (i+1);
Hcomment[i] = new wxStaticText(this,-1,txt,HCOMMENT(i)); Hcomment[i] = new wxStaticText(this,-1,txt,HCOMMENT(i));
Hcommentrect[i] = Hcomment[i]->GetRect(); Hcommentrect[i] = Hcomment[i]->GetRect();
} }
// text, first part // 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(); wxRect bfonttextrect = bfonttext->GetRect();
for(i=0; i<5; i++) for(i=0; i<5; i++)
{ {
wxString txt; 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)); Tcomment[i] = new wxStaticText(this,-1,txt,TCOMMENT(i),wxSize(-1,-1));
Tcommentrect[i] = Tcomment[i]->GetRect(); Tcommentrect[i] = Tcomment[i]->GetRect();
} }
// heading, second part // 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(); 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); Hjust[i] = new wxChoice(this,-1,HJUST(i),wxSize(-1,-1),3,choices);
Hjustrect[i] = Hjust[i]->GetRect(); 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(); 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 // 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(); 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()+ wxPoint(Tdimrect[i].GetRight()+
HSPACE,TCOMMENTY(i)+2), HSPACE,TCOMMENTY(i)+2),
wxSize(-1,-1)); wxSize(-1,-1));
Tjust[i] = new wxChoice(this,-1,TJUST(i),wxSize(-1,-1),3,choices); Tjust[i] = new wxChoice(this,-1,TJUST(i),wxSize(-1,-1),3,choices);
Tjustrect[i] = Tjust[i]->GetRect(); 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(); 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.GetBottom() - justifrect.GetTop())));
justifrect = justif->GetRect(); justifrect = justif->GetRect();
space->Move(wxPoint(Tspacesrect[0].GetLeft(),justifrect.GetTop())); 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) #define DIM wxSize(30,-1)
// Left part // 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(); 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(); 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(); 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(); 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(); 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(); 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(); 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(); 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(); wxRect dxbeginmmrect = dxbeginmm->GetRect();
// Right part // 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(); 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(); 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(); 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(); 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(); 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(); 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(); 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(); 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(); wxRect dxendmmrect = dxendmm->GetRect();
// shutdown warnings // 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(Tspacesrect[0].GetRight() - CANCELWIDTH,BPOS)
//#define BCANCELPOINT wxPoint(dxendmmrect.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(); 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(); // wxRect bpagerect = bpage->GetRect();
bpage->SetToolTip("Configurer la taille de page"); bpage->SetToolTip(wxT("Configurer la taille de page"));
bcancel = new wxButton(this,Button_Cancel,"Annuler"); bcancel = new wxButton(this,Button_Cancel,wxT("Annuler"));
wxRect bcancelrect = bcancel->GetRect(); wxRect bcancelrect = bcancel->GetRect();
bcancel->Move(BCANCELPOINT); bcancel->Move(BCANCELPOINT);
bcancelrect = bcancel->GetRect(); bcancelrect = bcancel->GetRect();
bcancel->SetToolTip("Annuler les dernier changements et quitter"); bcancel->SetToolTip(wxT("Annuler les dernier changements et quitter"));
bok = new wxButton(this,Button_Ok,"Quitter"); bok = new wxButton(this,Button_Ok,wxT("Quitter"));
wxRect bokrect = bok->GetRect(); wxRect bokrect = bok->GetRect();
bok->Move(BOKPOINT); bok->Move(BOKPOINT);
bokrect = bok->GetRect(); bokrect = bok->GetRect();
bok->SetToolTip("Enregistrer les changements et quitter"); bok->SetToolTip(wxT("Enregistrer les changements et quitter"));
#define DLGWIDTH (bcancelrect.GetRight() + HSPACE) #define DLGWIDTH (bcancelrect.GetRight() + HSPACE)
#define DLGHEIGHT (bokrect.GetBottom() + VSPACE) #define DLGHEIGHT (bokrect.GetBottom() + VSPACE)
@ -332,7 +332,7 @@ ConfDimDlg::get(wxTextCtrl* t)
{ {
wxString str; wxString str;
str = t->GetValue(); str = t->GetValue();
return atoi((const char*)str); return atoi(str.mb_str());
} }
void void
@ -387,7 +387,7 @@ ConfDimDlg::writeconf()
for(i=0; i<5; i++) { for(i=0; i<5; i++) {
wxString str; wxString str;
str = Tdim[i]->GetValue(); str = Tdim[i]->GetValue();
config.setDxText(i,atoi((const char*)str)); config.setDxText(i,atoi(str.mb_str()));
switch (Tjust[i]->GetSelection()) { switch (Tjust[i]->GetSelection()) {
case -1: break; case -1: break;
case 0: config.setJustifT(i,LEFT); 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 */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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 <iostream>
#include "ewx.h" #include "ewx.h"
#include "configdb.h" #include "configdb.h"
#include "wx/colordlg.h" #include "wx/colordlg.h"
#include "wx/fontdlg.h" #include "wx/fontdlg.h"
#include "wx/settings.h" #include "wx/settings.h"
using namespace std; using namespace std;
#define DIM 200 #define DIM 200
#define PREFIX "/" #define PREFIX "/"
#define DICPATH PREFIX"Fichiers/Dictionnaire_Chemin" #define DICPATH wxT(PREFIX"Fichiers/Dictionnaire_Chemin")
#define DICNAME PREFIX"Fichiers/Dictionnaire_Nom" #define DICNAME wxT(PREFIX"Fichiers/Dictionnaire_Nom")
#define TILEPATH PREFIX"Fichiers/Lettres_Chemin" #define TILEPATH wxT(PREFIX"Fichiers/Lettres_Chemin")
#define TILENAME PREFIX"Fichiers/Lettres_Nom" #define TILENAME wxT(PREFIX"Fichiers/Lettres_Nom")
/////////////////////////// ///////////////////////////
// //
// Print // Print
// //
/////////////////////////// ///////////////////////////
#define ORIENT PREFIX"Print/Page_Orientation" #define ORIENT wxT(PREFIX"Print/Page_Orientation")
#define MARGINX PREFIX"Print/Page_MargeGauche" #define MARGINX wxT(PREFIX"Print/Page_MargeGauche")
#define MARGINY PREFIX"Print/Page_MargeHaute" #define MARGINY wxT(PREFIX"Print/Page_MargeHaute")
#define HNAME PREFIX"Print/Header/Nom/" #define HNAME wxT(PREFIX"Print/Header/Nom/")
#define HDIM PREFIX"Print/Header/Dimensions/" #define HDIM wxT(PREFIX"Print/Header/Dimensions/")
#define HJUST PREFIX"Print/Header/Justification/" #define HJUST wxT(PREFIX"Print/Header/Justification/")
#define HSPACE PREFIX"Print/Header/Espacement/" #define HSPACE wxT(PREFIX"Print/Header/Espacement/")
#define TDIM PREFIX"Print/Text/Dimensions/" #define TDIM wxT(PREFIX"Print/Text/Dimensions/")
#define TJUST PREFIX"Print/Text/Justification/" #define TJUST wxT(PREFIX"Print/Text/Justification/")
#define TSPACE PREFIX"Print/Text/Espacement/" #define TSPACE wxT(PREFIX"Print/Text/Espacement/")
#define MISC PREFIX"Divers/" #define MISC wxT(PREFIX"Divers/")
ConfigDB::ConfigDB() ConfigDB::ConfigDB()
{ {
@ -91,40 +91,40 @@ long ConfigDB::Read(const wxString& key, long def)
return res; return res;
} }
#define FPOINTSIZE ".PointSize" #define FPOINTSIZE wxT(".PointSize")
#define FFAMILY ".Family" #define FFAMILY wxT(".Family")
#define FSTYLE ".Style" #define FSTYLE wxT(".Style")
#define FWEIGHT ".Weight" #define FWEIGHT wxT(".Weight")
#define FUNDERLINE ".Underline" #define FUNDERLINE wxT(".Underline")
#define FFACENAME ".FaceName" #define FFACENAME wxT(".FaceName")
#define FENCODING ".Encoding" #define FENCODING wxT(".Encoding")
wxFont ConfigDB::Read(const wxString& key, wxFont def) wxFont ConfigDB::Read(const wxString& key, wxFont def)
{ {
return wxFont(Read(key + FPOINTSIZE,(long)def.GetPointSize()), return wxFont(Read(key + FPOINTSIZE,(long)def.GetPointSize()),
Read(key + FFAMILY ,(long)def.GetFamily()), Read(key + FFAMILY ,(long)def.GetFamily()),
Read(key + FSTYLE ,(long)def.GetStyle()), Read(key + FSTYLE ,(long)def.GetStyle()),
Read(key + FWEIGHT ,(long)def.GetWeight()), Read(key + FWEIGHT ,(long)def.GetWeight()),
Read(key + FUNDERLINE,(long)def.GetUnderlined()), Read(key + FUNDERLINE,(long)def.GetUnderlined()),
ReadStr(key + FFACENAME ,def.GetFaceName()) ReadStr(key + FFACENAME ,def.GetFaceName())
//,Read(key + FENCODING ,def.GetDefaultEncoding()) //,Read(key + FENCODING ,def.GetDefaultEncoding())
); );
} }
void ConfigDB::Write(const wxString& key, wxFont font) void ConfigDB::Write(const wxString& key, wxFont font)
{ {
pConfig->Write(key + FPOINTSIZE,(long)font.GetPointSize()); pConfig->Write(key + FPOINTSIZE,(long)font.GetPointSize());
pConfig->Write(key + FFAMILY ,(long)font.GetFamily()); pConfig->Write(key + FFAMILY ,(long)font.GetFamily());
pConfig->Write(key + FSTYLE ,(long)font.GetStyle()); pConfig->Write(key + FSTYLE ,(long)font.GetStyle());
pConfig->Write(key + FWEIGHT ,(long)font.GetWeight()); pConfig->Write(key + FWEIGHT ,(long)font.GetWeight());
pConfig->Write(key + FUNDERLINE,(long)font.GetUnderlined()); pConfig->Write(key + FUNDERLINE,(long)font.GetUnderlined());
pConfig->Write(key + FFACENAME ,font.GetFaceName()); pConfig->Write(key + FFACENAME ,font.GetFaceName());
//pConfig->Write(key + FENCODING ,font.GetDefaultEncoding()); //pConfig->Write(key + FENCODING ,font.GetDefaultEncoding());
} }
#define CR ".R" #define CR wxT(".R")
#define CG ".G" #define CG wxT(".G")
#define CB ".B" #define CB wxT(".B")
wxColour ConfigDB::Read(const wxString& key, wxColour def) wxColour ConfigDB::Read(const wxString& key, wxColour def)
{ {
@ -145,7 +145,7 @@ wxString ConfigDB::ReadStr(const wxString& key, wxString def)
{ {
wxString res; wxString res;
/* /*
wxString msg; wxString msg;
msg << "want to read -" << key << "-"; msg << "want to read -" << key << "-";
wxMessageBox(msg, "Eliot configDB", wxICON_INFORMATION | wxOK); wxMessageBox(msg, "Eliot configDB", wxICON_INFORMATION | wxOK);
@ -188,22 +188,22 @@ void ConfigDB::Write(const wxString& key, wxString str)
wxString ConfigDB::getDicPath() wxString ConfigDB::getDicPath()
{ {
return ReadStr(DICPATH,wxString("//")); return ReadStr(DICPATH,wxT("//"));
} }
wxString ConfigDB::getDicName() wxString ConfigDB::getDicName()
{ {
return ReadStr(DICNAME,wxString("Aucun Dictionnaire")); return ReadStr(DICNAME,wxT("Aucun Dictionnaire"));
} }
wxString ConfigDB::getTilePath() wxString ConfigDB::getTilePath()
{ {
return ReadStr(TILEPATH,wxString("//")); return ReadStr(TILEPATH,wxT("//"));
} }
wxString ConfigDB::getTileName() wxString ConfigDB::getTileName()
{ {
return ReadStr(TILENAME,wxString("")); return ReadStr(TILENAME,wxT(""));
} }
void ConfigDB::setDicPath(wxString dpath, wxString dname) void ConfigDB::setDicPath(wxString dpath, wxString dname)
@ -237,7 +237,7 @@ void ConfigDB::setDxBegin(long d)
long ConfigDB::getDxText(int i) long ConfigDB::getDxText(int i)
{ {
long int res; long int res;
switch (i) switch (i)
{ {
case 0: res = Read(TDIM"texte/1",10L); break; case 0: res = Read(TDIM"texte/1",10L); break;
case 1: res = Read(TDIM"texte/2",30L); 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) void ConfigDB::setDxText(int i, long v)
{ {
wxString key; wxString key;
key << TDIM << "texte/" << (i+1); key << TDIM << wxT("texte/") << (i+1);
if (i<5) if (i<5)
Write(key,v); Write(key,v);
} }
@ -310,14 +310,14 @@ void ConfigDB::setDyH2(long d)
wxString ConfigDB::getNameH(int i) wxString ConfigDB::getNameH(int i)
{ {
wxString res; wxString res;
switch (i) switch (i)
{ {
case 0: res = ReadStr(wxString(HNAME)+wxString("1"),wxString("Num")); break; case 0: res = ReadStr(wxString(HNAME) + wxT("1"), wxT("Num")); break;
case 1: res = ReadStr(wxString(HNAME)+wxString("2"),wxString("Tirage")); break; case 1: res = ReadStr(wxString(HNAME) + wxT("2"), wxT("Tirage")); break;
case 2: res = ReadStr(wxString(HNAME)+wxString("3"),wxString("Solution")); break; case 2: res = ReadStr(wxString(HNAME) + wxT("3"), wxT("Solution")); break;
case 3: res = ReadStr(wxString(HNAME)+wxString("4"),wxString("Pos")); break; case 3: res = ReadStr(wxString(HNAME) + wxT("4"), wxT("Pos")); break;
case 4: res = ReadStr(wxString(HNAME)+wxString("5"),wxString("Pts")); break; case 4: res = ReadStr(wxString(HNAME) + wxT("5"), wxT("Pts")); break;
default: res = ""; break; default: res = wxT(""); break;
} }
return res; return res;
} }
@ -338,11 +338,11 @@ void ConfigDB::setNameH(int i, wxString str)
enum Justif ConfigDB::StrToJust(const wxString& str) enum Justif ConfigDB::StrToJust(const wxString& str)
{ {
enum Justif res; enum Justif res;
if (str.CmpNoCase("gauche") == 0) if (str.CmpNoCase(wxT("gauche")) == 0)
res = LEFT; res = LEFT;
else if (str.CmpNoCase("centre") == 0) else if (str.CmpNoCase(wxT("centre")) == 0)
res = CENTER; res = CENTER;
else if (str.CmpNoCase("droite") == 0) else if (str.CmpNoCase(wxT("droite")) == 0)
res = RIGHT; res = RIGHT;
else else
res = LEFT; res = LEFT;
@ -353,16 +353,16 @@ wxString ConfigDB::JustToStr(enum Justif j)
{ {
wxString res; wxString res;
switch (j) { switch (j) {
case LEFT: res = "gauche"; break; case LEFT: res = wxT("gauche"); break;
case CENTER: res = "centre"; break; case CENTER: res = wxT("centre"); break;
case RIGHT: res = "droite"; break; case RIGHT: res = wxT("droite"); break;
} }
return res; return res;
} }
enum Justif ConfigDB::getJustif(const wxString& key) 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) void ConfigDB::setJustif(const wxString& key, enum Justif j)
@ -464,7 +464,7 @@ void ConfigDB::setFontDefault()
setFont(LISTFONT ,fsys); setFont(LISTFONT ,fsys);
setFont(PRINTHFONT,FHEADERDEF); setFont(PRINTHFONT,FHEADERDEF);
setFont(PRINTTFONT,FTEXTDEF); setFont(PRINTTFONT,FTEXTDEF);
} }
void ConfigDB::setFont(wxString key, wxFont font) 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; long res;
wxString str; wxString str;
str = ReadStr(ORIENT,"paysage"); str = ReadStr(ORIENT,wxT("paysage"));
if (str.CmpNoCase("portrait") == 0) if (str.CmpNoCase(wxT("portrait")) == 0)
res = wxPORTRAIT; res = wxPORTRAIT;
else if (str.CmpNoCase("paysage") == 0) else if (str.CmpNoCase(wxT("paysage")) == 0)
res = wxLANDSCAPE; res = wxLANDSCAPE;
else else
res = wxPORTRAIT; res = wxPORTRAIT;
@ -571,11 +571,11 @@ long ConfigDB::getOrientation()
void ConfigDB::setOrientation(long o) 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 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 PX wxT("/x")
#define PY "/y" #define PY wxT("/y")
#define SW "/w" #define SW wxT("/w")
#define SH "/h" #define SH wxT("/h")
#define SHOW "/show" #define SHOW wxT("/show")
#define CONFIG_DEFAULT_X 150L #define CONFIG_DEFAULT_X 150L
#define CONFIG_DEFAULT_Y 150L #define CONFIG_DEFAULT_Y 150L
@ -639,7 +639,7 @@ wxPoint ConfigDB::getFramePos(wxString frame)
pos.x = Read(keyX,CONFIG_DEFAULT_X); pos.x = Read(keyX,CONFIG_DEFAULT_X);
pos.y = Read(keyY,CONFIG_DEFAULT_Y); pos.y = Read(keyY,CONFIG_DEFAULT_Y);
#ifdef FRAME_TRACE #ifdef FRAME_TRACE
cerr << "configdb::getFramePos " << frame cerr << "configdb::getFramePos " << frame
<< " \tx:" << pos.x << " y:" << pos.y << endl; << " \tx:" << pos.x << " y:" << pos.y << endl;
#endif #endif
return pos; return pos;
@ -648,7 +648,7 @@ wxPoint ConfigDB::getFramePos(wxString frame)
void ConfigDB::setFramePos(wxString frame, wxPoint pos) void ConfigDB::setFramePos(wxString frame, wxPoint pos)
{ {
#ifdef FRAME_TRACE #ifdef FRAME_TRACE
cerr << "configdb::setFramePos " << frame cerr << "configdb::setFramePos " << frame
<< " \tx:" << pos.x << " y:" << pos.y << endl; << " \tx:" << pos.x << " y:" << pos.y << endl;
#endif #endif
wxString keyX(frame + PX); wxString keyX(frame + PX);
@ -665,16 +665,16 @@ wxSize ConfigDB::getFrameSize(wxString frame)
size.x = Read(keyX,CONFIG_DEFAULT_W); size.x = Read(keyX,CONFIG_DEFAULT_W);
size.y = Read(keyY,CONFIG_DEFAULT_H); size.y = Read(keyY,CONFIG_DEFAULT_H);
#ifdef FRAME_TRACE #ifdef FRAME_TRACE
cerr << "configdb::getFrameSize " << frame cerr << "configdb::getFrameSize " << frame
<< " \tw:" << size.x << " h:" << size.y << endl; << " \tw:" << size.x << " h:" << size.y << endl;
#endif #endif
return size; return size;
} }
void ConfigDB::setFrameSize(wxString frame, wxSize size) void ConfigDB::setFrameSize(wxString frame, wxSize size)
{ {
#ifdef FRAME_TRACE #ifdef FRAME_TRACE
cerr << "configdb::setFrameSize " << frame cerr << "configdb::setFrameSize " << frame
<< " \tw:" << size.x << " h:" << size.y << endl; << " \tw:" << size.x << " h:" << size.y << endl;
#endif #endif
wxString keyX(frame + SW); wxString keyX(frame + SW);
@ -697,14 +697,14 @@ void ConfigDB::setFrameShow(wxString frame, int s)
void ConfigDB::setFrameDefault() void ConfigDB::setFrameDefault()
{ {
setFrameSize(FRAMEBOARD ,wxSize(450,450)); setFrameSize(FRAMEBOARD ,wxSize(450,450));
setFrameSize(FRAMEVERIF ,wxSize(150,50)); setFrameSize(FRAMEVERIF ,wxSize(150,50));
setFrameSize(FRAMESEARCH,wxSize(350,300)); setFrameSize(FRAMESEARCH ,wxSize(350,300));
setFrameSize(FRAMEPLUS1 ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H)); setFrameSize(FRAMEPLUS1 ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMERACC ,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(FRAMEBENJ ,wxSize(CONFIG_DEFAULT_W,CONFIG_DEFAULT_H));
setFrameSize(FRAMEBAG ,wxSize(150,40)); setFrameSize(FRAMEBAG ,wxSize(150,40));
setFrameSize(APPNAME ,wxSize(410,200)); setFrameSize(wxT(APPNAME),wxSize(410,200));
setFramePos(FRAMEBOARD ,wxPoint(58,76)); setFramePos(FRAMEBOARD ,wxPoint(58,76));
setFramePos(FRAMEVERIF ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y)); 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(FRAMERACC ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
setFramePos(FRAMEBENJ ,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(FRAMEBAG ,wxPoint(CONFIG_DEFAULT_X,CONFIG_DEFAULT_Y));
setFramePos(APPNAME ,wxPoint(500,9)); setFramePos(wxT(APPNAME),wxPoint(500,9));
setFrameShow(FRAMEBOARD ,1L); setFrameShow(FRAMEBOARD ,1L);
setFrameShow(FRAMEVERIF ,0L); setFrameShow(FRAMEVERIF ,0L);
@ -736,49 +736,49 @@ void ConfigDB::setFrameDefault()
void ConfigDB::setJokerPlus1(bool val) void ConfigDB::setJokerPlus1(bool val)
{ {
wxString key; wxString key;
key = wxString(MISC) + wxString("JokersDans7plus1"); key = wxString(MISC) + wxT("JokersDans7plus1");
Write(key,val); Write(key,val);
} }
bool ConfigDB::getJokerPlus1() bool ConfigDB::getJokerPlus1()
{ {
wxString key; wxString key;
key = wxString(MISC) + wxString("JokersDans7plus1"); key = wxString(MISC) + wxT("JokersDans7plus1");
return Read(key,(bool)FALSE); return Read(key,(bool)FALSE);
} }
void ConfigDB::setRackChecking(bool val) void ConfigDB::setRackChecking(bool val)
{ {
wxString key; wxString key;
key = wxString(MISC) + wxString("VerificationTirages"); key = wxString(MISC) + wxT("VerificationTirages");
Write(key,val); Write(key,val);
} }
bool ConfigDB::getRackChecking() bool ConfigDB::getRackChecking()
{ {
wxString key; wxString key;
key = wxString(MISC) + wxString("VerificationTirages"); key = wxString(MISC) + wxT("VerificationTirages");
return Read(key,(bool)FALSE); return Read(key,(bool)FALSE);
} }
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// //
// //
// //
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
#define INIT "/Initialized" #define INIT wxT("/Initialized")
void void
ConfigDB::setFirstDefault() ConfigDB::setFirstDefault()
{ {
if (Read(wxString(INIT),0L)) if (Read(INIT,0L))
return; return;
setFontDefault(); setFontDefault();
setColourDefault(); setColourDefault();
setFrameDefault(); 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 */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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++-*- // -*-C++-*-
@ -33,64 +33,64 @@
#define BUTTON_FONT wxFont(8,wxDEFAULT,wxNORMAL,wxNORMAL) #define BUTTON_FONT wxFont(8,wxDEFAULT,wxNORMAL,wxNORMAL)
#define BOARD "Board" #define BOARD "Board"
#define BCOLOURLINES BOARD"/Lines" #define BCOLOURLINES wxT(BOARD"/Lines")
#define BCOLOURWX2 BOARD"/Wx2" #define BCOLOURWX2 wxT(BOARD"/Wx2")
#define BCOLOURWX3 BOARD"/Wx3" #define BCOLOURWX3 wxT(BOARD"/Wx3")
#define BCOLOURLX2 BOARD"/Lx2" #define BCOLOURLX2 wxT(BOARD"/Lx2")
#define BCOLOURLX3 BOARD"/Lx3" #define BCOLOURLX3 wxT(BOARD"/Lx3")
#define BCOLOURBACKGROUND BOARD"/Background" #define BCOLOURBACKGROUND wxT(BOARD"/Background")
#define BCOLOURLETTERS BOARD"/Letters" #define BCOLOURLETTERS wxT(BOARD"/Letters")
#define BCOLOURTSTLETTERS BOARD"/TstLetters" #define BCOLOURTSTLETTERS wxT(BOARD"/TstLetters")
#define BOARDFONT BOARD"/Font" #define BOARDFONT wxT(BOARD"/Font")
#define LIST "List" #define LIST "List"
#define LISTFONT LIST"/Font" #define LISTFONT wxT(LIST"/Font")
#define PRINT "Print" #define PRINT "Print"
#define PHEADER PRINT"/Header" #define PHEADER PRINT"/Header"
#define PRINTHFONT PHEADER"/Font" #define PRINTHFONT wxT(PHEADER"/Font")
#define PTEXT PRINT"/Text" #define PTEXT PRINT"/Text"
#define PRINTTFONT PTEXT"/Font" #define PRINTTFONT wxT(PTEXT"/Font")
#define FRAME "Frames/" #define FRAME "Frames/"
#define FRAMEBOARD FRAME"Board" #define FRAMEBOARD wxT(FRAME"Board")
#define FRAMEVERIF FRAME"Verif" #define FRAMEVERIF wxT(FRAME"Verif")
#define FRAMESEARCH FRAME"Search" #define FRAMESEARCH wxT(FRAME"Search")
#define FRAMEPLUS1 FRAME"Plus1" #define FRAMEPLUS1 wxT(FRAME"Plus1")
#define FRAMERACC FRAME"Racc" #define FRAMERACC wxT(FRAME"Racc")
#define FRAMEBENJ FRAME"Benj" #define FRAMEBENJ wxT(FRAME"Benj")
#define FRAMEBAG FRAME"Bag" #define FRAMEBAG wxT(FRAME"Bag")
enum Justif { LEFT, CENTER, RIGHT }; enum Justif { LEFT, CENTER, RIGHT };
class ConfigDB class ConfigDB
{ {
private: private:
wxConfigBase* pConfig; wxConfigBase* pConfig;
enum Justif StrToJust(const wxString&); enum Justif StrToJust(const wxString&);
wxString JustToStr(enum Justif); wxString JustToStr(enum Justif);
enum Justif getJustif(const wxString&); enum Justif getJustif(const wxString&);
void setJustif(const wxString&, enum Justif); void setJustif(const wxString&, enum Justif);
bool Read(const wxString&, bool); bool Read(const wxString&, bool);
long Read(const wxString&, long); long Read(const wxString&, long);
wxFont Read(const wxString&, wxFont); wxFont Read(const wxString&, wxFont);
wxColour Read(const wxString&, wxColour); wxColour Read(const wxString&, wxColour);
wxString ReadStr(const wxString&, wxString); wxString ReadStr(const wxString&, wxString);
void Write(const wxString&, bool); void Write(const wxString&, bool);
void Write(const wxString&, long); void Write(const wxString&, long);
void Write(const wxString&, wxFont); void Write(const wxString&, wxFont);
void Write(const wxString&, wxColour); void Write(const wxString&, wxColour);
void Write(const wxString&, wxString); void Write(const wxString&, wxString);
public: public:
ConfigDB(); ConfigDB();
wxFont ChooseFont(wxFrame*,wxFont); wxFont ChooseFont(wxFrame*,wxFont);
wxColour ChooseColour(wxFrame*,wxColour); wxColour ChooseColour(wxFrame*,wxColour);
// Dictionary // Dictionary
wxString getDicPath(); wxString getDicPath();
wxString getDicName(); wxString getDicName();
@ -102,7 +102,7 @@ public:
// page setup // page setup
long getOrientation(); long getOrientation();
void setOrientation(long); void setOrientation(long);
// game drawing // game drawing
long getDxBegin(); long getDxBegin();
long getDxText(int); long getDxText(int);
@ -110,7 +110,7 @@ public:
void setDxBegin(long); void setDxBegin(long);
void setDxText(int,long); void setDxText(int,long);
void setDxEnd(long); void setDxEnd(long);
long getDyH1(); long getDyH1();
long getDyH2(); long getDyH2();
long getDyT1(); long getDyT1();
@ -119,25 +119,25 @@ public:
void setDyH2(long); void setDyH2(long);
void setDyT1(long); void setDyT1(long);
void setDyT2(long); void setDyT2(long);
int getSpacesH(int); int getSpacesH(int);
int getSpacesT(int); int getSpacesT(int);
void setSpacesH(int,int); void setSpacesH(int,int);
void setSpacesT(int,int); void setSpacesT(int,int);
enum Justif getJustifH(int); enum Justif getJustifH(int);
enum Justif getJustifT(int); enum Justif getJustifT(int);
void setJustifH(int, enum Justif); void setJustifH(int, enum Justif);
void setJustifT(int, enum Justif); void setJustifT(int, enum Justif);
wxString getNameH(int); wxString getNameH(int);
void setNameH(int, wxString); void setNameH(int, wxString);
long getMarginX(); long getMarginX();
long getMarginY(); long getMarginY();
void setMarginX(long); void setMarginX(long);
void setMarginY(long); void setMarginY(long);
wxFont getFont(wxString); wxFont getFont(wxString);
void setFont(wxString,wxFont); void setFont(wxString,wxFont);
void setFontDefault(); void setFontDefault();
@ -145,13 +145,13 @@ public:
wxColour getColour(wxString); wxColour getColour(wxString);
void setColour(wxString,wxColour); void setColour(wxString,wxColour);
void setColourDefault(); void setColourDefault();
wxPrintData getPrintData(); wxPrintData getPrintData();
void setPrintData(wxPrintData); void setPrintData(wxPrintData);
wxPageSetupData getPageSetupData(); wxPageSetupData getPageSetupData();
void setPageSetupData(wxPageSetupData); void setPageSetupData(wxPageSetupData);
/** /**
* frames * frames
*/ */
wxSize getFrameSize(wxString); wxSize getFrameSize(wxString);
@ -171,7 +171,7 @@ public:
void setPrintLineScale(float); void setPrintLineScale(float);
void setFirstDefault(); void setFirstDefault();
}; };
#endif #endif

View file

@ -16,15 +16,15 @@
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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 "ewx.h"
#include "configdb.h" #include "configdb.h"
#include "confsearch.h" #include "confsearch.h"
#include "wx/button.h"
#include "wx/sizer.h"
enum { enum {
Button_Ok, Button_Ok,
Button_Cancel, Button_Cancel,
@ -40,16 +40,16 @@ END_EVENT_TABLE()
ConfSearchDlg::ConfSearchDlg(wxWindow* parent) 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"); joker_searching = new wxCheckBox(this,CheckBox_Joker,wxT("Recherche sur joker dans 7+1"));
rack_checking = new wxCheckBox(this,CheckBox_Rack,"Vérification de la validité des tirages"); rack_checking = new wxCheckBox(this,CheckBox_Rack,wxT("Vérification de la validité des tirages"));
bcancel = new wxButton(this,Button_Cancel,"Annuler",wxPoint(-1,-1)); bcancel = new wxButton(this,Button_Cancel,wxT("Annuler"),wxPoint(-1,-1));
bcancel->SetToolTip("Annuler les dernier changements et quitter"); bcancel->SetToolTip(wxT("Annuler les dernier changements et quitter"));
bok = new wxButton(this,Button_Ok,"Quitter",wxPoint(-1,-1)); bok = new wxButton(this,Button_Ok,wxT("Quitter"),wxPoint(-1,-1));
bok->SetToolTip("Enregistrer les changements et quitter"); bok->SetToolTip(wxT("Enregistrer les changements et quitter"));
wxBoxSizer *bsizer = new wxBoxSizer( wxHORIZONTAL); wxBoxSizer *bsizer = new wxBoxSizer( wxHORIZONTAL);
bsizer->Add(bok, 1, wxALL, 1); bsizer->Add(bok, 1, wxALL, 1);

View file

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

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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 #ifdef WIN32 // mingw32 hack
# undef Yield # undef Yield
@ -54,9 +54,9 @@ bool
EliotApp::OnInit() EliotApp::OnInit()
{ {
srand(time(NULL)); srand(time(NULL));
SetVendorName("Afrab"); SetVendorName(wxT("Afrab"));
SetAppName(wxString("eliot") + wxString("-") + wxString(VERSION)); SetAppName(wxString(wxT("eliot")) + wxString(wxT("-")) + wxString(wxT(VERSION)));
SetClassName("eliot"); SetClassName(wxT("eliot"));
wxConfigBase* config = wxConfigBase::Get(); wxConfigBase* config = wxConfigBase::Get();
config = NULL; config = NULL;
@ -66,8 +66,8 @@ EliotApp::OnInit()
#endif #endif
ConfigDB configdb; ConfigDB configdb;
configdb.setFirstDefault(); configdb.setFirstDefault();
MainFrame *mainframe = new MainFrame(configdb.getFramePos(APPNAME), MainFrame *mainframe = new MainFrame(configdb.getFramePos(wxT(APPNAME)),
configdb.getFrameSize(APPNAME)); configdb.getFrameSize(wxT(APPNAME)));
mainframe->SetIcon( wxICON(eliot) ); mainframe->SetIcon( wxICON(eliot) );
mainframe->Show(TRUE); mainframe->Show(TRUE);
SetTopWindow(mainframe); SetTopWindow(mainframe);

View file

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

View file

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

View file

@ -16,7 +16,7 @@
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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++ -*- // -*- C++ -*-
#ifndef _PRINTOUT_H #ifndef _PRINTOUT_H
@ -38,8 +38,8 @@ private:
void DrawGameLines(wxDC*, long, long, float, float, float); void DrawGameLines(wxDC*, long, long, float, float, float);
public: 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 OnPrintPage(int);
bool HasPage(int); bool HasPage(int);
bool OnBeginDocument(int startPage, int endPage); bool OnBeginDocument(int startPage, int endPage);

View file

@ -16,21 +16,21 @@
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* 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 <string.h>
#include "ewx.h"
#include "dic.h"
#include "dic_search.h"
#include "searchpanel.h"
#include "configdb.h"
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/sizer.h" #include "wx/sizer.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "ewx.h"
#include "dic.h"
#include "dic_search.h"
#include "searchpanel.h"
#include "configdb.h"
enum { enum {
ID_PANEL_CROSS, ID_PANEL_CROSS,
ID_PANEL_PLUS1, ID_PANEL_PLUS1,
@ -64,12 +64,12 @@ BEGIN_EVENT_TABLE(SimpleSearchPanel, wxPanel)
EVT_TEXT_ENTER(ID_TEXT, SimpleSearchPanel::compute_enter) EVT_TEXT_ENTER(ID_TEXT, SimpleSearchPanel::compute_enter)
END_EVENT_TABLE() END_EVENT_TABLE()
SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic) SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic)
: wxPanel(parent,id) : wxPanel(parent,id)
{ {
dic_ = dic; 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)); t->SetFont(config.getFont(LISTFONT));
l = new wxListBox(this,ID_LIST); l = new wxListBox(this,ID_LIST);
l->SetFont(config.getFont(LISTFONT)); l->SetFont(config.getFont(LISTFONT));
@ -85,14 +85,14 @@ SimpleSearchPanel::SimpleSearchPanel(wxWindow* parent, int id, Dictionary dic)
sizer->SetSizeHints(this); sizer->SetSizeHints(this);
} }
int int
SimpleSearchPanel::check() SimpleSearchPanel::check()
{ {
wxString msg(""); wxString msg = wxT("");
if (dic_ == NULL) if (dic_ == NULL)
{ {
l->Clear(); l->Clear();
msg << "Pas de dictionnaire"; msg << wxT("Pas de dictionnaire");
l->Append(msg); l->Append(msg);
return 0; return 0;
} }
@ -125,23 +125,23 @@ PCross::compute_enter(wxCommandEvent&)
if (t->GetValue().Len() >= DIC_WORD_MAX) if (t->GetValue().Len() >= DIC_WORD_MAX)
{ {
wxString msg(""); wxString msg = wxT("");
msg << "La recherche est limitée à " << DIC_WORD_MAX - 1 << " lettres"; msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 << wxT(" lettres");
l->Append(msg); l->Append(msg);
return; 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); Dic_search_Cros(dic_,rack,buff);
int resnum = 0; int resnum = 0;
wxString res[RES_CROS_MAX]; wxString res[RES_CROS_MAX];
for(i=0; i < RES_CROS_MAX && buff[i][0]; i++) 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); l->Set(resnum,res);
if (l->GetCount() == 0) 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) if (t->GetValue().Len() >= DIC_WORD_MAX)
{ {
wxString msg(""); wxString msg = wxT("");
msg << "La recherche est limitée à " << DIC_WORD_MAX - 1 << " lettres"; msg << wxT("La recherche est limitée à ") << DIC_WORD_MAX - 1 << wxT(" lettres");
l->Append(msg); l->Append(msg);
return; 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); Dic_search_7pl1(dic_,rack,buff,TRUE);
int resnum = 0; int resnum = 0;
@ -183,14 +183,14 @@ PPlus1::compute_enter(wxCommandEvent&)
for(i=0; i < LETTERS; i++) for(i=0; i < LETTERS; i++)
{ {
if (i && buff[i][0][0]) 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++) 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); l->Set(resnum,res);
if (l->GetCount() == 0) 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()) if (!check())
return; 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); Dic_search_RegE(dic_,re,buff);
int resnum = 0; int resnum = 0;
wxString res[RES_REGE_MAX]; wxString res[RES_REGE_MAX];
for(i=0; i < RES_REGE_MAX && buff[i][0]; i++) 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); l->Set(resnum,res);
if (l->GetCount() == 0) 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) : SearchPanel::SearchPanel(wxFrame *parent, Dictionary dic) :
wxNotebook(parent, -1) wxNotebook(parent, -1)
{ {
AddPage(new PCross(this,ID_PANEL_CROSS,dic),"Mots croisés"); AddPage(new PCross(this,ID_PANEL_CROSS,dic),wxT("Mots croisés"));
AddPage(new PPlus1(this,ID_PANEL_PLUS1,dic),"Plus 1"); AddPage(new PPlus1(this,ID_PANEL_PLUS1,dic),wxT("Plus 1"));
AddPage(new PRegExp(this,ID_PANEL_REGEXP,dic),"Exp. Rationnelle"); AddPage(new PRegExp(this,ID_PANEL_REGEXP,dic),wxT("Exp. Rationnelle"));
SetSelection(0); SetSelection(0);
} }
SearchPanel::~SearchPanel() SearchPanel::~SearchPanel()