[Kst] kdeextragear-2/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Thu Aug 19 20:38:08 CEST 2004
CVS commit by rchern:
Make jumping to plot markers work in xLog mode...
M +33 -7 kst2dplot.cpp 1.233
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.232:1.233
@@ -1982,10 +1982,18 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
#endif
double xmin, xmax;
- double unNeeded;
- getLScale(xmin, unNeeded, xmax, unNeeded);
+ double tempVal;
+ getLScale(xmin, tempVal, xmax, tempVal);
+ double currCenter = ((xmax + xmin)/2.0) + (xmax - xmin)/MARKER_NUM_SEGS;
+ if (_xLog) {
+ currCenter = pow(10, currCenter);
+ }
id = submenu->insertItem(i18n("Next Marker"), this, SLOT(menuNextMarker()), ALT + Key_Right);
- submenu->setItemEnabled(id, nextMarker(((xmax + xmin)/2.0) + (xmax - xmin)/MARKER_NUM_SEGS, unNeeded));
+ submenu->setItemEnabled(id, nextMarker(currCenter, tempVal));
id = submenu->insertItem(i18n("Previous Marker"), this, SLOT(menuPrevMarker()), ALT + Key_Left);
- submenu->setItemEnabled(id, prevMarker(((xmax + xmin)/2.0) - (xmax - xmin)/MARKER_NUM_SEGS, unNeeded));
+ currCenter = ((xmax + xmin)/2.0) - (xmax - xmin)/MARKER_NUM_SEGS;
+ if (_xLog) {
+ currCenter = pow(10, currCenter);
+ }
+ submenu->setItemEnabled(id, prevMarker(currCenter, tempVal) && (!_xLog || tempVal > 0));
@@ -3042,5 +3050,5 @@ void Kst2DPlot::moveToPrevMarker(KstView
void Kst2DPlot::moveSelfToMarker(bool next) {
- double newCenter;
+ double newCenter, currCenter;
double xmin, xmax, ymin, ymax;
double new_xmin, new_xmax;
@@ -3048,5 +3056,12 @@ void Kst2DPlot::moveSelfToMarker(bool ne
getLScale(xmin, ymin, xmax, ymax);
if (next) {
- if (nextMarker(((xmax + xmin) / 2.0) + (xmax - xmin)/MARKER_NUM_SEGS, newCenter)) {
+ currCenter = ((xmax + xmin) / 2.0) + (xmax - xmin)/MARKER_NUM_SEGS;
+ if (_xLog) {
+ currCenter = pow(10, currCenter);
+ }
+ if (nextMarker(currCenter, newCenter)) {
+ if (_xLog) {
+ newCenter = logX(newCenter);
+ }
new_xmin = newCenter - (xmax - xmin)/2.0;
new_xmax = newCenter + (xmax - xmin)/2.0;
@@ -3055,5 +3070,16 @@ void Kst2DPlot::moveSelfToMarker(bool ne
}
} else {
- if (prevMarker(((xmax + xmin) / 2.0) - (xmax - xmin)/MARKER_NUM_SEGS, newCenter)) {
+ currCenter = ((xmax + xmin) / 2.0) - (xmax - xmin)/MARKER_NUM_SEGS;
+ if (_xLog) {
+ currCenter = pow(10, currCenter);
+ }
+ if (prevMarker(currCenter, newCenter)) {
+ if (_xLog) {
+ if (newCenter > 0) {
+ newCenter = logX(newCenter);
+ } else {
+ return; //don't scroll left past 0 in log mode
+ }
+ }
new_xmin = newCenter - (xmax - xmin)/2.0;
new_xmax = newCenter + (xmax - xmin)/2.0;
More information about the Kst
mailing list