[DEVELOPMENT ENVIRONMENT]

* NEW: Use the new mascot to draw project directory icon.

[EXAMPLES]
* NEW: Some little changes in the Painting example.

[INTERPRETER]
* NEW: The component GB_INIT function now returns an integer that gives an 
  unloading order. The higher the returned number, the later the component 
  is unloaded. If GB_INIT returns -1, then the component shared library 
  will not be unloaded.
* NEW: Update GB_INIT functions in all components.

[GB.DRAW]
* BUG: Paint.Image() optional translation arguments are not inverted 
  anymore.

[GB.QT4]
* BUG: If Paint.LineWidth is zero, then nothing is stroked, as in gb.gtk.
* BUG: TabStrip is now correctly arranged when it has only one tab.


git-svn-id: svn://localhost/gambas/trunk@2605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-01-10 13:40:48 +00:00
parent 09916d0a4b
commit 61997e8921
61 changed files with 230 additions and 152 deletions

View File

@ -436,7 +436,7 @@ msgstr ""
#: FConnectionEditor.class:261 FCreateFile.class:885 FDebugInfo.class:490 #: FConnectionEditor.class:261 FCreateFile.class:885 FDebugInfo.class:490
#: FEditor.class:2132 FFindList.class:195 FFind.class:114 #: FEditor.class:2132 FFindList.class:195 FFind.class:114
#: FFontChooser.class:86 FForm.class:2836 FGotoLine.class:63 #: FFontChooser.class:86 FForm.class:2836 FGotoLine.class:63
#: FHelpBrowser.class:285 FIconEditor.class:1393 FImportTable.class:38 #: FHelpBrowser.class:270 FIconEditor.class:1393 FImportTable.class:38
#: FList.class:155 FMain.class:204 FMakeExecutable.class:144 #: FList.class:155 FMain.class:204 FMakeExecutable.class:144
#: FMakeInstall.class:309 FMenu.class:1128 FNewConnection.class:317 #: FMakeInstall.class:309 FMenu.class:1128 FNewConnection.class:317
#: FNewTable.class:168 FNewTranslation.class:70 FOpenProject.class:146 #: FNewTable.class:168 FNewTranslation.class:70 FOpenProject.class:146
@ -638,7 +638,7 @@ msgstr ""
msgid "Default value" msgid "Default value"
msgstr "" msgstr ""
#: FConnectionEditor.class:58 FDebugExpr.class:425 FHelpBrowser.class:257 #: FConnectionEditor.class:58 FDebugExpr.class:425 FHelpBrowser.class:242
msgid "Index" msgid "Index"
msgstr "" msgstr ""
@ -781,7 +781,7 @@ msgid "Connection editor"
msgstr "" msgstr ""
#: FConnectionEditor.class:1547 FEditor.class:2132 FForm.class:2836 #: FConnectionEditor.class:1547 FEditor.class:2132 FForm.class:2836
#: FHelpBrowser.class:292 FIconEditor.class:2032 FTextEditor.class:462 #: FHelpBrowser.class:277 FIconEditor.class:2032 FTextEditor.class:462
#: FTranslate.class:700 #: FTranslate.class:700
msgid "Reload" msgid "Reload"
msgstr "" msgstr ""
@ -1229,7 +1229,7 @@ msgstr ""
msgid "Find definition" msgid "Find definition"
msgstr "" msgstr ""
#: FEditor.class:3148 FHelpBrowser.class:271 #: FEditor.class:3148 FHelpBrowser.class:256
msgid "Go back" msgid "Go back"
msgstr "" msgstr ""
@ -1608,31 +1608,31 @@ msgstr ""
msgid "Go to line" msgid "Go to line"
msgstr "" msgstr ""
#: FHelpBrowser.class:245 #: FHelpBrowser.class:230
msgid "Help browser" msgid "Help browser"
msgstr "" msgstr ""
#: FHelpBrowser.class:278 #: FHelpBrowser.class:263
msgid "Go forward" msgid "Go forward"
msgstr "" msgstr ""
#: FHelpBrowser.class:311 FIconEditor.class:2225 #: FHelpBrowser.class:296 FIconEditor.class:2225
msgid "Zoom in" msgid "Zoom in"
msgstr "" msgstr ""
#: FHelpBrowser.class:318 FIconEditor.class:2234 #: FHelpBrowser.class:303 FIconEditor.class:2234
msgid "Zoom out" msgid "Zoom out"
msgstr "" msgstr ""
#: FHelpBrowser.class:325 #: FHelpBrowser.class:310
msgid "No zoom" msgid "No zoom"
msgstr "" msgstr ""
#: FHelpBrowser.class:337 #: FHelpBrowser.class:322
msgid "Modify documentation..." msgid "Modify documentation..."
msgstr "" msgstr ""
#: FHelpBrowser.class:345 #: FHelpBrowser.class:329
msgid "Print" msgid "Print"
msgstr "" msgstr ""

View File

@ -191,22 +191,7 @@ Public Sub btnPrint_Click()
Printer1.OutputFile = "~/print.pdf" Printer1.OutputFile = "~/print.pdf"
$bPrint = False $bPrint = False
Printer1.Run If Printer1.Configure() Then Return
If $bPrint Then webHelp.Current.Print(Printer1) webHelp.Current.Print(Printer1)
'Printer1.Run
End End
Public Sub Printer1_Begin()
$bPrint = True
Printer1.Cancel
End
Public Sub Printer1_Draw()
Debug
End

View File

@ -86,7 +86,6 @@
} }
{ btnPrint ToolButton { btnPrint ToolButton
MoveScaled(71,0,15,4) MoveScaled(71,0,15,4)
Visible = False
AutoResize = True AutoResize = True
Text = ("Print") Text = ("Print")
Picture = Picture["icon:/small/print"] Picture = Picture["icon:/small/print"]

View File

@ -4492,7 +4492,7 @@ Public Sub MakeDirectoryIcon(Optional sDir As String)
If sIcon Then If sIcon Then
Try hIcon = StretchIcon(sIcon, 16) Try hIcon = StretchIcon(sIcon, 16)
If hIcon Then hDirIcon.Draw(hIcon, 26, 47) If hIcon Then hDirIcon.Draw(hIcon, 40, 34)
Endif Endif
hDirIcon.Save(sDir &/ ".icon.png") hDirIcon.Save(sDir &/ ".icon.png")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -277,17 +277,28 @@ End
Public Sub Example11() Public Sub Example11()
Dim hImg As Image Dim X, Y, W, H As Float
hImg = Image.Load(IMAGE_NAME) Dim hBrush As PaintBrush
Dim hImage As Image
hImage = Image.Load(IMAGE_NAME)
Paint.Translate(128, 128) X = 16
'Paint.Rotate(Rad(45)) Y = 40
Paint.Scale(256.0 / hImg.W, 256.0 / hImg.H) W = 200
Paint.Translate(-0.5 * hImg.W, -0.5 * hImg.H) H = 200
Paint.Brush = Paint.Image(hImg, 0, 0)
Paint.Rectangle(0, 0, 256, 256) hBrush = Paint.Image(hImage)
hBrush.Translate(X, Y)
hBrush.Scale(W / hImage.W, H / hImage.H)
Paint.Brush = hBrush
Paint.Rectangle(X, Y, W, H)
Paint.Fill Paint.Fill
Paint.Brush = Paint.Color(Color.RGB(255, 127, 127, 153))
Paint.Arc(X, Y, 10)
Paint.Fill
End End
Public Sub Example12() Public Sub Example12()
@ -344,7 +355,7 @@ Public Sub Example14()
'Draw helping lines 'Draw helping lines
Paint.Brush = Paint.Color(Color.RGB(255, 31, 31)) Paint.Brush = Paint.Color(Color.RGB(255, 31, 31))
Paint.LineWidth = 2.56 Paint.LineWidth = 6
Paint.MoveTo(64, 50) Paint.MoveTo(64, 50)
Paint.LineTo(64, 200) Paint.LineTo(64, 200)
Paint.MoveTo(128, 50) Paint.MoveTo(128, 50)
@ -352,6 +363,7 @@ Public Sub Example14()
Paint.MoveTo(192, 50) Paint.MoveTo(192, 50)
Paint.LineTo(192, 200) Paint.LineTo(192, 200)
Paint.Stroke Paint.Stroke
End End
Public Sub Example15() Public Sub Example15()
@ -457,18 +469,20 @@ Public Sub Example20()
End End
Private $hSvgImage As SvgImage
Public Sub Example21() Public Sub Example21()
Dim hSvgImage As SvgImage If Not $hSvgImage Then
$hSvgImage = SvgImage.Load("gambas.svg")
Paint.Begin($hSvgImage)
Paint.Brush = Paint.RadialGradient(200, 140, 40, 215, 115, [Color.RGB(255, 0, 0, 64), Color.White], [1.0, 0.1])
Paint.Arc(200, 140, 40)
Paint.Fill
Paint.End
Endif
hSvgImage = SvgImage.Load("gambas.svg") $hSvgImage.Paint
Paint.Begin(hSvgImage)
Paint.Brush = Paint.RadialGradient(200, 140, 40, 215, 115, [Color.RGB(255, 0, 0, 64), Color.White], [1.0, 0.1])
Paint.Arc(200, 140, 40)
Paint.Fill
Paint.End
hSvgImage.Paint
End End

View File

@ -1,14 +1,25 @@
Public Sub Example11() Public Sub Example11()
Dim hImg As Image Dim X, Y, W, H As Float
hImg = Image.Load(IMAGE_NAME) Dim hBrush As PaintBrush
Dim hImage As Image
hImage = Image.Load(IMAGE_NAME)
Paint.Translate(128, 128) X = 16
Paint.Rotate(Rad(45)) Y = 40
Paint.Scale(256.0 / hImg.W, 256.0 / hImg.H) W = 200
Paint.Translate(-0.5 * hImg.W, -0.5 * hImg.H) H = 200
Paint.Brush = Paint.Image(hImg, 0, 0)
Paint.Rectangle(0, 0, 256, 256) hBrush = Paint.Image(hImage)
hBrush.Translate(X, Y)
hBrush.Scale(W / hImage.W, H / hImage.H)
Paint.Brush = hBrush
Paint.Rectangle(X, Y, W, H)
Paint.Fill Paint.Fill
Paint.Brush = Paint.Color(Color.RGB(255, 127, 127, 153))
Paint.Arc(X, Y, 10)
Paint.Fill
End End

View File

@ -6,7 +6,7 @@ Public Sub Example12()
hImg = Image.Load(IMAGE_NAME) hImg = Image.Load(IMAGE_NAME)
Paint.Translate(128, 128) Paint.Translate(128, 128)
Paint.Rotate(Pi / 4) 'Paint.Rotate(Pi / 4)
Paint.Scale(1 / Sqr(2), 1 / Sqr(2)) Paint.Scale(1 / Sqr(2), 1 / Sqr(2))
Paint.Translate(-128, -128) Paint.Translate(-128, -128)
hBrush = Paint.Image(himg, 0, 0) hBrush = Paint.Image(himg, 0, 0)

View File

@ -16,7 +16,7 @@ Public Sub Example14()
'Draw helping lines 'Draw helping lines
Paint.Brush = Paint.Color(Color.RGB(255, 31, 31)) Paint.Brush = Paint.Color(Color.RGB(255, 31, 31))
Paint.LineWidth = 2.56 Paint.LineWidth = 6
Paint.MoveTo(64, 50) Paint.MoveTo(64, 50)
Paint.LineTo(64, 200) Paint.LineTo(64, 200)
Paint.MoveTo(128, 50) Paint.MoveTo(128, 50)
@ -24,4 +24,5 @@ Public Sub Example14()
Paint.MoveTo(192, 50) Paint.MoveTo(192, 50)
Paint.LineTo(192, 200) Paint.LineTo(192, 200)
Paint.Stroke Paint.Stroke
End End

View File

@ -21,12 +21,15 @@ Public Sub Example17()
Paint.Fill Paint.Fill
Paint.Brush = Paint.Color(Color.RGB(255, 31, 31, 93)) Paint.Brush = Paint.Color(Color.RGB(255, 31, 31, 93))
Paint.LineWidth = 6 Paint.LineWidth = 1
Paint.Arc(X, Y, 10) Paint.Arc(X, Y, 10)
Paint.Fill Paint.Fill
Paint.MoveTo(X, Y) 'Paint.MoveTo(X, Y)
Paint.RelLineTo(0, Paint.Font.Descent - hExt.Height) 'Paint.RelLineTo(0, Paint.Font.Descent - hExt.Height)
Paint.RelLineTo(hExt.Width, 0) 'Paint.RelLineTo(hExt.Width, 0)
Paint.Stroke 'Paint.Stroke
Paint.Brush = Paint.Color(Color.RGB(255, 31, 31, 192))
Paint.Rectangle(hExt.X, hExt.Y, hExt.Width, hExt.Height)
Paint.Fill
End End

View File

@ -1,14 +1,14 @@
Public Sub Example21() Public Sub Example21()
Dim hSvgImage As SvgImage If Not $hSvgImage Then
$hSvgImage = SvgImage.Load("gambas.svg")
Paint.Begin($hSvgImage)
Paint.Brush = Paint.RadialGradient(200, 140, 40, 215, 115, [Color.RGB(255, 0, 0, 64), Color.White], [1.0, 0.1])
Paint.Arc(200, 140, 40)
Paint.Fill
Paint.End
Endif
hSvgImage = SvgImage.Load("gambas.svg") $hSvgImage.Paint
Paint.Begin(hSvgImage)
Paint.Brush = Paint.RadialGradient(200, 140, 40, 215, 115, [Color.RGB(255, 0, 0, 64), Color.White], [1.0, 0.1])
Paint.Arc(200, 140, 40)
Paint.Fill
Paint.End
hSvgImage.Paint
End End

View File

@ -40,7 +40,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE); GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -574,7 +574,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.compress", COMPRESS_INTERFACE_VERSION, &COMPRESSION); GB.GetInterface("gb.compress", COMPRESS_INTERFACE_VERSION, &COMPRESSION);
COMPRESSION.Register(&_driver); COMPRESSION.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -489,7 +489,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.compress", COMPRESS_INTERFACE_VERSION, &COMPRESSION); GB.GetInterface("gb.compress", COMPRESS_INTERFACE_VERSION, &COMPRESSION);
COMPRESSION.Register(&_driver); COMPRESSION.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -84,7 +84,7 @@ extern "C" {
return true; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -2390,7 +2390,7 @@ extern "C" {
GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB); GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB);
DB.Register(&_driver); DB.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -2504,7 +2504,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB); GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB);
DB.Register(&_driver); DB.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -2732,7 +2732,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB); GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB);
DB.Register(&_driver); DB.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -2478,7 +2478,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB); GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB);
DB.Register(&_driver); DB.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -2718,7 +2718,7 @@ extern "C"
GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB); GB.GetInterface("gb.db", DB_INTERFACE_VERSION, &DB);
DB.Register(&_driver); DB.Register(&_driver);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -43,7 +43,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
CLASS_DBusVariant = GB.FindClass("DBusVariant"); CLASS_DBusVariant = GB.FindClass("DBusVariant");
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -39,7 +39,8 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE); GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE);
return 0; // Must be not be unloaded, because libxtst registers some exit procedure called at XCloseDisplay()
return -1;
} }
void EXPORT GB_EXIT(void) void EXPORT GB_EXIT(void)

