Show corresponding diagram to undo/redo action

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2714 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-01-06 18:21:58 +00:00
parent 38ea0c7ff8
commit 51c34b416b
7 changed files with 73 additions and 13 deletions

View File

@@ -95,7 +95,7 @@ void ConductorAutoNumerotation::applyText(QString t) {
diagram_ -> undoStack().push(ccpc); diagram_ -> undoStack().push(ccpc);
} }
else { else {
QSet <Conductor *> clist = conductor_list; QList <Conductor *> clist = conductor_list.toList();
clist << conductor_; clist << conductor_;
QList <ConductorProperties> old_properties, new_properties; QList <ConductorProperties> old_properties, new_properties;
ConductorProperties cp; ConductorProperties cp;

View File

@@ -111,6 +111,7 @@ class Diagram : public QGraphicsScene {
void setProject(QETProject *); void setProject(QETProject *);
int folioIndex() const; int folioIndex() const;
qreal declaredQElectroTechVersion(bool = true) const; qreal declaredQElectroTechVersion(bool = true) const;
void showMe() {emit showDiagram(this);}
// methods related to read only mode // methods related to read only mode
bool isReadOnly() const; bool isReadOnly() const;
@@ -198,6 +199,7 @@ class Diagram : public QGraphicsScene {
void invertSelection(); void invertSelection();
signals: signals:
void showDiagram (Diagram *);
void written(); void written();
void readOnlyChanged(bool); void readOnlyChanged(bool);
void usedTitleBlockTemplateChanged(const QString &); void usedTitleBlockTemplateChanged(const QString &);

View File

@@ -55,11 +55,13 @@ AddElementCommand::~AddElementCommand() {
/// Annule l'ajout /// Annule l'ajout
void AddElementCommand::undo() { void AddElementCommand::undo() {
diagram->showMe();
diagram -> removeElement(element); diagram -> removeElement(element);
} }
/// Refait l'ajout /// Refait l'ajout
void AddElementCommand::redo() { void AddElementCommand::redo() {
diagram->showMe();
diagram -> addElement(element); diagram -> addElement(element);
element -> setPos(position); element -> setPos(position);
element -> setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); element -> setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
@@ -88,11 +90,13 @@ AddTextCommand::~AddTextCommand() {
/// Annule l'ajout /// Annule l'ajout
void AddTextCommand::undo() { void AddTextCommand::undo() {
diagram->showMe();
diagram -> removeIndependentTextItem(textitem); diagram -> removeIndependentTextItem(textitem);
} }
/// Refait l'ajout /// Refait l'ajout
void AddTextCommand::redo() { void AddTextCommand::redo() {
diagram->showMe();
diagram -> addIndependentTextItem(textitem); diagram -> addIndependentTextItem(textitem);
textitem -> setPos(position); textitem -> setPos(position);
} }
@@ -120,11 +124,13 @@ AddImageCommand::~AddImageCommand() {
///Annule l'ajout ///Annule l'ajout
void AddImageCommand::undo() { void AddImageCommand::undo() {
diagram->showMe();
diagram -> removeItem(imageitem); diagram -> removeItem(imageitem);
} }
///Refait l'ajout ///Refait l'ajout
void AddImageCommand::redo() { void AddImageCommand::redo() {
diagram->showMe();
diagram -> addDiagramImageItem(imageitem); diagram -> addDiagramImageItem(imageitem);
imageitem -> setPos(position - imageitem -> boundingRect().center()); imageitem -> setPos(position - imageitem -> boundingRect().center());
} }
@@ -154,11 +160,13 @@ AddConductorCommand::~AddConductorCommand() {
/// Annule l'ajout /// Annule l'ajout
void AddConductorCommand::undo() { void AddConductorCommand::undo() {
diagram->showMe();
diagram -> removeConductor(conductor); diagram -> removeConductor(conductor);
} }
/// Refait l'ajout /// Refait l'ajout
void AddConductorCommand::redo() { void AddConductorCommand::redo() {
diagram->showMe();
diagram -> addConductor(conductor); diagram -> addConductor(conductor);
} }
@@ -195,6 +203,7 @@ DeleteElementsCommand::~DeleteElementsCommand() {
/// annule les suppressions /// annule les suppressions
void DeleteElementsCommand::undo() { void DeleteElementsCommand::undo() {
diagram->showMe();
// remet les elements // remet les elements
foreach(Element *e, removed_content.elements) { foreach(Element *e, removed_content.elements) {
diagram -> addElement(e); diagram -> addElement(e);
@@ -217,6 +226,7 @@ void DeleteElementsCommand::undo() {
/// refait les suppressions /// refait les suppressions
void DeleteElementsCommand::redo() { void DeleteElementsCommand::redo() {
diagram->showMe();
// enleve les conducteurs // enleve les conducteurs
foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor)) { foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor)) {
diagram -> removeConductor(c); diagram -> removeConductor(c);
@@ -274,6 +284,7 @@ PasteDiagramCommand::~PasteDiagramCommand() {
/// annule le coller /// annule le coller
void PasteDiagramCommand::undo() { void PasteDiagramCommand::undo() {
diagram->showMe();
// remove the conductors // remove the conductors
foreach(Conductor *c, content.conductorsToMove) diagram -> removeConductor(c); foreach(Conductor *c, content.conductorsToMove) diagram -> removeConductor(c);
@@ -289,6 +300,7 @@ void PasteDiagramCommand::undo() {
/// refait le coller /// refait le coller
void PasteDiagramCommand::redo() { void PasteDiagramCommand::redo() {
diagram->showMe();
if (first_redo) first_redo = false; if (first_redo) first_redo = false;
else { else {
// paste the elements // paste the elements
@@ -379,11 +391,13 @@ MoveElementsCommand::~MoveElementsCommand() {
/// annule le deplacement /// annule le deplacement
void MoveElementsCommand::undo() { void MoveElementsCommand::undo() {
diagram->showMe();
move(-movement); move(-movement);
} }
/// refait le deplacement /// refait le deplacement
void MoveElementsCommand::redo() { void MoveElementsCommand::redo() {
diagram->showMe();
if (first_redo) first_redo = false; if (first_redo) first_redo = false;
else move(movement); else move(movement);
} }
@@ -481,11 +495,13 @@ MoveElementsTextsCommand::~MoveElementsTextsCommand() {
/// annule le deplacement /// annule le deplacement
void MoveElementsTextsCommand::undo() { void MoveElementsTextsCommand::undo() {
diagram->showMe();
move(-movement); move(-movement);
} }
/// refait le deplacement /// refait le deplacement
void MoveElementsTextsCommand::redo() { void MoveElementsTextsCommand::redo() {
diagram->showMe();
if (first_redo) first_redo = false; if (first_redo) first_redo = false;
else move(movement); else move(movement);
} }
@@ -526,6 +542,7 @@ MoveConductorsTextsCommand::~MoveConductorsTextsCommand() {
/// annule le deplacement /// annule le deplacement
void MoveConductorsTextsCommand::undo() { void MoveConductorsTextsCommand::undo() {
diagram->showMe();
foreach(ConductorTextItem *cti, texts_to_move_.keys()) { foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
QPointF movement = texts_to_move_[cti].first; QPointF movement = texts_to_move_[cti].first;
bool was_already_moved = texts_to_move_[cti].second; bool was_already_moved = texts_to_move_[cti].second;
@@ -539,6 +556,7 @@ void MoveConductorsTextsCommand::undo() {
/// refait le deplacement /// refait le deplacement
void MoveConductorsTextsCommand::redo() { void MoveConductorsTextsCommand::redo() {
diagram->showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
} else { } else {
@@ -602,7 +620,8 @@ ChangeDiagramTextCommand::ChangeDiagramTextCommand(
text_item(dti), text_item(dti),
text_before(before), text_before(before),
text_after(after), text_after(after),
first_redo(true) first_redo(true),
diagram(dti->diagram())
{ {
} }
@@ -612,11 +631,13 @@ ChangeDiagramTextCommand::~ChangeDiagramTextCommand() {
/// annule la modification de texte /// annule la modification de texte
void ChangeDiagramTextCommand::undo() { void ChangeDiagramTextCommand::undo() {
diagram->showMe();
text_item -> setHtml(text_before); text_item -> setHtml(text_before);
} }
/// refait la modification de texte /// refait la modification de texte
void ChangeDiagramTextCommand::redo() { void ChangeDiagramTextCommand::redo() {
diagram->showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
} else { } else {
@@ -635,7 +656,8 @@ RotateElementsCommand::RotateElementsCommand(const QList<Element *> &elements, c
elements_to_rotate(elements), elements_to_rotate(elements),
texts_to_rotate(texts), texts_to_rotate(texts),
images_to_rotate(images), images_to_rotate(images),
applied_rotation_angle_(90.0) applied_rotation_angle_(90.0),
diagram (elements.first()->diagram())
{ {
setText( setText(
QString( QString(
@@ -653,6 +675,7 @@ RotateElementsCommand::~RotateElementsCommand() {
/// defait le pivotement /// defait le pivotement
void RotateElementsCommand::undo() { void RotateElementsCommand::undo() {
diagram->showMe();
foreach(Element *e, elements_to_rotate) { foreach(Element *e, elements_to_rotate) {
e -> rotateBy(-applied_rotation_angle_); e -> rotateBy(-applied_rotation_angle_);
} }
@@ -670,6 +693,7 @@ void RotateElementsCommand::undo() {
/// refait le pivotement /// refait le pivotement
void RotateElementsCommand::redo() { void RotateElementsCommand::redo() {
diagram->showMe();
foreach(Element *e, elements_to_rotate) { foreach(Element *e, elements_to_rotate) {
e -> rotateBy(applied_rotation_angle_); e -> rotateBy(applied_rotation_angle_);
} }
@@ -693,7 +717,8 @@ void RotateElementsCommand::redo() {
RotateTextsCommand::RotateTextsCommand(const QHash<DiagramTextItem *, double> &previous_state, double applied_rotation, QUndoCommand *parent) : RotateTextsCommand::RotateTextsCommand(const QHash<DiagramTextItem *, double> &previous_state, double applied_rotation, QUndoCommand *parent) :
QUndoCommand(parent), QUndoCommand(parent),
texts_to_rotate(previous_state), texts_to_rotate(previous_state),
applied_rotation_angle_(applied_rotation) applied_rotation_angle_(applied_rotation),
diagram(previous_state.key(0)->diagram())
{ {
defineCommandName(); defineCommandName();
} }
@@ -724,6 +749,7 @@ RotateTextsCommand::~RotateTextsCommand() {
Annule la rotation des textes Annule la rotation des textes
*/ */
void RotateTextsCommand::undo() { void RotateTextsCommand::undo() {
diagram->showMe();
foreach(DiagramTextItem *text, texts_to_rotate.keys()) { foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text))
cti -> forceRotateByUser(previous_rotate_by_user_[cti]); cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
@@ -735,6 +761,7 @@ void RotateTextsCommand::undo() {
Applique l'angle de rotation aux textes Applique l'angle de rotation aux textes
*/ */
void RotateTextsCommand::redo() { void RotateTextsCommand::redo() {
diagram->showMe();
foreach(DiagramTextItem *text, texts_to_rotate.keys()) { foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) { if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
//we grab the previous rotation by user of each ConductorTextItem //we grab the previous rotation by user of each ConductorTextItem
@@ -780,7 +807,8 @@ ChangeConductorCommand::ChangeConductorCommand(
old_profile(old_p), old_profile(old_p),
new_profile(new_p), new_profile(new_p),
path_type(path_t), path_type(path_t),
first_redo(true) first_redo(true),
diagram (c->diagram())
{ {
} }
@@ -790,12 +818,14 @@ ChangeConductorCommand::~ChangeConductorCommand() {
/// Annule la modification du conducteur /// Annule la modification du conducteur
void ChangeConductorCommand::undo() { void ChangeConductorCommand::undo() {
diagram->showMe();
conductor -> setProfile(old_profile, path_type); conductor -> setProfile(old_profile, path_type);
conductor -> textItem() -> setPos(text_pos_before_mov_); conductor -> textItem() -> setPos(text_pos_before_mov_);
} }
/// Refait la modification du conducteur /// Refait la modification du conducteur
void ChangeConductorCommand::redo() { void ChangeConductorCommand::redo() {
diagram->showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
} else { } else {
@@ -825,7 +855,8 @@ ResetConductorCommand::ResetConductorCommand(
QUndoCommand *parent QUndoCommand *parent
) : ) :
QUndoCommand(parent), QUndoCommand(parent),
conductors_profiles(cp) conductors_profiles(cp),
diagram(cp.keys().first()->diagram())
{ {
setText( setText(
QObject::tr( QObject::tr(
@@ -841,6 +872,7 @@ ResetConductorCommand::~ResetConductorCommand() {
/// Annule la reinitialisation des conducteurs /// Annule la reinitialisation des conducteurs
void ResetConductorCommand::undo() { void ResetConductorCommand::undo() {
diagram->showMe();
foreach(Conductor *c, conductors_profiles.keys()) { foreach(Conductor *c, conductors_profiles.keys()) {
c -> setProfiles(conductors_profiles[c]); c -> setProfiles(conductors_profiles[c]);
} }
@@ -848,6 +880,7 @@ void ResetConductorCommand::undo() {
/// Refait la reinitialisation des conducteurs /// Refait la reinitialisation des conducteurs
void ResetConductorCommand::redo() { void ResetConductorCommand::redo() {
diagram->showMe();
foreach(Conductor *c, conductors_profiles.keys()) { foreach(Conductor *c, conductors_profiles.keys()) {
c -> setProfiles(ConductorProfilesGroup()); c -> setProfiles(ConductorProfilesGroup());
} }
@@ -879,12 +912,14 @@ ChangeTitleBlockCommand::~ChangeTitleBlockCommand() {
/// Annule la modification de cartouche /// Annule la modification de cartouche
void ChangeTitleBlockCommand::undo() { void ChangeTitleBlockCommand::undo() {
diagram->showMe();
diagram -> border_and_titleblock.importTitleBlock(old_titleblock); diagram -> border_and_titleblock.importTitleBlock(old_titleblock);
diagram -> invalidate(diagram -> border()); diagram -> invalidate(diagram -> border());
} }
/// Refait la modification de cartouche /// Refait la modification de cartouche
void ChangeTitleBlockCommand::redo() { void ChangeTitleBlockCommand::redo() {
diagram->showMe();
diagram -> border_and_titleblock.importTitleBlock(new_titleblock); diagram -> border_and_titleblock.importTitleBlock(new_titleblock);
diagram -> invalidate(diagram -> border()); diagram -> invalidate(diagram -> border());
} }
@@ -910,11 +945,13 @@ ChangeBorderCommand::~ChangeBorderCommand() {
/// Annule les changements apportes au schema /// Annule les changements apportes au schema
void ChangeBorderCommand::undo() { void ChangeBorderCommand::undo() {
diagram->showMe();
diagram -> border_and_titleblock.importBorder(old_properties); diagram -> border_and_titleblock.importBorder(old_properties);
} }
/// Refait les changements apportes au schema /// Refait les changements apportes au schema
void ChangeBorderCommand::redo() { void ChangeBorderCommand::redo() {
diagram->showMe();
diagram -> border_and_titleblock.importBorder(new_properties); diagram -> border_and_titleblock.importBorder(new_properties);
} }
@@ -927,7 +964,8 @@ ChangeConductorPropertiesCommand::ChangeConductorPropertiesCommand(Conductor *c,
QUndoCommand(QObject::tr("modifier les propri\351t\351s d'un conducteur", "undo caption"), parent), QUndoCommand(QObject::tr("modifier les propri\351t\351s d'un conducteur", "undo caption"), parent),
conductor(c), conductor(c),
old_settings_set(false), old_settings_set(false),
new_settings_set(false) new_settings_set(false),
diagram(c->diagram())
{ {
} }
@@ -952,6 +990,7 @@ void ChangeConductorPropertiesCommand::setNewSettings(const ConductorProperties
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/ */
void ChangeConductorPropertiesCommand::undo() { void ChangeConductorPropertiesCommand::undo() {
diagram->showMe();
if (old_settings_set && new_settings_set) { if (old_settings_set && new_settings_set) {
conductor -> setProperties(old_properties); conductor -> setProperties(old_properties);
conductor -> update(); conductor -> update();
@@ -963,6 +1002,7 @@ void ChangeConductorPropertiesCommand::undo() {
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/ */
void ChangeConductorPropertiesCommand::redo() { void ChangeConductorPropertiesCommand::redo() {
diagram->showMe();
if (old_settings_set && new_settings_set) { if (old_settings_set && new_settings_set) {
conductor -> setProperties(new_properties); conductor -> setProperties(new_properties);
conductor -> update(); conductor -> update();
@@ -974,11 +1014,12 @@ void ChangeConductorPropertiesCommand::redo() {
@param c La liste des conducteurs dont on modifie les proprietes @param c La liste des conducteurs dont on modifie les proprietes
@param parent QUndoCommand parent @param parent QUndoCommand parent
*/ */
ChangeSeveralConductorsPropertiesCommand::ChangeSeveralConductorsPropertiesCommand(QSet<Conductor *>c, QUndoCommand *parent) : ChangeSeveralConductorsPropertiesCommand::ChangeSeveralConductorsPropertiesCommand(QList<Conductor *>c, QUndoCommand *parent) :
QUndoCommand(QObject::tr("modifier les propri\351t\351s de plusieurs conducteurs", "undo caption"), parent), QUndoCommand(QObject::tr("modifier les propri\351t\351s de plusieurs conducteurs", "undo caption"), parent),
conductors(c), conductors(c),
old_settings_set(false), old_settings_set(false),
new_settings_set(false) new_settings_set(false),
diagram(c.first()->diagram())
{ {
} }
@@ -1014,6 +1055,7 @@ void ChangeSeveralConductorsPropertiesCommand::setNewSettings(const ConductorPro
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/ */
void ChangeSeveralConductorsPropertiesCommand::undo() { void ChangeSeveralConductorsPropertiesCommand::undo() {
diagram->showMe();
if (old_settings_set && new_settings_set) { if (old_settings_set && new_settings_set) {
int i=0; int i=0;
foreach(Conductor *c, conductors) { foreach(Conductor *c, conductors) {
@@ -1029,6 +1071,7 @@ void ChangeSeveralConductorsPropertiesCommand::undo() {
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/ */
void ChangeSeveralConductorsPropertiesCommand::redo() { void ChangeSeveralConductorsPropertiesCommand::redo() {
diagram->showMe();
if (old_settings_set && new_settings_set) { if (old_settings_set && new_settings_set) {
//new propertie are the same for each conductor //new propertie are the same for each conductor
@@ -1062,7 +1105,8 @@ ImageResizerCommand::ImageResizerCommand (DiagramImageItem *image, qreal &old_,
QUndoCommand(parent), QUndoCommand(parent),
image_(image), image_(image),
old_size (old_), old_size (old_),
new_size (new_) new_size (new_),
diagram(image->diagram())
{} {}
/** /**
@@ -1074,6 +1118,7 @@ ImageResizerCommand::~ImageResizerCommand() {}
* @brief ImageResizerCommand::undo set the old size * @brief ImageResizerCommand::undo set the old size
*/ */
void ImageResizerCommand::undo() { void ImageResizerCommand::undo() {
diagram->showMe();
image_ -> setScale(old_size); image_ -> setScale(old_size);
} }
@@ -1081,6 +1126,7 @@ void ImageResizerCommand::undo() {
* @brief ImageResizerCommand::redo set the new size * @brief ImageResizerCommand::redo set the new size
*/ */
void ImageResizerCommand::redo() { void ImageResizerCommand::redo() {
diagram->showMe();
if (old_size<new_size) setText(QObject::tr("Agrandire une image \340 %1 %").arg(new_size*100)); 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)); else setText(QObject::tr("R\351duire une image \340 %1 %").arg(new_size*100));
image_ -> setScale(new_size); image_ -> setScale(new_size);

View File

@@ -322,6 +322,7 @@ class ChangeDiagramTextCommand : public QUndoCommand {
QString text_after; QString text_after;
/// prevent the first call to redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
Diagram *diagram;
}; };
/** /**
@@ -352,6 +353,7 @@ class RotateElementsCommand : public QUndoCommand {
qreal applied_rotation_angle_; qreal applied_rotation_angle_;
/// previous state of each conductor text item /// previous state of each conductor text item
QHash<ConductorTextItem *, bool> previous_rotate_by_user_; QHash<ConductorTextItem *, bool> previous_rotate_by_user_;
Diagram *diagram;
}; };
/** /**
@@ -383,6 +385,7 @@ class RotateTextsCommand : public QUndoCommand {
double applied_rotation_angle_; double applied_rotation_angle_;
/// previous state of each conductor text item /// previous state of each conductor text item
QHash<ConductorTextItem *, bool> previous_rotate_by_user_; QHash<ConductorTextItem *, bool> previous_rotate_by_user_;
Diagram *diagram;
}; };
/** /**
@@ -418,6 +421,7 @@ class ChangeConductorCommand : public QUndoCommand {
QPointF text_pos_after_mov_; QPointF text_pos_after_mov_;
/// prevent the first call to redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
Diagram *diagram;
}; };
/** /**
@@ -440,6 +444,7 @@ class ResetConductorCommand : public QUndoCommand {
private: private:
/// impacted conductors along with their former profiles /// impacted conductors along with their former profiles
QHash<Conductor *, ConductorProfilesGroup> conductors_profiles; QHash<Conductor *, ConductorProfilesGroup> conductors_profiles;
Diagram *diagram;
}; };
/** /**
@@ -525,6 +530,7 @@ class ChangeConductorPropertiesCommand : public QUndoCommand {
bool old_settings_set; bool old_settings_set;
/// track whether post-change properties were set /// track whether post-change properties were set
bool new_settings_set; bool new_settings_set;
Diagram *diagram;
}; };
/** /**
@@ -533,7 +539,7 @@ class ChangeConductorPropertiesCommand : public QUndoCommand {
class ChangeSeveralConductorsPropertiesCommand : public QUndoCommand { class ChangeSeveralConductorsPropertiesCommand : public QUndoCommand {
// constructors, destructor // constructors, destructor
public: public:
ChangeSeveralConductorsPropertiesCommand(QSet<Conductor *>, QUndoCommand * = 0); ChangeSeveralConductorsPropertiesCommand(QList<Conductor *>, QUndoCommand * = 0);
virtual ~ChangeSeveralConductorsPropertiesCommand(); virtual ~ChangeSeveralConductorsPropertiesCommand();
private: private:
ChangeSeveralConductorsPropertiesCommand(const ChangeSeveralConductorsPropertiesCommand &); ChangeSeveralConductorsPropertiesCommand(const ChangeSeveralConductorsPropertiesCommand &);
@@ -549,7 +555,7 @@ class ChangeSeveralConductorsPropertiesCommand : public QUndoCommand {
// attributes // attributes
private: private:
/// modified conductor /// modified conductor
QSet<Conductor *> conductors; QList<Conductor *> conductors;
/// properties before the change /// properties before the change
QList <ConductorProperties> old_properties; QList <ConductorProperties> old_properties;
/// properties after the change /// properties after the change
@@ -560,6 +566,7 @@ class ChangeSeveralConductorsPropertiesCommand : public QUndoCommand {
bool old_settings_set; bool old_settings_set;
/// track whether post-change properties were set /// track whether post-change properties were set
bool new_settings_set; bool new_settings_set;
Diagram *diagram;
}; };
class ImageResizerCommand : public QUndoCommand { class ImageResizerCommand : public QUndoCommand {
@@ -577,6 +584,7 @@ class ImageResizerCommand : public QUndoCommand {
private: private:
DiagramImageItem *image_; DiagramImageItem *image_;
qreal old_size, new_size; qreal old_size, new_size;
Diagram *diagram;
}; };
#endif #endif

View File

@@ -83,6 +83,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : QGraphicsView(pare
paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this); paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this);
connect(paste_here, SIGNAL(triggered()), this, SLOT(pasteHere())); connect(paste_here, SIGNAL(triggered()), this, SLOT(pasteHere()));
connect(scene, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(scene, SIGNAL(readOnlyChanged(bool)), this, SLOT(applyReadOnly())); connect(scene, SIGNAL(readOnlyChanged(bool)), this, SLOT(applyReadOnly()));
connect(&(scene -> border_and_titleblock), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect())); connect(&(scene -> border_and_titleblock), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
@@ -973,7 +974,7 @@ void DiagramView::editConductor(Conductor *edited_conductor) {
if (new_properties != old_properties) { if (new_properties != old_properties) {
if (cb_apply_all -> isChecked()) { if (cb_apply_all -> isChecked()) {
QSet <Conductor *> conductorslist = edited_conductor -> relatedPotentialConductors(); QList <Conductor *> conductorslist = edited_conductor -> relatedPotentialConductors().toList();
conductorslist << edited_conductor; conductorslist << edited_conductor;
QList <ConductorProperties> old_properties_list; QList <ConductorProperties> old_properties_list;

View File

@@ -131,6 +131,8 @@ class DiagramView : public QGraphicsView {
void ImageAdded(bool); void ImageAdded(bool);
/// Signal emmitted fater windows selection image have been canceled /// Signal emmitted fater windows selection image have been canceled
void ImageAddedCanceled(bool); void ImageAddedCanceled(bool);
/// Signal emmitted when diagram must be show
void showDiagram (Diagram *);
public slots: public slots:
void selectNothing(); void selectNothing();

View File

@@ -318,6 +318,7 @@ void ProjectView::addDiagram(DiagramView *diagram) {
diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame); diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
diagrams_ << diagram; diagrams_ << diagram;
rebuildDiagramsMap(); rebuildDiagramsMap();
connect(diagram, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &))); connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &))); connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &))); connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));