Kaydet (Commit) d6cee8ad authored tarafından Caolán McNamara's avatar Caolán McNamara

weld GraphicFilterSmooth

Change-Id: I9f92b49bff105965c13e5977ef39788c6684da29
Reviewed-on: https://gerrit.libreoffice.org/60711Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 65b5fc8f
......@@ -370,42 +370,24 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
return aRet;
}
GraphicFilterSmooth::GraphicFilterSmooth( vcl::Window* pParent, const Graphic& rGraphic, double nRadius)
: GraphicFilterDialog(pParent, "SmoothDialog",
"cui/ui/smoothdialog.ui", rGraphic)
GraphicFilterSmooth::GraphicFilterSmooth(weld::Window* pParent, const Graphic& rGraphic, double nRadius)
: GraphicFilterDialogController(pParent, "cui/ui/smoothdialog.ui", "SmoothDialog", rGraphic)
, mxMtrRadius(m_xBuilder->weld_spin_button("radius"))
{
get(mpMtrRadius, "radius");
mpMtrRadius->SetValue( nRadius* 10 );
mpMtrRadius->SetModifyHdl( LINK(this, GraphicFilterSmooth, EditModifyHdl) );
mpMtrRadius->GrabFocus();
mxMtrRadius->set_value(nRadius * 10);
mxMtrRadius->connect_value_changed(LINK(this, GraphicFilterSmooth, EditModifyHdl));
mxMtrRadius->grab_focus();
}
IMPL_LINK_NOARG(GraphicFilterSmooth, EditModifyHdl, Edit&, void)
IMPL_LINK_NOARG(GraphicFilterSmooth, EditModifyHdl, weld::SpinButton&, void)
{
GetModifyHdl().Call(nullptr);
}
GraphicFilterSmooth::~GraphicFilterSmooth()
{
disposeOnce();
}
void GraphicFilterSmooth::dispose()
{
mpMtrRadius.clear();
GraphicFilterDialog::dispose();
}
Graphic GraphicFilterSmooth::GetFilteredGraphic( const Graphic& rGraphic, double, double )
{
Graphic aRet;
double nRadius = mpMtrRadius->GetValue() / 10.0;
double nRadius = mxMtrRadius->get_value() / 10.0;
if( rGraphic.IsAnimated() )
{
......
......@@ -1297,11 +1297,10 @@ VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFil
return VclPtr<AbstractGraphicFilterDialogController_Impl>::Create(o3tl::make_unique<GraphicFilterSepia>(pParent, rGraphic, 10));
}
VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSmooth(vcl::Window* pParent,
VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSmooth(weld::Window* pParent,
const Graphic& rGraphic, double nRadius)
{
VclPtrInstance<GraphicFilterSmooth> pDlg( pParent, rGraphic, nRadius );
return VclPtr<AbstractGraphicFilterDialog_Impl>::Create( pDlg );
return VclPtr<AbstractGraphicFilterDialogController_Impl>::Create(o3tl::make_unique<GraphicFilterSmooth>(pParent, rGraphic, nRadius));
}
VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSolarize(weld::Window* pParent,
......
......@@ -759,7 +759,7 @@ public:
const Graphic& rGraphic) override;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSepia(weld::Window* pParent,
const Graphic& rGraphic) override;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth (vcl::Window* pParent,
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth(weld::Window* pParent,
const Graphic& rGraphic, double nRadius) override;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize(weld::Window* pParent,
const Graphic& rGraphic) override;
......
......@@ -151,18 +151,15 @@ public:
virtual Graphic GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY) = 0;
};
class GraphicFilterSmooth : public GraphicFilterDialog
class GraphicFilterSmooth : public GraphicFilterDialogController
{
private:
VclPtr<NumericField> mpMtrRadius;
DECL_LINK(EditModifyHdl, Edit&, void);
std::unique_ptr<weld::SpinButton> mxMtrRadius;
DECL_LINK(EditModifyHdl, weld::SpinButton&, void);
public:
GraphicFilterSmooth( vcl::Window* pParent, const Graphic& rGraphic, double nRadius);
virtual ~GraphicFilterSmooth() override;
virtual void dispose() override;
GraphicFilterSmooth(weld::Window* pParent, const Graphic& rGraphic, double nRadius);
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
};
......
<?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"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">0.10000000000000001</property>
<property name="upper">100</property>
......@@ -15,7 +14,13 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="smoothdialog|SmoothDialog">Smooth</property>
<property name="resizable">False</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>
......@@ -102,12 +107,29 @@
<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>
<property name="top_attach">0</property>
......@@ -134,10 +156,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="smoothdialog|label2">_Smooth radius:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">radius</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......
......@@ -418,7 +418,7 @@ public:
const Graphic& rGraphic)=0;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSepia(weld::Window* pParent,
const Graphic& rGraphic)=0;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth (vcl::Window* pParent,
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth(weld::Window* pParent,
const Graphic& rGraphic,
double nRadius)=0;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize(weld::Window* pParent,
......
......@@ -42,7 +42,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
{
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : nullptr;
vcl::Window* pWindow = ( pViewFrame && pViewFrame->GetViewShell() ) ? pViewFrame->GetViewShell()->GetWindow() : nullptr;
weld::Window* pFrameWeld = (pViewFrame && pViewFrame->GetViewShell()) ? pViewFrame->GetViewShell()->GetFrameWeld() : nullptr;
Graphic aGraphic;
switch( rReq.GetSlot() )
......@@ -75,7 +75,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_SMOOTH:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSmooth(pWindow, rGraphic, 0.7));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSmooth(pFrameWeld, rGraphic, 0.7));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......@@ -159,7 +159,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_MOSAIC:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterMosaic(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterMosaic(pFrameWeld, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......@@ -168,7 +168,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_EMBOSS:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterEmboss(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterEmboss(pFrameWeld, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......@@ -177,7 +177,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_POSTER:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pFrameWeld, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......@@ -211,7 +211,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_SEPIA:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSepia(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSepia(pFrameWeld, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......@@ -220,7 +220,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_SOLARIZE:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pFrameWeld, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment