[qet] qet/qet: [5264] Element editor : remove all sources code related to the old text field

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


Revision: 5264
Author:   blacksun
Date:     2018-03-11 16:11:08 +0100 (Sun, 11 Mar 2018)
Log Message:
-----------
Element editor : remove all sources code related to the old text field

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

Removed Paths:
-------------
    trunk/sources/editor/esevent/eseventaddtextfield.cpp
    trunk/sources/editor/esevent/eseventaddtextfield.h
    trunk/sources/editor/graphicspart/parttextfield.cpp
    trunk/sources/editor/graphicspart/parttextfield.h
    trunk/sources/editor/textfieldeditor.cpp
    trunk/sources/editor/textfieldeditor.h

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/elementscene.cpp	2018-03-11 15:11:08 UTC (rev 5264)
@@ -25,7 +25,6 @@
 #include "partpolygon.h"
 #include "partterminal.h"
 #include "parttext.h"
-#include "parttextfield.h"
 #include "partarc.h"
 #include "editorcommands.h"
 #include "elementcontent.h"
@@ -442,7 +441,6 @@
 	foreach (QGraphicsItem *qgi, items()) {
 		if (qgi->type() == ElementPrimitiveDecorator::Type) continue;
 		if (qgi->type() == QGraphicsRectItem::Type) continue;
-		if (qgi->type() == PartTextField::Type) continue;
 		if (qgi->type() == PartDynamicTextField::Type) continue;
 		if (CustomElementPart *cep = dynamic_cast <CustomElementPart*> (qgi)) {
 			esgr |= cep -> sceneGeometricRect();

Deleted: trunk/sources/editor/esevent/eseventaddtextfield.cpp
===================================================================
--- trunk/sources/editor/esevent/eseventaddtextfield.cpp	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/esevent/eseventaddtextfield.cpp	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,78 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 <QObject>
-
-#include "parttextfield.h"
-#include "editorcommands.h"
-#include "elementscene.h"
-#include "eseventaddtextfield.h"
-
-/**
- * @brief ESEventAddTextField::ESEventAddTextField
- * @param scene
- */
-ESEventAddTextField::ESEventAddTextField(ElementScene *scene) :
-	ESEventInterface(scene)
-{
-	m_text = new PartTextField(m_editor);
-	m_scene -> addItem(m_text);
-	m_running = true;
-}
-
-/**
- * @brief ESEventAddTextField::~ESEventAddTextField
- */
-ESEventAddTextField::~ESEventAddTextField() {
-		delete m_text;
-}
-
-/**
- * @brief ESEventAddTextField::ESEventAddTextField
- * @param event
- * @return
- */
-bool ESEventAddTextField::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
-	QPointF pos = m_scene -> snapToGrid(event -> scenePos());
-	updateHelpCross(pos);
-	m_text->setPos(pos);
-	return true;
-}
-
-/**
- * @brief ESEventAddTextField::ESEventAddTextField
- * @param event
- * @return
- */
-bool ESEventAddTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
-	if (event->button() == Qt::LeftButton) {
-		m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Champ texte"), m_scene, m_text));
-
-		//Set new text
-		m_text = new PartTextField(m_editor);
-		m_scene -> addItem(m_text);
-		m_text -> setPos(m_scene -> snapToGrid(event -> scenePos()));
-
-		return true;
-	}
-	else if (event->button() == Qt::RightButton) {
-		m_running = false;
-		return true;
-	}
-
-	return false;
-}

Deleted: trunk/sources/editor/esevent/eseventaddtextfield.h
===================================================================
--- trunk/sources/editor/esevent/eseventaddtextfield.h	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/esevent/eseventaddtextfield.h	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,44 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 ESEVENTADDTEXTFIELD_H
-#define ESEVENTADDTEXTFIELD_H
-
-#include "eseventinterface.h"
-
-class ElementScene;
-class PartTextField;
-class QGraphicsSceneMouseEvent;
-
-/**
- * @brief The ESEventAddTextField class
- * This ESEvent manage creation of text field in an ElementScene
- */
-class ESEventAddTextField : public ESEventInterface
-{
-	public:
-		ESEventAddTextField(ElementScene *scene);
-		~ESEventAddTextField() override;
-
-		bool mouseMoveEvent    (QGraphicsSceneMouseEvent *event) override;
-		bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override;
-
-	private:
-		PartTextField *m_text;
-};
-
-#endif // ESEVENTADDTEXTFIELD_H

