diff options
author | rh <rh> | 1999-11-14 13:25:58 +0000 |
---|---|---|
committer | rh <rh> | 1999-11-14 13:25:58 +0000 |
commit | b595adc6beac965d5263846cdfc3005642f95641 (patch) | |
tree | 1579d3ebadbd8649c14efaf0e17f35a6ee7723a5 | |
parent | d6d850a705510f938f4a0b6f782e4e3dcfc7e8aa (diff) | |
download | pkgsrc-b595adc6beac965d5263846cdfc3005642f95641.tar.gz |
Split up multi-file patch and defuzz.
-rw-r--r-- | graphics/xv/files/patch-sum | 11 | ||||
-rw-r--r-- | graphics/xv/patches/patch-ab | 128 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2 | 963 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvdial.c | 233 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvgam.c | 152 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvjpeg.c | 37 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvmisc.c | 26 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvpopup.c | 84 | ||||
-rw-r--r-- | graphics/xv/patches/patch-png2-xvps.c | 39 |
9 files changed, 627 insertions, 1046 deletions
diff --git a/graphics/xv/files/patch-sum b/graphics/xv/files/patch-sum index 4a36ca87de0..2b5911cfd35 100644 --- a/graphics/xv/files/patch-sum +++ b/graphics/xv/files/patch-sum @@ -1,20 +1,25 @@ -$NetBSD: patch-sum,v 1.2 1999/09/20 18:04:11 christos Exp $ +$NetBSD: patch-sum,v 1.3 1999/11/14 13:25:58 rh Exp $ MD5 (patch-aa) = 77f91c256a0b0f6cbac5673684c8d585 -MD5 (patch-ab) = 00f294e7b19382652e8fa9de3545e907 +MD5 (patch-ab) = 1da2c2fd872eb392a48f132bbd4bf63c MD5 (patch-ac) = 7aae919c8c4b5894f04c531cff23934b MD5 (patch-ad) = bb5894cc304cf79a79c236eaf035547c MD5 (patch-ae) = 5836b41c1360daf8c29dc25bc32473a7 MD5 (patch-af) = 5d9d3addb26000dddae35a827e382b5e MD5 (patch-ag) = 872417731f001f1ab01cf099304efd91 MD5 (patch-png1) = 0656b2d14390e377e83abc1054a2bdbd -MD5 (patch-png2) = f2b0b37bedd7fc434d4715171f380bd9 MD5 (patch-png2-Imakefile) = d7255aa55e9b7a56b5f48c4b91e89409 MD5 (patch-png2-Makefile) = 1c26627ba95fb3b2bfd8dd3c1815167b MD5 (patch-png2-Makefile.std) = 27b1c478033a9a92eef4968ac51f28f6 MD5 (patch-png2-xv.c) = 26bd1c5c20fcc8be9e2e0b3c7c09a42a MD5 (patch-png2-xv.h) = cb0ad8942b1a329a9d6ecfe444ac04ea MD5 (patch-png2-xvbrowse.c) = e1f70e29c9c96324f7814b83a7682b4f +MD5 (patch-png2-xvdial.c) = f636989ed681e14ae063bb9af68fc7f3 MD5 (patch-png2-xvdir.c) = daeac18cd308ea2b012ed56a0fc1e42c MD5 (patch-png2-xvevent.c) = 657e2631ecab928e2c450a318875ec97 +MD5 (patch-png2-xvgam.c) = 1585c474440b72b51464285b1f323fb6 +MD5 (patch-png2-xvjpeg.c) = a0c51759ad215dbb492e69ad34d787dc +MD5 (patch-png2-xvmisc.c) = c7e1f6cf348f8a6fc89d19cb9027900b +MD5 (patch-png2-xvpopup.c) = 306099c32b6705e562d4a2b5a8cf0dd8 +MD5 (patch-png2-xvps.c) = 4fcdb366eb318bc707880e6fdcb61627 MD5 (patch-png3) = 84057565efcd7d28e6864ab0808610f2 diff --git a/graphics/xv/patches/patch-ab b/graphics/xv/patches/patch-ab index 51afa5b489e..2bc3a32cf0c 100644 --- a/graphics/xv/patches/patch-ab +++ b/graphics/xv/patches/patch-ab @@ -1,81 +1,49 @@ -$NetBSD: patch-ab,v 1.3 1998/08/07 10:40:55 agc Exp $ +$NetBSD: patch-ab,v 1.4 1999/11/14 13:25:59 rh Exp $ -*** vdcomp.c.orig Fri Dec 23 01:34:47 1994 ---- vdcomp.c Mon Nov 18 02:52:59 1996 -*************** -*** 108,114 **** - !defined(bsd43) && \ - !defined(aux) && \ - !defined(__bsdi__) && \ -! !defined(sequent) - - # if defined(hp300) || defined(hp800) || defined(NeXT) - # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */ ---- 108,115 ---- - !defined(bsd43) && \ - !defined(aux) && \ - !defined(__bsdi__) && \ -! !defined(sequent) && \ -! !defined(__FreeBSD__) && !defined(__NetBSD__) - - # if defined(hp300) || defined(hp800) || defined(NeXT) - # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */ -*************** -*** 429,438 **** - { - short shortint; - typedef long off_t; - - if (inname[0] == ' ') { - printf("\nEnter name of file to be decompressed: "); -! gets (inname); - } - - if (host == 1 | host == 2) { ---- 430,442 ---- - { - short shortint; - typedef long off_t; -+ char *s; - - if (inname[0] == ' ') { - printf("\nEnter name of file to be decompressed: "); -! fgets (inname, sizeof(inname), stdin); -! if ((s = strchr(inname, '\n')) != NULL) -! *s = '\0'; - } - - if (host == 1 | host == 2) { -*************** -*** 474,486 **** - printf("\n 3. VICAR format."); - printf("\n 4. Unlabelled binary array.\n"); - printf("\n Enter format number:"); -! gets(inname); - output_format = atoi(inname); - } while (output_format < 1 || output_format > 4); - - if (outname[0] == ' ') { - printf("\nEnter name of uncompressed output file: "); -! gets (outname); - } - - return(host); ---- 478,494 ---- - printf("\n 3. VICAR format."); - printf("\n 4. Unlabelled binary array.\n"); - printf("\n Enter format number:"); -! fgets (inname, sizeof(inname), stdin); -! if ((s = strchr(inname, '\n')) != NULL) -! *s = '\0'; - output_format = atoi(inname); - } while (output_format < 1 || output_format > 4); - - if (outname[0] == ' ') { - printf("\nEnter name of uncompressed output file: "); -! fgets (outname, sizeof(outname), stdin); -! if ((s = strchr(outname, '\n')) != NULL) -! *s = '\0'; - } - - return(host); +--- vdcomp.c.orig Sun Nov 14 13:54:56 1999 ++++ vdcomp.c Sun Nov 14 13:54:59 1999 +@@ -109,7 +109,8 @@ + !defined(__bsd43) && \ + !defined(aux) && \ + !defined(__bsdi__) && \ +- !defined(sequent) ++ !defined(sequent) && \ ++ !defined(__FreeBSD__) && !defined(__NetBSD__) + + # if defined(hp300) || defined(hp800) || defined(NeXT) + # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */ +@@ -437,10 +438,13 @@ + { + short shortint; + typedef long off_t; ++ char *s; + + if (inname[0] == ' ') { + printf("\nEnter name of file to be decompressed: "); +- gets (inname); ++ fgets (inname, sizeof(inname), stdin); ++ if ((s = strchr(inname, '\n')) != NULL) ++ *s = '\0'; + } + + if (host == 1 | host == 2) { +@@ -482,13 +486,17 @@ + printf("\n 3. VICAR format."); + printf("\n 4. Unlabelled binary array.\n"); + printf("\n Enter format number:"); +- gets(inname); ++ fgets (inname, sizeof(inname), stdin); ++ if ((s = strchr(inname, '\n')) != NULL) ++ *s = '\0'; + output_format = atoi(inname); + } while (output_format < 1 || output_format > 4); + + if (outname[0] == ' ') { + printf("\nEnter name of uncompressed output file: "); +- gets (outname); ++ fgets (outname, sizeof(outname), stdin); ++ if ((s = strchr(outname, '\n')) != NULL) ++ *s = '\0'; + } + + return(host); diff --git a/graphics/xv/patches/patch-png2 b/graphics/xv/patches/patch-png2 deleted file mode 100644 index de1719f7cb3..00000000000 --- a/graphics/xv/patches/patch-png2 +++ /dev/null @@ -1,963 +0,0 @@ -$NetBSD: patch-png2,v 1.1 1999/06/13 16:23:53 hubertf Exp $ - -This patch is based on -http://www.mit.edu/afs/athena/contrib/graphics/src/xv/patches/png/xvpng.diff -It was edited to fit into the NetBSD Packages Collection! - HF - ---------------------------------------------------------------------------- - -This is v1.2 of the PNG patch for xv. This version adds a PNG dialog -so that the gamma, compression, interlacing, and filters can be selected -when saving PNG images. The gamma dial needed floating point values, so -it required modifying the Dial widget, and subsequently affected all of -the popups that use a Dial (jpeg, ps, and color). - -To add PNG support to xv, you need the xv-3.10a source code, libpng and zlib. - -To apply the patch, go into the xv-3.10a directory and execute -patch -p1 < thisfile - -The Makefile expects libpng and zlib to be already compiled. The versions -I used were libpng-0.89 and zlib 1.0.2, but it should work with later -versions. You will also have to modify the makefile to give the location -of libpng and zlib on your system. - -Andreas Dilger <adilger@enel.ucalgary.ca> -http://www-mddsp.enel.ucalgary.ca/People/adilger/ - -Alexander Lehmann <lehmann@mathematik.th-darmstadt.de> -http://www.mathematik.th-darmstadt.de/~lehmann/ - -diff -c3 xv-3.10a/xvdial.c xvdial.c -*** xv-3.10a/xvdial.c Tue Jan 3 14:20:31 1995 ---- xvdial.c Wed May 29 14:37:54 1996 -*************** -*** 41,60 **** - - - /* local functions */ -! static int whereInDial PARM((DIAL *, int, int)); -! static void drawArrow PARM((DIAL *)); -! static void drawValStr PARM((DIAL *)); -! static void drawButt PARM((DIAL *, int, int)); -! static int computeDialVal PARM((DIAL *, int, int)); -! static void dimDial PARM((DIAL *)); - - - /***************************************************/ -! void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page, - fg, bg, hi, lo, title, units) - DIAL *dp; - Window parent; -! int x,y,w,h,minv,maxv,curv,page; - unsigned long fg,bg,hi,lo; - char *title, *units; - { ---- 41,61 ---- - - - /* local functions */ -! static int whereInDial PARM((DIAL *, int, int)); -! static void drawArrow PARM((DIAL *)); -! static void drawValStr PARM((DIAL *)); -! static void drawButt PARM((DIAL *, int, int)); -! static double computeDialVal PARM((DIAL *, int, int)); -! static void dimDial PARM((DIAL *)); - - - /***************************************************/ -! void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page, - fg, bg, hi, lo, title, units) - DIAL *dp; - Window parent; -! int x,y,w,h; -! double minv,maxv,curv,inc,page; - unsigned long fg,bg,hi,lo; - char *title, *units; - { -*************** -*** 98,115 **** - 1,fg,bg); - if (!dp->win) FatalError("can't create dial window"); - -! DSetRange(dp, minv, maxv, curv, page); - XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask); - } - - - /***************************************************/ -! void DSetRange(dp, minv, maxv, curv, page) -! DIAL *dp; -! int minv, maxv, curv, page; - { - if (maxv<minv) maxv=minv; -! dp->min = minv; dp->max = maxv; dp->page = page; - dp->active = (minv < maxv); - - DSetVal(dp, curv); ---- 99,116 ---- - 1,fg,bg); - if (!dp->win) FatalError("can't create dial window"); - -! DSetRange(dp, minv, maxv, curv, inc, page); - XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask); - } - - - /***************************************************/ -! void DSetRange(dp, minv, maxv, curv, inc, page) -! DIAL *dp; -! double minv, maxv, curv, inc, page; - { - if (maxv<minv) maxv=minv; -! dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page; - dp->active = (minv < maxv); - - DSetVal(dp, curv); -*************** -*** 118,125 **** - - /***************************************************/ - void DSetVal(dp, curv) -! DIAL *dp; -! int curv; - { - RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */ - ---- 119,126 ---- - - /***************************************************/ - void DSetVal(dp, curv) -! DIAL *dp; -! double curv; - { - RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */ - -*************** -*** 129,135 **** - XSetForeground(theDisp, theGC, dp->bg); - drawArrow(dp); - -! dp->val = curv; - - /* draw new arrow and string */ - XSetForeground(theDisp, theGC, dp->fg); ---- 130,136 ---- - XSetForeground(theDisp, theGC, dp->bg); - drawArrow(dp); - -! dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc; - - /* draw new arrow and string */ - XSetForeground(theDisp, theGC, dp->fg); -*************** -*** 202,208 **** - int mx,my; - { - Window rW,cW; -! int rx,ry, x,y, ipos, pos, lit, i, origval; - unsigned int mask; - - lit = 0; ---- 203,210 ---- - int mx,my; - { - Window rW,cW; -! int rx, ry, x, y, ipos, pos, lit; -! double origval; - unsigned int mask; - - lit = 0; -*************** -*** 224,232 **** - if (ipos != INDIAL) { - drawButt(dp, ipos, 1); - switch (ipos) { -! case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); break; - case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break; -! case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break; - case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break; - } - if (dp->drawobj != NULL) (dp->drawobj)(); ---- 226,234 ---- - if (ipos != INDIAL) { - drawButt(dp, ipos, 1); - switch (ipos) { -! case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); break; - case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break; -! case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); break; - case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break; - } - if (dp->drawobj != NULL) (dp->drawobj)(); -*************** -*** 235,242 **** - } - - else { -! i = computeDialVal(dp, mx, my); -! DSetVal(dp, i); - if (dp->drawobj != NULL) (dp->drawobj)(); - } - ---- 237,245 ---- - } - - else { -! double v; -! v = computeDialVal(dp, mx, my); -! DSetVal(dp, v); - if (dp->drawobj != NULL) (dp->drawobj)(); - } - -*************** -*** 246,256 **** - if (!(mask & Button1Mask)) break; /* button released */ - - if (ipos == INDIAL) { -! int j; -! i = computeDialVal(dp, x, y); -! j = dp->val; -! DSetVal(dp, i); -! if (j != dp->val) { - /* track whatever dial controls */ - if (dp->drawobj != NULL) (dp->drawobj)(); - } ---- 249,259 ---- - if (!(mask & Button1Mask)) break; /* button released */ - - if (ipos == INDIAL) { -! double v, w; -! v = computeDialVal(dp, x, y); -! w = dp->val; -! DSetVal(dp, v); -! if (w != dp->val) { - /* track whatever dial controls */ - if (dp->drawobj != NULL) (dp->drawobj)(); - } -*************** -*** 266,276 **** - - if (lit) { - switch (ipos) { -! case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); - break; - case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); - break; -! case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); - break; - case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); - break; ---- 269,279 ---- - - if (lit) { - switch (ipos) { -! case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); - break; - case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); - break; -! case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); - break; - case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); - break; -*************** -*** 320,338 **** - static void drawArrow(dp) - DIAL *dp; - { -! int i, rad, cx, cy; - XPoint arrow[4]; - - rad = dp->rad; cx = dp->cx; cy = dp->cy; - - /* map pos (range minv..maxv) into degrees (range 240..-60) */ -! i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min); -! arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD)); -! arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD)); -! arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD)); -! arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD)); -! arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD)); -! arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD)); - arrow[3].x = arrow[0].x; - arrow[3].y = arrow[0].y; - XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin); ---- 323,342 ---- - static void drawArrow(dp) - DIAL *dp; - { -! int rad, cx, cy; -! double v; - XPoint arrow[4]; - - rad = dp->rad; cx = dp->cx; cy = dp->cy; - - /* map pos (range minv..maxv) into degrees (range 240..-60) */ -! v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min); -! arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD)); -! arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD)); -! arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD)); -! arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD)); -! arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD)); -! arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD)); - arrow[3].x = arrow[0].x; - arrow[3].y = arrow[0].y; - XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin); -*************** -*** 343,365 **** - static void drawValStr(dp) - DIAL *dp; - { -! int i, x1, x2; - char foo[60], foo1[60]; - - /* compute longest string necessary so we can right-align this thing */ -! sprintf(foo,"%d",dp->min); x1 = strlen(foo); -! sprintf(foo,"%d",dp->max); x2 = strlen(foo); - if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */ - i = x1; if (x2>x1) i = x2; - if (dp->units) i += strlen(dp->units); - -! if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val); -! else sprintf(foo,"%d", dp->val); - - if (dp->units) strcat(foo,dp->units); - foo1[0] = '\0'; - if (strlen(foo) < (size_t) i) { -! for (i = i - strlen(foo); i>0; i--) strcat(foo1," "); - } - strcat(foo1, foo); - ---- 347,383 ---- - static void drawValStr(dp) - DIAL *dp; - { -! int tot, i, x1, x2; - char foo[60], foo1[60]; - - /* compute longest string necessary so we can right-align this thing */ -! sprintf(foo,"%d",(int)dp->min); x1 = strlen(foo); -! sprintf(foo,"%d",(int)dp->max); x2 = strlen(foo); - if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */ - i = x1; if (x2>x1) i = x2; - if (dp->units) i += strlen(dp->units); - -! sprintf(foo,"%g",dp->inc); /* space for decimal values */ -! tot = i + strlen(foo) - 1; /* Take away the 0 from the beginning */ -! -! if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val); -! else sprintf(foo,"%g", dp->val); -! -! if (dp->inc < 1.0) -! { -! int j; -! -! if (dp->val == (double)((int)dp->val)) -! strcat(foo,"."); -! -! for (j = strlen(foo); j < tot; j++) -! strcat(foo,"0"); -! } - - if (dp->units) strcat(foo,dp->units); - foo1[0] = '\0'; - if (strlen(foo) < (size_t) i) { -! for (i-=strlen(foo);i>0;i--) strcat(foo1," "); - } - strcat(foo1, foo); - -*************** -*** 411,422 **** - - - /***************************************************/ -! static int computeDialVal(dp, x, y) - DIAL *dp; - int x, y; - { -! int dx, dy, val; -! double angle; - - /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */ - dx = x - dp->cx; dy = dp->cy - y; ---- 429,441 ---- - - - /***************************************************/ -! static double computeDialVal(dp, x, y) - DIAL *dp; - int x, y; - { -! int dx, dy; -! -! double angle, val; - - /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */ - dx = x - dp->cx; dy = dp->cy - y; -*************** -*** 436,443 **** - if (angle > 270.0) angle -= 360.0; - if (angle < -90.0) angle += 360.0; - -! val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min; - - return val; - } - ---- 455,464 ---- - if (angle > 270.0) angle -= 360.0; - if (angle < -90.0) angle += 360.0; - -! val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min; - -+ /* round value to be an even multiple of dp->inc */ -+ val = (double)((int)(val / dp->inc + 0.5)) * dp->inc; - return val; - } - -diff -c3 xv-3.10a/xvgam.c xvgam.c -*** xv-3.10a/xvgam.c Fri Jan 13 12:51:14 1995 ---- xvgam.c Wed May 29 11:13:56 1996 -*************** -*** 265,275 **** - BTCreate(&gbut[G_BRNDCOL], cmapF, 5 + 66 + 67 + 2, 189, 66, BUTTH, - "Random", infofg, infobg, hicol, locol); - -! DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5, - infofg, infobg, hicol, locol, "Hue", NULL); -! DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5, - infofg, infobg, hicol, locol, "Sat.", NULL); -! DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5, - infofg, infobg, hicol, locol, "Value", NULL); - - rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor; ---- 265,275 ---- - BTCreate(&gbut[G_BRNDCOL], cmapF, 5 + 66 + 67 + 2, 189, 66, BUTTH, - "Random", infofg, infobg, hicol, locol); - -! DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, - infofg, infobg, hicol, locol, "Hue", NULL); -! DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, - infofg, infobg, hicol, locol, "Sat.", NULL); -! DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, - infofg, infobg, hicol, locol, "Value", NULL); - - rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor; -*************** -*** 359,365 **** - - srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial; - -! DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5, - infofg, infobg,hicol,locol, "Saturation", "%"); - - hueRB = RBCreate(NULL, hsvF, 7, 153, "1", ---- 359,365 ---- - - srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial; - -! DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0, - infofg, infobg,hicol,locol, "Saturation", "%"); - - hueRB = RBCreate(NULL, hsvF, 7, 153, "1", -*************** -*** 722,728 **** - - if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++; - -! if (satDial.val != 0) hsvnonlinear++; - - /* check intensity graf */ - for (i=0; i<256 && intGraf.func[i]==i; i++); ---- 722,728 ---- - - if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++; - -! if (satDial.val != 0.0) hsvnonlinear++; - - /* check intensity graf */ - for (i=0; i<256 && intGraf.func[i]==i; i++); -*************** -*** 1291,1304 **** - rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v); - if (h<0) h = 0; - -! DSetVal(&rhDial, (int) h); -! DSetVal(&gsDial, (int) (s*100)); -! DSetVal(&bvDial, (int) (v*100)); - } - else { -! DSetVal(&rhDial, rcmap[editColor]); -! DSetVal(&gsDial, gcmap[editColor]); -! DSetVal(&bvDial, bcmap[editColor]); - } - } - ---- 1291,1304 ---- - rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v); - if (h<0) h = 0; - -! DSetVal(&rhDial, h); -! DSetVal(&gsDial, s*100); -! DSetVal(&bvDial, v*100); - } - else { -! DSetVal(&rhDial, (double)rcmap[editColor]); -! DSetVal(&gsDial, (double)gcmap[editColor]); -! DSetVal(&bvDial, (double)bcmap[editColor]); - } - } - -*************** -*** 1310,1325 **** - - if (hsvmode) { - int rv, gv, bv; -! hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0, -! ((double) bvDial.val) / 100.0, &rv, &gv, &bv); - rcmap[editColor] = rv; - gcmap[editColor] = gv; - bcmap[editColor] = bv; - } - else { -! rcmap[editColor] = rhDial.val; -! gcmap[editColor] = gsDial.val; -! bcmap[editColor] = bvDial.val; - } - } - ---- 1310,1324 ---- - - if (hsvmode) { - int rv, gv, bv; -! hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv); - rcmap[editColor] = rv; - gcmap[editColor] = gv; - bcmap[editColor] = bv; - } - else { -! rcmap[editColor] = (int)rhDial.val; -! gcmap[editColor] = (int)gsDial.val; -! bcmap[editColor] = (int)bvDial.val; - } - } - -*************** -*** 1561,1569 **** - gsDial.title = "Green"; - bvDial.title = "Blue"; - -! DSetRange(&rhDial, 0, 255, rcmap[editColor], 16); -! DSetRange(&gsDial, 0, 255, gcmap[editColor], 16); -! DSetRange(&bvDial, 0, 255, bcmap[editColor], 16); - - XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); - XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); ---- 1560,1568 ---- - gsDial.title = "Green"; - bvDial.title = "Blue"; - -! DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0); -! DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0); -! DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0); - - XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); - XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); -*************** -*** 1581,1589 **** - &h, &s, &v); - - if (h<0.0) h = 0.0; -! DSetRange(&rhDial, 0, 360, (int) h, 5); -! DSetRange(&gsDial, 0, 100, (int) (s*100), 5); -! DSetRange(&bvDial, 0, 100, (int) (v*100), 5); - - XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); - XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); ---- 1580,1588 ---- - &h, &s, &v); - - if (h<0.0) h = 0.0; -! DSetRange(&rhDial, 0.0, 360.0, h, 1.0, 5.0); -! DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0); -! DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0); - - XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); - XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); -*************** -*** 1891,1897 **** - } - - /* apply satDial value to s */ -! s = s + ((double) satDial.val) / 100.0; - if (s<0.0) s = 0.0; - if (s>1.0) s = 1.0; - ---- 1890,1896 ---- - } - - /* apply satDial value to s */ -! s = s + satDial.val / 100.0; - if (s<0.0) s = 0.0; - if (s>1.0) s = 1.0; - -*************** -*** 2007,2013 **** - - gs->hueRBnum = RBWhich(hueRB); - -! gs->satval = satDial.val; - GetGrafState(&intGraf,&gs->istate); - GetGrafState(&rGraf, &gs->rstate); - GetGrafState(&gGraf, &gs->gstate); ---- 2006,2012 ---- - - gs->hueRBnum = RBWhich(hueRB); - -! gs->satval = (int)satDial.val; - GetGrafState(&intGraf,&gs->istate); - GetGrafState(&rGraf, &gs->rstate); - GetGrafState(&gGraf, &gs->gstate); -*************** -*** 2064,2071 **** - changed++; - } - -! if (gs->satval != satDial.val) { -! DSetVal(&satDial,gs->satval); - changed++; - } - ---- 2063,2070 ---- - changed++; - } - -! if (gs->satval != (int)satDial.val) { -! DSetVal(&satDial,(double)gs->satval); - changed++; - } - -*************** -*** 3200,3206 **** - - if (whtHD.enabCB.val && whtHD.satval) hsvmod++; - -! if (satDial.val != 0) hsvmod++; - - /* check intensity graf */ - for (i=0; i<256; i++) { ---- 3199,3205 ---- - - if (whtHD.enabCB.val && whtHD.satval) hsvmod++; - -! if (satDial.val != 0.0) hsvmod++; - - /* check intensity graf */ - for (i=0; i<256; i++) { -*************** -*** 3284,3290 **** - } - - /* apply satDial value to s */ -! s = s + satDial.val; - if (s< 0) s = 0; - if (s>100) s = 100; - ---- 3283,3289 ---- - } - - /* apply satDial value to s */ -! s = s + (int)satDial.val; - if (s< 0) s = 0; - if (s>100) s = 100; - -diff -c3 xv-3.10a/xvjpeg.c xvjpeg.c -*** xv-3.10a/xvjpeg.c Thu Jan 5 01:17:13 1995 ---- xvjpeg.c Wed May 29 11:15:02 1996 -*************** -*** 87,96 **** - - XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask); - -! DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5, - infofg, infobg, hicol, locol, "Quality", "%"); - -! DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5, - infofg, infobg, hicol, locol, "Smoothing", "%"); - - BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH, ---- 85,94 ---- - - XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask); - -! DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0, - infofg, infobg, hicol, locol, "Quality", "%"); - -! DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0, - infofg, infobg, hicol, locol, "Smoothing", "%"); - - BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH, -*************** -*** 759,766 **** - - - jpeg_set_defaults(&cinfo); -! jpeg_set_quality(&cinfo, qDial.val, TRUE); -! cinfo.smoothing_factor = smDial.val; - - - jpeg_start_compress(&cinfo, TRUE); ---- 757,764 ---- - - - jpeg_set_defaults(&cinfo); -! jpeg_set_quality(&cinfo, (int)qDial.val, TRUE); -! cinfo.smoothing_factor = (int)smDial.val; - - - jpeg_start_compress(&cinfo, TRUE); -*************** -*** 769,775 **** - /*** COMMENT HANDLING ***/ - - sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n", -! CREATOR_STR, REVDATE, qDial.val, smDial.val); - - if (picComments) { /* append XV comment */ - char *sp, *sp1; int done; ---- 767,773 ---- - /*** COMMENT HANDLING ***/ - - sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n", -! CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val); - - if (picComments) { /* append XV comment */ - char *sp, *sp1; int done; -diff -c3 xv-3.10a/xvmisc.c xvmisc.c -*** xv-3.10a/xvmisc.c Fri Jan 13 16:41:34 1995 ---- xvmisc.c Tue May 28 14:57:52 1996 -*************** -*** 520,525 **** ---- 520,529 ---- - if (tiffW) XDestroyWindow(theDisp, tiffW); - #endif - -+ #ifdef HAVE_PNG -+ if (pngW) XDestroyWindow(theDisp, pngW); -+ #endif -+ - /* if NOT using stdcmap for images, free stdcmap */ - if (colorMapMode != CM_STDCMAP) { - int j; -*************** -*** 715,720 **** ---- 719,728 ---- - - #ifdef HAVE_TIFF - if (tiffW) XDefineCursor(theDisp, tiffW, otherc); -+ #endif -+ -+ #ifdef HAVE_PNG -+ if (pngW) XDefineCursor(theDisp, pngW, otherc); - #endif - } - -diff -c3 xv-3.10a/xvpopup.c xvpopup.c -*** xv-3.10a/xvpopup.c Thu Jan 19 11:09:31 1995 ---- xvpopup.c Wed May 29 11:18:43 1996 -*************** -*** 200,213 **** - - if (!padHaveDooDads) { - DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100, -! 1, 2048, pWIDE, 10, - infofg, infobg, hicol, locol, "Width", NULL); - DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100, -! 1, 2048, pHIGH, 10, - infofg, infobg, hicol, locol, "Height", NULL); - - DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100, -! 0, 100, 100, 10, - infofg, infobg, hicol, locol, "Opaque", NULL); - - MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL, ---- 200,213 ---- - - if (!padHaveDooDads) { - DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100, -! 1.0, 2048.0, (double)pWIDE, 1.0, 10.0, - infofg, infobg, hicol, locol, "Width", NULL); - DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100, -! 1.0, 2048.0, (double)pHIGH, 1.0, 10.0, - infofg, infobg, hicol, locol, "Height", NULL); - - DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100, -! 0.0, 100.0, 100.0, 1.0, 10.0, - infofg, infobg, hicol, locol, "Opaque", NULL); - - MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL, -*************** -*** 258,266 **** - else if (poptyp == ISPAD) { - BTSetActive(&bts[0], (int) strlen(gsBuf)); - i = pWIDE * 3; RANGE(i,2048,9999); -! DSetRange(&padWDial, 1, i, padWDial.val, 10); - i = pHIGH * 3; RANGE(i,2048,9999); -! DSetRange(&padHDial, 1, i, padHDial.val, 10); - - DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */ - DSetActive(&padHDial, (padMode!=PAD_LOAD)); ---- 258,266 ---- - else if (poptyp == ISPAD) { - BTSetActive(&bts[0], (int) strlen(gsBuf)); - i = pWIDE * 3; RANGE(i,2048,9999); -! DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0); - i = pHIGH * 3; RANGE(i,2048,9999); -! DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0); - - DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */ - DSetActive(&padHDial, (padMode!=PAD_LOAD)); -*************** -*** 465,473 **** - changedGSBuf(); /* careful! popW doesn't exist yet! */ - - if (padHaveDooDads) { -! oldW = padWDial.val; -! oldH = padHDial.val; -! oldO = padODial.val; - } - else { oldW = pWIDE; oldH = pHIGH; oldO = 100; } - ---- 465,473 ---- - changedGSBuf(); /* careful! popW doesn't exist yet! */ - - if (padHaveDooDads) { -! oldW = (int)padWDial.val; -! oldH = (int)padHDial.val; -! oldO = (int)padODial.val; - } - else { oldW = pWIDE; oldH = pHIGH; oldO = 100; } - -*************** -*** 486,494 **** - } - - if (rv == 1) { /* cancelled: restore normal values */ -! DSetVal(&padWDial, oldW); -! DSetVal(&padHDial, oldH); -! DSetVal(&padODial, oldO); - } - - XUnmapWindow(theDisp, padWDial.win); ---- 486,494 ---- - } - - if (rv == 1) { /* cancelled: restore normal values */ -! DSetVal(&padWDial, (double)oldW); -! DSetVal(&padHDial, (double)oldH); -! DSetVal(&padODial, (double)oldO); - } - - XUnmapWindow(theDisp, padWDial.win); -*************** -*** 498,506 **** - /* load up return values */ - *pMode = padMode; - *pStr = padBuf; -! *pWide = padWDial.val; -! *pHigh = padHDial.val; -! *pOpaque = padODial.val; - *pOmode = padOMode; - - return rv; ---- 498,506 ---- - /* load up return values */ - *pMode = padMode; - *pStr = padBuf; -! *pWide = (int)padWDial.val; -! *pHigh = (int)padHDial.val; -! *pOpaque = (int)padODial.val; - *pOmode = padOMode; - - return rv; -*************** -*** 972,979 **** - else if (popUp == ISPAD) { - if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) { - if (BTTrack(&padDButt)) { -! DSetVal(&padWDial, pWIDE); -! DSetVal(&padHDial, pHIGH); - } - } - ---- 970,977 ---- - else if (popUp == ISPAD) { - if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) { - if (BTTrack(&padDButt)) { -! DSetVal(&padWDial, (double)pWIDE); -! DSetVal(&padHDial, (double)pHIGH); - } - } - -diff -c3 xv-3.10a/xvps.c xvps.c -*** xv-3.10a/xvps.c Thu Dec 22 15:34:42 1994 ---- xvps.c Wed May 29 11:04:28 1996 -*************** -*** 139,147 **** - CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol); - CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol); - -! DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5, - infofg, infobg, hicol, locol, "Width", "%"); -! DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5, - infofg, infobg, hicol, locol, "Height", "%"); - xsDial.drawobj = changedScale; - ysDial.drawobj = changedScale; ---- 139,147 ---- - CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol); - CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol); - -! DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, - infofg, infobg, hicol, locol, "Width", "%"); -! DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, - infofg, infobg, hicol, locol, "Height", "%"); - xsDial.drawobj = changedScale; - ysDial.drawobj = changedScale; -*************** -*** 236,245 **** - - if (rd_int("psres")) { /* xv.psres: default paper resolution */ - if (def_int >= 10 && def_int <= 720) { -! int i = (int) ((PIX2INCH * 100) / def_int); - -! DSetVal(&xsDial, i); -! DSetVal(&ysDial, i); - } - } - ---- 236,245 ---- - - if (rd_int("psres")) { /* xv.psres: default paper resolution */ - if (def_int >= 10 && def_int <= 720) { -! double v = (PIX2INCH * 100) / def_int; - -! DSetVal(&xsDial, v); -! DSetVal(&ysDial, v); - } - } - -*************** -*** 836,842 **** - if (scx < scy) { sz_iny = h * scx; } - else { sz_inx = w * scy; } - -! DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5)); - DSetVal(&ysDial, xsDial.val); - - sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0); ---- 836,842 ---- - if (scx < scy) { sz_iny = h * scx; } - else { sz_inx = w * scy; } - -! DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w); - DSetVal(&ysDial, xsDial.val); - - sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0); diff --git a/graphics/xv/patches/patch-png2-xvdial.c b/graphics/xv/patches/patch-png2-xvdial.c new file mode 100644 index 00000000000..61088cddd8c --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvdial.c @@ -0,0 +1,233 @@ +$NetBSD: patch-png2-xvdial.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvdial.c.orig Tue Jan 3 22:20:31 1995 ++++ xvdial.c Sun Nov 14 14:05:49 1999 +@@ -45,16 +45,17 @@ + static void drawArrow PARM((DIAL *)); + static void drawValStr PARM((DIAL *)); + static void drawButt PARM((DIAL *, int, int)); +-static int computeDialVal PARM((DIAL *, int, int)); ++static double computeDialVal PARM((DIAL *, int, int)); + static void dimDial PARM((DIAL *)); + + + /***************************************************/ +-void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page, ++void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page, + fg, bg, hi, lo, title, units) + DIAL *dp; + Window parent; +-int x,y,w,h,minv,maxv,curv,page; ++int x,y,w,h; ++double minv,maxv,curv,inc,page; + unsigned long fg,bg,hi,lo; + char *title, *units; + { +@@ -98,18 +99,18 @@ + 1,fg,bg); + if (!dp->win) FatalError("can't create dial window"); + +- DSetRange(dp, minv, maxv, curv, page); ++ DSetRange(dp, minv, maxv, curv, inc, page); + XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask); + } + + + /***************************************************/ +-void DSetRange(dp, minv, maxv, curv, page) ++void DSetRange(dp, minv, maxv, curv, inc, page) + DIAL *dp; +-int minv, maxv, curv, page; ++double minv, maxv, curv, inc, page; + { + if (maxv<minv) maxv=minv; +- dp->min = minv; dp->max = maxv; dp->page = page; ++ dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page; + dp->active = (minv < maxv); + + DSetVal(dp, curv); +@@ -119,7 +120,7 @@ + /***************************************************/ + void DSetVal(dp, curv) + DIAL *dp; +-int curv; ++double curv; + { + RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */ + +@@ -129,7 +130,7 @@ + XSetForeground(theDisp, theGC, dp->bg); + drawArrow(dp); + +- dp->val = curv; ++ dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc; + + /* draw new arrow and string */ + XSetForeground(theDisp, theGC, dp->fg); +@@ -202,7 +203,8 @@ + int mx,my; + { + Window rW,cW; +- int rx,ry, x,y, ipos, pos, lit, i, origval; ++ int rx, ry, x, y, ipos, pos, lit; ++ double origval; + unsigned int mask; + + lit = 0; +@@ -224,9 +226,9 @@ + if (ipos != INDIAL) { + drawButt(dp, ipos, 1); + switch (ipos) { +- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); break; ++ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); break; + case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break; +- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break; ++ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); break; + case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break; + } + if (dp->drawobj != NULL) (dp->drawobj)(); +@@ -235,8 +237,9 @@ + } + + else { +- i = computeDialVal(dp, mx, my); +- DSetVal(dp, i); ++ double v; ++ v = computeDialVal(dp, mx, my); ++ DSetVal(dp, v); + if (dp->drawobj != NULL) (dp->drawobj)(); + } + +@@ -246,11 +249,11 @@ + if (!(mask & Button1Mask)) break; /* button released */ + + if (ipos == INDIAL) { +- int j; +- i = computeDialVal(dp, x, y); +- j = dp->val; +- DSetVal(dp, i); +- if (j != dp->val) { ++ double v, w; ++ v = computeDialVal(dp, x, y); ++ w = dp->val; ++ DSetVal(dp, v); ++ if (w != dp->val) { + /* track whatever dial controls */ + if (dp->drawobj != NULL) (dp->drawobj)(); + } +@@ -266,11 +269,11 @@ + + if (lit) { + switch (ipos) { +- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); ++ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); + break; + case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); + break; +- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); ++ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); + break; + case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); + break; +@@ -320,19 +323,20 @@ + static void drawArrow(dp) + DIAL *dp; + { +- int i, rad, cx, cy; ++ int rad, cx, cy; ++ double v; + XPoint arrow[4]; + + rad = dp->rad; cx = dp->cx; cy = dp->cy; + + /* map pos (range minv..maxv) into degrees (range 240..-60) */ +- i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min); +- arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD)); +- arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD)); +- arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD)); +- arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD)); +- arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD)); +- arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD)); ++ v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min); ++ arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD)); ++ arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD)); ++ arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD)); ++ arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD)); ++ arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD)); ++ arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD)); + arrow[3].x = arrow[0].x; + arrow[3].y = arrow[0].y; + XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin); +@@ -343,23 +347,37 @@ + static void drawValStr(dp) + DIAL *dp; + { +- int i, x1, x2; ++ int tot, i, x1, x2; + char foo[60], foo1[60]; + + /* compute longest string necessary so we can right-align this thing */ +- sprintf(foo,"%d",dp->min); x1 = strlen(foo); +- sprintf(foo,"%d",dp->max); x2 = strlen(foo); ++ sprintf(foo,"%d",(int)dp->min); x1 = strlen(foo); ++ sprintf(foo,"%d",(int)dp->max); x2 = strlen(foo); + if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */ + i = x1; if (x2>x1) i = x2; + if (dp->units) i += strlen(dp->units); + +- if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val); +- else sprintf(foo,"%d", dp->val); ++ sprintf(foo,"%g",dp->inc); /* space for decimal values */ ++ tot = i + strlen(foo) - 1; /* Take away the 0 from the beginning */ ++ ++ if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val); ++ else sprintf(foo,"%g", dp->val); ++ ++ if (dp->inc < 1.0) ++ { ++ int j; ++ ++ if (dp->val == (double)((int)dp->val)) ++ strcat(foo,"."); ++ ++ for (j = strlen(foo); j < tot; j++) ++ strcat(foo,"0"); ++ } + + if (dp->units) strcat(foo,dp->units); + foo1[0] = '\0'; + if (strlen(foo) < (size_t) i) { +- for (i = i - strlen(foo); i>0; i--) strcat(foo1," "); ++ for (i-=strlen(foo);i>0;i--) strcat(foo1," "); + } + strcat(foo1, foo); + +@@ -411,12 +429,13 @@ + + + /***************************************************/ +-static int computeDialVal(dp, x, y) ++static double computeDialVal(dp, x, y) + DIAL *dp; + int x, y; + { +- int dx, dy, val; +- double angle; ++ int dx, dy; ++ ++ double angle, val; + + /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */ + dx = x - dp->cx; dy = dp->cy - y; +@@ -436,8 +455,10 @@ + if (angle > 270.0) angle -= 360.0; + if (angle < -90.0) angle += 360.0; + +- val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min; ++ val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min; + ++ /* round value to be an even multiple of dp->inc */ ++ val = (double)((int)(val / dp->inc + 0.5)) * dp->inc; + return val; + } + diff --git a/graphics/xv/patches/patch-png2-xvgam.c b/graphics/xv/patches/patch-png2-xvgam.c new file mode 100644 index 00000000000..1933b8889bd --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvgam.c @@ -0,0 +1,152 @@ +$NetBSD: patch-png2-xvgam.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvgam.c.orig Fri Jan 13 20:51:14 1995 ++++ xvgam.c Sun Nov 14 14:05:49 1999 +@@ -265,11 +265,11 @@ + BTCreate(&gbut[G_BRNDCOL], cmapF, 5 + 66 + 67 + 2, 189, 66, BUTTH, + "Random", infofg, infobg, hicol, locol); + +- DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5, ++ DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, + infofg, infobg, hicol, locol, "Hue", NULL); +- DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5, ++ DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, + infofg, infobg, hicol, locol, "Sat.", NULL); +- DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5, ++ DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, + infofg, infobg, hicol, locol, "Value", NULL); + + rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor; +@@ -359,7 +359,7 @@ + + srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial; + +- DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5, ++ DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0, + infofg, infobg,hicol,locol, "Saturation", "%"); + + hueRB = RBCreate(NULL, hsvF, 7, 153, "1", +@@ -722,7 +722,7 @@ + + if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++; + +- if (satDial.val != 0) hsvnonlinear++; ++ if (satDial.val != 0.0) hsvnonlinear++; + + /* check intensity graf */ + for (i=0; i<256 && intGraf.func[i]==i; i++); +@@ -1291,14 +1291,14 @@ + rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v); + if (h<0) h = 0; + +- DSetVal(&rhDial, (int) h); +- DSetVal(&gsDial, (int) (s*100)); +- DSetVal(&bvDial, (int) (v*100)); ++ DSetVal(&rhDial, h); ++ DSetVal(&gsDial, s*100); ++ DSetVal(&bvDial, v*100); + } + else { +- DSetVal(&rhDial, rcmap[editColor]); +- DSetVal(&gsDial, gcmap[editColor]); +- DSetVal(&bvDial, bcmap[editColor]); ++ DSetVal(&rhDial, (double)rcmap[editColor]); ++ DSetVal(&gsDial, (double)gcmap[editColor]); ++ DSetVal(&bvDial, (double)bcmap[editColor]); + } + } + +@@ -1310,16 +1310,15 @@ + + if (hsvmode) { + int rv, gv, bv; +- hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0, +- ((double) bvDial.val) / 100.0, &rv, &gv, &bv); ++ hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv); + rcmap[editColor] = rv; + gcmap[editColor] = gv; + bcmap[editColor] = bv; + } + else { +- rcmap[editColor] = rhDial.val; +- gcmap[editColor] = gsDial.val; +- bcmap[editColor] = bvDial.val; ++ rcmap[editColor] = (int)rhDial.val; ++ gcmap[editColor] = (int)gsDial.val; ++ bcmap[editColor] = (int)bvDial.val; + } + } + +@@ -1561,9 +1560,9 @@ + gsDial.title = "Green"; + bvDial.title = "Blue"; + +- DSetRange(&rhDial, 0, 255, rcmap[editColor], 16); +- DSetRange(&gsDial, 0, 255, gcmap[editColor], 16); +- DSetRange(&bvDial, 0, 255, bcmap[editColor], 16); ++ DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0); ++ DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0); ++ DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0); + + XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); + XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); +@@ -1581,9 +1580,9 @@ + &h, &s, &v); + + if (h<0.0) h = 0.0; +- DSetRange(&rhDial, 0, 360, (int) h, 5); +- DSetRange(&gsDial, 0, 100, (int) (s*100), 5); +- DSetRange(&bvDial, 0, 100, (int) (v*100), 5); ++ DSetRange(&rhDial, 0.0, 360.0, h, 1.0, 5.0); ++ DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0); ++ DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0); + + XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial); + XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial); +@@ -1891,7 +1890,7 @@ + } + + /* apply satDial value to s */ +- s = s + ((double) satDial.val) / 100.0; ++ s = s + satDial.val / 100.0; + if (s<0.0) s = 0.0; + if (s>1.0) s = 1.0; + +@@ -2007,7 +2006,7 @@ + + gs->hueRBnum = RBWhich(hueRB); + +- gs->satval = satDial.val; ++ gs->satval = (int)satDial.val; + GetGrafState(&intGraf,&gs->istate); + GetGrafState(&rGraf, &gs->rstate); + GetGrafState(&gGraf, &gs->gstate); +@@ -2064,8 +2063,8 @@ + changed++; + } + +- if (gs->satval != satDial.val) { +- DSetVal(&satDial,gs->satval); ++ if (gs->satval != (int)satDial.val) { ++ DSetVal(&satDial,(double)gs->satval); + changed++; + } + +@@ -3200,7 +3199,7 @@ + + if (whtHD.enabCB.val && whtHD.satval) hsvmod++; + +- if (satDial.val != 0) hsvmod++; ++ if (satDial.val != 0.0) hsvmod++; + + /* check intensity graf */ + for (i=0; i<256; i++) { +@@ -3284,7 +3283,7 @@ + } + + /* apply satDial value to s */ +- s = s + satDial.val; ++ s = s + (int)satDial.val; + if (s< 0) s = 0; + if (s>100) s = 100; + diff --git a/graphics/xv/patches/patch-png2-xvjpeg.c b/graphics/xv/patches/patch-png2-xvjpeg.c new file mode 100644 index 00000000000..474d7793c57 --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvjpeg.c @@ -0,0 +1,37 @@ +$NetBSD: patch-png2-xvjpeg.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvjpeg.c.orig Sun Nov 14 14:05:46 1999 ++++ xvjpeg.c Sun Nov 14 14:05:49 1999 +@@ -87,10 +87,10 @@ + + XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask); + +- DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5, ++ DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0, + infofg, infobg, hicol, locol, "Quality", "%"); + +- DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5, ++ DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0, + infofg, infobg, hicol, locol, "Smoothing", "%"); + + BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH, +@@ -759,8 +759,8 @@ + + + jpeg_set_defaults(&cinfo); +- jpeg_set_quality(&cinfo, qDial.val, TRUE); +- cinfo.smoothing_factor = smDial.val; ++ jpeg_set_quality(&cinfo, (int)qDial.val, TRUE); ++ cinfo.smoothing_factor = (int)smDial.val; + + + jpeg_start_compress(&cinfo, TRUE); +@@ -769,7 +769,7 @@ + /*** COMMENT HANDLING ***/ + + sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n", +- CREATOR_STR, REVDATE, qDial.val, smDial.val); ++ CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val); + + if (picComments) { /* append XV comment */ + char *sp, *sp1; int done; diff --git a/graphics/xv/patches/patch-png2-xvmisc.c b/graphics/xv/patches/patch-png2-xvmisc.c new file mode 100644 index 00000000000..8c880b9a95a --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvmisc.c @@ -0,0 +1,26 @@ +$NetBSD: patch-png2-xvmisc.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvmisc.c.orig Sun Nov 14 14:05:45 1999 ++++ xvmisc.c Sun Nov 14 14:05:49 1999 +@@ -522,6 +522,10 @@ + + if (pcdW) XDestroyWindow(theDisp, pcdW); + ++#ifdef HAVE_PNG ++ if (pngW) XDestroyWindow(theDisp, pngW); ++#endif ++ + /* if NOT using stdcmap for images, free stdcmap */ + if (colorMapMode != CM_STDCMAP) { + int j; +@@ -717,6 +721,10 @@ + + #ifdef HAVE_TIFF + if (tiffW) XDefineCursor(theDisp, tiffW, otherc); ++#endif ++ ++#ifdef HAVE_PNG ++ if (pngW) XDefineCursor(theDisp, pngW, otherc); + #endif + + if (pcdW) XDefineCursor(theDisp, pcdW, otherc); diff --git a/graphics/xv/patches/patch-png2-xvpopup.c b/graphics/xv/patches/patch-png2-xvpopup.c new file mode 100644 index 00000000000..90db701d12f --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvpopup.c @@ -0,0 +1,84 @@ +$NetBSD: patch-png2-xvpopup.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvpopup.c.orig Thu Jan 19 19:09:31 1995 ++++ xvpopup.c Sun Nov 14 14:05:49 1999 +@@ -200,14 +200,14 @@ + + if (!padHaveDooDads) { + DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100, +- 1, 2048, pWIDE, 10, ++ 1.0, 2048.0, (double)pWIDE, 1.0, 10.0, + infofg, infobg, hicol, locol, "Width", NULL); + DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100, +- 1, 2048, pHIGH, 10, ++ 1.0, 2048.0, (double)pHIGH, 1.0, 10.0, + infofg, infobg, hicol, locol, "Height", NULL); + + DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100, +- 0, 100, 100, 10, ++ 0.0, 100.0, 100.0, 1.0, 10.0, + infofg, infobg, hicol, locol, "Opaque", NULL); + + MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL, +@@ -258,9 +258,9 @@ + else if (poptyp == ISPAD) { + BTSetActive(&bts[0], (int) strlen(gsBuf)); + i = pWIDE * 3; RANGE(i,2048,9999); +- DSetRange(&padWDial, 1, i, padWDial.val, 10); ++ DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0); + i = pHIGH * 3; RANGE(i,2048,9999); +- DSetRange(&padHDial, 1, i, padHDial.val, 10); ++ DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0); + + DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */ + DSetActive(&padHDial, (padMode!=PAD_LOAD)); +@@ -465,9 +465,9 @@ + changedGSBuf(); /* careful! popW doesn't exist yet! */ + + if (padHaveDooDads) { +- oldW = padWDial.val; +- oldH = padHDial.val; +- oldO = padODial.val; ++ oldW = (int)padWDial.val; ++ oldH = (int)padHDial.val; ++ oldO = (int)padODial.val; + } + else { oldW = pWIDE; oldH = pHIGH; oldO = 100; } + +@@ -486,9 +486,9 @@ + } + + if (rv == 1) { /* cancelled: restore normal values */ +- DSetVal(&padWDial, oldW); +- DSetVal(&padHDial, oldH); +- DSetVal(&padODial, oldO); ++ DSetVal(&padWDial, (double)oldW); ++ DSetVal(&padHDial, (double)oldH); ++ DSetVal(&padODial, (double)oldO); + } + + XUnmapWindow(theDisp, padWDial.win); +@@ -498,9 +498,9 @@ + /* load up return values */ + *pMode = padMode; + *pStr = padBuf; +- *pWide = padWDial.val; +- *pHigh = padHDial.val; +- *pOpaque = padODial.val; ++ *pWide = (int)padWDial.val; ++ *pHigh = (int)padHDial.val; ++ *pOpaque = (int)padODial.val; + *pOmode = padOMode; + + return rv; +@@ -972,8 +972,8 @@ + else if (popUp == ISPAD) { + if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) { + if (BTTrack(&padDButt)) { +- DSetVal(&padWDial, pWIDE); +- DSetVal(&padHDial, pHIGH); ++ DSetVal(&padWDial, (double)pWIDE); ++ DSetVal(&padHDial, (double)pHIGH); + } + } + diff --git a/graphics/xv/patches/patch-png2-xvps.c b/graphics/xv/patches/patch-png2-xvps.c new file mode 100644 index 00000000000..990eb70cdc6 --- /dev/null +++ b/graphics/xv/patches/patch-png2-xvps.c @@ -0,0 +1,39 @@ +$NetBSD: patch-png2-xvps.c,v 1.1 1999/11/14 13:26:01 rh Exp $ + +--- xvps.c.orig Thu Dec 22 23:34:42 1994 ++++ xvps.c Sun Nov 14 14:05:49 1999 +@@ -139,9 +139,9 @@ + CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol); + CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol); + +- DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5, ++ DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, + infofg, infobg, hicol, locol, "Width", "%"); +- DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5, ++ DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, + infofg, infobg, hicol, locol, "Height", "%"); + xsDial.drawobj = changedScale; + ysDial.drawobj = changedScale; +@@ -236,10 +236,10 @@ + + if (rd_int("psres")) { /* xv.psres: default paper resolution */ + if (def_int >= 10 && def_int <= 720) { +- int i = (int) ((PIX2INCH * 100) / def_int); ++ double v = (PIX2INCH * 100) / def_int; + +- DSetVal(&xsDial, i); +- DSetVal(&ysDial, i); ++ DSetVal(&xsDial, v); ++ DSetVal(&ysDial, v); + } + } + +@@ -836,7 +836,7 @@ + if (scx < scy) { sz_iny = h * scx; } + else { sz_inx = w * scy; } + +- DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5)); ++ DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w); + DSetVal(&ysDial, xsDial.val); + + sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0); |