View File

@ -41,11 +41,11 @@ GB_INTERFACE GB EXPORT;
GB_DESC *GB_CLASSES[] EXPORT = GB_DESC *GB_CLASSES[] EXPORT =
{ {
CGridViewColumnDesc, CGridViewColumnDesc,
CGridViewColumnsDesc, CGridViewColumnsDesc,
CGridViewDesc, CGridViewDesc,
CPaintDesc, CPaintDesc,
CDrawDesc, CDrawDesc,
NULL NULL
}; };
@ -53,7 +53,7 @@ int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.gtk", GTK_INTERFACE_VERSION, &GTK); GB.GetInterface("gb.gtk", GTK_INTERFACE_VERSION, &GTK);
GB.GetInterface("gb.draw", DRAW_INTERFACE_VERSION, &DRAW); GB.GetInterface("gb.draw", DRAW_INTERFACE_VERSION, &DRAW);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -255,8 +255,7 @@ void gTabStripPage::setVisible(bool v)
gtk_widget_show_all(widget); gtk_widget_show_all(widget);
gtk_widget_show_all(fix); gtk_widget_show_all(fix);
//gtk_container_resize_children(GTK_CONTAINER(gtk_widget_get_parent(widget))); //gtk_container_resize_children(GTK_CONTAINER(gtk_widget_get_parent(widget)));
if (parent->isVisible()) //gtk_container_resize_children(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(widget))));
gtk_container_resize_children(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(widget))));
} }
else else
{ {

View File

@ -259,7 +259,7 @@ extern "C"
CLASS_Image = GB.FindClass("Image"); CLASS_Image = GB.FindClass("Image");
CLASS_SvgImage = GB.FindClass("SvgImage"); CLASS_SvgImage = GB.FindClass("SvgImage");
return TRUE; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -47,7 +47,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.gtk", GTK_INTERFACE_VERSION, &GTK); GB.GetInterface("gb.gtk", GTK_INTERFACE_VERSION, &GTK);
GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL); GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -38,7 +38,7 @@ int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE); GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE);
imlib_set_cache_size(0); imlib_set_cache_size(0);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -41,7 +41,7 @@ int EXPORT GB_INIT(void)
// Bug in the gdk-pixbuf documentation: the following is mandatory. // Bug in the gdk-pixbuf documentation: the following is mandatory.
g_type_init(); g_type_init();
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -39,7 +39,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -86,7 +86,7 @@ int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE); GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -41,7 +41,7 @@ int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT);
return TRUE; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -239,7 +239,7 @@ int EXPORT GB_INIT(void)
GB.Hook(GB_HOOK_MAIN, (void *)hook_main); GB.Hook(GB_HOOK_MAIN, (void *)hook_main);
old_hook_lang = GB.Hook(GB_HOOK_LANG, (void *)hook_lang); old_hook_lang = GB.Hook(GB_HOOK_LANG, (void *)hook_lang);
return TRUE; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -217,7 +217,7 @@ void FUNCTION_NAME(void *_object) //(QFrame *cont)
wc -= padding * 2; wc -= padding * 2;
hc -= padding * 2; hc -= padding * 2;
//if (!strcmp(GET_OBJECT_NAME(_object), "HBox1")) //if (!strcmp(GET_OBJECT_NAME(_object), "TabStrip1"))
// fprintf(stderr, "#0: %d %d %d %d\n", xc, yc, wc, hc); // fprintf(stderr, "#0: %d %d %d %d\n", xc, yc, wc, hc);
if (indent) if (indent)

View File

@ -82,7 +82,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT);
DRAW_init(); DRAW_init();
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -925,7 +925,7 @@ int EXPORT GB_INIT(void)
QT_InitEventLoop(); QT_InitEventLoop();
return TRUE; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -45,7 +45,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt", QT_INTERFACE_VERSION, &QT);
GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL); GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -38,6 +38,7 @@
#include "CWindow.h" #include "CWindow.h"
#include "CConst.h" #include "CConst.h"
#include "CScrollView.h" #include "CScrollView.h"
#include "CTabStrip.h"
#include "CColor.h" #include "CColor.h"
#include "CContainer.h" #include "CContainer.h"
@ -204,7 +205,22 @@ static void flush_cache()
_cache.clear(); _cache.clear();
} }
#else
#if 0
static void get_widget_contents(QWidget *wid, int &x, int &y, int &w, int &h)
{
QRect wc;
wc = wid->contentsRect();
x = wc.x();
y = wc.y();
w = wc.width();
h = wc.height();
}
#endif
#endif #endif
static void resize_container(void *_object, QWidget *cont, int w, int h) static void resize_container(void *_object, QWidget *cont, int w, int h)
@ -249,6 +265,7 @@ static void resize_container(void *_object, QWidget *cont, int w, int h)
#else #else
//#define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) get_widget_contents(_widget, _x, _y, _w, _h)
#define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) \ #define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) \
_x = (_widget)->contentsRect().x(); \ _x = (_widget)->contentsRect().x(); \
_y = (_widget)->contentsRect().y(); \ _y = (_widget)->contentsRect().y(); \
@ -276,6 +293,8 @@ static void resize_container(void *_object, QWidget *cont, int w, int h)
#define GET_OBJECT_FROM_WIDGET(_widget) CWidget::getRealExisting(_widget) #define GET_OBJECT_FROM_WIDGET(_widget) CWidget::getRealExisting(_widget)
#define GET_OBJECT_NAME(_object) (((CWIDGET *)_object)->name)
#define RAISE_ARRANGE_EVENT(_object) \ #define RAISE_ARRANGE_EVENT(_object) \
{ \ { \
GB.Raise(_object, EVENT_Arrange, 0); \ GB.Raise(_object, EVENT_Arrange, 0); \
@ -296,6 +315,8 @@ void CCONTAINER_arrange(void *_object)
{ {
if (GB.Is(THIS, CLASS_ScrollView)) if (GB.Is(THIS, CLASS_ScrollView))
CSCROLLVIEW_arrange(THIS); CSCROLLVIEW_arrange(THIS);
else if (GB.Is(THIS, CLASS_TabStrip))
CTABSTRIP_arrange(THIS);
#if DEBUG_CONTAINER #if DEBUG_CONTAINER
static int level = 0; static int level = 0;
@ -452,9 +473,12 @@ void MyContainer::showEvent(QShowEvent *e)
void *_object = CWidget::get(this); void *_object = CWidget::get(this);
QWidget::showEvent(e); QWidget::showEvent(e);
THIS->widget.flag.shown = TRUE; THIS->widget.flag.shown = TRUE;
// if (!qstrcmp(GB.GetClassName(THIS), "TabStrip"))
// {
// qDebug("MyContainer::showEvent: %s %p: SHOWN = 1 (%d %d)", THIS->widget.name, THIS, THIS->widget.widget->isVisible() , !THIS->widget.widget->isHidden());
// BREAKPOINT();
// }
CCONTAINER_arrange(THIS); CCONTAINER_arrange(THIS);
//if (!qstrcmp(GB.GetClassName(THIS), "ListContainer"))
// qDebug("MyContainer::showEvent: %s %p: SHOWN = 1 (%d %d)", THIS->widget.name, THIS, THIS->widget.widget->isVisible() , !THIS->widget.widget->isHidden());
} }
void MyContainer::hideEvent(QHideEvent *e) void MyContainer::hideEvent(QHideEvent *e)

View File

@ -42,6 +42,11 @@ DECLARE_METHOD(CCONTAINER_y);
DECLARE_EVENT(EVENT_Click); DECLARE_EVENT(EVENT_Click);
void CTABSTRIP_arrange(void *_object)
{
WIDGET->forceLayout();
}
/** CTab *****************************************************************/ /** CTab *****************************************************************/
class CTab class CTab
@ -335,7 +340,6 @@ BEGIN_METHOD(CTABSTRIP_new, GB_OBJECT parent)
CWIDGET_new(wid, (void *)_object, true); CWIDGET_new(wid, (void *)_object, true);
set_tab_count(THIS, 1); set_tab_count(THIS, 1);
wid->show();
//wid->updateLayout(); //wid->updateLayout();
@ -726,15 +730,13 @@ void CTabStrip::currentChanged(int index)
wid = WIDGET->currentWidget(); wid = WIDGET->currentWidget();
//qDebug("CTabStrip::currentChanged: %d %p -> %p", index, THIS->container, wid);
if (wid != THIS->container) if (wid != THIS->container)
{ {
//qDebug("CTabStrip::currentChanged: %d %p -> %p", index, THIS->container, wid);
if (THIS->container) if (THIS->container)
THIS->container->hide(); THIS->container->hide();
THIS->container = wid; THIS->container = wid;
wid->show(); wid->show();
WIDGET->forceLayout();
CCONTAINER_arrange(THIS); CCONTAINER_arrange(THIS);
//if (wid->isVisible() && !THIS->lock) //if (wid->isVisible() && !THIS->lock)
@ -789,14 +791,12 @@ GB_DESC CTabStripDesc[] =
GB_PROPERTY("Orientation", "i", CTABSTRIP_orientation), GB_PROPERTY("Orientation", "i", CTABSTRIP_orientation),
GB_PROPERTY("Enabled", "b", CTABSTRIP_enabled), GB_PROPERTY("Enabled", "b", CTABSTRIP_enabled),
#ifdef GB_QT_COMPONENT
GB_PROPERTY_READ("ClientX", "i", CTABSTRIP_client_x), GB_PROPERTY_READ("ClientX", "i", CTABSTRIP_client_x),
GB_PROPERTY_READ("ClientY", "i", CTABSTRIP_client_y), GB_PROPERTY_READ("ClientY", "i", CTABSTRIP_client_y),
GB_PROPERTY_READ("ClientW", "i", CTABSTRIP_client_width), GB_PROPERTY_READ("ClientW", "i", CTABSTRIP_client_width),
GB_PROPERTY_READ("ClientWidth", "i", CTABSTRIP_client_width), GB_PROPERTY_READ("ClientWidth", "i", CTABSTRIP_client_width),
GB_PROPERTY_READ("ClientH", "i", CTABSTRIP_client_height), GB_PROPERTY_READ("ClientH", "i", CTABSTRIP_client_height),
GB_PROPERTY_READ("ClientHeight", "i", CTABSTRIP_client_height), GB_PROPERTY_READ("ClientHeight", "i", CTABSTRIP_client_height),
#endif
GB_PROPERTY("Arrangement", "i", CCONTAINER_arrangement), GB_PROPERTY("Arrangement", "i", CCONTAINER_arrangement),
GB_PROPERTY("AutoResize", "b", CCONTAINER_auto_resize), GB_PROPERTY("AutoResize", "b", CCONTAINER_auto_resize),

View File

@ -99,4 +99,6 @@ public slots:
void currentChanged(int); void currentChanged(int);
}; };
void CTABSTRIP_arrange(void *_object);
#endif #endif

View File

@ -263,7 +263,7 @@ void CWIDGET_new(QWidget *w, void *_object, bool no_show, bool no_filter, bool n
if (!no_show) if (!no_show)
{ {
w->setGeometry(-16, -16, 16, 16); w->setGeometry(-32, -32, 32, 32);
CWIDGET_set_visible(THIS, true); CWIDGET_set_visible(THIS, true);
w->raise(); w->raise();
} }

View File

@ -318,23 +318,26 @@ static void Stroke(GB_PAINT *d, int preserve)
{ {
CHECK_PATH(d); CHECK_PATH(d);
if (!CLIP(d)) if (PAINTER(d)->pen().widthF() > 0.0)
PAINTER(d)->strokePath(*PATH(d), PAINTER(d)->pen());
else
{ {
QPainterPathStroker stroker; if (!CLIP(d))
QPen pen = PAINTER(d)->pen(); PAINTER(d)->strokePath(*PATH(d), PAINTER(d)->pen());
else
stroker.setCapStyle(pen.capStyle()); {
stroker.setDashOffset(pen.dashOffset()); QPainterPathStroker stroker;
stroker.setDashPattern(pen.dashPattern()); QPen pen = PAINTER(d)->pen();
stroker.setJoinStyle(pen.joinStyle());
stroker.setMiterLimit(pen.miterLimit()); stroker.setCapStyle(pen.capStyle());
stroker.setWidth(pen.widthF()); stroker.setDashOffset(pen.dashOffset());
stroker.setDashPattern(pen.dashPattern());
QPainterPath path = PAINTER(d)->worldTransform().inverted().map(*CLIP(d)); stroker.setJoinStyle(pen.joinStyle());
path = path.intersected(stroker.createStroke(*PATH(d))); stroker.setMiterLimit(pen.miterLimit());
PAINTER(d)->fillPath(path, PAINTER(d)->brush()); stroker.setWidth(pen.widthF());
QPainterPath path = PAINTER(d)->worldTransform().inverted().map(*CLIP(d));
path = path.intersected(stroker.createStroke(*PATH(d)));
PAINTER(d)->fillPath(path, PAINTER(d)->brush());
}
} }
PRESERVE_PATH(d, preserve); PRESERVE_PATH(d, preserve);

View File

@ -79,7 +79,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT);
DRAW_init(); DRAW_init();
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -129,6 +129,7 @@ GB_CLASS CLASS_Control;
GB_CLASS CLASS_Container; GB_CLASS CLASS_Container;
GB_CLASS CLASS_UserControl; GB_CLASS CLASS_UserControl;
GB_CLASS CLASS_UserContainer; GB_CLASS CLASS_UserContainer;
GB_CLASS CLASS_TabStrip;
GB_CLASS CLASS_Window; GB_CLASS CLASS_Window;
GB_CLASS CLASS_Menu; GB_CLASS CLASS_Menu;
GB_CLASS CLASS_Picture; GB_CLASS CLASS_Picture;
@ -1025,6 +1026,7 @@ int EXPORT GB_INIT(void)
CLASS_Container = GB.FindClass("Container"); CLASS_Container = GB.FindClass("Container");
CLASS_UserControl = GB.FindClass("UserControl"); CLASS_UserControl = GB.FindClass("UserControl");
CLASS_UserContainer = GB.FindClass("UserContainer"); CLASS_UserContainer = GB.FindClass("UserContainer");
CLASS_TabStrip = GB.FindClass("TabStrip");
CLASS_Window = GB.FindClass("Window"); CLASS_Window = GB.FindClass("Window");
CLASS_Menu = GB.FindClass("Menu"); CLASS_Menu = GB.FindClass("Menu");
CLASS_Picture = GB.FindClass("Picture"); CLASS_Picture = GB.FindClass("Picture");
@ -1037,7 +1039,7 @@ int EXPORT GB_INIT(void)
QT_InitEventLoop(); QT_InitEventLoop();
return TRUE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -49,6 +49,7 @@ extern GB_CLASS CLASS_Control;
extern GB_CLASS CLASS_Container; extern GB_CLASS CLASS_Container;
extern GB_CLASS CLASS_UserControl; extern GB_CLASS CLASS_UserControl;
extern GB_CLASS CLASS_UserContainer; extern GB_CLASS CLASS_UserContainer;
extern GB_CLASS CLASS_TabStrip;
extern GB_CLASS CLASS_Window; extern GB_CLASS CLASS_Window;
extern GB_CLASS CLASS_Menu; extern GB_CLASS CLASS_Menu;
extern GB_CLASS CLASS_Picture; extern GB_CLASS CLASS_Picture;

View File

@ -43,7 +43,7 @@ int EXPORT GB_INIT(void)
GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT);
GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL); GB.GetInterface("gb.opengl", GL_INTERFACE_VERSION, &GL);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -362,6 +362,7 @@ GB_DESC CWebViewDesc[] =
MyWebView::MyWebView(QWidget *parent) : QWebView(parent) MyWebView::MyWebView(QWidget *parent) : QWebView(parent)
{ {
//settings()->setFontFamily(QWebSettings::FixedFont, "monospace");
} }
QWebView *MyWebView::createWindow(QWebPage::WebWindowType type) QWebView *MyWebView::createWindow(QWebPage::WebWindowType type)

View File

@ -54,7 +54,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT); GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -74,7 +74,7 @@ int EXPORT GB_INIT(void)
SOUND_init(); SOUND_init();
return 1; return -1;
} }

