diff options
Diffstat (limited to 'test/simple')
-rw-r--r-- | test/simple/config.mak | 21 | ||||
-rw-r--r-- | test/simple/makefile.linux | 18 | ||||
-rw-r--r-- | test/simple/makefile.mingw3 | 20 | ||||
-rw-r--r-- | test/simple/simple.c | 2 | ||||
-rw-r--r-- | test/simple/simple.dsp | 83 | ||||
-rw-r--r-- | test/simple/teste.cpp | 219 |
6 files changed, 11 insertions, 352 deletions
diff --git a/test/simple/config.mak b/test/simple/config.mak index 319568a..fee0960 100644 --- a/test/simple/config.mak +++ b/test/simple/config.mak @@ -1,11 +1,10 @@ APPNAME = simple -#SRC = simple.c simple_led.c iupmain.c -SRC = teste.cpp +SRC = simple.c simple_led.c iupmain.c -#DBG = Yes +DBG = Yes USE_CD=Yes -USE_IUP=Yes +USE_IUP3=Yes simple_led.c: simple.led ledc -f simple_loadled -o simple_led.c simple.led @@ -15,11 +14,11 @@ USE_STATIC = Yes #IUP = ../../../iup #CD = ../.. -USE_IM = Yes +#USE_IM = Yes -#ifneq ($(findstring Win, $(TEC_SYSNAME)), ) -# LIBS = cdpdflib cdgdiplus gdiplus -#else -# SLIB = $(CD)/lib/$(TEC_UNAME)/libcdpdflib.a $(CD)/lib/$(TEC_UNAME)/libcdxrender.a -# LIBS = Xrender Xft -#endif +ifneq ($(findstring Win, $(TEC_SYSNAME)), ) + LIBS = cdpdf pdflib cdcontextplus gdiplus +else + SLIB = $(CD)/lib/$(TEC_UNAME)/libcdpdf.a $(CD)/lib/$(TEC_UNAME)/libpdflib.a $(CD)/lib/$(TEC_UNAME)/libcdcontextplus.a + LIBS = Xrender Xft +endif diff --git a/test/simple/makefile.linux b/test/simple/makefile.linux deleted file mode 100644 index 5d014e0..0000000 --- a/test/simple/makefile.linux +++ /dev/null @@ -1,18 +0,0 @@ -CC = gcc - -CFLAGS = -I../cd/include -I../iup/include -I/usr/X11R6/include - -LIBS = -L../cd/lib/Linux26 -L../iup/lib/Linux26 -L/usr/X11R6/lib \ - -lcdiup -lcd -liup \ - -lXm -lXpm -lXmu -lXt -lXext -lX11 - -OBJS = simple.o iupmain.o - -simple.o: simple.c simple.h - $(CC) -o $@ -c simple.c $(CFLAGS) - -iupmain.o: iupmain.c simple.h - $(CC) -o $@ -c iupmain.c $(CFLAGS) - -simple: $(OBJS) - $(CC) -o $@ $(OBJS) $(LIBS) diff --git a/test/simple/makefile.mingw3 b/test/simple/makefile.mingw3 deleted file mode 100644 index cf735e8..0000000 --- a/test/simple/makefile.mingw3 +++ /dev/null @@ -1,20 +0,0 @@ -CC = gcc - -CFLAGS = -I../cd/include -I../iup/include - -LIBS = -L../cd/lib/mingw3 -L../iup/lib/mingw3 \ - -lcdiup -lcd -liup \ - -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -lcomctl32 - -OBJS = simple.o iupmain.o - -all: simple.exe - -simple.o: simple.c simple.h - $(CC) -o $@ -c simple.c $(CFLAGS) - -iupmain.o: iupmain.c simple.h - $(CC) -o $@ -c iupmain.c $(CFLAGS) - -simple.exe: $(OBJS) - $(CC) -o $@ $(OBJS) $(LIBS) diff --git a/test/simple/simple.c b/test/simple/simple.c index c75398b..bc0e59b 100644 --- a/test/simple/simple.c +++ b/test/simple/simple.c @@ -303,7 +303,7 @@ int SimpleDrawPS(void) int SimpleDrawPDF(void) { -// DrawCanvasDriver(CD_PDF, "simple.pdf"); + DrawCanvasDriver(CD_PDF, "simple.pdf"); return 0; } diff --git a/test/simple/simple.dsp b/test/simple/simple.dsp deleted file mode 100644 index c69b8df..0000000 --- a/test/simple/simple.dsp +++ /dev/null @@ -1,83 +0,0 @@ -# Microsoft Developer Studio Project File - Name="simple" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=simple - 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 "simple.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 "simple.mak" CFG="simple - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "simple - 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)" == "simple - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "..\bin" -# PROP BASE Intermediate_Dir "..\obj\simple" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\bin" -# PROP Intermediate_Dir "..\obj\simple" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W4 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "__CD__" /D "simple" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp".\..\obj\simple/simple.pch" /Fo".\..\obj\simple/" /Fd".\..\obj\simple/" /GZ /c /GX -# ADD CPP /nologo /MT /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W4 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "__CD__" /D "simple" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp".\..\obj\simple/simple.pch" /Fo".\..\obj\simple/" /Fd".\..\obj\simple/" /GZ /c /GX -# ADD BASE MTL /nologo /tlb".\..\bin\simple.tlb" /win32 -# ADD MTL /nologo /tlb".\..\bin\simple.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 cd.lib cdiup.lib iup.lib comctl32.lib cdgdiplus.lib gdiplus.lib cdpdflib.lib iupcontrols.lib /nologo /out:"..\bin\simple.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:".\..\bin\simple.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 cd.lib cdiup.lib iup.lib comctl32.lib cdgdiplus.lib gdiplus.lib cdpdflib.lib iupcontrols.lib /nologo /out:"..\bin\simple.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:".\..\bin\simple.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386 - -!ENDIF - -# Begin Target - -# Name "simple - Win32 Debug" -# Begin Source File - -SOURCE=iupmain.c -# End Source File -# Begin Source File - -SOURCE=simple.c -# End Source File -# Begin Source File - -SOURCE=simple.h -# End Source File -# Begin Source File - -SOURCE=simple.led -# End Source File -# Begin Source File - -SOURCE=simple_led.c -# End Source File -# End Target -# End Project - diff --git a/test/simple/teste.cpp b/test/simple/teste.cpp deleted file mode 100644 index 83fbbac..0000000 --- a/test/simple/teste.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <io.h> - -#include "iup.h" -#include "cd.h" -#include "cdiup.h" -#include "cdirgb.h" - -/*************************************************************************** -* callbacks do IUP * -****************************************************************************/ -int Draw( Ihandle *dial ) -{ - cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS"); - cdCanvas *imgCnv = (cdCanvas *) IupGetAttribute(dial, "IMGCNV"); - - if (cnv==NULL) - return IUP_DEFAULT; - - int width, height; - cdCanvasGetSize(cnv, &width, &height, NULL, NULL); - - cdCanvasInteriorStyle(cnv, CD_SOLID); - cdCanvasForeground(cnv, CD_WHITE); - cdCanvasBox(cnv, 0, width, 0, height); - - if (imgCnv==NULL) - return IUP_DEFAULT; - - int w, h; - cdCanvasGetSize(imgCnv, &w, &h, NULL, NULL); - - unsigned char* red = cdRedImage(imgCnv); - unsigned char* green = cdGreenImage(imgCnv); - unsigned char* blue = cdBlueImage(imgCnv); - - int dx = width - w; - int dy = height - h; - - cdCanvasPutImageRectRGB(cnv, w, h, red, green, blue, (int)(dx / 2.0), (int)(dy / 2.0), 0, 0, 0, 0, 0, 0); - - return IUP_DEFAULT; -} - -int repaint (Ihandle *self, float x, float y) -{ - Ihandle *dial = (Ihandle *) IupGetDialog(self); - - cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS"); - - Draw(dial); - - return IUP_DEFAULT; -} - -static int Resize (Ihandle *self, int larg, int alt) -{ - Ihandle *dial = IupGetDialog(self); - - if (dial==NULL) return IUP_DEFAULT; - - cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS"); - - if (cnv!=NULL) - cdCanvasActivate(cnv); - - Draw(dial); - - return IUP_DEFAULT; -} - -static int doexit(Ihandle *self) -{ - return IUP_CLOSE; -} - -cdCanvas* buildBackImage(Ihandle* dial) -{ - unsigned char* r = (unsigned char*) IupGetAttribute(dial, "BUFFRED"); - unsigned char* g = (unsigned char*) IupGetAttribute(dial, "BUFFGREEN"); - unsigned char* b = (unsigned char*) IupGetAttribute(dial, "BUFFBLUE"); - - cdCanvas* imgCnv = (cdCanvas*) IupGetAttribute(dial, "IMGCNV"); - - if (imgCnv!=NULL) - delete imgCnv; - - if (r!=NULL) - delete r; - if (g!=NULL) - delete g; - if (b!=NULL) - delete b; - - int w = 200; - int h = 200; - - int size = w * h; - - r = new unsigned char[size]; - g = new unsigned char[size]; - b = new unsigned char[size]; - - char data[100]; - sprintf(data, "%dx%d %p %p %p", w, h, r, g, b); - imgCnv = cdCreateCanvas(CD_IMAGERGB, data); - - IupSetAttribute(dial, "BUFFRED", (char*) r); - IupSetAttribute(dial, "BUFFGREEN", (char*) g); - IupSetAttribute(dial, "BUFFBLUE", (char*) b); - - IupSetAttribute(dial, "IMGCNV", (char*) imgCnv); - - return imgCnv; -} - -void drawInImage(cdCanvas* cnv) -{ - int w, h; - cdCanvasGetSize(cnv, &w, &h, NULL, NULL); - - cdCanvasBegin(cnv, CD_CLIP); -#if 0 - cdCanvasVertex(cnv, 0, 0); - cdCanvasVertex(cnv, w, 0); - cdCanvasVertex(cnv, w, h); - cdCanvasVertex(cnv, 0, h); -#else - cdCanvasVertex(cnv, -100, -100); - cdCanvasVertex(cnv, w+100, -100); - cdCanvasVertex(cnv, w+100, h+100); - cdCanvasVertex(cnv, -100, h+100); -#endif - cdCanvasEnd(cnv); - - cdCanvasClip(cnv, CD_CLIPPOLYGON); - - cdCanvasInteriorStyle(cnv, CD_SOLID); - cdCanvasForeground(cnv, CD_WHITE); - cdCanvasBox(cnv, 0, w, 0, h); - - cdCanvasForeground(cnv, CD_RED); - cdCanvasTextAlignment(cnv, CD_CENTER); - cdCanvasText(cnv, w/2, h/2, "SCURI É BOIOLA!"); -} - -static int tofly(Ihandle *self) -{ - Ihandle *dial = IupGetDialog(self); - - cdCanvas* back = buildBackImage(dial); - - if (back!=NULL) - drawInImage(back); - - Draw(dial); - - return IUP_DEFAULT; -} - -Ihandle *BuildDialog(void) -{ - Ihandle *saida = IupItem ("Saida", "acao_sai"); - Ihandle *voe = IupItem ("Voe", "acao_voar"); - Ihandle *main_menu = IupMenu ( saida, voe, NULL ); - - Ihandle *tela = IupCanvas("rpaint"); - IupSetAttribute(tela, IUP_BUTTON_CB, "buttonCb"); - IupSetAttribute(tela, IUP_MOTION_CB, "motionCb"); - - Ihandle *hbox = IupHbox ( tela, NULL ); - - Ihandle *dial = IupDialog ( hbox ); - - IupSetHandle( "main_menu", main_menu ); - IupSetHandle( "tela", tela ); - IupSetAttribute( dial, IUP_MENU, "main_menu" ); - IupSetAttribute( dial, IUP_SIZE, "HALFxHALF" ); - IupSetAttribute( tela, IUP_SIZE, "300x200" ); - IupSetAttribute( tela, IUP_RESIZE_CB, "resize_cb"); - - IupSetFunction( "rpaint", (Icallback) repaint ); - IupSetFunction( "acao_sai", (Icallback) doexit ); - IupSetFunction( "acao_voar", (Icallback) tofly ); - IupSetFunction( "resize_cb", (Icallback) Resize ); - - IupMap(dial); - - return dial; -} - -int main (void) -{ - Ihandle *dial; - - /* Abre IUP */ - IupOpen(); - - dial = BuildDialog(); - - cdCanvas *cnv = cdCreateCanvas( CD_IUP, IupGetHandle("tela") ); - - IupSetAttribute(dial, "CDCANVAS", (char *) cnv); - - /* Exibe dialogo */ - IupShow(dial); - - /* Interage com o usuario */ - IupMainLoop(); - - cdKillCanvas( cnv ); - - /* Fecha IUP */ - IupClose(); - - return 1; -} |