mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-25 11:50:53 +01:00
Les modifications de conducteur sont desormais annulables
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@140 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
21
conducer.cpp
21
conducer.cpp
@@ -4,6 +4,7 @@
|
||||
#include "conducersegmentprofile.h"
|
||||
#include "element.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcommands.h"
|
||||
#define PR(x) qDebug() << #x " = " << x;
|
||||
|
||||
bool Conducer::pen_and_brush_initialized = false;
|
||||
@@ -938,7 +939,11 @@ void Conducer::calculateTextItemPosition() {
|
||||
dans priv_modifieConducer.
|
||||
*/
|
||||
void Conducer::saveProfile() {
|
||||
ConducerProfile old_profile = conducer_profile;
|
||||
conducer_profile.fromConducer(this);
|
||||
if (Diagram *dia = diagram()) {
|
||||
dia -> undoStack().push(new ChangeConducerCommand(this, old_profile, conducer_profile));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -957,3 +962,19 @@ int Conducer::getCoeff(const qreal &value1, const qreal &value2) {
|
||||
int Conducer::getSign(const qreal &value) {
|
||||
return(value < 0 ? -1 : 1);
|
||||
}
|
||||
|
||||
/**
|
||||
Applique un nouveau profil a ce conducteur
|
||||
@param cp Profil a appliquer a ce conducteur
|
||||
*/
|
||||
void Conducer::setProfile(const ConducerProfile &cp) {
|
||||
conducer_profile = cp;
|
||||
if (conducer_profile.isNull()) {
|
||||
priv_calculeConducer(terminal1 -> amarrageConducer(), terminal1 -> orientation(), terminal2 -> amarrageConducer(), terminal2 -> orientation());
|
||||
modified_path = false;
|
||||
} else {
|
||||
priv_modifieConducer(terminal1 -> amarrageConducer(), terminal1 -> orientation(), terminal2 -> amarrageConducer(), terminal2 -> orientation());
|
||||
modified_path = true;
|
||||
}
|
||||
calculateTextItemPosition();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user