From 3137acbe78d7c61cb9d8e58cf44312943857f5f7 Mon Sep 17 00:00:00 2001 From: Palenik Mihály Date: Tue, 10 Jun 2014 14:35:08 +0200 Subject: Convert GRID_DIALOG to .ui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4476559cc2e6a90b65d5bdc8169b256929f07f7e Reviewed-on: https://gerrit.libreoffice.org/9734 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- extensions/AllLangResTarget_scn.mk | 4 -- extensions/UIConfig_scanner.mk | 1 + extensions/source/scanner/grid.cxx | 48 +++++++------- extensions/source/scanner/grid.hrc | 36 ----------- extensions/source/scanner/grid.hxx | 18 ++++-- extensions/source/scanner/grid.src | 79 ----------------------- extensions/uiconfig/scanner/ui/griddialog.ui | 95 ++++++++++++++++++++++++++++ 7 files changed, 132 insertions(+), 149 deletions(-) delete mode 100644 extensions/source/scanner/grid.hrc delete mode 100644 extensions/source/scanner/grid.src create mode 100644 extensions/uiconfig/scanner/ui/griddialog.ui (limited to 'extensions') diff --git a/extensions/AllLangResTarget_scn.mk b/extensions/AllLangResTarget_scn.mk index 56dbe69d49cd..10ee455f85d0 100644 --- a/extensions/AllLangResTarget_scn.mk +++ b/extensions/AllLangResTarget_scn.mk @@ -24,8 +24,4 @@ $(eval $(call gb_SrsTarget_set_include,scn/res,\ -I$(SRCDIR)/extensions/source/scanner \ )) -$(eval $(call gb_SrsTarget_add_files,scn/res,\ - extensions/source/scanner/grid.src \ -)) - # vim:set noet sw=4 ts=4: diff --git a/extensions/UIConfig_scanner.mk b/extensions/UIConfig_scanner.mk index 21d14c431b79..15ce9a4be4fc 100644 --- a/extensions/UIConfig_scanner.mk +++ b/extensions/UIConfig_scanner.mk @@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,modules/scanner)) $(eval $(call gb_UIConfig_add_uifiles,modules/scanner,\ extensions/uiconfig/scanner/ui/sanedialog \ + extensions/uiconfig/scanner/ui/griddialog \ )) # vim: set noet sw=4 ts=4: diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index c3f02d39023a..5266919fbbf5 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -49,7 +48,7 @@ ResId SaneResId( sal_uInt32 nID ) GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* pParent, bool bCutValues ) -: ModalDialog( pParent, SaneResId( GRID_DIALOG ) ), +: ModalDialog( pParent, "GridDialog", "modules/scanner/ui/griddialog.ui" ), m_aGridArea( 50, 15, 100, 100 ), m_pXValues( pXValues ), m_pOrigYValues( pYValues ), @@ -58,31 +57,30 @@ GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* m_bCutValues( bCutValues ), m_aHandles(), m_nDragIndex( 0xffffffff ), - m_aMarkerBitmap( Bitmap( SaneResId( GRID_DIALOG_HANDLE_BMP ) ), Color( 255, 255, 255 ) ), - m_aOKButton( this, SaneResId( GRID_DIALOG_OK_BTN ) ), - m_aCancelButton( this, SaneResId( GRID_DIALOG_CANCEL_BTN ) ), - m_aResetTypeBox( this, SaneResId( GRID_DIALOG_TYPE_BOX ) ), - m_aResetButton( this, SaneResId( GRID_DIALOG_RESET_BTN ) ) + m_aMarkerBitmap( FixedImage::loadThemeImage("extensions/source/scanner/handle.png").GetBitmapEx() ) { - sal_uInt16 nPos = m_aResetTypeBox.InsertEntry( SaneResId( RESET_TYPE_LINEAR_ASCENDING ).toString() ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_ASCENDING ); + get(m_pOKButton, "ok"); + get(m_pResetTypeBox, "resetTypeCombobox"); + get(m_pResetButton, "resetButton"); + sal_uInt16 nPos = m_pResetTypeBox->InsertEntry( "Linear ascending" ); + m_pResetTypeBox->SetEntryData( nPos, (void *)LINEAR_ASCENDING ); - nPos = m_aResetTypeBox.InsertEntry( SaneResId( RESET_TYPE_LINEAR_DESCENDING ).toString() ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_DESCENDING ); + nPos = m_pResetTypeBox->InsertEntry( "Linear descending" ); + m_pResetTypeBox->SetEntryData( nPos, (void *)LINEAR_DESCENDING ); - nPos = m_aResetTypeBox.InsertEntry( SaneResId( RESET_TYPE_RESET ).toString() ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_RESET ); + nPos = m_pResetTypeBox->InsertEntry( "Original values" ); + m_pResetTypeBox->SetEntryData( nPos, (void *)RESET ); - nPos = m_aResetTypeBox.InsertEntry( SaneResId( RESET_TYPE_EXPONENTIAL ).toString() ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_EXPONENTIAL ); + nPos = m_pResetTypeBox->InsertEntry( "Exponential increasing" ); + m_pResetTypeBox->SetEntryData( nPos, (void *)EXPONENTIAL ); - m_aResetTypeBox.SelectEntryPos( 0 ); + m_pResetTypeBox->SelectEntryPos( 0 ); - m_aResetButton.SetClickHdl( LINK( this, GridWindow, ClickButtonHdl ) ); + m_pResetButton->SetClickHdl( LINK( this, GridWindow, ClickButtonHdl ) ); SetMapMode( MapMode( MAP_PIXEL ) ); Size aSize = GetOutputSizePixel(); - Size aBtnSize = m_aOKButton.GetOutputSizePixel(); + Size aBtnSize = m_pOKButton->GetOutputSizePixel(); m_aGridArea.setWidth( aSize.Width() - aBtnSize.Width() - 80 ); m_aGridArea.setHeight( aSize.Height() - 40 ); @@ -100,8 +98,6 @@ GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* m_BmOffY = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Height() >> 1); m_aHandles.push_back(impHandle(transform(findMinX(), findMinY()), m_BmOffX, m_BmOffY)); m_aHandles.push_back(impHandle(transform(findMaxX(), findMaxY()), m_BmOffX, m_BmOffY)); - - FreeResource(); } GridWindow::~GridWindow() @@ -528,12 +524,12 @@ void GridWindow::MouseButtonDown( const MouseEvent& rEvt ) IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton ) { - if( pButton == &m_aResetButton ) + if( pButton == m_pResetButton ) { - int nType = (int)(sal_IntPtr)m_aResetTypeBox.GetEntryData( m_aResetTypeBox.GetSelectEntryPos() ); + int nType = (int)(sal_IntPtr)m_pResetTypeBox->GetEntryData( m_pResetTypeBox->GetSelectEntryPos() ); switch( nType ) { - case RESET_TYPE_LINEAR_ASCENDING: + case LINEAR_ASCENDING: { for( int i = 0; i < m_nValues; i++ ) { @@ -541,7 +537,7 @@ IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton ) } } break; - case RESET_TYPE_LINEAR_DESCENDING: + case LINEAR_DESCENDING: { for( int i = 0; i < m_nValues; i++ ) { @@ -549,13 +545,13 @@ IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton ) } } break; - case RESET_TYPE_RESET: + case RESET: { if( m_pOrigYValues && m_pNewYValues && m_nValues ) memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) ); } break; - case RESET_TYPE_EXPONENTIAL: + case EXPONENTIAL: { for( int i = 0; i < m_nValues; i++ ) { diff --git a/extensions/source/scanner/grid.hrc b/extensions/source/scanner/grid.hrc deleted file mode 100644 index a9aefa883b36..000000000000 --- a/extensions/source/scanner/grid.hrc +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GRID_HRC -#define GRID_HRC - -#define GRID_DIALOG 1100 -#define GRID_DIALOG_OK_BTN 1 -#define GRID_DIALOG_CANCEL_BTN 2 -#define GRID_DIALOG_RESET_BTN 3 -#define GRID_DIALOG_TYPE_BOX 4 -#define GRID_DIALOG_HANDLE_BMP 5 - -#define RESET_TYPE_LINEAR_ASCENDING 10 -#define RESET_TYPE_LINEAR_DESCENDING 11 -#define RESET_TYPE_RESET 12 -#define RESET_TYPE_EXPONENTIAL 13 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx index 5f738f0f5298..04346ba1b52d 100644 --- a/extensions/source/scanner/grid.hxx +++ b/extensions/source/scanner/grid.hxx @@ -23,6 +23,7 @@ #include #include #include +#include class GridWindow : public ModalDialog { @@ -57,6 +58,14 @@ class GridWindow : public ModalDialog } }; + enum resetType + { + LINEAR_ASCENDING = 10, + LINEAR_DESCENDING, + RESET, + EXPONENTIAL + }; + Rectangle m_aGridArea; double m_fMinX; @@ -85,11 +94,10 @@ class GridWindow : public ModalDialog BitmapEx m_aMarkerBitmap; - OKButton m_aOKButton; - CancelButton m_aCancelButton; + OKButton* m_pOKButton; - ListBox m_aResetTypeBox; - PushButton m_aResetButton; + ListBox* m_pResetTypeBox; + PushButton* m_pResetButton; Point transform( double x, double y ); @@ -100,6 +108,8 @@ class GridWindow : public ModalDialog double findMaxX(); double findMaxY(); + void updateRectSize(); + void drawGrid(); void drawOriginal(); void drawNew(); diff --git a/extensions/source/scanner/grid.src b/extensions/source/scanner/grid.src deleted file mode 100644 index 1f275aacb0c1..000000000000 --- a/extensions/source/scanner/grid.src +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include - -ModalDialog GRID_DIALOG -{ - HelpID = "extensions:ModalDialog:GRID_DIALOG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 10 , 10 ) ; - Size = MAP_APPFONT ( 300, 200 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - OKButton GRID_DIALOG_OK_BTN - { - Pos = MAP_APPFONT( 245, 5 ); - Size = MAP_APPFONT( 50, 15 ); - DefButton = TRUE; - }; - CancelButton GRID_DIALOG_CANCEL_BTN - { - Pos = MAP_APPFONT ( 245 , 25 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - ListBox GRID_DIALOG_TYPE_BOX - { - HelpID = "extensions:ListBox:GRID_DIALOG:GRID_DIALOG_TYPE_BOX"; - Border = TRUE ; - Dropdown = TRUE ; - Pos = MAP_APPFONT( 245, 45 ); - Size = MAP_APPFONT( 50, 130 ); - }; - PushButton GRID_DIALOG_RESET_BTN - { - HelpID = "extensions:PushButton:GRID_DIALOG:GRID_DIALOG_RESET_BTN"; - Pos = MAP_APPFONT( 245, 65 ); - Size = MAP_APPFONT( 50, 15 ); - Text [ en-US ] = "Set"; - }; - Bitmap GRID_DIALOG_HANDLE_BMP - { - File = "handle.bmp"; - }; - String RESET_TYPE_LINEAR_ASCENDING - { - Text [ en-US ] = "Linear ascending"; - }; - String RESET_TYPE_LINEAR_DESCENDING - { - Text [ en-US ] = "Linear descending"; - }; - String RESET_TYPE_RESET - { - Text [ en-US ] = "Original values"; - }; - String RESET_TYPE_EXPONENTIAL - { - Text [ en-US ] = "Exponential increasing"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/uiconfig/scanner/ui/griddialog.ui b/extensions/uiconfig/scanner/ui/griddialog.ui new file mode 100644 index 000000000000..1d95b3cd917b --- /dev/null +++ b/extensions/uiconfig/scanner/ui/griddialog.ui @@ -0,0 +1,95 @@ + + + + + False + 6 + dialog + + + False + 12 + + + False + vertical + start + + + gtk-ok + False + True + True + True + False + True + + + False + True + 0 + + + + + gtk-cancel + False + True + True + True + False + True + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + _Set + False + True + True + True + False + True + + + False + True + 3 + + + + + False + True + end + 0 + + + + + + + + + ok + cancel + resetButton + + + -- cgit