📄 rlplot.h
字号:
typedef struct _fmt_txt_info {
int tag;
char *txt;
}fmt_txt_info;
public:
fmtText(anyOutput *o, int x, int y, char *txt);
~fmtText();
bool StyleAt(int idx, TextDEF *txt_def, int *style, int *font);
int rightTag(char *txt, int cb);
int leftTag(char *txt, int cb);
void cur_right(int *pos);
void cur_left(int *pos);
bool oGetTextExtent(anyOutput *o, int *width, int *height, int cb);
void SetText(anyOutput *o, char *txt, int *px, int *py);
void DrawText(anyOutput *o);
private:
bool SetTextDef(TextDEF *td, int idx);
bool Parse();
void DrawBullet(anyOutput *o, int x, int y, int type, double size, DWORD lc, DWORD fc);
void DrawFormatted(anyOutput *o);
char *src;
POINT pos;
int n_split;
fmt_txt_info *split_text;
};
class DataObj{public: int cRows, cCols; EditText ***etRows; DataObj(); ~DataObj(); virtual bool Init(int nRows, int nCols); virtual bool SetValue(int row, int col, double val); virtual bool SetText(int row, int col, char *txt);
virtual bool GetValue(int row, int col, double *v); virtual bool GetText(int row, int col, char *txt, int len);
char ** GetTextPtr(int row, int col);
virtual bool GetResult(anyResult *r, int row, int col, bool use_last = false); virtual bool GetSize(int *width, int *height); virtual bool Select(POINT *p){return false;}; virtual bool WriteData(char *FileName) {return false;}; virtual bool AddCols(int nCols){return false;}; virtual bool AddRows(int nRows){return false;}; virtual bool ChangeSize(int nCols, int nRows, bool bUndo){return false;}; virtual bool Command(int cmd, void *tmpl, anyOutput *o){return false;}; virtual bool ReadData(char *, unsigned char *, int){return false;}; virtual void FlushData();
};
class StrData {
public:
StrData(DataObj *par, RECT *rc = 0L);
~StrData();
bool GetSize(int *w, int *h);
void StrData::RestoreData(DataObj *dest);
private:
int pw, ph;
RECT drc;
DataObj *src;
char ***str_data;
};
class HatchOut:public anyOutput {public: HatchOut(anyOutput *Parent); ~HatchOut(); bool SetFill(FillDEF *fill); bool StartPage(); bool oCircle(int x1, int y1, int x2, int y2, char *nam = 0L); bool oSphere(int cx, int cy, int r, POINT *pts, int cp, char *nam = 0L); bool oRectangle(int x1, int y1, int x2, int y2, char *nam = 0L); bool oPolygon(POINT *pts, int cp, char *nam = 0L);private: anyOutput *out; double xbase, ybase; LineDEF ParLineDef, MyLineDef; bool ParInit; int ho, ht; DWORD ParLinPat; RECT UseRect; struct { int cx, cy, r; }circ_grad; bool PrepareParent(bool Restore); bool DoHatch(); bool MkPolyLine(POINT *p, anyOutput *o); bool HatchLine(POINT p1, POINT p2); bool HatchArc(int x, int y, int r, int qad, bool start); bool IsInside(POINT p); void Lines000(); void Lines090(); void Lines045(); void Lines315(); void Stipple(int type); void Zigzag(); void Combs(); void BricksH(); void BricksV(); void Bricks045(); void Bricks315(); void Texture1(); void Texture2(); void Arcs(int type); void Waves2(); void Herringbone(); void Circles(); void Grass(); void Foam(); void Recs(); void CircGrad();};class GraphObj {public: unsigned long Id; //accepts an identifier during read from file // it is set to an object identifier after // construction GraphObj *parent; DataObj *data; int type, moveable; RECT rDims; char *name; GraphObj(GraphObj *par, DataObj *d); virtual ~GraphObj(); virtual double GetSize(int select); virtual bool SetSize(int select, double value){return false;}; virtual DWORD GetColor(int select); virtual bool SetColor(int select, DWORD col) {return false;}; virtual void DoPlot(anyOutput *target){return;}; virtual void DoMark(anyOutput *target, bool mark){return;}; virtual bool Command(int cmd, void *tmpl, anyOutput *o){return false;}; virtual bool PropertyDlg(){return false;}; virtual void RegGO(void *n);
virtual bool FileIO(int rw) {return false;}; virtual void * ObjThere(int x, int y); virtual void Track(POINT *p, anyOutput *o);
};class ssButton:public GraphObj {public: ssButton(GraphObj *par, int x, int y, int w, int h); ~ssButton(); void DoPlot(anyOutput *o); void DoMark(anyOutput *target, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o);private: bool bLBdown, bSelected; TextDEF TextDef; LineDEF Line; FillDEF Fill;};class dragHandle:public GraphObj {public: dragHandle(GraphObj *par, int type); ~dragHandle(); void DoPlot(anyOutput *o); bool Command(int cmd, void *tmpl, anyOutput *o); void * ObjThere(int x, int y); void Track(POINT *p, anyOutput *o);private: RECT upd, drec, *minRC, *maxRC; LineDEF LineDef; FillDEF FillDef;};class dragRect:public GraphObj {public: dragRect(GraphObj *par, int type); ~dragRect(); double GetSize(int select){return parent->GetSize(select);}; DWORD GetColor(int select){return parent->GetColor(select);}; void DoPlot(anyOutput *o); bool Command(int cmd, void*tmpl, anyOutput *o); void * ObjThere(int x, int y);private: dragHandle **handles;};class Drag3D:public GraphObj {public: Drag3D(GraphObj *par); ~Drag3D(); double GetSize(int select){return parent->GetSize(select);}; void DoPlot(anyOutput *o); void * ObjThere(int x, int y);private: dragHandle **handles;};class FrmRect:public GraphObj {public: FrmRect(GraphObj *par, fRECT *limRC, fRECT *cRC, fRECT *chld); ~FrmRect(); double GetSize(int select); bool SetSize(int select, double value); bool SetColor(int select, DWORD col); void DoMark(anyOutput *o, bool mark); void DoPlot(anyOutput *o); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(){return parent ? parent->Command(CMD_CONFIG, 0L, 0L) : false;}; void * ObjThere(int x, int y); void Track(POINT *p, anyOutput *o);private: RECT *minRC, *maxRC; anyOutput *mo; RECT mrc; dragRect *drag; bool swapX, swapY; fRECT *limRC, *cRC, *chldRC, CurrRect; LineDEF Line, FillLine; FillDEF Fill;};class svgOptions:public GraphObj{public: svgOptions(int src); ~svgOptions(); bool FileIO(int rw);private: char *script, *svgattr;};class Symbol:public GraphObj{public: int idx; Symbol(GraphObj *par, DataObj *d, double x, double y, int which, int xc = -1, int xr = -1, int yc = -1, int yr = -1); Symbol(int src); ~Symbol(); double GetSize(int select); bool SetSize(int select, double value); DWORD GetColor(int select); bool SetColor(int select, DWORD col); void DoPlot(anyOutput *target); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw);private: lfPOINT fPos; POINT *ssRef; long cssRef; double size; LineDEF SymLine; FillDEF SymFill; TextDEF *SymTxt;};class Bubble:public GraphObj{public: Bubble(GraphObj *par, DataObj *d, double x, double y, double s, int which, FillDEF *fill, LineDEF *outline, int xc = -1, int xr = -1, int yc = -1, int yr = -1, int sc = -1, int sr = -1); Bubble(int src); ~Bubble(); void DoPlot(anyOutput *o); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw);private:
bool DoAutoscale(anyOutput *o);
lfPOINT fPos; double fs; LineDEF BubbleLine, BubbleFillLine; FillDEF BubbleFill; POINT pts[5]; POINT *ssRef; long cssRef;};class Bar:public GraphObj {public: Bar(GraphObj *par, DataObj *d, double x, double y, int which, int xc = -1, int xr = -1, int yc = -1, int yr = -1); Bar(int src); ~Bar(); double GetSize(int select); bool SetSize(int select, double value); bool SetColor(int select, DWORD col); void DoPlot(anyOutput *target); void DoMark(anyOutput *o, bool mark);
bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw);private: anyOutput *mo;
RECT mrc;
double size; LineDEF BarLine, HatchLine; FillDEF BarFill; lfPOINT fPos, BarBase; POINT *ssRef; long cssRef;};class DataLine:public GraphObj{public: bool isPolygon, dirty; lfPOINT *Values; lfPOINT min, max; LineDEF LineDef; long nPnt, nPntSet, cp; DWORD BgColor; POINT *pts; char *ssXref, *ssYref; anyOutput *mo; RECT mrc; DataLine(GraphObj *par, DataObj *d, char *xrange=0L, char *yrange=0L); DataLine(GraphObj *par, DataObj *d, lfPOINT *val, long nval); DataLine(int src); ~DataLine(); bool SetColor(int select, DWORD col); virtual void DoPlot(anyOutput *target); virtual void DoMark(anyOutput *o, bool mark); virtual bool Command(int cmd, void *tmpl, anyOutput *o); virtual bool PropertyDlg(); virtual bool FileIO(int rw); void FileValues(char *name, int type, double start, double step); void SetValues(); void LineData(lfPOINT *val, long nval);
void DrawSpline(anyOutput *target);};class DataPolygon:public DataLine{public: DataPolygon(GraphObj *par, DataObj *d, char *xrange=0L, char *yrange=0L); DataPolygon(int src); ~DataPolygon(); void DoPlot(anyOutput *target); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw);private: FillDEF pgFill; LineDEF pgFillLine;};class RegLine:public GraphObj{public: RegLine(GraphObj *par, DataObj *d, lfPOINT *values, long n, int type); RegLine(int src); ~RegLine(); double GetSize(int select); void DoPlot(anyOutput *o); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw); void Recalc(lfPOINT *values, long n);
LineDEF *GetLine(){return &LineDef;};private: long nPoints, cp; double mx, my; LineDEF LineDef; fRECT lim, uclip; lfPOINT l1, l2, l3, l4, l5; DWORD BgColor; POINT *pts;};class SDellipse:public GraphObj{public: SDellipse(GraphObj *par, DataObj *d, lfPOINT *values, long n, int sel); SDellipse(int src); ~SDellipse(); void DoPlot(anyOutput *o); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); void RegGO(void *n);
bool FileIO(int rw); void Recalc(lfPOINT *values, long n);private: long nPoints, cp; double sd1, sd2, mx, my; POINT *pts; LineDEF LineDef; fRECT lim; lfPOINT *val; RegLine *rl;};class ErrorBar:public GraphObj{public: ErrorBar(GraphObj *par, DataObj *d, double x, double y, double err, int type, int xc=-1, int xr=-1, int yc=-1, int yr=-1, int ec=-1, int er=-1); ErrorBar(int src); ~ErrorBar(); bool SetSize(int select, double value); bool SetColor(int select, DWORD col); void DoPlot(anyOutput *target); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw);private: lfPOINT fPos; double ferr, SizeBar; POINT ebpts[6]; LineDEF ErrLine; POINT *ssRef; long cssRef;};class Arrow:public GraphObj {public: Arrow(GraphObj *par, DataObj *d, lfPOINT fp1, lfPOINT fp2, int which = 0, int xc1=-1, int xr1=-1, int yc1=-1, int yr1=-1, int xc2=-1, int xr2=-1, int yc2=-1, int yr2=-1); Arrow(int src); ~Arrow(); double GetSize(int select); bool SetSize(int select, double value); DWORD GetColor(int select){return LineDef.color;}; bool SetColor(int select, DWORD col); void DoPlot(anyOutput *o); void DoMark(anyOutput *o, bool mark); bool Command(int cmd, void *tmpl, anyOutput *o); bool PropertyDlg(); bool FileIO(int rw); void * ObjThere(int x, int y); void Track(POINT *p, anyOutput *o);private: dragHandle *dh1, *dh2; POINT pts[5]; lfPOINT pos1, pos2; double cw, cl; LineDEF LineDef; POINT *ssRef; long cssRef; bool bModified; void Redraw(anyOutput *o);};class Box:public GraphObj {public: Box(GraphObj *par, DataObj *d, lfPOINT fp1, lfPOINT fp2, int which, int xc1=-1, int xr1=-1, int yc1=-1, int yr1=-1, int xc2=-1, int xr2=-1, int yc2=-1, int yr2=-1); Box(int src); ~Box(); double GetSize(int select); bool SetSize(int select, double value); bool SetColor(int select, DWORD col);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -