2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2012-01-01 22:51:51 +00:00
|
|
|
Copyright 2006-2012 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-09-21 12:35:28 +00:00
|
|
|
#ifndef QET_DIAGRAM_EDITOR_H
|
|
|
|
#define QET_DIAGRAM_EDITOR_H
|
2007-04-12 03:13:13 +00:00
|
|
|
#include <QtGui>
|
2012-02-13 22:12:37 +00:00
|
|
|
#include "qetmainwindow.h"
|
2008-08-14 22:51:08 +00:00
|
|
|
#include "borderproperties.h"
|
2009-04-03 19:30:25 +00:00
|
|
|
#include "conductorproperties.h"
|
2010-12-20 02:45:36 +00:00
|
|
|
#include "titleblockproperties.h"
|
2009-08-09 12:51:02 +00:00
|
|
|
#include "exportproperties.h"
|
2009-04-03 19:30:25 +00:00
|
|
|
class QETProject;
|
|
|
|
class ProjectView;
|
|
|
|
class Diagram;
|
2007-04-12 03:13:13 +00:00
|
|
|
class DiagramView;
|
|
|
|
class ElementsPanelWidget;
|
2009-05-19 19:00:37 +00:00
|
|
|
class ElementsLocation;
|
2008-07-30 11:51:27 +00:00
|
|
|
class RecentFiles;
|
2007-04-12 03:13:13 +00:00
|
|
|
/**
|
|
|
|
Cette classe represente la fenetre principale de QElectroTech et,
|
|
|
|
ipso facto, la plus grande partie de l'interface graphique de QElectroTech.
|
|
|
|
Il s'agit d'un objet QMainWindow avec un QWorkSpace contenant des objets
|
2009-04-11 13:09:47 +00:00
|
|
|
"DiagramView" en guise de widget central et un "Panel d'Elements" en
|
|
|
|
guise de widget "Dock".
|
2007-04-12 03:13:13 +00:00
|
|
|
*/
|
2012-02-13 22:12:37 +00:00
|
|
|
class QETDiagramEditor : public QETMainWindow {
|
2007-04-12 03:13:13 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
// constructeurs, destructeur
|
|
|
|
public:
|
2007-09-22 13:27:14 +00:00
|
|
|
QETDiagramEditor(const QStringList & = QStringList(), QWidget * = 0);
|
2007-09-21 12:35:28 +00:00
|
|
|
virtual ~QETDiagramEditor();
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2007-09-21 12:35:28 +00:00
|
|
|
QETDiagramEditor(const QETDiagramEditor &);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
// methodes
|
|
|
|
public:
|
|
|
|
void closeEvent(QCloseEvent *);
|
2009-04-03 19:30:25 +00:00
|
|
|
QList<ProjectView *> openedProjects() const;
|
|
|
|
void addProjectView(ProjectView *);
|
2011-03-15 20:06:40 +00:00
|
|
|
bool openAndAddProject(const QString &, bool = true, bool = true);
|
2009-04-03 19:30:25 +00:00
|
|
|
QList<DiagramView *> projectViews() const;
|
2008-07-20 11:37:31 +00:00
|
|
|
QList<QString> editedFiles() const;
|
2009-04-03 19:30:25 +00:00
|
|
|
ProjectView *viewForFile(const QString &) const;
|
2010-12-20 02:45:36 +00:00
|
|
|
static TitleBlockProperties defaultTitleBlockProperties();
|
2009-08-09 12:51:02 +00:00
|
|
|
static BorderProperties defaultBorderProperties();
|
2009-04-03 19:30:25 +00:00
|
|
|
static ConductorProperties defaultConductorProperties();
|
2009-08-09 12:51:02 +00:00
|
|
|
static ExportProperties defaultExportProperties();
|
2009-11-22 16:12:22 +00:00
|
|
|
static ExportProperties defaultPrintProperties();
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void actions();
|
2009-04-03 19:30:25 +00:00
|
|
|
virtual bool event(QEvent *);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2011-03-15 20:06:40 +00:00
|
|
|
bool addProject(QETProject *, bool = true);
|
2009-04-03 19:30:25 +00:00
|
|
|
ProjectView *currentProject() const;
|
2007-09-25 23:24:36 +00:00
|
|
|
DiagramView *currentDiagram() const;
|
2009-04-03 19:30:25 +00:00
|
|
|
ProjectView *findProject(DiagramView *) const;
|
|
|
|
ProjectView *findProject(Diagram *) const;
|
|
|
|
ProjectView *findProject(QETProject *) const;
|
|
|
|
ProjectView *findProject(const QString &) const;
|
|
|
|
QMdiSubWindow *subWindowForWidget(QWidget *) const;
|
|
|
|
|
2007-04-12 03:13:13 +00:00
|
|
|
void menus();
|
|
|
|
void toolbar();
|
|
|
|
|
|
|
|
public slots:
|
2007-09-29 12:54:01 +00:00
|
|
|
void printDialog();
|
|
|
|
void exportDialog();
|
|
|
|
bool saveAsDialog();
|
|
|
|
bool save();
|
2009-04-03 19:30:25 +00:00
|
|
|
bool saveAll();
|
|
|
|
bool newProject();
|
|
|
|
bool openProject();
|
2008-07-30 11:51:27 +00:00
|
|
|
bool openRecentFile(const QString &);
|
2009-04-03 19:30:25 +00:00
|
|
|
bool closeProject(ProjectView *);
|
|
|
|
bool closeProject(QETProject *);
|
|
|
|
bool closeCurrentProject();
|
2007-09-29 12:54:01 +00:00
|
|
|
void slot_cut();
|
|
|
|
void slot_copy();
|
|
|
|
void slot_paste();
|
|
|
|
void slot_zoomIn();
|
|
|
|
void slot_zoomOut();
|
2007-04-12 03:13:13 +00:00
|
|
|
void slot_zoomFit();
|
|
|
|
void slot_zoomReset();
|
|
|
|
void slot_selectAll();
|
|
|
|
void slot_selectNothing();
|
|
|
|
void slot_selectInvert();
|
2007-09-29 12:54:01 +00:00
|
|
|
void slot_delete();
|
|
|
|
void slot_rotate();
|
2010-02-11 23:35:04 +00:00
|
|
|
void slot_rotateTexts();
|
2007-04-12 03:13:13 +00:00
|
|
|
void slot_setSelectionMode();
|
|
|
|
void slot_setVisualisationMode();
|
|
|
|
void slot_updateActions();
|
2007-10-28 00:16:32 +00:00
|
|
|
void slot_updateModeActions();
|
|
|
|
void slot_updateComplexActions();
|
|
|
|
void slot_updatePasteAction();
|
2007-09-29 12:54:01 +00:00
|
|
|
void slot_updateWindowsMenu();
|
2007-04-12 03:13:13 +00:00
|
|
|
void slot_addColumn();
|
|
|
|
void slot_removeColumn();
|
2008-08-10 15:07:59 +00:00
|
|
|
void slot_addRow();
|
|
|
|
void slot_removeRow();
|
2009-05-17 02:13:40 +00:00
|
|
|
void editSelectionProperties();
|
2007-10-03 17:02:39 +00:00
|
|
|
void slot_editConductor();
|
2007-10-06 18:37:21 +00:00
|
|
|
void slot_resetConductors();
|
2007-10-27 13:18:17 +00:00
|
|
|
void slot_addText();
|
2009-04-03 19:30:25 +00:00
|
|
|
void setWindowedMode();
|
|
|
|
void setTabbedMode();
|
2007-11-12 15:21:14 +00:00
|
|
|
void readSettings();
|
|
|
|
void writeSettings();
|
2009-04-03 19:30:25 +00:00
|
|
|
void activateDiagram(Diagram *);
|
|
|
|
void activateProject(QETProject *);
|
|
|
|
void activateProject(ProjectView *);
|
|
|
|
void activateWidget(QWidget *);
|
|
|
|
void projectWasClosed(ProjectView *);
|
|
|
|
void editCurrentProjectProperties();
|
|
|
|
void editProjectProperties(ProjectView *);
|
|
|
|
void editProjectProperties(QETProject *);
|
|
|
|
void editCurrentDiagramProperties();
|
|
|
|
void editDiagramProperties(DiagramView *);
|
|
|
|
void editDiagramProperties(Diagram *);
|
|
|
|
void addDiagramToProject();
|
|
|
|
void addDiagramToProject(QETProject *);
|
|
|
|
void removeDiagram(Diagram *);
|
|
|
|
void removeDiagramFromProject();
|
2010-02-28 16:13:45 +00:00
|
|
|
void moveDiagramUp(Diagram *);
|
|
|
|
void moveDiagramDown(Diagram *);
|
2009-04-03 19:30:25 +00:00
|
|
|
void cleanCurrentProject();
|
|
|
|
void diagramWasAdded(DiagramView *);
|
|
|
|
void diagramIsAboutToBeRemoved(DiagramView *);
|
|
|
|
void diagramWasRemoved(DiagramView *);
|
2009-05-19 19:00:37 +00:00
|
|
|
void findElementInPanel(const ElementsLocation &);
|
2009-07-08 09:41:20 +00:00
|
|
|
void editElementInEditor(const ElementsLocation &);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
// attributs
|
2007-11-02 18:04:13 +00:00
|
|
|
public:
|
2007-04-12 03:13:13 +00:00
|
|
|
// Actions faisables au travers de menus dans l'application QElectroTech
|
2007-12-16 14:05:39 +00:00
|
|
|
QActionGroup *grp_visu_sel; ///< Groupe d'actions pour les modes (edition et visualisation)
|
2009-04-03 19:30:25 +00:00
|
|
|
QActionGroup *grp_view_mode; ///< Groupe d'actions pour l'affichage des projets (onglets ou fenetres)
|
|
|
|
QAction *tabbed_view_mode; ///< Passe les projets en mode onglets
|
|
|
|
QAction *windowed_view_mode; ///< Passe les projets en mode fenetre
|
2007-12-16 14:05:39 +00:00
|
|
|
QAction *mode_selection; ///< Passe en mode edition
|
|
|
|
QAction *mode_visualise; ///< Passe en mode visualisation
|
|
|
|
QAction *new_file; ///< Cree un nouveau schema
|
|
|
|
QAction *open_file; ///< OUvre un fichier
|
|
|
|
QAction *close_file; ///< Ferme le fichier
|
|
|
|
QAction *save_file; ///< Enregistre le fichier
|
|
|
|
QAction *save_file_sous; ///< Enregistrer le fichier sous un nom donne
|
2009-04-03 19:30:25 +00:00
|
|
|
QAction *save_all; ///< Enregistre tous les schemas
|
2007-12-16 14:05:39 +00:00
|
|
|
QAction *import_diagram; ///< Importe un schema existant (non implemente)
|
|
|
|
QAction *export_diagram; ///< Exporte le schema sous forme d'image
|
|
|
|
QAction *print; ///< Imprime le schema
|
|
|
|
QAction *quit_editor; ///< Quitte l'editeur de schema
|
|
|
|
QAction *undo; ///< Annule la derniere action
|
|
|
|
QAction *redo; ///< Refait une action annulee
|
|
|
|
QAction *cut; ///< Coupe la selection dans le presse-papier
|
|
|
|
QAction *copy; ///< Copie la selection dans le presse-papier
|
|
|
|
QAction *paste; ///< Colle le contenu du presse-papier sur le schema
|
|
|
|
QAction *select_all; ///< Selectionne tout
|
|
|
|
QAction *select_nothing; ///< Deselectionne tout
|
|
|
|
QAction *select_invert; ///< Inverse la selection
|
|
|
|
QAction *delete_selection; ///< Supprime la selection
|
2010-02-11 23:35:04 +00:00
|
|
|
QAction *rotate_selection; ///< Pivote les elements et textes selectionnes de 90 degres
|
|
|
|
QAction *rotate_texts; ///< Pivote les textes selectionnes selon un angle parametrable
|
2009-05-17 02:13:40 +00:00
|
|
|
QAction *selection_prop; ///< Lance le dialogue de description ou d'edition de la selection
|
2007-12-16 14:05:39 +00:00
|
|
|
QAction *conductor_reset; ///< Reinitialise les conducteurs selectionnes
|
|
|
|
QAction *conductor_default; ///< Lance le dialogue d'edition des conducteurs par defaut
|
|
|
|
QAction *infos_diagram; ///< Lance le dialogue d'edition des proprietes du schema
|
|
|
|
QAction *add_text; ///< Passe en mode "Ajout de texte"
|
|
|
|
QAction *add_column; ///< Ajoute une colonne au schema
|
|
|
|
QAction *remove_column; ///< Enleve une colonne du schema
|
2008-08-10 15:07:59 +00:00
|
|
|
QAction *add_row; ///< Augmente la hauteur du schema
|
|
|
|
QAction *remove_row; ///< Reduit la hauteur du schema
|
2009-04-03 19:30:25 +00:00
|
|
|
QAction *prj_edit_prop; ///< Edite les proprietes du projet
|
|
|
|
QAction *prj_add_diagram; ///< Ajoute un schema au projet
|
|
|
|
QAction *prj_del_diagram; ///< Supprime un schema du projet
|
|
|
|
QAction *prj_clean; ///< Nettoie un projet
|
2007-12-16 14:05:39 +00:00
|
|
|
QAction *zoom_in; ///< Zoome avant
|
|
|
|
QAction *zoom_out; ///< Zoome arriere
|
|
|
|
QAction *zoom_fit; ///< Ajuste le zoom de facon a voir l'integralite des elements
|
|
|
|
QAction *zoom_reset; ///< Remet le zoom 1:1
|
|
|
|
QAction *tile_window; ///< Affiche les fenetre MDI en mosaique
|
|
|
|
QAction *cascade_window; ///< Affiche les fenetres MDI en cascade
|
|
|
|
QAction *prev_window; ///< Affiche la fenetre MDI precedente
|
|
|
|
QAction *next_window; ///< Affiche la fenetre MDI suivante
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-03 19:30:25 +00:00
|
|
|
QMdiArea workspace;
|
2007-04-12 03:13:13 +00:00
|
|
|
QSignalMapper windowMapper;
|
2007-10-21 12:53:57 +00:00
|
|
|
/// Dossier a utiliser pour Fichier > ouvrir
|
|
|
|
QDir open_dialog_dir;
|
2007-12-30 19:10:51 +00:00
|
|
|
/// Dock pour le Panel d'Elements
|
2007-04-12 03:13:13 +00:00
|
|
|
QDockWidget *qdw_pa;
|
2007-11-09 15:16:54 +00:00
|
|
|
/// Dock pour la liste des annulations
|
|
|
|
QDockWidget *qdw_undo;
|
2007-12-30 19:10:51 +00:00
|
|
|
/// Panel d'Elements
|
2007-04-12 03:13:13 +00:00
|
|
|
ElementsPanelWidget *pa;
|
2007-09-29 12:54:01 +00:00
|
|
|
QMenu *windows_menu;
|
2007-10-13 17:04:52 +00:00
|
|
|
QToolBar *main_bar;
|
|
|
|
QToolBar *view_bar;
|
|
|
|
QToolBar *diagram_bar;
|
2007-09-25 23:24:36 +00:00
|
|
|
QUndoGroup undo_group;
|
2009-04-03 19:30:25 +00:00
|
|
|
bool can_update_actions;
|
2007-04-12 03:13:13 +00:00
|
|
|
};
|
2006-10-27 15:47:22 +00:00
|
|
|
#endif
|