Commit 12ffa719 authored by David Saxton's avatar David Saxton

Store only one static reference to the main View object; this tidies up code

(and slightly reduces memory usage).

svn path=/trunk/KDE/kdeedu/kmplot/; revision=525069
parent dc7f2438
......@@ -83,22 +83,22 @@ MainDlg::MainDlg(QWidget *parentWidget, const char *, QObject *parent ) : DCOPO
coordsDialog = 0;
m_popupmenu = new KMenu( parentWidget );
m_newPlotMenu = new KMenu( parentWidget );
view = new View( m_readonly, m_modified, m_popupmenu, parentWidget, actionCollection(), this );
connect( view, SIGNAL( setStatusBarText(const QString &)), this, SLOT( setReadOnlyStatusBarText(const QString &) ) );
(void) new View( m_readonly, m_modified, m_popupmenu, parentWidget, actionCollection(), this );
connect( View::self(), SIGNAL( setStatusBarText(const QString &)), this, SLOT( setReadOnlyStatusBarText(const QString &) ) );
if ( !m_readonly )
{
m_functionEditor = new FunctionEditor( view, m_newPlotMenu, parentWidget );
m_functionEditor = new FunctionEditor( m_newPlotMenu, parentWidget );
static_cast<QMainWindow*>(parentWidget)->addDockWidget( Qt::LeftDockWidgetArea, m_functionEditor );
}
setWidget( view );
view->setFocusPolicy(Qt::ClickFocus);
minmaxdlg = new KMinMax(view, m_parent);
view->setMinMaxDlg(minmaxdlg);
setWidget( View::self() );
View::self()->setFocusPolicy(Qt::ClickFocus);
minmaxdlg = new KMinMax(m_parent);
View::self()->setMinMaxDlg(minmaxdlg);
setupActions();
view->parser()->constants()->load();
kmplotio = new KmPlotIO(view->parser());
View::self()->parser()->constants()->load();
kmplotio = new KmPlotIO(View::self()->parser());
m_config = KGlobal::config();
m_recentFiles->loadEntries( m_config );
......@@ -116,10 +116,10 @@ MainDlg::MainDlg(QWidget *parentWidget, const char *, QObject *parent ) : DCOPO
m_settingsDialog->setHelp("general-config");
// create and add the page(s)
m_generalSettings = new SettingsPageGeneral( view );
m_colorSettings = new SettingsPageColor( view );
m_fontsSettings = new SettingsPageFonts( view );
m_constantsSettings = new KConstantEditor( view, 0 );
m_generalSettings = new SettingsPageGeneral( View::self() );
m_colorSettings = new SettingsPageColor( View::self() );
m_fontsSettings = new SettingsPageFonts( View::self() );
m_constantsSettings = new KConstantEditor( 0 );
m_constantsSettings->setObjectName( "constantsSettings" );
m_settingsDialog->addPage( m_generalSettings, i18n("General"), "package_settings", i18n("General Settings") );
......@@ -134,7 +134,7 @@ MainDlg::MainDlg(QWidget *parentWidget, const char *, QObject *parent ) : DCOPO
MainDlg::~MainDlg()
{
m_recentFiles->saveEntries( m_config );
view->parser()->constants()->save();
View::self()->parser()->constants()->save();
delete kmplotio;
}
......@@ -182,15 +182,15 @@ void MainDlg::setupActions()
KAction * zoomIn = new KAction( i18n("Zoom &In"), actionCollection(), "zoom_in" );
zoomIn->setShortcut( "CTRL+1" );
zoomIn->setIcon( KIcon("viewmag+") );
connect( zoomIn, SIGNAL(triggered(bool)), view, SLOT(mnuZoomIn_clicked()) );
connect( zoomIn, SIGNAL(triggered(bool)), View::self(), SLOT(mnuZoomIn_clicked()) );
KAction * zoomOut = new KAction( i18n("Zoom &Out"), actionCollection(),"zoom_out" );
zoomOut->setShortcut( "CTRL+2" );
zoomOut->setIcon( KIcon("viewmag-") );
connect( zoomOut, SIGNAL(triggered(bool)), view, SLOT( mnuZoomOut_clicked() ) );
connect( zoomOut, SIGNAL(triggered(bool)), View::self(), SLOT( mnuZoomOut_clicked() ) );
KAction * zoomTrig = new KAction( i18n("&Fit Widget to Trigonometric Functions"), actionCollection(), "zoom_trig" );
connect( zoomTrig, SIGNAL(triggered(bool)), view, SLOT( mnuTrig_clicked() ) );
connect( zoomTrig, SIGNAL(triggered(bool)), View::self(), SLOT( mnuTrig_clicked() ) );
KAction * coordI = new KAction( i18n( "Coordinate System I" ), actionCollection(), "coord_i" );
coordI->setIcon( KIcon("ksys1.png") );
......@@ -249,23 +249,23 @@ void MainDlg::setupActions()
view->m_menuSliderAction = new KToggleAction( i18n( "Show Sliders" ), actionCollection(), "options_configure_show_sliders" );
connect( view->m_menuSliderAction, SIGNAL(triggered(bool)), this, SLOT( toggleShowSliders() ) );
View::self()->m_menuSliderAction = new KToggleAction( i18n( "Show Sliders" ), actionCollection(), "options_configure_show_sliders" );
connect( View::self()->m_menuSliderAction, SIGNAL(triggered(bool)), this, SLOT( toggleShowSliders() ) );
// Popup menu
KAction *mnuHide = new KAction(i18n("&Hide"), actionCollection(),"mnuhide" );
connect( mnuHide, SIGNAL(triggered(bool)), view, SLOT( mnuHide_clicked() ) );
connect( mnuHide, SIGNAL(triggered(bool)), View::self(), SLOT( mnuHide_clicked() ) );
mnuHide->plug(m_popupmenu);
KAction *mnuRemove = new KAction(i18n("&Remove"), actionCollection(),"mnuremove" );
mnuRemove->setIcon( KIcon("editdelete") );
connect( mnuRemove, SIGNAL(triggered(bool)), view, SLOT( mnuRemove_clicked() ) );
connect( mnuRemove, SIGNAL(triggered(bool)), View::self(), SLOT( mnuRemove_clicked() ) );
mnuRemove->plug(m_popupmenu);
KAction *mnuEdit = new KAction(i18n("&Edit"), actionCollection(),"mnuedit" );
mnuEdit->setIcon( KIcon("editplots") );
connect(mnuEdit , SIGNAL(triggered(bool)), view, SLOT( mnuEdit_clicked() ) );
connect(mnuEdit , SIGNAL(triggered(bool)), View::self(), SLOT( mnuEdit_clicked() ) );
mnuEdit->plug(m_popupmenu);
m_popupmenu->addSeparator();
......@@ -287,7 +287,7 @@ void MainDlg::undo()
m_currentState = m_undoStack.pop();
kmplotio->restore( m_currentState );
view->drawPlot();
View::self()->drawPlot();
m_undoAction->setEnabled( !m_undoStack.isEmpty() );
m_redoAction->setEnabled( true );
......@@ -305,7 +305,7 @@ void MainDlg::redo()
m_currentState = m_redoStack.pop();
kmplotio->restore( m_currentState );
view->drawPlot();
View::self()->drawPlot();
m_undoAction->setEnabled( true );
m_redoAction->setEnabled( !m_redoStack.isEmpty() );
......@@ -416,7 +416,7 @@ void MainDlg::slotExport()
if( url.fileName().right(4).toLower()==".svg")
{
QPicture pic;
view->draw(&pic, 2);
View::self()->draw(&pic, 2);
if (url.isLocalFile() )
pic.save( url.prettyURL(0), "SVG");
else
......@@ -432,7 +432,7 @@ void MainDlg::slotExport()
else if( url.fileName().right(4).toLower()==".bmp")
{
QPixmap pic(100, 100);
view->draw(&pic, 3);
View::self()->draw(&pic, 3);
if (url.isLocalFile() )
pic.save( url.prettyURL(0), "BMP");
else
......@@ -448,7 +448,7 @@ void MainDlg::slotExport()
else if( url.fileName().right(4).toLower()==".png")
{
QPixmap pic(100, 100);
view->draw(&pic, 3);
View::self()->draw(&pic, 3);
if (url.isLocalFile() )
pic.save( url.prettyURL(0), "PNG");
else
......@@ -464,7 +464,7 @@ void MainDlg::slotExport()
}
bool MainDlg::openFile()
{
view->init();
View::self()->init();
if (m_url==m_currentfile || !kmplotio->load( m_url ) )
{
m_recentFiles->removeUrl(m_url ); //remove the file from the recent-opened-file-list
......@@ -475,8 +475,8 @@ bool MainDlg::openFile()
m_recentFiles->addUrl( m_url.prettyURL(0) );
setWindowCaption( m_url.prettyURL(0) );
m_modified = false;
view->updateSliders();
view->drawPlot();
View::self()->updateSliders();
View::self()->drawPlot();
return true;
}
......@@ -492,7 +492,7 @@ void MainDlg::slotOpenRecent( const KUrl &url )
return;
}
view->init();
View::self()->init();
if ( !kmplotio->load( url ) ) //if the loading fails
{
m_recentFiles->removeUrl(url ); //remove the file from the recent-opened-file-list
......@@ -502,8 +502,8 @@ void MainDlg::slotOpenRecent( const KUrl &url )
m_recentFiles->setCurrentItem(-1); //don't select the item in the open-recent menu
setWindowCaption( m_url.prettyURL(0) );
m_modified = false;
view->updateSliders();
view->drawPlot();
View::self()->updateSliders();
View::self()->drawPlot();
}
void MainDlg::slotPrint()
......@@ -516,7 +516,7 @@ void MainDlg::slotPrint()
if ( prt.setup( m_parent, i18n( "Print Plot" ) ) )
{
prt.setFullPage( true );
view->draw(&prt, 1);
View::self()->draw(&prt, 1);
}
}
......@@ -525,7 +525,7 @@ void MainDlg::editAxes()
// create a config dialog and add a axes page
if ( !coordsDialog)
{
coordsDialog = new CoordsConfigDialog( view->parser(), m_parent);
coordsDialog = new CoordsConfigDialog( View::self()->parser(), m_parent);
// User edited the configuration - update your local copies of the
// configuration data
connect( coordsDialog, SIGNAL( settingsChanged(const QString &) ), this, SLOT(updateSettings() ) );
......@@ -558,7 +558,7 @@ void MainDlg::slotCoord1()
Settings::setXRange( 0 );
Settings::setYRange( 0 );
m_modified = true;
view->drawPlot();
View::self()->drawPlot();
}
void MainDlg::slotCoord2()
......@@ -566,7 +566,7 @@ void MainDlg::slotCoord2()
Settings::setXRange( 2 );
Settings::setYRange( 0 );
m_modified = true;
view->drawPlot();
View::self()->drawPlot();
}
void MainDlg::slotCoord3()
......@@ -574,7 +574,7 @@ void MainDlg::slotCoord3()
Settings::setXRange( 2 );
Settings::setYRange( 2 );
m_modified = true;
view->drawPlot();
View::self()->drawPlot();
}
void MainDlg::slotSettings()
......@@ -587,9 +587,9 @@ void MainDlg::slotSettings()
void MainDlg::updateSettings()
{
view->getSettings();
View::self()->getSettings();
m_modified = true;
view->drawPlot();
View::self()->drawPlot();
}
......@@ -620,16 +620,16 @@ void MainDlg::graphArea()
void MainDlg::toggleShowSliders()
{
// create the slider if it not exists already
if ( !view->m_sliderWindow )
if ( !View::self()->m_sliderWindow )
{
view->m_sliderWindow = new KSliderWindow( view, actionCollection());
connect( view->m_sliderWindow, SIGNAL( valueChanged() ), view, SLOT( drawPlot() ) );
connect( view->m_sliderWindow, SIGNAL( windowClosed() ), view, SLOT( slidersWindowClosed() ) );
View::self()->m_sliderWindow = new KSliderWindow( View::self(), actionCollection() );
connect( View::self()->m_sliderWindow, SIGNAL( valueChanged() ), View::self(), SLOT( drawPlot() ) );
connect( View::self()->m_sliderWindow, SIGNAL( windowClosed() ), View::self(), SLOT( slidersWindowClosed() ) );
}
if ( !view->m_sliderWindow->isVisible() )
view->m_sliderWindow->show();
if ( !View::self()->m_sliderWindow->isVisible() )
View::self()->m_sliderWindow->show();
else
view->m_sliderWindow->hide();
View::self()->m_sliderWindow->hide();
}
void MainDlg::setReadOnlyStatusBarText(const QString &text)
......
......@@ -153,8 +153,6 @@ private:
/// Returns true if any changes are done
bool isModified(){return m_modified;}
/// Central widget of the KMainWindow instance. tralala
View *view;
///The Recent Files action
KRecentFilesAction * m_recentFiles;
/// true == modifications not saved
......
......@@ -70,11 +70,12 @@
double View::xmin = 0;
double View::xmax = 0;
View * View::m_self = 0;
View::View(bool const r, bool &mo, KMenu *p, QWidget* parent, KActionCollection *ac, MainDlg * mainDlg )
: DCOPObject("View"),
QWidget( parent, Qt::WStaticContents ),
dgr(this),
buffer( width(), height() ),
m_popupmenu(p),
m_modified(mo),
......@@ -83,6 +84,7 @@ View::View(bool const r, bool &mo, KMenu *p, QWidget* parent, KActionCollection
m_ac(ac),
m_mainDlg( mainDlg )
{
m_self = this;
csmode = csparam = -1;
cstype = Ufkt::Function;
areaDraw = false;
......
......@@ -71,6 +71,9 @@ public:
View(bool, bool &, KMenu *, QWidget* parent, KActionCollection *ac, MainDlg * mainDlg );
void setMinMaxDlg(KMinMax *);
virtual ~View();
/// There is only one view.
static View * self() { return m_self; }
/// Reimplemented to draw all stuff to the view.
void draw(QPaintDevice *, int const);
......@@ -334,6 +337,7 @@ private:
Cursor m_prevCursor;
MainDlg * m_mainDlg;
static View * m_self;
};
#endif // View_included
......@@ -45,9 +45,8 @@ int isinf(double x)
#include <kdebug.h>
CDiagr::CDiagr( View * _view )
CDiagr::CDiagr()
{
view = _view;
updateSettings();
ex=ey=1.;
}
......@@ -101,7 +100,7 @@ void CDiagr::Skal( double ex, double ey )
void CDiagr::Plot(QPainter* pDC)
{
QPen pen(QColor(frameColor), view->mmToPenWidth( borderThickness, true ) );
QPen pen(QColor(frameColor), View::self()->mmToPenWidth( borderThickness, true ) );
if( g_mode != GRID_NONE )
drawGrid( pDC ); // draw the grid
......@@ -222,7 +221,7 @@ void CDiagr::drawAxes( QPainter* pDC ) // draw axes
if( Settings::showAxes() )
{
pDC->setPen( QPen( QColor(axesColor), view->mmToPenWidth(axesLineWidth, true) ) );
pDC->setPen( QPen( QColor(axesColor), View::self()->mmToPenWidth(axesLineWidth, true) ) );
a=PlotArea.right();
b=TransyToPixel(0.);
pDC->Lineh(PlotArea.left(), b, a); // x-Achse
......@@ -244,7 +243,7 @@ void CDiagr::drawAxes( QPainter* pDC ) // draw axes
}
}
pDC->setPen( QPen( QColor(axesColor), view->mmToPenWidth(ticWidth, true) ) );
pDC->setPen( QPen( QColor(axesColor), View::self()->mmToPenWidth(ticWidth, true) ) );
if( Settings::showAxes() )
{
da=oy-(ticLength*10.0);
......@@ -327,7 +326,7 @@ void CDiagr::drawGrid( QPainter* pDC )
{
double a, b;
double d, x, y;
QPen pen( QColor(gridColor), view->mmToPenWidth(gridLineWidth, true) );
QPen pen( QColor(gridColor), View::self()->mmToPenWidth(gridLineWidth, true) );
pDC->setPen(pen);
if( g_mode==GRID_LINES )
......
......@@ -58,7 +58,7 @@ class CDiagr
public:
/// Contructor. Members are set to initial values.
///@see Create()
CDiagr( View * view );
CDiagr();
/// Nothing to do for the destructor.
~CDiagr();
......@@ -144,8 +144,6 @@ private:
QRect PlotArea; ///< plot area
QRect m_frame; ///< frame around the plot
View * view; ///< Pointer to parent View
};
#endif // diagr_included
......@@ -33,6 +33,8 @@
#include "xparser.h"
#include <kaction.h>
#include <kmessagebox.h>
#include <QMenu>
#include <QTimer>
......@@ -49,13 +51,12 @@ class FunctionEditorWidget : public QWidget, public Ui::FunctionEditorWidget
//BEGIN class FunctionEditor
FunctionEditor::FunctionEditor( View * view, KMenu * createNewPlotsMenu, QWidget * parent )
FunctionEditor::FunctionEditor( KMenu * createNewPlotsMenu, QWidget * parent )
: QDockWidget( i18n("Function Editor"), parent )
{
m_function = -1;
m_functionX = -1;
m_functionY = -1;
m_view = view;
m_createNewPlotsMenu = createNewPlotsMenu;
// need a name for saving and restoring the position of this dock widget
......@@ -79,7 +80,7 @@ FunctionEditor::FunctionEditor( View * view, KMenu * createNewPlotsMenu, QWidget
connect( m_syncFunctionListTimer, SIGNAL(timeout()), this, SLOT( syncFunctionList() ) );
m_editor = new FunctionEditorWidget;
m_functionList = new FunctionListWidget( m_editor, m_view );
m_functionList = new FunctionListWidget( m_editor );
m_editor->functionListContainer->insertWidget( 0, m_functionList );
m_editor->functionListContainer->setCurrentIndex( 0 );
......@@ -120,8 +121,8 @@ FunctionEditor::FunctionEditor( View * view, KMenu * createNewPlotsMenu, QWidget
connect( w, SIGNAL(currentIndexChanged(int)), this, SLOT(save()) );
//END connect up all editing widgets
connect( m_view->parser(), SIGNAL(functionAdded(int)), this, SLOT(functionsChanged()) );
connect( m_view->parser(), SIGNAL(functionRemoved(int)), this, SLOT(functionsChanged()) );
connect( View::self()->parser(), SIGNAL(functionAdded(int)), this, SLOT(functionsChanged()) );
connect( View::self()->parser(), SIGNAL(functionRemoved(int)), this, SLOT(functionsChanged()) );
m_createNewPlotsMenu->installEventFilter( this );
connect( m_editor->createNewPlot, SIGNAL(pressed()), this, SLOT( createNewPlot() ) );
......@@ -147,7 +148,7 @@ void FunctionEditor::deleteCurrent()
return;
}
if ( !m_view->parser()->delfkt( functionItem->function1() ) )
if ( !View::self()->parser()->delfkt( functionItem->function1() ) )
{
kDebug() << "Couldn't delete function 1.\n";
// couldn't delete it, as e.g. another function depends on it
......@@ -155,11 +156,11 @@ void FunctionEditor::deleteCurrent()
}
kDebug() << "Deleting function 2 status: " <<
m_view->parser()->delfkt( functionItem->function2() ) << endl;
View::self()->parser()->delfkt( functionItem->function2() ) << endl;
kDebug() << "Deleted current, so requestion state save.\n";
m_view->mainDlg()->requestSaveCurrentState();
m_view->drawPlot();
View::self()->mainDlg()->requestSaveCurrentState();
View::self()->drawPlot();
}
......@@ -196,7 +197,7 @@ void FunctionEditor::syncFunctionList()
FunctionListItem * toSelect = 0l;
int newFunctionCount = 0;
for ( QMap<int, Ufkt*>::iterator it = m_view->parser()->m_ufkt.begin(); it != m_view->parser()->m_ufkt.end(); ++it)
for ( QMap<int, Ufkt*>::iterator it = View::self()->parser()->m_ufkt.begin(); it != View::self()->parser()->m_ufkt.end(); ++it)
{
Ufkt * function = *it;
......@@ -220,11 +221,11 @@ void FunctionEditor::syncFunctionList()
if ( function->fstr[0] == 'x' )
{
++it;
assert( it != m_view->parser()->m_ufkt.end() );
assert( it != View::self()->parser()->m_ufkt.end() );
f2 = (*it)->id;
}
toSelect = new FunctionListItem( m_functionList, m_view, f1, f2 );
toSelect = new FunctionListItem( m_functionList, f1, f2 );
newFunctionCount++;
}
......@@ -305,7 +306,7 @@ void FunctionEditor::functionSelected( QListWidgetItem * item )
m_functionX = -1;
m_functionY = -1;
if ( Ufkt * function = m_view->parser()->functionWithID(m_function) )
if ( Ufkt * function = View::self()->parser()->functionWithID(m_function) )
{
QChar prefix = function->fstr[0];
if ( prefix == 'r' )
......@@ -323,7 +324,7 @@ void FunctionEditor::initFromCartesian()
{
// kDebug() << k_funcinfo << endl;
Ufkt * f = m_view->parser()->functionWithID(m_function);
Ufkt * f = View::self()->parser()->functionWithID(m_function);
if ( !f )
{
......@@ -384,7 +385,7 @@ void FunctionEditor::initFromPolar()
{
// kDebug() << k_funcinfo << endl;
Ufkt * f = m_view->parser()->functionWithID(m_function);
Ufkt * f = View::self()->parser()->functionWithID(m_function);
if ( !f )
return;
......@@ -408,8 +409,8 @@ void FunctionEditor::initFromParametric()
{
// kDebug() << k_funcinfo << endl;
Ufkt * fx = m_view->parser()->functionWithID(m_functionX);
Ufkt * fy = m_view->parser()->functionWithID(m_functionY);
Ufkt * fx = View::self()->parser()->functionWithID(m_functionX);
Ufkt * fy = View::self()->parser()->functionWithID(m_functionY);
if ( !fx || !fy )
return;
......@@ -479,19 +480,21 @@ void FunctionEditor::createNewPlot()
void FunctionEditor::createCartesian()
{
KMessageBox::information( this, QString("View::m_self=%1").arg((unsigned long long)View::self()) );
m_function = -1;
m_functionX = -1;
m_functionY = -1;
// find a name not already used
QString fname( "f(x)=0" );
m_view->parser()->fixFunctionName( fname, XParser::Function, -1 );
View::self()->parser()->fixFunctionName( fname, XParser::Function, -1 );
m_function = m_view->parser()->addFunction( fname );
m_function = View::self()->parser()->addFunction( fname );
assert( m_function != -1 );
kDebug() << "Created cartesian, so requestion state save.\n";
m_view->mainDlg()->requestSaveCurrentState();
View::self()->mainDlg()->requestSaveCurrentState();
}
......@@ -503,23 +506,23 @@ void FunctionEditor::createParametric()
// find a name not already used
QString fname;
m_view->parser()->fixFunctionName( fname, XParser::ParametricX, -1 );
View::self()->parser()->fixFunctionName( fname, XParser::ParametricX, -1 );
QString name = fname.mid( 1, fname.indexOf('(')-1 );
kDebug() << "AAA\n";
m_functionX = m_view->parser()->addfkt( QString("x%1(t)=0").arg( name ) );
m_functionX = View::self()->parser()->addfkt( QString("x%1(t)=0").arg( name ) );
assert( m_functionX != -1 );
kDebug() << "BBB\n";
m_functionY = m_view->parser()->addfkt( QString("y%1(t)=0").arg( name ) );
m_functionY = View::self()->parser()->addfkt( QString("y%1(t)=0").arg( name ) );
assert( m_functionY != -1 );
kDebug() << "CCC\n";
kDebug() << "Created parametric, so requestion state save.\n";
m_view->mainDlg()->requestSaveCurrentState();
View::self()->mainDlg()->requestSaveCurrentState();
kDebug() << "DDD\n";
}
......@@ -533,22 +536,22 @@ void FunctionEditor::createPolar()
// find a name not already used
QString fname( "f(x)=0" );
m_view->parser()->fixFunctionName( fname, XParser::Polar, -1 );
View::self()->parser()->fixFunctionName( fname, XParser::Polar, -1 );
m_function = m_view->parser()->addFunction( fname );
m_function = View::self()->parser()->addFunction( fname );
assert( m_function != -1 );
m_view->mainDlg()->requestSaveCurrentState();
View::self()->mainDlg()->requestSaveCurrentState();
}
void FunctionEditor::save()
{
kDebug() << k_funcinfo << endl;
// kDebug() << k_funcinfo << endl;
if ( m_function != -1 )
{
Ufkt * f = m_view->parser()->functionWithID( m_function );
Ufkt * f = View::self()->parser()->functionWithID( m_function );
if ( !f )
return;
......@@ -569,22 +572,22 @@ void FunctionEditor::saveCartesian()
{
kDebug() << k_funcinfo << endl;
Ufkt * f = m_view->parser()->functionWithID( m_function );
Ufkt * f = View::self()->parser()->functionWithID( m_function );
if ( !f )
return;
FunctionListItem * functionListItem = static_cast<FunctionListItem*>(m_functionList->currentItem());
QString f_str( m_editor->cartesianEquation->text() );
m_view->parser()->fixFunctionName(f_str, XParser::Function, f->id );
View::self()->parser()->fixFunctionName(f_str, XParser::Function, f->id );
//all settings are saved here until we know that no errors have appeared
Ufkt tempFunction;
tempFunction.usecustomxmin = m_editor->cartesianCustomMin->isChecked();
tempFunction.str_dmin = m_editor->cartesianMin->text();
tempFunction.dmin = m_view->parser()->eval( tempFunction.str_dmin );
if ( tempFunction.usecustomxmin && m_view->parser()->parserError( false ) != 0)
tempFunction.dmin = View::self()->parser()->eval( tempFunction.str_dmin );
if ( tempFunction.usecustomxmin && View::self()->parser()->parserError( false ) != 0)
{
// showPage(0);
// editfunctionpage->min->setFocus();
......@@ -594,8 +597,8 @@ void FunctionEditor::saveCartesian()
tempFunction.usecustomxmax = m_editor->cartesianCustomMax->isChecked();
tempFunction.str_dmax = m_editor->cartesianMax->text();