~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/BrowseTracker/BrowseTrackerCfg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        This file is part of Browse Tracker, a plugin for Code::Blocks
 
3
        Copyright (C) 2007 Pecan Heber
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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.
 
18
*/
 
19
// RCS-ID: $Id: BrowseTracker.cpp 22 2007-12-18 14:41:58Z Pecan $
 
20
 
 
21
#include <wx/fileconf.h>
 
22
 
 
23
#include "BrowseTrackerDefs.h"
 
24
#include "BrowseTrackerCfg.h"
 
25
#include "ConfigDlg.h"
 
26
#include "manager.h"
 
27
#include "Version.h"
 
28
 
 
29
// ----------------------------------------------------------------------------
 
30
BrowseTrackerCfg::BrowseTrackerCfg()
 
31
// ----------------------------------------------------------------------------
 
32
    :m_configDlg(Manager::Get()->GetAppWindow() )
 
33
{
 
34
    //ctor
 
35
    pCfgFile = 0;
 
36
}
 
37
// ----------------------------------------------------------------------------
 
38
void BrowseTrackerCfg::GetUserOptions(wxString configFullPath)
 
39
// ----------------------------------------------------------------------------
 
40
{
 
41
 
 
42
    ReadUserOptions( configFullPath );
 
43
 
 
44
    #if defined(__WXMSW__)
 
45
    m_configDlg.m_staticText4->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
 
46
    #endif
 
47
 
 
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 ) ;
 
54
 
 
55
    m_configDlg.ShowModal();
 
56
 
 
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();
 
63
 
 
64
    // write user options to config file
 
65
        SaveUserOptions( configFullPath );
 
66
 
 
67
}//Init
 
68
// ----------------------------------------------------------------------------
 
69
BrowseTrackerCfg::~BrowseTrackerCfg()
 
70
// ----------------------------------------------------------------------------
 
71
{
 
72
    //dtor
 
73
}
 
74
// ----------------------------------------------------------------------------
 
75
void BrowseTrackerCfg::ReadUserOptions(wxString configFullPath)
 
76
// ----------------------------------------------------------------------------
 
77
{
 
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);
 
84
                    //0);
 
85
    wxFileConfig& cfgFile = *pCfgFile;
 
86
 
 
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 ) ;
 
92
 
 
93
}
 
94
// ----------------------------------------------------------------------------
 
95
void BrowseTrackerCfg::SaveUserOptions(wxString configFullPath)
 
96
// ----------------------------------------------------------------------------
 
97
{
 
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);
 
104
                    //0);
 
105
    wxFileConfig& cfgFile = *pCfgFile;
 
106
 
 
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 ) ;
 
112
 
 
113
    cfgFile.Flush();
 
114
 
 
115
}
 
116
// ----------------------------------------------------------------------------
 
117
 
 
118