Skip to content

Commit

Permalink
Let Marker::paint() handle (non-)painting of hidden markers
Browse files Browse the repository at this point in the history
  • Loading branch information
in3otd authored and felix-salfelder committed Jul 16, 2018
1 parent 4764972 commit a231efb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qucs/qucs/diagrams/diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void Diagram::paint(ViewPainter *p)
// draw markers last, so they are at the top of painting layers
foreach(Graph *pg, Graphs)
foreach(Marker *pm, pg->Markers)
if (!pm->isHidden) pm->paint(p, cx, cy);
pm->paint(p, cx, cy);
}

// ------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions qucs/qucs/diagrams/marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ bool Marker::moveUpDown(bool up)
// ---------------------------------------------------------------------
void Marker::paint(ViewPainter *p, int x0, int y0)
{
if (hidden) // marker is hidden
return; // don't paint it

// keep track of painter state
p->Painter->save();

Expand Down
4 changes: 3 additions & 1 deletion qucs/qucs/diagrams/marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class Marker : public Element {
std::vector<double> const& varPos() const {return VarPos;}
const Diagram *diag() const;

void hide() {hidden = true;};
void unHide() {hidden = false;};
public: // power matching stuff. some sort of VarPos (ab?)use
double powFreq() const {return VarPos[0];}
double powReal() const {return VarDep[0];}
Expand All @@ -77,12 +79,12 @@ class Marker : public Element {
std::vector<double> VarPos; // values the marker is pointing to
double VarDep[2]; // dependent value
float fCX, fCY; // coordinates for the line from graph to marker body
bool hidden = false; // to hide marker while printing, if not selected

public:
QString Text; // the string to be displayed in the marker text
bool transparent; // background shines through marker body
Axis const*xA,*yA,*zA;
bool isHidden = false; // to hide marker while printing, if not selected

// private: // not yet, cross-manipulated by MarkerDialog
int Precision; // number of digits to show
Expand Down
4 changes: 2 additions & 2 deletions qucs/qucs/schematic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ void Schematic::paintSchToViewpainter(ViewPainter *p, bool printAll, bool toImag
} else {
if (!printAll)
// if not printing all, hide non-selected markers
pm->isHidden = true;
pm->hide();
}
pm->isSelected = false;
}
Expand All @@ -723,7 +723,7 @@ void Schematic::paintSchToViewpainter(ViewPainter *p, bool printAll, bool toImag
foreach(Marker *pm, pg->Markers) {
if(pm->Type & 1) pm->isSelected = true;
pm->Type &= -2;
pm->isHidden = false; // make all markers visible again
pm->unHide(); // make all markers visible again
}
}
}
Expand Down

0 comments on commit a231efb

Please sign in to comment.