Commit c6d428de authored by Fredrik Edemar's avatar Fredrik Edemar

* Fix the popup menu for parametric functions single points.

* Don't let the default color disappear when adding/changing a function.

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

svn path=/trunk/kdeedu/kmplot/; revision=322070
parent 3332a402
......@@ -22,14 +22,12 @@ TODO for KDE 3.3
* Printing (pipesmoker)
- different paper sizes
* What-is-this for the new stuff
* Delete functions (parametric functions) properly
IN PROGRESS
=========================
* Configure Dialog for global Settings / save as default Checkboxes (Started)
* Import parameter values from different file format(.csv, KSpread, OpenOffice) via Koffice (see kde-edu/kig)
* Basic popup menu for single parametric points.
DONE
......@@ -72,4 +70,5 @@ DONE
* Fix scaling
* Change icon when zooming
* Ability to print background color
* Four modes for zooming.
\ No newline at end of file
* Four modes for zooming.
* Basic popup menu for single parametric points.
\ No newline at end of file
......@@ -825,35 +825,35 @@ void View::mousePressEvent(QMouseEvent *e)
m_parser->setparameter(ix, m_parser->fktext[ix].k_liste[k]);
else
m_parser->setparameter(ix, sliders[ m_parser->fktext[ix].use_slider ]->slider->value() );
if ( function_type=='x' && m_parser->fktext[ix].extstr.contains('t')==1) //parametric plot
if ( function_type=='x' && fabs(csxpos-m_parser->fkt(ix, csxpos))< g && m_parser->fktext[ix].extstr.contains('t')==1) //parametric plot
{
int y_index = ix+1;
if ( y_index == UFANZ)
y_index=0;
//kdDebug() << "y: " << m_parser->fkt(y_index, csypos) << endl;
if (fabs(csxpos-m_parser->fkt(ix, csxpos))< g && fabs(csypos-m_parser->fkt(y_index, csypos))<g )
if (fabs(csypos-m_parser->fkt(y_index, csxpos))<g && m_parser->fktext[y_index].extstr.contains('t')==1)
{
if ( csmode == -1)
{
csmode=ix;
cstype=0;
csparam = k;
m_popupmenushown = 1;
}
else
m_popupmenushown = 2;
QString y_name( m_parser->fktext[y_index].extstr );
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-1),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-2),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-3),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-4),false);
m_popupmenu->changeTitle(10, m_parser->fktext[ ix ].extstr+";"+y_name);
m_popupmenu->exec(QCursor::pos());
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-1),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-2),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-3),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-4),true);
return;
if ( csmode == -1)
{
csmode=ix;
cstype=0;
csparam = k;
m_popupmenushown = 1;
}
else
m_popupmenushown = 2;
QString y_name( m_parser->fktext[y_index].extstr );
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-1),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-2),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-3),false);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-4),false);
m_popupmenu->changeTitle(10, m_parser->fktext[ ix ].extstr+";"+y_name);
m_popupmenu->exec(QCursor::pos());
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-1),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-2),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-3),true);
m_popupmenu->setItemEnabled(m_popupmenu->idAt(m_popupmenu->count()-4),true);
return;
}
}
if(fabs(csypos-m_parser->fkt(ix, csxpos))< g && m_parser->fktext[ix].f_mode)
......
......@@ -367,6 +367,7 @@ void EditFunction::accept()
return;
}
tmp_fktext.color0 = m_parser->fktext[index].color0;
m_parser->fktext[index] = tmp_fktext;
editfunctionpage->equation->setText(f_str);
......
......@@ -193,6 +193,7 @@ void KEditParametric::accept()
tmp_fktext.use_slider = -1;
tmp_fktext.k_anz = 0;
tmp_fktext.color0 = m_parser->fktext[index].color0;
m_parser->fktext[index] = tmp_fktext;
if( m_y_index != -1 ) //when editing a function:
......@@ -223,6 +224,7 @@ void KEditParametric::accept()
return;
}
tmp_fktext.extstr = yFunction();
tmp_fktext.color0 = m_parser->fktext[index].color0;
m_parser->fktext[index] = tmp_fktext;
......
......@@ -110,6 +110,7 @@ void KEditPolar::accept()
m_parser->fixFunctionName(f_str);
f_str.prepend("r");
index = m_parser->addfkt(f_str );
kdDebug() << "index: " << index << endl;
}
if( index == -1 )
......@@ -178,6 +179,7 @@ void KEditPolar::accept()
tmp_fktext.use_slider = -1;
tmp_fktext.k_anz=0;
tmp_fktext.color0 = m_parser->fktext[index].color0;
m_parser->fktext[index] = tmp_fktext;
kLineEditYFunction->setText(f_str);
......
......@@ -166,7 +166,6 @@ int XParser::delfkt( int ix )
fktext[ ix ].k_anz = 0;
fktext[ ix ].dmin = fktext[ ix ].dmax = 0.;
fktext[ ix ].extstr = ""; //.resize(1);
// fktext[ ix ].color = fktext[ ix ].color0;
return ix;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment