forked from oulan/Asuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppConfig.pas
215 lines (185 loc) · 6.64 KB
/
AppConfig.pas
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
212
213
214
215
{
Copyright (C) 2006-2013 Matteo Salvi
Website: http://www.salvadorsoftware.com/
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit AppConfig;
interface
uses
SysUtils, Forms;
const
// Application's informations
APP_NAME = 'ASuite';
APP_TITLE = APP_NAME;
VERSION_MAJOR = '2'; { TODO : Update version info with IDE macro }
VERSION_MINOR = '0';
VERSION_RELEASE = '0';
VERSION_BUILD = '1163';
VERSION_COMPLETE = VERSION_MAJOR + '.' +
VERSION_MINOR + '.' +
VERSION_RELEASE;
VERSION_PRERELEASE = 'Alpha 3'; //For Alpha and Beta version
//(VERSION_RELEASE + VERSION_PRERELEASE = Version)
BACKUP_DIR = 'backup\';
CACHE_DIR = 'cache\';
LOCALE_DIR = 'locale\';
CACHELARGE_DIR = 'cache\large\';
MENUTHEMES_DIR = 'menuthemes\';
ICONS_DIR = 'icons\';
SMALLICONS_DIR = ICONS_DIR + '16x16\';
LARGEICONS_DIR = ICONS_DIR + '32x32\';
// Caratteri speciali
LF = #10; { line feed }
CR = #13; { carriage return }
SLASH = '/'; { forward slash }
BACKSLASH = '\'; { back slash }
CRLF = CR + LF; { new line }
//FileSystem
PATH_SEPARATOR = BACKSLASH; // Windows only, for now
SLASHES = [SLASH, BACKSLASH];
DriveLetters = ['a'..'z', 'A'..'Z'];
//Extensions
EXT_XML = '.xml';
EXT_SQL = '.sqlite';
EXT_SQLBCK = '.sqbck';
EXT_XMLBCK = '.bck';
EXT_ICO = '.ico';
EXT_LNK = '.lnk';
EXT_EXE = '.exe';
//File
DEBUG_FILE = 'Debug.txt';
THEME_INI = 'theme.ini';
BACKUP_FILE = APP_NAME + '_%s' + EXT_SQLBCK;
//Form
frmMainWidth = 190;
frmMainHeight = 440;
frmMenuID = 123456789;
// PageControl Indexes
PG_LIST = 0;
PG_SEARCH = 1;
// PageControl Indexes
PG_MENULIST = 0;
PG_MENUMRU = 1;
PG_MENUMFU = 2;
PG_MENUSEARCH = 3;
//ASuite placeholders for path
CONST_PATH_ASUITE = '$asuite';
CONST_PATH_DRIVE = '$drive';
//Parameters' variables: constant placeholders
CONST_PARAM_PENDRV = '%pendrive%';
//ASuite filename icons
FILEICON_ASuite = '0.ico';
FILEICON_Cat = '1.ico';
FILEICON_Help = '2.ico';
FILEICON_Options = '3.ico';
FILEICON_AddCat = '4.ico';
FILEICON_AddFile = '5.ico';
FILEICON_AddFolder = '6.ico';
FILEICON_Delete = '7.ico';
FILEICON_Property = '8.ico';
FILEICON_Save = '9.ico';
FILEICON_Folder = '10.ico';
FILEICON_NOTFOUND = '13.ico';
FILEICON_Run = '14.ico';
FILEICON_Cut = '15.ico';
FILEICON_Copy = '16.ico';
FILEICON_Paste = '17.ico';
FILEICON_Search = '18.ico';
FILEICON_SearchType = '19.ico';
FILEICON_Url = '20.ico';
FILEICON_Accept = '21.ico';
FILEICON_Cancel = '22.ico';
FILELARGEICON_General = '0.ico';
FILELARGEICON_Advanced = '1.ico';
FILELARGEICON_Items = '2.ico';
FILELARGEICON_Hotkey = '3.ico';
FILELARGEICON_Mouse = '4.ico';
FILELARGEICON_Trayicon = '5.ico';
FILELARGEICON_Stats = '6.ico';
FILELARGEICON_Behavior = '7.ico';
FILELARGEICON_PropGeneral = '8.ico';
var
//Paths
SUITE_FULLFILENAME : String;
SUITE_FILENAME : String;
SUITE_DRIVE : String;
SUITE_PATH : String;
SUITE_WORKING_PATH : String;
SUITE_LOCALE_PATH : String;
SUITE_CACHE_PATH : String;
SUITE_CACHELARGE_PATH : String;
SUITE_BACKUP_PATH : String;
SUITE_SMALLICONS_PATH : String;
SUITE_LARGEICONS_PATH : String;
SUITE_MENUTHEMES_PATH : String;
SUITE_CURRENTTHEME_PATH : String;
// Application's files
SUITE_LIST_PATH : String;
//Menu small icons
IMAGE_INDEX_ASuite, //ID = 0;
IMAGE_INDEX_Cat, //ID = 1;
IMAGE_INDEX_Help, //ID = 2;
IMAGE_INDEX_Options, //ID = 3;
IMAGE_INDEX_AddCat, //ID = 4;
IMAGE_INDEX_AddFile , //ID = 5;
IMAGE_INDEX_AddFolder, //ID = 6;
IMAGE_INDEX_Delete, //ID = 7;
IMAGE_INDEX_Property, //ID = 8;
IMAGE_INDEX_Save, //ID = 9;
IMAGE_INDEX_Folder, //ID = 10;
IMAGE_INDEX_AddGroupFile, //ID = 11;
IMAGE_INDEX_GroupFile, //ID = 12;
IMAGE_INDEX_NOTFOUND, //ID = 13;
IMAGE_INDEX_Run, //ID = 14;
IMAGE_INDEX_Cut, //ID = 15;
IMAGE_INDEX_Copy, //ID = 16;
IMAGE_INDEX_Paste , //ID = 17;
IMAGE_INDEX_Search, //ID = 18;
IMAGE_INDEX_SearchType, //ID = 19;
IMAGE_INDEX_Url, //ID = 20;
IMAGE_INDEX_Accept, //ID = 21;
IMAGE_INDEX_Cancel //ID = 22;
: Integer;
//Menu large icons
IMAGELARGE_INDEX_General, //ID = 0;
IMAGELARGE_INDEX_Advanced, //ID = 1;
IMAGELARGE_INDEX_Items, //ID = 2;
IMAGELARGE_INDEX_Hotkey, //ID = 3;
IMAGELARGE_INDEX_Mouse, //ID = 4;
IMAGELARGE_INDEX_Trayicon, //ID = 5;
IMAGELARGE_INDEX_Stats, //ID = 6;
IMAGELARGE_INDEX_Behavior, //ID = 7;
IMAGELARGE_INDEX_PropGeneral //ID = 8;
: Integer;
implementation
uses ulSysUtils;
initialization
//Default paths
SUITE_FULLFILENAME := Application.ExeName;
SUITE_FILENAME := ExtractFileName(SUITE_FULLFILENAME);
SUITE_DRIVE := LowerCase(ExtractFileDrive(SUITE_FULLFILENAME));
SUITE_PATH := IncludeTrailingBackslash(ExtractFileDir(SUITE_FULLFILENAME));
if IsDriveRoot(SUITE_PATH)
then SUITE_WORKING_PATH := GetCorrectWorkingDir(SUITE_PATH)
else SUITE_WORKING_PATH := SUITE_PATH;
SUITE_WORKING_PATH := LowerCase(SUITE_WORKING_PATH);
SUITE_LOCALE_PATH := SUITE_WORKING_PATH + LOCALE_DIR;
SUITE_CACHE_PATH := SUITE_WORKING_PATH + CACHE_DIR;
SUITE_CACHELARGE_PATH := SUITE_WORKING_PATH + CACHELARGE_DIR;
SUITE_BACKUP_PATH := SUITE_WORKING_PATH + BACKUP_DIR;
SUITE_MENUTHEMES_PATH := SUITE_WORKING_PATH + MENUTHEMES_DIR;
//List
if (ExtractFileExt(ParamStr(1)) = EXT_SQL) and FileExists(ParamStr(1)) then
SUITE_LIST_PATH := ParamStr(1)
else
SUITE_LIST_PATH := SUITE_WORKING_PATH + ChangeFileExt(SUITE_FILENAME, EXT_SQL);
end.