2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2008-02-06 19:40:45 +00:00
|
|
|
Copyright 2006-2008 Xavier Guerrin
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2007-01-29 00:41:12 +00:00
|
|
|
#ifndef DIAGRAMVIEW_H
|
2007-04-12 03:13:13 +00:00
|
|
|
#define DIAGRAMVIEW_H
|
|
|
|
#include <QtGui>
|
|
|
|
class Diagram;
|
2008-07-09 21:14:30 +00:00
|
|
|
class DiagramTextItem;
|
2007-11-02 18:04:13 +00:00
|
|
|
class QETDiagramEditor;
|
2007-12-02 20:41:19 +00:00
|
|
|
class Conductor;
|
2007-04-12 03:13:13 +00:00
|
|
|
/**
|
|
|
|
Classe representant graphiquement un schema electrique
|
|
|
|
*/
|
|
|
|
class DiagramView : public QGraphicsView {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
// constructeurs, destructeur
|
|
|
|
public:
|
|
|
|
DiagramView(QWidget * = 0);
|
|
|
|
virtual ~DiagramView();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DiagramView(const DiagramView &);
|
|
|
|
|
|
|
|
// attributs
|
2007-09-29 12:54:01 +00:00
|
|
|
public:
|
2007-12-16 14:05:39 +00:00
|
|
|
/// Nom de fichier du schema edite
|
2007-09-29 12:54:01 +00:00
|
|
|
QString file_name;
|
|
|
|
|
2007-04-12 03:13:13 +00:00
|
|
|
private:
|
|
|
|
Diagram *scene;
|
2007-11-02 18:04:13 +00:00
|
|
|
QMenu *context_menu;
|
|
|
|
QAction *paste_here;
|
|
|
|
QPoint paste_here_pos;
|
2007-10-27 13:18:17 +00:00
|
|
|
bool is_adding_text;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
// methodes
|
|
|
|
public:
|
2007-09-29 12:54:01 +00:00
|
|
|
bool open(QString, int * = NULL);
|
2007-04-12 03:13:13 +00:00
|
|
|
void closeEvent(QCloseEvent *);
|
2007-09-29 12:54:01 +00:00
|
|
|
bool save();
|
|
|
|
bool saveAs();
|
2007-04-12 03:13:13 +00:00
|
|
|
void dialogExport();
|
|
|
|
void dialogEditInfos();
|
|
|
|
void dialogPrint();
|
|
|
|
void addColumn();
|
|
|
|
void removeColumn();
|
2008-08-10 15:07:59 +00:00
|
|
|
void addRow();
|
|
|
|
void removeRow();
|
2007-12-16 13:21:28 +00:00
|
|
|
/// @return Le schema visualise par ce DiagramView
|
2007-04-12 03:13:13 +00:00
|
|
|
Diagram *diagram() { return(scene); }
|
2007-11-02 18:04:13 +00:00
|
|
|
QETDiagramEditor *diagramEditor() const;
|
2007-04-12 03:13:13 +00:00
|
|
|
bool hasSelectedItems();
|
2007-10-27 13:18:17 +00:00
|
|
|
void addText();
|
2008-07-09 21:14:30 +00:00
|
|
|
DiagramTextItem *addDiagramTextAtPos(const QPointF &);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2007-10-04 14:30:52 +00:00
|
|
|
protected:
|
2007-12-01 12:42:31 +00:00
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent *);
|
2007-11-02 18:04:13 +00:00
|
|
|
virtual void contextMenuEvent(QContextMenuEvent *);
|
2007-10-04 14:30:52 +00:00
|
|
|
virtual void wheelEvent(QWheelEvent *);
|
2007-10-12 10:58:57 +00:00
|
|
|
virtual bool event(QEvent *);
|
2007-10-04 14:30:52 +00:00
|
|
|
|
2007-04-12 03:13:13 +00:00
|
|
|
private:
|
2007-09-29 12:54:01 +00:00
|
|
|
bool saveDiagramToFile(QString &);
|
2007-04-12 03:13:13 +00:00
|
|
|
void mousePressEvent(QMouseEvent *);
|
|
|
|
void dragEnterEvent(QDragEnterEvent *);
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *);
|
|
|
|
void dragMoveEvent(QDragMoveEvent *);
|
|
|
|
void dropEvent(QDropEvent *);
|
2007-09-04 18:15:41 +00:00
|
|
|
QRectF viewedSceneRect() const;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
signals:
|
2007-10-21 16:10:21 +00:00
|
|
|
/// Signal emis lorsque la selection change
|
2007-04-12 03:13:13 +00:00
|
|
|
void selectionChanged();
|
2007-10-21 16:10:21 +00:00
|
|
|
/// Signal emis lorsque le mode de selection change
|
2007-04-12 03:13:13 +00:00
|
|
|
void modeChanged();
|
2007-10-27 13:18:17 +00:00
|
|
|
/// Signal emis lorsqu'un texte a ete pose
|
|
|
|
void textAdded(bool);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void selectNothing();
|
|
|
|
void selectAll();
|
|
|
|
void selectInvert();
|
2007-09-29 12:54:01 +00:00
|
|
|
void deleteSelection();
|
|
|
|
void rotateSelection();
|
2007-04-12 03:13:13 +00:00
|
|
|
void setVisualisationMode();
|
|
|
|
void setSelectionMode();
|
2007-09-29 12:54:01 +00:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
2007-04-12 03:13:13 +00:00
|
|
|
void zoomFit();
|
|
|
|
void zoomReset();
|
2007-09-29 12:54:01 +00:00
|
|
|
void cut();
|
|
|
|
void copy();
|
2007-11-02 18:04:13 +00:00
|
|
|
void paste(const QPointF & = QPointF(), QClipboard::Mode = QClipboard::Clipboard);
|
|
|
|
void pasteHere();
|
2007-09-28 21:02:53 +00:00
|
|
|
void adjustSceneRect();
|
2007-09-29 09:52:35 +00:00
|
|
|
void updateWindowTitle();
|
2007-10-03 17:02:39 +00:00
|
|
|
void editConductor();
|
2007-12-02 20:41:19 +00:00
|
|
|
void editConductor(Conductor *);
|
2007-10-06 18:37:21 +00:00
|
|
|
void resetConductors();
|
2007-10-14 15:16:37 +00:00
|
|
|
void editDefaultConductorProperties();
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private slots:
|
2007-09-04 18:15:41 +00:00
|
|
|
void adjustGridToZoom();
|
2007-04-12 03:13:13 +00:00
|
|
|
};
|
2006-10-27 15:47:22 +00:00
|
|
|
#endif
|