Commit f3c35dff authored by Fredrik Edemar's avatar Fredrik Edemar

Every function has now an unique ID-number. This number is used instead of...

Every function has now an unique ID-number. This number is used instead of index-number (the position the function had in the two functions-arrays). As the two arrays were converted to two QValueVectors the index-number of a function would be changed when a function with a lower index-number was removed. Therefore, the ID-number is needed to addres a function.

CCMAIL:kdmoeller@foni.net
CCMAIL:bmlmessmer@web.de

svn path=/trunk/kdeedu/kmplot/; revision=347257
parent 3f05ae50
......@@ -66,16 +66,16 @@ void FktDlg::slotDelete()
if( lb_fktliste->text( num )[0] == 'x' )
{
// Delete pair of parametric function
int const i = getParamIx( lb_fktliste->text( num ) );
if ( i == -1)
int const ix = m_parser->ixValue( getParamId( lb_fktliste->text( num ) ) );
if ( ix == -1)
return;
m_parser->delfkt( i+1 );
m_parser->delfkt( i );
m_parser->delfkt( ix+1 );
m_parser->delfkt( ix );
}
else
{
// only one function to be deleted
m_parser->delfkt( getIx( lb_fktliste->text( num ) ) );
m_parser->delfkt( m_parser->ixValue(getId( lb_fktliste->text( num ))) );
}
lb_fktliste->removeItem( num );
......@@ -91,40 +91,36 @@ void FktDlg::slotEdit()
return;
}
int const num = lb_fktliste->currentItem();
int index = getIx( lb_fktliste->currentText().section( ";", 0, 0) );
int const id = getId( lb_fktliste->currentText().section( ";", 0, 0) ) ;
// find out the function type
char const prefix = m_parser->fktext[ index ].extstr.at(0).latin1();
char const prefix = m_parser->fktext[ m_parser->ixValue(id) ].extstr.at(0).latin1();
if ( prefix == 'r')
slotEditPolar( index, num );
slotEditPolar( id, num );
else if ( prefix == 'x')
slotEditParametric( index, getIx( lb_fktliste->text( num ).section( ";", 1, 1) ), num );
slotEditParametric( id, m_parser->ixValue(getId( lb_fktliste->text( num ).section( ";", 1, 1) )), num );
else
slotEditFunction( index, num );
slotEditFunction( id, num );
}
int FktDlg::getIx( const QString &f_str )
int FktDlg::getId( const QString &f_str )
{
int ix=0;
for( QValueVector<XParser::FktExt>::iterator it = m_parser->fktext.begin(); it != m_parser->fktext.end(); ++it)
{
if ( it->extstr == f_str )
return ix;
++ix;
return it->id;
}
return -1;
}
int FktDlg::getParamIx( const QString &f_str)
int FktDlg::getParamId( const QString &f_str)
{
QString const fname = f_str.section( "(", 0, 0 );
int ix=0;
for( QValueVector<Parser::Ufkt>::iterator it = m_parser->ufkt.begin(); it != m_parser->ufkt.end(); ++it)
{
if ( it->fname == fname )
return ix;
++ix;
return it->id;
}
return -1;
}
......@@ -141,43 +137,43 @@ void FktDlg::slotHasSelection()
PushButtonDel->setEnabled( has_selection );
}
void FktDlg::slotEditFunction( int index, int num )
void FktDlg::slotEditFunction( int id, int num )
{
EditFunction* editFunction = new EditFunction( m_parser, this );
if ( index==-1&&num==-1) editFunction->setCaption(i18n( "New Function Plot" ));
if ( id==-1&&num==-1) editFunction->setCaption(i18n( "New Function Plot" ));
else editFunction->setCaption(i18n( "Edit Function Plot" ));
editFunction->initDialog( index );
editFunction->initDialog( id );
if( editFunction->exec() == QDialog::Accepted )
{
if( index == -1 ) lb_fktliste->insertItem( editFunction->functionItem() ); //a new function
if( id == -1 ) lb_fktliste->insertItem( editFunction->functionItem() ); //a new function
else lb_fktliste->changeItem( editFunction->functionItem(), num ); //changed a function
changed = true;
updateView();
}
}
void FktDlg::slotEditParametric( int x_index, int y_index, int num )
void FktDlg::slotEditParametric( int x_id, int y_id, int num )
{
KEditParametric* editParametric = new KEditParametric( m_parser, this );
if ( x_index==-1&&y_index==-1&&num==-1) editParametric->setCaption(i18n( "New Parametric Plot" ));
editParametric->initDialog( x_index, y_index );
if ( x_id==-1&&y_id==-1&&num==-1) editParametric->setCaption(i18n( "New Parametric Plot" ));
editParametric->initDialog( x_id, y_id );
if( editParametric->exec() == QDialog::Accepted )
{
if( x_index == -1 ) lb_fktliste->insertItem( editParametric->functionItem() ); //a new function
if( x_id == -1 ) lb_fktliste->insertItem( editParametric->functionItem() ); //a new function
else lb_fktliste->changeItem( editParametric->functionItem(), num ); //changed a function
changed = true;
updateView();
}
}
void FktDlg::slotEditPolar( int index, int num )
void FktDlg::slotEditPolar( int id, int num )
{
KEditPolar* editPolar = new KEditPolar( m_parser, this );
if ( index==-1&&num==-1) editPolar->setCaption(i18n( "New Polar Plot" ));
editPolar->initDialog( index );
if ( id==-1&&num==-1) editPolar->setCaption(i18n( "New Polar Plot" ));
editPolar->initDialog( id );
if( editPolar->exec() == QDialog::Accepted )
{
if( index == -1 ) lb_fktliste->insertItem( editPolar->functionItem() ); //a new function
if( id == -1 ) lb_fktliste->insertItem( editPolar->functionItem() ); //a new function
else lb_fktliste->changeItem( editPolar->functionItem(), num ); //changed a function
changed = true;
updateView();
......
......@@ -71,17 +71,17 @@ protected slots:
/// @param index Function index of the parser instance.
/// @param num Listbox index
/// @see KEditFunction
void slotEditFunction( int index = -1, int num = -1 );
void slotEditFunction( int id = -1, int num = -1 );
/// Edit a parametric plot.
/// @param x_index, y_index Function index of the parser instance.
/// @param num Listbox index
/// @see KEditParametric
void slotEditParametric( int x_index = -1, int y_index = -1, int num = -1 );
void slotEditParametric( int x_id = -1, int y_id = -1, int num = -1 );
/// Edit a polar plot.
/// @param index Function index of the parser instance.
/// @param num Listbox index
/// @see KEditPolar
void slotEditPolar( int index = -1, int num = -1 );
void slotEditPolar( int id = -1, int num = -1 );
/// Edit a new function plot.
void slotNewFunction();
/// Edit a new parametric plot.
......@@ -92,10 +92,10 @@ protected slots:
void slotHelp();
private:
/// Looks up the index of \a f_str in the parser instance.
int getIx( const QString &f_str );
/// Looks up the id of \a f_str in the parser instance.
int getId( const QString &f_str );
/// Looks up the indices of the parametric pair of function.
int getParamIx( const QString &f_str );
int getParamId( const QString &f_str );
/// Update the view of the main window.
void updateView();
/// Called when the dialog is showed
......
......@@ -536,8 +536,8 @@ void MainDlg::slotQuickEdit(const QString& tmp_f_str )
KMessageBox::error( this, i18n("Parametric functions must be definied in the \"New Parametric Plot\"-dialog which you can find in the menubar"));
return;
}
int index = view->parser()->addfkt( f_str );
if (index==-1)
int const id = view->parser()->addfkt( f_str );
if (id==-1)
{
view->parser()->errmsg();
m_quickEdit->setFocus();
......@@ -549,20 +549,21 @@ void MainDlg::slotQuickEdit(const QString& tmp_f_str )
KMessageBox::error( this, i18n( "Recursive function is not allowed"));
m_quickEdit->setFocus();
m_quickEdit->selectAll();
view->parser()->delfkt( index );
view->parser()->delfkt( view->parser()->ixValue(id) );
return;
}
XParser::FktExt fktext;
view->parser()->prepareAddingFktExtFunction(fktext);
fktext.extstr = f_str;
fktext.id = id;
view->parser()->fktext.append(fktext );
if ( view->parser()->getext( index ) == -1)
if ( view->parser()->getext( &fktext ) == -1)
{
m_quickEdit->setFocus();
m_quickEdit->selectAll();
view->parser()->delfkt( index );
view->parser()->delfkt( view->parser()->ixValue(id) );
}
m_quickEdit->clear();
m_modified = true;
......
This diff is collapsed.
......@@ -83,11 +83,11 @@ public:
/// @see getSettings
void init();
/// Finding the minimum or maximum value
void findMinMaxValue(int, char, bool, double &, double &,QString &);
void findMinMaxValue(XParser::FktExt *, char, bool, double &, double &,QString &);
/// get a y-value from a x-value
void getYValue(int, char, double , double &,QString &);
void getYValue(XParser::FktExt *, char, double , double &,QString &);
/// draw and calculate the area between the graph and the x-axis.
void areaUnderGraph(int const, char const, double &, double &, QString &, QPainter* );
void areaUnderGraph(XParser::FktExt *, char const, double &, double &, QString &, QPainter* );
/// the calculation was cancelled by the user
bool isCalculationStopped();
......@@ -110,7 +110,7 @@ public:
/// for areadrawing when printing
bool areaDraw;
int areaIx;
XParser::FktExt * areaFktext;
char areaPMode;
double areaMin, areaMax;
QString areaParameter;
......@@ -156,7 +156,7 @@ private:
/// Only for printing.
void drawHeaderTable(QPainter *);
/// Draw the function plots.
void plotfkt(int, QPainter*);
void plotfkt(QValueVector<XParser::FktExt>::iterator, QPainter*);
/// Gets the greek pi symbol.
void setpi(QString *);
/// in trace mode checks, if the function is (near by) zero
......
......@@ -73,10 +73,10 @@ EditFunction::EditFunction( XParser* parser, QWidget* parent, const char* name )
connect( editfunctionpage->useNoParameter, SIGNAL ( toggled(bool) ), this, SLOT( noParameter_clicked(bool) ) );
}
void EditFunction::initDialog( int index )
void EditFunction::initDialog( int id )
{
m_index = index;
if( m_index == -1 ) clearWidgets(); //new function, so clear all values
m_id = id;
if( m_id == -1 ) clearWidgets(); //new function, so clear all values
else setWidgets();
editfunctionpage->equation->setFocus();
}
......@@ -110,47 +110,47 @@ void EditFunction::clearWidgets()
void EditFunction::setWidgets()
{
editfunctionpage->equation->setText( m_parser->fktext[ m_index ].extstr );
editfunctionpage->hide->setChecked( m_parser->fktext[ m_index ].f_mode == 0 );
editfunctionpage->lineWidth->setValue( m_parser->fktext[ m_index ].linewidth );
editfunctionpage->color->setColor( m_parser->fktext[ m_index ].color );
if ( m_parser->fktext[ m_index ].dmin != m_parser->fktext[ m_index ].dmax )
editfunctionpage->equation->setText( m_parser->fktext[ m_id ].extstr );
editfunctionpage->hide->setChecked( m_parser->fktext[ m_id ].f_mode == 0 );
editfunctionpage->lineWidth->setValue( m_parser->fktext[ m_id ].linewidth );
editfunctionpage->color->setColor( m_parser->fktext[ m_id ].color );
if ( m_parser->fktext[ m_id ].dmin != m_parser->fktext[ m_id ].dmax )
{
editfunctionpage->customRange->setChecked(true);
editfunctionpage->min->setText( m_parser->fktext[ m_index ].str_dmin );
editfunctionpage->max->setText( m_parser->fktext[ m_index ].str_dmax );
editfunctionpage->min->setText( m_parser->fktext[ m_id ].str_dmin );
editfunctionpage->max->setText( m_parser->fktext[ m_id ].str_dmax );
}
else
editfunctionpage->customRange->setChecked(false);
m_parameter = m_parser->fktext[ m_index ].str_parameter;
if( m_parser->fktext[ m_index ].use_slider == -1 )
if ( m_parser->fktext[ m_index ].k_liste.isEmpty() )
m_parameter = m_parser->fktext[ m_id ].str_parameter;
if( m_parser->fktext[ m_id ].use_slider == -1 )
if ( m_parser->fktext[ m_id ].k_liste.isEmpty() )
editfunctionpage->useNoParameter->setChecked( true );
else
editfunctionpage->useList->setChecked( true );
else
{
editfunctionpage->useSlider->setChecked( true );
editfunctionpage->listOfSliders->setCurrentItem( m_parser->fktext[ m_index ].use_slider );
editfunctionpage->listOfSliders->setCurrentItem( m_parser->fktext[ m_id ].use_slider );
}
editderivativespage->showDerivative1->setChecked( m_parser->fktext[ m_index ].f1_mode );
editderivativespage->lineWidthDerivative1->setValue( m_parser->fktext[ m_index ].f1_linewidth );
editderivativespage->colorDerivative1->setColor( m_parser->fktext[ m_index ].f1_color );
editderivativespage->showDerivative2->setChecked( m_parser->fktext[ m_index ].f2_mode );
editderivativespage->lineWidthDerivative2->setValue( m_parser->fktext[ m_index ].f2_linewidth );
editderivativespage->colorDerivative2->setColor( m_parser->fktext[ m_index ].f2_color );
editintegralpage->precision->setValue( m_parser->fktext[ m_index ].integral_precision );
editintegralpage->lineWidth->setValue( m_parser->fktext[ m_index ].integral_linewidth );
editintegralpage->color->setColor( m_parser->fktext[ m_index ].integral_color );
editderivativespage->showDerivative1->setChecked( m_parser->fktext[ m_id ].f1_mode );
editderivativespage->lineWidthDerivative1->setValue( m_parser->fktext[ m_id ].f1_linewidth );
editderivativespage->colorDerivative1->setColor( m_parser->fktext[ m_id ].f1_color );
editderivativespage->showDerivative2->setChecked( m_parser->fktext[ m_id ].f2_mode );
editderivativespage->lineWidthDerivative2->setValue( m_parser->fktext[ m_id ].f2_linewidth );
editderivativespage->colorDerivative2->setColor( m_parser->fktext[ m_id ].f2_color );
editintegralpage->precision->setValue( m_parser->fktext[ m_id ].integral_precision );
editintegralpage->lineWidth->setValue( m_parser->fktext[ m_id ].integral_linewidth );
editintegralpage->color->setColor( m_parser->fktext[ m_id ].integral_color );
if ( m_parser->fktext[ m_index ].integral_mode )
if ( m_parser->fktext[ m_id ].integral_mode )
{
editintegralpage->showIntegral->setChecked( m_parser->fktext[ m_index ].integral_mode );
editintegralpage->customPrecision->setChecked( m_parser->fktext[ m_index ].integral_use_precision );
editintegralpage->txtInitX->setText(m_parser->fktext[ m_index ].str_startx);
editintegralpage->txtInitY->setText(m_parser->fktext[ m_index ].str_starty);
editintegralpage->showIntegral->setChecked( m_parser->fktext[ m_id ].integral_mode );
editintegralpage->customPrecision->setChecked( m_parser->fktext[ m_id ].integral_use_precision );
editintegralpage->txtInitX->setText(m_parser->fktext[ m_id ].str_startx);
editintegralpage->txtInitY->setText(m_parser->fktext[ m_id ].str_starty);
}
......@@ -159,20 +159,28 @@ void EditFunction::setWidgets()
void EditFunction::accept()
{
QString f_str(functionItem() );
int index;
if( m_index != -1 ) //when editing a function:
int id;
Parser::Ufkt *tmp_ufkt;
if( m_id != -1 ) //when editing a function:
{
index = m_index; //use the right function-index
QString const old_fstr = m_parser->ufkt[index].fstr;
m_parser->fixFunctionName(f_str, XParser::Function, index);
int const ix = m_parser->ixValue(m_id);
if ( ix == -1) //The function could have been deleted
{
KMessageBox::error(this,i18n("Function could not be found"));
return;
}
tmp_ufkt = &m_parser->ufkt[ix];
id = m_id; //use the right function-id
QString const old_fstr = tmp_ufkt->fstr;
m_parser->fixFunctionName(f_str, XParser::Function, m_id);
if(( (!m_parameter.isEmpty() && editfunctionpage->useList->isChecked() ) || editfunctionpage->useSlider->isChecked() ) && !functionHas2Arguments() )
fixFunctionArguments(f_str); //adding an extra argument for the parameter value
m_parser->ufkt[index].fstr = f_str;
m_parser->reparse(index); //reparse the funcion
tmp_ufkt->fstr = f_str;
m_parser->reparse(tmp_ufkt); //reparse the funcion
if ( m_parser->errmsg() != 0)
{
m_parser->ufkt[index].fstr = old_fstr;
m_parser->reparse(index);
tmp_ufkt->fstr = old_fstr;
m_parser->reparse(tmp_ufkt);
this->raise();
showPage(0);
editfunctionpage->equation->setFocus();
......@@ -185,9 +193,8 @@ void EditFunction::accept()
m_parser->fixFunctionName(f_str, XParser::Function);
if(( (!m_parameter.isEmpty() && editfunctionpage->useList->isChecked() ) || editfunctionpage->useSlider->isChecked() ) && !functionHas2Arguments() )
fixFunctionArguments(f_str); //adding an extra argument for the parameter value
index = m_parser->addfkt( f_str ); //create a new function otherwise
if( index == -1)
id = m_parser->addfkt( f_str ); //create a new function otherwise
if( id == -1)
{
m_parser->errmsg();
this->raise();
......@@ -196,12 +203,13 @@ void EditFunction::accept()
editfunctionpage->equation->selectAll();
return;
}
tmp_ufkt = &m_parser->ufkt.last();
}
if ( f_str.at(0)== 'x' || f_str.at(0)== 'y' || f_str.at(0)== 'r')
{
KMessageBox::error( this, i18n("You can only define plot functions in this dialog"));
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
......@@ -218,7 +226,7 @@ void EditFunction::accept()
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
tmp_fktext.str_dmax= editfunctionpage->max->text();
......@@ -228,7 +236,7 @@ void EditFunction::accept()
showPage(0);
editfunctionpage->max->setFocus();
editfunctionpage->max->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
......@@ -238,7 +246,7 @@ void EditFunction::accept()
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
......@@ -248,7 +256,7 @@ void EditFunction::accept()
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
}
......@@ -275,7 +283,7 @@ void EditFunction::accept()
showPage(2);
editintegralpage->txtInitX->setFocus();
editintegralpage->txtInitX->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
......@@ -288,7 +296,7 @@ void EditFunction::accept()
showPage(2);
editintegralpage->txtInitY->setFocus();
editintegralpage->txtInitY->selectAll();
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
tmp_fktext.integral_mode = 1;
......@@ -346,27 +354,20 @@ void EditFunction::accept()
if ( f_str.contains('y') != 0 && ( tmp_fktext.f_mode || tmp_fktext.f1_mode || tmp_fktext.f2_mode) )
{
KMessageBox::error( this, i18n( "Recursive function is only allowed when drawing integral graphs") );
if( m_index == -1 ) m_parser->Parser::delfkt( &m_parser->ufkt[index] );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
//tmp_fktext.color0 = m_parser->fktext[index].color0; ///Should we change the default color?
if( m_index == -1 )
}
if( m_id == -1 )
{
tmp_fktext.id = tmp_ufkt->id;
m_parser->fktext.append(tmp_fktext);
}
else
m_parser->fktext[index] = tmp_fktext ; //save all settings in the function now when we now no errors have appeared
if ( m_parser->getext( index ) == -1)
{
this->raise();
showPage(0);
editfunctionpage->equation->setFocus();
editfunctionpage->equation->selectAll();
if( m_index == -1 ) m_parser->delfkt( m_parser->ufkt.end(), m_parser->fktext.end() );
return;
tmp_fktext.id = id;
m_parser->fktext[m_parser->ixValue(id)] = tmp_fktext ; //save all settings in the function now when we now no errors have appeared
}
editfunctionpage->equation->setText(f_str); //update the function name in FktDlg
// call inherited method
......
......@@ -47,7 +47,7 @@ class EditFunction : public KDialogBase
/// Nothing special to do.
virtual ~EditFunction() {};
/// Fill the dialog's widgets with the properties of the parser function number index.
void initDialog( int index = -1 );
void initDialog( int id = -1 );
/// Returns the well formed function equation for the listbox in FktDlg.
const QString functionItem();
......@@ -74,7 +74,7 @@ class EditFunction : public KDialogBase
/// Pointer to the parser instance
XParser* m_parser;
/// Current function index
int m_index;
int m_id;
QStringList m_parameter;
EditFunctionPage* editfunctionpage;
......
......@@ -82,31 +82,25 @@ void KConstantEditor::cmdDelete_clicked()
if ( !varlist->currentItem() )
return;
QString fname, fstr, str;
bool stop = false;
constant = varlist->currentItem()->text(0).at(0).latin1();
value = varlist->currentItem()->text(1);
//for ( index = 0; index < m_view->parser()->fktext.count() && !stop; ++index )
QString str;
for( QValueVector<XParser::FktExt>::iterator it = m_view->parser()->fktext.begin(); it != m_view->parser()->fktext.end(); ++it)
{
str = it->extstr;
for (int i=str.find(')'); (uint)i<str.length() && !stop;i++)
for (int i=str.find(')'); (uint)i<str.length();i++)
if ( str.at(i) == constant )
stop = true;
{
KMessageBox::error(this, i18n("A function uses this constant; therefore, it cannot be removed."));
return;
}
}
if (stop)
{
KMessageBox::error(this, i18n("A function uses this constant; therefore, it cannot be removed."));
return;
}
QValueVector<Constant>::iterator it;
for(it = m_view->parser()->constant.begin(); it!= m_view->parser()->constant.end() && !stop;it++)
for(it = m_view->parser()->constant.begin(); it!= m_view->parser()->constant.end(); it++)
{
if ( it->constant == constant)
{
if ( it++ == m_view->parser()->constant.end())
m_view->parser()->constant.pop_back();
else
......@@ -114,14 +108,10 @@ void KConstantEditor::cmdDelete_clicked()
it--;
m_view->parser()->constant.erase(it++);
}
stop = true;
KMessageBox::error(this, i18n("The item could not be found."));
return;
}
}
if (!stop)
{
KMessageBox::error(this, i18n("The item could not be found."));
return;
}
delete varlist->findItem(QChar(constant), 0); //removes the item from the constant list
}
......@@ -205,7 +195,7 @@ void KConstantEditor::editConstantSlot()
if (item!=0)
item->setText(1,value);
QString fname, fstr;
//QString fname, fstr;
//for ( uint index = 0; index < m_view->parser()->fktext.count(); ++index )
int index = 0;
......
......@@ -46,11 +46,11 @@ KEditParametric::KEditParametric( XParser* parser, QWidget* parent, const char*
{
}
void KEditParametric::initDialog( int x_index, int y_index )
void KEditParametric::initDialog( int x_id, int y_id)
{
m_x_index = x_index;
m_y_index = y_index;
if( m_x_index == -1 ) clearWidgets();
m_x_id = x_id;
m_y_id = y_id;
if( m_x_id == -1 ) clearWidgets();
else setWidgets();
}
......@@ -70,27 +70,26 @@ void KEditParametric::clearWidgets()
void KEditParametric::setWidgets()
{
QString name, expression;
splitEquation( m_parser->fktext[ m_x_index ].extstr, name, expression );
splitEquation( m_parser->fktext[ m_x_id ].extstr, name, expression );
kLineEditName->setText( name );
kLineEditXFunction->setText( expression );
splitEquation( m_parser->fktext[ m_y_index ].extstr, name, expression );
splitEquation( m_parser->fktext[ m_y_id ].extstr, name, expression );
kLineEditYFunction->setText( expression );
checkBoxHide->setChecked( m_parser->fktext[ m_x_index ].f_mode == 0 );
if ( m_parser->fktext[ m_x_index ].dmin != m_parser->fktext[ m_x_index ].dmax )
checkBoxHide->setChecked( m_parser->fktext[ m_x_id ].f_mode == 0 );
if ( m_parser->fktext[ m_x_id ].dmin != m_parser->fktext[ m_x_id ].dmax )
{
checkBoxRange->setChecked(true);