37enum { PCW_END, PCW_COMBO, PCW_LABEL, PCW_SPIND, PCW_EDIT, PCW_SPIN, PCW_TEXT, PCW_DCOMBO };
139 void EvMouseButtonPress(
unsigned int button,
unsigned int x,
unsigned int y,
unsigned int state);
144 virtual void OnMouseButtonPress(
unsigned int inputId,
unsigned int button,
unsigned int x,
unsigned int y,
145 unsigned int state) {};
150 void EvMouseButtonRelease(
unsigned int button,
unsigned int x,
unsigned int y,
unsigned int state);
156 unsigned int state) {};
161 void EvMouseMove(
unsigned int button,
unsigned int x,
unsigned int y,
unsigned int state);
166 virtual void OnMouseMove(
unsigned int inputId,
unsigned int button,
unsigned int x,
unsigned int y,
167 unsigned int state) {};
172 virtual void EvKeyPress(
unsigned int key,
unsigned int mask) {};
212 virtual void ComboChange(
const char* controlname, std::string value) {};
217 virtual void SpinChange(
const char* controlname,
int value) {};
222 virtual void ButtonEvent(
const char* controlname,
unsigned int button,
unsigned int x,
unsigned int y,
223 unsigned int state) {};
228 virtual void KeyEvent(
const char* controlname,
unsigned int keysym,
unsigned int ukeysym,
unsigned int state) {};
233 virtual void Event(
const char* controlname) {};
243 part(
const unsigned x,
const unsigned y,
const char* name,
const char* type,
board* pboard_,
const int id_,
244 const int fsize = 8);
329 virtual void SetScale(
double scale);
361 const int GetPCWCount(
void);
362 const PCWProp* GetPCWProperties(
void);
364 const int GetPinCount(
void) {
return PinCount; };
365 unsigned char* GetPins(
void) {
return Pins; };
366 const int GetPinCtrlCount(
void) {
return PinCtrlCount; };
367 const unsigned char* GetPinsCtrl(
void) {
return PinsCtrl; };
396 unsigned char* PinsCtrl;
410 void SetPCWProperties(
const PCWProp* pcwprop);
411 void SetPCWComboWithPinNames(
const char* combo_name,
const unsigned char pin);
412 unsigned char GetPWCComboSelectedPin(
const char* combo_name);
439#define part_init(name, function, menu) \
440 static part* function##_create(const unsigned int x, const unsigned int y, board* pboard_, const int id_) { \
441 part* p = new function(x, y, name, menu, pboard_, id_); \
445 static void __attribute__((constructor)) function##_init(void); \
446 static void function##_init(void) { \
447 part_register(name, function##_create, menu); \
450typedef part* (*part_create_func)(
const unsigned int x,
const unsigned int y,
board* pboard_,
const int id_);
452void part_register(
const char* name, part_create_func pcreate,
const char* menu);
454part* create_part(std::string name,
const unsigned int x,
const unsigned int y,
board* pboard_,
const int id_);
458 part_create_func pcreate;
Board class.
Definition board.h:111
PART class.
Definition part.h:49
virtual void ConfigurePropertiesWindow(void)=0
Called to configure the properties window.
int always_update
part need to be update every clock cycle
Definition part.h:391
float GetScale(void)
Return the orientation to draw.
Definition part.cc:373
virtual void ReadPropertiesWindow(void)=0
Called when properties window close.
int GetAlwaysUpdate(void)
Return if part need to be update every clock cycle.
Definition part.cc:495
virtual void ReadPreferences(std::string value)=0
Called whe configuration file load preferences.
virtual void SpinChange(const char *controlname, int value)
Used by properties window spin.
Definition part.h:217
void ReadMaps(void)
read maps
Definition part.cc:67
unsigned int GetHeight(void)
Return height of part.
Definition part.h:294
virtual void ButtonEvent(const char *controlname, unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Used by windows of parts.
Definition part.h:222
virtual void OnMouseButtonRelease(unsigned int inputId, unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.h:155
virtual void Process(void)
Called every CPU step.
Definition part.h:84
void ReadOutputMap(std::string fname)
Read the Output Map.
Definition part.cc:166
void SetY(int y)
Set Y position of part.
Definition part.h:284
virtual void Event(const char *controlname)
Used by windows of parts.
Definition part.h:233
input_t input[MAX_IDS]
input map elements
Definition part.h:376
int GetBitmap(void)
Return the Bitmap of part.
Definition part.h:264
int Y
Y position of part.
Definition part.h:385
virtual void SetOrientation(int orientation)
Set the orientation to draw.
Definition part.cc:353
virtual std::string GetPictureFileName(void)
Return the filename of part picture.
Definition part.cc:451
virtual void LoadPartImage(void)
Load Part Image.
Definition part.cc:314
virtual ~part(void)
Called once on part destruction.
Definition part.h:259
void SetId(int id_)
Set the part ID.
Definition part.h:339
int GetX(void)
Return X position of part.
Definition part.h:269
virtual void PostProcess(void)
Called every end of CPU process.
Definition part.h:89
virtual void Stop(void)
Stop part simulation.
Definition part.h:134
int GetOrientation(void)
Return the orientation to draw.
Definition part.cc:349
unsigned int Update
part need draw Update
Definition part.h:390
int GetOutputCount(void)
Get part output count.
Definition part.cc:408
virtual void EvKeyPress(unsigned int key, unsigned int mask)
Event handler on the part.
Definition part.h:172
void SetUpdate(unsigned char upd)
Set part to Draw update.
Definition part.cc:444
output_t output[MAX_IDS]
output map elements
Definition part.h:378
input_t * input_ids[MAX_IDS]
input map elements by id order
Definition part.h:377
virtual unsigned short GetOutputId(char *name)=0
return the output ids numbers of names used in output map
virtual void ComboChange(const char *controlname, std::string value)
Used by properties window combos.
Definition part.h:212
void SetAlwaysUpdate(int sau)
Set if part need to be update every clock cycle.
Definition part.cc:499
virtual void filedialog_EvOnClose(int retId)
Used by properties window filedialogs.
Definition part.h:238
virtual void EvKeyRelease(unsigned int key, unsigned int mask)
Event handler on the part.
Definition part.h:177
output_t * output_ids[MAX_IDS]
output map elements by id order
Definition part.h:379
int Orientation
orientation to draw part
Definition part.h:388
int GetInputCount(void)
Get part input count.
Definition part.cc:397
virtual std::string GetAboutInfo(void)=0
Return the about information of part.
int GetId(void)
Get the part ID.
Definition part.h:334
int BitmapId
Internal Bitmap.
Definition part.h:386
virtual unsigned short GetInputId(char *name)=0
return the input ids numbers of names used in input map
virtual void PostInit(void)
Called once on part after initialization.
Definition part.h:254
unsigned int Width
Width of part.
Definition part.h:383
void RotateCoords(unsigned int *x, unsigned int *y)
Return coords x y rotated by orientation.
Definition part.cc:419
int PointInside(int x, int y)
Return if point x,y is inside of part.
Definition part.cc:243
virtual void Reset(void)
Reset part status.
Definition part.h:129
int id
part ID
Definition part.h:375
unsigned int Height
Height of part.
Definition part.h:382
unsigned int refresh
redraw is needed
Definition part.h:387
virtual void DrawOutput(const unsigned int index)=0
Called to draw every output.
virtual void SetScale(double scale)
Set the orientation to draw.
Definition part.cc:377
void Draw(void)
Called ever 100ms to draw part.
Definition part.cc:543
void ReadInputMap(std::string fname)
Read the Input Map.
Definition part.cc:82
std::string GetName(void)
Return the name of part.
Definition part.cc:539
virtual std::string GetPropertiesWindowFile(void)
Return the filename of properties window XML file.
Definition part.cc:459
virtual void PreProcess(void)
Called every start of CPU process.
Definition part.h:79
virtual std::string GetHelpURL(void)
Return the help url of part.
Definition part.cc:463
unsigned int GetWidth(void)
Return width of part.
Definition part.h:289
int GetY(void)
Return Y position of part.
Definition part.h:274
void Init(void)
Called once on part initialization.
Definition part.cc:58
virtual void OnMouseButtonPress(unsigned int inputId, unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.h:144
virtual void OnMouseMove(unsigned int inputId, unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.h:166
virtual std::string GetMapFile(void)
Return the filename of part picture map.
Definition part.cc:455
void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:567
int outputc
output map elements counter
Definition part.h:381
int X
X position of part.
Definition part.h:384
void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:578
void EvMouseMove(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:589
output_t * GetOutput(int n)
Get part input.
Definition part.cc:412
unsigned char GetUpdate(void)
Return if part need Draw update.
Definition part.cc:440
input_t * GetInput(int n)
Get part input.
Definition part.cc:401
virtual std::string WritePreferences(void)=0
Called to save part preferences in configuration file.
void SetX(int x)
Set X position of part.
Definition part.h:279
virtual void RegisterRemoteControl(void)
Register remote control variables.
Definition part.h:373
float Scale
scale to draw part
Definition part.h:389
int inputc
input map elements counter
Definition part.h:380
virtual void KeyEvent(const char *controlname, unsigned int keysym, unsigned int ukeysym, unsigned int state)
Used by windows of parts.
Definition part.h:228
output map struct
Definition board.h:68