Commit 51b15d7c authored by Fredrik Edemar's avatar Fredrik Edemar

Many internal changes for Parser and XParser:

* XParser::FktExt is merged to Parser::Ufkt as it simplify the code when looping through the functions.
* Ufkt is now a standalone class, independent from Parser.
* The changes stated above forced me to re-write the procedure of adding a function: Now all data for the new function isplaced in a temp-variable, the function is created and then all data is copied to the new function.
* Both XParser and Parser were cleaned; some old functions were removed (the are not needed anymore as XParser::FktExt doesn't exist) and comments are added to the header files.
* KmplotIO has the XParser-object as a member variable instead of an argument to the load and save functions.
* A silly ';'-character after an if-statement made it impossible to define recursive functions before. That is fixed now.

And:
* The functions are now sorted in the edit-function dialog.

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

svn path=/trunk/kdeedu/kmplot/; revision=347322
parent f3c35dff
......@@ -9,12 +9,14 @@ TODO
* In tool menu:
* find "nollställen" ( en: where the function's value is 0)
* get slope for a x-point
* Fix the unpolished lines
* Fix the unpolished lines?
* #52887, need to calculate with complex numbers.
* Popupmenu and tracemode for parametric- and polar functions
* Draw tangents in trace mode (pipesmoker)
* Printing (pipesmoker)
- different paper sizes
* Ability to set font size when drawing labels.
* Use a better(faster!) algorithm for drawing integrals numeric.
IN PROGRESS
......
......@@ -94,7 +94,7 @@ void FktDlg::slotEdit()
int const id = getId( lb_fktliste->currentText().section( ";", 0, 0) ) ;
// find out the function type
char const prefix = m_parser->fktext[ m_parser->ixValue(id) ].extstr.at(0).latin1();
char const prefix = m_parser->ufkt[ m_parser->ixValue(id) ].extstr.at(0).latin1();
if ( prefix == 'r')
slotEditPolar( id, num );
......@@ -106,7 +106,7 @@ void FktDlg::slotEdit()
int FktDlg::getId( const QString &f_str )
{
for( QValueVector<XParser::FktExt>::iterator it = m_parser->fktext.begin(); it != m_parser->fktext.end(); ++it)
for( QValueVector<Ufkt>::iterator it = m_parser->ufkt.begin(); it != m_parser->ufkt.end(); ++it)
{
if ( it->extstr == f_str )
return it->id;
......@@ -117,7 +117,7 @@ int FktDlg::getId( const QString &f_str )
int FktDlg::getParamId( const QString &f_str)
{
QString const fname = f_str.section( "(", 0, 0 );
for( QValueVector<Parser::Ufkt>::iterator it = m_parser->ufkt.begin(); it != m_parser->ufkt.end(); ++it)
for( QValueVector<Ufkt>::iterator it = m_parser->ufkt.begin(); it != m_parser->ufkt.end(); ++it)
{
if ( it->fname == fname )
return it->id;
......@@ -147,7 +147,8 @@ void FktDlg::slotEditFunction( int id, int num )
{
if( id == -1 ) lb_fktliste->insertItem( editFunction->functionItem() ); //a new function
else lb_fktliste->changeItem( editFunction->functionItem(), num ); //changed a function
changed = true;
lb_fktliste->sort();
changed = true;
updateView();
}
}
......@@ -161,7 +162,8 @@ void FktDlg::slotEditParametric( int x_id, int y_id, int num )
{
if( x_id == -1 ) lb_fktliste->insertItem( editParametric->functionItem() ); //a new function
else lb_fktliste->changeItem( editParametric->functionItem(), num ); //changed a function
changed = true;
lb_fktliste->sort();
changed = true;
updateView();
}
}
......@@ -175,7 +177,8 @@ void FktDlg::slotEditPolar( int id, int num )
{
if( id == -1 ) lb_fktliste->insertItem( editPolar->functionItem() ); //a new function
else lb_fktliste->changeItem( editPolar->functionItem(), num ); //changed a function
changed = true;
lb_fktliste->sort();
changed = true;
updateView();
}
}
......@@ -200,9 +203,9 @@ void FktDlg::getPlots()
lb_fktliste->clear();
// adding all yet added functions
for( QValueVector<XParser::FktExt>::iterator it = m_parser->fktext.begin(); it != m_parser->fktext.end(); ++it)
for( QValueVector<Ufkt>::iterator it = m_parser->ufkt.begin(); it != m_parser->ufkt.end(); ++it)
{
if( it->extstr[0] == 'y' ) continue;
if( it->fname.isEmpty() || it->extstr[0] == 'y' ) continue;
if( it->extstr[0] == 'x' )
{
QString y = it->extstr;
......@@ -211,6 +214,7 @@ void FktDlg::getPlots()
}
else lb_fktliste->insertItem( it->extstr );
}
lb_fktliste->sort();
}
void FktDlg::slotHelp()
......
......@@ -75,11 +75,11 @@ MainDlg::MainDlg( KCmdLineArgs* args, const char* name ) : KMainWindow( 0, name
setupStatusBar();
setupActions();
loadConstants();
kmplotio = new KmPlotIO();
kmplotio = new KmPlotIO(view->parser());
if (args -> count() > 0)
{
m_filename = args -> url( 0 ).url(-1);
if (kmplotio->load( view->parser(), KURL(m_filename) ) )
if (kmplotio->load( KURL(m_filename) ) )
{
setCaption( m_filename );
view->updateSliders();
......@@ -267,7 +267,7 @@ void MainDlg::slotSave()
if ( KMessageBox::warningYesNo( this, i18n( "This file is saved with an old file format; if you save it, you cannot open the file with older versions of Kmplot. Are you sure you want to continue?" ) ) == KMessageBox::No)
return;
}
kmplotio->save( view->parser(), m_filename );
kmplotio->save( m_filename );
kdDebug() << "saved" << endl;
m_modified = false;
}
......@@ -283,7 +283,7 @@ void MainDlg::slotSaveas()
// check if file exists and overwriting is ok.
if( !KIO::NetAccess::exists( url,false,this ) || KMessageBox::warningContinueCancel( this, i18n( "A file named \"%1\" already exists. Are you sure you want to continue and overwrite this file?" ).arg( url.url()), i18n( "Overwrite File?" ), KGuiItem( i18n( "&Overwrite" ) ) ) == KMessageBox::Continue )
{
if ( !kmplotio->save( view->parser(), url ) )
if ( !kmplotio->save( url ) )
KMessageBox::error(this, i18n("The file could not be saved") );
else
{
......@@ -364,7 +364,7 @@ void MainDlg::slotOpen()
if ( file.isEmpty() )
return;
view->init();
if ( !kmplotio->load( view->parser(), file ) )
if ( !kmplotio->load( file ) )
return;
m_filename = file.url();
m_recentFiles->addURL( file );
......@@ -378,7 +378,7 @@ void MainDlg::slotOpenRecent( const KURL &url )
{
if( !checkModified() ) return;
view->init();
if ( !kmplotio->load( view->parser(), url ) ) //if the loading fails
if ( !kmplotio->load( url ) ) //if the loading fails
{
m_recentFiles->removeURL(url ); //remove the file from the recent-opened-file-list
return;
......@@ -506,13 +506,13 @@ void MainDlg::slotEditPlots()
if ( !fdlg ) fdlg = new FktDlg( this, view->parser() ); // make the dialog only if not allready done
fdlg->getPlots();
KTempFile tmpfile;
kmplotio->save( view->parser(), tmpfile.name() );
kmplotio->save( tmpfile.name() );
if( fdlg->exec() == QDialog::Rejected )
{
if ( fdlg->isChanged() )
{
view->init();
kmplotio->load( view->parser(), tmpfile.name() );
kmplotio->load( tmpfile.name() );
view->drawPlot();
}
}
......@@ -530,40 +530,36 @@ void MainDlg::slotQuickEdit(const QString& tmp_f_str )
//creates a valid name for the function if the user has forgotten that
QString f_str( tmp_f_str );
view->parser()->fixFunctionName(f_str);
if ( f_str.at(0)== 'x' || f_str.at(0)== 'y')
{
KMessageBox::error( this, i18n("Parametric functions must be definied in the \"New Parametric Plot\"-dialog which you can find in the menubar"));
return;
}
if ( f_str.contains('y') != 0)
{
KMessageBox::error( this, i18n( "Recursive function is not allowed"));
m_quickEdit->setFocus();
m_quickEdit->selectAll();
return;
}
int const id = view->parser()->addfkt( f_str );
if (id==-1)
{
view->parser()->errmsg();
view->parser()->parserError();
m_quickEdit->setFocus();
m_quickEdit->selectAll();
return;
}
if ( f_str.contains('y') != 0)
{
KMessageBox::error( this, i18n( "Recursive function is not allowed"));
m_quickEdit->setFocus();
m_quickEdit->selectAll();
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 );
Ufkt *ufkt = &view->parser()->ufkt.last();
view->parser()->prepareAddingFunction(ufkt);
if ( view->parser()->getext( &fktext ) == -1)
if ( view->parser()->getext( ufkt ) == -1)
{
m_quickEdit->setFocus();
m_quickEdit->selectAll();
view->parser()->delfkt( view->parser()->ixValue(id) );
view->parser()->Parser::delfkt( ufkt );
return;
}
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(XParser::FktExt *, char, bool, double &, double &,QString &);
void findMinMaxValue(Ufkt *, char, bool, double &, double &,QString &);
/// get a y-value from a x-value
void getYValue(XParser::FktExt *, char, double , double &,QString &);
void getYValue(Ufkt * , char, double , double &,QString &);
/// draw and calculate the area between the graph and the x-axis.
void areaUnderGraph(XParser::FktExt *, char const, double &, double &, QString &, QPainter* );
void areaUnderGraph(Ufkt *, 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;
XParser::FktExt * areaFktext;
Ufkt * areaUfkt;
char areaPMode;
double areaMin, areaMax;
QString areaParameter;
......@@ -156,7 +156,7 @@ private:
/// Only for printing.
void drawHeaderTable(QPainter *);
/// Draw the function plots.
void plotfkt(QValueVector<XParser::FktExt>::iterator, QPainter*);
void plotfkt(Ufkt *ufkt, QPainter*);
/// Gets the greek pi symbol.
void setpi(QString *);
/// in trace mode checks, if the function is (near by) zero
......
......@@ -109,48 +109,48 @@ void EditFunction::clearWidgets()
void EditFunction::setWidgets()
{
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 )
Ufkt *ufkt = &m_parser->ufkt[ m_parser->ixValue(m_id) ];
editfunctionpage->equation->setText( ufkt->extstr );
editfunctionpage->hide->setChecked( ufkt->f_mode == 0 );
editfunctionpage->lineWidth->setValue( ufkt->linewidth );
editfunctionpage->color->setColor( ufkt->color );
if ( ufkt->dmin != ufkt->dmax )
{
editfunctionpage->customRange->setChecked(true);
editfunctionpage->min->setText( m_parser->fktext[ m_id ].str_dmin );
editfunctionpage->max->setText( m_parser->fktext[ m_id ].str_dmax );
editfunctionpage->min->setText( ufkt->str_dmin );
editfunctionpage->max->setText( ufkt->str_dmax );
}
else
editfunctionpage->customRange->setChecked(false);
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() )
m_parameter = ufkt->str_parameter;
if( ufkt->use_slider == -1 )
if ( ufkt->k_liste.isEmpty() )
editfunctionpage->useNoParameter->setChecked( true );
else
editfunctionpage->useList->setChecked( true );
else
{
editfunctionpage->useSlider->setChecked( true );
editfunctionpage->listOfSliders->setCurrentItem( m_parser->fktext[ m_id ].use_slider );
editfunctionpage->listOfSliders->setCurrentItem( ufkt->use_slider );
}
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 );
editderivativespage->showDerivative1->setChecked( ufkt->f1_mode );
editderivativespage->lineWidthDerivative1->setValue( ufkt->f1_linewidth );
editderivativespage->colorDerivative1->setColor( ufkt->f1_color );
editderivativespage->showDerivative2->setChecked( ufkt->f2_mode );
editderivativespage->lineWidthDerivative2->setValue( ufkt->f2_linewidth );
editderivativespage->colorDerivative2->setColor( ufkt->f2_color );
editintegralpage->precision->setValue( ufkt->integral_precision );
editintegralpage->lineWidth->setValue( ufkt->integral_linewidth );
editintegralpage->color->setColor( ufkt->integral_color );
if ( m_parser->fktext[ m_id ].integral_mode )
if ( ufkt->integral_mode )
{
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);
editintegralpage->showIntegral->setChecked( ufkt->integral_mode );
editintegralpage->customPrecision->setChecked( ufkt->integral_use_precision );
editintegralpage->txtInitX->setText(ufkt->str_startx);
editintegralpage->txtInitY->setText(ufkt->str_starty);
}
......@@ -159,215 +159,221 @@ void EditFunction::setWidgets()
void EditFunction::accept()
{
QString f_str(functionItem() );
int id;
Parser::Ufkt *tmp_ufkt;
if( m_id != -1 ) //when editing a function:
{
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
tmp_ufkt->fstr = f_str;
m_parser->reparse(tmp_ufkt); //reparse the funcion
if ( m_parser->errmsg() != 0)
{
tmp_ufkt->fstr = old_fstr;
m_parser->reparse(tmp_ufkt);
this->raise();
showPage(0);
editfunctionpage->equation->setFocus();
editfunctionpage->equation->selectAll();
return;
}
}
else //creating a new function
{
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
id = m_parser->addfkt( f_str ); //create a new function otherwise
if( id == -1)
{
m_parser->errmsg();
this->raise();
showPage(0);
editfunctionpage->equation->setFocus();
editfunctionpage->equation->selectAll();
return;
}
tmp_ufkt = &m_parser->ufkt.last();
}
if ( m_id!=-1 )
m_parser->fixFunctionName(f_str, XParser::Function, m_id);
else
m_parser->fixFunctionName(f_str, XParser::Function);
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_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
XParser::FktExt tmp_fktext; //all settings are saved here until we know that no errors have appeared
m_parser->prepareAddingFktExtFunction(tmp_fktext);
tmp_fktext.extstr = f_str;
Ufkt tmp_ufkt; //all settings are saved here until we know that no errors have appeared
if( editfunctionpage->customRange->isChecked() )
{
tmp_fktext.str_dmin = editfunctionpage->min->text();
tmp_fktext.dmin = m_parser->eval( editfunctionpage->min->text() );
if (m_parser->errmsg() != 0)
tmp_ufkt.str_dmin = editfunctionpage->min->text();
tmp_ufkt.dmin = m_parser->eval( editfunctionpage->min->text() );
if (m_parser->parserError() != 0)
{
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
tmp_fktext.str_dmax= editfunctionpage->max->text();
tmp_fktext.dmax = m_parser->eval( editfunctionpage->max->text() );
if (m_parser->errmsg() != 0)
tmp_ufkt.str_dmax= editfunctionpage->max->text();
tmp_ufkt.dmax = m_parser->eval( editfunctionpage->max->text() );
if (m_parser->parserError() != 0)
{
showPage(0);
editfunctionpage->max->setFocus();
editfunctionpage->max->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
if ( tmp_fktext.dmin >= tmp_fktext.dmax)
if ( tmp_ufkt.dmin >= tmp_ufkt.dmax)
{
KMessageBox::error(this,i18n("The minimum range value must be lower than the maximum range value"));
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
if ( tmp_fktext.dmin<View::xmin || tmp_fktext.dmax>View::xmax )
if ( tmp_ufkt.dmin<View::xmin || tmp_ufkt.dmax>View::xmax )
{
KMessageBox::error(this,i18n("Please insert a minimum and maximum range between %1 and %2").arg(View::xmin).arg(View::xmax) );
showPage(0);
editfunctionpage->min->setFocus();
editfunctionpage->min->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
}
else
{
//the min and max values must be equal so that plotfkt in View uses xmin and xmax instead
tmp_fktext.str_dmin ="0";
tmp_fktext.dmin = 0;
tmp_fktext.str_dmax = "0";
tmp_fktext.dmax = 0;
tmp_ufkt.str_dmin ="0";
tmp_ufkt.dmin = 0;
tmp_ufkt.str_dmax = "0";
tmp_ufkt.dmax = 0;
}
tmp_fktext.linewidth = editfunctionpage->lineWidth->value();
tmp_fktext.color = editfunctionpage->color->color().rgb();
tmp_ufkt.linewidth = editfunctionpage->lineWidth->value();
tmp_ufkt.color = editfunctionpage->color->color().rgb();
if (editintegralpage->showIntegral->isChecked() )
{
double initx = m_parser->eval(editintegralpage->txtInitX->text());
tmp_fktext.startx = initx;
tmp_fktext.str_startx = editintegralpage->txtInitX->text();
if (m_parser->err != 0)
tmp_ufkt.startx = initx;
tmp_ufkt.str_startx = editintegralpage->txtInitX->text();
if (m_parser->parserError(false) != 0)
{
KMessageBox::error(this,i18n("Please insert a valid x-value"));
showPage(2);
editintegralpage->txtInitX->setFocus();
editintegralpage->txtInitX->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
editintegralpage->txtInitX->selectAll();
return;
}
double inity = m_parser->eval(editintegralpage->txtInitY->text());
tmp_fktext.starty = inity;
tmp_fktext.str_starty = editintegralpage->txtInitY->text();
if (m_parser->err != 0)
tmp_ufkt.starty = inity;
tmp_ufkt.str_starty = editintegralpage->txtInitY->text();
if (m_parser->parserError(false) != 0)
{
KMessageBox::error(this,i18n("Please insert a valid y-value"));
showPage(2);
editintegralpage->txtInitY->setFocus();
editintegralpage->txtInitY->selectAll();
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
tmp_fktext.integral_mode = 1;
tmp_ufkt.integral_mode = 1;
}
else
tmp_fktext.integral_mode = 0;
tmp_ufkt.integral_mode = 0;
tmp_fktext.integral_color = editintegralpage->color->color().rgb();
tmp_fktext.integral_use_precision = editintegralpage->customPrecision->isChecked();
tmp_fktext.integral_precision = editintegralpage->precision->value();
tmp_fktext.integral_linewidth = editintegralpage->lineWidth->value();
tmp_ufkt.integral_color = editintegralpage->color->color().rgb();
tmp_ufkt.integral_use_precision = editintegralpage->customPrecision->isChecked();
tmp_ufkt.integral_precision = editintegralpage->precision->value();
tmp_ufkt.integral_linewidth = editintegralpage->lineWidth->value();
if( editfunctionpage->hide->isChecked() )
tmp_fktext.f_mode = 0;
/*if( editfunctionpage->hide->isChecked() )
tmp_ufkt.f_mode = 0;
else
tmp_fktext.f_mode = 1;
tmp_ufkt.f_mode = 1;*/
tmp_ufkt.f_mode = !editfunctionpage->hide->isChecked();
if( editfunctionpage->useSlider->isChecked() )
tmp_fktext.use_slider = editfunctionpage->listOfSliders->currentItem(); //specify which slider that will be used
tmp_ufkt.use_slider = editfunctionpage->listOfSliders->currentItem(); //specify which slider that will be used
else
{
tmp_fktext.use_slider = -1;
tmp_ufkt.use_slider = -1;
if ( editfunctionpage->useNoParameter->isChecked() || m_parameter.isEmpty() )
m_parameter.clear();
else
{
tmp_fktext.str_parameter = m_parameter;
int i=0;
tmp_fktext.k_liste.clear();
tmp_ufkt.str_parameter = m_parameter;
tmp_ufkt.k_liste.clear();
for( QStringList::Iterator it = m_parameter.begin(); it != m_parameter.end(); ++it )
{
tmp_fktext.k_liste.append(m_parser->eval(( *it ) ) );
++i;
tmp_ufkt.k_liste.append(m_parser->eval(( *it ) ) );
}
}
}
if( editderivativespage->showDerivative1->isChecked() )
tmp_fktext.f1_mode = 1;
tmp_ufkt.f1_mode = 1;
else
tmp_fktext.f1_mode = 0;
tmp_ufkt.f1_mode = 0;
tmp_fktext.f1_linewidth = editderivativespage->lineWidthDerivative1->value();
tmp_fktext.f1_color = editderivativespage->colorDerivative1->color().rgb();
tmp_ufkt.f1_linewidth = editderivativespage->lineWidthDerivative1->value();
tmp_ufkt.f1_color = editderivativespage->colorDerivative1->color().rgb();
if( editderivativespage->showDerivative2->isChecked() )
tmp_fktext.f2_mode = 1;
tmp_ufkt.f2_mode = 1;
else
tmp_fktext.f2_mode = 0;
tmp_ufkt.f2_mode = 0;
tmp_fktext.f2_linewidth = editderivativespage->lineWidthDerivative2->value();
tmp_fktext.f2_color = editderivativespage->colorDerivative2->color().rgb();
tmp_ufkt.f2_linewidth = editderivativespage->lineWidthDerivative2->value();
tmp_ufkt.f2_color = editderivativespage->colorDerivative2->color().rgb();
if ( f_str.contains('y') != 0 && ( tmp_fktext.f_mode || tmp_fktext.f1_mode || tmp_fktext.f2_mode) )
if ( f_str.contains('y') != 0 && ( tmp_ufkt.f_mode || tmp_ufkt.f1_mode || tmp_ufkt.f2_mode) )
{
KMessageBox::error( this, i18n( "Recursive function is only allowed when drawing integral graphs") );
if( m_id == -1 ) m_parser->Parser::delfkt( tmp_ufkt );
return;
}
if( m_id == -1 )
Ufkt *added_ufkt;
if( m_id != -1 ) //when editing a function:
{
tmp_fktext.id = tmp_ufkt->id;
m_parser->fktext.append(tmp_fktext);
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;
}
added_ufkt = &m_parser->ufkt[ix];