2
This file is part of Browse Tracker, a plugin for Code::Blocks
3
Copyright (C) 2007 Pecan Heber
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
// RCS-ID: $Id: BrowseTracker.cpp 22 2007-12-18 14:41:58Z Pecan $
21
#include <wx/fileconf.h>
23
#include "BrowseTrackerDefs.h"
24
#include "BrowseTrackerCfg.h"
25
#include "ConfigDlg.h"
29
// ----------------------------------------------------------------------------
30
BrowseTrackerCfg::BrowseTrackerCfg()
31
// ----------------------------------------------------------------------------
32
:m_configDlg(Manager::Get()->GetAppWindow() )
37
// ----------------------------------------------------------------------------
38
void BrowseTrackerCfg::GetUserOptions(wxString configFullPath)
39
// ----------------------------------------------------------------------------
42
ReadUserOptions( configFullPath );
44
#if defined(__WXMSW__)
45
m_configDlg.m_staticText4->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
48
// set the current values
49
m_configDlg.Cfg_BrowseMarksEnabled->SetValue( m_BrowseMarksEnabled);
50
m_configDlg.Cfg_MarkStyle->SetSelection(m_UserMarksStyle);
51
m_configDlg.Cfg_ToggleKey->SetSelection( m_ToggleKey );
52
m_configDlg.Cfg_LeftMouseDelay->SetValue( m_LeftMouseDelay ) ;
53
m_configDlg.Cfg_ClearAllKey->SetSelection( m_ClearAllKey ) ;
55
m_configDlg.ShowModal();
57
// get any new user values
58
m_BrowseMarksEnabled = m_configDlg.Cfg_BrowseMarksEnabled->GetValue();
59
m_UserMarksStyle = m_configDlg.Cfg_MarkStyle->GetSelection();
60
m_ToggleKey = m_configDlg.Cfg_ToggleKey->GetSelection();
61
m_LeftMouseDelay = m_configDlg.Cfg_LeftMouseDelay->GetValue();
62
m_ClearAllKey = m_configDlg.Cfg_ClearAllKey->GetSelection();
64
// write user options to config file
65
SaveUserOptions( configFullPath );
68
// ----------------------------------------------------------------------------
69
BrowseTrackerCfg::~BrowseTrackerCfg()
70
// ----------------------------------------------------------------------------
74
// ----------------------------------------------------------------------------
75
void BrowseTrackerCfg::ReadUserOptions(wxString configFullPath)
76
// ----------------------------------------------------------------------------
78
if (not pCfgFile) pCfgFile = new wxFileConfig(
79
wxEmptyString, // appname
80
wxEmptyString, // vendor
81
configFullPath, // local filename
82
wxEmptyString, // global file
83
wxCONFIG_USE_LOCAL_FILE);
85
wxFileConfig& cfgFile = *pCfgFile;
87
cfgFile.Read( wxT("BrowseMarksEnabled"), &m_BrowseMarksEnabled, 0 ) ;
88
cfgFile.Read( wxT("BrowseMarksStyle"), &m_UserMarksStyle, 0 ) ;
89
cfgFile.Read( wxT("BrowseMarksToggleKey"), &m_ToggleKey, Left_Mouse ) ;
90
cfgFile.Read( wxT("LeftMouseDelay"), &m_LeftMouseDelay, 200 ) ;
91
cfgFile.Read( wxT("BrowseMarksClearAllMethod"), &m_ClearAllKey, ClearAllOnSingleClick ) ;
94
// ----------------------------------------------------------------------------
95
void BrowseTrackerCfg::SaveUserOptions(wxString configFullPath)
96
// ----------------------------------------------------------------------------
98
if (not pCfgFile) pCfgFile = new wxFileConfig(
99
wxEmptyString, // appname
100
wxEmptyString, // vendor
101
configFullPath, // local filename
102
wxEmptyString, // global file
103
wxCONFIG_USE_LOCAL_FILE);
105
wxFileConfig& cfgFile = *pCfgFile;
107
cfgFile.Write( wxT("BrowseMarksEnabled"), m_BrowseMarksEnabled ) ;
108
cfgFile.Write( wxT("BrowseMarksStyle"), m_UserMarksStyle ) ;
109
cfgFile.Write( wxT("BrowseMarksToggleKey"), m_ToggleKey ) ;
110
cfgFile.Write( wxT("LeftMouseDelay"), m_LeftMouseDelay ) ;
111
cfgFile.Write( wxT("BrowseMarksClearAllMethod"),m_ClearAllKey ) ;
116
// ----------------------------------------------------------------------------