Avoid using Tab and Shift+Tab as accelerators This doesn't work in wxGTK and results in a debug warning on the sample startup.
Make wxStyledTextCtrl::TextHeight() const This function isn't declared as "get" in the Scintilla interface file but it's still one, semantically, so make it const in C++.
Experiment with document map in wxSTC sample Add a menu item showing a dialog with the document and its map.
Make the overlay more opaque while dragging under non-MSW too Unfortunately opacity needs to be handled differently for wxMSW and the others.
Prevent Scintilla from handling double clicks in the map This results in unwanted text selection and messes up mouse capture, so don't let it process this event.
Don't scroll when starting to drag Add forgotten return to prevent falling through to the logic for clicking outside of the thumb when clicking on it.
Add convenient GetThumbTopPos() function Just extract it from DrawVisibleZone(). No real changes, this is just a refactoring.
Simplify and improve map thumb positioning logic
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.
Handle double clicks in the map as simple clicks This is much more useful than ignoring them as some clicks in a series of clicks could be unintentionally lost/ignored before.
Don't allow Ctrl+mouse wheel zooming in the map Still allow scrolling using just the mouse wheel.
Prevent removing the document or the map ShowDocumentMap() Don't allow un-splitting wxSplitterWindow.
REVERT: Experiment with word wrap
Prevent removing the document or the map in ShowDocumentMap() Don't allow un-splitting wxSplitterWindow.
Merge branch 'master' into stc-document-map Pull in the performance-related changes in order to use them in this branch.
Store backing store bitmap in wxStyledTextCtrl Avoid recreating this bitmap in each call to OnPaint().
Use wxBitmap object and not pointer in SurfaceImpl There is no need to dynamically allocate this object when we can just use null bitmap instead of null pointer. Using the object is simpler, safer and could be marginally faster.
Store the last 8 used brushes in wxSTC implementation This avoid constantly recreating the background brush which is used multiple times on every repaint.
Reuse the same string buffer for STC-to-wx string conversions This avoids a lot of memory allocation while redrawing the window and results in noticeable performance improvement.
Avoid casting arbitrary wxDC to wxMemoryDC in wxSTC Even though all the device contexts used here are currently of either wxMemoryDC or wxBufferedPaintDC (deriving from wxMemoryDC) type, casting them to wxMemoryDC is still dangerous and prevents from the code being ever changed to use other wxDC types. No real changes, just make the code safer.
Disable bounding box updates for wxDCs used in wxSTC This is another micro-optimization for the drawing code.
Make VisibleFromDocLine/DocLineFromVisible() const too These functions names don't start with "Get" but they still don't modify the control and so should be const.
Use variable instead of hardcoded number for folding margin Make the comparison more understandable and avoid hardcoding "2".
Do not set the lexer for the map wxSTC instance 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.
Use number of displayed, and not document, lines in the map code 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.
Add wxStyledTextCtrl::GetDisplayLineCount() This is a convenient, even if trivial, function.
Merge branch 'master' into stc-document-map
Wrap lines in the main document used with the map for testing
Add separate m_isDragging instead of reusing m_dragOffset 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.
Initialize m_mapLineHeight only once It doesn't change even if the window is resized. No real changes.
Collect information about visible lines in LinesInfo struct This makes it simpler to check if any of the relevant variables have changed and update them all at once.
Rename GetMapLineAtPoint() to GetDocLineAtMapPoint() Make it clear that this function returns the logical/document line and not the physical/display line. No real changes.
Sync map and document properly when lines are wrapped 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.
Merge remote-tracking branch 'origin/master' into stc-document-map
Rename all "editor" variables to start with "edit" instead Use consistent naming instead of using "editorFoo" for some things and "editBar" for the other ones. No real changes.
Fix multiple bugs in determining position when dragging 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.
Merge branch 'master' into stc-document-map
Replace {map,edit}Display with {map,edit}Max in LinesInfo
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 skipping scroll events caused by the program itself 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.
Really fix map sync when lines can be wrapped 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.
Add MapVisibleFromEditVisible() helper function No real changes, just simplify the code a bit by adding a trivial function performing a commonly needed mapping.
Fix scrolling the editor while dragging the thumb 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.
Fix SyncEditPosition() for the case of wrapped lines too We need to iteratively find the first editor line such that the corresponding first map line is the desired one.
Extract iteration algorithm in its own function Avoid duplicating the same code in different functions that need to iteratively find the correct first visible line in the editor.
Increase the line number margin width It wasn't big enough to show 4 digit numbers.
Add wxStyledTextCtrl::SetMirrorFoldingCtrl() This can be used to mirror folding in one control to another one and will be used by wxStyledTextCtrlMiniMap to keep its folds synchronized with those in the main control automatically.
Synchronize folding in the map and the main editor Also don't hide fold margin any longer to allow testing folding.
Add Edit::ToggleLineNumbers() to the sample Make it a bit simpler to show line numbers when showing the minimap.
Move wxStyledTextCtrlMiniMap from stc sample to the library 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.
Add documentation for wxStyledTextCtrlMiniMap There is not much to document, as this class needs to be just created and left to its own devices.
Add possibility to customize wxStyledTextCtrlMiniMap thumb colours Default grey may not be always appropriate.
Don't scroll wxStyledTextCtrl used by wxStyledTextCtrlMiniMap Scrolling the control using wxWindow::ScrollWindow() corrupted the thumb drawn on top of it, as parts of it were scrolled away. There doesn't seem to be any way to prevent this from happening, so make it possible to avoid using ScrollWindow() completely by adding new SetCustomDrawn() function and using it in wxStyledTextCtrlMiniMap. This fixes visual thumb corruption under wxMSW when scrolling the map by small increments, e.g. using mouse wheel or the scrollbar arrows.
Refresh the map when syncing its position even when not scrolling If the entire map fits into the map window, the map first visible line never changes as it always remains as 0, however we still need to refresh the map to show the new thumb position properly.
Fix wrong colors being copied and returned
Add bitmap and pointer validations
Add consistent use of wxDynamicCast
Fix wrong flag being toggled in toolbar
Fix DeletePage when zero is given Would then try to call SetActivePage with max size_t. Code is now simplified and stays within boundary of the number of pages.
Undo bitmap check that didn't serve a purpose
Don't sync edit after map changes originating from the editor If the change in the map scrolling position is due to a change in the editor contents, we don't need to synchronize the editor with the map and, in fact, it is wrong to do it as deleting text at the bottom of the editor could result in the editor being scrolled to the top if the map was scrolled to the top due to it fitting the window now when it didn't fit it before.
Rename wxSTC::SetMirrorFoldingCtrl() to SetMirrorCtrl() This function will be used to synchronize other changes than just the folds in the upcoming commit, so stop using "Folding" in its name.
Make generating of mirroring methods more maintainable Instead of requiring to provide the full implementation of all methods that must be forwarded to m_mirrorCtrl, define a list of such methods and handle all of them in a single place. This will make adding new methods to mirror much simpler.
Synchronize markers with the mirror control too Add a demo marker to the sample to verify that it is shown in the map as well.
Merge branch 'master' into stc-document-map Resolve conflicts in Xcode projects by regenerating them.
Don't explicitly refresh the map when the editor contents change This seems to be unnecessary, as the map contents is updated anyhow, and just results in extra flicker as seen when e.g. maintaining a key pressed on autorepeat in the editor.
Don't synchronize map position on resize to avoid unwanted jumps Map position may change when its size changes, but this shouldn't result in a change in the editor position, as it did before this change because calling SyncMapPosition() from wxEVT_SIZE handler resulted in a subsequent call to SyncEditPosition() when we received a V_SCROLL update from Scintilla. Stop doing this from this handler and instead remember the last "set" (actually, "known") map position to avoid reacting to the corresponding V_SCROLL change. Note that just setting m_lastSetMapFirst but continuing to call SyncMapPosition() from here didn't quite work because Scintilla seems to not be in a consistent state yet when this event handler is executed when maximizing the window containing the map and the map position could pass by some small intermediate value (2 seen in the sample) before finally jumping to 0, which prevented us from filtering this update out. Updating map only from wxEVT_PAINT handler doesn't seem to result in any visual problems and avoids this problem.
Don't hide editor vertical scrollbar when using minimap This looks nicer but loses potentially useful functionality of the editor scrollbar which may be used to scroll the editor even if the text is short enough to fit entirely in the map, and so when the map doesn't have any scrollbar at all. Document the possibility of hiding it scrollbar for people who still want to do it.
Add wxStyledTextCtrlMiniMap::SetEdit() Allow changing the editor associated with the map or even resetting it completely, so that the map doesn't show anything. Also make the relationship between the editor and the map safer, by avoid leaving dangling pointers when either of them is destroyed.
When dynamic cast was used and pointer wasn't check, replace with DEBUG type check and static_cast Other existing dynamic casts where return pointer was validated is left in place.
Add pointer check to suppress PREFast null deref warning
Use wxASSERT_MSG where needed
Fix document pointer memory leak in wxStyledTextCtrlMiniMap Remove the extraneous call to AddRefDocument(), SetDocPointer() already does this internally and doing this in wxStyledTextCtrlMiniMap code just ensured that we leaked the associated document.
Recalculate wxGenericTreeCtrl line height after font change This ensures that the items always consume as much space as they need vertically and not more. Closes #16428.
Remove unnecessary wxDC::SetFont() calls in wxGenericTreeCtrl There is no need to set the normal font when using wxPaintDC or wxInfoDC as they already use this font by default.
Move macOS-specific font selection to GetClassDefaultAttributes() It doesn't make much sense to return one font from this function and then override it using Mac-specific font in InitVisualAttributes(). Instead, return the correct font for the current platform from GetClassDefaultAttributes() and don't override it later.
Remove dcUsesNormalFont from wxGenericTreeCtrl::DoCalculateSize() We don't need to use this parameter, the DC passed to DoCalculateSize() always has the correct font selected into it.
Remove wxGenericTreeCtrl::m_normalFont This seems to be completely redundant with wxWindow::m_font, so just use it instead.
Do not use wxItemId::m_pItem directly Call public wxItemId::GetID() instead. No real changes. Closes #25926.
Don't export wxGenericTreeItem from wx shared libraries This is unnecessary as this class definition is private anyhow.
Replace dynamic array use in wxGenericTreeCtrl with vector Stop using deprecate macro-based dynamic array class, as it's private it can be replaced with a vector. As a side effect, sorting tree branches is now re-entrant and we don't need to use the ugly s_treeBeingSorted hack.
Document wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES constant This will make it available in wxPython, so that the programs that need it could use the symbolic constant instead of its string expansion. Also fix a typo: does -> do Closes #25920.
Add and use new wxCheckedStaticCast helper
Document limitations of wxStyledTextCtrlMiniMap synchronization Mention that only folds and markers updated after associating the map with the control are automatically propagated to it and that the application needs to do it manually for the pre-existing ones.
Document wxHeaderCtrlSimple::DeleteAllColumns()
Fix parameter name in wxHeaderCtrl::ShowSortIndicator() Use more useful "ascending".
Merge branch 'RibbonReview' of github.com:Blake-Madden/wxWidgets Fix minor issues in wxRibbonBar code and add a generally useful wxCheckedStaticCast helper. See #25900.
Merge branch 'generic-tree-font' Improve font handling in wxGenericTreeCtrl. See #25851, #25927.
Work around MinGW thread local variables bug in wxTranslations Use a helper class storing per-thread untranslated strings in global variables but still ensuring that their cleanup happens for each thread when using this compiler as, due to a known bug in their implementation in MinGW (see https://github.com/msys2/MINGW-packages/issues/2519), member variables can't be used in thread local variables dtors. Closes #25897. Closes #25928.
Improve precise wxTreeCtrl best size calculation Try to compute the size of the items manually, even if GetBoundingRect() doesn't return it, as it happens when the items are collapsed. This ensures the tree control best size is big enough to show the tree fully expanded. Replaces #25843. Closes #25839. See #25930. Co-authored-by: Vadim Zeitlin <va...@wxwidgets.org>
Merge branch 'treectrl-generic-modernize' Modernize wxGenericTreeCtrl a bit. See #25931.
Add full wxImageHandler constructor and use it in derived classes Provide a ctor which can be used to fully initialize the base class instead of forcing all image handlers to initialize their member variables manually and use it in all the standard image handlers. Closes #25933. Co-authored-by: Vadim Zeitlin <va...@wxwidgets.org>
Merge branch 'headerctrl-doc-fixes' Improve wxHeaderCtrlSimple documentation. Closes #25934.
Merge branch 'stc-document-map-wrap' Add wxStyledTextCtrlMiniMap class showing a "mini map" of wxSTC. See #25887.
Merge branch 'stc-document-map' Merge the correct wxStyledTextCtrlMiniMap branch. This supersedes wrong accidental merge in the parent commit. See #25887.
Fix wxHeaderCtrl documentation after recent parameter change Correct a problem introduced in 00bd397cf2 (Fix parameter name in wxHeaderCtrl::ShowSortIndicator(), 2025-10-28) which wrongly renamed the parameter but not its documentation. See #25934.
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help