///////////////////////////////////////////////////////////////////////////// // Name: prefmacros.h // tag: Header for a bunch of prefmacros. // Author: David Roundy // Modified by: // Copyright: (c) 2002 David Roundy // Licence: GPL /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ///////////////////////////////////////////////////////////////////////////// #ifndef _PREFMACROS_H_ #define _PREFMACROS_H_ // For compilers that support precompilation, includes "wx/wx.h". #include #ifndef WX_PRECOMP #include #include #include #endif #include "globals.h" inline bool GetAskServer() { return wxConfig::Get()->Read("/General/AskServer", 0l); } inline bool GetAskName() { return wxConfig::Get()->Read("/General/AskName", 1l); } inline wxString GetPlayerName() { return wxConfig::Get()->Read("/Player/Name", "John Doe"); } inline wxString GetPlayerPic() { return wxConfig::Get()->Read("/Player/Picture", ""); } wxString SetPlayerPic(const wxString &file); wxString UploadPlayerPic(); inline wxString GetCacheDir() { #ifdef __WXGTK__ return wxConfig::Get()->Read("/General/Cachedir", wxGetHomeDir() + "/.abridge/"); #endif #ifdef __WXMAC__ return wxConfig::Get()->Read("/General/Cachedir", wxGetHomeDir() + "/.abridge/"); #endif #ifdef __WXMSW__ return wxConfig::Get()->Read("/General/Cachedir", "%TEMP%\\abridge\\"); #endif } class ftpFileCache; ftpFileCache GetCache(); inline bool GetBeep() { return wxConfig::Get()->Read("/General/Beep", 0l); } inline wxString GetMyInfo() { return wxConfig::Get()->Read("/Player/Blurb", "No info for " + player_name()); } wxBitmap GetPlayerBitmap(const wxString &playername); wxString GetPlayerBlurb(const wxString &playername); inline bool GetRememberWindowPositions() { return wxConfig::Get()->Read("/General/RememberWindowPositions", 1l); } inline bool GetLastTrickShown() { return wxConfig::Get()->Read("/GUI/LastTrickShown", 0l); } inline void SetLastTrickShown(bool shown) { wxConfig::Get()->Write("/GUI/LastTrickShown", (long)shown); wxConfig::Get()->Flush(); } inline wxSize GetGameSize() { return wxSize(wxConfig::Get()->Read("/GUI/GameW", 611l), wxConfig::Get()->Read("/GUI/GameH", 350l)); } inline void SetGameSize(const wxSize s) { wxConfigBase *conf = wxConfig::Get(); conf->Write("/GUI/GameW", (long)s.GetWidth()); conf->Write("/GUI/GameH", (long)s.GetHeight()); conf->Flush(); } inline wxPoint GetLastTrickPosition() { return wxPoint(wxConfig::Get()->Read("/GUI/LastTrickX", 611l), wxConfig::Get()->Read("/GUI/LastTrickY", 350l)); } inline void SetLastTrickPosition(wxPoint pt) { wxConfigBase *conf = wxConfig::Get(); conf->Write("/GUI/LastTrickX", (long)pt.x); conf->Write("/GUI/LastTrickY", (long)pt.y); conf->Flush(); } inline bool GetBidReviewShown() { return wxConfig::Get()->Read("/GUI/BidReviewShown", 0l); } inline void SetBidReviewShown(bool shown) { wxConfig::Get()->Write("/GUI/BidReviewShown", (long)shown); wxConfig::Get()->Flush(); } inline wxPoint GetBidReviewPosition() { return wxPoint(wxConfig::Get()->Read("/GUI/BidReviewX", 611l), wxConfig::Get()->Read("/GUI/BidReviewY", 0l)); } inline void SetBidReviewPosition(wxPoint pt) { wxConfigBase *conf = wxConfig::Get(); conf->Write("/GUI/BidReviewX", (long)pt.x); conf->Write("/GUI/BidReviewY", (long)pt.y); conf->Flush(); } inline wxPoint GetBidWindowPosition() { return wxPoint(wxConfig::Get()->Read("/GUI/BidWindowX", 500l), wxConfig::Get()->Read("/GUI/BidWindowY", 350l)); } inline void SetBidWindowPosition(wxPoint pt) { wxConfigBase *conf = wxConfig::Get(); conf->Write("/GUI/BidWindowX", (long)pt.x); conf->Write("/GUI/BidWindowY", (long)pt.y); conf->Flush(); } inline bool GetScoreWindowShown() { return wxConfig::Get()->Read("/GUI/ScoreWindowShown", 0l); } inline void SetScoreWindowShown(bool shown) { wxConfig::Get()->Write("/GUI/ScoreWindowShown", (long)shown); wxConfig::Get()->Flush(); } inline wxPoint GetScoreWindowPosition() { return wxPoint(wxConfig::Get()->Read("/GUI/ScoreWindowX", 611l), wxConfig::Get()->Read("/GUI/ScoreWindowY", 200l)); } inline void SetScoreWindowPosition(wxPoint pt) { wxConfigBase *conf = wxConfig::Get(); conf->Write("/GUI/ScoreWindowX", (long)pt.x); conf->Write("/GUI/ScoreWindowY", (long)pt.y); conf->Flush(); } #endif