summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-18 12:10:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-19 16:19:43 +0200
commit4b743a2cc1b6d29404873205a25432baf4f9c933 (patch)
tree328b1b17dac4746d5a4023b996a68e8ec2e2e301
parent3a87fb18241e803f7ebffedfc59648782f560f4e (diff)
weld GraphicFilterSolarize
Change-Id: If729ea1688e9dc15372a59d75c972ee37511f76e Reviewed-on: https://gerrit.libreoffice.org/60680 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx44
-rw-r--r--cui/source/factory/dlgfact.cxx5
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--cui/source/inc/cuigrfflt.hxx22
-rw-r--r--cui/uiconfig/ui/embossdialog.ui1
-rw-r--r--cui/uiconfig/ui/solarizedialog.ui33
-rw-r--r--include/svx/svxdlg.hxx2
-rw-r--r--svx/source/dialog/grfflt.cxx2
8 files changed, 55 insertions, 56 deletions
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index f8f2b76bc4a5..c8268ac38f02 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -449,53 +449,33 @@ Graphic GraphicFilterSmooth::GetFilteredGraphic( const Graphic& rGraphic, double
return aRet;
}
-
-GraphicFilterSolarize::GraphicFilterSolarize( vcl::Window* pParent, const Graphic& rGraphic,
- sal_uInt8 cGreyThreshold, bool bInvert )
- : GraphicFilterDialog(pParent, "SolarizeDialog",
- "cui/ui/solarizedialog.ui", rGraphic)
+GraphicFilterSolarize::GraphicFilterSolarize(weld::Window* pParent, const Graphic& rGraphic,
+ sal_uInt8 cGreyThreshold, bool bInvert)
+ : GraphicFilterDialogController(pParent, "cui/ui/solarizedialog.ui", "SolarizeDialog", rGraphic)
+ , mxMtrThreshold(m_xBuilder->weld_metric_spin_button("value", FUNIT_PERCENT))
+ , mxCbxInvert(m_xBuilder->weld_check_button("invert"))
{
- get(mpMtrThreshold, "value");
- get(mpCbxInvert, "invert");
-
- mpMtrThreshold->SetValue( FRound( cGreyThreshold / 2.55 ) );
- mpMtrThreshold->SetModifyHdl( LINK(this, GraphicFilterSolarize, EditModifyHdl) );
+ mxMtrThreshold->set_value(FRound(cGreyThreshold / 2.55), FUNIT_PERCENT);
+ mxMtrThreshold->connect_value_changed(LINK(this, GraphicFilterSolarize, EditModifyHdl));
- mpCbxInvert->Check( bInvert );
- mpCbxInvert->SetToggleHdl( LINK(this, GraphicFilterSolarize, CheckBoxModifyHdl) );
+ mxCbxInvert->set_active(bInvert);
+ mxCbxInvert->connect_toggled(LINK(this, GraphicFilterSolarize, CheckBoxModifyHdl));
}
-
-IMPL_LINK_NOARG(GraphicFilterSolarize, CheckBoxModifyHdl, CheckBox&, void)
+IMPL_LINK_NOARG(GraphicFilterSolarize, CheckBoxModifyHdl, weld::ToggleButton&, void)
{
GetModifyHdl().Call(nullptr);
}
-
-IMPL_LINK_NOARG(GraphicFilterSolarize, EditModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(GraphicFilterSolarize, EditModifyHdl, weld::MetricSpinButton&, void)
{
GetModifyHdl().Call(nullptr);
}
-
-GraphicFilterSolarize::~GraphicFilterSolarize()
-{
- disposeOnce();
-}
-
-
-void GraphicFilterSolarize::dispose()
-{
- mpMtrThreshold.clear();
- mpCbxInvert.clear();
- GraphicFilterDialog::dispose();
-}
-
-
Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, double, double )
{
Graphic aRet;
- sal_uInt8 nGreyThreshold = static_cast<sal_uInt8>(FRound( mpMtrThreshold->GetValue() * 2.55 ));
+ sal_uInt8 nGreyThreshold = static_cast<sal_uInt8>(FRound(mxMtrThreshold->get_value(FUNIT_PERCENT) * 2.55));
if( rGraphic.IsAnimated() )
{
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 63868ad23534..0534e2e006f8 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1306,11 +1306,10 @@ VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFil
return VclPtr<AbstractGraphicFilterDialog_Impl>::Create( pDlg );
}
-VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (vcl::Window* pParent,
+VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterSolarize(weld::Window* pParent,
const Graphic& rGraphic)
{
- VclPtrInstance<GraphicFilterSolarize> pDlg( pParent, rGraphic, 128, false/*bInvert*/ );
- return VclPtr<AbstractGraphicFilterDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractGraphicFilterDialogController_Impl>::Create(o3tl::make_unique<GraphicFilterSolarize>(pParent, rGraphic, 128, false /*bInvert*/));
}
VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterMosaic (vcl::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 6df50a3b0f52..968685e8994c 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -761,7 +761,7 @@ public:
const Graphic& rGraphic) override;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth (vcl::Window* pParent,
const Graphic& rGraphic, double nRadius) override;
- virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize (vcl::Window* pParent,
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize(weld::Window* pParent,
const Graphic& rGraphic) override;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterMosaic (vcl::Window* pParent,
const Graphic& rGraphic) override;
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
index 2a8a8f35229c..1d369d560fcd 100644
--- a/cui/source/inc/cuigrfflt.hxx
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -184,23 +184,19 @@ public:
bool IsEnhanceEdges() const { return mpCbxEdges->IsChecked(); }
};
-class GraphicFilterSolarize : public GraphicFilterDialog
+class GraphicFilterSolarize : public GraphicFilterDialogController
{
private:
- VclPtr<MetricField> mpMtrThreshold;
- VclPtr<CheckBox> mpCbxInvert;
- DECL_LINK(CheckBoxModifyHdl, CheckBox&, void);
- DECL_LINK(EditModifyHdl, Edit&, void);
+ std::unique_ptr<weld::MetricSpinButton> mxMtrThreshold;
+ std::unique_ptr<weld::CheckButton> mxCbxInvert;
+ DECL_LINK(CheckBoxModifyHdl, weld::ToggleButton&, void);
+ DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
public:
-
- GraphicFilterSolarize( vcl::Window* pParent, const Graphic& rGraphic,
- sal_uInt8 nGreyThreshold, bool bInvert );
- virtual ~GraphicFilterSolarize() override;
- virtual void dispose() override;
-
- virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
- bool IsInvert() const { return mpCbxInvert->IsChecked(); }
+ GraphicFilterSolarize(weld::Window* pParent, const Graphic& rGraphic,
+ sal_uInt8 nGreyThreshold, bool bInvert);
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
+ bool IsInvert() const { return mxCbxInvert->get_active(); }
};
class GraphicFilterSepia : public GraphicFilterDialog
diff --git a/cui/uiconfig/ui/embossdialog.ui b/cui/uiconfig/ui/embossdialog.ui
index d8457c5f91ce..07a8ef559513 100644
--- a/cui/uiconfig/ui/embossdialog.ui
+++ b/cui/uiconfig/ui/embossdialog.ui
@@ -6,6 +6,7 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="embossdialog|EmbossDialog">Emboss</property>
+ <property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
diff --git a/cui/uiconfig/ui/solarizedialog.ui b/cui/uiconfig/ui/solarizedialog.ui
index 75e056062812..e711ddde360b 100644
--- a/cui/uiconfig/ui/solarizedialog.ui
+++ b/cui/uiconfig/ui/solarizedialog.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"/>
@@ -13,7 +13,13 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="solarizedialog|SolarizeDialog">Solarization</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>
@@ -100,11 +106,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>
@@ -117,7 +140,7 @@
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkSpinButton" id="value:0%">
+ <object class="GtkSpinButton" id="value">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
@@ -131,10 +154,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="solarizedialog|label2">Threshold _value:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">value:0%</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 7fc73b72e4a3..81e4fd933543 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -421,7 +421,7 @@ public:
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSmooth (vcl::Window* pParent,
const Graphic& rGraphic,
double nRadius)=0;
- virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize (vcl::Window* pParent,
+ virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterSolarize(weld::Window* pParent,
const Graphic& rGraphic)=0;
virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterMosaic (vcl::Window* pParent,
const Graphic& rGraphic)=0;
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
index a73aba142da8..bc53e6cfa92d 100644
--- a/svx/source/dialog/grfflt.cxx
+++ b/svx/source/dialog/grfflt.cxx
@@ -220,7 +220,7 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const
case SID_GRFFILTER_SOLARIZE:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pWindow, rGraphic));
+ ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pWindow ? pWindow->GetFrameWeld() : nullptr, rGraphic));
if( aDlg->Execute() == RET_OK )
aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
}