[GB.DB.ODBC]
* BUG: Table existence should be checked correctly now. [GB.DRAW] * NEW: Paint.DrawImage() is a new utility function to paint an image easily. [GB.QT4] * BUG: Printer.Count is now 1 by default. * BUG: Found a workaround to the Qt bug #5114. Now the brush matrix is taken into account when painting on a Printer object. git-svn-id: svn://localhost/gambas/trunk@3347 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
26b363c96f
commit
1354ca2af7
@ -36,9 +36,9 @@ SearchComment=False
|
||||
SearchString=True
|
||||
|
||||
[OpenFile]
|
||||
Active=1
|
||||
File[1]="gambas.sourceforge.net/home.html.template:39.0"
|
||||
File[2]="gambas.sourceforge.net/menu.html:59.0"
|
||||
Active=2
|
||||
File[2]="gambas.sourceforge.net/menu.html:26.53"
|
||||
Count=2
|
||||
|
||||
[Watches]
|
||||
|
@ -18,6 +18,7 @@ Public Sub Load()
|
||||
$cTr["Readme"] = ("Readme")
|
||||
$cTr["Reporting a problem"] = ("Reporting a problem")
|
||||
$cTr["Resources"] = ("Resources")
|
||||
$cTr["Bug tracker"] = ("Bug tracker")
|
||||
$cTr["Distributions & O.S."] = ("Distributions & O.S.")
|
||||
$cTr["Links"] = ("Links")
|
||||
$cTr["Mailing lists/Forums"] = ("Mailing lists/Forums")
|
||||
|
@ -25,6 +25,7 @@
|
||||
<a href="introduction.html#about">About me</a> <br>
|
||||
<a href="acknowledgements.html">Acknowledgements</a> <br>-->
|
||||
<font color="white"><b>{Resources}</b></font><br>
|
||||
<a href="http://code.google.com/p/gambas/issues/list" target="_blank">{Bug tracker}</a> <br>
|
||||
<a href="http://gambasdoc.org/help/doc/distro?$(LANG)&view">{Distributions & O.S.}</a> <br>
|
||||
<a href="http://gambasdoc.org/help/doc/link?$(LANG)&view">{Links}</a> <br>
|
||||
<a href="http://gambasdoc.org/help/doc/forum?$(LANG)&view">{Mailing lists/Forums}</a> <br>
|
||||
|
@ -294,6 +294,7 @@ Public Sub Example11()
|
||||
Paint.Brush = hBrush
|
||||
Paint.Rectangle(X, Y, W, H)
|
||||
Paint.Fill
|
||||
'Paint.DrawImage(hImage, X, Y, W, H)
|
||||
|
||||
Paint.Brush = Paint.Color(Color.RGB(255, 127, 127, 153))
|
||||
Paint.Arc(X, Y, 10)
|
||||
|
@ -1843,7 +1843,12 @@ fflush(stderr);
|
||||
SQLLEN nIndicatorRemarks;
|
||||
int compare = -1;
|
||||
ODBC_CONN *han = (ODBC_CONN *)db->handle;
|
||||
int len;
|
||||
|
||||
len = strlen(table);
|
||||
if (len == 0)
|
||||
return FALSE;
|
||||
|
||||
retcode = SQLAllocHandle(SQL_HANDLE_STMT, han->odbcHandle, &statHandle);
|
||||
|
||||
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
|
||||
@ -1851,12 +1856,9 @@ fflush(stderr);
|
||||
return FALSE; //V_OD_erg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// EXECUTE OUR SQL/CALL
|
||||
if (SQL_SUCCESS != (nReturn = SQLTables(statHandle, 0, 0, 0, 0, 0, 0, 0, 0)))
|
||||
{
|
||||
|
||||
return FALSE; //nReturn;
|
||||
}
|
||||
|
||||
@ -1871,9 +1873,8 @@ fflush(stderr);
|
||||
while ((nReturn == SQL_SUCCESS || nReturn == SQL_SUCCESS_WITH_INFO)
|
||||
&& compare != 0)
|
||||
{
|
||||
|
||||
//printf("le tabelle in comparazione %s : %s\n",szTableName,table);
|
||||
compare = strncmp((char *)szTableName, table, sizeof(table));
|
||||
compare = strncmp((char *)szTableName, table, len);
|
||||
szTableName[0] = '\0';
|
||||
szTableType[0] = '\0';
|
||||
szTableRemarks[0] = '\0';
|
||||
|
@ -989,6 +989,7 @@ GB_PAINT_DESC PAINT_Interface =
|
||||
RichTextExtents,
|
||||
Matrix,
|
||||
SetBrush,
|
||||
NULL,
|
||||
{
|
||||
BrushFree,
|
||||
BrushColor,
|
||||
|
@ -86,6 +86,9 @@ static bool init_painting(GB_PAINT *d, QPaintDevice *device)
|
||||
EXTRA(d)->painter = new QPainter(device);
|
||||
}
|
||||
|
||||
MyPaintEngine *engine = (MyPaintEngine *)device->paintEngine();
|
||||
engine->patchFeatures();
|
||||
|
||||
EXTRA(d)->path = 0;
|
||||
EXTRA(d)->clip = 0;
|
||||
PAINTER(d)->setRenderHints(QPainter::Antialiasing, true);
|
||||
@ -739,6 +742,13 @@ static void SetBrush(GB_PAINT *d, GB_BRUSH brush)
|
||||
//PAINTER(d)->setBrushOrigin(QPointF((qreal)x, (qreal)y));
|
||||
}
|
||||
|
||||
static void DrawImage(GB_PAINT *d, GB_IMAGE image, float x, float y, float w, float h)
|
||||
{
|
||||
QImage *img = CIMAGE_get((CIMAGE *)image);
|
||||
QRectF rect(x, y, w, h);
|
||||
|
||||
PAINTER(d)->drawImage(rect, *img);
|
||||
}
|
||||
|
||||
static void BrushFree(GB_BRUSH brush)
|
||||
{
|
||||
@ -925,6 +935,7 @@ GB_PAINT_DESC PAINT_Interface = {
|
||||
RichTextExtents,
|
||||
Matrix,
|
||||
SetBrush,
|
||||
DrawImage,
|
||||
{
|
||||
BrushFree,
|
||||
BrushColor,
|
||||
@ -989,6 +1000,21 @@ void PAINT_clip(int x, int y, int w, int h)
|
||||
MyPaintEngine::MyPaintEngine() : QPaintEngine(0) {}
|
||||
MyPaintEngine::~MyPaintEngine() {}
|
||||
|
||||
void MyPaintEngine::patchFeatures()
|
||||
{
|
||||
if (!(gccaps & QPaintEngine::PerspectiveTransform))
|
||||
{
|
||||
QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures;
|
||||
f &= (QPaintEngine::PorterDuff | QPaintEngine::PerspectiveTransform
|
||||
| QPaintEngine::ObjectBoundingModeGradients
|
||||
| QPaintEngine::LinearGradientFill
|
||||
| QPaintEngine::RadialGradientFill
|
||||
| QPaintEngine::ConicalGradientFill);
|
||||
qWarning("warning: patching current paint engine");
|
||||
gccaps = f; //PerspectiveTransform;
|
||||
}
|
||||
}
|
||||
|
||||
bool MyPaintEngine::begin(QPaintDevice *pdev)
|
||||
{
|
||||
setActive(true);
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
//virtual QPoint coordinateOffset() const;
|
||||
|
||||
virtual Type type() const;
|
||||
|
||||
void patchFeatures();
|
||||
};
|
||||
|
||||
class MyPaintDevice: public QPaintDevice
|
||||
|
@ -167,6 +167,7 @@ BEGIN_METHOD_VOID(Printer_new)
|
||||
|
||||
THIS->printer = new QPrinter(QPrinter::HighResolution);
|
||||
THIS->num_copies = 1;
|
||||
THIS->page_count = 1;
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
@ -828,6 +828,72 @@ BEGIN_METHOD(Paint_Rotate, GB_FLOAT angle)
|
||||
|
||||
END_METHOD
|
||||
|
||||
BEGIN_METHOD(Paint_DrawImage, GB_OBJECT image; GB_FLOAT x; GB_FLOAT y; GB_FLOAT width; GB_FLOAT height)
|
||||
|
||||
PAINT_BRUSH *pb;
|
||||
GB_BRUSH brush;
|
||||
GB_IMG *image;
|
||||
GB_TRANSFORM transform;
|
||||
float x, y, w, h;
|
||||
|
||||
CHECK_DEVICE();
|
||||
|
||||
if (GB.CheckObject(VARG(image)))
|
||||
return;
|
||||
|
||||
x = VARG(x);
|
||||
y = VARG(y);
|
||||
w = VARG(width);
|
||||
h = VARG(height);
|
||||
|
||||
if (GB.CheckObject(VARG(image)))
|
||||
return;
|
||||
|
||||
if (w <= 0.0 || h <= 0.0)
|
||||
return;
|
||||
|
||||
if (PAINT->DrawImage)
|
||||
{
|
||||
PAINT->DrawImage(THIS, VARG(image), x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
image = (GB_IMG *)VARG(image);
|
||||
|
||||
if (image->width <= 0 || image->height <= 0)
|
||||
return;
|
||||
|
||||
PAINT->Brush.Image(&brush, (GB_IMAGE)image);
|
||||
pb = make_brush(THIS, brush);
|
||||
GB.Ref(pb);
|
||||
|
||||
// hBrush = Paint.Image(hImage)
|
||||
// hBrush.Translate(X, Y)
|
||||
// hBrush.Scale(W / hImage.W, H / hImage.H)
|
||||
|
||||
PAINT->Transform.Create(&transform);
|
||||
PAINT->Transform.Translate(transform, x, y);
|
||||
//PAINT->Transform.Scale(transform, w / image->width, h / image->height);
|
||||
fprintf(stderr, "brush %g %g %g %g %d %d\n", x, y, w, h, image->width, image->height);
|
||||
PAINT->Brush.Matrix(brush, TRUE, transform);
|
||||
PAINT->Transform.Delete(&transform);
|
||||
|
||||
// Paint.Brush = hBrush
|
||||
|
||||
PAINT->SetBrush(THIS, brush);
|
||||
|
||||
// Paint.Rectangle(X, Y, W, H)
|
||||
PAINT->NewPath(THIS);
|
||||
PAINT->Rectangle(THIS, x, y, w, h);
|
||||
PAINT->Fill(THIS, FALSE);
|
||||
|
||||
if (THIS->brush)
|
||||
PAINT->SetBrush(THIS, THIS->brush->brush);
|
||||
|
||||
GB.Unref(POINTER(&pb));
|
||||
|
||||
END_METHOD
|
||||
|
||||
GB_DESC PaintDesc[] =
|
||||
{
|
||||
GB_DECLARE("Paint", 0), GB_VIRTUAL_CLASS(),
|
||||
@ -893,6 +959,7 @@ GB_DESC PaintDesc[] =
|
||||
GB_STATIC_METHOD("Stroke", NULL, Paint_Stroke, "[(Preserve)b]"),
|
||||
//GB_STATIC_PROPERTY_READ("StrokeExtents", "PaintExtents", Paint_StrokeExtents),
|
||||
//GB_STATIC_METHOD("InStroke", "b", Paint_InStroke, "(X)f(Y)f"),
|
||||
GB_STATIC_METHOD("DrawImage", NULL, Paint_DrawImage, "(Image)Image;(X)f(Y)f(Width)f(Height)f"),
|
||||
|
||||
GB_STATIC_PROPERTY_READ("PathExtents", "PaintExtents", Paint_PathExtents),
|
||||
GB_STATIC_METHOD("PathContains", "b", Paint_PathContains, "(X)f(Y)f"),
|
||||
|
@ -171,6 +171,8 @@ typedef
|
||||
|
||||
void (*SetBrush)(GB_PAINT *d, GB_BRUSH brush);
|
||||
|
||||
void (*DrawImage)(GB_PAINT *d, GB_IMAGE image, float x, float y, float w, float h);
|
||||
|
||||
struct {
|
||||
void (*Free)(GB_BRUSH brush);
|
||||
void (*Color)(GB_BRUSH *brush, GB_COLOR color);
|
||||
|
@ -1,21 +1,21 @@
|
||||
/***************************************************************************
|
||||
|
||||
gb_common.h
|
||||
gb_common.h
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -63,8 +63,8 @@ typedef unsigned long ulong;
|
||||
|
||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
|
||||
|
||||
/* sighandler_t is replaced by sig_t */
|
||||
#define sighandler_t sig_t
|
||||
/* sighandler_t is replaced by sig_t */
|
||||
#define sighandler_t sig_t
|
||||
|
||||
typedef unsigned long ulong;
|
||||
|
||||
@ -75,28 +75,28 @@ typedef unsigned long ulong;
|
||||
#endif
|
||||
|
||||
#ifdef OS_FREEBSD
|
||||
/* finite is replaced by isfinite */
|
||||
#define finite isfinite
|
||||
/* finite is replaced by isfinite */
|
||||
#define finite isfinite
|
||||
#endif
|
||||
|
||||
#ifdef OS_SOLARIS
|
||||
|
||||
/* PGS: The following #define prevents /usr/include/sys/mman.h on solaris
|
||||
from #define'ing PRIVATE to 0x20, thus breaking Gambas.
|
||||
Perhaps Gambas should use a different name?
|
||||
BM: I don't use PRIVATE anymore!
|
||||
*/
|
||||
#ifdef _POSIX_C_SOURCE
|
||||
/* PGS: Stop compiler warnings when gcc on solaris does remember to define
|
||||
_POSIX_C_SOURCE, e.g. when compiling qt related files. */
|
||||
#undef _POSIX_C_SOURCE
|
||||
#endif
|
||||
/* PGS: The following #define prevents /usr/include/sys/mman.h on solaris
|
||||
from #define'ing PRIVATE to 0x20, thus breaking Gambas.
|
||||
Perhaps Gambas should use a different name?
|
||||
BM: I don't use PRIVATE anymore!
|
||||
*/
|
||||
#ifdef _POSIX_C_SOURCE
|
||||
/* PGS: Stop compiler warnings when gcc on solaris does remember to define
|
||||
_POSIX_C_SOURCE, e.g. when compiling qt related files. */
|
||||
#undef _POSIX_C_SOURCE
|
||||
#endif
|
||||
|
||||
#define _POSIX_C_SOURCE 3
|
||||
/* Get prototype for alloca() */
|
||||
#include <alloca.h>
|
||||
/* Get definition for index() */
|
||||
#include <strings.h>
|
||||
#define _POSIX_C_SOURCE 3
|
||||
/* Get prototype for alloca() */
|
||||
#include <alloca.h>
|
||||
/* Get definition for index() */
|
||||
#include <strings.h>
|
||||
|
||||
#endif
|
||||
|
||||
@ -109,28 +109,28 @@ typedef unsigned long ulong;
|
||||
|
||||
#if !defined(__cplusplus)
|
||||
|
||||
#ifndef FALSE
|
||||
enum
|
||||
{
|
||||
FALSE = 0,
|
||||
TRUE = 1
|
||||
};
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
enum
|
||||
{
|
||||
FALSE = 0,
|
||||
TRUE = 1
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef
|
||||
char boolean;
|
||||
typedef
|
||||
char boolean;
|
||||
|
||||
typedef
|
||||
char bool;
|
||||
typedef
|
||||
char bool;
|
||||
|
||||
#endif
|
||||
|
||||
typedef
|
||||
unsigned char uchar;
|
||||
|
||||
unsigned char uchar;
|
||||
|
||||
typedef
|
||||
size_t offset_t;
|
||||
|
||||
|
||||
#define PUBLIC
|
||||
#define INLINE __inline__
|
||||
#define EXTERN extern
|
||||
@ -152,7 +152,7 @@ typedef
|
||||
#define NO_WARNING(var) var = var
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(_type, _arg) ((size_t)&(((_type *)0)->_arg))
|
||||
#define offsetof(_type, _arg) ((size_t)&(((_type *)0)->_arg))
|
||||
#endif
|
||||
|
||||
#define Max(a, b) ({ int _a = (a), _b = (b); _a > _b ? _a : _b; })
|
||||
@ -170,10 +170,10 @@ typedef
|
||||
#endif /* __i386__ */
|
||||
|
||||
#define COPYRIGHT "(c) 2000-2010 Benoit Minisini\n\n" \
|
||||
"This program is free software; you can redistribute it and/or \n" \
|
||||
"modify it under the terms of the GNU General Public License as \n" \
|
||||
"published by the Free Software Foundation; either version 2, or \n" \
|
||||
"(at your option) any later version.\n\n"
|
||||
"This program is free software; you can redistribute it and/or \n" \
|
||||
"modify it under the terms of the GNU General Public License as \n" \
|
||||
"published by the Free Software Foundation; either version 2, or \n" \
|
||||
"(at your option) any later version.\n\n"
|
||||
|
||||
#define LIKELY(_x) __builtin_expect((_x), 1)
|
||||
#define UNLIKELY(_x) __builtin_expect((_x), 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user