mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:49:12 +02:00
IDE+LCL: Combine PropEdits.KeyAndShiftStateToKeyString and TWidgetSet.GetAcceleratorString, move to lclproc. Remove unused constants.
git-svn-id: trunk@33283 -
This commit is contained in:
parent
a54eb80b2f
commit
c4cee0e6dd
@ -400,6 +400,7 @@ resourcestring
|
|||||||
peFilterEditor = 'Filter editor';
|
peFilterEditor = 'Filter editor';
|
||||||
peFilterName = 'Filter name';
|
peFilterName = 'Filter name';
|
||||||
peFilter = 'Filter';
|
peFilter = 'Filter';
|
||||||
|
pirsUnit = 'Pascal unit';
|
||||||
|
|
||||||
fesFormCaption = 'New field';
|
fesFormCaption = 'New field';
|
||||||
fesFieldType = 'Field Type';
|
fesFieldType = 'Field Type';
|
||||||
@ -424,78 +425,8 @@ resourcestring
|
|||||||
oisMoveDownHint = 'Move field down';
|
oisMoveDownHint = 'Move field down';
|
||||||
oisSelectAllHint = 'Select All Fields';
|
oisSelectAllHint = 'Select All Fields';
|
||||||
oisUnselectAllHint = 'Unselect All';
|
oisUnselectAllHint = 'Unselect All';
|
||||||
|
|
||||||
//Key strings
|
|
||||||
srVK_UNKNOWN = 'Unknown';
|
|
||||||
srVK_LBUTTON = 'Mouse Button Left';
|
|
||||||
srVK_RBUTTON = 'Mouse Button Right';
|
|
||||||
srVK_CANCEL = 'Cancel'; //= dlgCancel
|
|
||||||
srVK_MBUTTON = 'Mouse Button Middle';
|
|
||||||
srVK_BACK = 'Backspace';
|
|
||||||
srVK_TAB = 'Tab';
|
|
||||||
srVK_CLEAR = 'Clear';
|
|
||||||
srVK_RETURN = 'Return';
|
|
||||||
srVK_SHIFT = 'Shift';
|
|
||||||
srVK_CONTROL = 'Control';
|
|
||||||
srVK_SUPER = 'Super';
|
|
||||||
srVK_META = 'Meta';
|
|
||||||
srVK_CMD = 'Cmd';
|
|
||||||
srVK_MENU = 'Menu';
|
|
||||||
srVK_PAUSE = 'Pause key';
|
|
||||||
srVK_CAPITAL = 'Capital';
|
|
||||||
srVK_KANA = 'Kana';
|
|
||||||
srVK_JUNJA = 'Junja';
|
|
||||||
srVK_FINAL = 'Final';
|
|
||||||
srVK_HANJA = 'Hanja';
|
|
||||||
srVK_ESCAPE = 'Escape';
|
|
||||||
srVK_CONVERT = 'Convert';
|
|
||||||
srVK_NONCONVERT = 'Nonconvert';
|
|
||||||
srVK_ACCEPT = 'Accept';
|
|
||||||
srVK_MODECHANGE = 'Mode Change';
|
|
||||||
srVK_SPACE = 'Space key';
|
|
||||||
srVK_PRIOR = 'Prior';
|
|
||||||
srVK_NEXT = 'Next';
|
|
||||||
srVK_END = 'End';
|
|
||||||
srVK_HOME = 'Home';
|
|
||||||
srVK_LEFT = 'Left';
|
|
||||||
srVK_UP = 'Up';
|
|
||||||
srVK_RIGHT = 'Right';
|
|
||||||
srVK_DOWN = 'Down'; //= dlgdownword
|
|
||||||
srVK_SELECT = 'Select'; //= lismenuselect
|
|
||||||
srVK_PRINT = 'Print';
|
|
||||||
srVK_EXECUTE = 'Execute';
|
|
||||||
srVK_SNAPSHOT = 'Snapshot';
|
|
||||||
srVK_INSERT = 'Insert';
|
|
||||||
srVK_DELETE = 'Delete'; //dlgeddelete
|
|
||||||
srVK_HELP = 'Help';
|
|
||||||
srVK_LWIN = 'Left Windows Key';
|
|
||||||
srVK_RWIN = 'Right Windows Key';
|
|
||||||
srVK_APPS = 'Application Key';
|
|
||||||
srVK_NUMPAD = 'Numpad %d';
|
|
||||||
srVK_NUMLOCK = 'Numlock';
|
|
||||||
srVK_SCROLL = 'Scroll';
|
|
||||||
lisOEMPlus = 'OEM plus';
|
|
||||||
lisOEM1 = 'OEM 1';
|
|
||||||
lisOEMComma = 'OEM comma';
|
|
||||||
lisOEMMinus = 'OEM minus';
|
|
||||||
lisOEMPeriod = 'OEM period';
|
|
||||||
lisOEM2 = 'OEM 2';
|
|
||||||
lisOEM3 = 'OEM 3';
|
|
||||||
lisOEM4 = 'OEM 4';
|
|
||||||
lisOEM5 = 'OEM 5';
|
|
||||||
lisOEM6 = 'OEM 6';
|
|
||||||
lisOEM7 = 'OEM 7';
|
|
||||||
lisOEM8 = 'OEM 8';
|
|
||||||
srVK_IRREGULAR = 'Irregular';
|
|
||||||
srVK_NONE = 'none';
|
|
||||||
srkm_Alt = 'Alt';
|
|
||||||
srkm_Ctrl = 'Ctrl';
|
|
||||||
pirsUnit = 'Pascal unit';
|
|
||||||
oisIndexOutOfBounds = 'Index out of bounds';
|
|
||||||
oisNotSupported = 'not supported';
|
|
||||||
oisUnableToChangeParentOfControlToNewParent = 'Unable to change parent of '
|
oisUnableToChangeParentOfControlToNewParent = 'Unable to change parent of '
|
||||||
+'control %s%s%s to new parent %s%s%s.%s%s';
|
+'control %s%s%s to new parent %s%s%s.%s%s';
|
||||||
|
|
||||||
oisAddCollectionItem = '&Add Item';
|
oisAddCollectionItem = '&Add Item';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -1396,13 +1396,6 @@ type
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
const
|
|
||||||
UnknownVKPrefix = 'Word(''';
|
|
||||||
UnknownVKPostfix = ''')';
|
|
||||||
function KeyAndShiftStateToKeyString(Key: word; ShiftState: TShiftState): String;
|
|
||||||
function KeyStringIsIrregular(const s: string): boolean;
|
|
||||||
function KeyStringToVKCode(const s: string): word;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TStringsPropEditorDlg = class(TStringsPropEditorFrm)
|
TStringsPropEditorDlg = class(TStringsPropEditorFrm)
|
||||||
public
|
public
|
||||||
@ -5959,141 +5952,6 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function KeyAndShiftStateToKeyString(Key: word; ShiftState: TShiftState): String;
|
|
||||||
var
|
|
||||||
p: integer;
|
|
||||||
|
|
||||||
procedure AddStr(const s: string);
|
|
||||||
begin
|
|
||||||
if s <> '' then
|
|
||||||
begin
|
|
||||||
inc(p);
|
|
||||||
Result := Result + s;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure AddAttribute(const s: string);
|
|
||||||
begin
|
|
||||||
if p > 0 then
|
|
||||||
AddStr('+');
|
|
||||||
AddStr(s);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Tricky routine. This only works for western languages
|
|
||||||
// TODO: This should be replaces by the winapi VKtoChar functions
|
|
||||||
//
|
|
||||||
procedure AddKey;
|
|
||||||
begin
|
|
||||||
if p > 0 then
|
|
||||||
AddStr('+');
|
|
||||||
|
|
||||||
case Key of
|
|
||||||
VK_UNKNOWN :AddStr(srVK_UNKNOWN);
|
|
||||||
VK_LBUTTON :AddStr(srVK_LBUTTON);
|
|
||||||
VK_RBUTTON :AddStr(srVK_RBUTTON);
|
|
||||||
VK_CANCEL :AddStr(srVK_CANCEL);
|
|
||||||
VK_MBUTTON :AddStr(srVK_MBUTTON);
|
|
||||||
VK_BACK :AddStr(srVK_BACK);
|
|
||||||
VK_TAB :AddStr(srVK_TAB);
|
|
||||||
VK_CLEAR :AddStr(srVK_CLEAR);
|
|
||||||
VK_RETURN :AddStr(srVK_RETURN);
|
|
||||||
VK_SHIFT :AddStr(srVK_SHIFT);
|
|
||||||
VK_CONTROL :AddStr(srVK_CONTROL);
|
|
||||||
VK_MENU :AddStr(srVK_MENU);
|
|
||||||
VK_PAUSE :AddStr(srVK_PAUSE);
|
|
||||||
VK_CAPITAL :AddStr(srVK_CAPITAL);
|
|
||||||
VK_KANA :AddStr(srVK_KANA);
|
|
||||||
// VK_HANGUL :AddStr('Hangul');
|
|
||||||
VK_JUNJA :AddStr(srVK_JUNJA);
|
|
||||||
VK_FINAL :AddStr(srVK_FINAL);
|
|
||||||
VK_HANJA :AddStr(srVK_HANJA );
|
|
||||||
// VK_KANJI :AddStr('Kanji');
|
|
||||||
VK_ESCAPE :AddStr(srVK_ESCAPE);
|
|
||||||
VK_CONVERT :AddStr(srVK_CONVERT);
|
|
||||||
VK_NONCONVERT :AddStr(srVK_NONCONVERT);
|
|
||||||
VK_ACCEPT :AddStr(srVK_ACCEPT);
|
|
||||||
VK_MODECHANGE :AddStr(srVK_MODECHANGE);
|
|
||||||
VK_SPACE :AddStr(srVK_SPACE);
|
|
||||||
VK_PRIOR :AddStr(srVK_PRIOR);
|
|
||||||
VK_NEXT :AddStr(srVK_NEXT);
|
|
||||||
VK_END :AddStr(srVK_END);
|
|
||||||
VK_HOME :AddStr(srVK_HOME);
|
|
||||||
VK_LEFT :AddStr(srVK_LEFT);
|
|
||||||
VK_UP :AddStr(srVK_UP);
|
|
||||||
VK_RIGHT :AddStr(srVK_RIGHT);
|
|
||||||
VK_DOWN :AddStr(srVK_DOWN);
|
|
||||||
VK_SELECT :AddStr(srVK_SELECT);
|
|
||||||
VK_PRINT :AddStr(srVK_PRINT);
|
|
||||||
VK_EXECUTE :AddStr(srVK_EXECUTE);
|
|
||||||
VK_SNAPSHOT :AddStr(srVK_SNAPSHOT);
|
|
||||||
VK_INSERT :AddStr(srVK_INSERT);
|
|
||||||
VK_DELETE :AddStr(srVK_DELETE);
|
|
||||||
VK_HELP :AddStr(srVK_HELP);
|
|
||||||
VK_0..VK_9 :AddStr(IntToStr(Key-VK_0));
|
|
||||||
VK_A..VK_Z :AddStr(chr(ord('A')+Key-VK_A));
|
|
||||||
VK_LWIN :AddStr(srVK_LWIN);
|
|
||||||
VK_RWIN :AddStr(srVK_RWIN);
|
|
||||||
VK_APPS :AddStr(srVK_APPS);
|
|
||||||
VK_NUMPAD0..VK_NUMPAD9: AddStr(Format(srVK_NUMPAD,[Key-VK_NUMPAD0]));
|
|
||||||
VK_MULTIPLY :AddStr('*');
|
|
||||||
VK_ADD :AddStr('+');
|
|
||||||
VK_SEPARATOR :AddStr('|');
|
|
||||||
VK_SUBTRACT :AddStr('-');
|
|
||||||
VK_DECIMAL :AddStr('.');
|
|
||||||
VK_DIVIDE :AddStr('/');
|
|
||||||
VK_F1..VK_F24 :AddStr('F'+IntToStr(Key-VK_F1+1));
|
|
||||||
VK_NUMLOCK :AddStr(srVK_NUMLOCK);
|
|
||||||
VK_SCROLL :AddStr(srVK_SCROLL);
|
|
||||||
VK_OEM_1 :AddStr(lisOEM1);
|
|
||||||
VK_OEM_PLUS :AddStr(lisOEMPlus);
|
|
||||||
VK_OEM_COMMA :AddStr(lisOEMComma);
|
|
||||||
VK_OEM_MINUS :AddStr(lisOEMMinus);
|
|
||||||
VK_OEM_PERIOD :AddStr(lisOEMPeriod);
|
|
||||||
VK_OEM_2 :AddStr(lisOEM2);
|
|
||||||
VK_OEM_3 :AddStr(lisOEM3);
|
|
||||||
VK_OEM_4 :AddStr(lisOEM4);
|
|
||||||
VK_OEM_5 :AddStr(lisOEM5);
|
|
||||||
VK_OEM_6 :AddStr(lisOEM6);
|
|
||||||
VK_OEM_7 :AddStr(lisOEM7);
|
|
||||||
VK_OEM_8 :AddStr(lisOEM8);
|
|
||||||
// VK_EQUAL :AddStr('=');
|
|
||||||
// VK_COMMA :AddStr(',');
|
|
||||||
// VK_POINT :AddStr('.');
|
|
||||||
// VK_SLASH :AddStr('/');
|
|
||||||
// VK_AT :AddStr('@');
|
|
||||||
else
|
|
||||||
AddStr(UnknownVKPrefix);
|
|
||||||
AddStr(IntToStr(Key));
|
|
||||||
AddStr(UnknownVKPostfix);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Result := '';
|
|
||||||
p := 0;
|
|
||||||
if ssCtrl in ShiftState then AddAttribute(srkm_Ctrl);
|
|
||||||
if ssAlt in ShiftState then AddAttribute(srkm_Alt);
|
|
||||||
if ssShift in ShiftState then AddAttribute(srVK_SHIFT);
|
|
||||||
if ssMeta in ShiftState then
|
|
||||||
{$IFDEF LCLcarbon}
|
|
||||||
AddAttribute(srVK_CMD);
|
|
||||||
{$ELSE}
|
|
||||||
AddAttribute(srVK_META);
|
|
||||||
{$ENDIF}
|
|
||||||
if ssSuper in ShiftState then AddAttribute(srVK_SUPER);
|
|
||||||
AddKey;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function KeyStringIsIrregular(const s: string): boolean;
|
|
||||||
begin
|
|
||||||
if (length(UnknownVKPrefix)<length(s))
|
|
||||||
and (AnsiStrLComp(PChar(s),PChar(UnknownVKPrefix),length(UnknownVKPrefix))=0)
|
|
||||||
then
|
|
||||||
Result:=true
|
|
||||||
else
|
|
||||||
Result:=false;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function KeyStringToVKCode(const s: string): word;
|
function KeyStringToVKCode(const s: string): word;
|
||||||
var
|
var
|
||||||
i: PtrInt;
|
i: PtrInt;
|
||||||
|
@ -355,93 +355,11 @@ begin
|
|||||||
Result:= false;
|
Result:= false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// MWE: Work in progress
|
|
||||||
function TWidgetSet.GetAcceleratorString(const AVKey: Byte;
|
function TWidgetSet.GetAcceleratorString(const AVKey: Byte;
|
||||||
const AShiftState: TShiftState): String;
|
const AShiftState: TShiftState): String;
|
||||||
// If the interface has a better way to create a string it can override this
|
// If the interface has a better way to create a string it can override this
|
||||||
|
|
||||||
procedure AddPart(const APart: string);
|
|
||||||
begin
|
|
||||||
if Result <> '' then Result := Result + '+';
|
|
||||||
Result := Result + APart;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Tricky routine. This only works for western languages
|
|
||||||
procedure AddKey;
|
|
||||||
begin
|
|
||||||
case AVKey of
|
|
||||||
VK_UNKNOWN :AddPart(ifsVK_UNKNOWN);
|
|
||||||
VK_LBUTTON :AddPart(ifsVK_LBUTTON);
|
|
||||||
VK_RBUTTON :AddPart(ifsVK_RBUTTON);
|
|
||||||
VK_CANCEL :AddPart(ifsVK_CANCEL);
|
|
||||||
VK_MBUTTON :AddPart(ifsVK_MBUTTON);
|
|
||||||
VK_BACK :AddPart(ifsVK_BACK);
|
|
||||||
VK_TAB :AddPart(ifsVK_TAB);
|
|
||||||
VK_CLEAR :AddPart(ifsVK_CLEAR);
|
|
||||||
VK_RETURN :AddPart(ifsVK_RETURN);
|
|
||||||
VK_SHIFT :AddPart(ifsVK_SHIFT);
|
|
||||||
VK_CONTROL :AddPart(ifsVK_CONTROL);
|
|
||||||
VK_MENU :AddPart(ifsVK_MENU);
|
|
||||||
VK_PAUSE :AddPart(ifsVK_PAUSE);
|
|
||||||
VK_CAPITAL :AddPart(ifsVK_CAPITAL);
|
|
||||||
VK_KANA :AddPart(ifsVK_KANA);
|
|
||||||
// VK_HANGUL :AddPart('Hangul');
|
|
||||||
VK_JUNJA :AddPart(ifsVK_JUNJA);
|
|
||||||
VK_FINAL :AddPart(ifsVK_FINAL);
|
|
||||||
VK_HANJA :AddPart(ifsVK_HANJA );
|
|
||||||
// VK_KANJI :AddPart('Kanji');
|
|
||||||
VK_ESCAPE :AddPart(ifsVK_ESCAPE);
|
|
||||||
VK_CONVERT :AddPart(ifsVK_CONVERT);
|
|
||||||
VK_NONCONVERT :AddPart(ifsVK_NONCONVERT);
|
|
||||||
VK_ACCEPT :AddPart(ifsVK_ACCEPT);
|
|
||||||
VK_MODECHANGE :AddPart(ifsVK_MODECHANGE);
|
|
||||||
VK_SPACE :AddPart(ifsVK_SPACE);
|
|
||||||
VK_PRIOR :AddPart(ifsVK_PRIOR);
|
|
||||||
VK_NEXT :AddPart(ifsVK_NEXT);
|
|
||||||
VK_END :AddPart(ifsVK_END);
|
|
||||||
VK_HOME :AddPart(ifsVK_HOME);
|
|
||||||
VK_LEFT :AddPart(ifsVK_LEFT);
|
|
||||||
VK_UP :AddPart(ifsVK_UP);
|
|
||||||
VK_RIGHT :AddPart(ifsVK_RIGHT);
|
|
||||||
VK_DOWN :AddPart(ifsVK_DOWN);
|
|
||||||
VK_SELECT :AddPart(ifsVK_SELECT);
|
|
||||||
VK_PRINT :AddPart(ifsVK_PRINT);
|
|
||||||
VK_EXECUTE :AddPart(ifsVK_EXECUTE);
|
|
||||||
VK_SNAPSHOT :AddPart(ifsVK_SNAPSHOT);
|
|
||||||
VK_INSERT :AddPart(ifsVK_INSERT);
|
|
||||||
VK_DELETE :AddPart(ifsVK_DELETE);
|
|
||||||
VK_HELP :AddPart(ifsVK_HELP);
|
|
||||||
VK_0..VK_9 :AddPart(chr(ord('0')+AVKey-VK_0));
|
|
||||||
VK_A..VK_Z :AddPart(chr(ord('A')+AVKey-VK_A));
|
|
||||||
VK_LWIN :AddPart(ifsVK_LWIN);
|
|
||||||
VK_RWIN :AddPart(ifsVK_RWIN);
|
|
||||||
VK_APPS :AddPart(ifsVK_APPS);
|
|
||||||
VK_NUMPAD0..VK_NUMPAD9: AddPart(Format(ifsVK_NUMPAD,[AVKey-VK_NUMPAD0]));
|
|
||||||
VK_MULTIPLY :AddPart('*');
|
|
||||||
VK_ADD :AddPart('+');
|
|
||||||
VK_SEPARATOR :AddPart('|');
|
|
||||||
VK_SUBTRACT :AddPart('-');
|
|
||||||
VK_DECIMAL :AddPart('.');
|
|
||||||
VK_DIVIDE :AddPart('/');
|
|
||||||
VK_F1..VK_F24: AddPart('F'+IntToStr(AVKey-VK_F1+1));
|
|
||||||
VK_NUMLOCK :AddPart(ifsVK_NUMLOCK);
|
|
||||||
VK_SCROLL :AddPart(ifsVK_SCROLL);
|
|
||||||
// VK_EQUAL :AddPart('=');
|
|
||||||
// VK_COMMA :AddPart(',');
|
|
||||||
// VK_POINT :AddPart('.');
|
|
||||||
// VK_SLASH :AddPart('/');
|
|
||||||
// VK_AT :AddPart('@');
|
|
||||||
else
|
|
||||||
AddPart(UNKNOWN_VK_PREFIX + IntToStr(AVKey) + UNKNOWN_VK_POSTFIX);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := KeyAndShiftStateToKeyString(AVKey, AShiftState);
|
||||||
if ssCtrl in AShiftState then AddPart(ifsCtrl);
|
|
||||||
if ssAlt in AShiftState then AddPart(ifsAlt);
|
|
||||||
if ssShift in AShiftState then AddPart(ifsVK_SHIFT);
|
|
||||||
AddKey;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWidgetSet.GetCaretRespondToFocus(handle: HWND;
|
function TWidgetSet.GetCaretRespondToFocus(handle: HWND;
|
||||||
|
@ -231,10 +231,6 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
|
||||||
UNKNOWN_VK_PREFIX = 'Word(''';
|
|
||||||
UNKNOWN_VK_POSTFIX = ''')';
|
|
||||||
|
|
||||||
{ TDialogButtons }
|
{ TDialogButtons }
|
||||||
|
|
||||||
procedure TDialogButtons.SetCancelButton(const AValue: TDialogButton);
|
procedure TDialogButtons.SetCancelButton(const AValue: TDialogButton);
|
||||||
|
111
lcl/lclproc.pas
111
lcl/lclproc.pas
@ -120,13 +120,14 @@ function CompareAddrWithLineInfoCacheItem(Addr, Item: Pointer): integer;
|
|||||||
type
|
type
|
||||||
TStringsSortCompare = function(const Item1, Item2: string): Integer;
|
TStringsSortCompare = function(const Item1, Item2: string): Integer;
|
||||||
|
|
||||||
|
|
||||||
procedure MergeSort(List: TFPList; const OnCompare: TListSortCompare); // sort so that for each i is OnCompare(List[i],List[i+1])<=0
|
procedure MergeSort(List: TFPList; const OnCompare: TListSortCompare); // sort so that for each i is OnCompare(List[i],List[i+1])<=0
|
||||||
procedure MergeSort(List: TStrings; const OnCompare: TStringsSortCompare); // sort so that for each i is OnCompare(List[i],List[i+1])<=0
|
procedure MergeSort(List: TStrings; const OnCompare: TStringsSortCompare); // sort so that for each i is OnCompare(List[i],List[i+1])<=0
|
||||||
|
|
||||||
function GetEnumValueDef(TypeInfo: PTypeInfo; const Name: string;
|
function GetEnumValueDef(TypeInfo: PTypeInfo; const Name: string;
|
||||||
const DefaultValue: Integer): Integer;
|
const DefaultValue: Integer): Integer;
|
||||||
|
|
||||||
|
function KeyAndShiftStateToKeyString(Key: word; ShiftState: TShiftState): String;
|
||||||
|
function KeyStringIsIrregular(const s: string): boolean;
|
||||||
function ShortCutToText(ShortCut: TShortCut): string;// untranslated
|
function ShortCutToText(ShortCut: TShortCut): string;// untranslated
|
||||||
function TextToShortCut(const ShortCutText: string): TShortCut;// untranslated
|
function TextToShortCut(const ShortCutText: string): TShortCut;// untranslated
|
||||||
|
|
||||||
@ -182,7 +183,6 @@ function TruncToCardinal(const e: Extended): cardinal;
|
|||||||
function StrToDouble(const s: string): double;
|
function StrToDouble(const s: string): double;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
procedure RaiseGDBException(const Msg: string);
|
procedure RaiseGDBException(const Msg: string);
|
||||||
procedure RaiseAndCatchException;
|
procedure RaiseAndCatchException;
|
||||||
@ -392,6 +392,8 @@ uses gettext;
|
|||||||
|
|
||||||
const
|
const
|
||||||
Str_LCL_Debug_File = 'lcldebug.log';
|
Str_LCL_Debug_File = 'lcldebug.log';
|
||||||
|
UNKNOWN_VK_PREFIX = 'Word(''';
|
||||||
|
UNKNOWN_VK_POSTFIX = ''')';
|
||||||
|
|
||||||
var
|
var
|
||||||
InterfaceInitializationHandlers: TFPList = nil;
|
InterfaceInitializationHandlers: TFPList = nil;
|
||||||
@ -504,6 +506,108 @@ begin
|
|||||||
Result:=DefaultValue;
|
Result:=DefaultValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Used also by TWidgetSet.GetAcceleratorString
|
||||||
|
function KeyAndShiftStateToKeyString(Key: word; ShiftState: TShiftState): String;
|
||||||
|
//function AcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String;
|
||||||
|
|
||||||
|
procedure AddPart(const APart: string);
|
||||||
|
begin
|
||||||
|
if Result <> '' then
|
||||||
|
Result := Result + '+';
|
||||||
|
Result := Result + APart;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Tricky routine. This only works for western languages
|
||||||
|
procedure AddKey;
|
||||||
|
begin
|
||||||
|
case Key of
|
||||||
|
VK_UNKNOWN :AddPart(ifsVK_UNKNOWN);
|
||||||
|
VK_LBUTTON :AddPart(ifsVK_LBUTTON);
|
||||||
|
VK_RBUTTON :AddPart(ifsVK_RBUTTON);
|
||||||
|
VK_CANCEL :AddPart(ifsVK_CANCEL);
|
||||||
|
VK_MBUTTON :AddPart(ifsVK_MBUTTON);
|
||||||
|
VK_BACK :AddPart(ifsVK_BACK);
|
||||||
|
VK_TAB :AddPart(ifsVK_TAB);
|
||||||
|
VK_CLEAR :AddPart(ifsVK_CLEAR);
|
||||||
|
VK_RETURN :AddPart(ifsVK_RETURN);
|
||||||
|
VK_SHIFT :AddPart(ifsVK_SHIFT);
|
||||||
|
VK_CONTROL :AddPart(ifsVK_CONTROL);
|
||||||
|
VK_MENU :AddPart(ifsVK_MENU);
|
||||||
|
VK_PAUSE :AddPart(ifsVK_PAUSE);
|
||||||
|
VK_CAPITAL :AddPart(ifsVK_CAPITAL);
|
||||||
|
VK_KANA :AddPart(ifsVK_KANA);
|
||||||
|
// VK_HANGUL :AddPart('Hangul');
|
||||||
|
VK_JUNJA :AddPart(ifsVK_JUNJA);
|
||||||
|
VK_FINAL :AddPart(ifsVK_FINAL);
|
||||||
|
VK_HANJA :AddPart(ifsVK_HANJA );
|
||||||
|
// VK_KANJI :AddPart('Kanji');
|
||||||
|
VK_ESCAPE :AddPart(ifsVK_ESCAPE);
|
||||||
|
VK_CONVERT :AddPart(ifsVK_CONVERT);
|
||||||
|
VK_NONCONVERT :AddPart(ifsVK_NONCONVERT);
|
||||||
|
VK_ACCEPT :AddPart(ifsVK_ACCEPT);
|
||||||
|
VK_MODECHANGE :AddPart(ifsVK_MODECHANGE);
|
||||||
|
VK_SPACE :AddPart(ifsVK_SPACE);
|
||||||
|
VK_PRIOR :AddPart(ifsVK_PRIOR);
|
||||||
|
VK_NEXT :AddPart(ifsVK_NEXT);
|
||||||
|
VK_END :AddPart(ifsVK_END);
|
||||||
|
VK_HOME :AddPart(ifsVK_HOME);
|
||||||
|
VK_LEFT :AddPart(ifsVK_LEFT);
|
||||||
|
VK_UP :AddPart(ifsVK_UP);
|
||||||
|
VK_RIGHT :AddPart(ifsVK_RIGHT);
|
||||||
|
VK_DOWN :AddPart(ifsVK_DOWN);
|
||||||
|
VK_SELECT :AddPart(ifsVK_SELECT);
|
||||||
|
VK_PRINT :AddPart(ifsVK_PRINT);
|
||||||
|
VK_EXECUTE :AddPart(ifsVK_EXECUTE);
|
||||||
|
VK_SNAPSHOT :AddPart(ifsVK_SNAPSHOT);
|
||||||
|
VK_INSERT :AddPart(ifsVK_INSERT);
|
||||||
|
VK_DELETE :AddPart(ifsVK_DELETE);
|
||||||
|
VK_HELP :AddPart(ifsVK_HELP);
|
||||||
|
VK_0..VK_9 :AddPart(chr(ord('0')+Key-VK_0));
|
||||||
|
VK_A..VK_Z :AddPart(chr(ord('A')+Key-VK_A));
|
||||||
|
VK_LWIN :AddPart(ifsVK_LWIN);
|
||||||
|
VK_RWIN :AddPart(ifsVK_RWIN);
|
||||||
|
VK_APPS :AddPart(ifsVK_APPS);
|
||||||
|
VK_NUMPAD0..VK_NUMPAD9: AddPart(Format(ifsVK_NUMPAD,[Key-VK_NUMPAD0]));
|
||||||
|
VK_MULTIPLY :AddPart('*');
|
||||||
|
VK_ADD :AddPart('+');
|
||||||
|
VK_SEPARATOR :AddPart('|');
|
||||||
|
VK_SUBTRACT :AddPart('-');
|
||||||
|
VK_DECIMAL :AddPart('.');
|
||||||
|
VK_DIVIDE :AddPart('/');
|
||||||
|
VK_F1..VK_F24: AddPart('F'+IntToStr(Key-VK_F1+1));
|
||||||
|
VK_NUMLOCK :AddPart(ifsVK_NUMLOCK);
|
||||||
|
VK_SCROLL :AddPart(ifsVK_SCROLL);
|
||||||
|
// VK_EQUAL :AddPart('=');
|
||||||
|
// VK_COMMA :AddPart(',');
|
||||||
|
// VK_POINT :AddPart('.');
|
||||||
|
// VK_SLASH :AddPart('/');
|
||||||
|
// VK_AT :AddPart('@');
|
||||||
|
else
|
||||||
|
AddPart(UNKNOWN_VK_PREFIX + IntToStr(Key) + UNKNOWN_VK_POSTFIX);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if ssCtrl in ShiftState then AddPart(ifsCtrl);
|
||||||
|
if ssAlt in ShiftState then AddPart(ifsAlt);
|
||||||
|
if ssShift in ShiftState then AddPart(ifsVK_SHIFT);
|
||||||
|
if ssMeta in ShiftState then
|
||||||
|
{$IFDEF LCLcarbon}
|
||||||
|
AddPart(ifsVK_CMD);
|
||||||
|
{$ELSE}
|
||||||
|
AddPart(ifsVK_META);
|
||||||
|
{$ENDIF}
|
||||||
|
if ssSuper in ShiftState then AddPart(ifsVK_SUPER);
|
||||||
|
AddKey;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function KeyStringIsIrregular(const s: string): boolean;
|
||||||
|
begin
|
||||||
|
Result:=(length(UNKNOWN_VK_PREFIX)<length(s)) and
|
||||||
|
(AnsiStrLComp(PChar(s),PChar(UNKNOWN_VK_PREFIX),length(UNKNOWN_VK_PREFIX))=0);
|
||||||
|
end;
|
||||||
|
|
||||||
function ShortCutToText(ShortCut: TShortCut): string;
|
function ShortCutToText(ShortCut: TShortCut): string;
|
||||||
var
|
var
|
||||||
Name: string;
|
Name: string;
|
||||||
@ -1391,6 +1495,9 @@ begin
|
|||||||
Freemem(MergeList);
|
Freemem(MergeList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// Debug funcs :
|
||||||
|
|
||||||
procedure InitializeDebugOutput;
|
procedure InitializeDebugOutput;
|
||||||
var
|
var
|
||||||
DebugFileName: string;
|
DebugFileName: string;
|
||||||
|
@ -318,6 +318,9 @@ resourceString
|
|||||||
ifsVK_CLEAR = 'Clear';
|
ifsVK_CLEAR = 'Clear';
|
||||||
ifsVK_RETURN = 'Return';
|
ifsVK_RETURN = 'Return';
|
||||||
ifsVK_SHIFT = 'Shift';
|
ifsVK_SHIFT = 'Shift';
|
||||||
|
ifsVK_META = 'Meta';
|
||||||
|
ifsVK_CMD = 'Cmd';
|
||||||
|
ifsVK_SUPER = 'Super';
|
||||||
ifsVK_CONTROL = 'Control';
|
ifsVK_CONTROL = 'Control';
|
||||||
ifsVK_MENU = 'Menu';
|
ifsVK_MENU = 'Menu';
|
||||||
ifsVK_PAUSE = 'Pause key';
|
ifsVK_PAUSE = 'Pause key';
|
||||||
|
@ -528,13 +528,11 @@ const
|
|||||||
//MWE: And should not be used.
|
//MWE: And should not be used.
|
||||||
// The keys they are on map to another VK
|
// The keys they are on map to another VK
|
||||||
|
|
||||||
(*
|
// VK_EQUAL = 187;
|
||||||
VK_EQUAL = 187;
|
// VK_COMMA = 188;
|
||||||
VK_COMMA = 188;
|
// VK_POINT = 190;
|
||||||
VK_POINT = 190;
|
// VK_SLASH = 191;
|
||||||
VK_SLASH = 191;
|
// VK_AT = 192;
|
||||||
VK_AT = 192;
|
|
||||||
*)
|
|
||||||
|
|
||||||
// VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys.
|
// VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys.
|
||||||
// Used only as parameters to GetAsyncKeyState() and GetKeyState().
|
// Used only as parameters to GetAsyncKeyState() and GetKeyState().
|
||||||
|
Loading…
Reference in New Issue
Block a user