diff --git a/VERSION b/VERSION index 54399cd2..4531e1c7 100644 --- a/VERSION +++ b/VERSION @@ -2,5 +2,5 @@ PACKAGE=picsimlab MAINVER=0 MINORVER=9 VERSION=0.9.1 -DATE=240129 +DATE=240131 VERSION_STABLE=0.9.1 diff --git a/src/lib/part.cc b/src/lib/part.cc index 25b53676..4b6c4864 100644 --- a/src/lib/part.cc +++ b/src/lib/part.cc @@ -510,34 +510,23 @@ const PCWProp* part::GetPCWProperties(void) { return PCWProperties; } -void part::SetPCWComboWithPinNames(CPWindow* WProp, const char* combo_name, const unsigned char pin) { +void part::SetPCWComboWithPinNames(const char* combo_name, const unsigned char pin) { std::string spin; - CCombo* combo = (CCombo*)WProp->GetChildByName(combo_name); + SpareParts.WPropCmd(combo_name, WPA_COMBOSETITEMS, SpareParts.GetPinsNames().c_str()); - if (combo) { - combo->SetItems(SpareParts.GetPinsNames()); - if (pin == 0) - combo->SetText("0 NC"); - else { - spin = SpareParts.GetPinName(pin); - combo->SetText(std::to_string(pin) + " " + spin); - } + if (pin == 0) { + SpareParts.WPropCmd(combo_name, WPA_COMBOSETTEXT, "0 NC"); } else { - printf("PICSimLab: Combo (%s) not found in Part Configuration Window!\n", combo_name); + spin = SpareParts.GetPinName(pin); + SpareParts.WPropCmd(combo_name, WPA_COMBOSETTEXT, (std::to_string(pin) + " " + spin).c_str()); } } -unsigned char part::GetPWCComboSelectedPin(CPWindow* WProp, const char* combo_name) { - int selectedpin = 0; - CCombo* combo = (CCombo*)WProp->GetChildByName(combo_name); - - if (combo) { - selectedpin = atoi(combo->GetText()); - } else { - printf("PICSimLab: Combo (%s) not found in Part Configuration Window!\n", combo_name); - } - return selectedpin; +unsigned char part::GetPWCComboSelectedPin(const char* combo_name) { + char buff[64]; + SpareParts.WPropCmd(combo_name, WPA_COMBOGETTEXT, NULL, buff); + return atoi(buff); } std::string part::GetName(void) { diff --git a/src/lib/part.h b/src/lib/part.h index 66a28fbd..2c4d668d 100644 --- a/src/lib/part.h +++ b/src/lib/part.h @@ -196,12 +196,12 @@ class part { /** * @brief Called to configure the properties window */ - virtual void ConfigurePropertiesWindow(CPWindow* WProp) = 0; + virtual void ConfigurePropertiesWindow(void) = 0; /** * @brief Called when properties window close */ - virtual void ReadPropertiesWindow(CPWindow* WProp) = 0; + virtual void ReadPropertiesWindow(void) = 0; /** * @brief Used by properties window combos @@ -399,8 +399,8 @@ class part { int PointInside(int x, int y, input_t input); void SetPCWProperties(const PCWProp* pcwprop); - void SetPCWComboWithPinNames(CPWindow* WProp, const char* combo_name, const unsigned char pin); - unsigned char GetPWCComboSelectedPin(CPWindow* WProp, const char* combo_name); + void SetPCWComboWithPinNames(const char* combo_name, const unsigned char pin); + unsigned char GetPWCComboSelectedPin(const char* combo_name); private: const PCWProp* PCWProperties; diff --git a/src/lib/spareparts.cc b/src/lib/spareparts.cc index cefe5700..bba64278 100644 --- a/src/lib/spareparts.cc +++ b/src/lib/spareparts.cc @@ -43,14 +43,12 @@ CSpareParts::CSpareParts() { fdtype = -1; PartOnDraw = -1; - PropButtonRelease = NULL; - PropComboChange = NULL; - PropSpinChange = NULL; PartEvent = NULL; PartKeyEvent = NULL; PartButtonEvent = NULL; OnCanvasCmd = NULL; + OnWPropCmd = NULL; } void CSpareParts::Init(CWindow* win) { @@ -678,4 +676,12 @@ int CSpareParts::CanvasCmd(const CanvasCmd_t cmd) { return (*SpareParts.OnCanvasCmd)(cmd); } return -1; +} + +int CSpareParts::WPropCmd(const char* ControlName, const PICSimLabWPropAction action, const char* Value, + void* ReturnBuff) { + if (SpareParts.OnWPropCmd) { + return (*SpareParts.OnWPropCmd)(ControlName, action, Value, ReturnBuff); + } + return -1; } \ No newline at end of file diff --git a/src/lib/spareparts.h b/src/lib/spareparts.h index 35aa3722..e5821725 100644 --- a/src/lib/spareparts.h +++ b/src/lib/spareparts.h @@ -31,6 +31,39 @@ #define IOINIT 110 +enum PICSimLabWPropAction { + WPA_COMBOSETITEMS, + WPA_COMBOSETTEXT, + WPA_COMBOGETTEXT, + WPA_SPINDSETMAX, + WPA_SPINDSETMIN, + WPA_SPINDSETVALUE, + WPA_SPINDGETVALUE, + WPA_SPINSETMAX, + WPA_SPINSETMIN, + WPA_SPINSETVALUE, + WPA_SPINGETVALUE, + + WPA_TEXTCLEAR, + WPA_TEXTADDLINE, + WPA_TEXTGETLINE, + WPA_TEXTGETLINECOUNT, + + WPA_EDITSETTEXT, + WPA_EDITGETTEXT, + + WPA_LABELSETTEXT, + + WPA_SETENABLE, + WPA_SETWIDTH, + WPA_SETHEIGHT, + WPA_SETVISIBLE, + WPA_SETX, + WPA_SETY, + + WPA_LAST, +}; + class CSpareParts { public: CSpareParts(); @@ -95,11 +128,6 @@ class CSpareParts { CFileDialog* GetFileDialog(void) { return filedialog; } void Reset(void); - void (CControl::*PropButtonRelease)(CControl* control, const uint button, const uint x, const uint y, - const uint mask); - void (CControl::*PropComboChange)(CControl* control); - void (CControl::*PropSpinChange)(CControl* control); - void (CControl::*PartButtonEvent)(CControl* control, const uint button, const uint x, const uint y, const uint mask); void (CControl::*PartEvent)(CControl* control); @@ -126,8 +154,13 @@ class CSpareParts { static int CanvasCmd(const CanvasCmd_t cmd); + static int WPropCmd(const char* ControlName, const PICSimLabWPropAction action, const char* Value, + void* ReturnBuff = NULL); + int (*OnCanvasCmd)(const CanvasCmd_t cmd); + int (*OnWPropCmd)(const char* ControlName, const PICSimLabWPropAction action, const char* Value, void* ReturnBuff); + private: float scale; board* pboard; diff --git a/src/parts/input_ADXL345.cc b/src/parts/input_ADXL345.cc index 1be3c027..369bce44 100644 --- a/src/parts/input_ADXL345.cc +++ b/src/parts/input_ADXL345.cc @@ -197,22 +197,22 @@ void cpart_ADXL345::ReadPreferences(std::string value) { Reset(); } -void cpart_ADXL345::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", adxl_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", adxl_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", adxl_pins[2]); - SetPCWComboWithPinNames(WProp, "combo6", adxl_pins[3]); - SetPCWComboWithPinNames(WProp, "combo7", adxl_pins[4]); - SetPCWComboWithPinNames(WProp, "combo8", adxl_pins[5]); +void cpart_ADXL345::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", adxl_pins[0]); + SetPCWComboWithPinNames("combo4", adxl_pins[1]); + SetPCWComboWithPinNames("combo5", adxl_pins[2]); + SetPCWComboWithPinNames("combo6", adxl_pins[3]); + SetPCWComboWithPinNames("combo7", adxl_pins[4]); + SetPCWComboWithPinNames("combo8", adxl_pins[5]); } -void cpart_ADXL345::ReadPropertiesWindow(CPWindow* WProp) { - adxl_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - adxl_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - adxl_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); - adxl_pins[3] = GetPWCComboSelectedPin(WProp, "combo6"); - adxl_pins[4] = GetPWCComboSelectedPin(WProp, "combo7"); - adxl_pins[5] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_ADXL345::ReadPropertiesWindow(void) { + adxl_pins[0] = GetPWCComboSelectedPin("combo3"); + adxl_pins[1] = GetPWCComboSelectedPin("combo4"); + adxl_pins[2] = GetPWCComboSelectedPin("combo5"); + adxl_pins[3] = GetPWCComboSelectedPin("combo6"); + adxl_pins[4] = GetPWCComboSelectedPin("combo7"); + adxl_pins[5] = GetPWCComboSelectedPin("combo8"); } void cpart_ADXL345::PreProcess(void) { diff --git a/src/parts/input_ADXL345.h b/src/parts/input_ADXL345.h index e58900d0..bed0685f 100644 --- a/src/parts/input_ADXL345.h +++ b/src/parts/input_ADXL345.h @@ -46,8 +46,8 @@ class cpart_ADXL345 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_LDR.cc b/src/parts/input_LDR.cc index 0de0b801..a47a4402 100644 --- a/src/parts/input_LDR.cc +++ b/src/parts/input_LDR.cc @@ -226,19 +226,20 @@ void cpart_LDR::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%hhu,%f", &output_pins[0], &output_pins[1], &value, &vthreshold); } -void cpart_LDR::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); +void cpart_LDR::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); - ((CSpind*)WProp->GetChildByName("spind5"))->SetMax(vmax); - ((CSpind*)WProp->GetChildByName("spind5"))->SetValue(vthreshold); + SpareParts.WPropCmd("spind5", WPA_SPINDSETMAX, std::to_string(vmax).c_str()); + SpareParts.WPropCmd("spind5", WPA_SPINDSETMIN, "0"); + SpareParts.WPropCmd("spind5", WPA_SPINDSETVALUE, std::to_string(vthreshold).c_str()); } -void cpart_LDR::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_LDR::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); - vthreshold = ((CSpind*)WProp->GetChildByName("spind5"))->GetValue(); + SpareParts.WPropCmd("spind5", WPA_SPINDGETVALUE, NULL, &vthreshold); } part_init(PART_LDR_Name, cpart_LDR, "Input"); diff --git a/src/parts/input_LDR.h b/src/parts/input_LDR.h index baccaabf..ee3f2f54 100644 --- a/src/parts/input_LDR.h +++ b/src/parts/input_LDR.h @@ -40,8 +40,8 @@ class cpart_LDR : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void Reset(void) override; diff --git a/src/parts/input_MPU6050.cc b/src/parts/input_MPU6050.cc index 2bf35a73..6ac0417e 100644 --- a/src/parts/input_MPU6050.cc +++ b/src/parts/input_MPU6050.cc @@ -241,22 +241,22 @@ void cpart_MPU6050::ReadPreferences(std::string value) { Reset(); } -void cpart_MPU6050::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", mpu_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", mpu_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", mpu_pins[2]); - SetPCWComboWithPinNames(WProp, "combo6", mpu_pins[3]); - SetPCWComboWithPinNames(WProp, "combo7", mpu_pins[4]); - SetPCWComboWithPinNames(WProp, "combo8", mpu_pins[5]); +void cpart_MPU6050::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", mpu_pins[0]); + SetPCWComboWithPinNames("combo4", mpu_pins[1]); + SetPCWComboWithPinNames("combo5", mpu_pins[2]); + SetPCWComboWithPinNames("combo6", mpu_pins[3]); + SetPCWComboWithPinNames("combo7", mpu_pins[4]); + SetPCWComboWithPinNames("combo8", mpu_pins[5]); } -void cpart_MPU6050::ReadPropertiesWindow(CPWindow* WProp) { - mpu_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - mpu_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - mpu_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); - mpu_pins[3] = GetPWCComboSelectedPin(WProp, "combo6"); - mpu_pins[4] = GetPWCComboSelectedPin(WProp, "combo7"); - mpu_pins[5] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_MPU6050::ReadPropertiesWindow(void) { + mpu_pins[0] = GetPWCComboSelectedPin("combo3"); + mpu_pins[1] = GetPWCComboSelectedPin("combo4"); + mpu_pins[2] = GetPWCComboSelectedPin("combo5"); + mpu_pins[3] = GetPWCComboSelectedPin("combo6"); + mpu_pins[4] = GetPWCComboSelectedPin("combo7"); + mpu_pins[5] = GetPWCComboSelectedPin("combo8"); } void cpart_MPU6050::PreProcess(void) { diff --git a/src/parts/input_MPU6050.h b/src/parts/input_MPU6050.h index 2c686426..58fa3ffb 100644 --- a/src/parts/input_MPU6050.h +++ b/src/parts/input_MPU6050.h @@ -45,8 +45,8 @@ class cpart_MPU6050 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_bmp180.cc b/src/parts/input_bmp180.cc index 0be259e7..abe91680 100644 --- a/src/parts/input_bmp180.cc +++ b/src/parts/input_bmp180.cc @@ -151,14 +151,14 @@ void cpart_bmp180::ReadPreferences(std::string value_) { Reset(); } -void cpart_bmp180::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); +void cpart_bmp180::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); } -void cpart_bmp180::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_bmp180::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); } void cpart_bmp180::PreProcess(void) { diff --git a/src/parts/input_bmp180.h b/src/parts/input_bmp180.h index 35cc54f4..29c00e8b 100644 --- a/src/parts/input_bmp180.h +++ b/src/parts/input_bmp180.h @@ -42,8 +42,8 @@ class cpart_bmp180 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_bmp280.cc b/src/parts/input_bmp280.cc index ce37a566..e5c2b379 100644 --- a/src/parts/input_bmp280.cc +++ b/src/parts/input_bmp280.cc @@ -165,18 +165,18 @@ void cpart_bmp280::ReadPreferences(std::string value_) { Reset(); } -void cpart_bmp280::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[0]); +void cpart_bmp280::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", input_pins[0]); + SetPCWComboWithPinNames("combo4", input_pins[1]); + SetPCWComboWithPinNames("combo5", input_pins[2]); + SetPCWComboWithPinNames("combo6", output_pins[0]); } -void cpart_bmp280::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo6"); +void cpart_bmp280::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo3"); + input_pins[1] = GetPWCComboSelectedPin("combo4"); + input_pins[2] = GetPWCComboSelectedPin("combo5"); + output_pins[0] = GetPWCComboSelectedPin("combo6"); } void cpart_bmp280::PreProcess(void) { diff --git a/src/parts/input_bmp280.h b/src/parts/input_bmp280.h index 54196534..49e47ba4 100644 --- a/src/parts/input_bmp280.h +++ b/src/parts/input_bmp280.h @@ -42,8 +42,8 @@ class cpart_bmp280 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_dht11.cc b/src/parts/input_dht11.cc index 576812b0..905af55b 100644 --- a/src/parts/input_dht11.cc +++ b/src/parts/input_dht11.cc @@ -249,12 +249,12 @@ void cpart_dht11::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%hhu", &output_pins[0], &values[0], &values[1]); } -void cpart_dht11::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_dht11::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); } -void cpart_dht11::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_dht11::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); } part_init(PART_DHT11_Name, cpart_dht11, "Input"); diff --git a/src/parts/input_dht11.h b/src/parts/input_dht11.h index 9a3f4cef..7c78f591 100644 --- a/src/parts/input_dht11.h +++ b/src/parts/input_dht11.h @@ -43,8 +43,8 @@ class cpart_dht11 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_dht22.cc b/src/parts/input_dht22.cc index 738b6f5e..9adda1f6 100644 --- a/src/parts/input_dht22.cc +++ b/src/parts/input_dht22.cc @@ -249,12 +249,12 @@ void cpart_dht22::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%hhu", &output_pins[0], &values[0], &values[1]); } -void cpart_dht22::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_dht22::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); } -void cpart_dht22::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_dht22::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); } part_init(PART_DHT22_Name, cpart_dht22, "Input"); diff --git a/src/parts/input_dht22.h b/src/parts/input_dht22.h index 81505875..5cbe4502 100644 --- a/src/parts/input_dht22.h +++ b/src/parts/input_dht22.h @@ -43,8 +43,8 @@ class cpart_dht22 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_ds1621.cc b/src/parts/input_ds1621.cc index 8d167365..af7256e7 100644 --- a/src/parts/input_ds1621.cc +++ b/src/parts/input_ds1621.cc @@ -164,22 +164,22 @@ void cpart_ds1621::ReadPreferences(std::string value_) { Reset(); } -void cpart_ds1621::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[5]); +void cpart_ds1621::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo5", input_pins[3]); + SetPCWComboWithPinNames("combo6", input_pins[4]); + SetPCWComboWithPinNames("combo7", input_pins[5]); } -void cpart_ds1621::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo7"); +void cpart_ds1621::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo5"); + input_pins[4] = GetPWCComboSelectedPin("combo6"); + input_pins[5] = GetPWCComboSelectedPin("combo7"); } void cpart_ds1621::PreProcess(void) { diff --git a/src/parts/input_ds1621.h b/src/parts/input_ds1621.h index 8171a853..21639f39 100644 --- a/src/parts/input_ds1621.h +++ b/src/parts/input_ds1621.h @@ -42,8 +42,8 @@ class cpart_ds1621 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_ds18b20.cc b/src/parts/input_ds18b20.cc index fd01582e..3d6d59e1 100644 --- a/src/parts/input_ds18b20.cc +++ b/src/parts/input_ds18b20.cc @@ -207,12 +207,12 @@ void cpart_ds18b20::ReadPreferences(std::string value_) { sen_ds18b20_set_addr(&ds18b20, addr); } -void cpart_ds18b20::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_ds18b20::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); } -void cpart_ds18b20::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_ds18b20::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); } part_init(PART_DS1820B_Name, cpart_ds18b20, "Input"); diff --git a/src/parts/input_ds18b20.h b/src/parts/input_ds18b20.h index 7240fc05..d49ccf7b 100644 --- a/src/parts/input_ds18b20.h +++ b/src/parts/input_ds18b20.h @@ -44,8 +44,8 @@ class cpart_ds18b20 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_encoder.cc b/src/parts/input_encoder.cc index 4bb30008..4f370f97 100644 --- a/src/parts/input_encoder.cc +++ b/src/parts/input_encoder.cc @@ -327,16 +327,16 @@ void cpart_encoder::ReadPreferences(std::string value) { value_old = this->value; } -void cpart_encoder::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[2]); +void cpart_encoder::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", output_pins[0]); + SetPCWComboWithPinNames("combo4", output_pins[1]); + SetPCWComboWithPinNames("combo5", output_pins[2]); } -void cpart_encoder::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_encoder::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo3"); + output_pins[1] = GetPWCComboSelectedPin("combo4"); + output_pins[2] = GetPWCComboSelectedPin("combo5"); } part_init(PART_ENCODER_Name, cpart_encoder, "Input"); diff --git a/src/parts/input_encoder.h b/src/parts/input_encoder.h index e3518bf5..43df56d3 100644 --- a/src/parts/input_encoder.h +++ b/src/parts/input_encoder.h @@ -42,8 +42,8 @@ class cpart_encoder : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_fixedv.cc b/src/parts/input_fixedv.cc index 067b5710..ed2f9d5a 100644 --- a/src/parts/input_fixedv.cc +++ b/src/parts/input_fixedv.cc @@ -141,19 +141,21 @@ void cpart_fixedv::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu", &output_pins[0], &value); } -void cpart_fixedv::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_fixedv::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); - CSpind* spind = (CSpind*)WProp->GetChildByName("spind4"); - spind->SetValue(value / 40.0); - spind->SetMax(5.0); - spind->SetMin(0.0); + SpareParts.WPropCmd("spind4", WPA_SPINDSETMAX, "5.0"); + SpareParts.WPropCmd("spind4", WPA_SPINDSETMIN, "0.0"); + SpareParts.WPropCmd("spind4", WPA_SPINDSETVALUE, std::to_string(value / 40.0).c_str()); } -void cpart_fixedv::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_fixedv::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); - value = ((CSpind*)WProp->GetChildByName("spind4"))->GetValue() * 40.0; + float valuef; + SpareParts.WPropCmd("spind4", WPA_SPINDGETVALUE, NULL, &valuef); + + value = valuef * 40.0; } part_init(PART_FIXEDV_Name, cpart_fixedv, "Input"); diff --git a/src/parts/input_fixedv.h b/src/parts/input_fixedv.h index 3c321343..6d2a50c7 100644 --- a/src/parts/input_fixedv.h +++ b/src/parts/input_fixedv.h @@ -37,8 +37,8 @@ class cpart_fixedv : public part { ~cpart_fixedv(void); void DrawOutput(const unsigned int index) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_fm50.cc b/src/parts/input_fm50.cc index 6f4102e7..bcdbd4c9 100644 --- a/src/parts/input_fm50.cc +++ b/src/parts/input_fm50.cc @@ -181,12 +181,12 @@ void cpart_fm50::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu", &output_pins[0], &value); } -void cpart_fm50::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_fm50::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); } -void cpart_fm50::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_fm50::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); } part_init(PART_FM50_Name, cpart_fm50, "Input"); diff --git a/src/parts/input_fm50.h b/src/parts/input_fm50.h index 506ba1ec..d175f88b 100644 --- a/src/parts/input_fm50.h +++ b/src/parts/input_fm50.h @@ -40,8 +40,8 @@ class cpart_fm50 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_gamepad.cc b/src/parts/input_gamepad.cc index bab8df71..79a475a2 100644 --- a/src/parts/input_gamepad.cc +++ b/src/parts/input_gamepad.cc @@ -499,26 +499,26 @@ void cpart_gamepad::ReadPreferences(std::string value) { &output_pins[3], &output_pins[4], &output_pins[5], &output_pins[6], &output_pins[7]); } -void cpart_gamepad::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", output_pins[7]); +void cpart_gamepad::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", output_pins[0]); + SetPCWComboWithPinNames("combo2", output_pins[1]); + SetPCWComboWithPinNames("combo3", output_pins[2]); + SetPCWComboWithPinNames("combo4", output_pins[3]); + SetPCWComboWithPinNames("combo5", output_pins[4]); + SetPCWComboWithPinNames("combo6", output_pins[5]); + SetPCWComboWithPinNames("combo7", output_pins[6]); + SetPCWComboWithPinNames("combo8", output_pins[7]); } -void cpart_gamepad::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_gamepad::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo1"); + output_pins[1] = GetPWCComboSelectedPin("combo2"); + output_pins[2] = GetPWCComboSelectedPin("combo3"); + output_pins[3] = GetPWCComboSelectedPin("combo4"); + output_pins[4] = GetPWCComboSelectedPin("combo5"); + output_pins[5] = GetPWCComboSelectedPin("combo6"); + output_pins[6] = GetPWCComboSelectedPin("combo7"); + output_pins[7] = GetPWCComboSelectedPin("combo8"); } part_init(PART_GAMEPAD_Name, cpart_gamepad, "Input"); diff --git a/src/parts/input_gamepad.h b/src/parts/input_gamepad.h index 43f64379..83f67a9f 100644 --- a/src/parts/input_gamepad.h +++ b/src/parts/input_gamepad.h @@ -44,8 +44,8 @@ class cpart_gamepad : public part { void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; void EvKeyPress(uint key, uint mask) override; void EvKeyRelease(uint key, uint mask) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_gamepad_an.cc b/src/parts/input_gamepad_an.cc index c3b44b6e..eadd9d5a 100644 --- a/src/parts/input_gamepad_an.cc +++ b/src/parts/input_gamepad_an.cc @@ -328,22 +328,22 @@ void cpart_gamepad_an::ReadPreferences(std::string value) { output_value_an = active * vmax; } -void cpart_gamepad_an::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", output_pins[0]); +void cpart_gamepad_an::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", output_pins[0]); - CCombo* combo = (CCombo*)WProp->GetChildByName("combo4"); - - combo->SetItems("HIGH,LOW,"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - combo->SetText("HIGH"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "HIGH"); else - combo->SetText("LOW "); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "LOW"); } -void cpart_gamepad_an::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); +void cpart_gamepad_an::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo1"); - active = (((CCombo*)WProp->GetChildByName("combo4"))->GetText().compare("HIGH") == 0); + char buff[64]; + SpareParts.WPropCmd("combo4", WPA_COMBOGETTEXT, NULL, buff); + active = (strcmp(buff, "HIGH") == 0); } part_init(PART_GAMEPAD_AN_Name, cpart_gamepad_an, "Input"); diff --git a/src/parts/input_gamepad_an.h b/src/parts/input_gamepad_an.h index f462f67e..cc850992 100644 --- a/src/parts/input_gamepad_an.h +++ b/src/parts/input_gamepad_an.h @@ -43,8 +43,8 @@ class cpart_gamepad_an : public part { void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void EvKeyPress(uint key, uint mask) override; void EvKeyRelease(uint key, uint mask) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_hcsr04.cc b/src/parts/input_hcsr04.cc index 93f4b6f8..36cc1cfd 100644 --- a/src/parts/input_hcsr04.cc +++ b/src/parts/input_hcsr04.cc @@ -217,14 +217,14 @@ void cpart_hcsr04::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%hhu", &pins[0], &pins[1], &value); } -void cpart_hcsr04::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", pins[1]); +void cpart_hcsr04::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", pins[0]); + SetPCWComboWithPinNames("combo3", pins[1]); } -void cpart_hcsr04::ReadPropertiesWindow(CPWindow* WProp) { - pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_hcsr04::ReadPropertiesWindow(void) { + pins[0] = GetPWCComboSelectedPin("combo2"); + pins[1] = GetPWCComboSelectedPin("combo3"); } part_init(PART_HCSR0404_Name, cpart_hcsr04, "Input"); diff --git a/src/parts/input_hcsr04.h b/src/parts/input_hcsr04.h index ebcaa121..4fd94ca5 100644 --- a/src/parts/input_hcsr04.h +++ b/src/parts/input_hcsr04.h @@ -40,8 +40,8 @@ class cpart_hcsr04 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_hx711.cc b/src/parts/input_hx711.cc index 99f64053..179c90a6 100644 --- a/src/parts/input_hx711.cc +++ b/src/parts/input_hx711.cc @@ -140,14 +140,14 @@ void cpart_hx711::ReadPreferences(std::string value_) { Reset(); } -void cpart_hx711::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", pins[1]); +void cpart_hx711::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", pins[0]); + SetPCWComboWithPinNames("combo3", pins[1]); } -void cpart_hx711::ReadPropertiesWindow(CPWindow* WProp) { - pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_hx711::ReadPropertiesWindow(void) { + pins[0] = GetPWCComboSelectedPin("combo2"); + pins[1] = GetPWCComboSelectedPin("combo3"); } void cpart_hx711::PreProcess(void) { diff --git a/src/parts/input_hx711.h b/src/parts/input_hx711.h index 83c80a27..3b69540f 100644 --- a/src/parts/input_hx711.h +++ b/src/parts/input_hx711.h @@ -43,8 +43,8 @@ class cpart_hx711 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_keypad.cc b/src/parts/input_keypad.cc index 1ae094c4..bbe155ad 100644 --- a/src/parts/input_keypad.cc +++ b/src/parts/input_keypad.cc @@ -623,82 +623,81 @@ void cpart_keypad::ReadPreferences(std::string value) { ChangeType(tp); } -void cpart_keypad::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", output_pins[7]); - - CCombo* combo = (CCombo*)WProp->GetChildByName("combo11"); - - combo->SetItems("UP,DOWN,"); +void cpart_keypad::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", output_pins[0]); + SetPCWComboWithPinNames("combo2", output_pins[1]); + SetPCWComboWithPinNames("combo3", output_pins[2]); + SetPCWComboWithPinNames("combo4", output_pins[3]); + SetPCWComboWithPinNames("combo5", output_pins[4]); + SetPCWComboWithPinNames("combo6", output_pins[5]); + SetPCWComboWithPinNames("combo7", output_pins[6]); + SetPCWComboWithPinNames("combo8", output_pins[7]); + + SpareParts.WPropCmd("combo11", WPA_COMBOSETITEMS, "UP,DOWN,"); if (!pull) - combo->SetText("UP"); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "UP"); else - combo->SetText("DOWN"); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "DOWN"); - ((CCombo*)WProp->GetChildByName("combo12"))->SetItems("4x4,4x3,2x5,"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETITEMS, "4x4,4x3,2x5,"); switch (type) { case KT4x4: - ((CLabel*)WProp->GetChildByName("label1"))->SetText("P1 - L1"); - ((CLabel*)WProp->GetChildByName("label2"))->SetText("P2 - L2"); - ((CLabel*)WProp->GetChildByName("label3"))->SetText("P3 - L3"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("P4 - L4"); - ((CLabel*)WProp->GetChildByName("label5"))->SetText("P5 - C1"); - ((CLabel*)WProp->GetChildByName("label6"))->SetText("P6 - C2"); - ((CLabel*)WProp->GetChildByName("label7"))->SetText("P7 - C3"); - ((CLabel*)WProp->GetChildByName("label8"))->SetText("P8 - C4"); - ((CCombo*)WProp->GetChildByName("combo8"))->SetEnable(true); - ((CCombo*)WProp->GetChildByName("combo12"))->SetText("4x4"); + SpareParts.WPropCmd("label1", WPA_LABELSETTEXT, "P1 - L1"); + SpareParts.WPropCmd("label2", WPA_LABELSETTEXT, "P2 - L2"); + SpareParts.WPropCmd("label3", WPA_LABELSETTEXT, "P3 - L3"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "P4 - L4"); + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "P5 - C1"); + SpareParts.WPropCmd("label6", WPA_LABELSETTEXT, "P6 - C2"); + SpareParts.WPropCmd("label7", WPA_LABELSETTEXT, "P7 - C3"); + SpareParts.WPropCmd("label8", WPA_LABELSETTEXT, "P8 - C4"); + SpareParts.WPropCmd("combo8", WPA_SETENABLE, "1"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "4x4"); break; case KT4x3: - ((CLabel*)WProp->GetChildByName("label1"))->SetText("P1 - L1"); - ((CLabel*)WProp->GetChildByName("label2"))->SetText("P2 - L2"); - ((CLabel*)WProp->GetChildByName("label3"))->SetText("P3 - L3"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("P4 - L4"); - ((CLabel*)WProp->GetChildByName("label5"))->SetText("P5 - C1"); - ((CLabel*)WProp->GetChildByName("label6"))->SetText("P6 - C2"); - ((CLabel*)WProp->GetChildByName("label7"))->SetText("P7 - C3"); - ((CLabel*)WProp->GetChildByName("label8"))->SetText("P8 - NC"); - ((CCombo*)WProp->GetChildByName("combo8"))->SetEnable(false); - ((CCombo*)WProp->GetChildByName("combo12"))->SetText("4x3"); + SpareParts.WPropCmd("label1", WPA_LABELSETTEXT, "P1 - L1"); + SpareParts.WPropCmd("label2", WPA_LABELSETTEXT, "P2 - L2"); + SpareParts.WPropCmd("label3", WPA_LABELSETTEXT, "P3 - L3"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "P4 - L4"); + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "P5 - C1"); + SpareParts.WPropCmd("label6", WPA_LABELSETTEXT, "P6 - C2"); + SpareParts.WPropCmd("label7", WPA_LABELSETTEXT, "P7 - C3"); + SpareParts.WPropCmd("label8", WPA_LABELSETTEXT, "P8 - NC"); + SpareParts.WPropCmd("combo8", WPA_SETENABLE, "0"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "4x3"); break; case KT2x5: - ((CLabel*)WProp->GetChildByName("label1"))->SetText("P1 - L1"); - ((CLabel*)WProp->GetChildByName("label2"))->SetText("P2 - L2"); - ((CLabel*)WProp->GetChildByName("label3"))->SetText("P3 - C1"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("P4 - C2"); - ((CLabel*)WProp->GetChildByName("label5"))->SetText("P5 - C3"); - ((CLabel*)WProp->GetChildByName("label6"))->SetText("P6 - C4"); - ((CLabel*)WProp->GetChildByName("label7"))->SetText("P7 - C5"); - ((CLabel*)WProp->GetChildByName("label8"))->SetText("P8 - NC"); - ((CCombo*)WProp->GetChildByName("combo8"))->SetEnable(false); - ((CCombo*)WProp->GetChildByName("combo12"))->SetText("2x5"); + SpareParts.WPropCmd("label1", WPA_LABELSETTEXT, "P1 - L1"); + SpareParts.WPropCmd("label2", WPA_LABELSETTEXT, "P2 - L2"); + SpareParts.WPropCmd("label3", WPA_LABELSETTEXT, "P3 - C1"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "P4 - C2"); + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "P5 - C3"); + SpareParts.WPropCmd("label6", WPA_LABELSETTEXT, "P6 - C4"); + SpareParts.WPropCmd("label7", WPA_LABELSETTEXT, "P7 - C5"); + SpareParts.WPropCmd("label8", WPA_LABELSETTEXT, "P8 - NC"); + SpareParts.WPropCmd("combo8", WPA_SETENABLE, "0"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "2x5"); break; } - - ((CCombo*)WProp->GetChildByName("combo12"))->EvOnComboChange = SpareParts.PropComboChange; } -void cpart_keypad::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_keypad::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo1"); + output_pins[1] = GetPWCComboSelectedPin("combo2"); + output_pins[2] = GetPWCComboSelectedPin("combo3"); + output_pins[3] = GetPWCComboSelectedPin("combo4"); + output_pins[4] = GetPWCComboSelectedPin("combo5"); + output_pins[5] = GetPWCComboSelectedPin("combo6"); + output_pins[6] = GetPWCComboSelectedPin("combo7"); + output_pins[7] = GetPWCComboSelectedPin("combo8"); + + char buff[64]; + SpareParts.WPropCmd("combo11", WPA_COMBOGETTEXT, NULL, buff); - pull = !(((CCombo*)WProp->GetChildByName("combo11"))->GetText().compare("UP") == 0); + pull = !(strcmp(buff, "UP") == 0); - std::string tps = (const char*)((CCombo*)WProp->GetChildByName("combo12"))->GetText().c_str(); + SpareParts.WPropCmd("combo12", WPA_COMBOGETTEXT, NULL, buff); - ComboChange(WProp, (CCombo*)WProp->GetChildByName("combo12"), tps); + ComboChange(NULL, NULL, buff); memset(keys, 0, 16); memset(keys2, 0, 10); diff --git a/src/parts/input_keypad.h b/src/parts/input_keypad.h index 5c2ec3e7..2ca5b943 100644 --- a/src/parts/input_keypad.h +++ b/src/parts/input_keypad.h @@ -41,8 +41,8 @@ class cpart_keypad : public part { std::string GetMapFile(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_lm35.cc b/src/parts/input_lm35.cc index 27dabb59..9ba90619 100644 --- a/src/parts/input_lm35.cc +++ b/src/parts/input_lm35.cc @@ -181,12 +181,12 @@ void cpart_lm35::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu", &output_pins[0], &value); } -void cpart_lm35::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_lm35::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); } -void cpart_lm35::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_lm35::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); } part_init(PART_LM35_Name, cpart_lm35, "Input"); diff --git a/src/parts/input_lm35.h b/src/parts/input_lm35.h index 0b7ea434..c3c95a5b 100644 --- a/src/parts/input_lm35.h +++ b/src/parts/input_lm35.h @@ -40,8 +40,8 @@ class cpart_lm35 : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_ntc.cc b/src/parts/input_ntc.cc index 1857526d..56c2e746 100644 --- a/src/parts/input_ntc.cc +++ b/src/parts/input_ntc.cc @@ -196,17 +196,17 @@ void cpart_ntc::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%i", &output_pins[0], &value, &Beta); } -void cpart_ntc::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_ntc::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); - ((CSpin*)WProp->GetChildByName("spin4"))->SetMin(2500); - ((CSpin*)WProp->GetChildByName("spin4"))->SetMax(5000); - ((CSpin*)WProp->GetChildByName("spin4"))->SetValue(Beta); + SpareParts.WPropCmd("spin4", WPA_SPINSETMAX, "5000"); + SpareParts.WPropCmd("spin4", WPA_SPINSETMIN, "2500"); + SpareParts.WPropCmd("spin4", WPA_SPINSETVALUE, std::to_string(Beta).c_str()); } -void cpart_ntc::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - Beta = ((CSpin*)WProp->GetChildByName("spin4"))->GetValue(); +void cpart_ntc::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + SpareParts.WPropCmd("spin4", WPA_SPINGETVALUE, NULL, &Beta); } part_init(PART_NTC_Name, cpart_ntc, "Input"); diff --git a/src/parts/input_ntc.h b/src/parts/input_ntc.h index 92d42ea0..c224520d 100644 --- a/src/parts/input_ntc.h +++ b/src/parts/input_ntc.h @@ -40,8 +40,8 @@ class cpart_ntc : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void Reset(void) override; diff --git a/src/parts/input_pot.cc b/src/parts/input_pot.cc index 9f479448..65ff99a1 100644 --- a/src/parts/input_pot.cc +++ b/src/parts/input_pot.cc @@ -258,32 +258,35 @@ void cpart_pot::ReadPreferences(std::string value) { ChangeSize(sz); } -void cpart_pot::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[3]); - ((CSpin*)WProp->GetChildByName("spin7"))->SetMax(4); - ((CSpin*)WProp->GetChildByName("spin7"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin7"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin7"))->EvOnChangeSpin = SpareParts.PropSpinChange; - SpinChange(WProp, NULL, Size); +void cpart_pot::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); + SetPCWComboWithPinNames("combo4", output_pins[2]); + SetPCWComboWithPinNames("combo5", output_pins[3]); + + SpareParts.WPropCmd("spin7", WPA_SPINSETMAX, "4"); + SpareParts.WPropCmd("spin7", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin7", WPA_SPINSETVALUE, std::to_string(Size).c_str()); + + SpinChange(NULL, NULL, Size); } -void cpart_pot::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_pot::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); + output_pins[2] = GetPWCComboSelectedPin("combo4"); + output_pins[3] = GetPWCComboSelectedPin("combo5"); - ChangeSize(((CSpin*)WProp->GetChildByName("spin7"))->GetValue()); + int size; + SpareParts.WPropCmd("spin7", WPA_SPINGETVALUE, NULL, &size); + ChangeSize(size); } void cpart_pot::SpinChange(CPWindow* WProp, CSpin* control, int value) { for (int i = 0; i < 4; i++) { char name[20]; sprintf(name, "combo%i", i + 2); - ((CCombo*)WProp->GetChildByName(name))->SetEnable(i < value); + SpareParts.WPropCmd(name, WPA_SETENABLE, std::to_string(i < value).c_str()); } } diff --git a/src/parts/input_pot.h b/src/parts/input_pot.h index 33377f80..54785196 100644 --- a/src/parts/input_pot.h +++ b/src/parts/input_pot.h @@ -40,8 +40,8 @@ class cpart_pot : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; void LoadPartImage(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/input_pot_r.cc b/src/parts/input_pot_r.cc index 01723ff5..c1012f4d 100644 --- a/src/parts/input_pot_r.cc +++ b/src/parts/input_pot_r.cc @@ -284,32 +284,35 @@ void cpart_pot_r::ReadPreferences(std::string value) { ChangeSize(sz); } -void cpart_pot_r::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[3]); - ((CSpin*)WProp->GetChildByName("spin7"))->SetMax(4); - ((CSpin*)WProp->GetChildByName("spin7"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin7"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin7"))->EvOnChangeSpin = SpareParts.PropSpinChange; - SpinChange(WProp, NULL, Size); +void cpart_pot_r::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); + SetPCWComboWithPinNames("combo4", output_pins[2]); + SetPCWComboWithPinNames("combo5", output_pins[3]); + + SpareParts.WPropCmd("spin7", WPA_SPINSETMAX, "4"); + SpareParts.WPropCmd("spin7", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin7", WPA_SPINSETVALUE, std::to_string(Size).c_str()); + + SpinChange(NULL, NULL, Size); } -void cpart_pot_r::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_pot_r::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); + output_pins[2] = GetPWCComboSelectedPin("combo4"); + output_pins[3] = GetPWCComboSelectedPin("combo5"); - ChangeSize(((CSpin*)WProp->GetChildByName("spin7"))->GetValue()); + int size; + SpareParts.WPropCmd("spin7", WPA_SPINGETVALUE, NULL, &size); + ChangeSize(size); } void cpart_pot_r::SpinChange(CPWindow* WProp, CSpin* control, int value) { for (int i = 0; i < 4; i++) { char name[20]; sprintf(name, "combo%i", i + 2); - ((CCombo*)WProp->GetChildByName(name))->SetEnable(i < value); + SpareParts.WPropCmd(name, WPA_SETENABLE, std::to_string(i < value).c_str()); } } diff --git a/src/parts/input_pot_r.h b/src/parts/input_pot_r.h index f09558f2..7fcc7d13 100644 --- a/src/parts/input_pot_r.h +++ b/src/parts/input_pot_r.h @@ -40,8 +40,8 @@ class cpart_pot_r : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; void LoadPartImage(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/input_push_buttons.cc b/src/parts/input_push_buttons.cc index 2c098d8c..d55488fe 100644 --- a/src/parts/input_push_buttons.cc +++ b/src/parts/input_push_buttons.cc @@ -392,53 +392,56 @@ void cpart_pbuttons::ReadPreferences(std::string value) { ChangeSize(sz); } -void cpart_pbuttons::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[3]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo7", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo8", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo9", output_pins[7]); - - CCombo* combo = (CCombo*)WProp->GetChildByName("combo11"); - - combo->SetItems("HIGH,LOW,"); +void cpart_pbuttons::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); + SetPCWComboWithPinNames("combo4", output_pins[2]); + SetPCWComboWithPinNames("combo5", output_pins[3]); + SetPCWComboWithPinNames("combo6", output_pins[4]); + SetPCWComboWithPinNames("combo7", output_pins[5]); + SetPCWComboWithPinNames("combo8", output_pins[6]); + SetPCWComboWithPinNames("combo9", output_pins[7]); + + SpareParts.WPropCmd("combo11", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - combo->SetText("HIGH"); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "HIGH"); else - combo->SetText("LOW "); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "LOW "); - combo = (CCombo*)WProp->GetChildByName("combo12"); - combo->SetItems("Ideal,Normal,"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETITEMS, "Ideal,Normal,"); if (mode) - combo->SetText("Ideal"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "Ideal"); else - combo->SetText("Normal"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "Normal"); - ((CSpin*)WProp->GetChildByName("spin13"))->SetMax(8); - ((CSpin*)WProp->GetChildByName("spin13"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin13"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin13"))->EvOnChangeSpin = SpareParts.PropSpinChange; - SpinChange(WProp, NULL, Size); + SpareParts.WPropCmd("spin13", WPA_SPINSETMAX, "8"); + SpareParts.WPropCmd("spin13", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin13", WPA_SPINSETVALUE, std::to_string(Size).c_str()); + + SpinChange(NULL, NULL, Size); } -void cpart_pbuttons::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo6"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo7"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo8"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo9"); +void cpart_pbuttons::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); + output_pins[2] = GetPWCComboSelectedPin("combo4"); + output_pins[3] = GetPWCComboSelectedPin("combo5"); + output_pins[4] = GetPWCComboSelectedPin("combo6"); + output_pins[5] = GetPWCComboSelectedPin("combo7"); + output_pins[6] = GetPWCComboSelectedPin("combo8"); + output_pins[7] = GetPWCComboSelectedPin("combo9"); + + char buff[64]; + SpareParts.WPropCmd("combo11", WPA_COMBOGETTEXT, NULL, buff); + active = (strcmp(buff, "HIGH") == 0); - active = (((CCombo*)WProp->GetChildByName("combo11"))->GetText().compare("HIGH") == 0); + SpareParts.WPropCmd("combo12", WPA_COMBOGETTEXT, NULL, buff); - mode = (((CCombo*)WProp->GetChildByName("combo12"))->GetText().compare("Ideal") == 0); + mode = (strcmp(buff, "Ideal") == 0); - ChangeSize(((CSpin*)WProp->GetChildByName("spin13"))->GetValue()); + int size; + SpareParts.WPropCmd("spin13", WPA_SPINGETVALUE, NULL, &size); + ChangeSize(size); output_value[0] = !active; output_value[1] = !active; @@ -454,7 +457,7 @@ void cpart_pbuttons::SpinChange(CPWindow* WProp, CSpin* control, int value) { for (int i = 0; i < 8; i++) { char name[20]; sprintf(name, "combo%i", i + 2); - ((CCombo*)WProp->GetChildByName(name))->SetEnable(i < value); + SpareParts.WPropCmd(name, WPA_SETENABLE, std::to_string(i < value).c_str()); } } diff --git a/src/parts/input_push_buttons.h b/src/parts/input_push_buttons.h index 7d57169a..a9adb4b3 100644 --- a/src/parts/input_push_buttons.h +++ b/src/parts/input_push_buttons.h @@ -43,8 +43,8 @@ class cpart_pbuttons : public part { void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; void LoadPartImage(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/input_push_buttons_an.cc b/src/parts/input_push_buttons_an.cc index 87115bdc..ffe31e3c 100644 --- a/src/parts/input_push_buttons_an.cc +++ b/src/parts/input_push_buttons_an.cc @@ -356,22 +356,22 @@ void cpart_pbuttons_an::ReadPreferences(std::string value) { output_value_[7] = !active; } -void cpart_pbuttons_an::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); +void cpart_pbuttons_an::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); - CCombo* combo = (CCombo*)WProp->GetChildByName("combo4"); - - combo->SetItems("HIGH,LOW,"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - combo->SetText("HIGH"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "HIGH"); else - combo->SetText("LOW "); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "LOW "); } -void cpart_pbuttons_an::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); +void cpart_pbuttons_an::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); - active = (((CCombo*)WProp->GetChildByName("combo4"))->GetText().compare("HIGH") == 0); + char buff[64]; + SpareParts.WPropCmd("combo4", WPA_COMBOGETTEXT, NULL, buff); + active = (strcmp(buff, "HIGH") == 0); output_value = active * vmax; diff --git a/src/parts/input_push_buttons_an.h b/src/parts/input_push_buttons_an.h index ab33b18d..12b89b37 100644 --- a/src/parts/input_push_buttons_an.h +++ b/src/parts/input_push_buttons_an.h @@ -43,8 +43,8 @@ class cpart_pbuttons_an : public part { void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_sht3x.cc b/src/parts/input_sht3x.cc index 4dcd17c9..266bbb6a 100644 --- a/src/parts/input_sht3x.cc +++ b/src/parts/input_sht3x.cc @@ -224,18 +224,17 @@ void cpart_sht3x::ReadPreferences(std::string value_) { sscanf(value_.c_str(), "%hhu,%hhu,%hhu,%hhu", &output_pins[0], &output_pins[1], &values[0], &values[1]); } -void cpart_sht3x::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); +void cpart_sht3x::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); - CCombo* combo = (CCombo*)WProp->GetChildByName("combo5"); - combo->SetItems("Analog,"); - combo->SetText("Analog"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETITEMS, "Analog,"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, "Analog"); } -void cpart_sht3x::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_sht3x::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); } part_init(PART_SHT3X_Name, cpart_sht3x, "Input"); diff --git a/src/parts/input_sht3x.h b/src/parts/input_sht3x.h index c60b0f6e..e80ca55c 100644 --- a/src/parts/input_sht3x.h +++ b/src/parts/input_sht3x.h @@ -40,8 +40,8 @@ class cpart_sht3x : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/input_switches.cc b/src/parts/input_switches.cc index b011add1..6602f856 100644 --- a/src/parts/input_switches.cc +++ b/src/parts/input_switches.cc @@ -382,59 +382,63 @@ void cpart_switches::ReadPreferences(std::string value) { ChangeSize(sz); } -void cpart_switches::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[3]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo7", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo8", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo9", output_pins[7]); - - CCombo* combo = (CCombo*)WProp->GetChildByName("combo11"); - combo->SetItems("Up,Down,"); +void cpart_switches::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", output_pins[0]); + SetPCWComboWithPinNames("combo3", output_pins[1]); + SetPCWComboWithPinNames("combo4", output_pins[2]); + SetPCWComboWithPinNames("combo5", output_pins[3]); + SetPCWComboWithPinNames("combo6", output_pins[4]); + SetPCWComboWithPinNames("combo7", output_pins[5]); + SetPCWComboWithPinNames("combo8", output_pins[6]); + SetPCWComboWithPinNames("combo9", output_pins[7]); + + SpareParts.WPropCmd("combo11", WPA_COMBOSETITEMS, "Up,Down,"); if (active) - combo->SetText("Up"); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "Up"); else - combo->SetText("Down"); + SpareParts.WPropCmd("combo11", WPA_COMBOSETTEXT, "Down"); - combo = (CCombo*)WProp->GetChildByName("combo12"); - combo->SetItems("Ideal,Normal,"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETITEMS, "Ideal,Normal,"); if (mode) - combo->SetText("Ideal"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "Ideal"); else - combo->SetText("Normal"); + SpareParts.WPropCmd("combo12", WPA_COMBOSETTEXT, "Normal"); - ((CSpin*)WProp->GetChildByName("spin13"))->SetMax(8); - ((CSpin*)WProp->GetChildByName("spin13"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin13"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin13"))->EvOnChangeSpin = SpareParts.PropSpinChange; - SpinChange(WProp, NULL, Size); + SpareParts.WPropCmd("spin13", WPA_SPINSETMAX, "8"); + SpareParts.WPropCmd("spin13", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin13", WPA_SPINSETVALUE, std::to_string(Size).c_str()); + + SpinChange(NULL, NULL, Size); } -void cpart_switches::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo6"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo7"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo8"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo9"); +void cpart_switches::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo2"); + output_pins[1] = GetPWCComboSelectedPin("combo3"); + output_pins[2] = GetPWCComboSelectedPin("combo4"); + output_pins[3] = GetPWCComboSelectedPin("combo5"); + output_pins[4] = GetPWCComboSelectedPin("combo6"); + output_pins[5] = GetPWCComboSelectedPin("combo7"); + output_pins[6] = GetPWCComboSelectedPin("combo8"); + output_pins[7] = GetPWCComboSelectedPin("combo9"); + + char buff[64]; + SpareParts.WPropCmd("combo11", WPA_COMBOGETTEXT, NULL, buff); + active = (strcmp(buff, "Up") == 0); - active = (((CCombo*)WProp->GetChildByName("combo11"))->GetText().compare("Up") == 0); + SpareParts.WPropCmd("combo12", WPA_COMBOGETTEXT, NULL, buff); - mode = (((CCombo*)WProp->GetChildByName("combo12"))->GetText().compare("Ideal") == 0); + mode = (strcmp(buff, "Ideal") == 0); - ChangeSize(((CSpin*)WProp->GetChildByName("spin13"))->GetValue()); + int size; + SpareParts.WPropCmd("spin13", WPA_SPINGETVALUE, NULL, &size); + ChangeSize(size); } void cpart_switches::SpinChange(CPWindow* WProp, CSpin* control, int value) { for (int i = 0; i < 8; i++) { char name[20]; sprintf(name, "combo%i", i + 2); - ((CCombo*)WProp->GetChildByName(name))->SetEnable(i < value); + SpareParts.WPropCmd(name, WPA_SETENABLE, std::to_string(i < value).c_str()); } } diff --git a/src/parts/input_switches.h b/src/parts/input_switches.h index ffc35369..7d8aa2b5 100644 --- a/src/parts/input_switches.h +++ b/src/parts/input_switches.h @@ -42,8 +42,8 @@ class cpart_switches : public part { void Process(void) override; void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; void LoadPartImage(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/other_ETH_w5500.cc b/src/parts/other_ETH_w5500.cc index f06c927b..d43052b3 100644 --- a/src/parts/other_ETH_w5500.cc +++ b/src/parts/other_ETH_w5500.cc @@ -328,22 +328,22 @@ void cpart_ETH_w5500::RegisterRemoteControl(void) { output_ids[O_STAT]->status = (void*)ðw; } -void cpart_ETH_w5500::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", pins[4]); - SetPCWComboWithPinNames(WProp, "combo5", pins[0]); - SetPCWComboWithPinNames(WProp, "combo6", pins[1]); - SetPCWComboWithPinNames(WProp, "combo7", pins[2]); - SetPCWComboWithPinNames(WProp, "combo8", pins[5]); - SetPCWComboWithPinNames(WProp, "combo9", pins[3]); +void cpart_ETH_w5500::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", pins[4]); + SetPCWComboWithPinNames("combo5", pins[0]); + SetPCWComboWithPinNames("combo6", pins[1]); + SetPCWComboWithPinNames("combo7", pins[2]); + SetPCWComboWithPinNames("combo8", pins[5]); + SetPCWComboWithPinNames("combo9", pins[3]); } -void cpart_ETH_w5500::ReadPropertiesWindow(CPWindow* WProp) { - pins[4] = GetPWCComboSelectedPin(WProp, "combo3"); - pins[0] = GetPWCComboSelectedPin(WProp, "combo5"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo6"); - pins[2] = GetPWCComboSelectedPin(WProp, "combo7"); - pins[5] = GetPWCComboSelectedPin(WProp, "combo8"); - pins[3] = GetPWCComboSelectedPin(WProp, "combo9"); +void cpart_ETH_w5500::ReadPropertiesWindow(void) { + pins[4] = GetPWCComboSelectedPin("combo3"); + pins[0] = GetPWCComboSelectedPin("combo5"); + pins[1] = GetPWCComboSelectedPin("combo6"); + pins[2] = GetPWCComboSelectedPin("combo7"); + pins[5] = GetPWCComboSelectedPin("combo8"); + pins[3] = GetPWCComboSelectedPin("combo9"); } void cpart_ETH_w5500::PreProcess(void) { diff --git a/src/parts/other_ETH_w5500.h b/src/parts/other_ETH_w5500.h index 50996cd1..176b825a 100644 --- a/src/parts/other_ETH_w5500.h +++ b/src/parts/other_ETH_w5500.h @@ -43,8 +43,8 @@ class cpart_ETH_w5500 : public part { void PostProcess(void) override; void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_IO_74xx573.cc b/src/parts/other_IO_74xx573.cc index 0db6151d..22b05b5e 100644 --- a/src/parts/other_IO_74xx573.cc +++ b/src/parts/other_IO_74xx573.cc @@ -247,7 +247,7 @@ void cpart_IO_74xx573::ReadPreferences(std::string value) { Reset(); } -void cpart_IO_74xx573::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_IO_74xx573::ConfigurePropertiesWindow(void) { std::string spin; for (int i = 0; i < 20; i++) { @@ -264,35 +264,32 @@ void cpart_IO_74xx573::ConfigurePropertiesWindow(CPWindow* WProp) { std::to_string(output_pins[pinv - 9]); // + " " + SpareParts.GetPinName (output_pins[pinv - 4]); } - ((CLabel*)WProp->GetChildByName("label" + std::to_string(i + 1))) - ->SetText(std::to_string(i + 1) + "-" + pin_names[i]); - CLabel* label = (CLabel*)WProp->GetChildByName("label_" + std::to_string(i + 1)); - if (label) { - label->SetText(value); - } + SpareParts.WPropCmd(("label" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, + (std::to_string(i + 1) + "-" + pin_names[i]).c_str()); + SpareParts.WPropCmd(("label_" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, value.c_str()); } - SetPCWComboWithPinNames(WProp, "combo2", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo9", input_pins[7]); - SetPCWComboWithPinNames(WProp, "combo11", input_pins[8]); + SetPCWComboWithPinNames("combo2", input_pins[0]); + SetPCWComboWithPinNames("combo3", input_pins[1]); + SetPCWComboWithPinNames("combo4", input_pins[2]); + SetPCWComboWithPinNames("combo5", input_pins[3]); + SetPCWComboWithPinNames("combo6", input_pins[4]); + SetPCWComboWithPinNames("combo7", input_pins[5]); + SetPCWComboWithPinNames("combo8", input_pins[6]); + SetPCWComboWithPinNames("combo9", input_pins[7]); + SetPCWComboWithPinNames("combo11", input_pins[8]); } -void cpart_IO_74xx573::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo8"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo9"); - input_pins[8] = GetPWCComboSelectedPin(WProp, "combo11"); +void cpart_IO_74xx573::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo2"); + input_pins[1] = GetPWCComboSelectedPin("combo3"); + input_pins[2] = GetPWCComboSelectedPin("combo4"); + input_pins[3] = GetPWCComboSelectedPin("combo5"); + input_pins[4] = GetPWCComboSelectedPin("combo6"); + input_pins[5] = GetPWCComboSelectedPin("combo7"); + input_pins[6] = GetPWCComboSelectedPin("combo8"); + input_pins[7] = GetPWCComboSelectedPin("combo9"); + input_pins[8] = GetPWCComboSelectedPin("combo11"); } void cpart_IO_74xx573::PreProcess(void) { diff --git a/src/parts/other_IO_74xx573.h b/src/parts/other_IO_74xx573.h index 480cf8cc..771b101b 100644 --- a/src/parts/other_IO_74xx573.h +++ b/src/parts/other_IO_74xx573.h @@ -43,8 +43,8 @@ class cpart_IO_74xx573 : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override { return "../Common/IC20.svg"; }; std::string GetMapFile(void) override { return "../Common/IC20.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_IO_74xx595.cc b/src/parts/other_IO_74xx595.cc index dbc0cd41..ddc11558 100644 --- a/src/parts/other_IO_74xx595.cc +++ b/src/parts/other_IO_74xx595.cc @@ -220,7 +220,7 @@ void cpart_IO_74xx595::ReadPreferences(std::string value) { Reset(); } -void cpart_IO_74xx595::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_IO_74xx595::ConfigurePropertiesWindow(void) { std::string Items = SpareParts.GetPinsNames(); std::string spin; @@ -238,25 +238,22 @@ void cpart_IO_74xx595::ConfigurePropertiesWindow(CPWindow* WProp) { std::to_string(output_pins[pinv - 4]); // + " " + SpareParts.GetPinName (output_pins[pinv - 4]); } - ((CLabel*)WProp->GetChildByName("label" + std::to_string(i + 1))) - ->SetText(std::to_string(i + 1) + "-" + pin_names[i]); - CLabel* label = (CLabel*)WProp->GetChildByName("label_" + std::to_string(i + 1)); - if (label) { - label->SetText(value); - } + SpareParts.WPropCmd(("label" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, + (std::to_string(i + 1) + "-" + pin_names[i]).c_str()); + SpareParts.WPropCmd(("label_" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, value.c_str()); } - SetPCWComboWithPinNames(WProp, "combo10", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo11", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo12", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo14", input_pins[3]); + SetPCWComboWithPinNames("combo10", input_pins[0]); + SetPCWComboWithPinNames("combo11", input_pins[1]); + SetPCWComboWithPinNames("combo12", input_pins[2]); + SetPCWComboWithPinNames("combo14", input_pins[3]); } -void cpart_IO_74xx595::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo10"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo11"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo12"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo14"); +void cpart_IO_74xx595::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo10"); + input_pins[1] = GetPWCComboSelectedPin("combo11"); + input_pins[2] = GetPWCComboSelectedPin("combo12"); + input_pins[3] = GetPWCComboSelectedPin("combo14"); } void cpart_IO_74xx595::PreProcess(void) { diff --git a/src/parts/other_IO_74xx595.h b/src/parts/other_IO_74xx595.h index 84bc641e..3ca9b81b 100644 --- a/src/parts/other_IO_74xx595.h +++ b/src/parts/other_IO_74xx595.h @@ -43,8 +43,8 @@ class cpart_IO_74xx595 : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override { return "../Common/IC16.svg"; }; std::string GetMapFile(void) override { return "../Common/IC16.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_IO_MCP23S17.cc b/src/parts/other_IO_MCP23S17.cc index 3c723322..e751bf10 100644 --- a/src/parts/other_IO_MCP23S17.cc +++ b/src/parts/other_IO_MCP23S17.cc @@ -315,7 +315,7 @@ void cpart_IO_MCP23S17::ReadPreferences(std::string value) { Reset(); } -void cpart_IO_MCP23S17::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_IO_MCP23S17::ConfigurePropertiesWindow(void) { std::string spin; for (int i = 0; i < 28; i++) { @@ -331,38 +331,35 @@ void cpart_IO_MCP23S17::ConfigurePropertiesWindow(CPWindow* WProp) { value = std::to_string(output_pins[pinv - 10]); } - ((CLabel*)WProp->GetChildByName("label" + std::to_string(i + 1))) - ->SetText(std::to_string(i + 1) + "-" + pin_names[i]); + SpareParts.WPropCmd(("label" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, + (std::to_string(i + 1) + "-" + pin_names[i]).c_str()); - CLabel* label = (CLabel*)WProp->GetChildByName("label_" + std::to_string(i + 1)); - if (label) { - label->SetText(value); - } + SpareParts.WPropCmd(("label_" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, value.c_str()); } - SetPCWComboWithPinNames(WProp, "combo11", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo12", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo13", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo14", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo15", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo16", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo17", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo18", input_pins[7]); - SetPCWComboWithPinNames(WProp, "combo19", input_pins[8]); - SetPCWComboWithPinNames(WProp, "combo20", input_pins[9]); + SetPCWComboWithPinNames("combo11", input_pins[0]); + SetPCWComboWithPinNames("combo12", input_pins[1]); + SetPCWComboWithPinNames("combo13", input_pins[2]); + SetPCWComboWithPinNames("combo14", input_pins[3]); + SetPCWComboWithPinNames("combo15", input_pins[4]); + SetPCWComboWithPinNames("combo16", input_pins[5]); + SetPCWComboWithPinNames("combo17", input_pins[6]); + SetPCWComboWithPinNames("combo18", input_pins[7]); + SetPCWComboWithPinNames("combo19", input_pins[8]); + SetPCWComboWithPinNames("combo20", input_pins[9]); } -void cpart_IO_MCP23S17::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo11"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo12"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo13"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo14"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo15"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo16"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo17"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo18"); - input_pins[8] = GetPWCComboSelectedPin(WProp, "combo19"); - input_pins[9] = GetPWCComboSelectedPin(WProp, "combo20"); +void cpart_IO_MCP23S17::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo11"); + input_pins[1] = GetPWCComboSelectedPin("combo12"); + input_pins[2] = GetPWCComboSelectedPin("combo13"); + input_pins[3] = GetPWCComboSelectedPin("combo14"); + input_pins[4] = GetPWCComboSelectedPin("combo15"); + input_pins[5] = GetPWCComboSelectedPin("combo16"); + input_pins[6] = GetPWCComboSelectedPin("combo17"); + input_pins[7] = GetPWCComboSelectedPin("combo18"); + input_pins[8] = GetPWCComboSelectedPin("combo19"); + input_pins[9] = GetPWCComboSelectedPin("combo20"); } void cpart_IO_MCP23S17::PreProcess(void) { diff --git a/src/parts/other_IO_MCP23S17.h b/src/parts/other_IO_MCP23S17.h index e761991e..20ce499d 100644 --- a/src/parts/other_IO_MCP23S17.h +++ b/src/parts/other_IO_MCP23S17.h @@ -43,8 +43,8 @@ class cpart_IO_MCP23S17 : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override { return "../Common/IC28.svg"; }; std::string GetMapFile(void) override { return "../Common/IC28.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_IO_MM74C922.cc b/src/parts/other_IO_MM74C922.cc index 9d5d00f4..5c4abc21 100644 --- a/src/parts/other_IO_MM74C922.cc +++ b/src/parts/other_IO_MM74C922.cc @@ -274,7 +274,7 @@ void cpart_IO_MM74C922::ReadPreferences(std::string value) { Reset(); } -void cpart_IO_MM74C922::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_IO_MM74C922::ConfigurePropertiesWindow(void) { std::string spin; for (int i = 0; i < 18; i++) { @@ -297,28 +297,25 @@ void cpart_IO_MM74C922::ConfigurePropertiesWindow(CPWindow* WProp) { // (output_pins[pinv - 4]); } - ((CLabel*)WProp->GetChildByName("label" + std::to_string(i + 1))) - ->SetText(std::to_string(i + 1) + "-" + pin_names[i]); + SpareParts.WPropCmd(("label" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, + (std::to_string(i + 1) + "-" + pin_names[i]).c_str()); - CLabel* label = (CLabel*)WProp->GetChildByName("label_" + std::to_string(i + 1)); - if (label) { - label->SetText(value); - } + SpareParts.WPropCmd(("label_" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, value.c_str()); } - SetPCWComboWithPinNames(WProp, "combo12", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo14", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo15", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo16", output_pins[7]); - SetPCWComboWithPinNames(WProp, "combo17", output_pins[8]); + SetPCWComboWithPinNames("combo12", output_pins[4]); + SetPCWComboWithPinNames("combo14", output_pins[5]); + SetPCWComboWithPinNames("combo15", output_pins[6]); + SetPCWComboWithPinNames("combo16", output_pins[7]); + SetPCWComboWithPinNames("combo17", output_pins[8]); } -void cpart_IO_MM74C922::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo12"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo14"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo15"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo16"); - output_pins[8] = GetPWCComboSelectedPin(WProp, "combo17"); +void cpart_IO_MM74C922::ReadPropertiesWindow(void) { + output_pins[4] = GetPWCComboSelectedPin("combo12"); + output_pins[5] = GetPWCComboSelectedPin("combo14"); + output_pins[6] = GetPWCComboSelectedPin("combo15"); + output_pins[7] = GetPWCComboSelectedPin("combo16"); + output_pins[8] = GetPWCComboSelectedPin("combo17"); } void cpart_IO_MM74C922::PreProcess(void) { diff --git a/src/parts/other_IO_MM74C922.h b/src/parts/other_IO_MM74C922.h index 00f8d198..34188dbb 100644 --- a/src/parts/other_IO_MM74C922.h +++ b/src/parts/other_IO_MM74C922.h @@ -43,8 +43,8 @@ class cpart_IO_MM74C922 : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override { return "../Common/IC18.svg"; }; std::string GetMapFile(void) override { return "../Common/IC18.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_IO_PCF8574.cc b/src/parts/other_IO_PCF8574.cc index 8361c763..a87aa54e 100644 --- a/src/parts/other_IO_PCF8574.cc +++ b/src/parts/other_IO_PCF8574.cc @@ -230,7 +230,7 @@ void cpart_IO_PCF8574::ReadPreferences(std::string value) { Reset(); } -void cpart_IO_PCF8574::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_IO_PCF8574::ConfigurePropertiesWindow(void) { std::string spin; for (int i = 0; i < 16; i++) { @@ -246,28 +246,25 @@ void cpart_IO_PCF8574::ConfigurePropertiesWindow(CPWindow* WProp) { value = std::to_string(output_pins[pinv - 5]); //+ " " + SpareParts.GetPinName (output_pins[pinv - 5]); } - ((CLabel*)WProp->GetChildByName("label" + std::to_string(i + 1))) - ->SetText(std::to_string(i + 1) + "-" + pin_names[i]); + SpareParts.WPropCmd(("label" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, + (std::to_string(i + 1) + "-" + pin_names[i]).c_str()); - CLabel* label = (CLabel*)WProp->GetChildByName("label_" + std::to_string(i + 1)); - if (label) { - label->SetText(value); - } + SpareParts.WPropCmd(("label_" + std::to_string(i + 1)).c_str(), WPA_LABELSETTEXT, value.c_str()); } - SetPCWComboWithPinNames(WProp, "combo1", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo14", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo15", input_pins[1]); + SetPCWComboWithPinNames("combo1", input_pins[2]); + SetPCWComboWithPinNames("combo2", input_pins[3]); + SetPCWComboWithPinNames("combo3", input_pins[4]); + SetPCWComboWithPinNames("combo14", input_pins[0]); + SetPCWComboWithPinNames("combo15", input_pins[1]); } -void cpart_IO_PCF8574::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo14"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo15"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_IO_PCF8574::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo14"); + input_pins[1] = GetPWCComboSelectedPin("combo15"); + input_pins[2] = GetPWCComboSelectedPin("combo1"); + input_pins[3] = GetPWCComboSelectedPin("combo2"); + input_pins[4] = GetPWCComboSelectedPin("combo3"); } void cpart_IO_PCF8574::PreProcess(void) { diff --git a/src/parts/other_IO_PCF8574.h b/src/parts/other_IO_PCF8574.h index 4e60a89b..bf3e1604 100644 --- a/src/parts/other_IO_PCF8574.h +++ b/src/parts/other_IO_PCF8574.h @@ -43,8 +43,8 @@ class cpart_IO_PCF8574 : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override { return "../Common/IC16.svg"; }; std::string GetMapFile(void) override { return "../Common/IC16.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_MI2C_24CXXX.cc b/src/parts/other_MI2C_24CXXX.cc index 87e5e185..5bf9c63f 100644 --- a/src/parts/other_MI2C_24CXXX.cc +++ b/src/parts/other_MI2C_24CXXX.cc @@ -204,26 +204,28 @@ void cpart_MI2C_24CXXX::ReadPreferences(std::string value) { Reset(); } -void cpart_MI2C_24CXXX::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[4]); - - CCombo* combo = (CCombo*)WProp->GetChildByName("combo9"); - combo->SetItems("4,512,"); - combo->SetText(std::to_string(kbits)); +void cpart_MI2C_24CXXX::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo5", input_pins[3]); + SetPCWComboWithPinNames("combo6", input_pins[4]); + + SpareParts.WPropCmd("combo9", WPA_COMBOSETITEMS, "4,512,"); + SpareParts.WPropCmd("combo9", WPA_COMBOSETTEXT, std::to_string(kbits).c_str()); } -void cpart_MI2C_24CXXX::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo6"); +void cpart_MI2C_24CXXX::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo5"); + input_pins[4] = GetPWCComboSelectedPin("combo6"); - int nkbits = atoi(((CCombo*)WProp->GetChildByName("combo9"))->GetText()); + char buff[64]; + SpareParts.WPropCmd("combo9", WPA_COMBOGETTEXT, NULL, buff); + + int nkbits = std::stoi(buff); if (nkbits != kbits) { kbits = nkbits; diff --git a/src/parts/other_MI2C_24CXXX.h b/src/parts/other_MI2C_24CXXX.h index 34555fd8..cfa94449 100644 --- a/src/parts/other_MI2C_24CXXX.h +++ b/src/parts/other_MI2C_24CXXX.h @@ -42,9 +42,9 @@ class cpart_MI2C_24CXXX : public part { void PreProcess(void) override; void Process(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; void filedialog_EvOnClose(int retId) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_RTC_ds1307.cc b/src/parts/other_RTC_ds1307.cc index d5ed6d1f..f52ecbe8 100644 --- a/src/parts/other_RTC_ds1307.cc +++ b/src/parts/other_RTC_ds1307.cc @@ -138,16 +138,16 @@ void cpart_RTC_ds1307::ReadPreferences(std::string value) { Reset(); } -void cpart_RTC_ds1307::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo5", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[2]); +void cpart_RTC_ds1307::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo5", input_pins[0]); + SetPCWComboWithPinNames("combo6", input_pins[1]); + SetPCWComboWithPinNames("combo7", input_pins[2]); } -void cpart_RTC_ds1307::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo7"); +void cpart_RTC_ds1307::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo5"); + input_pins[1] = GetPWCComboSelectedPin("combo6"); + input_pins[2] = GetPWCComboSelectedPin("combo7"); } void cpart_RTC_ds1307::PreProcess(void) { diff --git a/src/parts/other_RTC_ds1307.h b/src/parts/other_RTC_ds1307.h index 0df3f7f8..780c8275 100644 --- a/src/parts/other_RTC_ds1307.h +++ b/src/parts/other_RTC_ds1307.h @@ -42,8 +42,8 @@ class cpart_RTC_ds1307 : public part { void Process(void) override; std::string GetPictureFileName(void) override { return "../Common/IC8.svg"; }; std::string GetMapFile(void) override { return "../Common/IC8.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_RTC_pfc8563.cc b/src/parts/other_RTC_pfc8563.cc index bd4af43a..3fb21c57 100644 --- a/src/parts/other_RTC_pfc8563.cc +++ b/src/parts/other_RTC_pfc8563.cc @@ -140,18 +140,18 @@ void cpart_RTC_pfc8563::ReadPreferences(std::string value) { Reset(); } -void cpart_RTC_pfc8563::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[3]); +void cpart_RTC_pfc8563::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", input_pins[0]); + SetPCWComboWithPinNames("combo5", input_pins[1]); + SetPCWComboWithPinNames("combo6", input_pins[2]); + SetPCWComboWithPinNames("combo7", input_pins[3]); } -void cpart_RTC_pfc8563::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo7"); +void cpart_RTC_pfc8563::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo3"); + input_pins[1] = GetPWCComboSelectedPin("combo5"); + input_pins[2] = GetPWCComboSelectedPin("combo6"); + input_pins[3] = GetPWCComboSelectedPin("combo7"); } void cpart_RTC_pfc8563::PreProcess(void) { diff --git a/src/parts/other_RTC_pfc8563.h b/src/parts/other_RTC_pfc8563.h index 626662d7..e6c83464 100644 --- a/src/parts/other_RTC_pfc8563.h +++ b/src/parts/other_RTC_pfc8563.h @@ -42,8 +42,8 @@ class cpart_RTC_pfc8563 : public part { void Process(void) override; std::string GetPictureFileName(void) override { return "../Common/IC8.svg"; }; std::string GetMapFile(void) override { return "../Common/IC8.map"; }; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_TempSys.cc b/src/parts/other_TempSys.cc index 1276d79e..4e884284 100644 --- a/src/parts/other_TempSys.cc +++ b/src/parts/other_TempSys.cc @@ -271,38 +271,40 @@ void cpart_tempsys::ReadPreferences(std::string value) { temp[1] = ambient; } -void cpart_tempsys::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - - ((CCombo*)WProp->GetChildByName("combo7"))->SetItems("0V,1.2V,"); - - if (tvoff == 0) - ((CCombo*)WProp->GetChildByName("combo7"))->SetText("0V"); - else { - ((CCombo*)WProp->GetChildByName("combo7"))->SetText("1.2V"); +void cpart_tempsys::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + + SpareParts.WPropCmd("combo7", WPA_COMBOSETITEMS, "0V,1.2V,"); + + if (tvoff == 0) { + SpareParts.WPropCmd("combo7", WPA_COMBOSETTEXT, "0V"); + } else { + SpareParts.WPropCmd("combo7", WPA_COMBOSETTEXT, "1.2V"); } - ((CSpind*)WProp->GetChildByName("spind8"))->SetMax(150); - ((CSpind*)WProp->GetChildByName("spind8"))->SetMin(-55); - ((CSpind*)WProp->GetChildByName("spind8"))->SetValue(ambient); + SpareParts.WPropCmd("spind8", WPA_SPINDSETMAX, "150"); + SpareParts.WPropCmd("spind8", WPA_SPINDSETMIN, "-55"); + SpareParts.WPropCmd("spind8", WPA_SPINDSETVALUE, std::to_string(ambient).c_str()); } -void cpart_tempsys::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); +void cpart_tempsys::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); - if ((((CCombo*)WProp->GetChildByName("combo7"))->GetText().compare("0V")) == 0) { + char buff[64]; + SpareParts.WPropCmd("combo7", WPA_COMBOGETTEXT, NULL, buff); + if (strcmp(buff, "0V") == 0) { tvoff = 0; } else { tvoff = 1.2; } - ambient = ((CSpind*)WProp->GetChildByName("spind8"))->GetValue(); + SpareParts.WPropCmd("spind8", WPA_SPINDGETVALUE, NULL, &ambient); temp[0] = ambient; temp[1] = ambient; } diff --git a/src/parts/other_TempSys.h b/src/parts/other_TempSys.h index 5e9cc985..6f1d3b63 100644 --- a/src/parts/other_TempSys.h +++ b/src/parts/other_TempSys.h @@ -38,8 +38,8 @@ class cpart_tempsys : public part { ~cpart_tempsys(void); void DrawOutput(const unsigned int index) override; void Process(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_jumpers.cc b/src/parts/other_jumpers.cc index 2fe5f70d..d74fef6b 100644 --- a/src/parts/other_jumpers.cc +++ b/src/parts/other_jumpers.cc @@ -438,68 +438,60 @@ void cpart_Jumpers::RegisterRemoteControl(void) { } } -void cpart_Jumpers::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_Jumpers::ConfigurePropertiesWindow(void) { char childname[256]; - CCombo* cc; - ((CCombo*)WProp->GetChildByName("combo1"))->SetItems("F,M,"); - ((CCombo*)WProp->GetChildByName("combo1"))->EvOnComboChange = SpareParts.PropComboChange; - ((CCombo*)WProp->GetChildByName("combo18"))->SetItems("F,M,"); - ((CCombo*)WProp->GetChildByName("combo18"))->EvOnComboChange = SpareParts.PropComboChange; + SpareParts.WPropCmd("combo1", WPA_COMBOSETITEMS, "F,M,"); + SpareParts.WPropCmd("combo18", WPA_COMBOSETITEMS, "F,M,"); - cc = ((CCombo*)WProp->GetChildByName("combo1")); if (jtype & 0x02) - cc->SetText("F"); + SpareParts.WPropCmd("combo1", WPA_COMBOSETTEXT, "F"); else - cc->SetText("M"); + SpareParts.WPropCmd("combo1", WPA_COMBOSETTEXT, "M"); - cc = ((CCombo*)WProp->GetChildByName("combo18")); if (jtype & 0x01) - cc->SetText("F"); + SpareParts.WPropCmd("combo18", WPA_COMBOSETTEXT, "F"); else - cc->SetText("M"); + SpareParts.WPropCmd("combo18", WPA_COMBOSETTEXT, "M"); for (int i = 0; i < 16; i++) { // input snprintf(childname, 256, "combo%i", i + 2); - SetPCWComboWithPinNames(WProp, childname, input_pins[i]); - - cc = (CCombo*)WProp->GetChildByName(childname); + SetPCWComboWithPinNames(childname, input_pins[i]); if (jtype & 0x02) { - cc->SetEnable(1); + SpareParts.WPropCmd(childname, WPA_SETENABLE, "1"); } else { - cc->SetEnable(0); + SpareParts.WPropCmd(childname, WPA_SETENABLE, "0"); } // output snprintf(childname, 256, "combo%i", i + 19); - SetPCWComboWithPinNames(WProp, childname, output_pins[i]); - - cc = (CCombo*)WProp->GetChildByName(childname); + SetPCWComboWithPinNames(childname, output_pins[i]); if (jtype & 0x01) { - cc->SetEnable(1); + SpareParts.WPropCmd(childname, WPA_SETENABLE, "1"); } else { - cc->SetEnable(0); + SpareParts.WPropCmd(childname, WPA_SETENABLE, "0"); } } } -void cpart_Jumpers::ReadPropertiesWindow(CPWindow* WProp) { +void cpart_Jumpers::ReadPropertiesWindow(void) { char childname[256]; - CCombo* cc; - cc = ((CCombo*)WProp->GetChildByName("combo1")); - if (cc->GetText().compare("M")) + char buff[64]; + SpareParts.WPropCmd("combo1", WPA_COMBOGETTEXT, NULL, buff); + + if (strcmp(buff, "M")) jtype |= 0x02; else jtype &= ~0x02; - cc = ((CCombo*)WProp->GetChildByName("combo18")); - if (cc->GetText().compare("M")) + SpareParts.WPropCmd("combo18", WPA_COMBOGETTEXT, NULL, buff); + if (strcmp(buff, "M")) jtype |= 0x01; else jtype &= ~0x01; @@ -508,12 +500,12 @@ void cpart_Jumpers::ReadPropertiesWindow(CPWindow* WProp) { // input if (jtype & 0x02) { snprintf(childname, 256, "combo%i", i + 2); - input_pins[i] = GetPWCComboSelectedPin(WProp, childname); + input_pins[i] = GetPWCComboSelectedPin(childname); } // output if (jtype & 0x01) { snprintf(childname, 256, "combo%i", i + 19); - output_pins[i] = GetPWCComboSelectedPin(WProp, childname); + output_pins[i] = GetPWCComboSelectedPin(childname); } } } diff --git a/src/parts/other_jumpers.h b/src/parts/other_jumpers.h index aeb63f97..bb0732d5 100644 --- a/src/parts/other_jumpers.h +++ b/src/parts/other_jumpers.h @@ -43,8 +43,8 @@ class cpart_Jumpers : public part { void PreProcess(void) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/other_sdcard.cc b/src/parts/other_sdcard.cc index 7a0f5366..6aaf193f 100644 --- a/src/parts/other_sdcard.cc +++ b/src/parts/other_sdcard.cc @@ -197,18 +197,18 @@ void cpart_SDCard::ReadPreferences(std::string value) { } } -void cpart_SDCard::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", pins[3]); - SetPCWComboWithPinNames(WProp, "combo4", pins[0]); - SetPCWComboWithPinNames(WProp, "combo5", pins[1]); - SetPCWComboWithPinNames(WProp, "combo6", pins[2]); +void cpart_SDCard::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", pins[3]); + SetPCWComboWithPinNames("combo4", pins[0]); + SetPCWComboWithPinNames("combo5", pins[1]); + SetPCWComboWithPinNames("combo6", pins[2]); } -void cpart_SDCard::ReadPropertiesWindow(CPWindow* WProp) { - pins[3] = GetPWCComboSelectedPin(WProp, "combo3"); - pins[0] = GetPWCComboSelectedPin(WProp, "combo4"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo5"); - pins[2] = GetPWCComboSelectedPin(WProp, "combo6"); +void cpart_SDCard::ReadPropertiesWindow(void) { + pins[3] = GetPWCComboSelectedPin("combo3"); + pins[0] = GetPWCComboSelectedPin("combo4"); + pins[1] = GetPWCComboSelectedPin("combo5"); + pins[2] = GetPWCComboSelectedPin("combo6"); } void cpart_SDCard::Process(void) { diff --git a/src/parts/other_sdcard.h b/src/parts/other_sdcard.h index 75b71239..8ff0bd8d 100644 --- a/src/parts/other_sdcard.h +++ b/src/parts/other_sdcard.h @@ -40,8 +40,8 @@ class cpart_SDCard : public part { void Process(void) override; void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void filedialog_EvOnClose(int retId) override; diff --git a/src/parts/other_uart.cc b/src/parts/other_uart.cc index 5c616069..28c41055 100644 --- a/src/parts/other_uart.cc +++ b/src/parts/other_uart.cc @@ -186,30 +186,35 @@ void cpart_UART::ReadPreferences(std::string value) { } } -void cpart_UART::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", pins[1]); +void cpart_UART::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", pins[0]); + SetPCWComboWithPinNames("combo3", pins[1]); char* resp = serial_port_list(); if (resp) { - ((CCombo*)WProp->GetChildByName("combo5"))->SetItems(resp); + SpareParts.WPropCmd("combo5", WPA_COMBOSETITEMS, resp); free(resp); } if (uart_name[0] == '*') - ((CCombo*)WProp->GetChildByName("combo5"))->SetText(" "); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, " "); else { - ((CCombo*)WProp->GetChildByName("combo5"))->SetText(uart_name); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, uart_name); } - ((CCombo*)WProp->GetChildByName("combo6"))->SetItems("1200,2400,4800,9600,19200,38400,57600,115200,"); - ((CCombo*)WProp->GetChildByName("combo6"))->SetText(std::to_string(uart_speed)); + SpareParts.WPropCmd("combo6", WPA_COMBOSETITEMS, "1200,2400,4800,9600,19200,38400,57600,115200,"); + SpareParts.WPropCmd("combo6", WPA_COMBOSETTEXT, std::to_string(uart_speed).c_str()); } -void cpart_UART::ReadPropertiesWindow(CPWindow* WProp) { - pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - strncpy(uart_name, (((CCombo*)WProp->GetChildByName("combo5"))->GetText()).c_str(), 199); - uart_speed = atoi(((CCombo*)WProp->GetChildByName("combo6"))->GetText()); +void cpart_UART::ReadPropertiesWindow(void) { + pins[0] = GetPWCComboSelectedPin("combo2"); + pins[1] = GetPWCComboSelectedPin("combo3"); + + char buff[200]; + SpareParts.WPropCmd("combo5", WPA_COMBOGETTEXT, NULL, buff); + strncpy(uart_name, buff, 199); + + SpareParts.WPropCmd("combo6", WPA_COMBOGETTEXT, NULL, buff); + uart_speed = std::stoi(buff); uart_set_port(&sr, uart_name, uart_speed); } diff --git a/src/parts/other_uart.h b/src/parts/other_uart.h index 4a6eaa85..9e8e15a8 100644 --- a/src/parts/other_uart.h +++ b/src/parts/other_uart.h @@ -41,8 +41,8 @@ class cpart_UART : public part { void Process(void) override; void PostProcess(void) override; void Reset(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_7s_Display.cc b/src/parts/output_7s_Display.cc index 9af12a56..ea730325 100644 --- a/src/parts/output_7s_Display.cc +++ b/src/parts/output_7s_Display.cc @@ -559,65 +559,67 @@ void cpart_7s_display::RegisterRemoteControl(void) { output_ids[O_P4]->status = (void*)&lm4[7]; } -void cpart_7s_display::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[7]); - SetPCWComboWithPinNames(WProp, "combo9", input_pins[8]); - SetPCWComboWithPinNames(WProp, "combo10", input_pins[9]); - SetPCWComboWithPinNames(WProp, "combo11", input_pins[10]); - SetPCWComboWithPinNames(WProp, "combo12", input_pins[11]); - - ((CCombo*)WProp->GetChildByName("combo13"))->SetItems("HIGH,LOW,"); +void cpart_7s_display::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); + SetPCWComboWithPinNames("combo6", input_pins[5]); + SetPCWComboWithPinNames("combo7", input_pins[6]); + SetPCWComboWithPinNames("combo8", input_pins[7]); + SetPCWComboWithPinNames("combo9", input_pins[8]); + SetPCWComboWithPinNames("combo10", input_pins[9]); + SetPCWComboWithPinNames("combo11", input_pins[10]); + SetPCWComboWithPinNames("combo12", input_pins[11]); + + SpareParts.WPropCmd("combo13", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - ((CCombo*)WProp->GetChildByName("combo13"))->SetText("HIGH"); + SpareParts.WPropCmd("combo13", WPA_COMBOSETTEXT, "HIGH"); else - ((CCombo*)WProp->GetChildByName("combo13"))->SetText("LOW "); + SpareParts.WPropCmd("combo13", WPA_COMBOSETTEXT, "LOW "); - ((CCombo*)WProp->GetChildByName("combo14"))->SetItems("4 Mux.,Single,"); + SpareParts.WPropCmd("combo14", WPA_COMBOSETITEMS, "4 Mux.,Single,"); if (dtype == 0) - ((CCombo*)WProp->GetChildByName("combo14"))->SetText("4 Mux."); + SpareParts.WPropCmd("combo14", WPA_COMBOSETTEXT, "4 Mux."); else { - ((CCombo*)WProp->GetChildByName("combo14"))->SetText("Single"); + SpareParts.WPropCmd("combo14", WPA_COMBOSETTEXT, "Single"); } if (dtype == 0) { - ((CCombo*)WProp->GetChildByName("combo9"))->SetEnable(1); - ((CCombo*)WProp->GetChildByName("combo10"))->SetEnable(1); - ((CCombo*)WProp->GetChildByName("combo11"))->SetEnable(1); - ((CCombo*)WProp->GetChildByName("combo12"))->SetEnable(1); + SpareParts.WPropCmd("combo9", WPA_SETENABLE, "1"); + SpareParts.WPropCmd("combo10", WPA_SETENABLE, "1"); + SpareParts.WPropCmd("combo11", WPA_SETENABLE, " 1"); + SpareParts.WPropCmd("combo12", WPA_SETENABLE, " 1"); } else { - ((CCombo*)WProp->GetChildByName("combo9"))->SetEnable(0); - ((CCombo*)WProp->GetChildByName("combo10"))->SetEnable(0); - ((CCombo*)WProp->GetChildByName("combo11"))->SetEnable(0); - ((CCombo*)WProp->GetChildByName("combo12"))->SetEnable(0); + SpareParts.WPropCmd("combo9", WPA_SETENABLE, "0"); + SpareParts.WPropCmd("combo10", WPA_SETENABLE, "0"); + SpareParts.WPropCmd("combo11", WPA_SETENABLE, "0"); + SpareParts.WPropCmd("combo12", WPA_SETENABLE, "0"); } - - ((CCombo*)WProp->GetChildByName("combo14"))->EvOnComboChange = SpareParts.PropComboChange; } -void cpart_7s_display::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); - input_pins[8] = GetPWCComboSelectedPin(WProp, "combo9"); - input_pins[9] = GetPWCComboSelectedPin(WProp, "combo10"); - input_pins[10] = GetPWCComboSelectedPin(WProp, "combo11"); - input_pins[11] = GetPWCComboSelectedPin(WProp, "combo12"); - - active = (((CCombo*)WProp->GetChildByName("combo13"))->GetText().compare("HIGH") == 0); - - unsigned char dtype_ = (((CCombo*)WProp->GetChildByName("combo14"))->GetText().compare("4 Mux.")) != 0; +void cpart_7s_display::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); + input_pins[5] = GetPWCComboSelectedPin("combo6"); + input_pins[6] = GetPWCComboSelectedPin("combo7"); + input_pins[7] = GetPWCComboSelectedPin("combo8"); + input_pins[8] = GetPWCComboSelectedPin("combo9"); + input_pins[9] = GetPWCComboSelectedPin("combo10"); + input_pins[10] = GetPWCComboSelectedPin("combo11"); + input_pins[11] = GetPWCComboSelectedPin("combo12"); + + char buff[64]; + SpareParts.WPropCmd("combo13", WPA_COMBOGETTEXT, NULL, buff); + active = (strcmp(buff, "HIGH") == 0); + + SpareParts.WPropCmd("combo14", WPA_COMBOGETTEXT, NULL, buff); + + unsigned char dtype_ = (strcmp(buff, "4 Mux.")) != 0; ChangeType(dtype_); } diff --git a/src/parts/output_7s_Display.h b/src/parts/output_7s_Display.h index 90634831..0b302da7 100644 --- a/src/parts/output_7s_Display.h +++ b/src/parts/output_7s_Display.h @@ -42,8 +42,8 @@ class cpart_7s_display : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override; std::string GetMapFile(void) override; - void ConfigurePropertiesWindow(CPWindow* wprop) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_7s_Display_Dec.cc b/src/parts/output_7s_Display_Dec.cc index 67e8e1d7..f0cba6ab 100644 --- a/src/parts/output_7s_Display_Dec.cc +++ b/src/parts/output_7s_Display_Dec.cc @@ -544,36 +544,39 @@ void cpart_7s_display_dec::RegisterRemoteControl(void) { output_ids[O_P4]->status = (void*)&lm4[7]; } -void cpart_7s_display_dec::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[7]); - - ((CCombo*)WProp->GetChildByName("combo9"))->SetItems("MUX,LATCH,"); +void cpart_7s_display_dec::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); + SetPCWComboWithPinNames("combo6", input_pins[5]); + SetPCWComboWithPinNames("combo7", input_pins[6]); + SetPCWComboWithPinNames("combo8", input_pins[7]); + + SpareParts.WPropCmd("combo9", WPA_COMBOSETITEMS, "MUX,LATCH,"); if (dtype == 0) - ((CCombo*)WProp->GetChildByName("combo9"))->SetText("MUX"); + SpareParts.WPropCmd("combo9", WPA_COMBOSETTEXT, "MUX"); else { - ((CCombo*)WProp->GetChildByName("combo9"))->SetText("LATCH"); + SpareParts.WPropCmd("combo9", WPA_COMBOSETTEXT, "LATCH"); } } -void cpart_7s_display_dec::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); - - unsigned char type_ = (((CCombo*)WProp->GetChildByName("combo9"))->GetText().compare("MUX")) != 0; +void cpart_7s_display_dec::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); + input_pins[5] = GetPWCComboSelectedPin("combo6"); + input_pins[6] = GetPWCComboSelectedPin("combo7"); + input_pins[7] = GetPWCComboSelectedPin("combo8"); + + char buff[64]; + SpareParts.WPropCmd("combo9", WPA_COMBOGETTEXT, NULL, buff); + + unsigned char type_ = strcmp(buff, "MUX") != 0; ChangeType(type_); } diff --git a/src/parts/output_7s_Display_Dec.h b/src/parts/output_7s_Display_Dec.h index db7150c2..0434f471 100644 --- a/src/parts/output_7s_Display_Dec.h +++ b/src/parts/output_7s_Display_Dec.h @@ -42,8 +42,8 @@ class cpart_7s_display_dec : public part { void PostProcess(void) override; std::string GetPictureFileName(void) override; std::string GetMapFile(void) override; - void ConfigurePropertiesWindow(CPWindow* wprop) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_Buzzer.cc b/src/parts/output_Buzzer.cc index 86cc9eb7..46812258 100644 --- a/src/parts/output_Buzzer.cc +++ b/src/parts/output_Buzzer.cc @@ -175,32 +175,35 @@ void cpart_Buzzer::RegisterRemoteControl(void) { output_ids[O_L1]->status = (void*)&ppins[input_pins[0] - 1].oavalue; } -void cpart_Buzzer::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); +void cpart_Buzzer::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); - ((CCombo*)WProp->GetChildByName("combo3"))->SetItems("Active,Passive,Tone,"); + SpareParts.WPropCmd("combo3", WPA_COMBOSETITEMS, "Active,Passive,Tone,"); if (btype == ACTIVE) - ((CCombo*)WProp->GetChildByName("combo3"))->SetText("Active"); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, "Active"); else if (btype == PASSIVE) { - ((CCombo*)WProp->GetChildByName("combo3"))->SetText("Passive"); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, "Passive"); } else // TONE { - ((CCombo*)WProp->GetChildByName("combo3"))->SetText("Tone"); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, "Tone"); } - ((CCombo*)WProp->GetChildByName("combo4"))->SetItems("HIGH,LOW,"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - ((CCombo*)WProp->GetChildByName("combo4"))->SetText("HIGH"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "HIGH"); else - ((CCombo*)WProp->GetChildByName("combo4"))->SetText("LOW "); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "LOW "); } -void cpart_Buzzer::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); +void cpart_Buzzer::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); unsigned char tp = 0; - std::string mode = (const char*)((CCombo*)WProp->GetChildByName("combo3"))->GetText().c_str(); + char buff[64]; + SpareParts.WPropCmd("combo3", WPA_COMBOGETTEXT, NULL, buff); + + std::string mode = buff; if (mode.compare("Active") == 0) { tp = ACTIVE; } else if (mode.compare("Passive") == 0) { @@ -209,7 +212,9 @@ void cpart_Buzzer::ReadPropertiesWindow(CPWindow* WProp) { tp = TONE; } - active = (((CCombo*)WProp->GetChildByName("combo4"))->GetText().compare("HIGH") == 0); + SpareParts.WPropCmd("combo4", WPA_COMBOGETTEXT, NULL, buff); + + active = (strcmp(buff, "HIGH") == 0); ChangeType(tp); } diff --git a/src/parts/output_Buzzer.h b/src/parts/output_Buzzer.h index 3f617cf6..94712ec3 100644 --- a/src/parts/output_Buzzer.h +++ b/src/parts/output_Buzzer.h @@ -40,8 +40,8 @@ class cpart_Buzzer : public part { void Process(void) override; void PostProcess(void) override; void Stop(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_LCD_hd44780.cc b/src/parts/output_LCD_hd44780.cc index 276643fe..623f7011 100644 --- a/src/parts/output_LCD_hd44780.cc +++ b/src/parts/output_LCD_hd44780.cc @@ -236,55 +236,58 @@ void cpart_LCD_hd44780::RegisterRemoteControl(void) { output_ids[O_LCD]->status = (void*)&lcd; } -void cpart_LCD_hd44780::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo4", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo9", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo10", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo11", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo12", input_pins[7]); - SetPCWComboWithPinNames(WProp, "combo13", input_pins[8]); - SetPCWComboWithPinNames(WProp, "combo14", input_pins[9]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[10]); - - ((CCombo*)WProp->GetChildByName("combo15"))->SetItems("16x2,16x4,20x2,20x4,"); +void cpart_LCD_hd44780::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo4", input_pins[0]); + SetPCWComboWithPinNames("combo6", input_pins[1]); + SetPCWComboWithPinNames("combo7", input_pins[2]); + SetPCWComboWithPinNames("combo8", input_pins[3]); + SetPCWComboWithPinNames("combo9", input_pins[4]); + SetPCWComboWithPinNames("combo10", input_pins[5]); + SetPCWComboWithPinNames("combo11", input_pins[6]); + SetPCWComboWithPinNames("combo12", input_pins[7]); + SetPCWComboWithPinNames("combo13", input_pins[8]); + SetPCWComboWithPinNames("combo14", input_pins[9]); + SetPCWComboWithPinNames("combo5", input_pins[10]); + + SpareParts.WPropCmd("combo15", WPA_COMBOSETITEMS, "16x2,16x4,20x2,20x4,"); switch (model) { case LCD16x2: - ((CCombo*)WProp->GetChildByName("combo15"))->SetText("16x2"); + SpareParts.WPropCmd("combo15", WPA_COMBOSETTEXT, "16x2"); break; case LCD16x4: - ((CCombo*)WProp->GetChildByName("combo15"))->SetText("16x4"); + SpareParts.WPropCmd("combo15", WPA_COMBOSETTEXT, "16x4"); break; case LCD20x2: - ((CCombo*)WProp->GetChildByName("combo15"))->SetText("20x2"); + SpareParts.WPropCmd("combo15", WPA_COMBOSETTEXT, "20x2"); break; case LCD20x4: - ((CCombo*)WProp->GetChildByName("combo15"))->SetText("20x4"); + SpareParts.WPropCmd("combo15", WPA_COMBOSETTEXT, "20x4"); break; } } -void cpart_LCD_hd44780::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo8"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo9"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo10"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo11"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo12"); - input_pins[8] = GetPWCComboSelectedPin(WProp, "combo13"); - input_pins[9] = GetPWCComboSelectedPin(WProp, "combo14"); - input_pins[10] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_LCD_hd44780::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo4"); + input_pins[1] = GetPWCComboSelectedPin("combo6"); + input_pins[2] = GetPWCComboSelectedPin("combo7"); + input_pins[3] = GetPWCComboSelectedPin("combo8"); + input_pins[4] = GetPWCComboSelectedPin("combo9"); + input_pins[5] = GetPWCComboSelectedPin("combo10"); + input_pins[6] = GetPWCComboSelectedPin("combo11"); + input_pins[7] = GetPWCComboSelectedPin("combo12"); + input_pins[8] = GetPWCComboSelectedPin("combo13"); + input_pins[9] = GetPWCComboSelectedPin("combo14"); + input_pins[10] = GetPWCComboSelectedPin("combo5"); + + char buff[64]; + SpareParts.WPropCmd("combo15", WPA_COMBOGETTEXT, NULL, buff); model = LCD16x2; - if (!((((CCombo*)WProp->GetChildByName("combo15"))->GetText()).compare("16x4"))) + if (!strcmp(buff, "16x4")) model = LCD16x4; - else if (!((((CCombo*)WProp->GetChildByName("combo15"))->GetText()).compare("20x2"))) + else if (!strcmp(buff, "20x2")) model = LCD20x2; - else if (!((((CCombo*)WProp->GetChildByName("combo15"))->GetText()).compare("20x4"))) + else if (!strcmp(buff, "20x4")) model = LCD20x4; Reset(); diff --git a/src/parts/output_LCD_hd44780.h b/src/parts/output_LCD_hd44780.h index e53c6105..d415ec6e 100644 --- a/src/parts/output_LCD_hd44780.h +++ b/src/parts/output_LCD_hd44780.h @@ -50,8 +50,8 @@ class cpart_LCD_hd44780 : public part { std::string GetPictureFileName__(void) { return "LCD hd44780/LCD_hd44780__.svg"; }; std::string GetPictureFileName___(void) { return "LCD hd44780/LCD_hd44780___.svg"; }; void Reset(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void LoadPartImage(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/output_LCD_ili9341.cc b/src/parts/output_LCD_ili9341.cc index 21d2ba86..6de32029 100644 --- a/src/parts/output_LCD_ili9341.cc +++ b/src/parts/output_LCD_ili9341.cc @@ -302,309 +302,327 @@ void cpart_LCD_ili9341::ReadPreferences(std::string value) { ChangeType(tp); } -void cpart_LCD_ili9341::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_LCD_ili9341::ConfigurePropertiesWindow(void) { std::string Items = SpareParts.GetPinsNames(); std::string spin; char name[100]; - ((CCombo*)WProp->GetChildByName("combo1"))->SetItems(Items); + SpareParts.WPropCmd("combo1", WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[0] == 0) - ((CCombo*)WProp->GetChildByName("combo1"))->SetText("0 NC"); + SpareParts.WPropCmd("combo1", WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[0]); - ((CCombo*)WProp->GetChildByName("combo1"))->SetText(std::to_string(input_pins[0]) + " " + spin); + SpareParts.WPropCmd("combo1", WPA_COMBOSETTEXT, (std::to_string(input_pins[0]) + " " + spin).c_str()); } - ((CCombo*)WProp->GetChildByName("combo2"))->SetItems(Items); + SpareParts.WPropCmd("combo2", WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[1] == 0) - ((CCombo*)WProp->GetChildByName("combo2"))->SetText("0 NC"); + SpareParts.WPropCmd("combo2", WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[1]); - ((CCombo*)WProp->GetChildByName("combo2"))->SetText(std::to_string(input_pins[1]) + " " + spin); + SpareParts.WPropCmd("combo2", WPA_COMBOSETTEXT, (std::to_string(input_pins[1]) + " " + spin).c_str()); } - ((CCombo*)WProp->GetChildByName("combo3"))->SetItems(Items); + SpareParts.WPropCmd("combo3", WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[2] == 0) - ((CCombo*)WProp->GetChildByName("combo3"))->SetText("0 NC"); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[2]); - ((CCombo*)WProp->GetChildByName("combo3"))->SetText(std::to_string(input_pins[2]) + " " + spin); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, (std::to_string(input_pins[2]) + " " + spin).c_str()); } - ((CCombo*)WProp->GetChildByName("combo4"))->SetItems(Items); + SpareParts.WPropCmd("combo4", WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[3] == 0) - ((CCombo*)WProp->GetChildByName("combo4"))->SetText("0 NC"); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[3]); - ((CCombo*)WProp->GetChildByName("combo4"))->SetText(std::to_string(input_pins[3]) + " " + spin); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, (std::to_string(input_pins[3]) + " " + spin).c_str()); } - ((CCombo*)WProp->GetChildByName("combo5"))->SetItems(Items); + SpareParts.WPropCmd("combo5", WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[4] == 0) - ((CCombo*)WProp->GetChildByName("combo5"))->SetText("0 NC"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[4]); - ((CCombo*)WProp->GetChildByName("combo5"))->SetText(std::to_string(input_pins[4]) + " " + spin); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, (std::to_string(input_pins[4]) + " " + spin).c_str()); } switch (type_com) { case TC_SPI: - WProp->SetWidth(389); - WProp->SetHeight(370); - - ((CButton*)WProp->GetChildByName("button1"))->SetX(104); - ((CButton*)WProp->GetChildByName("button2"))->SetX(185); - ((CButton*)WProp->GetChildByName("button1"))->SetY(286); - ((CButton*)WProp->GetChildByName("button2"))->SetY(286); - - ((CCombo*)WProp->GetChildByName("combo6"))->SetText("SPI"); - - ((CCombo*)WProp->GetChildByName("combo7"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo8"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo9"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo10"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo11"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo12"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo13"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo14"))->SetVisible(false); - - ((CCombo*)WProp->GetChildByName("combo15"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo16"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo17"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo18"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo19"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label9"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label10"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label11"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label12"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label13"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label14"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label15"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label16"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label17"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label18"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label19"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label20"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label21"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label5"))->SetText("Pin 3 - CLK"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("Pin 4 - DIN"); + + SpareParts.WPropCmd(NULL, WPA_SETWIDTH, "389"); + SpareParts.WPropCmd(NULL, WPA_SETHEIGHT, "370"); + + SpareParts.WPropCmd("button1", WPA_SETX, "104"); + SpareParts.WPropCmd("button2", WPA_SETX, "185"); + SpareParts.WPropCmd("button1", WPA_SETY, "286"); + SpareParts.WPropCmd("button2", WPA_SETY, "286"); + + SpareParts.WPropCmd("combo6", WPA_COMBOSETTEXT, "SPI"); + + SpareParts.WPropCmd("combo7", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo8", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo9", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo10", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo11", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo12", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo13", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo14", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("combo15", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo16", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo17", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo18", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo19", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label9", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label10", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label11", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label12", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label13", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label14", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label15", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label16", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label17", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label18", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label19", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label20", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label21", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "Pin 3 - CLK"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "Pin 4 - DIN"); break; case TC_8BITS: - WProp->SetWidth(740); - WProp->SetHeight(370); - - ((CButton*)WProp->GetChildByName("button1"))->SetX(154); - ((CButton*)WProp->GetChildByName("button2"))->SetX(235); - ((CButton*)WProp->GetChildByName("button1"))->SetY(286); - ((CButton*)WProp->GetChildByName("button2"))->SetY(286); - - ((CCombo*)WProp->GetChildByName("combo6"))->SetText("8Bits"); - - ((CCombo*)WProp->GetChildByName("combo7"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo8"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo9"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo10"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo11"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo12"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo13"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo14"))->SetVisible(true); - - ((CCombo*)WProp->GetChildByName("combo15"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo16"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo17"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo18"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo19"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label9"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label10"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label11"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label12"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label13"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label14"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label15"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label16"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label17"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label18"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label19"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label20"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label21"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label5"))->SetText("Pin 3 - /WR"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("Pin 4 - /RD"); + SpareParts.WPropCmd(NULL, WPA_SETWIDTH, "740"); + SpareParts.WPropCmd(NULL, WPA_SETHEIGHT, "370"); + + SpareParts.WPropCmd("button1", WPA_SETX, "154"); + SpareParts.WPropCmd("button2", WPA_SETX, "235"); + SpareParts.WPropCmd("button1", WPA_SETY, "286"); + SpareParts.WPropCmd("button2", WPA_SETY, "286"); + + SpareParts.WPropCmd("combo6", WPA_COMBOSETTEXT, "8Bits"); + + SpareParts.WPropCmd("combo7", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo8", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo9", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo10", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo11", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo12", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo13", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo14", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("combo15", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo16", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo17", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo18", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo19", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label9", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label10", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label11", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label12", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label13", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label14", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label15", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label16", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label17", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label18", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label19", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label20", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label21", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "Pin 3 - /WR"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "Pin 4 - /RD"); for (int i = 0; i < 8; i++) { snprintf(name, 100, "combo%i", i + 7); - ((CCombo*)WProp->GetChildByName(name))->SetItems(Items); + SpareParts.WPropCmd(name, WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[5 + i] == 0) - ((CCombo*)WProp->GetChildByName(name))->SetText("0 NC"); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[5 + i]); - ((CCombo*)WProp->GetChildByName(name))->SetText(std::to_string(input_pins[5 + i]) + " " + spin); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, + (std::to_string(input_pins[5 + i]) + " " + spin).c_str()); } } break; case TC_SPI_TOUCH: - WProp->SetWidth(389); - WProp->SetHeight(570); - - ((CButton*)WProp->GetChildByName("button1"))->SetX(104); - ((CButton*)WProp->GetChildByName("button2"))->SetX(185); - ((CButton*)WProp->GetChildByName("button1"))->SetY(486); - ((CButton*)WProp->GetChildByName("button2"))->SetY(486); - - ((CCombo*)WProp->GetChildByName("combo6"))->SetText("SPI+Touch"); - - ((CCombo*)WProp->GetChildByName("combo7"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo8"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo9"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo10"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo11"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo12"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo13"))->SetVisible(false); - ((CCombo*)WProp->GetChildByName("combo14"))->SetVisible(false); - - ((CCombo*)WProp->GetChildByName("combo15"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo16"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo17"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo18"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo19"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label9"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label10"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label11"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label12"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label13"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label14"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label15"))->SetVisible(false); - ((CLabel*)WProp->GetChildByName("label16"))->SetVisible(false); - - ((CLabel*)WProp->GetChildByName("label17"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label18"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label19"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label20"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label21"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label5"))->SetText("Pin 3 - CLK"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("Pin 4 - DIN"); + + SpareParts.WPropCmd(NULL, WPA_SETWIDTH, "389"); + SpareParts.WPropCmd(NULL, WPA_SETHEIGHT, "570"); + + SpareParts.WPropCmd("button1", WPA_SETX, "104"); + SpareParts.WPropCmd("button2", WPA_SETX, "185"); + SpareParts.WPropCmd("button1", WPA_SETY, "486"); + SpareParts.WPropCmd("button2", WPA_SETY, "486"); + + SpareParts.WPropCmd("combo6", WPA_COMBOSETTEXT, "SPI+Touch"); + + SpareParts.WPropCmd("combo7", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo8", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo9", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo10", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo11", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo12", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo13", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("combo14", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("combo15", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo16", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo17", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo18", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo19", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label9", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label10", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label11", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label12", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label13", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label14", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label15", WPA_SETVISIBLE, "0"); + SpareParts.WPropCmd("label16", WPA_SETVISIBLE, "0"); + + SpareParts.WPropCmd("label17", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label18", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label19", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label20", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label21", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "Pin 3 - CLK"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "Pin 4 - DIN"); for (int i = 0; i < 5; i++) { snprintf(name, 100, "combo%i", i + 15); - ((CCombo*)WProp->GetChildByName(name))->SetItems(Items); + SpareParts.WPropCmd(name, WPA_COMBOSETITEMS, Items.c_str()); if (touch_pins[i] == 0) - ((CCombo*)WProp->GetChildByName(name))->SetText("0 NC"); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(touch_pins[i]); - ((CCombo*)WProp->GetChildByName(name))->SetText(std::to_string(touch_pins[i]) + " " + spin); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, (std::to_string(touch_pins[i]) + " " + spin).c_str()); } } break; case TC_8BITS_TOUCH: - WProp->SetWidth(740); - WProp->SetHeight(570); - - ((CButton*)WProp->GetChildByName("button1"))->SetX(154); - ((CButton*)WProp->GetChildByName("button2"))->SetX(235); - ((CButton*)WProp->GetChildByName("button1"))->SetY(486); - ((CButton*)WProp->GetChildByName("button2"))->SetY(486); - - ((CCombo*)WProp->GetChildByName("combo6"))->SetText("8Bits+Touch"); - - ((CCombo*)WProp->GetChildByName("combo7"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo8"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo9"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo10"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo11"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo12"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo13"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo14"))->SetVisible(true); - - ((CCombo*)WProp->GetChildByName("combo15"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo16"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo17"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo18"))->SetVisible(true); - ((CCombo*)WProp->GetChildByName("combo19"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label9"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label10"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label11"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label12"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label13"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label14"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label15"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label16"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label17"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label18"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label19"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label20"))->SetVisible(true); - ((CLabel*)WProp->GetChildByName("label21"))->SetVisible(true); - - ((CLabel*)WProp->GetChildByName("label5"))->SetText("Pin 3 - /WR"); - ((CLabel*)WProp->GetChildByName("label4"))->SetText("Pin 4 - /RD"); + SpareParts.WPropCmd(NULL, WPA_SETWIDTH, "740"); + SpareParts.WPropCmd(NULL, WPA_SETHEIGHT, "570"); + + SpareParts.WPropCmd("button1", WPA_SETX, "154"); + SpareParts.WPropCmd("button2", WPA_SETX, "235"); + SpareParts.WPropCmd("button1", WPA_SETY, "486"); + SpareParts.WPropCmd("button2", WPA_SETY, "486"); + + SpareParts.WPropCmd("combo6", WPA_COMBOSETTEXT, "8Bits+Touch"); + + SpareParts.WPropCmd("combo7", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo8", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo9", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo10", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo11", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo12", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo13", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo14", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("combo15", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo16", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo17", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo18", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("combo19", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label9", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label10", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label11", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label12", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label13", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label14", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label15", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label16", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label17", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label18", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label19", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label20", WPA_SETVISIBLE, "1"); + SpareParts.WPropCmd("label21", WPA_SETVISIBLE, "1"); + + SpareParts.WPropCmd("label5", WPA_LABELSETTEXT, "Pin 3 - /WR"); + SpareParts.WPropCmd("label4", WPA_LABELSETTEXT, "Pin 4 - /RD"); for (int i = 0; i < 8; i++) { snprintf(name, 100, "combo%i", i + 7); - ((CCombo*)WProp->GetChildByName(name))->SetItems(Items); + SpareParts.WPropCmd(name, WPA_COMBOSETITEMS, Items.c_str()); if (input_pins[5 + i] == 0) - ((CCombo*)WProp->GetChildByName(name))->SetText("0 NC"); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(input_pins[5 + i]); - ((CCombo*)WProp->GetChildByName(name))->SetText(std::to_string(input_pins[5 + i]) + " " + spin); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, + (std::to_string(input_pins[5 + i]) + " " + spin).c_str()); } } for (int i = 0; i < 5; i++) { snprintf(name, 100, "combo%i", i + 15); - ((CCombo*)WProp->GetChildByName(name))->SetItems(Items); + SpareParts.WPropCmd(name, WPA_COMBOSETITEMS, Items.c_str()); if (touch_pins[i] == 0) - ((CCombo*)WProp->GetChildByName(name))->SetText("0 NC"); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, "0 NC"); else { spin = SpareParts.GetPinName(touch_pins[i]); - ((CCombo*)WProp->GetChildByName(name))->SetText(std::to_string(touch_pins[i]) + " " + spin); + SpareParts.WPropCmd(name, WPA_COMBOSETTEXT, (std::to_string(touch_pins[i]) + " " + spin).c_str()); } } break; } - - ((CCombo*)WProp->GetChildByName("combo6"))->EvOnComboChange = SpareParts.PropComboChange; - - ((CButton*)WProp->GetChildByName("button1"))->EvMouseButtonRelease = SpareParts.PropButtonRelease; - ((CButton*)WProp->GetChildByName("button1"))->SetTag(1); - - ((CButton*)WProp->GetChildByName("button2"))->EvMouseButtonRelease = SpareParts.PropButtonRelease; } -void cpart_LCD_ili9341::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = atoi(((CCombo*)WProp->GetChildByName("combo1"))->GetText()); - input_pins[1] = atoi(((CCombo*)WProp->GetChildByName("combo2"))->GetText()); - input_pins[2] = atoi(((CCombo*)WProp->GetChildByName("combo3"))->GetText()); - input_pins[3] = atoi(((CCombo*)WProp->GetChildByName("combo4"))->GetText()); - input_pins[4] = atoi(((CCombo*)WProp->GetChildByName("combo5"))->GetText()); +void cpart_LCD_ili9341::ReadPropertiesWindow(void) { + char buff[64]; + SpareParts.WPropCmd("combo1", WPA_COMBOGETTEXT, NULL, buff); + input_pins[0] = std::stoi(buff); + SpareParts.WPropCmd("combo2", WPA_COMBOGETTEXT, NULL, buff); + input_pins[1] = std::stoi(buff); + SpareParts.WPropCmd("combo3", WPA_COMBOGETTEXT, NULL, buff); + input_pins[2] = std::stoi(buff); + SpareParts.WPropCmd("combo4", WPA_COMBOGETTEXT, NULL, buff); + input_pins[3] = std::stoi(buff); + SpareParts.WPropCmd("combo5", WPA_COMBOGETTEXT, NULL, buff); + input_pins[4] = std::stoi(buff); if ((type_com == TC_8BITS) || (type_com == TC_8BITS_TOUCH)) { - input_pins[5] = atoi(((CCombo*)WProp->GetChildByName("combo7"))->GetText()); - input_pins[6] = atoi(((CCombo*)WProp->GetChildByName("combo8"))->GetText()); - input_pins[7] = atoi(((CCombo*)WProp->GetChildByName("combo9"))->GetText()); - input_pins[8] = atoi(((CCombo*)WProp->GetChildByName("combo10"))->GetText()); - input_pins[9] = atoi(((CCombo*)WProp->GetChildByName("combo11"))->GetText()); - input_pins[10] = atoi(((CCombo*)WProp->GetChildByName("combo12"))->GetText()); - input_pins[11] = atoi(((CCombo*)WProp->GetChildByName("combo13"))->GetText()); - input_pins[12] = atoi(((CCombo*)WProp->GetChildByName("combo14"))->GetText()); + SpareParts.WPropCmd("combo7", WPA_COMBOGETTEXT, NULL, buff); + input_pins[5] = std::stoi(buff); + SpareParts.WPropCmd("combo8", WPA_COMBOGETTEXT, NULL, buff); + input_pins[6] = std::stoi(buff); + SpareParts.WPropCmd("combo9", WPA_COMBOGETTEXT, NULL, buff); + input_pins[7] = std::stoi(buff); + SpareParts.WPropCmd("combo10", WPA_COMBOGETTEXT, NULL, buff); + input_pins[8] = std::stoi(buff); + SpareParts.WPropCmd("combo11", WPA_COMBOGETTEXT, NULL, buff); + input_pins[9] = std::stoi(buff); + SpareParts.WPropCmd("combo12", WPA_COMBOGETTEXT, NULL, buff); + input_pins[10] = std::stoi(buff); + SpareParts.WPropCmd("combo13", WPA_COMBOGETTEXT, NULL, buff); + input_pins[11] = std::stoi(buff); + SpareParts.WPropCmd("combo14", WPA_COMBOGETTEXT, NULL, buff); + input_pins[12] = std::stoi(buff); } if ((type_com == TC_8BITS_TOUCH) || (type_com == TC_SPI_TOUCH)) { - touch_pins[0] = atoi(((CCombo*)WProp->GetChildByName("combo15"))->GetText()); - touch_pins[1] = atoi(((CCombo*)WProp->GetChildByName("combo16"))->GetText()); - touch_pins[2] = atoi(((CCombo*)WProp->GetChildByName("combo17"))->GetText()); - touch_pins[3] = atoi(((CCombo*)WProp->GetChildByName("combo18"))->GetText()); - touch_pins[4] = atoi(((CCombo*)WProp->GetChildByName("combo19"))->GetText()); + SpareParts.WPropCmd("combo11", WPA_COMBOGETTEXT, NULL, buff); + input_pins[9] = std::stoi(buff); + SpareParts.WPropCmd("combo15", WPA_COMBOGETTEXT, NULL, buff); + touch_pins[0] = std::stoi(buff); + SpareParts.WPropCmd("combo16", WPA_COMBOGETTEXT, NULL, buff); + touch_pins[1] = std::stoi(buff); + SpareParts.WPropCmd("combo17", WPA_COMBOGETTEXT, NULL, buff); + touch_pins[2] = std::stoi(buff); + SpareParts.WPropCmd("combo18", WPA_COMBOGETTEXT, NULL, buff); + touch_pins[3] = std::stoi(buff); + SpareParts.WPropCmd("combo19", WPA_COMBOGETTEXT, NULL, buff); + touch_pins[4] = std::stoi(buff); } } diff --git a/src/parts/output_LCD_ili9341.h b/src/parts/output_LCD_ili9341.h index 5778fd5f..877d306f 100644 --- a/src/parts/output_LCD_ili9341.h +++ b/src/parts/output_LCD_ili9341.h @@ -48,8 +48,8 @@ class cpart_LCD_ili9341 : public part { void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; void Reset(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void LoadPartImage(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/output_LCD_pcd8544.cc b/src/parts/output_LCD_pcd8544.cc index 78de10f8..c20468a6 100644 --- a/src/parts/output_LCD_pcd8544.cc +++ b/src/parts/output_LCD_pcd8544.cc @@ -170,20 +170,20 @@ void cpart_LCD_pcd8544::ReadPreferences(std::string value) { Reset(); } -void cpart_LCD_pcd8544::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); +void cpart_LCD_pcd8544::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); } -void cpart_LCD_pcd8544::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_LCD_pcd8544::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); } void cpart_LCD_pcd8544::Process(void) { diff --git a/src/parts/output_LCD_pcd8544.h b/src/parts/output_LCD_pcd8544.h index a14df8b0..bab59598 100644 --- a/src/parts/output_LCD_pcd8544.h +++ b/src/parts/output_LCD_pcd8544.h @@ -40,8 +40,8 @@ class cpart_LCD_pcd8544 : public part { void DrawOutput(const unsigned int index) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void LoadPartImage(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/output_LCD_pcf8833.cc b/src/parts/output_LCD_pcf8833.cc index ad8e7edd..34a1651a 100644 --- a/src/parts/output_LCD_pcf8833.cc +++ b/src/parts/output_LCD_pcf8833.cc @@ -176,18 +176,18 @@ void cpart_LCD_pcf8833::ReadPreferences(std::string value) { Reset(); } -void cpart_LCD_pcf8833::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[3]); +void cpart_LCD_pcf8833::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", input_pins[0]); + SetPCWComboWithPinNames("combo3", input_pins[1]); + SetPCWComboWithPinNames("combo4", input_pins[2]); + SetPCWComboWithPinNames("combo5", input_pins[3]); } -void cpart_LCD_pcf8833::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_LCD_pcf8833::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo2"); + input_pins[1] = GetPWCComboSelectedPin("combo3"); + input_pins[2] = GetPWCComboSelectedPin("combo4"); + input_pins[3] = GetPWCComboSelectedPin("combo5"); } void cpart_LCD_pcf8833::Process(void) { diff --git a/src/parts/output_LCD_pcf8833.h b/src/parts/output_LCD_pcf8833.h index 70dbb3d2..f5f87599 100644 --- a/src/parts/output_LCD_pcf8833.h +++ b/src/parts/output_LCD_pcf8833.h @@ -40,8 +40,8 @@ class cpart_LCD_pcf8833 : public part { void DrawOutput(const unsigned int index) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void LoadPartImage(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/output_LCD_ssd1306.cc b/src/parts/output_LCD_ssd1306.cc index 34a17cc0..d9b2f883 100644 --- a/src/parts/output_LCD_ssd1306.cc +++ b/src/parts/output_LCD_ssd1306.cc @@ -162,29 +162,32 @@ void cpart_LCD_ssd1306::ReadPreferences(std::string value) { Reset(); } -void cpart_LCD_ssd1306::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[4]); - - ((CCombo*)WProp->GetChildByName("combo8"))->SetItems("SPI,I2C,"); +void cpart_LCD_ssd1306::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", input_pins[0]); + SetPCWComboWithPinNames("combo4", input_pins[1]); + SetPCWComboWithPinNames("combo5", input_pins[2]); + SetPCWComboWithPinNames("combo6", input_pins[3]); + SetPCWComboWithPinNames("combo7", input_pins[4]); + + SpareParts.WPropCmd("combo8", WPA_COMBOSETITEMS, "SPI,I2C,"); if (!type_com) { - ((CCombo*)WProp->GetChildByName("combo8"))->SetText("SPI"); + SpareParts.WPropCmd("combo8", WPA_COMBOSETTEXT, "SPI"); } else { - ((CCombo*)WProp->GetChildByName("combo8"))->SetText("I2C"); + SpareParts.WPropCmd("combo8", WPA_COMBOSETTEXT, "I2C"); } } -void cpart_LCD_ssd1306::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo7"); +void cpart_LCD_ssd1306::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo3"); + input_pins[1] = GetPWCComboSelectedPin("combo4"); + input_pins[2] = GetPWCComboSelectedPin("combo5"); + input_pins[3] = GetPWCComboSelectedPin("combo6"); + input_pins[4] = GetPWCComboSelectedPin("combo7"); - if (!((CCombo*)WProp->GetChildByName("combo8"))->GetText().compare("SPI")) { + char buff[64]; + SpareParts.WPropCmd("combo8", WPA_COMBOGETTEXT, NULL, buff); + + if (!strcmp(buff, "SPI")) { type_com = 0; } else { type_com = 1; diff --git a/src/parts/output_LCD_ssd1306.h b/src/parts/output_LCD_ssd1306.h index c49f18cc..ac073596 100644 --- a/src/parts/output_LCD_ssd1306.h +++ b/src/parts/output_LCD_ssd1306.h @@ -41,8 +41,8 @@ class cpart_LCD_ssd1306 : public part { void PreProcess(void) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void LoadPartImage(void) override; void ReadPreferences(std::string value) override; diff --git a/src/parts/output_LED_WS2812B.cc b/src/parts/output_LED_WS2812B.cc index 02d269c2..a0162531 100644 --- a/src/parts/output_LED_WS2812B.cc +++ b/src/parts/output_LED_WS2812B.cc @@ -248,37 +248,40 @@ void cpart_led_ws2812b::RegisterRemoteControl(void) { output_ids[O_LED]->status = (void*)&led; } -void cpart_led_ws2812b::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo4", input_pins[0]); +void cpart_led_ws2812b::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo4", input_pins[0]); - ((CLabel*)WProp->GetChildByName("label_2"))->SetText(std::to_string(output_pins[0])); + SpareParts.WPropCmd("label_2", WPA_LABELSETTEXT, std::to_string(output_pins[0]).c_str()); - ((CSpin*)WProp->GetChildByName("spin5"))->SetMax(MAXROWS); - ((CSpin*)WProp->GetChildByName("spin5"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin5"))->SetValue(led.nrows); + SpareParts.WPropCmd("spin5", WPA_SPINSETMAX, std::to_string(MAXROWS).c_str()); + SpareParts.WPropCmd("spin5", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin5", WPA_SPINSETVALUE, std::to_string(led.nrows).c_str()); - ((CSpin*)WProp->GetChildByName("spin6"))->SetMax(MAXCOLS); - ((CSpin*)WProp->GetChildByName("spin6"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin6"))->SetValue(led.ncols); + SpareParts.WPropCmd("spin6", WPA_SPINSETMAX, std::to_string(MAXCOLS).c_str()); + SpareParts.WPropCmd("spin6", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin6", WPA_SPINSETVALUE, std::to_string(led.ncols).c_str()); - ((CCombo*)WProp->GetChildByName("combo7"))->SetItems("On,Off,"); + SpareParts.WPropCmd("combo7", WPA_COMBOSETITEMS, "On,Off,"); if (led.diffuser) { - ((CCombo*)WProp->GetChildByName("combo7"))->SetText("On"); + SpareParts.WPropCmd("combo7", WPA_COMBOSETTEXT, "On"); } else { - ((CCombo*)WProp->GetChildByName("combo7"))->SetText("Off"); + SpareParts.WPropCmd("combo7", WPA_COMBOSETTEXT, "Off"); } } -void cpart_led_ws2812b::ReadPropertiesWindow(CPWindow* WProp) { +void cpart_led_ws2812b::ReadPropertiesWindow(void) { unsigned int rows, cols; unsigned char diffuser; - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo4"); + input_pins[0] = GetPWCComboSelectedPin("combo4"); - rows = ((CSpin*)WProp->GetChildByName("spin5"))->GetValue(); - cols = ((CSpin*)WProp->GetChildByName("spin6"))->GetValue(); + SpareParts.WPropCmd("spin5", WPA_SPINGETVALUE, NULL, &rows); + SpareParts.WPropCmd("spin6", WPA_SPINGETVALUE, NULL, &cols); - if (!((CCombo*)WProp->GetChildByName("combo7"))->GetText().compare("On")) { + char buff[64]; + SpareParts.WPropCmd("combo7", WPA_COMBOGETTEXT, NULL, buff); + + if (!strcmp(buff, "On")) { diffuser = 1; } else { diffuser = 0; diff --git a/src/parts/output_LED_WS2812B.h b/src/parts/output_LED_WS2812B.h index 7d20ef3c..921fc720 100644 --- a/src/parts/output_LED_WS2812B.h +++ b/src/parts/output_LED_WS2812B.h @@ -41,8 +41,8 @@ class cpart_led_ws2812b : public part { void PreProcess(void) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void LoadPartImage(void) override; diff --git a/src/parts/output_LED_matrix.cc b/src/parts/output_LED_matrix.cc index 25a7bc00..6aa0c167 100644 --- a/src/parts/output_LED_matrix.cc +++ b/src/parts/output_LED_matrix.cc @@ -177,26 +177,33 @@ void cpart_led_matrix::RegisterRemoteControl(void) { output_ids[O_LED]->status = (void*)&ldd; } -void cpart_led_matrix::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo3", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[2]); +void cpart_led_matrix::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo3", input_pins[0]); + SetPCWComboWithPinNames("combo4", input_pins[1]); + SetPCWComboWithPinNames("combo5", input_pins[2]); - ((CLabel*)WProp->GetChildByName("label_6"))->SetText(std::to_string(output_pins[0])); + SpareParts.WPropCmd("label_6", WPA_LABELSETTEXT, std::to_string(output_pins[0]).c_str()); - ((CCombo*)WProp->GetChildByName("combo7"))->SetItems("0,90,180,270,"); - ((CCombo*)WProp->GetChildByName("combo7"))->SetText(std::to_string(angle)); + SpareParts.WPropCmd("combo7", WPA_COMBOSETITEMS, "0,90,180,270,"); + SpareParts.WPropCmd("combo7", WPA_COMBOSETTEXT, std::to_string(angle).c_str()); - ((CCombo*)WProp->GetChildByName("combo8"))->SetItems("FC16,Parola,"); - ((CCombo*)WProp->GetChildByName("combo8"))->SetText((!lmode ? "FC16" : "Parola")); + SpareParts.WPropCmd("combo8", WPA_COMBOSETITEMS, "FC16,Parola,"); + SpareParts.WPropCmd("combo8", WPA_COMBOSETTEXT, (!lmode ? "FC16" : "Parola")); } -void cpart_led_matrix::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo5"); - angle = atoi(((CCombo*)WProp->GetChildByName("combo7"))->GetText()); - lmode = !(((CCombo*)WProp->GetChildByName("combo8"))->GetText().compare("FC16") == 0); +void cpart_led_matrix::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo3"); + input_pins[1] = GetPWCComboSelectedPin("combo4"); + input_pins[2] = GetPWCComboSelectedPin("combo5"); + + char buff[64]; + SpareParts.WPropCmd("combo7", WPA_COMBOGETTEXT, NULL, buff); + + angle = std::stoi(buff); + + SpareParts.WPropCmd("combo8", WPA_COMBOGETTEXT, NULL, buff); + + lmode = !(strcmp(buff, "FC16") == 0); } void cpart_led_matrix::Process(void) { diff --git a/src/parts/output_LED_matrix.h b/src/parts/output_LED_matrix.h index d711d564..d954a5d9 100644 --- a/src/parts/output_LED_matrix.h +++ b/src/parts/output_LED_matrix.h @@ -40,8 +40,8 @@ class cpart_led_matrix : public part { void DrawOutput(const unsigned int index) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_LEDs.cc b/src/parts/output_LEDs.cc index 2b057ee9..13cab520 100644 --- a/src/parts/output_LEDs.cc +++ b/src/parts/output_LEDs.cc @@ -239,7 +239,7 @@ void cpart_leds::RegisterRemoteControl(void) { } } -void cpart_leds::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_leds::ConfigurePropertiesWindow(void) { std::string Colors = ""; for (int i = 0; i < C_END; i++) { @@ -247,62 +247,67 @@ void cpart_leds::ConfigurePropertiesWindow(CPWindow* WProp) { Colors += ","; } - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[7]); + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); + SetPCWComboWithPinNames("combo6", input_pins[5]); + SetPCWComboWithPinNames("combo7", input_pins[6]); + SetPCWComboWithPinNames("combo8", input_pins[7]); - ((CCombo*)WProp->GetChildByName("combo9"))->SetItems("HIGH,LOW,"); + SpareParts.WPropCmd("combo9", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - ((CCombo*)WProp->GetChildByName("combo9"))->SetText("HIGH"); + SpareParts.WPropCmd("combo9", WPA_COMBOSETTEXT, "HIGH"); else - ((CCombo*)WProp->GetChildByName("combo9"))->SetText("LOW "); - - ((CSpin*)WProp->GetChildByName("spin10"))->SetMax(8); - ((CSpin*)WProp->GetChildByName("spin10"))->SetMin(1); - ((CSpin*)WProp->GetChildByName("spin10"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin10"))->EvOnChangeSpin = SpareParts.PropSpinChange; - - ((CCombo*)WProp->GetChildByName("combo_1"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_1"))->SetText(Colorname[colors[0]]); - ((CCombo*)WProp->GetChildByName("combo_2"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_2"))->SetText(Colorname[colors[1]]); - ((CCombo*)WProp->GetChildByName("combo_3"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_3"))->SetText(Colorname[colors[2]]); - ((CCombo*)WProp->GetChildByName("combo_4"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_4"))->SetText(Colorname[colors[3]]); - ((CCombo*)WProp->GetChildByName("combo_5"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_5"))->SetText(Colorname[colors[4]]); - ((CCombo*)WProp->GetChildByName("combo_6"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_6"))->SetText(Colorname[colors[5]]); - ((CCombo*)WProp->GetChildByName("combo_7"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_7"))->SetText(Colorname[colors[6]]); - ((CCombo*)WProp->GetChildByName("combo_8"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo_8"))->SetText(Colorname[colors[7]]); - - SpinChange(WProp, NULL, Size); + SpareParts.WPropCmd("combo9", WPA_COMBOSETTEXT, "LOW "); + + SpareParts.WPropCmd("spin10", WPA_SPINSETMAX, "8"); + SpareParts.WPropCmd("spin10", WPA_SPINSETMIN, "1"); + SpareParts.WPropCmd("spin10", WPA_SPINSETVALUE, std::to_string(Size).c_str()); + + SpareParts.WPropCmd("combo_1", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_1", WPA_COMBOSETTEXT, Colorname[colors[0]]); + SpareParts.WPropCmd("combo_2", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_2", WPA_COMBOSETTEXT, Colorname[colors[1]]); + SpareParts.WPropCmd("combo_3", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_3", WPA_COMBOSETTEXT, Colorname[colors[2]]); + SpareParts.WPropCmd("combo_4", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_4", WPA_COMBOSETTEXT, Colorname[colors[3]]); + SpareParts.WPropCmd("combo_5", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_5", WPA_COMBOSETTEXT, Colorname[colors[4]]); + SpareParts.WPropCmd("combo_6", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_6", WPA_COMBOSETTEXT, Colorname[colors[5]]); + SpareParts.WPropCmd("combo_7", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_7", WPA_COMBOSETTEXT, Colorname[colors[6]]); + SpareParts.WPropCmd("combo_8", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo_8", WPA_COMBOSETTEXT, Colorname[colors[7]]); + + SpinChange(NULL, NULL, Size); } -void cpart_leds::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_leds::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); + input_pins[5] = GetPWCComboSelectedPin("combo6"); + input_pins[6] = GetPWCComboSelectedPin("combo7"); + input_pins[7] = GetPWCComboSelectedPin("combo8"); - active = (((CCombo*)WProp->GetChildByName("combo9"))->GetText().compare("HIGH") == 0); + char buff[64]; + SpareParts.WPropCmd("combo9", WPA_COMBOGETTEXT, NULL, buff); + + active = (strcmp(buff, "HIGH") == 0); for (int i = 0; i < 8; i++) { char cname[100]; snprintf(cname, 100, "combo_%i", 1 + i); - std::string val = (const char*)((CCombo*)WProp->GetChildByName(cname))->GetText().c_str(); + + char buff[64]; + SpareParts.WPropCmd(cname, WPA_COMBOGETTEXT, NULL, buff); + std::string val = buff; for (int j = 0; j < C_END; j++) { if (!val.compare(Colorname[j])) { colors[i] = j; @@ -311,14 +316,16 @@ void cpart_leds::ReadPropertiesWindow(CPWindow* WProp) { } } - ChangeSize(((CSpin*)WProp->GetChildByName("spin10"))->GetValue()); + int size; + SpareParts.WPropCmd("spin10", WPA_SPINGETVALUE, NULL, &size); + ChangeSize(size); } void cpart_leds::SpinChange(CPWindow* WProp, CSpin* control, int value) { for (int i = 0; i < 8; i++) { char name[20]; sprintf(name, "combo%i", i + 1); - ((CCombo*)WProp->GetChildByName(name))->SetEnable(i < value); + SpareParts.WPropCmd(name, WPA_SETENABLE, std::to_string(i < value).c_str()); } } diff --git a/src/parts/output_LEDs.h b/src/parts/output_LEDs.h index 6f0199db..a05f6a25 100644 --- a/src/parts/output_LEDs.h +++ b/src/parts/output_LEDs.h @@ -37,8 +37,8 @@ class cpart_leds : public part { ~cpart_leds(void); void DrawOutput(const unsigned int index) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void LoadPartImage(void) override; diff --git a/src/parts/output_RGB_LED.cc b/src/parts/output_RGB_LED.cc index 15498a3e..e429a1c3 100644 --- a/src/parts/output_RGB_LED.cc +++ b/src/parts/output_RGB_LED.cc @@ -160,24 +160,27 @@ void cpart_rgb_led::RegisterRemoteControl(void) { output_ids[O_L1]->status = (void*)color; } -void cpart_rgb_led::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); +void cpart_rgb_led::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); - ((CCombo*)WProp->GetChildByName("combo5"))->SetItems("HIGH,LOW,"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETITEMS, "HIGH,LOW,"); if (active) - ((CCombo*)WProp->GetChildByName("combo5"))->SetText("HIGH"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, "HIGH"); else - ((CCombo*)WProp->GetChildByName("combo5"))->SetText("LOW "); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, "LOW "); } -void cpart_rgb_led::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_rgb_led::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); - active = (((CCombo*)WProp->GetChildByName("combo5"))->GetText().compare("HIGH") == 0); + char buff[64]; + SpareParts.WPropCmd("combo5", WPA_COMBOGETTEXT, NULL, buff); + + active = (strcmp(buff, "HIGH") == 0); } part_init(PART_RGB_LED_Name, cpart_rgb_led, "Output"); diff --git a/src/parts/output_RGB_LED.h b/src/parts/output_RGB_LED.h index 8d93246c..afa3c3fc 100644 --- a/src/parts/output_RGB_LED.h +++ b/src/parts/output_RGB_LED.h @@ -38,8 +38,8 @@ class cpart_rgb_led : public part { ~cpart_rgb_led(void); void DrawOutput(const unsigned int index) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_dcmotor.cc b/src/parts/output_dcmotor.cc index 173614b9..6ec0eaf2 100644 --- a/src/parts/output_dcmotor.cc +++ b/src/parts/output_dcmotor.cc @@ -323,20 +323,20 @@ void cpart_dcmotor::ReadPreferences(std::string value) { sscanf(value.c_str(), "%hhu,%hhu,%hhu,%hhu,%hhu", &pins[0], &pins[1], &pins[2], &pins[3], &pins[4]); } -void cpart_dcmotor::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", pins[4]); +void cpart_dcmotor::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", pins[0]); + SetPCWComboWithPinNames("combo2", pins[1]); + SetPCWComboWithPinNames("combo3", pins[2]); + SetPCWComboWithPinNames("combo4", pins[3]); + SetPCWComboWithPinNames("combo5", pins[4]); } -void cpart_dcmotor::ReadPropertiesWindow(CPWindow* WProp) { - pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_dcmotor::ReadPropertiesWindow(void) { + pins[0] = GetPWCComboSelectedPin("combo1"); + pins[1] = GetPWCComboSelectedPin("combo2"); + pins[2] = GetPWCComboSelectedPin("combo3"); + pins[3] = GetPWCComboSelectedPin("combo4"); + pins[4] = GetPWCComboSelectedPin("combo5"); } part_init(PART_DCMOTOR_Name, cpart_dcmotor, "Output"); diff --git a/src/parts/output_dcmotor.h b/src/parts/output_dcmotor.h index 62a86c7a..4cf8b981 100644 --- a/src/parts/output_dcmotor.h +++ b/src/parts/output_dcmotor.h @@ -40,8 +40,8 @@ class cpart_dcmotor : public part { void PreProcess(void) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/output_servo.cc b/src/parts/output_servo.cc index ee229988..b7d963cb 100644 --- a/src/parts/output_servo.cc +++ b/src/parts/output_servo.cc @@ -164,12 +164,12 @@ void cpart_servo::RegisterRemoteControl(void) { output_ids[O_AXIS]->status = (void*)∠ } -void cpart_servo::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pin); +void cpart_servo::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pin); } -void cpart_servo::ReadPropertiesWindow(CPWindow* WProp) { - input_pin = GetPWCComboSelectedPin(WProp, "combo1"); +void cpart_servo::ReadPropertiesWindow(void) { + input_pin = GetPWCComboSelectedPin("combo1"); } void cpart_servo::LoadPartImage(void) { diff --git a/src/parts/output_servo.h b/src/parts/output_servo.h index 8b25a7c8..19f5ef11 100644 --- a/src/parts/output_servo.h +++ b/src/parts/output_servo.h @@ -54,8 +54,8 @@ class cpart_servo : public part { void DrawOutput(const unsigned int index) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void LoadPartImage(void) override; diff --git a/src/parts/output_step.cc b/src/parts/output_step.cc index 5b360382..fb5654b3 100644 --- a/src/parts/output_step.cc +++ b/src/parts/output_step.cc @@ -400,20 +400,20 @@ void cpart_step::RegisterRemoteControl(void) { output_ids[O_ROT]->status = (void*)∠ } -void cpart_step::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[0]); +void cpart_step::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", output_pins[0]); } -void cpart_step::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo5"); +void cpart_step::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + output_pins[0] = GetPWCComboSelectedPin("combo5"); } part_init(PART_STEP_Name, cpart_step, "Output"); diff --git a/src/parts/output_step.h b/src/parts/output_step.h index 46310daf..fa217198 100644 --- a/src/parts/output_step.h +++ b/src/parts/output_step.h @@ -55,8 +55,8 @@ class cpart_step : public part { void PreProcess(void) override; void Process(void) override; void PostProcess(void) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_SignalGenerator.cc b/src/parts/virtual_SignalGenerator.cc index ddfcac16..fc8a0c17 100644 --- a/src/parts/virtual_SignalGenerator.cc +++ b/src/parts/virtual_SignalGenerator.cc @@ -383,14 +383,14 @@ void cpart_SignalGenerator::RegisterRemoteControl(void) { output_ids[O_OFFS]->status = (void*)&offs; } -void cpart_SignalGenerator::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[1]); +void cpart_SignalGenerator::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", input_pins[0]); + SetPCWComboWithPinNames("combo3", input_pins[1]); } -void cpart_SignalGenerator::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); +void cpart_SignalGenerator::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo2"); + input_pins[1] = GetPWCComboSelectedPin("combo3"); } part_init(PART_SIGNALGENERATOR_Name, cpart_SignalGenerator, "Virtual"); diff --git a/src/parts/virtual_SignalGenerator.h b/src/parts/virtual_SignalGenerator.h index 3b42b790..197618d6 100644 --- a/src/parts/virtual_SignalGenerator.h +++ b/src/parts/virtual_SignalGenerator.h @@ -42,8 +42,8 @@ class cpart_SignalGenerator : public part { void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseButtonRelease(uint inputId, uint button, uint x, uint y, uint state) override; void OnMouseMove(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_Text.cc b/src/parts/virtual_Text.cc index 821f2dc5..ddc51031 100644 --- a/src/parts/virtual_Text.cc +++ b/src/parts/virtual_Text.cc @@ -222,7 +222,7 @@ void cpart_TEXT::ChangeText(int size, int textcolor, int bgcolor) { void cpart_TEXT::RegisterRemoteControl(void) {} -void cpart_TEXT::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_TEXT::ConfigurePropertiesWindow(void) { std::string Colors = ""; for (int i = 0; i < C_END; i++) { @@ -230,36 +230,45 @@ void cpart_TEXT::ConfigurePropertiesWindow(CPWindow* WProp) { Colors += ","; } - ((CText*)WProp->GetChildByName("text1"))->Clear(); + SpareParts.WPropCmd("text1", WPA_TEXTCLEAR, NULL); for (unsigned int l = 0; l < Lines.size(); l++) { - ((CText*)WProp->GetChildByName("text1"))->AddLine(lxString::FromUTF8(Lines.at(l))); + SpareParts.WPropCmd("text1", WPA_TEXTADDLINE, Lines.at(l).c_str()); } - ((CSpin*)WProp->GetChildByName("spin2"))->SetValue(Size); - ((CSpin*)WProp->GetChildByName("spin2"))->SetMin(6); - ((CSpin*)WProp->GetChildByName("spin2"))->SetMax(100); + SpareParts.WPropCmd("spin2", WPA_SPINSETMAX, "100"); + SpareParts.WPropCmd("spin2", WPA_SPINSETMIN, "6"); + SpareParts.WPropCmd("spin2", WPA_SPINSETVALUE, std::to_string(Size).c_str()); - ((CCombo*)WProp->GetChildByName("combo3"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo3"))->SetText(Colorname[Textcolor]); + SpareParts.WPropCmd("combo3", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo3", WPA_COMBOSETTEXT, Colorname[Textcolor]); - ((CCombo*)WProp->GetChildByName("combo4"))->SetItems(Colors); - ((CCombo*)WProp->GetChildByName("combo4"))->SetText(Colorname[Bgcolor]); + SpareParts.WPropCmd("combo4", WPA_COMBOSETITEMS, Colors.c_str()); + SpareParts.WPropCmd("combo4", WPA_COMBOSETTEXT, Colorname[Bgcolor]); - ((CEdit*)WProp->GetChildByName("edit5"))->SetText(Link); + SpareParts.WPropCmd("edit5", WPA_EDITSETTEXT, Link.c_str()); } -void cpart_TEXT::ReadPropertiesWindow(CPWindow* WProp) { +void cpart_TEXT::ReadPropertiesWindow(void) { Lines.clear(); - CText* Text = ((CText*)WProp->GetChildByName("text1")); - for (unsigned int l = 0; l < Text->GetCountLines(); l++) { - if (strlen(Text->GetLine(l).utf8_str()) > 0) { - Lines.push_back((const char*)Text->GetLine(l).utf8_str()); + unsigned int linecount; + SpareParts.WPropCmd("text1", WPA_TEXTGETLINECOUNT, NULL, &linecount); + for (unsigned int l = 0; l < linecount; l++) { + char buff[64]; + SpareParts.WPropCmd("text1", WPA_TEXTGETLINE, std::to_string(l).c_str(), buff); + if (strlen(buff) > 0) { + Lines.push_back(buff); } } - Size = ((CSpin*)WProp->GetChildByName("spin2"))->GetValue(); + int size; + SpareParts.WPropCmd("spin2", WPA_SPINGETVALUE, NULL, &size); - std::string val = (const char*)((CCombo*)WProp->GetChildByName("combo3"))->GetText().utf8_str(); + Size = size; + + char buff[64]; + SpareParts.WPropCmd("combo3", WPA_COMBOGETTEXT, NULL, buff); + + std::string val = buff; for (int j = 0; j < C_END; j++) { if (!val.compare(Colorname[j])) { Textcolor = j; @@ -267,7 +276,9 @@ void cpart_TEXT::ReadPropertiesWindow(CPWindow* WProp) { } } - val = ((CCombo*)WProp->GetChildByName("combo4"))->GetText(); + SpareParts.WPropCmd("combo4", WPA_COMBOGETTEXT, NULL, buff); + + val = buff; for (int j = 0; j < C_END; j++) { if (!val.compare(Colorname[j])) { Bgcolor = j; @@ -275,7 +286,9 @@ void cpart_TEXT::ReadPropertiesWindow(CPWindow* WProp) { } } - Link = ((CEdit*)WProp->GetChildByName("edit5"))->GetText(); + SpareParts.WPropCmd("edit5", WPA_EDITGETTEXT, NULL, buff); + + Link = buff; ChangeText(Size, Textcolor, Bgcolor); } diff --git a/src/parts/virtual_Text.h b/src/parts/virtual_Text.h index c93b939f..a2bad7c6 100644 --- a/src/parts/virtual_Text.h +++ b/src/parts/virtual_Text.h @@ -39,8 +39,8 @@ class cpart_TEXT : public part { void PostInit(void) override; void DrawOutput(const unsigned int index) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; void LoadPartImage(void) override; diff --git a/src/parts/virtual_VCD_Dump.cc b/src/parts/virtual_VCD_Dump.cc index 4851be88..2d710c24 100644 --- a/src/parts/virtual_VCD_Dump.cc +++ b/src/parts/virtual_VCD_Dump.cc @@ -238,26 +238,26 @@ void cpart_VCD_Dump::ReadPreferences(std::string value) { &input_pins[2], &input_pins[3], &input_pins[4], &input_pins[5], &input_pins[6], &input_pins[7], &rec); } -void cpart_VCD_Dump::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[7]); +void cpart_VCD_Dump::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); + SetPCWComboWithPinNames("combo6", input_pins[5]); + SetPCWComboWithPinNames("combo7", input_pins[6]); + SetPCWComboWithPinNames("combo8", input_pins[7]); } -void cpart_VCD_Dump::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_VCD_Dump::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); + input_pins[5] = GetPWCComboSelectedPin("combo6"); + input_pins[6] = GetPWCComboSelectedPin("combo7"); + input_pins[7] = GetPWCComboSelectedPin("combo8"); } void cpart_VCD_Dump::PreProcess(void) { diff --git a/src/parts/virtual_VCD_Dump.h b/src/parts/virtual_VCD_Dump.h index ed02b151..4dc67477 100644 --- a/src/parts/virtual_VCD_Dump.h +++ b/src/parts/virtual_VCD_Dump.h @@ -41,8 +41,8 @@ class cpart_VCD_Dump : public part { void Process(void) override; void PostProcess(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_VCD_Dump_an.cc b/src/parts/virtual_VCD_Dump_an.cc index a64964cd..c8559cf2 100644 --- a/src/parts/virtual_VCD_Dump_an.cc +++ b/src/parts/virtual_VCD_Dump_an.cc @@ -246,26 +246,26 @@ void cpart_VCD_Dump_an::ReadPreferences(std::string value) { &input_pins[2], &input_pins[3], &input_pins[4], &input_pins[5], &input_pins[6], &input_pins[7], &rec); } -void cpart_VCD_Dump_an::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", input_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", input_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", input_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", input_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", input_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", input_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", input_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", input_pins[7]); +void cpart_VCD_Dump_an::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", input_pins[0]); + SetPCWComboWithPinNames("combo2", input_pins[1]); + SetPCWComboWithPinNames("combo3", input_pins[2]); + SetPCWComboWithPinNames("combo4", input_pins[3]); + SetPCWComboWithPinNames("combo5", input_pins[4]); + SetPCWComboWithPinNames("combo6", input_pins[5]); + SetPCWComboWithPinNames("combo7", input_pins[6]); + SetPCWComboWithPinNames("combo8", input_pins[7]); } -void cpart_VCD_Dump_an::ReadPropertiesWindow(CPWindow* WProp) { - input_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - input_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - input_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - input_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - input_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - input_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - input_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - input_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_VCD_Dump_an::ReadPropertiesWindow(void) { + input_pins[0] = GetPWCComboSelectedPin("combo1"); + input_pins[1] = GetPWCComboSelectedPin("combo2"); + input_pins[2] = GetPWCComboSelectedPin("combo3"); + input_pins[3] = GetPWCComboSelectedPin("combo4"); + input_pins[4] = GetPWCComboSelectedPin("combo5"); + input_pins[5] = GetPWCComboSelectedPin("combo6"); + input_pins[6] = GetPWCComboSelectedPin("combo7"); + input_pins[7] = GetPWCComboSelectedPin("combo8"); } void cpart_VCD_Dump_an::PreProcess(void) { diff --git a/src/parts/virtual_VCD_Dump_an.h b/src/parts/virtual_VCD_Dump_an.h index 0a0df71d..f0020f65 100644 --- a/src/parts/virtual_VCD_Dump_an.h +++ b/src/parts/virtual_VCD_Dump_an.h @@ -44,8 +44,8 @@ class cpart_VCD_Dump_an : public part { std::string GetMapFile(void) override { return "VCD Dump/part.map"; }; std::string GetPropertiesWindowFile(void) override { return "VCD Dump/part.lxrad"; }; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_VCD_Play.cc b/src/parts/virtual_VCD_Play.cc index 41b488b2..94a4bcc2 100644 --- a/src/parts/virtual_VCD_Play.cc +++ b/src/parts/virtual_VCD_Play.cc @@ -246,26 +246,26 @@ void cpart_VCD_Play::ReadPreferences(std::string value) { Reset(); } -void cpart_VCD_Play::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo1", output_pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", output_pins[1]); - SetPCWComboWithPinNames(WProp, "combo3", output_pins[2]); - SetPCWComboWithPinNames(WProp, "combo4", output_pins[3]); - SetPCWComboWithPinNames(WProp, "combo5", output_pins[4]); - SetPCWComboWithPinNames(WProp, "combo6", output_pins[5]); - SetPCWComboWithPinNames(WProp, "combo7", output_pins[6]); - SetPCWComboWithPinNames(WProp, "combo8", output_pins[7]); +void cpart_VCD_Play::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo1", output_pins[0]); + SetPCWComboWithPinNames("combo2", output_pins[1]); + SetPCWComboWithPinNames("combo3", output_pins[2]); + SetPCWComboWithPinNames("combo4", output_pins[3]); + SetPCWComboWithPinNames("combo5", output_pins[4]); + SetPCWComboWithPinNames("combo6", output_pins[5]); + SetPCWComboWithPinNames("combo7", output_pins[6]); + SetPCWComboWithPinNames("combo8", output_pins[7]); } -void cpart_VCD_Play::ReadPropertiesWindow(CPWindow* WProp) { - output_pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - output_pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); - output_pins[2] = GetPWCComboSelectedPin(WProp, "combo3"); - output_pins[3] = GetPWCComboSelectedPin(WProp, "combo4"); - output_pins[4] = GetPWCComboSelectedPin(WProp, "combo5"); - output_pins[5] = GetPWCComboSelectedPin(WProp, "combo6"); - output_pins[6] = GetPWCComboSelectedPin(WProp, "combo7"); - output_pins[7] = GetPWCComboSelectedPin(WProp, "combo8"); +void cpart_VCD_Play::ReadPropertiesWindow(void) { + output_pins[0] = GetPWCComboSelectedPin("combo1"); + output_pins[1] = GetPWCComboSelectedPin("combo2"); + output_pins[2] = GetPWCComboSelectedPin("combo3"); + output_pins[3] = GetPWCComboSelectedPin("combo4"); + output_pins[4] = GetPWCComboSelectedPin("combo5"); + output_pins[5] = GetPWCComboSelectedPin("combo6"); + output_pins[6] = GetPWCComboSelectedPin("combo7"); + output_pins[7] = GetPWCComboSelectedPin("combo8"); } void cpart_VCD_Play::PreProcess(void) { diff --git a/src/parts/virtual_VCD_Play.h b/src/parts/virtual_VCD_Play.h index 65eae314..77190c1b 100644 --- a/src/parts/virtual_VCD_Play.h +++ b/src/parts/virtual_VCD_Play.h @@ -46,9 +46,9 @@ class cpart_VCD_Play : public part { void Process(void) override; void PostProcess(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; void filedialog_EvOnClose(int retId) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_d_transfer_function.cc b/src/parts/virtual_d_transfer_function.cc index eaea70e4..aaecf129 100644 --- a/src/parts/virtual_d_transfer_function.cc +++ b/src/parts/virtual_d_transfer_function.cc @@ -279,44 +279,48 @@ void cpart_dtfunc::ReadPreferences(std::string value) { &den[1], &den[2], &den[3]); } -void cpart_dtfunc::ConfigurePropertiesWindow(CPWindow* WProp) { +void cpart_dtfunc::ConfigurePropertiesWindow(void) { std::string Items = SpareParts.GetPinsNames(); std::string spin; char buff[20]; char eq[200]; - SetPCWComboWithPinNames(WProp, "combo1", pins[0]); - SetPCWComboWithPinNames(WProp, "combo2", pins[1]); + SetPCWComboWithPinNames("combo1", pins[0]); + SetPCWComboWithPinNames("combo2", pins[1]); eq[0] = 0; for (int i = 0; i < ordern; i++) { snprintf(buff, 19, "%+f ", num[i]); strncat(eq, buff, 199); } - ((CEdit*)WProp->GetChildByName("edit3"))->SetText(eq); + + SpareParts.WPropCmd("edit3", WPA_EDITSETTEXT, eq); eq[0] = 0; for (int i = 0; i < orderd; i++) { snprintf(buff, 19, "%+f ", den[i]); strncat(eq, buff, 199); } - ((CEdit*)WProp->GetChildByName("edit4"))->SetText(eq); + SpareParts.WPropCmd("edit4", WPA_EDITSETTEXT, eq); - ((CEdit*)WProp->GetChildByName("edit5"))->SetText(std::to_string(sample)); - ((CEdit*)WProp->GetChildByName("edit6"))->SetText(std::to_string(in_gain)); - ((CEdit*)WProp->GetChildByName("edit7"))->SetText(std::to_string(in_off)); - ((CEdit*)WProp->GetChildByName("edit8"))->SetText(std::to_string(out_gain)); - ((CEdit*)WProp->GetChildByName("edit9"))->SetText(std::to_string(out_off)); + SpareParts.WPropCmd("edit5", WPA_EDITSETTEXT, std::to_string(sample).c_str()); + SpareParts.WPropCmd("edit6", WPA_EDITSETTEXT, std::to_string(in_gain).c_str()); + SpareParts.WPropCmd("edit7", WPA_EDITSETTEXT, std::to_string(in_off).c_str()); + SpareParts.WPropCmd("edit8", WPA_EDITSETTEXT, std::to_string(out_gain).c_str()); + SpareParts.WPropCmd("edit9", WPA_EDITSETTEXT, std::to_string(out_off).c_str()); } -void cpart_dtfunc::ReadPropertiesWindow(CPWindow* WProp) { +void cpart_dtfunc::ReadPropertiesWindow(void) { char line[256]; char* T[4]; - pins[0] = GetPWCComboSelectedPin(WProp, "combo1"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo2"); + pins[0] = GetPWCComboSelectedPin("combo1"); + pins[1] = GetPWCComboSelectedPin("combo2"); + + char buff[255]; + SpareParts.WPropCmd("edit3", WPA_EDITGETTEXT, NULL, buff); - strncpy(line, ((CEdit*)WProp->GetChildByName("edit3"))->GetText().c_str(), 255); + strncpy(line, buff, 255); T[0] = strtok(line, " "); T[1] = strtok(NULL, " "); T[2] = strtok(NULL, " "); @@ -332,7 +336,9 @@ void cpart_dtfunc::ReadPropertiesWindow(CPWindow* WProp) { } } - strncpy(line, ((CEdit*)WProp->GetChildByName("edit4"))->GetText().c_str(), 255); + SpareParts.WPropCmd("edit4", WPA_EDITGETTEXT, NULL, buff); + + strncpy(line, buff, 255); T[0] = strtok(line, " "); T[1] = strtok(NULL, " "); T[2] = strtok(NULL, " "); @@ -358,11 +364,20 @@ void cpart_dtfunc::ReadPropertiesWindow(CPWindow* WProp) { } } - sample = atof(((CEdit*)WProp->GetChildByName("edit5"))->GetText()); - in_gain = atof(((CEdit*)WProp->GetChildByName("edit6"))->GetText()); - in_off = atof(((CEdit*)WProp->GetChildByName("edit7"))->GetText()); - out_gain = atof(((CEdit*)WProp->GetChildByName("edit8"))->GetText()); - out_off = atof(((CEdit*)WProp->GetChildByName("edit9"))->GetText()); + SpareParts.WPropCmd("edit5", WPA_EDITGETTEXT, NULL, buff); + sample = std::stof(buff); + + SpareParts.WPropCmd("edit6", WPA_EDITGETTEXT, NULL, buff); + in_gain = std::stof(buff); + + SpareParts.WPropCmd("edit7", WPA_EDITGETTEXT, NULL, buff); + in_off = std::stof(buff); + + SpareParts.WPropCmd("edit8", WPA_EDITGETTEXT, NULL, buff); + out_gain = std::stof(buff); + + SpareParts.WPropCmd("edit9", WPA_EDITGETTEXT, NULL, buff); + out_off = std::stof(buff); Reset(); } diff --git a/src/parts/virtual_d_transfer_function.h b/src/parts/virtual_d_transfer_function.h index a7999a74..93af6aba 100644 --- a/src/parts/virtual_d_transfer_function.h +++ b/src/parts/virtual_d_transfer_function.h @@ -41,8 +41,8 @@ class cpart_dtfunc : public part { void Reset(void) override; void EvKeyPress(uint key, uint mask) override; void EvKeyRelease(uint key, uint mask) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; std::string WritePreferences(void) override; void ReadPreferences(std::string value) override; unsigned short GetInputId(char* name) override; diff --git a/src/parts/virtual_vterm.cc b/src/parts/virtual_vterm.cc index 0a05965a..e2e2f2c8 100644 --- a/src/parts/virtual_vterm.cc +++ b/src/parts/virtual_vterm.cc @@ -360,18 +360,22 @@ void cpart_vterm::ReadPreferences(std::string value) { Reset(); } -void cpart_vterm::ConfigurePropertiesWindow(CPWindow* WProp) { - SetPCWComboWithPinNames(WProp, "combo2", pins[0]); - SetPCWComboWithPinNames(WProp, "combo3", pins[1]); +void cpart_vterm::ConfigurePropertiesWindow(void) { + SetPCWComboWithPinNames("combo2", pins[0]); + SetPCWComboWithPinNames("combo3", pins[1]); - ((CCombo*)WProp->GetChildByName("combo5"))->SetItems("1200,2400,4800,9600,19200,38400,57600,115200,"); - ((CCombo*)WProp->GetChildByName("combo5"))->SetText(std::to_string(vterm_speed)); + SpareParts.WPropCmd("combo5", WPA_COMBOSETITEMS, "1200,2400,4800,9600,19200,38400,57600,115200,"); + SpareParts.WPropCmd("combo5", WPA_COMBOSETTEXT, std::to_string(vterm_speed).c_str()); } -void cpart_vterm::ReadPropertiesWindow(CPWindow* WProp) { - pins[0] = GetPWCComboSelectedPin(WProp, "combo2"); - pins[1] = GetPWCComboSelectedPin(WProp, "combo3"); - vterm_speed = atoi(((CCombo*)WProp->GetChildByName("combo5"))->GetText()); +void cpart_vterm::ReadPropertiesWindow(void) { + pins[0] = GetPWCComboSelectedPin("combo2"); + pins[1] = GetPWCComboSelectedPin("combo3"); + + char buff[64]; + SpareParts.WPropCmd("combo5", WPA_COMBOGETTEXT, NULL, buff); + + vterm_speed = std::stoi(buff); Reset(); } diff --git a/src/parts/virtual_vterm.h b/src/parts/virtual_vterm.h index 59ec8180..7ccd4aa5 100644 --- a/src/parts/virtual_vterm.h +++ b/src/parts/virtual_vterm.h @@ -42,8 +42,8 @@ class cpart_vterm : public part { void PostProcess(void) override; void Reset(void) override; void OnMouseButtonPress(uint inputId, uint button, uint x, uint y, uint state) override; - void ConfigurePropertiesWindow(CPWindow* WProp) override; - void ReadPropertiesWindow(CPWindow* WProp) override; + void ConfigurePropertiesWindow(void) override; + void ReadPropertiesWindow(void) override; void ButtonEvent(CControl* control, uint button, uint x, uint y, uint state) override; void KeyEvent(CControl* control, uint keysym, uint ukeysym, uint state) override; void Event(CControl* control) override; diff --git a/src/picsimlab1.cc b/src/picsimlab1.cc index a8eb2267..4f60b5bd 100644 --- a/src/picsimlab1.cc +++ b/src/picsimlab1.cc @@ -698,9 +698,6 @@ void CPWindow1::_EvOnCreate(CControl* control) { Oscilloscope.Init(&Window4); - SpareParts.PropButtonRelease = EVMOUSEBUTTONRELEASE & CPWindow5::PropButtonRelease; - SpareParts.PropComboChange = EVONCOMBOCHANGE & CPWindow5::PropComboChange; - SpareParts.PropSpinChange = EVONCHANGESPIN & CPWindow5::PropSpinChange; SpareParts.PartEvent = EVONCOMBOCHANGE & CPWindow5::PartEvent; SpareParts.PartButtonEvent = EVMOUSEBUTTONRELEASE & CPWindow5::PartButtonEvent; SpareParts.PartKeyEvent = EVKEYBOARDPRESS & CPWindow5::PartKeyEvent; diff --git a/src/picsimlab5.cc b/src/picsimlab5.cc index 45403771..d11674d6 100644 --- a/src/picsimlab5.cc +++ b/src/picsimlab5.cc @@ -70,6 +70,7 @@ void CPWindow5::menu1_EvMenuActive(CControl* control) { void CPWindow5::_EvOnCreate(CControl* control) { SpareParts.OnCanvasCmd = &CPWindow5::OnCanvasCmd; + SpareParts.OnWPropCmd = &CPWindow5::OnWPropCmd; if (SpareParts.GetLoadConfigFile().length() > 0) SpareParts.LoadConfig(SpareParts.GetLoadConfigFile()); @@ -199,6 +200,7 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { combo->SetX(x + 68); combo->SetY(y); wprop.CreateChild(combo); + combo->EvOnComboChange = EVONCOMBOCHANGE & CPWindow5::PropComboChange; break; case PCW_LABEL: { char lb[21]; @@ -272,6 +274,7 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { spin->SetX(x + 68); spin->SetY(y); wprop.CreateChild(spin); + spin->EvOnChangeSpin = EVONCHANGESPIN & CPWindow5::PropSpinChange; break; case PCW_EDIT: sprintf(name, "label%i", i + 1); @@ -366,7 +369,7 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { button->SetX((wprop.GetWidth() / 2) - 75); button->SetY(y + 32); button->SetTag(1); - button->EvMouseButtonRelease = SpareParts.PropButtonRelease; + button->EvMouseButtonRelease = EVMOUSEBUTTONRELEASE & CPWindow5::PropButtonRelease; wprop.CreateChild(button); button = new CButton; @@ -377,12 +380,12 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { button->SetHeight(28); button->SetX((wprop.GetWidth() / 2) + 10); button->SetY(y + 32); - button->EvMouseButtonRelease = SpareParts.PropButtonRelease; + button->EvMouseButtonRelease = EVMOUSEBUTTONRELEASE & CPWindow5::PropButtonRelease; wprop.CreateChild(button); wprop.SetHeight(y + 130); - SpareParts.GetPart(PartSelected)->ConfigurePropertiesWindow(&wprop); + SpareParts.GetPart(PartSelected)->ConfigurePropertiesWindow(); wprop.SetX(SpareParts.GetPart(PartSelected)->GetX() + GetX() - offsetx); wprop.SetY(SpareParts.GetPart(PartSelected)->GetY() + GetY() - offsety); @@ -401,17 +404,23 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { if (wprop.LoadXMLContextAndCreateChilds(fname)) { // wprop.SetCanDestroy (false); - SpareParts.GetPart(PartSelected)->ConfigurePropertiesWindow(&wprop); + SpareParts.GetPart(PartSelected)->ConfigurePropertiesWindow(); button = (CButton*)wprop.GetChildByName("button1"); if (button) { - button->EvMouseButtonRelease = SpareParts.PropButtonRelease; + button->EvMouseButtonRelease = EVMOUSEBUTTONRELEASE & CPWindow5::PropButtonRelease; button->SetTag(1); } button = (CButton*)wprop.GetChildByName("button2"); if (button) { - button->EvMouseButtonRelease = SpareParts.PropButtonRelease; + button->EvMouseButtonRelease = EVMOUSEBUTTONRELEASE & CPWindow5::PropButtonRelease; + } + + // FIXME -- Only to work with ili9341 old interface - remove + CCombo* combo = ((CCombo*)wprop.GetChildByName("combo6")); + if (combo) { + combo->EvOnComboChange = EVONCOMBOCHANGE & CPWindow5::PropComboChange; } wprop.SetX(SpareParts.GetPart(PartSelected)->GetX() + GetX() - offsetx); @@ -420,6 +429,7 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { wprop.Draw(); wprop.ShowExclusive(); } + } else { PICSimLab.RegisterError(SpareParts.GetPart(PartSelected)->GetName() + ": File not found! \n" + fname); printf("PICSimLab: (%s) File not found! %s\n", @@ -430,7 +440,7 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) { void CPWindow5::PropClose(int tag) { if (tag) { - SpareParts.GetPart(PartSelected)->ReadPropertiesWindow(&wprop); + SpareParts.GetPart(PartSelected)->ReadPropertiesWindow(); } wprop.HideExclusive(); // wprop.SetCanDestroy (true); @@ -917,26 +927,6 @@ void CPWindow5::filedialog1_EvOnClose(int retId) { } } -int CPWindow5::OnLoadImage(const std::string fname, const float scale, const int usealpha, const int orientation) { - lxImage image(&Window5); - if (image.LoadFile(lxGetLocalFile(fname), orientation, scale, scale, usealpha)) { - // find enpty bitmap - int bid = -1; - for (int i = 0; i < (MAX_PARTS * 2); i++) { - if (Window5.Bitmaps[i] == NULL) { - bid = i; - break; - } - } - if ((bid >= 0) && (bid < (MAX_PARTS * 2))) { - Window5.Bitmaps[bid] = new lxBitmap(&image, &Window5); - image.Destroy(); - return bid; - } - } - return -1; -} - int CPWindow5::OnCanvasCmd(const CanvasCmd_t cmd) { int partn = SpareParts.GetPartOnDraw(); switch (cmd.cmd) { @@ -1092,4 +1082,106 @@ int CPWindow5::OnCanvasCmd(const CanvasCmd_t cmd) { break; } return -1; +} + +int CPWindow5::OnWPropCmd(const char* ControlName, const PICSimLabWPropAction action, const char* Value, + void* ReturnBuff) { + CControl* ctrl; + + if (ControlName) { + ctrl = Window5.wprop.GetChildByName(ControlName); + } else { + ctrl = &Window5.wprop; + } + + if (ctrl == NULL) { + return -1; + } + + switch (action) { + case WPA_COMBOSETITEMS: + ((CCombo*)ctrl)->SetItems(Value); + break; + case WPA_COMBOSETTEXT: + ((CCombo*)ctrl)->SetText(Value); + break; + case WPA_COMBOGETTEXT: + strcpy((char*)ReturnBuff, ((CCombo*)ctrl)->GetText().c_str()); + return strlen((char*)ReturnBuff); + break; + case WPA_SPINDSETMAX: + ((CSpind*)ctrl)->SetMax(std::stof(Value)); + break; + case WPA_SPINDSETMIN: + ((CSpind*)ctrl)->SetMin(std::stof(Value)); + break; + case WPA_SPINDSETVALUE: + ((CSpind*)ctrl)->SetValue(std::stof(Value)); + break; + case WPA_SPINDGETVALUE: + *((float*)ReturnBuff) = ((CSpind*)ctrl)->GetValue(); + break; + + case WPA_SPINSETMAX: + ((CSpin*)ctrl)->SetMax(std::stoi(Value)); + break; + case WPA_SPINSETMIN: + ((CSpin*)ctrl)->SetMin(std::stoi(Value)); + break; + case WPA_SPINSETVALUE: + ((CSpin*)ctrl)->SetValue(std::stoi(Value)); + break; + case WPA_SPINGETVALUE: + *((int*)ReturnBuff) = ((CSpin*)ctrl)->GetValue(); + break; + + case WPA_TEXTCLEAR: + ((CText*)ctrl)->Clear(); + break; + case WPA_TEXTADDLINE: + ((CText*)ctrl)->AddLine(lxString::FromUTF8(Value)); + break; + case WPA_TEXTGETLINE: + strcpy((char*)ReturnBuff, ((CText*)ctrl)->GetLine(std::stoi(Value)).utf8_str()); + return strlen((char*)ReturnBuff); + break; + case WPA_TEXTGETLINECOUNT: + *((int*)ReturnBuff) = ((CText*)ctrl)->GetCountLines(); + break; + + case WPA_EDITSETTEXT: + ((CEdit*)ctrl)->SetText(Value); + break; + case WPA_EDITGETTEXT: + strcpy((char*)ReturnBuff, ((CEdit*)ctrl)->GetText().utf8_str()); + return strlen((char*)ReturnBuff); + break; + + case WPA_LABELSETTEXT: + ((CLabel*)ctrl)->SetText(Value); + break; + case WPA_SETENABLE: + ctrl->SetEnable(std::stoi(Value)); + break; + case WPA_SETWIDTH: + ctrl->SetWidth(std::stoi(Value)); + break; + case WPA_SETHEIGHT: + ctrl->SetHeight(std::stoi(Value)); + break; + case WPA_SETVISIBLE: + ctrl->SetVisible(std::stoi(Value)); + break; + case WPA_SETX: + ctrl->SetX(std::stoi(Value)); + break; + case WPA_SETY: + ctrl->SetY(std::stoi(Value)); + break; + default: + return -1; + break; + } + + return 0; } \ No newline at end of file diff --git a/src/picsimlab5.h b/src/picsimlab5.h index 7a73cecf..f0a5c993 100644 --- a/src/picsimlab5.h +++ b/src/picsimlab5.h @@ -116,8 +116,9 @@ class CPWindow5 : public CPWindow { void PartEvent(CControl* control); void DeleteParts(void); - static int OnLoadImage(const std::string fname, const float scale, const int usealpha, const int orientation); static int OnCanvasCmd(const CanvasCmd_t cmd); + static int OnWPropCmd(const char* ControlName, const PICSimLabWPropAction action, const char* Value, + void* ReturnBuff); CCanvas Canvas[MAX_PARTS]; lxBitmap* Bitmaps[MAX_PARTS * 2];