View File

@ -88,7 +88,7 @@ extern "C"
CLASS_Image = GB.FindClass("Image"); CLASS_Image = GB.FindClass("Image");
CLASS_Font = GB.FindClass("Font"); CLASS_Font = GB.FindClass("Font");
return true; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -58,7 +58,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
return 1; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -32,16 +32,14 @@ GB_INTERFACE GB EXPORT;
GB_DESC *GB_CLASSES[] EXPORT = GB_DESC *GB_CLASSES[] EXPORT =
{ {
CXsltDesc, CXsltDesc,
NULL NULL
}; };
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
return 1; return -1;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -54,7 +54,7 @@
#include "gbx_component.h" #include "gbx_component.h"
/*#define DEBUG*/ //#define DEBUG_COMP
/*#define DEBUG_PRELOAD*/ /*#define DEBUG_PRELOAD*/
COMPONENT *COMPONENT_current = NULL; COMPONENT *COMPONENT_current = NULL;
@ -76,9 +76,29 @@ void COMPONENT_init(void)
void COMPONENT_exit(void) void COMPONENT_exit(void)
{ {
COMPONENT *comp; COMPONENT *comp;
int order;
int max_order = 0;
LIST_for_each(comp, _component_list) LIST_for_each(comp, _component_list)
COMPONENT_unload(comp); {
if (comp->order > max_order)
max_order = comp->order;
}
for (order = 0; order <= max_order; order++)
{
LIST_for_each(comp, _component_list)
{
if (comp->order == order)
COMPONENT_unload(comp);
}
}
LIST_for_each(comp, _component_list)
{
if (comp->loaded)
COMPONENT_unload(comp);
}
while (_component_list) while (_component_list)
COMPONENT_delete(_component_list); COMPONENT_delete(_component_list);
@ -245,7 +265,7 @@ void COMPONENT_load(COMPONENT *comp)
COMPONENT_current = comp; COMPONENT_current = comp;
if (comp->library) if (comp->library)
LIBRARY_load(comp->library); comp->order = LIBRARY_load(comp->library);
if (comp->archive) if (comp->archive)
ARCHIVE_load(comp->archive); ARCHIVE_load(comp->archive);
@ -256,12 +276,21 @@ void COMPONENT_load(COMPONENT *comp)
void COMPONENT_unload(COMPONENT *comp) void COMPONENT_unload(COMPONENT *comp)
{ {
if (!comp->loaded)
return;
#if DEBUG_COMP
fprintf(stderr, "Unloading component %s [%d]\n", comp->name, comp->order);
#endif
if (comp->library) if (comp->library)
LIBRARY_unload(comp->library); LIBRARY_unload(comp->library);
/* Do not exist yet */ /* Do not exist yet */
//if (comp->archive) //if (comp->archive)
// ARCHIVE_unload(comp->archive); // ARCHIVE_unload(comp->archive);
comp->loaded = FALSE;
} }

View File

@ -38,11 +38,12 @@ typedef
char *name; char *name;
LIBRARY *library; LIBRARY *library;
ARCHIVE *archive; ARCHIVE *archive;
char order;
unsigned preload : 1; unsigned preload : 1;
unsigned loaded : 1; unsigned loaded : 1;
unsigned user : 1; unsigned user : 1;
unsigned warning : 1; // Set when the bytecode warning was displayed by the class loader for this component unsigned warning : 1; // Set when the bytecode warning was displayed by the class loader for this component
unsigned _reserved : 28; unsigned _reserved : 20;
} }
PACKED PACKED
COMPONENT; COMPONENT;

