~ubuntu-branches/ubuntu/lucid/codelite/lucid

« back to all changes in this revision

Viewing changes to LiteEditor/editorsettingsdialogs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-01-12 15:46:55 UTC
  • Revision ID: james.westby@ubuntu.com-20090112154655-sdynrljcb6u167yw
Tags: upstream-1.0.2674+dfsg
ImportĀ upstreamĀ versionĀ 1.0.2674+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// copyright            : (C) 2008 by Eran Ifrah
 
5
// file name            : editorsettingsdialogs.cpp
 
6
//
 
7
// -------------------------------------------------------------------------
 
8
// A
 
9
//              _____           _      _     _ _
 
10
//             /  __ \         | |    | |   (_) |
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|
 
15
//
 
16
//                                                  F i l e
 
17
//
 
18
//    This program is free software; you can redistribute it and/or modify
 
19
//    it under the terms of the GNU General Public License as published by
 
20
//    the Free Software Foundation; either version 2 of the License, or
 
21
//    (at your option) any later version.
 
22
//
 
23
//////////////////////////////////////////////////////////////////////////////
 
24
//////////////////////////////////////////////////////////////////////////////
 
25
 
 
26
#include "editorsettingsdialogs.h"
 
27
 
 
28
EditorSettingsDialogs::EditorSettingsDialogs( wxWindow* parent )
 
29
                : EditorSettingsDialogsBase( parent )
 
30
                , TreeBookNode<EditorSettingsDialogs>()
 
31
{
 
32
        long adjustCpuNumber(0);
 
33
        long replaceWrapAround(0);
 
34
        long findNextWrapAround(0);
 
35
        long buildBeforeDebug(0);
 
36
        long createSwappedFile(0);
 
37
 
 
38
        bAdjustCPUNumber = EditorConfigST::Get()->GetLongValue(wxT("AdjustCPUNumber"), adjustCpuNumber);
 
39
        bReplaceWrapAroundAnswer = EditorConfigST::Get()->GetLongValue(wxT("ReplaceWrapAroundAnswer"), replaceWrapAround);
 
40
        bFindNextWrapAroundAnswer = EditorConfigST::Get()->GetLongValue(wxT("FindNextWrapAroundAnswer"), findNextWrapAround);
 
41
        bBuildBeforeDebug = EditorConfigST::Get()->GetLongValue(wxT("BuildBeforeDebug"), buildBeforeDebug);
 
42
        bCreateSwappedFile = EditorConfigST::Get()->GetLongValue(wxT("CreateSwappedFile"), createSwappedFile);
 
43
 
 
44
        // the value stored is 0 / 1
 
45
        if (bAdjustCPUNumber) {
 
46
                AdjustCPUNumber_idx = m_checkListAnswers->Append(wxT("Adjust number of build processes according to CPU"));
 
47
                m_checkListAnswers->Check((unsigned int)AdjustCPUNumber_idx, adjustCpuNumber ? true : false);
 
48
        }
 
49
 
 
50
        // the value stored is wxID_OK / wxID_NO
 
51
        if (bReplaceWrapAroundAnswer) {
 
52
                ReplaceWrapAroundAnswer_idx = m_checkListAnswers->Append(wxT("Wrap around 'Replace' operation"));
 
53
                m_checkListAnswers->Check((unsigned int)ReplaceWrapAroundAnswer_idx, replaceWrapAround == wxID_OK);
 
54
        }
 
55
 
 
56
        // the value stored is wxID_OK / wxID_NO
 
57
        if (bFindNextWrapAroundAnswer) {
 
58
                FindNextWrapAroundAnswer_idx = m_checkListAnswers->Append(wxT("Wrap around 'Find' operation"));
 
59
                m_checkListAnswers->Check((unsigned int)FindNextWrapAroundAnswer_idx, findNextWrapAround == wxID_OK);
 
60
        }
 
61
 
 
62
        if (bBuildBeforeDebug) {
 
63
                BuildBeforeDebug_idx = m_checkListAnswers->Append(wxT("Always Build before debugging"));
 
64
                m_checkListAnswers->Check((unsigned int)BuildBeforeDebug_idx, buildBeforeDebug == wxID_OK);
 
65
        }
 
66
 
 
67
        if (bCreateSwappedFile) {
 
68
                CreateSwappedFile_idx = m_checkListAnswers->Append(wxT("If swapped file does not exist, create one"));
 
69
                m_checkListAnswers->Check((unsigned int)CreateSwappedFile_idx, createSwappedFile == wxID_OK);
 
70
        }
 
71
 
 
72
}
 
73
 
 
74
EditorSettingsDialogs::~EditorSettingsDialogs()
 
75
{
 
76
 
 
77
}
 
78
 
 
79
void EditorSettingsDialogs::Save(OptionsConfigPtr)
 
80
{
 
81
        if(bAdjustCPUNumber)
 
82
                EditorConfigST::Get()->SaveLongValue(wxT("AdjustCPUNumber"), m_checkListAnswers->IsChecked(AdjustCPUNumber_idx) ? 1 : 0);
 
83
 
 
84
        if(bReplaceWrapAroundAnswer)
 
85
                EditorConfigST::Get()->SaveLongValue(wxT("ReplaceWrapAroundAnswer"), m_checkListAnswers->IsChecked(ReplaceWrapAroundAnswer_idx) ? wxID_OK : wxID_NO);
 
86
 
 
87
        if(bFindNextWrapAroundAnswer)
 
88
                EditorConfigST::Get()->SaveLongValue(wxT("FindNextWrapAroundAnswer"), m_checkListAnswers->IsChecked(FindNextWrapAroundAnswer_idx) ? wxID_OK : wxID_NO);
 
89
 
 
90
        if(bBuildBeforeDebug)
 
91
                EditorConfigST::Get()->SaveLongValue(wxT("BuildBeforeDebug"), m_checkListAnswers->IsChecked(BuildBeforeDebug_idx) ? wxID_OK : wxID_NO);
 
92
 
 
93
        if(bCreateSwappedFile)
 
94
                EditorConfigST::Get()->SaveLongValue(wxT("CreateSwappedFile"), m_checkListAnswers->IsChecked(CreateSwappedFile_idx) ? wxID_OK : wxID_NO);
 
95
}