|
|
@@ -3,10 +3,10 @@
|
|
|
#include <math.h>
|
|
|
|
|
|
#include "AlphaField.h"
|
|
|
-#include "Image.h"
|
|
|
-#include "MouseEvent.h"
|
|
|
#include "Border.h"
|
|
|
#include "Font.h"
|
|
|
+#include "Image.h"
|
|
|
+#include "MouseEvent.h"
|
|
|
#include "Scroll.h"
|
|
|
#include "Text.h"
|
|
|
#include "ToolTip.h"
|
|
|
@@ -106,8 +106,7 @@ void LiveLineDiagram::addPoint(int lNum, int x, int h) // adds a point
|
|
|
{
|
|
|
ph_tmp->remove(0);
|
|
|
pb_tmp->remove(0);
|
|
|
- if (!pb_tmp->getEntryCount() || !ph_tmp->getEntryCount())
|
|
|
- break;
|
|
|
+ if (!pb_tmp->getEntryCount() || !ph_tmp->getEntryCount()) break;
|
|
|
int ii = -i;
|
|
|
i = pb_tmp->get(0);
|
|
|
i -= ii;
|
|
|
@@ -134,12 +133,12 @@ void LiveLineDiagram::render(Image& zRObj) // draws to zRObj
|
|
|
{
|
|
|
if (hasStyle(Style::Visible))
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockRead();
|
|
|
removeStyle(Style::VScroll | Style::HScroll);
|
|
|
DrawableBackground::render(zRObj);
|
|
|
if (!zRObj.setDrawOptions(innenPosition, innenSize))
|
|
|
{
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockRead();
|
|
|
return;
|
|
|
}
|
|
|
int hv = getHighestValue();
|
|
|
@@ -207,7 +206,7 @@ void LiveLineDiagram::render(Image& zRObj) // draws to zRObj
|
|
|
}
|
|
|
}
|
|
|
zRObj.releaseDrawOptions();
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockRead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -233,7 +232,8 @@ int LiveLineDiagram::getGColor() const // returns the grid color
|
|
|
return gF;
|
|
|
}
|
|
|
|
|
|
-int LiveLineDiagram::getLineNumber(const char* name) const // returns the line number
|
|
|
+int LiveLineDiagram::getLineNumber(
|
|
|
+ const char* name) const // returns the line number
|
|
|
{
|
|
|
for (int i = 0; i < lines; ++i)
|
|
|
{
|
|
|
@@ -367,7 +367,7 @@ DiagramData::~DiagramData()
|
|
|
|
|
|
// Contents of the BaseDiagram class from Diagram.h
|
|
|
// Constructor
|
|
|
-BaseDiagram::BaseDiagram(Critical* lock)
|
|
|
+BaseDiagram::BaseDiagram(ReadWriteLock* lock)
|
|
|
: daten(new DiagramData()),
|
|
|
changed(0),
|
|
|
lock(lock)
|
|
|
@@ -383,16 +383,16 @@ BaseDiagram::~BaseDiagram()
|
|
|
void BaseDiagram::setDiagramDataZ(
|
|
|
DiagramData* dd) // Sets a pointer to the diagram data
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (daten) daten->release();
|
|
|
daten = dd;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setDiagramData(DiagramData* dd) // copies the diagram data
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
daten->style = dd->style;
|
|
|
daten->gridWidth = dd->gridWidth;
|
|
|
@@ -442,122 +442,122 @@ void BaseDiagram::setDiagramData(DiagramData* dd) // copies the diagram data
|
|
|
}
|
|
|
}
|
|
|
dd->release();
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setGridThickness(int d) // set raster thickness
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->rasterDicke != d) changed = 1;
|
|
|
daten->rasterDicke = d;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setGridWidth(int br) // set raster width
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->gridWidth != br) changed = 1;
|
|
|
daten->gridWidth = br;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setGridHeight(int hi) // set raster height
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->rasterHeight != hi) changed = 1;
|
|
|
daten->rasterHeight = hi;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setGridColor(int f) // set raster color
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->rasterColor != f) changed = 1;
|
|
|
daten->rasterColor = f;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setHIntervalWidth(double br) // interval width
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
daten->hIntervalWidth = br;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setVIntervalHeight(double hi) // interval height
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
daten->vIntervalHeight = hi;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setHIntervalColor(int f) // color of the horizontal interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->hIntervalColor != f) changed = 1;
|
|
|
daten->hIntervalColor = f;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setVIntervalColor(int f) // color of the vertical interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (daten->vIntervalColor != f) changed = 1;
|
|
|
daten->vIntervalColor = f;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setHIntervalName(
|
|
|
const char* name) // Sets the name of the horizontal interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->hIntervalName) daten->hIntervalName = new Text();
|
|
|
if (!daten->hIntervalName->isEqual(name)) changed = 1;
|
|
|
daten->hIntervalName->setText(name);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setHIntervalName(Text* name)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->hIntervalName) daten->hIntervalName = new Text();
|
|
|
if (!daten->hIntervalName->isEqual(*name)) changed = 1;
|
|
|
daten->hIntervalName->setText(*name);
|
|
|
name->release();
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setVIntervalName(
|
|
|
const char* name) // Sets the name of the vertical interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->vIntervalName) daten->vIntervalName = new Text();
|
|
|
if (!daten->vIntervalName->isEqual(name)) changed = 1;
|
|
|
daten->vIntervalName->setText(name);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::setVIntervalName(Text* name)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->vIntervalName) daten->vIntervalName = new Text();
|
|
|
if (!daten->vIntervalName->isEqual(*name)) changed = 1;
|
|
|
daten->vIntervalName->setText(*name);
|
|
|
name->release();
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addHIntervalText(double hInterval,
|
|
|
@@ -575,7 +575,7 @@ void BaseDiagram::addHIntervalText(double hInterval, Text* text)
|
|
|
void BaseDiagram::setHIntervalTextZ(double hInterval,
|
|
|
Text* text) // Sets the text of a horizontal interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->hIntervalWerte) daten->hIntervalWerte = new Array<double>();
|
|
|
if (!daten->hIntervalTexte) daten->hIntervalTexte = new RCArray<Text>();
|
|
|
@@ -586,14 +586,14 @@ void BaseDiagram::setHIntervalTextZ(double hInterval,
|
|
|
&& daten->hIntervalWerte->get(i) == hInterval)
|
|
|
{
|
|
|
daten->hIntervalTexte->set(text, i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
daten->hIntervalWerte->set(hInterval, anz);
|
|
|
daten->hIntervalTexte->set(text, anz);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
@@ -605,7 +605,7 @@ void BaseDiagram::setHIntervalText(double hInterval, Text* text)
|
|
|
|
|
|
void BaseDiagram::setHIntervalText(double hInterval, const char* text)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->hIntervalWerte) daten->hIntervalWerte = new Array<double>();
|
|
|
if (!daten->hIntervalTexte) daten->hIntervalTexte = new RCArray<Text>();
|
|
|
@@ -619,21 +619,21 @@ void BaseDiagram::setHIntervalText(double hInterval, const char* text)
|
|
|
daten->hIntervalTexte->set(new Text(text), i);
|
|
|
else
|
|
|
daten->hIntervalTexte->z(i)->setText(text);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
daten->hIntervalWerte->set(hInterval, anz);
|
|
|
daten->hIntervalTexte->set(new Text(text), anz);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removeHIntervalText(
|
|
|
double hInterval) // removes the text of a horizontal interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->hIntervalWerte) daten->hIntervalWerte = new Array<double>();
|
|
|
if (!daten->hIntervalTexte) daten->hIntervalTexte = new RCArray<Text>();
|
|
|
@@ -645,12 +645,12 @@ void BaseDiagram::removeHIntervalText(
|
|
|
{
|
|
|
daten->hIntervalTexte->remove(i);
|
|
|
daten->hIntervalWerte->remove(i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addVIntervalText(double vInterval,
|
|
|
@@ -668,7 +668,7 @@ void BaseDiagram::addVIntervalText(double vInterval, Text* text)
|
|
|
void BaseDiagram::setVIntervalTextZ(
|
|
|
double vInterval, Text* text) // Sets the text of a vertical interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->vIntervalWerte) daten->vIntervalWerte = new Array<double>();
|
|
|
if (!daten->vIntervalTexte) daten->vIntervalTexte = new RCArray<Text>();
|
|
|
@@ -679,14 +679,14 @@ void BaseDiagram::setVIntervalTextZ(
|
|
|
&& daten->vIntervalWerte->get(i) == vInterval)
|
|
|
{
|
|
|
daten->vIntervalTexte->set(text, i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
daten->vIntervalWerte->set(vInterval, anz);
|
|
|
daten->vIntervalTexte->set(text, anz);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
@@ -698,7 +698,7 @@ void BaseDiagram::setVIntervalText(double vInterval, Text* text)
|
|
|
|
|
|
void BaseDiagram::setVIntervalText(double vInterval, const char* text)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->vIntervalWerte) daten->vIntervalWerte = new Array<double>();
|
|
|
if (!daten->vIntervalTexte) daten->vIntervalTexte = new RCArray<Text>();
|
|
|
@@ -712,21 +712,21 @@ void BaseDiagram::setVIntervalText(double vInterval, const char* text)
|
|
|
daten->vIntervalTexte->set(new Text(text), i);
|
|
|
else
|
|
|
daten->vIntervalTexte->z(i)->setText(text);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
daten->vIntervalWerte->set(vInterval, anz);
|
|
|
daten->vIntervalTexte->set(new Text(text), anz);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removeVIntervalText(
|
|
|
double vInterval) // removes the text of a vertical interval
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->vIntervalWerte) daten->vIntervalWerte = new Array<double>();
|
|
|
if (!daten->vIntervalTexte) daten->vIntervalTexte = new RCArray<Text>();
|
|
|
@@ -738,27 +738,27 @@ void BaseDiagram::removeVIntervalText(
|
|
|
{
|
|
|
daten->vIntervalTexte->remove(i);
|
|
|
daten->vIntervalWerte->remove(i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addValueZ(DiagramValue* w) // Adds a value
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
daten->werte->add(w);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addValue(DiagramValue* w)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
DiagramValue* tmp = new DiagramValue();
|
|
|
tmp->style = w->style;
|
|
|
tmp->color = w->color;
|
|
|
@@ -777,19 +777,19 @@ void BaseDiagram::addValue(DiagramValue* w)
|
|
|
}
|
|
|
w->release();
|
|
|
addValueZ(tmp);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addValue(const char* name)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
DiagramValue* w = new DiagramValue();
|
|
|
w->name->setText(name);
|
|
|
daten->werte->add(w);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
@@ -802,19 +802,20 @@ void BaseDiagram::addValue(Text* txt)
|
|
|
void BaseDiagram::setValueColor(int wNum, int f) // sets the color of a value
|
|
|
{
|
|
|
if (wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
daten->werte->z(wNum)->color = f;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
-void BaseDiagram::addPointZ(int wNum, DiagramPoint* p) // adds a point to a value
|
|
|
+void BaseDiagram::addPointZ(
|
|
|
+ int wNum, DiagramPoint* p) // adds a point to a value
|
|
|
{
|
|
|
if (wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
while (!daten->werte->has(wNum))
|
|
|
@@ -822,14 +823,14 @@ void BaseDiagram::addPointZ(int wNum, DiagramPoint* p) // adds a point to a valu
|
|
|
if (!daten->werte->z(wNum)->punkte)
|
|
|
daten->werte->z(wNum)->punkte = new Array<DiagramPoint*>();
|
|
|
daten->werte->z(wNum)->punkte->add(p);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addPoint(int wNum, DiagramPoint* p)
|
|
|
{
|
|
|
if (wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
while (!daten->werte->has(wNum))
|
|
|
@@ -840,14 +841,14 @@ void BaseDiagram::addPoint(int wNum, DiagramPoint* p)
|
|
|
tmp->hInterval = p->hInterval;
|
|
|
tmp->vInterval = p->vInterval;
|
|
|
daten->werte->z(wNum)->punkte->add(tmp);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::addPoint(int wNum, double hI, double vI)
|
|
|
{
|
|
|
if (wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
@@ -857,7 +858,7 @@ void BaseDiagram::addPoint(int wNum, double hI, double vI)
|
|
|
tmp->hInterval = hI;
|
|
|
tmp->vInterval = vI;
|
|
|
daten->werte->z(wNum)->punkte->add(tmp);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
@@ -880,7 +881,7 @@ void BaseDiagram::setPoint(int wNum, double hI, double h, double v)
|
|
|
void BaseDiagram::setPointZ(int wNum, int pNum, DiagramPoint* p)
|
|
|
{
|
|
|
if (pNum < 0 || wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
@@ -889,7 +890,7 @@ void BaseDiagram::setPointZ(int wNum, int pNum, DiagramPoint* p)
|
|
|
if (daten->werte->z(wNum)->punkte->has(pNum))
|
|
|
delete daten->werte->z(wNum)->punkte->get(pNum);
|
|
|
daten->werte->z(wNum)->punkte->set(p, pNum);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
@@ -902,7 +903,7 @@ void BaseDiagram::setPoint(int wNum, int pNum, DiagramPoint* p)
|
|
|
void BaseDiagram::setPoint(int wNum, int pNum, double h, double v)
|
|
|
{
|
|
|
if (pNum < 0 || wNum < 0) return;
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
@@ -912,14 +913,14 @@ void BaseDiagram::setPoint(int wNum, int pNum, double h, double v)
|
|
|
daten->werte->z(wNum)->punkte->set(new DiagramPoint(), pNum);
|
|
|
daten->werte->z(wNum)->punkte->get(pNum)->hInterval = h;
|
|
|
daten->werte->z(wNum)->punkte->get(pNum)->vInterval = v;
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
// Deletes an existing point
|
|
|
void BaseDiagram::removePoint(int wNum, double hI)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
@@ -933,17 +934,17 @@ void BaseDiagram::removePoint(int wNum, double hI)
|
|
|
{
|
|
|
delete daten->werte->z(wNum)->punkte->get(i);
|
|
|
daten->werte->z(wNum)->punkte->remove(i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removePoint(int wNum, int pNum)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
if (!daten->werte->z(wNum)) daten->werte->set(new DiagramValue(), wNum);
|
|
|
@@ -955,22 +956,22 @@ void BaseDiagram::removePoint(int wNum, int pNum)
|
|
|
daten->werte->z(wNum)->punkte->remove(pNum);
|
|
|
changed = 1;
|
|
|
}
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removeValue(int wNum) // removes a value
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
daten->werte->remove(wNum);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removeValue(const char* name)
|
|
|
{
|
|
|
- lock->lock();
|
|
|
+ lock->lockWrite();
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
if (!daten->werte) daten->werte = new RCArray<DiagramValue>();
|
|
|
int anz = daten->werte->getEntryCount();
|
|
|
@@ -980,12 +981,12 @@ void BaseDiagram::removeValue(const char* name)
|
|
|
if (tmp && tmp->name && tmp->name->isEqual(name))
|
|
|
{
|
|
|
daten->werte->remove(i);
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
changed = 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- lock->unlock();
|
|
|
+ lock->unlockWrite();
|
|
|
}
|
|
|
|
|
|
void BaseDiagram::removeValue(Text* name)
|
|
|
@@ -1023,7 +1024,8 @@ void BaseDiagram::removeDataStyle(int style)
|
|
|
daten->style &= ~style;
|
|
|
}
|
|
|
|
|
|
-void BaseDiagram::addValueStyle(int wNum, int style) // Sets the style of a value
|
|
|
+void BaseDiagram::addValueStyle(
|
|
|
+ int wNum, int style) // Sets the style of a value
|
|
|
{
|
|
|
if (wNum < 0) return;
|
|
|
if (!daten) daten = new DiagramData();
|
|
|
@@ -1072,7 +1074,8 @@ DiagramData* BaseDiagram::zDiagramData() const
|
|
|
return daten;
|
|
|
}
|
|
|
|
|
|
-DiagramValue* BaseDiagram::getDiagramValue(int wNum) const // Returns the data of a value
|
|
|
+DiagramValue* BaseDiagram::getDiagramValue(
|
|
|
+ int wNum) const // Returns the data of a value
|
|
|
{
|
|
|
return (daten && daten->werte) ? daten->werte->get(wNum) : 0;
|
|
|
}
|
|
|
@@ -1158,7 +1161,7 @@ bool BaseDiagram::hasValueStyleNot(int wNum, int style) const
|
|
|
// Constructor
|
|
|
LineDiagram::LineDiagram()
|
|
|
: DrawableBackground(),
|
|
|
- BaseDiagram(&cs),
|
|
|
+ BaseDiagram(&rwLock),
|
|
|
textRd(0),
|
|
|
dRam(new LBorder()),
|
|
|
dBgF(0),
|
|
|
@@ -1168,7 +1171,7 @@ LineDiagram::LineDiagram()
|
|
|
hIntervalRB(new Image()),
|
|
|
fontGr(12)
|
|
|
{
|
|
|
- style = Style::MELockDrawable;
|
|
|
+ style = 0;
|
|
|
vertikalScrollBar = new VScrollBar();
|
|
|
horizontalScrollBar = new HScrollBar();
|
|
|
}
|
|
|
@@ -1211,68 +1214,68 @@ void LineDiagram::doMouseEvent(MouseEvent& me, bool userRet)
|
|
|
// non-constant
|
|
|
void LineDiagram::setTextRendererZ(TextRenderer* textRd)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (this->textRd) this->textRd->release();
|
|
|
this->textRd = textRd;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setFontZ(Font* font) // Sets the font
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!this->textRd)
|
|
|
textRd = new TextRenderer(font);
|
|
|
else
|
|
|
textRd->setFontZ(font);
|
|
|
rend = 1;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setFontSize(int gr)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (fontGr != gr) rend = 1;
|
|
|
fontGr = gr;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataBorderZ(
|
|
|
Border* ram) // Sets the inner border around the actual diagram
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (dRam) dRam->release();
|
|
|
dRam = ram;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataBorder(Border* ram)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dRam) dRam = new LBorder();
|
|
|
dRam->setAlpha(ram->hasAlpha());
|
|
|
dRam->setColor(ram->getColor());
|
|
|
dRam->setBorderWidth(ram->getRWidth());
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
ram->release();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataBorderWidth(int br)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dRam) dRam = new LBorder();
|
|
|
if (dRam->getRWidth() != br) rend = 1;
|
|
|
dRam->setBorderWidth(br);
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataBorderColor(int f)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dRam) dRam = new LBorder();
|
|
|
dRam->setColor(f);
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
@@ -1285,20 +1288,20 @@ void LineDiagram::setDataBackgroundColor(
|
|
|
|
|
|
void LineDiagram::setDataBackgroundImageZ(Image* b)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (dBgB) dBgB->release();
|
|
|
dBgB = b;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataBackgroundImage(Image* b)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dBgB) dBgB = new Image();
|
|
|
dBgB->newImage(b->getWidth(), b->getHeight(), 0);
|
|
|
dBgB->drawImage(0, 0, b->getWidth(), b->getHeight(), *b);
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
b->release();
|
|
|
rend = 1;
|
|
|
}
|
|
|
@@ -1306,40 +1309,40 @@ void LineDiagram::setDataBackgroundImage(Image* b)
|
|
|
void LineDiagram::setDataAlphaFieldZ(
|
|
|
AlphaField* af) // Sets the AlphaField of the actual diagram
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (dAf) dAf->release();
|
|
|
dAf = af;
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataAlphaField(AlphaField* af)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dAf) dAf = new AlphaField();
|
|
|
dAf->setColor(af->getColor());
|
|
|
dAf->setStrength(af->getStrength());
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
af->release();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataAlphaFieldColor(int f)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dAf) dAf = new AlphaField();
|
|
|
dAf->setColor(f);
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
void LineDiagram::setDataAlphaFieldStrength(int st)
|
|
|
{
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockWrite();
|
|
|
if (!dAf) dAf = new AlphaField();
|
|
|
if (dAf->getStrength() != st) rend = 1;
|
|
|
dAf->setStrength(st);
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockWrite();
|
|
|
}
|
|
|
|
|
|
void LineDiagram::render(Image& zRObj)
|
|
|
@@ -1347,7 +1350,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
if (!hasDataStyle(DiagramData::Style::Visible)) return;
|
|
|
DrawableBackground::render(zRObj);
|
|
|
if (!zRObj.setDrawOptions(innenPosition, innenSize)) return;
|
|
|
- lockDrawable();
|
|
|
+ rwLock.lockRead();
|
|
|
int dgy = 0;
|
|
|
int dgbr = innenSize.x;
|
|
|
int dghi = innenSize.y;
|
|
|
@@ -1355,12 +1358,10 @@ void LineDiagram::render(Image& zRObj)
|
|
|
int hIAnz = 0;
|
|
|
if (daten)
|
|
|
{ // calculating auto values
|
|
|
- vIAnz = daten->vIntervalWerte
|
|
|
- ? daten->vIntervalWerte->getEntryCount()
|
|
|
- : 0;
|
|
|
- hIAnz = daten->hIntervalWerte
|
|
|
- ? daten->hIntervalWerte->getEntryCount()
|
|
|
- : 0;
|
|
|
+ vIAnz = daten->vIntervalWerte ? daten->vIntervalWerte->getEntryCount()
|
|
|
+ : 0;
|
|
|
+ hIAnz = daten->hIntervalWerte ? daten->hIntervalWerte->getEntryCount()
|
|
|
+ : 0;
|
|
|
if (daten->vIntervalWerte
|
|
|
&& hasDataStyle(DiagramData::Style::AutoIntervalHeight))
|
|
|
{
|
|
|
@@ -1413,8 +1414,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
|| vIntervalRB->getHeight() != fontGr + 2)
|
|
|
vIntervalRB->newImage(vIRBbr, fontGr + 2, 0xFF000000);
|
|
|
else
|
|
|
- vIntervalRB->fillRegion(
|
|
|
- 0, 0, vIRBbr, fontGr + 2, 0xFF000000);
|
|
|
+ vIntervalRB->fillRegion(0, 0, vIRBbr, fontGr + 2, 0xFF000000);
|
|
|
textRd->setFontSize(fontGr);
|
|
|
if (daten->vIntervalWerte)
|
|
|
{
|
|
|
@@ -1453,8 +1453,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
&& daten->vIntervalTexte
|
|
|
&& daten->vIntervalTexte->z(rf[i]))
|
|
|
txt = daten->vIntervalTexte->z(rf[i])->getText();
|
|
|
- else if (hasDataStyleNot(
|
|
|
- DiagramData::Style::VIntervalTexte)
|
|
|
+ else if (hasDataStyleNot(DiagramData::Style::VIntervalTexte)
|
|
|
|| !daten->vIntervalWerte)
|
|
|
txt = daten->vIntervalWerte->get(rf[i]);
|
|
|
xPos = (int)(daten->vIntervalWerte->get(rf[i])
|
|
|
@@ -1471,11 +1470,8 @@ void LineDiagram::render(Image& zRObj)
|
|
|
xPos = vIntervalRB->getWidth() - br;
|
|
|
if (xPos >= rWeite + 10)
|
|
|
{
|
|
|
- textRd->renderText(xPos,
|
|
|
- 1,
|
|
|
- txt,
|
|
|
- *vIntervalRB,
|
|
|
- daten->vIntervalColor);
|
|
|
+ textRd->renderText(
|
|
|
+ xPos, 1, txt, *vIntervalRB, daten->vIntervalColor);
|
|
|
rWeite = xPos + br + 10;
|
|
|
}
|
|
|
}
|
|
|
@@ -1523,8 +1519,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
|| hIntervalRB->getHeight() != fontGr + 2)
|
|
|
hIntervalRB->newImage(hIRBbr, fontGr + 2, 0xFF000000);
|
|
|
else
|
|
|
- hIntervalRB->fillRegion(
|
|
|
- 0, 0, hIRBbr, fontGr + 2, 0xFF000000);
|
|
|
+ hIntervalRB->fillRegion(0, 0, hIRBbr, fontGr + 2, 0xFF000000);
|
|
|
textRd->setFontSize(fontGr);
|
|
|
if (daten->hIntervalWerte)
|
|
|
{
|
|
|
@@ -1563,8 +1558,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
&& daten->hIntervalTexte
|
|
|
&& daten->hIntervalTexte->z(rf[i]))
|
|
|
txt = daten->hIntervalTexte->z(rf[i])->getText();
|
|
|
- else if (hasDataStyleNot(
|
|
|
- DiagramData::Style::HIntervalTexte)
|
|
|
+ else if (hasDataStyleNot(DiagramData::Style::HIntervalTexte)
|
|
|
|| !daten->hIntervalWerte)
|
|
|
txt = daten->hIntervalWerte->get(rf[i]);
|
|
|
xPos = (int)(daten->hIntervalWerte->get(rf[i])
|
|
|
@@ -1577,11 +1571,8 @@ void LineDiagram::render(Image& zRObj)
|
|
|
xPos = hIntervalRB->getWidth() - br;
|
|
|
if (xPos >= rWeite + 10)
|
|
|
{
|
|
|
- textRd->renderText(xPos,
|
|
|
- 1,
|
|
|
- txt,
|
|
|
- *hIntervalRB,
|
|
|
- daten->hIntervalColor);
|
|
|
+ textRd->renderText(
|
|
|
+ xPos, 1, txt, *hIntervalRB, daten->hIntervalColor);
|
|
|
rWeite = xPos + br + 10;
|
|
|
}
|
|
|
}
|
|
|
@@ -1612,7 +1603,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
if (!zRObj.setDrawOptions(0, dgy, dgbr, dghi))
|
|
|
{
|
|
|
zRObj.releaseDrawOptions();
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockRead();
|
|
|
return;
|
|
|
}
|
|
|
dgy = 0;
|
|
|
@@ -1627,7 +1618,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
{
|
|
|
zRObj.releaseDrawOptions();
|
|
|
zRObj.releaseDrawOptions();
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockRead();
|
|
|
return;
|
|
|
}
|
|
|
if (hasStyle(Style::DataBackground))
|
|
|
@@ -1642,7 +1633,8 @@ void LineDiagram::render(Image& zRObj)
|
|
|
zRObj.alphaImage(
|
|
|
0, 0, dgbr - dgrbr * 2, dghi - dgrbr * 2, *dBgB);
|
|
|
else
|
|
|
- zRObj.drawImage(0, 0, dgbr - dgrbr * 2, dghi - dgrbr * 2, *dBgB);
|
|
|
+ zRObj.drawImage(
|
|
|
+ 0, 0, dgbr - dgrbr * 2, dghi - dgrbr * 2, *dBgB);
|
|
|
}
|
|
|
}
|
|
|
if (hasStyle(Style::DataBuffered) && dAf)
|
|
|
@@ -1776,7 +1768,8 @@ void LineDiagram::render(Image& zRObj)
|
|
|
double y = (double)ay;
|
|
|
ax = ax < 0 ? 0 : ax;
|
|
|
bx = bx > dgbr - dgrbr ? dgbr - dgrbr : bx;
|
|
|
- if (hasValueStyle(i, DiagramValue::Style::HAlpha))
|
|
|
+ if (hasValueStyle(
|
|
|
+ i, DiagramValue::Style::HAlpha))
|
|
|
{
|
|
|
for (int x = ax; x < bx; x++, y += yf)
|
|
|
zRObj.drawLineVAlpha(x,
|
|
|
@@ -1792,7 +1785,8 @@ void LineDiagram::render(Image& zRObj)
|
|
|
dgmhi - (int)(y + 0.5),
|
|
|
wert->background);
|
|
|
}
|
|
|
- if (hasValueStyle(i, DiagramValue::Style::Alpha))
|
|
|
+ if (hasValueStyle(
|
|
|
+ i, DiagramValue::Style::Alpha))
|
|
|
zRObj.drawLineAlpha(Point(ax, ay),
|
|
|
Point(bx, by),
|
|
|
wert->color);
|
|
|
@@ -1816,34 +1810,30 @@ void LineDiagram::render(Image& zRObj)
|
|
|
{
|
|
|
if (hasValueStyle(i, DiagramValue::Style::Alpha))
|
|
|
zRObj.drawLineAlpha(
|
|
|
- Point(
|
|
|
- (int)(rpx
|
|
|
- + vorher->hInterval
|
|
|
- * daten->hIntervalWidth),
|
|
|
+ Point((int)(rpx
|
|
|
+ + vorher->hInterval
|
|
|
+ * daten->hIntervalWidth),
|
|
|
(int)(dgmhi
|
|
|
- vorher->vInterval
|
|
|
* daten->vIntervalHeight)),
|
|
|
- Point(
|
|
|
- (int)(rpx
|
|
|
- + jetzt->hInterval
|
|
|
- * daten->hIntervalWidth),
|
|
|
+ Point((int)(rpx
|
|
|
+ + jetzt->hInterval
|
|
|
+ * daten->hIntervalWidth),
|
|
|
(int)(dgmhi
|
|
|
- jetzt->vInterval
|
|
|
* daten->vIntervalHeight)),
|
|
|
wert->color);
|
|
|
else
|
|
|
zRObj.drawLine(
|
|
|
- Point(
|
|
|
- (int)(rpx
|
|
|
- + vorher->hInterval
|
|
|
- * daten->hIntervalWidth),
|
|
|
+ Point((int)(rpx
|
|
|
+ + vorher->hInterval
|
|
|
+ * daten->hIntervalWidth),
|
|
|
(int)(dgmhi
|
|
|
- vorher->vInterval
|
|
|
* daten->vIntervalHeight)),
|
|
|
- Point(
|
|
|
- (int)(rpx
|
|
|
- + jetzt->hInterval
|
|
|
- * daten->hIntervalWidth),
|
|
|
+ Point((int)(rpx
|
|
|
+ + jetzt->hInterval
|
|
|
+ * daten->hIntervalWidth),
|
|
|
(int)(dgmhi
|
|
|
- jetzt->vInterval
|
|
|
* daten->vIntervalHeight)),
|
|
|
@@ -1879,7 +1869,7 @@ void LineDiagram::render(Image& zRObj)
|
|
|
zRObj.releaseDrawOptions();
|
|
|
zRObj.releaseDrawOptions();
|
|
|
zRObj.releaseDrawOptions();
|
|
|
- unlockDrawable();
|
|
|
+ rwLock.unlockRead();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
@@ -1930,8 +1920,8 @@ Image* LineDiagram::zDataBackgroundImage() const
|
|
|
return dBgB;
|
|
|
}
|
|
|
|
|
|
-AlphaField*
|
|
|
-LineDiagram::getDataAlphaField() const // Returns the AlphaField of the actual diagram
|
|
|
+AlphaField* LineDiagram::getDataAlphaField()
|
|
|
+ const // Returns the AlphaField of the actual diagram
|
|
|
{
|
|
|
return dAf ? dynamic_cast<AlphaField*>(dAf->getThis()) : 0;
|
|
|
}
|