Main Page | Class List | File List | Class Members | Related Pages

profilemanager.h

00001 /***************************************************************************
00002                            profilemanager.h
00003                            -------------------
00004     begin                : 2004-09-22 12:43
00005     copyright            : (C) 2004-2005 by Dominik Haumann
00006     email                : dhaumann@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  This program is free software; you can redistribute it and/or
00011  modify it under the terms of the GNU General Public License
00012  as published by the Free Software Foundation; either version 2
00013  of the License, or (at your option) any later version.
00014 
00015  This program is distributed in the hope that it will be useful,
00016  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  GNU General Public License for more details.
00019 
00020  You should have received a copy of the GNU General Public License
00021  along with this program; if not, write to the Free Software
00022  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023  ***************************************************************************/
00024 
00025 #ifndef PROFILEMANAGER_H
00026 #define PROFILEMANAGER_H
00027 
00028 #include "global.h"
00029 
00030 namespace WDS
00031 {
00032 class CGoToEntry;
00033 class CProfile;
00034 class CProfileManager;
00035 
00036 typedef vector <CGoToEntry> GoToArray;
00037 
00038 //-------------------------------------------------------------------------
00039 //BEGIN class CGoToEntry
00040 //-------------------------------------------------------------------------
00046 class CGoToEntry
00047 {
00048 public:
00049     CGoToEntry() { }
00050     CGoToEntry( int x_position, int y_position, const wxString& str_comment = "" )
00051         : x( x_position ), y( y_position ), comment( str_comment ) { }
00052 
00053     virtual ~CGoToEntry() {}
00054 
00055     int      x;        
00056     int      y;        
00057     wxString comment;  
00058 };
00059 //-------------------------------------------------------------------------
00060 //END class CGoToEntry
00061 //-------------------------------------------------------------------------
00062 
00063 //-------------------------------------------------------------------------
00064 //BEGIN class CProfile
00065 //-------------------------------------------------------------------------
00066 
00081 class CProfile
00082 {
00083 public:
00085     CProfile();
00087     ~CProfile();
00088 
00089     void SetName(const wxString& name);     
00090     wxString GetName() const;               
00091 
00092     void SetMap(const wxString& map);       
00093     wxString GetMap() const;                
00094 
00095     void SetDat(const wxString& dat);       
00096     wxString GetDat() const;                
00097 
00098     bool IsValid() const;                   
00099 
00100     // User and server for phpmap account
00101     void SetUser(const wxString& user);     
00102     wxString GetUser() const;               
00103 
00104     void SetPassword(const wxString& pw);   
00105     wxString GetPassword() const;           
00106 
00107     void SetServer(const wxString& server); 
00108     wxString GetServer() const;             
00109 
00110     void SetUsePhpmap(bool b_use);          
00111     bool GetUsePhpmap() const;              
00112 
00113     void SetFogOfWar(bool fow);             
00114     bool GetFogOfWar() const;               
00115 
00116     void SetTimestamp(int ts);              
00117     int GetTimestamp() const;               
00118 
00124     void SetDirty(bool dirty);
00125     bool GetDirty() const;                  
00126 
00127     GoToArray& GetBookmarks();              
00128     GoToArray& GetRecentGoTos();            
00129 
00134     void AddBookmark( int x, int y, const wxString& comment );
00135     void AddRecentGoTo( int x, int y );     
00136 
00137     void Load( wxFileConfig *pConfig );     
00138     void Save( wxFileConfig *pConfig );     
00139 
00145     void SetLastScrollPosition(int x, int y);
00146 
00148     int GetLastScrollPositionX() const;
00149 
00151     int GetLastScrollPositionY() const;
00152 
00154     void SetLastZoom( float zoom );
00156     float GetLastZoom( ) const;
00157 
00158 protected:
00159     void LoadBookmarks( wxFileConfig *pConfig );
00160     void LoadRecents  ( wxFileConfig *pConfig );
00161     void SaveBookmarks( wxFileConfig *pConfig );
00162     void SaveRecents  ( wxFileConfig *pConfig );
00163 
00164 protected:
00165 //  type         |var name       |saved in config.cfg
00166     wxString      m_name;         // yes
00167     wxString      m_map;          // yes
00168     wxString      m_dat;          // yes
00169 
00170     bool          m_usephpmap;    // yes
00171     wxString      m_user;         // yes
00172     wxString      m_password;     // yes
00173     wxString      m_server;       // yes
00174 
00175     int           m_timestamp;    // yes
00176     bool          m_fogofwar;     // yes
00177     bool          m_dirty;        // no
00178 
00179     wxString      m_notes;        // yes
00180     GoToArray     m_bookmarks;    // yes
00181     GoToArray     m_recents;      // yes
00182 
00183     int           m_last_scroll_x;// yes
00184     int           m_last_scroll_y;// yes
00185     float         m_last_zoom;    // yes
00186 };
00187 
00188 //-------------------------------------------------------------------------
00189 //END class CProfile
00190 //-------------------------------------------------------------------------
00191 
00192 //-------------------------------------------------------------------------
00193 //BEGIN class CProfileManager
00194 //-------------------------------------------------------------------------
00195 
00208 class CProfileManager
00209 {
00210 public:
00214     CProfileManager(wxFileConfig* pConfig);
00215 
00217     virtual ~CProfileManager();
00218 
00220     void save();
00221 
00223     int size() const;
00225     CProfile* GetProfile(int index) const;
00226 
00230     int GetIndexFromProfile(const CProfile* profile);
00231 
00235     bool DeleteProfile (int index);
00239     bool DeleteProfile (CProfile* p);
00240 
00244     bool AddProfile (CProfile* p);
00245 
00247     static CProfile* GetCurrentProfile( ) { return m_pCurrentProfile; }
00252     static void SetCurrentProfile( CProfile* p ) { m_pCurrentProfile = p;    }
00253 
00254 protected:
00256     void Init();
00257 
00258 protected:
00259     wxFileConfig *m_pConfig;
00260     static CProfile *m_pCurrentProfile;
00261     vector <CProfile*> m_profiles;
00262 };
00263 
00264 //-------------------------------------------------------------------------
00265 //END class CProfileManager
00266 //-------------------------------------------------------------------------
00267 
00268 }
00269 
00270 #endif // PROFILEMANAGER_H
00271 
00272 // kate: space-indent off; tab-width 4; replace-tabs off;

Generated on Sun Jan 16 18:20:26 2005 for WDSMap by  doxygen 1.3.9.1