-
Notifications
You must be signed in to change notification settings - Fork 4
/
TypeAndRun.dpr
80 lines (66 loc) · 2.17 KB
/
TypeAndRun.dpr
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
program TypeAndRun;
uses
Forms,
Classes,
Windows,
SysUtils,
frmConsoleUnit in 'frmConsoleUnit.pas' {frmTARConsole},
ForAll in 'ForAll.pas',
Configs in 'Configs.pas',
Static in 'Static.pas',
frmSettingsUnit in 'frmSettingsUnit.pas' {frmSettings},
frmAboutUnit in 'frmAboutUnit.pas' {frmAbout},
Plugins in 'Plugins.pas',
frmTypeDownDropUnit in 'frmTypeDownDropUnit.pas' {frmTypeDropDown},
Settings in 'Settings.pas',
frmHintUnit in 'frmHintUnit.pas' {frmHint};
{$R *.res}
{$R XPTheme.RES}
begin
Application.Initialize;
// Èíèöèàëèçàöèÿ ìàññèâîâ ñòðîê ïåðåä çàíåñåíèåì â íèõ êîíôèãà
ConfigStr:=TStringList.Create;
HistoryStr:=TStringList.Create;
Options:=TSettings.Create;
tmpAliasStr:=TStringList.Create;
// Ñîçäàåì ñåìàôîð è ñìîòðèì, ñîçäàëñÿ ëè îí
CreateSemaphore(nil, 0, 1, 'TypeAndRunSemaphore');
if GetLastError = Error_Already_Exists then begin
// Åñëè íå ñîçäàëñÿ, è ïàðàìåòð êîììàíäíîé ñòðîêè íå ïóñòîé, òî äîáàâëÿåì àëèàñ
if ParamCount <> 0 then begin
//Application.CreateForm(TfrmAbout, frmAbout);
Application.CreateForm(TfrmTARConsole, frmTARConsole);
Application.CreateForm(TfrmHint, frmHint);
ActivatePrevInst;
end;
Application.Terminate;
Halt;
end;
ParseCmdLine(1);
Application.CreateForm(TfrmTARConsole, frmTARConsole);
//Application.CreateForm(TfrmSettings, frmSettings);
//Application.CreateForm(TfrmAbout, frmAbout);
// Îáðàáîòêà ñîáûòèé àêòèâèçàöèè/äåàêòèâèçàöèè ïðèëîæåíèÿ
Application.OnDeactivate:=frmTARConsole.AppDeActivate;
Application.OnActivate:=frmTARConsole.AppActivate;
// ×òåíèå âñåõ íàñòðîåê
Options.ReadSettings;
ReadConfig(Program_Config);
ReadHistory(Program_History);
Options.SystemAliases.ReadSystemAliases;
ReadPlugins(Program_Plugin);
LoadPlugins;
// Óñòàíîâêà íà÷àëüíûõ çíà÷åíèé îòìåí
UndoMax:=0;
SetLength(Undo, UndoMax);
SetLength(UndoCur, UndoMax);
SetLength(UndoCurLength, UndoMax);
ApplySettings;
ParseCmdLine(2);
if Options.Config.CDA_Startup then begin
ReturnDeadAliases;
CheckDeadAliases;
end;
if Options.Show.ShowConsoleOnStart then ShowCon;
Application.Run;
end.