Deleted: trunk/sources/editor/graphicspart/parttextfield.cpp
===================================================================
--- trunk/sources/editor/graphicspart/parttextfield.cpp	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/graphicspart/parttextfield.cpp	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,315 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 "parttextfield.h"
-#include "textfieldeditor.h"
-#include "elementprimitivedecorator.h"
-#include "qetapp.h"
-#include "QPropertyUndoCommand/qpropertyundocommand.h"
-#include "elementscene.h"
-
-/**
-	Constructeur
-	@param editor L'editeur d'element concerne
-	@param parent Le QGraphicsItem parent de ce champ de texte
-*/
-PartTextField::PartTextField(QETElementEditor *editor, QGraphicsItem *parent) :
-	QGraphicsTextItem(parent),
-	CustomElementPart(editor),
-	follow_parent_rotations(true),
-	m_tagg("none"),
-    previous_text()
-{
-	setDefaultTextColor(Qt::black);
-	setFont(QETApp::diagramTextsFont());
-	real_font_size_ = font().pointSize();
-    setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges | QGraphicsItem::ItemIsMovable);
-	setAcceptHoverEvents(true);
-	setPlainText(QObject::tr("_", "default text when adding a textfield in the element editor"));
-	
-	adjustItemPosition(1);
-	// adjust textfield position after line additions/deletions
-	connect(document(), SIGNAL(blockCountChanged(int)), this, SLOT(adjustItemPosition(int)));
-	connect(document(), SIGNAL(contentsChanged()),      this, SLOT(adjustItemPosition()));
-}
-
-/// Destructeur
-PartTextField::~PartTextField() {
-}
-
-/**
-	Importe les proprietes d'un champ de texte depuis un element XML
-	@param xml_element Element XML a lire
-*/
-void PartTextField::fromXml(const QDomElement &xml_element) {
-	bool ok;
-	int font_size = xml_element.attribute("size").toInt(&ok);
-	if (!ok || font_size < 1) font_size = 20;
-	
-	setProperty("size", font_size);
-	setPlainText(xml_element.attribute("text"));
-
-	m_tagg = xml_element.attribute("tagg", "none");
-	
-	qreal default_rotation_angle = 0.0;
-	if (QET::attributeIsAReal(xml_element, "rotation", &default_rotation_angle)) {
-		setRotationAngle(default_rotation_angle);
-	}
-	
-	setPos(
-		xml_element.attribute("x").toDouble(),
-		xml_element.attribute("y").toDouble()
-	);
-	
-	follow_parent_rotations = (xml_element.attribute("rotate") == "true");
-}
-
-/**
-	Exporte le champ de texte en XML
-	@param xml_document Document XML a utiliser pour creer l'element XML
-	@return un element XML decrivant le champ de texte
-*/
-const QDomElement PartTextField::toXml(QDomDocument &xml_document) const {
-	QDomElement xml_element = xml_document.createElement("input");
-	xml_element.setAttribute("x", QString("%1").arg(pos().x()));
-	xml_element.setAttribute("y", QString("%1").arg(pos().y()));
-	xml_element.setAttribute("text", toPlainText());
-	xml_element.setAttribute("size", font().pointSize());
-	xml_element.setAttribute("tagg", m_tagg);
-
-	// angle de rotation du champ de texte
-	if (rotation()) {
-		xml_element.setAttribute("rotation", QString("%1").arg(rotation()));
-	}
-	// suivi (ou non) des rotations de l'element parent par le champ de texte
-	if (follow_parent_rotations) {
-		xml_element.setAttribute("rotate", "true");
-	}
-	return(xml_element);
-}
-
-void PartTextField::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
-    if((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable))
-    {
-        QPointF pos = event->scenePos() + (m_origine_pos - event->buttonDownScenePos(Qt::LeftButton));
-        event->modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene()->snapToGrid(pos));
-    }
-    else
-        QGraphicsObject::mouseMoveEvent(event);
-}
-
-void PartTextField::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-    if(event->button() == Qt::LeftButton)
-        m_origine_pos = this->pos();
-
-    QGraphicsObject::mousePressEvent(event);
-}
-
-void PartTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
-    if((event->button() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable) && m_origine_pos != pos())
-    {
-        QPropertyUndoCommand *undo = new QPropertyUndoCommand(this, "pos", QVariant(m_origine_pos), QVariant(pos()));
-        undo->setText(tr("Déplacer un champ texte"));
-        undo->enableAnimation();
-        elementScene()->undoStack().push(undo);
-    }
-
-    QGraphicsObject::mouseReleaseEvent(event);
-}
-
-/**
- * @brief PartTextField::focusInEvent
- * @param e The QFocusEvent object describing the focus gain.
-    Start text edition when the item gains focus.
- */
-void PartTextField::focusInEvent(QFocusEvent *e) {
-	startEdition();
-	QGraphicsTextItem::focusInEvent(e);
-}
-
-/**
-	Permet a l'element texte de redevenir deplacable a la fin de l'edition de texte
-	@param e Le QFocusEvent decrivant la perte de focus
-*/
-void PartTextField::focusOutEvent(QFocusEvent *e) {
-	QGraphicsTextItem::focusOutEvent(e);
-	endEdition();
-}
-
-/**
-	@reimp QGraphicsTextItem::keyPressEvent()
-	Used to handle the escape key when the event is delivered to the field, not
-	to the decorator.
-*/
-void PartTextField::keyPressEvent(QKeyEvent *event) {
-	if (event -> key() == Qt::Key_Escape) {
-		endEdition();
-	}
-	else {
-		QGraphicsTextItem::keyPressEvent(event);
-	}
-}
-
-/**
-	Permet a l'element texte de devenir editable lorsqu'on double-clique dessus
-	@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
-*/
-void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
-	QGraphicsTextItem::mouseDoubleClickEvent(e);
-	if (e -> button() == Qt::LeftButton) {
-		setEditable(true);
-	}
-}
-
-/**
-	Gere les changements intervenant sur cette partie
-	@param change Type de changement
-	@param value Valeur numerique relative au changement
-*/
-QVariant PartTextField::itemChange(GraphicsItemChange change, const QVariant &value) {
-	if (change == QGraphicsItem::ItemPositionHasChanged || change == QGraphicsItem::ItemSceneHasChanged) {
-		updateCurrentPartEditor();
-	} else if (change == QGraphicsItem::ItemSelectedHasChanged) {
-		if (value.toBool() == true) {
-			updateCurrentPartEditor();
-		}
-	}
-	return(QGraphicsTextItem::itemChange(change, value));
-}
-
-/**
-	@return le rectangle delimitant cette partie.
-*/
-QRectF PartTextField::boundingRect() const {
-	QRectF r = QGraphicsTextItem::boundingRect();
-	r.adjust(0.0, -1.1, 0.0, 0.0);
-	return(r);
-}
-
-/**
-	@return true si cette partie n'est pas pertinente et ne merite pas d'etre
-	conservee / enregistree.
-	Un champ de texte est toujours pertinent ; cette fonction renvoie donc
-	toujours false
-*/
-bool PartTextField::isUseless() const {
-	return(false);
-}
-
-/**
-	@return the minimum, margin-less rectangle this part can fit into, in scene
-	coordinates. It is different from boundingRect() because it is not supposed
-	to imply any margin, and it is different from shape because it is a regular
-	rectangle, not a complex shape.
-*/
-QRectF PartTextField::sceneGeometricRect() const {
-	return(sceneBoundingRect());
-}
-
-/**
-	Start the user-induced transformation, provided this primitive is contained
-	within the \a initial_selection_rect bounding rectangle.
-*/
-void PartTextField::startUserTransformation(const QRectF &initial_selection_rect) {
-	Q_UNUSED(initial_selection_rect)
-	saved_point_ = pos(); // scene coordinates, no need to mapFromScene()
-	saved_font_size_ = real_font_size_;
-}
-
-/**
-	Handle the user-induced transformation from \a initial_selection_rect to \a new_selection_rect
-*/
-void PartTextField::handleUserTransformation(const QRectF &initial_selection_rect, const QRectF &new_selection_rect) {
-	// let's try the naive approach
-	QPointF new_pos = mapPoints(initial_selection_rect, new_selection_rect, QList<QPointF>() << saved_point_).first();
-	setPos(new_pos);
-	
-	// adjust the font size following the vertical scale factor
-	qreal sy = new_selection_rect.height() / initial_selection_rect.height();
-	qreal new_font_size = saved_font_size_ * sy;
-	setProperty("real_size", qMax(1, qRound(new_font_size)));
-}
-
-/**
-	Cette methode s'assure que la position du champ de texte est coherente
-	en repositionnant son origine (c-a-d le milieu du bord gauche du champ de
-	texte) a la position originale. Cela est notamment utile lorsque le champ
-	de texte est agrandi ou retreci verticalement (ajout ou retrait de lignes).
-	@param new_block_count Nombre de blocs dans le PartTextField
-*/
-void PartTextField::adjustItemPosition(int new_block_count) {
-	Q_UNUSED(new_block_count);
-	qreal origin_offset = boundingRect().bottom() / 2.0;
-	
-	QTransform base_translation;
-	base_translation.translate(0.0, -origin_offset);
-	setTransform(base_translation, false);
-	setTransformOriginPoint(0.0, origin_offset);
-}
-
-/**
-	@param editable Whether this text item should be interactively editable.
-*/
-void PartTextField::setEditable(bool editable) {
-	if (editable) {
-		setFlag(QGraphicsItem::ItemIsFocusable, true);
-		setTextInteractionFlags(Qt::TextEditorInteraction);
-		setFocus(Qt::MouseFocusReason);
-	}
-	else {
-		setTextInteractionFlags(Qt::NoTextInteraction);
-		setFlag(QGraphicsItem::ItemIsFocusable, false);
-	}
-}
-
-/**
-	Start text edition by storing the former value of the text.
-*/
-void PartTextField::startEdition() {
-	// !previous_text.isNull() means the text is being edited
-	previous_text = toPlainText();
-}
-
-/**
-	End text edition, potentially generating a ChangePartCommand if the text
-	has changed.
-*/
-void PartTextField::endEdition()
-{
-	if (!previous_text.isNull())
-	{
-			// the text was being edited
-		QString new_text = toPlainText();
-		if (previous_text != new_text)
-		{
-			QPropertyUndoCommand *undo = new QPropertyUndoCommand(this, "text", previous_text, new_text);
-			undo->setText(tr("Modifier un champ texte"));
-			undoStack().push(undo);
-			previous_text = QString();
-		}
-	}
-	
-	// deselectionne le texte
-	QTextCursor qtc = textCursor();
-	qtc.clearSelection();
-	setTextCursor(qtc);
-	
-	setEditable(false);
-}

Deleted: trunk/sources/editor/graphicspart/parttextfield.h
===================================================================
--- trunk/sources/editor/graphicspart/parttextfield.h	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/graphicspart/parttextfield.h	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,117 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 PART_TEXTFIELD_H
-#define PART_TEXTFIELD_H
-#include <QtWidgets>
-#include "customelementpart.h"
-#include "qetapp.h"
-class TextFieldEditor;
-class QETElementEditor;
-class ElementPrimitiveDecorator;
-/**
-	This class represents an editable text field which may be used to compose the
-	drawing of an electrical element within the element editor. Users may specify
-	a default value. The field will remain editable once the element is added onto
-	a diagram. lorsque l'element sera pose sur un schema.
-*/
-class PartTextField : public QGraphicsTextItem, public CustomElementPart
-{
-	Q_OBJECT
-	
-	// constructors, destructor
-	public:
-    PartTextField(QETElementEditor *, QGraphicsItem * = nullptr);
-	~PartTextField() override;
-	
-	private:
-	PartTextField(const PartTextField &);
-	
-	// attributes
-	bool follow_parent_rotations;
-	QString m_tagg;
-	
-	// methods
-	public:
-	enum { Type = UserType + 1108 };
-	/**
-		Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
-		PartTextField.
-		@return the QGraphicsItem type
-	*/
-	int type() const override { return Type; }
-	QString name() const override { return(QObject::tr("champ de texte", "element part name")); }
-	QString xmlName() const override { return(QString("input")); }
-	void fromXml(const QDomElement &) override;
-	const QDomElement toXml(QDomDocument &) const override;
-	bool isUseless() const override;
-	QRectF sceneGeometricRect() const override;
-	void startUserTransformation(const QRectF &) override;
-	void handleUserTransformation(const QRectF &, const QRectF &) override;
-
-	///PROPERTY
-	void setProperty(const char *name, const QVariant &value) override {QGraphicsTextItem::setProperty(name, value);}
-	QVariant property(const char *name) const override {return QGraphicsTextItem::property(name);}
-
-	// displayed text
-	Q_PROPERTY(QString text READ toPlainText WRITE setPlainText)
-	// font size
-	Q_PROPERTY(int   size READ size  WRITE setSize)
-		int size() const {return font().pointSize();}
-		void setSize (const int value) {setFont(QETApp::diagramTextsFont(value)); real_font_size_ = value;}
-	// real size
-	Q_PROPERTY(qreal real_size READ realSize WRITE setRealSize)
-		qreal realSize() const {return real_font_size_;}
-		void setRealSize(const qreal size) {real_font_size_ = size;}
-	// angle of text
-	Q_PROPERTY(qreal rotation_angle READ rotation WRITE setRotationAngle)
-		void setRotationAngle(const qreal &angle) {setRotation(QET::correctAngle(angle));}
-	// follow parent rotation
-	Q_PROPERTY(bool rotate READ followParentRotations WRITE setFollowParentRotations)
-		bool followParentRotations() const {return follow_parent_rotations;}
-		void setFollowParentRotations(bool i) {follow_parent_rotations = i;}
-	// tagg of text
-	Q_PROPERTY(QString tagg READ tagg WRITE setTagg)
-		QString tagg() const {return m_tagg;}
-		void setTagg(const QString &tagg) {m_tagg = tagg;}
-
-
-	public slots:
-	void adjustItemPosition(int = 0);
-	void setEditable(bool);
-	void startEdition();
-	void endEdition();
-	
-	protected:   
-        void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
-        void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
-        void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
-        void focusInEvent(QFocusEvent *) override;
-        void focusOutEvent(QFocusEvent *) override;
-        void keyPressEvent(QKeyEvent *) override;
-        void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override;
-        QVariant itemChange(GraphicsItemChange, const QVariant &) override;
-        QRectF boundingRect() const override;
-	
-	private:
-        QString previous_text;
-        qreal real_font_size_;
-        QPointF saved_point_;
-        qreal saved_font_size_;
-        QPointF m_origine_pos;
-};
-#endif

Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/qetelementeditor.cpp	2018-03-11 15:11:08 UTC (rev 5264)
@@ -36,9 +36,7 @@
 #include "rectangleeditor.h"
 #include "terminaleditor.h"
 #include "texteditor.h"
-#include "textfieldeditor.h"
 #include "partterminal.h"
-#include "parttextfield.h"
 #include "styleeditor.h"
 #include "dynamictextfieldeditor.h"
 
@@ -48,7 +46,6 @@
 #include "eseventaddpolygon.h"
 #include "eseventaddarc.h"
 #include "eseventaddtext.h"
-#include "eseventaddtextfield.h"
 #include "eseventaddterminal.h"
 #include "eseventadddynamictextfield.h"
 
@@ -288,7 +285,6 @@
 	QAction *add_text      = new QAction(QET::Icons::PartText,      tr("Ajouter du texte"),          parts);
 	QAction *add_arc       = new QAction(QET::Icons::PartArc,       tr("Ajouter un arc de cercle"),  parts);
 	QAction *add_terminal  = new QAction(QET::Icons::Terminal,      tr("Ajouter une borne"),         parts);
-	QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
 	QAction *add_dynamic_text_field = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ texte dynamique"), parts);
 
 	foreach (QAction *action, parts -> actions()) action -> setCheckable(true);
@@ -300,7 +296,6 @@
 	connect(add_text,      SIGNAL(triggered()), this, SLOT(addText()      ));
 	connect(add_arc,       SIGNAL(triggered()), this, SLOT(addArc()       ));
 	connect(add_terminal,  SIGNAL(triggered()), this, SLOT(addTerminal()  ));
-	connect(add_textfield, SIGNAL(triggered()), this, SLOT(addTextField() ));
 	connect(add_dynamic_text_field, &QAction::triggered, this, &QETElementEditor::addDynamicTextField);
 
 	
@@ -520,7 +515,6 @@
 	m_editors["rect"]      = new RectangleEditor(this);
 	m_editors["terminal"]  = new TerminalEditor(this);
 	m_editors["text"]      = new TextEditor(this);
-	m_editors["input"]     = new TextFieldEditor(this);
 	m_editors["style"]     = new StyleEditor(this);
 	m_editors["dynamic_text"] = new DynamicTextFieldEditor(this);
 	
@@ -688,7 +682,7 @@
 /**
  * @brief QETElementEditor::checkElement
  * Do several check about element.
- * If error is occurred return false
+ * If error is occured return false
  */
 bool QETElementEditor::checkElement()
 {
@@ -714,15 +708,13 @@
 		/// Check folio report element
 	if (m_elmt_scene -> elementType().contains("report"))
 	{
-		int text =0, terminal =0;
+		int terminal =0;
 
 		foreach(QGraphicsItem *qgi, m_elmt_scene->items())
-		{
-			if		(qgraphicsitem_cast<PartTerminal *>(qgi))  terminal ++;
-			else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
-		}
+			if (qgraphicsitem_cast<PartTerminal *>(qgi)) 
+				terminal ++;
 
-			///Error #2 folio report must have only one terminal
+			///Error folio report must have only one terminal
 		if (terminal != 1)
 		{
 			errors << qMakePair (tr("Absence de borne"),
@@ -988,14 +980,6 @@
 }
 
 /**
- * @brief QETElementEditor::addTextField
- * Set text field creation interface to scene
- */
-void QETElementEditor::addTextField() {
-	m_elmt_scene -> setEventInterface(new ESEventAddTextField(m_elmt_scene));
-}
-
-/**
  * @brief QETElementEditor::addTerminal
  * Set terminal creation interface to scene
  */
@@ -1135,7 +1119,7 @@
 /**
  * @brief QETElementEditor::slot_save
  * Save the current editing element.
- * If the filepath or location is unknown, use save_as instead
+ * If the filepath or location is unknow, use save_as instead
  * @return true if save with success
  */
 bool QETElementEditor::slot_save()

Modified: trunk/sources/editor/qetelementeditor.h
===================================================================
--- trunk/sources/editor/qetelementeditor.h	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/qetelementeditor.h	2018-03-11 15:11:08 UTC (rev 5264)
@@ -131,7 +131,6 @@
 		void addPolygon();
 		void addArc();
 		void addText();
-		void addTextField();
 		void addTerminal();
 		void addDynamicTextField();
 		void UncheckAddPrimitive();

Deleted: trunk/sources/editor/textfieldeditor.cpp
===================================================================
--- trunk/sources/editor/textfieldeditor.cpp	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/textfieldeditor.cpp	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,269 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 "textfieldeditor.h"
-#include "parttextfield.h"
-#include "qtextorientationspinboxwidget.h"
-#include "qetapp.h"
-#include "QPropertyUndoCommand/qpropertyundocommand.h"
-/**
-	Constructeur
-	@param editor L'editeur d'element concerne
-	@param textfield Le champ de texte a editer
-	@param parent QWidget parent
-*/
-TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfield, QWidget *parent) :
-	ElementItemEditor(editor, parent),
-	part(textfield),
-	m_locked(false)
-{
-	qle_x     = new QDoubleSpinBox();
-	qle_y     = new QDoubleSpinBox();
-	qle_text  = new QLineEdit();
-	qle_text  ->setClearButtonEnabled(true);
-	font_size = new QSpinBox();
-	font_size -> setRange(0, 144);
-	rotate    = new QCheckBox(tr("Ne pas subir les rotations de l'élément parent"));
-	rotate -> setChecked(true);
-	QLabel *rotation_angle_label = new QLabel(tr("Angle de rotation par défaut : "));
-	rotation_angle_label -> setWordWrap(true);
-	rotation_angle_ = QETApp::createTextOrientationSpinBoxWidget();
-	
-	qle_x -> setRange (-5000, 5000);
-	qle_y -> setRange (-5000, 5000);
-	
-	QVBoxLayout *main_layout = new QVBoxLayout();
-	main_layout -> addWidget(new QLabel(tr("Position : ")));
-	
-	QHBoxLayout *position = new QHBoxLayout();
-	position -> addWidget(new QLabel(tr("x : ")));
-	position -> addWidget(qle_x                 );
-	position -> addWidget(new QLabel(tr("y : ")));
-	position -> addWidget(qle_y                 );
-	main_layout -> addLayout(position);
-	
-	QHBoxLayout *fs = new QHBoxLayout();
-	fs -> addWidget(new QLabel(tr("Taille : ")));
-	fs -> addWidget(font_size);
-	main_layout -> addLayout(fs);
-	
-	QHBoxLayout *t = new QHBoxLayout();
-	t -> addWidget(new QLabel(tr("Texte par défaut : ")));
-	t -> addWidget(qle_text);
-	main_layout -> addLayout(t);
-
-		//add the tagg combobox
-	QHBoxLayout *tagg_layout = new QHBoxLayout();
-	tagg_layout -> addWidget(new QLabel(tr("tagg :")));
-	tagg_layout -> addWidget(m_tagg_cb = new QComboBox());
-	m_tagg_cb -> addItem(tr("Aucun"), QVariant("none"));
-	m_tagg_cb -> addItem(tr("label"), QVariant("label"));
-	m_tagg_cb -> addItem(tr("Fonction"), QVariant("function"));
-	m_tagg_cb -> addItem(tr("Tension/protocole"), QVariant("tension-protocol"));
-	main_layout -> addLayout(tagg_layout);
-	
-	QHBoxLayout *rotation_angle_layout = new QHBoxLayout();
-	rotation_angle_layout -> addWidget(rotation_angle_label);
-	rotation_angle_layout -> addWidget(rotation_angle_);
-	main_layout -> addLayout(rotation_angle_layout);
-	
-	QHBoxLayout *r = new QHBoxLayout();
-	r -> addWidget(rotate);
-	main_layout -> addLayout(r);
-	
-	main_layout -> addStretch();
-	setLayout(main_layout);
-	updateForm();
-}
-
-/// Destructeur
-TextFieldEditor::~TextFieldEditor() {
-}
-
-/**
-	Permet de specifier a cet editeur quelle primitive il doit editer. A noter
-	qu'un editeur peut accepter ou refuser d'editer une primitive.
-	L'editeur de texte dynamique acceptera d'editer la primitive new_part s'il
-	s'agit d'un objet de la classe PartTextField.
-	@param new_part Nouvelle primitive a editer
-	@return true si l'editeur a accepter d'editer la primitive, false sinon
-*/
-bool TextFieldEditor::setPart(CustomElementPart *new_part)
-{
-	if (!new_part)
-	{
-		part = nullptr;
-		return(true);
-	}
-	if (PartTextField *part_textfield = dynamic_cast<PartTextField *>(new_part))
-	{
-		if(part == part_textfield) return true;
-		part = part_textfield;
-		updateForm();
-		return(true);
-	}
-	return(false);
-}
-
-/**
-	@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
-*/
-CustomElementPart *TextFieldEditor::currentPart() const {
-	return(part);
-}
-
-/// Met a jour le texte du champ de texte et cree un objet d'annulation
-void TextFieldEditor::updateTextFieldT()
-{
-	if(m_locked) return;
-	m_locked = true;
-	QString text = qle_text->text();
-	if (text != part->property("text"))
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "text", part->property("text"), text);
-		undo->setText(tr("Modifier le contenu d'un champ texte"));
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-/// Met a jour la taille du champ de texte et cree un objet d'annulation
-void TextFieldEditor::updateTextFieldS()
-{
-	if(m_locked) return;
-	m_locked = true;
-	int size = font_size->value();
-	if (size != part->property("size"))
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "size", part->property("size"), size);
-		undo->setText(tr("Modifier la taille d'un champ texte"));
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-/// Met a jour la taille du champ de texte et cree un objet d'annulation
-void TextFieldEditor::updateTextFieldR()
-{
-	if(m_locked) return;
-	m_locked = true;
-	bool rot = !rotate -> isChecked();
-	if (rot != part->property("rotate"))
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "rotate", part->property("rotate"), rot);
-		undo->setText(tr("Modifier les propriétés d'un champ texte"));
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
-void TextFieldEditor::updateTextFieldRotationAngle()
-{
-	if(m_locked) return;
-	m_locked = true;
-	double rot = rotation_angle_ -> value();
-	if (rot != part->property("rotation_angle"))
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "rotation_angle", part->property("rotation_angle"), rot);
-		undo->setText(tr("Modifier l'angle de rotation d'un champ texte"));
-		undo->enableAnimation();
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-/**
- * @brief TextFieldEditor::updateTagg
- * Change the tagg of the text field.
- * Change is apply with a QUndoCommand
- */
-void TextFieldEditor::updateTagg()
-{
-	if(m_locked) return;
-	m_locked = true;
-	QVariant var(m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());
-	if (var != part->property("tagg"))
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "tagg", part->property("tagg"), var);
-		undo->setText(tr("Modifier le tagg d'un champ texte"));
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-void TextFieldEditor::updatePos()
-{
-	if(m_locked) return;
-	m_locked = true;
-	QPointF pos(qle_x->value(), qle_y->value());
-	if (pos != part->pos())
-	{
-		QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "pos", part->pos(), pos);
-		undo->setText(tr("Déplacer un champ texte"));
-		undo->enableAnimation();
-		undoStack().push(undo);
-	}
-	m_locked= false;
-}
-
-/**
- * @brief TextFieldEditor::updateForm
- * Update the value of editor widget
- */
-void TextFieldEditor::updateForm() {
-	if (!part) return;
-	activeConnections(false);
-
-	qle_x           -> setValue        (part      -> property ("x").toReal());
-	qle_y           -> setValue        (part      -> property ("y").toReal());
-	qle_text        -> setText         (part      -> property ("text").toString());
-	font_size       -> setValue        (part      -> property ("size").toInt());
-	rotate	        -> setChecked      (!part     -> property ("rotate").toBool());
-	rotation_angle_ -> setValue        (part      -> property ("rotation").toDouble());
-	m_tagg_cb       -> setCurrentIndex (m_tagg_cb -> findData (part -> property("tagg")));
-
-	activeConnections(true);
-}
-
-/**
-	Active ou desactive les connexionx signaux/slots entre les widgets internes.
-	@param active true pour activer les connexions, false pour les desactiver
-*/
-void TextFieldEditor::activeConnections(bool active)
-{
-	if (active)
-	{
-		connect(qle_x,			 SIGNAL(editingFinished()),		   this, SLOT(updatePos()));
-		connect(qle_y,			 SIGNAL(editingFinished()),		   this, SLOT(updatePos()));
-		connect(qle_text,		 SIGNAL(editingFinished()),		   this, SLOT(updateTextFieldT()));
-		connect(font_size,		 SIGNAL(editingFinished()),		   this, SLOT(updateTextFieldS()));
-		connect(rotate,			 SIGNAL(stateChanged(int)),		   this, SLOT(updateTextFieldR()));
-		connect(rotation_angle_, SIGNAL(editingFinished()),		   this, SLOT(updateTextFieldRotationAngle()));
-		connect(m_tagg_cb,		 SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
-	}
-	else
-	{
-		disconnect(qle_x,			SIGNAL(editingFinished()),		  this, SLOT(updatePos()));
-		disconnect(qle_y,			SIGNAL(editingFinished()),		  this, SLOT(updatePos()));
-		disconnect(qle_text,		SIGNAL(editingFinished()),		  this, SLOT(updateTextFieldT()));
-		disconnect(font_size,		SIGNAL(editingFinished()),		  this, SLOT(updateTextFieldS()));
-		disconnect(rotate,			SIGNAL(stateChanged(int)),		  this, SLOT(updateTextFieldR()));
-		disconnect(rotation_angle_, SIGNAL(editingFinished()),		  this, SLOT(updateTextFieldRotationAngle()));
-		connect(m_tagg_cb,			SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
-	}
-}

Deleted: trunk/sources/editor/textfieldeditor.h
===================================================================
--- trunk/sources/editor/textfieldeditor.h	2018-03-11 14:44:21 UTC (rev 5263)
+++ trunk/sources/editor/textfieldeditor.h	2018-03-11 15:11:08 UTC (rev 5264)
@@ -1,73 +0,0 @@
-/*
-	Copyright 2006-2017 The QElectroTech Team
-	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 TEXTFIELD_EDITOR_H
-#define TEXTFIELD_EDITOR_H
-
-#include "elementitemeditor.h"
-
-class PartTextField;
-class QTextOrientationSpinBoxWidget;
-class QLineEdit;
-class QComboBox;
-class QSpinBox;
-class QDoubleSpinBox;
-class QCheckBox;
-
-/**
-	This class provides a widget to edit text fields within the element editor.
-*/
-class TextFieldEditor : public ElementItemEditor
-{
-	Q_OBJECT
-
-		// Constructors, destructor
-	public:
-		TextFieldEditor(QETElementEditor *, PartTextField * = nullptr, QWidget * = nullptr);
-		~TextFieldEditor() override;
-	private:
-		TextFieldEditor(const TextFieldEditor &);
-	
-		// attributes
-	private:
-		PartTextField *part;
-		QLineEdit *qle_text;
-		QComboBox *m_tagg_cb;
-		QSpinBox *font_size;
-		QDoubleSpinBox *qle_x, *qle_y;
-		QCheckBox *rotate;
-		QTextOrientationSpinBoxWidget *rotation_angle_;
-		bool m_locked;
-	
-		// methods
-	public:
-		bool setPart(CustomElementPart *) override;
-		CustomElementPart *currentPart() const override;
-	
-	public slots:
-		void updateTextFieldT();
-		void updateTextFieldS();
-		void updateTextFieldR();
-		void updateTextFieldRotationAngle();
-		void updateTagg();
-		void updatePos();
-		void updateForm() override;
-	
-	private:
-		void activeConnections(bool);
-};
-#endif


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