cui/source/dialogs/cuigrfflt.cxx | 35 ++++++++--------------------------- cui/source/factory/dlgfact.cxx | 5 ++--- cui/source/factory/dlgfact.hxx | 2 +- cui/source/inc/cuigrfflt.hxx | 13 +++++-------- cui/uiconfig/ui/posterdialog.ui | 29 ++++++++++++++++++++++++++--- include/svx/svxdlg.hxx | 2 +- svx/source/dialog/grfflt.cxx | 2 +- 7 files changed, 44 insertions(+), 44 deletions(-)
New commits: commit 65b5fc8f66eb2facaed5d35b61a2836b3390fb01 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 18 14:12:21 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Sep 19 16:51:32 2018 +0200 weld GraphicFilterPoster Change-Id: I1e8af81267fdadc725eee8ac28e4dcf038cc50d9 Reviewed-on: https://gerrit.libreoffice.org/60710 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index 0ba79e581a0a..0a0c9f718dce 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -522,44 +522,25 @@ Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic, double, return aRet; } - -GraphicFilterPoster::GraphicFilterPoster(vcl::Window* pParent, const Graphic& rGraphic, +GraphicFilterPoster::GraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic, sal_uInt16 nPosterCount) - : GraphicFilterDialog(pParent, "PosterDialog", - "cui/ui/posterdialog.ui", rGraphic) + : GraphicFilterDialogController(pParent, "cui/ui/posterdialog.ui", "PosterDialog", rGraphic) + , mxNumPoster(m_xBuilder->weld_spin_button("value")) { - get(mpNumPoster, "value"); - - mpNumPoster->SetFirst( 2 ); - mpNumPoster->SetLast( rGraphic.GetBitmapEx().GetBitCount() ); - mpNumPoster->SetValue( nPosterCount ); - mpNumPoster->SetModifyHdl( LINK(this, GraphicFilterPoster, EditModifyHdl) ); + mxNumPoster->set_range(2, rGraphic.GetBitmapEx().GetBitCount()); + mxNumPoster->set_value(nPosterCount); + mxNumPoster->connect_value_changed(LINK(this, GraphicFilterPoster, EditModifyHdl)); } - -IMPL_LINK_NOARG(GraphicFilterPoster, EditModifyHdl, Edit&, void) +IMPL_LINK_NOARG(GraphicFilterPoster, EditModifyHdl, weld::SpinButton&, void) { GetModifyHdl().Call(nullptr); } - -GraphicFilterPoster::~GraphicFilterPoster() -{ - disposeOnce(); -} - - -void GraphicFilterPoster::dispose() -{ - mpNumPoster.clear(); - GraphicFilterDialog::dispose(); -} - - Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, double, double ) { Graphic aRet; - const sal_uInt16 nPosterCount = static_cast<sal_uInt16>(mpNumPoster->GetValue()); + const sal_uInt16 nPosterCount = static_cast<sal_uInt16>(mxNumPoster->get_value()); if( rGraphic.IsAnimated() ) { diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 108ac73ca14d..d8240ce678e9 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1285,11 +1285,10 @@ VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFil return VclPtr<AbstractGraphicFilterDialogController_Impl>::Create(o3tl::make_unique<GraphicFilterEmboss>(pParent, rGraphic, RectPoint::MM)); } -VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterPoster(vcl::Window* pParent, +VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic) { - VclPtrInstance<GraphicFilterPoster> pDlg( pParent, rGraphic, 16 ); - return VclPtr<AbstractGraphicFilterDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractGraphicFilterDialogController_Impl>::Create(o3tl::make_unique<GraphicFilterPoster>(pParent, rGraphic, 16)); } VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSepia(weld::Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index d26d30fa1dce..753b12bd150d 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -755,7 +755,7 @@ public: const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier) override; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterEmboss(weld::Window* pParent, const Graphic& rGraphic) override; - virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterPoster(vcl::Window* pParent, + virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic) override; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSepia(weld::Window* pParent, const Graphic& rGraphic) override; diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx index 3ba2b75148e5..c202a189a95c 100644 --- a/cui/source/inc/cuigrfflt.hxx +++ b/cui/source/inc/cuigrfflt.hxx @@ -209,17 +209,14 @@ public: virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override; }; -class GraphicFilterPoster : public GraphicFilterDialog +class GraphicFilterPoster : public GraphicFilterDialogController { private: - VclPtr<NumericField> mpNumPoster; - DECL_LINK(EditModifyHdl, Edit&, void); + std::unique_ptr<weld::SpinButton> mxNumPoster; + DECL_LINK(EditModifyHdl, weld::SpinButton&, void); public: - GraphicFilterPoster( vcl::Window* pParent, const Graphic& rGraphic, - sal_uInt16 nPosterColorCount ); - virtual ~GraphicFilterPoster() override; - virtual void dispose() override; - + GraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic, + sal_uInt16 nPosterColorCount); virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override; }; diff --git a/cui/uiconfig/ui/posterdialog.ui b/cui/uiconfig/ui/posterdialog.ui index e542ccdb9a18..69a9d9ed519e 100644 --- a/cui/uiconfig/ui/posterdialog.ui +++ b/cui/uiconfig/ui/posterdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <requires lib="LibreOffice" version="1.0"/> @@ -14,7 +14,13 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="posterdialog|PosterDialog">Posterize</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> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -101,11 +107,28 @@ <property name="vexpand">True</property> <property name="column_spacing">24</property> <child> - <object class="cuilo-GraphicPreviewWindow" id="preview"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="preview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="left_attach">1</property> @@ -132,10 +155,10 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="posterdialog|label2">Poster colors:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">value</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 0f8b386c01c9..d1f5c3303263 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -414,7 +414,7 @@ public: const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier)=0; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterEmboss(weld::Window* pParent, const Graphic& rGraphic)=0; - virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterPoster(vcl::Window* pParent, + virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic)=0; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSepia(weld::Window* pParent, const Graphic& rGraphic)=0; diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx index 793e7f066f42..3983bc8be4e5 100644 --- a/svx/source/dialog/grfflt.cxx +++ b/svx/source/dialog/grfflt.cxx @@ -177,7 +177,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const case SID_GRFFILTER_POSTER: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pWindow, rGraphic)); + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic)); if( aDlg->Execute() == RET_OK ) aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits