[qet] [2410] Remove file and code, because unused with the new auto hotspot

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2410
Author:   blacksun
Date:     2013-08-05 15:20:57 +0200 (Mon, 05 Aug 2013)
Log Message:
-----------
Remove file and code, because unused with the new auto hotspot

Modified Paths:
--------------
    trunk/sources/editor/editorcommands.cpp
    trunk/sources/editor/editorcommands.h
    trunk/sources/editor/elementscene.cpp
    trunk/sources/editor/elementscene.h
    trunk/sources/editor/elementview.cpp
    trunk/sources/editor/qetelementeditor.cpp
    trunk/sources/editor/qetelementeditor.h
    trunk/sources/newelementwizard.cpp
    trunk/sources/newelementwizard.h

Removed Paths:
-------------
    trunk/sources/hotspoteditor.cpp
    trunk/sources/hotspoteditor.h

Modified: trunk/sources/editor/editorcommands.cpp
===================================================================
--- trunk/sources/editor/editorcommands.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/editorcommands.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -379,72 +379,6 @@
 /**
 	Constructeur
 	@param element_scene Element edite
-	@param size_1 Dimensions de l'element avant le changement
-	@param size_2 Dimensions de l'element apres le changement
-	@param hotspot_1 Point de saisie de l'element avant le changement
-	@param hotspot_2 Point de saisie de l'element apres le changement
-	@param o Eventuel decalage a appliquer aux parties de l'element edite
-	@param parent QUndoCommand parent
-*/
-ChangeHotspotCommand::ChangeHotspotCommand(
-	ElementScene *element_scene,
-	const QSize  &size_1,
-	const QSize  &size_2,
-	const QPoint &hotspot_1,
-	const QPoint &hotspot_2,
-	const QPoint &o,
-	QUndoCommand *parent
-) :
-	ElementEditionCommand(QObject::tr("modification dimensions/hotspot", "undo caption"), element_scene, 0, parent),
-	size_before(size_1),
-	size_after(size_2),
-	hotspot_before(hotspot_1),
-	hotspot_after(hotspot_2),
-	offset(o)
-{
-}
-
-/// Destructeur
-ChangeHotspotCommand::~ChangeHotspotCommand() {
-}
-
-/// Annule le changement
-void ChangeHotspotCommand::undo() {
-	QRectF sc(editor_scene_ -> sceneContent());
-	
-	editor_scene_ -> setWidth(size_before.width());
-	editor_scene_ -> setHeight(size_before.height());
-	editor_scene_ -> setHotspot(hotspot_before);
-	if (!offset.isNull()) applyOffset(-offset);
-	
-	editor_scene_ -> update(editor_scene_ -> sceneContent().unite(sc));
-}
-
-/// Refait le changement
-void ChangeHotspotCommand::redo() {
-	QRectF sc(editor_scene_ -> sceneContent());
-	
-	editor_scene_ -> setWidth(size_after.width());
-	editor_scene_ -> setHeight(size_after.height());
-	editor_scene_ -> setHotspot(hotspot_after);
-	if (!offset.isNull()) applyOffset(offset);
-	
-	editor_scene_ -> update(editor_scene_ -> sceneContent().unite(sc));
-}
-
-/**
-	Applique une translation aux parties de l'element edite
-	@param o Translation a appliquer
-*/
-void ChangeHotspotCommand::applyOffset(const QPointF &o) {
-	foreach(QGraphicsItem *qgi, editor_scene_ -> items()) {
-		qgi -> translate(o.x(), o.y());
-	}
-}
-
-/**
-	Constructeur
-	@param element_scene Element edite
 	@param before Listes des noms avant changement
 	@param after Listes des noms apres changement
 	@param parent QUndoCommand parent

Modified: trunk/sources/editor/editorcommands.h
===================================================================
--- trunk/sources/editor/editorcommands.h	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/editorcommands.h	2013-08-05 13:20:57 UTC (rev 2410)
@@ -225,39 +225,6 @@
 };
 
 /**
-	This command changes the dimensions and/or the hotspot of an electrical
-	element.
-*/
-class ChangeHotspotCommand : public ElementEditionCommand {
-	// constructors, destructor
-	public:
-	ChangeHotspotCommand(ElementScene *, const QSize &, const QSize &, const QPoint &, const QPoint &, const QPoint & = QPoint(), QUndoCommand * = 0);
-	virtual ~ChangeHotspotCommand();
-	private:
-	ChangeHotspotCommand(const ChangeHotspotCommand &);
-	
-	// methods
-	public:
-	virtual void undo();
-	virtual void redo();
-	
-	private:
-	void applyOffset(const QPointF &);
-	
-	// attributes
-	/// Former dimensions
-	QSize size_before;
-	/// new dimensions
-	QSize size_after;
-	/// Former hotspot
-	QPoint hotspot_before;
-	/// New hotspot
-	QPoint hotspot_after;
-	/// Offset to be applied to primitives
-	QPoint offset;
-};
-
-/**
 	This command changes the translated names of an electrical element.
 */
 class ChangeNamesCommand : public ElementEditionCommand {

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/elementscene.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -27,7 +27,6 @@
 #include "parttext.h"
 #include "parttextfield.h"
 #include "partarc.h"
-#include "hotspoteditor.h"
 #include "editorcommands.h"
 #include "elementcontent.h"
 #include "nameslist.h"
@@ -39,9 +38,6 @@
 */
 ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
 	QGraphicsScene(parent),
-	_width(3),
-	_height(7),
-	_hotspot(15, 35),
 	internal_connections(false),
 	qgi_manager(this),
 	element_editor(editor),
@@ -326,55 +322,6 @@
 }
 
 /**
-	Dessine l'arriere-plan de l'editeur, cad la grille.
-	@param p Le QPainter a utiliser pour dessiner
-	@param r Le rectangle de la zone a dessiner
-*/
-void ElementScene::drawBackground(QPainter *p, const QRectF &r) {
-	p -> save();
-	
-	// desactive tout antialiasing, sauf pour le texte
-	p -> setRenderHint(QPainter::Antialiasing, false);
-	p -> setRenderHint(QPainter::TextAntialiasing, true);
-	p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
-	
-	// dessine un fond blanc
-	p -> setPen(Qt::NoPen);
-	p -> setBrush(Qt::white);
-	p -> drawRect(r);
-	
-	// encadre la zone dessinable de l'element
-	QRectF drawable_area(-_hotspot.x(), -_hotspot.y(), width(), height());
-	p -> setPen(Qt::black);
-	p -> setBrush(Qt::NoBrush);
-	p -> drawRect(drawable_area);
-	
-	// on dessine un point de la grille sur 10
-	int drawn_x_grid = x_grid * 10;
-	int drawn_y_grid = y_grid * 10;
-	
-	if (r.width() < 2500 && r.height() < 2500) {
-		// dessine les points de la grille
-		p -> setPen(Qt::black);
-		p -> setBrush(Qt::NoBrush);
-		qreal limite_x = r.x() + r.width();
-		qreal limite_y = r.y() + r.height();
-		
-		int g_x = (int)ceil(r.x());
-		while (g_x % drawn_x_grid) ++ g_x;
-		int g_y = (int)ceil(r.y());
-		while (g_y % drawn_y_grid) ++ g_y;
-		
-		for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) {
-			for (int gy = g_y ; gy < limite_y ; gy += drawn_y_grid) {
-				p -> drawPoint(gx, gy);
-			}
-		}
-	}
-	p -> restore();
-}
-
-/**
 	Dessine l'arriere-plan de l'editeur, cad l'indicateur de hotspot.
 	@param p Le QPainter a utiliser pour dessiner
 	@param rect Le rectangle de la zone a dessiner
@@ -390,8 +337,8 @@
 	
 	p -> setPen(Qt::red);
 	p -> setBrush(Qt::NoBrush);
-	p -> drawLine(QLineF(0.0, -_hotspot.y(), 0.0, height() - _hotspot.y()));
-	p -> drawLine(QLineF(-_hotspot.x(), 0.0, width() - _hotspot.x(),  0.0));
+	p -> drawLine(-20, 0, 20, 0);
+	p -> drawLine(0, -20, 0, 20);
 	p -> restore();
 }
 
@@ -555,7 +502,7 @@
 	superieur gauche les coordonnees opposees du hotspot.
 */
 QRectF ElementScene::borderRect() const {
-	return(QRectF(-_hotspot, QSizeF(width(), height())));
+	return(QRectF(-elementSceneGeometricRect().topLeft(), QSizeF(width(), height())));
 }
 
 /**
@@ -731,52 +678,6 @@
 }
 
 /**
-	Lance un dialogue pour editer les dimensions et le point de saisie
-	(hotspot) de l'element.
-*/
-void ElementScene::slot_editSizeHotSpot() {
-	bool is_read_only = element_editor && element_editor -> isReadOnly();
-	
-	// cree un dialogue
-	QDialog dialog_sh(element_editor);
-	dialog_sh.setModal(true);
-#ifdef Q_WS_MAC
-	dialog_sh.setWindowFlags(Qt::Sheet);
-#endif
-	dialog_sh.setWindowTitle(tr("\311diter la taille et le point de saisie", "window title"));
-	QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_sh);
-	
-	// ajoute un HotspotEditor au dialogue
-	HotspotEditor *hotspot_editor = new HotspotEditor();
-	hotspot_editor -> setElementWidth(static_cast<uint>(width() / 10));
-	hotspot_editor -> setElementHeight(static_cast<uint>(height() / 10));
-	hotspot_editor -> setHotspot(hotspot());
-	hotspot_editor -> setOldHotspot(hotspot());
-	hotspot_editor -> setPartsRect(elementContentBoundingRect(items()));
-	hotspot_editor -> setPartsRectEnabled(true);
-	hotspot_editor -> setReadOnly(is_read_only);
-	dialog_layout -> addWidget(hotspot_editor);
-	
-	// ajoute deux boutons au dialogue
-	QDialogButtonBox *dialog_buttons = new QDialogButtonBox(is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	dialog_layout -> addWidget(dialog_buttons);
-	connect(dialog_buttons, SIGNAL(accepted()),    &dialog_sh, SLOT(accept()));
-	connect(dialog_buttons, SIGNAL(rejected()),    &dialog_sh, SLOT(reject()));
-	
-	// lance le dialogue
-	if (dialog_sh.exec() == QDialog::Accepted && !is_read_only) {
-		QSize new_size(hotspot_editor -> elementSize());
-		QSize old_size(width(), height());
-		QPoint new_hotspot(hotspot_editor -> hotspot());
-		QPoint old_hotspot(_hotspot);
-		
-		if (new_size != old_size || new_hotspot != old_hotspot) {
-			undo_stack.push(new ChangeHotspotCommand(this, old_size, new_size, old_hotspot, new_hotspot, hotspot_editor -> offsetParts()));
-		}
-	}
-}
-
-/**
 	Lance un dialogue pour editer les noms de cete element
 */
 void ElementScene::slot_editOrientations() {
@@ -1092,25 +993,7 @@
 		}
 		return(false);
 	}
