configdb.h

Go to the documentation of this file.
00001 /* Eliot                                                                     */
00002 /* Copyright (C) 1999  Antoine Fraboulet                                     */
00003 /*                                                                           */
00004 /* This file is part of Eliot.                                               */
00005 /*                                                                           */
00006 /* Eliot is free software; you can redistribute it and/or modify             */
00007 /* it under the terms of the GNU General Public License as published by      */
00008 /* the Free Software Foundation; either version 2 of the License, or         */
00009 /* (at your option) any later version.                                       */
00010 /*                                                                           */
00011 /* Eliot is distributed in the hope that it will be useful,                  */
00012 /* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
00013 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
00014 /* GNU General Public License for more details.                              */
00015 /*                                                                           */
00016 /* You should have received a copy of the GNU General Public License         */
00017 /* along with this program; if not, write to the Free Software               */
00018 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00019 
00020 /**
00021  *  \file   configdb.h
00022  *  \brief  Access to Eliot persistant configuration data
00023  *  \author Antoine Fraboulet
00024  *  \date   2002
00025  */
00026 
00027 #ifndef _CONFIGDB_H
00028 #define _CONFIGDB_H
00029 
00030 #include "wx/dc.h"
00031 #include "wx/font.h"
00032 #include "wx/colour.h"
00033 #include "wx/frame.h"
00034 #include "wx/cmndata.h"
00035 #include "wx/config.h"
00036 
00037 #define BUTTON_FONT wxFont(8,wxDEFAULT,wxNORMAL,wxNORMAL)
00038 
00039 #define BOARD              "Board"
00040 #define BCOLOURLINES       wxT(BOARD"/Lines")
00041 #define BCOLOURWX2         wxT(BOARD"/Wx2")
00042 #define BCOLOURWX3         wxT(BOARD"/Wx3")
00043 #define BCOLOURLX2         wxT(BOARD"/Lx2")
00044 #define BCOLOURLX3         wxT(BOARD"/Lx3")
00045 #define BCOLOURBACKGROUND  wxT(BOARD"/Background")
00046 #define BCOLOURLETTERS     wxT(BOARD"/Letters")
00047 #define BCOLOURTSTLETTERS  wxT(BOARD"/TstLetters")
00048 #define BOARDFONT          wxT(BOARD"/Font")
00049 
00050 #define BDRAWBACKGROUND    wxT(BOARD"/DrawTile")
00051 #define BTILEBACKGROUND    wxT(BOARD"/TileBG")
00052 #define BTSTTILEBACKGROUND wxT(BOARD"/TstTileBG")
00053 
00054 #define LIST               "List"
00055 #define LISTFONT           wxT(LIST"/Font")
00056 
00057 #define PRINT             "Print"
00058 #define PHEADER           PRINT"/Header"
00059 #define PRINTHFONT        wxT(PHEADER"/Font")
00060 #define PTEXT             PRINT"/Text"
00061 #define PRINTTFONT        wxT(PTEXT"/Font")
00062 
00063 #define FRAME             "Frames/"
00064 #define FRAMEBOARD        wxT(FRAME"Board")
00065 #define FRAMEVERIF        wxT(FRAME"Verif")
00066 #define FRAMESEARCH       wxT(FRAME"Search")
00067 #define FRAMEPLUS1        wxT(FRAME"Plus1")
00068 #define FRAMERACC         wxT(FRAME"Racc")
00069 #define FRAMEBENJ         wxT(FRAME"Benj")
00070 #define FRAMEBAG          wxT(FRAME"Bag")
00071 #define FRAMEGAME         wxT(FRAME"Game")
00072 #define FRAMERESULT       wxT(FRAME"Result")
00073 
00074 enum Justif { LEFT, CENTER, RIGHT };
00075 
00076 class ConfigDB
00077 {
00078 private:
00079   wxConfigBase* pConfig;
00080   enum Justif StrToJust(const wxString&);
00081   wxString JustToStr(enum Justif);
00082 
00083   enum Justif getJustif(const wxString&);
00084   void setJustif(const wxString&, enum Justif);
00085 
00086   bool Read(const wxString&, bool);
00087   long Read(const wxString&, long);
00088   wxFont Read(const wxString&, wxFont);
00089   wxColour Read(const wxString&, wxColour);
00090   wxString ReadStr(const wxString&, wxString);
00091 
00092   void Write(const wxString&, bool);
00093   void Write(const wxString&, long);
00094   void Write(const wxString&, wxFont);
00095   void Write(const wxString&, wxColour);
00096   void Write(const wxString&, wxString);
00097 
00098 public:
00099   ConfigDB();
00100 
00101   wxFont ChooseFont(wxFrame*,wxFont);
00102   wxColour ChooseColour(wxFrame*,wxColour);
00103 
00104   // Dictionary
00105   wxString getDicPath();
00106   wxString getDicName();
00107   wxString getTilePath();
00108   wxString getTileName();
00109   void setDicPath(wxString name,wxString name);
00110   void setTilePath(wxString path,wxString name);
00111 
00112   // page setup
00113   long getOrientation();
00114   void setOrientation(long);
00115 
00116   // game drawing
00117   long getDxBegin();
00118   long getDxText(int);
00119   long getDxEnd();
00120   void setDxBegin(long);
00121   void setDxText(int,long);
00122   void setDxEnd(long);
00123 
00124   long getDyH1();
00125   long getDyH2();
00126   long getDyT1();
00127   long getDyT2();
00128   void setDyH1(long);
00129   void setDyH2(long);
00130   void setDyT1(long);
00131   void setDyT2(long);
00132 
00133   int  getSpacesH(int);
00134   int  getSpacesT(int);
00135   void setSpacesH(int,int);
00136   void setSpacesT(int,int);
00137 
00138   enum Justif getJustifH(int);
00139   enum Justif getJustifT(int);
00140   void setJustifH(int, enum Justif);
00141   void setJustifT(int, enum Justif);
00142 
00143   wxString getNameH(int);
00144   void setNameH(int, wxString);
00145 
00146   long getMarginX();
00147   long getMarginY();
00148   void setMarginX(long);
00149   void setMarginY(long);
00150 
00151   wxFont getFont(wxString);
00152   void setFont(wxString,wxFont);
00153   void setFontDefault();
00154 
00155   wxColour getColour(wxString);
00156   void setColour(wxString,wxColour);
00157   void setColourDefault();
00158 
00159   wxPrintData getPrintData();
00160   void setPrintData(wxPrintData);
00161   wxPageSetupData getPageSetupData();
00162   void setPageSetupData(wxPageSetupData);
00163 
00164   /**
00165    * frames
00166    */
00167   wxSize  getFrameSize(wxString);
00168   wxPoint getFramePos(wxString);
00169   int     getFrameShow(wxString);
00170   void setFrameSize(wxString,wxSize);
00171   void setFramePos(wxString,wxPoint);
00172   void setFrameShow(wxString,int);
00173   void setFrameDefault();
00174 
00175   void setRackChecking(bool);
00176   bool getRackChecking();
00177 
00178   void setJokerPlus1(bool);
00179   bool getJokerPlus1();
00180 
00181   void setDrawTile(bool);
00182   bool getDrawTile();
00183 
00184   float getPrintLineScale();
00185   void setPrintLineScale(float);
00186 
00187   void setFirstDefault();
00188 
00189 };
00190 
00191 #endif
00192 

Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5