-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuStartup.pas
119 lines (105 loc) · 3.52 KB
/
uStartup.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
//------------------------------------------------------------------
// SpellCode - Source code spell checking utility.
// Copyright © 2010 Dilshan R Jayakody. <[email protected]>
// http://code.google.com/p/spellcode
//
// SpellCode is distributed under the MIT license.
//------------------------------------------------------------------
unit uStartup;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, JvExControls, JvButton, JvNavigationPane,
JvXPCore, JvXPBar, StdCtrls, JvExStdCtrls, JvCombobox, JvDriveCtrls,
JvListBox, ComCtrls, FolderTree, shellapi;
type
TuStartupWin = class(TForm)
JvNavPanelHeader2: TJvNavPanelHeader;
Panel1: TPanel;
Bevel1: TBevel;
brLinks: TJvXPBar;
JvNavPanelHeader1: TJvNavPanelHeader;
brMRU: TJvXPBar;
Image1: TImage;
Label1: TLabel;
chkStartup: TCheckBox;
Label2: TLabel;
cmbLangs: TComboBox;
btnCancel: TButton;
btnOK: TButton;
tvDirs: TFolderTree;
path_timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure path_timer1Timer(Sender: TObject);
procedure MRUItemClick(Sender : TObject);
procedure brLinksItems0Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
const general_err_txt = 'Critical error has been occurred!'#13;
var
uStartupWin: TuStartupWin;
implementation
uses uMain;
{$R *.dfm}
procedure TuStartupWin.FormCreate(Sender: TObject);
var strlist : TStringList; pos : integer;
begin
try
cmbLangs.Items := fmMain.cmbLanguage.Items;
cmbLangs.ItemIndex := fmMain.cmbLanguage.ItemIndex;
Screen.Cursor := crHourGlass;
strlist := TStringList.Create;
strlist.LoadFromFile(fmMain.root+'spellcode.mru');
for pos := 0 to strlist.Count - 1 do begin
with brMru.Items.Add do begin
Caption := ExtractFileName(ExcludeTrailingBackslash(strlist.Strings[pos]));
Hint := strlist.Strings[pos];
OnClick := MRUItemClick;
end;
end;
freeandnil(strlist);
except on E: Exception do
MessageBox(handle,pchar(general_err_txt+E.Message),pchar(Application.Title + ' - Error'),MB_OK+MB_ICONERROR);
end;
end;
procedure TuStartupWin.MRUItemClick(Sender : TObject);
begin
try
Screen.Cursor := crHourGlass;
tvDirs.SetDirectory(TJvXPBarItem(Sender).Hint);
Screen.Cursor := crDefault;
self.ModalResult := mrOK;
except on E: Exception do
MessageBox(handle,pchar(general_err_txt+E.Message),pchar(Application.Title + ' - Error'),MB_OK+MB_ICONERROR);
end;
end;
procedure TuStartupWin.path_timer1Timer(Sender: TObject);
begin
try
path_timer1.Interval := 0;
tvDirs.SetDirectory(GetCurrentDir);
Screen.Cursor := crDefault;
except on E: Exception do
MessageBox(handle,pchar(general_err_txt+E.Message),pchar(Application.Title + ' - Error'),MB_OK+MB_ICONERROR);
end;
end;
procedure TuStartupWin.brLinksItems0Click(Sender: TObject);
begin
try
ShellExecute(Application.Handle,'open',pchar(TJvXPBarItem(Sender).Hint),'','',SW_SHOW);
except on E: Exception do
MessageBox(handle,pchar(general_err_txt+E.Message),pchar(Application.Title + ' - Error'),MB_OK+MB_ICONERROR);
end;
end;
procedure TuStartupWin.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then begin
self.ModalResult := mrCancel;
Key := #0;
end;
end;
end.