The dictionary generated from my class Drag has some sort of problem with the destructor: g++ -fPIC -I/usr/X11R6/include -I/usr/include/g++ -I/oscar/public/root/include -c dictionary.cc dictionary.cc: In function `int G__Drag_DragcLcLwADrag_9_0(struct G__value *, char *, struct G__param *, int)': dictionary.cc:319: aggregate value used where an integer was expected /* Drag */ static int G__Drag_DragcLcLwADrag_9_0(G__value *result7,char *funcname,struct G__param *libp,int hash) { G__letint(result7,105,(long)((Drag*)(G__getstructoffset()))->Drag::~Drag()); return(1); } Note that this compiler error does NOT occur when Drag.h is rootcinted separately. Only when I am attempting to create a rootcint dictionary of my entire 40-file source tree at once. brannon@surf ~/rs/VisionMagick/terry : rootcint dicttest.cc -c -I/usr/X11R6/include -I/usr/include/g++ -I/oscar/public/root/include Drag.h LinkDef.h Limitation: macro handled as typedef int __PTRDIFF_TYPE__; FILE:/usr/include/_G_config.h LINE:33 Limitation: macro handled as typedef unsignedint __SIZE_TYPE__; FILE:/usr/include/_G_config.h LINE:38 Limitation: can not handle macro _G_signal_return_type void Use +P or -p option FILE:/usr/include/_G_config.h LINE:47 Limitation: macro handled as typedef int _G_sprintf_return_type; FILE:/usr/include/_G_config.h LINE:48 Note: operator new() masked c Note: operator delete() masked c Warning: Link requested for undefined class param FILE: LINE:0 brannon@surf ~/rs/VisionMagick/terry : g++ -fPIC -I/usr/X11R6/include -I/usr/include/g++ -I/oscar/public/root/include -c dicttest.cc brannon@surf ~/rs/VisionMagick/terry : I include Drag.h and Drag.cc below --------------------------- Drag.h ---------------------------- #ifndef _DRAG_H_ #define _DRAG_H_ #include <bool.h> #include "ROI.h" #ifndef __CINT__ #include <X11/Xlib.h> #include <xview/canvas.h> #else struct Display; struct GC; struct Window; struct Event; #endif #include "globals.h" #define FAKE_EXPOSE_EVENT_CODE 0 enum drag_state {INIT, NOT_DRAGGING, PRE_DRAG, FIRST_DRAG, IN_DRAG, DRAG_DONE, POST_DRAG, NEW_DRAG}; enum drag_button {LEFT, MIDDLE, RIGHT}; #include "Rtypes.h" class Drag { protected: drag_state state; Display *display; Window window; GC gc; drag_button button; /* fixed corner */ unsigned int anchor_x, anchor_y; /* movable corner */ unsigned int drag_x, drag_y; virtual void down(int x, int y) = 0; virtual void drag(int x, int y) = 0; /* returns true if drag is complete */ virtual void up() = 0; /* returns true if drag is complete */ virtual void window_exit() = 0; virtual void window_enter() = 0; virtual void window_repaint() = 0; virtual void irrelevant() = 0; public: /* drag coords should never exceed these */ unsigned int max_x, max_y; /* constructors */ Drag(); Drag(drag_button db, Display *d, Window w, unsigned int wd, unsigned int ht); Drag::~Drag(); /* routines to process mouse events */ /* all relevant events should be passed in through this call */ /* returns state of drag after event is processed */ drag_state process_event(Event *event); /* returns the upper left and lower right corners of the ROI */ /* void get_corners(unsigned int & ulx, unsigned int & uly, unsigned int & lrx, unsigned int & lry);*/ /* computes upper left x,y, and w, h based on anchor and drag x,y */ ROI get_roi(); /* these keep the drag coordinates within bounds */ unsigned int clip_x(int x) {return clip(x, 0, max_x);} unsigned int clip_y(int y) {return clip(y, 0, max_y);} /* just like constructor */ void init(drag_button db, Display *d, Window w, unsigned int wd, unsigned int ht); ClassDef(Drag,0) }; #endif ----------------------- Drag.cc --------------------- #include <iostream.h> #include <X11/Xlib.h> #include "Drag.h" #include "Rtypes.h" ClassImp(Drag) Drag::Drag() { state = INIT; display = (Display *)NULL; window = 0; gc = (GC)NULL; } Drag::Drag(drag_button db, Display *d, Window w, u_int wd, u_int ht) { init(db, d, w, wd, ht); } Drag::~Drag() { if (state != INIT) XFreeGC(display, gc); } void Drag::init(drag_button db, Display *d, Window w, u_int wd, u_int ht) { state = NOT_DRAGGING; button = db; display = d; window = w; anchor_x = anchor_y = drag_x = drag_y = 0; max_x = wd; max_y = ht; if (gc == (GC)NULL) { XGCValues gcvalues; gcvalues.foreground = 0xffff; gcvalues.line_style = LineOnOffDash; gcvalues.line_width = 2; gcvalues.function = GXxor; gc = XCreateGC(d, w, GCForeground|GCFunction|GCLineStyle|GCLineWidth, &gcvalues); static char dashes[2] = {8,5}; XSetDashes(d, gc, 0, dashes, 2); } } drag_state Drag::process_event(Event *event) { switch(event_action(event)) { case WIN_REPAINT: window_repaint(); return(state); case LOC_WINENTER: window_enter(); return(state); case LOC_WINEXIT: /* good chance drag is complete */ window_exit(); return(state); case LOC_DRAG: /* need to figure out which mouse button is down */ switch(button) { case LEFT: if (event_left_is_down(event)) { drag(event_x(event), event_y(event)); } else { irrelevant(); } return(state); case MIDDLE: if (event_middle_is_down(event)) { drag(event_x(event), event_y(event)); } else { irrelevant(); } return(state); case RIGHT: if (event_right_is_down(event)) { drag(event_x(event), event_y(event)); } else { irrelevant(); } return(state); default: cerr << "Drag::process_event: shouldn't land here!\a\n"; return(state); } /* look at up and down mouse events */ /* and only change state if the relevant button was manipulated */ case ACTION_SELECT: case MS_LEFT: if (button == LEFT) { if(event_is_down(event)) { down(event_x(event), event_y(event)); } else up(); } else { irrelevant(); } return(state); case ACTION_ADJUST: case MS_MIDDLE: if (button == MIDDLE) { if(event_is_down(event)) { down(event_x(event), event_y(event)); } else up(); } else { irrelevant(); } return (state); case ACTION_MENU: case MS_RIGHT: if (button == RIGHT) { if(event_is_down(event)) { down(event_x(event), event_y(event)); } else up(); } else { irrelevant(); } return(state); default: irrelevant(); return(state); } } ROI Drag::get_roi() { ROI r; if (anchor_x <= drag_x && anchor_y <= drag_y) { r.x = anchor_x; r.y = anchor_y; } else if (anchor_x <= drag_x && anchor_y > drag_y) { r.x = anchor_x; r.y = drag_y; } else if (anchor_x > drag_x && anchor_y <= drag_y) { r.x = drag_x; r.y = anchor_y; } else if (anchor_x > drag_x && anchor_y > drag_y) { r.x = drag_x; r.y = drag_y; } r.w = abs(drag_x - anchor_x); r.h = abs(drag_y - anchor_y); return r; } -- o============o Sending unsolicited commercial e-mail (UCE) to this address Legal Notice is indication of your consent to pay me $120/hour for 1 hour o============o minimum for professional proofreading & technical assessment. Terrence Brannon * brannon@quake.usc.edu * http://quake.usc.edu/~brannon
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET