Kromster80 / kam_remake

"KaM Remake" is an RTS game remake written in Delphi from scratch.
http://www.kamremake.com
GNU Affero General Public License v3.0
361 stars 90 forks source link

Edit controls refactoring #368

Closed reyandme closed 6 years ago

reyandme commented 7 years ago

This PR was extracted from https://github.com/Kromster80/kam_remake/pull/358 for simplicity

Added selectable control TKMSelectableEdit as parent for TKMEdit and TKMNumEdit. Code for TKMSelectableEdit was mainly extracted from TKMEdit (as selection feature was already implemented there earlier). Also some small fixes, refactoring has been done:

  1. Renamed TKMMasterControl.fCtrl into TKMMasterControl.fMasterPanel as it means exactly master panel (main panel)
  2. Added MouseWheel actions for TKMNumericEdit
  3. Added Focus method for TKMControl (also used in MouseWheel action)
  4. Added AbsRight/AbsBottom properties for TKMControl
  5. Removed duplicate code from TKMLabel.Create
  6. Allow big numbers in TKMNumericEdit. Fixed edge errors (Integer out of range when incrementing/decr. with one of the possible ways - button/mousewheel/keyboard). Toxic used big numbers in NumEdits for his RMG settings popup window, so I fixed these small issues
  7. Allow type '-' into TKMNumericEdit for negative numbers. Fixed small bugs related to negative numbers.
  8. Removed unnessesery events from TKMControl fOnControlMouseDown/Up. Must use ControlMouseDown/Up methods hierarhy instead.
  9. Same refactoring for Focus event. fOnFocus renamed to fOnFocusChanged. Added method FocusChanged for controls internal use. For external use fOnFocusChange is still available.
  10. Other small fixes, related to TKMNumericEdit were added, f.e. fixed setting string to '0', when using Backspace (when using Delete leave string empty)
Kromster80 commented 7 years ago

Too many changes crammed into one PR. It's hard to review them

reyandme commented 7 years ago

@Kromster80 I added detailed comments to the code differences. I know it was better to remove small things from this PR, but then it could be possibly hard to merge/restore changes I've done by using several (10) smaller PR's.

Even if I make one PR - extracting TKMSelectableEdit from TKMEdit and make TKMEdit and TKMNumericEdit inherit selectable features - then it will still be hard to track all the code differences, and there nothing I can do about it, unfortunally.

Its much better to check all the code on 'Files changed' tab here, then on 'Conversation' tab IMHO (where I am writing now).

Thx