diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-10 21:18:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-11 09:50:21 +0200 |
commit | 40f1cfa6a7d9f8c501cd4e940f8a047b4162fb03 (patch) | |
tree | 5ed11fc1f676b2ee3840a60cab1799aa93554c53 /basctl | |
parent | 49eb02f07a5af44da59008a238e828b4a9532bef (diff) |
weld GotoLineDialog
Change-Id: Ibf040e9b48a5545550e1ee830852a75ca82262e7
Reviewed-on: https://gerrit.libreoffice.org/52695
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 8 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 31 | ||||
-rw-r--r-- | basctl/source/basicide/moduldlg.hxx | 11 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/ui/gotolinedialog.ui | 12 |
4 files changed, 31 insertions, 31 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index c7eb307b9500..d85eac5a1b39 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1010,13 +1010,15 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) break; case SID_GOTOLINE: { - ScopedVclPtrInstance< GotoLineDialog > aGotoDlg(this); - if (aGotoDlg->Execute()) - if (sal_Int32 const nLine = aGotoDlg->GetLineNumber()) + GotoLineDialog aGotoDlg(GetFrameWeld()); + if (aGotoDlg.run() == RET_OK) + { + if (sal_Int32 const nLine = aGotoDlg.GetLineNumber()) { TextSelection const aSel(TextPaM(nLine - 1, 0), TextPaM(nLine - 1, 0)); GetEditView()->SetSelection(aSel); } + } break; } } diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index a1d3761001a6..56a490a7721b 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -392,39 +392,30 @@ NewObjectDialog::NewObjectDialog(weld::Window * pParent, ObjectMode eMode, bool } // GotoLineDialog -GotoLineDialog::GotoLineDialog(vcl::Window * pParent ) - : ModalDialog(pParent, "GotoLineDialog", - "modules/BasicIDE/ui/gotolinedialog.ui") +GotoLineDialog::GotoLineDialog(weld::Window* pParent ) + : GenericDialogController(pParent, "modules/BasicIDE/ui/gotolinedialog.ui", "GotoLineDialog") + , m_xEdit(m_xBuilder->weld_entry("entry")) + , m_xOKButton(m_xBuilder->weld_button("ok")) { - get(m_pEdit, "entry"); - get(m_pOKButton, "ok"); - m_pEdit->GrabFocus(); - m_pOKButton->SetClickHdl(LINK(this, GotoLineDialog, OkButtonHandler)); + m_xEdit->grab_focus(); + m_xOKButton->connect_clicked(LINK(this, GotoLineDialog, OkButtonHandler)); } GotoLineDialog::~GotoLineDialog() { - disposeOnce(); -} - -void GotoLineDialog::dispose() -{ - m_pEdit.clear(); - m_pOKButton.clear(); - ModalDialog::dispose(); } sal_Int32 GotoLineDialog::GetLineNumber() const { - return m_pEdit->GetText().toInt32(); + return m_xEdit->get_text().toInt32(); } -IMPL_LINK_NOARG(GotoLineDialog, OkButtonHandler, Button*, void) +IMPL_LINK_NOARG(GotoLineDialog, OkButtonHandler, weld::Button&, void) { - if ( GetLineNumber() ) - EndDialog(1); + if (GetLineNumber()) + m_xDialog->response(RET_OK); else - m_pEdit->SetText(m_pEdit->GetText(), Selection(0, m_pEdit->GetText().getLength())); + m_xEdit->select_region(0, -1); } // ExportDialog diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index ac9a4b37b7c7..44f647a45b0c 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -60,15 +60,14 @@ public: } }; -class GotoLineDialog : public ModalDialog +class GotoLineDialog : public weld::GenericDialogController { - VclPtr<Edit> m_pEdit; - VclPtr<OKButton> m_pOKButton; - DECL_LINK(OkButtonHandler, Button*, void); + std::unique_ptr<weld::Entry> m_xEdit; + std::unique_ptr<weld::Button> m_xOKButton; + DECL_LINK(OkButtonHandler, weld::Button&, void); public: - explicit GotoLineDialog(vcl::Window * pParent); + explicit GotoLineDialog(weld::Window* pParent); virtual ~GotoLineDialog() override; - virtual void dispose() override; sal_Int32 GetLineNumber() const; }; diff --git a/basctl/uiconfig/basicide/ui/gotolinedialog.ui b/basctl/uiconfig/basicide/ui/gotolinedialog.ui index 387991d3749a..371087a13806 100644 --- a/basctl/uiconfig/basicide/ui/gotolinedialog.ui +++ b/basctl/uiconfig/basicide/ui/gotolinedialog.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="basctl"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="GotoLineDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="gotolinedialog|GotoLineDialog">Go to Line</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -81,10 +84,10 @@ <object class="GtkLabel" id="area"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="gotolinedialog|area">_Line number:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -96,6 +99,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -114,6 +118,10 @@ <action-widgets> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> + <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |