[qet] [2565] Merge sources trunk to branche 0.4 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2565
Author: scorpio810
Date: 2013-09-29 14:24:51 +0200 (Sun, 29 Sep 2013)
Log Message:
-----------
Merge sources trunk to branche 0.4
Modified Paths:
--------------
branches/0.4/sources/conductor.cpp
branches/0.4/sources/diagram.cpp
branches/0.4/sources/diagramcommands.cpp
branches/0.4/sources/diagramcommands.h
branches/0.4/sources/diagramcontent.cpp
branches/0.4/sources/diagramcontent.h
branches/0.4/sources/diagramimageitem.cpp
branches/0.4/sources/diagramimageitem.h
branches/0.4/sources/diagramtextitem.cpp
branches/0.4/sources/diagramview.cpp
branches/0.4/sources/diagramview.h
branches/0.4/sources/editor/editorcommands.cpp
branches/0.4/sources/editor/elementscene.cpp
branches/0.4/sources/editor/elementscene.h
branches/0.4/sources/editor/elementview.cpp
branches/0.4/sources/editor/elementview.h
branches/0.4/sources/editor/qetelementeditor.cpp
branches/0.4/sources/editor/qetelementeditor.h
branches/0.4/sources/qetdiagrameditor.cpp
branches/0.4/sources/qetdiagrameditor.h
branches/0.4/sources/qeticons.cpp
branches/0.4/sources/qeticons.h
branches/0.4/sources/ui/dialogautonum.cpp
branches/0.4/sources/ui/selectautonumw.cpp
branches/0.4/sources/ui/selectautonumw.h
Modified: branches/0.4/sources/conductor.cpp
===================================================================
--- branches/0.4/sources/conductor.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/conductor.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -51,8 +51,8 @@
segments_squares_scale_(1.0),
must_highlight_(Conductor::None)
{
- //set Zvalue at 10 to be upper than the DiagramImageItem
- setZValue(10);
+ //set Zvalue at 9 to be upper than the DiagramImageItem and bottom of element(10)
+ setZValue(9);
previous_z_value = zValue();
// ajout du conducteur a la liste de conducteurs de chacune des deux bornes
Modified: branches/0.4/sources/diagram.cpp
===================================================================
--- branches/0.4/sources/diagram.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagram.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -84,6 +84,8 @@
delete undo_stack_;
// suppression du QGIManager - tous les elements qu'il connait sont supprimes
delete qgi_manager_;
+ // remove of conductor setter
+ delete conductor_setter_;
// suppression des objets gerant les deplacements
delete elements_mover_;
Modified: branches/0.4/sources/diagramcommands.cpp
===================================================================
--- branches/0.4/sources/diagramcommands.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramcommands.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -252,7 +252,7 @@
QUndoCommand(parent),
content(c),
diagram(dia),
- filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::ConductorsToMove),
+ filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove),
first_redo(true)
{
@@ -274,32 +274,39 @@
/// annule le coller
void PasteDiagramCommand::undo() {
- // enleve les conducteurs
+ // remove the conductors
foreach(Conductor *c, content.conductorsToMove) diagram -> removeConductor(c);
- // enleve les elements
+ // remove the elements
foreach(Element *e, content.elements) diagram -> removeElement(e);
- // enleve les textes
+ // remove the texts
foreach(IndependentTextItem *t, content.textFields) diagram -> removeIndependentTextItem(t);
+
+ // remove the images
+ foreach(DiagramImageItem *dii, content.images) diagram -> removeItem(dii);
}
/// refait le coller
void PasteDiagramCommand::redo() {
if (first_redo) first_redo = false;
else {
- // pose les elements
+ // paste the elements
foreach(Element *e, content.elements) diagram -> addElement(e);
- // pose les conducteurs
+ // paste the conductors
foreach(Conductor *c, content.conductorsToMove) diagram -> addConductor(c);
- // pose les textes
+ // paste the texts
foreach(IndependentTextItem *t, content.textFields) diagram -> addIndependentTextItem(t);
+
+ // paste the images
+ foreach(DiagramImageItem *dii, content.images) diagram -> addDiagramImageItem(dii);
}
foreach(Element *e, content.elements) e -> setSelected(true);
foreach(Conductor *c, content.conductorsToMove) c -> setSelected(true);
foreach(IndependentTextItem *t, content.textFields) t -> setSelected(true);
+ foreach(DiagramImageItem *dii, content.images) dii -> setSelected(true);
}
/**
@@ -1064,3 +1071,38 @@
}
}
}
+
+/**
+ * @brief ImageResizerCommand::ImageResizerCommand Constructor
+ * @param image
+ * @param old_ old size of image
+ * @param new_ new size of image
+ * @param parent undocommand parent
+ */
+ImageResizerCommand::ImageResizerCommand (DiagramImageItem *image, qreal &old_, qreal &new_, QUndoCommand *parent):
+ QUndoCommand(parent),
+ image_(image),
+ old_size (old_),
+ new_size (new_)
+{}
+
+/**
+ * @brief ImageResizerCommand::~ImageResizerCommand destructor
+ */
+ImageResizerCommand::~ImageResizerCommand() {}
+
+/**
+ * @brief ImageResizerCommand::undo set the old size
+ */
+void ImageResizerCommand::undo() {
+ image_ -> setScale(old_size);
+}
+
+/**
+ * @brief ImageResizerCommand::redo set the new size
+ */
+void ImageResizerCommand::redo() {
+ if (old_size<new_size) setText(QObject::tr("Agrandire une image \340 %1 %").arg(new_size*100));
+ else setText(QObject::tr("R\351duire une image \340 %1 %").arg(new_size*100));
+ image_ -> setScale(new_size);
+}
Modified: branches/0.4/sources/diagramcommands.h
===================================================================
--- branches/0.4/sources/diagramcommands.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramcommands.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -561,4 +561,22 @@
/// track whether post-change properties were set
bool new_settings_set;
};
+
+class ImageResizerCommand : public QUndoCommand {
+ //constructor and destructor
+ public:
+ ImageResizerCommand (DiagramImageItem *image, qreal &old_, qreal &new_, QUndoCommand *parent = 0);
+ virtual ~ImageResizerCommand();
+
+ //methods
+ public:
+ virtual void undo();
+ virtual void redo();
+
+ //attributes
+ private:
+ DiagramImageItem *image_;
+ qreal old_size, new_size;
+};
+
#endif
Modified: branches/0.4/sources/diagramcontent.cpp
===================================================================
--- branches/0.4/sources/diagramcontent.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramcontent.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -103,14 +103,15 @@
if (filter & SelectedOnly) {
if (filter & Elements) foreach(Element *element, elements) { if (element -> isSelected()) ++ count; }
if (filter & TextFields) foreach(DiagramTextItem *dti, textFields) { if (dti -> isSelected()) ++ count; }
- if (filter & Images) foreach(DiagramImageItem *dii, images) { if (dii -> isSelected()) ++ count; }
+ if (filter & Images) foreach(DiagramImageItem *dii, images) { if (dii -> isSelected()) ++ count; }
if (filter & ConductorsToMove) foreach(Conductor *conductor, conductorsToMove) { if (conductor -> isSelected()) ++ count; }
if (filter & ConductorsToUpdate) foreach(Conductor *conductor, conductorsToUpdate) { if (conductor -> isSelected()) ++ count; }
if (filter & OtherConductors) foreach(Conductor *conductor, otherConductors) { if (conductor -> isSelected()) ++ count; }
- } else {
+ }
+ else {
if (filter & Elements) count += elements.count();
if (filter & TextFields) count += textFields.count();
- if (filter & Images) count += images.count();
+ if (filter & Images) count += images.count();
if (filter & ConductorsToMove) count += conductorsToMove.count();
if (filter & ConductorsToUpdate) count += conductorsToUpdate.count();
if (filter & OtherConductors) count += otherConductors.count();
Modified: branches/0.4/sources/diagramcontent.h
===================================================================
--- branches/0.4/sources/diagramcontent.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramcontent.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -41,13 +41,13 @@
enum Filter {
Elements = 1,
TextFields = 2,
- Images = 3,
- ConductorsToMove = 4,
- ConductorsToUpdate = 8,
- OtherConductors = 16,
- AnyConductor = 28,
- All = 31,
- SelectedOnly = 32
+ Images = 4,
+ ConductorsToMove = 8,
+ ConductorsToUpdate = 16,
+ OtherConductors = 32,
+ AnyConductor = 56,
+ All = 63,
+ SelectedOnly = 64
};
/// Hold electrical elements
Modified: branches/0.4/sources/diagramimageitem.cpp
===================================================================
--- branches/0.4/sources/diagramimageitem.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramimageitem.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -21,13 +21,13 @@
#include "qetapp.h"
DiagramImageItem::DiagramImageItem(Diagram *parent_diagram) :
- QGraphicsPixmapItem(0, parent_diagram)
+ QGraphicsPixmapItem(0, parent_diagram),
+ first_move_(false)
{
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
- //connect(this, SIGNAL(lostFocus()), this, SLOT(setNonFocusable()));
}
/**
@@ -39,12 +39,11 @@
QGraphicsPixmapItem(pixmap, 0, parent_diagram),
first_move_(false)
{
- setCursor(Qt::PointingHandCursor);
+ setTransformOriginPoint(boundingRect().center());
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
- //connect(this, SIGNAL(lostFocus()), this, SLOT(setNonFocusable()));
}
/// Destructeur
@@ -82,82 +81,6 @@
}
/**
- Traduit en coordonnees de la scene un mouvement / vecteur initialement
- exprime en coordonnees locales.
- @param movement Vecteur exprime en coordonnees locales
- @return le meme vecteur, exprime en coordonnees de la scene
-*/
-QPointF DiagramImageItem::mapMovementToScene(const QPointF &movement) const {
- // on definit deux points en coordonnees locales
- QPointF local_origin(0.0, 0.0);
- QPointF local_movement_point(movement);
-
- // on les mappe sur la scene
- QPointF scene_origin(mapToScene(local_origin));
- QPointF scene_movement_point(mapToScene(local_movement_point));
-
- // on calcule le vecteur represente par ces deux points
- return(scene_movement_point - scene_origin);
-}
-
-/**
- Traduit en coordonnees locales un mouvement / vecteur initialement
- exprime en coordonnees de la scene.
- @param movement Vecteur exprime en coordonnees de la scene
- @return le meme vecteur, exprime en coordonnees locales
-*/
-QPointF DiagramImageItem::mapMovementFromScene(const QPointF &movement) const {
- // on definit deux points sur la scene
- QPointF scene_origin(0.0, 0.0);
- QPointF scene_movement_point(movement);
-
- // on les mappe sur ce QGraphicsItem
- QPointF local_origin(mapFromScene(scene_origin));
- QPointF local_movement_point(mapFromScene(scene_movement_point));
-
- // on calcule le vecteur represente par ces deux points
- return(local_movement_point - local_origin);
-}
-
-/**
- Traduit en coordonnees de l'item parent un mouvement / vecteur initialement
- exprime en coordonnees locales.
- @param movement Vecteur exprime en coordonnees locales
- @return le meme vecteur, exprime en coordonnees du parent
-*/
-QPointF DiagramImageItem::mapMovementToParent(const QPointF &movement) const {
- // on definit deux points en coordonnees locales
- QPointF local_origin(0.0, 0.0);
- QPointF local_movement_point(movement);
-
- // on les mappe sur la scene
- QPointF parent_origin(mapToParent(local_origin));
- QPointF parent_movement_point(mapToParent(local_movement_point));
-
- // on calcule le vecteur represente par ces deux points
- return(parent_movement_point - parent_origin);
-}
-
-/**
- Traduit en coordonnees locales un mouvement / vecteur initialement
- exprime en coordonnees du parent.
- @param movement Vecteur exprime en coordonnees du parent
- @return le meme vecteur, exprime en coordonnees locales
-*/
-QPointF DiagramImageItem::mapMovementFromParent(const QPointF &movement) const {
- // on definit deux points sur le parent
- QPointF parent_origin(0.0, 0.0);
- QPointF parent_movement_point(movement);
-
- // on les mappe sur ce QGraphicsItem
- QPointF local_origin(mapFromParent(parent_origin));
- QPointF local_movement_point(mapFromParent(parent_movement_point));
-
- // on calcule le vecteur represente par ces deux points
- return(local_movement_point - local_origin);
-}
-
-/**
Dessine le champ de image.
Cette methode delegue simplement le travail a QGraphicsPixmapItem::paint apres
avoir desactive l'antialiasing.
@@ -171,37 +94,6 @@
}
/**
- Gere la prise de focus du champ de image
- @param e Objet decrivant la prise de focus
-*/
-void DiagramImageItem::focusInEvent(QFocusEvent *e) {
- QGraphicsPixmapItem::focusInEvent(e);
-
- // empeche le deplacement du image pendant son edition
- setFlag(QGraphicsItem::ItemIsMovable, false);
-}
-
-/**
- Gere la perte de focus du champ de image
- @param e Objet decrivant la perte de focus
-*/
-void DiagramImageItem::focusOutEvent(QFocusEvent *e) {
- QGraphicsPixmapItem::focusOutEvent(e);
-
- /*// deselectionne le image
- QTextCursor cursor = textCursor();
- cursor.clearSelection();
- setTextCursor(cursor);
-
- // hack a la con pour etre re-entrant
- setTextInteractionFlags(Qt::NoTextInteraction);
-
- // autorise de nouveau le deplacement du image
- setFlag(QGraphicsItem::ItemIsMovable, true);
- QTimer::singleShot(0, this, SIGNAL(lostFocus()));*/
-}
-
-/**
Gere le clic sur le champ de texte
@param e Objet decrivant l'evenement souris
*/
@@ -218,15 +110,8 @@
@param event un QGraphicsSceneMouseEvent decrivant le double-clic
*/
void DiagramImageItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
- /*if (!(textInteractionFlags() & Qt::imageditable)) {
- // rend le champ de image editable
- setTextInteractionFlags(Qt::imageditorInteraction);
-
- // edite le champ de image
- setFocus(Qt::MouseFocusReason);
- } else {
- QGraphicsPixmapItem::mouseDoubleClickEvent(event);
- }*/
+ Q_UNUSED (event);
+ edit();
}
/**
@@ -246,10 +131,14 @@
//we apply the mouse movement
QPointF old_pos = pos();
- setPos(mapToParent(e -> pos()) - matrix().map(e -> buttonDownPos(Qt::LeftButton)));
+ if (first_move_) {
+ mouse_to_origin_movement_ = old_pos - e -> buttonDownScenePos(Qt::LeftButton);
+ }
+ QPointF expected_pos = e-> scenePos() + mouse_to_origin_movement_;
+ setPos(expected_pos); // setPos() will snap the expected position to the grid
+
//we calcul the real movement apply by setPos()
QPointF effective_movement = pos() - old_pos;
-
if (diagram()) {
//we signal the real movement apply to diagram,
//who he apply to other selected item
@@ -283,9 +172,7 @@
@param angle Angle de la rotation a effectuer
*/
void DiagramImageItem::applyRotation(const qreal &angle) {
- // un simple appel a QGraphicsPixmapItem::setRotation suffit
- setTransformOriginPoint(boundingRect().center());
- QGraphicsPixmapItem::setRotation(QGraphicsPixmapItem::rotation() + angle);
+ setRotation(QET::correctAngle(rotation()+angle));
}
/**
@@ -316,24 +203,77 @@
}
/**
- @return la position du champ de image
-*/
-QPointF DiagramImageItem::pos() const {
- return(QGraphicsPixmapItem::pos());
+ * @brief DiagramImageItem::setScale
+ * @param scale the value of @scale must be betwen 1 and 200
+ */
+void DiagramImageItem::PreviewScale(int scale) {
+ if (scale >= 1 && scale <= 200) {
+ qreal new_scale = scale;
+ new_scale /= 100;
+ setScale(new_scale);
+ }
}
-/// Rend le champ de image non focusable
-void DiagramImageItem::setNonFocusable() {
- setFlag(QGraphicsPixmapItem::ItemIsFocusable, false);
-}
-
/**
* @brief Edit the image with ....
*/
void DiagramImageItem::edit() {
- // waiting
+ if (diagram() -> isReadOnly()) return;
+ //the range for scale image and divisor factor
+ int min_range = 1;
+ int max_range = 200;
+ int factor_range = 100;
+
+ //the dialog
+ QDialog property_dialog;
+ property_dialog.setWindowTitle(tr("\311diter les propri\351t\351s d'une image", "window title"));
+ //the main layout
+ QVBoxLayout *dialog_layout = new QVBoxLayout(&property_dialog);
+
+ //GroupBox for resizer image
+ QGroupBox *resize_groupe = new QGroupBox(tr("Dimension de l'image", "image size"));
+ dialog_layout -> addWidget(resize_groupe);
+ QHBoxLayout *resize_layout = new QHBoxLayout(resize_groupe);
+
+ //slider
+ QSlider *slider = new QSlider(Qt::Horizontal, &property_dialog);
+ slider->setRange(min_range, max_range);
+ qreal scale_= scale();
+ slider -> setValue(scale_*factor_range);
+ //spinbox
+ QSpinBox *spin_box = new QSpinBox(&property_dialog);
+ spin_box -> setRange(min_range, max_range);
+ spin_box -> setValue(scale_*factor_range);
+ spin_box -> setSuffix(" %");
+ //synchro slider with spinbox
+ connect(slider, SIGNAL(valueChanged(int)), spin_box, SLOT(setValue(int)));
+ connect(slider, SIGNAL(valueChanged(int)), this, SLOT(PreviewScale(int)));
+ connect(spin_box, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
+ //add slider and spinbox to layout
+ resize_layout -> addWidget(slider);
+ resize_layout -> addWidget(spin_box);
+
+ //dialog button, box
+ QDialogButtonBox *dbb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ dialog_layout -> addWidget(dbb);
+ connect(dbb, SIGNAL(accepted()), &property_dialog, SLOT(accept()));
+ connect(dbb, SIGNAL(rejected()), &property_dialog, SLOT(reject()));
+ //dialog is accepted...
+ if (property_dialog.exec() == QDialog::Accepted) {
+ qreal new_scale = slider -> value();
+ new_scale /= factor_range;
+ if (scale_ != new_scale) diagram()->undoStack().push(new ImageResizerCommand(this, scale_, new_scale));
+ }
+ //...or not
+ else setScale(scale_);
+ return;
}
+void DiagramImageItem::setPixmap(const QPixmap &pixmap) {
+ QGraphicsPixmapItem::setPixmap(pixmap);
+ setTransformOriginPoint(boundingRect().center());
+}
+
/**
Load the image from this xml element
@param e xml element that define an image
@@ -352,8 +292,9 @@
pixmap.loadFromData(array);
setPixmap(pixmap);
+ setScale(e.attribute("size").toDouble());
+ setRotationAngle(e.attribute("rotation").toDouble());
setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
- if (e.hasAttribute("rotation")) setRotationAngle(e.attribute("rotation").toDouble());
return (true);
}
@@ -367,7 +308,8 @@
//write some attribute
result.setAttribute("x", QString("%1").arg(pos().x()));
result.setAttribute("y", QString("%1").arg(pos().y()));
- if (rotation()) result.setAttribute("rotation", QString("%1").arg(rotation()));
+ result.setAttribute("rotation", QString("%1").arg(rotation()));
+ result.setAttribute("size", QString("%1").arg(scale()));
//write the pixmap in the xml element after he was been transformed to base64
QByteArray array;
Modified: branches/0.4/sources/diagramimageitem.h
===================================================================
--- branches/0.4/sources/diagramimageitem.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramimageitem.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -51,19 +51,13 @@
virtual void setPos(const QPointF &);
virtual void setPos(qreal, qreal);
- virtual QPointF pos() const;
void setRotationAngle(const qreal &);
void rotateBy(const qreal &);
void edit();
- QPointF mapMovementToScene(const QPointF &) const;
- QPointF mapMovementFromScene(const QPointF &) const;
- QPointF mapMovementToParent(const QPointF &) const;
- QPointF mapMovementFromParent(const QPointF &) const;
+ void setPixmap(const QPixmap &pixmap);
protected:
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
- void focusInEvent(QFocusEvent *);
- void focusOutEvent(QFocusEvent *);
void mousePressEvent(QGraphicsSceneMouseEvent *e);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
void mouseMoveEvent(QGraphicsSceneMouseEvent *);
@@ -71,15 +65,14 @@
void applyRotation(const qreal &);
signals:
- /// signal emitted when the image field loses focus
- void lostFocus();
/// signal emitted after image was changed
void diagramImageChanged(DiagramImageItem *, const QString &, const QString &);
- public slots:
- void setNonFocusable();
+ private slots:
+ void PreviewScale(int);
private:
bool first_move_;
+ QPointF mouse_to_origin_movement_;
};
#endif
Modified: branches/0.4/sources/diagramtextitem.cpp
===================================================================
--- branches/0.4/sources/diagramtextitem.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramtextitem.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -261,8 +261,7 @@
@param angle Angle de la rotation a effectuer
*/
void DiagramTextItem::applyRotation(const qreal &angle) {
- // un simple appel a QGraphicsTextItem::setRotation suffit
- QGraphicsTextItem::setRotation(QGraphicsTextItem::rotation() + angle);
+ setRotation(QET::correctAngle(rotation()+angle));
}
/**
Modified: branches/0.4/sources/diagramview.cpp
===================================================================
--- branches/0.4/sources/diagramview.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramview.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -427,14 +427,20 @@
switchToVisualisationModeIfNeeded(e);
fresh_focus_in_ = false;
}
- if (isInteractive() && !scene -> isReadOnly() && current_behavior > noAction && e -> buttons() == Qt::LeftButton) {
+ if (isInteractive() && !scene -> isReadOnly() && e -> buttons() == Qt::LeftButton) {
switch (current_behavior) {
+ case noAction:
+ break;
case addingText:
addDiagramTextAtPos(mapToScene(e -> pos()));
break;
case addingImage:
addDiagramImageAtPos(mapToScene(e -> pos()));
break;
+ case dragView:
+ break;
+ default:
+ break;
}
current_behavior = noAction;
}
@@ -1266,7 +1272,22 @@
}
current_behavior = addingImage;
}
+
/**
+ * @brief DiagramView::editImage
+ * open edit image dialog if only one image is selected
+ */
+void DiagramView::editImage() {
+ if (scene -> isReadOnly()) return;
+ QList <QGraphicsItem *> images = diagram() -> selectedContent().items(DiagramContent::Images);
+ if (images.count() != 1) return;
+ DiagramImageItem *image;
+ if ((image = qgraphicsitem_cast<DiagramImageItem *> (images.first()))) {
+ image -> edit();
+ }
+}
+
+/**
* @brief DiagramView::addDiagramImageAtPos
* @param pos
* @return
@@ -1329,6 +1350,7 @@
context_menu -> addAction(paste_here);
context_menu -> addSeparator();
context_menu -> addAction(qde -> infos_diagram);
+ context_menu -> addAction(qde -> prj_diagramNum);
context_menu -> addAction(qde -> add_column);
context_menu -> addAction(qde -> remove_column);
context_menu -> addAction(qde -> add_row);
@@ -1342,11 +1364,9 @@
context_menu -> addAction(qde -> delete_selection);
context_menu -> addAction(qde -> rotate_selection);
context_menu -> addAction(qde -> rotate_texts);
- context_menu -> addAction(qde -> add_edittext);
+ context_menu -> addAction(qde -> edit_selection);
context_menu -> addAction(qde -> find_element);
- context_menu -> addAction(qde -> edit_element);
context_menu -> addAction(qde -> selection_prop);
- context_menu -> addAction(qde -> prj_diagramNum);
}
// affiche le menu contextuel
Modified: branches/0.4/sources/diagramview.h
===================================================================
--- branches/0.4/sources/diagramview.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/diagramview.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -75,6 +75,7 @@
void addText();
void editText();
void addImage();
+ void editImage();
IndependentTextItem *addDiagramTextAtPos(const QPointF &);
DiagramImageItem *addDiagramImageAtPos(const QPointF &);
Modified: branches/0.4/sources/editor/editorcommands.cpp
===================================================================
--- branches/0.4/sources/editor/editorcommands.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/editorcommands.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -157,7 +157,7 @@
editor_view_ -> offset_paste_count_ = old_offset_paste_count_;
editor_view_ -> start_top_left_corner_ = old_start_top_left_corner_;
}
- editor_view_ -> zoomFit();
+ editor_view_ -> adjustSceneRect();
}
/// refait le coller
@@ -176,7 +176,7 @@
}
}
editor_scene_ -> slot_select(content_);
- editor_view_ -> zoomFit();
+ editor_view_ -> adjustSceneRect();
}
/**
Modified: branches/0.4/sources/editor/elementscene.cpp
===================================================================
--- branches/0.4/sources/editor/elementscene.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/elementscene.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -385,9 +385,17 @@
representer tout l'element ou seulement les elements selectionnes
@return un document XML decrivant l'element
*/
-const QDomDocument ElementScene::toXml(bool all_parts) const {
+const QDomDocument ElementScene::toXml(bool all_parts) {
+ QRectF size= elementSceneGeometricRect();
+ //if the element doesn't contains the origin point of the scene
+ //we move the element to the origin for solve this default before saving
+ if (!size.contains(0,0) && all_parts) {
+ centerElementToOrigine();
+ //recalcul the size after movement
+ size= elementSceneGeometricRect();
+ }
+
//define the size of the element by the upper multiple of 10
- QRectF size= elementSceneGeometricRect();
int upwidth = ((qRound(size.width())/10)*10)+10;
if ((qRound(size.width())%10) > 6) upwidth+=10;
@@ -598,6 +606,11 @@
}
+void ElementScene::contextMenu(QContextMenuEvent *event) {
+ if (behavior == ElementScene::Normal)
+ element_editor -> contextMenu(event);
+}
+
/**
Selectionne une liste de parties
@param content liste des parties a selectionner
@@ -1144,6 +1157,33 @@
}
/**
+ * @brief ElementScene::centerElementToOrigine
+ * try to center better is possible the element to the scene
+ * (the calcul isn't optimal but work good)
+ */
+void ElementScene::centerElementToOrigine() {
+ QRectF size= elementSceneGeometricRect();
+ int center_x = qRound(size.center().x());
+ int center_y = qRound(size.center().y());
+
+ //define the movement of translation
+ int move_x = center_x - (qRound(center_x) %10);
+ if (center_x < 0) move_x -= 10;
+ int move_y = center_y - (qRound(center_y) %10);
+ if (center_y < 0) move_y -= 10;
+
+ //move each primitive by @move
+ foreach (QGraphicsItem *qgi, items()) {
+ if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
+ if (qgi -> type() == QGraphicsRectItem::Type) continue;
+ //deselect item for disable decorator
+ qgi -> setSelected(false);
+ qgi -> moveBy(-(move_x), -(move_y));
+ }
+ emit (needZoomFit());
+}
+
+/**
Ensure the decorator is adequately shown, hidden or updated so it always
represents the current selection.
*/
Modified: branches/0.4/sources/editor/elementscene.h
===================================================================
--- branches/0.4/sources/editor/elementscene.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/elementscene.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -121,7 +121,7 @@
virtual int xGrid() const;
virtual int yGrid() const;
virtual void setGrid(int, int);
- virtual const QDomDocument toXml(bool = true) const;
+ virtual const QDomDocument toXml(bool = true);
virtual QRectF boundingRectFromXml(const QDomDocument &);
virtual void fromXml(const QDomDocument &, const QPointF & = QPointF(), bool = true, ElementContent * = 0);
virtual void reset();
@@ -138,6 +138,7 @@
void cut();
void copy();
void paste();
+ void contextMenu (QContextMenuEvent *event);
protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
@@ -158,6 +159,7 @@
bool mustSnapToGrid(QGraphicsSceneMouseEvent *);
static bool zValueLessThan(QGraphicsItem *, QGraphicsItem *);
QMutex *decorator_lock_;
+ void centerElementToOrigine();
public slots:
void slot_move();
@@ -199,6 +201,8 @@
void partsZValueChanged();
/// Signal emitted when users have defined the copy/paste area
void pasteAreaDefined(const QRectF &);
+ /// Signal emitted when need zoomFit
+ void needZoomFit();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(ElementScene::ItemOptions)
Modified: branches/0.4/sources/editor/elementview.cpp
===================================================================
--- branches/0.4/sources/editor/elementview.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/elementview.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -36,6 +36,7 @@
zoomReset();
connect(scene_, SIGNAL(pasteAreaDefined(const QRectF &)), this, SLOT(pasteAreaDefined(const QRectF &)));
connect(scene_, SIGNAL(partsAdded()), this, SLOT(adjustSceneRect()));
+ connect(scene_, SIGNAL(needZoomFit()), this, SLOT(zoomFit()));
}
/// Destructeur
@@ -65,6 +66,10 @@
return(QRectF(scene_left_top, scene_right_bottom));
}
+void ElementView::contextMenuEvent(QContextMenuEvent *event) {
+ scene_ -> contextMenu(event);
+}
+
/**
Definit l'ElementScene visualisee par cette ElementView
@param s l'ElementScene visualisee par cette ElementView
Modified: branches/0.4/sources/editor/elementview.h
===================================================================
--- branches/0.4/sources/editor/elementview.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/elementview.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -40,6 +40,7 @@
ElementScene *scene() const;
void setScene(ElementScene *);
QRectF viewedSceneRect() const;
+ void contextMenuEvent(QContextMenuEvent *event);
protected:
void mousePressEvent(QMouseEvent *);
Modified: branches/0.4/sources/editor/qetelementeditor.cpp
===================================================================
--- branches/0.4/sources/editor/qetelementeditor.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/qetelementeditor.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -376,7 +376,7 @@
paste_from_menu -> setIcon(QET::Icons::EditPaste);
paste_from_menu -> addAction(paste_from_file);
paste_from_menu -> addAction(paste_from_elmt);
-
+
edit_menu -> addAction(undo);
edit_menu -> addAction(redo);
edit_menu -> addSeparator();
@@ -400,7 +400,7 @@
edit_menu -> addAction(edit_raise);
edit_menu -> addAction(edit_lower);
edit_menu -> addAction(edit_backward);
-
+
display_menu -> addAction(zoom_in);
display_menu -> addAction(zoom_out);
display_menu -> addAction(zoom_fit);
@@ -412,6 +412,34 @@
}
/**
+ * @brief QETElementEditor::contextMenuEvent
+ * @param event
+ */
+void QETElementEditor::contextMenu(QContextMenuEvent *event) {
+ QMenu menu(this);
+ menu.addAction(undo);
+ menu.addAction(redo);
+ menu.addAction(selectall);
+ menu.addAction(deselectall);
+ menu.addAction(inv_select);
+ menu.addSeparator();
+ menu.addAction(edit_delete);
+ menu.addAction(cut);
+ menu.addAction(copy);
+ menu.addSeparator();
+ menu.addAction(paste);
+ menu.addAction(paste_in_area);
+ menu.addMenu(paste_from_menu);
+ menu.addSeparator();
+ menu.addAction(edit_forward);
+ menu.addAction(edit_raise);
+ menu.addAction(edit_lower);
+ menu.addAction(edit_backward);
+ menu.exec(event -> globalPos());
+ }
+
+
+/**
Met a jour les menus
*/
void QETElementEditor::slot_updateMenus() {
Modified: branches/0.4/sources/editor/qetelementeditor.h
===================================================================
--- branches/0.4/sources/editor/qetelementeditor.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/editor/qetelementeditor.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -113,11 +113,12 @@
static QPointF pasteOffset();
static QET::OrientedMovement pasteMovement();
static QString getOpenElementFileName(QWidget * = 0, const QString & = QString());
-
+ void contextMenu(QContextMenuEvent *event);
+
protected:
void closeEvent(QCloseEvent *);
virtual void firstActivation(QEvent *);
-
+
private:
void setupActions();
void setupMenus();
Modified: branches/0.4/sources/qetdiagrameditor.cpp
===================================================================
--- branches/0.4/sources/qetdiagrameditor.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/qetdiagrameditor.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -209,14 +209,13 @@
rotate_selection = new QAction(QET::Icons::ObjectRotateRight, tr("Pivoter"), this);
rotate_texts = new QAction(QET::Icons::ObjectRotateRight, tr("Orienter les textes"), this);
find_element = new QAction( tr("Retrouver dans le panel"), this);
- edit_element = new QAction(QET::Icons::ElementEdit, tr("\311diter l'\351l\351ment"), this);
+ edit_selection = new QAction(QET::Icons::ElementEdit, tr("\311diter l'item s\351lectionn\351"), this);
selection_prop = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s de la s\351lection"), this);
conductor_reset = new QAction(QET::Icons::ConductorSettings, tr("R\351initialiser les conducteurs"), this);
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s du sch\351ma"), this);
add_text = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), this);
- add_edittext = new QAction(QET::Icons::EditText, tr("\311diter le champ de texte"), this);
add_column = new QAction(QET::Icons::EditTableInsertColumnRight, tr("Ajouter une colonne"), this);
- add_image = new QAction(QET::Icons::adding_image, tr("Ajouter une image"), this);
+ add_image = new QAction(QET::Icons::adding_image, tr("Ajouter une image"), this);
remove_column = new QAction(QET::Icons::EditTableDeleteColumn, tr("Enlever une colonne"), this);
add_row = new QAction(QET::Icons::EditTableInsertRowUnder, tr("Ajouter une ligne"), this);
remove_row = new QAction(QET::Icons::EditTableDeleteRow, tr("Enlever une ligne"), this);
@@ -274,6 +273,7 @@
selection_prop -> setShortcut(QKeySequence(tr("Ctrl+J")));
conductor_reset -> setShortcut(QKeySequence(tr("Ctrl+K")));
infos_diagram -> setShortcut(QKeySequence(tr("Ctrl+L")));
+ edit_selection -> setShortcut(QKeySequence(tr("Ctrl+E")));
prj_add_diagram -> setShortcut(QKeySequence(tr("Ctrl+T")));
@@ -310,7 +310,6 @@
rotate_selection -> setStatusTip(tr("Pivote les \351l\351ments et textes s\351lectionn\351s", "status bar tip"));
rotate_texts -> setStatusTip(tr("Pivote les textes s\351lectionn\351s \340 un angle pr\351cis", "status bar tip"));
find_element -> setStatusTip(tr("Retrouve l'\351l\351ment s\351lectionn\351 dans le panel", "status bar tip"));
- edit_element -> setStatusTip(tr("Retrouve l'\351l\351ment s\351lectionn\351 dans le panel avant de l'\351diter", "status bar tip"));
selection_prop -> setStatusTip(tr("\311dite les propri\351t\351s des objets s\351lectionn\351", "status bar tip"));
conductor_reset -> setStatusTip(tr("Recalcule les chemins des conducteurs sans tenir compte des modifications", "status bar tip"));
infos_diagram -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche", "status bar tip"));
@@ -338,7 +337,7 @@
// traitements speciaux
add_text -> setCheckable(true);
- add_image -> setCheckable(true);
+ add_image -> setCheckable(true);
windowed_view_mode -> setCheckable(true);
tabbed_view_mode -> setCheckable(true);
mode_selection -> setCheckable(true);
@@ -364,8 +363,7 @@
connect(rotate_selection, SIGNAL(triggered()), this, SLOT(slot_rotate()) );
connect(rotate_texts, SIGNAL(triggered()), this, SLOT(slot_rotateTexts()) );
connect(find_element, SIGNAL(triggered()), this, SLOT(findSelectedElementInPanel()));
- connect(edit_element, SIGNAL(triggered()), this, SLOT(findSelectedElementInPanel()));
- connect(edit_element, SIGNAL(triggered()), this, SLOT(editSelectedElementInEditor()));
+ connect(edit_selection, SIGNAL(triggered()), this, SLOT(slot_editSelection()) );
connect(windowed_view_mode, SIGNAL(triggered()), this, SLOT(setWindowedMode()) );
connect(tabbed_view_mode, SIGNAL(triggered()), this, SLOT(setTabbedMode()) );
connect(mode_selection, SIGNAL(triggered()), this, SLOT(slot_setSelectionMode()) );
@@ -400,7 +398,6 @@
connect(conductor_reset, SIGNAL(triggered()), this, SLOT(slot_resetConductors()) );
connect(infos_diagram, SIGNAL(triggered()), this, SLOT(editCurrentDiagramProperties()));
connect(add_text, SIGNAL(triggered()), this, SLOT(slot_addText()) );
- connect(add_edittext, SIGNAL(triggered()), this, SLOT(slot_editText()) );
connect(add_image, SIGNAL(triggered()), this, SLOT(slot_addImage()) );
connect(add_column, SIGNAL(triggered()), this, SLOT(slot_addColumn()) );
connect(remove_column, SIGNAL(triggered()), this, SLOT(slot_removeColumn()) );
@@ -476,7 +473,7 @@
menu_edition -> addAction(delete_selection);
menu_edition -> addAction(rotate_selection);
menu_edition -> addAction(rotate_texts);
- menu_edition -> addAction(add_edittext);
+ menu_edition -> addAction(edit_selection);
menu_edition -> addAction(selection_prop);
menu_edition -> addSeparator();
menu_edition -> addAction(conductor_reset);
@@ -1193,13 +1190,12 @@
// number of selected elements
int selected_elements_count = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Elements) : 0;
find_element -> setEnabled(selected_elements_count == 1);
- edit_element -> setEnabled(selected_elements_count == 1);
// actions ayant aussi besoin d'items (elements, conducteurs, textes, ...) selectionnes
bool copiable_items = dv ? (dv -> hasCopiableItems()) : false;
bool deletable_items = dv ? (dv -> hasDeletableItems()) : false;
- cut -> setEnabled(editable_diagram);
- copy -> setEnabled(editable_diagram);
+ cut -> setEnabled(editable_diagram && copiable_items);
+ copy -> setEnabled(copiable_items);
delete_selection -> setEnabled(editable_diagram && deletable_items);
rotate_selection -> setEnabled(editable_diagram && dv -> diagram() -> canRotateSelection());
selection_prop -> setEnabled(deletable_items);
@@ -1209,7 +1205,35 @@
int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
int selected_conductor_texts = dv ? (dv -> diagram() -> selectedConductorTexts().count()) : 0;
rotate_texts -> setEnabled(editable_diagram && selected_texts);
- add_edittext -> setEnabled(editable_diagram && selected_texts == 1 && !selected_conductor_texts);
+
+ // actions need only one editable item
+ int selected_image = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Images) : 0;
+ int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts) + selected_image;
+
+ if (selected_editable == 1) {
+ edit_selection -> setEnabled(true);
+ //edit element
+ if (selected_elements_count) {
+ edit_selection -> setText(tr("\311diter l'\351lement", "edit element"));
+ edit_selection -> setIcon(QET::Icons::ElementEdit);
+ }
+ //edit text field
+ else if (selected_texts) {
+ edit_selection -> setText(tr("\311diter le champ de texte", "edit text field"));
+ edit_selection -> setIcon(QET::Icons::EditText);
+ }
+ //edit image
+ else if (selected_image) {
+ edit_selection -> setText(tr("\311diter l'image", "edit image"));
+ edit_selection -> setIcon(QET::Icons::resize_image);
+ }
+ }
+ //not an editable item
+ else {
+ edit_selection -> setText(tr("\311diter l'objet s\351lectionn\351", "edit selected item"));
+ edit_selection -> setIcon(QET::Icons::ElementEdit);
+ edit_selection -> setEnabled(false);
+ }
}
@@ -1501,12 +1525,22 @@
dv -> addImage();
}
}
+
/**
- to Edit en text through the html editor
-*/
-void QETDiagramEditor::slot_editText() {
+ * @brief QETDiagramEditor::slot_editSelection
+ * edit the selected item if he can be edited and if only one item is selected
+ */
+void QETDiagramEditor::slot_editSelection() {
if (DiagramView *dv = currentDiagram()) {
- dv -> editText();
+ DiagramContent dc = dv -> diagram() -> selectedContent();
+ if (dc.count(DiagramContent::SelectedOnly | DiagramContent::All) != 1) return;
+
+ if (dc.count(DiagramContent::Elements)) {
+ findSelectedElementInPanel();
+ editSelectedElementInEditor();
+ }
+ else if (dc.count(DiagramContent::TextFields)) dv -> editText();
+ else if (dc.count(DiagramContent::Images)) dv -> editImage();
}
}
@@ -1767,7 +1801,6 @@
connect(dv, SIGNAL(selectionChanged()), this, SLOT(slot_updateComplexActions()));
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
connect(dv, SIGNAL(textAdded(bool)), add_text, SLOT(setChecked(bool)));
- connect(dv, SIGNAL(textAdded(bool)), add_edittext, SLOT(setChecked(bool)));
connect(dv, SIGNAL(ImageAdded(bool)), add_image, SLOT(setChecked(bool)));
connect(dv, SIGNAL(ImageAddedCanceled(bool)), add_image, SLOT(setChecked(bool)));
}
Modified: branches/0.4/sources/qetdiagrameditor.h
===================================================================
--- branches/0.4/sources/qetdiagrameditor.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/qetdiagrameditor.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -123,8 +123,8 @@
void slot_editConductor();
void slot_resetConductors();
void slot_addText();
- void slot_editText();
void slot_addImage();
+ void slot_editSelection();
void setWindowedMode();
void setTabbedMode();
void readSettings();
@@ -190,13 +190,11 @@
QAction *rotate_selection; ///< Rotate selected elements and text items by 90 degrees
QAction *rotate_texts; ///< Direct selected text items to a specific angle
QAction *find_element; ///< Find the selected element in the panel
- QAction *edit_element; ///< Edit the selected element
QAction *selection_prop; ///< Show a dialog describing the selection
QAction *conductor_reset; ///< Reset paths of selected conductors
QAction *conductor_default; ///< Show a dialog to edit default conductor properties
QAction *infos_diagram; ///< Show a dialog to edit diagram properties
QAction *add_text; ///< Tool to add an independent text item on diagrams
- QAction *add_edittext; ///< Tool to add an independent text item on diagrams
QAction *add_column; ///< Increase diagram width by adding an extra column
QAction *remove_column; ///< Decrease diagram width by removing the last column
QAction *add_row; ///< Increase diagram height by adding an extra row
@@ -216,7 +214,9 @@
QAction *cascade_window; ///< Show MDI subwindows as cascade
QAction *prev_window; ///< Switch to the previous document
QAction *next_window; ///< Switch to the next document
- QAction *add_image; ///< Tool to add an independent image item on diagrams
+ QAction *add_image; ///< Tool to add an independent image item on diagrams
+ QAction *edit_selection; ///< To edit selected item
+
private:
QMdiArea workspace;
QSignalMapper windowMapper;
Modified: branches/0.4/sources/qeticons.cpp
===================================================================
--- branches/0.4/sources/qeticons.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/qeticons.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -153,6 +153,7 @@
QIcon ZoomOriginal;
QIcon ZoomOut;
QIcon adding_image;
+ QIcon resize_image;
}
}
@@ -312,7 +313,6 @@
NewDiagram .addFile(":/ico/128x128/diagram.png");
North .addFile(":/ico/16x16/north.png");
ObjectLocked .addFile(":/ico/22x22/object-locked.png");
- ObjectRotateRight .addFile(":/ico/16x16/object-rotate-right.png");
ObjectRotateRight .addFile(":/ico/22x22/object-rotate-right.png");
ObjectUnlocked .addFile(":/ico/22x22/object-unlocked.png");
Orientations .addFile(":/ico/16x16/orientations.png");
@@ -350,6 +350,7 @@
Raise .addFile(":/ico/22x22/raise.png");
Remove .addFile(":/ico/16x16/list-remove.png");
Remove .addFile(":/ico/22x22/list-remove.png");
+ resize_image .addFile(":/ico/22x22/transform-scale.png");
Restore .addFile(":/ico/22x22/restaurer.png");
SendBackward .addFile(":/ico/22x22/send_backward.png");
Settings .addFile(":/ico/128x128/settings.png");
Modified: branches/0.4/sources/qeticons.h
===================================================================
--- branches/0.4/sources/qeticons.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/qeticons.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -162,6 +162,7 @@
extern QIcon ZoomOriginal;
extern QIcon ZoomOut;
extern QIcon adding_image;
+ extern QIcon resize_image;
}
}
#endif
Modified: branches/0.4/sources/ui/dialogautonum.cpp
===================================================================
--- branches/0.4/sources/ui/dialogautonum.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/ui/dialogautonum.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -34,7 +34,7 @@
{
ui -> setupUi(this);
- ui -> configuration_layout -> addWidget (new SelectAutonumW(dg_ -> project() -> diagrams(), ui -> configuration_tab));
+ ui -> configuration_layout -> addWidget (new SelectAutonumW(dg_ -> project() -> diagrams(), dg, ui -> configuration_tab));
dgselect_ = new diagramselection( dg_ -> project(), ui -> annotation_tab);
ui -> verticalLayout_Selection -> addWidget(dgselect_);
Modified: branches/0.4/sources/ui/selectautonumw.cpp
===================================================================
--- branches/0.4/sources/ui/selectautonumw.cpp 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/ui/selectautonumw.cpp 2013-09-29 12:24:51 UTC (rev 2565)
@@ -5,7 +5,7 @@
/**
* Constructor
*/
-SelectAutonumW::SelectAutonumW(const QList <Diagram *> &diagrams, QWidget *parent) :
+SelectAutonumW::SelectAutonumW(const QList <Diagram *> &diagrams, Diagram *current_diagram ,QWidget *parent) :
QWidget(parent),
ui(new Ui::SelectAutonumW),
diagram_list(diagrams)
@@ -13,6 +13,7 @@
ui->setupUi(this);
initDiagramChooser();
+ if (current_diagram) ui -> diagram_chooser -> setCurrentIndex (diagram_list.indexOf(current_diagram));
setCurrentContext();
}
Modified: branches/0.4/sources/ui/selectautonumw.h
===================================================================
--- branches/0.4/sources/ui/selectautonumw.h 2013-09-28 10:52:51 UTC (rev 2564)
+++ branches/0.4/sources/ui/selectautonumw.h 2013-09-29 12:24:51 UTC (rev 2565)
@@ -15,7 +15,7 @@
//METHODS
public:
- explicit SelectAutonumW(const QList <Diagram *> &, QWidget *parent = 0);
+ explicit SelectAutonumW(const QList <Diagram *> &, Diagram * = 0, QWidget *parent = 0);
~SelectAutonumW();
private: