forked from eranif/codelite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweaks_settings.h
146 lines (131 loc) · 4.3 KB
/
tweaks_settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2014 Eran Ifrah
// file name : tweaks_settings.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef TWEAKSSETTINGS_H
#define TWEAKSSETTINGS_H
#include "cl_config.h"
#include <wx/colour.h>
#include <map>
class ProjectTweaks : public clConfigItem
{
wxColour m_tabFgColour;
wxColour m_tabBgColour;
wxString m_projectName;
wxString m_bitmapFilename;
public:
typedef std::map<wxString, ProjectTweaks> Map_t;
public:
virtual void FromJSON(const JSONElement& json);
virtual JSONElement ToJSON() const;
ProjectTweaks();
virtual ~ ProjectTweaks();
void ResetColours();
void SetBitmapFilename(const wxString& bitmapFilename) {
this->m_bitmapFilename = bitmapFilename;
}
const wxString& GetBitmapFilename() const {
return m_bitmapFilename;
}
bool IsOk() const {
return !m_projectName.IsEmpty() && m_tabBgColour.IsOk() && m_tabFgColour.IsOk();
}
void SetTabBgColour(const wxColour& tabBgColour) {
this->m_tabBgColour = tabBgColour;
}
void SetTabFgColour(const wxColour& tabFgColour) {
this->m_tabFgColour = tabFgColour;
}
const wxColour& GetTabBgColour() const {
return m_tabBgColour;
}
const wxColour& GetTabFgColour() const {
return m_tabFgColour;
}
void SetProjectName(const wxString& projectName) {
this->m_projectName = projectName;
}
const wxString& GetProjectName() const {
return m_projectName;
}
};
class TweaksSettings : public clConfigItem
{
ProjectTweaks::Map_t m_projects;
wxColour m_globalBgColour;
wxColour m_globalFgColour;
bool m_enableTweaks;
size_t m_flags;
public:
enum {
kDontPromptForProjectReload = 0x00000001
};
public:
virtual void FromJSON(const JSONElement& json);
virtual JSONElement ToJSON() const;
TweaksSettings();
virtual ~TweaksSettings();
TweaksSettings& Load();
void Clear();
void ResetColours();
void Save();
bool HasFlag(int flag) const {
return m_flags & kDontPromptForProjectReload;
}
void EnableFlag(int flag, bool b) {
if ( b ) {
m_flags |= flag;
} else {
m_flags &= ~flag;
}
}
const ProjectTweaks::Map_t& GetProjects() const {
return m_projects;
}
void SetGlobalBgColour(const wxColour& globalBgColour) {
this->m_globalBgColour = globalBgColour;
}
void SetGlobalFgColour(const wxColour& globalFgColour) {
this->m_globalFgColour = globalFgColour;
}
void SetProjects(const ProjectTweaks::Map_t& projects) {
this->m_projects = projects;
}
const wxColour& GetGlobalBgColour() const {
return m_globalBgColour;
}
const wxColour& GetGlobalFgColour() const {
return m_globalFgColour;
}
void SetEnableTweaks(bool enableTweaks) {
this->m_enableTweaks = enableTweaks;
}
bool IsEnableTweaks() const {
return m_enableTweaks;
}
const ProjectTweaks& GetProjectTweaks(const wxString &project) const;
ProjectTweaks& GetProjectTweaks(const wxString &project);
void UpdateProject(const ProjectTweaks& pt);
void DeleteProject(const wxString& pt);
};
#endif // TWEAKSSETTINGS_H