The standard border size is 5 or 6 pixels which is not that different
from 4 and it's not worth specifying the size of the border explicitly,
this just distracts from the rest of the code which the samples are
supposed to demonstrate.
Moreover, many borders of size 4 have been already replaced with ones of
standard size in the grandparent commit, so get rid of all the rest of
them too.
This is an LLM-assisted change as doing it by hand turned out to be too
time-consuming and not worth spending time on it.
See #24755.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
On macOS, "Minimal editor" and "Document map" items placed in the
"Window" menu didn't appear in the (standard) "Window" menu at all and
so couldn't be accessed.
Temporarily work around this wxOSX bug by moving them to another menu.
Closes#25935.
Signed-off-by: Eran Ifrah <eran@codelite.org>
After experimenting with this code in the sample, move it to its
permanent place in the library.
This commit is best viewed using Git --color-moved option and ignoring
whitespace changes.
Find the candidate middle of the thumb directly from the first visible
line in the editor, we don't need to compute the first visible map line
(especially as we did it wrongly) for this.
Get rid of m_dragLastY which is not needed to get a reasonably accurate
initial estimation.
The assumption that first visible lines of the map and the editor are
proportional doesn't hold in this case, only the thumb position and the
first visible line in the editor must be proportional to each other in
order to accurately represent the position in the document.
Don't use a single m_updateBlocked flag which was reset too early,
before the re-wrapping happened, and so didn't really avoid processing
the scroll events due to the program itself.
Remember the last first line value we set instead and ignore events
scrolling to this line instead.
No real changes, just store the maximum possible values for the first
visible line in both controls instead of storing the number of display
lines as we only really need the former.
Improve the initial estimate: old method was more precise when display
and document lines matched up (i.e. without wrapping) but could result
in completely wrong value when they were very different.
Add proper range checking to avoid ending up with an invalid editor
first visible line.
Ensure that we don't enter an infinite loop when there are two first
visible lines values resulting in the thumb position close to but
either just above or below the correct one.
Don't assume that display and document lines are the same any longer.
This complicates things a lot, notably while dragging because we can't
simply find the correct first line for the editor any longer but need to
search for it iteratively because the size of the thumb now depends on
its position, as different regions of the document may wrap differently.
Also synchronize the map with the document when it is repainted and not
resized because line wrapping is done in the background after the resize
and we don't have the correct mapping between the display and document
lines yet in the wxEVT_SIZE handler -- but we eventually get it for the
last wxEVT_PAINT provoked by it.
The value of m_dragOffset will possibly become negative after the
upcoming changes, so don't rely on the special value -1 meaning that we
are not dragging any more.
No real changes.
We really care about the number of physical, i.e. "display", lines
appearing in the window and not the number of logical, or "document",
lines.
They are the same as long as no lines are either wrapped or folded but
become different as soon as either of them is used.
Apparently using the same lexer for 2 controls sharing the same document
doesn't work, this results in problems with syntax highlighting and
folding not working at all.
Simply not doing this fixes these problems while still showing the
correct syntax highlighting in the map, as it shares the same document.
Cache often used values for efficiency.
Avoid recursive calls to our Sync{Edit,Map}Position() by using a flag to
block the unwanted notifications.
Fix thumb positioning while dragging.
Create file samples/samples.props which adds the DLL build directory
to MSVS PATH in <LocalDebuggerEnvironment> property.
Add file samples.props to all MSVS sample projects.