SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
MultiLayer.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : MultiLayer.h
3
Project : SciDAVis
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief,
6
Tilman Benkert,
7
Knut Franke
8
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net,
9
knut.franke*gmx.de
10
Description : Multi layer widget
11
12
***************************************************************************/
13
14
/***************************************************************************
15
* *
16
* This program is free software; you can redistribute it and/or modify *
17
* it under the terms of the GNU General Public License as published by *
18
* the Free Software Foundation; either version 2 of the License, or *
19
* (at your option) any later version. *
20
* *
21
* This program is distributed in the hope that it will be useful, *
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
24
* GNU General Public License for more details. *
25
* *
26
* You should have received a copy of the GNU General Public License *
27
* along with this program; if not, write to the Free Software *
28
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
29
* Boston, MA 02110-1301 USA *
30
* *
31
***************************************************************************/
32
#ifndef MULTILAYER_H
33
#define MULTILAYER_H
34
35
#include "
MyWidget.h
"
36
#include "
Graph.h
"
37
#include <QPushButton>
38
#include <QLayout>
39
#include <QPointer>
40
#include "
core/column/Column.h
"
41
42
class
QWidget;
43
class
QLabel;
44
class
QWidget;
45
class
LayerButton
;
46
class
SelectionMoveResizer
;
47
class
ApplicationWindow
;
48
66
class
MultiLayer
:
public
MyWidget
67
{
68
Q_OBJECT
69
70
public
:
71
MultiLayer
(
const
QString& label, QWidget* parent=0,
const
char
*
name
=0, Qt::WFlags f=0);
72
QWidgetList
graphPtrs
(){
return
graphsList
;};
73
Graph
*
layer
(
int
num);
74
QWidgetList
layerWidgets
()
const
{
return
graphsList
; }
75
LayerButton
*
addLayerButton
();
76
void
copy
(
ApplicationWindow
* parent,
MultiLayer
* ml);
77
78
enum
HorAlignement
{
HCenter
,
Left
,
Right
};
79
enum
VertAlignement
{
VCenter
,
Top
,
Bottom
};
80
82
83
void
mousePressEvent
(QMouseEvent *);
84
void
contextMenuEvent
(QContextMenuEvent *);
85
void
wheelEvent
(QWheelEvent *);
86
void
keyPressEvent
(QKeyEvent *);
87
void
changeEvent
(QEvent *);
88
bool
eventFilter
(QObject *
object
, QEvent *);
89
void
releaseLayer
();
90
91
bool
focusNextPrevChild
(
bool
next );
93
94
void
setOpenMaximized
(){
d_open_maximized
= 1;};
95
96
bool
scaleLayersOnPrint
(){
return
d_scale_on_print
;};
97
void
setScaleLayersOnPrint
(
bool
on){
d_scale_on_print
= on;};
98
99
bool
printCropmarksEnabled
(){
return
d_print_cropmarks
;};
100
void
printCropmarks
(
bool
on){
d_print_cropmarks
= on;};
101
102
void
setHidden
();
103
104
public
slots:
105
Graph
*
addLayer
(
int
x = 0,
int
y = 0,
int
width = 0,
int
height = 0);
106
void
setLayersNumber
(
int
n);
107
108
bool
isEmpty
();
109
void
removeLayer
();
110
void
confirmRemoveLayer
();
111
119
void
addTextLayer
(
int
f,
const
QFont& font,
const
QColor& textCol,
const
QColor& backgroundCol);
127
void
addTextLayer
(
const
QPoint& pos);
128
129
Graph
*
activeGraph
(){
return
active_graph
;};
130
void
setActiveGraph
(
Graph
* g);
131
void
activateGraph
(
LayerButton
* button);
132
133
void
setGraphGeometry
(
int
x,
int
y,
int
w,
int
h);
134
135
void
findBestLayout
(
int
&
rows
,
int
&
cols
);
136
137
QSize
arrangeLayers
(
bool
userSize);
138
void
arrangeLayers
(
bool
fit,
bool
userSize);
139
void
adjustSize
();
140
141
int
getRows
(){
return
rows
;};
142
void
setRows
(
int
r);
143
144
int
getCols
(){
return
cols
;};
145
void
setCols
(
int
c);
146
147
int
colsSpacing
(){
return
colsSpace
;};
148
int
rowsSpacing
(){
return
rowsSpace
;};
149
void
setSpacing
(
int
rgap,
int
cgap);
150
151
int
leftMargin
(){
return
left_margin
;};
152
int
rightMargin
(){
return
right_margin
;};
153
int
topMargin
(){
return
top_margin
;};
154
int
bottomMargin
(){
return
bottom_margin
;};
155
void
setMargins
(
int
lm,
int
rm,
int
tm,
int
bm);
156
157
QSize
layerCanvasSize
(){
return
QSize(
l_canvas_width
,
l_canvas_height
);};
158
void
setLayerCanvasSize
(
int
w,
int
h);
159
160
int
horizontalAlignement
(){
return
hor_align
;};
161
int
verticalAlignement
(){
return
vert_align
;};
162
void
setAlignement
(
int
ha,
int
va);
163
164
int
layers
(){
return
graphs
;};
165
167
168
QPixmap
canvasPixmap
();
169
void
exportToFile
(
const
QString& fileName);
170
void
exportImage
(
const
QString& fileName,
int
quality = 100,
bool
transparent =
false
);
171
void
exportSVG
(
const
QString& fname);
172
void
exportPDF
(
const
QString& fname);
173
void
exportVector
(
const
QString& fileName,
int
res = 0,
bool
color =
true
,
174
bool
keepAspect =
true
, QPrinter::PageSize pageSize = QPrinter::Custom,
175
QPrinter::Orientation orientation = QPrinter::Portrait);
176
177
void
copyAllLayers
();
178
void
print
();
179
void
printAllLayers
(QPainter *painter);
180
void
printActiveLayer
();
182
183
void
setFonts
(
const
QFont& titleFnt,
const
QFont& scaleFnt,
184
const
QFont& numbersFnt,
const
QFont& legendFnt);
185
186
void
connectLayer
(
Graph
*g);
187
188
QString
saveToString
(
const
QString& geometry);
189
QString
saveAsTemplate
(
const
QString& geometryInfo);
190
191
signals:
192
void
showTextDialog
();
193
void
showPlotDialog
(
int
);
194
void
showAxisDialog
(
int
);
195
void
showScaleDialog
(
int
);
196
void
showGraphContextMenu
();
197
void
showLayerButtonContextMenu
();
198
void
showCurveContextMenu
(
int
);
199
void
showWindowContextMenu
();
200
void
showCurvesDialog
();
201
void
drawTextOff
();
202
void
drawLineEnded
(
bool
);
203
void
showXAxisTitleDialog
();
204
void
showYAxisTitleDialog
();
205
void
showTopAxisTitleDialog
();
206
void
showRightAxisTitleDialog
();
207
void
showMarkerPopupMenu
();
208
void
modifiedPlot
();
209
void
cursorInfo
(
const
QString&);
210
void
showImageDialog
();
211
void
showLineDialog
();
212
void
viewTitleDialog
();
213
void
createTable
(
const
QString&,
const
QString&,QList<Column*>);
214
void
showGeometryDialog
();
215
void
pasteMarker
();
216
void
createIntensityTable
(
const
QString&);
217
void
setPointerCursor
();
218
219
private
:
220
void
resizeLayers
(
const
QResizeEvent *re);
221
void
resizeLayers
(
const
QSize& size,
const
QSize& oldSize,
bool
scaleFonts);
222
223
Graph
*
active_graph
;
225
int
graphs
,
cols
,
rows
,
graph_width
,
graph_height
,
colsSpace
,
rowsSpace
;
226
int
left_margin
,
right_margin
,
top_margin
,
bottom_margin
;
227
int
l_canvas_width
,
l_canvas_height
,
hor_align
,
vert_align
;
228
bool
addTextOn
;
229
bool
d_scale_on_print
,
d_print_cropmarks
;
230
232
int
defaultTextMarkerFrame
;
233
QFont
defaultTextMarkerFont
;
234
QColor
defaultTextMarkerColor
,
defaultTextMarkerBackground
;
235
236
QWidgetList
buttonsList
,
graphsList
;
237
QHBoxLayout *
layerButtonsBox
;
238
QWidget *
canvas
;
239
240
QPointer<SelectionMoveResizer>
d_layers_selector
;
241
int
d_open_maximized
;
243
QSize
d_max_size
;
245
QSize
d_normal_size
;
246
};
247
248
250
class
LayerButton
:
public
QPushButton
251
{
252
Q_OBJECT
253
254
public
:
255
LayerButton
(
const
QString& text = QString::null, QWidget* parent = 0);
256
~LayerButton
(){};
257
258
static
int
btnSize
(){
return
20;};
259
260
protected
:
261
void
mousePressEvent
( QMouseEvent * );
262
void
mouseDoubleClickEvent
( QMouseEvent * );
263
264
signals:
265
void
showCurvesDialog
();
266
void
clicked
(
LayerButton
*);
267
void
showContextMenu
();
268
};
269
270
#endif
Generated by
1.8.1