diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2024-01-10 20:34:55 +0100 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2024-01-11 19:56:08 +0100 |
commit | bf410be4502c2d78e38856c455833681c6b8a151 (patch) | |
tree | dad89b6cba25835b25199a279ba1d98ba116dad0 /basctl/source/basicide/baside2.hxx | |
parent | 45f3398c9a816f70815cf38620cf5db2ce66431c (diff) |
tdf#158750 Highlight the line where the cursor is positioned (Basic IDE)
This patch implements support for highlighting the selected line in the code editor, similar to what Kate, VSCode, etc do.
If the cursor is positioned in a single line and nothing is selected, then a highlight color is applied to the line. The line number window also highlights the selected line.
Change-Id: I2047d79500cd783b122b6752bb00996de0a7c702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161861
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basctl/source/basicide/baside2.hxx')
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index c07141b7079f..cd0485c46b4b 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -105,6 +105,11 @@ private: bool bDoSyntaxHighlight; bool bDelayHighlight; + // Used to determine if the highlighted line has changed, which would require redrawing the highlight + sal_uInt32 m_nLastHighlightPara; + + Color m_aLineHighlightColor; + virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate = true) override; CodeCompleteDataCache aCodeCompleteCache; VclPtr<CodeCompleteWindow> pCodeCompleteWnd; @@ -130,6 +135,7 @@ private: void DoSyntaxHighlight( sal_uInt32 nPara ); OUString GetWordAtCursor(); bool ImpCanModify(); + void HighlightCurrentLine(vcl::RenderContext& rRenderContext); public: EditorWindow (vcl::Window* pParent, ModulWindow*); @@ -156,6 +162,7 @@ public: void ChangeFontColor( Color aColor ); void UpdateSyntaxHighlighting (); + void SetLineHighlightColor(Color aColor); void SetEditorZoomLevel(sal_uInt16 nNewZoomLevel); sal_uInt16 GetCurrentZoom() { return nCurrentZoomLevel; } |