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);
356 const int GetPCWCount(
void);
357 const PCWProp* GetPCWProperties(
void);
359 const int GetPinCount(
void) {
return PinCount; };
360 unsigned char* GetPins(
void) {
return Pins; };
361 const int GetPinCtrlCount(
void) {
return PinCtrlCount; };
362 const unsigned char* GetPinsCtrl(
void) {
return PinsCtrl; };
391 unsigned char* PinsCtrl;
405 void SetPCWProperties(
const PCWProp* pcwprop);
406 void SetPCWComboWithPinNames(
const char* combo_name,
const unsigned char pin);
407 unsigned char GetPWCComboSelectedPin(
const char* combo_name);
434#define part_init(name, function, menu) \
435 static part* function##_create(const unsigned int x, const unsigned int y, board* pboard_, const int id_) { \
436 part* p = new function(x, y, name, menu, pboard_, id_); \
440 static void __attribute__((constructor)) function##_init(void); \
441 static void function##_init(void) { \
442 part_register(name, function##_create, menu); \
445typedef part* (*part_create_func)(
const unsigned int x,
const unsigned int y,
board* pboard_,
const int id_);
447void part_register(
const char* name, part_create_func pcreate,
const char* menu);
449part* create_part(std::string name,
const unsigned int x,
const unsigned int y,
board* pboard_,
const int id_);
453 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:386
float GetScale(void)
Return the orientation to draw.
Definition part.cc:367
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:489
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:371
int GetBitmap(void)
Return the Bitmap of part.
Definition part.h:264
int Y
Y position of part.
Definition part.h:380
virtual void SetOrientation(int orientation)
Set the orientation to draw.
Definition part.cc:347
virtual std::string GetPictureFileName(void)
Return the filename of part picture.
Definition part.cc:445
virtual void LoadPartImage(void)
Load Part Image.
Definition part.cc:314
virtual ~part(void)
Called once on part destruction.
Definition part.h:259
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:343
unsigned int Update
part need draw Update
Definition part.h:385
int GetOutputCount(void)
Get part output count.
Definition part.cc:402
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:438
output_t output[MAX_IDS]
output map elements
Definition part.h:373
input_t * input_ids[MAX_IDS]
input map elements by id order
Definition part.h:372
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:493
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:374
int Orientation
orientation to draw part
Definition part.h:383
int GetInputCount(void)
Get part input count.
Definition part.cc:391
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:381
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:378
void RotateCoords(unsigned int *x, unsigned int *y)
Return coords x y rotated by orientation.
Definition part.cc:413
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:370
unsigned int Height
Height of part.
Definition part.h:377
unsigned int refresh
redraw is needed
Definition part.h:382
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:371
void Draw(void)
Called ever 100ms to draw part.
Definition part.cc:537
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:533
virtual std::string GetPropertiesWindowFile(void)
Return the filename of properties window XML file.
Definition part.cc:453
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:457
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:449
void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:561
int outputc
output map elements counter
Definition part.h:376
int X
X position of part.
Definition part.h:379
void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:572
void EvMouseMove(unsigned int button, unsigned int x, unsigned int y, unsigned int state)
Event handler on the part.
Definition part.cc:583
output_t * GetOutput(int n)
Get part input.
Definition part.cc:406
unsigned char GetUpdate(void)
Return if part need Draw update.
Definition part.cc:434
input_t * GetInput(int n)
Get part input.
Definition part.cc:395
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:368
float Scale
scale to draw part
Definition part.h:384
int inputc
input map elements counter
Definition part.h:375
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