From 65f41e210f2ef3a77209f9ea1f89a17b4b3bffa9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 30 Jan 2017 15:31:45 +0000 Subject: convert RID_POPUP_BRKPROPS menu to .ui Change-Id: I2f55f4959249ac45de4a852089256a33e0f24d91 --- basctl/UIConfig_basicide.mk | 1 + basctl/inc/basidesh.hrc | 2 - basctl/inc/helpid.hrc | 3 -- basctl/source/basicide/baside2.hrc | 7 ---- basctl/source/basicide/baside2.hxx | 2 + basctl/source/basicide/baside2b.cxx | 56 +++++++++++++------------- basctl/source/basicide/basidesh.src | 38 ----------------- basctl/uiconfig/basicide/ui/breakpointmenus.ui | 42 +++++++++++++++++++ 8 files changed, 74 insertions(+), 77 deletions(-) create mode 100644 basctl/uiconfig/basicide/ui/breakpointmenus.ui (limited to 'basctl') diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk index 31b0334d1fd7..f79d9ce5f39b 100644 --- a/basctl/UIConfig_basicide.mk +++ b/basctl/UIConfig_basicide.mk @@ -34,6 +34,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/BasicIDE,\ $(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\ basctl/uiconfig/basicide/ui/basicmacrodialog \ + basctl/uiconfig/basicide/ui/breakpointmenus \ basctl/uiconfig/basicide/ui/defaultlanguage \ basctl/uiconfig/basicide/ui/deletelangdialog \ basctl/uiconfig/basicide/ui/dialogpage \ diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index 97d8ce12ae35..34f8d3a04ef0 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -23,8 +23,6 @@ #include #define RID_BASICIDE_OBJECTBAR ( RID_BASICIDE_START + 0 ) -#define RID_POPUP_BRKDLG ( RID_BASICIDE_START + 10 ) -#define RID_POPUP_BRKPROPS ( RID_BASICIDE_START + 11 ) #define RID_POPUP_TABBAR ( RID_BASICIDE_START + 12 ) #define RID_BMP_REMOVEWATCH ( RID_BASICIDE_START + 8 ) diff --git a/basctl/inc/helpid.hrc b/basctl/inc/helpid.hrc index 86e3d4f58c89..3bafa9769a10 100644 --- a/basctl/inc/helpid.hrc +++ b/basctl/inc/helpid.hrc @@ -21,9 +21,6 @@ #define HID_BASICIDE_OBJECTCAT "BASCTL_HID_BASICIDE_OBJECTCAT" -#define HID_BASICIDE_BRKDLG "BASCTL_HID_BASICIDE_BRKDLG" -#define HID_BASICIDE_ACTIV "BASCTL_HID_BASICIDE_ACTIV" -#define HID_BASICIDE_BRKPROPS "BASCTL_HID_BASICIDE_BRKPROPS" #define HID_BASICIDE_REMOVEWATCH "BASCTL_HID_BASICIDE_REMOVEWATCH" #define HID_BASICIDE_MODULWINDOW "BASCTL_HID_BASICIDE_MODULWINDOW" diff --git a/basctl/source/basicide/baside2.hrc b/basctl/source/basicide/baside2.hrc index e208d0f2ebed..038b35ca7228 100644 --- a/basctl/source/basicide/baside2.hrc +++ b/basctl/source/basicide/baside2.hrc @@ -23,13 +23,6 @@ // Diese Dateien enthaelt nur die lokalen ID's. -// RID_POPUP_BRKPROPS -#define RID_BRKPROPS 1 -#define RID_ACTIV 2 - -// RID_POPUP_BRKDLG -#define RID_BRKDLG 1 - // RID_POPUP_TABBAR #define RID_INSERT 1 diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 35ffe34c125c..4deb7db00221 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -168,6 +168,7 @@ private: sal_uInt16 nMarkerPos; BreakPointList aBreakPointList; bool bErrorMarker; + std::unique_ptr mpUIBuilder; virtual void DataChanged(DataChangedEvent const & rDCEvt) override; @@ -184,6 +185,7 @@ protected: public: BreakPointWindow (vcl::Window* pParent, ModulWindow*); + virtual void dispose() override; void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false ); void SetNoMarker (); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 977d827f8230..56e428069e40 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1456,40 +1456,36 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt ) BreakPoint* pBrk = rCEvt.IsMouseEvent() ? FindBreakPoint( aEventPos ) : nullptr; if ( pBrk ) { + if (!mpUIBuilder) + mpUIBuilder.reset(new VclBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/BasicIDE/ui/breakpointmenus.ui", "")); + // test if break point is enabled... - ScopedVclPtrInstance aBrkPropMenu( IDEResId( RID_POPUP_BRKPROPS ) ); - aBrkPropMenu->CheckItem( RID_ACTIV, pBrk->bEnabled ); - switch ( aBrkPropMenu->Execute( this, aPos ) ) + VclPtr xBrkPropMenu = mpUIBuilder->get_menu("breakmenu"); + xBrkPropMenu->CheckItem(xBrkPropMenu->GetItemId("active"), pBrk->bEnabled); + OString sCommand = xBrkPropMenu->GetItemIdent(xBrkPropMenu->Execute(this, aPos)); + if (sCommand == "active") { - case RID_ACTIV: - { - pBrk->bEnabled = !pBrk->bEnabled; - rModulWindow.UpdateBreakPoint( *pBrk ); - Invalidate(); - } - break; - case RID_BRKPROPS: - { - ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( this, GetBreakPoints() ); - aBrkDlg->SetCurrentBreakPoint( pBrk ); - aBrkDlg->Execute(); - Invalidate(); - } - break; + pBrk->bEnabled = !pBrk->bEnabled; + rModulWindow.UpdateBreakPoint( *pBrk ); + Invalidate(); + } + else if (sCommand == "properties") + { + ScopedVclPtrInstance aBrkDlg(this, GetBreakPoints()); + aBrkDlg->SetCurrentBreakPoint( pBrk ); + aBrkDlg->Execute(); + Invalidate(); } } else { - ScopedVclPtrInstance aBrkListMenu( IDEResId( RID_POPUP_BRKDLG ) ); - switch ( aBrkListMenu->Execute( this, aPos ) ) + VclPtr xBrkListMenu = mpUIBuilder->get_menu("breaklistmenu"); + OString sCommand = xBrkListMenu->GetItemIdent(xBrkListMenu->Execute(this, aPos)); + if (sCommand == "manage") { - case RID_BRKDLG: - { - ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( this, GetBreakPoints() ); - aBrkDlg->Execute(); - Invalidate(); - } - break; + ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( this, GetBreakPoints() ); + aBrkDlg->Execute(); + Invalidate(); } } } @@ -1533,6 +1529,12 @@ void BreakPointWindow::setBackgroundColor(Color aColor) SetBackground(Wallpaper(aColor)); } +void BreakPointWindow::dispose() +{ + mpUIBuilder.reset(); + Window::dispose(); +} + namespace { const sal_uInt16 ITEM_ID_VARIABLE = 1; diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src index d1c8e565ea08..5775b6b98d4f 100644 --- a/basctl/source/basicide/basidesh.src +++ b/basctl/source/basicide/basidesh.src @@ -326,44 +326,6 @@ String RID_STR_SHAREMACROSDIALOGS Text [ en-US ] = "%PRODUCTNAME Macros & Dialogs" ; }; -Menu RID_POPUP_BRKPROPS -{ - Text [ en-US ] = "Properties" ; - ItemList = - { - MenuItem - { - Identifier = RID_ACTIV ; - HelpId = HID_BASICIDE_ACTIV ; - Text [ en-US ] = "Active" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = RID_BRKPROPS ; - HelpId = HID_BASICIDE_BRKPROPS ; - Text [ en-US ] = "Properties..." ; - }; - }; -}; - -Menu RID_POPUP_BRKDLG -{ - Text [ en-US ] = "Manage Breakpoints" ; - ItemList = - { - MenuItem - { - Identifier = RID_BRKDLG ; - HelpId = HID_BASICIDE_BRKDLG ; - Text [ en-US ] = "Manage Breakpoints..." ; - }; - }; -}; - Menu RID_POPUP_TABBAR { ItemList = diff --git a/basctl/uiconfig/basicide/ui/breakpointmenus.ui b/basctl/uiconfig/basicide/ui/breakpointmenus.ui new file mode 100644 index 000000000000..710ab214ea3c --- /dev/null +++ b/basctl/uiconfig/basicide/ui/breakpointmenus.ui @@ -0,0 +1,42 @@ + + + + + + True + False + + + True + False + Manage Breakpoints... + + + + + True + False + + + True + False + _Active + True + + + + + True + False + + + + + True + False + _Properties... + True + + + + -- cgit