Recent

Author Topic: Visual Studio keymap (for debugger and compiller)  (Read 3367 times)

Tango600

  • New Member
  • *
  • Posts: 12

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Visual Studio keymap (for debugger and compiller)
« Reply #16 on: June 18, 2022, 07:44:53 pm »
for the discussion. Does it worth to modify loading XML process, thus it could understand characters, instead of integer codes for keys.

So instead of
Code: XML  [Select][+][-]
  1.     <Item9 Name="Build project/program">
  2.       <KeyA Default="False" Key1="117" Shift1="2"/>
  3.     </Item9>
  4.  
it would be possible to write:
Code: XML  [Select][+][-]
  1.     <Item9 Name="Build project/program">
  2.       <KeyA Default="False" Key1="F6" Shift1="Shift"/>
  3.     </Item9>
  4.  
(and if the actual number needs to be specified, it could be prefixed by some character)
Code: XML  [Select][+][-]
  1.     <Item9 Name="Build project/program">
  2.       <KeyA Default="False" Key1="*6" Shift1="Shift"/>
  3.     </Item9>
  4.  
(which would map to key "6")
Obviously, it's also possible to use a different attribute, i.e. Char1 (instead of Key1), BUT it also introduces a problem which one to use, if both are specified.

Purpose: to make the configuration of the key mapping files HUMAN friendly.

Btw, Visual Studio keyboard map XML is attached. It is based on Tango600's keyboard schema.
« Last Edit: June 18, 2022, 07:52:06 pm by skalogryz »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Visual Studio keymap (for debugger and compiller)
« Reply #17 on: June 18, 2022, 08:11:08 pm »
for the discussion. Does it worth to modify loading XML process, thus it could understand characters, instead of integer codes for keys.

That is an interesting question... I think in most cases the actual key, is more important.

IIRC by default Ctrl+/  comments the current line/selection. Never mind which Keycode the "/" has on the users keyboard layout.

For example, I use "Dovrak UK Punctuation".
The IDE has
Code: Text  [Select][+][-]
  1.   ecToggleComment:       SetSingle(VK_OEM_2,[XCtrl]);
which did not work for me at all.
Having "ctrl" and "key=/" instead of a keycode, could help... or could mess it up.

On a German layout the "\" is only available via AltGr. Yet on an English layout the "\" has its own key.
Having something like ctrl-\  would then break, if a German user wants to load it.

Quote
(and if the actual number needs to be specified, it could be prefixed by some character)
Actually, in that case the XML could have a "KeyCode"
 <Item9 Name="Build project/program">
      <KeyA Default="False" KeyCode1="117" Key1="F6" Shift1="2"/>
    </Item9>

Quote
Btw, Visual Studio keyboard map XML is attached. It is based on Tango600's keyboard schema.

It will be a little time before I get to any of this. Quite busy right now.



I do think that the V.S. map is a great extension.
As for XML vs Build-in, I will wait what other devs have to say.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Visual Studio keymap (for debugger and compiller)
« Reply #18 on: June 18, 2022, 10:31:24 pm »
IIRC by default Ctrl+/  comments the current line/selection. Never mind which Keycode the "/" has on the users keyboard layout.
I see what you mean. Indeed layouts have different characters per same keycode.
Yet, if we define that characters are treated as US-layout characters and in the end are mapped to the corresponding key codes, this would be sufficient.
In the end, xml is to be human-friendly for the creator of such XML, not for the end-user.

For the end user the selection takes place through the UI only (and the contents of XML is not review).

Since you've brought that up.

How does this Key Edit dialog works:

There's a list of textual representation of keys (not just characters)
How does it map back to the key code? Does it respect the current layout, or is it fixed to a certain (US) layout?
« Last Edit: June 18, 2022, 10:33:38 pm by skalogryz »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Visual Studio keymap (for debugger and compiller)
« Reply #19 on: June 19, 2022, 11:23:14 am »
I don't know what the dialog uses.

What we could use are the VK_### names: VK_A, VK_OEM.

Sadly, it seems we don't (yet? ;) ) have an IdentToInt for them.
See components\ideintf\idecommands.pas
  function IdentToIDECommand(const Ident: string; var Cmd: longint): boolean;
  function IDECommandToIdent(Cmd: longint; var Ident: string): boolean;


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Visual Studio keymap (for debugger and compiller)
« Reply #20 on: June 19, 2022, 09:24:07 pm »
There are changes available: https://github.com/skalogryz/Lazarus/tree/keybordschemas

The branch introduces loading of the custom keyboard schemas.

I did put the description here: https://github.com/skalogryz/Lazarus/wiki/keybordschemas#Keyboard_Schema_Files

Now, it's possible to extend pre-defined schemas without changing the code and distribute them with Lazarus. (i didn't update any installers though)

I don't know what the dialog uses.
it's based of KeyAndShiftStateToKeyString (at LCLProc) (KeyCodeStrings array)
and there's a corresponding TextToShortCut() function to convert text to a code

and it's obviously fixed to a certain keyboard layout.
« Last Edit: June 19, 2022, 09:32:43 pm by skalogryz »

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Visual Studio keymap (for debugger and compiller)
« Reply #21 on: June 20, 2022, 10:41:47 am »
Quote
I did put the description here: https://github.com/skalogryz/Lazarus/wiki/keybordschemas#Keyboard_Schema_Files
It should be put to Lazarus Wiki.
Should I do it?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5448
  • Compiler Developer
Re: Visual Studio keymap (for debugger and compiller)
« Reply #22 on: June 20, 2022, 01:32:49 pm »
Quote
I did put the description here: https://github.com/skalogryz/Lazarus/wiki/keybordschemas#Keyboard_Schema_Files
It should be put to Lazarus Wiki.
Should I do it?

Why would you want to add this if the corresponding isn't yet part of Lazarus' main?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Visual Studio keymap (for debugger and compiller)
« Reply #23 on: July 06, 2022, 08:59:52 pm »
a couple of commits:
https://github.com/skalogryz/Lazarus/commit/c5f80390b08a47fce8af7b6ebb39757167e3c5ed (human readable export)

https://github.com/skalogryz/Lazarus/commit/99f54ec041414ae3050938ecc2d79193bc14c18e (file dialog filters)

The major change is;
- export is now generates human-readable file
- import supports human-readable values, yet the original "decimals" values are supported (backwards compatible)
- the entire list of shortcuts is exported (for "Export" feature), no matter if the key has an assigned  value or not

As a result, this should make the list of shortcuts be easily readable and editable.
Code: XML  [Select][+][-]
  1.     <Item30 Name="Close">
  2.       <KeyA Key1="F4" Shift1="Ctrl" Key2="" Shift2=""/>
  3.       <KeyB Key1="W" Shift1="Ctrl" Key2="" Shift2=""/>
  4.     </Item30>

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com

 

TinyPortal © 2005-2018