You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
4.5 KiB
150 lines
4.5 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2001,2002,2003,2004 Laurent Montel <montel@kde.org>
|
||
|
|
||
|
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"
|
||
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <kcolorbutton.h>
|
||
|
#include <kdebug.h>
|
||
|
|
||
14 years ago
|
#include <tqhbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#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>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdefontdialog.h>
|
||
15 years ago
|
|
||
|
// For IRIX
|
||
|
namespace std {}
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
#include "kchart_params.h"
|
||
|
#include "kchart_part.h"
|
||
|
|
||
|
namespace KChart
|
||
|
{
|
||
|
|
||
|
KChartDataConfigPage::KChartDataConfigPage( KChartParams* params,
|
||
14 years ago
|
TQWidget* parent,
|
||
15 years ago
|
KDChartTableData *dat)
|
||
14 years ago
|
: TQWidget( parent ), m_params( params ), data(dat),
|
||
15 years ago
|
m_firstRowAsLabel(0), m_firstColAsLabel(0)
|
||
|
{
|
||
14 years ago
|
TQGridLayout *grid1 = new TQGridLayout(this, 4, 1, KDialog::marginHint(),
|
||
15 years ago
|
KDialog::spacingHint());
|
||
|
|
||
|
// The Data Area
|
||
|
if ( !m_params->part()->canChangeValue() ) {
|
||
14 years ago
|
TQButtonGroup *gb1 = new TQVButtonGroup( i18n( "Data Area" ), this );
|
||
15 years ago
|
|
||
|
// ================================================================
|
||
4 years ago
|
// This code is copied from kchartWizardSelectDataFormatPage.cpp
|
||
14 years ago
|
TQHBox *hbox = new TQHBox( gb1 );
|
||
|
(void) new TQLabel( i18n("Area: "), hbox);
|
||
|
m_dataArea = new TQLineEdit( hbox );
|
||
15 years ago
|
|
||
|
// The row/column as label checkboxes.
|
||
14 years ago
|
m_firstRowAsLabel = new TQCheckBox( i18n( "First row as label" ), gb1);
|
||
|
m_firstColAsLabel = new TQCheckBox( i18n( "First column as label" ), gb1);
|
||
15 years ago
|
|
||
|
grid1->addWidget(gb1, 0, 0);
|
||
|
}
|
||
|
|
||
|
// The Data Format button group
|
||
14 years ago
|
TQButtonGroup *gb = new TQVButtonGroup( i18n( "Data Format" ), this );
|
||
15 years ago
|
|
||
14 years ago
|
m_rowMajor = new TQRadioButton( i18n( "Data in rows" ), gb );
|
||
13 years ago
|
m_rowMajor->resize( m_rowMajor->sizeHint() );
|
||
15 years ago
|
|
||
14 years ago
|
m_colMajor = new TQRadioButton( i18n( "Data in columns" ), gb );
|
||
13 years ago
|
m_colMajor->resize( m_colMajor->sizeHint() );
|
||
15 years ago
|
|
||
|
grid1->addWidget(gb, 2, 0);
|
||
|
|
||
14 years ago
|
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."));
|
||
15 years ago
|
|
||
14 years ago
|
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."));
|
||
13 years ago
|
m_colMajor->resize( m_colMajor->sizeHint() );
|
||
15 years ago
|
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
|