View File

@ -438,15 +438,16 @@ void LIBRARY_delete(LIBRARY *lib)
} }
void LIBRARY_load(LIBRARY *lib) int LIBRARY_load(LIBRARY *lib)
{ {
int (*func)(); int (*func)();
void **iface; void **iface;
GB_DESC **desc; GB_DESC **desc;
char *path; char *path;
int order = 0;
if (lib->handle) if (lib->handle)
return; return 0;
#ifdef DEBUG #ifdef DEBUG
clock_t t = clock(); clock_t t = clock();
@ -489,8 +490,9 @@ void LIBRARY_load(LIBRARY *lib)
lib->info = (int(*)())get_symbol(lib, LIB_INFO, FALSE); lib->info = (int(*)())get_symbol(lib, LIB_INFO, FALSE);
/* Initialisation */ /* Initialisation */
lib->persistent = (bool)(*func)(); order = (*func)();
lib->persistent = order < 0;
/* Déclaration des classes */ /* Déclaration des classes */
desc = get_symbol(lib, LIB_CLASS, FALSE); desc = get_symbol(lib, LIB_CLASS, FALSE);
if (desc) if (desc)
@ -500,6 +502,8 @@ void LIBRARY_load(LIBRARY *lib)
fprintf(stderr, "Library %s loaded ", lib->name); fprintf(stderr, "Library %s loaded ", lib->name);
fprintf(stderr, "in %g s\n", ((double)(clock() - t) / CLOCKS_PER_SEC)); fprintf(stderr, "in %g s\n", ((double)(clock() - t) / CLOCKS_PER_SEC));
#endif #endif
return order;
} }

