summaryrefslogtreecommitdiff
path: root/test/cdtest
diff options
context:
space:
mode:
Diffstat (limited to 'test/cdtest')
-rw-r--r--test/cdtest/.cvsignore16
-rw-r--r--test/cdtest/cdtest.bat3
-rw-r--r--test/cdtest/cdtest.c2662
-rw-r--r--test/cdtest/cdtest.dsp107
-rw-r--r--test/cdtest/cdtest.h415
-rw-r--r--test/cdtest/cdtest.icobin0 -> 766 bytes
-rw-r--r--test/cdtest/cdtest.led1508
-rw-r--r--test/cdtest/cdtest.rc1
-rw-r--r--test/cdtest/cdtest.sln16
-rw-r--r--test/cdtest/cdtest.vcproj161
-rw-r--r--test/cdtest/cdtest_led.c1590
-rw-r--r--test/cdtest/colobar.h7
-rw-r--r--test/cdtest/colorbar.c565
-rw-r--r--test/cdtest/config.mak24
-rw-r--r--test/cdtest/drivers.c457
-rw-r--r--test/cdtest/list.c278
-rw-r--r--test/cdtest/rubber.c387
17 files changed, 8197 insertions, 0 deletions
diff --git a/test/cdtest/.cvsignore b/test/cdtest/.cvsignore
new file mode 100644
index 0000000..1da6c19
--- /dev/null
+++ b/test/cdtest/.cvsignore
@@ -0,0 +1,16 @@
+obj
+bin
+william
+so_locations
+*.dep
+*.wdep
+*.loh
+.plan
+.project
+*.err
+Makefile
+*.make
+*.suo
+*.ncb
+*.opt
+*.user
diff --git a/test/cdtest/cdtest.bat b/test/cdtest/cdtest.bat
new file mode 100644
index 0000000..3249300
--- /dev/null
+++ b/test/cdtest/cdtest.bat
@@ -0,0 +1,3 @@
+@echo off
+REM Script generated automatically by tecmake v3.10
+..\bin\Win32\cdtest.exe %*
diff --git a/test/cdtest/cdtest.c b/test/cdtest/cdtest.c
new file mode 100644
index 0000000..bf701b9
--- /dev/null
+++ b/test/cdtest/cdtest.c
@@ -0,0 +1,2662 @@
+/*=========================================================================*/
+/* CDTEST.C - 09/12/95 */
+/* Canvas Draw Test. */
+/*=========================================================================*/
+
+/*- Convenccoes Usadas: ---------------------------------------------------*/
+/* - Identificadores de funccoes associadas a um callback comeccam por f. */
+/* Ex: fResize, fRepaint. */
+/* - Identificadores de constantes sao escritos em maiusculas. */
+/* Ex: LINE, ARC, NEWPOINT. */
+/* - Identificadores de funcoes internas do programa sao escritas em */
+/* minusculas. */
+/* Ex: newpolypoint, dellist. */
+/*-------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <iup.h>
+#include <cd.h>
+#include <wd.h>
+#include <cdiup.h>
+#include <cdpicture.h>
+#include <cddbuf.h>
+#include <cdirgb.h>
+#include <cdgdiplus.h>
+#include <iupkey.h>
+
+#include "cdtest.h"
+
+/*- Contexto do CD Test: --------------------------------------------------*/
+tCTC ctgc;
+
+/*- Parametros geometricos da primitiva sendo desenhada: ------------------*/
+tLinePos line_pos;
+tBoxPos box_pos;
+tPixelPos pixel_pos;
+tMarkPos mark_pos;
+tArcPos arc_pos;
+
+//#define USE_GDIPLUS
+
+#ifdef USE_GDIPLUS
+static const int use_gdiplus = 1;
+#else
+static const int use_gdiplus = 0;
+#endif
+
+static const int antialias = 1;
+
+
+/*-------------------------------------------------------------------------*/
+/* Associa os call-backs do IUP. */
+/*-------------------------------------------------------------------------*/
+void setcallbacks(void)
+{
+ IupSetFunction("cmdFileExit", (Icallback) fFileExit);
+
+ IupSetFunction("cmdEditClear", (Icallback) fEditClear);
+ IupSetFunction("cmdEditUndo", (Icallback) fEditUndo);
+
+ IupSetFunction("cmdHelpAbout", (Icallback) fHelpAbout);
+ IupSetFunction("cmdCloseAbout", (Icallback) fCloseAbout);
+
+ IupSetFunction("cmdWDCanvas", (Icallback) fWDCanvas);
+ IupSetFunction("cmdCloseWD", (Icallback) fCloseWD);
+ IupSetFunction("cmdPICCanvas", (Icallback) fPICCanvas);
+ IupSetFunction("cmdClosePIC", (Icallback) fClosePIC);
+
+ IupSetFunction("cmdShowDialog", (Icallback) fShowDialog);
+ IupSetFunction("cmdLine", (Icallback) fLine);
+ IupSetFunction("cmdRect", (Icallback) fRect);
+ IupSetFunction("cmdBox", (Icallback) fBox);
+ IupSetFunction("cmdArc", (Icallback) fArc);
+ IupSetFunction("cmdSector", (Icallback) fSector);
+ IupSetFunction("cmdChord", (Icallback) fChord);
+ IupSetFunction("cmdPixel", (Icallback) fPixel);
+ IupSetFunction("cmdMark", (Icallback) fMark);
+ IupSetFunction("cmdText", (Icallback) fText);
+ IupSetFunction("cmdPoly", (Icallback) fPoly);
+
+ IupSetFunction("cmdOptions", (Icallback) fOptions);
+ IupSetFunction("cmdOptionsHide", (Icallback) fOptionsHide);
+ IupSetFunction("cmdAttributes", (Icallback) fAttributes);
+ IupSetFunction("cmdAttributesHide", (Icallback) fAttributesHide);
+ IupSetFunction("cmdMsgHide", (Icallback) fMsgHide);
+ IupSetFunction("cmdSimulate", (Icallback) fSimulate);
+ IupSetFunction("cmdStretchPlay", (Icallback) fStretchPlay);
+
+ IupSetFunction("cmdWriteMode", (Icallback) fWriteMode);
+ IupSetFunction("cmdLineStyle", (Icallback) fLineStyle);
+ IupSetFunction("cmdLineCap", (Icallback) fLineCap);
+ IupSetFunction("cmdLineJoin", (Icallback) fLineJoin);
+ IupSetFunction("cmdFillMode", (Icallback) fFillMode);
+ IupSetFunction("cmdFontStyle", (Icallback) fFontStyle);
+ IupSetFunction("cmdFontTypeFace", (Icallback) fFontTypeFace);
+ IupSetFunction("cmdMarkType", (Icallback) fMarkType);
+ IupSetFunction("cmdTextAlignment", (Icallback) fTextAlignment);
+ IupSetFunction("cmdHatchStyle", (Icallback) fHatchStyle);
+ IupSetFunction("cmdOpacity", (Icallback) fOpacity);
+
+ IupSetFunction("cmdNoBuffering", (Icallback) fNoBuffering);
+ IupSetFunction("cmdImageBuffer", (Icallback) fImageBuffer);
+ IupSetFunction("cmdRGBBuffer", (Icallback) fRGBBuffer);
+
+ IupSetFunction("cmdInteger", (Icallback) fInteger);
+ IupSetFunction("cmdReal", (Icallback) fReal);
+ IupSetFunction("cmdDraw", (Icallback) fDraw);
+
+ IupSetFunction("cmdSolid", (Icallback) fSolid);
+ IupSetFunction("cmdHatch", (Icallback) fHatch);
+ IupSetFunction("cmdStipple", (Icallback) fStipple);
+ IupSetFunction("cmdPattern", (Icallback) fPattern);
+
+ IupSetFunction("cmdOpenLines", (Icallback) fOpenLines);
+ IupSetFunction("cmdClosedLines", (Icallback) fClosedLines);
+ IupSetFunction("cmdFill", (Icallback) fFill);
+ IupSetFunction("cmdPolyClip", (Icallback) fPolyClip);
+ IupSetFunction("cmdPolyBezier", (Icallback) fPolyBezier);
+
+ IupSetFunction("cmdClip", (Icallback) fClip);
+ IupSetFunction("cmdClipArea", (Icallback) fClipArea);
+ IupSetFunction("cmdClipOff", (Icallback) fClipOff);
+ IupSetFunction("cmdClipPoly", (Icallback) fClipPoly);
+
+ IupSetFunction("cmdImage", (Icallback) fImage);
+ IupSetFunction("cmdImagePut", (Icallback) fImagePut);
+ IupSetFunction("cmdImageGet", (Icallback) fImageGet);
+
+ IupSetFunction("cmdImageRGB", (Icallback) fImageRGB);
+ IupSetFunction("cmdImageRGBPut", (Icallback) fImageRGBPut);
+ IupSetFunction("cmdImageRGBGet", (Icallback) fImageRGBGet);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o stipple e o pattern exemplo. */
+/*-------------------------------------------------------------------------*/
+void initsamples(void)
+{
+ int i;
+
+ /* zera os vetores */
+ for (i=0; i<100; i++) {
+ ctgc.stipple[i] = 0;
+ ctgc.pattern[i] = 0xffffffl;
+ }
+
+ /* especificaccao do stipple */
+ ctgc.stipple[11] = 1; /*------------*/
+ ctgc.stipple[21] = 1; /* 0123456789*/
+ ctgc.stipple[31] = 1; /* */
+ ctgc.stipple[41] = 1; /*9 0000000000*/
+ ctgc.stipple[51] = 1; /*8 0000111110*/
+ /*7 0001000110*/
+ ctgc.stipple[12] = 1; /*6 0010001010*/
+ ctgc.stipple[52] = 1; /*5 0111110010*/
+ ctgc.stipple[62] = 1; /*4 0100010010*/
+ /*3 0100010100*/
+ ctgc.stipple[13] = 1; /*2 0100011000*/
+ ctgc.stipple[53] = 1; /*1 0111110000*/
+ ctgc.stipple[73] = 1; /*0 0000000000*/
+ /*------------*/
+ ctgc.stipple[14] = 1;
+ ctgc.stipple[54] = 1;
+ ctgc.stipple[84] = 1;
+
+ ctgc.stipple[15] = 1; ctgc.stipple[26] = 1;
+ ctgc.stipple[25] = 1; ctgc.stipple[66] = 1;
+ ctgc.stipple[35] = 1; ctgc.stipple[86] = 1;
+ ctgc.stipple[45] = 1;
+ ctgc.stipple[55] = 1; ctgc.stipple[48] = 1;
+ ctgc.stipple[85] = 1; ctgc.stipple[58] = 1;
+ ctgc.stipple[68] = 1;
+ ctgc.stipple[37] = 1; ctgc.stipple[78] = 1;
+ ctgc.stipple[77] = 1; ctgc.stipple[88] = 1;
+ ctgc.stipple[87] = 1;
+
+
+ /* especificaccao do stipple */
+ ctgc.pattern[11] = CD_RED; /*------------*/
+ ctgc.pattern[21] = CD_RED; /* 0123456789*/
+ ctgc.pattern[31] = CD_RED; /* */
+ ctgc.pattern[41] = CD_RED; /*9 WWWWWWWWWW*/
+ ctgc.pattern[51] = CD_RED; /*8 WWWWGGGGGW*/
+ ctgc.pattern[12] = CD_RED; /*7 WWWGGGGGBW*/
+ ctgc.pattern[22] = CD_RED; /*6 WWGGGGGBBW*/
+ ctgc.pattern[32] = CD_RED; /*5 WrrrrrBBBW*/
+ ctgc.pattern[42] = CD_RED; /*4 WrrrrrBBBW*/
+ ctgc.pattern[52] = CD_RED; /*3 WrrrrrBBWW*/
+ ctgc.pattern[13] = CD_RED; /*2 WrrrrrBWWW*/
+ ctgc.pattern[23] = CD_RED; /*1 WrrrrrWWWW*/
+ ctgc.pattern[33] = CD_RED; /*0 WWWWWWWWWW*/
+ ctgc.pattern[43] = CD_RED; /*------------*/
+ ctgc.pattern[53] = CD_RED;
+ ctgc.pattern[14] = CD_RED; ctgc.pattern[15] = CD_RED;
+ ctgc.pattern[24] = CD_RED; ctgc.pattern[25] = CD_RED;
+ ctgc.pattern[34] = CD_RED; ctgc.pattern[35] = CD_RED;
+ ctgc.pattern[44] = CD_RED; ctgc.pattern[45] = CD_RED;
+ ctgc.pattern[54] = CD_RED; ctgc.pattern[55] = CD_RED;
+
+ ctgc.pattern[26] = CD_BLUE; ctgc.pattern[37] = CD_BLUE;
+ ctgc.pattern[36] = CD_BLUE; ctgc.pattern[47] = CD_BLUE;
+ ctgc.pattern[46] = CD_BLUE; ctgc.pattern[57] = CD_BLUE;
+ ctgc.pattern[56] = CD_BLUE; ctgc.pattern[67] = CD_BLUE;
+
+ ctgc.pattern[48] = CD_BLUE; ctgc.pattern[62] = CD_GREEN;
+ ctgc.pattern[58] = CD_BLUE; ctgc.pattern[63] = CD_GREEN;
+ ctgc.pattern[68] = CD_BLUE; ctgc.pattern[64] = CD_GREEN;
+ ctgc.pattern[78] = CD_BLUE; ctgc.pattern[65] = CD_GREEN;
+ ctgc.pattern[66] = CD_GREEN;
+
+ ctgc.pattern[73] = CD_GREEN; ctgc.pattern[84] = CD_GREEN;
+ ctgc.pattern[74] = CD_GREEN; ctgc.pattern[85] = CD_GREEN;
+ ctgc.pattern[75] = CD_GREEN; ctgc.pattern[86] = CD_GREEN;
+ ctgc.pattern[76] = CD_GREEN; ctgc.pattern[87] = CD_GREEN;
+ ctgc.pattern[77] = CD_GREEN; ctgc.pattern[88] = CD_GREEN;
+
+ ctgc.dashes[0] = 10;
+ ctgc.dashes[1] = 2;
+ ctgc.dashes[2] = 5;
+ ctgc.dashes[3] = 2;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o CD Test. */
+/*-------------------------------------------------------------------------*/
+void CDTestInit(void)
+{
+ memset(&ctgc, 0, sizeof(ctgc));
+
+ if (use_gdiplus)
+ {
+#ifdef USE_GDIPLUS
+ cdInitGdiPlus();
+#endif
+ }
+
+ /* inicializaccao dos drivers */
+ DriversInit();
+
+ /* mostra o dialogo principal */
+ IupShow(IupGetHandle("dlgMain"));
+
+ /* inicializaccao da barra de cores */
+ ColorBarInit(IupGetHandle("dlgMain"), IupGetHandle("cnvColorBar"), &ctgc.foreground, &ctgc.background);
+
+ /* cria o canvas do CD associado ao canvas do IUP */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.iup_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvMain"));
+ if (!antialias) cdCanvasSetAttribute(ctgc.iup_canvas, "ANTIALIAS", "0");
+ cdActivate(ctgc.iup_canvas);
+ if (use_gdiplus) cdUseContextPlus(0);
+
+ /* associa os call-backs */
+ setcallbacks();
+
+ /* os call-backs do canvas devem ser associados depois de sua criacao */
+ IupSetFunction("cmdRepaint", (Icallback) fRepaint);
+ IupSetFunction("cmdMotionCB", (Icallback) fMotionCB);
+ IupSetFunction("cmdButtonCB", (Icallback) fButtonCB);
+ IupSetFunction("cmdResizeCB", (Icallback) fResizeCB);
+ IupSetFunction("cmdGetFocusCB", (Icallback) fGetFocusCB);
+
+ /* inicializaccao do contexto */
+ ctgc.write_mode = CD_REPLACE;
+ ctgc.line_style = CD_CONTINUOUS;
+ ctgc.line_cap = CD_CAPFLAT;
+ ctgc.line_join = CD_MITER;
+ ctgc.fill_mode = CD_EVENODD;
+ ctgc.line_width = 1;
+ ctgc.font_style = CD_PLAIN;
+ ctgc.font_typeface = CD_SYSTEM;
+ ctgc.font_size = CD_STANDARD;
+ ctgc.text_alignment = CD_BASE_LEFT;
+ ctgc.text_orientation = 0;
+ ctgc.back_opacity = CD_TRANSPARENT;
+ ctgc.mark_type = CD_STAR;
+ ctgc.poly_mode = CD_OPEN_LINES;
+ ctgc.interior_style = CD_SOLID;
+ ctgc.hatch = CD_HORIZONTAL;
+ ctgc.following = FALSE;
+ ctgc.foreground = CD_BLACK;
+ ctgc.background = CD_WHITE;
+ ctgc.head = NULL;
+ ctgc.test_image = NULL;
+ ctgc.sim = 0;
+ ctgc.stretch_play = 0;
+ ctgc.dlg_x = IUP_CENTER;
+ ctgc.dlg_y = IUP_CENTER;
+ ctgc.visible = 0;
+
+ /* inicializa os vetores stipple e pattern */
+ initsamples();
+
+ /* inicializa o CDTest com a primitiva LINE */
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ ctgc.bt_cur_prim = IupGetHandle("btCurPrim");
+ ctgc.cur_prim = LINE;
+
+ /* inicializaccao do Canvas do IUP */
+ cdActivate(ctgc.iup_canvas);
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ cdBackground(ctgc.background);
+ cdClear();
+ cdGetCanvasSize(&(ctgc.w),&(ctgc.h),NULL,NULL);
+ ctgc.bpp = cdGetColorPlanes();
+
+ {
+ double mm, xres;
+ cdPixel2MM(1, 0, &mm, NULL);
+ xres = 1.0/mm;
+ ctgc.res = xres;
+ }
+
+ /* inicializa o canvas off-screen de double-bufering */
+ ctgc.buffering = NO_BUFFER;
+ ctgc.buffer_canvas = NULL;
+
+ /* inicializa o clipping */
+ ctgc.clip_mode = CD_CLIPOFF;
+ cdGetClipArea(&(ctgc.clip_xmin), &(ctgc.clip_xmax),
+ &(ctgc.clip_ymin), &(ctgc.clip_ymax));
+
+ /* zera o buffer temporario de pontos */
+ ctgc.num_points = 0;
+
+ /* a lista de primitivas jah estah vazia, nao hah o que apagar */
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ /* atualiza o tamanho do canvas em pixels na barra de titulo */
+ sprintf(ctgc.title, "CDTest 5.3 (%dx%d - %dbpp)", ctgc.w, ctgc.h, ctgc.bpp);
+ IupSetAttribute(IupGetHandle("dlgMain"), IUP_TITLE, ctgc.title);
+
+ /* inicializa a barra de status */
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+
+ /* inicializa a posiccao do mouse */
+ mouse_pos(0, 0);
+
+ /* constroi os dialogos do CDTest sem mostra-los */
+ IupMap(IupGetHandle("dlgLB"));
+ IupMap(IupGetHandle("dlgAS"));
+ IupMap(IupGetHandle("dlgPixel"));
+ IupMap(IupGetHandle("dlgImage"));
+ IupMap(IupGetHandle("dlgImageRGB"));
+ IupMap(IupGetHandle("dlgMark"));
+ IupMap(IupGetHandle("dlgText"));
+ IupMap(IupGetHandle("dlgClip"));
+ IupMap(IupGetHandle("dlgAttributes"));
+ IupMap(IupGetHandle("dlgWDCanvas"));
+ IupMap(IupGetHandle("dlgPICCanvas"));
+
+ /* cria o canvas WD */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.wd_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvWDCanvas"));
+ ctgc.pic_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvPICCanvas"));
+ ctgc.picture = cdCreateCanvas(CD_PICTURE, "");
+ if (use_gdiplus) cdUseContextPlus(0);
+
+ /* CDTEST default values */
+ cdActivate(ctgc.picture);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ cdActivate(ctgc.wd_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ /* reativa o canvas IUP */
+ cdActivate(ctgc.iup_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+}
+
+static void CDTestClose(void)
+{
+ dellist();
+
+ ColorBarClose();
+
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ if (ctgc.test_image) cdKillImage(ctgc.test_image);
+ cdKillCanvas(ctgc.picture);
+ cdKillCanvas(ctgc.pic_canvas);
+ cdKillCanvas(ctgc.wd_canvas);
+ cdKillCanvas(ctgc.iup_canvas);
+
+ IupDestroy(IupGetHandle("dlgLB"));
+ IupDestroy(IupGetHandle("dlgAS"));
+ IupDestroy(IupGetHandle("dlgPixel"));
+ IupDestroy(IupGetHandle("dlgImage"));
+ IupDestroy(IupGetHandle("dlgImageRGB"));
+ IupDestroy(IupGetHandle("dlgMark"));
+ IupDestroy(IupGetHandle("dlgText"));
+ IupDestroy(IupGetHandle("dlgClip"));
+ IupDestroy(IupGetHandle("dlgAttributes"));
+ IupDestroy(IupGetHandle("dlgWDCanvas"));
+ IupDestroy(IupGetHandle("dlgPICCanvas"));
+
+ IupDestroy(IupGetHandle("dlgMain"));
+}
+
+static int iscurvisible(void)
+{
+ char* vis = IupGetAttribute(ctgc.dlg_cur_prim, IUP_VISIBLE);
+ if (!vis)
+ return 0;
+ return strcmp(vis, IUP_YES) == 0? 1: 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo da lista de primitivas para o dispositivo ativo. */
+/*-------------------------------------------------------------------------*/
+void putlist(cdCanvas *target)
+{
+ tList *temp;
+ int wdc_w, wdc_h, wd = 0;
+
+ /* ativa o canvas destino */
+ cdActivate(target);
+
+ if (target == ctgc.wd_canvas)
+ {
+ cdGetCanvasSize(&wdc_w, &wdc_h, NULL, NULL);
+ wdWindow(0, ctgc.w, 0, ctgc.h);
+ wdViewport(0, wdc_w, 0, wdc_h);
+ wd = 1;
+ }
+
+ /* limpa o canvas com a cor de fundo */
+ cdBackground(ctgc.background);
+ cdClear();
+ cdClipArea(ctgc.clip_xmin, ctgc.clip_xmax, ctgc.clip_ymin, ctgc.clip_ymax);
+ cdClip(ctgc.clip_mode);
+
+ /* coloca a lista de primitivas no canvas */
+ for (temp = ctgc.head; temp; temp = (tList *) temp->next)
+ {
+ switch (temp->type) {
+ case LINE:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ if (wd)
+ wdLine(temp->par.lineboxpar.x1, temp->par.lineboxpar.y1,
+ temp->par.lineboxpar.x2, temp->par.lineboxpar.y2);
+ else
+ cdLine(temp->par.lineboxpar.x1, temp->par.lineboxpar.y1,
+ temp->par.lineboxpar.x2, temp->par.lineboxpar.y2);
+ break;
+ case RECT:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ if (wd)
+ wdRect(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ else
+ cdRect(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ break;
+ case BOX:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ cdBackground(temp->par.lineboxpar.background);
+ cdBackOpacity(temp->par.lineboxpar.back_opacity);
+ cdHatch(temp->par.lineboxpar.hatch);
+ cdInteriorStyle(temp->par.lineboxpar.interior_style);
+ if (wd)
+ wdBox(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ else
+ cdBox(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ break;
+ case ARC:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ if (wd)
+ wdArc(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdArc(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case CHORD:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ cdBackground(temp->par.arcsectorpar.background);
+ cdBackOpacity(temp->par.arcsectorpar.back_opacity);
+ cdHatch(temp->par.arcsectorpar.hatch);
+ cdInteriorStyle(temp->par.arcsectorpar.interior_style);
+ if (wd)
+ wdChord(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdChord(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case SECTOR:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ cdBackground(temp->par.arcsectorpar.background);
+ cdBackOpacity(temp->par.arcsectorpar.back_opacity);
+ cdHatch(temp->par.arcsectorpar.hatch);
+ cdInteriorStyle(temp->par.arcsectorpar.interior_style);
+ if (wd)
+ wdSector(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdSector(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case PIXEL:
+ cdWriteMode(temp->par.pixelpar.write_mode);
+ cdPixel(temp->par.pixelpar.x, temp->par.pixelpar.y,
+ temp->par.pixelpar.foreground);
+ break;
+ case MARK:
+ cdWriteMode(temp->par.markpar.write_mode);
+ cdMarkSize(temp->par.markpar.mark_size);
+ cdMarkType(temp->par.markpar.mark_type);
+ cdForeground(temp->par.markpar.foreground);
+ if (wd)
+ wdMark(temp->par.markpar.x, temp->par.markpar.y);
+ else
+ cdMark(temp->par.markpar.x, temp->par.markpar.y);
+ break;
+ case TEXT:
+ cdWriteMode(temp->par.textpar.write_mode);
+ cdForeground(temp->par.textpar.foreground);
+ cdBackground(temp->par.textpar.background);
+ cdBackOpacity(temp->par.textpar.back_opacity);
+ cdTextAlignment(temp->par.textpar.text_alignment);
+ cdTextOrientation(temp->par.textpar.text_orientation);
+ cdFont(temp->par.textpar.font_typeface,
+ temp->par.textpar.font_style,
+ temp->par.textpar.font_size);
+ if (wd)
+ wdText(temp->par.textpar.x, temp->par.textpar.y,
+ temp->par.textpar.s);
+ else
+ cdText(temp->par.textpar.x, temp->par.textpar.y,
+ temp->par.textpar.s);
+ break;
+ case POLY: {
+ int i;
+ cdForeground(temp->par.polypar.foreground);
+ cdBackground(temp->par.polypar.background);
+ cdWriteMode(temp->par.polypar.write_mode);
+ cdLineCap(temp->par.polypar.line_cap);
+ cdLineJoin(temp->par.polypar.line_join);
+ cdLineStyle(temp->par.polypar.line_style);
+ cdLineWidth(temp->par.polypar.line_width);
+ cdFillMode(temp->par.polypar.fill_mode);
+ cdBackOpacity(temp->par.polypar.back_opacity);
+ cdHatch(temp->par.polypar.hatch);
+ cdInteriorStyle(temp->par.polypar.interior_style);
+ cdBegin(temp->par.polypar.poly_mode);
+ if (wd)
+ for (i=0; (i<temp->par.polypar.num_points); i++) {
+ wdVertex(temp->par.polypar.points[i].x,
+ temp->par.polypar.points[i].y);
+ }
+ else
+ for (i=0; (i<temp->par.polypar.num_points); i++) {
+ cdVertex(temp->par.polypar.points[i].x,
+ temp->par.polypar.points[i].y);
+ }
+ cdEnd();
+ break;
+ case META:
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.stretch_play)
+ {
+ if (wd)
+ cdPlay(temp->par.metapar.ctx, 0, wdc_w-1, 0, wdc_h-1, temp->par.metapar.filename);
+ else
+ cdPlay(temp->par.metapar.ctx, 0, ctgc.w-1, 0, ctgc.h-1, temp->par.metapar.filename);
+ }
+ else
+ cdPlay(temp->par.metapar.ctx, 0, 0, 0, 0, temp->par.metapar.filename);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /* volta o clip-mode para o corrente */
+ cdClip(ctgc.clip_mode);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo da lista de primitivas no canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fWDRepaint(void)
+{
+ putlist(ctgc.wd_canvas);
+
+ /* reativa o canvas iup */
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+int fPICRepaint(void)
+{
+ int w, h;
+ putlist(ctgc.picture);
+
+ cdActivate(ctgc.pic_canvas);
+ cdGetCanvasSize(&w, &h, NULL, NULL);
+ cdClear();
+ if (ctgc.stretch_play)
+ cdPlay(CD_PICTURE, 0, w-1, 0, h-1, ctgc.picture);
+ else
+ cdPlay(CD_PICTURE, 0, 0, 0, 0, ctgc.picture);
+
+ /* reativa o canvas iup */
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Redesenha o canvas. */
+/*-------------------------------------------------------------------------*/
+void updatecanvas(void)
+{
+ if (ctgc.buffering == NO_BUFFER)
+ putlist(ctgc.iup_canvas);
+ else
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ putlist(ctgc.buffer_canvas);
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+
+ if (ctgc.wd_dialog)
+ fWDRepaint();
+
+ if (ctgc.pic_dialog)
+ fPICRepaint();
+}
+
+/*-------------------------------------------------------------------------*/
+/* Redesenha o canvas. */
+/*-------------------------------------------------------------------------*/
+int fRepaint(void)
+{
+ int i;
+
+ /* ativa o canvas na tela */
+ cdActivate(ctgc.iup_canvas);
+ wdViewport(0, ctgc.w, 0, ctgc.h);
+
+ /* desliga o clipping durante o evento Repaint */
+ cdClip(CD_CLIPOFF);
+
+ /* double-buffering? */
+ cdWriteMode(CD_REPLACE);
+ updatecanvas();
+
+ /* se o evento repaint for gerado durante o rubber band...*/
+ /* ...eh preciso restaurar o estado anterior */
+ if (ctgc.following) {
+ cdWriteMode(CD_NOT_XOR);
+ cdForeground(CD_BLACK);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ switch (ctgc.cur_prim) {
+ case POLY:
+ for (i=0; (i<ctgc.num_points-1); i++) {
+ cdLine(ctgc.points[i].x, ctgc.points[i].y,
+ ctgc.points[i+1].x, ctgc.points[i+1].y);
+ }
+ polygon(REPAINT, 0, 0);
+ break;
+ case LINE:
+ line(REPAINT, 0, 0);
+ break;
+ case ARC:
+ case CHORD:
+ case SECTOR:
+ arc(REPAINT, 0, 0);
+ break;
+ case RECT:
+ case BOX:
+ box(REPAINT, 0, 0);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* restaura o estado de clipping anterior ao evento Repaint */
+ cdClip(ctgc.clip_mode);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Ativa o canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fWDCanvas(void)
+{
+ IupShow(IupGetHandle("dlgWDCanvas"));
+ ctgc.wd_dialog = TRUE;
+ IupSetFunction("cmdWDRepaint", (Icallback)fWDRepaint);
+ fWDRepaint();
+ return IUP_DEFAULT;
+}
+
+int fPICCanvas(void)
+{
+ IupShow(IupGetHandle("dlgPICCanvas"));
+ ctgc.pic_dialog = TRUE;
+ IupSetFunction("cmdPICRepaint", (Icallback)fPICRepaint);
+ fPICRepaint();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desativa o canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fCloseWD(void)
+{
+ ctgc.wd_dialog = FALSE;
+ return IUP_DEFAULT;
+}
+
+int fClosePIC(void)
+{
+ ctgc.pic_dialog = FALSE;
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Apaga a ultima primitiva desenhada. */
+/*-------------------------------------------------------------------------*/
+int fEditUndo(void)
+{
+ /* apaga a ultima primitiva da fila */
+ dellast();
+ /* se nao ha mais primitivas na fila, desabilita o undo */
+ if (ctgc.head == NULL)
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ updatecanvas();
+
+ return IUP_DEFAULT;
+}
+
+int fSimulate(Ihandle *self, int v)
+{
+ ignore(self);
+
+ cdActivate(ctgc.iup_canvas);
+
+ if (v == 1)
+ {
+ if (ctgc.sim == 1)
+ return IUP_DEFAULT;
+
+ ctgc.sim = 1;
+ cdSimulate(CD_SIM_ALL);
+ sprintf(ctgc.status_line, "cdSimulate(CD_SIM_ALL)");
+ }
+ else
+ {
+ if (ctgc.sim == 0)
+ return IUP_DEFAULT;
+
+ ctgc.sim = 0;
+ cdSimulate(CD_SIM_NONE);
+ sprintf(ctgc.status_line, "cdSimulate(CD_SIM_NONE)");
+ }
+
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+int fStretchPlay(Ihandle *self, int v)
+{
+ ignore(self);
+ ctgc.stretch_play = v;
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Tchau. */
+/*-------------------------------------------------------------------------*/
+int fFileExit(void)
+{
+ IupHide(ctgc.dlg_cur_prim);
+ return IUP_CLOSE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle OpenLines. */
+/*-------------------------------------------------------------------------*/
+int fOpenLines(void)
+{
+ ctgc.poly_mode = CD_OPEN_LINES;
+ sprintf(ctgc.status_line, "cdBegin(CD_OPEN_LINES)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle ClosedLines. */
+/*-------------------------------------------------------------------------*/
+int fClosedLines(void)
+{
+ ctgc.poly_mode = CD_CLOSED_LINES;
+ sprintf(ctgc.status_line, "cdBegin(CD_CLOSED_LINES)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fPolyBezier(void)
+{
+ ctgc.poly_mode = CD_BEZIER;
+ sprintf(ctgc.status_line, "cdBegin(CD_BEZIER)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Fill. */
+/*-------------------------------------------------------------------------*/
+int fFill(void)
+{
+ ctgc.poly_mode = CD_FILL;
+ sprintf(ctgc.status_line, "cdBegin(CD_FILL)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Clip. */
+/*-------------------------------------------------------------------------*/
+int fPolyClip(void)
+{
+ ctgc.poly_mode = CD_CLIP;
+ sprintf(ctgc.status_line, "cdBegin(CD_CLIP)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Solid. */
+/*-------------------------------------------------------------------------*/
+int fSolid(void)
+{
+ ctgc.interior_style = CD_SOLID;
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_SOLID)");
+ set_status();
+ cdInteriorStyle(CD_SOLID);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Hatch. */
+/*-------------------------------------------------------------------------*/
+int fHatch(void)
+{
+ ctgc.interior_style = CD_HATCH;
+ cdInteriorStyle(CD_HATCH);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_HATCH)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Stipple. */
+/*-------------------------------------------------------------------------*/
+int fStipple(void)
+{
+ ctgc.interior_style = CD_STIPPLE;
+ cdInteriorStyle(CD_STIPPLE);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_STIPPLE)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Pattern. */
+/*-------------------------------------------------------------------------*/
+int fPattern(void)
+{
+ ctgc.interior_style = CD_PATTERN;
+ cdInteriorStyle(CD_PATTERN);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_PATTERN)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o a opacidade do fundo. */
+/*-------------------------------------------------------------------------*/
+int fOpacity(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.back_opacity = CD_OPAQUE;
+ sprintf(ctgc.status_line, "cdBackOpacity(CD_OPAQUE)");
+ break;
+ case 2:
+ ctgc.back_opacity = CD_TRANSPARENT;
+ sprintf(ctgc.status_line, "cdBackOpacity(CD_TRANSPARENT)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para imagem do servidor. */
+/*-------------------------------------------------------------------------*/
+int fImageBuffer(Ihandle *self, int v)
+{
+ ignore(self);
+
+ /* se o toggle foi para o estado ligado... */
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGE_BUFFER:
+ break;
+ case IMAGERGB_BUFFER:
+ /* mata o canvas do buffer anterior */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* prosegue como se nao houvesse o buffer anterior */
+ case NO_BUFFER:
+ /* cria o canvas do buffer */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.buffer_canvas = cdCreateCanvas(CD_DBUFFER, ctgc.iup_canvas);
+ if (!antialias) cdCanvasSetAttribute(ctgc.buffer_canvas, "ANTIALIAS", "0");
+ if (use_gdiplus) cdUseContextPlus(0);
+ /* se nao consegui criar o canvas... */
+ if (!ctgc.buffer_canvas) {
+ /* desabilita o double-buffering */
+ ctgc.buffering = NO_BUFFER;
+ sprintf(ctgc.status_line, "Error creating CD_DBUFFER canvas.");
+ set_status();
+ }
+ else {
+ /* seta o modo de escrita para double-buffering em imagem do servidor */
+ ctgc.buffering = IMAGE_BUFFER;
+ /* reconstroe o stipple e o pattern no canvas do buffer */
+ cdActivate(ctgc.buffer_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+ /* atualiza o buffer */
+ updatecanvas();
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "CD_DBUFFER buffer active.");
+ set_status();
+ }
+
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para imagem RGB. */
+/*-------------------------------------------------------------------------*/
+int fRGBBuffer(Ihandle *self, int v)
+{
+ ignore(self);
+
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGERGB_BUFFER:
+ break;
+ case IMAGE_BUFFER:
+ /* mata o canvas do buffer anterior */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* prossegue como se nao houvesse o buffer anterior */
+ case NO_BUFFER:
+ /* cria o canvas do buffer */
+ ctgc.buffer_canvas = cdCreateCanvas(CD_DBUFFERRGB, ctgc.iup_canvas);
+ if (!antialias) cdCanvasSetAttribute(ctgc.buffer_canvas, "ANTIALIAS", "0");
+ /* se nao consegui criar o canvas... */
+ if (!ctgc.buffer_canvas) {
+ /* mata a imagem alocada */
+ /* desabilita o double-buffering */
+ ctgc.buffering = NO_BUFFER;
+ sprintf(ctgc.status_line, "Error creating CD_DBUFFERRGB canvas.");
+ set_status();
+ }
+ else {
+ /* seta o modo de escrita para double-buffering em imagem RGB */
+ ctgc.buffering = IMAGERGB_BUFFER;
+ /* reconstroe o stipple e o pattern no canvas do buffer */
+ cdActivate(ctgc.buffer_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+ /* atualiza o buffer */
+ updatecanvas();
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "CD_DBUFFERRGB buffer active.");
+ set_status();
+ }
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para escrita diretamente na tela. */
+/*-------------------------------------------------------------------------*/
+int fNoBuffering(Ihandle *self, int v)
+{
+ ignore(self);
+
+ /* se foi para double-buffering, atualiza o buffer off-screen */
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGERGB_BUFFER:
+ /* mata o canvas */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* passa a desenhar diretamente na tela */
+ ctgc.buffering = NO_BUFFER;
+ /* atualiza o buffer */
+ updatecanvas();
+ break;
+ case IMAGE_BUFFER:
+ /* mata o canvas */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* passa a desenhar diretamente na tela */
+ ctgc.buffering = NO_BUFFER;
+ /* atualiza o buffer */
+ updatecanvas();
+ break;
+ case NO_BUFFER:
+ break;
+ }
+ }
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "Now drawing on-screen.");
+ set_status();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcoes da barra de estilos.. */
+/*-------------------------------------------------------------------------*/
+int fMarkType(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.mark_type = CD_PLUS;
+ sprintf(ctgc.status_line, "cdMarkType(CD_PLUS)");
+ break;
+ case 2:
+ ctgc.mark_type = CD_STAR;
+ sprintf(ctgc.status_line, "cdMarkType(CD_STAR)");
+ break;
+ case 3:
+ ctgc.mark_type = CD_CIRCLE;
+ sprintf(ctgc.status_line, "cdMarkType(CD_CIRCLE)");
+ break;
+ case 4:
+ ctgc.mark_type = CD_X;
+ sprintf(ctgc.status_line, "cdMarkType(CD_X)");
+ break;
+ case 5:
+ ctgc.mark_type = CD_BOX;
+ sprintf(ctgc.status_line, "cdMarkType(CD_BOX)");
+ break;
+ case 6:
+ ctgc.mark_type = CD_DIAMOND;
+ sprintf(ctgc.status_line, "cdMarkType(CD_DIAMOND)");
+ break;
+ case 7:
+ ctgc.mark_type = CD_HOLLOW_CIRCLE;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_CIRCLE)");
+ break;
+ case 8:
+ ctgc.mark_type = CD_HOLLOW_BOX;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_BOX)");
+ break;
+ case 9:
+ ctgc.mark_type = CD_HOLLOW_DIAMOND;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_DIAMOND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fWriteMode(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.write_mode = CD_REPLACE;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_REPLACE)");
+ break;
+ case 2:
+ ctgc.write_mode = CD_XOR;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_XOR)");
+ break;
+ case 3:
+ ctgc.write_mode = CD_NOT_XOR;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_NOT_XOR)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_style = CD_CONTINUOUS;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_CONTINUOUS)");
+ break;
+ case 2:
+ ctgc.line_style = CD_DASHED;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASHED)");
+ break;
+ case 3:
+ ctgc.line_style = CD_DOTTED;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DOTTED)");
+ break;
+ case 4:
+ ctgc.line_style = CD_DASH_DOT;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASH_DOT)");
+ break;
+ case 5:
+ ctgc.line_style = CD_DASH_DOT_DOT;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASH_DOT_DOT)");
+ break;
+ case 6:
+ ctgc.line_style = CD_CUSTOM;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_CUSTOM)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineCap(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_cap = CD_CAPFLAT;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPFLAT)");
+ break;
+ case 2:
+ ctgc.line_cap = CD_CAPSQUARE;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPSQUARE)");
+ break;
+ case 3:
+ ctgc.line_cap = CD_CAPROUND;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPROUND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineJoin(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_join = CD_MITER;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_MITER)");
+ break;
+ case 2:
+ ctgc.line_join = CD_BEVEL;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_BEVEL)");
+ break;
+ case 3:
+ ctgc.line_join = CD_ROUND;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_ROUND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fFillMode(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.fill_mode = CD_EVENODD;
+ sprintf(ctgc.status_line, "cdFillMode(CD_EVENODD)");
+ break;
+ case 2:
+ ctgc.fill_mode = CD_WINDING;
+ sprintf(ctgc.status_line, "cdFillMode(CD_WINDING)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+char* font_style[4] = {"CD_PLAIN", "CD_BOLD", "CD_ITALIC", "CD_BOLD_ITALIC"};
+char* font_face[4] = {"CD_SYSTEM", "CD_COURIER", "CD_TIMES_ROMAN", "CD_HELVETICA"};
+
+int fFontStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.font_style = CD_PLAIN;
+ break;
+ case 2:
+ ctgc.font_style = CD_BOLD;
+ break;
+ case 3:
+ ctgc.font_style = CD_ITALIC;
+ break;
+ case 4:
+ ctgc.font_style = CD_BOLD_ITALIC;
+ break;
+ }
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ sprintf(ctgc.status_line, "cdFont(%s, %s, %d)", font_face[ctgc.font_typeface], font_style[ctgc.font_style], ctgc.font_size);
+ set_status();
+ return IUP_DEFAULT;
+}
+
+
+int fFontTypeFace(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.font_typeface = CD_SYSTEM;
+ break;
+ case 2:
+ ctgc.font_typeface = CD_COURIER;
+ break;
+ case 3:
+ ctgc.font_typeface = CD_TIMES_ROMAN;
+ break;
+ case 4:
+ ctgc.font_typeface = CD_HELVETICA;
+ break;
+ }
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ sprintf(ctgc.status_line, "cdFont(%s, %s, %d)", font_face[ctgc.font_typeface], font_style[ctgc.font_style], ctgc.font_size);
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fTextAlignment(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.text_alignment = CD_NORTH;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH)");
+ break;
+ case 2 :
+ ctgc.text_alignment = CD_SOUTH;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH)");
+ break;
+ case 3:
+ ctgc.text_alignment = CD_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_EAST)");
+ break;
+ case 4:
+ ctgc.text_alignment = CD_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_WEST)");
+ break;
+ case 5:
+ ctgc.text_alignment = CD_NORTH_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH_EAST)");
+ break;
+ case 6:
+ ctgc.text_alignment = CD_NORTH_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH_WEST)");
+ break;
+ case 7:
+ ctgc.text_alignment = CD_SOUTH_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH_EAST)");
+ break;
+ case 8:
+ ctgc.text_alignment = CD_SOUTH_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH_WEST)");
+ break;
+ case 9:
+ ctgc.text_alignment = CD_CENTER;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_CENTER)");
+ break;
+ case 10:
+ ctgc.text_alignment = CD_BASE_LEFT;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_LEFT)");
+ break;
+ case 11:
+ ctgc.text_alignment = CD_BASE_CENTER;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_CENTER)");
+ break;
+ case 12:
+ ctgc.text_alignment = CD_BASE_RIGHT;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_RIGHT)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fHatchStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.hatch = CD_HORIZONTAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_HORIZONTAL)");
+ break;
+ case 2 :
+ ctgc.hatch = CD_VERTICAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_VERTICAL)");
+ break;
+ case 3:
+ ctgc.hatch = CD_FDIAGONAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_FDIAGONAL)");
+ break;
+ case 4:
+ ctgc.hatch = CD_BDIAGONAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_BDIAGONAL)");
+ break;
+ case 5:
+ ctgc.hatch = CD_CROSS;
+ sprintf(ctgc.status_line, "cdHatch(CD_CROSS)");
+ break;
+ case 6:
+ ctgc.hatch = CD_DIAGCROSS;
+ sprintf(ctgc.status_line, "cdHatch(CD_DIAGCROSS)");
+ break;
+ }
+ set_status();
+ cdHatch(ctgc.hatch);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a linha de estatus do CDTest. */
+/*-------------------------------------------------------------------------*/
+void set_status(void)
+{
+ IupSetAttribute(IupGetHandle("lbStatusLine"), IUP_TITLE, ctgc.status_line);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a posiccao do mouse no dialogo principal. */
+/*-------------------------------------------------------------------------*/
+void mouse_pos(int x, int y)
+{
+ /* salva a posiccao do mouse no contexto */
+ ctgc.x = x;
+ ctgc.y = y;
+
+ /* atualiza a posiccao do mouse no feedback para o usuario */
+ sprintf(ctgc.mouse_pos, "(%4d,%4d)", x, y);
+ IupSetAttribute(IupGetHandle("lbMousePos"), IUP_TITLE, ctgc.mouse_pos);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo corrente. */
+/*-------------------------------------------------------------------------*/
+int fShowDialog(void)
+{
+ if (ctgc.dlg_cur_prim != NULL) {
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Ativa a seleccao de area de clip. */
+/*-------------------------------------------------------------------------*/
+int fClip(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgClip");
+ ctgc.following = FALSE;
+ ctgc.cur_prim = CLIP;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgClip");
+ sprintf(ctgc.status_line, "LEFT click and drag to set. RIGHT clip to disable.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a area de clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipArea(void)
+{
+ ctgc.clip_mode = CD_CLIPAREA;
+ ctgc.clip_xmin = IupGetInt(IupGetHandle("txtClipXmin"), IUP_VALUE);
+ ctgc.clip_xmax = IupGetInt(IupGetHandle("txtClipXmax"), IUP_VALUE);
+ ctgc.clip_ymin = IupGetInt(IupGetHandle("txtClipYmin"), IUP_VALUE);
+ ctgc.clip_ymax = IupGetInt(IupGetHandle("txtClipYmax"), IUP_VALUE);
+ cdClipArea(ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ cdClip(CD_CLIPAREA);
+ sprintf(ctgc.status_line, "cdClipArea( %d, %d, %d, %d)",
+ ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza poligono de clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipPoly(void)
+{
+ ctgc.clip_mode=CD_CLIPPOLYGON;
+ cdClip(CD_CLIPPOLYGON);
+ sprintf(ctgc.status_line, "cdClip(CD_CLIPPOLYGON)");
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desativa o Clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipOff(void)
+{
+ ctgc.clip_mode = CD_CLIPOFF;
+ cdClip(CD_CLIPOFF);
+ sprintf(ctgc.status_line, "cdClip(CD_CLIPOFF)");
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Prepara a seleccao de imagens. */
+/*-------------------------------------------------------------------------*/
+int fImage(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgImage");
+ ctgc.cur_prim = IMAGE;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgImage");
+ sprintf(ctgc.status_line, "LEFT click and drag to get. RIGHT click to put.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Pega a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImageGet(void)
+{
+ int x, y, width, height;
+
+ /* mata a image */
+ if (ctgc.test_image != NULL) {
+ cdKillImage(ctgc.test_image);
+ }
+
+ x = IupGetInt(IupGetHandle("txtImageX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageY"), IUP_VALUE);
+
+ width = IupGetInt(IupGetHandle("txtImageW"), IUP_VALUE);
+ height = IupGetInt(IupGetHandle("txtImageH"), IUP_VALUE);
+
+ if (width*height != 0)
+ {
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ ctgc.test_image = cdCreateImage(width, height);
+ if (ctgc.test_image != NULL)
+ {
+ cdGetImage(ctgc.test_image, x, y);
+ sprintf(ctgc.status_line, "cdGetImage( image, %d, %d)", x, y);
+ set_status();
+ }
+
+ cdActivate(ctgc.iup_canvas);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Coloca a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImagePut(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageY"), IUP_VALUE);
+
+ if (ctgc.test_image != NULL)
+ {
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdWriteMode(ctgc.write_mode);
+ cdPutImage(ctgc.test_image, x, y);
+ sprintf(ctgc.status_line, "cdPutImage( image, %d, %d)", x, y);
+ set_status();
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Prepara a seleccao de imagens. */
+/*-------------------------------------------------------------------------*/
+int fImageRGB(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgImageRGB");
+ ctgc.cur_prim = RGB;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgImageRGB");
+ sprintf(ctgc.status_line, "LEFT click and drag to get. RIGHT click to put.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Pega a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImageRGBGet(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageRGBX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageRGBY"), IUP_VALUE);
+ ctgc.rgb_w = IupGetInt(IupGetHandle("txtImageRGBW"), IUP_VALUE);
+ ctgc.rgb_h = IupGetInt(IupGetHandle("txtImageRGBH"), IUP_VALUE);
+
+ if (ctgc.red) free(ctgc.red);
+ ctgc.red = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+ if (ctgc.green) free(ctgc.green);
+ ctgc.green = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+ if (ctgc.blue) free(ctgc.blue);
+ ctgc.blue = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+
+ if ((ctgc.red!=NULL)&&(ctgc.green!=NULL)&&(ctgc.blue!=NULL)) {
+ sprintf(ctgc.status_line, "cdGetImageRGB( r, g, b, %d, %d, %d, %d)",
+ x, y, ctgc.rgb_w, ctgc.rgb_h);
+ set_status();
+
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdGetImageRGB(ctgc.red, ctgc.green, ctgc.blue, x, y, ctgc.rgb_w, ctgc.rgb_h);
+
+ cdActivate(ctgc.iup_canvas);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Joga a imagem na tela. */
+/*-------------------------------------------------------------------------*/
+int fImageRGBPut(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageRGBX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageRGBY"), IUP_VALUE);
+
+ if ((ctgc.red!=NULL)&&(ctgc.green!=NULL)&&(ctgc.blue!=NULL))
+ {
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdWriteMode(ctgc.write_mode);
+ sprintf(ctgc.status_line, "cdPutImageRGB( %d, %d, r, g, b, %d, %d, %d, %d)",
+ ctgc.rgb_w, ctgc.rgb_h, x, y, ctgc.rgb_w, ctgc.rgb_h);
+ set_status();
+ cdPutImageRGB(ctgc.rgb_w, ctgc.rgb_h, ctgc.red, ctgc.green, ctgc.blue, x, y, ctgc.rgb_w, ctgc.rgb_h);
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fLine(Ihandle* self)
+{
+ if (ctgc.cur_prim != LINE) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgLine");
+ if (ctgc.cur_prim == POLY) { /* termina o poligono em andamento */
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = LINE;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim); /* esconde o dialogo anterior */
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Line Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fRect(Ihandle* self)
+{
+ if (ctgc.cur_prim != RECT) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgRect");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = RECT;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Rect Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fBox(Ihandle* self)
+{
+ if (ctgc.cur_prim != BOX) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgBox");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = BOX;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Box Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fArc(Ihandle* self)
+{
+ if (ctgc.cur_prim != ARC) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgArc");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = ARC;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Arc Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fSector(Ihandle* self)
+{
+ if (ctgc.cur_prim != SECTOR) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgSector");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = SECTOR;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Sector Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fChord(Ihandle* self)
+{
+ if (ctgc.cur_prim != CHORD) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgChord");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = CHORD;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Chord Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fPixel(Ihandle* self)
+{
+ if (ctgc.cur_prim != PIXEL) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgPixel");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = PIXEL;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgPixel");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fMark(Ihandle* self)
+{
+ if (ctgc.cur_prim != MARK) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgMark");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = MARK;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgMark");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fText(Ihandle* self)
+{
+ if (ctgc.cur_prim != TEXT) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgText");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = TEXT;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgText");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fPoly(Ihandle* self)
+{
+ if (ctgc.cur_prim != POLY) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgPoly");
+ ctgc.cur_prim = POLY;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgPoly");
+ /* zera o buffer temporario de pontos */
+ ctgc.num_points = 0;
+ }
+ sprintf(ctgc.status_line, "LEFT click to add vertex. RIGHT click to end.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fOptions(void)
+{
+ IupShow(IupGetHandle("dlgOptions"));
+ return IUP_DEFAULT;
+}
+
+int fOptionsHide(void)
+{
+ IupHide(IupGetHandle("dlgOptions"));
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo Attributes. */
+/*-------------------------------------------------------------------------*/
+int fAttributes(void)
+{
+ IupShow(IupGetHandle("dlgAttributes"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Esconde o dialogo de Attributes. */
+/*-------------------------------------------------------------------------*/
+int fAttributesHide(void)
+{
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ IupHide(IupGetHandle("dlgAttributes"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Esconde o dialogo de primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fMsgHide(void)
+{
+ IupHide(ctgc.dlg_cur_prim);
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Filtra inteiros. */
+/*-------------------------------------------------------------------------*/
+int fInteger(Ihandle *self, int c)
+{
+ ignore(self);
+ if (isdigit(c) || c == '-')
+ return IUP_DEFAULT;
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB))
+ return IUP_DEFAULT;
+ else
+ return IUP_IGNORE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Filtra reais. */
+/*-------------------------------------------------------------------------*/
+int fReal(Ihandle *self, int c)
+{
+ ignore(self);
+ if (isdigit(c))
+ return IUP_DEFAULT;
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB))
+ return IUP_DEFAULT;
+ else if ((c=='.') || (c=='e') || (c=='E') || (c=='+') || (c=='-'))
+ return IUP_DEFAULT;
+ else
+ return IUP_IGNORE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a primitiva entrada na caixa de dialogo ativa. */
+/*-------------------------------------------------------------------------*/
+void draw(void)
+{
+ int a, b;
+
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_YES);
+ ctgc.line_width = IupGetInt(IupGetHandle("txtLineWidth"), IUP_VALUE);
+ if (ctgc.line_width < 1) ctgc.line_width = 1;
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+
+ /* escolhe entre o canvas na tela e o off-screen */
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ /* atualiza os atributos */
+ cdWriteMode(ctgc.write_mode);
+ cdLineStyle(ctgc.line_style);
+ cdLineCap(ctgc.line_cap);
+ cdLineJoin(ctgc.line_join);
+ cdLineWidth(ctgc.line_width);
+ cdForeground(ctgc.foreground);
+ cdBackground(ctgc.background);
+ cdHatch(ctgc.hatch);
+ cdFillMode(ctgc.fill_mode);
+ cdInteriorStyle(ctgc.interior_style);
+ cdBackOpacity(ctgc.back_opacity);
+
+ cdClipArea(ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ cdClip(ctgc.clip_mode);
+
+ switch (ctgc.cur_prim) {
+ case LINE:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line, "cdLine( %d, %d, %d, %d)", line_pos.x1,
+ line_pos.y1, line_pos.x2, line_pos.y2);
+ set_status();
+ /* desenha a line na tela */
+ cdLine(line_pos.x1, line_pos.y1, line_pos.x2, line_pos.y2);
+ /* arquiva a line */
+ newline(line_pos.x1, line_pos.y1, line_pos.x2, line_pos.y2);
+ break;
+ case RECT:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdRect( %d, %d, %d, %d)",box_pos.xmin,
+ box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ set_status();
+ /* desenha a box na tela */
+ cdRect(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ /* armazena a box */
+ newrect(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ break;
+ case BOX:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdBox( %d, %d, %d, %d)",box_pos.xmin,
+ box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ set_status();
+ /* desenha a box na tela */
+ cdBox(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ /* armazena a box */
+ newbox(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ break;
+ case ARC:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdArc( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o arc na tela */
+ cdArc(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o arc */
+ newarc(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case SECTOR:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdSector( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o sector na tela */
+ cdSector(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o sector */
+ newsector(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case CHORD:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdChord( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o sector na tela */
+ cdChord(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o sector */
+ newchord(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case PIXEL:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line, "cdPixel( %d, %d, 0x%.6lx )",pixel_pos.x, pixel_pos.y,ctgc.foreground);
+ set_status();
+ /* desenha o pixel na tela */
+ cdPixel(pixel_pos.x, pixel_pos.y, ctgc.foreground);
+ /* armazena o pixel */
+ newpixel(pixel_pos.x, pixel_pos.y);
+ break;
+ case MARK:
+ mark_pos.size = IupGetInt(IupGetHandle("txtMarkSize"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdMark( %d, %d)", mark_pos.x, mark_pos.y);
+ set_status();
+ /* armazena a marca */
+ newmark(mark_pos.x, mark_pos.y, mark_pos.size);
+ /* desenha a marca na tela */
+ cdMarkType(ctgc.mark_type);
+ cdMarkSize(mark_pos.size);
+ cdMark(mark_pos.x, mark_pos.y);
+ break;
+ case TEXT:
+ if (IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE)) {
+ a=IupGetInt(IupGetHandle("txtTextX"),IUP_VALUE);
+ b=IupGetInt(IupGetHandle("txtTextY"),IUP_VALUE);
+ sprintf(ctgc.status_line," cdText( %d, %d, ""%.3s""...)", a, b,
+ IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ set_status();
+ ctgc.text_orientation = IupGetInt(IupGetHandle("txtTextOrientation"),IUP_VALUE);
+ newtext(a,b,IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ cdTextAlignment(ctgc.text_alignment);
+ cdTextOrientation(ctgc.text_orientation);
+ cdText(a,b,IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ }
+ case POLY:
+ if (ctgc.num_points > 1) {
+ cdBegin(ctgc.poly_mode);
+ for (a=0; (a<ctgc.num_points); a++) {
+ cdVertex(ctgc.points[a].x,ctgc.points[a].y);
+ }
+ cdEnd();
+ if (ctgc.poly_mode != CD_CLIP)
+ newpoly();
+ ctgc.num_points = 0;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a primitiva entrada na caixa de dialogo corrente. */
+/*-------------------------------------------------------------------------*/
+int fDraw(void)
+{
+ /* atualiza os dados entrados na caixa de dialogo no contexto da */
+ /* primitiva corrente */
+ switch (ctgc.cur_prim) {
+ case LINE:
+ line_pos.x1 = IupGetInt(IupGetHandle("txtLBX1"), IUP_VALUE);
+ line_pos.x2 = IupGetInt(IupGetHandle("txtLBX2"), IUP_VALUE);
+ line_pos.y1 = IupGetInt(IupGetHandle("txtLBY1"), IUP_VALUE);
+ line_pos.y2 = IupGetInt(IupGetHandle("txtLBY2"), IUP_VALUE);
+ break;
+ case RECT:
+ case BOX:
+ box_pos.xmin = IupGetInt(IupGetHandle("txtLBX1"), IUP_VALUE);
+ box_pos.xmax = IupGetInt(IupGetHandle("txtLBX2"), IUP_VALUE);
+ box_pos.ymin = IupGetInt(IupGetHandle("txtLBY1"), IUP_VALUE);
+ box_pos.ymax = IupGetInt(IupGetHandle("txtLBY2"), IUP_VALUE);
+ break;
+ case ARC:
+ case CHORD:
+ case SECTOR:
+ arc_pos.xc = IupGetInt(IupGetHandle("txtASXC"), IUP_VALUE);
+ arc_pos.yc = IupGetInt(IupGetHandle("txtASYC"), IUP_VALUE);
+ arc_pos.w = IupGetInt(IupGetHandle("txtASW"), IUP_VALUE);
+ arc_pos.h = IupGetInt(IupGetHandle("txtASH"), IUP_VALUE);
+ break;
+ case PIXEL:
+ pixel_pos.x = IupGetInt(IupGetHandle("txtPixelX"), IUP_VALUE);
+ pixel_pos.y = IupGetInt(IupGetHandle("txtPixelY"), IUP_VALUE);
+ break;
+ case MARK:
+ mark_pos.x = IupGetInt(IupGetHandle("txtMarkX"), IUP_VALUE);
+ mark_pos.y = IupGetInt(IupGetHandle("txtMarkY"), IUP_VALUE);
+ break;
+ default:
+ break;
+ }
+
+ /* efetivamente desenha a primitiva */
+ draw();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a janelinha de apresentacao. */
+/*-------------------------------------------------------------------------*/
+int fHelpAbout(void)
+{
+ IupSetAttribute(IupGetHandle("lblVersion"), IUP_TITLE, cdVersion());
+ IupShow(IupGetHandle("dlgHelpAbout"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a janelinha de apresentacao. */
+/*-------------------------------------------------------------------------*/
+int fCloseAbout(void)
+{
+ IupHide(IupGetHandle("dlgHelpAbout"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Limpa o canvas e a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int fEditClear(void)
+{
+ /* mata a lista de primitivas */
+ dellist();
+
+ /* torna inativo a opcap undo */
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ updatecanvas();
+
+ sprintf(ctgc.status_line, "cdClear()");
+ set_status();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao ganho de focus do canvas. */
+/*-------------------------------------------------------------------------*/
+int fGetFocusCB(Ihandle *self)
+{
+ ignore(self);
+ /* avisa ao CD que o focus foi recebido, */
+ /* para que ele restaure o contexto grafico */
+ cdActivate(ctgc.iup_canvas);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao movimento do mouse. */
+/*-------------------------------------------------------------------------*/
+int fMotionCB(Ihandle *self, int x, int y, char *r)
+{
+ ignore(self);
+ ignore(r);
+
+ cdActivate(ctgc.iup_canvas);
+ cdUpdateYAxis(&y);
+ mouse_pos(x, y);
+
+ if (ctgc.following) {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ line(MOVE, x, y);
+ follow(x, y);
+ break;
+ case RECT:
+ case BOX:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case CLIP:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* sao equivalentes */
+ case CHORD:
+ arc(MOVE, x, y);
+ follow(x, y);
+ break;
+ case IMAGE:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case RGB:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case POLY:
+ polygon(MOVE, x, y);
+ break;
+ default:
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao botao do mouse. */
+/*-------------------------------------------------------------------------*/
+int fButtonCB(Ihandle *self, int b, int e, int x, int y, char *r)
+{
+ ignore(self);
+ ignore(r);
+
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_NOT_XOR);
+ cdForeground(CD_BLACK);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdClip(CD_CLIPOFF);
+
+ cdUpdateYAxis(&y);
+ mouse_pos(x, y);
+
+ if (b == IUP_BUTTON1) {
+ if (e) {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ follow(x, y);
+ line(NEWPOINT, x, y);
+ line_pos.x1 = x;
+ line_pos.y1 = y;
+ ctgc.following = TRUE;
+ break;
+ case RECT:
+ case BOX:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ box_pos.x = x;
+ box_pos.y = y;
+ ctgc.following = TRUE;
+ break;
+ case CLIP:
+ box(NEWPOINT, x, y);
+ follow(x, y);
+ ctgc.following = TRUE;
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* sao equivalentes */
+ case CHORD:
+ follow(x, y);
+ arc(CENTER, x, y);
+ arc_pos.xc = x;
+ arc_pos.yc = y;
+ ctgc.following = TRUE;
+ break;
+ case MARK:
+ case PIXEL:
+ case TEXT:
+ follow(x, y);
+ draw();
+ break;
+ case IMAGE:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ ctgc.following = TRUE;
+ break;
+ case RGB:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ ctgc.following = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ else {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ line(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ }
+ break;
+ case RECT:
+ case BOX:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ }
+ break;
+ case CLIP:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ fClipArea();
+ }
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* ...sao equivalentes */
+ case CHORD:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ arc(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ arc_pos.w = 0;
+ arc_pos.h = 0;
+ }
+ break;
+ case POLY:
+ cdActivate(ctgc.iup_canvas);
+ polygon(NEWPOINT, x, y);
+ newpolypoint(x, y);
+ sprintf(ctgc.status_line, "cdVertex( %d, %d)", x, y);
+ set_status();
+ ctgc.following = TRUE;
+ break;
+ case IMAGE:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ fImageGet();
+ }
+ break;
+ case RGB:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ fImageRGBGet();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else if (b == IUP_BUTTON3) {
+ if (e) {
+ switch (ctgc.cur_prim) {
+ case IMAGE:
+ cdClip(ctgc.clip_mode);
+ follow(x, y);
+ fImagePut();
+ break;
+ case RGB:
+ cdClip(ctgc.clip_mode);
+ follow(x, y);
+ fImageRGBPut();
+ break;
+ case CLIP:
+ fClipOff();
+ break;
+ default:
+ break;
+ }
+ }
+ else {
+ switch (ctgc.cur_prim) {
+ case POLY:
+ cdActivate(ctgc.iup_canvas);
+ ctgc.following = FALSE;
+ polygon(CLOSE, x, y);
+ sprintf(ctgc.status_line, "cdEnd()");
+ set_status();
+ fDraw();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao resize do canvas. */
+/*-------------------------------------------------------------------------*/
+int fResizeCB(Ihandle *self, int width, int height)
+{
+ ignore(self);
+
+ /* atualiza o contexto do programa */
+ ctgc.w = width;
+ ctgc.h = height;
+
+ /* atualiza o tamanho do canvas em pixels no titulo */
+ sprintf(ctgc.title, "CDTest 5.3 (%dx%d - %dbpp)", ctgc.w, ctgc.h, ctgc.bpp);
+ IupSetAttribute(IupGetHandle("dlgMain"), IUP_TITLE, ctgc.title);
+
+ /* reconstroi o buffer off-screen, se necessario */
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+void cdtest_loadled(void);
+
+/*-------------------------------------------------------------------------*/
+/* Rotina principal. */
+/*-------------------------------------------------------------------------*/
+void main(void)
+{
+ char *err = NULL;
+
+ /* inicializa o IUP */
+ IupOpen();
+
+ /* carrega o LED */
+#ifdef USE_LED
+ err = IupLoad("cdtest.led");
+#else
+ cdtest_loadled();
+#endif
+
+ if (!err)
+ {
+ /* inicializa o CDTest */
+ CDTestInit();
+ }
+ else
+ {
+ /* imprime uma mensagem de erro */
+ IupMessage("LED Error:", err);
+ IupClose();
+ return;
+ }
+
+ IupMainLoop();
+
+ CDTestClose();
+
+ IupClose();
+}
+
diff --git a/test/cdtest/cdtest.dsp b/test/cdtest/cdtest.dsp
new file mode 100644
index 0000000..80c1421
--- /dev/null
+++ b/test/cdtest/cdtest.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="cdtest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=cdtest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cdtest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cdtest.mak" CFG="cdtest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cdtest - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cdtest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "..\bin"
+# PROP BASE Intermediate_Dir "..\obj\cdtest"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin"
+# PROP Intermediate_Dir "..\obj\cdtest"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W3 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "CDTEST_WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp"..\obj/cdtest.pch" /Fo"$(IntDir)/" /Fd"..\obj/cdtest" /GZ /c /GX
+# ADD CPP /nologo /MTd /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W3 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "CDTEST_WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp"..\obj/cdtest.pch" /Fo"$(IntDir)/" /Fd"..\obj/cdtest" /GZ /c /GX
+# ADD BASE MTL /nologo /D"_DEBUG" /mktyplib203 /tlb"..\bin\cdtest.tlb" /win32
+# ADD MTL /nologo /D"_DEBUG" /mktyplib203 /tlb"..\bin\cdtest.tlb" /win32
+# ADD BASE RSC /l 1046 /d "_DEBUG"
+# ADD RSC /l 1046 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib /nologo /out:"..\bin\cdtest.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:"..\bin\cdtest.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib /nologo /out:"..\bin\cdtest.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:"..\bin\cdtest.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+
+!ENDIF
+
+# Begin Target
+
+# Name "cdtest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=Cdtest.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cdtest.led
+# End Source File
+# Begin Source File
+
+SOURCE=cdtest.rc
+# End Source File
+# Begin Source File
+
+SOURCE=cdtest_led.c
+# End Source File
+# Begin Source File
+
+SOURCE=Colorbar.c
+# End Source File
+# Begin Source File
+
+SOURCE=Drivers.c
+# End Source File
+# Begin Source File
+
+SOURCE=List.c
+# End Source File
+# Begin Source File
+
+SOURCE=Rubber.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=Cdtest.h
+# End Source File
+# End Group
+# End Target
+# End Project
+
diff --git a/test/cdtest/cdtest.h b/test/cdtest/cdtest.h
new file mode 100644
index 0000000..f670cc6
--- /dev/null
+++ b/test/cdtest/cdtest.h
@@ -0,0 +1,415 @@
+/*=========================================================================*/
+/* CDTEST.H - 05/12/95. */
+/*=========================================================================*/
+#ifndef CDTEST_H
+#define CDTEST_H
+
+/*- Constantes: -----------------------------------------------------------*/
+#define MAXPOINTS 300
+
+/*- Macros: ---------------------------------------------------------------*/
+#define isdigit(_) (((_)>='0') && ((_)<='9'))
+#define ignore(_) (void)(_)
+
+/*-------------------------------------------------------------------------*/
+/* Tipos enumerados. */
+/*-------------------------------------------------------------------------*/
+typedef enum {
+ LINE,
+ RECT,
+ BOX,
+ ARC,
+ SECTOR,
+ CHORD,
+ PIXEL,
+ MARK,
+ TEXT,
+ POLY,
+ CLIP,
+ IMAGE,
+ RGB,
+ META
+} tPrim;
+
+enum {
+ BACKGROUND,
+ FOREGROUND
+};
+
+enum {
+ NO_BUFFER,
+ IMAGE_BUFFER,
+ IMAGERGB_BUFFER
+};
+
+typedef enum {
+ NEWPOINT,
+ MOVE,
+ CLOSE,
+ CENTER,
+ REPAINT
+} tRubber;
+
+#if ((!defined(FALSE))&&(!defined(TRUE)))
+typedef enum {
+ FALSE,
+ TRUE
+} tBoolean;
+#else
+#define tBoolean int
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Definicao das estruturas de dados usadas. */
+/*-------------------------------------------------------------------------*/
+typedef struct {
+ int x, y;
+} tPoint;
+
+typedef struct {
+ cdContext* ctx;
+ char *filename;
+} tMeta;
+
+typedef struct {
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int interior_style;
+ int back_opacity;
+ int hatch;
+ long foreground;
+ long background;
+} tLB; /* cdLine ou cdBox ou cdRect */
+
+typedef struct {
+ int xc;
+ int yc;
+ int w;
+ int h;
+ double angle1;
+ double angle2;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int interior_style;
+ int back_opacity;
+ int hatch;
+ long foreground;
+ long background;
+} tAS; /* cdArc e cdSector e Chord */
+
+typedef struct {
+ int x;
+ int y;
+ int write_mode;
+ long foreground;
+} tPixel; /* cdPixel */
+
+typedef struct {
+ int x;
+ int y;
+ int write_mode;
+ int mark_type;
+ int mark_size;
+ long foreground;
+} tMark; /* cdMark */
+
+typedef struct {
+ int x;
+ int y;
+ char *s;
+ int write_mode;
+ int font_size;
+ int font_style;
+ int font_typeface;
+ int back_opacity;
+ double text_orientation;
+ int text_alignment;
+ long foreground;
+ long background;
+} tText; /* cdText */
+
+typedef struct {
+ int poly_mode;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int fill_mode;
+ int back_opacity;
+ int interior_style;
+ int hatch;
+ long foreground;
+ long background;
+ int num_points;
+ tPoint *points;
+} tPoly; /* cdBegin, cdVertex e cdEnd */
+
+typedef struct tnode {
+ tPrim type;
+ union {
+ tLB lineboxpar;
+ tAS arcsectorpar;
+ tPoly polypar;
+ tPixel pixelpar;
+ tMark markpar;
+ tText textpar;
+ tMeta metapar;
+ } par;
+ struct tnode *next;
+} tList;
+
+/*-------------------------------------------------------------------------*/
+/* Contexto do CD Test. */
+/*-------------------------------------------------------------------------*/
+typedef struct {
+ cdCanvas *iup_canvas; /* canvas do iup */
+ int w, h; /* largura e altura do canvas */
+ double res;
+ int bpp;
+
+ cdCanvas *wd_canvas; /* canvas IUP p/ WD */
+ int wd_dialog; /* se o dialogo do canvas WD estah na tela */
+
+ cdCanvas *pic_canvas; /* canvas IUP p/ Picture */
+ cdCanvas *picture; /* Picture */
+ int pic_dialog; /* se o dialogo do canvas Picture estah na tela */
+
+ cdCanvas *buffer_canvas; /* canvas para double-buffering */
+ int buffering;
+
+ Ihandle *dlg_cur_prim; /* handle do dialogo de primitiva ativo */
+ Ihandle *bt_cur_prim; /* handle do botao da primitiva corente */
+
+ tPrim cur_prim; /* primitiva corrente */
+ tBoolean following; /* flag de rubber-band */
+ int dlg_x;
+ int dlg_y;
+ int visible;
+
+ int write_mode; /* atributos do CD */
+ int line_cap;
+ int line_join;
+ int line_style;
+ int line_width;
+ int fill_mode;
+ int font_typeface;
+ int font_style;
+ int font_size;
+ int text_alignment;
+ double text_orientation;
+ int back_opacity;
+ int mark_type;
+ int poly_mode;
+ long foreground;
+ long background;
+ int interior_style;
+ int hatch;
+
+ unsigned char stipple[100];/* sample stipple */
+ long pattern[100]; /* sample pattern */
+ int dashes[4]; /* sample dash */
+
+ int clip_xmin;
+ int clip_xmax;
+ int clip_ymin;
+ int clip_ymax;
+ int clip_mode;
+
+ unsigned char *red; /* imagem RGB */
+ unsigned char *green;
+ unsigned char *blue;
+ int rgb_w, rgb_h; /* largura e altura da imagem RGB */
+
+ cdImage *test_image; /* imagem off-screen para testes */
+
+ int num_points; /* numero de pontos no poligono corrente */
+ tPoint points[MAXPOINTS]; /* armazanamento temporario do poligono */
+
+ char status_line[256]; /* linha de status */
+ char title[80]; /* barra de titulo do programa */
+
+ int x, y; /* posiccao do mouse no canvas */
+ char mouse_pos[40]; /* posiccao do mouse em uma string */
+
+ int sim; /* flag para simulacao */
+ int stretch_play;
+
+ tList *head; /* lista de primitivas */
+} tCTC; /* CD Test Context */
+
+extern tCTC ctgc;
+
+/* parametros geometricos das primitivas */
+typedef struct {
+ int x1, x2, y1, y2;
+} tLinePos;
+
+typedef struct {
+ int xmin, xmax, ymin, ymax;
+ int x, y;
+} tBoxPos;
+
+typedef struct {
+ int x, y;
+} tPixelPos;
+
+typedef struct {
+ int x, y;
+ int size;
+} tMarkPos;
+
+typedef struct {
+ int xc, yc;
+ int w, h;
+ double angle1, angle2;
+} tArcPos;
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo CDTEST.C. */
+/*-------------------------------------------------------------------------*/
+int fEditUndo(void);
+int fEditClear(void);
+
+int fRepaint(void);
+int fFileExit(void);
+int fOK(void);
+int fOpenLines(void);
+int fClosedLines(void);
+int fPolyBezier(void);
+int fFill(void);
+int fSolid(void);
+int fHatch(void);
+int fStipple(void);
+int fPattern(void);
+
+int fPolyClip(void);
+int fClipPoly(void);
+
+int fWDCanvas(void);
+int fCloseWD(void);
+int fWDRepaint(void);
+
+int fPICCanvas(void);
+int fClosePIC(void);
+int fPICRepaint(void);
+
+int fOpacity(Ihandle *, char *, int, int);
+int fMarkType(Ihandle *, char *, int, int);
+
+int fNoBuffering(Ihandle *, int);
+int fImageBuffer(Ihandle *, int);
+int fRGBBuffer(Ihandle *, int);
+
+int fWriteMode(Ihandle *, char *, int, int);
+int fLineStyle(Ihandle *, char *, int, int);
+int fLineCap(Ihandle *, char *, int, int);
+int fLineJoin(Ihandle *, char *, int, int);
+int fFillMode(Ihandle *, char *, int, int);
+int fFontStyle(Ihandle *, char *, int, int);
+int fFontTypeFace(Ihandle *, char *, int, int);
+int fTextAlignment(Ihandle *, char *, int, int);
+int fHatchStyle(Ihandle *, char *, int, int);
+
+int fColor(Ihandle *);
+
+int fClip(Ihandle *);
+int fClipArea(void);
+int fClipOff(void);
+
+int fImage(Ihandle *);
+int fImagePut(void);
+int fImageGet(void);
+
+int fImageRGB(Ihandle *);
+int fImageRGBPut(void);
+int fImageRGBGet(void);
+
+int fLine(Ihandle *);
+int fRect(Ihandle *);
+int fBox(Ihandle *);
+int fArc(Ihandle *);
+int fSector(Ihandle *);
+int fChord(Ihandle *);
+int fPixel(Ihandle *);
+int fMark(Ihandle *);
+int fText(Ihandle *);
+int fPoly(Ihandle *);
+
+int fShowDialog(void);
+
+int fStretchPlay(Ihandle*, int);
+int fSimulate(Ihandle *, int);
+int fOptionsHide(void);
+int fOptions(void);
+int fAttributes(void);
+int fAttributesHide(void);
+int fMsgHide(void);
+
+int fInteger(Ihandle *, int);
+int fReal(Ihandle *, int);
+
+int fDraw(void);
+
+int fHelpAbout(void);
+int fCloseAbout(void);
+
+int fMotionCB(Ihandle *, int, int, char *);
+int fButtonCB(Ihandle *, int, int, int, int, char *);
+int fResizeCB(Ihandle *, int, int);
+int fGetFocusCB(Ihandle *);
+
+void set_status(void);
+void mouse_pos(int, int);
+void putlist(cdCanvas *target);
+void draw(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo RUBBER.C. */
+/*-------------------------------------------------------------------------*/
+void follow(int, int);
+void line(tRubber, int, int);
+void box(tRubber, int, int);
+void arc(tRubber, int, int);
+void polygon(tRubber, int, int);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo LIST.C. */
+/*-------------------------------------------------------------------------*/
+int newpolypoint(int, int);
+int newline(int, int, int, int);
+int newrect(int, int, int, int);
+int newbox(int, int, int, int);
+int newarc(int, int, int, int, double, double);
+int newsector(int, int, int, int, double, double);
+int newchord(int, int, int, int, double, double);
+int newpixel(int, int);
+int newmark(int, int, int);
+int newtext(int, int, char *);
+int newmetafile(char *, cdContext* ctx);
+int newpoly(void);
+void dellist(void);
+void dellast(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo DRIVERS.C. */
+/*-------------------------------------------------------------------------*/
+void DriversInit(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo COLORBAR.C. */
+/*-------------------------------------------------------------------------*/
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long *foreground, long *background);
+void ColorBarClose(void);
+
+#endif
diff --git a/test/cdtest/cdtest.ico b/test/cdtest/cdtest.ico
new file mode 100644
index 0000000..ba4b8af
--- /dev/null
+++ b/test/cdtest/cdtest.ico
Binary files differ
diff --git a/test/cdtest/cdtest.led b/test/cdtest/cdtest.led
new file mode 100644
index 0000000..1f2c412
--- /dev/null
+++ b/test/cdtest/cdtest.led
@@ -0,0 +1,1508 @@
+#===========================================================================#
+# CDTEST.LED - 05/12/95 #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Icones da Barra de Primitivas. #
+#---------------------------------------------------------------------------#
+imgLine = IM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,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+)
+
+#---------------------------------------------------------------------------#
+# Descricao dos Menus. #
+#---------------------------------------------------------------------------#
+mnOpen = MENU
+(
+ ITEM("MF...", cmdPlayMF),
+ itPlayCGM = ITEM[ACTIVE=NO]("CGM...", cmdPlayCGM),
+ itPlayEMF = ITEM[ACTIVE=NO]("EMF...", cmdPlayEMF),
+ itPlayWMF = ITEM[ACTIVE=NO]("WMF...", cmdPlayWMF)
+)
+
+mnSave = MENU
+(
+ ITEM("MF...", cmdMF),
+ itPDF = ITEM[ACTIVE=NO]("PDF...", cmdPDF),
+ itPS = ITEM[ACTIVE=NO]("PS...", cmdPS),
+ itEPS = ITEM[ACTIVE=NO]("EPS...", cmdEPS),
+ itCGMt = ITEM[ACTIVE=NO]("CGMt...", cmdCGMt),
+ itCGMb = ITEM[ACTIVE=NO]("CGMb...", cmdCGMb),
+ itDGN = ITEM[ACTIVE=NO]("DGN...", cmdDGN),
+ itDXF = ITEM[ACTIVE=NO]("DXF...", cmdDXF),
+ itEMF = ITEM[ACTIVE=NO]("EMF...", cmdEMF),
+ itWMF = ITEM[ACTIVE=NO]("WMF...", cmdWMF)
+)
+
+mnFile = MENU
+(
+ SUBMENU[KEY=K_O]("Open", mnOpen),
+ SEPARATOR(),
+ SUBMENU[KEY=K_S]("Save", mnSave),
+ SEPARATOR(),
+ itPrint = ITEM[KEY=K_P]("Print...", cmdPrint),
+ SEPARATOR(),
+ ITEM[KEY=K_x]("Exit", cmdFileExit)
+)
+
+mnEdit = MENU
+(
+ itEditUndo = ITEM("Undo", cmdEditUndo),
+ SEPARATOR(),
+ itClipBoard = ITEM[ACTIVE=NO]("Copy as EMF/WMF", cmdClipBoard),
+ itClipBoardBitmap = ITEM[ACTIVE=NO]("Copy as Bitmap", cmdClipBoardBitmap),
+ itClipBoardMetafile = ITEM[ACTIVE=NO]("Copy as CD Metafile", cmdClipBoardMetafile),
+ itClipBoardPaste = ITEM[ACTIVE=NO]("Paste", cmdClipBoardPaste),
+ SEPARATOR(),
+ ITEM("Clear", cmdEditClear),
+ SEPARATOR(),
+ ITEM("Options...", cmdOptions)
+)
+
+mnPrimitives = MENU
+(
+ ITEM("Pixel...", cmdPixel),
+ ITEM("Mark...", cmdMark),
+ ITEM("Line...", cmdLine),
+ ITEM("Polygon...", cmdPoly),
+ ITEM("Rect...", cmdRect),
+ ITEM("Box...", cmdBox),
+ ITEM("Arc...", cmdArc),
+ ITEM("Sector...", cmdSector),
+ ITEM("Chord...", cmdChord),
+ ITEM("Text...", cmdText),
+ SEPARATOR(),
+ ITEM("Server Image...", cmdImage),
+ ITEM("RGB Image...", cmdImageRGB)
+)
+
+mnDraw = MENU[ISMENU=YES]
+(
+ SUBMENU[KEY=K_P]("Primitives", mnPrimitives),
+ SEPARATOR(),
+ ITEM("Clipping...", cmdClip),
+ ITEM("Attributes...", cmdAttributes),
+ SEPARATOR(),
+ itWDCanvas = ITEM("Show WD Canvas", cmdWDCanvas),
+ itPICCanvas = ITEM("Show Picture Canvas", cmdPICCanvas)
+)
+
+mnHelp = MENU
+(
+ ITEM("About...", cmdHelpAbout)
+)
+
+mnMain = MENU
+(
+ SUBMENU[KEY=K_mF]("File", mnFile),
+ SUBMENU[KEY=K_mE]("Edit", mnEdit),
+ SUBMENU[KEY=K_mD]("Draw", mnDraw),
+ SUBMENU[KEY=K_mH]("Help", mnHelp)
+)
+
+#===========================================================================#
+# Barras de Ferramentas. #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Barra de status. #
+#---------------------------------------------------------------------------#
+lbStatusLine = LABEL[EXPAND=HORIZONTAL]("Esta eh a barra de status do CDTest.")
+
+#---------------------------------------------------------------------------#
+# Barra de Primitivas. #
+#---------------------------------------------------------------------------#
+
+btLine = BUTTON[IMAGE=imgLine, TIP="Line"]("",cmdLine)
+btBox = BUTTON[IMAGE=imgBox, TIP="Box"]("",cmdBox)
+btRect = BUTTON[IMAGE=imgRect, TIP="Rect"]("",cmdRect)
+btArc = BUTTON[IMAGE=imgArc, TIP="Arc"]("", cmdArc)
+btSector = BUTTON[IMAGE=imgSector, TIP="Sector"]("", cmdSector)
+btChord = BUTTON[IMAGE=imgChord, TIP="Chord"]("", cmdChord)
+btPixel = BUTTON[IMAGE=imgPixel, TIP="Pixel"]("", cmdPixel)
+btMark = BUTTON[IMAGE=imgMark, TIP="Mark"]("", cmdMark)
+btText = BUTTON[IMAGE=imgText, TIP="Text"]("", cmdText)
+btPoly = BUTTON[IMAGE=imgPoly, TIP="Polygon"]("", cmdPoly)
+
+btImageRGB = BUTTON[IMAGE=imgImageRGB, TIP="RGB Image"]("", cmdImageRGB)
+btImage = BUTTON[IMAGE=imgImage, TIP="Server Image"]("", cmdImage)
+btClip = BUTTON[IMAGE=imgClip, TIP="Clipping Area"]("", cmdClip)
+
+btCurPrim = BUTTON[IMAGE=imgLine, TIP="Show primitive dialog"]("", cmdShowDialog)
+
+lbMousePos = LABEL[SIZE=90]("( , )")
+
+PrimBar = VBOX[GAP=2]
+(
+ btCurPrim,
+ FILL[SIZE=20](),
+ btPixel,
+ btMark,
+ btLine,
+ btPoly,
+ btRect,
+ btBox,
+ btArc,
+ btSector,
+ btChord,
+ btText,
+ FILL[SIZE=5](),
+ btImage,
+ btImageRGB,
+ FILL[SIZE=5](),
+ btClip,
+ FILL[SIZE=30]()
+)
+
+#---------------------------------------------------------------------------#
+# Barra de Cores. #
+#---------------------------------------------------------------------------#
+cnvColorBar = CANVAS
+[
+ BUTTON_CB = cmdColorBarButtonCB,
+ RESIZE_CB = cmdColorBarResizeCB,
+ SIZE = 220x12,
+ BORDER = NO,
+ EXPAND = NO
+]
+(cmdColorBarRepaint)
+
+#===========================================================================#
+# Dialogo Principal #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Canvas para visualizacao das primitivas. #
+#---------------------------------------------------------------------------#
+cnvMain = CANVAS
+[
+ MOTION_CB=cmdMotionCB,
+ BUTTON_CB=cmdButtonCB,
+ RESIZE_CB=cmdResizeCB
+]
+(cmdRepaint)
+
+#---------------------------------------------------------------------------#
+# Area de trabalho. #
+#---------------------------------------------------------------------------#
+DeskTop = VBOX
+(
+ FILL[SIZE=5](),
+ HBOX
+ (
+ FILL[SIZE=5](),
+ PrimBar,
+ FILL[SIZE=2](),
+ VBOX
+ (
+ FILL[SIZE=2](),
+ lbMousePos,
+ FILL[SIZE=5](),
+ cnvMain,
+ FILL[SIZE=2](),
+ cnvColorBar,
+ FILL[SIZE=5](),
+ lbStatusLine
+ ),
+ FILL[SIZE=5]()
+ ),
+ FILL[SIZE=5]()
+)
+
+#---------------------------------------------------------------------------#
+# Dialogo principal. #
+#---------------------------------------------------------------------------#
+dlgMain = DIALOG
+[
+ TITLE = "CD Test 5.3",
+ MENU = mnMain,
+ ICON = "CdTestIcon",
+ K_cZ = cmdEditUndo,
+ GETFOCUS_CB = cmdGetFocusCB,
+ KILLFOCUS_CB = cmdKillFocusCB,
+ CLOSE_CB = cmdFileExit
+]
+(DeskTop)
+
+#===========================================================================#
+# Especificacao dos dialogos auxiliares. #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Dialogo com o canvas para exibiccao de primitivas WD. #
+#---------------------------------------------------------------------------#
+cnvWDCanvas = CANVAS[BORDER=NO](cmdWDRepaint)
+dlgWDCanvas = DIALOG
+[
+ TITLE = "WD Canvas",
+ CLISE_CB = cmdCloseWD,
+ SIZE = 200x200,
+ PARENTDIALOG="dlgMain",
+ GAP=5x5
+]
+(cnvWDCanvas)
+
+cnvPICCanvas = CANVAS[BORDER=NO](cmdPICRepaint)
+dlgPICCanvas = DIALOG
+[
+ TITLE = "PIC Canvas",
+ CLISE_CB = cmdClosePIC,
+ SIZE = 200x200,
+ PARENTDIALOG="dlgMain",
+ GAP=5x5
+]
+(cnvPICCanvas)
+
+#---------------------------------------------------------------------------#
+# Dialogo Options #
+#---------------------------------------------------------------------------#
+btOptionsHide = BUTTON[SIZE=30]("Hide", cmdOptionsHide)
+
+tgSimulate = TOGGLE[VALUE=OFF, SIZE=55]("Simulate", cmdSimulate)
+tgStretchPlay = TOGGLE[VALUE=OFF, SIZE=70]("Stretch Play", cmdStretchPlay)
+
+tgNoBuffering = TOGGLE[VALUE=ON]("No buffering", cmdNoBuffering)
+tgImageBuffer = TOGGLE("CD_DBUFFER", cmdImageBuffer)
+tgRGBBuffer = TOGGLE("CD_DBUFFERRGB", cmdRGBBuffer)
+
+rdBuffering = RADIO
+(
+ VBOX
+ (
+ tgNoBuffering,
+ tgImageBuffer,
+ tgRGBBuffer
+ )
+)
+
+OptionsDesktop = VBOX
+(
+ VBOX[GAP=2]
+ (
+ FRAME[TITLE="Buffering:", MARGIN=5x5, SIZE=80]
+ (
+ rdBuffering
+ ),
+ FILL[SIZE=10](),
+ tgSimulate,
+ tgStretchPlay,
+ FILL[SIZE=10](),
+ btOptionsHide,
+ FILL[SIZE=2]()
+ )
+)
+
+dlgOptions = DIALOG
+[
+ TITLE="Options",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ MARGIN=5x2
+]
+(OptionsDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Attributes #
+#---------------------------------------------------------------------------#
+lstTextAlignment = LIST
+[
+ 1="CD_NORTH",
+ 2="CD_SOUTH",
+ 3="CD_EAST",
+ 4="CD_WEST",
+ 5="CD_NORTH_EAST",
+ 6="CD_NORTH_WEST",
+ 7="CD_SOUTH_EAST",
+ 8="CD_SOUTH_WEST",
+ 9="CD_CENTER",
+ 10="CD_BASE_LEFT",
+ 11="CD_BASE_CENTER",
+ 12="CD_BASE_RIGHT",
+ DROPDOWN=YES,
+ VALUE=10,
+ SIZE=89
+]
+(cmdTextAlignment)
+
+txtMarkSize = TEXT[NC=4, SIZE=20x12, VALUE="10"](cmdInteger)
+
+lstMarkType = LIST
+[
+ 1="CD_PLUS",
+ 2="CD_STAR",
+ 3="CD_CIRCLE",
+ 4="CD_X",
+ 5="CD_BOX",
+ 6="CD_DIAMOND",
+ 7="CD_HOLLOW_CIRCLE",
+ 8="CD_HOLLOW_BOX",
+ 9="CD_HOLLOW_DIAMOND",
+ DROPDOWN=YES,
+ VALUE=2,
+ SIZE=80
+](cmdMarkType)
+
+lstWriteMode = LIST
+[
+ 1="CD_REPLACE",
+ 2="CD_XOR",
+ 3="CD_NOT_XOR",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdWriteMode)
+
+lstFontTypeFace = LIST
+[
+ 1="CD_SYSTEM",
+ 2="CD_COURIER",
+ 3="CD_TIMES_ROMAN",
+ 4="CD_HELVETICA",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFontTypeFace)
+
+lstLineCap = LIST
+[
+ 1="CD_CAPFLAT",
+ 2="CD_CAPSQUARE",
+ 3="CD_CAPROUND",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineCap)
+
+lstLineJoin = LIST
+[
+ 1="CD_BEVEL",
+ 2="CD_MITER",
+ 3="CD_ROUND",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineJoin)
+
+lstFillMode = LIST
+[
+ 1="CD_EVENODD",
+ 2="CD_WINDING",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFillMode)
+
+lstFontStyle = LIST
+[
+ 1="CD_PLAIN",
+ 2="CD_BOLD",
+ 3="CD_ITALIC",
+ 4="CD_BOLD_ITALIC",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFontStyle)
+
+txtLineWidth = TEXT[SIZE=30, NC=3, VALUE="1"](cmdInteger)
+txtFontSize = TEXT[SIZE=30, NC=3, VALUE="12"](cmdInteger)
+txtTextOrientation = TEXT[SIZE=30, NC=3, VALUE="0"](cmdInteger)
+
+lstLineStyle = LIST
+[
+ 1="CD_CONTINUOUS",
+ 2="CD_DASHED",
+ 3="CD_DOTTED",
+ 4="CD_DASH_DOT",
+ 5="CD_DASH_DOT_DOT",
+ 6="CD_CUSTOM",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineStyle)
+
+tgSolid = TOGGLE[VALUE=ON] ("CD_SOLID", cmdSolid)
+tgHatch = TOGGLE("CD_HATCH", cmdHatch)
+tgStipple = TOGGLE("CD_STIPPLE", cmdStipple)
+tgPattern = TOGGLE("CD_PATTERN", cmdPattern)
+
+lstOpacity = LIST
+[
+ 1="CD_OPAQUE",
+ 2="CD_TRANSPARENT",
+ VALUE=2,
+ DROPDOWN=YES,
+ SIZE=80,
+ ACTIVE=YES
+]
+(cmdOpacity)
+
+lstHatchStyle = LIST
+[
+ 1="CD_HORIZONTAL",
+ 2="CD_VERTICAL",
+ 3="CD_FDIAGONAL",
+ 4="CD_BDIAGONAL",
+ 5="CD_CROSS",
+ 6="CD_DIAGCROSS",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80,
+ ACTIVE=YES
+]
+(cmdHatchStyle)
+
+btAttributesHide = BUTTON[SIZE=30]("Hide", cmdAttributesHide)
+
+rdInteriorStyle = RADIO
+(
+ VBOX
+ (
+ tgSolid,
+ tgHatch,
+ tgStipple,
+ tgPattern
+ )
+)
+
+AttributesDesktop = VBOX
+(
+ HBOX
+ (
+ VBOX[GAP=2]
+ (
+ LABEL("Write Mode:"),
+ lstWriteMode,
+ FILL[SIZE=4](),
+ FRAME[TITLE="Fill Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Back Opacity:"),
+ lstOpacity,
+ FILL[SIZE=2](),
+ LABEL("Fill Mode:"),
+ lstFillMode,
+ FILL[SIZE=2](),
+ FRAME[TITLE="Interior Style:", MARGIN=5x5, SIZE=80]
+ (
+ rdInteriorStyle
+ ),
+ FILL[SIZE=2](),
+ LABEL("Hatch Style:"),
+ lstHatchStyle
+ )
+ ),
+ FILL[SIZE=10](),
+ FRAME[TITLE="Mark Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Mark Type:"),
+ lstMarkType,
+ FILL[SIZE=2](),
+ LABEL("Mark Size:"),
+ txtMarkSize
+ )
+ ),
+ FILL[SIZE=10](),
+ btAttributesHide
+ ),
+ VBOX[GAP=2]
+ (
+ FRAME[TITLE="Text Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Font Typeface:"),
+ lstFontTypeFace,
+ FILL[SIZE=2](),
+ LABEL("Font Style:"),
+ lstFontStyle,
+ FILL[SIZE=2](),
+ LABEL("Font Size:"),
+ txtFontSize,
+ FILL[SIZE=2](),
+ LABEL[SIZE=x9]("Text Alignment:"),
+ lstTextAlignment,
+ FILL[SIZE=2](),
+ LABEL[SIZE=x9]("Text Orientation:"),
+ txtTextOrientation
+ )
+ ),
+ FILL[SIZE=10](),
+ FRAME[TITLE="Line Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Line Style:"),
+ lstLineStyle,
+ FILL[SIZE=2](),
+ LABEL("Line Width:"),
+ txtLineWidth,
+ FILL[SIZE=2](),
+ LABEL("Line Cap:"),
+ lstLineCap,
+ FILL[SIZE=2](),
+ LABEL("Line Join:"),
+ lstLineJoin
+ )
+ )
+ )
+ )
+)
+
+dlgAttributes = DIALOG
+[
+ TITLE="Attributes",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdAttributesHide,
+ MARGIN=5x2
+]
+(AttributesDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Line ou Box ou Rect. #
+#---------------------------------------------------------------------------#
+txtLBX1 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBX2 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBY1 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBY2 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btLBDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btLBHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+LBData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=15x9]("X1:"),
+ txtLBX1,
+ FILL[SIZE=5](),
+ LABEL[SIZE=15x9]("Y1:"),
+ txtLBY1
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=15x9]("X2:"),
+ txtLBX2,
+ FILL[SIZE=5](),
+ LABEL[SIZE=15x9]("Y2:"),
+ txtLBY2
+ )
+)
+
+LBDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ LBData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btLBDraw,
+ FILL[SIZE=5](),
+ btLBHide,
+ FILL()
+ )
+)
+
+dlgLB = DIALOG
+[
+ TITLE="Line Parameters",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(LBDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Arc ou Sector. #
+#---------------------------------------------------------------------------#
+txtASXC = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASYC = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASW = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASH = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASAngle1 = TEXT[NC=10, SIZE=30x12, VALUE="0"](cmdReal)
+txtASAngle2 = TEXT[NC=10, SIZE=30x12, VALUE="360"](cmdReal)
+
+btASDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btASHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ASData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Xc:"),
+ txtASXC,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Yc:"),
+ txtASYC
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("W:"),
+ txtASW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("H:"),
+ txtASH
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Angle1:"),
+ txtASAngle1,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Angle2:"),
+ txtASAngle2
+ )
+)
+
+ASDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ASData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btASDraw,
+ FILL[SIZE=5](),
+ btASHide,
+ FILL()
+ )
+)
+
+dlgAS = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Arc Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(ASDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Pixel. #
+#---------------------------------------------------------------------------#
+txtPixelX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtPixelY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btPixelDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btPixelHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+PixelData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=10x9]("X:"),
+ txtPixelX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtPixelY
+ )
+)
+
+PixelDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ PixelData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btPixelDraw,
+ FILL[SIZE=5](),
+ btPixelHide,
+ FILL()
+ )
+)
+
+dlgPixel = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Pixel Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(PixelDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Mark. #
+#---------------------------------------------------------------------------#
+txtMarkX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtMarkY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btMarkDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btMarkHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+MarkData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ FILL(),
+ LABEL[SIZE=10x9]("X:"),
+ txtMarkX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtMarkY,
+ FILL()
+ )
+)
+
+MarkDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ MarkData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btMarkDraw,
+ FILL[SIZE=5](),
+ btMarkHide,
+ FILL()
+ )
+)
+
+dlgMark = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Mark Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(MarkDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Text. #
+#---------------------------------------------------------------------------#
+txtTextX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtTextY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtTextS = TEXT[NC=100, SIZE=89x12, VALUE="Text"](cmdString)
+
+btTextDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btTextHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+TextData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=10x9]("X:"),
+ txtTextX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtTextY
+ ),
+ HBOX
+ (
+ VBOX
+ (
+ LABEL[SIZE=25x9]("Text:"),
+ txtTextS
+ )
+ )
+)
+
+TextDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ TextData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btTextDraw,
+ FILL[SIZE=5](),
+ btTextHide,
+ FILL()
+ )
+)
+
+dlgText = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Text Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(TextDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Poly. #
+#---------------------------------------------------------------------------#
+tgOpenLines = TOGGLE[VALUE=ON]("CD_OPEN_LINES", cmdOpenLines)
+tgClosedLines = TOGGLE("CD_CLOSED_LINES", cmdClosedLines)
+tgFilled = TOGGLE("CD_FILL", cmdFill)
+tgClip = TOGGLE("CD_CLIP", cmdPolyClip)
+tgBezier = TOGGLE("CD_BEZIER", cmdPolyBezier)
+
+btPolyHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+rdMode = RADIO
+(
+ VBOX
+ (
+ tgOpenLines,
+ tgClosedLines,
+ tgFilled,
+ tgClip,
+ tgBezier
+ )
+)
+
+PolyDesktop = VBOX
+(
+ FILL[SIZE=5](),
+ HBOX
+ (
+ FILL(),
+ FRAME[TITLE="Polygon Mode:"]
+ (
+ HBOX
+ (
+ FILL[SIZE=5](),
+ rdMode
+ )
+ ),
+ FILL()
+ ),
+ FILL[SIZE=10](),
+ HBOX
+ (
+ FILL(),
+ btPolyHide,
+ FILL()
+ ),
+ FILL[SIZE=5]()
+)
+
+dlgPoly = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Polygon Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide
+]
+(PolyDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Clip. #
+#---------------------------------------------------------------------------#
+txtClipXmin = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipXmax = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipYmin = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipYmax = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btClipOff = BUTTON[SIZE=30]("Off", cmdClipOff)
+btClipArea = BUTTON[SIZE=30]("Area", cmdClipArea)
+btClipPoly = BUTTON[SIZE=50]("Polygon", cmdClipPoly)
+btClipHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ClipData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=25x9]("Xmin:"),
+ txtClipXmin,
+ FILL[SIZE=5](),
+ LABEL[SIZE=25x9]("Ymin:"),
+ txtClipYmin
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=25x9]("Xmax:"),
+ txtClipXmax,
+ FILL[SIZE=5](),
+ LABEL[SIZE=25x9]("Ymax:"),
+ txtClipYmax
+ )
+)
+
+ClipDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ClipData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btClipOff,
+ FILL[SIZE=5](),
+ btClipArea,
+ FILL[SIZE=5](),
+ btClipPoly,
+ FILL[SIZE=5](),
+ btClipHide,
+ FILL()
+ )
+)
+
+dlgClip = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Clipping",
+ MAXBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ MINBOX=NO,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ClipDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Image. #
+#---------------------------------------------------------------------------#
+txtImageX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageW = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageH = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btImagePut = BUTTON[SIZE=30]("Put", cmdImagePut)
+btImageGet = BUTTON[SIZE=30]("Get", cmdImageGet)
+btImageHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ImageData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("X:"),
+ txtImageX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Y:"),
+ txtImageY
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Width:"),
+ txtImageW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Height:"),
+ txtImageH
+ )
+)
+
+ImageDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ImageData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btImageGet,
+ FILL[SIZE=5](),
+ btImagePut,
+ FILL[SIZE=5](),
+ btImageHide,
+ FILL()
+ )
+)
+
+dlgImage = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Server Image",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ImageDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo ImageRGB. #
+#---------------------------------------------------------------------------#
+txtImageRGBX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBW = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBH = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btImageRGBPut = BUTTON[SIZE=30]("Put", cmdImageRGBPut)
+btImageRGBGet = BUTTON[SIZE=30]("Get", cmdImageRGBGet)
+btImageRGBHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ImageRGBData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("X:"),
+ txtImageRGBX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Y:"),
+ txtImageRGBY
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Width:"),
+ txtImageRGBW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Height:"),
+ txtImageRGBH
+ )
+)
+
+ImageRGBDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ImageRGBData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btImageRGBGet,
+ FILL[SIZE=5](),
+ btImageRGBPut,
+ FILL[SIZE=5](),
+ btImageRGBHide,
+ FILL()
+ )
+)
+
+dlgImageRGB = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="RGB Image",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ImageRGBDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo About. #
+#---------------------------------------------------------------------------#
+
+btCDTest = BUTTON("Close", cmdCloseAbout)
+
+AboutDeskTop = HBOX[MARGIN=5x5, GAP=2]
+(
+ FILL(),
+ VBOX[ALIGNMENT=ACENTER](
+ LABEL("CD Test 5.3"),
+ FILL[SIZE=5](),
+ LABEL("Antonio Scuri"),
+ LABEL("Diego Nehab"),
+ FILL[SIZE=5](),
+ LABEL("Tecgraf/PUC-Rio"),
+ FILL[SIZE=5](),
+ LABEL("CD Library Version"),
+ lblVersion = LABEL(""),
+ btCDTest
+ ),
+ FILL()
+)
+
+dlgHelpAbout = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="About",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO
+]
+(AboutDeskTop)
+
+
+ \ No newline at end of file
diff --git a/test/cdtest/cdtest.rc b/test/cdtest/cdtest.rc
new file mode 100644
index 0000000..c7e3ebc
--- /dev/null
+++ b/test/cdtest/cdtest.rc
@@ -0,0 +1 @@
+CdTestIcon ICON "cdtest.ico"
diff --git a/test/cdtest/cdtest.sln b/test/cdtest/cdtest.sln
new file mode 100644
index 0000000..fb19d0c
--- /dev/null
+++ b/test/cdtest/cdtest.sln
@@ -0,0 +1,16 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdtest", "cdtest.vcproj", "{A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}.Debug|Win32.Build.0 = Debug|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/test/cdtest/cdtest.vcproj b/test/cdtest/cdtest.vcproj
new file mode 100644
index 0000000..2323676
--- /dev/null
+++ b/test/cdtest/cdtest.vcproj
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="cdtest"
+ ProjectGUID="{A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\bin"
+ IntermediateDirectory="..\obj\cdtest"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName="..\bin/cdtest.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include,..\..\..\iup\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;CDTEST_WIN32;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile="..\obj/cdtest.pch"
+ AssemblerListingLocation=""
+ ObjectFile="$(IntDir)/"
+ ProgramDataBaseFileName="..\obj/cdtest"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1046"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib"
+ OutputFile="..\bin/cdtest.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib,..\..\..\iup\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="..\bin/cdtest.pdb"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="Cdtest.c"
+ >
+ </File>
+ <File
+ RelativePath=".\cdtest.led"
+ >
+ </File>
+ <File
+ RelativePath="cdtest.rc"
+ >
+ </File>
+ <File
+ RelativePath="cdtest_led.c"
+ >
+ </File>
+ <File
+ RelativePath="Colorbar.c"
+ >
+ </File>
+ <File
+ RelativePath="Drivers.c"
+ >
+ </File>
+ <File
+ RelativePath="List.c"
+ >
+ </File>
+ <File
+ RelativePath="Rubber.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="Cdtest.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/test/cdtest/cdtest_led.c b/test/cdtest/cdtest_led.c
new file mode 100644
index 0000000..b48b467
--- /dev/null
+++ b/test/cdtest/cdtest_led.c
@@ -0,0 +1,1590 @@
+/* Arquivo gerado automaticamente por ledc 2.5 */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <iup.h>
+
+static Ihandle* named[ 172 ];
+
+static Ihandle* decl( char* name, Ihandle* elem, char* first, ...)
+{
+ char *attr, *val;
+ va_list arg;
+ va_start (arg, first);
+ attr = first;
+ while (attr)
+ {
+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, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1 };
+
+ decl( "imgPixel", IupImage( 18, 18, map ),
+ "0", "BGCOLOR",
+ "1", "0 0 0",
+ "2", "255 255 255", 0 );
+}
+
+
+void cdtest_loadled (void)
+{
+ image_imgLine ();
+ image_imgClip ();
+ image_imgImage ();
+ image_imgImageRGB ();
+ image_imgBox ();
+ image_imgRect ();
+ image_imgSector ();
+ image_imgChord ();
+ image_imgArc ();
+ image_imgText ();
+ image_imgPoly ();
+ image_imgMark ();
+ image_imgPixel ();
+ named[0] = decl( "mnOpen", IupMenu(
+ IupItem( "MF...", "cmdPlayMF" ),
+ named[1] = decl( "itPlayCGM", IupItem( "CGM...", "cmdPlayCGM" ),
+ "ACTIVE", "NO", 0 ),
+ named[2] = decl( "itPlayEMF", IupItem( "EMF...", "cmdPlayEMF" ),
+ "ACTIVE", "NO", 0 ),
+ named[3] = decl( "itPlayWMF", IupItem( "WMF...", "cmdPlayWMF" ),
+ "ACTIVE", "NO", 0 ),
+ NULL), 0 );
+ named[4] = decl( "mnSave", IupMenu(
+ IupItem( "MF...", "cmdMF" ),
+ named[5] = decl( "itPDF", IupItem( "PDF...", "cmdPDF" ),
+ "ACTIVE", "NO", 0 ),
+ named[6] = decl( "itPS", IupItem( "PS...", "cmdPS" ),
+ "ACTIVE", "NO", 0 ),
+ named[7] = decl( "itEPS", IupItem( "EPS...", "cmdEPS" ),
+ "ACTIVE", "NO", 0 ),
+ named[8] = decl( "itCGMt", IupItem( "CGMt...", "cmdCGMt" ),
+ "ACTIVE", "NO", 0 ),
+ named[9] = decl( "itCGMb", IupItem( "CGMb...", "cmdCGMb" ),
+ "ACTIVE", "NO", 0 ),
+ named[10] = decl( "itDGN", IupItem( "DGN...", "cmdDGN" ),
+ "ACTIVE", "NO", 0 ),
+ named[11] = decl( "itDXF", IupItem( "DXF...", "cmdDXF" ),
+ "ACTIVE", "NO", 0 ),
+ named[12] = decl( "itEMF", IupItem( "EMF...", "cmdEMF" ),
+ "ACTIVE", "NO", 0 ),
+ named[13] = decl( "itWMF", IupItem( "WMF...", "cmdWMF" ),
+ "ACTIVE", "NO", 0 ),
+ NULL), 0 );
+ named[14] = decl( "mnFile", IupMenu(
+ decl( 0, IupSubmenu( "Open",
+ named[0] /* mnOpen */
+ ),
+ "KEY", "K_O", 0 ),
+ IupSeparator(),
+ decl( 0, IupSubmenu( "Save",
+ named[4] /* mnSave */
+ ),
+ "KEY", "K_S", 0 ),
+ IupSeparator(),
+ named[15] = decl( "itPrint", IupItem( "Print...", "cmdPrint" ),
+ "KEY", "K_P", 0 ),
+ IupSeparator(),
+ decl( 0, IupItem( "Exit", "cmdFileExit" ),
+ "KEY", "K_x", 0 ),
+ NULL), 0 );
+ named[16] = decl( "mnEdit", IupMenu(
+ named[17] = decl( "itEditUndo", IupItem( "Undo", "cmdEditUndo" ), 0 ),
+ IupSeparator(),
+ named[18] = decl( "itClipBoard", IupItem( "Copy as EMF/WMF", "cmdClipBoard" ),
+ "ACTIVE", "NO", 0 ),
+ named[19] = decl( "itClipBoardBitmap", IupItem( "Copy as Bitmap", "cmdClipBoardBitmap" ),
+ "ACTIVE", "NO", 0 ),
+ named[20] = decl( "itClipBoardMetafile", IupItem( "Copy as CD Metafile", "cmdClipBoardMetafile" ),
+ "ACTIVE", "NO", 0 ),
+ named[21] = decl( "itClipBoardPaste", IupItem( "Paste", "cmdClipBoardPaste" ),
+ "ACTIVE", "NO", 0 ),
+ IupSeparator(),
+ IupItem( "Clear", "cmdEditClear" ),
+ IupSeparator(),
+ IupItem( "Options...", "cmdOptions" ),
+ NULL), 0 );
+ named[22] = decl( "mnPrimitives", IupMenu(
+ IupItem( "Pixel...", "cmdPixel" ),
+ IupItem( "Mark...", "cmdMark" ),
+ IupItem( "Line...", "cmdLine" ),
+ IupItem( "Polygon...", "cmdPoly" ),
+ IupItem( "Rect...", "cmdRect" ),
+ IupItem( "Box...", "cmdBox" ),
+ IupItem( "Arc...", "cmdArc" ),
+ IupItem( "Sector...", "cmdSector" ),
+ IupItem( "Chord...", "cmdChord" ),
+ IupItem( "Text...", "cmdText" ),
+ IupSeparator(),
+ IupItem( "Server Image...", "cmdImage" ),
+ IupItem( "RGB Image...", "cmdImageRGB" ),
+ NULL), 0 );
+ named[23] = decl( "mnDraw", IupMenu(
+ decl( 0, IupSubmenu( "Primitives",
+ named[22] /* mnPrimitives */
+ ),
+ "KEY", "K_P", 0 ),
+ IupSeparator(),
+ IupItem( "Clipping...", "cmdClip" ),
+ IupItem( "Attributes...", "cmdAttributes" ),
+ IupSeparator(),
+ named[24] = decl( "itWDCanvas", IupItem( "Show WD Canvas", "cmdWDCanvas" ), 0 ),
+ named[25] = decl( "itPICCanvas", IupItem( "Show Picture Canvas", "cmdPICCanvas" ), 0 ),
+ NULL),
+ "ISMENU", "YES", 0 );
+ named[26] = decl( "mnHelp", IupMenu(
+ IupItem( "About...", "cmdHelpAbout" ),
+ NULL), 0 );
+ named[27] = decl( "mnMain", IupMenu(
+ decl( 0, IupSubmenu( "File",
+ named[14] /* mnFile */
+ ),
+ "KEY", "K_mF", 0 ),
+ decl( 0, IupSubmenu( "Edit",
+ named[16] /* mnEdit */
+ ),
+ "KEY", "K_mE", 0 ),
+ decl( 0, IupSubmenu( "Draw",
+ named[23] /* mnDraw */
+ ),
+ "KEY", "K_mD", 0 ),
+ decl( 0, IupSubmenu( "Help",
+ named[26] /* mnHelp */
+ ),
+ "KEY", "K_mH", 0 ),
+ NULL), 0 );
+ named[28] = decl( "lbStatusLine", IupLabel( "Esta eh a barra de status do CDTest." ),
+ "EXPAND", "HORIZONTAL", 0 );
+ named[29] = decl( "btLine", IupButton( "", "cmdLine" ),
+ "IMAGE", "imgLine",
+ "TIP", "Line", 0 );
+ named[30] = decl( "btBox", IupButton( "", "cmdBox" ),
+ "IMAGE", "imgBox",
+ "TIP", "Box", 0 );
+ named[31] = decl( "btRect", IupButton( "", "cmdRect" ),
+ "IMAGE", "imgRect",
+ "TIP", "Rect", 0 );
+ named[32] = decl( "btArc", IupButton( "", "cmdArc" ),
+ "IMAGE", "imgArc",
+ "TIP", "Arc", 0 );
+ named[33] = decl( "btSector", IupButton( "", "cmdSector" ),
+ "IMAGE", "imgSector",
+ "TIP", "Sector", 0 );
+ named[34] = decl( "btChord", IupButton( "", "cmdChord" ),
+ "IMAGE", "imgChord",
+ "TIP", "Chord", 0 );
+ named[35] = decl( "btPixel", IupButton( "", "cmdPixel" ),
+ "IMAGE", "imgPixel",
+ "TIP", "Pixel", 0 );
+ named[36] = decl( "btMark", IupButton( "", "cmdMark" ),
+ "IMAGE", "imgMark",
+ "TIP", "Mark", 0 );
+ named[37] = decl( "btText", IupButton( "", "cmdText" ),
+ "IMAGE", "imgText",
+ "TIP", "Text", 0 );
+ named[38] = decl( "btPoly", IupButton( "", "cmdPoly" ),
+ "IMAGE", "imgPoly",
+ "TIP", "Polygon", 0 );
+ named[39] = decl( "btImageRGB", IupButton( "", "cmdImageRGB" ),
+ "IMAGE", "imgImageRGB",
+ "TIP", "RGB Image", 0 );
+ named[40] = decl( "btImage", IupButton( "", "cmdImage" ),
+ "IMAGE", "imgImage",
+ "TIP", "Server Image", 0 );
+ named[41] = decl( "btClip", IupButton( "", "cmdClip" ),
+ "IMAGE", "imgClip",
+ "TIP", "Clipping Area", 0 );
+ named[42] = decl( "btCurPrim", IupButton( "", "cmdShowDialog" ),
+ "IMAGE", "imgLine",
+ "TIP", "Show primitive dialog", 0 );
+ named[43] = decl( "lbMousePos", IupLabel( "( , )" ),
+ "SIZE", "90", 0 );
+ named[44] = decl( "PrimBar", IupVbox(
+ named[42] /* btCurPrim */,
+ decl( 0, IupFill(),
+ "SIZE", "20", 0 ),
+ named[35] /* btPixel */,
+ named[36] /* btMark */,
+ named[29] /* btLine */,
+ named[38] /* btPoly */,
+ named[31] /* btRect */,
+ named[30] /* btBox */,
+ named[32] /* btArc */,
+ named[33] /* btSector */,
+ named[34] /* btChord */,
+ named[37] /* btText */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[40] /* btImage */,
+ named[39] /* btImageRGB */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[41] /* btClip */,
+ decl( 0, IupFill(),
+ "SIZE", "30", 0 ),
+ NULL),
+ "GAP", "2", 0 );
+ named[45] = decl( "cnvColorBar", IupCanvas( "cmdColorBarRepaint" ),
+ "BUTTON_CB", "cmdColorBarButtonCB",
+ "RESIZE_CB", "cmdColorBarResizeCB",
+ "SIZE", "220x12",
+ "BORDER", "NO",
+ "EXPAND", "NO", 0 );
+ named[46] = decl( "cnvMain", IupCanvas( "cmdRepaint" ),
+ "MOTION_CB", "cmdMotionCB",
+ "BUTTON_CB", "cmdButtonCB",
+ "RESIZE_CB", "cmdResizeCB", 0 );
+ named[47] = decl( "DeskTop", IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupHbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[44] /* PrimBar */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ named[43] /* lbMousePos */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[46] /* cnvMain */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ named[45] /* cnvColorBar */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[28] /* lbStatusLine */,
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL), 0 );
+ named[48] = decl( "dlgMain", IupDialog(
+ named[47] /* DeskTop */
+ ),
+ "TITLE", "CD Test 5.3",
+ "MENU", "mnMain",
+ "ICON", "CdTestIcon",
+ "K_cZ", "cmdEditUndo",
+ "GETFOCUS_CB", "cmdGetFocusCB",
+ "KILLFOCUS_CB", "cmdKillFocusCB",
+ "CLOSE_CB", "cmdFileExit", 0 );
+ named[49] = decl( "cnvWDCanvas", IupCanvas( "cmdWDRepaint" ),
+ "BORDER", "NO", 0 );
+ named[50] = decl( "dlgWDCanvas", IupDialog(
+ named[49] /* cnvWDCanvas */
+ ),
+ "TITLE", "WD Canvas",
+ "CLISE_CB", "cmdCloseWD",
+ "SIZE", "200x200",
+ "PARENTDIALOG", "dlgMain",
+ "GAP", "5x5", 0 );
+ named[51] = decl( "cnvPICCanvas", IupCanvas( "cmdPICRepaint" ),
+ "BORDER", "NO", 0 );
+ named[52] = decl( "dlgPICCanvas", IupDialog(
+ named[51] /* cnvPICCanvas */
+ ),
+ "TITLE", "PIC Canvas",
+ "CLISE_CB", "cmdClosePIC",
+ "SIZE", "200x200",
+ "PARENTDIALOG", "dlgMain",
+ "GAP", "5x5", 0 );
+ named[53] = decl( "btOptionsHide", IupButton( "Hide", "cmdOptionsHide" ),
+ "SIZE", "30", 0 );
+ named[54] = decl( "tgSimulate", IupToggle( "Simulate", "cmdSimulate" ),
+ "VALUE", "OFF",
+ "SIZE", "55", 0 );
+ named[55] = decl( "tgStretchPlay", IupToggle( "Stretch Play", "cmdStretchPlay" ),
+ "VALUE", "OFF",
+ "SIZE", "70", 0 );
+ named[56] = decl( "tgNoBuffering", IupToggle( "No buffering", "cmdNoBuffering" ),
+ "VALUE", "ON", 0 );
+ named[57] = decl( "tgImageBuffer", IupToggle( "CD_DBUFFER", "cmdImageBuffer" ), 0 );
+ named[58] = decl( "tgRGBBuffer", IupToggle( "CD_DBUFFERRGB", "cmdRGBBuffer" ), 0 );
+ named[59] = decl( "rdBuffering", IupRadio(
+ IupVbox(
+ named[56] /* tgNoBuffering */,
+ named[57] /* tgImageBuffer */,
+ named[58] /* tgRGBBuffer */,
+ NULL)
+ ), 0 );
+ named[60] = decl( "OptionsDesktop", IupVbox(
+ decl( 0, IupVbox(
+ decl( 0, IupFrame(
+ named[59] /* rdBuffering */
+ ),
+ "TITLE", "Buffering:",
+ "MARGIN", "5x5",
+ "SIZE", "80", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[54] /* tgSimulate */,
+ named[55] /* tgStretchPlay */,
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[53] /* btOptionsHide */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ NULL),
+ "GAP", "2", 0 ),
+ NULL), 0 );
+ named[61] = decl( "dlgOptions", IupDialog(
+ named[60] /* OptionsDesktop */
+ ),
+ "TITLE", "Options",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "MARGIN", "5x2", 0 );
+ named[62] = decl( "lstTextAlignment", IupList( "cmdTextAlignment" ),
+ "1", "CD_NORTH",
+ "2", "CD_SOUTH",
+ "3", "CD_EAST",
+ "4", "CD_WEST",
+ "5", "CD_NORTH_EAST",
+ "6", "CD_NORTH_WEST",
+ "7", "CD_SOUTH_EAST",
+ "8", "CD_SOUTH_WEST",
+ "9", "CD_CENTER",
+ "10", "CD_BASE_LEFT",
+ "11", "CD_BASE_CENTER",
+ "12", "CD_BASE_RIGHT",
+ "DROPDOWN", "YES",
+ "VALUE", "10",
+ "SIZE", "89", 0 );
+ named[63] = decl( "txtMarkSize", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "20x12",
+ "VALUE", "10", 0 );
+ named[64] = decl( "lstMarkType", IupList( "cmdMarkType" ),
+ "1", "CD_PLUS",
+ "2", "CD_STAR",
+ "3", "CD_CIRCLE",
+ "4", "CD_X",
+ "5", "CD_BOX",
+ "6", "CD_DIAMOND",
+ "7", "CD_HOLLOW_CIRCLE",
+ "8", "CD_HOLLOW_BOX",
+ "9", "CD_HOLLOW_DIAMOND",
+ "DROPDOWN", "YES",
+ "VALUE", "2",
+ "SIZE", "80", 0 );
+ named[65] = decl( "lstWriteMode", IupList( "cmdWriteMode" ),
+ "1", "CD_REPLACE",
+ "2", "CD_XOR",
+ "3", "CD_NOT_XOR",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[66] = decl( "lstFontTypeFace", IupList( "cmdFontTypeFace" ),
+ "1", "CD_SYSTEM",
+ "2", "CD_COURIER",
+ "3", "CD_TIMES_ROMAN",
+ "4", "CD_HELVETICA",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[67] = decl( "lstLineCap", IupList( "cmdLineCap" ),
+ "1", "CD_CAPFLAT",
+ "2", "CD_CAPSQUARE",
+ "3", "CD_CAPROUND",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[68] = decl( "lstLineJoin", IupList( "cmdLineJoin" ),
+ "1", "CD_BEVEL",
+ "2", "CD_MITER",
+ "3", "CD_ROUND",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[69] = decl( "lstFillMode", IupList( "cmdFillMode" ),
+ "1", "CD_EVENODD",
+ "2", "CD_WINDING",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[70] = decl( "lstFontStyle", IupList( "cmdFontStyle" ),
+ "1", "CD_PLAIN",
+ "2", "CD_BOLD",
+ "3", "CD_ITALIC",
+ "4", "CD_BOLD_ITALIC",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[71] = decl( "txtLineWidth", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "1", 0 );
+ named[72] = decl( "txtFontSize", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "12", 0 );
+ named[73] = decl( "txtTextOrientation", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "0", 0 );
+ named[74] = decl( "lstLineStyle", IupList( "cmdLineStyle" ),
+ "1", "CD_CONTINUOUS",
+ "2", "CD_DASHED",
+ "3", "CD_DOTTED",
+ "4", "CD_DASH_DOT",
+ "5", "CD_DASH_DOT_DOT",
+ "6", "CD_CUSTOM",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[75] = decl( "tgSolid", IupToggle( "CD_SOLID", "cmdSolid" ),
+ "VALUE", "ON", 0 );
+ named[76] = decl( "tgHatch", IupToggle( "CD_HATCH", "cmdHatch" ), 0 );
+ named[77] = decl( "tgStipple", IupToggle( "CD_STIPPLE", "cmdStipple" ), 0 );
+ named[78] = decl( "tgPattern", IupToggle( "CD_PATTERN", "cmdPattern" ), 0 );
+ named[79] = decl( "lstOpacity", IupList( "cmdOpacity" ),
+ "1", "CD_OPAQUE",
+ "2", "CD_TRANSPARENT",
+ "VALUE", "2",
+ "DROPDOWN", "YES",
+ "SIZE", "80",
+ "ACTIVE", "YES", 0 );
+ named[80] = decl( "lstHatchStyle", IupList( "cmdHatchStyle" ),
+ "1", "CD_HORIZONTAL",
+ "2", "CD_VERTICAL",
+ "3", "CD_FDIAGONAL",
+ "4", "CD_BDIAGONAL",
+ "5", "CD_CROSS",
+ "6", "CD_DIAGCROSS",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80",
+ "ACTIVE", "YES", 0 );
+ named[81] = decl( "btAttributesHide", IupButton( "Hide", "cmdAttributesHide" ),
+ "SIZE", "30", 0 );
+ named[82] = decl( "rdInteriorStyle", IupRadio(
+ IupVbox(
+ named[75] /* tgSolid */,
+ named[76] /* tgHatch */,
+ named[77] /* tgStipple */,
+ named[78] /* tgPattern */,
+ NULL)
+ ), 0 );
+ named[83] = decl( "AttributesDesktop", IupVbox(
+ IupHbox(
+ decl( 0, IupVbox(
+ IupLabel( "Write Mode:" ),
+ named[65] /* lstWriteMode */,
+ decl( 0, IupFill(),
+ "SIZE", "4", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Back Opacity:" ),
+ named[79] /* lstOpacity */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Fill Mode:" ),
+ named[69] /* lstFillMode */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupFrame(
+ named[82] /* rdInteriorStyle */
+ ),
+ "TITLE", "Interior Style:",
+ "MARGIN", "5x5",
+ "SIZE", "80", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Hatch Style:" ),
+ named[80] /* lstHatchStyle */,
+ NULL)
+ ),
+ "TITLE", "Fill Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Mark Type:" ),
+ named[64] /* lstMarkType */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Mark Size:" ),
+ named[63] /* txtMarkSize */,
+ NULL)
+ ),
+ "TITLE", "Mark Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[81] /* btAttributesHide */,
+ NULL),
+ "GAP", "2", 0 ),
+ decl( 0, IupVbox(
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Font Typeface:" ),
+ named[66] /* lstFontTypeFace */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Font Style:" ),
+ named[70] /* lstFontStyle */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Font Size:" ),
+ named[72] /* txtFontSize */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupLabel( "Text Alignment:" ),
+ "SIZE", "x9", 0 ),
+ named[62] /* lstTextAlignment */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupLabel( "Text Orientation:" ),
+ "SIZE", "x9", 0 ),
+ named[73] /* txtTextOrientation */,
+ NULL)
+ ),
+ "TITLE", "Text Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Line Style:" ),
+ named[74] /* lstLineStyle */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Width:" ),
+ named[71] /* txtLineWidth */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Cap:" ),
+ named[67] /* lstLineCap */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Join:" ),
+ named[68] /* lstLineJoin */,
+ NULL)
+ ),
+ "TITLE", "Line Attributes",
+ "MARGIN", "5x5", 0 ),
+ NULL),
+ "GAP", "2", 0 ),
+ NULL),
+ NULL), 0 );
+ named[84] = decl( "dlgAttributes", IupDialog(
+ named[83] /* AttributesDesktop */
+ ),
+ "TITLE", "Attributes",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdAttributesHide",
+ "MARGIN", "5x2", 0 );
+ named[85] = decl( "txtLBX1", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[86] = decl( "txtLBX2", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[87] = decl( "txtLBY1", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[88] = decl( "txtLBY2", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[89] = decl( "btLBDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[90] = decl( "btLBHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[91] = decl( "LBData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X1:" ),
+ "SIZE", "15x9", 0 ),
+ named[85] /* txtLBX1 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y1:" ),
+ "SIZE", "15x9", 0 ),
+ named[87] /* txtLBY1 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X2:" ),
+ "SIZE", "15x9", 0 ),
+ named[86] /* txtLBX2 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y2:" ),
+ "SIZE", "15x9", 0 ),
+ named[88] /* txtLBY2 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[92] = decl( "LBDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[91] /* LBData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[89] /* btLBDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[90] /* btLBHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[93] = decl( "dlgLB", IupDialog(
+ named[92] /* LBDeskTop */
+ ),
+ "TITLE", "Line Parameters",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[94] = decl( "txtASXC", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[95] = decl( "txtASYC", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[96] = decl( "txtASW", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[97] = decl( "txtASH", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[98] = decl( "txtASAngle1", IupText( "cmdReal" ),
+ "NC", "10",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[99] = decl( "txtASAngle2", IupText( "cmdReal" ),
+ "NC", "10",
+ "SIZE", "30x12",
+ "VALUE", "360", 0 );
+ named[100] = decl( "btASDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[101] = decl( "btASHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[102] = decl( "ASData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xc:" ),
+ "SIZE", "30x9", 0 ),
+ named[94] /* txtASXC */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Yc:" ),
+ "SIZE", "30x9", 0 ),
+ named[95] /* txtASYC */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "W:" ),
+ "SIZE", "30x9", 0 ),
+ named[96] /* txtASW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "H:" ),
+ "SIZE", "30x9", 0 ),
+ named[97] /* txtASH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Angle1:" ),
+ "SIZE", "30x9", 0 ),
+ named[98] /* txtASAngle1 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Angle2:" ),
+ "SIZE", "30x9", 0 ),
+ named[99] /* txtASAngle2 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[103] = decl( "ASDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[102] /* ASData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[100] /* btASDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[101] /* btASHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[104] = decl( "dlgAS", IupDialog(
+ named[103] /* ASDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Arc Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[105] = decl( "txtPixelX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[106] = decl( "txtPixelY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[107] = decl( "btPixelDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[108] = decl( "btPixelHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[109] = decl( "PixelData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[105] /* txtPixelX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[106] /* txtPixelY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[110] = decl( "PixelDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[109] /* PixelData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[107] /* btPixelDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[108] /* btPixelHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[111] = decl( "dlgPixel", IupDialog(
+ named[110] /* PixelDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Pixel Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[112] = decl( "txtMarkX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[113] = decl( "txtMarkY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[114] = decl( "btMarkDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[115] = decl( "btMarkHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[116] = decl( "MarkData", IupVbox(
+ decl( 0, IupHbox(
+ IupFill(),
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[112] /* txtMarkX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[113] /* txtMarkY */,
+ IupFill(),
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[117] = decl( "MarkDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[116] /* MarkData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[114] /* btMarkDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[115] /* btMarkHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[118] = decl( "dlgMark", IupDialog(
+ named[117] /* MarkDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Mark Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[119] = decl( "txtTextX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[120] = decl( "txtTextY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[121] = decl( "txtTextS", IupText( "cmdString" ),
+ "NC", "100",
+ "SIZE", "89x12",
+ "VALUE", "Text", 0 );
+ named[122] = decl( "btTextDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[123] = decl( "btTextHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[124] = decl( "TextData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[119] /* txtTextX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[120] /* txtTextY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ IupHbox(
+ IupVbox(
+ decl( 0, IupLabel( "Text:" ),
+ "SIZE", "25x9", 0 ),
+ named[121] /* txtTextS */,
+ NULL),
+ NULL),
+ NULL), 0 );
+ named[125] = decl( "TextDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[124] /* TextData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[122] /* btTextDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[123] /* btTextHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[126] = decl( "dlgText", IupDialog(
+ named[125] /* TextDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Text Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[127] = decl( "tgOpenLines", IupToggle( "CD_OPEN_LINES", "cmdOpenLines" ),
+ "VALUE", "ON", 0 );
+ named[128] = decl( "tgClosedLines", IupToggle( "CD_CLOSED_LINES", "cmdClosedLines" ), 0 );
+ named[129] = decl( "tgFilled", IupToggle( "CD_FILL", "cmdFill" ), 0 );
+ named[130] = decl( "tgClip", IupToggle( "CD_CLIP", "cmdPolyClip" ), 0 );
+ named[131] = decl( "tgBezier", IupToggle( "CD_BEZIER", "cmdPolyBezier" ), 0 );
+ named[132] = decl( "btPolyHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[133] = decl( "rdMode", IupRadio(
+ IupVbox(
+ named[127] /* tgOpenLines */,
+ named[128] /* tgClosedLines */,
+ named[129] /* tgFilled */,
+ named[130] /* tgClip */,
+ named[131] /* tgBezier */,
+ NULL)
+ ), 0 );
+ named[134] = decl( "PolyDesktop", IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupHbox(
+ IupFill(),
+ decl( 0, IupFrame(
+ IupHbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[133] /* rdMode */,
+ NULL)
+ ),
+ "TITLE", "Polygon Mode:", 0 ),
+ IupFill(),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ IupHbox(
+ IupFill(),
+ named[132] /* btPolyHide */,
+ IupFill(),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL), 0 );
+ named[135] = decl( "dlgPoly", IupDialog(
+ named[134] /* PolyDesktop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Polygon Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide", 0 );
+ named[136] = decl( "txtClipXmin", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[137] = decl( "txtClipXmax", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[138] = decl( "txtClipYmin", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[139] = decl( "txtClipYmax", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[140] = decl( "btClipOff", IupButton( "Off", "cmdClipOff" ),
+ "SIZE", "30", 0 );
+ named[141] = decl( "btClipArea", IupButton( "Area", "cmdClipArea" ),
+ "SIZE", "30", 0 );
+ named[142] = decl( "btClipPoly", IupButton( "Polygon", "cmdClipPoly" ),
+ "SIZE", "50", 0 );
+ named[143] = decl( "btClipHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[144] = decl( "ClipData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xmin:" ),
+ "SIZE", "25x9", 0 ),
+ named[136] /* txtClipXmin */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Ymin:" ),
+ "SIZE", "25x9", 0 ),
+ named[138] /* txtClipYmin */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xmax:" ),
+ "SIZE", "25x9", 0 ),
+ named[137] /* txtClipXmax */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Ymax:" ),
+ "SIZE", "25x9", 0 ),
+ named[139] /* txtClipYmax */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[145] = decl( "ClipDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[144] /* ClipData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[140] /* btClipOff */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[141] /* btClipArea */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[142] /* btClipPoly */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[143] /* btClipHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[146] = decl( "dlgClip", IupDialog(
+ named[145] /* ClipDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Clipping",
+ "MAXBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[147] = decl( "txtImageX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[148] = decl( "txtImageY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[149] = decl( "txtImageW", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[150] = decl( "txtImageH", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[151] = decl( "btImagePut", IupButton( "Put", "cmdImagePut" ),
+ "SIZE", "30", 0 );
+ named[152] = decl( "btImageGet", IupButton( "Get", "cmdImageGet" ),
+ "SIZE", "30", 0 );
+ named[153] = decl( "btImageHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[154] = decl( "ImageData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "30x9", 0 ),
+ named[147] /* txtImageX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "30x9", 0 ),
+ named[148] /* txtImageY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Width:" ),
+ "SIZE", "30x9", 0 ),
+ named[149] /* txtImageW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Height:" ),
+ "SIZE", "30x9", 0 ),
+ named[150] /* txtImageH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[155] = decl( "ImageDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[154] /* ImageData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[152] /* btImageGet */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[151] /* btImagePut */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[153] /* btImageHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[156] = decl( "dlgImage", IupDialog(
+ named[155] /* ImageDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Server Image",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[157] = decl( "txtImageRGBX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[158] = decl( "txtImageRGBY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[159] = decl( "txtImageRGBW", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[160] = decl( "txtImageRGBH", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[161] = decl( "btImageRGBPut", IupButton( "Put", "cmdImageRGBPut" ),
+ "SIZE", "30", 0 );
+ named[162] = decl( "btImageRGBGet", IupButton( "Get", "cmdImageRGBGet" ),
+ "SIZE", "30", 0 );
+ named[163] = decl( "btImageRGBHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[164] = decl( "ImageRGBData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "30x9", 0 ),
+ named[157] /* txtImageRGBX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "30x9", 0 ),
+ named[158] /* txtImageRGBY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Width:" ),
+ "SIZE", "30x9", 0 ),
+ named[159] /* txtImageRGBW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Height:" ),
+ "SIZE", "30x9", 0 ),
+ named[160] /* txtImageRGBH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[165] = decl( "ImageRGBDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[164] /* ImageRGBData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[162] /* btImageRGBGet */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[161] /* btImageRGBPut */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[163] /* btImageRGBHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[166] = decl( "dlgImageRGB", IupDialog(
+ named[165] /* ImageRGBDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "RGB Image",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[167] = decl( "btCDTest", IupButton( "Close", "cmdCloseAbout" ), 0 );
+ named[168] = decl( "AboutDeskTop", IupHbox(
+ IupFill(),
+ decl( 0, IupVbox(
+ IupLabel( "CD Test 5.3" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "Antonio Scuri" ),
+ IupLabel( "Diego Nehab" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "Tecgraf/PUC-Rio" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "CD Library Version" ),
+ named[169] = decl( "lblVersion", IupLabel( "" ), 0 ),
+ named[167] /* btCDTest */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ IupFill(),
+ NULL),
+ "MARGIN", "5x5",
+ "GAP", "2", 0 );
+ named[170] = decl( "dlgHelpAbout", IupDialog(
+ named[168] /* AboutDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "About",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO", 0 );
+}
diff --git a/test/cdtest/colobar.h b/test/cdtest/colobar.h
new file mode 100644
index 0000000..263cb53
--- /dev/null
+++ b/test/cdtest/colobar.h
@@ -0,0 +1,7 @@
+#ifndef COLORBAR_H
+#define COLORBAR_H
+
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long int *fc, long int *bc);
+void ColorBarClose(void);
+
+#endif
diff --git a/test/cdtest/colorbar.c b/test/cdtest/colorbar.c
new file mode 100644
index 0000000..c83f539
--- /dev/null
+++ b/test/cdtest/colorbar.c
@@ -0,0 +1,565 @@
+/*=========================================================================*/
+/* COLORBAR.C - 03/03/96 */
+/* Color Bar implementation. */
+/*=========================================================================*/
+
+/*- Constantes: -----------------------------------------------------------*/
+#define NUMCOLORS 16
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+#include <iupkey.h>
+
+/*- Declaraccoes e Prototypes: --------------------------------------------*/
+#include "cdtest.h"
+
+#undef isdigit
+#include <ctype.h>
+
+
+/*- Globais: --------------------------------------------------------------*/
+static struct {
+ cdCanvas *bar_canvas; /* canvas da colorbar */
+ cdCanvas *other_canvas; /* canvas ativo anteriormente */
+ int w, h; /* dimensoes do canvas */
+ int bgr, bgg, bgb; /* cor de fundo do dialogo pai */
+ int bci, fci; /* indice das cores correntes */
+ long *p_foreground, *p_background; /* variaveis do usuario */
+ long colors[NUMCOLORS]; /* palheta interna */
+ int bounds[2*(NUMCOLORS+1)]; /* fronteiras dos elementos da palheta */
+} colorbar; /* contexto da colorbar */
+
+/*- Dialogo para mudancca da cor da palheta: ------------------------------*/
+static struct {
+ Ihandle *dialog;
+ Ihandle *red;
+ Ihandle *green;
+ Ihandle *blue;
+ Ihandle *alpha;
+ Ihandle *bt_ok;
+ Ihandle *bt_cancel;
+ int to_change;
+} color_change;
+
+/*- Macros: ---------------------------------------------------------------*/
+#define ignore(_) (void)(_)
+
+/*-------------------------------------------------------------------------*/
+/* Filtra inteiros. */
+/*-------------------------------------------------------------------------*/
+static int integer(Ihandle *self, int c)
+{
+ ignore(self);
+
+ if (isdigit(c)) {
+ return IUP_DEFAULT;
+ }
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB)) {
+ return IUP_DEFAULT;
+ }
+ else {
+ return IUP_IGNORE;
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Retorna a cor de indice i. */
+/*-------------------------------------------------------------------------*/
+static long getcolor(int i)
+{
+ if (i<=NUMCOLORS) {
+ return colorbar.colors[i-1];
+ }
+ else return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo Color Change. */
+/*-------------------------------------------------------------------------*/
+static void color_change_show(int c)
+{
+ unsigned char r, g, b, a;
+ long color;
+ char s[4];
+
+ /* mostra o dialogo Color Change */
+ IupShow(color_change.dialog);
+
+ /* mostra a cor atual */
+ color = getcolor(c);
+ cdDecodeColor(color, &r, &g, &b);
+ sprintf(s, "%d", r);
+ IupSetAttribute(color_change.red, IUP_VALUE, s);
+ sprintf(s, "%d", g);
+ IupSetAttribute(color_change.green, IUP_VALUE, s);
+ sprintf(s, "%d", b);
+ IupSetAttribute(color_change.blue, IUP_VALUE, s);
+
+ a = cdDecodeAlpha(color);
+ sprintf(s, "%d", a);
+ IupSetAttribute(color_change.alpha, IUP_VALUE, s);
+
+ /* salva cor a ser alterada no contexto */
+ color_change.to_change = c;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Cancela a operaccao de mudancca de cor. */
+/*-------------------------------------------------------------------------*/
+static int color_change_cancel(void)
+{
+ IupHide(color_change.dialog);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Determina as fronteiras dos elementos da palheta. */
+/*-------------------------------------------------------------------------*/
+static void bounds(int dx, int p, int *x)
+{
+ int i; /* contador dos intervalos */
+ int j; /* indice do vetor x */
+ int k; /* inicio do intervalo */
+ int e; /* erro da aproximacao inteira */
+ int _2p; /* dobro do numero de intervalos */
+ int q; /* quociente da divisao inteira */
+ int _2r; /* dobro do resto da divisao inteira */
+
+ /* inicializa as variaveis */
+ k = 0; /* inicio do primeiro intervalo */
+ j = 0; /* indice do vetor x */
+ e = 0; /* inicializa o erro */
+ _2p = p << 1; /* dobro do numero de intervalos */
+ _2r = (dx % p) << 1; /* dobro do resto da divisao inteira */
+ q = dx / p; /* quociente da divisao inteira */
+
+ /* gera o vetor de intervalos */
+ for (i=0; i<p; i++) { /* para p intervalos */
+ e += _2r; /* incrementa o erro */
+ x[j++] = k; /* inicio do intervalo */
+ if (e >= p) { /* estourou? */
+ e -= _2p; /* ajusta o novo limite */
+ k += q + 1; /* arredonda para cima */
+ }
+ else {
+ k += q; /* arredonda para baixo */
+ }
+ x[j++] = k - 2; /* fim do intervalo */
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Acha a cor onde o mouse foi clicado por busca binaria. Retorna zero se */
+/* o click foi fora de qualquer cor. */
+/*-------------------------------------------------------------------------*/
+static int findwhere(int x, int y, int c1, int c2)
+{
+ int mid;
+
+ /* so pode ser este ou o click foi fora */
+ if (c1 == c2) {
+ if ((x > colorbar.bounds[c1<<1]) && (x < colorbar.bounds[(c1<<1) + 1])) {
+ if ((y > 0) && (y < (colorbar.h-1))) return c1;
+ else return 0;
+ }
+ else return 0;
+ }
+
+ /* elemento intermediario */
+ mid = (c1 + c2)>>1;
+
+ /* se o click estah a direita do elemento intermediario */
+ if (x > colorbar.bounds[(mid<<1) + 1]) return findwhere(x, y, mid+1, c2);
+
+ /* se estah a esquerda do elemento intermediario */
+ else if (x < colorbar.bounds[mid<<1]) return findwhere(x, y, c1, mid-1);
+
+ /* estah no meio do intermediario e a vertical estah legal, eh esse */
+ else if ((y > 0) && (y < (colorbar.h-1))) return mid;
+
+ /* o programa nunca chega aqui, mas o compilador fica feliz */
+ return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a moldura do elemento da palheta. */
+/*-------------------------------------------------------------------------*/
+static void hollowbox(int xmin, int xmax, int ymin, int ymax)
+{
+ cdForeground(cdEncodeColor(255, 255, 255));
+ cdLine(xmin, ymin, xmax, ymin);
+ cdLine(xmax, ymin+1, xmax, ymax);
+
+ cdForeground(cdEncodeColor(102, 102, 102));
+ cdLine(xmin, ymin+1, xmin, ymax);
+ cdLine(xmin+1, ymax, xmax-1, ymax);
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Muda a cor de indice i e retorna a anterior. */
+/*-------------------------------------------------------------------------*/
+static long changecolor(int i, long color)
+{
+ long temp;
+
+ if (i<=NUMCOLORS) {
+ temp = colorbar.colors[i-1];
+ colorbar.colors[i-1] = color;
+ return temp;
+ }
+ else return 0;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o vetor de cores. */
+/*-------------------------------------------------------------------------*/
+static void resetcolors(void)
+{
+ colorbar.colors[ 0] = cdEncodeColor( 0, 0, 0);
+ colorbar.colors[ 1] = cdEncodeColor(153, 153, 153);
+ colorbar.colors[ 2] = cdEncodeColor(178, 178, 178);
+ colorbar.colors[ 3] = cdEncodeColor(255, 255, 255);
+ colorbar.colors[ 4] = cdEncodeColor(255, 255, 0);
+ colorbar.colors[ 5] = cdEncodeColor(255, 0, 0);
+ colorbar.colors[ 6] = cdEncodeColor(255, 0, 255);
+ colorbar.colors[ 7] = cdEncodeColor( 0, 255, 255);
+ colorbar.colors[ 8] = cdEncodeColor( 0, 0, 255);
+ colorbar.colors[ 9] = cdEncodeColor( 0, 255, 0);
+ colorbar.colors[10] = cdEncodeColor(128, 128, 0);
+ colorbar.colors[11] = cdEncodeColor(128, 0, 0);
+ colorbar.colors[12] = cdEncodeColor(128, 0, 128);
+ colorbar.colors[13] = cdEncodeColor( 0, 128, 128);
+ colorbar.colors[14] = cdEncodeColor( 0, 0, 128);
+ colorbar.colors[15] = cdEncodeColor( 0, 128, 0);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a ColorBar. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarRepaint(void)
+{
+ int i;
+ double dt;
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 1;
+ }
+ cdClear();
+
+ /* desenha as cores da palheta */
+ for (i=2; i<=2*NUMCOLORS; i+=2) {
+ cdForeground(getcolor(i>>1));
+ cdBox(colorbar.bounds[i], colorbar.bounds[i+1], 1, colorbar.h-1);
+ hollowbox(colorbar.bounds[i], colorbar.bounds[i+1], 1, colorbar.h-1);
+ }
+
+ /* desenha o fedback */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ /* desenha a cor de fundo */
+ cdForeground(getcolor(colorbar.bci));
+ cdBox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ hollowbox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ /* desenha a cor de frente */
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+
+ /* restaura o canvas anteriormente ativo */
+ cdActivate(colorbar.other_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao botao do mouse. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarButtonCB(Ihandle *self, int b, int e, int x, int y, char *r)
+{
+ int c;
+
+ ignore(self);
+ ignore(r);
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 1;
+ }
+
+ /* converte para coordenadas do canvas */
+ cdUpdateYAxis(&y);
+
+ /* se o botao foi pressionado */
+ if (e) {
+
+ /* acha onde foi o click */
+ c = findwhere(x, y, 1, 16);
+
+ /* se o click foi dentro de alguma cor... */
+ if (c != 0) {
+
+ /* botao da esquerda eh mudancca de cor de foreground */
+ if (b == IUP_BUTTON1) {
+
+ /* se for double-click */
+ if ((isdouble(r)) && (c == colorbar.fci) ) {
+
+ /* mostra o dialogo */
+ color_change_show(c);
+ }
+
+ /* muda a cor de frente corrente */
+ else {
+
+ /* largura de cada celula */
+ double dt;
+ unsigned char r, g, b;
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_foreground) = getcolor(c);
+
+ /* altera o indice da cor de frente corrente */
+ colorbar.fci = c;
+
+ cdDecodeColor(getcolor(colorbar.fci), &r, &g, &b);
+ sprintf(ctgc.status_line, "cdForeground(cdEncodeColor(%d, %d, %d))", (int)r, (int)g, (int)b);
+ set_status();
+
+ /* altera o feedback no primeiro elemento da palheta */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ }
+
+ }
+
+ else if (b == IUP_BUTTON3) {
+
+ /* largura de cada celula */
+ double dt;
+ unsigned char r, g, b;
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_background) = getcolor(c);
+
+ /* altera o indice da cor de frente corrente */
+ colorbar.bci = c;
+
+ cdDecodeColor(getcolor(colorbar.bci), &r, &g, &b);
+ sprintf(ctgc.status_line, "cdBackground(cdEncodeColor(%d, %d, %d))", (int)r, (int)g, (int)b);
+ set_status();
+
+ /* altera o feedback no primeiro elemento da palheta */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ cdForeground(getcolor(colorbar.bci));
+ cdBox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ hollowbox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ }
+
+ }
+
+ }
+
+ /* restaura o canvas anteriormente ativo */
+ cdActivate(colorbar.other_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Callback associado ao resize do canvas. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarResizeCB(Ihandle *self, int w, int h)
+{
+ ignore(self);
+
+ /* atualiza as dimensoes do canvas */
+ colorbar.w = w;
+ colorbar.h = h;
+
+ /* atualiza as fronteiras dos elementos da palheta */
+ bounds(colorbar.w, NUMCOLORS+1, colorbar.bounds);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Confirma a mudanca de cores. */
+/*-------------------------------------------------------------------------*/
+static int color_change_ok(void)
+{
+ int r, g, b, a;
+ long new_color;
+
+ /* pega os novos valores */
+ r = IupGetInt(color_change.red, IUP_VALUE);
+ g = IupGetInt(color_change.green, IUP_VALUE);
+ b = IupGetInt(color_change.blue, IUP_VALUE);
+ a = IupGetInt(color_change.alpha, IUP_VALUE);
+
+ /* se todos forem validos */
+ if ((r<256)&&(g<256)&&(b<256)) {
+
+ /* esconde a caixa de dialogo */
+ IupHide(color_change.dialog);
+
+ /* atualiza a cor no contexto */
+ new_color = cdEncodeColor((unsigned char)r, (unsigned char) g, (unsigned char) b);
+ new_color = cdEncodeAlpha(new_color, (unsigned char)a);
+ changecolor(color_change.to_change, new_color);
+
+ colorbar.fci = color_change.to_change;
+
+ /* redesenha a colorbar */
+ fColorBarRepaint();
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_foreground) = new_color;
+
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa a ColorBar. */
+/*-------------------------------------------------------------------------*/
+void ColorBarClose(void)
+{
+ cdKillCanvas(colorbar.bar_canvas);
+ IupDestroy(color_change.dialog);
+}
+
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long *foreground, long *background)
+{
+ char *bg_color;
+
+ /* pega a cor de fundo do dialogo parente */
+ bg_color = IupGetAttribute(parent, "BGCOLOR");
+ if (bg_color == NULL) {
+ printf("Color Bar Error: Unable to get bg_color.");
+ return 0;
+ }
+ sscanf(bg_color, "%d %d %d", &colorbar.bgr, &colorbar.bgg, &colorbar.bgb);
+
+ /* inicializa as cores de fundo e de frente defaults */
+ colorbar.fci = 1;
+ colorbar.bci = 4;
+
+ /* pega o enderecco das variaveis do usuario */
+ colorbar.p_foreground = foreground;
+ colorbar.p_background = background;
+
+ /* inicializa a palheta interna de cores */
+ resetcolors();
+
+ /* cria o canvas do CD */
+ colorbar.bar_canvas = cdCreateCanvas(CD_IUP, canvas);
+ if (colorbar.bar_canvas == NULL) {
+ printf("Color Bar Error: Unable to create canvas.");
+ return 0;
+ }
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 0;
+ }
+
+ /* pega as dimensoes do canvas pela primeira vez */
+ cdGetCanvasSize(&colorbar.w, &colorbar.h, NULL, NULL);
+
+ /* restaura o canvas anteriormente ativo */
+ if (colorbar.other_canvas != NULL) cdActivate(colorbar.other_canvas);
+
+ /* cria o vetor com as fronteiras dos elementos da palheta */
+ bounds(colorbar.w, NUMCOLORS+1, colorbar.bounds);
+
+ /* associa os callbacks */
+ IupSetFunction("cmdColorBarButtonCB", (Icallback) fColorBarButtonCB);
+ IupSetFunction("cmdColorBarRepaint", (Icallback) fColorBarRepaint);
+ IupSetFunction("cmdColorBarResizeCB", (Icallback) fColorBarResizeCB);
+
+ /* desenha a barra de cores pela primeira vez */
+ fColorBarRepaint();
+
+ /* inicializa o dialogo de troca de cores da palheta */
+ color_change.dialog = IupDialog(
+ IupVbox(
+ IupHbox(
+ IupLabel("R:"),
+ color_change.red = IupText("cmdInteger"),
+ IupLabel("G:"),
+ color_change.green = IupText("cmdInteger"),
+ IupLabel("B:"),
+ color_change.blue = IupText("cmdInteger"),
+ IupLabel("A:"),
+ color_change.alpha = IupText("cmdInteger"),
+ NULL
+ ),
+ IupHbox(
+ IupFill(),
+ color_change.bt_ok = IupButton("OK", "cmdColorChangeOK"),
+ color_change.bt_cancel = IupButton("Cancel", "cmdColorChangeCancel"),
+ IupFill(),
+ NULL
+ ),
+ NULL
+ )
+ );
+
+ /* atributos do dialogo */
+ IupSetAttribute(color_change.dialog, IUP_TITLE, "Color Change:");
+ IupSetAttribute(color_change.dialog, IUP_MARGIN, "5x5");
+ IupSetAttribute(color_change.dialog, IUP_GAP, "5");
+ IupSetAttribute(color_change.dialog, "MAXBOX", "NO");
+ IupSetAttribute(color_change.dialog, "MINBOX", "NO");
+ IupSetAttribute(color_change.dialog, "PARENTDIALOG", "dlgMain");
+
+ /* atributos dos texts */
+ IupSetFunction("cmdInteger", (Icallback) integer);
+ IupSetAttribute(color_change.red, "NC", "3");
+ IupSetAttribute(color_change.green, "NC", "3");
+ IupSetAttribute(color_change.blue, "NC", "3");
+ IupSetAttribute(color_change.alpha, "NC", "3");
+ IupSetAttribute(color_change.red, "SIZE", "24");
+ IupSetAttribute(color_change.green, "SIZE", "24");
+ IupSetAttribute(color_change.blue, "SIZE", "24");
+ IupSetAttribute(color_change.alpha, "SIZE", "24");
+
+ /* atributos dos botoes */
+ IupSetAttribute(color_change.bt_ok, IUP_SIZE, "30");
+ IupSetAttribute(color_change.bt_cancel, IUP_SIZE, "30");
+ IupSetFunction("cmdColorChangeCancel", (Icallback) color_change_cancel);
+ IupSetFunction("cmdColorChangeOK", (Icallback) color_change_ok);
+
+ return 1;
+}
diff --git a/test/cdtest/config.mak b/test/cdtest/config.mak
new file mode 100644
index 0000000..9453944
--- /dev/null
+++ b/test/cdtest/config.mak
@@ -0,0 +1,24 @@
+APPNAME = cdtest
+
+SRC = cdtest.c cdtest_led.c colorbar.c drivers.c list.c rubber.c
+
+ifeq "$(TEC_SYSNAME)" "Win32"
+ SRC += cdtest.rc
+endif
+
+USE_CD=Yes
+USE_IUP=Yes
+
+cdtest_led.c: cdtest.led
+ ledc -f cdtest_loadled -o cdtest_led.c cdtest.led
+
+USE_STATIC = Yes
+
+#IUP = ../../../iup
+CD = ../..
+
+ifneq ($(findstring Win, $(TEC_SYSNAME)), )
+ LIBS = cdpdflib
+else
+ SLIB = $(CD)/lib/$(TEC_UNAME)/libcdpdflib.a
+endif
diff --git a/test/cdtest/drivers.c b/test/cdtest/drivers.c
new file mode 100644
index 0000000..93918d5
--- /dev/null
+++ b/test/cdtest/drivers.c
@@ -0,0 +1,457 @@
+/*=========================================================================*/
+/* DRIVERS.C - 10/02/95 */
+/* Suporte para os drivers do CD. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas: --------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CDTest: -----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CDTest (declarado em CDTEST.C): ---------------------------*/
+extern tCTC ctgc;
+
+#ifdef CDTEST_WIN32
+#define CLIPBOARD_WIN32
+#define WMF
+#define PRINTER
+#endif
+
+#define CLIPBOARD
+#define CGM
+#define MF
+#define PS
+#define DXF
+#define DGN
+#define PDF
+
+static int LoadCanvas(char* ctx_name, cdContext* ctx, char *filename)
+{
+ if (IupGetFile(filename) == 0)
+ {
+ newmetafile(filename, ctx);
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.stretch_play)
+ {
+ cdPlay(ctx, 0, ctgc.w-1, 0, ctgc.h-1, filename);
+ sprintf(ctgc.status_line, "cdPlay(%s, 0, %d, 0, %d, %s)", ctx_name, ctgc.w-1, ctgc.h-1, filename);
+ }
+ else
+ {
+ cdPlay(ctx, 0, 0, 0, 0, filename);
+ sprintf(ctgc.status_line, "cdPlay(%s, 0, 0, 0, 0, %s)", ctx_name, filename);
+ }
+ set_status();
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int SaveCanvas(char* ctx_name, cdContext* ctx, char *data)
+{
+ cdCanvas *canvas;
+
+ canvas = cdCreateCanvas(ctx, data);
+ if (!canvas)
+ {
+ IupMessage("Error!", "Can not create canvas.");
+ return IUP_DEFAULT;
+ }
+
+ cdActivate(canvas);
+
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+
+ putlist(canvas);
+
+ cdKillCanvas(canvas);
+
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para o clipboard do Windows, vetorial. */
+/*-------------------------------------------------------------------------*/
+#ifdef CLIPBOARD
+#include <cdclipbd.h>
+
+static int fClipBoard(void)
+{
+ char data[1000];
+ sprintf(data, "%dx%d %g", ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para o clipboard do Windows, BitMap. */
+/*-------------------------------------------------------------------------*/
+static int fClipBoardBitmap(void)
+{
+ char data[1000];
+ sprintf(data, "%dx%d %g -b", ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+static int fClipBoardMetafile(void)
+{
+ char data[1000];
+#ifdef WIN32
+ sprintf(data, "%gx%g %g -m", ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+#else
+ sprintf(data, "%p %gx%g %g", IupGetAttribute(IupGetHandle("cnvMain"), "XDISPLAY"), ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+#endif
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+static int fClipBoardPaste(void)
+{
+ char* data;
+ newmetafile("", CD_CLIPBOARD);
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+
+#ifdef WIN32
+ data = "";
+#else
+ data = IupGetAttribute(IupGetHandle("cnvMain"), "XDISPLAY");
+#endif
+
+ if (ctgc.stretch_play)
+ {
+ cdPlay(CD_CLIPBOARD, 0, ctgc.w-1, 0, ctgc.h-1, data);
+ sprintf(ctgc.status_line, "cdPlay(CD_CLIPBOARD, 0, %d, 0, %d, \"\")", ctgc.w-1, ctgc.h-1);
+ }
+ else
+ {
+ cdPlay(CD_CLIPBOARD, 0, 0, 0, 0, data);
+ sprintf(ctgc.status_line, "cdPlay(CD_CLIPBOARD, 0, 0, 0, 0, \"\")");
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo PostScript. */
+/*-------------------------------------------------------------------------*/
+#ifdef PS
+#include <cdps.h>
+
+static int fPS(void)
+{
+ char filename[1024]="*.ps";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PS", CD_PS, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fEPS(void)
+{
+ char filename[1024]="*.eps";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d -e -l0 -r0 -t0 -b0", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PS", CD_PS, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+#ifdef PDF
+#include <cdpdf.h>
+
+static int fPDF(void)
+{
+ char filename[1024]="*.pdf";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PDF", CD_PDF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo CGM. */
+/*-------------------------------------------------------------------------*/
+#ifdef CGM
+#include <cdcgm.h>
+
+static int fCGMb(void)
+{
+ char filename[1024]="*.cgm";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_CGM", CD_CGM, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fCGMt(void)
+{
+ char filename[1024]="*.cgm";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g -t", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_CGM", CD_CGM, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayCGM(void)
+{
+ char filename[1024]="*.cgm";
+ return LoadCanvas("CD_CGM", CD_CGM, filename);
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo DXF. */
+/*-------------------------------------------------------------------------*/
+#ifdef DXF
+#include <cddxf.h>
+
+static int fDXF(void)
+{
+ char filename[1024]="*.dxf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_DXF", CD_DXF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo DGN. */
+/*-------------------------------------------------------------------------*/
+#ifdef DGN
+#include <cddgn.h>
+
+static int fDGN(void)
+{
+ char filename[1024]="*.dgn";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g -sseed2d.dgn", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_DGN", CD_DGN, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+#ifdef MF
+#include <cdmf.h>
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo metafile do CD. */
+/*-------------------------------------------------------------------------*/
+static int fMF(void)
+{
+ char filename[1024]="*.mf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_METAFILE", CD_METAFILE, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo metafile do CD. */
+/*-------------------------------------------------------------------------*/
+static int fPlayMF(void)
+{
+ char filename[1024]="*.mf";
+ return LoadCanvas("CD_METAFILE", CD_METAFILE, filename);
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo WMF. */
+/*-------------------------------------------------------------------------*/
+#ifdef WMF
+#include <cdwmf.h>
+
+static int fWMF(void)
+{
+ char filename[1024]="*.wmf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %dx%d %g", filename, ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_WMF", CD_WMF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayWMF(void)
+{
+ char filename[1024]="*.wmf";
+ return LoadCanvas("CD_WMF", CD_WMF, filename);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo EMF. */
+/*-------------------------------------------------------------------------*/
+#include <cdemf.h>
+
+static int fEMF(void)
+{
+ char filename[1024]="*.emf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %dx%d %g", filename, ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_EMF", CD_EMF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayEMF(void)
+{
+ char filename[1024]="*.emf";
+ return LoadCanvas("CD_EMF", CD_EMF, filename);
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para a impressora. */
+/*-------------------------------------------------------------------------*/
+#ifdef PRINTER
+#include <cdprint.h>
+
+static int fPrint(void)
+{
+ char *data = "CDTEST.PRN -d";
+ return SaveCanvas("CD_PRINTER", CD_PRINTER, data);
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa os menus de Save e Open. */
+/*-------------------------------------------------------------------------*/
+void DriversInit(void)
+{
+#ifdef MF
+ IupSetFunction("cmdMF", (Icallback) fMF);
+ IupSetFunction("cmdPlayMF", (Icallback) fPlayMF);
+#endif
+#ifdef PS
+ IupSetAttribute(IupGetHandle("itPS"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itEPS"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPS", (Icallback) fPS);
+ IupSetFunction("cmdEPS", (Icallback) fEPS);
+#endif
+#ifdef PDF
+ IupSetAttribute(IupGetHandle("itPDF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPDF", (Icallback) fPDF);
+#endif
+#ifdef CLIPBOARD
+ IupSetAttribute(IupGetHandle("itClipBoardMetafile"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itClipBoardPaste"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdClipBoardMetafile", (Icallback)fClipBoardMetafile);
+ IupSetFunction("cmdClipBoardPaste", (Icallback)fClipBoardPaste);
+#endif
+#ifdef CLIPBOARD_WIN32
+ IupSetAttribute(IupGetHandle("itClipBoardBitmap"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itClipBoard"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdClipBoardBitmap", (Icallback)fClipBoardBitmap);
+ IupSetFunction("cmdClipBoard", (Icallback)fClipBoard);
+#endif
+#ifdef DXF
+ IupSetAttribute(IupGetHandle("itDXF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdDXF", (Icallback) fDXF);
+#endif
+#ifdef DGN
+ IupSetAttribute(IupGetHandle("itDGN"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdDGN", (Icallback) fDGN);
+#endif
+#ifdef CGM
+ IupSetAttribute(IupGetHandle("itCGMb"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdCGMb", (Icallback) fCGMb);
+ IupSetAttribute(IupGetHandle("itCGMt"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdCGMt", (Icallback) fCGMt);
+ IupSetAttribute(IupGetHandle("itPlayCGM"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPlayCGM", (Icallback) fPlayCGM);
+#endif
+#ifdef WMF
+ IupSetAttribute(IupGetHandle("itEMF"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itWMF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdEMF", (Icallback) fEMF);
+ IupSetFunction("cmdWMF", (Icallback) fWMF);
+ IupSetAttribute(IupGetHandle("itPlayEMF"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itPlayWMF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPlayEMF", (Icallback) fPlayEMF);
+ IupSetFunction("cmdPlayWMF", (Icallback) fPlayWMF);
+#endif
+#ifdef PRINTER
+ IupSetAttribute(IupGetHandle("itPrint"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPrint", (Icallback) fPrint);
+#endif
+}
diff --git a/test/cdtest/list.c b/test/cdtest/list.c
new file mode 100644
index 0000000..a41c5bc
--- /dev/null
+++ b/test/cdtest/list.c
@@ -0,0 +1,278 @@
+/*=========================================================================*/
+/* LIST.C 10/12/95 */
+/* Funcoes para a manipulacao da lista de primitivas. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CD Test: ----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CD Test (declarado em CDTEST.C): --------------------------*/
+extern tCTC ctgc;
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um ponto ao poligono temporario corrente. */
+/*-------------------------------------------------------------------------*/
+int newpolypoint(int x, int y)
+{
+ if (ctgc.num_points <= MAXPOINTS) {
+ ctgc.points[ctgc.num_points].x = x;
+ ctgc.points[ctgc.num_points].y = y;
+ ctgc.num_points++;
+ return TRUE;
+ }
+ else return FALSE;
+}
+
+tList* newNode(void)
+{
+ tList *newnode = (tList *) malloc(sizeof (tList));
+ newnode->next = NULL;
+
+ if (ctgc.head != NULL)
+ {
+ tList *temp;
+ for(temp = ctgc.head; temp->next; temp = (tList *)temp->next);
+ temp->next = newnode; /* coloca o novo item no final da lista */
+ }
+ else
+ ctgc.head = newnode;
+
+ return newnode;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona uma linha/rect/caixa a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+
+static int newtLB(int x1, int y1, int x2, int y2, int type)
+{
+ tList* newnode = newNode();
+
+ newnode->type = type;
+ newnode->par.lineboxpar.x1 = x1;
+ newnode->par.lineboxpar.x2 = x2;
+ newnode->par.lineboxpar.y1 = y1;
+ newnode->par.lineboxpar.y2 = y2;
+ newnode->par.lineboxpar.foreground = ctgc.foreground;
+ newnode->par.lineboxpar.background = ctgc.background;
+ newnode->par.lineboxpar.line_style = ctgc.line_style;
+ newnode->par.lineboxpar.line_width = ctgc.line_width;
+ newnode->par.lineboxpar.write_mode = ctgc.write_mode;
+ newnode->par.lineboxpar.line_cap = ctgc.line_cap;
+ newnode->par.lineboxpar.line_join = ctgc.line_join;
+ newnode->par.lineboxpar.interior_style = ctgc.interior_style;
+ newnode->par.lineboxpar.back_opacity = ctgc.back_opacity;
+ newnode->par.lineboxpar.hatch = ctgc.hatch;
+
+ return TRUE;
+}
+
+int newline(int x1, int y1, int x2, int y2)
+{
+ return newtLB(x1, y1, x2, y2, LINE);
+}
+
+int newrect(int x1, int x2, int y1, int y2)
+{
+ return newtLB(x1, y1, x2, y2, RECT);
+}
+
+int newbox(int x1, int x2, int y1, int y2)
+{
+ return newtLB(x1, y1, x2, y2, BOX);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um arc/sector/chord a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+static int newtAS(int xc, int yc, int w, int h, double angle1, double angle2, int type)
+{
+ tList* newnode = newNode();
+
+ newnode->type = type;
+ newnode->par.arcsectorpar.xc = xc;
+ newnode->par.arcsectorpar.yc = yc;
+ newnode->par.arcsectorpar.w = w;
+ newnode->par.arcsectorpar.h = h;
+ newnode->par.arcsectorpar.angle1 = angle1;
+ newnode->par.arcsectorpar.angle2 = angle2;
+ newnode->par.arcsectorpar.foreground = ctgc.foreground;
+ newnode->par.arcsectorpar.background = ctgc.background;
+ newnode->par.arcsectorpar.line_style = ctgc.line_style;
+ newnode->par.arcsectorpar.line_width = ctgc.line_width;
+ newnode->par.arcsectorpar.line_cap = ctgc.line_cap;
+ newnode->par.arcsectorpar.line_join = ctgc.line_join;
+ newnode->par.arcsectorpar.write_mode = ctgc.write_mode;
+ newnode->par.arcsectorpar.interior_style = ctgc.interior_style;
+ newnode->par.arcsectorpar.back_opacity = ctgc.back_opacity;
+ newnode->par.arcsectorpar.hatch = ctgc.hatch;
+
+ return TRUE;
+}
+
+int newarc(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, ARC);
+}
+
+int newsector(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, SECTOR);
+}
+
+int newchord(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, CHORD);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um pixel a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newpixel(int x, int y)
+{
+ tList* newnode = newNode();
+
+ newnode->type = PIXEL;
+ newnode->par.pixelpar.x = x;
+ newnode->par.pixelpar.y = y;
+ newnode->par.pixelpar.foreground = ctgc.foreground;
+ newnode->par.pixelpar.write_mode = ctgc.write_mode;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um metafile a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newmetafile(char *filename, cdContext* ctx)
+{
+ tList* newnode = newNode();
+
+ newnode->type = META;
+ newnode->par.metapar.filename = (char *) malloc(strlen(filename) + 1);
+ newnode->par.metapar.ctx = ctx;
+ strcpy(newnode->par.metapar.filename, filename);
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona uma marca a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newmark(int x, int y, int mark_size)
+{
+ tList* newnode = newNode();
+
+ newnode->type = MARK;
+ newnode->par.markpar.x = x;
+ newnode->par.markpar.y = y;
+ newnode->par.markpar.mark_size = mark_size;
+ newnode->par.markpar.foreground = ctgc.foreground;
+ newnode->par.markpar.write_mode = ctgc.write_mode;
+ newnode->par.markpar.mark_type = ctgc.mark_type;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um texto a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newtext(int x, int y, char *s)
+{
+ tList* newnode = newNode();
+
+ newnode->type = TEXT;
+ newnode->par.textpar.x = x;
+ newnode->par.textpar.y = y;
+ newnode->par.textpar.foreground = ctgc.foreground;
+ newnode->par.textpar.background = ctgc.background;
+ newnode->par.textpar.font_style = ctgc.font_style;
+ newnode->par.textpar.font_typeface = ctgc.font_typeface;
+ newnode->par.textpar.font_size = ctgc.font_size;
+ newnode->par.textpar.write_mode = ctgc.write_mode;
+ newnode->par.textpar.back_opacity = ctgc.back_opacity;
+ newnode->par.textpar.text_alignment = ctgc.text_alignment;
+ newnode->par.textpar.text_orientation = ctgc.text_orientation;
+ newnode->par.textpar.s = (char *) malloc(strlen(s) + 1);
+ strcpy(newnode->par.textpar.s, s);
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um poligono a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newpoly(void)
+{
+ tList* newnode = newNode();
+
+ newnode->type = POLY;
+ newnode->par.polypar.foreground = ctgc.foreground;
+ newnode->par.polypar.background = ctgc.background;
+ newnode->par.polypar.line_style = ctgc.line_style;
+ newnode->par.polypar.line_width = ctgc.line_width;
+ newnode->par.polypar.write_mode = ctgc.write_mode;
+ newnode->par.polypar.fill_mode = ctgc.fill_mode;
+ newnode->par.polypar.line_cap = ctgc.line_cap;
+ newnode->par.polypar.line_join = ctgc.line_join;
+ newnode->par.polypar.poly_mode = ctgc.poly_mode;
+ newnode->par.polypar.interior_style = ctgc.interior_style;
+ newnode->par.polypar.back_opacity = ctgc.back_opacity;
+ newnode->par.polypar.hatch = ctgc.hatch;
+ newnode->par.polypar.points = (tPoint *) malloc(ctgc.num_points*sizeof(tPoint));
+ newnode->par.polypar.num_points = ctgc.num_points;
+ memcpy(newnode->par.polypar.points, ctgc.points, ctgc.num_points*sizeof(tPoint));
+ newnode->next = NULL;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+void dellist(void)
+{
+ tList *killer, *back;
+
+ for (killer = ctgc.head; killer; killer = back) {
+ back = (tList *) (killer->next);
+ if (killer->type == TEXT) { /* se for TEXT... */
+ free(killer->par.textpar.s); /* ...mata a string */
+ }
+ if (killer->type == POLY) { /* se for POLY... */
+ free(killer->par.polypar.points); /* ...mata os pontos */
+ }
+ free(killer);
+ }
+ ctgc.head = NULL;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a ultima primitiva. */
+/*-------------------------------------------------------------------------*/
+void dellast(void)
+{
+ tList *killer;
+
+ if (ctgc.head == NULL ) return;
+ else if (ctgc.head->next == NULL) {
+ free(ctgc.head);
+ ctgc.head = NULL;
+ }
+ else {
+ for (killer = ctgc.head; killer->next->next; killer = killer->next);
+ free(killer->next);
+ killer->next = NULL;
+ }
+}
diff --git a/test/cdtest/rubber.c b/test/cdtest/rubber.c
new file mode 100644
index 0000000..80a5921
--- /dev/null
+++ b/test/cdtest/rubber.c
@@ -0,0 +1,387 @@
+/*=========================================================================*/
+/* RUBBER.C - 10/12/95 */
+/* Funcoes para o desenho interativo das primitivas. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CD Test: ----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CD Test (declarado em CDTEST.C): --------------------------*/
+extern tCTC ctgc;
+
+/*- Parametros para o desenho das primitivas: -----------------------------*/
+extern tLinePos line_pos;
+extern tBoxPos box_pos;
+extern tPixelPos pixel_pos;
+extern tMarkPos mark_pos;
+extern tArcPos arc_pos;
+
+/*-------------------------------------------------------------------------*/
+/* Segue as coordenadas do mouse atualizando o TXT apropriado. */
+/*-------------------------------------------------------------------------*/
+void follow(int x, int y)
+{
+ static char mx[10], my[10];
+ static char nx[10], ny[10];
+
+ sprintf(nx, "%d", x);
+ sprintf(ny, "%d", y);
+
+ switch(ctgc.cur_prim) {
+ case PIXEL:
+ /* atualiza os parametros do pixel */
+ pixel_pos.x = x;
+ pixel_pos.y = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtPixelX"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtPixelY"), IUP_VALUE, my);
+ break;
+ case MARK:
+ /* atualiza os parametros da mark */
+ mark_pos.x = x;
+ mark_pos.y = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtMarkX"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtMarkY"), IUP_VALUE, my);
+ break;
+ case RECT:
+ case BOX:
+ /* atualiza os parametros da box */
+ if (ctgc.following) {
+ if (x < box_pos.x) {
+ box_pos.xmin = x;
+ box_pos.xmax = box_pos.x;
+ }
+ else {
+ box_pos.xmax = x;
+ box_pos.xmin = box_pos.x;
+ }
+
+ if (y < box_pos.y) {
+ box_pos.ymin = y;
+ box_pos.ymax = box_pos.y;
+ }
+ else {
+ box_pos.ymax = y;
+ box_pos.ymin = box_pos.y;
+ }
+ }
+ else {
+ box_pos.xmax = box_pos.xmin = x;
+ box_pos.ymax = box_pos.ymin = y;
+ }
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", box_pos.xmin);
+ sprintf(nx, "%d", box_pos.xmax);
+ sprintf(my, "%d", box_pos.ymin);
+ sprintf(ny, "%d", box_pos.ymax);
+ IupSetAttribute(IupGetHandle("txtLBX1"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtLBY1"), IUP_VALUE, my);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, ny);
+ break;
+ case LINE:
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ line_pos.x2 = x;
+ line_pos.y2 = y;
+ if (ctgc.following) {
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, my);
+ }
+ else {
+ line_pos.x1 = x;
+ line_pos.y1 = y;
+ IupSetAttribute(IupGetHandle("txtLBX1"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBY1"), IUP_VALUE, my);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, my);
+ }
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case CHORD:
+ case SECTOR: /* ...sao equivalentes */
+ if (ctgc.following) {
+ /* atualiza os parametros do arc */
+ arc_pos.w = 2*abs(arc_pos.xc-x+1);
+ arc_pos.h = 2*abs(arc_pos.yc-y+1);
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", arc_pos.w);
+ sprintf(my, "%d", arc_pos.h);
+ IupSetAttribute(IupGetHandle("txtASW"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtASH"), IUP_VALUE, my);
+ }
+ else {
+ /* atualiza os parametros do arc */
+ arc_pos.xc = x;
+ arc_pos.xc = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtASXC"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtASYC"), IUP_VALUE, my);
+ }
+ break;
+ case TEXT:
+ IupSetAttribute(IupGetHandle("txtTextX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtTextY"), IUP_VALUE, ny);
+ break;
+ case CLIP:
+ if (ctgc.following) {
+ if (atoi(nx) >= atoi(mx)) {
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, mx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, mx);
+ }
+ if (atoi(ny) >= atoi(my)) {
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, my);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, my);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ case IMAGE:
+ if (ctgc.following) {
+ if (atoi(mx) <= atoi(nx)) {
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageW"), IUP_VALUE, nx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageX"), IUP_VALUE, nx);
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageW"), IUP_VALUE, nx);
+ }
+ if (atoi(my) <= atoi(ny)) {
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageH"), IUP_VALUE, ny);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageY"), IUP_VALUE, ny);
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageH"), IUP_VALUE, ny);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtImageY"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ case RGB:
+ if (ctgc.following) {
+ if (atoi(mx) <= atoi(nx)) {
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageRGBW"), IUP_VALUE, nx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBX"), IUP_VALUE, nx);
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageRGBW"), IUP_VALUE, nx);
+ }
+ if (atoi(my) <= atoi(ny)) {
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageRGBH"), IUP_VALUE, ny);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBY"), IUP_VALUE, ny);
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageRGBH"), IUP_VALUE, ny);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtImageRGBY"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma linha em rubber band. */
+/*-------------------------------------------------------------------------*/
+void line(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ x1 = x2 = x; /* novo segmento comeca no... */
+ y1 = y2 = y; /* ...fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdLine(x1, y1, x2, y2); /* apaga o segmento velho */
+ }
+ cdLine(x1, y1, x, y); /* desenha o novo */
+ x2 = x; /* o novo se... */
+ y2 = y; /* ...torna velho */
+ break;
+ case REPAINT:
+ cdLine(x1, y1, x2, y2); /* recupera o segmento perdido */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ cdLine(x1, y1, x2, y2); /* apaga o ultimo segmento */
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/* Desenha uma caixa vazia (funcao nao exportada). */
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+static void frame(int x1, int y1, int x2, int y2)
+{
+ cdLine(x1, y1, x1, y2);
+ cdLine(x2, y1, x2, y2);
+ cdLine(x1, y1, x2, y1);
+ cdLine(x1, y2, x2, y2);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma caixa em rubber band. */
+/*-------------------------------------------------------------------------*/
+void box(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ x1 = x2 = x; /* novo segmento comeca no... */
+ y1 = y2 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ frame(x1, y1, x2, y2); /* apaga a caixa anterior */
+ }
+ frame(x1, y1, x, y); /* desenha a nova */
+ x2 = x; /* o novo se... */
+ y2 = y; /* torna velho */
+ break;
+ case REPAINT:
+ frame(x1, y1, x2, y2); /* restaura a caixa perdida */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ frame(x1, y1, x2, y2); /* apaga a caixa definitiva */
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma caixa centrada, em rubber band. */
+/*-------------------------------------------------------------------------*/
+void arc(tRubber what, int x, int y)
+{
+ static int xc, yc, y1, x1;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case CENTER:
+ xc = x1 = x; /* novo segmento comeca no... */
+ yc = y1 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ }
+ cdArc(xc, yc, 2*abs(xc-x+1), 2*abs(yc-y+1), 0, 360);
+ x1 = x; /* o novo se... */
+ y1 = y; /* torna velho */
+ break;
+ case REPAINT:
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha o poligono em rubber band. */
+/*-------------------------------------------------------------------------*/
+void polygon(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ if (lastwhat != CLOSE) {
+ cdLine(x1, y1, x2, y2); /* ...apaga a anterior e... */
+ cdLine(x1, y1, x, y); /* desenha a definitiva */
+ }
+ x1 = x; /* novo segmento comeca no... */
+ y1 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdLine(x1, y1, x2, y2); /* apaga o segmento velho */
+ }
+ cdLine(x1, y1, x, y); /* desenha o novo */
+ x2 = x; /* o novo se... */
+ y2 = y; /* torna velho */
+ break;
+ case REPAINT:
+ cdLine(x1, y1, x2, y2); /* recupera o segmento perdido */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ if (lastwhat != CLOSE) {
+ int i;
+ cdLine(x1, y1, x2, y2); /* apaga o ultimo segmento */
+ /* apaga o poligono temporario inteiro */
+ for (i=0; (i<ctgc.num_points-1); i++) {
+ cdLine(ctgc.points[i].x, ctgc.points[i].y,
+ ctgc.points[i+1].x, ctgc.points[i+1].y);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}