#include "constants.h" typedef struct { int x; int y; } xy_t; struct { int x; int y; int width; int height; int pos; int gridsize; int gridrowlen; SDL_Color gridcol; SDL_Color gridbgcol; SDL_Color bgcol; } obox; struct { int x; int y; int width; int height; int gridsize; int gridrowlen; SDL_Color gridcol; SDL_Color bgcol; } toolbox; struct { int x; int y; int width; int height; int offset; } mapbox; typedef struct { char text[BUFLEN]; int x; int y; int w; int h; /* top bit of c.unused says whether or not this is a flow */ SDL_Color c; int anchor; } text_t; typedef struct { int srcobj; int srcxoff; int srcyoff; int dstobj; int dstxoff; int dstyoff; int npoints; xy_t point[MAXPOINTS]; /* top bit of c.unused says whether or not this is a flow */ SDL_Color col; int style; } link_t; typedef struct { int type; /* line, square */ int x1,y1; int x2,y2; SDL_Color c; SDL_Color fc; } vector_t; typedef struct { int w; int h; vector_t vector[MAXVECTORSPERIMAGE]; int vnum; } vectorimg_t; typedef struct { char name[BUFLEN]; int canscale; int defw; int defh; vectorimg_t vimg; } object_t; //struct { // vectorimg_t vect; // char name; //} letter[MAXLETTERVECTS]; typedef struct { int id; int type; } thing_t; object_t objtype[MAXOBJTYPES]; typedef struct { int type; /* index into objtype[] */ int x; int y; int w; int h; int child; /* fillcol.unused top bit unused says whether or not this is a flow */ /* (fillcol.unused & 1) == 1 means to fill with this colour */ /* (fillcol.unused & 1) == NOCOLOUR means to ignore this*/ SDL_Color fillcol; } mapobject_t; typedef struct { int type; /* index into objtype[] */ int x; int y; int w; int h; int child; } mapobject099a_t; typedef struct { char name[BUFLEN]; SDL_Surface *img; } button_t; button_t button[MAXBUTTONS]; typedef struct { int width; int height; int bpp; SDL_Color bgcol; SDL_Color boxcol; int numthings; int numobjects; int numlinks; int numtext; int selecteditem; int selecteditemtype; int selectedlinkpoint; int selectedtype; int curobj; /* object being moved/dragged/etc */ int curlink; /* link being moved/dragged/etc */ int curlinkpoint; /* link point being moved/dragged/etc */ int curtext; /* text being moved/dragged/etc */ int startx,starty; int textanchor; char text[BUFLEN]; char name[BUFLEN]; /* actual data */ text_t textob[MAXTEXT]; mapobject_t obj[MAXOBJECTS]; thing_t thing[MAXOBJECTS + MAXLINKS]; link_t olink[MAXLINKS]; } map_t; map_t map[MAXMAPS]; char typedesc[6][BUFLEN]; void adjustendpoint(SDL_Surface *screen, int *adjx, int *adjy, double x1, double y1, double x2, double y2, int arrowstyle, int arrowpos ); void addlinkpoint(int linkid, int x, int y); int addvector(vectorimg_t *vimg, int type, int x1, int y1, int x2, int y2, SDL_Color *c, SDL_Color *fc); void changegridsize(void); void changelinearrow(int changeby); void changelinestyle(int changeby); void changelinethickness(int changeby); void changemap(int newmap); void changestate(int newstate); void cleanup(void); void copy(void); int createobject(int type, int x, int y); void calcmapdimensions(void); void copyline(SDL_Surface *screen,int x1, int y1, int x2, int y2, int *lbuf); void deletething(int id, int type); void deletelink(int linkid); void deleteobject(int oid ); void deletetext(int textid); int dosearch(void); int dosearchnext(void); void drawarrowhead(SDL_Surface *screen, double x1, double y1, double x2, double y2, SDL_Color c, int arrowstyle, int arrowpos); void drawarrowheadSVG(double x1, double y1, double x2, double y2, SDL_Color c, int arrowstyle, int arrowpos); void lerp(int *newx, int *newy, int ax, int ay, int bx, int by, float t); void drawbezier(SDL_Surface *screen, int x1, int y1, int x2,int y2, int x3,int y3, int x4,int y4, SDL_Color c); void drawbox(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c, SDL_Color *fc); void drawellipsepoints(SDL_Surface *screen, int x1, int y1, int x, int y, SDL_Color c); void drawellipse(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); void drawflowbox(SDL_Surface *dest, int oid, int otype); void drawcolorchart(SDL_Surface *dest); void drawmaplist(SDL_Surface *dest); void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c, int linestyle); void drawlinebehind(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); void drawlink(SDL_Surface *dest, link_t *l); void drawlinkSVG(link_t *l); void drawobject(SDL_Surface *dest, mapobject_t *o, int doublebuffer, int adjust); void drawobjectSVG(SDL_Surface *dest, mapobject_t *o, int doublebuffer); void drawpixel(SDL_Surface *screen, int x, int y, SDL_Color c); void drawmap(void); void drawmapbox(void); void drawobox(void); void drawscreen(void); void drawsearchflash(void); void drawstatusbar(void); void drawtext(SDL_Surface *dest, text_t *t, int adjust); void drawtextat(SDL_Surface *dest, int x, int y, char *text, int size, SDL_Color c); void drawtextSVG(text_t *t); void drawtoolbox(void); void drawtoolboxselector(int buttonid, int altcolour); void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h,SDL_Color *overridefg, SDL_Color *overridebg ); void drawvectorSVG(vectorimg_t *vimg, int x, int y, int w, int h, SDL_Color *overridefg, SDL_Color *overridebg); int drawSVG(char *svgfilename); void drawxscrollbar(void); void drawyscrollbar(void); void drillto(int mapnum); int endobjmove(int x, int y); int endresize(int x, int y); int endtextresize(int x, int y); int endlink(int x, int y); int endlinkmove(int x, int y); int endlinkdstmove(int x, int y); int endlinkpointmove(int x, int y); int endlinksrcmove(int x, int y); int endtext(void); int endtextedit(void); int endtextmove(int x, int y); void endSVG(void); int findpointpos(link_t *l, int px, int py); void floodfill(SDL_Surface *dest, int x, int y, SDL_Color fillcol); void floodfill2(SDL_Surface *dest, int x, int y, SDL_Color fillcol, SDL_Color bgcol); void floodfill3(SDL_Surface *dest, int x1, int x2, int y, SDL_Color fillcol, SDL_Color bgcol); void floodfill4(SDL_Surface *dest, int x, int y, SDL_Color fillcol, SDL_Color bgcol); int getcolor(SDL_Surface *dest, int x, int y, SDL_Color *col); int getmousepos(int x, int y); void drawyn(char *prompt); int getyn(int x, int y); void goback(void); int linelen(int x1,int y1,int x2,int y2); int linkat(int x, int y); int loadmap(void); void lowerselected(int amt); int objat(int x, int y); void paste(void); void pasteline(SDL_Surface *screen, int *lbuf); void pop(int *x, int *y); void push(int x, int y); int initgraphics(void); void initmap(int mapnum); int initobject(int onum); int isinhistory(int mapid); int isflow(int oid, int otype); int isonline (int fx, int fy, int x1, int y1, int x2, int y2); int isonlink(int linkid, int mx, int my); int isonlinkdst(int lineid, int mx, int my); int isonlinkpoint(int lineid, int mx, int my); int isonlinksrc(int lineid, int mx, int my); int isonmap (int x, int y); int isonobox (int x, int y); int isontoolbox (int x, int y); int isonmapbox (int x, int y); int isonmapboxchildren (int x, int y); int isonmapname (int x, int y); int isongoback (int x, int y); int isonxscrollbar(int x, int y); int isonyscrollbar(int x, int y); void initvars(void); void raiseselected(int amt); void seterror(int errnum); void setinfo(int infonum); void setsearchflash(int num); void setmod(int tf); int savemap(void); void scrollmaplist(int amt); void scrollobox(int amt); int showfiledialog(void); void startedittext (int o); int startlink (int x, int y); int startlinkdstmove(int x, int y); int startlinkpointmove(int x, int y); int startlinksrcmove(int x, int y); int startlinkmove(int x, int y); int startobjmove(int x, int y); int startresize (int x, int y); int startresizetext (int x, int y); int startSVG(char *svgfilename); int starttextmove(int x, int y); int textat(int x, int y); void toggleflow(int oid, int otype); void togglegrid(void); int thingat(int x, int y); int updatefilename(void); int updatelinkshadow(int x, int y); int updatelinkpointshadow(int x, int y); int updatemoveshadow(int x, int y); int updateresizeshadow(int x, int y); int updateresizetextshadow(int x, int y); int updatetextcursor(void); int updatetextshadow(int x, int y); void updatewm(void); void validatescreenpos(void);