1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
// -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
/* This file is part of the KDE project
Copyright (C) 2002 Montel Laurent <lmontel@mandrakesoft.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <tdelocale.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <knuminput.h>
#include <tqbuttongroup.h>
#include <tqradiobutton.h>
#include <KoUnit.h>
#include <klineedit.h>
#include <knumvalidator.h>
#include <KoUnitWidgets.h>
#include "KPrMoveHelpLineDia.h"
#include "KPrDocument.h"
KPrMoveHelpLineDia::KPrMoveHelpLineDia( TQWidget *parent, double value, double limitTop, double limitBottom,
KPrDocument *_doc, const char *name)
: KDialogBase( parent, name , true, "", Ok | Cancel | User1, Ok, true )
{
m_doc=_doc;
m_bRemoveLine = false;
setButtonText( KDialogBase::User1, i18n("Remove") );
setCaption( i18n("Change Help Line Position") );
TQVBox *page = makeVBoxMainWidget();
new TQLabel(i18n("Position:"), page);
position= new KoUnitDoubleSpinBox( page, TQMAX(0.00, limitTop), TQMAX(0.00, limitBottom), 1, TQMAX(0.00, value));
position->setUnit(m_doc->unit() );
connect( this, TQT_SIGNAL( user1Clicked() ), this ,TQT_SLOT( slotRemoveHelpLine() ));
resize( 300,100 );
}
void KPrMoveHelpLineDia::slotRemoveHelpLine()
{
m_bRemoveLine = true;
KDialogBase::slotOk();
}
double KPrMoveHelpLineDia::newPosition() const
{
return position->value();
}
KPrInsertHelpLineDia::KPrInsertHelpLineDia( TQWidget *parent, const KoRect & _pageRect,
KPrDocument *_doc, const char *name)
: KDialogBase( parent, name , true, "", Ok|Cancel, Ok, true )
{
limitOfPage=_pageRect;
m_doc=_doc;
setCaption( i18n("Add New Help Line") );
TQVBox *page = makeVBoxMainWidget();
TQButtonGroup *group = new TQButtonGroup( 1, Qt::Horizontal,i18n("Orientation"), page );
group->setRadioButtonExclusive( TRUE );
group->layout();
m_rbHoriz = new TQRadioButton( i18n("Horizontal"), group );
m_rbVert = new TQRadioButton( i18n("Vertical"), group );
connect( group , TQT_SIGNAL( clicked( int) ), this, TQT_SLOT( slotRadioButtonClicked() ));
new TQLabel(i18n("Position:"), page);
position= new KoUnitDoubleSpinBox( page,TQMAX(0.00, limitOfPage.top() ), TQMAX(0.00, limitOfPage.bottom()),1,0.00 );
position->setUnit( m_doc->unit() );
m_rbHoriz->setChecked( true );
resize( 300,100 );
}
double KPrInsertHelpLineDia::newPosition() const
{
return position->value();
}
bool KPrInsertHelpLineDia::addHorizontalHelpLine()
{
return m_rbHoriz->isChecked();
}
void KPrInsertHelpLineDia::slotRadioButtonClicked()
{
if ( m_rbHoriz->isChecked() )
{
position->setMinValue( TQMAX(0.00, limitOfPage.top() ) );
position->setMaxValue( TQMAX(0.00, limitOfPage.bottom() ) );
}
else if ( m_rbVert->isChecked() )
{
position->setMinValue( TQMAX(0.00, limitOfPage.left()) );
position->setMaxValue( TQMAX(0.00, limitOfPage.right()) );
}
}
KPrInsertHelpPointDia::KPrInsertHelpPointDia( TQWidget *parent, const KoRect & _pageRect,
KPrDocument *_doc, double posX, double posY, const char *name)
: KDialogBase( parent, name , true, "", Ok|Cancel| User1, Ok, true ),
m_bRemovePoint( false )
{
limitOfPage=_pageRect;
m_doc=_doc;
setButtonText( KDialogBase::User1, i18n("Remove") );
setCaption( i18n("Add New Help Point") );
TQVBox *page = makeVBoxMainWidget();
TQLabel *lab=new TQLabel(i18n("X position:"), page);
positionX= new KoUnitDoubleSpinBox( page, TQMAX(0.00, limitOfPage.left()),TQMAX(0.00, limitOfPage.right()),1,TQMAX(0.00, posX) ) ;
positionX->setUnit( m_doc->unit() );
lab=new TQLabel(i18n("Y position:"), page);
positionY= new KoUnitDoubleSpinBox( page, TQMAX(0.00, limitOfPage.top()),TQMAX(0.00, limitOfPage.bottom()),1, TQMAX(0.00, posY) );
positionY->setUnit( m_doc->unit() );
showButton( KDialogBase::User1, (posX!=0.0 || posY!=0.0) );
connect( this, TQT_SIGNAL( user1Clicked() ), this ,TQT_SLOT( slotRemoveHelpPoint() ));
resize( 300,100 );
}
KoPoint KPrInsertHelpPointDia::newPosition() const
{
return KoPoint( positionX->value(),
positionY->value() );
}
void KPrInsertHelpPointDia::slotRemoveHelpPoint()
{
m_bRemovePoint = true;
KDialogBase::slotOk();
}
#include "KPrMoveHelpLineDia.moc"
|