Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
LabPlot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Education
LabPlot
Commits
ae3d6663
Commit
ae3d6663
authored
Apr 04, 2008
by
Stefan Gerlach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ACCESS functions, using elements classes
parent
ab50b012
Changes
40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
1184 additions
and
1918 deletions
+1184
-1918
CMakeLists.txt
CMakeLists.txt
+4
-2
ChangeLog
ChangeLog
+2
-0
clean
clean
+3
-1
src/Axis.cc
src/Axis.cc
+0
-267
src/Axis.h
src/Axis.h
+0
-96
src/Label.cc
src/Label.cc
+0
-332
src/Label.h
src/Label.h
+0
-57
src/MainWin.cc
src/MainWin.cc
+6
-6
src/Makefile
src/Makefile
+135
-75
src/Plot.cc
src/Plot.cc
+33
-33
src/Plot2D.cc
src/Plot2D.cc
+187
-187
src/Plot2DSimple.cc
src/Plot2DSimple.cc
+143
-144
src/Point.cc
src/Point.cc
+7
-7
src/Point.h
src/Point.h
+5
-5
src/Project.cc
src/Project.cc
+22
-22
src/Project.h
src/Project.h
+12
-12
src/ProjectDialog.cc
src/ProjectDialog.cc
+8
-8
src/Range.cc
src/Range.cc
+3
-3
src/Range.h
src/Range.h
+4
-4
src/Set.cc
src/Set.cc
+5
-6
src/Set.h
src/Set.h
+18
-17
src/Set2D.cc
src/Set2D.cc
+12
-12
src/Set2D.h
src/Set2D.h
+6
-6
src/Spreadsheet.cc
src/Spreadsheet.cc
+10
-10
src/Style.cc
src/Style.cc
+11
-11
src/Style.h
src/Style.h
+18
-18
src/Symbol.cc
src/Symbol.cc
+432
-432
src/Symbol.h
src/Symbol.h
+9
-9
src/Worksheet.cc
src/Worksheet.cc
+1
-1
src/definitions.h
src/definitions.h
+14
-10
src/defs.h
src/defs.h
+0
-16
src/elements/Axis.h
src/elements/Axis.h
+47
-51
src/elements/Label.h
src/elements/Label.h
+10
-10
src/elements/Legend.h
src/elements/Legend.h
+7
-7
src/gui/AxesDialog.cc
src/gui/AxesDialog.cc
+1
-1
src/gui/AxesWidget.cc
src/gui/AxesWidget.cc
+5
-5
src/gui/LabelWidget.cc
src/gui/LabelWidget.cc
+4
-4
src/scale.h
src/scale.h
+0
-11
src/settype.h
src/settype.h
+0
-10
src/tickformat.h
src/tickformat.h
+0
-10
No files found.
CMakeLists.txt
View file @
ae3d6663
...
...
@@ -51,6 +51,8 @@ IF (GSL_FOUND)
ELSE
(
GSL_FOUND
)
MESSAGE
(
STATUS
"GNU Scientific Library not found. "
"LabPlot will be build without GSL suppot."
)
SET
(
GSL_LIBRARIES
""
)
SET
(
GSL_CBLAS_LIBRARIES
""
)
ENDIF
(
GSL_FOUND
)
### HDF5 #####################################
...
...
@@ -97,8 +99,8 @@ IF(OPJ_LIBRARY)
MESSAGE
(
"-- Found liborigin library:
${
OPJ_LIBRARY
}
"
)
ELSE
(
OPJ_LIBRARY
)
MESSAGE
(
"-- System OPJ library not found! Using included version."
)
#
add_subdirectory(liborigin)
SET
(
OPJ_LIBRARY
"-L../lib
origin
-lorigin"
)
add_subdirectory
(
liborigin
)
SET
(
OPJ_LIBRARY
"-L../lib -lorigin"
)
ENDIF
(
OPJ_LIBRARY
)
##############################################
...
...
ChangeLog
View file @
ae3d6663
2008-04-03 fixed ACCESS functions
using elements/classes
2008-04-01 first versions of Function-, Legend-, Title-Dialogs/Widgets uploaded
src/elements created
2008-03-30 started with open/save projects
...
...
clean
View file @
ae3d6663
make clean
rm -rf CMakeFiles CMakeTmp src/CMakeFiles
rm -rf CMakeFiles CMakeTmp src/CMakeFiles
liborigin/CMakeFiles
rm -f Makefile CMakeCache.txt cmake_install.cmake cmake_uninstall.cmake install_manifest.txt
rm -f src/LabPlot_automoc.cpp src/LabPlot_automoc.cpp.files src/cmake_install.cmake
rm -f src/LabPlot src/LabPlot.shell src/moc_* src/ui_* src/parser.tab.c
rm -rf lib/ liborigin/opj2dat
src/Axis.cc
deleted
100644 → 0
View file @
ab50b012
//LabPlot: Axis.cc
#include <KDebug>
#include "Axis.h"
//! general axis class
Axis
::
Axis
()
{
kDebug
()
<<
"Axis()"
<<
endl
;
label
=
new
Label
();
scale
=
LINEAR
;
position
=
0
;
scaling
=
1
;
shift
=
0
;
enabled
=
true
;
ticktype
=
1
;
ticklabelrotation
=
0
;
ticklabelprefix
=
QString
(
""
);
ticklabelsuffix
=
QString
(
""
);
tickfont
=
QFont
(
QString
(
"Adobe Times"
),
12
);
tickcolor
=
QColor
(
"black"
);
ticklabelcolor
=
QColor
(
"black"
);
bordercolor
=
QColor
(
"black"
);
minorgridcolor
=
QColor
(
"black"
);
majorgridcolor
=
QColor
(
"black"
);
majorticks
=
-
1
;
// default ("auto")
minorticks
=
3
;
majorticks_enabled
=
true
;
minorticks_enabled
=
true
;
ticklabel_enabled
=
true
;
ticklabelformat
=
AUTO
;
datetimeformat
=
"auto"
;
ticklabelprecision
=
3
;
tickposition
=
0
;
gap
=
15
;
majorgridtype
=
Qt
::
DashLine
;
minorgridtype
=
Qt
::
DotLine
;
majortickwidth
=
minortickwidth
=
1
;
borderwidth
=
1
;
majorgridwidth
=
minorgridwidth
=
1
;
border_enabled
=
true
;
majorgrid_enabled
=
false
;
minorgrid_enabled
=
false
;
}
/*void Axis::setLabel(Label *l) {
if(label != 0 && l != 0)
delete label;
label=l;
}
void Axis::centerX(int plotsize, double center) {
int length = label->Length();
// kDebug()<<"LENGTH = "<<length<<endl;
// kDebug()<<"PLOTSIZE = "<<plotsize<<endl;
// kDebug()<<"CENTER = "<<center<<endl;
double nx = center - length/(2.0*plotsize);
kDebug()<<"NX="<<nx<<endl;
label->setX(nx);
}
void Axis::centerY(int plotsize, double center) {
int length = label->Length();
// kDebug()<<"LENGTH = "<<length<<endl;
// kDebug()<<"PLOTSIZE = "<<plotsize<<endl;
// kDebug()<<"CENTER = "<<center<<endl;
double ny = center + length/(2.0*plotsize);
kDebug()<<"NY="<<ny<<endl;
label->setY(ny);
}
QDomElement Axis::saveXML(QDomDocument doc, int id) {
QDomElement axistag = doc.createElement( "Axis" );
axistag.setAttribute("id",QString::number(id));
QDomElement tag = doc.createElement( "Enabled" );
axistag.appendChild( tag );
QDomText t = doc.createTextNode( QString::number(enabled) );
tag.appendChild( t );
tag = doc.createElement( "Scale" );
axistag.appendChild( tag );
t = doc.createTextNode( QString::number(scale) );
tag.appendChild( t );
tag = doc.createElement( "Position" );
axistag.appendChild( tag );
t = doc.createTextNode( QString::number(position) );
tag.appendChild( t );
tag = doc.createElement( "Scaling" );
axistag.appendChild( tag );
t = doc.createTextNode( QString::number(scaling) );
tag.appendChild( t );
tag = doc.createElement( "Shift" );
axistag.appendChild( tag );
t = doc.createTextNode( QString::number(shift) );
tag.appendChild( t );
tag = doc.createElement( "Border" );
tag.setAttribute("enabled",QString::number(border_enabled));
tag.setAttribute("width",QString::number(borderwidth));
tag.setAttribute("color",bordercolor.name());
axistag.appendChild( tag );
tag = doc.createElement( "MajorGrid" );
tag.setAttribute("enabled",QString::number(majorgrid_enabled));
tag.setAttribute("width",QString::number(majorgridwidth));
tag.setAttribute("color",majorgridcolor.name());
tag.setAttribute("style",QString::number(majorgridtype));
axistag.appendChild( tag );
tag = doc.createElement( "MinorGrid" );
tag.setAttribute("enabled",QString::number(minorgrid_enabled));
tag.setAttribute("width",QString::number(minorgridwidth));
tag.setAttribute("color",minorgridcolor.name());
tag.setAttribute("style",QString::number(minorgridtype));
axistag.appendChild( tag );
tag = doc.createElement( "MajorTicks" );
tag.setAttribute("enabled",QString::number(majorticks_enabled));
tag.setAttribute("position",QString::number(tickpos));
tag.setAttribute("type",QString::number(ticktype));
tag.setAttribute("nr",QString::number(majorticks));
tag.setAttribute("width",QString::number(majortickwidth));
tag.setAttribute("color",tickcolor.name());
tag.setAttribute("length",QString::number(majorticklength));
axistag.appendChild( tag );
tag = doc.createElement( "MinorTicks" );
tag.setAttribute("enabled",QString::number(minorticks_enabled));
tag.setAttribute("nr",QString::number(minorticks));
tag.setAttribute("width",QString::number(minorTickWidth()));
tag.setAttribute("length",QString::number(minorticklength));
axistag.appendChild( tag );
QDomElement ticktag = doc.createElement( "TickLabel" );
ticktag.setAttribute("enabled",QString::number(ticklabel_enabled));
axistag.appendChild( ticktag );
tag = doc.createElement( "Prefix" );
ticktag.appendChild( tag );
t = doc.createTextNode( ticklabelprefix );
tag.appendChild( t );
tag = doc.createElement( "Suffix" );
ticktag.appendChild( tag );
t = doc.createTextNode( ticklabelsuffix );
tag.appendChild( t );
tag = doc.createElement( "Font" );
tag.setAttribute("family",tickfont.family());
tag.setAttribute("pointsize",tickfont.pointSize());
tag.setAttribute("weight",tickfont.weight());
tag.setAttribute("italic",tickfont.italic());
ticktag.appendChild( tag );
tag = doc.createElement( "Rotation" );
ticktag.appendChild( tag );
t = doc.createTextNode( QString::number(ticklabelrotation) );
tag.appendChild( t );
tag = doc.createElement( "Position" );
ticktag.appendChild( tag );
t = doc.createTextNode( QString::number(gap) );
tag.appendChild( t );
tag = doc.createElement( "Color" );
ticktag.appendChild( tag );
t = doc.createTextNode( ticklabelcolor.name() );
tag.appendChild( t );
tag = doc.createElement( "Format" );
ticktag.appendChild( tag );
t = doc.createTextNode( QString::number(ticklabelformat) );
tag.appendChild( t );
tag = doc.createElement( "Precision" );
ticktag.appendChild( tag );
t = doc.createTextNode( QString::number(ticklabelprecision) );
tag.appendChild( t );
tag = doc.createElement( "DatetimeFormat" );
ticktag.appendChild( tag );
t = doc.createTextNode( datetimeformat );
tag.appendChild( t );
tag = label->saveXML(doc);
axistag.appendChild( tag );
return axistag;
}
void Axis::openXML(QDomNode node) {
kDebug()<<"Axis::openXML()"<<endl;
while(!node.isNull()) {
QDomElement e = node.toElement();
// kDebug()<<"AXIS TAG : "<<e.text()<<endl;
if(e.tagName() == "Enabled")
enabled = (bool) e.text().toInt();
else if(e.tagName() == "Scale")
scale = (TScale) e.text().toInt();
else if(e.tagName() == "Position")
position = e.text().toInt();
else if(e.tagName() == "Scaling")
scaling = e.text().toDouble();
else if(e.tagName() == "Shift")
shift = e.text().toDouble();
else if(e.tagName() == "Border") {
border_enabled = (bool) e.attribute("enabled").toInt();
borderwidth = e.attribute("width").toInt();
bordercolor = QColor(e.attribute("color"));
}
else if(e.tagName() == "MajorGrid") {
majorgrid_enabled = (bool) e.attribute("enabled").toInt();
majorgridwidth = e.attribute("width").toInt();
majorgridcolor = QColor(e.attribute("color"));
majorgridtype = (Qt::PenStyle) e.attribute("style").toInt();
}
else if(e.tagName() == "MinorGrid") {
minorgrid_enabled = (bool) e.attribute("enabled").toInt();
minorgridwidth = e.attribute("width").toInt();
minorgridcolor = QColor(e.attribute("color"));
minorgridtype = (Qt::PenStyle) e.attribute("style").toInt();
}
else if(e.tagName() == "MajorTicks") {
majorticks_enabled = (bool) e.attribute("enabled").toInt();
tickpos = e.attribute("position").toInt();
ticktype = e.attribute("type").toInt();
majorticks = e.attribute("nr").toDouble();
majortickwidth = e.attribute("width").toInt();
tickcolor = QColor(e.attribute("color"));
majorticklength = e.attribute("length").toDouble();
}
else if(e.tagName() == "MinorTicks") {
minorticks_enabled = (bool) e.attribute("enabled").toInt();
minorticks = e.attribute("nr").toInt();
minortickwidth = e.attribute("width").toInt();
minorticklength = e.attribute("length").toDouble();
}
else if(e.tagName() == "TickLabel") {
ticklabel_enabled = (bool) e.attribute("enabled").toInt();
QDomNode ticknode = e.firstChild();
while(!ticknode.isNull()) {
QDomElement te = ticknode.toElement();
// kDebug()<<"TICK TAG : "<<te.text()<<endl;
if(te.tagName() == "Prefix")
ticklabelprefix = te.text();
else if(te.tagName() == "Suffix")
ticklabelsuffix = te.text();
else if(te.tagName() == "Font")
tickfont = QFont(te.attribute("family"),te.attribute("pointsize").toInt(),
te.attribute("weight").toInt(),(bool) te.attribute("italic").toInt());
else if(te.tagName() == "Rotation")
ticklabelrotation = te.text().toDouble();
else if(te.tagName() == "Position")
gap = te.text().toInt();
else if(te.tagName() == "Color")
ticklabelcolor = QColor(te.text());
else if(te.tagName() == "Format")
ticklabelformat = (TFormat) te.text().toInt();
else if(te.tagName() == "Precision")
ticklabelprecision = te.text().toInt();
else if(te.tagName() == "DateTimeFormat")
datetimeformat = te.text();
ticknode = ticknode.nextSibling();
}
}
label->openXML(e.firstChild());
node = node.nextSibling();
}
}
*/
src/Axis.h
deleted
100644 → 0
View file @
ab50b012
//LabPlot: Axis.h
#ifndef AXIS_H
#define AXIS_H
#include <QFont>
#include <QColor>
#include "Label.h"
#include "scale.h"
#include "tickformat.h"
#include "defs.h"
class
Axis
{
public:
Axis
();
// QDomElement saveXML(QDomDocument doc, int id);
// void openXML(QDomNode node);
void
centerX
(
int
plotsize
,
double
center
);
//!< center label on x axis
void
centerY
(
int
plotsize
,
double
center
);
//!< center label on y axis
// TODO void setLabel(Label *l);
Label
*
getLabel
()
const
{
return
label
;
}
ACCESS
(
bool
,
enabled
,
Enabled
);
ACCESS
(
TScale
,
scale
,
Scale
);
ACCESS
(
double
,
scaling
,
Scaling
);
ACCESS
(
double
,
shift
,
Shift
);
ACCESS
(
int
,
position
,
Position
);
ACCESS
(
int
,
ticktype
,
TickType
);
ACCESSFLAG
(
ticklabel_enabled
,
TickLabel
);
ACCESS
(
double
,
ticklabelrotation
,
TickLabelRotation
);
ACCESS
(
QString
,
ticklabelprefix
,
TickLabelPrefix
);
ACCESS
(
QString
,
ticklabelsuffix
,
TickLabelSuffix
);
ACCESS
(
QFont
,
tickfont
,
TickLabelFont
);
ACCESS
(
QColor
,
tickcolor
,
TickColor
);
ACCESS
(
QColor
,
ticklabelcolor
,
TickLabelColor
);
ACCESS
(
TFormat
,
ticklabelformat
,
TickLabelFormat
);
ACCESS
(
QString
,
datetimeformat
,
DateTimeFormat
);
ACCESS
(
int
,
ticklabelprecision
,
TickLabelPrecision
);
ACCESS
(
int
,
gap
,
TickLabelPosition
);
ACCESS
(
double
,
majorticks
,
MajorTicks
);
ACCESS
(
int
,
minorticks
,
MinorTicks
);
ACCESSFLAG
(
majorticks_enabled
,
MajorTicks
);
ACCESSFLAG
(
minorticks_enabled
,
MinorTicks
);
ACCESS
(
int
,
tickposition
,
TickPosition
);
ACCESS
(
int
,
majortickwidth
,
majorTickWidth
);
ACCESS
(
int
,
minortickwidth
,
minorTickWidth
);
ACCESS
(
int
,
majorticklength
,
majorTickLength
);
ACCESS
(
int
,
minorticklength
,
minorTickLength
);
ACCESSFLAG
(
border_enabled
,
Border
);
ACCESS
(
QColor
,
bordercolor
,
BorderColor
);
ACCESS
(
int
,
borderwidth
,
BorderWidth
);
ACCESSFLAG
(
majorgrid_enabled
,
MajorGrid
);
ACCESSFLAG
(
minorgrid_enabled
,
MinorGrid
);
ACCESS
(
QColor
,
majorgridcolor
,
MajorGridColor
);
ACCESS
(
QColor
,
minorgridcolor
,
MinorGridColor
);
ACCESS
(
Qt
::
PenStyle
,
majorgridtype
,
MajorGridType
);
ACCESS
(
Qt
::
PenStyle
,
minorgridtype
,
MinorGridType
);
ACCESS
(
int
,
majorgridwidth
,
MajorGridWidth
);
ACCESS
(
int
,
minorgridwidth
,
MinorGridWidth
);
private:
bool
enabled
;
Label
*
label
;
int
position
;
//!< position : 0: normal 1: center
TScale
scale
;
double
scaling
,
shift
;
//!< scaling and shift of axes tick values
int
ticktype
;
//!< tick type. 0: NUMBER, 1: INCREMENT
bool
ticklabel_enabled
;
//!< tick label enabled?
double
ticklabelrotation
;
//!< tick label rotation
QString
ticklabelprefix
,
ticklabelsuffix
;
//!< tick label prefix and suffix
QFont
tickfont
;
//!< axis/tics label font
QColor
tickcolor
,
ticklabelcolor
;
TFormat
ticklabelformat
;
QString
datetimeformat
;
//!< format for time tick label
int
ticklabelprecision
;
int
tickposition
;
//!< tick label position 0:out 1:in 2:in&out 3:none
double
majorticks
;
//!< number of / increment for major ticks
int
minorticks
;
//!< number of minor ticks
bool
majorticks_enabled
,
minorticks_enabled
;
int
gap
;
//!< gap between tick label and axis
bool
border_enabled
;
QColor
bordercolor
;
int
borderwidth
;
bool
majorgrid_enabled
,
minorgrid_enabled
;
QColor
majorgridcolor
,
minorgridcolor
;
Qt
::
PenStyle
majorgridtype
;
//!< major grid style (solid,dashed,dotted,...)
Qt
::
PenStyle
minorgridtype
;
//!< minor grid style (solid,dashed,dotted,...)
int
majortickwidth
,
minortickwidth
;
int
majorgridwidth
,
minorgridwidth
;
double
majorticklength
,
minorticklength
;
};
#endif //AXIS_H
src/Label.cc
deleted
100644 → 0
View file @
ab50b012
//LabPlot: Label.cc
#include <KDebug>
#include <QPainter>
#include <QTextDocument>
#include "Label.h"
Label
::
Label
(
QString
t
,
QFont
f
,
QColor
c
)
{
text
=
t
;
font
=
f
;
color
=
c
;
bgcolor
=
Qt
::
white
;
x
=
y
=
0
;
boxed
=
false
;
transparent
=
true
;
rotation
=
0.0
;
// is_texlabel = false;
}
/*int Label::Length() {
QSimpleRichText *rt = new QSimpleRichText(title,font);
return rt->width();
}
QString Label::simpleTitle() {
QString t(title);
t.replace(QRegExp(QString("\n")),""); // replace newlines
QRegExp rx("<.*>"); // remove all html tags
rx.setMinimal(true);
t.replace(rx,"");
return t;
}
QStringList Label::Info() {
QStringList s;
// no label
if(title.isEmpty())
return s;
s << QString::number(x) + "/" + QString::number(y);
return s;
}
void Label::save(QTextStream *ts) {
title.replace( QRegExp(QString("\n")), QString("") ); // strip all newlines from t
*ts<<title<<endl;
*ts<<font.family()<<endl;
*ts<<font.pointSize()<<' ';
*ts<<font.weight()<<' '<<font.italic()<<endl;
*ts<<color.name()<<endl;
*ts<<x<<' '<<y<<endl;
*ts<<(int)boxed<<endl;
*ts<<rotation<<endl;
*ts<<(int)is_texlabel<<endl;
*ts<<bgcolor.name()<<endl;
*ts<<transparent<<endl;
}
//!< ALSO change in Plot.cc !!!
void Label::open(QTextStream *ts,int version, bool skip) {
// kDebug()<<"Label::open()"<<endl;
QString t, family, c;
int pointsize, weight, italic, tmp;
double tmpx,tmpy;
if(skip)
ts->readLine();
title = ts->readLine();
if(version>3) {
family=ts->readLine();
*ts>>pointsize>>weight>>italic;
}
else {
*ts>>family>>pointsize>>weight>>italic;
}
font = QFont(family,pointsize,weight,italic);
// kDebug()<<"Label : "<<title<<endl;
// kDebug()<<"(family/pointsize/weight/italic) : "<<family<<' '<<pointsize<<' '<<weight<<' '<<italic<<endl;
if (version > 3) {
*ts>>c;
color = QColor(c);
*ts>>tmpx>>tmpy;
x = tmpx;
y = tmpy;
}
if (version > 8) {
*ts>>tmp;
boxed = (bool)tmp;
}
if (version > 16)
*ts>>rotation;
if (version > 20) {
*ts>>tmp;
is_texlabel = (bool)tmp;
}
if (version > 21) {
*ts>>c;
bgcolor = QColor(c);
*ts>>tmp;
transparent=(bool)tmp;
// kDebug()<<" BGCOLOR : "<<bgcolor.name()<<endl;
}
}
QDomElement Label::saveXML(QDomDocument doc) {
QDomElement labeltag = doc.createElement( "Label" );
QDomElement tag = doc.createElement( "Title" );
labeltag.appendChild( tag );
QDomText t = doc.createTextNode( title );
tag.appendChild( t );
tag = doc.createElement( "Font" );
tag.setAttribute("family",font.family());
tag.setAttribute("pointsize",font.pointSize());
tag.setAttribute("weight",font.weight());
tag.setAttribute("italic",font.italic());
labeltag.appendChild( tag );
tag = doc.createElement( "Color" );
labeltag.appendChild( tag );
t = doc.createTextNode( color.name() );
tag.appendChild( t );
tag = doc.createElement( "Position" );
tag.setAttribute("x",x);
tag.setAttribute("y",y);
labeltag.appendChild( tag );
tag = doc.createElement( "Boxed" );
labeltag.appendChild( tag );
t = doc.createTextNode( QString::number(boxed) );
tag.appendChild( t );
tag = doc.createElement( "Rotation" );
labeltag.appendChild( tag );
t = doc.createTextNode( QString::number(rotation) );
tag.appendChild( t );
tag = doc.createElement( "TeXLabel" );
labeltag.appendChild( tag );
t = doc.createTextNode( QString::number(is_texlabel) );
tag.appendChild( t );
tag = doc.createElement( "BackgroundColor" );
labeltag.appendChild( tag );
t = doc.createTextNode( bgcolor.name() );
tag.appendChild( t );
tag = doc.createElement( "Transparent" );
labeltag.appendChild( tag );
t = doc.createTextNode( QString::number(transparent) );
tag.appendChild( t );
return labeltag;
}
void Label::openXML(QDomNode node) {
while(!node.isNull()) {
QDomElement e = node.toElement();
// kDebug()<<"LABEL TAG = "<<e.tagName()<<endl;
// kDebug()<<"LABEL TEXT = "<<e.text()<<endl;
if(e.tagName() == "Title")
title = e.text();
else if(e.tagName() == "Font")
font = QFont(e.attribute("family"),e.attribute("pointsize").toInt(),
e.attribute("weight").toInt(),(bool) e.attribute("italic").toInt());
else if(e.tagName() == "Color")
color = QColor(e.text());
else if(e.tagName() == "Position") {
x = e.attribute("x").toDouble();
y = e.attribute("y").toDouble();
}
else if(e.tagName() == "Boxed")
boxed = (bool) e.text().toInt();
else if(e.tagName() == "Rotation")
rotation = e.text().toInt();
else if(e.tagName() == "TeXLabel")
is_texlabel = (bool) e.text().toInt();
else if(e.tagName() == "BackgroundColor")
bgcolor = QColor(e.text());
else if(e.tagName() == "Transparent")
transparent = (bool) e.text().toInt();
node = node.nextSibling();
}
}
void Label::saveSettings(KConfig *config, QString entry) {
config->writeEntry(entry+"LabelTitle",title);
config->writeEntry(entry+"LabelFont",font);
config->writeEntry(entry+"LabelColor",color);
config->writeEntry(entry+"LabelXPosition",x);
config->writeEntry(entry+"LabelYPosition",y);
config->writeEntry(entry+"LabelBoxed",boxed);
config->writeEntry(entry+"LabelRotation",rotation);
config->writeEntry(entry+"LabelTeXLabel",is_texlabel);
config->writeEntry(entry+"LabelBackgroundColor",bgcolor);
config->writeEntry(entry+"LabelTransparent",transparent);
}
void Label::readSettings(KConfig *config, QString entry) {
title = config->readEntry(entry+"LabelTitle",title);
font = config->readFontEntry(entry+"LabelFont",&font);
color = config->readColorEntry(entry+"LabelColor",&color);
x = config->readDoubleNumEntry(entry+"LabelXPosition",x);
y = config->readDoubleNumEntry(entry+"LabelYPosition",y);
boxed = config->readBoolEntry(entry+"LabelBoxed",boxed);
rotation = config->readDoubleNumEntry(entry+"LabelRotation",rotation);
is_texlabel = config->readBoolEntry(entry+"LabelTeXLabel",is_texlabel);
bgcolor = config->readColorEntry(entry+"LabelBackgroundColor",&bgcolor);
transparent = config->readBoolEntry(entry+"LabelTranparent",transparent);
}
*/
void
Label
::
draw
(
QPainter
*
p
,
Point
pos
,
Point
size
,
int
w
,
int
h
,
double
phi
)
{
kDebug
()
<<
"Label::draw()"
<<
endl
;
/* // resize font with plot size
QFont tmpfont(font);
int tmpsize = font.pointSize();
tmpfont.setPointSize((int)(size.X()*tmpsize));
*/
/* if(richtext) delete richtext;
richtext = new QSimpleRichText(title,tmpfont);
richtext->setWidth(p,500);
*/
QTextDocument
*
t
=
new
QTextDocument
();