home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
ArsClip
/
source.zip
/
UnitFrmConfig.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2004-10-16
|
40KB
|
1,209 lines
unit UnitFrmConfig;
{
Purpose:
This form configures the hotkey as well as receives messages
when the hotkey is pressed.
This form also reads the current configuration and passes those
option onto the responsible form (mainly FrmMainPopup)
Updates:
New panel for Popup "Config -> Popup - Keystrokes"
Updated for option to show popup on double-click
Removed Items now saved << no longer needed with cached removed items
--------------
New Form Mode show option
Fixed logic for "Show Permanent Items" and selecting a
display method.
------------
New "SHIFT+INSERT" pasting options
Moved the popup "show" options to their own panel
New "Show Options" subitem under Popup
New user definable function key for copy & permanent
popup keystrokes.
New Clipboard option - "Disable clipboard Monitoring when Scroll Lock is on"
New look
New way to do hotkeys
Used ini.ReadInteger where appropriate
Using UnitClipQueue
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, ImgList, UnitHotKey;
type
TFrmConfig = class(TForm)
btnSave: TButton;
btnCancel: TButton;
tvOptions: TTreeView;
ImageList1: TImageList;
FontDialog: TFontDialog;
pcPanels: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
TabSheet7: TTabSheet;
TabSheet8: TTabSheet;
TabSheet9: TTabSheet;
pHotkey: TPanel;
Shape3: TShape;
Shape1: TShape;
lblKeyname: TLabel;
Label5: TLabel;
Shape2: TShape;
Label12: TLabel;
lblTooltipKeyname: TLabel;
Label16: TLabel;
lblPreviousTooltipKeyname: TLabel;
bEditPopupHotkey: TButton;
cbUseTooltipHotkey: TCheckBox;
bEditToolTipHotkey: TButton;
bEditPreviousToolTipHotkey: TButton;
pClipboard: TPanel;
Label1: TLabel;
cbCopyIcons: TCheckBox;
cbDisable: TCheckBox;
cbDisableWhenScrollLock: TCheckBox;
cbDisableSystemTrayIconNotification: TCheckBox;
cbRemember: TCheckBox;
cbDisableChainNotification: TCheckBox;
txtOldHistorySize: TEdit;
udRemovedSize: TUpDown;
cbEnableExtendedChainChecking: TCheckBox;
cbAutofixURLs: TCheckBox;
pClipboard_TextItems: TPanel;
Label2: TLabel;
txtQueueSize: TEdit;
udQueueSize: TUpDown;
cbMonitorFilenames: TCheckBox;
cbMoveDuplicate: TCheckBox;
pClipboard_NonText: TPanel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
cbOtherItems: TCheckBox;
txtOtherSize: TEdit;
txtOtherSizeLimitKB: TEdit;
udOtherSize: TUpDown;
pPasting: TPanel;
Label3: TLabel;
rbTyping: TRadioButton;
rbPaste: TRadioButton;
rbClipboardOnly: TRadioButton;
Panel1: TPanel;
Label4: TLabel;
rbOtherClipboardOnly: TRadioButton;
rbOtherPaste: TRadioButton;
rbPasteSI: TRadioButton;
cbPasteComplex: TCheckBox;
pPopup: TPanel;
Label6: TLabel;
Label17: TLabel;
cbMoveFirst: TCheckBox;
cbUseKeyboard: TCheckBox;
cbPopupDoubleclick: TCheckBox;
txtCharacters: TEdit;
udCharacters: TUpDown;
cbPopupDoubleclickTray: TCheckBox;
cbDisplayUnicode: TCheckBox;
cbDisplayAtMouseCursor: TCheckBox;
cbPopupSingleclickTray: TCheckBox;
cbPopupSingleclick: TCheckBox;
bntSetFont: TButton;
pPopupShow: TPanel;
btnEditPermanentItems: TButton;
cbUsePermanentItems: TCheckBox;
cbPasteAll: TCheckBox;
cbShowLast: TCheckBox;
cbShowCurrent: TCheckBox;
cbShowEditHistory: TCheckBox;
cbShowFormMode: TCheckBox;
cbShowTypes: TCheckBox;
GroupBox1: TGroupBox;
cbShowSwitchTo: TCheckBox;
cbShowAllItems: TCheckBox;
Panel3: TPanel;
cbPermanentItemsSubmenu: TCheckBox;
cbShowPermanentItemGroups: TCheckBox;
pTooltipPopup: TPanel;
cbFullHeader: TCheckBox;
cbCopyVisibleItem: TCheckBox;
pPopupKeystrokes: TPanel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label10: TLabel;
Label11: TLabel;
cboCopyClickKey: TComboBox;
cboPermanentClickKey: TComboBox;
cboMimicClickKey: TComboBox;
Panel2: TPanel;
rbCtrlClickRun: TRadioButton;
rbCtrlClickMenu: TRadioButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure cbKeyChange(Sender: TObject);
procedure cbUseKeyboardClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure txtQueueSizeKeyPress(Sender: TObject; var Key: Char);
procedure udQueueSizeClick(Sender: TObject; Button: TUDBtnType);
procedure cbDisableClick(Sender: TObject);
procedure cbUsePermanentItemsClick(Sender: TObject);
procedure btnEditPermanentItemsClick(Sender: TObject);
procedure rbTypingClick(Sender: TObject);
procedure rbPasteClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure cbMonitorFilenamesClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure cbPasteAllClick(Sender: TObject);
procedure rbClipboardOnlyClick(Sender: TObject);
procedure cbMoveFirstClick(Sender: TObject);
procedure cbShowCurrentClick(Sender: TObject);
procedure udCharactersClick(Sender: TObject; Button: TUDBtnType);
procedure cbRememberClick(Sender: TObject);
procedure cbCopyIconsClick(Sender: TObject);
procedure cbMoveDuplicateClick(Sender: TObject);
procedure cbShowLastClick(Sender: TObject);
procedure txtOldHistorySizeKeyPress(Sender: TObject; var Key: Char);
procedure udRemovedSizeClick(Sender: TObject; Button: TUDBtnType);
procedure cbOtherItemsClick(Sender: TObject);
procedure txtOtherSizeKeyPress(Sender: TObject; var Key: Char);
procedure txtOtherSizeLimitKBChange(Sender: TObject);
procedure udOtherSizeClick(Sender: TObject; Button: TUDBtnType);
procedure cbShowPermanentItemGroupsClick(Sender: TObject);
procedure tvOptionsClick(Sender: TObject);
procedure tvOptionsCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
procedure bEditPopupHotkeyClick(Sender: TObject);
procedure cbDisableWhenScrollLockClick(Sender: TObject);
procedure cbShowEditHistoryClick(Sender: TObject);
procedure cbPermanentItemsSubmenuClick(Sender: TObject);
procedure cbDisableSystemTrayIconNotificationClick(Sender: TObject);
procedure cboCopyClickKeyClick(Sender: TObject);
procedure cboPermanentClickKeyClick(Sender: TObject);
procedure rbPasteSIClick(Sender: TObject);
procedure cboMimicClickKeyClick(Sender: TObject);
procedure rbCtrlClickRunClick(Sender: TObject);
procedure rbCtrlClickMenuClick(Sender: TObject);
procedure tvOptionsChange(Sender: TObject; Node: TTreeNode);
procedure cbShowFormModeClick(Sender: TObject);
procedure bEditToolTipHotkeyClick(Sender: TObject);
procedure bEditPreviousToolTipHotkeyClick(Sender: TObject);
procedure cbPopupDoubleclickClick(Sender: TObject);
procedure cbPopupDoubleclickTrayClick(Sender: TObject);
procedure cbShowSwitchToClick(Sender: TObject);
procedure bntSetFontClick(Sender: TObject);
private
{ Private declarations }
HotKeyPopup : TACHotKey;
TTHotKeyPopup : TACHotKey;
PTTHotKeyPopup : TACHotKey;
LastShownPanel : TPanel;
Hotkey_Ctrl : boolean;
Hotkey_Alt : boolean;
Hotkey_Winkey : boolean;
Hotkey_Shift : boolean;
Hotkey_Key : word;
TTHotkey_Ctrl : boolean;
TTHotkey_Alt : boolean;
TTHotkey_Winkey : boolean;
TTHotkey_Shift : boolean;
TTHotkey_Key : word;
PTTHotkey_Ctrl : boolean;
PTTHotkey_Alt : boolean;
PTTHotkey_Winkey : boolean;
PTTHotkey_Shift : boolean;
PTTHotkey_Key : word;
procedure HotkeySave;
procedure HotkeyLoad;
function GetINIFileName: string;
{function HotKeyAssign(
Ctrl: boolean; Alt: boolean; Shift: boolean; WinKey: boolean;
Keystroke: word; FunctionKey : boolean): boolean;
//function HotKeyRelease(): boolean;
}
function GetHumanReadableHotkey: string;
function GetHumanReadableTTHotkey : string;
function GetHumanReadablePTTHotkey : string;
{function SetHotKey : boolean;}
public
function GetHotKeyID: integer;
function GetTTHotKeyID: integer;
function GetPTTHotKeyID: integer;
procedure SaveLastPermPath;
{ Public declarations }
end;
var
FrmConfig: TFrmConfig;
implementation
uses
INIFiles,
UnitFrmClipboardManager,
UnitFrmMainPopup, UnitClipQueue, UnitOtherQueue, UnitFrmHotKey,
UnitFrmSysTrayMenu, UnitFrmPermanentNew, UnitFrmRemoved, UnitPaste,
UnitMisc, UnitfrmDummyUnicodePopup;
{$R *.dfm}
{
--========================
-- // Hook/ Release //
--========================
}
procedure TFrmConfig.FormCreate(Sender: TObject);
var tn : TTreeNode;
i : integer;
begin
self.HotkeyLoad();
//
//Hook onto keystoke
//
TTHotKeyPopup := nil;
PTTHotKeyPopup := nil;
try
HotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyHotKey',
Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift,
Hotkey_Winkey, Hotkey_Key
);
except
ShowMessage('Failed to set hotkey ' + self.lblKeyname.Caption );
end;
try
if (self.cbUseTooltipHotkey.checked) then begin
TTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyTTHotKey',
TTHotkey_Ctrl, TTHotkey_Alt, TTHotkey_Shift,
TTHotkey_Winkey, TTHotkey_Key
);
end;
except
ShowMessage('Failed to set hotkey ' + self.lblTooltipKeyname.Caption );
end;
try
if (self.cbUseTooltipHotkey.checked) then begin
PTTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyPTTHotKey',
PTTHotkey_Ctrl, PTTHotkey_Alt, PTTHotkey_Shift,
PTTHotkey_Winkey, PTTHotkey_Key
);
end;
except
ShowMessage('Failed to set hotkey ' + self.lblPreviousTooltipKeyname.Caption );
end;
{
if (rbKey.Checked) then begin
w := ord(txtKey.text[1]);
end else begin
w := Hotkey_Key;
end;
{
if not self.HotKeyAssign(Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift,
Hotkey_Winkey, Hotkey_Key, false) then begin
ShowMessage('ERROR: Unable to assign a hotkey. Please change the key.');
end;
}
// expand all tree branches
tn := tvOptions.Items.GetFirstNode;
while tn <> nil do begin
if tn.HasChildren then
tn.expand(true);
tn := tn.getNextSibling;
end;
for i := 0 to pcPanels.PageCount - 1 do begin
pcPanels.Pages[i].TabVisible := false;
end;
// click the first node by default
tvOptions.Selected := tvOptions.Items.GetFirstNode;
tvOptions.HideSelection := false;
tvOptions.OnClick(self);
end;
procedure TFrmConfig.FormDestroy(Sender: TObject);
begin
MyFree(HotKeyPopup);
MyFree(TTHotKeyPopup);
MyFree(PTTHotKeyPopup);
end;
procedure TFrmConfig.FormShow(Sender: TObject);
begin
Windows.SetForegroundWindow(self.Handle);
end;
function TFrmConfig.GetHotKeyID: integer;
begin
result := HotKeyPopup.GetID;
end;
function TFrmConfig.GetTTHotKeyID: integer;
begin
result := TTHotKeyPopup.GetID;
end;
function TFrmConfig.GetPTTHotKeyID: integer;
begin
result := PTTHotKeyPopup.GetID;
end;
function TFrmConfig.GetHumanReadableHotkey : string;
var b : boolean;
begin
result := FrmHotkey.GetHumanReadable(Hotkey_alt, Hotkey_shift, Hotkey_ctrl, Hotkey_winkey, Hotkey_key, b);
end;
function TFrmConfig.GetHumanReadableTTHotkey : string;
var b : boolean;
begin
result := FrmHotkey.GetHumanReadable(TTHotkey_alt, TTHotkey_shift, TTHotkey_ctrl, TTHotkey_winkey, TTHotkey_key, b);
end;
function TFrmConfig.GetHumanReadablePTTHotkey: string;
var b : boolean;
begin
result := FrmHotkey.GetHumanReadable(TTHotkey_alt, PTTHotkey_shift, PTTHotkey_ctrl, PTTHotkey_winkey, PTTHotkey_key, b);
end;
{
--============================
-- // Load/Save hotkey info //
--============================
}
const ArsClip = 'ArsClip';
procedure TFrmConfig.SaveLastPermPath;
var ini: TInifile;
begin
ini := TInifile.Create( self.GetINIFileName );
ini.WriteString(ArsClip, 'LastPermanentPath', frmPermanent.GetPermanentPath);
MyFree(ini);
end;
function TFrmConfig.GetINIFileName: string;
begin
Result := ExtractFilePath ( application.ExeName ) + 'arsclip.ini';
end;
procedure TFrmConfig.HotkeySave;
var ini: TInifile;
begin
ini := TInifile.Create( self.GetINIFileName );
//
// Hotkey Panel
//
ini.WriteInteger(ArsClip,'Hotkey_Key', Hotkey_Key);
ini.WriteBool(ArsClip,'Hotkey_Alt', Hotkey_Alt);
ini.WriteBool(ArsClip,'Hotkey_Shift', Hotkey_Shift);
ini.WriteBool(ArsClip,'Hotkey_Ctrl', Hotkey_Ctrl);
ini.WriteBool(ArsClip,'Hotkey_Winkey', Hotkey_Winkey);
ini.WriteBool(ArsClip,'UseTooltipHotkey', cbUseTooltipHotkey.Checked );
ini.WriteInteger(ArsClip,'TTHotkey_Key', TTHotkey_Key);
ini.WriteBool(ArsClip,'TTHotkey_Alt', TTHotkey_Alt);
ini.WriteBool(ArsClip,'TTHotkey_Shift', TTHotkey_Shift);
ini.WriteBool(ArsClip,'TTHotkey_Ctrl', TTHotkey_Ctrl);
ini.WriteBool(ArsClip,'TTHotkey_Winkey', TTHotkey_Winkey);
ini.WriteInteger(ArsClip,'PTTHotkey_Key', PTTHotkey_Key);
ini.WriteBool(ArsClip,'PTTHotkey_Alt', PTTHotkey_Alt);
ini.WriteBool(ArsClip,'PTTHotkey_Shift', PTTHotkey_Shift);
ini.WriteBool(ArsClip,'PTTHotkey_Ctrl', PTTHotkey_Ctrl);
ini.WriteBool(ArsClip,'PTTHotkey_Winkey', PTTHotkey_Winkey);
//----------
//'Popup' panel
ini.WriteBool(Arsclip, 'MoveSelectedToFirst', cbMoveFirst.Checked );
if (cbUseKeyboard.Checked) then begin
ini.WriteString(ArsClip, 'PopupUseKeyboard', 'Y');
end else begin
ini.WriteString(ArsClip, 'PopupUseKeyboard', 'N');
end;
ini.WriteInteger(ArsClip, 'CharactersToShow', udCharacters.position);
ini.WriteBool(ArsClip, cbDisplayUnicode.Name, cbDisplayUnicode.checked );
ini.WriteBool(ArsClip, cbDisplayAtMouseCursor.Name, cbDisplayAtMouseCursor.checked);
ini.WriteBool(Arsclip, 'PopupDoubleclick', cbPopupDoubleclick.checked);
ini.WriteBool(Arsclip, 'PopupDoubleclickTray', cbPopupDoubleclickTray.checked);
ini.WriteBool(Arsclip, cbPopupSingleclickTray.Name, cbPopupSingleclickTray.checked);
ini.WriteBool(Arsclip, cbPopupSingleclick.Name, cbPopupSingleclick.Checked);
//
ini.WriteInteger(ArsClip, 'CopyClickKey', cboCopyClickKey.ItemIndex );
ini.WriteInteger(ArsClip, 'PermanentClickKey', cboPermanentClickKey.ItemIndex );
ini.WriteInteger(ArsClip, 'MimicClickKey', cboMimicClickKey.ItemIndex );
ini.WriteBool(ArsClip, rbCtrlClickRun.Name, rbCtrlClickRun.Checked );
ini.WriteBool(ArsClip, rbCtrlClickMenu.Name, rbCtrlClickMenu.Checked );
//
ini.WriteInteger(ArsClip, 'QueueSize', udQueueSize.position);
ini.WriteInteger(ArsClip, 'RemovedItemsSize', udRemovedSize.Position);
if (cbDisable.Checked) then begin
ini.WriteString(ArsClip, 'DisableMonitoring', 'Y');
end else begin
ini.WriteString(ArsClip, 'DisableMonitoring', 'N');
end;
ini.WriteBool(ArsClip, 'DisableWhenScrollLock', cbDisableWhenScrollLock.checked);
ini.WriteBool(ArsClip, 'CopyIcons', cbCopyIcons.checked);
ini.WriteBool(ArsClip, 'DisableSystemTrayIconNotification', cbDisableSystemTrayIconNotification.Checked );
ini.WriteBool(ArsClip, cbDisableChainNotification.name, cbDisableChainNotification.checked );
ini.WriteBool(ArsClip, cbEnableExtendedChainChecking.Name, cbEnableExtendedChainChecking.Checked);
if (cbUsePermanentItems.Checked) then begin
ini.WriteString(ArsClip, 'UsePermanentItems', 'Y');
end else begin
ini.WriteString(ArsClip, 'UsePermanentItems', 'N');
end;
ini.WriteString(ArsClip, 'LastPermanentPath', frmPermanent.GetPermanentPath);
ini.WriteBool(ArsClip, cbShowSwitchTo.Name, cbShowSwitchTo.Checked);
ini.WriteBool(ArsClip,'ShowPermanentItemGroups', cbShowPermanentItemGroups.checked );
ini.WriteBool(ArsClip, 'ShowPermanentItemSubmenu', cbPermanentItemsSubmenu.Checked );
ini.WriteBool(ArsClip, 'ShowFormMode', cbShowFormMode.Checked);
if (rbTyping.Checked) then begin
ini.WriteString(ArsClip,'PasteMethod', 'MimicTyping');
end else if (rbPaste.checked) then begin
ini.WriteString(ArsClip, 'PasteMethod', 'CTRL+V');
end else if (rbPasteSI.Checked) then begin
ini.WriteString(ArsClip, 'PasteMethod', 'SHIFT+INSERT');
end else begin
ini.WriteString(ArsClip, 'PasteMethod', 'ClipboardOnly');
end;
ini.WriteBool(ArsClip, cbPasteComplex.Name, cbPasteComplex.Checked);
ini.WriteBool(ArsClip, 'MonitorFilenames', cbMonitorFilenames.checked);
ini.WriteBool(ArsClip, 'ShowPasteAll', cbPasteAll.checked );
ini.WriteBool(ArsClip, 'ShowCurrent', cbShowCurrent.checked );
ini.WriteBool(ArsClip, 'RememberHistory', cbRemember.checked);
ini.WriteBool(ArsClip, 'MoveDuplicate', cbMoveDuplicate.checked );
ini.WriteBool(ArsClip, 'ShowLast', cbShowLast.checked);
ini.WriteBool(ArsClip, 'ShowEditHistory', cbShowEditHistory.Checked);
ini.WriteBool(ArsClip, cbShowTypes.Name, cbShowTypes.checked);
ini.WriteBool(ArsClip, cbAutofixURLs.Name, cbAutofixURLs.Checked);
ini.WriteBool(ArsClip, cbShowAllItems.Name, cbShowAllItems.checked);
//-------------------
// Non-text items
//-------------------
ini.WriteBool(ArsClip,'EnableOtherItems', cbOtherItems.Checked);
ini.WriteInteger(ArsClip, 'OtherSize', udOtherSize.Position);
ini.WriteInteger(ArsClip,'OtherSizeLimitKB', StrToInt(txtOtherSizeLimitKB.text));
if (rbOtherPaste.Checked) then begin
ini.WriteString(ArsClip, 'OtherPasteMethod', 'CTRL+V' );
end else begin
ini.WriteString(ArsClip, 'OtherPasteMethod', 'ClipboardOnly');
end;
//-------------
// Tooltip
//-------------
ini.WriteBool(ArsClip,'FullHeader', cbFullHeader.Checked);
ini.WriteBool(ArsClip,'CopyVisibleItem', cbCopyVisibleItem.Checked);
//lblKeyname.Caption := self.GetHumanReadableHotkey;
MyFree(ini);
end;
procedure TFrmConfig.HotkeyLoad;
var ini: TInifile;
begin
//
// read last assigned hotkey
// CTRL+SHIFT+Z is default
//
// fake the user selecting the Modifier and the Normal Key
ini := TInifile.Create( self.GetINIFileName );
FrmDummyUnicodePopup.Font.Name := ini.ReadString('Font','Name', FrmDummyUnicodePopup.Font.Name);
FrmDummyUnicodePopup.Font.Charset := ini.ReadInteger('Font','CharSet', FrmDummyUnicodePopup.Font.Charset);
FrmDummyUnicodePopup.Font.Color := ini.ReadInteger('Font','Color', FrmDummyUnicodePopup.Font.Color);
FrmDummyUnicodePopup.Font.Size := ini.ReadInteger('Font','Size', FrmDummyUnicodePopup.Font.Size);
FontDialog.Font := FrmDummyUnicodePopup.Font;
//----------
// HotKey
//----------
Hotkey_Key := ini.ReadInteger(ArsClip,'Hotkey_Key', Ord('Z'));
Hotkey_Alt := ini.ReadBool(ArsClip,'Hotkey_Alt', false);
Hotkey_Shift := ini.ReadBool(ArsClip,'Hotkey_Shift', true);
Hotkey_Ctrl := ini.ReadBool(ArsClip,'Hotkey_Ctrl', true);
Hotkey_Winkey := ini.ReadBool(ArsClip,'Hotkey_Winkey', false);
cbUseTooltipHotkey.Checked := ini.ReadBool(ArsClip,'UseTooltipHotkey',false);
TTHotkey_Key := ini.ReadInteger(ArsClip,'TTHotkey_Key', Ord('X'));
TTHotkey_Alt := ini.ReadBool(ArsClip,'TTHotkey_Alt', false);
TTHotkey_Shift := ini.ReadBool(ArsClip,'TTHotkey_Shift', true);
TTHotkey_Ctrl := ini.ReadBool(ArsClip,'TTHotkey_Ctrl', true);
TTHotkey_Winkey := ini.ReadBool(ArsClip,'TTHotkey_Winkey', false);
PTTHotkey_Key := ini.ReadInteger(ArsClip,'PTTHotkey_Key', Ord('C'));
PTTHotkey_Alt := ini.ReadBool(ArsClip,'PTTHotkey_Alt', false);
PTTHotkey_Shift := ini.ReadBool(ArsClip,'PTTHotkey_Shift', true);
PTTHotkey_Ctrl := ini.ReadBool(ArsClip,'PTTHotkey_Ctrl', true);
PTTHotkey_Winkey := ini.ReadBool(ArsClip,'PTTHotkey_Winkey', false);
//----------------
// 'Popup' panel
//----------------
cbMoveFirst.Checked := ini.ReadBool(ArsClip, 'MoveSelectedToFirst', false);
cbUseKeyboard.Checked := (ini.ReadString(ArsClip,'PopupUseKeyboard', 'Y') = 'Y');
cbPopupDoubleclick.checked := ini.ReadBool(Arsclip, 'PopupDoubleclick', false);
cbPopupDoubleclickTray.checked := ini.ReadBool(Arsclip, 'PopupDoubleclickTray', false);
udCharacters.position := ini.ReadInteger(ArsClip, 'CharactersToShow', 30);
frmMainPopup.SetVisibleCharacterCount(udCharacters.position);
cboCopyClickKey.ItemIndex := ini.ReadInteger(ArsClip, 'CopyClickKey', 0 );
cboPermanentClickKey.ItemIndex := ini.ReadInteger(ArsClip, 'PermanentClickKey', 1);
cboMimicClickKey.ItemIndex := ini.ReadInteger(ArsClip, 'MimicClickKey', 2 );
rbCtrlClickRun.Checked := ini.ReadBool(ArsClip, rbCtrlClickRun.Name, false);
rbCtrlClickMenu.Checked := ini.ReadBool(ArsClip, rbCtrlClickMenu.name, true );
cbDisplayUnicode.checked := ini.ReadBool(ArsClip, cbDisplayUnicode.Name, false);
cbDisplayAtMouseCursor.checked :=ini.ReadBool(ArsClip, cbDisplayAtMouseCursor.Name, false);
cbPopupSingleclickTray.checked := ini.ReadBool(Arsclip, cbPopupSingleclickTray.Name, false);
cbPopupSingleclick.Checked := ini.ReadBool(Arsclip, cbPopupSingleclick.Name, false);
self.cboCopyClickKeyClick(self);
self.cboPermanentClickKeyClick(self);
self.cboMimicClickKeyClick(self);
// setting the ItemIndex doesn't auto set of any event
//-------------------
// Show Options
//-------------------
cbShowEditHistory.checked := ini.ReadBool(ArsClip,'ShowEditHistory', false);
cbShowCurrent.Checked := ini.ReadBool(ArsClip, 'ShowCurrent', false );
cbShowLast.Checked := ini.ReadBool(ArsClip,'ShowLast', true);
cbPasteAll.Checked := ini.ReadBool(ArsClip, 'ShowPasteAll', true);
cbUsePermanentItems.Checked := (ini.ReadString(ArsClip,'UsePermanentItems', 'N') = 'Y');
cbShowSwitchTo.Checked := ini.ReadBool(ArsClip, cbShowSwitchTo.Name, true);
cbShowPermanentItemGroups.checked := ini.ReadBool(ArsClip,'ShowPermanentItemGroups', true );
cbPermanentItemsSubmenu.checked := ini.Readbool(ArsClip,'ShowPermanentItemSubmenu', false);
cbShowFormMode.Checked := ini.ReadBool(ArsClip, 'ShowFormMode', false);
cbShowTypes.checked := ini.ReadBool(ArsClip, cbShowTypes.Name, true);
cbShowAllItems.checked := ini.ReadBool(ArsClip, cbShowAllItems.Name, false);
//-------------------
// Pasting
//-------------------
rbTyping.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'MimicTyping';
rbPaste.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'CTRL+V';
rbClipboardOnly.checked := ini.ReadString(ArsClip, 'PasteMethod', 'CTRL+V') = 'ClipboardOnly';
rbPasteSI.Checked := ini.ReadString(ArsClip, 'PasteMethod', 'SHIFT+INSERT') = 'SHIFT+INSERT';
rbOtherClipboardOnly.Checked := ini.ReadString(ArsClip, 'OtherPasteMethod', 'ClipboardOnly') = 'ClipboardOnly';
rbOtherPaste.Checked := ini.ReadString(ArsClip, 'OtherPasteMethod', 'ClipboardOnly') = 'CTRL+V';
cbPasteComplex.Checked := ini.ReadBool(ArsClip, cbPasteComplex.Name, false);
//-------------------
// Clipboard
//-------------------
cbCopyIcons.Checked := ini.ReadBool(ArsClip,'CopyIcons', true);
cbDisable.Checked := (ini.ReadString(ArsClip,'DisableMonitoring','N') = 'Y');
cbDisableWhenScrollLock.Checked := ini.ReadBool(ArsClip, 'DisableWhenScrollLock', false);
cbDisableSystemTrayIconNotification.Checked := ini.ReadBool(ArsClip,'DisableSystemTrayIconNotification', false);
cbDisableChainNotification.checked := ini.ReadBool(ArsClip, cbDisableChainNotification.name, false);
cbEnableExtendedChainChecking.Checked := ini.ReadBool(ArsClip, cbEnableExtendedChainChecking.Name, false);
cbAutofixURLs.Checked := ini.ReadBool(ArsClip, cbAutofixURLs.Name, false);
//-----------------------
// Clipboard Text
//-----------------------
udqueuesize.Position := ini.ReadInteger(ArsClip, 'QueueSize', 15);
udRemovedSize.Position := ini.ReadInteger(ArsClip, 'RemovedItemsSize', 50);
ClipQueue.SetQueueSize(udQueueSize.position);
RemovedQueue.SetQueueSize(udRemovedSize.position);
cbMonitorFilenames.Checked := ini.ReadBool(ArsClip, 'MonitorFilenames', false);
cbRemember.Checked := ini.ReadBool(ArsClip, 'RememberHistory', true);
cbMoveDuplicate.checked := ini.ReadBool(ArsClip, 'MoveDuplicate', true);
//------------------------
// Clipboard Non-text
//------------------------
cbOtherItems.Checked := ini.ReadBool(ArsClip,'EnableOtherItems', false);
udOtherSize.Position := ini.ReadInteger(ArsClip, 'OtherSize', 5);
txtOtherSizeLimitKB.text := IntToStr(ini.ReadInteger(ArsClip,'OtherSizeLimitKB', 500));
// Ect - util stuff
// HuH? The "Other" config options above seem not to work
txtOtherSizeLimitKB.OnChange(self);
OtherQueue.SetQueueSize(udOtherSize.position);
cbUseKeyboard.OnClick(self);
cbDisable.OnClick(self);
cbUsePermanentItems.OnClick(self);
frmPermanent.SetPermanentPath(ini.ReadString(ArsClip, 'LastPermanentPath', UnitFrmPermanentNew.DEFAULT_FOLDER));
//------------------------
// Tooltip
//------------------------
cbFullHeader.Checked := ini.ReadBool(ArsClip,'FullHeader', true);
cbCopyVisibleItem.Checked := ini.ReadBool(ArsClip,'CopyVisibleItem', false);
//
// these are here because because there is no "onchange"
// triggered when the control's state is changed
//
if (rbOtherPaste.Checked) then begin
frmMainPopup.SetOtherPasteMethodPasting;
end else begin
FrmMainPopup.SetOtherPasteMethodClipboardOnly;
end;
if rbTyping.checked then
Paste.SetMimicTyping;
if rbClipboardOnly.checked then
Paste.SetClipboardOnly;
if rbPaste.Checked then
Paste.SetUsePaste;
if rbPasteSI.Checked then
Paste.SetUsePasteSI;
lblKeyname.Caption := self.GetHumanReadableHotkey;
lblTooltipKeyname.Caption := self.GetHumanReadableTTHotkey;
lblPreviousTooltipKeyname.Caption := self.GetHumanReadablePTTHotkey;
MyFree(ini);
end;
{
--========================
-- // Release/Assign //
--========================
Returns true if successful.
}
{function TFrmConfig.HotKeyRelease(): boolean;
begin
result := UnRegisterHotKey(frmMainPopup.handle, HotKeyID)
end;
function TFrmConfig.HotKeyAssign(
Ctrl: boolean; Alt: boolean; Shift: boolean; Winkey : boolean;
Keystroke: word; FunctionKey : boolean): boolean;
var modifier: word;
begin
modifier := 0;
if ctrl then modifier := modifier or MOD_CONTROL;
if alt then modifier := modifier or MOD_ALT;
if shift then modifier := modifier or MOD_SHIFT;
if winkey then modifier := modifier or MOD_WIN;
result := false;
if (HotKeyID = 0) then begin
exit;
end;
// this alteration allows for using , . ` in hotkeys
//if (not functionkey) then begin
// keystroke := VkKeyScan(char(Keystroke)) and $ff;
//end;
if not ( RegisterHotKey(frmMainPopup.handle, HotKeyID, modifier, Keystroke)) then begin
exit;
end;
result := true;
end;
}
{
--========================
-- // Control Events //
--========================
}
{function TFrmConfig.SetHotKey : boolean;
begin
result := false;
//
// if the user tries to assign to a hotkey that is already in use,
// the hotkeyrelease failing is OK
//
self.HotKeyRelease();
if not (self.HotKeyAssign(Hotkey_Ctrl, Hotkey_Alt, Hotkey_Shift, Hotkey_Winkey,
Hotkey_key, false)) then begin
ShowMessage('ERROR: Couldn''t assign hotkey. It may already be assigned by another program.');
end else begin
result := true;
end;
end;
}
procedure TFrmConfig.cbKeyChange(Sender: TObject);
begin
end;
//============================
// Clipboard Options
//============================
procedure TFrmConfig.cbUseKeyboardClick(Sender: TObject);
begin
frmMainPopup.setpopupusekeyboard(cbUseKeyboard.Checked);
end;
{
Make the user use the up/down to change the queue size
}
procedure TFrmConfig.txtQueueSizeKeyPress(Sender: TObject; var Key: Char);
begin
// ignore keystrokes
key := chr(0);
end;
procedure TFrmConfig.txtOldHistorySizeKeyPress(Sender: TObject;
var Key: Char);
begin
// ignore keystrokes
Key := Chr(0);
end;
procedure TFrmConfig.txtOtherSizeKeyPress(Sender: TObject; var Key: Char);
begin
key := chr(0);
end;
procedure TFrmConfig.cbOtherItemsClick(Sender: TObject);
begin
udOtherSize.Enabled := cbOtherItems.Checked;
txtOtherSizeLimitKB.Enabled := cbOtherItems.Checked;
frmClipboardManager.SetOtherItemsMonitoring(cbOtherItems.Checked);
end;
procedure TFrmConfig.txtOtherSizeLimitKBChange(Sender: TObject);
begin
OtherQueue.SetClipSizeLimit( StrToInt(txtOtherSizeLimitKB.text) * 1024);
end;
procedure TFrmConfig.udOtherSizeClick(Sender: TObject; Button: TUDBtnType);
begin
OtherQueue.SetQueueSize(udOtherSize.position);
end;
procedure TFrmConfig.udQueueSizeClick(Sender: TObject; Button: TUDBtnType);
begin
ClipQueue.SetQueueSize(udQueueSize.position);
end;
procedure TFrmConfig.udRemovedSizeClick(Sender: TObject; Button: TUDBtnType);
begin
RemovedQueue.SetQueueSize(udRemovedSize.position);
end;
procedure TFrmConfig.cbDisableClick(Sender: TObject);
begin
frmClipboardManager.SetMonitoring(cbdisable.Checked);
end;
procedure TFrmConfig.cbMonitorFilenamesClick(Sender: TObject);
begin
frmClipboardManager.SetFilenameMonitoring(cbMonitorFilenames.checked);
end;
procedure TFrmConfig.cbRememberClick(Sender: TObject);
begin
frmMainPopup.SetRememberHistory(cbRemember.checked);
// this loads only the first time
if (cbRemember.Checked) then begin
frmClipboardManager.LoadHistory;
//frmRemoved.LoadHistory;
end;
end;
procedure TFrmConfig.cbCopyIconsClick(Sender: TObject);
begin
frmClipboardManager.SetCopyIcon(cbCopyIcons.Checked);
end;
procedure TFrmConfig.cbMoveDuplicateClick(Sender: TObject);
begin
ClipQueue.SetMoveDuplicateTop(cbMoveDuplicate.checked);
end;
procedure TFrmConfig.cbUsePermanentItemsClick(Sender: TObject);
begin
frmMainPopup.SetPermanentItems(cbUsePermanentItems.Checked);
if not cbUsePermanentItems.Checked then begin
cbShowPermanentItemGroups.Checked := cbUsePermanentItems.Checked;
cbPermanentItemsSubmenu.Checked := cbUsePermanentItems.Checked;
end;
end;
procedure TFrmConfig.cbShowEditHistoryClick(Sender: TObject);
begin
FrmMainPopup.SetShowEditHistory(cbShowEditHistory.checked);
end;
procedure TFrmConfig.cbShowPermanentItemGroupsClick(Sender: TObject);
begin
if (cbShowPermanentItemGroups.Checked) then begin
cbPermanentItemsSubmenu.Checked := not cbShowPermanentItemGroups.Checked;
end;
cbUsePermanentItems.checked := cbPermanentItemsSubmenu.Checked or
cbShowPermanentItemGroups.checked;
FrmMainPopup.SetShowPermeanentItemGroups(cbShowPermanentItemGroups.checked);
end;
procedure TFrmConfig.cbPermanentItemsSubmenuClick(Sender: TObject);
begin
if (cbPermanentItemsSubmenu.Checked) then begin
cbShowPermanentItemGroups.Checked := not cbPermanentItemsSubmenu.Checked;
end;
cbUsePermanentItems.checked := cbPermanentItemsSubmenu.Checked or
cbShowPermanentItemGroups.Checked ;
FrmMainPopup.SetShowPermanentItemSubmenu(cbPermanentItemsSubmenu.Checked);
end;
procedure TFrmConfig.btnEditPermanentItemsClick(Sender: TObject);
begin
frmPermanent.ShowModal;
end;
procedure TFrmConfig.cbPasteAllClick(Sender: TObject);
begin
frmMainPopup.SetShowPasteAll(cbPasteAll.checked);
end;
//============================
// Pasting Options
//============================
procedure TFrmConfig.rbTypingClick(Sender: TObject);
begin
Paste.SetMimicTyping;
end;
procedure TFrmConfig.rbPasteClick(Sender: TObject);
begin
Paste.SetUsePaste;
end;
procedure TFrmConfig.rbPasteSIClick(Sender: TObject);
begin
Paste.SetUsePasteSI;
end;
procedure TFrmConfig.rbClipboardOnlyClick(Sender: TObject);
begin
Paste.SetClipboardOnly;
end;
procedure TFrmConfig.cbMoveFirstClick(Sender: TObject);
begin
frmMainPopup.SetMoveSelectedItemToTop(cbmovefirst.checked);
end;
procedure TFrmConfig.cbShowCurrentClick(Sender: TObject);
begin
frmMainPopup.SetShowCurrentItem(cbSHowCurrent.checked);
end;
procedure TFrmConfig.cbShowLastClick(Sender: TObject);
begin
frmMainPopup.SetDoShowLast(cbShowLast.checked);
end;
procedure TFrmConfig.udCharactersClick(Sender: TObject;
Button: TUDBtnType);
begin
frmMainPopup.SetVisibleCharacterCount(udCharacters.Position);
end;
//
// close/save/cancel
// TreeView clicks
//
procedure TFrmConfig.btnSaveClick(Sender: TObject);
begin
self.HotkeySave;
try
HotKeyPopup.SetHotKey(Hotkey_Ctrl, Hotkey_Alt,
Hotkey_Shift, Hotkey_Winkey, Hotkey_key);
if (cbUseTooltipHotkey.checked) then begin
if (TTHotKeyPopup <> nil) then begin
TTHotKeyPopup.SetHotKey(TTHotkey_Ctrl, TTHotkey_Alt,
TTHotkey_Shift, TTHotkey_Winkey, TTHotkey_key);
PTTHotKeyPopup.SetHotKey(PTTHotkey_Ctrl, PTTHotkey_Alt,
PTTHotkey_Shift, PTTHotkey_Winkey, PTTHotkey_key)
end else begin
TTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyTTHotKey',
TTHotkey_Ctrl, TTHotkey_Alt, TTHotkey_Shift,
TTHotkey_Winkey, TTHotkey_Key
);
PTTHotKeyPopup := TACHotKey.Create(FrmMainPopup.handle, 'ArsClip.exe.MyPTTHotKey',
PTTHotkey_Ctrl, PTTHotkey_Alt, PTTHotkey_Shift,
PTTHotkey_Winkey, PTTHotkey_Key
);
end;
end else begin
MyFree(TTHotKeyPopup);
MyFree(PTTHotKeyPopup);
end;
except
EXIT;
end;
{if (self.SetHotKey) then begin}
self.close;
{end;}
end;
procedure TFrmConfig.btnCancelClick(Sender: TObject);
begin
self.Close;
end;
procedure TFrmConfig.FormClose(Sender: TObject; var Action: TCloseAction);
begin
self.HotkeyLoad;
end;
procedure TFrmConfig.tvOptionsClick(Sender: TObject);
begin
//self.ShowNewPanel;
pcPanels.ActivePageIndex := (tvOptions.Selected.AbsoluteIndex);
end;
procedure TFrmConfig.tvOptionsCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
begin
AllowCollapse := false;
end;
procedure TFrmConfig.bEditPopupHotkeyClick(Sender: TObject);
var w : word;
s : string;
ha, hs, hc, hw : boolean;
begin
if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
Hotkey_Alt := ha;
Hotkey_Shift := hs;
Hotkey_Ctrl := hc;
Hotkey_Winkey := hw;
Hotkey_Key := w;
lblKeyname.caption := s;
end;
end;
procedure TFrmConfig.bEditToolTipHotkeyClick(Sender: TObject);
var w : word;
s : string;
ha, hs, hc, hw : boolean;
begin
if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
TTHotkey_Alt := ha;
TTHotkey_Shift := hs;
TTHotkey_Ctrl := hc;
TTHotkey_Winkey := hw;
TTHotkey_Key := w;
lblToolTipKeyname.caption := s;
end;
end;
procedure TFrmConfig.bEditPreviousToolTipHotkeyClick(Sender: TObject);
var w : word;
s : string;
ha, hs, hc, hw : boolean;
begin
if FrmHotkey.GetHotkey( ha, hs ,hc , hw, w, s) then begin
PTTHotkey_Alt := ha;
PTTHotkey_Shift := hs;
PTTHotkey_Ctrl := hc;
PTTHotkey_Winkey := hw;
PTTHotkey_Key := w;
lblPreviousTooltipKeyname.caption := s;
end;
end;
procedure TFrmConfig.cbDisableWhenScrollLockClick(Sender: TObject);
begin
frmClipboardManager.SetDisableWhenScrollLock(cbDisableWhenScrollLock.checked);
end;
procedure TFrmConfig.cbDisableSystemTrayIconNotificationClick(
Sender: TObject);
begin
FrmSysTrayMenu.SetDisableIconChanges(cbDisableSystemTrayIconNotification.checked);
end;
procedure TFrmConfig.cboCopyClickKeyClick(Sender: TObject);
begin
FrmMainPopup.SetCopyKey(self.cboCopyClickKey.ItemIndex);
end;
procedure TFrmConfig.cboPermanentClickKeyClick(Sender: TObject);
begin
FrmMainPopup.SetPermanentKey(self.cboPermanentClickKey.ItemIndex);
end;
procedure TFrmConfig.cboMimicClickKeyClick(Sender: TObject);
begin
FrmMainPopup.SetMimicKey(self.cboMimicClickKey.ItemIndex);
end;
procedure TFrmConfig.rbCtrlClickRunClick(Sender: TObject);
begin
FrmMainPopup.SetCtrlClickOpen(rbCtrlClickRun.checked);
end;
procedure TFrmConfig.rbCtrlClickMenuClick(Sender: TObject);
begin
FrmMainPopup.SetCtrlClickMenu(rbCtrlClickMenu.checked);
end;
procedure TFrmConfig.tvOptionsChange(Sender: TObject; Node: TTreeNode);
begin
//self.ShowNewPanel;
pcPanels.ActivePageIndex := (tvOptions.Selected.AbsoluteIndex);
end;
procedure TFrmConfig.cbShowFormModeClick(Sender: TObject);
begin
FrmMainPopup.SetShowFormMode(cbShowFormMode.Checked);
end;
procedure TFrmConfig.cbPopupDoubleclickClick(Sender: TObject);
begin
if cbPopupDoubleclick.checked then
cbPopupDoubleclickTray.checked := not cbPopupDoubleclick.checked;
end;
procedure TFrmConfig.cbPopupDoubleclickTrayClick(Sender: TObject);
begin
if cbPopupDoubleclickTray.checked then
cbPopupDoubleclick.checked := not cbPopupDoubleclickTray.checked;
end;
procedure TFrmConfig.cbShowSwitchToClick(Sender: TObject);
begin
cbPermanentItemsSubmenu.Enabled := cbShowSwitchTo.Checked;
cbShowPermanentItemGroups.Enabled := cbShowSwitchTo.Checked;
end;
procedure TFrmConfig.bntSetFontClick(Sender: TObject);
var ini : TIniFile;
begin
if FontDialog.Execute then begin
FrmDummyUnicodePopup.Font := FontDialog.Font;
ini := TInifile.Create( self.GetINIFileName );
//
// Hotkey Panel
//
ini.WriteString('Font','Name', FontDialog.Font.Name);
ini.WriteInteger('Font','CharSet', FontDialog.Font.Charset);
ini.WriteInteger('Font','Color', FontDialog.Font.Color);
ini.WriteInteger('Font','Size', FontDialog.Font.Size);
end;
end;
end.