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
|
/* This file is part of the KDE project
Copyright (C) 2001,2002,2003,2004 Laurent Montel <[email protected]>
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 "kchartDataConfigPage.h"
#include "kchartDataConfigPage.moc"
#include <kapplication.h>
#include <klocale.h>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <tqhbox.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqlistbox.h>
#include <tqbuttongroup.h>
#include <tqvbuttongroup.h>
#include <tqpushbutton.h>
#include <tqradiobutton.h>
#include <tqcheckbox.h>
#include <tqpainter.h>
#include <tqwhatsthis.h>
#include <kfontdialog.h>
// For IRIX
namespace std {}
using namespace std;
#include "kchart_params.h"
#include "kchart_part.h"
namespace KChart
{
KChartDataConfigPage::KChartDataConfigPage( KChartParams* params,
TQWidget* parent,
KDChartTableData *dat)
: TQWidget( parent ), m_params( params ), data(dat),
m_firstRowAsLabel(0), m_firstColAsLabel(0)
{
TQGridLayout *grid1 = new TQGridLayout(this, 4, 1, KDialog::marginHint(),
KDialog::spacingHint());
// The Data Area
if ( !m_params->part()->canChangeValue() ) {
TQButtonGroup *gb1 = new TQVButtonGroup( i18n( "Data Area" ), this );
// ================================================================
// This code is copied from kchartWizardSelectDataFormatPage.cc
TQHBox *hbox = new TQHBox( gb1 );
(void) new TQLabel( i18n("Area: "), hbox);
m_dataArea = new TQLineEdit( hbox );
// The row/column as label checkboxes.
m_firstRowAsLabel = new TQCheckBox( i18n( "First row as label" ), gb1);
m_firstColAsLabel = new TQCheckBox( i18n( "First column as label" ), gb1);
grid1->addWidget(gb1, 0, 0);
}
// The Data Format button group
TQButtonGroup *gb = new TQVButtonGroup( i18n( "Data Format" ), this );
m_rowMajor = new TQRadioButton( i18n( "Data in rows" ), gb );
m_rowMajor->resize( m_rowMajor->sizeHint() );
m_colMajor = new TQRadioButton( i18n( "Data in columns" ), gb );
m_colMajor->resize( m_colMajor->sizeHint() );
grid1->addWidget(gb, 2, 0);
TQWhatsThis::add(this, i18n("This configuration page can be used to swap the interpretation of rows and columns."));
TQWhatsThis::add(m_rowMajor, i18n("By default one row is considered to be a data set and each column holds the individual values of the data series. This sets the data in rows on your chart."));
TQWhatsThis::add(m_colMajor, i18n("Here you can choose to have each column hold one data set. Note that the values are not really swapped but only their interpretation."));
m_colMajor->resize( m_colMajor->sizeHint() );
grid1->addWidget(gb, 1, 0);
grid1->setColStretch(3, 0);
grid1->activate();
}
void KChartDataConfigPage::init()
{
if (m_params->dataDirection() == KChartParams::DataRows)
m_rowMajor->setChecked(true);
else
m_colMajor->setChecked(true);
if ( !m_params->part()->canChangeValue() ) {
m_firstRowAsLabel->setChecked( m_params->firstRowAsLabel() );
m_firstColAsLabel->setChecked( m_params->firstColAsLabel() );
m_dataArea->setText( m_params->dataArea() );
}
}
void KChartDataConfigPage::defaults()
{
m_colMajor->setChecked( true );
if ( !m_params->part()->canChangeValue() ) {
m_firstRowAsLabel->setChecked( false );
m_firstColAsLabel->setChecked( false );
m_dataArea->setText( "" );
}
}
void KChartDataConfigPage::apply()
{
if (m_rowMajor->isChecked())
m_params->setDataDirection( KChartParams::DataRows );
else
m_params->setDataDirection( KChartParams::DataColumns );
if ( !m_params->part()->canChangeValue() ) {
m_params->setFirstRowAsLabel( m_firstRowAsLabel->isChecked() );
m_params->setFirstColAsLabel( m_firstColAsLabel->isChecked() );
m_params->setDataArea( m_dataArea->text() );
}
}
} //KChart namespace
|