From edb6d59b81017488b883a3e4020b805b7edbc326 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 15 Nov 2005 03:45:04 +0000 Subject: [PATCH] - Rewrote Command Reference document (simplified and now includes screenshots) - Updated example diagram to use new Traffic Flows feature - Added an additional paste shortcut for windows compatibility ('v') - Grid is now back to being on by default again - Grid is automatically turned off when a new map is loaded. - Grid is automatically turned on when all maps are cleared (via the new map button) - Removed -g from Windows Makefile (since I can't make gdb work under mingw anyway) - Current filename is now displayed in title bar - Modified welcome text - Added new vector shape: Bezier Curve - Redrew Cloud object to use bezier curves instead of lines - Added Copy, Paste and Grid buttons - Combined X&Y position matching into a single button (use RMB for Y position match) - Added Traffic Flow button (LMB = toggle display of flows, RMB = define flows) - 1 bit of "Unused" part of colour struct on links, objects and text is now used to show whether or not to fill this thing. - 2 bit of "Unused" part of colour struct on links, objects and text is now used to show whether or not this thing is a traffic flow. - Fixed bug where first toolbox button hilighted would "stick" - Fixed bug where status text was overwritten during VIDEO_EXPOSE event --- CHANGELOG | 22 ++ Makefile | 16 +- Makefile.freebsd | 3 + Makefile.linux | 3 + Makefile.windows | 4 + buttons.dat | 83 +++- constants.h | 41 +- dist.sh | 2 + example.map | Bin 51361 -> 51361 bytes netmapr.c | 969 +++++++++++++++++++++++++++++++++++------------ netmapr.h | 19 +- objects.dat | 51 +-- windist.sh | 11 + 13 files changed, 895 insertions(+), 329 deletions(-) create mode 100755 windist.sh diff --git a/CHANGELOG b/CHANGELOG index ffea752..28134a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,28 @@ Ideas for future versions: - Implement a toggle-able traffic flow display (for example, you might click a button and have arrows appear to show all SMTP mail flows) +Version 1.4: +- Rewrote Command Reference document (simplified and now includes screenshots) +- Updated example diagram to use new Traffic Flows feature +- Added an additional paste shortcut for windows compatibility ('v') +- Grid is now back to being on by default again +- Grid is automatically turned off when a new map is loaded. +- Grid is automatically turned on when all maps are cleared (via the new map button) +- Removed -g from Windows Makefile (since I can't make gdb work under mingw anyway) +- Current filename is now displayed in title bar +- Modified welcome text +- Added new vector shape: Bezier Curve +- Redrew Cloud object to use bezier curves instead of lines +- Added Copy, Paste and Grid buttons +- Combined X&Y position matching into a single button (use RMB for Y position match) +- Added Traffic Flow button (LMB = toggle display of flows, RMB = define flows) +- 1 bit of "Unused" part of colour struct on links, objects and text is now used to + show whether or not to fill this thing. +- 2 bit of "Unused" part of colour struct on links, objects and text is now used to + show whether or not this thing is a traffic flow. +- Fixed bug where first toolbox button hilighted would "stick" +- Fixed bug where status text was overwritten during VIDEO_EXPOSE event + Version 1.3: - Grid is now off by default - Added keyboard shortcuts ('0' through '9' to select or define) diff --git a/Makefile b/Makefile index dc2aa59..e6f97f0 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,12 @@ netmapr: netmapr.c constants.h netmapr.h Makefile ln -f netmapr netmapr-viewer install: netmapr - install -C -o root -m 755 netmapr /usr/local/bin/netmapr + install -C -D -o root -m 755 netmapr /usr/local/bin/netmapr ln -f /usr/local/bin/netmapr /usr/local/bin/netmapr-viewer - install -C -o root -m 644 buttons.dat /usr/local/share/netmapr/buttons.dat - install -C -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat - install -C -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf - install -C -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp + install -C -D -o root -m 644 buttons.dat /usr/local/share/netmapr/buttons.dat + install -C -D -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat + install -C -D -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf + install -C -D -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp -ss: netmapr.jpg - convert netmapr.jpg -geometry 320x240 netmapr-small.jpg - convert netmapr.jpg -geometry 800x600 netmapr-fm.jpg - +clean: netmapr convert netmapr-viewer + rm -f netmapr convert netmapr-viewer diff --git a/Makefile.freebsd b/Makefile.freebsd index f5918db..a0e0f3b 100644 --- a/Makefile.freebsd +++ b/Makefile.freebsd @@ -8,3 +8,6 @@ install: netmapr install -C -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat install -C -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf install -C -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp + +clean: netmapr convert netmapr-viewer + rm -f netmapr convert netmapr-viewer diff --git a/Makefile.linux b/Makefile.linux index ff1a3ef..e6f97f0 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -9,3 +9,6 @@ install: netmapr install -C -D -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat install -C -D -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf install -C -D -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp + +clean: netmapr convert netmapr-viewer + rm -f netmapr convert netmapr-viewer diff --git a/Makefile.windows b/Makefile.windows index c92eb11..7bc11d6 100644 --- a/Makefile.windows +++ b/Makefile.windows @@ -3,3 +3,7 @@ netmapr: netmapr.c constants.h netmapr.h Makefile convert: convert.c convert.h Makefile gcc -Wall -g convert.c -I/usr/local/include -oconvert -lmingw32 -L/usr/local/lib -lSDLmain -lSDL + + +clean: netmapr convert netmapr-viewer + rm -f netmapr convert netmapr-viewer diff --git a/buttons.dat b/buttons.dat index 7a85eb3..d87b7e1 100644 --- a/buttons.dat +++ b/buttons.dat @@ -21,6 +21,60 @@ line 20 100 60 20 190 190 190 line 100 100 60 20 190 190 190 line 40 60 80 60 190 190 190 end +button copy 120 120 +# corner +line 10 20 30 0 190 190 190 +line 30 0 30 20 190 190 190 +line 10 20 30 20 190 190 190 +# paper +line 10 20 10 70 190 190 190 +line 10 70 40 70 190 190 190 +line 60 40 60 0 190 190 190 +line 60 0 30 0 190 190 190 +# 2nd corner +line 40 60 60 40 190 190 190 +line 40 60 60 60 190 190 190 +line 60 40 60 60 190 190 190 +# 2nd paper +line 40 60 40 110 190 190 190 +line 40 110 90 110 190 190 190 +line 90 110 90 40 190 190 190 +line 90 40 60 40 190 190 190 +end +button paste 120 120 +# clip +line 45 0 55 0 190 190 190 +line 55 0 70 15 190 190 190 +line 45 0 30 15 190 190 190 +line 30 15 70 15 190 190 190 +# board +line 50 5 10 5 190 190 190 +line 10 5 10 90 190 190 190 +line 10 90 50 90 190 190 190 +line 90 40 90 5 190 190 190 +line 90 5 60 5 190 190 190 +# paper +line 90 40 50 40 190 190 190 +line 50 40 50 110 190 190 190 +line 50 110 110 110 190 190 190 +line 110 110 110 60 190 190 190 +line 110 60 90 40 190 190 190 +# fold +line 90 40 90 60 190 190 190 +line 90 60 110 60 190 190 190 +# lines +line 60 50 80 50 190 190 190 +line 60 60 80 60 190 190 190 +line 60 74 95 74 190 190 190 +line 60 86 95 86 190 190 190 +line 60 99 95 99 190 190 190 +end +button grid 120 120 +line 10 35 100 35 190 190 190 +line 10 75 100 75 190 190 190 +line 35 10 35 100 190 190 190 +line 75 10 75 100 190 190 190 +end button fgcol 120 120 # colour box box 10 10 100 70 190 190 190 @@ -76,18 +130,25 @@ box 60 10 100 50 190 190 190 box 60 60 100 100 190 190 190 # lines line 10 10 60 10 150 150 150 -line 10 30 60 30 150 150 150 -line 10 50 60 50 150 150 150 +line 10 10 10 100 150 150 150 +# +line 25 30 60 30 150 150 150 +line 25 30 25 100 150 150 150 +# +line 35 50 60 50 150 150 150 +line 35 50 35 100 150 150 150 end -button matchy 120 120 -#left -box 5 60 45 100 190 190 190 -#right -box 60 60 100 100 190 190 190 -#lines -line 60 10 60 60 150 150 150 -line 80 10 80 60 150 150 150 -line 100 10 100 60 150 150 150 +button flow 120 90 +# t +line 0 10 30 10 190 190 190 +line 15 10 15 40 190 190 190 +# c +line 70 10 40 10 190 190 190 +line 40 10 40 40 190 190 190 +line 40 40 70 40 190 190 190 +# p +box 80 10 105 20 190 190 190 +line 80 20 80 40 190 190 190 end button drilldown 120 120 # down line diff --git a/constants.h b/constants.h index fac3bbe..18e74cc 100644 --- a/constants.h +++ b/constants.h @@ -1,5 +1,6 @@ -#define VERSION "1.3" +#define VERSION "1.4" +#define SMALLBUFLEN 64 #define BUFLEN 512 #define DOUBLECLICKTHRES 250 @@ -40,6 +41,8 @@ #define MAXFILLSTACK 500000 +#define BEZIERQUALITY 50 + #define SHORTCUTSIZE (10) #define OLDMAXVECTORSPERIMAGE (60) @@ -50,9 +53,8 @@ #define OBJSELHANDLEPCT (15) -/* used as a NULL value for colours */ -#define NOCOLOUR (99) -#define USECOLOUR (100) +#define USECOLOUR (0x01) /* used as a NULL value for colours */ +#define ISFLOW (0x02) /* used to show whether things are traffic flows */ #define GRIDBRIGHTNESS 100 @@ -61,7 +63,7 @@ #define T_LINK (2) #define T_TEXT (3) #define T_LINKPOINT (4) -#define T_MAP (5) +#define T_MAP (5) #define O_ROUTER (0) #define O_SWITCH (1) @@ -75,6 +77,7 @@ #define VT_FILL (3) #define VT_ELLIPSE (4) #define VT_FILLBOX (5) +#define VT_BEZIER (6) #define TRUE (-1) #define FALSE (0) @@ -104,23 +107,27 @@ #define S_FILLCOL (22) #define S_EDITTEXT (23) #define S_CHANGEOBJECT (24) +#define S_DRAWFLOW (25) #define TB_POINTER (0) #define TB_ADDOBJ (1) #define TB_ADDTEXT (2) -#define TB_FGCOL (3) -#define TB_FILLCOL (4) -#define TB_LINESTYLE (5) -#define TB_MATCHSIZE (6) -#define TB_MATCHX (7) -#define TB_MATCHY (8) -#define TB_DRILLDOWN (9) -#define TB_CREATETELE (10) -#define TB_DELETEMAP (11) -#define TB_NEW (12) -#define TB_LOAD (13) -#define TB_SAVE (14) +#define TB_COPY (3) +#define TB_PASTE (4) +#define TB_GRID (5) +#define TB_FGCOL (6) +#define TB_FILLCOL (7) +#define TB_LINESTYLE (8) +#define TB_MATCHSIZE (9) +#define TB_MATCHPOS (10) +#define TB_FLOW (11) +#define TB_DRILLDOWN (12) +#define TB_CREATETELE (13) +#define TB_DELETEMAP (14) +#define TB_NEW (15) +#define TB_LOAD (16) +#define TB_SAVE (17) #define SIDEBARW 100 diff --git a/dist.sh b/dist.sh index 115bef2..0b5536a 100755 --- a/dist.sh +++ b/dist.sh @@ -8,6 +8,7 @@ WINFILE=${FULLNAME}-win32.zip mkdir ${FULLNAME} cp README.txt INSTALL.txt Makefile.linux Makefile.freebsd Makefile.windows objects.dat buttons.dat netmapr.c netmapr.h constants.h convert.c convert.h icon.bmp verdana.ttf example.map ${FULLNAME}/ cp -R doc ${FULLNAME}/ +rm -rf ${FULLNAME}/doc/CVS tar zcvf ${TARFILE} ${FULLNAME} rm -rf ${FULLNAME} @@ -15,5 +16,6 @@ rm -rf ${FULLNAME} mkdir ${FULLNAME} cp README.txt INSTALL.txt objects.dat buttons.dat netmapr.exe netmapr.c netmapr.h constants.h convert.c convert.h verdana.ttf example.map icon.bmp windows_files/*.dll ${FULLNAME}/ cp -R doc ${FULLNAME}/ +rm -rf ${FULLNAME}/doc/CVS zip -r ${WINFILE} ${FULLNAME} rm -rf ${FULLNAME} diff --git a/example.map b/example.map index b6483d5cdff900a6c4b0edd5584de7e93ffddf7e..8f97a5bae465bde82c85c4e5491b222a34af709c 100644 GIT binary patch delta 448 zcmZ2Dk$K@nX3j7}J>w(=1qJ5GvaRA96&{E%N=#-H-Nwi?d55UHB_j(11A`tAPY2>A zAl3om|6m{imb;EaZnA)wG$X@g9WiN321cNoy+E7{WJm*Pm>EDO0}~J*0Af?1oCuHx zVUY1aieYjC*o-+KGnj$=t3Wk;K&$~|s{k=f9Zb#@i`?W7U^95cfo6a}HBik(AZ-D} zGC&M71IT130Xhbo+~fptX-3A$HR95;U_ToJ)vW`XGY_Z-WGcuHhPS6MPTnGJ4pjF> z+(HKAjToS~5s(Hs*8qs2RxxdMkT{&h#{}XArRL_Bq$-3KZ~mb6ol)cqPza>M35dCX e7zmg)%e3aR0zA zAl3om|6m{imb;EaZnA)wG-L8)9WiOkWJaKxy+90NNCRn@86Y7hAaMYQO@VSEKpKQW z#sjJ3$qisL=77v#1`1pSs^J4-4IoD4`4HR#DQi2wJ=lz)m#M97C$!3{V^-4RWp$5JRnE*z6#2I7format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask,screen->format->Bmask, - screen->format->Amask); + screen->format->Amask); area.x = toolbox.x + ((selection % 3 )*(toolbox.gridsize+3)); area.y = toolbox.y + ((selection / 3)*(toolbox.gridsize+3)); area.w = toolbox.gridsize+1; @@ -1174,6 +1260,18 @@ int main (int argc, char **argv) { sprintf(statustext, "LMB (on map) = Add text to the map, LMB (on object) = Add text to an object"); drawstatusbar(); break; + case TB_COPY: + sprintf(statustext, "LMB = Copy the current object/text/map"); + drawstatusbar(); + break; + case TB_PASTE: + sprintf(statustext, "LMB = Paste the current copy buffer"); + drawstatusbar(); + break; + case TB_GRID: + sprintf(statustext, "LMB = Toggle grid on/off, RMB = Change grid size"); + drawstatusbar(); + break; case TB_FGCOL: sprintf(statustext, "LMB = Apply default foreground colour to current selection, RMB = Change default foreground colour"); drawstatusbar(); @@ -1196,12 +1294,12 @@ int main (int argc, char **argv) { sprintf(statustext, "LMB = Match size of current selection to next item clicked"); drawstatusbar(); break; - case TB_MATCHX: - sprintf(statustext, "LMB = Match horizontal position of currently selected item to next item clicked"); + case TB_MATCHPOS: + sprintf(statustext, "LMB = Match horizontal position of currently selected item to next item clicked, RMB = match vertical position"); drawstatusbar(); break; - case TB_MATCHY: - sprintf(statustext, "LMB = Match vertical position of currently selected item to next item clicked"); + case TB_FLOW: + sprintf(statustext, "LMB = Toggle display of traffic flows, RMB = Enter traffic flow definition mode"); drawstatusbar(); break; case TB_DRILLDOWN: @@ -1263,7 +1361,7 @@ int main (int argc, char **argv) { case SDL_QUIT: if (modified) { strcpy(text, "Changes not saved - really quit?"); - changestate(S_REALLYQUIT); + changestate(S_REALLYQUIT); drawmap(); } else { done = TRUE; @@ -1456,46 +1554,15 @@ int main (int argc, char **argv) { } } if (c == 'g') { /* toggle snap-to-grid */ - if (grid) { - grid = FALSE; - strcpy(statustext, "Grid mode disabled."); - } else { - grid = TRUE; - strcpy(statustext, "Grid mode enabled."); - } + togglegrid(); drawmap(); } if (c == ';') { /* change gridsize */ - if (++gridsizeindex >= gridsizenum) { - gridsizeindex = 0; - } - gridsize = gridsizelist[gridsizeindex]; - sprintf(statustext, "Grid size set to %d.", gridsize); + changegridsize(); drawmap(); } if (c == 'c') { /* copy */ - if (map[curmap].selecteditem == -1) { - /* copy entire map */ - copytype = T_MAP; - copyfrom = -1; - copymap = curmap; - sprintf(statustext,"Map %d ('%s') set as copy source.",curmap, map[curmap].name); - drawstatusbar(); - } else { - if (map[curmap].selecteditemtype == T_OBJECT) { - copytype = T_OBJECT; - copymap = curmap; - copyfrom = map[curmap].selecteditem; - sprintf(statustext,"Object %d set as copy source.",copyfrom); - drawstatusbar(); - } else if (map[curmap].selecteditemtype == T_TEXT) { - copytype = T_TEXT; - copymap = curmap; - copyfrom = map[curmap].selecteditem; - sprintf(statustext,"Text %d ('%s') set as copy source.",copyfrom, map[curmap].textob[copyfrom].text); - drawstatusbar(); - } - } + copy(); } if (c == 'd') { /* drill down */ if (state == S_NONE) { @@ -1510,118 +1577,19 @@ int main (int argc, char **argv) { drawstatusbar(); } } - if (c == 'p') { /* paste */ - if (copytype == T_MAP) { - if (copymap == curmap) { - sprintf(statustext,"Error: copy source and destination are the same!"); - drawstatusbar(); - } else if (copymap < 0) { - sprintf(statustext,"Error: No copy source selected!"); - drawstatusbar(); - } else { - map[curmap] = map[copymap]; - sprintf(map[curmap].name, "Copy of map%d",copymap); - modified = TRUE; - sprintf(statustext,"Map %d ('%s') copied to map %d.", copymap, map[copymap].name, curmap); - copytype = -1; - copymap = -1; - drawmap(); - - } - } else if (copytype == T_TEXT) { - int tnum; - /* create new text object */ - if ((map[copymap].textob[copyfrom].x + 10) >= map[curmap].width) { - startx = map[copymap].textob[copyfrom].x - 10; - } else { - startx = map[copymap].textob[copyfrom].x + 10; - } - if ((map[copymap].textob[copyfrom].y + 10) >= map[curmap].height) { - starty = map[copymap].textob[copyfrom].y - 10; - } else { - starty = map[copymap].textob[copyfrom].y + 10; - } - if (copymap == curmap) { - textanchor = map[copymap].textob[copyfrom].anchor; - if (textanchor != -1) { - startx += map[copymap].obj[textanchor].x; - starty += map[copymap].obj[textanchor].y; - } - } else { - textanchor = -1; - } - strcpy(text, map[copymap].textob[copyfrom].text); - - /* create it */ - endtext(); - - sprintf(statustext,"Text object pasted at %d,%d.",startx,starty); - - /* update its size */ - tnum = map[curmap].numtext-1; - map[curmap].textob[tnum].h = map[copymap].textob[copyfrom].h; - map[curmap].textob[tnum].w = map[copymap].textob[copyfrom].w; - map[curmap].textob[tnum].c = map[copymap].textob[copyfrom].c; - - /* select new item */ - map[curmap].selecteditemtype = T_TEXT; - map[curmap].selecteditem = tnum; - - /* clear buffer */ - copytype = -1; - copymap = -1; - - drawmap(); - } else if (copytype == T_OBJECT) { - int newtype, newx, newy, n; - int newnum; - - newtype = map[copymap].obj[copyfrom].type; - newx = map[copymap].obj[copyfrom].x + 10; - newy = map[copymap].obj[copyfrom].y + 10; - - /* TODO: validate new position */ - - createobject(newtype, newx,newy); - - /* match size, colour, etc */ - newnum = map[curmap].numobjects-1; - map[curmap].obj[newnum].w = map[copymap].obj[copyfrom].w; - map[curmap].obj[newnum].h = map[copymap].obj[copyfrom].h; - map[curmap].obj[newnum].fillcol = map[copymap].obj[copyfrom].fillcol; - - /* copy over all attached text */ - - for (n = 0; n < map[copymap].numtext; n++) { - if (map[copymap].textob[n].anchor == copyfrom) { - int tnum; - - /* duplicate it */ - startx = map[copymap].textob[n].x + map[curmap].obj[newnum].x; - starty = map[copymap].textob[n].y + map[curmap].obj[newnum].y; - textanchor = newnum; - strcpy(text, map[copymap].textob[n].text); - endtext(); - - /* update text size */ - tnum = map[curmap].numtext-1; - - map[curmap].textob[tnum].h = map[copymap].textob[n].h; - map[curmap].textob[tnum].w = map[copymap].textob[n].w; - map[curmap].textob[tnum].c = map[copymap].textob[n].c; - } - } - - /* select new object */ - map[curmap].selecteditemtype = T_OBJECT; - map[curmap].selecteditem = newnum; - - sprintf(statustext,"Object pasted at %d,%d.",newx,newy); - drawmap(); + if (c == 'f') { + if (showflows) { + showflows = FALSE; + sprintf(statustext, "Traffic flows hidden."); } else { - sprintf(statustext,"Error: No copy source selected!"); - drawstatusbar(); - } + sprintf(statustext, "Traffic flows displayed."); + showflows = TRUE; + } + drawtoolbox(); + drawmap(); + } + if ((c == 'p') || (c == 'v')) { /* paste */ + paste(); } /* keyboard shortcuts */ if ((c >= '0') && (c <= '9')) { @@ -1737,7 +1705,7 @@ void addlinkpoint(int linkid, int x, int y) { map[curmap].olink[linkid].point[pos].x = x; map[curmap].olink[linkid].point[pos].y = y; - modified = TRUE; + setmod(TRUE); sprintf(statustext, "Point added to link #%d",linkid); } @@ -1757,6 +1725,14 @@ int addvector(vectorimg_t *vimg, int type, int x1, int y1, int x2, int y2, SDL_C return FALSE; } +void changegridsize(void) { + if (++gridsizeindex >= gridsizenum) { + gridsizeindex = 0; + } + gridsize = gridsizelist[gridsizeindex]; + sprintf(statustext, "Grid size set to %d.", gridsize); +} + void changelinearrow(int changeby) { if ((changeby < 0) && (defarrow == 0)) { @@ -1773,7 +1749,7 @@ void changelinearrow(int changeby) { if (map[curmap].selecteditem != -1) { map[curmap].olink[map[curmap].selecteditem].style &= 0x00ffff; map[curmap].olink[map[curmap].selecteditem].style |= (defarrow << 16); - modified = TRUE; + setmod(TRUE); drawmap(); } } @@ -1796,7 +1772,7 @@ void changelinestyle(int changeby) { if (map[curmap].selecteditem != -1) { map[curmap].olink[map[curmap].selecteditem].style &= 0xff00ff; map[curmap].olink[map[curmap].selecteditem].style |= (defstyle << 8); - modified = TRUE; + setmod(TRUE); drawmap(); } } @@ -1816,7 +1792,7 @@ void changelinethickness(int changeby) { if (map[curmap].selecteditem != -1) { map[curmap].olink[map[curmap].selecteditem].style &= 0xffff00; map[curmap].olink[map[curmap].selecteditem].style |= defthickness; - modified = TRUE; + setmod(TRUE); drawmap(); } } @@ -1833,6 +1809,9 @@ void changemap(int newmap) { } void changestate(int newstate) { + int oldstate; + + oldstate = state; /* can't do most things in readonly mode */ if (readonly) { switch (newstate) { @@ -1846,6 +1825,9 @@ void changestate(int newstate) { } } if (newstate != state) { + if (oldstate == S_DRAWFLOW) { + showflows = oldshowflows; + } if ((state == S_ADDOBJ) || (state == S_ADDTEXT)) { /* change mouse back to normal */ SDL_SetCursor(normalmouse); @@ -1854,43 +1836,52 @@ void changestate(int newstate) { if (newstate == S_ADDTEXT) SDL_SetCursor(textmouse); state = newstate; + if (oldstate == S_DRAWFLOW) { + drawmap(); + } drawtoolbox(); switch (state) { case S_NONE: //sprintf(statustext,"Selection mode enabled.\n"); fflush(stdout); + if (oldstate == S_DRAWFLOW) { + sprintf(statustext,"Traffic flow definition complete."); + } break; case S_ADDOBJ: - sprintf(statustext,"Object creation mode enabled.\n"); fflush(stdout); + sprintf(statustext,"Object creation mode enabled.\n"); break; case S_CHANGEOBJECT: - sprintf(statustext,"Object type modification mode enabled.\n"); fflush(stdout); + sprintf(statustext,"Object type modification mode enabled.\n"); break; case S_ADDTEXT: - sprintf(statustext,"Text creation mode entered.\n"); fflush(stdout); + sprintf(statustext,"Text creation mode entered.\n"); break; case S_TYPETEXT: - sprintf(statustext,"Text entry mode entered.\n"); fflush(stdout); + sprintf(statustext,"Text entry mode entered.\n"); break; case S_EDITTEXT: - sprintf(statustext,"Text edit mode entered.\n"); fflush(stdout); + sprintf(statustext,"Text edit mode entered.\n"); break; case S_MATCHSIZE: - sprintf(statustext,"Size-matching mode entered - select object to copy size from...\n"); fflush(stdout); + sprintf(statustext,"Size-matching mode entered - select object to copy size from...\n"); break; case S_MATCHX: - sprintf(statustext,"X-matching mode entered - select item to align with...\n"); fflush(stdout); + sprintf(statustext,"X-matching mode entered - select item to align with...\n"); break; case S_MATCHY: - sprintf(statustext,"Y-matching mode entered - select item to align with...\n"); fflush(stdout); + sprintf(statustext,"Y-matching mode entered - select item to align with...\n"); + break; + case S_DRAWFLOW: + sprintf(statustext,"Traffic flow definition mode entered - select items...\n"); break; case S_MAPNAMING: - sprintf(statustext,"Map rename mode entered.\n"); fflush(stdout); + sprintf(statustext,"Map rename mode entered.\n"); break; case S_SAVING: - sprintf(statustext,"Save mode entered.\n"); fflush(stdout); + sprintf(statustext,"Save mode entered.\n"); break; case S_LOADING: - sprintf(statustext,"Load mode entered.\n"); fflush(stdout); + sprintf(statustext,"Load mode entered.\n"); break; } drawstatusbar(); @@ -1908,6 +1899,31 @@ void cleanup(void) { SDL_Quit(); } +void copy(void) { + if (map[curmap].selecteditem == -1) { + /* copy entire map */ + copytype = T_MAP; + copyfrom = -1; + copymap = curmap; + sprintf(statustext,"Map %d ('%s') set as copy source.",curmap, map[curmap].name); + drawstatusbar(); + } else { + if (map[curmap].selecteditemtype == T_OBJECT) { + copytype = T_OBJECT; + copymap = curmap; + copyfrom = map[curmap].selecteditem; + sprintf(statustext,"Object %d set as copy source.",copyfrom); + drawstatusbar(); + } else if (map[curmap].selecteditemtype == T_TEXT) { + copytype = T_TEXT; + copymap = curmap; + copyfrom = map[curmap].selecteditem; + sprintf(statustext,"Text %d ('%s') set as copy source.",copyfrom, map[curmap].textob[copyfrom].text); + drawstatusbar(); + } + } +} + int createobject(int type, int x, int y) { map[curmap].obj[map[curmap].numobjects].type = type; map[curmap].obj[map[curmap].numobjects].w = objtype[type].defw; @@ -1929,8 +1945,9 @@ int createobject(int type, int x, int y) { map[curmap].obj[map[curmap].numobjects].y = y; map[curmap].obj[map[curmap].numobjects].child = -1; + map[curmap].obj[map[curmap].numobjects].fillcol.unused &= ~ISFLOW; /* not a flow */ - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Object #%d (%s) created at (%d,%d).\n",map[curmap].numobjects, objtype[type].name, x, y); drawstatusbar(); @@ -2073,7 +2090,7 @@ void deletething(int id, int type) { } } } - modified = TRUE; + setmod(TRUE); map[curmap].selecteditem = -1; map[curmap].selecteditemtype = -1; drawmap(); @@ -2118,7 +2135,7 @@ void deletelink(int linkid) { sprintf(statustext,"Can't find matching thing for link #%d!\n",linkid); } - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Deleted link #%d.\n",linkid); drawstatusbar(); @@ -2161,7 +2178,7 @@ void deleteobject(int oid) { sprintf(statustext,"Can't find matching thing for object #%d!\n",oid); } - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Deleted object #%d.\n",oid); drawstatusbar(); @@ -2207,7 +2224,7 @@ void deletetext(int textid) { sprintf(statustext,"Can't find matching thing for text item #%d!\n",textid); } - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Deleted text item #%d.\n",textid); drawstatusbar(); @@ -2419,6 +2436,44 @@ void drawarrowhead(SDL_Surface *screen, double x1, double y1, double x2, double drawline(screen, arrowpointx, arrowpointy, arrowend2x, arrowend2y, c, arrowstyle); } +void lerp(int *newx, int *newy, int ax, int ay, int bx, int by, float t) { + *newx = ax + (bx - ax) * t; + *newy = ay + (by - ay) * 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) { + int i; + float t; + int abx,aby,bcx,bcy,cdx,cdy; + int abbcx,abbcy,bccdx,bccdy; + int newx,newy; + int oldx,oldy; + + oldx = x1; + oldy = y1; + + for (i = 0; i < BEZIERQUALITY; i++) { + t = (float)i / (float)(BEZIERQUALITY - 1); + + lerp(&abx,&aby, x1, y1, x2, y2, t); + lerp(&bcx,&bcy, x2, y2, x3, y3, t); + lerp(&cdx,&cdy, x3, y3, x4, y4, t); + lerp(&abbcx,&abbcy, abx, aby, bcx, bcy, t); + lerp(&bccdx,&bccdy, bcx, bcy, cdx, cdy, t); + lerp(&newx,&newy, abbcx, abbcy, bccdx, bccdy, t); + + drawline(screen, oldx, oldy, newx, newy, c, 1); + oldx = newx; + oldy = newy; + } + +} + + void drawbox(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c) { drawline(screen,x1,y1,x2,y1,c,1); drawline(screen,x1,y1,x1,y2,c,1); @@ -2504,6 +2559,49 @@ void drawellipse(SDL_Surface *screen, int x1, int y1, int xr, int yr, SDL_Color } +void drawflowbox(SDL_Surface *dest, int oid, int otype) { + int x1,y1,x2,y2; + int i; + int ls = 10; + + switch (otype) { + case T_OBJECT: + x1 = map[curmap].obj[oid].x; + y1 = map[curmap].obj[oid].y; + x2 = map[curmap].obj[oid].x + map[curmap].obj[oid].w; + y2 = map[curmap].obj[oid].y + map[curmap].obj[oid].h; + drawbox(dest, x1, y1, x2, y2, blue); + break; + case T_LINK: + x1 = map[curmap].obj[map[curmap].olink[oid].srcobj].x + map[curmap].olink[oid].srcxoff; + y1 = map[curmap].obj[map[curmap].olink[oid].srcobj].y + map[curmap].olink[oid].srcyoff; + x2 = map[curmap].obj[map[curmap].olink[oid].dstobj].x + map[curmap].olink[oid].dstxoff; + y2 = map[curmap].obj[map[curmap].olink[oid].dstobj].y + map[curmap].olink[oid].dstyoff; + drawfillbox(dest, x1-ls, y1-ls, x1+ls, y1+ls, blue); + drawfillbox(dest, x2-ls, y2-ls, x2+ls, y2+ls, blue); + for (i = 0; i < map[curmap].olink[oid].npoints; i++) { + x1 = map[curmap].olink[oid].point[i].x; + y1 = map[curmap].olink[oid].point[i].y; + drawfillbox(dest, x1-ls, y1-ls, x1+ls, y1+ls, blue); + } + break; + case T_TEXT: + if (map[curmap].textob[oid].anchor == -1) { + x1 = map[curmap].textob[oid].x; + y1 = map[curmap].textob[oid].y; + } else { + x1 = map[curmap].textob[oid].x + map[curmap].obj[map[curmap].textob[oid].anchor].x; + y1 = map[curmap].textob[oid].y + map[curmap].obj[map[curmap].textob[oid].anchor].y; + } + x2 = x1 + map[curmap].textob[oid].w; + y2 = y1 + map[curmap].textob[oid].h; + drawbox(dest, x1, y1, x2, y2, blue); + break; + default: + return; + } +} + void drawcolorchart(SDL_Surface *dest) { int x,y; int i; @@ -2698,6 +2796,8 @@ void drawlink(SDL_Surface *dest, link_t *l) { x2 = l->point[i].x; y2 = l->point[i].y; + /* clear the "arrowhead" part of these */ + //drawline(dest, x,y,x2,y2, l->col,l->style & 0xff00ffff); drawline(dest, x,y,x2,y2, l->col,l->style); x = x2; @@ -2740,7 +2840,7 @@ void drawobject(SDL_Surface *dest, mapobject_t *o, int doublebuffer) { printf("About to drawvector ..."); fflush(stdout); } - if (o->fillcol.unused == USECOLOUR) { + if (o->fillcol.unused & USECOLOUR) { drawvector(temps, &objtype[o->type].vimg, 0, 0, o->w, o->h, NULL, &o->fillcol); } else { drawvector(temps, &objtype[o->type].vimg, 0, 0, o->w, o->h, NULL, NULL); @@ -2887,17 +2987,59 @@ void drawmap(void) { for (i = 0; i < map[curmap].numthings; i++) { if (map[curmap].thing[i].type == T_OBJECT) { if (testing) { printf("Drawing thing #%d (%d, %s)\n",i,map[curmap].thing[i].id,objtype[map[curmap].obj[map[curmap].thing[i].id].type].name); fflush(stdout); } - drawobject(buffer, &map[curmap].obj[map[curmap].thing[i].id], TRUE); + if (!isflow(map[curmap].thing[i].id, T_OBJECT) || (showflows == TRUE)) { + drawobject(buffer, &map[curmap].obj[map[curmap].thing[i].id], TRUE); + } + if (isflow(map[curmap].thing[i].id, T_OBJECT)) { + if (state == S_DRAWFLOW) { + drawflowbox(buffer, map[curmap].thing[i].id, T_OBJECT); + } + } } else if (map[curmap].thing[i].type == T_LINK) { if (testing) { printf ("Drawing thing #%d (%d, link)\n",i,map[curmap].thing[i].id); fflush(stdout); } - drawlink(buffer, &map[curmap].olink[map[curmap].thing[i].id]); + if (!isflow(map[curmap].thing[i].id, T_LINK) || (showflows == TRUE)) { + drawlink(buffer, &map[curmap].olink[map[curmap].thing[i].id]); + } + if (isflow(map[curmap].thing[i].id, T_LINK)) { + if (state == S_DRAWFLOW) { + drawflowbox(buffer, map[curmap].thing[i].id, T_LINK); + } + } } else if (map[curmap].thing[i].type == T_TEXT) { if (testing) { printf ("Drawing thing #%d (%d, text)\n",i,map[curmap].thing[i].id); fflush(stdout); } - drawtext(buffer, &map[curmap].textob[map[curmap].thing[i].id]); + if (!isflow(map[curmap].thing[i].id, T_TEXT) || (showflows == TRUE)) { + drawtext(buffer, &map[curmap].textob[map[curmap].thing[i].id]); + } + if (isflow(map[curmap].thing[i].id, T_TEXT)) { + if (state == S_DRAWFLOW) { + drawflowbox(buffer, map[curmap].thing[i].id, T_TEXT); + } + } } else { printf("WARNING: Thing #%d has unknown type %d!\n",i,map[curmap].thing[i].type); } } + + + /* show traffic flows (these should be on top of everything else) */ + if (state == S_DRAWFLOW) { + for (i = 0; i < map[curmap].numthings; i++) { + if (map[curmap].thing[i].type == T_OBJECT) { + if (isflow(map[curmap].thing[i].id, T_OBJECT)) { + drawflowbox(buffer, map[curmap].thing[i].id, T_OBJECT); + } + } else if (map[curmap].thing[i].type == T_LINK) { + if (isflow(map[curmap].thing[i].id, T_LINK)) { + drawflowbox(buffer, map[curmap].thing[i].id, T_LINK); + } + } else if (map[curmap].thing[i].type == T_TEXT) { + if (isflow(map[curmap].thing[i].id, T_TEXT)) { + drawflowbox(buffer, map[curmap].thing[i].id, T_TEXT); + } + } + } + } + if (testing) { printf("FINISHED THINGS \n"); fflush(stdout); } @@ -3501,11 +3643,6 @@ void drawobox(void) { } void drawscreen(void){ - if (readonly) { - sprintf(statustext, "Welcome to netmapr viewer v%s.", VERSION); - } else { - sprintf(statustext, "Welcome to netmapr v%s.", VERSION); - } drawmap(); drawtoolbox(); drawobox(); @@ -3570,7 +3707,7 @@ void drawtoolbox(void) { Uint32 bcol; int z; - dontpaste = TRUE; + if (oldselection >= 0) dontpaste = TRUE; fillcol = SDL_MapRGB(screen->format, toolbox.bgcol.r,toolbox.bgcol.g,toolbox.bgcol.b); area.x = toolbox.x; @@ -3625,7 +3762,7 @@ void drawtoolbox(void) { floodfill(screen, area.x + 5, area.y + 5, fgcol); } if (i == TB_FILLCOL) { - if (objfillcol.unused != NOCOLOUR) { + if (objfillcol.unused & USECOLOUR) { floodfill(screen, area.x + 5, area.y + 5, objfillcol); } else { floodfill(screen, area.x + 5, area.y + 5, black); @@ -3648,6 +3785,19 @@ void drawtoolbox(void) { style = (defarrow << 16) | 1; drawline(screen, area.x + 5,area.y+24,area.x + area.w - 5, area.y+24 ,white,style); } + if (i == TB_FLOW) { + if (showflows) { + drawfillbox(screen, area.x+5,area.y+20,area.x + area.w - 15, area.y + area.h - 5, black); + if (state == S_DRAWFLOW) { + drawfillbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, yellow); + } else { + drawfillbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, green); + } + } else { + drawfillbox(screen, area.x+5,area.y+20,area.x + area.w - 15, area.y + area.h - 5, red); + drawfillbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, black); + } + } SDL_UpdateRect(screen, x, y, toolbox.gridsize+3,toolbox.gridsize+3); @@ -3663,9 +3813,10 @@ void drawtoolbox(void) { if (state == S_SAVING) drawtoolboxselector(TB_SAVE, 0); if (state == S_LOADING) drawtoolboxselector(TB_LOAD, 0); if (state == S_MATCHSIZE) drawtoolboxselector(TB_MATCHSIZE, 0); - if (state == S_MATCHX) drawtoolboxselector(TB_MATCHX, 0); - if (state == S_MATCHY) drawtoolboxselector(TB_MATCHY, 0); + if (state == S_MATCHX) drawtoolboxselector(TB_MATCHPOS, 0); + if (state == S_MATCHY) drawtoolboxselector(TB_MATCHPOS, 0); if (state == S_CREATETELE) drawtoolboxselector(TB_CREATETELE, 0); + if (state == S_DRAWFLOW) drawtoolboxselector(TB_FLOW, 0); } @@ -3700,6 +3851,8 @@ void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h float xscale,yscale; int realx1, realy1; int realx2, realy2; + int realx3, realy3; + int realx4, realy4; int i; SDL_Color linecol,fillcol; @@ -3732,10 +3885,36 @@ void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h } // scale the coords of this vector - realx1 = x + ((float)vimg->vector[i].x1 * xscale); - realy1 = y + ((float)vimg->vector[i].y1 * yscale); - realx2 = x + ((float)vimg->vector[i].x2 * xscale); - realy2 = y + ((float)vimg->vector[i].y2 * yscale); + + if (vimg->vector[i].type == VT_BEZIER) { + int ax,ay; + int bx,by; + int cx,cy; + int dx,dy; + + ax = (vimg->vector[i].x1 & 0xffff0000) >> 16; + ay = (vimg->vector[i].y1 & 0xffff0000) >> 16; + bx = (vimg->vector[i].x1 & 0x0000ffff); + by = (vimg->vector[i].y1 & 0x0000ffff); + cx = (vimg->vector[i].x2 & 0xffff0000) >> 16; + cy = (vimg->vector[i].y2 & 0xffff0000) >> 16; + dx = (vimg->vector[i].x2 & 0x0000ffff); + dy = (vimg->vector[i].y2 & 0x0000ffff); + + realx1 = x + ((float)ax * xscale); + realy1 = y + ((float)ay * yscale); + realx2 = x + ((float)bx * xscale); + realy2 = y + ((float)by * yscale); + realx3 = x + ((float)cx * xscale); + realy3 = y + ((float)cy * yscale); + realx4 = x + ((float)dx * xscale); + realy4 = y + ((float)dy * yscale); + } else { + realx1 = x + ((float)vimg->vector[i].x1 * xscale); + realy1 = y + ((float)vimg->vector[i].y1 * yscale); + realx2 = x + ((float)vimg->vector[i].x2 * xscale); + realy2 = y + ((float)vimg->vector[i].y2 * yscale); + } // draw this vector switch (vimg->vector[i].type) { @@ -3751,6 +3930,13 @@ void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h case VT_ELLIPSE: drawellipse(dest,realx1,realy1, realx2,realy2, linecol); break; + case VT_BEZIER: + drawbezier(dest,realx1,realy1, + realx2,realy2, + realx3,realy3, + realx4,realy4, + linecol); + break; case VT_FILL: floodfill(dest,realx1,realy1, fillcol); break; @@ -3812,13 +3998,14 @@ int endtext(void) { map[curmap].textob[map[curmap].numtext].w = tw; map[curmap].textob[map[curmap].numtext].h = DEFTEXTH; map[curmap].textob[map[curmap].numtext].c = fgcol; + map[curmap].textob[map[curmap].numtext].c.unused |= ~(ISFLOW); /* add to 'thing' list */ map[curmap].thing[map[curmap].numthings].type = T_TEXT; map[curmap].thing[map[curmap].numthings].id = map[curmap].numtext; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Added text object #%d: '%s'.",map[curmap].numtext, map[curmap].textob[map[curmap].numtext].text); drawstatusbar(); @@ -3868,7 +4055,7 @@ int endtextedit(void) { TTF_SizeText(font[map[curmap].textob[si].h], text, &tw,&th); map[curmap].textob[si].w = tw; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Updated text object #%d to '%s'\n",si, map[curmap].textob[si].text); drawstatusbar(); @@ -3921,7 +4108,7 @@ int endtextmove(int x, int y) { map[curmap].textob[map[curmap].curtext].x += (x - startx); map[curmap].textob[map[curmap].curtext].y += (y - starty); - modified = TRUE; + setmod(TRUE); return 0; } @@ -4151,7 +4338,11 @@ int linkat(int x, int y) { int i; for (i = 0; i < map[curmap].numlinks; i++) { /* is (x,y) on the line? */ - if (isonlink(i, x, y)) return i; + if (isonlink(i, x, y)) { + if (!isflow(i, T_LINK) || (showflows == TRUE)) { + return i; + } + } } return -1; @@ -4245,7 +4436,7 @@ int loadmap(void) { map[i].obj[n].h = tempmapobjects[n].h; map[i].obj[n].child = tempmapobjects[n].child; map[i].obj[n].fillcol = black; - map[i].obj[n].fillcol.unused = NOCOLOUR; + map[i].obj[n].fillcol.unused &= ~(USECOLOUR); } fread(&map[i].textob, sizeof(text_t), map[i].numtext, f); } @@ -4296,14 +4487,47 @@ int loadmap(void) { if (map[i].olink[n].style == 0) { map[i].olink[n].style = 1; } + /* old maps have fillcol.unused = 99 for NOCOLOUR and 100 for USECOLOUR */ + /* new maps have fillcol.unused&0x01 == 1 for USECOLOUR, == 0 for NOCOLOUR */ + if (map[i].olink[n].col.unused == 99) { + map[i].olink[n].col.unused = 0; + } + if (map[i].olink[n].col.unused == 100) { + map[i].olink[n].col.unused = 1; + } + } + for (n = 0; n < map[i].numobjects; n++) { + /* old maps have fillcol.unused = 99 for NOCOLOUR and 100 for USECOLOUR */ + /* new maps have fillcol.unused&0x01 == 1 for USECOLOUR, == 0 for NOCOLOUR */ + if (map[i].obj[n].fillcol.unused == 99) { + map[i].obj[n].fillcol.unused = 0; + } + if (map[i].obj[n].fillcol.unused == 100) { + map[i].obj[n].fillcol.unused = 1; + } + } + for (n = 0; n < map[i].numtext; n++) { + /* old maps have fillcol.unused = 99 for NOCOLOUR and 100 for USECOLOUR */ + /* new maps have fillcol.unused&0x01 == 1 for USECOLOUR, == 0 for NOCOLOUR */ + if (map[i].textob[n].c.unused == 99) { + map[i].textob[n].c.unused = 0; + } + if (map[i].textob[n].c.unused == 100) { + map[i].textob[n].c.unused = 1; + } } } curmap = 0; - modified = FALSE; + setmod(FALSE); sprintf(statustext,"Successfully loaded map from '%s' (%d maps). [file version: '%s']\n",filename,nummaps, vers); strcpy(currentfilename, filename); + + /* disable grid when we load a map */ + grid = FALSE; + + updatewm(); drawmap(); @@ -4332,7 +4556,7 @@ void lowerselected(void) { break; } } - modified = TRUE; + setmod(TRUE); /* redraw map */ drawmap(); } @@ -4342,13 +4566,131 @@ int objat(int x, int y) { for (i = 0; i < map[curmap].numobjects; i++) { if ( (x >= map[curmap].obj[i].x ) && (x <= (map[curmap].obj[i].x + map[curmap].obj[i].w)) && (y >= map[curmap].obj[i].y ) && (y <= (map[curmap].obj[i].y + map[curmap].obj[i].h)) ) { - return i; + + if (!isflow(i, T_OBJECT) || (showflows == TRUE)) { + return i; + } } } return -1; } + +void paste(void) { + if (copytype == T_MAP) { + if (copymap == curmap) { + sprintf(statustext,"Error: copy source and destination are the same!"); + drawstatusbar(); + } else if (copymap < 0) { + sprintf(statustext,"Error: No copy source selected!"); + drawstatusbar(); + } else { + map[curmap] = map[copymap]; + sprintf(map[curmap].name, "Copy of map%d",copymap); + setmod(TRUE); + sprintf(statustext,"Map %d ('%s') copied to map %d.", copymap, map[copymap].name, curmap); + copytype = -1; + copymap = -1; + drawmap(); + + } + } else if (copytype == T_TEXT) { + int tnum; + /* create new text object */ + if ((map[copymap].textob[copyfrom].x + 10) >= map[curmap].width) { + startx = map[copymap].textob[copyfrom].x - 10; + } else { + startx = map[copymap].textob[copyfrom].x + 10; + } + if ((map[copymap].textob[copyfrom].y + 10) >= map[curmap].height) { + starty = map[copymap].textob[copyfrom].y - 10; + } else { + starty = map[copymap].textob[copyfrom].y + 10; + } + if (copymap == curmap) { + textanchor = map[copymap].textob[copyfrom].anchor; + if (textanchor != -1) { + startx += map[copymap].obj[textanchor].x; + starty += map[copymap].obj[textanchor].y; + } + } else { + textanchor = -1; + } + strcpy(text, map[copymap].textob[copyfrom].text); + + /* create it */ + endtext(); + + sprintf(statustext,"Text object pasted at %d,%d.",startx,starty); + + /* update its size */ + tnum = map[curmap].numtext-1; + map[curmap].textob[tnum].h = map[copymap].textob[copyfrom].h; + map[curmap].textob[tnum].w = map[copymap].textob[copyfrom].w; + map[curmap].textob[tnum].c = map[copymap].textob[copyfrom].c; + + /* select new item */ + map[curmap].selecteditemtype = T_TEXT; + map[curmap].selecteditem = tnum; + + /* clear buffer */ + copytype = -1; + copymap = -1; + + drawmap(); + } else if (copytype == T_OBJECT) { + int newtype, newx, newy, n; + int newnum; + + newtype = map[copymap].obj[copyfrom].type; + newx = map[copymap].obj[copyfrom].x + 10; + newy = map[copymap].obj[copyfrom].y + 10; + + /* TODO: validate new position */ + + createobject(newtype, newx,newy); + + /* match size, colour, etc */ + newnum = map[curmap].numobjects-1; + map[curmap].obj[newnum].w = map[copymap].obj[copyfrom].w; + map[curmap].obj[newnum].h = map[copymap].obj[copyfrom].h; + map[curmap].obj[newnum].fillcol = map[copymap].obj[copyfrom].fillcol; + + /* copy over all attached text */ + + for (n = 0; n < map[copymap].numtext; n++) { + if (map[copymap].textob[n].anchor == copyfrom) { + int tnum; + + /* duplicate it */ + startx = map[copymap].textob[n].x + map[curmap].obj[newnum].x; + starty = map[copymap].textob[n].y + map[curmap].obj[newnum].y; + textanchor = newnum; + strcpy(text, map[copymap].textob[n].text); + endtext(); + + /* update text size */ + tnum = map[curmap].numtext-1; + + map[curmap].textob[tnum].h = map[copymap].textob[n].h; + map[curmap].textob[tnum].w = map[copymap].textob[n].w; + map[curmap].textob[tnum].c = map[copymap].textob[n].c; + } + } + + /* select new object */ + map[curmap].selecteditemtype = T_OBJECT; + map[curmap].selecteditem = newnum; + + sprintf(statustext,"Object pasted at %d,%d.",newx,newy); + drawmap(); + } else { + sprintf(statustext,"Error: No copy source selected!"); + drawstatusbar(); + } +} + void pasteline(SDL_Surface *screen, int *lbuf) { int deltax, deltay; int numpixels; @@ -4473,7 +4815,6 @@ int initgraphics(void) { Uint8 data[32]; Uint8 mask[32]; int i; - char verstring[BUFLEN]; char file[BUFLEN]; Uint32 fillcol; SDL_Rect area; @@ -4490,7 +4831,6 @@ int initgraphics(void) { initvars(); - /* set up icon */ sprintf(file, "icon.bmp"); icon = SDL_LoadBMP(file); @@ -4509,6 +4849,7 @@ int initgraphics(void) { } SDL_WM_SetIcon(icon, NULL); + updatewm(); /* load fonts */ TTF_Init(); @@ -4644,14 +4985,7 @@ int initgraphics(void) { printf("Doublebuf set ok.\n"); fflush(stdout); } - if (readonly) { - sprintf(verstring, "netmapr viewer v%s, by rpearce 2005", VERSION); - SDL_WM_SetCaption(verstring,"netmapr viewer"); - } else { - sprintf(verstring, "netmapr v%s, by rpearce 2005", VERSION); - SDL_WM_SetCaption(verstring,"netmapr"); - } - + updatewm(); /* set up toolbox highlight image */ toolhilite = SDL_CreateRGBSurface(SDL_SWSURFACE,toolbox.gridsize+3, toolbox.gridsize+3, @@ -4838,6 +5172,54 @@ screen->format->Amask); printf("Too many vectors on line %d of objects file.\n",line); exit(1); } + } else if (!strcmp(p, "bezier")) { + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + x1 = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + y1 = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + x1 = x1 << 16; + x1 |= atoi(p); /* store two things in the one int */ + + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + y1 = y1 << 16; + y1 |= atoi(p); /* store two things in the one int */ + + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + x2 = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + y2 = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + x2 = x2 << 16; + x2 |= atoi(p); /* store two things in the one int */ + + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + y2 = y2 << 16; + y2 |= atoi(p); /* store two things in the one int */ + + + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + c.r = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + c.g = atoi(p); + p = strtok(NULL, " "); + if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } + c.b = atoi(p); + + if (addvector(&objtype[numobjtypes].vimg,VT_BEZIER,x1,y1,x2,y2,&c)) { + printf("Too many vectors on line %d of objects file.\n",line); + exit(1); + } } else if (!strcmp(p, "circle")) { p = strtok(NULL, " "); if (p == NULL) { printf("Missing token on line #%d of objects file.\n",line); exit(1); } @@ -5212,6 +5594,21 @@ int readletters() { #endif +int isflow(int oid, int otype) { + switch (otype) { + case T_OBJECT: + if (map[curmap].obj[oid].fillcol.unused & ISFLOW) return TRUE; + break; + case T_LINK: + if (map[curmap].olink[oid].col.unused & ISFLOW) return TRUE; + break; + case T_TEXT: + if (map[curmap].textob[oid].c.unused & ISFLOW) return TRUE; + break; + } + return FALSE; +} + int isonline (int fx, int fy, int x1, int y1, int x2, int y2) { int deltax, deltay; int numpixels; @@ -5437,7 +5834,7 @@ void initmap(int mapnum) { sprintf(map[mapnum].name, "Map #%d",mapnum); } - modified = FALSE; + setmod(FALSE); } @@ -5445,8 +5842,18 @@ void initmap(int mapnum) { void initvars(void) { nummaps = 1; + strcpy(typedesc[0], "None"); + strcpy(typedesc[1], "Object"); + strcpy(typedesc[2], "Link"); + strcpy(typedesc[3], "Text"); + strcpy(typedesc[4], "Linkpoint"); + strcpy(typedesc[5], "Map"); + strcpy(currentfilename, ""); + grid = TRUE; + gridsize = 10; + /* set globals */ initmap(0); @@ -5471,7 +5878,7 @@ void initvars(void) { toolbox.gridrowlen = SIDEBARW / toolbox.gridsize; mapbox.x = map[curmap].width + 1; - mapbox.y = toolbox.y+toolbox.height+1; + mapbox.y = toolbox.y+toolbox.height+10; mapbox.width = SIDEBARW; mapbox.height = obox.y - mapbox.y - 20; mapbox.offset = 0; @@ -5479,7 +5886,7 @@ void initvars(void) { fgcol = black; objfillcol = black; - objfillcol.unused = NOCOLOUR; + objfillcol.unused &= ~(USECOLOUR); } @@ -5505,11 +5912,16 @@ void raiseselected(void) { break; } } - modified = TRUE; + setmod(TRUE); /* redraw map */ drawmap(); } +void setmod(int tf) { + modified = tf; + updatewm(); +} + int savemap(void) { char filename[BUFLEN]; FILE *f; @@ -5608,11 +6020,13 @@ int savemap(void) { fclose(f); - modified = FALSE; + setmod(FALSE); sprintf(statustext,"Successfully saved map to '%s'.\n",filename); /* save filename */ strcpy(currentfilename, filename); + + updatewm(); return 0; } @@ -6035,12 +6449,16 @@ int textat(int x, int y) { if (anchor == -1) { if ( (x >= map[curmap].textob[i].x ) && (x <= (map[curmap].textob[i].x + map[curmap].textob[i].w)) && (y >= map[curmap].textob[i].y ) && (y <= (map[curmap].textob[i].y + map[curmap].textob[i].h)) ) { - return i; + if (!isflow(i, T_TEXT) || (showflows == TRUE)) { + return i; + } } } else { if ( (x >= map[curmap].textob[i].x + map[curmap].obj[anchor].x ) && (x <= (map[curmap].textob[i].x + map[curmap].obj[anchor].x + map[curmap].textob[i].w)) && (y >= map[curmap].textob[i].y + map[curmap].obj[anchor].y ) && (y <= (map[curmap].textob[i].y + map[curmap].obj[anchor].y + map[curmap].textob[i].h)) ) { - return i; + if (!isflow(i, T_TEXT) || (showflows == TRUE)) { + return i; + } } } @@ -6049,6 +6467,30 @@ int textat(int x, int y) { return -1; } +void toggleflow(int oid, int otype) { + switch (otype) { + case T_OBJECT: + map[curmap].obj[oid].fillcol.unused = map[curmap].obj[oid].fillcol.unused ^ ISFLOW; + break; + case T_LINK: + map[curmap].olink[oid].col.unused = map[curmap].olink[oid].col.unused ^ ISFLOW; + break; + case T_TEXT: + map[curmap].textob[oid].c.unused = map[curmap].textob[oid].c.unused ^ ISFLOW; + break; + } +} + +void togglegrid(void) { + if (grid) { + grid = FALSE; + strcpy(statustext, "Grid mode disabled."); + } else { + grid = TRUE; + strcpy(statustext, "Grid mode enabled."); + } +} + int thingat(int x, int y) { int i; int anchor; @@ -6059,12 +6501,16 @@ int thingat(int x, int y) { (x <= (map[curmap].obj[map[curmap].thing[i].id].x + map[curmap].obj[map[curmap].thing[i].id].w)) && (y >= map[curmap].obj[map[curmap].thing[i].id].y ) && (y <= (map[curmap].obj[map[curmap].thing[i].id].y + map[curmap].obj[map[curmap].thing[i].id].h)) ) { - return i; + if (!isflow(i, T_OBJECT) || (showflows == TRUE)) { + return i; + } } break; case T_LINK: if (isonlink(map[curmap].thing[i].id, x, y)) { - return i; + if (!isflow(i, T_LINK) || (showflows == TRUE)) { + return i; + } } break; case T_TEXT: @@ -6072,12 +6518,16 @@ int thingat(int x, int y) { if (anchor == -1) { if ( (x >= map[curmap].textob[map[curmap].thing[i].id].x ) && (x <= (map[curmap].textob[map[curmap].thing[i].id].x + map[curmap].textob[map[curmap].thing[i].id].w)) && (y >= map[curmap].textob[map[curmap].thing[i].id].y ) && (y <= (map[curmap].textob[map[curmap].thing[i].id].y + map[curmap].textob[map[curmap].thing[i].id].h)) ) { - return i; + if (!isflow(i, T_TEXT) || (showflows == TRUE)) { + return i; + } } } else { if ( (x >= map[curmap].textob[map[curmap].thing[i].id].x + map[curmap].obj[anchor].x ) && (x <= (map[curmap].textob[map[curmap].thing[i].id].x + map[curmap].obj[anchor].x + map[curmap].textob[map[curmap].thing[i].id].w)) && (y >= map[curmap].textob[map[curmap].thing[i].id].y + map[curmap].obj[anchor].y ) && (y <= (map[curmap].textob[map[curmap].thing[i].id].y + map[curmap].obj[anchor].y + map[curmap].textob[map[curmap].thing[i].id].h)) ) { - return i; + if (!isflow(i, T_TEXT) || (showflows == TRUE)) { + return i; + } } } break; @@ -6551,6 +7001,7 @@ int endlink(int x, int y) { map[curmap].olink[map[curmap].numlinks].dstyoff = endyoff; map[curmap].olink[map[curmap].numlinks].col = fgcol; + map[curmap].olink[map[curmap].numlinks].col.unused &= ~(ISFLOW); map[curmap].olink[map[curmap].numlinks].npoints = 0; @@ -6571,7 +7022,7 @@ int endlink(int x, int y) { map[curmap].thing[0].id = map[curmap].numlinks; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d created (from obj #%d to obj #%d).\n", map[curmap].numlinks, startobj, endobj); map[curmap].numlinks++; map[curmap].numthings++; @@ -6601,7 +7052,7 @@ int endlinkdstmove(int x, int y) { map[curmap].olink[map[curmap].curlink].dstxoff = x - map[curmap].obj[o].x; map[curmap].olink[map[curmap].curlink].dstyoff = y - map[curmap].obj[o].y; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d dst endpoint moved to offset (+%d,+%d).\n",map[curmap].curlink, map[curmap].olink[map[curmap].curlink].dstxoff,map[curmap].olink[map[curmap].curlink].dstyoff); } else { /* else if over a new map[curmap].object, update map[curmap].objid and offsets */ @@ -6609,7 +7060,7 @@ int endlinkdstmove(int x, int y) { map[curmap].olink[map[curmap].curlink].dstxoff = x - map[curmap].obj[o].x; map[curmap].olink[map[curmap].curlink].dstyoff = y - map[curmap].obj[o].y; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d dst endpoint moved to object %d(+%d,+%d).\n",map[curmap].curlink,o, map[curmap].olink[map[curmap].curlink].dstxoff,map[curmap].olink[map[curmap].curlink].dstyoff); } drawstatusbar(); @@ -6631,7 +7082,7 @@ int endlinkpointmove(int x, int y) { map[curmap].olink[map[curmap].curlink].point[map[curmap].curlinkpoint].x = x; map[curmap].olink[map[curmap].curlink].point[map[curmap].curlinkpoint].y = y; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d point #%d moved to (%d,%d).\n",map[curmap].curlink, map[curmap].curlinkpoint, map[curmap].olink[map[curmap].curlink].point[map[curmap].curlinkpoint].x,map[curmap].olink[map[curmap].curlink].point[map[curmap].curlinkpoint].y); drawstatusbar(); @@ -6658,7 +7109,7 @@ int endlinksrcmove(int x, int y) { map[curmap].olink[map[curmap].curlink].srcxoff = x - map[curmap].obj[o].x; map[curmap].olink[map[curmap].curlink].srcyoff = y - map[curmap].obj[o].y; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d src endpoint moved to offset (+%d,+%d).\n",map[curmap].curlink, map[curmap].olink[map[curmap].curlink].srcxoff,map[curmap].olink[map[curmap].curlink].srcyoff); } else { /* else if over a new map[curmap].object, update map[curmap].objid and offsets */ @@ -6666,7 +7117,7 @@ int endlinksrcmove(int x, int y) { map[curmap].olink[map[curmap].curlink].srcxoff = x - map[curmap].obj[o].x; map[curmap].olink[map[curmap].curlink].srcyoff = y - map[curmap].obj[o].y; - modified = TRUE; + setmod(TRUE); sprintf(statustext,"Link #%d src endpoint moved to object %d(+%d,+%d).\n",map[curmap].curlink,o, map[curmap].olink[map[curmap].curlink].srcxoff,map[curmap].olink[map[curmap].curlink].srcyoff); } drawstatusbar(); @@ -6680,7 +7131,7 @@ int endlinkmove(int x, int y) { if (linebg) free(linebg); - modified = TRUE; + setmod(TRUE); /* TODO: move the line */ return 0; @@ -6753,7 +7204,7 @@ int endobjmove(int x, int y) { } - modified = TRUE; + setmod(TRUE); newx = map[curmap].obj[map[curmap].curobj].x + (x - startx); newy = map[curmap].obj[map[curmap].curobj].y + (y - starty); @@ -6843,7 +7294,7 @@ int endresize(int x, int y) { } } - modified = TRUE; + setmod(TRUE); drawmap(); return 0; @@ -6891,7 +7342,7 @@ int endtextresize(int x, int y) { objtype[map[curmap].obj[map[curmap].curobj].type].defh = newh; */ - modified = TRUE; + setmod(TRUE); drawmap(); return 0; @@ -6941,3 +7392,25 @@ int updatetextshadow(int x, int y) { SDL_UpdateRect(screen, area.x, area.y, area.w, area.h); return 0; } + +void updatewm(void) { + char progname[SMALLBUFLEN]; + char verstring[BUFLEN]; + char filestring[BUFLEN]; + + if (readonly) { + sprintf(progname, "netmapr viewer"); + } else { + sprintf(progname, "netmapr"); + } + + if (!strcmp(currentfilename,"")) { + strcpy(filestring, "(no file)"); + } else { + strcpy(filestring, currentfilename); + } + + sprintf(verstring, "%s v%s - %s %s", progname, VERSION, filestring, + modified ? "*" : ""); + SDL_WM_SetCaption(verstring, progname); +} diff --git a/netmapr.h b/netmapr.h index 53e21d0..794a692 100644 --- a/netmapr.h +++ b/netmapr.h @@ -44,6 +44,7 @@ typedef struct { 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; @@ -58,6 +59,7 @@ typedef struct { 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; @@ -105,8 +107,9 @@ typedef struct { int w; int h; int child; - /* fillcol.unused = 1 means to fill with this colour */ - /* fillcol.unused = NOCOLOUR means to ignore this*/ + /* 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; @@ -161,15 +164,18 @@ typedef struct { map_t map[MAXMAPS]; +char typedesc[6][BUFLEN]; 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); +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 copyline(SDL_Surface *screen,int x1, int y1, int x2, int y2, int *lbuf); void deletething(int id, int type); @@ -177,10 +183,13 @@ void deletelink(int linkid); void deleteobject(int oid ); void deletetext(int textid); void drawarrowhead(SDL_Surface *screen, 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); void drawfillbox(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); 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); int drawletter(SDL_Surface *dest,int x, int y, int w, int h, char let, SDL_Color col); @@ -225,12 +234,14 @@ int linkat(int x, int y); int loadmap(void); void lowerselected(void); 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 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); @@ -245,6 +256,7 @@ int isonmapname (int x, int y); int isongoback (int x, int y); void initvars(void); void raiseselected(void); +void setmod(int tf); int savemap(void); int showfiledialog(void); void startedittext (int o); @@ -258,6 +270,8 @@ int startresize (int x, int y); int startresizetext (int x, int y); 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); @@ -267,3 +281,4 @@ int updateresizeshadow(int x, int y); int updateresizetextshadow(int x, int y); int updatetextcursor(void); int updatetextshadow(int x, int y); +void updatewm(void); diff --git a/objects.dat b/objects.dat index 067e67d..2d135e1 100644 --- a/objects.dat +++ b/objects.dat @@ -222,48 +222,15 @@ line 90 30 90 80 0 0 0 # fill monitor screen fill 50 50 0 0 255 end -object cloud 105 105 -# top -# / -line 0 15 15 0 0 0 0 -line 15 0 30 0 0 0 0 -line 30 0 37 10 0 0 0 -line 37 10 45 0 0 0 0 -line 45 0 60 0 0 0 0 -line 60 0 67 10 0 0 0 -line 67 10 75 0 0 0 0 -line 75 0 90 0 0 0 0 -line 90 0 104 15 0 0 0 -# right -# | -line 104 15 104 30 0 0 0 -line 104 30 90 37 0 0 0 -line 90 37 104 45 0 0 0 -line 104 45 104 60 0 0 0 -line 104 60 90 67 0 0 0 -line 90 67 104 75 0 0 0 -line 104 75 104 90 0 0 0 -line 104 90 90 104 0 0 0 -# bottom -# _ -line 90 104 75 104 0 0 0 -line 75 104 67 94 0 0 0 -line 67 94 60 104 0 0 0 -line 60 104 45 104 0 0 0 -line 45 104 37 94 0 0 0 -line 37 94 30 104 0 0 0 -line 30 104 15 104 0 0 0 -line 15 104 0 90 0 0 0 -# left -# | -line 0 90 0 75 0 0 0 -line 0 75 10 67 0 0 0 -line 10 67 0 60 0 0 0 -line 0 60 0 45 0 0 0 -line 0 45 10 37 0 0 0 -line 10 37 0 30 0 0 0 -line 0 30 0 15 0 0 0 -# insides +object cloud 102 102 +bezier 37 15 45 0 60 0 67 15 0 0 0 +bezier 67 15 80 0 104 15 90 37 0 0 0 +bezier 90 37 104 45 104 60 90 67 0 0 0 +bezier 90 67 104 75 90 104 67 89 0 0 0 +bezier 67 89 60 104 45 104 37 89 0 0 0 +bezier 37 89 30 104 0 90 10 67 0 0 0 +bezier 10 67 0 60 0 45 10 37 0 0 0 +bezier 10 37 0 30 15 0 37 15 0 0 0 fill 60 60 180 180 180 end object server 120 120 diff --git a/windist.sh b/windist.sh new file mode 100755 index 0000000..1498404 --- /dev/null +++ b/windist.sh @@ -0,0 +1,11 @@ +#!/bin/sh +VERSION=`cat constants.h | grep VERSION | awk '{ v=$3; gsub("\"","",v); print v }'` + +FULLNAME=netmapr-${VERSION} +TARFILE=${FULLNAME}.tar.gz +WINFILE=${FULLNAME}-win32.zip + + +mkdir ${FULLNAME} +cp README.txt INSTALL.txt objects.dat buttons.dat netmapr.exe netmapr.c netmapr.h constants.h convert.c convert.h verdana.ttf example.map icon.bmp windows_files/*.dll ${FULLNAME}/ +cp -R doc ${FULLNAME}/