From efb265927890a2cb0503cbbfd3bbb0ba3f48dac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Thu, 24 Dec 2009 15:09:08 +0000 Subject: [PATCH] [CONFIGURATION] * BUG: Remove the libtoolize "--install" flag in the reconf script, as it breaks the "main" source sub-directory. We must add an option to this script to handle that flag correctly. [DEVELOPMENT ENVIRONMENT] * BUG: Correctly display errors raised at program startup. [EXAMPLES] * BUG: The Notepad example has been fixed. [GB.DRAW] * NEW: Work continue on the Paint class. git-svn-id: svn://localhost/gambas/trunk@2514 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.lang/.pot | 124 +++--- app/src/gambas3/.src/Debug/Design.module | 21 +- examples/examples/Misc/Notepad/.icon.png | Bin 7143 -> 7147 bytes examples/examples/Misc/Notepad/.project | 4 +- .../examples/Misc/Notepad/.src/FAbout.class | 20 +- .../examples/Misc/Notepad/.src/FNotepad.class | 173 ++++---- main/gbx/gbx_class.c | 2 + main/gbx/gbx_library.c | 8 +- main/lib/draw/Makefile.am | 3 +- main/lib/draw/cpaint.c | 397 +++++++++++++----- main/lib/draw/cpaint.h | 6 +- main/lib/draw/gb.paint.h | 59 +-- main/lib/draw/main.c | 1 + reconf | 2 +- 14 files changed, 522 insertions(+), 298 deletions(-) diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index 7ee71fc0b..ccc6398d8 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -10,12 +10,32 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: .project:1 -msgid "Gambas 3" +#: CComponentBox.class:92 +msgid "Experimental" msgstr "" -#: .project:2 -msgid "Integrated Development Environment for Gambas" +#: CComponentBox.class:94 FPropertyProject.class:1883 +msgid "Not finished but stable" +msgstr "" + +#: CComponentBox.class:200 ProjectItem.class:70 +msgid "Authors" +msgstr "" + +#: CComponentBox.class:207 FPropertyProject.class:2082 +msgid "Requires" +msgstr "" + +#: CComponentBox.class:209 +msgid "Excludes" +msgstr "" + +#: CComponentBox.class:215 +msgid "Implements" +msgstr "" + +#: CComponentBox.class:228 FPropertyProject.class:2057 +msgid "Provides" msgstr "" #: CComponent.class:66 @@ -270,35 +290,7 @@ msgstr "" msgid "Loading information on component &1..." msgstr "" -#: CComponentBox.class:92 -msgid "Experimental" -msgstr "" - -#: CComponentBox.class:94 FPropertyProject.class:1883 -msgid "Not finished but stable" -msgstr "" - -#: CComponentBox.class:200 ProjectItem.class:70 -msgid "Authors" -msgstr "" - -#: CComponentBox.class:207 FPropertyProject.class:2082 -msgid "Requires" -msgstr "" - -#: CComponentBox.class:209 -msgid "Excludes" -msgstr "" - -#: CComponentBox.class:215 -msgid "Implements" -msgstr "" - -#: CComponentBox.class:228 FPropertyProject.class:2057 -msgid "Provides" -msgstr "" - -#: CModule.class:28 FCreateFile.class:625 FEditor.class:3385 FForm.class:3539 +#: CModule.class:28 FCreateFile.class:625 FEditor.class:3389 FForm.class:3539 #: FInfo.class:88 msgid "Form" msgstr "" @@ -335,11 +327,11 @@ msgstr "" msgid "Gambas reports" msgstr "" -#: Design.module:215 Project.module:1659 +#: Design.module:220 Project.module:1659 msgid "In class &1 at line &2." msgstr "" -#: Design.module:319 +#: Design.module:324 msgid "" "The program has stopped unexpectedly\n" "by raising signal #&1.\n" @@ -348,13 +340,13 @@ msgid "" "gambas@users.sourceforge.net." msgstr "" -#: Design.module:323 +#: Design.module:328 msgid "" "The program has returned\n" "the value: &1" msgstr "" -#: Design.module:379 FAbout.class:565 FColorChooser.class:197 +#: Design.module:384 FAbout.class:565 FColorChooser.class:197 #: FCommit.class:391 FConnectionEditor.class:411 FCreateFile.class:879 #: FFontChooser.class:80 FGotoLine.class:57 FList.class:333 FMain.class:2767 #: FMakeExecutable.class:138 FMenu.class:1093 FNewConnection.class:586 @@ -365,11 +357,11 @@ msgstr "" msgid "OK" msgstr "" -#: Design.module:774 +#: Design.module:779 msgid "Output terminal" msgstr "" -#: Design.module:801 +#: Design.module:806 msgid "No terminal emulator found." msgstr "" @@ -442,7 +434,7 @@ msgstr "" #: FColorChooser.class:203 FCommit.class:397 FConflict.class:191 #: FConnectionEditor.class:261 FCreateFile.class:885 FDebugInfo.class:490 -#: FEditor.class:2132 FFind.class:114 FFindList.class:195 +#: FEditor.class:2132 FFindList.class:195 FFind.class:114 #: FFontChooser.class:86 FForm.class:2830 FGotoLine.class:63 #: FHelpBrowser.class:258 FIconEditor.class:1393 FImportTable.class:38 #: FList.class:155 FMain.class:204 FMakeExecutable.class:144 @@ -450,7 +442,7 @@ msgstr "" #: FNewTable.class:168 FNewTranslation.class:70 FOpenProject.class:146 #: FOption.class:576 FPasteSpecial.class:279 FPropertyProject.class:1236 #: FSave.class:118 FSelectExtraFile.class:78 FSelectIcon.class:271 -#: FTableChooser.class:145 FText.class:107 FTextEditor.class:462 +#: FTableChooser.class:145 FTextEditor.class:462 FText.class:107 #: FTranslate.class:606 Project.module:350 msgid "Cancel" msgstr "" @@ -1242,7 +1234,7 @@ msgstr "" msgid "Find definition" msgstr "" -#: FEditor.class:3144 FHelpBrowser.class:244 +#: FEditor.class:3148 FHelpBrowser.class:244 msgid "Go back" msgstr "" @@ -1334,6 +1326,18 @@ msgstr "" msgid "Procedure list" msgstr "" +#: FFindList.class:75 +msgid "Column" +msgstr "" + +#: FFindList.class:238 +msgid "Find list" +msgstr "" + +#: FFindList.class:273 FFind.class:395 FOutput.class:309 FTranslate.class:567 +msgid "Search string cannot be found." +msgstr "" + #: FFind.class:114 msgid "Are you sure to want to replace all?" msgstr "" @@ -1342,10 +1346,6 @@ msgstr "" msgid "Replace" msgstr "" -#: FFind.class:395 FFindList.class:273 FOutput.class:309 FTranslate.class:567 -msgid "Search string cannot be found." -msgstr "" - #: FFind.class:397 msgid "Search string replaced once." msgstr "" @@ -1402,14 +1402,6 @@ msgstr "" msgid "Search in strings" msgstr "" -#: FFindList.class:75 -msgid "Column" -msgstr "" - -#: FFindList.class:238 -msgid "Find list" -msgstr "" - #: FFontChooser.class:57 msgid "Select a font" msgstr "" @@ -3494,6 +3486,10 @@ msgstr "" msgid "Connection" msgstr "" +#: FTextEditor.class:764 +msgid "Text editor" +msgstr "" + #: FText.class:77 msgid "Edit text property" msgstr "" @@ -3502,10 +3498,6 @@ msgstr "" msgid "Use a fixed font" msgstr "" -#: FTextEditor.class:764 -msgid "Text editor" -msgstr "" - #: FTips.class:47 msgid "Tip of the day" msgstr "" @@ -4814,6 +4806,18 @@ msgstr "" msgid "'tar' has returned the following error code:" msgstr "" +#: ProjectItem.class:70 +msgid "Author" +msgstr "" + +#: .project:1 +msgid "Gambas 3" +msgstr "" + +#: .project:2 +msgid "Integrated Development Environment for Gambas" +msgstr "" + #: Project.module:145 msgid "Automation" msgstr "" @@ -5119,10 +5123,6 @@ msgstr "" msgid "Unable to update all forms." msgstr "" -#: ProjectItem.class:70 -msgid "Author" -msgstr "" - #: Save.module:38 msgid "Cannot save file !" msgstr "" diff --git a/app/src/gambas3/.src/Debug/Design.module b/app/src/gambas3/.src/Debug/Design.module index 25b45f1fd..b6c913274 100644 --- a/app/src/gambas3/.src/Debug/Design.module +++ b/app/src/gambas3/.src/Debug/Design.module @@ -53,8 +53,12 @@ End Public Sub CheckErrorMessage(hEditor As FEditor) If Not $sError Then Return - If hEditor.Name = $sPosClass And If hEditor.Editor.Line = ($iPosLine - 1) Then - hEditor.ShowErrorMessage($sError, "error") + If hEditor Then + If hEditor.Name = $sPosClass And If hEditor.Editor.Line = ($iPosLine - 1) Then + hEditor.ShowErrorMessage($sError, "error") + Endif + Else + FMain.ShowError($sError) Endif End @@ -212,12 +216,13 @@ Public Sub Debug_Read(Data As String) If aData[1] And If Not $bError Then '$bError = True - $sError = "" & MakeErrorMessage(aData[1]) & "

" & Subst(("In class &1 at line &2."), $sPosClass, $iPosLine) - Try CheckErrorMessage(Project.ActiveForm) - ' 'Message.Error(aData[1]) - ' Try Project.ActiveForm.ShowMessage(aData[1], "error") - ' If Error Then Message.Error(aData[1]) - ' $bError = False + $sError = "" & MakeErrorMessage(aData[1]) & "" + If sClass Then $sError &= "

" & Subst(("In class &1 at line &2."), $sPosClass, $iPosLine) + If sClass Then + Try CheckErrorMessage(Project.ActiveForm) + Else + Try CheckErrorMessage(Null) + Endif Endif SetState(STATE_DEBUG) diff --git a/examples/examples/Misc/Notepad/.icon.png b/examples/examples/Misc/Notepad/.icon.png index 02467f14aa4e170bbc7e5a252c08e672ba49b026..9753f5d85785cafd11593699d6f14ced2956ac91 100644 GIT binary patch literal 7147 zcmVJNRCt`_n|XX)Rk`=SYY%72aFR50nx;ux(wQ=psSKsH6bhms z-~<*#xm*Qb6%nosir@?PDu^NzSx~weBD1 zq)pnSrO4~`e%|Nv+1dN-z1Ld%_j}fQp0(EVMDV{%iZ6ZJP*PrrRQXol-e-DOUEB2c z)MtEJANG%sk}s~hKuL9fFvBycFvr8rM8QSCIY9p>t@D2c0pq{2YL1lR7rGD&zrLi5 z8!oM+p(DDpGT_Nm8XbizhL=BVhRWOwf&qi%g!2~IUF$a$U;4N6m8L+m|buJRyt!tc7>>g5$utdYC&spOxY2&y`&I z=0aW97k=xa30!wkg}nNnZPv=RJtqTMK+oaY`llkG>YM8fCEd%F;+~QmZ_y7gnZS~h z@_D-fp8hY0Cl9=vv?YC(hCjdT!u>K`!&Jh%jOmE-OrAvPw70e6`K1~-F-;< zdSmR`+JF-ubziJi#0LtjrAS>Z~~@&XT1;2{DG4EV0w8Vc=PAWm|c~@ zyKPXj4Xj}rcU`F4)y_p#)6-!ImqPRCncPnq@a$Si<=y&*S%k5*~pOR7!;m7oU;}q-hIp{-iXtF|xb& z^;>MLX{SFFVd?xrzPYG~7dFF}eg}i`L+g&&ke}nFt0z$ePS|j?3?&_bGHvwCiGT@= zQt~JWnEzJqO&WV`mTxd;sS_?;>MxqMbjQONtz+1DoAqzo zCWE+N7vlU2kI&&d=N94`IxE|t;~>kPOe#Ly(na0g5D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ajcMYa?lGO2Ai9Iq8JUuej#luf6u#PfV^V^Cgou zQYtpq?(Vzrg2h)34)ngxN6ghY@9H1TtgDaK8J=tmPXLcU#Efd9ixwT5Yv|%zMS1@3 zeqv$Om}L)ZAT*9BPu`SwHGjob{kF&+O1Rwdhi10yXl?9W`_SFJ@Bi?Z(vEE+owGkY zRdAxw{-*ce``hzRJpSmDA8y(iFD{!nMQEn?@=slSYj-Cyt4lY3jm;G*%RjkN+&&}8M;5ww&Bgrx9<9t zObyloeT<$XjrkoyXu*P_3G>6J44)_-!&WGlC%yz0oi z{{5Vn4%+bHHgpitfFdA|wAb!p^v>Gname, cds->name, class->name); } } diff --git a/main/gbx/gbx_library.c b/main/gbx/gbx_library.c index 58d463afd..d076d418b 100644 --- a/main/gbx/gbx_library.c +++ b/main/gbx/gbx_library.c @@ -57,7 +57,7 @@ #include "gbx_library.h" -/*#define DEBUG*/ +//#define DEBUG //#define DEBUG_PRELOAD // Maximum size of a project or startup file @@ -445,14 +445,14 @@ void LIBRARY_load(LIBRARY *lib) GB_DESC **desc; char *path; + if (lib->handle) + return; + #ifdef DEBUG clock_t t = clock(); fprintf(stderr, "Loading library %s\n", lib->name); #endif - if (lib->handle) - return; - path = FILE_buffer(); sprintf(path, LIB_PATTERN, COMPONENT_path, lib->name); diff --git a/main/lib/draw/Makefile.am b/main/lib/draw/Makefile.am index 6ce673515..80115bf6a 100644 --- a/main/lib/draw/Makefile.am +++ b/main/lib/draw/Makefile.am @@ -7,10 +7,11 @@ gb_draw_la_LDFLAGS = -module @LD_FLAGS@ gb_draw_la_CFLAGS = -I$(top_srcdir)/share @INCLTDL@ $(AM_CFLAGS) gb_draw_la_SOURCES = \ - gb.draw.h \ + gb.draw.h gb.paint.h \ gb_list.c \ matrix.h matrix.c \ CDraw.h CDraw.c \ + cpaint.h cpaint.c \ main.h main.c diff --git a/main/lib/draw/cpaint.c b/main/lib/draw/cpaint.c index e3ce81c27..e11373e75 100644 --- a/main/lib/draw/cpaint.c +++ b/main/lib/draw/cpaint.c @@ -30,6 +30,10 @@ static GB_PAINT *_current = NULL; #define THIS _current #define PAINT _current->desc +#define THIS_EXTENTS ((PAINT_EXTENTS *)_object) +#define THIS_BRUSH ((PAINT_BRUSH *)_object) +#define THIS_MATRIX ((PAINT_MATRIX *)_object) + static bool check_device() { if (!_current) @@ -71,7 +75,7 @@ bool PAINT_begin(void *device) paint->device = device; _current = paint; - if (paint->desc->Begin(paint)) + if (PAINT->Begin(paint)) return TRUE; //DRAW->SetBackground(draw, GB_PAINT_COLOR_DEFAULT); @@ -80,96 +84,60 @@ bool PAINT_begin(void *device) return FALSE; } - -BEGIN_METHOD(Paint_begin, GB_OBJECT device) - - void *device = VARG(device); - - if (GB.CheckObject(device)) - return; - - DRAW_begin(device); - -END_METHOD - - -void DRAW_end() +void PAINT_end() { - GB_PAINT *draw; + GB_PAINT *paint; if (!_current) return; - draw = _current; + paint = _current; _current = _current->previous; - draw->desc->End(draw); + PAINT->End(paint); - GB.Unref(POINTER(&draw->device)); - GB.Free(POINTER(&draw)); + GB.Unref(POINTER(&paint->device)); + GB.Free(POINTER(&paint)); } -BEGIN_METHOD_VOID(Paint_end) +/**** PaintExtents *********************************************************/ - DRAW_end(); - -END_METHOD +#define IMPLEMENT_EXTENTS_PROPERTY(_method, _field) \ +BEGIN_PROPERTY(_method) \ + GB.ReturnFloat(THIS_EXTENTS->ext._field); \ +END_PROPERTY +IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_X, x1) +IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_Y, y1) +IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_X2, x2) +IMPLEMENT_EXTENTS_PROPERTY(PaintExtents_Y2, y2) -BEGIN_METHOD_VOID(Paint_exit) +BEGIN_PROPERTY(PaintExtents_Width) - while (_current) - DRAW_end(); - -END_METHOD - - -BEGIN_METHOD_VOID(Paint_save) - - CHECK_DEVICE(); - DRAW->Save(THIS); - -END_METHOD - - -BEGIN_METHOD_VOID(Paint_restore) - - CHECK_DEVICE(); - DRAW->Restore(THIS); - -END_METHOD - -BEGIN_PROPERTY(Paint_device) - - CHECK_DEVICE(); - GB.ReturnObject(THIS->device); + GB.ReturnFloat(THIS_EXTENTS->ext.x2 - THIS_EXTENTS->ext.x1); END_PROPERTY -BEGIN_PROPERTY(Paint_width) +BEGIN_PROPERTY(PaintExtents_Height) - CHECK_DEVICE(); - GB.ReturnInteger(THIS->width); + GB.ReturnFloat(THIS_EXTENTS->ext.y2 - THIS_EXTENTS->ext.y1); END_PROPERTY +BEGIN_METHOD(PaintExtents_Merge, GB_OBJECT extents) -BEGIN_PROPERTY(Paint_height) - - CHECK_DEVICE(); - GB.ReturnInteger(THIS->height); - -END_PROPERTY - - -BEGIN_PROPERTY(Paint_resolution) - - CHECK_DEVICE(); - GB.ReturnInteger(THIS->resolution); - -END_PROPERTY + PAINT_EXTENTS *extents = VARG(extents); + + if (GB.CheckObject(extents)) + return; + + if (extents->ext.x1 < THIS_EXTENTS->ext.x1) THIS_EXTENTS->ext.x1 = extents->ext.x1; + if (extents->ext.y1 < THIS_EXTENTS->ext.y1) THIS_EXTENTS->ext.y1 = extents->ext.y1; + if (extents->ext.x2 > THIS_EXTENTS->ext.x2) THIS_EXTENTS->ext.x2 = extents->ext.x2; + if (extents->ext.y2 > THIS_EXTENTS->ext.y2) THIS_EXTENTS->ext.y2 = extents->ext.y2; +END_METHOD GB_DESC PaintExtentsDesc[] = { @@ -187,32 +155,269 @@ GB_DESC PaintExtentsDesc[] = GB_END_DECLARE }; +/**** PaintMatrix **********************************************************/ + +static GB_PAINT_DESC *handle_matrix(void *_object, bool set, GB_TRANSFORM *pmatrix) +{ + if (!_object) + { + PAINT->Matrix(THIS, set, pmatrix); + return PAINT; + } + else + { + THIS_BRUSH->desc->Brush.Matrix(THIS_BRUSH->brush, set, pmatrix); + return THIS_BRUSH->desc; + } +} + +#define IMPLEMENT_MATRIX_METHOD_VOID(_method, _code) \ +BEGIN_METHOD_VOID(_method) \ + GB_TRANSFORM matrix; \ + handle_matrix(_object, FALSE, &matrix)->Transform._code; \ + handle_matrix(_object, TRUE, &matrix); \ + RETURN_SELF(); \ +END_METHOD + +#define IMPLEMENT_MATRIX_METHOD(_method, _arg, _code) \ +BEGIN_METHOD(_method, _arg) \ + GB_TRANSFORM matrix; \ + handle_matrix(_object, FALSE, &matrix)->Transform._code; \ + handle_matrix(_object, TRUE, &matrix); \ + RETURN_SELF(); \ +END_METHOD + +IMPLEMENT_MATRIX_METHOD_VOID(PaintMatrix_Reset, Init(matrix, 1, 0, 0, 1, 0, 0)) +IMPLEMENT_MATRIX_METHOD(PaintMatrix_Translate, GB_FLOAT tx; GB_FLOAT ty, Translate(matrix, VARG(tx), VARG(ty))) +IMPLEMENT_MATRIX_METHOD(PaintMatrix_Scale, GB_FLOAT sx; GB_FLOAT sy, Scale(matrix, VARG(sx), VARG(sy))) +IMPLEMENT_MATRIX_METHOD(PaintMatrix_Rotate, GB_FLOAT angle, Rotate(matrix, VARG(angle))) + +BEGIN_METHOD_VOID(PaintMatrix_Invert) + + GB_TRANSFORM matrix; + if (handle_matrix(_object, FALSE, &matrix)->Transform.Invert(matrix)) + { + GB.ReturnNull(); + return; + } + handle_matrix(_object, TRUE, &matrix); + RETURN_SELF(); + +END_METHOD + +BEGIN_METHOD(PaintMatrix_Multiply, GB_OBJECT matrix2) + + GB_TRANSFORM matrix; + PAINT_MATRIX *matrix2 = (PAINT_MATRIX *)VARG(matrix2); + + if (GB.CheckObject(matrix2)) + return; + + handle_matrix(_object, FALSE, &matrix)->Transform.Multiply(matrix, matrix2->matrix); + handle_matrix(_object, TRUE, &matrix); + RETURN_SELF(); + +END_METHOD + + +GB_DESC PaintMatrixDesc[] = +{ + GB_DECLARE(".PaintMatrix", 0), GB_VIRTUAL_CLASS(), + + //GB_METHOD("_new", NULL, PaintMatrix_new, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"), + //GB_STATIC_METHOD("_call", "PaintMatrix", PaintMatrix_call, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"), + GB_METHOD("Reset", ".PaintMatrix", PaintMatrix_Reset, NULL), + GB_METHOD("Translate", ".PaintMatrix", PaintMatrix_Translate, "(TX)f(TY)f"), + GB_METHOD("Scale", ".PaintMatrix", PaintMatrix_Scale, "(SX)f(SY)f"), + GB_METHOD("Rotate", ".PaintMatrix", PaintMatrix_Rotate, "(Angle)f"), + GB_METHOD("Invert", ".PaintMatrix", PaintMatrix_Invert, NULL), + GB_METHOD("Multiply", ".PaintMatrix", PaintMatrix_Multiply, "(Matrix)PaintMatrix;"), + + GB_END_DECLARE +}; + + +/**** PaintBrush ***********************************************************/ + +BEGIN_METHOD_VOID(PaintBrush_free) + + THIS_BRUSH->desc->Brush.Free(THIS_BRUSH->brush); + +END_METHOD + GB_DESC PaintBrushDesc[] = { GB_DECLARE("PaintBrush", sizeof(PAINT_BRUSH)), GB_NOT_CREATABLE(), GB_METHOD("_free", NULL, PaintBrush_free, NULL), - GB_PROPERTY("Matrix", "PaintMatrix", PaintBrush_Matrix), + GB_PROPERTY_SELF("Matrix", ".PaintMatrix"), GB_END_DECLARE }; -GB_DESC PaintMatrixDesc[] = -{ - GB_DECLARE("PaintMatrix", sizeof(PAINT_MATRIX)), - GB_METHOD("_new", NULL, PaintMatrix_new, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"), - GB_STATIC_METHOD("_call", "PaintMatrix", PaintMatrix_call, "[(XX)f(YX)f(XY)f(YY)f(X0)f(Y0)f]"), - GB_METHOD("Translate", "PaintMatrix", PaintMatrix_translate, "(TX)f(TY)f"), - GB_METHOD("Scale", "PaintMatrix", PaintMatrix_scale, "(SX)f(SY)f"), - GB_METHOD("Rotate", "PaintMatrix", PaintMatrix_rotate, "(Angle)f"), - GB_METHOD("Invert", "PaintMatrix", PaintMatrix_invert, NULL), - GB_METHOD("Multiply", "PaintMatrix", PaintMatrix_multiply, "(Matrix)PaintMatrix;"), +/**** Paint ****************************************************************/ - GB_END_DECLARE -}; +BEGIN_METHOD(Paint_begin, GB_OBJECT device) + void *device = VARG(device); + + if (GB.CheckObject(device)) + return; + + PAINT_begin(device); + +END_METHOD + + +BEGIN_METHOD_VOID(Paint_end) + + PAINT_end(); + +END_METHOD + + +BEGIN_METHOD_VOID(Paint_exit) + + while (_current) + PAINT_end(); + +END_METHOD + +BEGIN_PROPERTY(Paint_Device) + + CHECK_DEVICE(); + GB.ReturnObject(THIS->device); + +END_PROPERTY + +BEGIN_PROPERTY(Paint_Width) + + CHECK_DEVICE(); + GB.ReturnInteger(THIS->width); + +END_PROPERTY + +BEGIN_PROPERTY(Paint_Height) + + CHECK_DEVICE(); + GB.ReturnInteger(THIS->height); + +END_PROPERTY + +BEGIN_PROPERTY(Paint_Resolution) + + CHECK_DEVICE(); + GB.ReturnInteger(THIS->resolution); + +END_PROPERTY + +#define IMPLEMENT_METHOD(_method, _api) \ +BEGIN_METHOD_VOID(_method) \ + CHECK_DEVICE(); \ + PAINT->_api(THIS); \ +END_METHOD + +#define IMPLEMENT_METHOD_PRESERVE(_method, _api) \ +BEGIN_METHOD(_method, GB_BOOLEAN preserve) \ + CHECK_DEVICE(); \ + PAINT->_api(THIS, VARGOPT(preserve, FALSE)); \ +END_METHOD + +#define IMPLEMENT_PROPERTY_EXTENTS(_property, _api) \ +BEGIN_PROPERTY(_property) \ + PAINT_EXTENTS *extents; \ + CHECK_DEVICE(); \ + GB.New(POINTER(&extents), GB.FindClass("PaintExtents"), NULL, NULL); \ + PAINT->_api(THIS, &extents->ext); \ + GB.ReturnObject(extents); \ +END_METHOD + +#define IMPLEMENT_PROPERTY_INTEGER(_property, _api) \ +BEGIN_PROPERTY(_property) \ + int value; \ + CHECK_DEVICE(); \ + if (READ_PROPERTY) \ + { \ + PAINT->_api(THIS, FALSE, &value); \ + GB.ReturnInteger(value); \ + } \ + else \ + { \ + value = VPROP(GB_INTEGER); \ + PAINT->_api(THIS, TRUE, &value); \ + } \ +END_METHOD + +#define IMPLEMENT_PROPERTY_FLOAT(_property, _api) \ +BEGIN_PROPERTY(_property) \ + double value; \ + CHECK_DEVICE(); \ + if (READ_PROPERTY) \ + { \ + PAINT->_api(THIS, FALSE, &value); \ + GB.ReturnFloat(value); \ + } \ + else \ + { \ + value = VPROP(GB_FLOAT); \ + PAINT->_api(THIS, TRUE, &value); \ + } \ +END_METHOD + +IMPLEMENT_METHOD(Paint_Save, Save) +IMPLEMENT_METHOD(Paint_Restore, Restore) +IMPLEMENT_METHOD_PRESERVE(Paint_Clip, Clip) +IMPLEMENT_METHOD(Paint_ResetClip, ResetClip) +IMPLEMENT_PROPERTY_EXTENTS(Paint_ClipExtents, ClipExtents) +IMPLEMENT_METHOD_PRESERVE(Paint_Fill, Fill) +IMPLEMENT_METHOD_PRESERVE(Paint_Stroke, Stroke) +IMPLEMENT_PROPERTY_EXTENTS(Paint_PathExtents, PathExtents) +IMPLEMENT_PROPERTY_INTEGER(Paint_FillRule, FillRule) +IMPLEMENT_PROPERTY_INTEGER(Paint_LineCap, LineCap) +IMPLEMENT_PROPERTY_INTEGER(Paint_LineJoin, LineJoin) +IMPLEMENT_PROPERTY_INTEGER(Paint_Operator, Operator) +IMPLEMENT_PROPERTY_FLOAT(Paint_LineWidth, LineWidth) +IMPLEMENT_PROPERTY_FLOAT(Paint_MiterLimit, MiterLimit) +IMPLEMENT_PROPERTY_FLOAT(Paint_DashOffset, DashOffset) +IMPLEMENT_METHOD(Paint_NewPath, NewPath) +IMPLEMENT_METHOD(Paint_ClosePath, ClosePath) + +BEGIN_METHOD(Paint_Arc, GB_FLOAT xc; GB_FLOAT yc; GB_FLOAT radius; GB_FLOAT angle1; GB_FLOAT angle2) + + CHECK_DEVICE(); + PAINT->Arc(THIS, VARG(xc), VARG(yc), VARG(radius), VARGOPT(angle1, 0.0), VARGOPT(angle2, M_PI * 2)); + +END_METHOD + +BEGIN_METHOD(Paint_CurveTo, GB_FLOAT x1; GB_FLOAT y1; GB_FLOAT x2; GB_FLOAT y2; GB_FLOAT x3; GB_FLOAT y3) + + CHECK_DEVICE(); + PAINT->CurveTo(THIS, VARG(x1), VARG(y1), VARG(x2), VARG(y2), VARG(x3), VARG(y3)); + +END_METHOD + +BEGIN_METHOD(Paint_LineTo, GB_FLOAT x; GB_FLOAT y) + + CHECK_DEVICE(); + PAINT->LineTo(THIS, VARG(x), VARG(y)); + +END_METHOD + +BEGIN_METHOD(Paint_MoveTo, GB_FLOAT x; GB_FLOAT y) + + CHECK_DEVICE(); + PAINT->MoveTo(THIS, VARG(x), VARG(y)); + +END_METHOD + +BEGIN_METHOD(Paint_Rectangle, GB_FLOAT x; GB_FLOAT y; GB_FLOAT w; GB_FLOAT h) + + CHECK_DEVICE(); + PAINT->Rectangle(THIS, VARG(x), VARG(y), VARG(w), VARG(h)); + +END_METHOD GB_DESC CPaintDesc[] = { @@ -253,10 +458,15 @@ GB_DESC CPaintDesc[] = GB_STATIC_METHOD("Begin", NULL, Paint_begin, "(Device)o"), GB_STATIC_METHOD("End", NULL, Paint_end, NULL), - GB_STATIC_PROPERTY_READ("Device", "o", Paint_device), + GB_STATIC_PROPERTY_READ("Device", "o", Paint_Device), + GB_STATIC_PROPERTY_READ("W", "i", Paint_Width), + GB_STATIC_PROPERTY_READ("H", "i", Paint_Height), + GB_STATIC_PROPERTY_READ("Width", "i", Paint_Width), + GB_STATIC_PROPERTY_READ("Height", "i", Paint_Height), + GB_STATIC_PROPERTY_READ("Resolution", "i", Paint_Resolution), - GB_STATIC_METHOD("Save", NULL, Paint_save, NULL), - GB_STATIC_METHOD("Restore", NULL, Paint_restore, NULL), + GB_STATIC_METHOD("Save", NULL, Paint_Save, NULL), + GB_STATIC_METHOD("Restore", NULL, Paint_Restore, NULL), GB_STATIC_METHOD("Clip", NULL, Paint_Clip, "[(Preserve)b]"), GB_STATIC_METHOD("ResetClip", NULL, Paint_ResetClip, NULL), @@ -275,11 +485,10 @@ GB_DESC CPaintDesc[] = //GB_STATIC_METHOD("InStroke", "b", Paint_InStroke, "(X)f(Y)f"), GB_STATIC_PROPERTY_READ("PathExtents", "PaintExtents", Paint_PathExtents), - GB_STATIC_METHOD("PathContains", "b", Paint_InPath, "(X)f(Y)f"), + //GB_STATIC_METHOD("PathContains", "b", Paint_InPath, "(X)f(Y)f"), - GB_STATIC_PROPERTY("Brush", "PaintBrush", Paint_Brush), - //GB_STATIC_PROPERTY("AntiAlias", "i", CAIRO_anti_alias), - GB_STATIC_PROPERTY("Dash", "Float[]", Paint_Dash), + //GB_STATIC_PROPERTY("Brush", "PaintBrush", Paint_Brush), + //GB_STATIC_PROPERTY("Dash", "Float[]", Paint_Dash), GB_STATIC_PROPERTY("DashOffset", "f", Paint_DashOffset), GB_STATIC_PROPERTY("FillRule", "i", Paint_FillRule), GB_STATIC_PROPERTY("LineCap", "i", Paint_LineCap), @@ -300,22 +509,18 @@ GB_DESC CPaintDesc[] = GB_STATIC_METHOD("MoveTo", NULL, Paint_MoveTo, "(X)f(Y)f"), GB_STATIC_METHOD("Rectangle", NULL, Paint_Rectangle, "(X)f(Y)f(Width)f(Height)f"), - GB_STATIC_PROPERTY("Font", "PaintFont", Paint_Font), - GB_STATIC_METHOD("Text", NULL, Paint_Text, "(Text)s(X)f(Y)f[(Width)f(Height)f(Alignment)i)]"), + #if 0 + GB_STATIC_PROPERTY("Font", "Font", Paint_Font), + GB_STATIC_METHOD("Text", NULL, Paint_Text, "(Text)s[(X)f(Y)f(Width)f(Height)f(Alignment)i)]"), GB_STATIC_METHOD("TextExtents", "TextExtents", Paint_TextExtents, "(Text)s"), - //GB_STATIC_METHOD("RelCurveTo", NULL, CAIRO_rel_curve_to, "(DX1)f(DY1)f(DX2)f(DY2)f(DX3)f(DY3)f"), - //GB_STATIC_METHOD("RelLineTo", NULL, CAIRO_rel_line_to, "(DX)f(DY)f"), - //GB_STATIC_METHOD("RelMoveTo", NULL, CAIRO_rel_move_to, "(DX)f(DY)f"), GB_STATIC_METHOD("ColorBrush", "PaintBrush", Paint_ColorBrush, "(Color)i"), GB_STATIC_METHOD("ImageBrush", "PaintBrush", Paint_ImageBrush, "(Image)Image;[(X)f(Y)f(Extend)i]"), GB_STATIC_METHOD("LinearGradient", "PaintBrush", Paint_LinearGradient, "(X0)f(Y0)f(X1)f(Y1)f(Colors)Float[][];"), GB_STATIC_METHOD("RadialGradient", "PaintBrush", Paint_RadialGradient, "(CX0)f(CY0)f(Radius0)f(CX1)f(CY1)f(Radius1)f(Colors)Float[][];"), - GB_STATIC_METHOD("Translate", NULL, Paint_Translate, "(TX)f(TY)f"), - GB_STATIC_METHOD("Scale", NULL, Paint_Scale, "(SX)f(SY)f"), - GB_STATIC_METHOD("Rotate", NULL, Paint_Rotate, "(Angle)f"), - GB_STATIC_PROPERTY("Matrix", "PaintMatrix", Paint_Matrix), + GB_STATIC_PROPERTY_SELF("Matrix", ".PaintMatrix"), + #endif GB_END_DECLARE }; diff --git a/main/lib/draw/cpaint.h b/main/lib/draw/cpaint.h index 5c12e2220..f2847b58f 100644 --- a/main/lib/draw/cpaint.h +++ b/main/lib/draw/cpaint.h @@ -24,11 +24,13 @@ #define __CPAINT_H #include "gambas.h" -#include "gb.draw.h" +#include "gb.paint.h" #ifndef __CPAINT_C -extern GB_DESC CPaintDesc[]; +extern GB_DESC PaintExtentsDesc[]; +extern GB_DESC PaintBrushDesc[]; +extern GB_DESC PaintDesc[]; #endif diff --git a/main/lib/draw/gb.paint.h b/main/lib/draw/gb.paint.h index 2bef30dca..014c06b60 100644 --- a/main/lib/draw/gb.paint.h +++ b/main/lib/draw/gb.paint.h @@ -60,16 +60,18 @@ enum { GB_PAINT_OPERATOR_DEST, GB_PAINT_OPERATOR_DEST_OVER, GB_PAINT_OPERATOR_DEST_IN, - GB_PAINT_OPERATOR_DEST_OUT + GB_PAINT_OPERATOR_DEST_OUT, GB_PAINT_OPERATOR_DEST_ATOP, GB_PAINT_OPERATOR_XOR, GB_PAINT_OPERATOR_ADD, GB_PAINT_OPERATOR_SATURATE }; +struct GB_PAINT_DESC; + typedef struct { - double x1, x2, y1, y2; + double x1, y1, x2, y2; } GB_EXTENTS; @@ -89,6 +91,7 @@ typedef typedef struct { GB_BASE ob; + struct GB_PAINT_DESC *desc; // drawing driver GB_TRANSFORM matrix; } PAINT_MATRIX; @@ -96,14 +99,15 @@ typedef typedef struct { GB_BASE ob; + struct GB_PAINT_DESC *desc; // drawing driver GB_BRUSH brush; } PAINT_BRUSH; typedef struct GB_PAINT { - struct GB_PAINT_DESC *desc; // drawing driver - struct GB_PAINT *previous; // previous drawing context + struct GB_PAINT_DESC *desc; // drawing driver + struct GB_PAINT *previous; // previous drawing context void *device; // drawing object int width; // device width in device coordinates int height; // device height in device coordinates @@ -156,21 +160,36 @@ typedef void (*LineTo)(GB_PAINT *d, double x, double y); void (*CurveTo)(GB_PAINT *d, double x1, double y1, double x2, double y2, double x3, double y3); - void (*Text)(GB_PAINT *d, const char *text, double x, double y); + void (*Text)(GB_PAINT *d, const char *text); void (*TextExtents)(GB_PAINT *d, const char *text, GB_EXTENTS *ext); - void (*SetBrush)(GB_PAINT *d, GB_BRUSH brush); - void (*FreeBrush)(GB_PAINT *d, GB_BRUSH brush); - GB_BRUSH (*ColorBrush)(GB_PAINT *d, GB_COLOR color); - GB_BRUSH (*ImageBrush)(GB_PAINT *d, GB_IMAGE image, double x, double y, int extend); - GB_BRUSH (*LinearGradient)(GB_PAINT *d, double x0, double y0, double x1, double y1); - GB_BRUSH (*RadialGradient)(GB_PAINT *d, double cx0, double cy0, double r0, double cx1, double cy1, double r1); - void (*SetColorStop)(GB_PAINT *d, GB_BRUSH *brush, int nstop, double *pos, GB_COLOR *color); - void (*Translate)(GB_PAINT *d, double tx, double ty); void (*Scale)(GB_PAINT *d, double sx, double sy); void (*Rotate)(GB_PAINT *d, double angle); void (*Matrix)(GB_PAINT *d, bool set, GB_TRANSFORM *matrix); + + void (*SetBrush)(GB_PAINT *d, GB_BRUSH brush); + + struct { + void (*Free)(GB_BRUSH brush); + void (*Color)(GB_BRUSH *brush, GB_COLOR color); + void (*Image)(GB_BRUSH *brush, GB_IMAGE image, double x, double y, int extend); + void (*LinearGradient)(GB_BRUSH *brush, double x0, double y0, double x1, double y1); + void (*RadialGradient)(GB_BRUSH *brush, double cx0, double cy0, double r0, double cx1, double cy1, double r1); + void (*SetColorStop)(GB_BRUSH brush, int nstop, double *pos, GB_COLOR *color); + void (*Matrix)(GB_BRUSH brush, bool set, GB_TRANSFORM *matrix); + } + Brush; + + struct { + void (*Init)(GB_TRANSFORM matrix, double xx, double yx, double xy, double yy, double x0, double y0); + void (*Translate)(GB_TRANSFORM matrix, double tx, double ty); + void (*Scale)(GB_TRANSFORM matrix, double sx, double sy); + void (*Rotate)(GB_TRANSFORM matrix, double angle); + bool (*Invert)(GB_TRANSFORM matrix); + void (*Multiply)(GB_TRANSFORM matrix, GB_TRANSFORM matrix2); + } + Transform; } GB_PAINT_DESC; @@ -183,20 +202,6 @@ typedef } PAINT_INTERFACE; -#define DRAW_NORMALIZE(x, y, w, h, sx, sy, sw, sh, width, height) \ - if (w < 0) w = width; \ - if (h < 0) h = height; \ - if (sw < 0) sw = width; \ - if (sh < 0) sh = height; \ - if (sx >= (width) || sy >= (height) || sw <= 0 || sh <= 0) \ - return; \ - if (sx < 0) x -= sx, sx = 0; \ - if (sy < 0) y -= sy, sy = 0; \ - if (sw > ((width) - sx)) \ - sw = ((width) - sx); \ - if (sh > ((height) - sy)) \ - sh = ((height) - sy); - #endif diff --git a/main/lib/draw/main.c b/main/lib/draw/main.c index a1fca68e4..ca0194c24 100644 --- a/main/lib/draw/main.c +++ b/main/lib/draw/main.c @@ -30,6 +30,7 @@ #include "gb_common.h" #include "CDraw.h" +#include "cpaint.h" #include "main.h" diff --git a/reconf b/reconf index e243c2740..ffe37f8bf 100755 --- a/reconf +++ b/reconf @@ -3,6 +3,6 @@ rm -f config.cache rm -f acconfig.cache -libtoolize --force --copy --install +libtoolize --force --copy autoreconf -v $@