00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SCRIBBLEMGR_H_
00020 #define SCRIBBLEMGR_H_
00021
00022 #include <liberscribble/scb.h>
00023 #include "goo/gtypes.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00048 class Controller;
00049 class CScribbleMgr
00050 {
00051 private:
00052 ScbPath path;
00053 ScbDocPtr doc;
00054 ScbPagePtr page;
00055 ScbStrokePtr stroke;
00056 int pageNumber;
00057 ScbDevPoint pagePoint;
00058 ScbDevPoint point;
00059 ScbPageId id;
00060 ScbPageEraseCtx eraseCtx;
00061 GBool bErased;
00062 GBool bScbDirty;
00063
00064 private:
00066 void beginStroke(const int pn, Controller * ctrl,
00067 const int px, const int py,
00068 const int x, const int y,
00069 const int ox, const int oy);
00070 void addPoint(const int pn, Controller * ctrl,
00071 const int px, const int py,
00072 const int x, const int y,
00073 const int ox, const int oy);
00074 void endStroke(const int pn, Controller * ctrl,
00075 const int px, const int py,
00076 const int x, const int y,
00077 const int ox, const int oy);
00078 void endStroke(Controller * ctrl,
00079 const int px, const int py,
00080 const int x, const int y);
00081
00083 void drawScribblePagePortrait(ScbPagePtr, Controller * ctrl,
00084 const int x, const int y);
00085 void drawScribblePageLandscape(ScbPagePtr, Controller * ctrl,
00086 const int x, const int y);
00087 void drawErasedStrokesPortrait(ScbStrokesPtr, Controller * ctrl,
00088 const int x, const int y);
00089 void drawErasedStrokesLandscape(ScbStrokesPtr, Controller * ctrl,
00090 const int x, const int y);
00091 void drawStroke(ScbStrokePtr stroke, Controller * ctrl,
00092 const int px, const int py);
00093 void drawStrokeDirectly(ScbStrokePtr stroke, Controller * ctrl);
00094 int calLineSize(const int penSize, const double strokeZoom, const double dispZoom);
00095
00096 void setScbDirty(const GBool b = gTrue);
00097 GBool isScbDirty() const { return bScbDirty; }
00098
00099
00100 public:
00101 CScribbleMgr(void);
00102 ~CScribbleMgr(void);
00103
00104 public:
00105 void open(const char *);
00106 void close(GBool bSave = gTrue);
00107 void save();
00108 void generatePageId(ScbPageIdPtr pid, const int pn);
00109 ScbDocPtr getScbDoc() { return doc; }
00110
00112
00113 void onScribblePress(const int pn, Controller * ctrl,
00114 const int px, const int py,
00115 const int x, const int y,
00116 const int ox, const int oy);
00117 void onScribbleMove(const int pn, Controller * ctrl,
00118 const int px, const int py,
00119 const int x, const int y,
00120 const int ox, const int oy);
00121 void onScribbleRelease(const int pn, Controller * ctrl,
00122 const int px, const int py,
00123 const int x, const int y,
00124 const int ox, const int oy);
00125
00127 void onErasePress(const int pn, Controller * ctrl,
00128 const int x, const int y,
00129 const int ox, const int oy);
00130 void onEraseMove(const int pn, Controller * ctrl,
00131 const int x, const int y,
00132 const int ox, const int oy);
00133 void onEraseRelease(const int pn, Controller * ctrl,
00134 const int x, const int y,
00135 const int ox, const int oy);
00136 GBool isEraseDirty() const { return bErased; }
00137 void setEraseDirty(GBool b = gTrue);
00138
00140 void drawScribblePage(const int pn, Controller * ctrl,
00141 const int x, const int y);
00142 };
00143
00144 #endif