Kaydet (Commit) 3137acbe authored tarafından Palenik Mihály's avatar Palenik Mihály Kaydeden (comit) Caolán McNamara

Convert GRID_DIALOG to .ui

Change-Id: I4476559cc2e6a90b65d5bdc8169b256929f07f7e
Reviewed-on: https://gerrit.libreoffice.org/9734Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3c446cd0
......@@ -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:
......@@ -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:
......@@ -19,7 +19,6 @@
#include <sal/config.h>
#include <osl/thread.h>
#include <grid.hrc>
#include <cstdio>
#include <math.h>
......@@ -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++ )
{
......
/* -*- 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: */
......@@ -23,6 +23,7 @@
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
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();
......
/* -*- 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 <grid.hrc>
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: */
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="GridDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="resetTypeCombobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="resetButton">
<property name="label" translatable="yes">_Set</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">resetButton</action-widget>
</action-widgets>
</object>
</interface>
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