-	
-	// dimensions et hotspot : ces attributs doivent etre presents et valides
-	int w, h, hot_x, hot_y;
-	if (
-		!QET::attributeIsAnInteger(root, QString("width"),     &w) ||\
-		!QET::attributeIsAnInteger(root, QString("height"),    &h) ||\
-		!QET::attributeIsAnInteger(root, QString("hotspot_x"), &hot_x) ||\
-		!QET::attributeIsAnInteger(root, QString("hotspot_y"), &hot_y)
-	) {
-		if (error_message) {
-			*error_message = tr("Les dimensions ou le point de saisie ne sont pas valides.", "error message");
-		}
-		return(false);
-	}
-	//
-	setWidth(w);
-	setHeight(h);
-	setHotspot(QPoint(hot_x, hot_y));
-	
+		
 	// orientations
 	internal_connections = (root.attribute("ic") == "true");
 	

Modified: trunk/sources/editor/elementscene.h
===================================================================
--- trunk/sources/editor/elementscene.h	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/elementscene.h	2013-08-05 13:20:57 UTC (rev 2410)
@@ -63,12 +63,6 @@
 	
 	// attributes
 	private:
-	/// element width, in dozens of pixels
-	uint _width;
-	/// element height, in dozens of pixels
-	uint _height;
-	/// hotspot position
-	QPoint _hotspot;
 	/// List of localized names
 	NamesList _names;
 	/// Set of orientations
