home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / ArsClip / source.zip / UnitFrmConfig.pas < prev    next >
Pascal/Delphi Source File  |  2004-10-16  |  40KB  |  1,209 lines

  1. unit UnitFrmConfig;
  2. {
  3.     Purpose:
  4.         This form configures the hotkey as well as receives messages
  5.         when the hotkey is pressed.
  6.  
  7.         This form also reads the current configuration and passes those
  8.         option onto the responsible form (mainly FrmMainPopup)
  9.  
  10.     Updates:
  11.         New panel for Popup "Config -> Popup - Keystrokes"
  12.         Updated for option to show popup on double-click
  13.         Removed Items now saved << no longer needed with cached removed items
  14.  
  15.  
  16.         --------------
  17.         New Form Mode show option
  18.         Fixed logic for "Show Permanent Items" and selecting a
  19.         display method.
  20.         ------------
  21.         New "SHIFT+INSERT" pasting options
  22.         
  23.         Moved the popup "show" options to their own panel
  24.         New "Show Options" subitem under Popup
  25.         New user definable function key for copy & permanent
  26.         popup keystrokes.
  27.  
  28.  
  29.         New Clipboard option - "Disable clipboard Monitoring when Scroll Lock is on"
  30.  
  31.         New look
  32.         New way to do hotkeys
  33.  
  34.         Used ini.ReadInteger where appropriate
  35.         Using UnitClipQueue
  36. }
  37. interface
  38.  
  39. uses
  40.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  41.   Dialogs, StdCtrls, ComCtrls, ExtCtrls, ImgList, UnitHotKey;
  42.  
  43. type
  44.   TFrmConfig = class(TForm)
  45.     btnSave: TButton;
  46.     btnCancel: TButton;
  47.     tvOptions: TTreeView;
  48.     ImageList1: TImageList;
  49.     FontDialog: TFontDialog;
  50.     pcPanels: TPageControl;
  51.     TabSheet1: TTabSheet;
  52.     TabSheet2: TTabSheet;
  53.     TabSheet3: TTabSheet;
  54.     TabSheet4: TTabSheet;
  55.     TabSheet5: TTabSheet;
  56.     TabSheet6: TTabSheet;
  57.     TabSheet7: TTabSheet;
  58.     TabSheet8: TTabSheet;
  59.     TabSheet9: TTabSheet;
  60.     pHotkey: TPanel;
  61.     Shape3: TShape;
  62.     Shape1: TShape;
  63.     lblKeyname: TLabel;
  64.     Label5: TLabel;
  65.     Shape2: TShape;
  66.     Label12: TLabel;
  67.     lblTooltipKeyname: TLabel;
  68.     Label16: TLabel;
  69.     lblPreviousTooltipKeyname: TLabel;
  70.     bEditPopupHotkey: TButton;
  71.     cbUseTooltipHotkey: TCheckBox;
  72.     bEditToolTipHotkey: TButton;
  73.     bEditPreviousToolTipHotkey: TButton;
  74.     pClipboard: TPanel;
  75.     Label1: TLabel;
  76.     cbCopyIcons: TCheckBox;
  77.     cbDisable: TCheckBox;
  78.     cbDisableWhenScrollLock: TCheckBox;
  79.     cbDisableSystemTrayIconNotification: TCheckBox;
  80.     cbRemember: TCheckBox;
  81.     cbDisableChainNotification: TCheckBox;
  82.     txtOldHistorySize: TEdit;
  83.     udRemovedSize: TUpDown;
  84.     cbEnableExtendedChainChecking: TCheckBox;
  85.     cbAutofixURLs: TCheckBox;
  86.     pClipboard_TextItems: TPanel;
  87.     Label2: TLabel;
  88.     txtQueueSize: TEdit;
  89.     udQueueSize: TUpDown;
  90.     cbMonitorFilenames: TCheckBox;
  91.     cbMoveDuplicate: TCheckBox;
  92.     pClipboard_NonText: TPanel;
  93.     Label7: TLabel;
  94.     Label8: TLabel;
  95.     Label9: TLabel;
  96.     cbOtherItems: TCheckBox;
  97.     txtOtherSize: TEdit;
  98.     txtOtherSizeLimitKB: TEdit;
  99.     udOtherSize: TUpDown;
  100.     pPasting: TPanel;
  101.     Label3: TLabel;
  102.     rbTyping: TRadioButton;
  103.     rbPaste: TRadioButton;
  104.     rbClipboardOnly: TRadioButton;
  105.     Panel1: TPanel;
  106.     Label4: TLabel;
  107.     rbOtherClipboardOnly: TRadioButton;
  108.     rbOtherPaste: TRadioButton;
  109.     rbPasteSI: TRadioButton;
  110.     cbPasteComplex: TCheckBox;
  111.     pPopup: TPanel;
  112.     Label6: TLabel;
  113.     Label17: TLabel;
  114.     cbMoveFirst: TCheckBox;
  115.     cbUseKeyboard: TCheckBox;
  116.     cbPopupDoubleclick: TCheckBox;
  117.     txtCharacters: TEdit;
  118.     udCharacters: TUpDown;
  119.     cbPopupDoubleclickTray: TCheckBox;
  120.     cbDisplayUnicode: TCheckBox;
  121.     cbDisplayAtMouseCursor: TCheckBox;
  122.     cbPopupSingleclickTray: TCheckBox;
  123.     cbPopupSingleclick: TCheckBox;
  124.     bntSetFont: TButton;
  125.     pPopupShow: TPanel;
  126.     btnEditPermanentItems: TButton;
  127.     cbUsePermanentItems: TCheckBox;
  128.     cbPasteAll: TCheckBox;
  129.     cbShowLast: TCheckBox;
  130.     cbShowCurrent: TCheckBox;
  131.     cbShowEditHistory: TCheckBox;
  132.     cbShowFormMode: TCheckBox;
  133.     cbShowTypes: TCheckBox;
  134.     GroupBox1: TGroupBox;
  135.     cbShowSwitchTo: TCheckBox;
  136.     cbShowAllItems: TCheckBox;
  137.     Panel3: TPanel;
  138.     cbPermanentItemsSubmenu: TCheckBox;
  139.     cbShowPermanentItemGroups: TCheckBox;
  140.     pTooltipPopup: TPanel;
  141.     cbFullHeader: TCheckBox;
  142.     cbCopyVisibleItem: TCheckBox;
  143.     pPopupKeystrokes: TPanel;
  144.     Label13: TLabel;
  145.     Label14: TLabel;
  146.     Label15: TLabel;
  147.     Label10: TLabel;
  148.     Label11: TLabel;
  149.     cboCopyClickKey: TComboBox;
  150.     cboPermanentClickKey: TComboBox;
  151.     cboMimicClickKey: TComboBox;
  152.     Panel2: TPanel;
  153.     rbCtrlClickRun: TRadioButton;
  154.     rbCtrlClickMenu: TRadioButton;
  155.     procedure FormCreate(Sender: TObject);
  156.     procedure FormDestroy(Sender: TObject);
  157.     procedure cbKeyChange(Sender: TObject);
  158.     procedure cbUseKeyboardClick(Sender: TObject);
  159.     procedure FormShow(Sender: TObject);
  160.     procedure txtQueueSizeKeyPress(Sender: TObject; var Key: Char);
  161.     procedure udQueueSizeClick(Sender: TObject; Button: TUDBtnType);
  162.     procedure cbDisableClick(Sender: TObject);
  163.     procedure cbUsePermanentItemsClick(Sender: TObject);
  164.     procedure btnEditPermanentItemsClick(Sender: TObject);
  165.     procedure rbTypingClick(Sender: TObject);
  166.     procedure rbPasteClick(Sender: TObject);
  167.     procedure btnSaveClick(Sender: TObject);
  168.     procedure btnCancelClick(Sender: TObject);
  169.     procedure cbMonitorFilenamesClick(Sender: TObject);
  170.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  171.     procedure cbPasteAllClick(Sender: TObject);
  172.     procedure rbClipboardOnlyClick(Sender: TObject);
  173.     procedure cbMoveFirstClick(Sender: TObject);
  174.     procedure cbShowCurrentClick(Sender: TObject);
  175.     procedure udCharactersClick(Sender: TObject; Button: TUDBtnType);
  176.     procedure cbRememberClick(Sender: TObject);
  177.     procedure cbCopyIconsClick(Sender: TObject);
  178.     procedure cbMoveDuplicateClick(Sender: TObject);
  179.     procedure cbShowLastClick(Sender: TObject);
  180.     procedure txtOldHistorySizeKeyPress(Sender: TObject; var Key: Char);
  181.     procedure udRemovedSizeClick(Sender: TObject; Button: TUDBtnType);
  182.     procedure cbOtherItemsClick(Sender: TObject);
  183.     procedure txtOtherSizeKeyPress(Sender: TObject; var Key: Char);
  184.     procedure txtOtherSizeLimitKBChange(Sender: TObject);
  185.     procedure udOtherSizeClick(Sender: TObject; Button: TUDBtnType);
  186.     procedure cbShowPermanentItemGroupsClick(Sender: TObject);
  187.     procedure tvOptionsClick(Sender: TObject);
  188.     procedure tvOptionsCollapsing(Sender: TObject; Node: TTreeNode;
  189.       var AllowCollapse: Boolean);
  190.     procedure bEditPopupHotkeyClick(Sender: TObject);
  191.     procedure cbDisableWhenScrollLockClick(Sender: TObject);
  192.     procedure cbShowEditHistoryClick(Sender: TObject);
  193.     procedure cbPermanentItemsSubmenuClick(Sender: TObject);
  194.     procedure cbDisableSystemTrayIconNotificationClick(Sender: TObject);
  195.     procedure cboCopyClickKeyClick(Sender: TObject);
  196.     procedure cboPermanentClickKeyClick(Sender: TObject);
  197.     procedure rbPasteSIClick(Sender: TObject);
  198.     procedure cboMimicClickKeyClick(Sender: TObject);
  199.     procedure rbCtrlClickRunClick(Sender: TObject);
  200.     procedure rbCtrlClickMenuClick(Sender: TObject);
  201.     procedure tvOptionsChange(Sender: TObject; Node: TTreeNode);
  202.     procedure cbShowFormModeClick(Sender: TObject);
  203.     procedure bEditToolTipHotkeyClick(Sender: TObject);
  204.     procedure bEditPreviousToolTipHotkeyClick(Sender: TObject);
  205.     procedure cbPopupDoubleclickClick(Sender: TObject);
  206.     procedure cbPopupDoubleclickTrayClick(Sender: TObject);
  207.     procedure cbShowSwitchToClick(Sender: TObject);
  208.     procedure bntSetFontClick(Sender: TObject);
  209.  
  210.  
  211.  
  212.  
  213.   private
  214.     { Private declarations }
  215.     HotKeyPopup : TACHotKey;
  216.     TTHotKeyPopup : TACHotKey;
  217.     PTTHotKeyPopup : TACHotKey;
  218.  
  219.     LastShownPanel : TPanel;
  220.  
  221.     Hotkey_Ctrl : boolean;
  222.     Hotkey_Alt : boolean;
  223.     Hotkey_Winkey : boolean;
  224.     Hotkey_Shift : boolean;
  225.     Hotkey_Key :  word;
  226.  
  227.     TTHotkey_Ctrl : boolean;
  228.     TTHotkey_Alt : boolean;
  229.     TTHotkey_Winkey : boolean;
  230.     TTHotkey_Shift : boolean;
  231.     TTHotkey_Key :  word;
  232.  
  233.     PTTHotkey_Ctrl : boolean;
  234.     PTTHotkey_Alt : boolean;
  235.     PTTHotkey_Winkey : boolean;
  236.     PTTHotkey_Shift : boolean;
  237.     PTTHotkey_Key :  word;
  238.  
  239.     procedure HotkeySave;
  240.     procedure HotkeyLoad;
  241.     function GetINIFileName: string;
  242.     {function HotKeyAssign(
  243.             Ctrl: boolean; Alt: boolean; Shift: boolean; WinKey: boolean;
  244.             Keystroke: word; FunctionKey : boolean): boolean;
  245.     //function HotKeyRelease(): boolean;
  246.     }
  247.     function GetHumanReadableHotkey: string;
  248.     function GetHumanReadableTTHotkey : string;
  249.     function GetHumanReadablePTTHotkey : string;
  250.     {function SetHotKey : boolean;}
  251.  
  252.  
  253.   public
  254.     function GetHotKeyID: integer;
  255.     function GetTTHotKeyID: integer;
  256.     function GetPTTHotKeyID: integer;
  257.  
  258.     procedure SaveLastPermPath;
  259.     
  260.     { Public declarations }
  261.   end;
  262.  
  263. var
  264.   FrmConfig: TFrmConfig;
  265.  
  266. implementation
  267.  
  268. uses
  269.     INIFiles,
  270.     UnitFrmClipboardManager,
  271.     UnitFrmMainPopup, UnitClipQueue, UnitOtherQueue, UnitFrmHotKey,
  272.   UnitFrmSysTrayMenu, UnitFrmPermanentNew, UnitFrmRemoved, UnitPaste,
  273.   UnitMisc, UnitfrmDummyUnicodePopup;
  274.  
  275.  
  276.  
  277.  
  278. {$R *.dfm}
  279.  
  280.  
  281.  
  282.  
  283. {
  284. --========================
  285. -- // Hook/ Release    //
  286. --========================
  287.  
  288. }
  289. procedure TFrmConfig.FormCreate(Sender: TObject);
  290. var     tn : TTreeNode;
  291.     i : integer;
  292. begin
  293.     self.HotkeyLoad();
  294.  
  295.     //
  296.     //Hook onto keystoke
  297.     //
  298.     TTHotKeyPopup := nil;
  299.     PTTHotKeyPopup := nil;
  300.     try
  301.         HotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyHotKey',
  302.             Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift,
  303.             Hotkey_Winkey, Hotkey_Key
  304.         );
  305.     except
  306.         ShowMessage('Failed to set hotkey ' + self.lblKeyname.Caption );
  307.     end;
  308.     try
  309.         if (self.cbUseTooltipHotkey.checked) then begin
  310.             TTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyTTHotKey',
  311.                 TTHotkey_Ctrl, TTHotkey_Alt, TTHotkey_Shift,
  312.                 TTHotkey_Winkey, TTHotkey_Key
  313.             );
  314.         end;
  315.     except
  316.         ShowMessage('Failed to set hotkey ' + self.lblTooltipKeyname.Caption );
  317.     end;
  318.     try
  319.         if (self.cbUseTooltipHotkey.checked) then begin
  320.             PTTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyPTTHotKey',
  321.                 PTTHotkey_Ctrl, PTTHotkey_Alt, PTTHotkey_Shift,
  322.                 PTTHotkey_Winkey, PTTHotkey_Key
  323.             );
  324.         end;
  325.     except
  326.         ShowMessage('Failed to set hotkey ' + self.lblPreviousTooltipKeyname.Caption );
  327.     end;
  328.  
  329.  
  330.     {
  331.     if (rbKey.Checked) then begin
  332.         w := ord(txtKey.text[1]);
  333.     end else begin
  334.         w := Hotkey_Key;
  335.     end;
  336.     {
  337.     if not self.HotKeyAssign(Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift,
  338.         Hotkey_Winkey, Hotkey_Key, false) then begin
  339.         ShowMessage('ERROR: Unable to assign a hotkey. Please change the key.');
  340.     end;
  341.     }
  342.  
  343.     // expand all tree branches
  344.     tn := tvOptions.Items.GetFirstNode;
  345.     while tn <> nil do begin
  346.         if tn.HasChildren then
  347.             tn.expand(true);
  348.         tn := tn.getNextSibling;
  349.     end;
  350.  
  351.     for i := 0 to pcPanels.PageCount - 1 do begin
  352.         pcPanels.Pages[i].TabVisible := false;
  353.     end;
  354.  
  355.     // click the first node by default
  356.     tvOptions.Selected := tvOptions.Items.GetFirstNode;
  357.     tvOptions.HideSelection := false;
  358.     tvOptions.OnClick(self);
  359. end;
  360.  
  361.  
  362. procedure TFrmConfig.FormDestroy(Sender: TObject);
  363. begin
  364.     MyFree(HotKeyPopup);
  365.     MyFree(TTHotKeyPopup);
  366.     MyFree(PTTHotKeyPopup);
  367. end;
  368.  
  369. procedure TFrmConfig.FormShow(Sender: TObject);
  370. begin
  371.     Windows.SetForegroundWindow(self.Handle);
  372. end;
  373.  
  374.  
  375.  
  376.  
  377.  
  378. function TFrmConfig.GetHotKeyID: integer;
  379. begin
  380.     result := HotKeyPopup.GetID;
  381. end;
  382. function TFrmConfig.GetTTHotKeyID: integer;
  383. begin
  384.     result := TTHotKeyPopup.GetID;
  385. end;
  386.  
  387. function TFrmConfig.GetPTTHotKeyID: integer;
  388. begin
  389.     result := PTTHotKeyPopup.GetID;
  390. end;
  391.  
  392. function TFrmConfig.GetHumanReadableHotkey : string;
  393. var b : boolean;
  394. begin
  395.     result := FrmHotkey.GetHumanReadable(Hotkey_alt, Hotkey_shift, Hotkey_ctrl, Hotkey_winkey, Hotkey_key, b);
  396. end;
  397.  
  398.  
  399. function TFrmConfig.GetHumanReadableTTHotkey : string;
  400. var b : boolean;
  401. begin
  402.     result := FrmHotkey.GetHumanReadable(TTHotkey_alt, TTHotkey_shift, TTHotkey_ctrl, TTHotkey_winkey, TTHotkey_key, b);
  403. end;
  404.  
  405. function TFrmConfig.GetHumanReadablePTTHotkey: string;
  406. var b : boolean;
  407. begin
  408.     result := FrmHotkey.GetHumanReadable(TTHotkey_alt, PTTHotkey_shift, PTTHotkey_ctrl, PTTHotkey_winkey, PTTHotkey_key, b);
  409. end;
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417. {
  418. --============================
  419. -- // Load/Save hotkey info //
  420. --============================
  421.  
  422. }
  423. const ArsClip = 'ArsClip';
  424.  
  425. procedure TFrmConfig.SaveLastPermPath;
  426. var ini: TInifile;
  427. begin
  428.     ini := TInifile.Create( self.GetINIFileName );
  429.  
  430.     ini.WriteString(ArsClip, 'LastPermanentPath', frmPermanent.GetPermanentPath);
  431.     MyFree(ini);
  432. end;
  433.  
  434. function TFrmConfig.GetINIFileName: string;
  435. begin
  436.     Result := ExtractFilePath ( application.ExeName ) + 'arsclip.ini';
  437. end;
  438.  
  439. procedure TFrmConfig.HotkeySave;
  440. var ini: TInifile;
  441. begin
  442.     ini := TInifile.Create( self.GetINIFileName );
  443.  
  444.     //
  445.     // Hotkey Panel
  446.     //
  447.     ini.WriteInteger(ArsClip,'Hotkey_Key', Hotkey_Key);
  448.     ini.WriteBool(ArsClip,'Hotkey_Alt', Hotkey_Alt);
  449.     ini.WriteBool(ArsClip,'Hotkey_Shift', Hotkey_Shift);
  450.     ini.WriteBool(ArsClip,'Hotkey_Ctrl', Hotkey_Ctrl);
  451.     ini.WriteBool(ArsClip,'Hotkey_Winkey', Hotkey_Winkey);
  452.  
  453.     ini.WriteBool(ArsClip,'UseTooltipHotkey', cbUseTooltipHotkey.Checked );
  454.     ini.WriteInteger(ArsClip,'TTHotkey_Key', TTHotkey_Key);
  455.     ini.WriteBool(ArsClip,'TTHotkey_Alt', TTHotkey_Alt);
  456.     ini.WriteBool(ArsClip,'TTHotkey_Shift', TTHotkey_Shift);
  457.     ini.WriteBool(ArsClip,'TTHotkey_Ctrl', TTHotkey_Ctrl);
  458.     ini.WriteBool(ArsClip,'TTHotkey_Winkey', TTHotkey_Winkey);
  459.  
  460.     ini.WriteInteger(ArsClip,'PTTHotkey_Key', PTTHotkey_Key);
  461.     ini.WriteBool(ArsClip,'PTTHotkey_Alt', PTTHotkey_Alt);
  462.     ini.WriteBool(ArsClip,'PTTHotkey_Shift', PTTHotkey_Shift);
  463.     ini.WriteBool(ArsClip,'PTTHotkey_Ctrl', PTTHotkey_Ctrl);
  464.     ini.WriteBool(ArsClip,'PTTHotkey_Winkey', PTTHotkey_Winkey);
  465.  
  466.  
  467.     //----------
  468.     //'Popup' panel
  469.  
  470.     ini.WriteBool(Arsclip, 'MoveSelectedToFirst', cbMoveFirst.Checked );
  471.  
  472.     if (cbUseKeyboard.Checked) then begin
  473.         ini.WriteString(ArsClip, 'PopupUseKeyboard', 'Y');
  474.     end else begin
  475.         ini.WriteString(ArsClip, 'PopupUseKeyboard', 'N');
  476.     end;
  477.     ini.WriteInteger(ArsClip, 'CharactersToShow', udCharacters.position);
  478.     ini.WriteBool(ArsClip, cbDisplayUnicode.Name, cbDisplayUnicode.checked );
  479.     ini.WriteBool(ArsClip, cbDisplayAtMouseCursor.Name, cbDisplayAtMouseCursor.checked);
  480.  
  481.     ini.WriteBool(Arsclip, 'PopupDoubleclick', cbPopupDoubleclick.checked);
  482.     ini.WriteBool(Arsclip, 'PopupDoubleclickTray', cbPopupDoubleclickTray.checked);
  483.     ini.WriteBool(Arsclip, cbPopupSingleclickTray.Name, cbPopupSingleclickTray.checked);
  484.     ini.WriteBool(Arsclip, cbPopupSingleclick.Name, cbPopupSingleclick.Checked);
  485.  
  486.     //
  487.     
  488.     ini.WriteInteger(ArsClip, 'CopyClickKey', cboCopyClickKey.ItemIndex  );
  489.     ini.WriteInteger(ArsClip, 'PermanentClickKey', cboPermanentClickKey.ItemIndex );
  490.     ini.WriteInteger(ArsClip, 'MimicClickKey', cboMimicClickKey.ItemIndex );
  491.     ini.WriteBool(ArsClip, rbCtrlClickRun.Name, rbCtrlClickRun.Checked );
  492.     ini.WriteBool(ArsClip, rbCtrlClickMenu.Name, rbCtrlClickMenu.Checked );
  493.  
  494.  
  495.  
  496.     //
  497.  
  498.     ini.WriteInteger(ArsClip, 'QueueSize', udQueueSize.position);
  499.     ini.WriteInteger(ArsClip, 'RemovedItemsSize', udRemovedSize.Position);
  500.  
  501.     if (cbDisable.Checked) then begin
  502.         ini.WriteString(ArsClip, 'DisableMonitoring', 'Y');
  503.     end else begin
  504.         ini.WriteString(ArsClip, 'DisableMonitoring', 'N');
  505.     end;
  506.     ini.WriteBool(ArsClip, 'DisableWhenScrollLock', cbDisableWhenScrollLock.checked);
  507.     ini.WriteBool(ArsClip, 'CopyIcons', cbCopyIcons.checked);
  508.     ini.WriteBool(ArsClip, 'DisableSystemTrayIconNotification', cbDisableSystemTrayIconNotification.Checked   );
  509.     ini.WriteBool(ArsClip, cbDisableChainNotification.name, cbDisableChainNotification.checked );
  510.     ini.WriteBool(ArsClip, cbEnableExtendedChainChecking.Name, cbEnableExtendedChainChecking.Checked);
  511.  
  512.     if (cbUsePermanentItems.Checked) then begin
  513.         ini.WriteString(ArsClip, 'UsePermanentItems', 'Y');
  514.     end else begin
  515.         ini.WriteString(ArsClip, 'UsePermanentItems', 'N');
  516.     end;
  517.     ini.WriteString(ArsClip, 'LastPermanentPath', frmPermanent.GetPermanentPath);
  518.  
  519.     ini.WriteBool(ArsClip, cbShowSwitchTo.Name, cbShowSwitchTo.Checked);
  520.     ini.WriteBool(ArsClip,'ShowPermanentItemGroups', cbShowPermanentItemGroups.checked );
  521.     ini.WriteBool(ArsClip, 'ShowPermanentItemSubmenu', cbPermanentItemsSubmenu.Checked );
  522.     ini.WriteBool(ArsClip, 'ShowFormMode', cbShowFormMode.Checked);
  523.     if (rbTyping.Checked) then begin
  524.         ini.WriteString(ArsClip,'PasteMethod', 'MimicTyping');
  525.     end else if (rbPaste.checked) then begin
  526.         ini.WriteString(ArsClip, 'PasteMethod', 'CTRL+V');
  527.     end else if (rbPasteSI.Checked) then begin
  528.         ini.WriteString(ArsClip, 'PasteMethod', 'SHIFT+INSERT');
  529.     end else begin
  530.         ini.WriteString(ArsClip, 'PasteMethod', 'ClipboardOnly');
  531.     end;
  532.     ini.WriteBool(ArsClip, cbPasteComplex.Name, cbPasteComplex.Checked);
  533.  
  534.  
  535.     ini.WriteBool(ArsClip, 'MonitorFilenames', cbMonitorFilenames.checked);
  536.     ini.WriteBool(ArsClip, 'ShowPasteAll', cbPasteAll.checked );
  537.  
  538.     ini.WriteBool(ArsClip, 'ShowCurrent', cbShowCurrent.checked );
  539.  
  540.     ini.WriteBool(ArsClip, 'RememberHistory', cbRemember.checked);
  541.  
  542.     ini.WriteBool(ArsClip, 'MoveDuplicate', cbMoveDuplicate.checked );
  543.     ini.WriteBool(ArsClip, 'ShowLast', cbShowLast.checked);
  544.     ini.WriteBool(ArsClip, 'ShowEditHistory', cbShowEditHistory.Checked);
  545.     ini.WriteBool(ArsClip, cbShowTypes.Name, cbShowTypes.checked);
  546.     ini.WriteBool(ArsClip, cbAutofixURLs.Name, cbAutofixURLs.Checked);
  547.     ini.WriteBool(ArsClip, cbShowAllItems.Name, cbShowAllItems.checked);
  548.     //-------------------
  549.     // Non-text items
  550.     //-------------------
  551.     ini.WriteBool(ArsClip,'EnableOtherItems', cbOtherItems.Checked);
  552.     ini.WriteInteger(ArsClip, 'OtherSize', udOtherSize.Position);
  553.     ini.WriteInteger(ArsClip,'OtherSizeLimitKB', StrToInt(txtOtherSizeLimitKB.text));
  554.  
  555.     if (rbOtherPaste.Checked) then begin
  556.         ini.WriteString(ArsClip, 'OtherPasteMethod', 'CTRL+V' );
  557.     end else begin
  558.         ini.WriteString(ArsClip, 'OtherPasteMethod',  'ClipboardOnly');
  559.     end;
  560.  
  561.     //-------------
  562.     // Tooltip
  563.     //-------------
  564.     ini.WriteBool(ArsClip,'FullHeader', cbFullHeader.Checked);
  565.     ini.WriteBool(ArsClip,'CopyVisibleItem', cbCopyVisibleItem.Checked);
  566.     //lblKeyname.Caption := self.GetHumanReadableHotkey;
  567.     MyFree(ini);
  568. end;
  569.  
  570. procedure TFrmConfig.HotkeyLoad;
  571. var ini: TInifile;
  572. begin
  573.     //
  574.     // read last assigned hotkey
  575.     // CTRL+SHIFT+Z is default
  576.     //
  577.     // fake the user selecting the Modifier and the Normal Key
  578.  
  579.     ini := TInifile.Create( self.GetINIFileName );
  580.  
  581.     FrmDummyUnicodePopup.Font.Name := ini.ReadString('Font','Name', FrmDummyUnicodePopup.Font.Name);
  582.     FrmDummyUnicodePopup.Font.Charset := ini.ReadInteger('Font','CharSet', FrmDummyUnicodePopup.Font.Charset);
  583.     FrmDummyUnicodePopup.Font.Color := ini.ReadInteger('Font','Color', FrmDummyUnicodePopup.Font.Color);
  584.     FrmDummyUnicodePopup.Font.Size := ini.ReadInteger('Font','Size', FrmDummyUnicodePopup.Font.Size);
  585.  
  586.     FontDialog.Font := FrmDummyUnicodePopup.Font;
  587.  
  588.     //----------
  589.     // HotKey
  590.     //----------
  591.     Hotkey_Key := ini.ReadInteger(ArsClip,'Hotkey_Key', Ord('Z'));
  592.     Hotkey_Alt := ini.ReadBool(ArsClip,'Hotkey_Alt', false);
  593.     Hotkey_Shift := ini.ReadBool(ArsClip,'Hotkey_Shift', true);
  594.     Hotkey_Ctrl := ini.ReadBool(ArsClip,'Hotkey_Ctrl', true);
  595.     Hotkey_Winkey := ini.ReadBool(ArsClip,'Hotkey_Winkey', false);
  596.  
  597.     cbUseTooltipHotkey.Checked := ini.ReadBool(ArsClip,'UseTooltipHotkey',false);
  598.     TTHotkey_Key := ini.ReadInteger(ArsClip,'TTHotkey_Key', Ord('X'));
  599.     TTHotkey_Alt := ini.ReadBool(ArsClip,'TTHotkey_Alt', false);
  600.     TTHotkey_Shift := ini.ReadBool(ArsClip,'TTHotkey_Shift', true);
  601.     TTHotkey_Ctrl := ini.ReadBool(ArsClip,'TTHotkey_Ctrl', true);
  602.     TTHotkey_Winkey := ini.ReadBool(ArsClip,'TTHotkey_Winkey', false);
  603.  
  604.     PTTHotkey_Key := ini.ReadInteger(ArsClip,'PTTHotkey_Key', Ord('C'));
  605.     PTTHotkey_Alt := ini.ReadBool(ArsClip,'PTTHotkey_Alt', false);
  606.     PTTHotkey_Shift := ini.ReadBool(ArsClip,'PTTHotkey_Shift', true);
  607.     PTTHotkey_Ctrl := ini.ReadBool(ArsClip,'PTTHotkey_Ctrl', true);
  608.     PTTHotkey_Winkey := ini.ReadBool(ArsClip,'PTTHotkey_Winkey', false);
  609.  
  610.     //----------------
  611.     // 'Popup' panel
  612.     //----------------
  613.     cbMoveFirst.Checked := ini.ReadBool(ArsClip, 'MoveSelectedToFirst', false);
  614.     cbUseKeyboard.Checked := (ini.ReadString(ArsClip,'PopupUseKeyboard', 'Y') = 'Y');
  615.     cbPopupDoubleclick.checked := ini.ReadBool(Arsclip, 'PopupDoubleclick', false);
  616.     cbPopupDoubleclickTray.checked := ini.ReadBool(Arsclip, 'PopupDoubleclickTray', false);   
  617.     udCharacters.position := ini.ReadInteger(ArsClip, 'CharactersToShow', 30);
  618.     frmMainPopup.SetVisibleCharacterCount(udCharacters.position);
  619.     cboCopyClickKey.ItemIndex :=     ini.ReadInteger(ArsClip, 'CopyClickKey', 0 );
  620.     cboPermanentClickKey.ItemIndex :=    ini.ReadInteger(ArsClip, 'PermanentClickKey', 1);
  621.     cboMimicClickKey.ItemIndex := ini.ReadInteger(ArsClip, 'MimicClickKey', 2 );
  622.     rbCtrlClickRun.Checked := ini.ReadBool(ArsClip, rbCtrlClickRun.Name, false);
  623.     rbCtrlClickMenu.Checked := ini.ReadBool(ArsClip, rbCtrlClickMenu.name, true );
  624.     cbDisplayUnicode.checked := ini.ReadBool(ArsClip, cbDisplayUnicode.Name,  false);
  625.     cbDisplayAtMouseCursor.checked :=ini.ReadBool(ArsClip, cbDisplayAtMouseCursor.Name, false);
  626.  
  627.     cbPopupSingleclickTray.checked := ini.ReadBool(Arsclip, cbPopupSingleclickTray.Name, false);
  628.     cbPopupSingleclick.Checked := ini.ReadBool(Arsclip, cbPopupSingleclick.Name, false);
  629.  
  630.  
  631.     self.cboCopyClickKeyClick(self);
  632.     self.cboPermanentClickKeyClick(self);
  633.     self.cboMimicClickKeyClick(self);
  634.     // setting the ItemIndex doesn't auto set of any event
  635.  
  636.     //-------------------
  637.     // Show Options
  638.     //-------------------
  639.  
  640.     cbShowEditHistory.checked := ini.ReadBool(ArsClip,'ShowEditHistory', false);
  641.     cbShowCurrent.Checked := ini.ReadBool(ArsClip, 'ShowCurrent', false );
  642.     cbShowLast.Checked := ini.ReadBool(ArsClip,'ShowLast', true);
  643.     cbPasteAll.Checked := ini.ReadBool(ArsClip, 'ShowPasteAll', true);
  644.     cbUsePermanentItems.Checked := (ini.ReadString(ArsClip,'UsePermanentItems', 'N') = 'Y');
  645.     cbShowSwitchTo.Checked := ini.ReadBool(ArsClip, cbShowSwitchTo.Name, true);
  646.     cbShowPermanentItemGroups.checked := ini.ReadBool(ArsClip,'ShowPermanentItemGroups', true );
  647.     cbPermanentItemsSubmenu.checked := ini.Readbool(ArsClip,'ShowPermanentItemSubmenu', false);
  648.     cbShowFormMode.Checked := ini.ReadBool(ArsClip, 'ShowFormMode', false);
  649.     cbShowTypes.checked  := ini.ReadBool(ArsClip, cbShowTypes.Name, true);
  650.     cbShowAllItems.checked := ini.ReadBool(ArsClip, cbShowAllItems.Name, false);
  651.     
  652.     //-------------------
  653.     // Pasting
  654.     //-------------------
  655.     rbTyping.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'MimicTyping';
  656.     rbPaste.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'CTRL+V';
  657.     rbClipboardOnly.checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'ClipboardOnly';
  658.     rbPasteSI.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'SHIFT+INSERT') = 'SHIFT+INSERT';
  659.     rbOtherClipboardOnly.Checked := ini.ReadString(ArsClip, 'OtherPasteMethod',  'ClipboardOnly') = 'ClipboardOnly';
  660.     rbOtherPaste.Checked := ini.ReadString(ArsClip, 'OtherPasteMethod',  'ClipboardOnly') = 'CTRL+V';
  661.     cbPasteComplex.Checked := ini.ReadBool(ArsClip, cbPasteComplex.Name, false);
  662.  
  663.     //-------------------
  664.     // Clipboard
  665.     //-------------------
  666.     cbCopyIcons.Checked := ini.ReadBool(ArsClip,'CopyIcons', true);
  667.     cbDisable.Checked := (ini.ReadString(ArsClip,'DisableMonitoring','N') = 'Y');
  668.     cbDisableWhenScrollLock.Checked := ini.ReadBool(ArsClip, 'DisableWhenScrollLock', false);
  669.     cbDisableSystemTrayIconNotification.Checked := ini.ReadBool(ArsClip,'DisableSystemTrayIconNotification', false);
  670.     cbDisableChainNotification.checked := ini.ReadBool(ArsClip, cbDisableChainNotification.name,  false);
  671.     cbEnableExtendedChainChecking.Checked := ini.ReadBool(ArsClip, cbEnableExtendedChainChecking.Name, false);
  672.     cbAutofixURLs.Checked := ini.ReadBool(ArsClip, cbAutofixURLs.Name, false);
  673.  
  674.     //-----------------------
  675.     // Clipboard Text
  676.     //-----------------------
  677.     udqueuesize.Position  := ini.ReadInteger(ArsClip, 'QueueSize', 15);
  678.     udRemovedSize.Position := ini.ReadInteger(ArsClip, 'RemovedItemsSize', 50);
  679.     ClipQueue.SetQueueSize(udQueueSize.position);
  680.     RemovedQueue.SetQueueSize(udRemovedSize.position);
  681.     cbMonitorFilenames.Checked :=  ini.ReadBool(ArsClip, 'MonitorFilenames', false);
  682.     cbRemember.Checked := ini.ReadBool(ArsClip, 'RememberHistory', true);
  683.     cbMoveDuplicate.checked := ini.ReadBool(ArsClip, 'MoveDuplicate', true);
  684.  
  685.     //------------------------
  686.     // Clipboard Non-text
  687.     //------------------------
  688.  
  689.     cbOtherItems.Checked := ini.ReadBool(ArsClip,'EnableOtherItems', false);
  690.     udOtherSize.Position := ini.ReadInteger(ArsClip, 'OtherSize', 5);
  691.     txtOtherSizeLimitKB.text := IntToStr(ini.ReadInteger(ArsClip,'OtherSizeLimitKB', 500));
  692.  
  693.     // Ect - util stuff
  694.     // HuH? The "Other" config options above seem not to work
  695.     txtOtherSizeLimitKB.OnChange(self);
  696.     OtherQueue.SetQueueSize(udOtherSize.position);
  697.  
  698.     cbUseKeyboard.OnClick(self);
  699.     cbDisable.OnClick(self);
  700.     cbUsePermanentItems.OnClick(self);
  701.  
  702.     frmPermanent.SetPermanentPath(ini.ReadString(ArsClip, 'LastPermanentPath', UnitFrmPermanentNew.DEFAULT_FOLDER));
  703.  
  704.     //------------------------
  705.     //  Tooltip
  706.     //------------------------
  707.     cbFullHeader.Checked := ini.ReadBool(ArsClip,'FullHeader', true);
  708.     cbCopyVisibleItem.Checked := ini.ReadBool(ArsClip,'CopyVisibleItem', false);
  709.  
  710.     //
  711.     // these are here because because there is no "onchange"
  712.     // triggered when the control's state is changed
  713.     //
  714.     if (rbOtherPaste.Checked) then begin
  715.         frmMainPopup.SetOtherPasteMethodPasting;
  716.     end else begin
  717.         FrmMainPopup.SetOtherPasteMethodClipboardOnly;
  718.     end;
  719.  
  720.     if rbTyping.checked then
  721.         Paste.SetMimicTyping;
  722.  
  723.     if rbClipboardOnly.checked then
  724.         Paste.SetClipboardOnly;
  725.  
  726.     if rbPaste.Checked then
  727.         Paste.SetUsePaste;
  728.     if rbPasteSI.Checked then
  729.         Paste.SetUsePasteSI;
  730.  
  731.     lblKeyname.Caption := self.GetHumanReadableHotkey;
  732.     lblTooltipKeyname.Caption := self.GetHumanReadableTTHotkey;
  733.     lblPreviousTooltipKeyname.Caption := self.GetHumanReadablePTTHotkey; 
  734.     MyFree(ini);
  735. end;
  736.  
  737.  
  738. {
  739. --========================
  740. -- // Release/Assign    //
  741. --========================
  742.  
  743. Returns true if successful.
  744.  
  745. }
  746.  
  747. {function TFrmConfig.HotKeyRelease(): boolean;
  748. begin
  749.     result := UnRegisterHotKey(frmMainPopup.handle, HotKeyID)
  750. end;
  751.  
  752. function TFrmConfig.HotKeyAssign(
  753.     Ctrl: boolean; Alt: boolean; Shift: boolean; Winkey : boolean;
  754.     Keystroke: word; FunctionKey : boolean): boolean;
  755. var modifier: word;
  756. begin
  757.     modifier := 0;
  758.     if ctrl then modifier := modifier or MOD_CONTROL;
  759.     if alt then  modifier := modifier or MOD_ALT;
  760.     if shift then modifier := modifier or MOD_SHIFT;
  761.     if winkey then modifier := modifier or MOD_WIN;
  762.     result := false;
  763.     if (HotKeyID = 0) then begin
  764.         exit;
  765.     end;
  766.  
  767.  
  768.     // this alteration allows for using , . ` in hotkeys
  769.     //if (not functionkey) then begin
  770.     //    keystroke := VkKeyScan(char(Keystroke)) and $ff;
  771.     //end;
  772.     if not ( RegisterHotKey(frmMainPopup.handle, HotKeyID, modifier, Keystroke)) then begin
  773.         exit;
  774.     end;
  775.  
  776.     result := true;
  777. end;
  778. }
  779. {
  780. --========================
  781. -- // Control Events    //
  782. --========================
  783.  
  784. }
  785. {function TFrmConfig.SetHotKey : boolean;
  786. begin
  787.     result := false;
  788.  
  789.     //
  790.     // if the user tries to assign to a hotkey that is already in use,
  791.     // the hotkeyrelease failing is OK
  792.     //
  793.     self.HotKeyRelease();
  794.  
  795.  
  796.     if not (self.HotKeyAssign(Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift, Hotkey_Winkey,
  797.         Hotkey_key, false)) then begin
  798.         ShowMessage('ERROR: Couldn''t assign hotkey. It may already be assigned by another program.');
  799.     end else begin
  800.         result := true;
  801.     end;
  802. end;
  803. }
  804.  
  805.  
  806. procedure TFrmConfig.cbKeyChange(Sender: TObject);
  807. begin
  808. end;
  809.  
  810.  
  811. //============================
  812. // Clipboard Options
  813. //============================
  814.  
  815. procedure TFrmConfig.cbUseKeyboardClick(Sender: TObject);
  816. begin
  817.     frmMainPopup.setpopupusekeyboard(cbUseKeyboard.Checked);
  818. end;
  819.  
  820. {
  821. Make the user use the up/down to change the queue size
  822. }
  823. procedure TFrmConfig.txtQueueSizeKeyPress(Sender: TObject; var Key: Char);
  824. begin
  825.     // ignore keystrokes
  826.     key := chr(0);
  827. end;
  828.  
  829. procedure TFrmConfig.txtOldHistorySizeKeyPress(Sender: TObject;
  830.   var Key: Char);
  831. begin
  832.     // ignore keystrokes
  833.     Key := Chr(0);
  834. end;
  835.  
  836. procedure TFrmConfig.txtOtherSizeKeyPress(Sender: TObject; var Key: Char);
  837. begin
  838.     key := chr(0);
  839. end;
  840.  
  841.  
  842. procedure TFrmConfig.cbOtherItemsClick(Sender: TObject);
  843. begin
  844.     udOtherSize.Enabled := cbOtherItems.Checked;
  845.     txtOtherSizeLimitKB.Enabled := cbOtherItems.Checked;
  846.     frmClipboardManager.SetOtherItemsMonitoring(cbOtherItems.Checked);
  847.  
  848. end;
  849.  
  850. procedure TFrmConfig.txtOtherSizeLimitKBChange(Sender: TObject);
  851. begin
  852.     OtherQueue.SetClipSizeLimit( StrToInt(txtOtherSizeLimitKB.text) * 1024);
  853. end;
  854.  
  855. procedure TFrmConfig.udOtherSizeClick(Sender: TObject; Button: TUDBtnType);
  856. begin
  857.     OtherQueue.SetQueueSize(udOtherSize.position);
  858. end;
  859.  
  860.  
  861. procedure TFrmConfig.udQueueSizeClick(Sender: TObject; Button: TUDBtnType);
  862. begin
  863.     ClipQueue.SetQueueSize(udQueueSize.position);
  864. end;
  865. procedure TFrmConfig.udRemovedSizeClick(Sender: TObject; Button: TUDBtnType);
  866. begin
  867.     RemovedQueue.SetQueueSize(udRemovedSize.position);
  868. end;
  869.  
  870.  
  871. procedure TFrmConfig.cbDisableClick(Sender: TObject);
  872. begin
  873.     frmClipboardManager.SetMonitoring(cbdisable.Checked);
  874. end;
  875.  
  876. procedure TFrmConfig.cbMonitorFilenamesClick(Sender: TObject);
  877. begin
  878.     frmClipboardManager.SetFilenameMonitoring(cbMonitorFilenames.checked);
  879. end;
  880. procedure TFrmConfig.cbRememberClick(Sender: TObject);
  881. begin
  882.     frmMainPopup.SetRememberHistory(cbRemember.checked);
  883.     // this loads only the first time
  884.     if (cbRemember.Checked) then begin
  885.         frmClipboardManager.LoadHistory;
  886.         //frmRemoved.LoadHistory;
  887.     end;
  888. end;
  889.  
  890. procedure TFrmConfig.cbCopyIconsClick(Sender: TObject);
  891. begin
  892.     frmClipboardManager.SetCopyIcon(cbCopyIcons.Checked);
  893. end;
  894.  
  895. procedure TFrmConfig.cbMoveDuplicateClick(Sender: TObject);
  896. begin
  897.     ClipQueue.SetMoveDuplicateTop(cbMoveDuplicate.checked);
  898. end;
  899.  
  900.  
  901.  
  902.  
  903. procedure TFrmConfig.cbUsePermanentItemsClick(Sender: TObject);
  904. begin
  905.     frmMainPopup.SetPermanentItems(cbUsePermanentItems.Checked);
  906.     if not cbUsePermanentItems.Checked then begin
  907.         cbShowPermanentItemGroups.Checked := cbUsePermanentItems.Checked;
  908.         cbPermanentItemsSubmenu.Checked := cbUsePermanentItems.Checked;
  909.     end;
  910. end;
  911.  
  912.  
  913. procedure TFrmConfig.cbShowEditHistoryClick(Sender: TObject);
  914. begin
  915.     FrmMainPopup.SetShowEditHistory(cbShowEditHistory.checked);
  916. end;
  917.  
  918. procedure TFrmConfig.cbShowPermanentItemGroupsClick(Sender: TObject);
  919. begin
  920.     if (cbShowPermanentItemGroups.Checked) then begin
  921.         cbPermanentItemsSubmenu.Checked := not cbShowPermanentItemGroups.Checked;
  922.     end;
  923.     cbUsePermanentItems.checked := cbPermanentItemsSubmenu.Checked or
  924.         cbShowPermanentItemGroups.checked;
  925.  
  926.     FrmMainPopup.SetShowPermeanentItemGroups(cbShowPermanentItemGroups.checked);
  927. end;
  928.  
  929. procedure TFrmConfig.cbPermanentItemsSubmenuClick(Sender: TObject);
  930. begin
  931.     if (cbPermanentItemsSubmenu.Checked) then begin
  932.         cbShowPermanentItemGroups.Checked := not cbPermanentItemsSubmenu.Checked;
  933.     end;
  934.     cbUsePermanentItems.checked := cbPermanentItemsSubmenu.Checked or
  935.         cbShowPermanentItemGroups.Checked ;
  936.  
  937.     FrmMainPopup.SetShowPermanentItemSubmenu(cbPermanentItemsSubmenu.Checked);
  938. end;
  939.  
  940.  
  941.  
  942. procedure TFrmConfig.btnEditPermanentItemsClick(Sender: TObject);
  943. begin
  944.     frmPermanent.ShowModal;
  945. end;
  946.  
  947. procedure TFrmConfig.cbPasteAllClick(Sender: TObject);
  948. begin
  949.     frmMainPopup.SetShowPasteAll(cbPasteAll.checked);
  950. end;
  951.  
  952.  
  953. //============================
  954. // Pasting Options
  955. //============================
  956. procedure TFrmConfig.rbTypingClick(Sender: TObject);
  957. begin
  958.     Paste.SetMimicTyping;
  959. end;
  960. procedure TFrmConfig.rbPasteClick(Sender: TObject);
  961. begin
  962.     Paste.SetUsePaste;
  963. end;
  964. procedure TFrmConfig.rbPasteSIClick(Sender: TObject);
  965. begin
  966.     Paste.SetUsePasteSI;
  967. end;
  968. procedure TFrmConfig.rbClipboardOnlyClick(Sender: TObject);
  969. begin
  970.     Paste.SetClipboardOnly;
  971. end;
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978. procedure TFrmConfig.cbMoveFirstClick(Sender: TObject);
  979. begin
  980.     frmMainPopup.SetMoveSelectedItemToTop(cbmovefirst.checked);
  981. end;
  982. procedure TFrmConfig.cbShowCurrentClick(Sender: TObject);
  983. begin
  984.     frmMainPopup.SetShowCurrentItem(cbSHowCurrent.checked);
  985. end;
  986.  
  987. procedure TFrmConfig.cbShowLastClick(Sender: TObject);
  988. begin
  989.     frmMainPopup.SetDoShowLast(cbShowLast.checked);
  990. end;
  991.  
  992. procedure TFrmConfig.udCharactersClick(Sender: TObject;
  993.   Button: TUDBtnType);
  994. begin
  995.     frmMainPopup.SetVisibleCharacterCount(udCharacters.Position);
  996. end;
  997.  
  998.  
  999.  
  1000. //
  1001. // close/save/cancel
  1002. // TreeView clicks
  1003. //
  1004. procedure TFrmConfig.btnSaveClick(Sender: TObject);
  1005. begin
  1006.     self.HotkeySave;
  1007.     try
  1008.         HotKeyPopup.SetHotKey(Hotkey_Ctrl, Hotkey_Alt,
  1009.             Hotkey_Shift, Hotkey_Winkey, Hotkey_key);
  1010.         if (cbUseTooltipHotkey.checked) then begin
  1011.             if (TTHotKeyPopup <> nil) then begin
  1012.                 TTHotKeyPopup.SetHotKey(TTHotkey_Ctrl, TTHotkey_Alt,
  1013.                     TTHotkey_Shift, TTHotkey_Winkey, TTHotkey_key);
  1014.                 PTTHotKeyPopup.SetHotKey(PTTHotkey_Ctrl, PTTHotkey_Alt,
  1015.                     PTTHotkey_Shift, PTTHotkey_Winkey, PTTHotkey_key)
  1016.             end else begin
  1017.                 TTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyTTHotKey',
  1018.                     TTHotkey_Ctrl, TTHotkey_Alt, TTHotkey_Shift,
  1019.                     TTHotkey_Winkey, TTHotkey_Key
  1020.                 );
  1021.                 PTTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyPTTHotKey',
  1022.                     PTTHotkey_Ctrl, PTTHotkey_Alt, PTTHotkey_Shift,
  1023.                     PTTHotkey_Winkey, PTTHotkey_Key
  1024.                 );
  1025.             end;
  1026.         end else begin
  1027.             MyFree(TTHotKeyPopup);
  1028.             MyFree(PTTHotKeyPopup);
  1029.         end;
  1030.     except
  1031.         EXIT;
  1032.     end;
  1033.     {if (self.SetHotKey) then begin}
  1034.         self.close;
  1035.     {end;}
  1036. end;
  1037.  
  1038. procedure TFrmConfig.btnCancelClick(Sender: TObject);
  1039. begin
  1040.     self.Close;
  1041. end;
  1042.  
  1043. procedure TFrmConfig.FormClose(Sender: TObject; var Action: TCloseAction);
  1044. begin
  1045.     self.HotkeyLoad;
  1046. end;
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053. procedure TFrmConfig.tvOptionsClick(Sender: TObject);
  1054. begin
  1055.     //self.ShowNewPanel;
  1056.     pcPanels.ActivePageIndex := (tvOptions.Selected.AbsoluteIndex);
  1057. end;
  1058.  
  1059. procedure TFrmConfig.tvOptionsCollapsing(Sender: TObject; Node: TTreeNode;
  1060.   var AllowCollapse: Boolean);
  1061. begin
  1062.     AllowCollapse := false;
  1063. end;
  1064.  
  1065. procedure TFrmConfig.bEditPopupHotkeyClick(Sender: TObject);
  1066. var w : word;
  1067.     s : string;
  1068.     ha, hs, hc, hw : boolean;
  1069. begin
  1070.     if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
  1071.        Hotkey_Alt    := ha;
  1072.        Hotkey_Shift  := hs;
  1073.        Hotkey_Ctrl   := hc;
  1074.        Hotkey_Winkey := hw;
  1075.        Hotkey_Key    := w;
  1076.        lblKeyname.caption := s;
  1077.     end;
  1078. end;
  1079.  
  1080. procedure TFrmConfig.bEditToolTipHotkeyClick(Sender: TObject);
  1081. var w : word;
  1082.     s : string;
  1083.     ha, hs, hc, hw : boolean;
  1084. begin
  1085.     if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
  1086.        TTHotkey_Alt    := ha;
  1087.        TTHotkey_Shift  := hs;
  1088.        TTHotkey_Ctrl   := hc;
  1089.        TTHotkey_Winkey := hw;
  1090.        TTHotkey_Key    := w;
  1091.        lblToolTipKeyname.caption := s;
  1092.     end;
  1093. end;
  1094.  
  1095. procedure TFrmConfig.bEditPreviousToolTipHotkeyClick(Sender: TObject);
  1096. var w : word;
  1097.     s : string;
  1098.     ha, hs, hc, hw : boolean;
  1099. begin
  1100.     if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
  1101.        PTTHotkey_Alt    := ha;
  1102.        PTTHotkey_Shift  := hs;
  1103.        PTTHotkey_Ctrl   := hc;
  1104.        PTTHotkey_Winkey := hw;
  1105.        PTTHotkey_Key    := w;
  1106.        lblPreviousTooltipKeyname.caption := s;
  1107.     end;
  1108. end;
  1109.  
  1110.  
  1111.  
  1112.  
  1113. procedure TFrmConfig.cbDisableWhenScrollLockClick(Sender: TObject);
  1114. begin
  1115.     frmClipboardManager.SetDisableWhenScrollLock(cbDisableWhenScrollLock.checked);
  1116. end;
  1117.  
  1118.  
  1119. procedure TFrmConfig.cbDisableSystemTrayIconNotificationClick(
  1120.   Sender: TObject);
  1121. begin
  1122.     FrmSysTrayMenu.SetDisableIconChanges(cbDisableSystemTrayIconNotification.checked);
  1123. end;
  1124.  
  1125. procedure TFrmConfig.cboCopyClickKeyClick(Sender: TObject);
  1126. begin
  1127.      FrmMainPopup.SetCopyKey(self.cboCopyClickKey.ItemIndex);
  1128. end;
  1129.  
  1130. procedure TFrmConfig.cboPermanentClickKeyClick(Sender: TObject);
  1131. begin
  1132.    FrmMainPopup.SetPermanentKey(self.cboPermanentClickKey.ItemIndex);
  1133. end;
  1134.  
  1135. procedure TFrmConfig.cboMimicClickKeyClick(Sender: TObject);
  1136. begin
  1137.     FrmMainPopup.SetMimicKey(self.cboMimicClickKey.ItemIndex);
  1138. end;
  1139.  
  1140. procedure TFrmConfig.rbCtrlClickRunClick(Sender: TObject);
  1141. begin
  1142.     FrmMainPopup.SetCtrlClickOpen(rbCtrlClickRun.checked); 
  1143. end;
  1144.  
  1145. procedure TFrmConfig.rbCtrlClickMenuClick(Sender: TObject);
  1146. begin
  1147.     FrmMainPopup.SetCtrlClickMenu(rbCtrlClickMenu.checked); 
  1148. end;
  1149.  
  1150. procedure TFrmConfig.tvOptionsChange(Sender: TObject; Node: TTreeNode);
  1151. begin
  1152.     //self.ShowNewPanel;
  1153.     pcPanels.ActivePageIndex := (tvOptions.Selected.AbsoluteIndex);
  1154. end;
  1155.  
  1156. procedure TFrmConfig.cbShowFormModeClick(Sender: TObject);
  1157. begin
  1158.     FrmMainPopup.SetShowFormMode(cbShowFormMode.Checked); 
  1159. end;
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165. procedure TFrmConfig.cbPopupDoubleclickClick(Sender: TObject);
  1166. begin
  1167.     if cbPopupDoubleclick.checked then
  1168.         cbPopupDoubleclickTray.checked := not cbPopupDoubleclick.checked;
  1169. end;
  1170.  
  1171. procedure TFrmConfig.cbPopupDoubleclickTrayClick(Sender: TObject);
  1172. begin
  1173.     if cbPopupDoubleclickTray.checked then
  1174.     cbPopupDoubleclick.checked := not cbPopupDoubleclickTray.checked;
  1175. end;
  1176.  
  1177. procedure TFrmConfig.cbShowSwitchToClick(Sender: TObject);
  1178. begin
  1179.     cbPermanentItemsSubmenu.Enabled := cbShowSwitchTo.Checked;
  1180.     cbShowPermanentItemGroups.Enabled := cbShowSwitchTo.Checked;
  1181. end;
  1182.  
  1183. procedure TFrmConfig.bntSetFontClick(Sender: TObject);
  1184. var ini : TIniFile;
  1185. begin
  1186.     if FontDialog.Execute then begin
  1187.         FrmDummyUnicodePopup.Font := FontDialog.Font;
  1188.  
  1189.         ini := TInifile.Create( self.GetINIFileName );
  1190.  
  1191.         //
  1192.         // Hotkey Panel
  1193.         //
  1194.         ini.WriteString('Font','Name', FontDialog.Font.Name);
  1195.         ini.WriteInteger('Font','CharSet', FontDialog.Font.Charset);
  1196.         ini.WriteInteger('Font','Color', FontDialog.Font.Color);
  1197.         ini.WriteInteger('Font','Size', FontDialog.Font.Size);
  1198.     end;
  1199. end;
  1200.  
  1201.  
  1202. end.
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.