diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-31 10:06:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-31 21:21:37 +0000 |
commit | e70fb08305fdb3ad54c17f979c64996a7f043dcd (patch) | |
tree | 1f29b40353f82f4d082b013d722bdb15bd790c7a /cui/source/dialogs | |
parent | 344a1abd2f28f4556746f72a06358a08dd23abbe (diff) |
convert smooth dialog to .ui
Change-Id: If2894cef70bf6b9848a1338afaa36dc8b0d7d6be
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r-- | cui/source/dialogs/cuigrfflt.cxx | 67 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.hrc | 7 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.src | 72 |
3 files changed, 35 insertions, 111 deletions
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index 06381de76367..ccf12762b604 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -18,6 +18,7 @@ */ #include <tools/shl.hxx> +#include <vcl/builder.hxx> #include <vcl/msgbox.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/viewsh.hxx> @@ -143,7 +144,7 @@ IMPL_LINK_NOARG(oldGraphicFilterDialog, ImplModifyHdl) return 0; } -GraphicFilterDialog::PreviewWindow::PreviewWindow(Window* pParent, +GraphicPreviewWindow::GraphicPreviewWindow(Window* pParent, const WinBits nStyle) : Control(pParent, nStyle) , mpOrigGraphic(NULL) @@ -152,14 +153,25 @@ GraphicFilterDialog::PreviewWindow::PreviewWindow(Window* pParent, { } -Size GraphicFilterDialog::PreviewWindow::GetOptimalSize() const +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeGraphicPreviewWindow(Window *pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinBits = WB_TABSTOP; + + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinBits |= WB_BORDER; + + return new GraphicPreviewWindow(pParent, nWinBits); +} + +Size GraphicPreviewWindow::GetOptimalSize() const { return LogicToPixel(Size(81, 73), MAP_APPFONT); } // ----------------------------------------------------------------------------- -void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) +void GraphicPreviewWindow::Paint( const Rectangle& rRect ) { Control::Paint( rRect ); @@ -183,21 +195,19 @@ void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) // ----------------------------------------------------------------------------- -void GraphicFilterDialog::PreviewWindow::SetPreview( const Graphic& rGraphic ) +void GraphicPreviewWindow::SetPreview( const Graphic& rGraphic ) { maPreview = rGraphic; - - if( maPreview.IsAnimated() || maPreview.IsTransparent() ) - Invalidate(); - else - Paint( Rectangle( Point(), GetOutputSizePixel() ) ); + Invalidate(); } -void GraphicFilterDialog::PreviewWindow::ScaleImageToFit() +void GraphicPreviewWindow::ScaleImageToFit() { if (!mpOrigGraphic) return; + maScaledOrig = *mpOrigGraphic; + const Size aPreviewSize( GetOutputSizePixel() ); Size aSizePixel(LogicToPixel(mpOrigGraphic->GetPrefSize(), mpOrigGraphic->GetPrefMapMode())); @@ -229,12 +239,14 @@ void GraphicFilterDialog::PreviewWindow::ScaleImageToFit() BitmapEx aBmpEx( mpOrigGraphic->GetBitmapEx() ); if( aBmpEx.Scale( aGrfSize, BMP_SCALE_DEFAULT ) ) - maPreview = aBmpEx; + maScaledOrig = aBmpEx; } } + + maModifyHdl.Call(this); } -void GraphicFilterDialog::PreviewWindow::Resize() +void GraphicPreviewWindow::Resize() { Control::Resize(); ScaleImageToFit(); @@ -250,14 +262,12 @@ GraphicFilterDialog::GraphicFilterDialog(Window* pParent, { bIsBitmap = rGraphic.GetType() == GRAPHIC_BITMAP; - get(mpPreview, "preview"); - mpPreview->init(&rGraphic); - maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) ); - maTimer.SetTimeout( 100 ); - ImplModifyHdl( NULL ); -} + maTimer.SetTimeout( 5 ); + get(mpPreview, "preview"); + mpPreview->init(&rGraphic, maModifyHdl); +} // ----------------------------------------------------------------------------- @@ -366,22 +376,15 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, // - GraphicFilterSmooth - // ------------------ -GraphicFilterSmooth::GraphicFilterSmooth( Window* pParent, const Graphic& rGraphic, double nRadius) : - oldGraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SMOOTH ), rGraphic ), - maFtRadius ( this, CUI_RES( DLG_FILTERSMOOTH_FT_RADIUS ) ), - maMtrRadius ( this, CUI_RES( DLG_FILTERSMOOTH_MTR_RADIUS ) ) +GraphicFilterSmooth::GraphicFilterSmooth( Window* pParent, const Graphic& rGraphic, double nRadius) + : GraphicFilterDialog(pParent, "SmoothDialog", + "cui/ui/smoothdialog.ui", rGraphic) { - FreeResource(); - - maMtrRadius.SetValue( nRadius* 10 ); - maMtrRadius.SetModifyHdl( GetModifyHdl() ); - maMtrRadius.GrabFocus(); -} + get(mpMtrRadius, "radius"); -// ----------------------------------------------------------------------------- - -GraphicFilterSmooth::~GraphicFilterSmooth() -{ + mpMtrRadius->SetValue( nRadius* 10 ); + mpMtrRadius->SetModifyHdl( GetModifyHdl() ); + mpMtrRadius->GrabFocus(); } // ----------------------------------------------------------------------------- diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc index 976d8b0e082b..da6abb3fe07c 100644 --- a/cui/source/dialogs/grfflt.hrc +++ b/cui/source/dialogs/grfflt.hrc @@ -41,13 +41,6 @@ #define DLG_FILTERMOSAIC_CBX_EDGES 5 // ---------------------- -// - DLG_FILTERSMOOTH - -// ---------------------- - -#define DLG_FILTERSMOOTH_FT_RADIUS 1 -#define DLG_FILTERSMOOTH_MTR_RADIUS 2 - -// ---------------------- // - DLG_FILTERSOLARIZE - // ---------------------- diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src index ff1cfb2492c0..23192ecd8601 100644 --- a/cui/source/dialogs/grfflt.src +++ b/cui/source/dialogs/grfflt.src @@ -412,76 +412,4 @@ ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS }; }; -// -------------------- -// - DLG_FILTERSMOOTH - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_SMOOTH -{ - HelpID = CMD_SID_GRFFILTER_SMOOTH; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Smooth" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y14 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERSMOOTH_FT_RADIUS - { - Pos = MAP_APPFONT ( 12 , MA_Y14 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Smooth Radius" ; - }; -#define MA_Y15 MA_Y14 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - NumericField DLG_FILTERSMOOTH_MTR_RADIUS - { - HelpID = "cui:NumericField:RID_SVX_GRFFILTER_DLG_SMOOTH:DLG_FILTERSMOOTH_MTR_RADIUS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y15 ); - Size = MAP_APPFONT ( 35 , 12 ); - TabStop = TRUE; - Right = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = 0; - Maximum = 1000; - StrictFormat = TRUE; - First = 1; - DecimalDigits = 1; - Last = 1000; - SpinSize = 2; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |