| 1 | unit UOptionsWindow;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|---|
| 7 | Dialogs, StdCtrls, ComCtrls, ExtCtrls, cUtils, cWinSock, Menus, Spin,
|
|---|
| 8 | UMainWindow, cWindows, ShellAPI, Buttons, ExtDlgs, ImgList, GIFImage, UTextFileStream,
|
|---|
| 9 | ActnList, XPStyleActnCtrls, ActnMan;
|
|---|
| 10 |
|
|---|
| 11 | const
|
|---|
| 12 | SmileysDefFile = 'Smileys\Smileys.def';
|
|---|
| 13 |
|
|---|
| 14 | type
|
|---|
| 15 | TOptionsWindow = class(TForm)
|
|---|
| 16 | PageControl1: TPageControl;
|
|---|
| 17 | TabSheet1: TTabSheet;
|
|---|
| 18 | Label1: TLabel;
|
|---|
| 19 | Button1: TButton;
|
|---|
| 20 | Edit1: TEdit;
|
|---|
| 21 | TabSheet3: TTabSheet;
|
|---|
| 22 | Label2: TLabel;
|
|---|
| 23 | TrackBar1: TTrackBar;
|
|---|
| 24 | CheckBox1: TCheckBox;
|
|---|
| 25 | CheckBox2: TCheckBox;
|
|---|
| 26 | CheckBox3: TCheckBox;
|
|---|
| 27 | CheckBox4: TCheckBox;
|
|---|
| 28 | CheckBox5: TCheckBox;
|
|---|
| 29 | CheckBox6: TCheckBox;
|
|---|
| 30 | CheckBox7: TCheckBox;
|
|---|
| 31 | CheckBox8: TCheckBox;
|
|---|
| 32 | Label4: TLabel;
|
|---|
| 33 | Edit2: TEdit;
|
|---|
| 34 | Label5: TLabel;
|
|---|
| 35 | Shape1: TShape;
|
|---|
| 36 | ColorDialog1: TColorDialog;
|
|---|
| 37 | CheckBox9: TCheckBox;
|
|---|
| 38 | CheckBox10: TCheckBox;
|
|---|
| 39 | CheckBox11: TCheckBox;
|
|---|
| 40 | CheckBox13: TCheckBox;
|
|---|
| 41 | CheckBox14: TCheckBox;
|
|---|
| 42 | CheckBox15: TCheckBox;
|
|---|
| 43 | TabSheet4: TTabSheet;
|
|---|
| 44 | Label7: TLabel;
|
|---|
| 45 | ListBox1: TListBox;
|
|---|
| 46 | GroupBox1: TGroupBox;
|
|---|
| 47 | CheckBox16: TCheckBox;
|
|---|
| 48 | CheckBox17: TCheckBox;
|
|---|
| 49 | Edit3: TEdit;
|
|---|
| 50 | Button2: TButton;
|
|---|
| 51 | CheckBox18: TCheckBox;
|
|---|
| 52 | Edit4: TEdit;
|
|---|
| 53 | Button3: TButton;
|
|---|
| 54 | CheckBox19: TCheckBox;
|
|---|
| 55 | CheckBox20: TCheckBox;
|
|---|
| 56 | CheckBox21: TCheckBox;
|
|---|
| 57 | Edit5: TEdit;
|
|---|
| 58 | OpenDialog1: TOpenDialog;
|
|---|
| 59 | Button4: TButton;
|
|---|
| 60 | CheckBox22: TCheckBox;
|
|---|
| 61 | Edit6: TEdit;
|
|---|
| 62 | Label8: TLabel;
|
|---|
| 63 | Label10: TLabel;
|
|---|
| 64 | SpinEdit3: TSpinEdit;
|
|---|
| 65 | Button6: TButton;
|
|---|
| 66 | SpinEdit1: TSpinEdit;
|
|---|
| 67 | Label6: TLabel;
|
|---|
| 68 | Label11: TLabel;
|
|---|
| 69 | Button7: TButton;
|
|---|
| 70 | SaveDialog1: TSaveDialog;
|
|---|
| 71 | Label12: TLabel;
|
|---|
| 72 | CheckBox12: TCheckBox;
|
|---|
| 73 | SpinEdit4: TSpinEdit;
|
|---|
| 74 | GroupBox2: TGroupBox;
|
|---|
| 75 | TrackBar2: TTrackBar;
|
|---|
| 76 | SpeedButton4: TSpeedButton;
|
|---|
| 77 | TabSheet5: TTabSheet;
|
|---|
| 78 | Label13: TLabel;
|
|---|
| 79 | ListBox2: TListBox;
|
|---|
| 80 | GroupBox3: TGroupBox;
|
|---|
| 81 | SpeedButton5: TSpeedButton;
|
|---|
| 82 | CheckBox23: TCheckBox;
|
|---|
| 83 | CheckBox24: TCheckBox;
|
|---|
| 84 | Edit7: TEdit;
|
|---|
| 85 | Button5: TButton;
|
|---|
| 86 | CheckBox25: TCheckBox;
|
|---|
| 87 | Edit8: TEdit;
|
|---|
| 88 | Button8: TButton;
|
|---|
| 89 | CheckBox27: TCheckBox;
|
|---|
| 90 | CheckBox28: TCheckBox;
|
|---|
| 91 | Edit9: TEdit;
|
|---|
| 92 | GroupBox4: TGroupBox;
|
|---|
| 93 | SpeedButton3: TSpeedButton;
|
|---|
| 94 | SpeedButton2: TSpeedButton;
|
|---|
| 95 | SpeedButton1: TSpeedButton;
|
|---|
| 96 | Edit10: TEdit;
|
|---|
| 97 | FontDialog1: TFontDialog;
|
|---|
| 98 | RichEdit1: TRichEdit;
|
|---|
| 99 | Label15: TLabel;
|
|---|
| 100 | Button9: TButton;
|
|---|
| 101 | CheckBox26: TCheckBox;
|
|---|
| 102 | ComboBox2: TComboBox;
|
|---|
| 103 | CheckBox29: TCheckBox;
|
|---|
| 104 | CheckBox30: TCheckBox;
|
|---|
| 105 | Edit11: TEdit;
|
|---|
| 106 | GroupBox5: TGroupBox;
|
|---|
| 107 | Label3: TLabel;
|
|---|
| 108 | ComboBox1: TComboBox;
|
|---|
| 109 | SpinEdit2: TSpinEdit;
|
|---|
| 110 | Label9: TLabel;
|
|---|
| 111 | Label14: TLabel;
|
|---|
| 112 | ComboBox3: TComboBox;
|
|---|
| 113 | SpeedButton7: TSpeedButton;
|
|---|
| 114 | Edit12: TEdit;
|
|---|
| 115 | Button10: TButton;
|
|---|
| 116 | Edit13: TEdit;
|
|---|
| 117 | Label16: TLabel;
|
|---|
| 118 | Label17: TLabel;
|
|---|
| 119 | ComboBox4: TComboBox;
|
|---|
| 120 | CheckBox31: TCheckBox;
|
|---|
| 121 | Button11: TButton;
|
|---|
| 122 | OpenPictureDialog1: TOpenPictureDialog;
|
|---|
| 123 | CheckBox32: TCheckBox;
|
|---|
| 124 | Edit14: TEdit;
|
|---|
| 125 | Button12: TButton;
|
|---|
| 126 | CheckBox33: TCheckBox;
|
|---|
| 127 | SpeedButton8: TSpeedButton;
|
|---|
| 128 | PopupMenu1: TPopupMenu;
|
|---|
| 129 | Pidat1: TMenuItem;
|
|---|
| 130 | Zmnitjmnoudlosti1: TMenuItem;
|
|---|
| 131 | S1: TMenuItem;
|
|---|
| 132 | Posunoutudlostnahoru1: TMenuItem;
|
|---|
| 133 | Posunoutudlostdol1: TMenuItem;
|
|---|
| 134 | Nastudlostisobrzkyzesouboru1: TMenuItem;
|
|---|
| 135 | ActionManager1: TActionManager;
|
|---|
| 136 | ActionAddUserEvent: TAction;
|
|---|
| 137 | ActionDeleteUserEvent: TAction;
|
|---|
| 138 | ActionMoveUserEventUp: TAction;
|
|---|
| 139 | ActionMoveUserEventDown: TAction;
|
|---|
| 140 | ActionImportUserEventList: TAction;
|
|---|
| 141 | ActionEditUserEventCaption: TAction;
|
|---|
| 142 | ActionInsertToMessage: TAction;
|
|---|
| 143 | ActionDeleteAllUserEvents: TAction;
|
|---|
| 144 | SpeedButton6: TSpeedButton;
|
|---|
| 145 | Smazatvechnyudlosti1: TMenuItem;
|
|---|
| 146 | Vloittextdozprvy1: TMenuItem;
|
|---|
| 147 | ActionSaveUserEventsList: TAction;
|
|---|
| 148 | Uloitseznamudlostdosouboru1: TMenuItem;
|
|---|
| 149 | RadioGroup1: TRadioGroup;
|
|---|
| 150 | Label18: TLabel;
|
|---|
| 151 | Label19: TLabel;
|
|---|
| 152 | procedure Button1Click(Sender: TObject);
|
|---|
| 153 | procedure FormShow(Sender: TObject);
|
|---|
| 154 | procedure Shape1MouseDown(Sender: TObject; Button: TMouseButton;
|
|---|
| 155 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 156 | procedure TrackBar1Change(Sender: TObject);
|
|---|
| 157 | procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 158 | procedure Edit2KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 159 | procedure ListBox1Click(Sender: TObject);
|
|---|
| 160 | procedure CheckBox16Click(Sender: TObject);
|
|---|
| 161 | procedure CheckBox19Click(Sender: TObject);
|
|---|
| 162 | procedure CheckBox20Click(Sender: TObject);
|
|---|
| 163 | procedure CheckBox17Click(Sender: TObject);
|
|---|
| 164 | procedure CheckBox18Click(Sender: TObject);
|
|---|
| 165 | procedure CheckBox21Click(Sender: TObject);
|
|---|
| 166 | procedure Button2Click(Sender: TObject);
|
|---|
| 167 | procedure Button3Click(Sender: TObject);
|
|---|
| 168 | procedure Edit3Change(Sender: TObject);
|
|---|
| 169 | procedure Edit4Change(Sender: TObject);
|
|---|
| 170 | procedure Edit5Change(Sender: TObject);
|
|---|
| 171 | procedure Button4Click(Sender: TObject);
|
|---|
| 172 | procedure CheckBox22Click(Sender: TObject);
|
|---|
| 173 | procedure Button6Click(Sender: TObject);
|
|---|
| 174 | procedure Button7Click(Sender: TObject);
|
|---|
| 175 | procedure FormCreate(Sender: TObject);
|
|---|
| 176 | procedure SpeedButton4Click(Sender: TObject);
|
|---|
| 177 | procedure Button9Click(Sender: TObject);
|
|---|
| 178 | procedure Button10Click(Sender: TObject);
|
|---|
| 179 | procedure Edit12Change(Sender: TObject);
|
|---|
| 180 | procedure ComboBox1Change(Sender: TObject);
|
|---|
| 181 | procedure CheckBox9Click(Sender: TObject);
|
|---|
| 182 | procedure Button11Click(Sender: TObject);
|
|---|
| 183 | procedure ListBox2Click(Sender: TObject);
|
|---|
| 184 | procedure CheckBox29Click(Sender: TObject);
|
|---|
| 185 | procedure Edit10Change(Sender: TObject);
|
|---|
| 186 | procedure CheckBox26Click(Sender: TObject);
|
|---|
| 187 | procedure ComboBox2Change(Sender: TObject);
|
|---|
| 188 | procedure CheckBox30Click(Sender: TObject);
|
|---|
| 189 | procedure Edit11Change(Sender: TObject);
|
|---|
| 190 | procedure CheckBox23Click(Sender: TObject);
|
|---|
| 191 | procedure CheckBox27Click(Sender: TObject);
|
|---|
| 192 | procedure CheckBox24Click(Sender: TObject);
|
|---|
| 193 | procedure CheckBox33Click(Sender: TObject);
|
|---|
| 194 | procedure Edit7Change(Sender: TObject);
|
|---|
| 195 | procedure CheckBox25Click(Sender: TObject);
|
|---|
| 196 | procedure Edit8Change(Sender: TObject);
|
|---|
| 197 | procedure CheckBox28Click(Sender: TObject);
|
|---|
| 198 | procedure Edit9Change(Sender: TObject);
|
|---|
| 199 | procedure CheckBox32Click(Sender: TObject);
|
|---|
| 200 | procedure Edit14Change(Sender: TObject);
|
|---|
| 201 | procedure SpeedButton5Click(Sender: TObject);
|
|---|
| 202 | procedure Button5Click(Sender: TObject);
|
|---|
| 203 | procedure Button8Click(Sender: TObject);
|
|---|
| 204 | procedure Button12Click(Sender: TObject);
|
|---|
| 205 | procedure Button14Click(Sender: TObject);
|
|---|
| 206 | procedure ListBox2DblClick(Sender: TObject);
|
|---|
| 207 | procedure ActionAddUserEventExecute(Sender: TObject);
|
|---|
| 208 | procedure ActionDeleteUserEventExecute(Sender: TObject);
|
|---|
| 209 | procedure ActionMoveUserEventUpExecute(Sender: TObject);
|
|---|
| 210 | procedure ActionMoveUserEventDownExecute(Sender: TObject);
|
|---|
| 211 | procedure ActionImportUserEventListExecute(Sender: TObject);
|
|---|
| 212 | procedure ActionEditUserEventCaptionExecute(Sender: TObject);
|
|---|
| 213 | procedure ActionInsertToMessageExecute(Sender: TObject);
|
|---|
| 214 | procedure ActionDeleteAllUserEventsExecute(Sender: TObject);
|
|---|
| 215 | procedure ActionSaveUserEventsListExecute(Sender: TObject);
|
|---|
| 216 | procedure TrackBar2Change(Sender: TObject);
|
|---|
| 217 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|---|
| 218 | private
|
|---|
| 219 | { Private declarations }
|
|---|
| 220 | public
|
|---|
| 221 | AppEvents: array of TAppEvent;
|
|---|
| 222 | AppUserEvents: array of TAppUserEvent;
|
|---|
| 223 | procedure LoadEventOptions;
|
|---|
| 224 | procedure LoadUserEventOptions;
|
|---|
| 225 | procedure ListBox2Reload;
|
|---|
| 226 | procedure SaveUserEvents;
|
|---|
| 227 | end;
|
|---|
| 228 |
|
|---|
| 229 | var
|
|---|
| 230 | OptionsWindow: TOptionsWindow;
|
|---|
| 231 |
|
|---|
| 232 | implementation
|
|---|
| 233 |
|
|---|
| 234 | uses USunriseChatCore, ULocalization, DateUtils, UWaitingDialog;
|
|---|
| 235 |
|
|---|
| 236 | {$R *.dfm}
|
|---|
| 237 |
|
|---|
| 238 | // Closing dialog and saving options
|
|---|
| 239 | procedure TOptionsWindow.Button1Click(Sender: TObject);
|
|---|
| 240 | var
|
|---|
| 241 | I: Integer;
|
|---|
| 242 | DiffrentAppUserEvents: Boolean;
|
|---|
| 243 | begin
|
|---|
| 244 | with SunriseChatCore, MainWindow, OptionsWindow do begin
|
|---|
| 245 | if LocalUser.Nick <> Edit1.Text then ChangeNick(Edit1.Text);
|
|---|
| 246 | if NetworkInterface <> NetworkInterfaces[ComboBox1.ItemIndex].GUID then begin
|
|---|
| 247 | SelectNetworkInterface(NetworkInterfaces[ComboBox1.ItemIndex].GUID);
|
|---|
| 248 | NetworkInterface:= NetworkInterfaces[ComboBox1.ItemIndex].GUID;
|
|---|
| 249 | end;
|
|---|
| 250 |
|
|---|
| 251 | NetworkPort:= SpinEdit2.Value;
|
|---|
| 252 | if SunriseChatCore.UDPPort <> NetworkPort then begin
|
|---|
| 253 | SunriseChatCore.UDPPort:= NetworkPort;
|
|---|
| 254 | ShowMessage('Změna se projeví až po restartu aplikace!');
|
|---|
| 255 | //SunriseChatCore.StartNetwork;
|
|---|
| 256 | end;
|
|---|
| 257 | LocalUser.Color:= Shape1.Brush.Color;
|
|---|
| 258 | ShowMainMenu:= CheckBox1.Checked;
|
|---|
| 259 | MainMenu1.Items.Visible:= ShowMainMenu;
|
|---|
| 260 | RunOnLogon:= CheckBox2.Checked;
|
|---|
| 261 | ChangeRunOnLogon;
|
|---|
| 262 | MinimizeToTray:= CheckBox3.Checked;
|
|---|
| 263 | MainWindow.InitTrayIcon;
|
|---|
| 264 | StartInTray:= CheckBox4.Checked;
|
|---|
| 265 | OnTop:= CheckBox5.Checked;
|
|---|
| 266 | ToolButton5.Marked:= OnTop;
|
|---|
| 267 | ShowOnMessage:= CheckBox6.Checked;
|
|---|
| 268 | ShowMessageTime:= CheckBox7.Checked;
|
|---|
| 269 | TabControl1Change(Self);
|
|---|
| 270 | ShowBallonHint:= CheckBox8.Checked;
|
|---|
| 271 | ServiceFunction:= CheckBox9.Checked;
|
|---|
| 272 | MinimalizeOnCloseWindow:= CheckBox10.Checked;
|
|---|
| 273 | ShowRightToolBar:= CheckBox11.Checked;
|
|---|
| 274 | AutoAwayIdleTime:= SpinEdit1.Value;
|
|---|
| 275 | OneAppInstance:= CheckBox13.Checked;
|
|---|
| 276 | SoundDisable:= CheckBox14.Checked;
|
|---|
| 277 | SnapWindow:= CheckBox15.Checked;
|
|---|
| 278 | MainWindow.ScreenSnap:= SnapWindow;
|
|---|
| 279 | ToolButton4.Marked:= SoundDisable;
|
|---|
| 280 | SunriseChatCore.LocalUser.DetailInfo:= Edit6.Text;
|
|---|
| 281 | if MinimumVisibleUsersCount <> SpinEdit4.Value then begin
|
|---|
| 282 | MinimumVisibleUsersCount := SpinEdit4.Value;
|
|---|
| 283 | ListView1.Items.Clear;
|
|---|
| 284 | MainWindow.ShowUserList;
|
|---|
| 285 | end;
|
|---|
| 286 | SoundVolume := 1000-TrackBar2.Position;
|
|---|
| 287 | InvisibledOnStart := CheckBox31.Checked;
|
|---|
| 288 | AutoChangeWindowHeight := CheckBox12.Checked;
|
|---|
| 289 | AutoChangeWindowHeightDirectionDown := ComboBox4.ItemIndex = 1;
|
|---|
| 290 | MinimumVisibleUsersCount := SpinEdit4.Value;
|
|---|
| 291 | if MaxNumberOfRoomLines <> SpinEdit3.Value then begin
|
|---|
| 292 | MaxNumberOfRoomLines := SpinEdit3.Value;
|
|---|
| 293 | MaxRoomLines := MaxNumberOfRoomLines;
|
|---|
| 294 | TabControl1Change(Self);
|
|---|
| 295 | end;
|
|---|
| 296 |
|
|---|
| 297 | Panel5.Visible := ShowRightToolBar;
|
|---|
| 298 | //Panel2.Visible := False;
|
|---|
| 299 | //Panel2.Visible := True;
|
|---|
| 300 | AlphaBlendWindow := TrackBar1.Position;
|
|---|
| 301 | MainWindow.AlphaBlendValue := AlphaBlendWindow;
|
|---|
| 302 | AlphaBlend := AlphaBlendValue < 255;
|
|---|
| 303 |
|
|---|
| 304 | // ChangeMenuVisibility(ShowMainMenu);
|
|---|
| 305 | DefaultReason:= Edit2.Text;
|
|---|
| 306 | InitTrayIcon;
|
|---|
| 307 |
|
|---|
| 308 | SunriseChatCore.BroadcastType := TBroadCastType(RadioGroup1.ItemIndex);
|
|---|
| 309 | BroadcastTypeI := RadioGroup1.ItemIndex;
|
|---|
| 310 |
|
|---|
| 311 | SetLength(MainWindow.AppEvents,Length(AppEvents));
|
|---|
| 312 | for I:= 0 to High(AppEvents) do
|
|---|
| 313 | MainWindow.AppEvents[I]:= AppEvents[I];
|
|---|
| 314 | MainWindow.SaveAppEventsToRegistry;
|
|---|
| 315 |
|
|---|
| 316 | // Save user events
|
|---|
| 317 | DiffrentAppUserEvents := False;
|
|---|
| 318 | if Length(AppUserEvents) <> Length(MainWindow.AppUserEvents) then
|
|---|
| 319 | DiffrentAppUserEvents := True
|
|---|
| 320 | else begin
|
|---|
| 321 | for I := 0 to High(AppUserEvents) do begin
|
|---|
| 322 | if (MainWindow.AppUserEvents[I].ConditionTextEnable <> AppUserEvents[I].ConditionTextEnable) or
|
|---|
| 323 | (MainWindow.AppUserEvents[I].ConditionText <> AppUserEvents[I].ConditionText) or
|
|---|
| 324 | (MainWindow.AppUserEvents[I].ConditionUserEnable <> AppUserEvents[I].ConditionUserEnable) or
|
|---|
| 325 | (MainWindow.AppUserEvents[I].ConditionUser <> AppUserEvents[I].ConditionUser) or
|
|---|
| 326 | (MainWindow.AppUserEvents[I].ConditionAppEventEnable <> AppUserEvents[I].ConditionAppEventEnable) or
|
|---|
| 327 | (MainWindow.AppUserEvents[I].ConditionAppEvent <> AppUserEvents[I].ConditionAppEvent) or
|
|---|
| 328 | (MainWindow.AppUserEvents[I].EventName <> AppUserEvents[I].EventName) or
|
|---|
| 329 | (MainWindow.AppUserEvents[I].ShowWindow <> AppUserEvents[I].ShowWindow) or
|
|---|
| 330 | (MainWindow.AppUserEvents[I].ShowBalloonHint <> AppUserEvents[I].ShowBalloonHint) or
|
|---|
| 331 | (MainWindow.AppUserEvents[I].PlaySound <> AppUserEvents[I].PlaySound) or
|
|---|
| 332 | (MainWindow.AppUserEvents[I].ShowAlertIcon <> AppUserEvents[I].ShowAlertIcon) or
|
|---|
| 333 | (MainWindow.AppUserEvents[I].IconFile <> AppUserEvents[I].IconFile) or
|
|---|
| 334 | (MainWindow.AppUserEvents[I].PlayBeep <> AppUserEvents[I].PlayBeep) or
|
|---|
| 335 | (MainWindow.AppUserEvents[I].SoundFile <> AppUserEvents[I].SoundFile) or
|
|---|
| 336 | (MainWindow.AppUserEvents[I].ExecuteApplication <> AppUserEvents[I].ExecuteApplication) or
|
|---|
| 337 | (MainWindow.AppUserEvents[I].ApplicationFile <> AppUserEvents[I].ApplicationFile) or
|
|---|
| 338 | (MainWindow.AppUserEvents[I].ShowImage <> AppUserEvents[I].ShowImage) or
|
|---|
| 339 | (MainWindow.AppUserEvents[I].ImageFile <> AppUserEvents[I].ImageFile) then
|
|---|
| 340 | DiffrentAppUserEvents := True;
|
|---|
| 341 | end;
|
|---|
| 342 | end;
|
|---|
| 343 | if DiffrentAppUserEvents then begin
|
|---|
| 344 | SetLength(MainWindow.AppUserEvents, Length(AppUserEvents));
|
|---|
| 345 | for I := 0 to High(AppUserEvents) do
|
|---|
| 346 | MainWindow.AppUserEvents[I] := AppUserEvents[I];
|
|---|
| 347 | SetLength(MainWindow.AppUserEventsOptions, Length(AppUserEvents));
|
|---|
| 348 | MainWindow.AppUserEventsCount := Length(AppUserEvents);
|
|---|
| 349 |
|
|---|
| 350 | WaitingDialog.PridejUlohu('Načtení z registrů', SaveUserEvents);
|
|---|
| 351 | WaitingDialog.PridejUlohu('Uložení do registrů', MainWindow.SaveAppUserEventsToRegistry);
|
|---|
| 352 | WaitingDialog.Start;
|
|---|
| 353 | ReloadImages;
|
|---|
| 354 | end;
|
|---|
| 355 | MainWindow.LanguageIndex := ComboBox3.ItemIndex;
|
|---|
| 356 | Localization.Activate(MainWindow.LanguageIndex);
|
|---|
| 357 | end;
|
|---|
| 358 | MainWindow.Options.SaveToRegistry;
|
|---|
| 359 | Close;
|
|---|
| 360 | end;
|
|---|
| 361 |
|
|---|
| 362 | procedure TOptionsWindow.FormShow(Sender: TObject);
|
|---|
| 363 | var
|
|---|
| 364 | I: Integer;
|
|---|
| 365 | begin
|
|---|
| 366 | with SunriseChatCore do begin
|
|---|
| 367 | Shape1.Brush.Color:= LocalUser.Color;
|
|---|
| 368 | Edit1.Text:= LocalUser.Nick;
|
|---|
| 369 | Edit2.Text:= MainWindow.DefaultReason;
|
|---|
| 370 | Edit6.Text:= SunriseChatCore.LocalUser.DetailInfo;
|
|---|
| 371 | CheckBox1.Checked:= MainWindow.ShowMainMenu;
|
|---|
| 372 | CheckBox2.Checked:= MainWindow.RunOnLogon;
|
|---|
| 373 | CheckBox3.Checked:= MainWindow.MinimizeToTray;
|
|---|
| 374 | CheckBox4.Checked:= MainWindow.StartInTray;
|
|---|
| 375 | CheckBox5.Checked:= MainWindow.OnTop;
|
|---|
| 376 | CheckBox6.Checked:= MainWindow.ShowOnMessage;
|
|---|
| 377 | CheckBox7.Checked:= MainWindow.ShowMessageTime;
|
|---|
| 378 | CheckBox8.Checked:= MainWindow.ShowBallonHint;
|
|---|
| 379 | CheckBox9.Checked:= MainWindow.ServiceFunction;
|
|---|
| 380 | CheckBox10.Checked:= MainWindow.MinimalizeOnCloseWindow;
|
|---|
| 381 | CheckBox11.Checked:= MainWindow.ShowRightToolBar;
|
|---|
| 382 | CheckBox12.Checked:= MainWindow.AutoChangeWindowHeight;
|
|---|
| 383 | CheckBox13.Checked:= MainWindow.OneAppInstance;
|
|---|
| 384 | CheckBox14.Checked:= MainWindow.SoundDisable;
|
|---|
| 385 | CheckBox15.Checked:= MainWindow.SnapWindow;
|
|---|
| 386 | CheckBox31.Checked:= MainWindow.InvisibledOnStart;
|
|---|
| 387 | SpinEdit1.Value:= AutoAwayIdleTime;
|
|---|
| 388 | SpinEdit3.Value:= MainWindow.MaxNumberOfRoomLines;
|
|---|
| 389 | SpinEdit2.Value:= MainWindow.NetworkPort;
|
|---|
| 390 | SpinEdit4.Value:= MainWindow.MinimumVisibleUsersCount;
|
|---|
| 391 | TrackBar1.Position := MainWindow.AlphaBlendWindow;
|
|---|
| 392 | TrackBar2.Position := 1000 - MainWindow.SoundVolume;
|
|---|
| 393 | if MainWindow.AutoChangeWindowHeightDirectionDown then
|
|---|
| 394 | ComboBox4.ItemIndex:= 1 else ComboBox4.ItemIndex:= 0;
|
|---|
| 395 | RadioGroup1.ItemIndex := MainWindow.BroadcastTypeI;
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 | // Fill network interfaces list
|
|---|
| 399 | ComboBox1.Items.Clear;
|
|---|
| 400 | for I:= 0 to High(NetworkInterfaces) do ComboBox1.Items.Add(NetworkInterfaces[I].Name);
|
|---|
| 401 | ComboBox1.ItemIndex:= NetworkInterfaceIndex;
|
|---|
| 402 |
|
|---|
| 403 | ComboBox3.Items.Clear;
|
|---|
| 404 | for I:= 0 to High(Localization.Languages) do ComboBox3.Items.Add(Localization.Languages[I].Name);
|
|---|
| 405 | if MainWindow.LanguageIndex < ComboBox3.Items.Count then ComboBox3.ItemIndex:= MainWindow.LanguageIndex;
|
|---|
| 406 | ComboBox1Change(Self);
|
|---|
| 407 |
|
|---|
| 408 | // Load AppEvents
|
|---|
| 409 | // ShowMessage(IntToStr(Length(MainWindow.AppEvents)));
|
|---|
| 410 | SetLength(AppEvents,Length(MainWindow.AppEvents));
|
|---|
| 411 | for I:= 0 to High(AppEvents) do
|
|---|
| 412 | AppEvents[I]:= MainWindow.AppEvents[I];
|
|---|
| 413 | ListBox1.Items.BeginUpdate;
|
|---|
| 414 | ListBox1.Items.Clear;
|
|---|
| 415 | for I:= 0 to High(AppEvents) do ListBox1.Items.Add(AppEvents[I].EventName);
|
|---|
| 416 | ListBox1.Items.EndUpdate;
|
|---|
| 417 | ListBox1.ItemIndex:= 0;
|
|---|
| 418 | ListBox1Click(Self);
|
|---|
| 419 |
|
|---|
| 420 | // Load AppUserEvents
|
|---|
| 421 | SetLength(AppUserEvents,Length(MainWindow.AppUserEvents));
|
|---|
| 422 | for I:= 0 to High(AppUserEvents) do
|
|---|
| 423 | AppUserEvents[I]:= MainWindow.AppUserEvents[I];
|
|---|
| 424 | ListBox2.Items.BeginUpdate;
|
|---|
| 425 | ListBox2.Items.Clear;
|
|---|
| 426 | for I:= 0 to High(AppUserEvents) do ListBox2.Items.Add(AppUserEvents[I].EventName);
|
|---|
| 427 | ListBox2.Items.EndUpdate;
|
|---|
| 428 | ListBox2.ItemIndex:= 0;
|
|---|
| 429 | ComboBox2.Items.Clear;
|
|---|
| 430 | for I:= 0 to High(AppEvents) do ComboBox2.Items.Add(AppEvents[I].EventName);
|
|---|
| 431 | LoadUserEventOptions;
|
|---|
| 432 | end;
|
|---|
| 433 | end;
|
|---|
| 434 |
|
|---|
| 435 | procedure TOptionsWindow.Shape1MouseDown(Sender: TObject;
|
|---|
| 436 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|---|
| 437 | begin
|
|---|
| 438 | if ColorDialog1.Execute then Shape1.Brush.Color := ColorDialog1.Color;
|
|---|
| 439 | end;
|
|---|
| 440 |
|
|---|
| 441 | procedure TOptionsWindow.TrackBar1Change(Sender: TObject);
|
|---|
| 442 | begin
|
|---|
| 443 | MainWindow.AlphaBlendValue := TrackBar1.Position;
|
|---|
| 444 | end;
|
|---|
| 445 |
|
|---|
| 446 | procedure TOptionsWindow.Edit1KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 447 | begin
|
|---|
| 448 | if Key = #13 then begin
|
|---|
| 449 | Key := #0;
|
|---|
| 450 | Button1Click(Self);
|
|---|
| 451 | end;
|
|---|
| 452 | end;
|
|---|
| 453 |
|
|---|
| 454 | procedure TOptionsWindow.Edit2KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 455 | begin
|
|---|
| 456 | if Key = #13 then begin
|
|---|
| 457 | Key:= #0;
|
|---|
| 458 | Button1Click(Self);
|
|---|
| 459 | end;
|
|---|
| 460 | end;
|
|---|
| 461 |
|
|---|
| 462 | procedure TOptionsWindow.ListBox1Click(Sender: TObject);
|
|---|
| 463 | begin
|
|---|
| 464 | LoadEventOptions;
|
|---|
| 465 | end;
|
|---|
| 466 |
|
|---|
| 467 | procedure TOptionsWindow.LoadEventOptions;
|
|---|
| 468 | begin
|
|---|
| 469 | with AppEvents[ListBox1.ItemIndex] do begin
|
|---|
| 470 | CheckBox16.Checked := ShowWindow;
|
|---|
| 471 | CheckBox19.Checked := ShowAlertIcon;
|
|---|
| 472 | Edit12.Text := IconFile;
|
|---|
| 473 | CheckBox20.Checked := ShowBalloonHint;
|
|---|
| 474 | CheckBox17.Checked := PlaySound;
|
|---|
| 475 | CheckBox22.Checked := PlayBeep;
|
|---|
| 476 | Edit3.Text := SoundFile;
|
|---|
| 477 | CheckBox18.Checked := ExecuteApplication;
|
|---|
| 478 | Edit4.Text := ApplicationFile;
|
|---|
| 479 | CheckBox21.Checked := ShowMessage;
|
|---|
| 480 | Edit5.Text := MessageText;
|
|---|
| 481 | FontDialog1.Font := MessageFont;
|
|---|
| 482 | RichEdit1.SelectAll;
|
|---|
| 483 | RichEdit1.SelAttributes.Name := MessageFont.Name;
|
|---|
| 484 | RichEdit1.SelAttributes.Charset := MessageFont.Charset;
|
|---|
| 485 | RichEdit1.SelAttributes.Color := MessageFont.Color;
|
|---|
| 486 | RichEdit1.SelAttributes.Style := MessageFont.Style;
|
|---|
| 487 | RichEdit1.SelAttributes.Size := MessageFont.Size;
|
|---|
| 488 | RichEdit1.SelAttributes.Pitch := MessageFont.Pitch;
|
|---|
| 489 | end;
|
|---|
| 490 | end;
|
|---|
| 491 |
|
|---|
| 492 | procedure TOptionsWindow.CheckBox16Click(Sender: TObject);
|
|---|
| 493 | begin
|
|---|
| 494 | AppEvents[ListBox1.ItemIndex].ShowWindow:= CheckBox16.Checked;
|
|---|
| 495 | end;
|
|---|
| 496 |
|
|---|
| 497 | procedure TOptionsWindow.CheckBox19Click(Sender: TObject);
|
|---|
| 498 | begin
|
|---|
| 499 | AppEvents[ListBox1.ItemIndex].ShowAlertIcon:= CheckBox19.Checked;
|
|---|
| 500 | end;
|
|---|
| 501 |
|
|---|
| 502 | procedure TOptionsWindow.CheckBox20Click(Sender: TObject);
|
|---|
| 503 | begin
|
|---|
| 504 | AppEvents[ListBox1.ItemIndex].ShowBalloonHint:= CheckBox20.Checked;
|
|---|
| 505 | end;
|
|---|
| 506 |
|
|---|
| 507 | procedure TOptionsWindow.CheckBox17Click(Sender: TObject);
|
|---|
| 508 | begin
|
|---|
| 509 | AppEvents[ListBox1.ItemIndex].PlaySound:= CheckBox17.Checked;
|
|---|
| 510 | end;
|
|---|
| 511 |
|
|---|
| 512 | procedure TOptionsWindow.CheckBox18Click(Sender: TObject);
|
|---|
| 513 | begin
|
|---|
| 514 | AppEvents[ListBox1.ItemIndex].ExecuteApplication:= CheckBox18.Checked;
|
|---|
| 515 | end;
|
|---|
| 516 |
|
|---|
| 517 | procedure TOptionsWindow.CheckBox21Click(Sender: TObject);
|
|---|
| 518 | begin
|
|---|
| 519 | AppEvents[ListBox1.ItemIndex].ShowMessage:= CheckBox21.Checked;
|
|---|
| 520 | end;
|
|---|
| 521 |
|
|---|
| 522 | procedure TOptionsWindow.Button2Click(Sender: TObject);
|
|---|
| 523 | begin
|
|---|
| 524 | OpenDialog1.Filter:= 'Soubory WAV|*.wav|Všechny soubory|*.*';
|
|---|
| 525 | OpenDialog1.FileName:= Edit3.Text;
|
|---|
| 526 | if OpenDialog1.Execute then begin
|
|---|
| 527 | CheckBox17.Checked := True;
|
|---|
| 528 | Edit3.Text:= OpenDialog1.FileName;
|
|---|
| 529 | AppEvents[ListBox1.ItemIndex].SoundFile:= OpenDialog1.FileName;
|
|---|
| 530 | end;
|
|---|
| 531 | end;
|
|---|
| 532 |
|
|---|
| 533 | procedure TOptionsWindow.Button3Click(Sender: TObject);
|
|---|
| 534 | begin
|
|---|
| 535 | OpenDialog1.Filter:= 'Spustitelné soubory|*.exe|Všechny soubory|*.*';
|
|---|
| 536 | OpenDialog1.FileName:= Edit4.Text;
|
|---|
| 537 | if OpenDialog1.Execute then begin
|
|---|
| 538 | CheckBox18.Checked := True;
|
|---|
| 539 | Edit4.Text:= OpenDialog1.FileName;
|
|---|
| 540 | AppEvents[ListBox1.ItemIndex].ApplicationFile:= OpenDialog1.FileName;
|
|---|
| 541 | end;
|
|---|
| 542 | end;
|
|---|
| 543 |
|
|---|
| 544 | procedure TOptionsWindow.Edit3Change(Sender: TObject);
|
|---|
| 545 | begin
|
|---|
| 546 | AppEvents[ListBox1.ItemIndex].SoundFile:= Edit3.Text;
|
|---|
| 547 | end;
|
|---|
| 548 |
|
|---|
| 549 | procedure TOptionsWindow.Edit4Change(Sender: TObject);
|
|---|
| 550 | begin
|
|---|
| 551 | AppEvents[ListBox1.ItemIndex].ApplicationFile:= Edit4.Text;
|
|---|
| 552 | end;
|
|---|
| 553 |
|
|---|
| 554 | procedure TOptionsWindow.Edit5Change(Sender: TObject);
|
|---|
| 555 | begin
|
|---|
| 556 | AppEvents[ListBox1.ItemIndex].MessageText:= Edit5.Text;
|
|---|
| 557 | end;
|
|---|
| 558 |
|
|---|
| 559 | procedure TOptionsWindow.Button4Click(Sender: TObject);
|
|---|
| 560 | begin
|
|---|
| 561 | Close;
|
|---|
| 562 | end;
|
|---|
| 563 |
|
|---|
| 564 | procedure TOptionsWindow.CheckBox22Click(Sender: TObject);
|
|---|
| 565 | begin
|
|---|
| 566 | AppEvents[ListBox1.ItemIndex].PlayBeep:= CheckBox22.Checked;
|
|---|
| 567 | end;
|
|---|
| 568 |
|
|---|
| 569 | procedure TOptionsWindow.Button6Click(Sender: TObject);
|
|---|
| 570 | var
|
|---|
| 571 | I: Integer;
|
|---|
| 572 | begin
|
|---|
| 573 | // SetLength(AppEvents,0);
|
|---|
| 574 | with MainWindow do begin
|
|---|
| 575 | Options.Delete;
|
|---|
| 576 | for I:= 0 to High(AppEventsOptions) do begin
|
|---|
| 577 | AppEventsOptions[I].Delete;
|
|---|
| 578 | AppEventsOptions[I].Free;
|
|---|
| 579 | end;
|
|---|
| 580 | SetLength(AppEventsOptions,0);
|
|---|
| 581 | InitSettings;
|
|---|
| 582 | end;
|
|---|
| 583 | FormShow(Self);
|
|---|
| 584 | end;
|
|---|
| 585 |
|
|---|
| 586 | procedure TOptionsWindow.Button7Click(Sender: TObject);
|
|---|
| 587 | begin
|
|---|
| 588 | SaveDialog1.FileName:= 'Nastavení '+ApplicationName+'u '+DateToStr(Now)+'.reg';
|
|---|
| 589 | if SaveDialog1.Execute then
|
|---|
| 590 | //ShowMessage(IntToStr(
|
|---|
| 591 | ShellExecute(0, 'open', PChar('regedit.exe'), PChar('/e "'+SaveDialog1.FileName+'" "HKEY_CURRENT_USER'+RegistryPath+'"'), '', SW_SHOWNORMAL);
|
|---|
| 592 | end;
|
|---|
| 593 |
|
|---|
| 594 | procedure TOptionsWindow.FormCreate(Sender: TObject);
|
|---|
| 595 | begin
|
|---|
| 596 | if MainWindow.OnTop then FormStyle:= fsStayOnTop else FormStyle:= fsNormal;
|
|---|
| 597 | PageControl1.ActivePageIndex:= 0;
|
|---|
| 598 | end;
|
|---|
| 599 |
|
|---|
| 600 | procedure TOptionsWindow.SpeedButton4Click(Sender: TObject);
|
|---|
| 601 | begin
|
|---|
| 602 | with MainWindow do try
|
|---|
| 603 | MediaPlayer1.FileName:= Edit3.Text;
|
|---|
| 604 | MediaPlayer1.Open;
|
|---|
| 605 | MediaPlayer1.Play;
|
|---|
| 606 | except
|
|---|
| 607 | Dialogs.ShowMessage(Localization.Item('AudioFileNotFound'));
|
|---|
| 608 | end;
|
|---|
| 609 | end;
|
|---|
| 610 |
|
|---|
| 611 | procedure TOptionsWindow.Button9Click(Sender: TObject);
|
|---|
| 612 | begin
|
|---|
| 613 | with AppEvents[ListBox1.ItemIndex] do
|
|---|
| 614 | if FontDialog1.Execute then begin
|
|---|
| 615 | MessageFont.Name := FontDialog1.Font.Name;
|
|---|
| 616 | MessageFont.Charset := FontDialog1.Font.Charset;
|
|---|
| 617 | MessageFont.Color := FontDialog1.Font.Color;
|
|---|
| 618 | MessageFont.Style := FontDialog1.Font.Style;
|
|---|
| 619 | MessageFont.Size := FontDialog1.Font.Size;
|
|---|
| 620 | MessageFont.Pitch := FontDialog1.Font.Pitch;
|
|---|
| 621 |
|
|---|
| 622 | RichEdit1.SelectAll;
|
|---|
| 623 | RichEdit1.SelAttributes.Name := MessageFont.Name;
|
|---|
| 624 | RichEdit1.SelAttributes.Charset := MessageFont.Charset;
|
|---|
| 625 | RichEdit1.SelAttributes.Color := MessageFont.Color;
|
|---|
| 626 | RichEdit1.SelAttributes.Style := MessageFont.Style;
|
|---|
| 627 | RichEdit1.SelAttributes.Size := MessageFont.Size;
|
|---|
| 628 | RichEdit1.SelAttributes.Pitch := MessageFont.Pitch;
|
|---|
| 629 | end;
|
|---|
| 630 | end;
|
|---|
| 631 |
|
|---|
| 632 | procedure TOptionsWindow.Button10Click(Sender: TObject);
|
|---|
| 633 | begin
|
|---|
| 634 | OpenDialog1.Filter:= 'Ikony|*.ico|Všechny soubory|*.*';
|
|---|
| 635 | OpenDialog1.FileName:= Edit12.Text;
|
|---|
| 636 | if OpenDialog1.Execute then begin
|
|---|
| 637 | CheckBox19.Checked := True;
|
|---|
| 638 | Edit12.Text:= OpenDialog1.FileName;
|
|---|
| 639 | AppEvents[ListBox1.ItemIndex].IconFile:= OpenDialog1.FileName;
|
|---|
| 640 | end;
|
|---|
| 641 | end;
|
|---|
| 642 |
|
|---|
| 643 | procedure TOptionsWindow.Edit12Change(Sender: TObject);
|
|---|
| 644 | begin
|
|---|
| 645 | AppEvents[ListBox1.ItemIndex].IconFile:= Edit12.Text;
|
|---|
| 646 | end;
|
|---|
| 647 |
|
|---|
| 648 | procedure TOptionsWindow.ComboBox1Change(Sender: TObject);
|
|---|
| 649 | begin
|
|---|
| 650 | Edit13.Text:= SunriseChatCore.NetworkInterfaces[ComboBox1.ItemIndex].IPAddress;
|
|---|
| 651 | end;
|
|---|
| 652 |
|
|---|
| 653 | procedure TOptionsWindow.CheckBox9Click(Sender: TObject);
|
|---|
| 654 | begin
|
|---|
| 655 | MainWindow.ServiceFunction:= CheckBox9.Checked;
|
|---|
| 656 | SpinEdit2.Visible:= MainWindow.ServiceFunction;
|
|---|
| 657 | Label16.Visible:= MainWindow.ServiceFunction;
|
|---|
| 658 | Edit13.Visible:= MainWindow.ServiceFunction;
|
|---|
| 659 | Label9.Visible:= MainWindow.ServiceFunction;
|
|---|
| 660 | end;
|
|---|
| 661 |
|
|---|
| 662 | procedure TOptionsWindow.Button11Click(Sender: TObject);
|
|---|
| 663 | begin
|
|---|
| 664 | OpenPictureDialog1.FileName:= Edit9.Text;
|
|---|
| 665 | if OpenPictureDialog1.Execute then begin
|
|---|
| 666 | CheckBox28.Checked := True;
|
|---|
| 667 | Edit9.Text:= OpenPictureDialog1.FileName;
|
|---|
| 668 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= OpenPictureDialog1.FileName;
|
|---|
| 669 | end;
|
|---|
| 670 | end;
|
|---|
| 671 |
|
|---|
| 672 | procedure TOptionsWindow.LoadUserEventOptions;
|
|---|
| 673 | begin
|
|---|
| 674 | if (ListBox2.ItemIndex>=0) and (ListBox2.ItemIndex < ListBox2.Items.Count) then
|
|---|
| 675 | with AppUserEvents[ListBox2.ItemIndex] do begin
|
|---|
| 676 | CheckBox29.Checked:= ConditionTextEnable;
|
|---|
| 677 | Edit10.Text:= ConditionText;
|
|---|
| 678 | CheckBox26.Checked:= ConditionAppEventEnable;
|
|---|
| 679 | ComboBox2.ItemIndex:= Integer(ConditionAppEvent);
|
|---|
| 680 | CheckBox30.Checked:= ConditionUserEnable;
|
|---|
| 681 | Edit11.Text:= ConditionUser;
|
|---|
| 682 |
|
|---|
| 683 | CheckBox23.Checked:= ShowWindow;
|
|---|
| 684 | CheckBox27.Checked:= ShowBalloonHint;
|
|---|
| 685 | CheckBox24.Checked:= PlaySound;
|
|---|
| 686 | CheckBox33.Checked:= PlayBeep;
|
|---|
| 687 | CheckBox32.Checked:= ShowAlertIcon;
|
|---|
| 688 | Edit14.Text:= IconFile;
|
|---|
| 689 | Edit7.Text:= SoundFile;
|
|---|
| 690 | CheckBox25.Checked:= ExecuteApplication;
|
|---|
| 691 | Edit8.Text:= ApplicationFile;
|
|---|
| 692 | CheckBox28.Checked:= ShowImage;
|
|---|
| 693 | Edit9.Text:= ImageFile;
|
|---|
| 694 | end;
|
|---|
| 695 | end;
|
|---|
| 696 |
|
|---|
| 697 | procedure TOptionsWindow.ListBox2Click(Sender: TObject);
|
|---|
| 698 | begin
|
|---|
| 699 | LoadUserEventOptions;
|
|---|
| 700 | end;
|
|---|
| 701 |
|
|---|
| 702 | procedure TOptionsWindow.CheckBox29Click(Sender: TObject);
|
|---|
| 703 | begin
|
|---|
| 704 | AppUserEvents[ListBox2.ItemIndex].ConditionTextEnable:= CheckBox29.Checked;
|
|---|
| 705 | end;
|
|---|
| 706 |
|
|---|
| 707 | procedure TOptionsWindow.Edit10Change(Sender: TObject);
|
|---|
| 708 | begin
|
|---|
| 709 | AppUserEvents[ListBox2.ItemIndex].ConditionText:= Edit10.Text;
|
|---|
| 710 | end;
|
|---|
| 711 |
|
|---|
| 712 | procedure TOptionsWindow.CheckBox26Click(Sender: TObject);
|
|---|
| 713 | begin
|
|---|
| 714 | AppUserEvents[ListBox2.ItemIndex].ConditionAppEventEnable:= CheckBox26.Checked;
|
|---|
| 715 | end;
|
|---|
| 716 |
|
|---|
| 717 | procedure TOptionsWindow.ComboBox2Change(Sender: TObject);
|
|---|
| 718 | begin
|
|---|
| 719 | AppUserEvents[ListBox2.ItemIndex].ConditionAppEvent:= ComboBox2.ItemIndex;
|
|---|
| 720 | end;
|
|---|
| 721 |
|
|---|
| 722 | procedure TOptionsWindow.CheckBox30Click(Sender: TObject);
|
|---|
| 723 | begin
|
|---|
| 724 | AppUserEvents[ListBox2.ItemIndex].ConditionUserEnable:= CheckBox30.Checked;
|
|---|
| 725 | end;
|
|---|
| 726 |
|
|---|
| 727 | procedure TOptionsWindow.Edit11Change(Sender: TObject);
|
|---|
| 728 | begin
|
|---|
| 729 | AppUserEvents[ListBox2.ItemIndex].ConditionUser:= Edit11.Text;
|
|---|
| 730 | end;
|
|---|
| 731 |
|
|---|
| 732 | procedure TOptionsWindow.CheckBox23Click(Sender: TObject);
|
|---|
| 733 | begin
|
|---|
| 734 | AppUserEvents[ListBox2.ItemIndex].ShowWindow:= CheckBox23.Checked;
|
|---|
| 735 | end;
|
|---|
| 736 |
|
|---|
| 737 | procedure TOptionsWindow.CheckBox27Click(Sender: TObject);
|
|---|
| 738 | begin
|
|---|
| 739 | AppUserEvents[ListBox2.ItemIndex].ShowBalloonHint:= CheckBox27.Checked;
|
|---|
| 740 | end;
|
|---|
| 741 |
|
|---|
| 742 | procedure TOptionsWindow.CheckBox24Click(Sender: TObject);
|
|---|
| 743 | begin
|
|---|
| 744 | AppUserEvents[ListBox2.ItemIndex].PlaySound:= CheckBox24.Checked;
|
|---|
| 745 | end;
|
|---|
| 746 |
|
|---|
| 747 | procedure TOptionsWindow.CheckBox33Click(Sender: TObject);
|
|---|
| 748 | begin
|
|---|
| 749 | AppUserEvents[ListBox2.ItemIndex].PlayBeep:= CheckBox33.Checked;
|
|---|
| 750 | end;
|
|---|
| 751 |
|
|---|
| 752 | procedure TOptionsWindow.Edit7Change(Sender: TObject);
|
|---|
| 753 | begin
|
|---|
| 754 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= Edit7.Text;
|
|---|
| 755 | end;
|
|---|
| 756 |
|
|---|
| 757 | procedure TOptionsWindow.CheckBox25Click(Sender: TObject);
|
|---|
| 758 | begin
|
|---|
| 759 | AppUserEvents[ListBox2.ItemIndex].ExecuteApplication:= CheckBox25.Checked;
|
|---|
| 760 | end;
|
|---|
| 761 |
|
|---|
| 762 | procedure TOptionsWindow.Edit8Change(Sender: TObject);
|
|---|
| 763 | begin
|
|---|
| 764 | AppUserEvents[ListBox2.ItemIndex].ApplicationFile:= Edit8.Text;
|
|---|
| 765 | end;
|
|---|
| 766 |
|
|---|
| 767 | procedure TOptionsWindow.CheckBox28Click(Sender: TObject);
|
|---|
| 768 | begin
|
|---|
| 769 | AppUserEvents[ListBox2.ItemIndex].ShowImage:= CheckBox28.Checked;
|
|---|
| 770 | end;
|
|---|
| 771 |
|
|---|
| 772 | procedure TOptionsWindow.Edit9Change(Sender: TObject);
|
|---|
| 773 | begin
|
|---|
| 774 | AppUserEvents[ListBox2.ItemIndex].ImageFile:= Edit9.Text;
|
|---|
| 775 | end;
|
|---|
| 776 |
|
|---|
| 777 | procedure TOptionsWindow.CheckBox32Click(Sender: TObject);
|
|---|
| 778 | begin
|
|---|
| 779 | AppUserEvents[ListBox2.ItemIndex].ShowAlertIcon:= CheckBox32.Checked;
|
|---|
| 780 | end;
|
|---|
| 781 |
|
|---|
| 782 | procedure TOptionsWindow.Edit14Change(Sender: TObject);
|
|---|
| 783 | begin
|
|---|
| 784 | AppUserEvents[ListBox2.ItemIndex].IconFile:= Edit14.Text;
|
|---|
| 785 | end;
|
|---|
| 786 |
|
|---|
| 787 | procedure TOptionsWindow.SpeedButton5Click(Sender: TObject);
|
|---|
| 788 | begin
|
|---|
| 789 | with MainWindow do try
|
|---|
| 790 | MediaPlayer1.FileName:= Edit7.Text;
|
|---|
| 791 | MediaPlayer1.Open;
|
|---|
| 792 | MediaPlayer1.Play;
|
|---|
| 793 | except
|
|---|
| 794 | Dialogs.ShowMessage(Localization.Item('AudioFileNotFound'));
|
|---|
| 795 | end;
|
|---|
| 796 |
|
|---|
| 797 | end;
|
|---|
| 798 |
|
|---|
| 799 | procedure TOptionsWindow.Button5Click(Sender: TObject);
|
|---|
| 800 | begin
|
|---|
| 801 | OpenDialog1.Filter:= 'Soubory WAV|*.wav|Všechny soubory|*.*';
|
|---|
| 802 | OpenDialog1.FileName:= Edit7.Text;
|
|---|
| 803 | if OpenDialog1.Execute then begin
|
|---|
| 804 | CheckBox24.Checked := True;
|
|---|
| 805 | Edit7.Text:= OpenDialog1.FileName;
|
|---|
| 806 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= OpenDialog1.FileName;
|
|---|
| 807 | end;
|
|---|
| 808 | end;
|
|---|
| 809 |
|
|---|
| 810 | procedure TOptionsWindow.Button8Click(Sender: TObject);
|
|---|
| 811 | begin
|
|---|
| 812 | OpenDialog1.Filter:= 'Spustitelné soubory|*.exe|Všechny soubory|*.*';
|
|---|
| 813 | OpenDialog1.FileName:= Edit8.Text;
|
|---|
| 814 | if OpenDialog1.Execute then begin
|
|---|
| 815 | CheckBox25.Checked := True;
|
|---|
| 816 | Edit8.Text:= OpenDialog1.FileName;
|
|---|
| 817 | AppUserEvents[ListBox2.ItemIndex].ApplicationFile:= OpenDialog1.FileName;
|
|---|
| 818 | end;
|
|---|
| 819 | end;
|
|---|
| 820 |
|
|---|
| 821 | procedure TOptionsWindow.Button12Click(Sender: TObject);
|
|---|
| 822 | begin
|
|---|
| 823 | OpenDialog1.Filter:= 'Ikony|*.ico|Všechny soubory|*.*';
|
|---|
| 824 | OpenDialog1.FileName:= Edit14.Text;
|
|---|
| 825 | if OpenDialog1.Execute then begin
|
|---|
| 826 | CheckBox32.Checked := True;
|
|---|
| 827 | Edit14.Text:= OpenDialog1.FileName;
|
|---|
| 828 | AppUserEvents[ListBox2.ItemIndex].IconFile:= OpenDialog1.FileName;
|
|---|
| 829 | end;
|
|---|
| 830 | end;
|
|---|
| 831 |
|
|---|
| 832 | procedure TOptionsWindow.ListBox2Reload;
|
|---|
| 833 | var
|
|---|
| 834 | I: Integer;
|
|---|
| 835 | begin
|
|---|
| 836 | ListBox2.Items.BeginUpdate;
|
|---|
| 837 | ListBox2.Items.Clear;
|
|---|
| 838 | for I:= 0 to High(AppUserEvents) do ListBox2.Items.Add(AppUserEvents[I].EventName);
|
|---|
| 839 | ListBox2.Items.EndUpdate;
|
|---|
| 840 | ListBox2.ItemIndex:= 0;
|
|---|
| 841 | LoadUserEventOptions;
|
|---|
| 842 | ListBox2Click(Self);
|
|---|
| 843 | end;
|
|---|
| 844 |
|
|---|
| 845 | procedure TOptionsWindow.Button14Click(Sender: TObject);
|
|---|
| 846 | begin
|
|---|
| 847 | OpenDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 848 | if OpenDialog1.Execute then begin
|
|---|
| 849 | end;
|
|---|
| 850 | end;
|
|---|
| 851 |
|
|---|
| 852 | procedure TOptionsWindow.ListBox2DblClick(Sender: TObject);
|
|---|
| 853 | begin
|
|---|
| 854 | ActionInsertToMessageExecute(Self);
|
|---|
| 855 | end;
|
|---|
| 856 |
|
|---|
| 857 | procedure TOptionsWindow.ActionAddUserEventExecute(Sender: TObject);
|
|---|
| 858 | begin
|
|---|
| 859 | SetLength(AppUserEvents,Length(AppUserEvents)+1);
|
|---|
| 860 | AppUserEvents[High(AppUserEvents)].EventName:= 'Nový '+IntToStr(High(AppUserEvents)+1);
|
|---|
| 861 | ListBox2Reload;
|
|---|
| 862 | end;
|
|---|
| 863 |
|
|---|
| 864 | procedure TOptionsWindow.ActionDeleteUserEventExecute(Sender: TObject);
|
|---|
| 865 | var
|
|---|
| 866 | I: Integer;
|
|---|
| 867 | begin
|
|---|
| 868 | with ListBox2 do if (ItemIndex>=0) and (ItemIndex<Count) then begin
|
|---|
| 869 | for I:= ItemIndex+1 to High(AppUserEvents) do
|
|---|
| 870 | AppUserEvents[I-1]:= AppUserEvents[I];
|
|---|
| 871 | SetLength(AppUserEvents,High(AppUserEvents));
|
|---|
| 872 | Items.Delete(ItemIndex);
|
|---|
| 873 | ListBox2Reload;
|
|---|
| 874 | end;
|
|---|
| 875 | end;
|
|---|
| 876 |
|
|---|
| 877 | procedure TOptionsWindow.ActionMoveUserEventUpExecute(Sender: TObject);
|
|---|
| 878 | var
|
|---|
| 879 | TempItem: TAppUserEvent;
|
|---|
| 880 | I: Integer;
|
|---|
| 881 | begin
|
|---|
| 882 | with ListBox2 do if (ItemIndex>0) and (ItemIndex<Count) then begin
|
|---|
| 883 | I:= ItemIndex;
|
|---|
| 884 | TempItem:= AppUserEvents[ItemIndex];
|
|---|
| 885 | AppUserEvents[ItemIndex]:= AppUserEvents[ItemIndex-1];
|
|---|
| 886 | AppUserEvents[ItemIndex-1]:= TempItem;
|
|---|
| 887 | ListBox2Reload;
|
|---|
| 888 | ItemIndex:= I-1;
|
|---|
| 889 | end;
|
|---|
| 890 | end;
|
|---|
| 891 |
|
|---|
| 892 | procedure TOptionsWindow.ActionMoveUserEventDownExecute(Sender: TObject);
|
|---|
| 893 | var
|
|---|
| 894 | I: Integer;
|
|---|
| 895 | TempItem: TAppUserEvent;
|
|---|
| 896 | begin
|
|---|
| 897 | with ListBox2 do if (ItemIndex>=0) and (ItemIndex<(Count-1)) then begin
|
|---|
| 898 | I:= ItemIndex;
|
|---|
| 899 | TempItem:= AppUserEvents[ItemIndex];
|
|---|
| 900 | AppUserEvents[ItemIndex]:= AppUserEvents[ItemIndex+1];
|
|---|
| 901 | AppUserEvents[ItemIndex+1]:= TempItem;
|
|---|
| 902 | ListBox2Reload;
|
|---|
| 903 | ItemIndex:= I+1;
|
|---|
| 904 | end;
|
|---|
| 905 | end;
|
|---|
| 906 |
|
|---|
| 907 | procedure TOptionsWindow.ActionImportUserEventListExecute(Sender: TObject);
|
|---|
| 908 | const
|
|---|
| 909 | Separator = '|';
|
|---|
| 910 | var
|
|---|
| 911 | Row: string;
|
|---|
| 912 | begin
|
|---|
| 913 | OpenDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 914 | if OpenDialog1.Execute then begin
|
|---|
| 915 | with TTextFileStream.Create(OpenDialog1.FileName,fmOpenRead) do try
|
|---|
| 916 | repeat
|
|---|
| 917 | Row:= Trim(ReadLn);
|
|---|
| 918 | if Row <> '' then begin
|
|---|
| 919 | SetLength(AppUserEvents, Length(AppUserEvents)+1);
|
|---|
| 920 | with AppUserEvents[High(AppUserEvents)] do begin
|
|---|
| 921 | EventName:= Copy(Row, 1, Pos(Separator, Row)-1);
|
|---|
| 922 | ConditionTextEnable:= True;
|
|---|
| 923 | ConditionText:= EventName;
|
|---|
| 924 | ShowImage:= True;
|
|---|
| 925 | ImageFile:= ExtractFileDir(OpenDialog1.FileName) + '\' + Copy(Row, Pos(Separator, Row)+1, Length(Row));
|
|---|
| 926 | end;
|
|---|
| 927 | end;
|
|---|
| 928 | until Position = Size;
|
|---|
| 929 | ListBox2Reload;
|
|---|
| 930 | finally
|
|---|
| 931 | Free;
|
|---|
| 932 | end;
|
|---|
| 933 | end;
|
|---|
| 934 | end;
|
|---|
| 935 |
|
|---|
| 936 | procedure TOptionsWindow.ActionEditUserEventCaptionExecute(
|
|---|
| 937 | Sender: TObject);
|
|---|
| 938 | begin
|
|---|
| 939 | if ListBox2.Count>0 then
|
|---|
| 940 | if not InputQuery('Změna jména události','Zadejte nové jméno uživatelské události:',AppUserEvents[ListBox2.ItemIndex].EventName) then Exit;
|
|---|
| 941 | ListBox2Reload;
|
|---|
| 942 | end;
|
|---|
| 943 |
|
|---|
| 944 | procedure TOptionsWindow.ActionInsertToMessageExecute(Sender: TObject);
|
|---|
| 945 | begin
|
|---|
| 946 | with MainWindow.ComboBox1 do Text:= Text + ListBox2.Items[ListBox2.ItemIndex];
|
|---|
| 947 | Close;
|
|---|
| 948 | end;
|
|---|
| 949 |
|
|---|
| 950 | procedure TOptionsWindow.ActionDeleteAllUserEventsExecute(Sender: TObject);
|
|---|
| 951 | begin
|
|---|
| 952 | ListBox2.Items.Clear;
|
|---|
| 953 | SetLength(AppUserEvents,0);
|
|---|
| 954 | ListBox2Reload;
|
|---|
| 955 | end;
|
|---|
| 956 |
|
|---|
| 957 | procedure TOptionsWindow.ActionSaveUserEventsListExecute(Sender: TObject);
|
|---|
| 958 | const
|
|---|
| 959 | Separator = '|';
|
|---|
| 960 | var
|
|---|
| 961 | // Row: string;
|
|---|
| 962 | I: Integer;
|
|---|
| 963 | FileMode: Word;
|
|---|
| 964 | begin
|
|---|
| 965 | SaveDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 966 | if SaveDialog1.Execute then begin
|
|---|
| 967 | if FileExists(SaveDialog1.FileName) then FileMode:= fmOpenWrite else
|
|---|
| 968 | FileMode:= fmCreate;
|
|---|
| 969 | with TTextFileStream.Create(SaveDialog1.FileName, FileMode) do try
|
|---|
| 970 | for I:= 0 to High(AppUserEvents) do with AppUserEvents[I] do
|
|---|
| 971 | WriteLn(ConditionText + Separator + ExtractFileName(ImageFile));
|
|---|
| 972 | finally
|
|---|
| 973 | Free;
|
|---|
| 974 | end;
|
|---|
| 975 | end;
|
|---|
| 976 | end;
|
|---|
| 977 |
|
|---|
| 978 | procedure TOptionsWindow.SaveUserEvents;
|
|---|
| 979 | begin
|
|---|
| 980 | MainWindow.LoadAppUserEventsFromRegistry(True);
|
|---|
| 981 | end;
|
|---|
| 982 |
|
|---|
| 983 | procedure TOptionsWindow.TrackBar2Change(Sender: TObject);
|
|---|
| 984 | begin
|
|---|
| 985 | with MainWindow do begin
|
|---|
| 986 | MPSetVolume(MediaPlayer1, 1000 - TrackBar2.Position);
|
|---|
| 987 | end;
|
|---|
| 988 | end;
|
|---|
| 989 |
|
|---|
| 990 | procedure TOptionsWindow.FormClose(Sender: TObject;
|
|---|
| 991 | var Action: TCloseAction);
|
|---|
| 992 | begin
|
|---|
| 993 | with MainWindow do MPSetVolume(MediaPlayer1, SoundVolume);
|
|---|
| 994 | end;
|
|---|
| 995 |
|
|---|
| 996 | end.
|
|---|