00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _DRAWPALETTE_H_
00032 #define _DRAWPALETTE_H_
00033
00034 #include <fx.h>
00035
00036
00037 #include "DataFunc.h"
00038
00039
00040
00041
00042
00043
00044 class DrawPaletteDialog : public FXDialogBox
00045 {
00046 FXDECLARE(DrawPaletteDialog)
00047 private:
00048 FXColorWell *drawfgColourwell;
00049 FXColorWell *drawbgColourwell;
00050 FXTextField *drawstrokeTextfield;
00051
00052 FXTextField *drawxposTextfield;
00053 FXTextField *drawyposTextfield;
00054 FXPopup *drawbasisPopup;
00055 FXOption *drawaxisOption;
00056 FXOption *drawfractionalOption;
00057 FXOption *drawabsoluteOption;
00058 FXOption *drawaxisfractionalOption;
00059 FXOption *drawborderOption;
00060 FXOptionMenu *drawbasisOptionmenu;
00061
00062 FXSwitcher *drawobjectSwitcher;
00063
00064 FXTextField *drawxsizeTextfield;
00065 FXTextField *drawysizeTextfield;
00066 FXPopup *drawsizebasisPopup;
00067 FXOption *drawsizeaxisOption;
00068 FXOption *drawsizefractionalOption;
00069 FXOption *drawsizeabsoluteOption;
00070 FXOption *drawsizeaxisfractionalOption;
00071 FXOption *drawsizeborderOption;
00072 FXOptionMenu *drawsizebasisOptionmenu;
00073
00074 FXTextField *drawtextTextfield;
00075 FXPopup *drawjustifyPopup;
00076 FXOption *drawtljustifyOption;
00077 FXOption *drawtrjustifyOption;
00078 FXOption *drawbljustifyOption;
00079 FXOption *drawbrjustifyOption;
00080 FXOption *drawcjustifyOption;
00081 FXOptionMenu *drawjustifyOptionmenu;
00082
00083 FXTextField *drawimageTextfield;
00084
00085 FXTextField *drawfunctionTextfield;
00086 FXCheckButton *draw2dCheckbutton;
00087
00088
00089 FXCheckButton *drawstartarrowCheckbutton;
00090 FXCheckButton *drawendarrowCheckbutton;
00091 FXTextField *drawarrowlengthTextfield;
00092 FXTextField *drawarrowwidthTextfield;
00093
00094 FXCheckButton *drawstartlCheckbutton;
00095 FXCheckButton *drawendlCheckbutton;
00096 FXCheckButton *drawgradlCheckbutton;
00097 FXCheckButton *drawdistlCheckbutton;
00098
00099 FXColorList *drawitemsColourlist;
00100
00101 DrawPaletteDialog(){}
00102
00103 int startpx, startpy;
00104 int currentpx, currentpy;
00105 double startax, startay;
00106
00107 int totalwidth, totalheight;
00108 int xpixels, ypixels;
00109 int borderleft, borderbottom, bordertop, borderright;
00110
00111 bool drawing;
00112
00113 FXString drawfile;
00114
00115 int updatetarget;
00116
00117 #ifndef WIN32
00118 void coordSort(int &xmin, int &xmax, int &ymin, int &ymax, int spx, int epx, int spy, int epy);
00119 #endif
00120 void constructItemLine(int idx);
00121 void ImageLoad(void);
00122
00123 public:
00124 void setImageCoords(int tw, int th, int xp, int yp, int bl, int bb);
00125 void drawPrimative(FXDCWindow *dcw, double x, double y, int mx, int my, int xpx, int ypx);
00126 void startDraw(double x, double y, int mx, int my, int xpx, int ypx);
00127 void endDraw(FXDCWindow *dcw, double x, double y, int mx, int my, int xpx, int ypx);
00128
00129 long cmdUpdateData(FXObject*, FXSelector, void*);
00130 long cmdUpdatePositionData(FXObject*, FXSelector, void*);
00131 long cmdUpdateAllData(FXObject*, FXSelector, void*);
00132 long cmdItemDelete(FXObject*, FXSelector, void*);
00133 long cmdItemSelect(FXObject*, FXSelector, void*);
00134
00135 long cmdNewLine(FXObject*, FXSelector, void*);
00136 long cmdNewText(FXObject*, FXSelector, void*);
00137 long cmdNewRect(FXObject*, FXSelector, void*);
00138 long cmdNewEllipse(FXObject*, FXSelector, void*);
00139 long cmdNewImage(FXObject*, FXSelector, void*);
00140 long cmdNewFunction(FXObject*, FXSelector, void*);
00141
00142 long cmdItemUp(FXObject*, FXSelector, void*);
00143 long cmdItemDown(FXObject*, FXSelector, void*);
00144
00145 long cmdImageBrowse(FXObject*, FXSelector, void*);
00146
00147 long cmdNew(FXObject*, FXSelector, void*);
00148 long cmdLoad(FXObject*, FXSelector, void*);
00149 long cmdAppend(FXObject*, FXSelector, void*);
00150 long cmdSave(FXObject*, FXSelector, void*);
00151 long cmdSaveAs(FXObject*, FXSelector, void*);
00152
00153 enum { ID_DRAW_NEWLINE = FXDialogBox::ID_LAST, ID_DRAW_NEWTEXT, ID_DRAW_NEWRECT, ID_DRAW_NEWELLIPSE, ID_DRAW_NEWIMAGE, ID_DRAW_NEWFUNCTION,
00154 ID_DRAW_IMAGEBROWSE,
00155 ID_DRAW_ITEMUP, ID_DRAW_ITEMDN, ID_DRAW_CHANGED, ID_DRAW_ITEMSEL,
00156 ID_DRAW_NEW, ID_DRAW_LOAD, ID_DRAW_APPEND, ID_DRAW_SAVE, ID_DRAW_SAVEAS };
00157
00158 DrawPaletteDialog(FXWindow *owner, int target);
00159 virtual ~DrawPaletteDialog();
00160 void hide(void);
00161
00162 FXString drawdirectory;
00163
00164
00165
00166 struct primative
00167 {
00168 enum typemode { LINE, TEXT, RECT, ELLIPSE, IMAGE, FUNCTION } type;
00169 FXColor fg;
00170 FXColor bg;
00171 int stroke;
00172 float position[2];
00173 enum axismode { AXISABS, IMAGEFRAC, IMAGEABS, AXISFRAC, BORDERFRAC } posmode;
00174 float dimensions[2];
00175 enum axismode dimmode;
00176 FXString *text;
00177 enum justification { TL, TR, BL, BR, C } justify;
00178 bool arrow[2];
00179 float arrowsize[2];
00180 FXString *file;
00181 unsigned int imageid;
00182 bool validimage;
00183 FXString *func;
00184 CDataFunc *datafunc;
00185 bool twod;
00186 bool startendgrad[4];
00187 } *primatives;
00188 int nPrimatives;
00189
00190 private:
00191 void createPrimative(primative::typemode p);
00192 void newPrimative(primative::typemode p);
00193 void deletePrimative(int idx);
00194
00195 };
00196
00197 #endif