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.
302 lines
10 KiB
302 lines
10 KiB
15 years ago
|
#include "kchartWizardSetupAxesPage.h"
|
||
|
#include "kchart_view.h"
|
||
|
#include "kchart_part.h"
|
||
|
|
||
14 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqframe.h>
|
||
|
#include <tqlineedit.h>
|
||
|
#include <tqcheckbox.h>
|
||
|
#include <tqgroupbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
12 years ago
|
#include <tdefontdialog.h>
|
||
15 years ago
|
#include <knumvalidator.h>
|
||
|
#include <math.h>
|
||
|
#include <float.h>
|
||
|
|
||
|
|
||
14 years ago
|
#include <tqspinbox.h>
|
||
|
#include <tqpushbutton.h>
|
||
|
#include <tqcolor.h>
|
||
15 years ago
|
|
||
|
#include "kchart_params.h"
|
||
|
|
||
|
namespace KChart
|
||
|
{
|
||
|
|
||
13 years ago
|
KChartWizardSetupAxesPage::KChartWizardSetupAxesPage( TQWidget* parent,
|
||
15 years ago
|
KChartPart* chart ) :
|
||
13 years ago
|
TQWidget( parent ),
|
||
15 years ago
|
_chart( chart )
|
||
|
{
|
||
|
chart3d=true;
|
||
|
|
||
14 years ago
|
TQGridLayout *grid1 = new TQGridLayout(this,2,2,KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
14 years ago
|
TQGroupBox* tmpTQGroupBox;
|
||
|
tmpTQGroupBox = new TQGroupBox( this, "GroupBox_1" );
|
||
|
tmpTQGroupBox->setFrameStyle( 49 );
|
||
15 years ago
|
|
||
14 years ago
|
TQGridLayout *grid2 = new TQGridLayout(tmpTQGroupBox,3,2,KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
|
|
||
14 years ago
|
//grid = new TQCheckBox( i18n( "Has grid:" ), tmpTQGroupBox );
|
||
|
new TQLabel( i18n( "Grid Lines" ), tmpTQGroupBox );
|
||
|
gridX = new TQCheckBox( i18n( "X axis:" ), tmpTQGroupBox );
|
||
|
gridY = new TQCheckBox( i18n( "Y axis:" ), tmpTQGroupBox );
|
||
15 years ago
|
|
||
|
gridX->setChecked(_chart->params()->showGrid());
|
||
|
gridY->setChecked(_chart->params()->showGrid());
|
||
|
grid2->addWidget(gridX, 0, 0);
|
||
|
grid2->addWidget(gridY, 1, 0);
|
||
|
|
||
14 years ago
|
gridColor=new KColorButton(tmpTQGroupBox);
|
||
15 years ago
|
// PENDING(kalle) Put back in
|
||
|
// colorGrid=_chart->params()->GridColor;
|
||
|
gridColor->setColor( colorGrid );
|
||
|
grid2->addWidget(gridColor, 0, 1);
|
||
|
|
||
14 years ago
|
border = new TQCheckBox( i18n( "Border:" ), tmpTQGroupBox );
|
||
15 years ago
|
// PENDING(kalle) Put back in
|
||
|
// border->setChecked( _chart->params()->border );
|
||
|
grid2->addWidget(border, 2, 0);
|
||
|
border->setEnabled(false);
|
||
|
|
||
14 years ago
|
borderColor=new KColorButton(tmpTQGroupBox);
|
||
15 years ago
|
// PENDING(kalle) Put back in
|
||
|
// colorBorder=_chart->params()->LineColor;
|
||
|
borderColor->setColor( colorBorder );
|
||
|
grid2->addWidget(borderColor,2,1);
|
||
|
borderColor->setEnabled(false);
|
||
|
|
||
14 years ago
|
grid1->addWidget(tmpTQGroupBox,0,0);
|
||
15 years ago
|
|
||
|
|
||
14 years ago
|
tmpTQGroupBox = new TQGroupBox( this, "GroupBox_2" );
|
||
|
tmpTQGroupBox->setFrameStyle( 49 );
|
||
15 years ago
|
|
||
14 years ago
|
grid2 = new TQGridLayout(tmpTQGroupBox,3,2,KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
14 years ago
|
TQLabel *tmpLabel;
|
||
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Angle 3D:"));
|
||
|
grid2->addWidget(tmpLabel,0,0);
|
||
14 years ago
|
angle = new TQSpinBox(1, 90, 1,tmpTQGroupBox );
|
||
15 years ago
|
angle->setValue( _chart->params()->threeDBarAngle() );
|
||
|
grid2->addWidget(angle,0,1);
|
||
|
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Depth 3D:"));
|
||
|
grid2->addWidget(tmpLabel,1,0);
|
||
14 years ago
|
depth = new TQSpinBox(1, 40, 1, tmpTQGroupBox);
|
||
15 years ago
|
depth->setValue( static_cast<int>( _chart->params()->threeDBarDepth() ) );
|
||
|
grid2->addWidget(depth,1,1);
|
||
|
|
||
|
// Bar width is computed automatically in KDChart (and can be
|
||
|
// changed via gaps)
|
||
14 years ago
|
// tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
// tmpLabel->setText(i18n("Bar width:"));
|
||
|
// grid2->addWidget(tmpLabel,2,0);
|
||
14 years ago
|
// barWidth = new TQSpinBox(1, 200, 1, tmpTQGroupBox);
|
||
15 years ago
|
// barWidth->setValue(_chart->params()->bar_width);
|
||
|
// grid2->addWidget(barWidth,2,1);
|
||
|
|
||
14 years ago
|
grid1->addWidget(tmpTQGroupBox,0,1);
|
||
15 years ago
|
|
||
14 years ago
|
tmpTQGroupBox = new TQGroupBox( this, "GroupBox_3" );
|
||
|
tmpTQGroupBox->setFrameStyle( 49 );
|
||
15 years ago
|
|
||
14 years ago
|
grid2 = new TQGridLayout(tmpTQGroupBox,3,2,KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Y interval:"));
|
||
|
grid2->addWidget(tmpLabel,0,0);
|
||
|
|
||
14 years ago
|
TQString tmp;
|
||
|
y_interval=new TQLineEdit(tmpTQGroupBox);
|
||
15 years ago
|
y_interval->setValidator(new KFloatValidator( y_interval));
|
||
|
grid2->addWidget(y_interval,0,1);
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if( _chart->params()->requested_yinterval != -DBL_MAX)
|
||
|
// y_interval->setText( tmp.setNum(_chart->params()->requested_yinterval));
|
||
|
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Y min:"));
|
||
|
grid2->addWidget(tmpLabel,1,0);
|
||
14 years ago
|
y_min=new TQLineEdit(tmpTQGroupBox);
|
||
15 years ago
|
y_min->setValidator(new KFloatValidator( y_min));
|
||
|
grid2->addWidget(y_min,1,1);
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if( _chart->params()->requested_ymin != DBL_MAX)
|
||
|
// y_min->setText( tmp.setNum(_chart->params()->requested_ymin));
|
||
|
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Y max:"));
|
||
|
grid2->addWidget(tmpLabel,2,0);
|
||
14 years ago
|
y_max=new TQLineEdit(tmpTQGroupBox);
|
||
15 years ago
|
y_max->setValidator(new KFloatValidator( y_max));
|
||
|
grid2->addWidget(y_max,2,1);
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if( _chart->params()->requested_ymax != -DBL_MAX)
|
||
|
// y_max->setText( tmp.setNum(_chart->params()->requested_ymax));
|
||
|
|
||
14 years ago
|
grid1->addWidget(tmpTQGroupBox,1,0);
|
||
|
tmpTQGroupBox->setEnabled(false);
|
||
15 years ago
|
|
||
14 years ago
|
tmpTQGroupBox = new TQGroupBox( this, "GroupBox_3" );
|
||
|
tmpTQGroupBox->setFrameStyle( 49 );
|
||
15 years ago
|
|
||
14 years ago
|
grid2 = new TQGridLayout(tmpTQGroupBox,3,2,KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Y-label format:"));
|
||
|
grid2->addWidget(tmpLabel,0,0);
|
||
14 years ago
|
ylabel_fmt=new TQLineEdit(tmpTQGroupBox);
|
||
15 years ago
|
grid2->addWidget(ylabel_fmt,0,1);
|
||
|
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if( !_chart->params()->ylabel_fmt.isEmpty()) {
|
||
|
// int len=_chart->params()->ylabel_fmt.length();
|
||
|
// ylabel_fmt->setText(_chart->params()->ylabel_fmt.right(len-3));
|
||
|
// }
|
||
14 years ago
|
ylabelFont = new TQPushButton( tmpTQGroupBox);
|
||
15 years ago
|
grid2->addWidget(ylabelFont,1,0);
|
||
|
ylabelFont->setText(i18n("Font..."));
|
||
|
// PENDING(kalle) Put back in
|
||
|
// ylabel=_chart->params()->yAxisFont();
|
||
|
|
||
14 years ago
|
ylabelColor=new KColorButton(tmpTQGroupBox);
|
||
15 years ago
|
grid2->addWidget(ylabelColor,1,1);
|
||
|
// PENDING(kalle) Put back in
|
||
|
// ycolor=_chart->params()->YLabelColor;
|
||
|
ylabelColor->setColor( ycolor );
|
||
|
|
||
|
#if 0
|
||
14 years ago
|
tmpLabel=new TQLabel(tmpTQGroupBox);
|
||
15 years ago
|
tmpLabel->setText(i18n("Y-label 2 format:"));
|
||
|
grid2->addWidget(tmpLabel,2,0);
|
||
|
|
||
14 years ago
|
ylabel2_fmt=new TQLineEdit(tmpTQGroupBox);
|
||
15 years ago
|
grid2->addWidget(ylabel2_fmt,2,1);
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if( !_chart->params()->ylabel2_fmt.isEmpty()) {
|
||
|
// int len=_chart->params()->ylabel2_fmt.length();
|
||
|
// ylabel2_fmt->setText(_chart->params()->ylabel2_fmt.right(len-3));
|
||
|
// }
|
||
|
#endif
|
||
14 years ago
|
tmpTQGroupBox->setEnabled(false);
|
||
|
grid1->addWidget(tmpTQGroupBox,1,1);
|
||
15 years ago
|
|
||
|
|
||
|
|
||
14 years ago
|
connect(ylabelFont,TQT_SIGNAL(clicked()),this,TQT_SLOT(changeLabelFont()));
|
||
15 years ago
|
|
||
|
|
||
14 years ago
|
connect(ylabelColor,TQT_SIGNAL(changed( const TQColor & )),
|
||
|
this,TQT_SLOT(changeLabelColor(const TQColor &)));
|
||
|
connect(borderColor,TQT_SIGNAL(changed( const TQColor & )),
|
||
|
this,TQT_SLOT(changeBorderColor(const TQColor &)));
|
||
|
connect(gridColor,TQT_SIGNAL(changed( const TQColor & )),
|
||
|
this,TQT_SLOT(changeGridColor(const TQColor &)));
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
KChartWizardSetupAxesPage::~KChartWizardSetupAxesPage()
|
||
|
{
|
||
|
// _chart->removeAutoUpdate( preview );
|
||
|
}
|
||
|
|
||
14 years ago
|
void KChartWizardSetupAxesPage::changeLabelColor(const TQColor &_color)
|
||
15 years ago
|
{
|
||
|
ycolor=_color;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KChartWizardSetupAxesPage::changeBorderColor(const TQColor &_color)
|
||
15 years ago
|
{
|
||
|
colorBorder=_color;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KChartWizardSetupAxesPage::changeGridColor(const TQColor &_color)
|
||
15 years ago
|
{
|
||
|
colorGrid=_color;
|
||
|
}
|
||
|
|
||
|
void KChartWizardSetupAxesPage::changeLabelFont()
|
||
|
{
|
||
12 years ago
|
if( TDEFontDialog::getFont( ylabel,false,this ) == TQDialog::Rejected )
|
||
15 years ago
|
return;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KChartWizardSetupAxesPage::paintEvent( TQPaintEvent *)
|
||
15 years ago
|
{
|
||
|
if(chart3d) {
|
||
|
angle->setEnabled(true);
|
||
|
depth->setEnabled(true);
|
||
|
//barWidth->setEnabled(true);
|
||
|
} else {
|
||
|
angle->setEnabled(false);
|
||
|
depth->setEnabled(false);
|
||
|
//barWidth->setEnabled(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void KChartWizardSetupAxesPage::apply()
|
||
|
{
|
||
|
_chart->params()->setAxisShowGrid(KDChartAxisParams::AxisPosLeft,gridY->isChecked() );
|
||
|
_chart->params()->setAxisShowGrid(KDChartAxisParams::AxisPosBottom,gridX->isChecked() );
|
||
|
|
||
|
KDChartAxisParams leftparams;
|
||
|
leftparams = _chart->params()->axisParams( KDChartAxisParams::AxisPosLeft );
|
||
|
/* if( !y_max->text().isEmpty())
|
||
|
{
|
||
|
leftparams.setAxisAreaMode(KDChartAxisParams::AxisAreaModeMinMaxSize);
|
||
|
leftparams.setAxisAreaMax(y_max->text().toDouble());
|
||
|
}
|
||
|
else
|
||
|
leftparams.setAxisAreaMode(KDChartAxisParams::AxisAreaModeAutoSize);*/
|
||
|
//leftparams.setAxisCalcMode(KDChartAxisParams::AxisCalcLogarithmic);
|
||
|
_chart->params()->setAxisParams( KDChartAxisParams::AxisPosLeft, leftparams );
|
||
|
// PENDING(kalle) Put back in
|
||
|
// _chart->params()->grid =grid->isChecked() ;
|
||
|
// if( !y_interval->text().isEmpty())
|
||
|
// _chart->params()->requested_yinterval=y_interval->text().toDouble();
|
||
|
// else
|
||
|
// _chart->params()->requested_yinterval=0;
|
||
|
// if( !y_max->text().isEmpty())
|
||
|
// _chart->params()->requested_ymax=y_max->text().toDouble();
|
||
|
// else
|
||
|
// _chart->params()->requested_ymax=0;
|
||
|
// if( !y_min->text().isEmpty())
|
||
|
// _chart->params()->requested_ymin=y_min->text().toDouble();
|
||
|
// else
|
||
|
// _chart->params()->requested_ymin=0;
|
||
|
|
||
|
// PENDING(kalle) Put back in
|
||
|
// _chart->params()->border =border->isChecked() ;
|
||
|
|
||
|
_chart->params()->setThreeDBarAngle( angle->value() );
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if(! ylabel_fmt->text().isEmpty()) {
|
||
14 years ago
|
// TQString tmp="%g "+ylabel_fmt->text();
|
||
15 years ago
|
// _chart->params()->ylabel_fmt=tmp;
|
||
|
// } else {
|
||
|
// _chart->params()->ylabel_fmt="";
|
||
|
// }
|
||
|
// _chart->params()->setYAxisFont(ylabel);
|
||
|
// _chart->params()->YLabelColor=ycolor;
|
||
|
// _chart->params()->GridColor=colorGrid;
|
||
|
// _chart->params()->LineColor=colorBorder;
|
||
|
_chart->params()->setThreeDBarDepth( depth->value() );
|
||
|
// PENDING(kalle) Put back in
|
||
|
// if(! ylabel2_fmt->text().isEmpty()) {
|
||
14 years ago
|
// TQString tmp="%g "+ylabel2_fmt->text();
|
||
15 years ago
|
// _chart->params()->ylabel2_fmt=tmp;
|
||
|
// } else {
|
||
|
// _chart->params()->ylabel2_fmt="";
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
} //namespace KChart
|
||
|
|
||
|
#include "kchartWizardSetupAxesPage.moc"
|