1 | unit UMainWindow;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
7 | Dialogs, StdCtrls, cTCPClient, cTCPServer, cWindows, cSockets, cUtils,
|
---|
8 | cSocketsUDP, USunriseChatCore, ImgList, Menus, CoolTrayIcon, ToolWin,
|
---|
9 | ActnMan, ActnCtrls, ActnMenus, ActnList, XPStyleActnCtrls, ComCtrls,
|
---|
10 | ExtCtrls, cWinSock, UAutoRegistry, Registry, CustomizeDlg, MPlayer,
|
---|
11 | StdActns, ULogExceptions, RVScroll, RichView, RVStyle, UTextFileStream,
|
---|
12 | ShellAPI;
|
---|
13 |
|
---|
14 | const
|
---|
15 | ApplicationName = 'SunriseChat';
|
---|
16 | Author = 'Jiří Hajda';
|
---|
17 | HomePage = 'http://www.zdechov.net/sunrisechat/';
|
---|
18 | Email = 'robie@centrum.cz';
|
---|
19 | ClientVersion = '2.9';
|
---|
20 | ClientReleaseDate = '18.3.2006';
|
---|
21 | OfflineTimeout = 13/24/3600; // 13 seconds
|
---|
22 | Creator = 'Chronosoft';
|
---|
23 | RegistryPath = '\Software\'+Creator+'\SunriseChat';
|
---|
24 | ChangeLogFile = 'Novinky.txt';
|
---|
25 | Licence = 'GNU/GPL';
|
---|
26 | HttpHeader = 'http://';
|
---|
27 |
|
---|
28 | type
|
---|
29 | TAppEventTextColor = record
|
---|
30 | Color: Integer;
|
---|
31 | Charset: Integer;
|
---|
32 | Style: string;
|
---|
33 | Size: Integer;
|
---|
34 | Name: string;
|
---|
35 | end;
|
---|
36 |
|
---|
37 | TAppEvent = record
|
---|
38 | public
|
---|
39 | // Actions
|
---|
40 | EventName: string;
|
---|
41 | ShowWindow: Boolean;
|
---|
42 | ShowBalloonHint: Boolean;
|
---|
43 | PlaySound: Boolean;
|
---|
44 | ShowAlertIcon: Boolean;
|
---|
45 | IconFile: string;
|
---|
46 | PlayBeep: Boolean;
|
---|
47 | SoundFile: string;
|
---|
48 | ExecuteApplication: Boolean;
|
---|
49 | ApplicationFile: string;
|
---|
50 | ShowMessage: Boolean;
|
---|
51 | MessageText: string;
|
---|
52 | MessageFont: TFont;
|
---|
53 | MessageFontTemp: TAppEventTextColor;
|
---|
54 | end;
|
---|
55 |
|
---|
56 | TAppUserEvent = record
|
---|
57 | // Conditions
|
---|
58 | ConditionTextEnable: Boolean;
|
---|
59 | ConditionText: string;
|
---|
60 | ConditionUserEnable: Boolean;
|
---|
61 | ConditionUser: string;
|
---|
62 | ConditionAppEventEnable: Boolean;
|
---|
63 | ConditionAppEvent: Integer;
|
---|
64 |
|
---|
65 | // Actions
|
---|
66 | EventName: string;
|
---|
67 | ShowWindow: Boolean;
|
---|
68 | ShowBalloonHint: Boolean;
|
---|
69 | PlaySound: Boolean;
|
---|
70 | ShowAlertIcon: Boolean;
|
---|
71 | IconFile: string;
|
---|
72 | PlayBeep: Boolean;
|
---|
73 | SoundFile: string;
|
---|
74 | ExecuteApplication: Boolean;
|
---|
75 | ApplicationFile: string;
|
---|
76 | ShowImage: Boolean;
|
---|
77 | ImageFile: string;
|
---|
78 | Image: TImage;
|
---|
79 | end;
|
---|
80 |
|
---|
81 | TEventOption = (eoShowWindow, eoShowBalloonHint, eoShowAlertIcon, eoPlayBeep,
|
---|
82 | eoShowMessage);
|
---|
83 | TEventOptions = set of TEventOption;
|
---|
84 |
|
---|
85 | TMainWindow = class(TForm)
|
---|
86 | Panel3: TPanel;
|
---|
87 | Panel4: TPanel;
|
---|
88 | Button1: TButton;
|
---|
89 | ActionManager1: TActionManager;
|
---|
90 | ActionOptions: TAction;
|
---|
91 | ActionInfo: TAction;
|
---|
92 | ActionAbout: TAction;
|
---|
93 | ActionStatus: TAction;
|
---|
94 | ActionClose: TAction;
|
---|
95 | ActionRestore: TAction;
|
---|
96 | ActionOnline: TAction;
|
---|
97 | ActionAway: TAction;
|
---|
98 | ActionInvisible: TAction;
|
---|
99 | ActionTestResponse: TAction;
|
---|
100 | ActionBlockIP: TAction;
|
---|
101 | ActionCallUp: TAction;
|
---|
102 | CoolTrayIcon1: TCoolTrayIcon;
|
---|
103 | PopupMenu2: TPopupMenu;
|
---|
104 | Blokovatadresu1: TMenuItem;
|
---|
105 | estodezvy1: TMenuItem;
|
---|
106 | Vzva1: TMenuItem;
|
---|
107 | PopupMenu1: TPopupMenu;
|
---|
108 | Obnovit1: TMenuItem;
|
---|
109 | Informace1: TMenuItem;
|
---|
110 | Nastaven2: TMenuItem;
|
---|
111 | Oprogramu2: TMenuItem;
|
---|
112 | Ukonit1: TMenuItem;
|
---|
113 | ImageList1: TImageList;
|
---|
114 | Timer1: TTimer;
|
---|
115 | ActionUserRoom: TAction;
|
---|
116 | ActionLogCommand: TAction;
|
---|
117 | PopupMenu3: TPopupMenu;
|
---|
118 | Odejtzmstnosti1: TMenuItem;
|
---|
119 | CustomizeDlg1: TCustomizeDlg;
|
---|
120 | ActionCustomizeDlg: TAction;
|
---|
121 | PopupMenu4: TPopupMenu;
|
---|
122 | Pedchozzprva1: TMenuItem;
|
---|
123 | Doplnitjmno1: TMenuItem;
|
---|
124 | MainMenu1: TMainMenu;
|
---|
125 | Status1: TMenuItem;
|
---|
126 | Online1: TMenuItem;
|
---|
127 | Pry1: TMenuItem;
|
---|
128 | Neviditeln1: TMenuItem;
|
---|
129 | Nastaven1: TMenuItem;
|
---|
130 | Informace2: TMenuItem;
|
---|
131 | Status2: TMenuItem;
|
---|
132 | Online2: TMenuItem;
|
---|
133 | Pry2: TMenuItem;
|
---|
134 | Neviditeln2: TMenuItem;
|
---|
135 | ActionNetworkTest: TAction;
|
---|
136 | estst1: TMenuItem;
|
---|
137 | Panel5: TPanel;
|
---|
138 | ToolBar1: TToolBar;
|
---|
139 | ToolButton1: TToolButton;
|
---|
140 | ToolButton2: TToolButton;
|
---|
141 | ToolButton3: TToolButton;
|
---|
142 | ToolButton4: TToolButton;
|
---|
143 | ToolButton5: TToolButton;
|
---|
144 | ToolButton7: TToolButton;
|
---|
145 | Panel2: TPanel;
|
---|
146 | Label1: TLabel;
|
---|
147 | ListView1: TListView;
|
---|
148 | Splitter3: TSplitter;
|
---|
149 | Panel1: TPanel;
|
---|
150 | Label2: TLabel;
|
---|
151 | MediaPlayer1: TMediaPlayer;
|
---|
152 | Vytvoitmstnost1: TMenuItem;
|
---|
153 | ActionCreateRoom: TAction;
|
---|
154 | Vytvoitmstnost2: TMenuItem;
|
---|
155 | SearchFind1: TSearchFind;
|
---|
156 | PopupMenu5: TPopupMenu;
|
---|
157 | Find1: TMenuItem;
|
---|
158 | Vymazatve1: TMenuItem;
|
---|
159 | ActionClearMessageList: TAction;
|
---|
160 | ComboBox1: TComboBox;
|
---|
161 | N1: TMenuItem;
|
---|
162 | Novinky1: TMenuItem;
|
---|
163 | ActionChangeLog: TAction;
|
---|
164 | Oprogramu1: TMenuItem;
|
---|
165 | RVStyle1: TRVStyle;
|
---|
166 | Panel6: TPanel;
|
---|
167 | RichView1: TRichView;
|
---|
168 | PageControl1: TPageControl;
|
---|
169 | TabSheet1: TTabSheet;
|
---|
170 | Pozvatuivateledomstnosti1: TMenuItem;
|
---|
171 | ActionUserEventsList: TAction;
|
---|
172 | Nabdkauivatelskchudlost1: TMenuItem;
|
---|
173 | ToolButton6: TToolButton;
|
---|
174 | ListView2: TListView;
|
---|
175 | Koprovar1: TMenuItem;
|
---|
176 | Vloit1: TMenuItem;
|
---|
177 | procedure RichView1Jump(Sender: TObject; id: Integer);
|
---|
178 | procedure Vloit1Click(Sender: TObject);
|
---|
179 | procedure Koprovar1Click(Sender: TObject);
|
---|
180 | procedure FormCreate(Sender: TObject);
|
---|
181 | procedure Button1Click(Sender: TObject);
|
---|
182 | procedure FormShow(Sender: TObject);
|
---|
183 | procedure Timer1Timer(Sender: TObject);
|
---|
184 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
185 | procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
|
---|
186 | procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
|
---|
187 | Shift: TShiftState);
|
---|
188 | procedure ActionInfoExecute(Sender: TObject);
|
---|
189 | procedure ActionAwayExecute(Sender: TObject);
|
---|
190 | procedure ActionOnlineExecute(Sender: TObject);
|
---|
191 | procedure ActionCloseExecute(Sender: TObject);
|
---|
192 | procedure ListView1Click(Sender: TObject);
|
---|
193 | procedure ActionTestResponseExecute(Sender: TObject);
|
---|
194 | procedure ActionRestoreExecute(Sender: TObject);
|
---|
195 | procedure ActionInvisibleExecute(Sender: TObject);
|
---|
196 | procedure ActionAboutExecute(Sender: TObject);
|
---|
197 | procedure ActionOptionsExecute(Sender: TObject);
|
---|
198 | procedure ActionCallUpExecute(Sender: TObject);
|
---|
199 | procedure TabControl1Change(Sender: TObject);
|
---|
200 | procedure ActionBlockIPExecute(Sender: TObject);
|
---|
201 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
---|
202 | procedure ActionUserRoomExecute(Sender: TObject);
|
---|
203 | procedure Odejtzmstnosti1Click(Sender: TObject);
|
---|
204 | procedure ActionCustomizeDlgExecute(Sender: TObject);
|
---|
205 | procedure PopupMenu2Popup(Sender: TObject);
|
---|
206 | procedure Pedchozzprva1Click(Sender: TObject);
|
---|
207 | // procedure Doplnitjmno1Click(Sender: TObject);
|
---|
208 | procedure ActionNetworkTestExecute(Sender: TObject);
|
---|
209 | procedure ToolButton7Click(Sender: TObject);
|
---|
210 | procedure CoolTrayIcon1Click(Sender: TObject);
|
---|
211 | procedure ToolButton1Click(Sender: TObject);
|
---|
212 | procedure ToolButton3Click(Sender: TObject);
|
---|
213 | procedure ToolButton2Click(Sender: TObject);
|
---|
214 | procedure ToolButton5Click(Sender: TObject);
|
---|
215 | procedure ToolButton4Click(Sender: TObject);
|
---|
216 | procedure RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
|
---|
217 | Shift: TShiftState; X, Y: Integer);
|
---|
218 | procedure ListView1InfoTip(Sender: TObject; Item: TListItem;
|
---|
219 | var InfoTip: String);
|
---|
220 | procedure ActionCreateRoomExecute(Sender: TObject);
|
---|
221 | procedure Doplnitjmno1Click(Sender: TObject);
|
---|
222 | procedure SearchFind1FindDialogFind(Sender: TObject);
|
---|
223 | procedure SearchFind1BeforeExecute(Sender: TObject);
|
---|
224 | procedure ActionClearMessageListExecute(Sender: TObject);
|
---|
225 | procedure ComboBox1Change(Sender: TObject);
|
---|
226 | procedure ActionChangeLogExecute(Sender: TObject);
|
---|
227 | procedure ComboBox1DropDown(Sender: TObject);
|
---|
228 | procedure ComboBox1CloseUp(Sender: TObject);
|
---|
229 | procedure FormResize(Sender: TObject);
|
---|
230 | procedure ActionUserEventsListExecute(Sender: TObject);
|
---|
231 | procedure ToolButton6Click(Sender: TObject);
|
---|
232 | private
|
---|
233 | CloseEnabled: Boolean;
|
---|
234 | UserLastText: string;
|
---|
235 | procedure WMQueryEndSession(var Message: TMessage); message WM_QUERYENDSESSION;
|
---|
236 | procedure AppMessage(var Msg: TMsg; var Handled: Boolean);
|
---|
237 | procedure ChangeNetworkState;
|
---|
238 | procedure CallUp;
|
---|
239 | procedure lComboBox1Change(Sender: TObject);
|
---|
240 | { Private declarations }
|
---|
241 | public
|
---|
242 | UserEventsImagesEnabled: Boolean;
|
---|
243 | FirstStart: Boolean;
|
---|
244 | LastRichViewStyle: Integer;
|
---|
245 | MaxNumberOfRoomLines: Integer;
|
---|
246 | AppEvents: array of TAppEvent;
|
---|
247 | AppUserEvents: array of TAppUserEvent;
|
---|
248 | AppEventsInit: array of TAppEvent;
|
---|
249 | Options: TAutoRegistry;
|
---|
250 | AppEventsOptions: array of TAutoRegistry;
|
---|
251 | AppUserEventsOptions: array of TAutoRegistry;
|
---|
252 | NetworkPort: Integer;
|
---|
253 | NetworkInterface: string;
|
---|
254 | PingTimeout: Integer;
|
---|
255 | MinimizeToTray: Boolean;
|
---|
256 | StartInTray: Boolean;
|
---|
257 | RunOnLogon: Boolean;
|
---|
258 | LastText: string;
|
---|
259 | OnTop: Boolean;
|
---|
260 | ShowOnMessage: Boolean;
|
---|
261 | PositionX, PositionY, SizeX, SizeY: Integer;
|
---|
262 | LastWindowState: Integer;
|
---|
263 | AlphaBlendWindow: Integer;
|
---|
264 | UserListWidth: Integer;
|
---|
265 | ShowMessageTime: Boolean;
|
---|
266 | ShowMainMenu: Boolean;
|
---|
267 | InstanceIndex: Integer;
|
---|
268 | ShowBallonHint: Boolean;
|
---|
269 | NoResloveHostName: Boolean;
|
---|
270 | MinimalizeOnCloseWindow: Boolean;
|
---|
271 | DefaultReason: string;
|
---|
272 | ServiceFunction: Boolean;
|
---|
273 | ShowRightToolBar: Boolean;
|
---|
274 | PauseScrollText: Boolean;
|
---|
275 | OneAppInstance: Boolean;
|
---|
276 | WM_SunriseChatStart: Cardinal;
|
---|
277 | WM_SunriseChatClose: Cardinal;
|
---|
278 | NoSaveToRegistry: Boolean;
|
---|
279 | SoundDisable: Boolean;
|
---|
280 | StopProgram: Boolean;
|
---|
281 | SnapWindow: Boolean;
|
---|
282 | InvisibledOnStart: Boolean;
|
---|
283 | AutoChangeWindowHeight: Boolean;
|
---|
284 | AutoChangeWindowHeightDirectionDown: Boolean;
|
---|
285 | MinimumVisibleUsersCount: Integer;
|
---|
286 | SoundVolume: Integer;
|
---|
287 | LanguageIndex: Integer;
|
---|
288 | SettingsName: string;
|
---|
289 | AutoChangeInfoWindowHeight: Boolean;
|
---|
290 | AppUserEventsCount: Integer;
|
---|
291 | HyperLinks: array of string;
|
---|
292 | procedure RoomListChanged;
|
---|
293 | procedure InitTrayIcon;
|
---|
294 | procedure ChangeRunOnLogon;
|
---|
295 | procedure AddMessage(RoomIndex: Integer; const Args: array of const; EventType: TAppEventType; TextColor: TColor = clSysMessage; UserNick: string = '');
|
---|
296 | procedure ScrollDownRichEdit1;
|
---|
297 | procedure DoplnitJmeno;
|
---|
298 | procedure AddEvent(Name, Text: string; Options: TEventOptions);
|
---|
299 | procedure SaveAppEventsToRegistry;
|
---|
300 | procedure LoadAppEventsFromRegistry;
|
---|
301 | procedure SaveAppUserEventsToRegistry;
|
---|
302 | procedure LoadAppUserEventsFromRegistry(UpdateOnly: Boolean = False);
|
---|
303 | procedure RefreshAppTitle;
|
---|
304 | procedure InitSettings;
|
---|
305 | procedure FillComboBox;
|
---|
306 | procedure ShowUserList;
|
---|
307 | procedure ReloadImages;
|
---|
308 | end;
|
---|
309 |
|
---|
310 | var
|
---|
311 | MainWindow: TMainWindow;
|
---|
312 |
|
---|
313 | implementation
|
---|
314 |
|
---|
315 | uses UInfoWindow, UAboutWindow, UOptionsWindow, UNetworkTest, UNewRoom,
|
---|
316 | DateUtils, ULocalization, UWaitingDialog;
|
---|
317 |
|
---|
318 | {$R *.dfm}
|
---|
319 |
|
---|
320 | procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall; external user32 Name 'SwitchToThisWindow';
|
---|
321 |
|
---|
322 | procedure TMainWindow.FormCreate(Sender: TObject);
|
---|
323 | const
|
---|
324 | Separator = '|';
|
---|
325 | var
|
---|
326 | Row: string;
|
---|
327 | FileName: string;
|
---|
328 | I: Integer;
|
---|
329 | begin
|
---|
330 | SettingsName:= '';
|
---|
331 | // Process application parameters
|
---|
332 | for I:= 0 to ParamCount do begin
|
---|
333 | //ShowMessage(ParamStr(I));
|
---|
334 | if Copy(ParamStr(I),1,3) = '/s:' then SettingsName:= Copy(ParamStr(I),4,255);
|
---|
335 | end;
|
---|
336 | if SettingsName = '' then SettingsName:= 'Default';
|
---|
337 |
|
---|
338 | SunriseChatCore.OnChangeNetworkState:= ChangeNetworkState;
|
---|
339 | SunriseChatCore.OnAddMessage:= AddMessage;
|
---|
340 | SunriseChatCore.OnUserListChange:= ShowUserList;
|
---|
341 | SunriseChatCore.OnRoomListChanged:= RoomListChanged;
|
---|
342 |
|
---|
343 | Options:= TAutoRegistry.Create(RegistryPath+'\'+SettingsName);
|
---|
344 | with Options, SunriseChatCore do begin
|
---|
345 | InitSettings;
|
---|
346 | if FirstStart then begin
|
---|
347 | FileName:= ExtractFileDir(Application.ExeName) + '\' + SmileysDefFile;
|
---|
348 | if FileExists(FileName) then begin
|
---|
349 | with TTextFileStream.Create(FileName,fmOpenRead) do try
|
---|
350 | repeat
|
---|
351 | Row:= Trim(ReadLn);
|
---|
352 | if Row <> '' then begin
|
---|
353 | SetLength(AppUserEvents, Length(AppUserEvents)+1);
|
---|
354 | with AppUserEvents[High(AppUserEvents)] do begin
|
---|
355 | EventName:= Copy(Row, 1, Pos(Separator, Row)-1);
|
---|
356 | ConditionTextEnable:= True;
|
---|
357 | ConditionText:= EventName;
|
---|
358 | ShowImage:= True;
|
---|
359 | ImageFile:= ExtractFileDir(FileName) + '\' + Copy(Row, Pos(Separator, Row)+1, Length(Row));
|
---|
360 | end;
|
---|
361 | end;
|
---|
362 | until Position = Size;
|
---|
363 | finally
|
---|
364 | Free;
|
---|
365 | end;
|
---|
366 | SetLength(AppUserEventsOptions,Length(AppUserEvents));
|
---|
367 | AppUserEventsCount:= Length(AppUserEvents);
|
---|
368 | LoadAppUserEventsFromRegistry(True);
|
---|
369 | SaveAppUserEventsToRegistry;
|
---|
370 | ReloadImages;
|
---|
371 | end;
|
---|
372 | end;
|
---|
373 |
|
---|
374 | // Check multiple application instance
|
---|
375 | WM_SunriseChatStart := RegisterWindowMessage('SunriseChatStart');
|
---|
376 | WM_SunriseChatClose := RegisterWindowMessage('SunriseChatClose');
|
---|
377 | Application.OnMessage := AppMessage;
|
---|
378 | PostMessage(HWND_BROADCAST,WM_SunriseChatStart,Application.Handle,0);
|
---|
379 | for I:= 0 to 10 do begin
|
---|
380 | Sleep(1);
|
---|
381 | Application.ProcessMessages;
|
---|
382 | if StopProgram then Break;
|
---|
383 | end;
|
---|
384 | if StopProgram then begin
|
---|
385 | Application.Terminate;
|
---|
386 | Exit;
|
---|
387 | end;
|
---|
388 | end;
|
---|
389 |
|
---|
390 | // Local user initialization
|
---|
391 | with SunriseChatCore.LocalUser do begin
|
---|
392 | Client:= ApplicationName;
|
---|
393 | Application.Title:= ApplicationName;
|
---|
394 | end;
|
---|
395 | SunriseChatCore.LocalUser.ClientVersion:= ClientVersion;
|
---|
396 | SunriseChatCore.UDPPort:= NetworkPort;
|
---|
397 | SunriseChatCore.SelectNetworkInterface(NetworkInterface);
|
---|
398 | // SunriseChatCore.Init;
|
---|
399 | RoomListChanged;
|
---|
400 | // if FileExists(CustomizeFile) then ActionManager1.LoadFromFile(CustomizeFile);
|
---|
401 | RefreshAppTitle;
|
---|
402 | AddMessage(riAll,[],aeStart);
|
---|
403 | end;
|
---|
404 |
|
---|
405 | procedure TMainWindow.InitTrayIcon;
|
---|
406 | begin
|
---|
407 | CoolTrayIcon1.MinimizeToTray:= MinimizeToTray;
|
---|
408 | CoolTrayIcon1.IconIndex:= 5;
|
---|
409 | CoolTrayIcon1.IconVisible:= True; //MinimizeToTray;
|
---|
410 | if OnTop then FormStyle:= fsStayOnTop else FormStyle:= fsNormal;
|
---|
411 |
|
---|
412 | if MinimizeToTray then CoolTrayIcon1.HideTaskbarIcon
|
---|
413 | else CoolTrayIcon1.ShowTaskbarIcon;
|
---|
414 |
|
---|
415 | // Hide MainForm at startup.
|
---|
416 | if StartInTray then Application.ShowMainForm:= False;
|
---|
417 | end;
|
---|
418 |
|
---|
419 | procedure TMainWindow.Koprovar1Click(Sender: TObject);
|
---|
420 | begin
|
---|
421 | RichView1.CopyText;
|
---|
422 | //SendMessage(RichView1.Handle, WM_COPY, 0, 0);
|
---|
423 | end;
|
---|
424 |
|
---|
425 | procedure TMainWindow.AddMessage(RoomIndex: Integer; const Args: array of const; EventType: TAppEventType; TextColor: TColor = clSysMessage; UserNick: string = '');
|
---|
426 | var
|
---|
427 | ForUser, ForUser2, MessageTime: string;
|
---|
428 | Icon: TIcon;
|
---|
429 | RichViewStyle: Integer;
|
---|
430 | I, II: Integer;
|
---|
431 | MessageTextTemp: string;
|
---|
432 | TextStart, TextEnd: Integer;
|
---|
433 | TemporaryText: string;
|
---|
434 | begin
|
---|
435 | case EventType of
|
---|
436 | aeUserChangeNick: RefreshAppTitle;
|
---|
437 | end;
|
---|
438 |
|
---|
439 | // One user message checking
|
---|
440 | if EventType = aeCommonMessage then begin
|
---|
441 | ForUser:= SunriseChatCore.LocalUser.Nick+': ';
|
---|
442 | ForUser2:= Copy(Format('%1:s',Args),1,Length(ForUser));
|
---|
443 | if ForUser2 = ForUser then EventType:= aeOneUserMessage;
|
---|
444 | end;
|
---|
445 |
|
---|
446 | // if SunriseChatCore.ActiveRoomIndex <> RoomIndex then EventType:=
|
---|
447 | try
|
---|
448 | SunriseChatCore.LastMessage:= Format(AppEvents[Integer(EventType)].MessageText,Args);
|
---|
449 | except
|
---|
450 | ShowMessage('Chyba ve zprávě pro událost '+AppEvents[Integer(EventType)].EventName+'!');
|
---|
451 | end;
|
---|
452 |
|
---|
453 | with AppEvents[Integer(EventType)] do begin
|
---|
454 | if ShowWindow then CallUp; //CoolTrayIcon1.ShowMainForm;
|
---|
455 | if not SoundDisable then begin
|
---|
456 | if PlayBeep then Beep;
|
---|
457 | if PlaySound then
|
---|
458 | try
|
---|
459 | MediaPlayer1.FileName:= SoundFile;
|
---|
460 | MediaPlayer1.Open;
|
---|
461 | MediaPlayer1.Play;
|
---|
462 | except
|
---|
463 | Dialogs.ShowMessage('Zadaný zvukový soubor pro událost '+AppEvents[Integer(EventType)].EventName+' není audio soubor nebo nebyl nalezen!');
|
---|
464 | end;
|
---|
465 | end;
|
---|
466 | try
|
---|
467 | if ExecuteApplication then ShellLaunch(ApplicationFile);
|
---|
468 | except
|
---|
469 | Dialogs.ShowMessage('Zadaný program ke spuštění pro událost '+AppEvents[Integer(EventType)].EventName+' nebyl nalezen!');
|
---|
470 | end;
|
---|
471 |
|
---|
472 | with SunriseChatCore do
|
---|
473 | if (not Visible) and ShowBalloonHint then with SunriseChatCore do
|
---|
474 | CoolTrayIcon1.ShowBalloonHint(ApplicationName+' - Zpráva',LastMessage,bitInfo,10);
|
---|
475 |
|
---|
476 | // Change tray icon
|
---|
477 | if ShowAlertIcon and MinimizeToTray and (not Visible) and FileExists(IconFile) then begin
|
---|
478 | Icon:= TIcon.Create;
|
---|
479 | try
|
---|
480 | Icon.LoadFromFile(IconFile);
|
---|
481 | CoolTrayIcon1.IconList.ReplaceIcon(6,Icon);
|
---|
482 | CoolTrayIcon1.IconIndex:= 6;
|
---|
483 | finally
|
---|
484 | Icon.Free;
|
---|
485 | end;
|
---|
486 | end;
|
---|
487 |
|
---|
488 | if ShowMessage then with SunriseChatCore do begin
|
---|
489 | // Set text font
|
---|
490 | LastFont := TFont.Create;
|
---|
491 | LastFont.Charset := MessageFont.Charset;
|
---|
492 | LastFont.Name := MessageFont.Name;
|
---|
493 | LastFont.Size := MessageFont.Size;
|
---|
494 | LastFont.Style := MessageFont.Style;
|
---|
495 | if TextColor = clSysMessage then LastFont.Color := MessageFont.Color
|
---|
496 | else LastFont.Color := TextColor;
|
---|
497 | if EventType = aeOneUserMessage then begin
|
---|
498 | LastFont.Style := LastFont.Style + [fsBold];
|
---|
499 | end;
|
---|
500 |
|
---|
501 | if (RoomIndex = riAll) or (SunriseChatCore.ActiveRoomIndex = RoomIndex) then begin
|
---|
502 | with SunriseChatCore, UserList[LastUserIndex],RVStyle1.TextStyles do begin
|
---|
503 | AddFontEx(LastFont.Name, LastFont.Size, LastFont.Color, LastFont.Style, LastFont.Charset);
|
---|
504 |
|
---|
505 | if ShowMessageTime then MessageTime := '['+TimeToStr(Now)+'] ' else MessageTime:= '';
|
---|
506 | RichView1.AddNamedCheckPoint('a');
|
---|
507 | RichView1.AddFromNewLine(MessageTime, Count-1);
|
---|
508 |
|
---|
509 | // Process user defined events
|
---|
510 | MessageTextTemp := SunriseChatCore.LastMessage;
|
---|
511 | TextStart := 1;
|
---|
512 | TextEnd := 1;
|
---|
513 | while TextEnd <= Length(MessageTextTemp) do begin
|
---|
514 | for I := 0 to High(AppUserEvents) do
|
---|
515 | with AppUserEvents[I] do begin
|
---|
516 | if (HttpHeader = Copy(MessageTextTemp, TextEnd, Length(HttpHeader))) then begin
|
---|
517 | TemporaryText := Copy(MessageTextTemp, TextEnd, High(Integer));
|
---|
518 | if(Pos(' ', TemporaryText)>0) then TemporaryText := Copy(MessageTextTemp, TextEnd, Pos(' ', TemporaryText)-1);
|
---|
519 | RichView1.Add(TemporaryText, rvsJump1);
|
---|
520 | TextStart := TextEnd + Length(TemporaryText);
|
---|
521 | TextEnd := TextStart-1;
|
---|
522 | SetLength(HyperLinks, Length(HyperLinks)+1);
|
---|
523 | HyperLinks[High(HyperLinks)] := TemporaryText;
|
---|
524 | end else
|
---|
525 | if (((not ConditionUserEnable) or (ConditionUserEnable and (ConditionUser = UserNick))) and
|
---|
526 | ((not ConditionTextEnable) or (ConditionTextEnable and (Length(ConditionText)>0)and (ConditionText = Copy(MessageTextTemp,TextEnd,Length(ConditionText))))) and
|
---|
527 | ((not ConditionAppEventEnable) or (ConditionAppEventEnable and (ConditionAppEvent = Integer(EventType))))) and
|
---|
528 | (ConditionAppEventEnable or ConditionTextEnable or ConditionUserEnable) then begin
|
---|
529 | // Show image instead text
|
---|
530 | if ShowImage and UserEventsImagesEnabled then begin
|
---|
531 | if (MessageTime = '') and (TextStart = 1) then RichView1.AddTextFromNewLine(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1)
|
---|
532 | else RichView1.AddText(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1);
|
---|
533 |
|
---|
534 | if not Assigned(Image) then begin
|
---|
535 | Image:= TImage.Create(Self);
|
---|
536 | if FileExists(ImageFile) then
|
---|
537 | Image.Picture.LoadFromFile(ImageFile);
|
---|
538 | end;
|
---|
539 | if Assigned(Image.Picture.Graphic) then RichView1.AddImage(Image, False)
|
---|
540 | else RichView1.AddText(ConditionText+'"Obrázek nenalezen!"',Count-1);
|
---|
541 |
|
---|
542 | TextStart:= TextEnd + Length(ConditionText);
|
---|
543 | TextEnd:= TextStart-1;
|
---|
544 | end;
|
---|
545 |
|
---|
546 | // Show call up
|
---|
547 | if ShowWindow then CallUp; //CoolTrayIcon1.ShowMainForm;
|
---|
548 |
|
---|
549 | // Play sound
|
---|
550 | if not SoundDisable then begin
|
---|
551 | if PlayBeep then Beep;
|
---|
552 | if PlaySound then
|
---|
553 | try
|
---|
554 | MediaPlayer1.FileName:= SoundFile;
|
---|
555 | MediaPlayer1.Open;
|
---|
556 | MediaPlayer1.Play;
|
---|
557 | except
|
---|
558 | Dialogs.ShowMessage('Zadaný zvukový soubor pro uživatelskou událost '+EventName+' není audio soubor nebo nebyl nalezen!');
|
---|
559 | end;
|
---|
560 | end;
|
---|
561 | // Execute application
|
---|
562 | try
|
---|
563 | if ExecuteApplication then ShellLaunch(ApplicationFile);
|
---|
564 | except
|
---|
565 | Dialogs.ShowMessage('Zadaný program ke spuštění pro událost '+AppEvents[Integer(EventType)].EventName+' nebyl nalezen!');
|
---|
566 | end;
|
---|
567 |
|
---|
568 | // Show balloon hint
|
---|
569 | with SunriseChatCore do
|
---|
570 | if (not Visible) and ShowBalloonHint then with SunriseChatCore do
|
---|
571 | CoolTrayIcon1.ShowBalloonHint(ApplicationName+' - Zpráva',LastMessage,bitInfo,10);
|
---|
572 |
|
---|
573 | // Change tray icon
|
---|
574 | if ShowAlertIcon and MinimizeToTray and (not Visible) and FileExists(IconFile) then begin
|
---|
575 | Icon:= TIcon.Create;
|
---|
576 | try
|
---|
577 | Icon.LoadFromFile(IconFile);
|
---|
578 | CoolTrayIcon1.IconList.ReplaceIcon(6,Icon);
|
---|
579 | CoolTrayIcon1.IconIndex:= 6;
|
---|
580 | finally
|
---|
581 | Icon.Free;
|
---|
582 | end;
|
---|
583 | end;
|
---|
584 | Break;
|
---|
585 | end;
|
---|
586 | end;
|
---|
587 | TextEnd:= TextEnd + 1;
|
---|
588 | end;
|
---|
589 | if (MessageTime = '') and (TextStart = 1) then RichView1.AddTextFromNewLine(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1)
|
---|
590 | else RichView1.AddText(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1);
|
---|
591 | //Dialogs.ShowMessage(IntToStr(RichView1.CheckPointsCount));
|
---|
592 | if RichView1.CheckPointsCount > SunriseChatCore.MaxRoomLines then
|
---|
593 | RichView1.DeleteSection('a');
|
---|
594 | RichView1.Format;
|
---|
595 | ScrollDownRichEdit1;
|
---|
596 | RichView1.Paint;
|
---|
597 | end;
|
---|
598 | end else begin
|
---|
599 | if RoomIndex < PageControl1.PageCount then
|
---|
600 | with PageControl1.Pages[RoomIndex] do begin
|
---|
601 | if ImageIndex = 25 then ImageIndex := 27;
|
---|
602 | if ImageIndex = 26 then ImageIndex := 28;
|
---|
603 | end;
|
---|
604 | end;
|
---|
605 | end else SunriseChatCore.LastMessage:= '';;
|
---|
606 | end;
|
---|
607 | end;
|
---|
608 |
|
---|
609 | procedure TMainWindow.Button1Click(Sender: TObject);
|
---|
610 | begin
|
---|
611 | //raise Exception.Create('Test');
|
---|
612 | if ComboBox1.Text<>'' then
|
---|
613 | with SunriseChatCore do begin
|
---|
614 | LocalUser.Status:= usOnline;
|
---|
615 | LocalUser.RoomName:= RoomList[PageControl1.TabIndex].Name;
|
---|
616 | LocalUser.RoomType:= RoomList[PageControl1.TabIndex].Typ;
|
---|
617 | UserLastText:= ComboBox1.Text;
|
---|
618 | SunriseChatCore.SendCommand('Message',ComboBox1.Text);
|
---|
619 | end;
|
---|
620 | ComboBox1.Text:= '';
|
---|
621 | ComboBox1.SetFocus;
|
---|
622 | lComboBox1Change(Self);
|
---|
623 | // MediaPlayer1.Play;
|
---|
624 | end;
|
---|
625 |
|
---|
626 | procedure TMainWindow.FormShow(Sender: TObject);
|
---|
627 | begin
|
---|
628 | FirstStart:= False;
|
---|
629 | Options.SaveToRegistry;
|
---|
630 |
|
---|
631 | LogExceptions.NazevAplikace:= ApplicationName + ' ' +ClientVersion;
|
---|
632 | if MinimizeToTray then CoolTrayIcon1.HideTaskbarIcon
|
---|
633 | else CoolTrayIcon1.ShowTaskbarIcon;
|
---|
634 | CoolTrayIcon1.IconIndex:= 5;
|
---|
635 | // Localization section
|
---|
636 | with Localization do begin
|
---|
637 | ActionAbout.Caption:= Item('AboutProgram');
|
---|
638 | ActionAway.Caption:= Item('AwayMode');
|
---|
639 | ActionBlockIP.Caption:= Item('BlockUser');
|
---|
640 | ActionCallUp.Caption:= Item('CallUp');
|
---|
641 | ActionClearMessageList.Caption:= Item('ClearMessageList');
|
---|
642 | ActionClose.Caption:= Item('Close');
|
---|
643 | ActionCreateRoom.Caption:= Item('CreateRoom');
|
---|
644 | ActionInfo.Caption:= Item('Information');
|
---|
645 | ActionInvisible.Caption:= Item('Invisible');
|
---|
646 | ActionNetworkTest.Caption:= Item('NetworkTest');
|
---|
647 | ActionOnline.Caption:= Item('Online');
|
---|
648 | ActionOptions.Caption:= Item('Options');
|
---|
649 | ActionRestore.Caption:= Item('Restore');
|
---|
650 | ActionStatus.Caption:= Item('Status');
|
---|
651 | ActionTestResponse.Caption:= Item('ResponseTest');
|
---|
652 | ActionUserRoom.Caption:= Item('InviteUserToRoom');
|
---|
653 | ActionChangeLog.Caption:= Item('ChangeLog');
|
---|
654 |
|
---|
655 | SearchFind1.Caption:= Item('SearchText');
|
---|
656 | Label1.Caption:= Item('UserList')+':';
|
---|
657 | Label2.Caption:= Item('MessageList')+':';
|
---|
658 | Pedchozzprva1.Caption:= Item('PreviousMessage');
|
---|
659 | Doplnitjmno1.Caption:= Item('CompleteUserName');
|
---|
660 | Odejtzmstnosti1.Caption:= Item('LeaveRoom');
|
---|
661 | Button1.Caption:= Item('Send');
|
---|
662 | end;
|
---|
663 | end;
|
---|
664 |
|
---|
665 | procedure TMainWindow.CallUp;
|
---|
666 | begin
|
---|
667 | CoolTrayIcon1.ShowMainForm;
|
---|
668 | FormStyle := fsStayOnTop;
|
---|
669 | // ShowMessage('Výzva');
|
---|
670 | // CallUpWindow.Show;
|
---|
671 | BringWindowToTop(Handle);
|
---|
672 | //Timer1.Tag := 0;
|
---|
673 | //Timer1.Enabled := True;
|
---|
674 |
|
---|
675 | //Windows.SetForegroundWindow(Handle);
|
---|
676 | //BringToFront;
|
---|
677 | //windows.SetFocus(Handle);
|
---|
678 | //FormStyle := fsStayOnTop;
|
---|
679 | // ShellLaunch('calc.exe');
|
---|
680 | if not OnTop then FormStyle := fsNormal;
|
---|
681 | //SwitchToThisWindow(Handle,True);
|
---|
682 | //TabControl1Change(Self);
|
---|
683 | // RichEdit1.Repaint;
|
---|
684 | end;
|
---|
685 |
|
---|
686 | procedure TMainWindow.Timer1Timer(Sender: TObject);
|
---|
687 | begin
|
---|
688 | with SunriseChatCore, LocalUser do begin
|
---|
689 | Repaint;
|
---|
690 | Beep;
|
---|
691 | Timer1.Tag := Timer1.Tag + 1;
|
---|
692 | if Timer1.Tag > 50 then Timer1.Enabled := False;
|
---|
693 | // if SunriseChatCore.Connected then NewCaption:= '' else NewCaption:= '(offline)';
|
---|
694 | // Caption:= 'SunriseChat'+NewCaption+' - '+SunriseChatCore.LocalUser.Nick;
|
---|
695 | // Label1.Caption:= BoolToStr(CoolTrayIcon1.MinimizeToTray);
|
---|
696 | // Label3.Caption:= BoolToStr(SunriseChatCore.fndTCPServer1.Active);
|
---|
697 | // Label4.Caption:= IntToStr(SunriseChatCore.fndTCPServer1.ClientCount);
|
---|
698 | end;
|
---|
699 | end;
|
---|
700 |
|
---|
701 | procedure TMainWindow.ChangeRunOnLogon;
|
---|
702 | begin
|
---|
703 | // Check run on startup
|
---|
704 | with TRegistry.Create do
|
---|
705 | try
|
---|
706 | RootKey := HKEY_CURRENT_USER;
|
---|
707 | OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', True);
|
---|
708 | if RunOnLogon then WriteString(ApplicationName+'-'+SettingsName,'"'+Application.ExeName+'" "/s:'+SettingsName+'"')
|
---|
709 | else DeleteValue(ApplicationName+'-'+SettingsName);
|
---|
710 | finally
|
---|
711 | Free;
|
---|
712 | end;
|
---|
713 | end;
|
---|
714 |
|
---|
715 | procedure TMainWindow.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
716 | begin
|
---|
717 | // IdleTrackerTerm;
|
---|
718 | //Timer1.Enabled:= False;
|
---|
719 | PositionX:= Left;
|
---|
720 | PositionY:= Top;
|
---|
721 | SizeX:= Width;
|
---|
722 | SizeY:= Height;
|
---|
723 | LastWindowState:= Integer(WindowState);
|
---|
724 | UserListWidth:= Panel2.Width;
|
---|
725 | SaveAppEventsToRegistry;
|
---|
726 | SaveAppUserEventsToRegistry;
|
---|
727 | if not NoSaveToRegistry then Options.SaveToRegistry;
|
---|
728 | ShowBallonHint:= False;
|
---|
729 | SoundDisable:= True;
|
---|
730 | SunriseChatCore.SendCommand('Disconnect','');
|
---|
731 | Options.Free;
|
---|
732 | end;
|
---|
733 |
|
---|
734 | procedure TMainWindow.ChangeNetworkState;
|
---|
735 | begin
|
---|
736 | RefreshAppTitle;
|
---|
737 | end;
|
---|
738 |
|
---|
739 | procedure TMainWindow.ShowUserList;
|
---|
740 | var
|
---|
741 | I: Integer;
|
---|
742 | Node: TListItem;
|
---|
743 | Index: Integer;
|
---|
744 | LastCount: Integer;
|
---|
745 | NewImageIndex: Integer;
|
---|
746 |
|
---|
747 | function StatusToImageIndex(Status: string): Integer;
|
---|
748 | begin
|
---|
749 | if Status = usAway then Result:= 2
|
---|
750 | else if Status = usWritting then Result:= 4
|
---|
751 | else if Status = usInvisible then Result:= 7
|
---|
752 | else if Status = usOffline then Result:= 7
|
---|
753 | else Result:= 0;
|
---|
754 | end;
|
---|
755 |
|
---|
756 | begin
|
---|
757 | with SunriseChatCore, ListView1 do begin
|
---|
758 | if Assigned(ListView1.Selected) then Index:= ListView1.Selected.Index
|
---|
759 | else Index:= 0;
|
---|
760 | LastCount:= ListView1.Items.Count;
|
---|
761 | //ListView1.Items.BeginUpdate;
|
---|
762 | //ListView1.Items.Clear;
|
---|
763 |
|
---|
764 | // Add missing items to list
|
---|
765 | for I:= 1 to Length(UserList) - Items.Count do begin
|
---|
766 | Node:= ListView1.Items.Add;
|
---|
767 | with Node do begin
|
---|
768 | Node.Caption:= '';
|
---|
769 | ImageIndex:= 0;
|
---|
770 | end;
|
---|
771 | end;
|
---|
772 |
|
---|
773 | // Delete excessive items from list
|
---|
774 | for I:= 1 to Items.Count - Length(UserList) do Items.Delete(Items.Count-1);
|
---|
775 |
|
---|
776 | // Update all items
|
---|
777 | for I:= 0 to High(UserList) do with UserList[I], Items.Item[I] do begin
|
---|
778 | if Caption <> Nick then Caption:= Nick;
|
---|
779 | if (Now - LastTime)>OfflineTimeout then NewImageIndex:= 7 else begin
|
---|
780 | if (IdleTime>(AutoAwayIdleTime*60)) and (Status <> usAway) then NewImageIndex:= 1 else
|
---|
781 | NewImageIndex:= StatusToImageIndex(Status);
|
---|
782 | if BlockMessages then NewImageIndex:= 17;
|
---|
783 | end;
|
---|
784 | if NewImageIndex <> ImageIndex then ImageIndex:= NewImageIndex;
|
---|
785 | end;
|
---|
786 |
|
---|
787 | //ListView1.Items.EndUpdate;
|
---|
788 |
|
---|
789 | // Select previous selected item
|
---|
790 | try
|
---|
791 | with ListView1 do
|
---|
792 | if Items.Count>0 then
|
---|
793 | if Index < Items.Count then Selected:= Items.Item[Index] else
|
---|
794 | Selected:= Items.Item[Items.Count-1];
|
---|
795 | except
|
---|
796 | end;
|
---|
797 |
|
---|
798 | // Automatically change window height according to user list count
|
---|
799 | if AutoChangeWindowHeight then
|
---|
800 | if LastCount <> ListView1.Items.Count then begin
|
---|
801 | LastCount:= ListView1.Items.Count;
|
---|
802 | if LastCount < MinimumVisibleUsersCount then LastCount:= MinimumVisibleUsersCount;
|
---|
803 | with MainWindow do begin
|
---|
804 | if not AutoChangeWindowHeightDirectionDown then
|
---|
805 | Top := Top - (LastCount * 17 - ListView1.Height + 10);
|
---|
806 | Height := Height + (LastCount * 17 - ListView1.Height + 10);
|
---|
807 | ListView1.Update;
|
---|
808 | end;
|
---|
809 | end;
|
---|
810 | end;
|
---|
811 | end;
|
---|
812 |
|
---|
813 | procedure TMainWindow.ComboBox1KeyPress(Sender: TObject; var Key: Char);
|
---|
814 | begin
|
---|
815 | if Key = #13 then begin
|
---|
816 | with ComboBox1 do
|
---|
817 | if DroppedDown and (Style <> csSimple) then begin
|
---|
818 | DroppedDown:= False;
|
---|
819 | Items.Clear;
|
---|
820 | SelStart:= Length(ComboBox1.Text);
|
---|
821 | ComboBox1.Style:= csSimple;
|
---|
822 | end else Button1Click(Self);
|
---|
823 | Key:= #0;
|
---|
824 | end;
|
---|
825 | end;
|
---|
826 |
|
---|
827 | procedure TMainWindow.ComboBox1KeyDown(Sender: TObject; var Key: Word;
|
---|
828 | Shift: TShiftState);
|
---|
829 | begin
|
---|
830 | // ShowMessage(IntToStr(Key));
|
---|
831 | if Key = 38 then ComboBox1.Text:= UserLastText;
|
---|
832 | if Key = 39 then with SunriseChatCore do DoplnitJmeno;
|
---|
833 | end;
|
---|
834 |
|
---|
835 | procedure TMainWindow.ActionInfoExecute(Sender: TObject);
|
---|
836 | begin
|
---|
837 | InfoWindow.ShowModal;
|
---|
838 | end;
|
---|
839 |
|
---|
840 | procedure TMainWindow.ActionAwayExecute(Sender: TObject);
|
---|
841 | begin
|
---|
842 | with SunriseChatCore, LocalUser do
|
---|
843 | if Status <> usAway then begin
|
---|
844 | Reason:= DefaultReason;
|
---|
845 | if ComboBox1.Text <> '' then begin
|
---|
846 | Reason:= ComboBox1.Text;
|
---|
847 | ComboBox1.Text:= '';
|
---|
848 | end else
|
---|
849 | if not InputQuery('Odchod pryč','Zadejte důvod nepřítomnosti',Reason) then Exit;
|
---|
850 | ActionAway.Checked:= True;
|
---|
851 | SendCommand('GoAway','');
|
---|
852 | Status:= usAway;
|
---|
853 | ShowUserList;
|
---|
854 | ComboBox1.Enabled:= False;
|
---|
855 | Button1.Enabled:= False;
|
---|
856 | end;
|
---|
857 | //ShowUserList;
|
---|
858 | end;
|
---|
859 |
|
---|
860 | procedure TMainWindow.ActionOnlineExecute(Sender: TObject);
|
---|
861 | begin
|
---|
862 | ActionOnline.Checked:= True;
|
---|
863 | with SunriseChatCore do begin
|
---|
864 | if LocalUser.Status = usAway then begin
|
---|
865 | SendCommand('GoOnline','');
|
---|
866 | end;
|
---|
867 | LocalUser.Status:= usOnline;
|
---|
868 | ShowUserList;
|
---|
869 | end;
|
---|
870 | ComboBox1.Enabled:= True;
|
---|
871 | Button1.Enabled:= True;
|
---|
872 | ShowUserList;
|
---|
873 | end;
|
---|
874 |
|
---|
875 | procedure TMainWindow.ActionCloseExecute(Sender: TObject);
|
---|
876 | begin
|
---|
877 | CloseEnabled:= True;
|
---|
878 | Close;
|
---|
879 | end;
|
---|
880 |
|
---|
881 | procedure TMainWindow.ListView1Click(Sender: TObject);
|
---|
882 | begin
|
---|
883 | with SunriseChatCore do
|
---|
884 | if Assigned(ListView1.Selected) then with ListView1.Selected do begin
|
---|
885 | if UserList[Index].Status = usAway then
|
---|
886 | AddMessage(riAll,[UserList[Index].Nick, UserList[Index].Reason],aeUserGoAway);
|
---|
887 | end;
|
---|
888 | end;
|
---|
889 |
|
---|
890 | procedure TMainWindow.ActionTestResponseExecute(Sender: TObject);
|
---|
891 | begin
|
---|
892 | with SunriseChatCore do
|
---|
893 | if Assigned(ListView1.Selected) then with ListView1.Selected do begin
|
---|
894 | SunriseChatCore.SendCommand('Ping',TimeToStr(Now),UserList[Index].IP,UserList[Index].ID);
|
---|
895 | SunriseChatCore.AddMessage(riAll,[UserList[Index].Nick],aeSendPing);
|
---|
896 | end;
|
---|
897 | end;
|
---|
898 |
|
---|
899 | procedure TMainWindow.ActionRestoreExecute(Sender: TObject);
|
---|
900 | begin
|
---|
901 | CoolTrayIcon1.ShowMainForm;
|
---|
902 | end;
|
---|
903 |
|
---|
904 | procedure TMainWindow.ActionInvisibleExecute(Sender: TObject);
|
---|
905 | begin
|
---|
906 | ActionInvisible.Checked:= True;
|
---|
907 | SunriseChatCore.LocalUser.Status:= usInvisible;
|
---|
908 | ComboBox1.Enabled:= False;
|
---|
909 | Button1.Enabled:= False;
|
---|
910 | ShowUserList;
|
---|
911 | end;
|
---|
912 |
|
---|
913 | procedure TMainWindow.ActionAboutExecute(Sender: TObject);
|
---|
914 | begin
|
---|
915 | AboutWindow.ShowModal;
|
---|
916 | end;
|
---|
917 |
|
---|
918 | procedure TMainWindow.ActionOptionsExecute(Sender: TObject);
|
---|
919 | begin
|
---|
920 | OptionsWindow.ShowModal;
|
---|
921 | end;
|
---|
922 |
|
---|
923 | procedure TMainWindow.ActionCallUpExecute(Sender: TObject);
|
---|
924 | begin
|
---|
925 | with SunriseChatCore do
|
---|
926 | if Assigned(ListView1.Selected) then with ListView1.Selected do begin
|
---|
927 | SunriseChatCore.SendCommand('CallUp','',UserList[Index].IP,UserList[Index].ID);
|
---|
928 | AddMessage(riAll,[UserList[Index].Nick],aeSendCallUp);
|
---|
929 | end;
|
---|
930 | end;
|
---|
931 |
|
---|
932 |
|
---|
933 | procedure TMainWindow.TabControl1Change(Sender: TObject);
|
---|
934 | var
|
---|
935 | I, II: Integer;
|
---|
936 | ForUser: string;
|
---|
937 | MessageTime: string;
|
---|
938 | MessageTextTemp: string;
|
---|
939 | TextStart, TextEnd: Integer;
|
---|
940 | TemporaryText: string;
|
---|
941 | begin
|
---|
942 | SetLength(HyperLinks, 0);
|
---|
943 | SunriseChatCore.ActiveRoomIndex:= PageControl1.TabIndex;
|
---|
944 | with SunriseChatCore, RoomList[PageControl1.TabIndex] do begin
|
---|
945 | with PageControl1 do
|
---|
946 | if RoomList[ActiveRoomIndex].Typ = rtPublic then Pages[TabIndex].ImageIndex:= 25
|
---|
947 | else Pages[TabIndex].ImageIndex:= 26;
|
---|
948 | RichView1.Clear;
|
---|
949 | ForUser:= SunriseChatCore.LocalUser.Nick+': ';
|
---|
950 | for II:= 0 to Count-1 do
|
---|
951 | with SunriseChatCore, RVStyle1.TextStyles, Lines[(StartLine+II) mod MaxRoomLines] do begin
|
---|
952 |
|
---|
953 | AddFontEx(Font.Name, Font.Size, Font.Color, Font.Style, Font.Charset);
|
---|
954 | if ShowMessageTime then MessageTime := '['+TimeToStr(Time)+'] ' else MessageTime:= '';
|
---|
955 | RichView1.AddNamedCheckPoint('a');
|
---|
956 | RichView1.AddFromNewLine(MessageTime, Count-1);
|
---|
957 |
|
---|
958 | // Process user defined events
|
---|
959 | MessageTextTemp:= Text;
|
---|
960 | TextStart:= 1;
|
---|
961 | TextEnd:= 1;
|
---|
962 | while TextEnd <= Length(MessageTextTemp) do begin
|
---|
963 | if (HttpHeader = Copy(MessageTextTemp, TextEnd, Length(HttpHeader))) then begin
|
---|
964 | TemporaryText := Copy(MessageTextTemp, TextEnd, High(Integer));
|
---|
965 | if(Pos(' ', TemporaryText)>0) then TemporaryText := Copy(MessageTextTemp, TextEnd, Pos(' ', TemporaryText)-1);
|
---|
966 | RichView1.Add(TemporaryText, rvsJump1);
|
---|
967 | TextStart := TextEnd + Length(TemporaryText);
|
---|
968 | TextEnd := TextStart-1;
|
---|
969 | SetLength(HyperLinks, Length(HyperLinks)+1);
|
---|
970 | HyperLinks[High(HyperLinks)] := TemporaryText;
|
---|
971 | end else
|
---|
972 | for I:= 0 to High(AppUserEvents) do
|
---|
973 | with AppUserEvents[I] do begin
|
---|
974 | if (((not ConditionUserEnable) or (ConditionUserEnable and (ConditionUser = Nick))) and
|
---|
975 | ((not ConditionTextEnable) or (ConditionTextEnable and (ConditionText = Copy(MessageTextTemp,TextEnd,Length(ConditionText))))) and
|
---|
976 | (ConditionText <> '') and
|
---|
977 | ((not ConditionAppEventEnable) or (ConditionAppEventEnable and (ConditionAppEvent = Integer(EventType))))) and
|
---|
978 | (ConditionAppEventEnable or ConditionTextEnable or ConditionUserEnable) then begin
|
---|
979 | // Show image instead text
|
---|
980 | if ShowImage and UserEventsImagesEnabled then begin
|
---|
981 | if (MessageTime = '') and (TextStart = 1) then RichView1.AddTextFromNewLine(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1)
|
---|
982 | else RichView1.AddText(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1);
|
---|
983 | if not Assigned(Image) then begin
|
---|
984 | Image:= TImage.Create(Self);
|
---|
985 | if FileExists(ImageFile) then
|
---|
986 | Image.Picture.LoadFromFile(ImageFile);
|
---|
987 | end;
|
---|
988 | if Assigned(Image.Picture.Graphic) then RichView1.AddImage(Image, False)
|
---|
989 | else RichView1.AddText(ConditionText+'"Obrázek nenalezen!"',Count-1);
|
---|
990 | TextStart:= TextEnd + Length(ConditionText);
|
---|
991 | TextEnd:= TextStart-1;
|
---|
992 | Break;
|
---|
993 | end;
|
---|
994 | end;
|
---|
995 | end;
|
---|
996 | TextEnd:= TextEnd + 1;
|
---|
997 | end;
|
---|
998 | if (MessageTime = '') and (TextStart = 1) then RichView1.AddTextFromNewLine(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1)
|
---|
999 | else RichView1.AddText(Copy(MessageTextTemp,TextStart,TextEnd-TextStart),Count-1);
|
---|
1000 | end;
|
---|
1001 | RichView1.Format;
|
---|
1002 | ScrollDownRichEdit1;
|
---|
1003 | RichView1.Paint;
|
---|
1004 | end;
|
---|
1005 | end;
|
---|
1006 |
|
---|
1007 | procedure TMainWindow.ActionBlockIPExecute(Sender: TObject);
|
---|
1008 | begin
|
---|
1009 | with SunriseChatCore do
|
---|
1010 | if Assigned(ListView1.Selected) then
|
---|
1011 | with ListView1.Selected, SunriseChatCore.UserList[Index] do begin
|
---|
1012 | BlockMessages:= not BlockMessages;
|
---|
1013 | ShowUserList;
|
---|
1014 | end;
|
---|
1015 | end;
|
---|
1016 |
|
---|
1017 | procedure TMainWindow.FormCloseQuery(Sender: TObject;
|
---|
1018 | var CanClose: Boolean);
|
---|
1019 | begin
|
---|
1020 | CanClose:= CloseEnabled;
|
---|
1021 | if MinimalizeOnCloseWindow then begin
|
---|
1022 | CoolTrayIcon1.HideMainForm;
|
---|
1023 | end else CanClose:= True;
|
---|
1024 | end;
|
---|
1025 |
|
---|
1026 | procedure TMainWindow.ActionUserRoomExecute(Sender: TObject);
|
---|
1027 | begin
|
---|
1028 | if Assigned(ListView1.Selected) then
|
---|
1029 | with ListView1.Selected, SunriseChatCore, SunriseChatCore.UserList[Index] do begin
|
---|
1030 | if RoomList[ActiveRoomIndex].Typ = rtPublic then ShowMessage('Nelze pozvat uživatele do veřejné místnosti!')
|
---|
1031 | else begin
|
---|
1032 | LocalUser.RoomName:= RoomList[ActiveRoomIndex].Name;
|
---|
1033 | LocalUser.RoomType:= rtPrivate;
|
---|
1034 | SendCommand('CreateRoom','',IP,ID);
|
---|
1035 | //if (IP<>LocalUser.IP) or (ID<>LocalUser.ID) then SendCommand('CreateRoom','',LocalUser.IP,LocalUser.ID);
|
---|
1036 | end;
|
---|
1037 | end;
|
---|
1038 | end;
|
---|
1039 |
|
---|
1040 | procedure TMainWindow.RoomListChanged;
|
---|
1041 | var
|
---|
1042 | I: Integer;
|
---|
1043 | NewTabSheet: TTabSheet;
|
---|
1044 | LastTabIndex: Integer;
|
---|
1045 | begin
|
---|
1046 | with SunriseChatCore do with PageControl1 do begin
|
---|
1047 | while PageCount>0 do Pages[0].Free;
|
---|
1048 | for I:= 0 to High(RoomList) do begin
|
---|
1049 | NewTabSheet := TTabSheet.Create(PageControl1);
|
---|
1050 | NewTabSheet.PageControl := PageControl1;
|
---|
1051 | NewTabSheet.Caption:= RoomList[I].Name;
|
---|
1052 | if RoomList[I].Typ = rtPublic then NewTabSheet.ImageIndex:= 25
|
---|
1053 | else NewTabSheet.ImageIndex:= 26;
|
---|
1054 | end;
|
---|
1055 | Visible:= PageCount > 1;
|
---|
1056 | if ActiveRoomIndex >= PageControl1.PageCount then ActiveRoomIndex:= 0;
|
---|
1057 | ActivePageIndex:= ActiveRoomIndex;
|
---|
1058 | PageControl1.TabIndex := ActiveRoomIndex;
|
---|
1059 | TabControl1Change(Self);
|
---|
1060 | end;
|
---|
1061 | end;
|
---|
1062 |
|
---|
1063 | procedure TMainWindow.Odejtzmstnosti1Click(Sender: TObject);
|
---|
1064 | begin
|
---|
1065 | if PageControl1.ActivePageIndex = 0 then ShowMessage('Tuto místnost nelze zrušit')
|
---|
1066 | else begin
|
---|
1067 | SunriseChatCore.SendCommand('LeaveRoom','');
|
---|
1068 | SunriseChatCore.DeleteRoom(PageControl1.ActivePageIndex);
|
---|
1069 | TabControl1Change(Self);
|
---|
1070 | end;
|
---|
1071 | end;
|
---|
1072 |
|
---|
1073 | procedure TMainWindow.ActionCustomizeDlgExecute(Sender: TObject);
|
---|
1074 | begin
|
---|
1075 | FormStyle:= fsNormal;
|
---|
1076 | CustomizeDlg1.Show;
|
---|
1077 | // if OnTop then FormStyle:= fsStayOnTop;
|
---|
1078 | end;
|
---|
1079 |
|
---|
1080 | procedure TMainWindow.PopupMenu2Popup(Sender: TObject);
|
---|
1081 | begin
|
---|
1082 | with SunriseChatCore do
|
---|
1083 | if Assigned(ListView1.Selected) then
|
---|
1084 | with ListView1.Selected, SunriseChatCore.UserList[Index] do
|
---|
1085 | BlokovatAdresu1.Checked:= BlockMessages;
|
---|
1086 | end;
|
---|
1087 |
|
---|
1088 | procedure TMainWindow.WMQueryEndSession(var Message: TMessage);
|
---|
1089 | { This method is a hack. It intercepts the WM_QUERYENDSESSION message.
|
---|
1090 | This way we can decide if we want to ignore the "Close to tray" option.
|
---|
1091 | Otherwise, when selected, the option would make Windows unable to shut down. }
|
---|
1092 | begin
|
---|
1093 | CloseEnabled:= True;
|
---|
1094 | Message.Result:= 1;
|
---|
1095 | end;
|
---|
1096 |
|
---|
1097 | procedure TMainWindow.Pedchozzprva1Click(Sender: TObject);
|
---|
1098 | var
|
---|
1099 | I: Integer;
|
---|
1100 | begin
|
---|
1101 | ComboBox1.Style:= csDropDown;
|
---|
1102 | with SunriseChatCore, ComboBox1.Items do begin
|
---|
1103 | BeginUpdate;
|
---|
1104 | Clear;
|
---|
1105 | for I:= RoomList[ActiveRoomIndex].Count-1 downto 0 do with RoomList[ActiveRoomIndex], Lines[(I + StartLine) mod MaxRoomLines] do begin
|
---|
1106 | Add(Text);
|
---|
1107 | end;
|
---|
1108 | Update;
|
---|
1109 | EndUpdate;
|
---|
1110 | if ComboBox1.Items.Count>0 then ComboBox1.DroppedDown:= True;
|
---|
1111 | end;
|
---|
1112 | end;
|
---|
1113 |
|
---|
1114 |
|
---|
1115 | procedure TMainWindow.DoplnitJmeno;
|
---|
1116 | var
|
---|
1117 | I: Integer;
|
---|
1118 | UserIndex: Integer;
|
---|
1119 | NickCount: Integer;
|
---|
1120 | begin
|
---|
1121 | UserIndex:= -1;
|
---|
1122 | NickCOunt:= 0;
|
---|
1123 | with SunriseChatCore do begin
|
---|
1124 | for I:= 0 to High(UserList) do begin
|
---|
1125 | if Length(ComboBox1.Text) <= Length(UserList[I].Nick) then
|
---|
1126 | if ComboBox1.Text = Copy(UserList[I].Nick,1,Length(ComboBox1.Text)) then begin
|
---|
1127 | UserIndex:= I;
|
---|
1128 | NickCount:= NickCount + 1;
|
---|
1129 | end;
|
---|
1130 | end;
|
---|
1131 | if NickCount = 1 then begin
|
---|
1132 | ComboBox1.Text:= UserList[UserIndex].Nick + ': ';
|
---|
1133 | ComboBox1.SelStart:= Length(ComboBox1.Text);
|
---|
1134 | end else
|
---|
1135 | if NickCount > 1 then FillComboBox;
|
---|
1136 | end;
|
---|
1137 | end;
|
---|
1138 |
|
---|
1139 | procedure TMainWindow.ActionNetworkTestExecute(Sender: TObject);
|
---|
1140 | begin
|
---|
1141 | NetworkTest.ShowModal;
|
---|
1142 | end;
|
---|
1143 |
|
---|
1144 | procedure TMainWindow.ToolButton7Click(Sender: TObject);
|
---|
1145 | begin
|
---|
1146 | Application.Minimize;
|
---|
1147 | end;
|
---|
1148 |
|
---|
1149 | procedure TMainWindow.Vloit1Click(Sender: TObject);
|
---|
1150 | begin
|
---|
1151 | SendMessage(ComboBox1.Handle, WM_PASTE, 0, 0);
|
---|
1152 | end;
|
---|
1153 |
|
---|
1154 | procedure TMainWindow.CoolTrayIcon1Click(Sender: TObject);
|
---|
1155 | begin
|
---|
1156 | // RichEdit1.Lines.Add(IntToStr(GetForegroundWindow)+' '+IntToStr(MainWindow.Handle)+' '+IntToStr(Application.Handle));
|
---|
1157 | // if GetForegroundWindow = Application.Handle then CoolTrayIcon1.HideMainForm else
|
---|
1158 | if MainWindow.Visible then CoolTrayIcon1.HideMainForm else
|
---|
1159 | CoolTrayIcon1.ShowMainForm;
|
---|
1160 | end;
|
---|
1161 |
|
---|
1162 | procedure TMainWindow.ToolButton1Click(Sender: TObject);
|
---|
1163 | begin
|
---|
1164 | // ToolButton1.Marked := not ToolButton1.Marked;
|
---|
1165 | PauseScrollText := ToolButton1.Down;
|
---|
1166 | end;
|
---|
1167 |
|
---|
1168 | procedure TMainWindow.ToolButton3Click(Sender: TObject);
|
---|
1169 | begin
|
---|
1170 | ActionOptionsExecute(Self);
|
---|
1171 | end;
|
---|
1172 |
|
---|
1173 | procedure TMainWindow.ToolButton2Click(Sender: TObject);
|
---|
1174 | begin
|
---|
1175 | ActionInfoExecute(Self);
|
---|
1176 | end;
|
---|
1177 |
|
---|
1178 | procedure TMainWindow.ToolButton5Click(Sender: TObject);
|
---|
1179 | begin
|
---|
1180 | // ToolButton5.Marked:= not ToolButton5.Marked;
|
---|
1181 | OnTop:= ToolButton5.Down;
|
---|
1182 | InitTrayIcon;
|
---|
1183 | end;
|
---|
1184 |
|
---|
1185 | procedure TMainWindow.ToolButton4Click(Sender: TObject);
|
---|
1186 | begin
|
---|
1187 | // ToolButton4.Marked:= not ToolButton4.Marked;
|
---|
1188 | SoundDisable:= ToolButton4.Down;
|
---|
1189 | end;
|
---|
1190 |
|
---|
1191 | procedure TMainWindow.ScrollDownRichEdit1;
|
---|
1192 | var
|
---|
1193 | ScrollMessage: TWMVScroll;
|
---|
1194 | begin
|
---|
1195 | if not PauseScrollText then begin
|
---|
1196 | RichView1.ScrollTo(High(Integer));
|
---|
1197 | RichView1.Paint;
|
---|
1198 | (*
|
---|
1199 | // Scroll down Richedit
|
---|
1200 | ScrollMessage.Msg:= WM_VScroll;
|
---|
1201 |
|
---|
1202 | ScrollMessage.ScrollCode:= sb_Bottom;
|
---|
1203 | ScrollMessage.Pos:= 0;
|
---|
1204 | RichEdit1.Dispatch(ScrollMessage);
|
---|
1205 | if Win32Platform = 1 then begin
|
---|
1206 | ScrollMessage.Msg:= WM_VScroll;
|
---|
1207 | begin
|
---|
1208 | ScrollMessage.ScrollCode:= SB_PAGEUP;
|
---|
1209 | ScrollMessage.Pos:= 0;
|
---|
1210 | RichEdit1.Dispatch(ScrollMessage);
|
---|
1211 | end;
|
---|
1212 | end;
|
---|
1213 | *)
|
---|
1214 | end;
|
---|
1215 | end;
|
---|
1216 |
|
---|
1217 |
|
---|
1218 | procedure TMainWindow.AppMessage(var Msg: TMsg; var Handled: Boolean);
|
---|
1219 | begin
|
---|
1220 | if Msg.Message = WM_SunriseChatStart then begin
|
---|
1221 | if HWND(Msg.wParam) <> Application.Handle then begin
|
---|
1222 | if OneAppInstance then begin
|
---|
1223 | Application.Restore;
|
---|
1224 | CoolTrayIcon1.ShowMainForm;
|
---|
1225 | SetForeGroundWindow(Application.MainForm.Handle);
|
---|
1226 | PostMessage(HWND_BROADCAST, WM_SunriseChatClose, Application.Handle, 0);
|
---|
1227 | end;
|
---|
1228 | end;
|
---|
1229 | Handled := true;
|
---|
1230 | end;
|
---|
1231 | if Msg.Message = WM_SunriseChatClose then begin
|
---|
1232 | if HWND(Msg.wParam) <> Application.Handle then begin
|
---|
1233 | if OneAppInstance then begin
|
---|
1234 | NoSaveToRegistry:= True;
|
---|
1235 | StopProgram:= True;
|
---|
1236 | end;
|
---|
1237 | end;
|
---|
1238 | Handled := true;
|
---|
1239 | end;
|
---|
1240 | end;
|
---|
1241 |
|
---|
1242 | procedure TMainWindow.RichEdit1MouseDown(Sender: TObject;
|
---|
1243 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
1244 | begin
|
---|
1245 | SendMessage(HWND_BROADCAST,WM_SunriseChatStart,0,0);
|
---|
1246 | end;
|
---|
1247 |
|
---|
1248 | procedure TMainWindow.RichView1Jump(Sender: TObject; id: Integer);
|
---|
1249 | var
|
---|
1250 | Url: string;
|
---|
1251 | begin
|
---|
1252 | Url := HyperLinks[id];
|
---|
1253 | ShellExecute(Handle, 'open', PChar(Url), nil, nil, SW_SHOWNORMAL);
|
---|
1254 | end;
|
---|
1255 |
|
---|
1256 | procedure TMainWindow.lComboBox1Change(Sender: TObject);
|
---|
1257 | begin
|
---|
1258 | if (ComboBox1.Text = '') and (Length(LastText)>0) then begin
|
---|
1259 | SunriseChatCore.LocalUser.Status:= usOnline;
|
---|
1260 | SunriseChatCore.SendCommand('UserInfo','');
|
---|
1261 | end;
|
---|
1262 | if (Length(ComboBox1.Text)>0) and (Length(LastText)=0) then begin
|
---|
1263 | SunriseChatCore.LocalUser.Status:= usWritting;
|
---|
1264 | SunriseChatCore.SendCommand('UserInfo','');
|
---|
1265 | end;
|
---|
1266 | LastText:= ComboBox1.Text;
|
---|
1267 | // if Edit1.Text='' then SunriseChatCore.LocalUser.Status:= usOnline;
|
---|
1268 | end;
|
---|
1269 |
|
---|
1270 | procedure TMainWindow.AddEvent(Name, Text: string; Options: TEventOptions);
|
---|
1271 | begin
|
---|
1272 | SetLength(AppEventsInit,Length(AppEventsInit)+1);
|
---|
1273 | with AppEventsInit[High(AppEventsInit)] do begin
|
---|
1274 | EventName:= Name;
|
---|
1275 | ShowMessage:= eoShowMessage in Options;
|
---|
1276 | MessageText:= Text;
|
---|
1277 | MessageFont:= TFont.Create;
|
---|
1278 | ShowBalloonHint:= eoShowBalloonHint in Options;
|
---|
1279 | ShowAlertIcon:= eoShowAlertIcon in Options;
|
---|
1280 | ShowWindow:= eoShowWindow in Options;
|
---|
1281 | PlayBeep:= eoPlayBeep in Options;
|
---|
1282 | end;
|
---|
1283 | end;
|
---|
1284 |
|
---|
1285 | procedure TMainWindow.SaveAppEventsToRegistry;
|
---|
1286 | var
|
---|
1287 | I: Integer;
|
---|
1288 | begin
|
---|
1289 | for I:= 0 to High(AppEventsOptions) do with AppEvents[I] do begin
|
---|
1290 | MessageFontTemp.Color := MessageFont.Color;
|
---|
1291 | MessageFontTemp.Style:= '';
|
---|
1292 | if fsBold in MessageFont.Style then MessageFontTemp.Style := MessageFontTemp.Style + 'Bold,';
|
---|
1293 | if fsItalic in MessageFont.Style then MessageFontTemp.Style := MessageFontTemp.Style + 'Italic,';
|
---|
1294 | if fsUnderline in MessageFont.Style then MessageFontTemp.Style := MessageFontTemp.Style + 'Underline,';
|
---|
1295 | if fsStrikeOut in MessageFont.Style then MessageFontTemp.Style := MessageFontTemp.Style + 'StrikeOut,';
|
---|
1296 | MessageFontTemp.Charset := MessageFont.Charset;
|
---|
1297 | MessageFontTemp.Size := MessageFont.Size;
|
---|
1298 | MessageFontTemp.Name := MessageFont.Name;
|
---|
1299 |
|
---|
1300 | AppEventsOptions[I].SaveToRegistry;
|
---|
1301 | AppEventsOptions[I].Free;
|
---|
1302 | end;
|
---|
1303 | SetLength(AppEventsOptions,0);
|
---|
1304 | LoadAppEventsFromRegistry;
|
---|
1305 | end;
|
---|
1306 |
|
---|
1307 | procedure TMainWindow.SaveAppUserEventsToRegistry;
|
---|
1308 | var
|
---|
1309 | I: Integer;
|
---|
1310 | Max: Integer;
|
---|
1311 | begin
|
---|
1312 | AppUserEventsCount := Length(AppUserEvents);
|
---|
1313 | Max := High(AppUserEventsOptions);
|
---|
1314 | for I := 0 to Max do begin
|
---|
1315 | if I<Length(AppUserEvents) then AppUserEventsOptions[I].SaveToRegistry;
|
---|
1316 | //AppUserEventsOptions[I].Free;
|
---|
1317 | if Assigned(WaitingDialog) then WaitingDialog.Pozice := I/Max*100;
|
---|
1318 | end;
|
---|
1319 | //SetLength(AppUserEventsOptions,0);
|
---|
1320 | //LoadAppUserEventsFromRegistry;
|
---|
1321 | end;
|
---|
1322 |
|
---|
1323 | procedure TMainWindow.LoadAppEventsFromRegistry;
|
---|
1324 | var
|
---|
1325 | I: Integer;
|
---|
1326 | Text: string;
|
---|
1327 | begin
|
---|
1328 | SetLength(AppEventsOptions,Length(AppEvents));
|
---|
1329 | for I:= 0 to High(AppEventsOptions) do begin
|
---|
1330 | //if not Assigned(AppEventsOptions[I]) then
|
---|
1331 | AppEventsOptions[I]:= TAutoRegistry.Create(RegistryPath+'\'+SettingsName+'\AppEvents\'+IntToStr(I));
|
---|
1332 | with AppEventsOptions[I], AppEvents[I] do begin
|
---|
1333 | Include('ShowWindow',ShowWindow,ShowWindow);
|
---|
1334 | Include('ShowAlertIcon',ShowAlertIcon,ShowAlertIcon);
|
---|
1335 | Include('ShowBaloonHint',ShowBalloonHint,ShowBalloonHint);
|
---|
1336 | Include('PlayBeep',PlayBeep,PlayBeep);
|
---|
1337 | Include('PlaySound',PlaySound,PlaySound);
|
---|
1338 | Include('SoundFile',SoundFile,'');
|
---|
1339 | Include('ExecuteApplication',ExecuteApplication,False);
|
---|
1340 | Include('ApplicationFile',ApplicationFile,'');
|
---|
1341 | Include('ShowMessage',ShowMessage,ShowMessage);
|
---|
1342 | Include('MessageText',MessageText,MessageText);
|
---|
1343 | Include('IconFile',IconFile,'Envelope.ico');
|
---|
1344 | // Font
|
---|
1345 | Include('FontColor',MessageFontTemp.Color,Integer(clBlack));
|
---|
1346 | Include('FontStyle',MessageFontTemp.Style,'');
|
---|
1347 | Include('FontCharset',MessageFontTemp.Charset,1);
|
---|
1348 | Include('FontSize', MessageFontTemp.Size, 8);
|
---|
1349 | Include('FontName', MessageFontTemp.Name, 'MS Sans Serif');
|
---|
1350 | LoadFromRegistry;
|
---|
1351 | MessageFont.Color := MessageFontTemp.Color;
|
---|
1352 | while Pos(',', MessageFontTemp.Style)>0 do begin
|
---|
1353 | Text:= Copy(MessageFontTemp.Style, 1, Pos(',', MessageFontTemp.Style)-1);
|
---|
1354 | System.Delete(MessageFontTemp.Style, 1, Length(Text)+1);
|
---|
1355 | if Text = 'Bold' then MessageFont.Style := MessageFont.Style + [fsBold];
|
---|
1356 | if Text = 'Italic' then MessageFont.Style := MessageFont.Style + [fsItalic];
|
---|
1357 | if Text = 'Underline' then MessageFont.Style := MessageFont.Style + [fsUnderline];
|
---|
1358 | if Text = 'StrikeOut' then MessageFont.Style := MessageFont.Style + [fsStrikeOut];
|
---|
1359 | end;
|
---|
1360 | MessageFont.Charset := MessageFontTemp.Charset;
|
---|
1361 | MessageFont.Size := MessageFontTemp.Size;
|
---|
1362 | MessageFont.Name := MessageFontTemp.Name;
|
---|
1363 | end;
|
---|
1364 | end;
|
---|
1365 | end;
|
---|
1366 |
|
---|
1367 | procedure TMainWindow.LoadAppUserEventsFromRegistry(UpdateOnly: Boolean = False);
|
---|
1368 | var
|
---|
1369 | I: Integer;
|
---|
1370 | begin
|
---|
1371 | SetLength(AppUserEventsOptions, AppUserEventsCount);
|
---|
1372 | SetLength(AppUserEvents, AppUserEventsCount);
|
---|
1373 | for I := 0 to AppUserEventsCount-1 do begin
|
---|
1374 | //if not Assigned(AppEventsOptions[I]) then
|
---|
1375 | AppUserEventsOptions[I] := TAutoRegistry.Create(RegistryPath+'\'+SettingsName+'\AppUserEvents\'+IntToStr(I));
|
---|
1376 | with AppUserEventsOptions[I], AppUserEvents[I] do begin
|
---|
1377 | Update := UpdateOnly;
|
---|
1378 | Include('ConditionTextEnable', ConditionTextEnable, ConditionTextEnable);
|
---|
1379 | Include('ConditionText', ConditionText, ConditionText);
|
---|
1380 | Include('ConditionUserEnable', ConditionUserEnable, ConditionUserEnable);
|
---|
1381 | Include('ConditionUser', ConditionUser, ConditionUser);
|
---|
1382 | Include('ConditionAppEventEnable', ConditionAppEventEnable,ConditionAppEventEnable);
|
---|
1383 | Include('ConditionAppEvent',ConditionAppEvent,ConditionAppEvent);
|
---|
1384 | Include('ShowWindow',ShowWindow,ShowWindow);
|
---|
1385 | Include('ShowAlertIcon',ShowAlertIcon,ShowAlertIcon);
|
---|
1386 | Include('IconFile',IconFile,'Envelope.ico');
|
---|
1387 | Include('ShowBaloonHint',ShowBalloonHint,ShowBalloonHint);
|
---|
1388 | Include('PlayBeep',PlayBeep,PlayBeep);
|
---|
1389 | Include('PlaySound',PlaySound,PlaySound);
|
---|
1390 | Include('SoundFile',SoundFile,'');
|
---|
1391 | Include('ExecuteApplication',ExecuteApplication,False);
|
---|
1392 | Include('ApplicationFile',ApplicationFile,'');
|
---|
1393 | Include('ShowImage',ShowImage,ShowImage);
|
---|
1394 | Include('ImageFile',ImageFile,ImageFile);
|
---|
1395 | Include('EventName',EventName,EventName);
|
---|
1396 | LoadFromRegistry;
|
---|
1397 | end;
|
---|
1398 | if Assigned(WaitingDialog) then WaitingDialog.Pozice := I/AppUserEventsCount*100;
|
---|
1399 | end;
|
---|
1400 | end;
|
---|
1401 |
|
---|
1402 | procedure TMainWindow.RefreshAppTitle;
|
---|
1403 | var
|
---|
1404 | NewCaption: string;
|
---|
1405 | Settings: string;
|
---|
1406 | begin
|
---|
1407 | if SettingsName = 'Default' then Settings:= '' else Settings:= '('+SettingsName+')';
|
---|
1408 | if SunriseChatCore.Connected then NewCaption:= '' else NewCaption:= ' (Offline)';
|
---|
1409 | Caption:= ApplicationName+Settings+' - '+SunriseChatCore.LocalUser.Nick+NewCaption;
|
---|
1410 | end;
|
---|
1411 |
|
---|
1412 | procedure TMainWindow.ListView1InfoTip(Sender: TObject; Item: TListItem;
|
---|
1413 | var InfoTip: String);
|
---|
1414 | begin
|
---|
1415 | InfoTip:= SunriseChatCore.UserList[Item.Index].DetailInfo;
|
---|
1416 | end;
|
---|
1417 |
|
---|
1418 | procedure TMainWindow.ActionCreateRoomExecute(Sender: TObject);
|
---|
1419 | begin
|
---|
1420 | NewRoom.ShowModal;
|
---|
1421 | end;
|
---|
1422 |
|
---|
1423 | procedure TMainWindow.Doplnitjmno1Click(Sender: TObject);
|
---|
1424 | begin
|
---|
1425 | //if Pos(':',ComboBox1.Text) = 0 then
|
---|
1426 | DoplnitJmeno;
|
---|
1427 | ComboBox1.SelStart:= ComboBox1.SelStart + 1;
|
---|
1428 | end;
|
---|
1429 |
|
---|
1430 | procedure TMainWindow.SearchFind1FindDialogFind(Sender: TObject);
|
---|
1431 | var
|
---|
1432 | FoundAt: LongInt;
|
---|
1433 | StartPos, ToEnd: Integer;
|
---|
1434 | STypes: TSearchTypes;
|
---|
1435 | begin
|
---|
1436 | (*
|
---|
1437 | with SearchFind1, RichEdit1 do begin
|
---|
1438 | if frWholeWord in Dialog.Options then STypes := STypes + [stWholeWord];
|
---|
1439 | if frMatchCase in Dialog.Options then STypes := STypes + [stMatchCase];
|
---|
1440 | if SelLength <> 0 then StartPos := SelStart + SelLength
|
---|
1441 | else StartPos := 0;
|
---|
1442 | ToEnd := Length(Text) - StartPos;
|
---|
1443 | FoundAt := FindText(Dialog.FindText, StartPos, ToEnd, Stypes);
|
---|
1444 | if FoundAt <> -1 then begin
|
---|
1445 | SetFocus;
|
---|
1446 | SelStart := FoundAt;
|
---|
1447 | SelLength := Length(Dialog.FindText);
|
---|
1448 | end else ShowMessage(Dialog.FindText+' nelze najít');
|
---|
1449 | end;
|
---|
1450 | *)
|
---|
1451 | end;
|
---|
1452 |
|
---|
1453 | procedure TMainWindow.SearchFind1BeforeExecute(Sender: TObject);
|
---|
1454 | begin
|
---|
1455 | SearchFind1.Dialog.Options:= [frHideUpDown];
|
---|
1456 | end;
|
---|
1457 |
|
---|
1458 | procedure TMainWindow.ActionClearMessageListExecute(Sender: TObject);
|
---|
1459 | var
|
---|
1460 | I: Integer;
|
---|
1461 | begin
|
---|
1462 | with SunriseChatCore do begin
|
---|
1463 | for I:= 0 to RoomList[ActiveRoomIndex].Count-1 do
|
---|
1464 | RoomList[ActiveRoomIndex].Lines[I].Font.Free;
|
---|
1465 | RoomList[ActiveRoomIndex].Count:= 0;
|
---|
1466 | TabControl1Change(Self);
|
---|
1467 | end;
|
---|
1468 | end;
|
---|
1469 |
|
---|
1470 | procedure TMainWindow.InitSettings;
|
---|
1471 | var
|
---|
1472 | I: Integer;
|
---|
1473 | begin
|
---|
1474 | with Options, SunriseChatCore do begin
|
---|
1475 | Include('UserEventsImagesEnabled', UserEventsImagesEnabled, True);
|
---|
1476 | Include('ShowRightToolBar', ShowRightToolBar, True);
|
---|
1477 | Include('MinimalizeOnCloseWindow', MinimalizeOnCloseWindow, False);
|
---|
1478 | Include('DefaultReason', DefaultReason, 'Jsem pryč');
|
---|
1479 | Include('NoResloveHostName', NoResloveHostName, False);
|
---|
1480 | Include('ShowMainMenu', ShowMainMenu, True);
|
---|
1481 | MainMenu1.Items.Visible:= ShowMainMenu;
|
---|
1482 | Include('ShowMessageTime', ShowMessageTime, False);
|
---|
1483 | Include('AlphaBlend', AlphaBlendWindow, 255);
|
---|
1484 | Include('UserListWidth', UserListWidth, 100);
|
---|
1485 | Include('ShowOnMessage', ShowOnMessage, False);
|
---|
1486 | Include('ShowBallonHint', ShowBallonHint, False);
|
---|
1487 | Include('OnTop', OnTop, False);
|
---|
1488 | Include('RunOnLogon', RunOnLogon, True);
|
---|
1489 | Include('StartInTray', StartInTray, False);
|
---|
1490 | Include('MinimizeToTray', MinimizeToTray, True);
|
---|
1491 | Include('ServiceFunction',ServiceFunction,False);
|
---|
1492 | Include('Nick',LocalUser.Nick,'Host');
|
---|
1493 | Include('DetailInfo',LocalUser.DetailInfo,'');
|
---|
1494 | LocalUser.NickTime:= Now;
|
---|
1495 | Include('Color',LocalUser.Color,0);
|
---|
1496 | Include('SnapWindow',SnapWindow,True);
|
---|
1497 | Include('Port',NetworkPort,55556);
|
---|
1498 | Include('NetworkInterfaceGUID',NetworkInterface,'');
|
---|
1499 | Include('PositionX',PositionX,Left);
|
---|
1500 | Include('PositionY',PositionY,Top);
|
---|
1501 | Include('SizeX',SizeX,Width);
|
---|
1502 | Include('SizeY',SizeY,Height);
|
---|
1503 | Include('WindowState',LastWindowState,Integer(fsNormal));
|
---|
1504 | Include('AutoAwayIdleTime',AutoAwayIdleTime,5);
|
---|
1505 | Include('PauseScrollText',PauseScrollText,False);
|
---|
1506 | Include('SoundDisable',SoundDisable,False);
|
---|
1507 | Include('OneAppInstance',OneAppInstance,True);
|
---|
1508 | Include('MaxNumberOfRoomLines',MaxNumberOfRoomLines,100);
|
---|
1509 | Include('AutoChangeWindowHeight',AutoChangeWindowHeight,False);
|
---|
1510 | Include('AutoChangeWindowHeightDirectionDown',AutoChangeWindowHeightDirectionDown,False);
|
---|
1511 | Include('MinimumVisibleUsersCount',MinimumVisibleUsersCount,8);
|
---|
1512 | Include('PingTimeout',PingTimeout,200);
|
---|
1513 | Include('SoundVolume',SoundVolume,100);
|
---|
1514 | Include('LanguageIndex', LanguageIndex, 0);
|
---|
1515 | Include('InvisibledOnStart',InvisibledOnStart,False);
|
---|
1516 | Include('AutoChangeInfoWindowHeight',AutoChangeInfoWindowHeight,True);
|
---|
1517 | Include('AppUserEventsCount',AppUserEventsCount,0);
|
---|
1518 | Include('FirstStart', FirstStart, True);
|
---|
1519 | LoadFromRegistry;
|
---|
1520 | if InvisibledOnStart then ActionInvisibleExecute(Self) else ActionOnlineExecute(Self);
|
---|
1521 | Localization.Activate(LanguageIndex);
|
---|
1522 | SunriseChatCore.MaxRoomLines := MaxNumberOfRoomLines;
|
---|
1523 | MainWindow.ScreenSnap := SnapWindow;
|
---|
1524 | ToolButton1.Down := PauseScrollText;
|
---|
1525 | ToolButton4.Down := SoundDisable;
|
---|
1526 | ToolButton5.Down := OnTop;
|
---|
1527 | Left := PositionX;
|
---|
1528 | Top := PositionY;
|
---|
1529 | Width := SizeX;
|
---|
1530 | Height := SizeY;
|
---|
1531 | WindowState := TWindowState(LastWindowState);
|
---|
1532 | Panel2.Width := UserListWidth;
|
---|
1533 | AlphaBlendValue := AlphaBlendWindow;
|
---|
1534 | AlphaBlend := AlphaBlendValue < 255;
|
---|
1535 |
|
---|
1536 | // Initialisation of Events
|
---|
1537 | AddEvent('Běžná zpráva', '<%0:s> %1:s', [eoShowMessage, eoPlayBeep, eoShowAlertIcon]);
|
---|
1538 | AddEvent('Osobní zpráva', '<%0:s> %1:s', [eoShowMessage, eoPlayBeep, eoShowAlertIcon, eoShowBalloonHint]);
|
---|
1539 | AddEvent('Uživatel se připojil', 'Uživatel %0:s se připojil z počítače %1:s', [eoShowMessage]);
|
---|
1540 | AddEvent('Uživatel se odpojil', 'Uživatel %s se odpojil', [eoShowMessage]);
|
---|
1541 | AddEvent('Uživatel obnoven', 'Uživatel %s obnoven', []);
|
---|
1542 | AddEvent('Uživatel zmizel', 'Uživatel %s zmizel', []);
|
---|
1543 | AddEvent('Uživatel odešel', 'Uživatel %0:s odešel: %1:s', [eoShowMessage]);
|
---|
1544 | AddEvent('Uživatel se vrátil', 'Uživatel %s se vrátil', []);
|
---|
1545 | AddEvent('Odeslání výzvy', 'Výzva uživateli %s byla odeslána', [eoShowMessage]);
|
---|
1546 | AddEvent('Přijetí výzvy', 'Uživatel %s vás vyzval', [eoShowMessage, eoShowWindow, eoPlayBeep]);
|
---|
1547 | AddEvent('Test odezvy', 'Odezva uživateli %s byla odeslána', [eoShowMessage]);
|
---|
1548 | AddEvent('Přijetí odezvy', 'Odezva od uživatele %0:s přijata za %1:s sekund', [eoShowMessage]);
|
---|
1549 | AddEvent('Změna jména uživatele', 'Uživatel %0:s se přejmenoval na %1:s', [eoShowMessage]);
|
---|
1550 | AddEvent('Změna jména při konfliktu', 'Došlo ke konfliktu jmen. Měním vaše jméno na %s', [eoShowMessage]);
|
---|
1551 | AddEvent('Vytvoření místnosti', 'Uživatel %0:s vytvořil místnost %1:s', [eoShowMessage]);
|
---|
1552 | AddEvent('Opuštění místnosti', 'Uživatel %0:s opustil místnosti %1:s', [eoShowMessage]);
|
---|
1553 | AddEvent('Uživatel automaticky odešel', 'Uživatel %0:s automaticky odešel po %1:s minutách nečinnosti', []);
|
---|
1554 | AddEvent('Uživatel se automaticky vrátil', 'Uživatel %0:s se automaticky vrátil po %1:s minutách', []);
|
---|
1555 | AddEvent('Celé hodiny', 'Je %0:d hodin', []);
|
---|
1556 | AddEvent('Start aplikace', 'Vítá tě '+ApplicationName+'!', [eoShowMessage]);
|
---|
1557 | SetLength(AppEvents,Length(AppEventsInit));
|
---|
1558 | for I:= 0 to High(AppEventsInit) do
|
---|
1559 | AppEvents[I]:= AppEventsInit[I];
|
---|
1560 | SetLength(AppEventsInit,0);
|
---|
1561 | LoadAppEventsFromRegistry;
|
---|
1562 |
|
---|
1563 | LoadAppUserEventsFromRegistry;
|
---|
1564 | ReloadImages;
|
---|
1565 |
|
---|
1566 | CoolTrayIcon1.Hint:= ApplicationName;
|
---|
1567 | if OnTop then FormStyle:= fsStayOnTop else FormStyle:= fsNormal;
|
---|
1568 | InitTrayIcon;
|
---|
1569 | ChangeRunOnLogon;
|
---|
1570 | Panel5.Visible:= ShowRightToolBar;
|
---|
1571 | Panel2.Visible:= False;
|
---|
1572 | Panel2.Visible:= True;
|
---|
1573 | end;
|
---|
1574 | end;
|
---|
1575 |
|
---|
1576 | procedure TMainWindow.ComboBox1Change(Sender: TObject);
|
---|
1577 | begin
|
---|
1578 | lComboBox1Change(Self);
|
---|
1579 | end;
|
---|
1580 |
|
---|
1581 | procedure TMainWindow.FillComboBox;
|
---|
1582 | var
|
---|
1583 | I: Integer;
|
---|
1584 | begin
|
---|
1585 | ComboBox1.Style:= csDropDown;
|
---|
1586 | with SunriseChatCore, ComboBox1.Items do begin
|
---|
1587 | BeginUpdate;
|
---|
1588 | Clear;
|
---|
1589 | for I:= 0 to High(UserList) do with UserList[I] do begin
|
---|
1590 | if Copy(Nick,1,Length(ComboBox1.Text)) = ComboBox1.Text then Add(Nick+': ');
|
---|
1591 | end;
|
---|
1592 | Update;
|
---|
1593 | EndUpdate;
|
---|
1594 | if ComboBox1.Items.Count>0 then ComboBox1.DroppedDown:= True;
|
---|
1595 | end;
|
---|
1596 | end;
|
---|
1597 |
|
---|
1598 | procedure TMainWindow.ActionChangeLogExecute(Sender: TObject);
|
---|
1599 | begin
|
---|
1600 | ShellLaunch(ChangeLogFile);
|
---|
1601 | end;
|
---|
1602 |
|
---|
1603 | procedure TMainWindow.ComboBox1DropDown(Sender: TObject);
|
---|
1604 | begin
|
---|
1605 | ComboBox1.Style:= csSimple;
|
---|
1606 | end;
|
---|
1607 |
|
---|
1608 | procedure TMainWindow.ComboBox1CloseUp(Sender: TObject);
|
---|
1609 | begin
|
---|
1610 | ComboBox1.Style:= csSimple;
|
---|
1611 | ComboBox1.SelStart:= -1;
|
---|
1612 | end;
|
---|
1613 |
|
---|
1614 | procedure TMainWindow.FormResize(Sender: TObject);
|
---|
1615 | begin
|
---|
1616 | ScrollDownRichEdit1;
|
---|
1617 | end;
|
---|
1618 |
|
---|
1619 | procedure TMainWindow.ReloadImages;
|
---|
1620 | var
|
---|
1621 | I: Integer;
|
---|
1622 | begin
|
---|
1623 | RichView1.Clear;
|
---|
1624 | for I:= 0 to High(AppUserEvents) do
|
---|
1625 | if Assigned(AppUserEvents[I].Image) then FreeAndNil(AppUserEvents[I].Image);
|
---|
1626 | TabControl1Change(Self);
|
---|
1627 | (*
|
---|
1628 | for I:= 0 to High(AppUserEvents) do
|
---|
1629 | with AppUserEvents[I] do begin
|
---|
1630 | if not Assigned(Image) then Image:= TImage.Create(Self);
|
---|
1631 | if FileExists(ImageFile) then
|
---|
1632 | Image.Picture.LoadFromFile(ImageFile);
|
---|
1633 | end;
|
---|
1634 | RichView1.Paint;
|
---|
1635 | *)
|
---|
1636 | end;
|
---|
1637 |
|
---|
1638 | procedure TMainWindow.ActionUserEventsListExecute(Sender: TObject);
|
---|
1639 | var
|
---|
1640 | I: Integer;
|
---|
1641 | StringList: TStringList;
|
---|
1642 | begin
|
---|
1643 | ComboBox1.Style := csDropDown;
|
---|
1644 | StringList := TStringList.Create;
|
---|
1645 | try
|
---|
1646 | with SunriseChatCore, StringList do begin
|
---|
1647 | BeginUpdate;
|
---|
1648 | for I := 0 to High(AppUserEvents) do with AppUserEvents[I] do begin
|
---|
1649 | Add(ComboBox1.Text+EventName);
|
---|
1650 | end;
|
---|
1651 | Sort;
|
---|
1652 | EndUpdate;
|
---|
1653 | end;
|
---|
1654 | with SunriseChatCore, ComboBox1, Items do begin
|
---|
1655 | BeginUpdate;
|
---|
1656 | Clear;
|
---|
1657 | AddStrings(StringList);
|
---|
1658 | if Count>0 then DroppedDown:= True;
|
---|
1659 | Update;
|
---|
1660 | EndUpdate;
|
---|
1661 | end;
|
---|
1662 | finally
|
---|
1663 | StringList.Free;
|
---|
1664 | end;
|
---|
1665 | end;
|
---|
1666 |
|
---|
1667 | procedure TMainWindow.ToolButton6Click(Sender: TObject);
|
---|
1668 | begin
|
---|
1669 | // ToolButton6.Marked := not ToolButton6.Marked;
|
---|
1670 | ToolButton6.Repaint;
|
---|
1671 | UserEventsImagesEnabled := not ToolButton6.Down;
|
---|
1672 | TabControl1Change(Self);
|
---|
1673 | end;
|
---|
1674 |
|
---|
1675 | end.
|
---|
1676 |
|
---|