@@ -116,12 +110,6 @@
 	
 	// methods
 	public:
-	void setWidth(const uint &);
-	uint width() const;
-	void setHeight(const uint &);
-	uint height() const;
-	void setHotspot(const QPoint &);
-	QPoint hotspot() const;
 	void setNames(const NamesList &);
 	NamesList names() const;
 	OrientationSet orientations();
@@ -158,7 +146,6 @@
 	virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
 	virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
 	virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
-	virtual void drawBackground(QPainter *, const QRectF &);
 	virtual void drawForeground(QPainter *, const QRectF &);
 	virtual void endCurrentBehavior(const QGraphicsSceneMouseEvent *);
 	
@@ -191,7 +178,6 @@
 	void slot_deselectAll();
 	void slot_invertSelection();
 	void slot_delete();
-	void slot_editSizeHotSpot();
 	void slot_editNames();
 	void slot_editOrientations();
 	void slot_editAuthorInformations();
@@ -220,53 +206,8 @@
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(ElementScene::ItemOptions)
 
-/**
-	@param wid the new width for the currently edited element
-*/
-inline void ElementScene::setWidth(const uint &wid) {
-	_width = wid;
-	while (_width % 10) ++ _width;
-	_width /= 10;
-}
 
 /**
-	@return the height of the currently edited element
-*/
-inline uint ElementScene::width() const {
-	return(_width * 10);
-}
-
-/**
-	@param hei the new height for the currently edited element
-*/
-inline void ElementScene::setHeight(const uint &hei) {
-	_height = hei;
-	while (_height % 10) ++ _height;
-	_height /= 10;
-}
-
-/**
-	@return the width of the currently edited element
-*/
-inline uint ElementScene::height() const {
-	return(_height * 10);
-}
-
-/**
-	@param hs the new hotspot for the currently edited element
-*/
-inline void ElementScene::setHotspot(const QPoint &hs) {
-	_hotspot = hs;
-}
-
-/**
-	@return the hotspot of the currently edited element
-*/
-inline QPoint ElementScene::hotspot() const {
-	return(_hotspot);
-}
-
-/**
 	@param nameslist New set of naes for the currently edited element
 */
 inline void ElementScene::setNames(const NamesList &nameslist) {

Modified: trunk/sources/editor/elementview.cpp
===================================================================
--- trunk/sources/editor/elementview.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/elementview.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -408,13 +408,7 @@
 	p -> setPen(Qt::NoPen);
 	p -> setBrush(Qt::white);
 	p -> drawRect(r);
-	
-	// encadre la zone dessinable de l'element
-	QRectF drawable_area(-scene_ -> hotspot().x(), -scene_ -> hotspot().y(), scene_ -> width(), scene_ -> height());
-	p -> setPen(Qt::black);
-	p -> setBrush(Qt::NoBrush);
-	p -> drawRect(drawable_area);
-	
+		
 	// determine le zoom en cours
 	qreal zoom_factor = matrix().m11();
 	

Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/qetelementeditor.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -144,7 +144,6 @@
 	zoom_out        = new QAction(QET::Icons::ZoomOut,              tr("Zoom arri\350re"),                           this);
 	zoom_fit        = new QAction(QET::Icons::ZoomFitBest,          tr("Zoom adapt\351"),                            this);
 	zoom_reset      = new QAction(QET::Icons::ZoomOriginal,         tr("Pas de zoom"),                               this);
-	edit_size_hs    = new QAction(QET::Icons::HotSpot,              tr("\311diter la taille et le point de saisie"), this);
 	edit_names      = new QAction(QET::Icons::Names,                tr("\311diter les noms"),                        this);
 	edit_ori        = new QAction(QET::Icons::Orientations,         tr("\311diter les orientations"),                this);
 	edit_author     = new QAction(QET::Icons::UserInformations,     tr("\311diter les informations sur l'auteur"),   this);
@@ -205,7 +204,6 @@
 	zoom_reset        -> setShortcut(QKeySequence(tr("Ctrl+0")));
 	
 	edit_names        -> setShortcut(QKeySequence(tr("Ctrl+E")));
-	edit_size_hs      -> setShortcut(QKeySequence(tr("Ctrl+R")));
 	edit_ori          -> setShortcut(QKeySequence(tr("Ctrl+T")));
 	edit_author       -> setShortcut(tr("Ctrl+Y"));
 	
@@ -236,7 +234,6 @@
 	connect(zoom_fit,        SIGNAL(triggered()), ce_view,  SLOT(zoomFit()));
 	connect(zoom_reset,      SIGNAL(triggered()), ce_view,  SLOT(zoomReset()));
 	connect(edit_delete,     SIGNAL(triggered()), ce_scene, SLOT(slot_delete()));
-	connect(edit_size_hs,    SIGNAL(triggered()), ce_scene, SLOT(slot_editSizeHotSpot()));
 	connect(edit_names,      SIGNAL(triggered()), ce_scene, SLOT(slot_editNames()));
 	connect(edit_ori,        SIGNAL(triggered()), ce_scene, SLOT(slot_editOrientations()));
 	connect(edit_author,     SIGNAL(triggered()), ce_scene, SLOT(slot_editAuthorInformations()));
@@ -253,7 +250,6 @@
 	connect(add_arc,         SIGNAL(triggered()), ce_scene, SLOT(slot_addArc()));
 	connect(add_terminal,    SIGNAL(triggered()), ce_scene, SLOT(slot_addTerminal()));
 	connect(add_textfield,   SIGNAL(triggered()), ce_scene, SLOT(slot_addTextField()));
-	
 	connect(move,            SIGNAL(triggered()), this,     SLOT(slot_setRubberBandToView()));
 	connect(add_line,        SIGNAL(triggered()), this,     SLOT(slot_setNoDragToView()));
 	connect(add_rectangle,   SIGNAL(triggered()), this,     SLOT(slot_setNoDragToView()));
@@ -321,7 +317,6 @@
 	main_toolbar -> addAction(edit_delete);
 	view_toolbar -> addAction(zoom_fit);
 	view_toolbar -> addAction(zoom_reset);
-	element_toolbar -> addAction(edit_size_hs);
 	element_toolbar -> addAction(edit_names);
 	element_toolbar -> addAction(edit_ori);
 	depth_toolbar -> addAction(edit_forward);
@@ -398,7 +393,6 @@
 	edit_menu -> addAction(edit_delete);
 	edit_menu -> addSeparator();
 	edit_menu -> addAction(edit_names);
-	edit_menu -> addAction(edit_size_hs);
 	edit_menu -> addAction(edit_ori);
 	edit_menu -> addAction(edit_author);
 	edit_menu -> addSeparator();
@@ -627,23 +621,7 @@
 	// liste les avertissements applicables
 	typedef QPair<QString, QString> QETWarning;
 	QList<QETWarning> warnings;
-	
-	/// Avertissement #1 : si les parties semblent deborder du cadre de l'element
-	if (!ce_scene -> borderContainsEveryParts()) {
-		warnings << qMakePair(
-			tr("Dimensions de l'\351l\351ment", "warning title"),
-			tr(
-				"Certaines parties graphiques (textes, cercles, lignes...) "
-				"semblent d\351border du cadre de l'\351l\351ment. Cela "
-				"risque de g\351n\351rer des bugs graphiques lors de leur "
-				"manipulation sur un sch\351ma. Vous pouvez corriger cela soit "
-				"en d\351pla\347ant ces parties, soit en vous rendant dans "
-				"\311dition > \311diter la taille et le point de saisie.",
-				"warning description"
-			)
-		);
-	}
-	
+		
 	/// Avertissement #2 : si l'element ne comporte aucune borne
 	if (!ce_scene -> containsTerminals()) {
 		warnings << qMakePair(

Modified: trunk/sources/editor/qetelementeditor.h
===================================================================
--- trunk/sources/editor/qetelementeditor.h	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/editor/qetelementeditor.h	2013-08-05 13:20:57 UTC (rev 2410)
@@ -92,10 +92,6 @@
 	
 	// methods
 	public:
-	void setSize(const QSize &);
-	QSize size() const;
-	void setHotspot(const QPoint &);
-	QPoint hotspot() const;
 	void setNames(const NamesList &);
 	void setOrientations(const OrientationSet &orientation_set);
 	OrientationSet orientations() const;
@@ -157,40 +153,6 @@
 };
 
 /**
-	@param siz The new size for the currently edited element
-*/
-inline void QETElementEditor::setSize(const QSize &siz) {
-	ce_scene -> setWidth(siz.width());
-	ce_scene -> setHeight(siz.height());
-}
-
-/**
-	@return the size of the currently edited element
-*/
-inline QSize QETElementEditor::size() const {
-	return(
-		QSize(
-			ce_scene -> width(),
-			ce_scene -> height()
-		)
-	);
-}
-
-/**
-	@param hs The new hotspot for the currently edited element
-*/
-inline void QETElementEditor::setHotspot(const QPoint &hs) {
-	ce_scene -> setHotspot(hs);
-}
-
-/**
-	@return the hotspot of the currently edited element
-*/
-inline QPoint QETElementEditor::hotspot() const {
-	return(ce_scene -> hotspot());
-}
-
-/**
 	@param nameslist the new list of names for the currently edited element
 */
 inline void QETElementEditor::setNames(const NamesList &nameslist) {

Deleted: trunk/sources/hotspoteditor.cpp
===================================================================
--- trunk/sources/hotspoteditor.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/hotspoteditor.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -1,329 +0,0 @@
-/*
-	Copyright 2006-2012 Xavier Guerrin
-	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/>.
-*/
-#include "hotspoteditor.h"
-
-/**
-	Constructeur
-	@param parent QWidget parent de cet editeur de hotspot
-*/
-HotspotEditor::HotspotEditor(QWidget *parent) :
-	QWidget(parent),
-	parts_rect_enabled(false)
-{
-	informations_label_ = new QLabel(
-		tr(
-			"L'\351l\351ment doit \352tre assez grand pour contenir tout sa "
-			"repr\351sentation graphique."
-		)
-	);
-	
-	sb_width = new QSpinBox();
-	sb_width -> setMinimum(1);
-	sb_width -> setMaximum(1000);
-	sb_width -> setValue(3);
-	sb_width -> setSuffix(tr(" \32710 px"));
-	sb_height = new QSpinBox();
-	sb_height -> setMinimum(1);
-	sb_height -> setMaximum(1000);
-	sb_height -> setValue(7);
-	sb_height -> setSuffix(tr(" \32710 px"));
-	
-	sb_hotspot_x = new QSpinBox();
-	sb_hotspot_x -> setValue(15);
-	sb_hotspot_x -> setSuffix(tr(" px"));
-	sb_hotspot_x -> setSingleStep(10);
-	sb_hotspot_y = new QSpinBox();
-	sb_hotspot_y -> setValue(35);
-	sb_hotspot_y -> setSuffix(tr(" px"));
-	sb_hotspot_y -> setSingleStep(10);
-	
-	diagram_scene = new Diagram();
-	diagram_scene -> border_and_titleblock.setColumnsWidth(50.0);
-	diagram_scene -> border_and_titleblock.setColumnsCount(3);
-	diagram_scene -> border_and_titleblock.setRowsHeight(60.0);
-	diagram_scene -> border_and_titleblock.setRowsCount(2);
-	diagram_scene -> border_and_titleblock.displayRows(false);
-	diagram_scene -> border_and_titleblock.displayTitleBlock(false);
-	
-	diagram_view = new QGraphicsView(diagram_scene);
-	diagram_view -> setMinimumSize(
-		qRound(diagram_scene -> border_and_titleblock.diagramWidth()  + (3 * Diagram::margin)),
-		qRound(diagram_scene -> border_and_titleblock.diagramHeight() + (3 * Diagram::margin))
-	);
-	diagram_view -> setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
-	diagram_view -> setResizeAnchor(QGraphicsView::AnchorUnderMouse);
-	diagram_view -> setAlignment(Qt::AlignLeft | Qt::AlignTop);
-	
-	hotspot_sync = new QCheckBox(tr("D\351placer l'\351l\351ment avec le hotspot"));
-	hotspot_sync -> setChecked(true);
-	// TODO setvisible to disable checkbox hotspot_sync
-	// one for remove bug in element editor after un move hotspot_sync, selection is not focused on primitives
-	// two is not specialy used
-	// and for future auto boudinrect hotspot
-	hotspot_sync -> setVisible(false);
-	
-	connect(sb_width,     SIGNAL(valueChanged(int)), this, SLOT(updateHotspotLimits()));
-	connect(sb_height,    SIGNAL(valueChanged(int)), this, SLOT(updateHotspotLimits()));
-	connect(sb_width,     SIGNAL(valueChanged(int)), this, SLOT(updateScene()));
-	connect(sb_height,    SIGNAL(valueChanged(int)), this, SLOT(updateScene()));
-	connect(sb_hotspot_x, SIGNAL(valueChanged(int)), this, SLOT(updateScene()));
-	connect(sb_hotspot_y, SIGNAL(valueChanged(int)), this, SLOT(updateScene()));
-	connect(hotspot_sync, SIGNAL(stateChanged(int)), this, SLOT(updateScene()));
-	
-	QGridLayout *grid_layout = new QGridLayout();
-	grid_layout -> addWidget(new QLabel(tr("<span style=\"text-decoration:underline;\">Dimensions</span>")),   0, 0);
-	grid_layout -> addWidget(new QLabel(tr("Largeur :")),      1, 0);
-	grid_layout -> addWidget(sb_width,                         1, 1);
-	grid_layout -> addWidget(new QLabel(tr("Hauteur :")),      2, 0);
-	grid_layout -> addWidget(sb_height,                        2, 1);
-	grid_layout -> addWidget(new QLabel(tr("<span style=\"text-decoration:underline;\">Hotspot</span>")),      3, 0);
-	grid_layout -> addWidget(new QLabel(tr("Abscisse :")),     4, 0);
-	grid_layout -> addWidget(sb_hotspot_x,                     4, 1);
-	grid_layout -> addWidget(new QLabel(tr("Ordonn\351e :")),  5, 0);
-	grid_layout -> addWidget(sb_hotspot_y,                     5, 1);
-	grid_layout -> setRowStretch(6, 500);
-	grid_layout -> setSpacing(3);
-	
-	QHBoxLayout *hlayout = new QHBoxLayout();
-	hlayout -> addLayout(grid_layout,    1);
-	hlayout -> addWidget(diagram_view, 500);
-	
-	vlayout = new QVBoxLayout(this);
-	vlayout -> setSpacing(0);
-	vlayout -> addWidget(informations_label_);
-	vlayout -> addLayout(hlayout, 1);
-	
-	updateScene();
-	updateHotspotLimits();
-}
-
-/// @param w Nouvelle largeur de l'element, en dizaines de pixels
-void HotspotEditor::setElementWidth(uint w) {
-	sb_width -> setValue(w);
-}
-
-/// @param h Nouvelle hauteur de l'element, en dizaines de pixels
-void HotspotEditor::setElementHeight(uint h) {
-	sb_height -> setValue(h);
-}
-
-/// @return la Largeur de l'element en dizaines de pixels
-uint HotspotEditor::elementWidth10px() const {
-	return(sb_width -> value());
-}
-
-/// @return la hauteur de l'element en dizaines de pixels
-uint HotspotEditor::elementHeight10px() const {
-	return(sb_height -> value());
-}
-
-/// @return la Largeur de l'element en pixels
-uint HotspotEditor::elementWidth() const {
-	return(sb_width -> value() * 10);
-}
-
-/// @return la hauteur de l'element en pixels
-uint HotspotEditor::elementHeight() const {
-	return(sb_height -> value() * 10);
-}
-
-/// @param size La nouvelle taille de l'element, en dizaines de pixels
-void HotspotEditor::setElementSize(const QSize &size) {
-	setElementWidth(size.width());
-	setElementWidth(size.height());
-}
-
-/// @return la taille de l'element, en dizaines de pixels
-QSize HotspotEditor::elementSize10px() const {
-	return(QSize(elementWidth10px(), elementHeight10px()));
-}
-
-/// @return la taille de l'element, en pixels
-QSize HotspotEditor::elementSize() const {
-	return(QSize(elementWidth(), elementHeight()));
-}
-
-/// @param hs Nouvelle position du hotspot
-void HotspotEditor::setHotspot(const QPoint &hs) {
-	sb_hotspot_x -> setValue(hs.x());
-	sb_hotspot_y -> setValue(hs.y());
-}
-
-/// @return les coordonnees du hotspot de l'element
-QPoint HotspotEditor::hotspot() const {
-	return(QPoint(sb_hotspot_x -> value(), sb_hotspot_y -> value()));
-}
-
-/// @param o_h l'ancien hotspot en cas d'edition du hotspot
-void HotspotEditor::setOldHotspot(const QPoint &o_h) {
-	old_hotspot = o_h;
-}
-
-/// @return l'ancien hotspot en cas d'edition du hotspot
-QPoint HotspotEditor::oldHotspot() const {
-	return(old_hotspot);
-}
-
-/**
-	Specifie le rectangle delimitant les parties de l'element
-	@param rect rectangle delimitant les parties de l'element
-*/
-void HotspotEditor::setPartsRect(const QRectF &rect) {
-	parts_rect = rect;
-}
-
-/// @return le rectangle delimitant les parties de l'element
-QRectF HotspotEditor::partsRect() const {
-	return(parts_rect);
-}
-
-/**
-	@param a true pour activer l'affichage du rectangle representant l'element,
-	false pour le desactiver
-*/
-void HotspotEditor::setPartsRectEnabled(bool a) {
-	if (a != parts_rect_enabled) {
-		if (a) vlayout -> addWidget(hotspot_sync);
-		else vlayout -> removeWidget(hotspot_sync);
-	}
-	parts_rect_enabled = a;
-	updateScene();
-}
-
-/**
-	@return true si l'affichage du rectangle representant l'element est active,
-	false sinon
-*/
-bool HotspotEditor::partsRectEnabled() {
-	return(parts_rect_enabled);
-}
-
-/// @return true s'il sera necessaire d'appliquer une translation aux parties de l'elements
-bool HotspotEditor::mustTranslateParts() const {
-	// il sera necessaire d'appliquer une translation aux parties de l'elements
-	// si le hotspot a ete change et si l'element ne suit pas le hotspot
-	bool hotspot_change = !old_hotspot.isNull() && old_hotspot != hotspot();
-	return(hotspot_change && !hotspot_sync -> isChecked());
-}
-
-/// @return La translation a faire subir aux parties de l'element apres l'edition du hotspot
-QPoint HotspotEditor::offsetParts() const {
-	// si le hotspot n'a pas ete change ou si l'element doit suivre le hotspot,
-	// il n'est pas necessaire d'appliquer une translation aux parties de
-	// l'elements
-	if (!mustTranslateParts()) return(QPoint(0,0));
-	else return(old_hotspot - hotspot());
-}
-
-/**
-	@return true si ce widget est en lecture seule, false sinon
-*/
-bool HotspotEditor::isReadOnly() const {
-	return(sb_width -> isReadOnly());
-}
-
-/**
-	@param ro true pour passer ce widget en lecture seule, false sinon
-*/
-void HotspotEditor::setReadOnly(bool ro) {
-	sb_width     -> setReadOnly(ro);
-	sb_height    -> setReadOnly(ro);
-	sb_hotspot_x -> setReadOnly(ro);
-	sb_hotspot_y -> setReadOnly(ro);
-	hotspot_sync -> setDisabled(ro);
-}
-
-/**
-	Met a jour le schema
-*/
-void HotspotEditor::updateScene() {
-	// nettoie la scene
-	foreach (QGraphicsItem *qgi, diagram_scene -> items()) {
-		diagram_scene -> removeItem(qgi);
-		delete qgi;
-	}
-	
-	int elmt_width  = sb_width  -> value() * 10;
-	int elmt_height = sb_height -> value() * 10;
-	int hotspot_x   = sb_hotspot_x -> value();
-	int hotspot_y   = sb_hotspot_y -> value();
-	int margin_x = 10;
-	int margin_y = 30;
-	
-	// dessin du cadre representant les dimensions de l'element
-	diagram_scene -> addRect(QRectF(margin_x, margin_y, elmt_width, elmt_height));
-	
-	// dessin des deux segments representant le point de saisie de l'element
-	QPen hotspot_pen(Qt::red);
-	QGraphicsLineItem *line_hotspot_x = diagram_scene -> addLine(
-		QLine(
-			margin_x,
-			margin_y + hotspot_y,
-			margin_x + elmt_width,
-			margin_y + hotspot_y
-		),
-		hotspot_pen
-	);
-	QGraphicsLineItem *line_hotspot_y = diagram_scene -> addLine(
-		QLine(
-			margin_x + hotspot_x,
-			margin_y,
-			margin_x + hotspot_x,
-			margin_y + elmt_height
-		),
-		hotspot_pen
-	);
-	line_hotspot_x -> setZValue(10);
-	line_hotspot_y -> setZValue(10);
-	
-	// dessin eventuel du rectangle representant l'element
-	if (parts_rect_enabled) {
-		QPen element_pen(Qt::blue);
-		QBrush element_brush(QColor(0, 0, 255, 100));
-		QRectF parts_rect_to_draw;
-		
-		if (!hotspot_sync -> isChecked() && !old_hotspot.isNull()) {
-			// coordonnees de l'ancien hotspot sur le schema
-			QPointF current_old_hotspotf(margin_x + old_hotspot.x(), margin_y + old_hotspot.y());
-			QPoint current_old_hotspot(current_old_hotspotf.toPoint());
-			
-			// laisse l'element en place par rapport au coin superieur gauche
-			parts_rect_to_draw = parts_rect.translated(current_old_hotspot);
-		} else {
-			// coordonnees du nouveau hotspot sur le schema
-			QPointF current_hotspotf(line_hotspot_y -> line().x1(), line_hotspot_x -> line().y1());
-			QPoint current_hotspot(current_hotspotf.toPoint());
-			
-			// deplace l'element en meme temps que le hotspot
-			parts_rect_to_draw = parts_rect.translated(current_hotspot);
-		}
-		QGraphicsRectItem *rect_element = diagram_scene -> addRect(parts_rect_to_draw, element_pen, element_brush);
-		rect_element -> setZValue(5);
-	}
-	
-	diagram_scene -> setSceneRect(QRect(0, 0, elmt_width + (2 * margin_x) + 15, elmt_height + (2 * margin_y)));
-	diagram_scene -> update();
-}
-
-/**
-	Met a jour les limites des QSpinBox
-*/
-void HotspotEditor::updateHotspotLimits() {
-	sb_hotspot_x -> setMaximum(sb_width  -> value() * 10);
-	sb_hotspot_y -> setMaximum(sb_height -> value() * 10);
-}

Deleted: trunk/sources/hotspoteditor.h
===================================================================
--- trunk/sources/hotspoteditor.h	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/hotspoteditor.h	2013-08-05 13:20:57 UTC (rev 2410)
@@ -1,80 +0,0 @@
-/*
-	Copyright 2006-2012 Xavier Guerrin
-	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/>.
-*/
-#ifndef HOTSPOT_EDITOR_H
-#define HOTSPOT_EDITOR_H
-#include <QtGui>
-#include "diagram.h"
-/**
-	This widget enable users to edit the dimensions and the hotspot of an
-	electrical element.
-*/
-class HotspotEditor : public QWidget {
-	Q_OBJECT
-	
-	// constructors, destructor
-	public:
-	HotspotEditor(QWidget * = 0);
-	virtual ~HotspotEditor() {};
-	
-	private:
-	HotspotEditor(const HotspotEditor &);
-	
-	// attributes
-	private:
-	QLabel *informations_label_;
-	QSpinBox *sb_width;
-	QSpinBox *sb_height;
-	QSpinBox *sb_hotspot_x;
-	QSpinBox *sb_hotspot_y;
-	QCheckBox *hotspot_sync;
-	Diagram *diagram_scene;
-	QGraphicsView *diagram_view;
-	QRectF parts_rect;
-	QPoint old_hotspot;
-	bool parts_rect_enabled;
-	QVBoxLayout *vlayout;
-	
-	// methods
-	public:
-	void setElementWidth(uint);
-	void setElementHeight(uint);
-	uint elementWidth10px() const;
-	uint elementWidth() const;
-	uint elementHeight10px() const;
-	uint elementHeight() const;
-	void setElementSize(const QSize &);
-	QSize elementSize10px() const;
-	QSize elementSize() const;
-	void setHotspot(const QPoint &);
-	QPoint hotspot() const;
-	void setOldHotspot(const QPoint &);
-	QPoint oldHotspot() const;
-	void setPartsRect(const QRectF &);
-	QRectF partsRect() const;
-	void setPartsRectEnabled(bool);
-	bool partsRectEnabled();
-	bool mustTranslateParts() const;
-	QPoint offsetParts() const;
-	bool isReadOnly() const;
-	void setReadOnly(bool);
-	
-	public slots:
-	void updateScene();
-	void updateHotspotLimits();
-};
-#endif

Modified: trunk/sources/newelementwizard.cpp
===================================================================
--- trunk/sources/newelementwizard.cpp	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/newelementwizard.cpp	2013-08-05 13:20:57 UTC (rev 2410)
@@ -21,7 +21,6 @@
 #include "elementscategorieslist.h"
 #include "nameslistwidget.h"
 #include "orientationsetwidget.h"
-#include "hotspoteditor.h"
 #include "element.h"
 #include "qetelementeditor.h"
 #include "qet.h"
@@ -50,7 +49,6 @@
 	addPage(buildStep2());
 	addPage(buildStep3());
 	addPage(buildStep4());
-	addPage(buildStep5());
 	setFixedSize(705, 325);
 }
 
@@ -94,7 +92,7 @@
 QWizardPage *NewElementWizard::buildStep1() {
 	QWizardPage *page = new QWizardPage();
 	page -> setProperty("WizardState", Category);
-	page -> setTitle(tr("\311tape 1/5 : Cat\351gorie parente", "wizard page title"));
+	page -> setTitle(tr("\311tape 1/4 : Cat\351gorie parente", "wizard page title"));
 	page -> setSubTitle(tr("S\351lectionnez une cat\351gorie dans laquelle enregistrer le nouvel \351l\351ment.", "wizard page subtitle"));
 	QVBoxLayout *layout = new QVBoxLayout();
 	
@@ -111,7 +109,7 @@
 QWizardPage *NewElementWizard::buildStep2() {
 	QWizardPage *page = new QWizardPage();
 	page -> setProperty("WizardState", Filename);
-	page -> setTitle(tr("\311tape 2/5 : Nom du fichier", "wizard page title"));
+	page -> setTitle(tr("\311tape 2/4 : Nom du fichier", "wizard page title"));
 	page -> setSubTitle(tr("Indiquez le nom du fichier dans lequel enregistrer le nouvel \351l\351ment.", "wizard page subtitle"));
 	QVBoxLayout *layout = new QVBoxLayout();
 	
@@ -134,7 +132,7 @@
 QWizardPage *NewElementWizard::buildStep3() {
 	QWizardPage *page = new QWizardPage();
 	page -> setProperty("WizardState", Names);
-	page -> setTitle(tr("\311tape 3/5 : Noms de l'\351l\351ment", "wizard page title"));
+	page -> setTitle(tr("\311tape 3/4 : Noms de l'\351l\351ment", "wizard page title"));
 	page -> setSubTitle(tr("Indiquez le ou les noms de l'\351l\351ment.", "wizard page subtitle"));
 	QVBoxLayout *layout = new QVBoxLayout();
 	
@@ -149,30 +147,12 @@
 }
 
 /**
-	Met en place l'etape 4 : Dimensions et Hotspot
+	Met en place l'etape 4 : orientations possibles pour le nouvel element
 */
 QWizardPage *NewElementWizard::buildStep4() {
 	QWizardPage *page = new QWizardPage();
-	page -> setProperty("WizardState", Dimensions);
-	page -> setTitle(tr("\311tape 4/5 : Dimensions et point de saisie", "wizard page title"));
-	page -> setSubTitle(tr("Saisissez les dimensions du nouvel \351l\351ment ainsi que la position du hotspot (point de saisie de l'\351l\351ment \340 la souris) en consid\351rant que l'\351l\351ment est dans son orientation par d\351faut.", "wizard page subtitle"));
-	QVBoxLayout *layout = new QVBoxLayout();
-	
-	hotspot_editor = new HotspotEditor();
-	layout -> addWidget(hotspot_editor, 0);
-	layout -> setSpacing(0);
-	
-	page -> setLayout(layout);
-	return(page);
-}
-
-/**
-	Met en place l'etape 5 : orientations possibles pour le nouvel element
-*/
-QWizardPage *NewElementWizard::buildStep5() {
-	QWizardPage *page = new QWizardPage();
 	page -> setProperty("WizardState", Orientations);
-	page -> setTitle(tr("\311tape 5/5 : Orientations", "wizard page title"));
+	page -> setTitle(tr("\311tape 4/4 : Orientations", "wizard page title"));
 	page -> setSubTitle(tr("Indiquez les orientations possibles pour le nouvel \351l\351ment.", "wizard page subtitle"));
 	QVBoxLayout *layout = new QVBoxLayout();
 	
@@ -274,8 +254,6 @@
 */
 void NewElementWizard::createNewElement() {
 	QETElementEditor *edit_new_element = new QETElementEditor(parentWidget());
-	edit_new_element -> setSize(hotspot_editor -> elementSize());
-	edit_new_element -> setHotspot(hotspot_editor -> hotspot());
 	edit_new_element -> setNames(element_names -> names());
 	edit_new_element -> setOrientations(orientation_set -> orientationSet());
 	

Modified: trunk/sources/newelementwizard.h
===================================================================
--- trunk/sources/newelementwizard.h	2013-08-03 21:33:08 UTC (rev 2409)
+++ trunk/sources/newelementwizard.h	2013-08-05 13:20:57 UTC (rev 2410)
@@ -22,7 +22,6 @@
 class ElementsCategory;
 class NamesListWidget;
 class OrientationSetWidget;
-class HotspotEditor;
 class QFileNameEdit;
 /**
 	This class provides a wizard dialog enabling users to to specify the basic
@@ -59,7 +58,6 @@
 	QFileNameEdit *qle_filename;
 	NamesListWidget *element_names;
 	OrientationSetWidget *orientation_set;
-	HotspotEditor *hotspot_editor;
 	WizardState current_state;
 	QString chosen_file;
 	ElementsCategory *chosen_category;
@@ -70,7 +68,6 @@
 	QWizardPage *buildStep2();
 	QWizardPage *buildStep3();
 	QWizardPage *buildStep4();
-	QWizardPage *buildStep5();
 	bool validStep1();
 	bool validStep2();
 	bool validateCurrentPage();


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/