View File

@ -64,7 +64,7 @@ void LIBRARY_exit(void);
LIBRARY *LIBRARY_create(const char *path); LIBRARY *LIBRARY_create(const char *path);
void LIBRARY_delete(LIBRARY *lib); void LIBRARY_delete(LIBRARY *lib);
void LIBRARY_load(LIBRARY *lib); int LIBRARY_load(LIBRARY *lib);
void LIBRARY_unload(LIBRARY *lib); void LIBRARY_unload(LIBRARY *lib);
void LIBRARY_declare(GB_DESC **desc); void LIBRARY_declare(GB_DESC **desc);

View File

@ -54,7 +54,7 @@ void *GB_DEBUG_1[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -694,7 +694,7 @@ BEGIN_METHOD(Paint_Image, GB_OBJECT image; GB_FLOAT x; GB_FLOAT y)
{ {
GB_TRANSFORM transform; GB_TRANSFORM transform;
PAINT->Transform.Create(&transform); PAINT->Transform.Create(&transform);
PAINT->Transform.Translate(transform, -VARGOPT(x, 0.0), -VARGOPT(y, 0.0)); PAINT->Transform.Translate(transform, VARGOPT(x, 0.0), VARGOPT(y, 0.0));
PAINT->Brush.Matrix(brush, TRUE, transform); PAINT->Brush.Matrix(brush, TRUE, transform);
PAINT->Transform.Delete(&transform); PAINT->Transform.Delete(&transform);
} }

View File

@ -65,7 +65,7 @@ int EXPORT GB_INIT(void)
{ {
EVAL_init(); EVAL_init();
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -64,7 +64,7 @@ int EXPORT GB_INIT(void)
if (GB.LoadComponent(comp)) if (GB.LoadComponent(comp))
fprintf(stderr, "gb.gui: unable to load '%s' component\n", comp); fprintf(stderr, "gb.gui: unable to load '%s' component\n", comp);
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()

View File

@ -71,7 +71,7 @@ void *GB_IMAGE_1[] EXPORT =
int EXPORT GB_INIT(void) int EXPORT GB_INIT(void)
{ {
return FALSE; return 0;
} }
void EXPORT GB_EXIT() void EXPORT GB_EXIT()