Code-duplication refactoring notes (draft, for discussion) - #18
Merged
Conversation
Owner
|
Hello Damien. Fred |
fredvs
marked this pull request as ready for review
July 26, 2026 18:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Fred — while trying out a new static-analysis tool (argot, which just got Object Pascal support) on StrumPract, it surfaced a handful of copy-pasted routines in the app's own forms (the vendored
use/trees — MSEgui, uos, OvoTag, BGRABitmap — were excluded). I hand-verified each one and wrote them up inREFACTORING-NOTES.md(this PR's only change).This is a draft / discussion PR — it changes no code, just documents the duplication with exact locations so a future fix only has to be made once. Several past commits (center-dialog, dock layout, EQ tweaks) had to be repeated across copies, which is the pattern these would remove.
Highlights (full list + line numbers in the file):
onmouseev/onmouseevware byte-identical —songplayer.pas:3722vswaveform.pas:418(same 20-line waveform mouse handler, only the name differs).onsetvalvolduplicated verbatim —recorder.pas:1000vssongplayer.pas:3250(~68 lines).mainfo.basedock … updatelayoutpanloop in everyvisiblechangeev) → onerefreshdocklayouts(parentwidget)helper.recorder.pasandsongplayer.pas.paintslider(×2), anontextedit/show-hint block (~18×),updatelayoutstrum/updatelayoutpan,InitDrawLive,RoundMath(×3 units), and anfptimervsmsetimerconsistency nit.I didn't include the actual refactors because I couldn't compile-test them here — happy to send compile-tested commits for any of these on request, starting with the four cleanest (the two identical handlers, the dock-refresh helper, the shared EQ table). Just let me know which you'd want, or feel free to take the notes and run with them.
🤖 Generated with Claude Code