[Libreoffice-commits] core.git: 3 commits - cui/source
Noel Grandin
noel at peralex.com
Mon Oct 19 06:23:05 PDT 2015
cui/source/dialogs/colorpicker.cxx | 174 ++++++++++++++++++-------------------
cui/source/dialogs/cuigrfflt.cxx | 36 +++----
cui/source/inc/cuigrfflt.hxx | 16 +--
3 files changed, 114 insertions(+), 112 deletions(-)
New commits:
commit c4484a8225a5d0fe0cd8a7f9ca36cc8b009b35ff
Author: Noel Grandin <noel at peralex.com>
Date: Mon Oct 19 13:29:13 2015 +0200
convert Link<> to typed
Change-Id: I1d8fe58c589b56590453b2136296ca50bfe78252
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index bdf4c93..f19e523 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -123,7 +123,7 @@ void GraphicPreviewWindow::ScaleImageToFit()
}
}
- maModifyHdl.Call(this);
+ maModifyHdl.Call(nullptr);
}
void GraphicPreviewWindow::Resize()
@@ -170,15 +170,13 @@ IMPL_LINK_NOARG_TYPED(GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer *, void)
-IMPL_LINK_NOARG(GraphicFilterDialog, ImplModifyHdl)
+IMPL_LINK_NOARG_TYPED(GraphicFilterDialog, ImplModifyHdl, LinkParamNone*, void)
{
if (bIsBitmap)
{
maTimer.Stop();
maTimer.Start();
}
-
- return 0;
}
@@ -208,14 +206,14 @@ GraphicFilterMosaic::GraphicFilterMosaic( vcl::Window* pParent, const Graphic& r
mpMtrWidth->GrabFocus();
}
-IMPL_LINK_TYPED(GraphicFilterMosaic, CheckBoxModifyHdl, CheckBox&, rCheckBox, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterMosaic, CheckBoxModifyHdl, CheckBox&, void)
{
- GetModifyHdl().Call(&rCheckBox);
+ GetModifyHdl().Call(nullptr);
}
-IMPL_LINK_TYPED(GraphicFilterMosaic, EditModifyHdl, Edit&, rEdit, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterMosaic, EditModifyHdl, Edit&, void)
{
- GetModifyHdl().Call(&rEdit);
+ GetModifyHdl().Call(nullptr);
}
GraphicFilterMosaic::~GraphicFilterMosaic()
@@ -282,9 +280,9 @@ GraphicFilterSmooth::GraphicFilterSmooth( vcl::Window* pParent, const Graphic& r
mpMtrRadius->GrabFocus();
}
-IMPL_LINK_TYPED(GraphicFilterSmooth, EditModifyHdl, Edit&, rEdit, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterSmooth, EditModifyHdl, Edit&, void)
{
- GetModifyHdl().Call(&rEdit);
+ GetModifyHdl().Call(nullptr);
}
GraphicFilterSmooth::~GraphicFilterSmooth()
@@ -345,13 +343,13 @@ GraphicFilterSolarize::GraphicFilterSolarize( vcl::Window* pParent, const Graphi
mpCbxInvert->SetToggleHdl( LINK(this, GraphicFilterSolarize, CheckBoxModifyHdl) );
}
-IMPL_LINK_TYPED(GraphicFilterSolarize, CheckBoxModifyHdl, CheckBox&, rCheckBox, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterSolarize, CheckBoxModifyHdl, CheckBox&, void)
{
- GetModifyHdl().Call(&rCheckBox);
+ GetModifyHdl().Call(nullptr);
}
-IMPL_LINK_TYPED(GraphicFilterSolarize, EditModifyHdl, Edit&, rEdit, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterSolarize, EditModifyHdl, Edit&, void)
{
- GetModifyHdl().Call(&rEdit);
+ GetModifyHdl().Call(nullptr);
}
GraphicFilterSolarize::~GraphicFilterSolarize()
@@ -416,9 +414,9 @@ GraphicFilterSepia::GraphicFilterSepia( vcl::Window* pParent, const Graphic& rGr
mpMtrSepia->SetModifyHdl( LINK(this, GraphicFilterSepia, EditModifyHdl) );
}
-IMPL_LINK_TYPED(GraphicFilterSepia, EditModifyHdl, Edit&, rEdit, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterSepia, EditModifyHdl, Edit&, void)
{
- GetModifyHdl().Call(&rEdit);
+ GetModifyHdl().Call(nullptr);
}
GraphicFilterSepia::~GraphicFilterSepia()
@@ -474,9 +472,9 @@ GraphicFilterPoster::GraphicFilterPoster(vcl::Window* pParent, const Graphic& rG
mpNumPoster->SetModifyHdl( LINK(this, GraphicFilterPoster, EditModifyHdl) );
}
-IMPL_LINK_TYPED(GraphicFilterPoster, EditModifyHdl, Edit&, rEdit, void)
+IMPL_LINK_NOARG_TYPED(GraphicFilterPoster, EditModifyHdl, Edit&, void)
{
- GetModifyHdl().Call(&rEdit);
+ GetModifyHdl().Call(nullptr);
}
GraphicFilterPoster::~GraphicFilterPoster()
@@ -526,7 +524,7 @@ void EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
SvxRectCtl::MouseButtonDown( rEvt );
if( GetActualRP() != eOldRP )
- maModifyHdl.Call( this );
+ maModifyHdl.Call( nullptr );
}
Size EmbossControl::GetOptimalSize() const
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
index 9d7be2d..db4b0a3 100644
--- a/cui/source/inc/cuigrfflt.hxx
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -36,7 +36,7 @@ class GraphicPreviewWindow : public Control
{
private:
const Graphic* mpOrigGraphic;
- Link<> maModifyHdl;
+ Link<LinkParamNone*,void> maModifyHdl;
Graphic maScaledOrig;
Graphic maPreview;
double mfScaleX;
@@ -51,7 +51,7 @@ private:
public:
GraphicPreviewWindow(vcl::Window* pParent, WinBits nStyle);
- void init(const Graphic* pOrigGraphic, const Link<>& rLink)
+ void init(const Graphic* pOrigGraphic, const Link<LinkParamNone*,void>& rLink)
{
mpOrigGraphic = pOrigGraphic;
maModifyHdl = rLink;
@@ -69,17 +69,17 @@ class GraphicFilterDialog : public ModalDialog
private:
Timer maTimer;
- Link<> maModifyHdl;
+ Link<LinkParamNone*,void> maModifyHdl;
Size maSizePixel;
bool bIsBitmap;
- DECL_LINK_TYPED(ImplPreviewTimeoutHdl, Timer *, void);
- DECL_LINK( ImplModifyHdl, void* );
+ DECL_LINK_TYPED( ImplPreviewTimeoutHdl, Timer *, void );
+ DECL_LINK_TYPED( ImplModifyHdl, LinkParamNone*, void);
protected:
VclPtr<GraphicPreviewWindow> mpPreview;
- const Link<>& GetModifyHdl() const { return maModifyHdl; }
+ const Link<LinkParamNone*,void>& GetModifyHdl() const { return maModifyHdl; }
const Size& GetGraphicSizePixel() const { return maSizePixel; }
public:
@@ -183,14 +183,14 @@ public:
class EmbossControl : public SvxRectCtl
{
private:
- Link<> maModifyHdl;
+ Link<LinkParamNone*, void> maModifyHdl;
virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
virtual Size GetOptimalSize() const override;
public:
EmbossControl(vcl::Window* pParent)
: SvxRectCtl(pParent) {}
- void SetModifyHdl( const Link<>& rHdl ) { maModifyHdl = rHdl; }
+ void SetModifyHdl( const Link<LinkParamNone*,void>& rHdl ) { maModifyHdl = rHdl; }
};
class GraphicFilterEmboss : public GraphicFilterDialog
commit 2e5427ce81cf9641ec21ce6bd935120e25e4c00d
Author: Noel Grandin <noel at peralex.com>
Date: Mon Oct 19 13:23:06 2015 +0200
convert Link<> to typed
Change-Id: Ib3931639f7407f274700ab96f01a67d6f26925f4
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index f83e52c..5cb9593 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -732,12 +732,12 @@ public:
void KeyMove( int dy );
- void SetModifyHdl( const Link<>& rLink ) { maModifyHdl = rLink; }
+ void SetModifyHdl( const Link<ColorSliderControl&,void>& rLink ) { maModifyHdl = rLink; }
sal_Int16 GetLevel() const { return mnLevel; }
private:
- Link<> maModifyHdl;
+ Link<ColorSliderControl&,void> maModifyHdl;
Color maColor;
ColorMode meMode;
Bitmap* mpBitmap;
@@ -951,7 +951,7 @@ void ColorSliderControl::Resize()
void ColorSliderControl::Modify()
{
- maModifyHdl.Call(this);
+ maModifyHdl.Call(*this);
}
void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double dValue)
@@ -989,8 +989,8 @@ public:
void update_color(sal_uInt16 n = UPDATE_ALL);
- DECL_LINK(ColorModifyHdl, void*);
DECL_LINK_TYPED(ColorFieldControlModifydl, ColorFieldControl&, void);
+ DECL_LINK_TYPED(ColorSliderControlModifyHdl, ColorSliderControl&, void);
DECL_LINK_TYPED(ColorModifyEditHdl, Edit&, void);
DECL_LINK_TYPED(ModeModifyHdl, RadioButton&, void);
@@ -1073,7 +1073,7 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa
set_height_request(aDialogSize.Height() + 30);
mpColorField->SetModifyHdl( LINK( this, ColorPickerDialog, ColorFieldControlModifydl ) );
- mpColorSlider->SetModifyHdl( LINK( this, ColorPickerDialog, ColorModifyHdl ) );
+ mpColorSlider->SetModifyHdl( LINK( this, ColorPickerDialog, ColorSliderControlModifyHdl ) );
Link<Edit&,void> aLink3( LINK( this, ColorPickerDialog, ColorModifyEditHdl ) );
mpMFRed->SetModifyHdl( aLink3 );
@@ -1280,10 +1280,6 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
mpColorPreview->SetColor(aColor);
}
-IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void)
-{
- ColorModifyHdl(&rEdit);
-}
IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorFieldControlModifydl, ColorFieldControl&, void)
{
sal_uInt16 n = 0;
@@ -1325,88 +1321,92 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorFieldControlModifydl, ColorFieldCo
update_color(n);
}
-IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p)
+IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorSliderControlModifyHdl, ColorSliderControl&, void)
{
sal_uInt16 n = 0;
- if (p == mpColorSlider)
+ double dValue = mpColorSlider->GetValue();
+ switch (meMode)
{
- double dValue = mpColorSlider->GetValue();
- switch (meMode)
- {
- case HUE:
- setColorComponent( COLORCOMP_HUE, dValue * 360.0 );
- break;
- case SATURATION:
- setColorComponent( COLORCOMP_SAT, dValue );
- break;
- case BRIGHTNESS:
- setColorComponent( COLORCOMP_BRI, dValue );
- break;
- case RED:
- setColorComponent( COLORCOMP_RED, dValue );
- break;
- case GREEN:
- setColorComponent( COLORCOMP_GREEN, dValue );
- break;
- case BLUE:
- setColorComponent( COLORCOMP_BLUE, dValue );
- break;
- }
-
- n = UPDATE_ALL&~(UPDATE_COLORSLIDER);
+ case HUE:
+ setColorComponent( COLORCOMP_HUE, dValue * 360.0 );
+ break;
+ case SATURATION:
+ setColorComponent( COLORCOMP_SAT, dValue );
+ break;
+ case BRIGHTNESS:
+ setColorComponent( COLORCOMP_BRI, dValue );
+ break;
+ case RED:
+ setColorComponent( COLORCOMP_RED, dValue );
+ break;
+ case GREEN:
+ setColorComponent( COLORCOMP_GREEN, dValue );
+ break;
+ case BLUE:
+ setColorComponent( COLORCOMP_BLUE, dValue );
+ break;
}
- else if (p == mpMFRed)
+
+ n = UPDATE_ALL&~(UPDATE_COLORSLIDER);
+ if (n)
+ update_color(n);
+}
+IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void)
+{
+ sal_uInt16 n = 0;
+
+ if (&rEdit == mpMFRed)
{
setColorComponent( COLORCOMP_RED, ((double)mpMFRed->GetValue()) / 255.0 );
n = UPDATE_ALL &~ (UPDATE_RGB);
}
- else if (p == mpMFGreen)
+ else if (&rEdit == mpMFGreen)
{
setColorComponent( COLORCOMP_GREEN, ((double)mpMFGreen->GetValue()) / 255.0 );
n = UPDATE_ALL &~ (UPDATE_RGB);
}
- else if (p == mpMFBlue)
+ else if (&rEdit == mpMFBlue)
{
setColorComponent( COLORCOMP_BLUE, ((double)mpMFBlue->GetValue()) / 255.0 );
n = UPDATE_ALL &~ (UPDATE_RGB);
}
- else if (p == mpMFHue)
+ else if (&rEdit == mpMFHue)
{
setColorComponent( COLORCOMP_HUE, (double)mpMFHue->GetValue() );
n = UPDATE_ALL &~ (UPDATE_HSB);
}
- else if (p == mpMFSaturation)
+ else if (&rEdit == mpMFSaturation)
{
setColorComponent( COLORCOMP_SAT, ((double)mpMFSaturation->GetValue()) / 100.0 );
n = UPDATE_ALL &~ (UPDATE_HSB);
}
- else if (p == mpMFBrightness)
+ else if (&rEdit == mpMFBrightness)
{
setColorComponent( COLORCOMP_BRI, ((double)mpMFBrightness->GetValue()) / 100.0 );
n = UPDATE_ALL &~ (UPDATE_HSB);
}
- else if (p == mpMFCyan)
+ else if (&rEdit == mpMFCyan)
{
setColorComponent( COLORCOMP_CYAN, ((double)mpMFCyan->GetValue()) / 100.0 );
n = UPDATE_ALL &~ (UPDATE_CMYK);
}
- else if (p == mpMFMagenta)
+ else if (&rEdit == mpMFMagenta)
{
setColorComponent( COLORCOMP_MAGENTA, ((double)mpMFMagenta->GetValue()) / 100.0 );
n = UPDATE_ALL &~ (UPDATE_CMYK);
}
- else if (p == mpMFYellow)
+ else if (&rEdit == mpMFYellow)
{
setColorComponent( COLORCOMP_YELLOW, ((double)mpMFYellow->GetValue()) / 100.0 );
n = UPDATE_ALL &~ (UPDATE_CMYK);
}
- else if (p == mpMFKey)
+ else if (&rEdit == mpMFKey)
{
setColorComponent( COLORCOMP_KEY, ((double)mpMFKey->GetValue()) / 100.0 );
n = UPDATE_ALL&~(UPDATE_CMYK);
}
- else if (p == mpEDHex)
+ else if (&rEdit == mpEDHex)
{
sal_Int32 nColor = mpEDHex->GetColor();
@@ -1429,8 +1429,6 @@ IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p)
if (n)
update_color(n);
-
- return 0;
}
IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ModeModifyHdl, RadioButton&, void)
commit dbad14154cb83490b966bafa7bb97ab7e858acec
Author: Noel Grandin <noel at peralex.com>
Date: Mon Oct 19 13:18:33 2015 +0200
convert Link<> to typed
Change-Id: I57c15ba4374b626db322f42f04adc088b8cf6ce0
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 81d274a..f83e52c 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -329,10 +329,10 @@ public:
void KeyMove(int dx, int dy);
- void SetModifyHdl(Link<>& rLink) { maModifyHdl = rLink; }
+ void SetModifyHdl(const Link<ColorFieldControl&,void>& rLink) { maModifyHdl = rLink; }
private:
- Link<> maModifyHdl;
+ Link<ColorFieldControl&,void> maModifyHdl;
ColorMode meMode;
Color maColor;
double mdX;
@@ -682,7 +682,7 @@ void ColorFieldControl::Resize()
void ColorFieldControl::Modify()
{
- maModifyHdl.Call( this );
+ maModifyHdl.Call( *this );
}
void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y )
@@ -732,7 +732,7 @@ public:
void KeyMove( int dy );
- void SetModifyHdl( Link<>& rLink ) { maModifyHdl = rLink; }
+ void SetModifyHdl( const Link<>& rLink ) { maModifyHdl = rLink; }
sal_Int16 GetLevel() const { return mnLevel; }
@@ -990,6 +990,7 @@ public:
void update_color(sal_uInt16 n = UPDATE_ALL);
DECL_LINK(ColorModifyHdl, void*);
+ DECL_LINK_TYPED(ColorFieldControlModifydl, ColorFieldControl&, void);
DECL_LINK_TYPED(ColorModifyEditHdl, Edit&, void);
DECL_LINK_TYPED(ModeModifyHdl, RadioButton&, void);
@@ -1071,9 +1072,8 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa
set_width_request(aDialogSize.Width() + 50);
set_height_request(aDialogSize.Height() + 30);
- Link<> aLink( LINK( this, ColorPickerDialog, ColorModifyHdl ) );
- mpColorField->SetModifyHdl( aLink );
- mpColorSlider->SetModifyHdl( aLink );
+ mpColorField->SetModifyHdl( LINK( this, ColorPickerDialog, ColorFieldControlModifydl ) );
+ mpColorSlider->SetModifyHdl( LINK( this, ColorPickerDialog, ColorModifyHdl ) );
Link<Edit&,void> aLink3( LINK( this, ColorPickerDialog, ColorModifyEditHdl ) );
mpMFRed->SetModifyHdl( aLink3 );
@@ -1284,46 +1284,52 @@ IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void)
{
ColorModifyHdl(&rEdit);
}
-IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p)
+IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorFieldControlModifydl, ColorFieldControl&, void)
{
sal_uInt16 n = 0;
- if (p == mpColorField)
+ double x = mpColorField->GetX();
+ double y = mpColorField->GetY();
+
+ switch( meMode )
{
- double x = mpColorField->GetX();
- double y = mpColorField->GetY();
+ case HUE:
+ mdSat = x;
+ setColorComponent( COLORCOMP_BRI, y );
+ break;
+ case SATURATION:
+ mdHue = x * 360.0;
+ setColorComponent( COLORCOMP_BRI, y );
+ break;
+ case BRIGHTNESS:
+ mdHue = x * 360.0;
+ setColorComponent( COLORCOMP_SAT, y );
+ break;
+ case RED:
+ mdBlue = x;
+ setColorComponent( COLORCOMP_GREEN, y );
+ break;
+ case GREEN:
+ mdBlue = x;
+ setColorComponent( COLORCOMP_RED, y );
+ break;
+ case BLUE:
+ mdRed = x;
+ setColorComponent( COLORCOMP_GREEN, y );
+ break;
+ }
- switch( meMode )
- {
- case HUE:
- mdSat = x;
- setColorComponent( COLORCOMP_BRI, y );
- break;
- case SATURATION:
- mdHue = x * 360.0;
- setColorComponent( COLORCOMP_BRI, y );
- break;
- case BRIGHTNESS:
- mdHue = x * 360.0;
- setColorComponent( COLORCOMP_SAT, y );
- break;
- case RED:
- mdBlue = x;
- setColorComponent( COLORCOMP_GREEN, y );
- break;
- case GREEN:
- mdBlue = x;
- setColorComponent( COLORCOMP_RED, y );
- break;
- case BLUE:
- mdRed = x;
- setColorComponent( COLORCOMP_GREEN, y );
- break;
- }
+ n = UPDATE_ALL &~ (UPDATE_COLORCHOOSER);
- n = UPDATE_ALL &~ (UPDATE_COLORCHOOSER);
- }
- else if (p == mpColorSlider)
+ if (n)
+ update_color(n);
+
+}
+IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p)
+{
+ sal_uInt16 n = 0;
+
+ if (p == mpColorSlider)
{
double dValue = mpColorSlider->GetValue();
switch (meMode)
More information about the Libreoffice-commits
mailing list