Hi,

After lots of browsing and debugging I figured out how keyboard shortcuts are 
handled in Lazarus code. So complicated! They are just keypresses.

My goal was to get Form Designer receive the undo-command. Currently it is 
sent only to source editor. There are already Undo and Redo commands mapped 
under CommandCommand (!?) category. They are kind of global commands which 
could be used in many places but the supporting code was not ready. So, I 
modified TmainIDE.DoCommand + some other methods, effectively implementing one 
ToDo item:
  // ToDo: Send Command to form editor/designer

Copy, Cut and Paste are logically similar commands, meaning that they can be 
used in many places and they use the same shortcuts everywhere. However they 
were implemented differently. One set of commands was under source editor 
category and one set under form designer category. After my change there is 
only one set under CommandCommand (!?) category and they are forwarded to the 
right editor correctly.

There are now skeleton methods DoUndo and DoRedo in Designer and they are 
called properly. Rest of the undo functionality should be easy now... :-)

I hope this patch is accepted already although it doesn't bring any new 
functionality or even fix bugs. It enables future work with Designer Undo and 
also cleans the shortcut dispatch code. And, it decreases the total amount of 
code unlike most code improvements.

I created issue # 0015481 with a patch.


Juha Manninen


P.S.

There was discussion of const array syntax in another thread. I really could 
use a new syntax in IDECommands unit, like:
const
  IDECommandStrs: array[0..] of TIdentMapEntry = (

The array has about 200 elements. During testing I added and removed items 
from it and then tried to compile. Uhhhh...
Counting the elements should really be the compiler's work, not mine.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to