git-svn-id: svn://db.shs.com.ru/libs@397 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -109,7 +109,7 @@ void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
|
||||
if (cd->cd_type_ == CDType::cdX)
|
||||
x_selected = cd->collectX();
|
||||
initRoot(cd);
|
||||
K_ChangedGlobal();
|
||||
raiseChangedGlobal(cd->cd_type_);
|
||||
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
||||
piForeach(PIIODevice * d, ds) {
|
||||
if (d)
|
||||
@@ -121,7 +121,7 @@ void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
|
||||
void CDCore::cd_parse(CDSection * cd, PIIODevice * d) {
|
||||
*cd = CDParser::parse(d, cd->cd_type_);
|
||||
initRoot(cd);
|
||||
K_ChangedGlobal();
|
||||
raiseChangedGlobal(cd->cd_type_);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,13 +138,13 @@ void CDCore::cd_update(CDSection * cd, PIIODevice * d, UpdateModeFlags mode) {
|
||||
//piCout << k_.count() << ucd.count();
|
||||
*cd = ucd;
|
||||
initRoot(cd);
|
||||
K_ChangedGlobal();
|
||||
raiseChangedGlobal(cd->cd_type_);
|
||||
}
|
||||
|
||||
|
||||
void CDCore::cd_calculate(CDSection * cd) {
|
||||
cd->calculate();
|
||||
K_ChangedGlobal();
|
||||
raiseChangedGlobal(cd->cd_type_);
|
||||
}
|
||||
|
||||
|
||||
@@ -475,6 +475,16 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
||||
}
|
||||
|
||||
|
||||
void CDCore::raiseChangedGlobal(CDType::cdT cdt) {
|
||||
switch (cdt) {
|
||||
case CDType::cdK: K_ChangedGlobal(); break;
|
||||
case CDType::cdX: X_ChangedGlobal(); break;
|
||||
case CDType::cdC: C_ChangedGlobal(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PIString CDCore::pathToString(const PIDeque<int> & p) {
|
||||
PIString ret;
|
||||
for (int i = 0; i < p.size_s(); ++i) {
|
||||
|
||||
@@ -92,6 +92,7 @@ private:
|
||||
void sendDirect(PIByteArray & ba);
|
||||
void sendThreaded(PIByteArray & ba);
|
||||
void procReceivedPacket(PIByteArray & ba);
|
||||
void raiseChangedGlobal(CDType::cdT cdt);
|
||||
|
||||
typedef PIPair<PIObject * , Handler> OHPair;
|
||||
|
||||
|
||||
@@ -19,18 +19,21 @@ Interface::Interface(CDType::cdT type_) {
|
||||
CONNECTU(core, K_SendFail, this, sendFailed);
|
||||
CONNECTU(core, K_Received, this, received);
|
||||
CONNECTU(core, K_ReceiveFail, this, receiveFailed);
|
||||
CONNECTU(core, K_ChangedGlobal, this, changedGlobal);
|
||||
break;
|
||||
case CDType::cdX:
|
||||
CONNECTU(core, X_Sended, this, sended);
|
||||
CONNECTU(core, X_SendFail, this, sendFailed);
|
||||
CONNECTU(core, X_Received, this, received);
|
||||
CONNECTU(core, X_ReceiveFail, this, receiveFailed);
|
||||
CONNECTU(core, X_ChangedGlobal, this, changedGlobal);
|
||||
break;
|
||||
case CDType::cdC:
|
||||
CONNECTU(core, C_Sended, this, sended);
|
||||
CONNECTU(core, C_SendFail, this, sendFailed);
|
||||
CONNECTU(core, C_Received, this, received);
|
||||
CONNECTU(core, C_ReceiveFail, this, receiveFailed);
|
||||
CONNECTU(core, C_ChangedGlobal, this, changedGlobal);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@ KInterface::KInterface(): Interface(CDType::cdK) {
|
||||
}
|
||||
|
||||
|
||||
void KInterface::directChange(const CDType & k) {
|
||||
core->K_DirectChange(k.path(), k.value());
|
||||
}
|
||||
|
||||
|
||||
void KInterface::directChange(const CDType & k, double v) {
|
||||
core->K_DirectChange(k.path(), PIString::fromNumber(v));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
|
||||
EVENT1(keepNamesRequest, bool*, kn)
|
||||
|
||||
void directChange(const CDType & k);
|
||||
void directChange(const CDType & k, double v);
|
||||
|
||||
};
|
||||
|
||||
@@ -88,6 +88,25 @@ PIString CDType::value() const {
|
||||
}
|
||||
|
||||
|
||||
PIVariant CDType::variantValue() const {
|
||||
if (type_.isEmpty()) return PIVariant(value());
|
||||
switch (type_[0].toAscii()) {
|
||||
case 'b': return PIVariant(toBool()); break;
|
||||
case 'n': return PIVariant(toInt()); break;
|
||||
case 'f': return PIVariant(toDouble()); break;
|
||||
case 'c': return PIVariant(PIVariantTypes::Color(toInt())); break;
|
||||
case 'e': {
|
||||
PIVariantTypes::Enum e = enum_values;
|
||||
e.selectValue(toInt());
|
||||
return PIVariant(e);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return PIVariant(value());
|
||||
}
|
||||
|
||||
|
||||
void CDType::setValue(const PIString & value_) {
|
||||
formula_ = value_;
|
||||
value_d = formula_.toDouble();
|
||||
@@ -96,6 +115,11 @@ void CDType::setValue(const PIString & value_) {
|
||||
}
|
||||
|
||||
|
||||
void CDType::setVariantValue(const PIVariant & value_) {
|
||||
setValue(PIString::fromNumber(value_.toDouble()));
|
||||
}
|
||||
|
||||
|
||||
void CDType::setFormula(const PIString & f) {
|
||||
formula_ = f;
|
||||
calculated = false;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "pistring.h"
|
||||
#include "pimap.h"
|
||||
#include "pivarianttypes.h"
|
||||
#include "pivariant.h"
|
||||
|
||||
class PIIODevice;
|
||||
class PIEvaluator;
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
PIString name() const {return name_;}
|
||||
PIString type() const;
|
||||
PIString value() const;
|
||||
PIVariant variantValue() const;
|
||||
PIString formula() const {return formula_;}
|
||||
PIString comment() const {return comment_;}
|
||||
double toDouble() const {return value_d;}
|
||||
@@ -47,6 +48,7 @@ public:
|
||||
bool toBool() const {return value_b;}
|
||||
cdT cd_type() const {return cd_type_;}
|
||||
void setValue(const PIString & value_);
|
||||
void setVariantValue(const PIVariant & value_);
|
||||
void setFormula(const PIString & formula);
|
||||
void setComment(const PIString & comment) {comment_ = comment;}
|
||||
operator double() const {return value_d;}
|
||||
|
||||
Reference in New Issue
Block a user