-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57c8827
Showing
321 changed files
with
32,835 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
//--------------------------------------------------------------------------- | ||
#ifndef PBaseH | ||
#define PBaseH | ||
//--------------------------------------------------------------------------- | ||
#include <SysUtils.hpp> | ||
#include <Classes.hpp> | ||
#include <Controls.hpp> | ||
#include <ExtCtrls.hpp> | ||
#include <vector> | ||
#include "model.h" | ||
//--------------------------------------------------------------------------- | ||
// ôîðìóëû ðàññ÷åòà ÝÄÑ èñòî÷íèêîâ | ||
PType Ef(PElement* obj, double &time); | ||
PType Eb(PElement* obj, double &time); | ||
PType Ec(PElement* obj, double &time); | ||
//--------------------------------------------------------------------------- | ||
//typedef void __fastcall (__closure *TNotifyEvent)(System::TObject* Sender); | ||
//--------------------------------------------------------------------------- | ||
//--------------------------------------------------------------------------- | ||
class PPinControl; | ||
class PACKAGE PBase : public TGraphicControl // TGraphicControl ïîçâîëÿåò ñäåëàòü êîìïîíåíò ïðîçðà÷íûì | ||
{ | ||
private: | ||
typedef TGraphicControl inherited; | ||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, Classes::TShiftState Shift, int X, int Y); | ||
DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y); | ||
DYNAMIC void __fastcall MouseUp(TMouseButton Button, Classes::TShiftState Shift, int X, int Y); | ||
std::vector<int> _Pins_Cnt; | ||
int MouseDownPos_X, MouseDownPos_Y; // ãäå áûëà íàæàòà êíîïêà ìûøè | ||
bool _Drag; // ôëàã íåðåíîñà | ||
int _LEFT_, _RIGHT_, _TOP_,_BOTTOM_; // íîìåð êàêîé ãðóïïû âûâîäîâ ñ êàêîé | ||
// ñòîðîíû äîëæåí áûòü îòîáðàæåí | ||
// (íåîáõîäèì äëÿ ïîâîðîòà êîìïîíåíòà) | ||
PPinControl* PinControl (PPin *pin); // âîçâðàùàåò ãðàô.îáúåêò àññîöèèðîâàííûé ñ âûâîäîì | ||
void __fastcall PinMouseDown(TObject* Sender, TMouseButton Button, Classes::TShiftState Shift, int X, int Y); | ||
void __fastcall PinDragDrop (System::TObject* Sender, System::TObject* Source, int X, int Y); | ||
void __fastcall PinDragOver(System::TObject* Sender, System::TObject* Source, int X, int Y, TDragState State, bool &Accept); | ||
int __fastcall XtoParent(int x); | ||
int __fastcall YtoParent(int y); | ||
protected: | ||
TPopupMenu *Menu; // êîíòåêòíîå ìåíþ | ||
virtual void __fastcall MenuItemClick(TObject *Sender); // âûçûâàåòñÿ ïðè êëèêå íà ýëåìåíò ìåíþ | ||
PElement *_Obj; | ||
virtual void __fastcall SetParent(TWinControl* AParent); | ||
void createPins(); // ñîçäàòü îáúåêòû ãðàô.ïðåäñòàâëåíèÿ âûâîäîâ | ||
vector<PPinControl*> pList; // ñïèñîê ãðàôè÷åñêèõ îáúåêòîâ âûâîäîâ | ||
public: | ||
//typedef TCustomControl inherited; | ||
//void __fastcall CreateParams(TCreateParams &Params); // overriding TWinControl::CreateParams | ||
//void __fastcall SetBounds( int left, int top, int width, int height); // overriding TWinControl::SetBounds | ||
//void __fastcall WndProc( Messages::TMessage &message); | ||
__fastcall PBase(TComponent* Owner); | ||
__fastcall ~PBase(); | ||
virtual void __fastcall Paint(void); // âûçûâàåòñÿ ðîäèòåëåì ïðè ïðîñèñîâêå êîìïîíåíòà | ||
__property DragKind = {default=0}; | ||
__property DragMode = {default=0}; | ||
__property OnMouseDown ; | ||
__property OnMouseMove ; | ||
__property OnMouseUp ; | ||
__property OnEndDrag = {default=0}; | ||
__property OnStartDrag = {default=0}; | ||
TNotifyEvent OnChange; | ||
TMouseEvent OnPinMouseDown; // ñîáûòèå âîçíèêàåò ïðè êëèêå ïî âûâîäó | ||
TDragDropEvent OnPinDragDrop; // âîçíèêàåò â êîíöå ïåðåòàñêèâàíèÿ íà îáúåêò | ||
TDragOverEvent OnPinDragOver; // âîçíèêàåò â êîíöå ïåðåòàñêèâàíèÿ íà îáúåêò | ||
void Obj(PElement *obj); // àññîöèèèðóåì ñèëîâîé îáúåêò ñ êîìïîíåíòîì | ||
PElement * Obj(); // àññîöèèèðóåì ñèëîâîé îáúåêò ñ êîìïîíåíòîì | ||
PElement* ObjType(String ClassName); // ñîçäàåì îáúåêò è àññîöèèðóåì åãî ñ êîìïîíåíòîì | ||
TNotifyEvent OnDelete; // Âûçûâàåòñÿ ïðè óäàëåíèè | ||
//virtual void SaveComponentOnly(ostream &stream); // ñîõðàíÿåòñÿ òîëüêî êîìïîíåíò áåç ìîäåëè | ||
//virtual void ReadComponentOnly(istream &stream); // ÷èòàåì òîëüêî êîìïîíåíò áåç ìîäåëè | ||
virtual void Save(ostream &stream); // ñîõðàíèòü êîíòðîë è îáúåêò (saveModel=false ñîõðàíÿåòñÿ òîëüêî êîìïîíåíò áåç ìîäåëè ) | ||
virtual void Read(istream &stream); // çàãðóçèòü êîíòðîë è îáúåêò | ||
__published: | ||
}; | ||
//--------------------------------------------------------------------------- | ||
// Power Pin Control - Ãðàôè÷åñêîå ïðåäñòàâëåíèå âûâîäà îò óñòðîéñòâà | ||
class PPinControl : public TShape{ | ||
private: | ||
PPin* _Pin; | ||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, Classes::TShiftState Shift, int X, int Y); | ||
DYNAMIC void __fastcall DragOver(System::TObject* Source, int X, int Y, TDragState State, bool &Accept); | ||
DYNAMIC void __fastcall DragDrop (System::TObject* Source, int X, int Y); | ||
int savedWidth, savedHeight; // äëÿ çàïîìèíàíèÿ ðàçìåðîâ | ||
TColor savedColor; | ||
protected: | ||
void __fastcall MouseEnter(TMessage& Msg); | ||
void __fastcall MouseLeave(TMessage& Msg); | ||
#pragma warn -8027 | ||
BEGIN_MESSAGE_MAP | ||
VCL_MESSAGE_HANDLER(CM_MOUSEENTER,TMessage,MouseEnter); | ||
VCL_MESSAGE_HANDLER(CM_MOUSELEAVE,TMessage,MouseLeave); | ||
END_MESSAGE_MAP(TShape); | ||
#pragma warn -8027 | ||
public: | ||
__fastcall PPinControl(TComponent* Owner); | ||
__fastcall ~PPinControl(); | ||
PPin* Pin(); // âîçâðàùàåì âûâîä | ||
void Pin(PPin* pin); // óñòàíîâèì âûâîä | ||
TMouseEvent OnMouseDown; // ñîáûòèå âîçíèêàåò ïðè êëèêå ïî âûâîäó | ||
TDragOverEvent OnDragOver; // âîçíèêàåò â êîíöå ïåðåòàñêèâàíèÿ íà îáúåêò | ||
TDragDropEvent OnDragDrop; // âîçíèêàåò â êîíöå ïåðåòàñêèâàíèÿ íà îáúåêò | ||
typedef void __fastcall (__closure *PinNotifyEvent)(PPinControl* Sender); | ||
PinNotifyEvent OnDelete; // Âûçûâàåòñÿ ïðè óäàëåíèè | ||
}; | ||
//--------------------------------------------------------------------------- | ||
class Pair_PinConrtol{ | ||
public: | ||
PPinControl* First; | ||
PPinControl* Second; | ||
}; | ||
//--------------------------------------------------------------------------- | ||
class PLinkComponent{ | ||
vector<Pair_PinConrtol> Links; | ||
void __fastcall MenuItemClick(TObject *Sender); | ||
TPopupMenu* Menu; // ìåíþ äàííîé ñâÿçè | ||
int menuFor; // äëÿ êàêîãî ýëåìåíòà îáîáðàæåíî ìåíþ | ||
void __fastcall PinDelete(PPinControl *pc); // âûçûâàåòñÿ ïðè óäàëåíèè êîìïîíåíòà âûâîäà | ||
void Change(); // âûçûâàåòñÿ ïðè èçìåíåíèè êîìïîíåíòîâ ñâÿçè | ||
public: | ||
void Add (Pair_PinConrtol link); // äîáàâèòü íîâóþ ïàðó | ||
void Delete(PPinControl* pc); // óäàëèòü ñâÿçè, ãäå ïðèñóòñòâóåò óêàçàííûé âûâîä | ||
void Delete(PPin* pin); // óäàëèòü ñâÿçè, ãäå ïðèñóòñòâóåò óêàçàííûé âûâîä | ||
Pair_PinConrtol& operator[](int i); | ||
int Count(); | ||
int FindAtPos(int X, int Y); // ïîèñê ëèíèè ïî êîîðäèíàòàì | ||
PLinkComponent(TComponent *owner); | ||
PLinkComponent operator=(const PLinkComponent &Obj);// ïðèñâàèâàíèå | ||
~PLinkComponent(); | ||
void ShowMenuFor(int LinkNumber); // ïîêàçàòü ìåíþ äëÿ çàäàííîé ñâÿçè | ||
void ShowMenuFor(int X, int Y); // ïîêàçàòü ìåíþ äëÿ ñâÿçè ñ çàäàííûìè êîîðäèíàòàìè | ||
void __fastcall Paint(); // ïðîðèñîâûâàåò ñâÿçè | ||
TForm* Parent; // êîìïîíåíò íà êîòîðîì ðèñóåì | ||
TComponent* Owner; // êîìïîíåíò-âëàäåëåö | ||
void Save(ostream &stream); // ñîõðàíèòü êîíòðîë è ñâÿçè | ||
void Read(istream &stream); // çàãðóçèòü êîíòðîë è ñâÿçè | ||
void __fastcall (__closure *OnDelete)(PLinkComponent* Sender); // Âûçûâàåòñÿ ïðè óäàëåíèè ñâÿçè | ||
void __fastcall (__closure *OnAdd)(PLinkComponent* Sender); // âûçûâàåòñÿ ïðè èçìåíåíèè ñâÿçåé | ||
void Clear(); | ||
}; | ||
//--------------------------------------------------------------------------- | ||
#endif |
Binary file not shown.
Oops, something went wrong.