diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2023-02-19 20:37:51 -0300 |
---|---|---|
committer | Rafael Lima <rafael.palma.lima@gmail.com> | 2023-02-23 12:34:21 +0000 |
commit | 11c69c57f045f364dd7466f49d9de5408b6a02b4 (patch) | |
tree | 9332690c6ee90a708692eda82b5a8e5d608ba080 /basctl | |
parent | 9da4a2518eea880a2c80515d1346effa7c8c8c11 (diff) |
tdf#146518 Implement commands to toggle Watch/Stack windows
This patch implements the new .uno:WatchWindow and .uno:StackWindow commands in the Basic IDE to allow the user to toggle the Watch/Stack windows.
Change-Id: I0778b9fe8efcafbbf57da3cc437e6b156306021d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147305
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/sdi/baside.sdi | 12 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 12 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 58 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/menubar/menubar.xml | 2 |
5 files changed, 87 insertions, 1 deletions
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 0d32339fc833..9e7229ca9712 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -248,6 +248,18 @@ shell basctl_Shell StateMethod = GetState; ] + SID_BASICIDE_WATCH + [ + ExecMethod = ExecuteGlobal; + StateMethod = GetState; + ] + + SID_BASICIDE_STACK + [ + ExecMethod = ExecuteGlobal; + StateMethod = GetState; + ] + SID_BASICIDE_CREATEMACRO [ ExecMethod = ExecuteGlobal; diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index ad1dd3682b22..1df230f9bd92 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1511,6 +1511,18 @@ void ModulWindowLayout::BasicRemoveWatch () aWatchWindow->RemoveSelectedWatch(); } +void ModulWindowLayout::ShowWatchWindow(bool bVisible) +{ + aWatchWindow->Show(bVisible); + ArrangeWindows(); +} + +void ModulWindowLayout::ShowStackWindow(bool bVisible) +{ + aStackWindow->Show(bVisible); + ArrangeWindows(); +} + void ModulWindowLayout::OnFirstSize (tools::Long const nWidth, tools::Long const nHeight) { AddToLeft(&rObjectCatalog, Size(nWidth * 0.20, nHeight * 0.75)); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 9a8700aecf3a..73b98ef7412e 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -409,6 +409,10 @@ public: public: void BasicAddWatch (OUString const&); void BasicRemoveWatch (); + void ShowWatchWindow(bool bVisible); + void ShowStackWindow(bool bVisible); + bool IsWatchWindowVisible() { return aWatchWindow->IsVisible(); } + bool IsStackWindowVisible() { return aStackWindow->IsVisible(); } Color const & GetSyntaxBackgroundColor () const { return aSyntaxColors.GetBackgroundColor(); } Color const & GetFontColor () const { return aSyntaxColors.GetFontColor(); } Color const & GetSyntaxColor (TokenType eType) const { return aSyntaxColors.GetColor(eType); } diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 5e985211aa42..66820cd21881 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -430,6 +430,30 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) pBindings->Invalidate(SID_BASICIDE_OBJCAT); break; + case SID_BASICIDE_WATCH: + { + // Toggling the watch window can only be done from a ModulWindow + if (!dynamic_cast<ModulWindowLayout*>(pLayout.get())) + return; + + pModulLayout->ShowWatchWindow(!pModulLayout->IsWatchWindowVisible()); + if (SfxBindings* pBindings = GetBindingsPtr()) + pBindings->Invalidate(SID_BASICIDE_WATCH); + } + break; + + case SID_BASICIDE_STACK: + { + // Toggling the stack window can only be done from a ModulWindow + if (!dynamic_cast<ModulWindowLayout*>(pLayout.get())) + return; + + pModulLayout->ShowStackWindow(!pModulLayout->IsStackWindowVisible()); + if (SfxBindings* pBindings = GetBindingsPtr()) + pBindings->Invalidate(SID_BASICIDE_STACK); + } + break; + case SID_BASICIDE_NAMECHANGEDONTAB: { DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); @@ -875,12 +899,44 @@ void Shell::GetState(SfxItemSet &rSet) rSet.DisableItem( nWh ); } break; + case SID_BASICIDE_OBJCAT: + { if (pLayout) rSet.Put(SfxBoolItem(nWh, aObjectCatalog->IsVisible())); else rSet.Put(SfxVisibilityItem(nWh, false)); - break; + } + break; + + case SID_BASICIDE_WATCH: + { + if (pLayout) + { + rSet.Put(SfxBoolItem(nWh, pModulLayout->IsWatchWindowVisible())); + // Disable command if the visible window is not a ModulWindow + if (!dynamic_cast<ModulWindowLayout*>(pLayout.get())) + rSet.DisableItem(nWh); + } + else + rSet.Put(SfxVisibilityItem(nWh, false)); + } + break; + + case SID_BASICIDE_STACK: + { + if (pLayout) + { + rSet.Put(SfxBoolItem(nWh, pModulLayout->IsStackWindowVisible())); + // Disable command if the visible window is not a ModulWindow + if (!dynamic_cast<ModulWindowLayout*>(pLayout.get())) + rSet.DisableItem(nWh); + } + else + rSet.Put(SfxVisibilityItem(nWh, false)); + } + break; + case SID_BASICIDE_SHOWSBX: case SID_BASICIDE_CREATEMACRO: case SID_BASICIDE_EDITMACRO: diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index ac59065c9daf..fc510571e2fe 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -69,6 +69,8 @@ <menu:menuitem menu:id=".uno:ShowLines"/> <menu:menuitem menu:id=".uno:ShowPropBrowser"/> <menu:menuitem menu:id=".uno:ObjectCatalog"/> + <menu:menuitem menu:id=".uno:WatchWindow"/> + <menu:menuitem menu:id=".uno:StackWindow"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:FullScreen"/> </menu:menupopup> |