MG: alternative key bugfix, shiftstate bugfix

git-svn-id: trunk@297 -
This commit is contained in:
lazarus 2001-06-20 17:00:20 +00:00
parent 16d5355d7b
commit e186a1d1d7
4 changed files with 37 additions and 23 deletions

View File

@ -988,10 +988,6 @@ begin
fRange := rsUnknown;
fAsmStart := False;
fDefaultFilter := SYNS_FilterPascal;
writeln('SYNPASSYN ---------------- operator=',KeyHash('operator'));
writeln('SYNPASSYN ---------------- as=',KeyHash('as'));
end; { Create }
procedure TSynPasSyn.SetLine(NewValue: string; LineNumber:Integer);

View File

@ -633,20 +633,30 @@ begin
end;
procedure TKeyMappingEditForm.OkButtonClick(Sender:TObject);
var NewKey1,NewKey2,a:integer;
var NewKey1,NewKey2:integer;
NewShiftState1,NewShiftState2:TShiftState;
s,ACaption,AText:AnsiString;
ACaption,AText:AnsiString;
DummyRelation:TKeyCommandRelation;
function StrToVKCode(s: string): integer;
var i: integer;
begin
if copy(s,1,6)='Word(''' then
Result:=StrToIntDef(copy(s,7,length(s)-8),VK_UNKNOWN)
else if s<>'none' then begin
for i:=1 to 200 do
if KeyAndShiftStateToStr(i,[])=s then
Result:=i;
end else
Result:=VK_UNKNOWN;
end;
begin
NewKey1:=VK_UNKNOWN;
NewShiftState1:=[];
NewKey2:=VK_UNKNOWN;
NewShiftState2:=[];
s:=Key1KeyComboBox.Text;
if s<>'none' then
for a:=1 to 145 do
if KeyAndShiftStateToStr(a,[])=s then
NewKey1:=a;
NewKey1:=StrToVKCode(Key1KeyComboBox.Text);
if NewKey1<>VK_UNKNOWN then begin
if Key1CtrlCheckBox.Checked then include(NewShiftState1,ssCtrl);
if Key1AltCheckBox.Checked then include(NewShiftState1,ssAlt);
@ -661,11 +671,7 @@ begin
Application.MessageBox(PChar(AText),PChar(ACaption),0);
exit;
end;
s:=Key2KeyComboBox.Text;
if s<>'none' then
for a:=1 to 145 do
if KeyAndShiftStateToStr(a,[])=s then
NewKey2:=a;
NewKey2:=StrToVKCode(Key2KeyComboBox.Text);
if (NewKey1=NewKey2) and (NewShiftState1=NewShiftState2) then
NewKey2:=VK_UNKNOWN;
if NewKey2<>VK_UNKNOWN then begin
@ -1050,8 +1056,13 @@ begin
while KeyCnt<=MaxKeyCnt do begin
Key:=ASynEditKeyStrokes.Add;
Key.Command:=Relations[a].Command;
Key.Key:=Relations[a].Key1;
Key.Shift:=Relations[a].Shift1;
if KeyCnt=1 then begin
Key.Key:=Relations[a].Key1;
Key.Shift:=Relations[a].Shift1;
end else begin
Key.Key:=Relations[a].Key2;
Key.Shift:=Relations[a].Shift2;
end;
Key.Key2:=VK_UNKNOWN;
Key.Shift2:=[];
inc(KeyCnt);

View File

@ -799,7 +799,7 @@ Begin
CodeCompletionTimer.OnTimer := @CCOnTimer;
CodeCompletionTimer.Enabled := True;
end;
else
TSourceNotebook(FaOwner).ProcessParentCommand(self,Command,aChar,Data);
end; //case
@ -1996,14 +1996,18 @@ end;
Procedure TSourceNotebook.NextEditor;
Begin
if Notebook.PageIndex < Notebook.Pages.Count-1 then
Notebook.Pageindex := Notebook.Pageindex+1;
Notebook.PageIndex := Notebook.PageIndex+1
else
NoteBook.PageIndex := 0;
End;
Procedure TSourceNotebook.PrevEditor;
Begin
if Notebook.PageIndex > 0 then
Notebook.Pageindex := Notebook.Pageindex-1;
Notebook.PageIndex := Notebook.PageIndex-1
else
NoteBook.PageIndex := NoteBook.Pages.Count-1;
End;

View File

@ -456,8 +456,8 @@ begin
// map all other keys to VK_IRREGULAR +
VirtualKey := VK_IRREGULAR + KeyCode;
writeln('GetGTKKeyInfo KeyCode=',KeyCode,' VirtualKey=',VirtualKey
,' SysKey=',SysKey,' Extended=',Extended,' Toggle=',Toggle);
//writeln('GetGTKKeyInfo KeyCode=',KeyCode,' VirtualKey=',VirtualKey
//,' SysKey=',SysKey,' Extended=',Extended,' Toggle=',Toggle);
// Assert(False, Format('Trace:[GetGTKKeyInfo] Event^.KeyVal %d, Event^.State %d, KeyCode %d, VirtualKey %d, SysKey %d, Extended %d, CtrlDown %d', [Integer(Event^.KeyVal), Integer(Event^.State), Integer(KeyCode), Integer(VirtualKey), Integer(SysKey), Integer(Extended), Integer(CtrlDown)]));
end;
@ -740,6 +740,9 @@ end;
{ =============================================================================
$Log$
Revision 1.18 2001/06/20 17:00:20 lazarus
MG: alternative key bugfix, shiftstate bugfix
Revision 1.17 2001/06/20 13:35:51 lazarus
MG: added VK_IRREGULAR and key grabbing