-
Notifications
You must be signed in to change notification settings - Fork 0
/
Icons.cpp
212 lines (189 loc) · 5.45 KB
/
Icons.cpp
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include "Icons.h"
int CIcons::m_index_name = 0;
int CIcons::m_index_filename = 0;
int CIcons::m_index_parameters = 0;
int CIcons::m_index_workingdir = 0;
int CIcons::m_index_hotkey = 0;
int CIcons::m_index_commentar = 0;
int CIcons::m_index_iconfilename = 0;
int CIcons::m_index_iconindex = 0;
int CIcons::m_index_appuser = 0;
int CIcons::m_index_flags = 0;
const wxString CIcons::Flags[] =
{
wxT("closeonexit"),
wxT("createonlyiffileexists"),
wxT("dontcloseonexit"),
wxT("foldershortcut"),
wxT("runmaximized"),
wxT("runminimized"),
wxT("uninsneveruninstall"),
wxT("useapppaths")
};
CIcons::CIcons( void)
{
//ctor
}
CIcons::~CIcons()
{
//dtor
}
void CIcons::WriteInFile( wxTextFile* File)
{
if( !m_Name.IsEmpty() && !m_Filename.IsEmpty())
{
wxString Text;
Text =_T("Name: \"") + m_Name +_T("\"; Filename: \"") + m_Filename +_T("\"");
if( !m_Parameters.IsEmpty())
Text +=_T("; Parameters; \"") + m_Parameters +_T("\"");
if( !m_WorkingDir.IsEmpty())
Text +=_T("; WorkingDir: \"") + m_WorkingDir +_T("\"");
if( !m_HotKey.IsEmpty())
Text +=_T("; HotKey: \"") + m_HotKey +_T("\"");
if( !m_Commentar.IsEmpty())
Text +=_T("; Comment: \"") + m_Commentar +_T("\"");
if( !m_IconFilename.IsEmpty())
Text +=_T("; IconFilename: \"") + m_IconFilename +_T("\"");
if( !m_IconIndex.IsEmpty())
Text +=_T("; IconIndex: ") + m_IconIndex;
if( !m_Flags.IsEmpty())
Text +=_T("; Flags: ") + m_Flags;
CCompTask::AddText(Text);
CCommon::AddText(Text);
File->AddLine( Text);
}
}
void CIcons::Set( wxString name, wxString filename)
{
m_Name = name;
m_Filename = filename;
}
void CIcons::SetParameters( wxString parameters)
{
m_Parameters = parameters;
}
void CIcons::SetWorkingDir( wxString workingDir)
{
m_WorkingDir = workingDir;
}
void CIcons::SetHotKey( wxString hotKey)
{
m_HotKey = hotKey;
}
void CIcons::SetCommentar( wxString commentar)
{
m_Commentar = commentar;
}
void CIcons::SetIconFilename( wxString iconFilename)
{
m_IconFilename = iconFilename;
}
void CIcons::SetAppUserModelID( wxString app)
{
m_AppUserModelId = app;
}
void CIcons::SetFlags( wxString flags)
{
m_Flags = flags;
}
void CIcons::SetName(wxString name)
{
m_Name = name;
}
void CIcons::SetFilename(wxString filename)
{
m_Filename = filename;
}
void CIcons::SetIconIndex(wxString iconIndex)
{
m_IconIndex = iconIndex;
}
void CIcons::Analize(const wxString& content, const wxString& line)
{
wxString cont = content;
wxString part;
wxString settings;
SetLinenumber(line);
while( !cont.empty())
{
part = cont.BeforeFirst(':');
settings = cont.AfterFirst(':').BeforeFirst(';');
cont = cont.AfterFirst(';');
part = part.Trim(false);
settings = settings.Trim(false);
cont = cont.Trim(false);
if( part.CmpNoCase(_T("name")) == 0)
{
SetName(settings);
}
else if( part.CmpNoCase(_T("Filename")) == 0)
{
SetFilename(settings);
}
else if( part.CmpNoCase(_T("parameters")) == 0)
{
SetParameters(settings);
}
else if( part.CmpNoCase(_T("workingdir")) == 0)
{
SetWorkingDir(settings);
}
else if( part.CmpNoCase(_T("hotkey")) == 0)
{
SetHotKey(settings);
}
else if( part.CmpNoCase(_T("comment")) == 0)
{
SetCommentar(settings);
}
else if( part.CmpNoCase(_T("iconfilename")) == 0)
{
SetIconFilename(settings);
}
else if( part.CmpNoCase(_T("iconindex")) == 0)
{
SetIconIndex(settings);
}
else if( part.CmpNoCase(_T("appusermodelid")) == 0)
{
SetAppUserModelID(settings);
}
else if( part.CmpNoCase(_T("flags")) == 0)
{
SetFlags(settings);
}
else if( !CCompTask::Analize(part, settings))
CCommon::Analize(part, settings);
}
}
void CIcons::FillContent(wxListCtrl* liste)
{
liste->SetItem(GetIndex(), m_index_name, m_Name);
liste->SetItem(GetIndex(), m_index_filename, m_Filename);
liste->SetItem(GetIndex(), m_index_parameters, m_Parameters);
liste->SetItem(GetIndex(), m_index_workingdir, m_WorkingDir);
liste->SetItem(GetIndex(), m_index_hotkey, m_HotKey);
liste->SetItem(GetIndex(), m_index_commentar, m_Commentar);
liste->SetItem(GetIndex(), m_index_iconfilename, m_IconFilename);
liste->SetItem(GetIndex(), m_index_iconindex, m_IconIndex);
liste->SetItem(GetIndex(), m_index_appuser, m_AppUserModelId);
liste->SetItem(GetIndex(), m_index_flags, m_Flags);
CCompTask::FillContent(liste, GetIndex());
CCommon::FillContent(liste, GetIndex());
}
void CIcons::AddHeader(wxListCtrl* liste)
{
InsertHeader(liste);
m_index_name = liste->InsertColumn(liste->GetColumnCount(), _T("Name"));
m_index_filename = liste->InsertColumn(liste->GetColumnCount(), _T("Filename"));
m_index_parameters = liste->InsertColumn(liste->GetColumnCount(), _T("Parameters"));
m_index_workingdir = liste->InsertColumn(liste->GetColumnCount(), _T("WorkingDir"));
m_index_hotkey = liste->InsertColumn(liste->GetColumnCount(), _T("HotKey"));
m_index_commentar = liste->InsertColumn(liste->GetColumnCount(), _T("Comment"));
m_index_iconfilename = liste->InsertColumn(liste->GetColumnCount(), _T("IconFilename"));
m_index_iconindex = liste->InsertColumn(liste->GetColumnCount(), _T("IconIndex"));
m_index_appuser = liste->InsertColumn(liste->GetColumnCount(), _T("AppUserModelID"));
m_index_flags = liste->InsertColumn(liste->GetColumnCount(), _T("Flags"));
CCompTask::AddHeader(liste);
CCommon::AddHeader(liste);
}