[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
This commit is contained in:
parent
a05c17d9cc
commit
efb2659278
@ -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 ""
|
||||
|
@ -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 = "<b>" & MakeErrorMessage(aData[1]) & "</b><p>" & 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 = "<b>" & MakeErrorMessage(aData[1]) & "</b>"
|
||||
If sClass Then $sError &= "<p>" & 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)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
@ -1,8 +1,10 @@
|
||||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.0 (r2498)
|
||||
Startup=FNotepad
|
||||
Icon=notepad.png
|
||||
Version=0.0.1
|
||||
Library=gb.gui
|
||||
Component=gb.gui
|
||||
Environment="GB_GUI=gb.qt4"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=fr
|
||||
|
@ -1,25 +1,25 @@
|
||||
' Gambas class file
|
||||
|
||||
|
||||
STATIC PUBLIC SUB Run()
|
||||
Static Public Sub Run()
|
||||
|
||||
DIM hForm AS Form
|
||||
Dim hForm As Form
|
||||
|
||||
hForm = NEW FAbout
|
||||
hForm = New FAbout
|
||||
hForm.ShowModal
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB _new()
|
||||
Public Sub _new()
|
||||
|
||||
ME.Center
|
||||
Me.Center
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB btnOK_Click()
|
||||
Public Sub btnOK_Click()
|
||||
|
||||
ME.Close
|
||||
Me.Close
|
||||
|
||||
END
|
||||
End
|
||||
|
@ -1,224 +1,225 @@
|
||||
' Gambas class file
|
||||
|
||||
PRIVATE $sPath AS String
|
||||
PRIVATE $bModify AS Boolean
|
||||
Private $sPath As String
|
||||
Private $bModify As Boolean
|
||||
|
||||
STATIC PUBLIC SUB Main()
|
||||
Static Public Sub Main()
|
||||
|
||||
DIM hForm AS Form
|
||||
Dim hForm As Form
|
||||
|
||||
hForm = NEW FNotepad
|
||||
hForm = New FNotepad
|
||||
hForm.Show
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB _new()
|
||||
Public Sub _new()
|
||||
|
||||
txtNotepad.Text = ""
|
||||
$bModify = FALSE
|
||||
$bModify = False
|
||||
RefreshTitle
|
||||
txtNotePad.SetFocus
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE FUNCTION GetName() AS String
|
||||
Private Function GetName() As String
|
||||
|
||||
IF $sPath THEN RETURN $sPath
|
||||
If $sPath Then Return $sPath
|
||||
|
||||
RETURN "(New document)"
|
||||
Return "(New document)"
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE SUB RefreshTitle()
|
||||
Private Sub RefreshTitle()
|
||||
|
||||
DIM sTitle AS String
|
||||
Dim sTitle As String
|
||||
|
||||
IF $bModify THEN sTitle = "*"
|
||||
If $bModify Then sTitle = "*"
|
||||
sTitle = sTitle & GetName()
|
||||
|
||||
ME.Title = sTitle
|
||||
Me.Title = sTitle
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE SUB SetPath(sPath AS String)
|
||||
Private Sub SetPath(sPath As String)
|
||||
|
||||
$sPath = sPath
|
||||
RefreshTitle
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB SetModify(bModify AS Boolean)
|
||||
Private Sub SetModify(bModify As Boolean)
|
||||
|
||||
IF $bModify = bModify THEN RETURN
|
||||
If $bModify = bModify Then Return
|
||||
$bModify = bModify
|
||||
RefreshTitle
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE FUNCTION CloseDoc() AS Boolean
|
||||
Private Function CloseDoc() As Boolean
|
||||
|
||||
IF $bModify THEN
|
||||
SELECT CASE Message.Question(GetName() & "\n\nFile has been modified. Do you want to save it ?", "Yes", "No", "Cancel")
|
||||
CASE 1
|
||||
If $bModify Then
|
||||
Select Case Message.Question(GetName() & "\n\nFile has been modified. Do you want to save it ?", "Yes", "No", "Cancel")
|
||||
Case 1
|
||||
Save
|
||||
CASE 3
|
||||
RETURN TRUE
|
||||
END SELECT
|
||||
ENDIF
|
||||
Case 3
|
||||
Return True
|
||||
End Select
|
||||
Endif
|
||||
|
||||
$sPath = ""
|
||||
txtNotepad.Text = ""
|
||||
$bModify = FALSE
|
||||
$bModify = False
|
||||
RefreshTitle
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
|
||||
PUBLIC SUB Load(sPath AS String)
|
||||
Public Sub LoadFile(sPath As String)
|
||||
|
||||
DIM sData AS String
|
||||
Dim sData As String
|
||||
|
||||
IF CloseDoc() THEN RETURN
|
||||
If CloseDoc() Then Return
|
||||
|
||||
sData = File.Load(sPath)
|
||||
txtNotepad.Text = Conv(sData, System.Charset, Desktop.Charset)
|
||||
$bModify = FALSE
|
||||
Try txtNotepad.Text = Conv(sData, System.Charset, Desktop.Charset)
|
||||
If Error Then txtNotepad.Text = Conv(sData, "ISO_8859-1", Desktop.Charset)
|
||||
$bModify = False
|
||||
SetPath(sPath)
|
||||
|
||||
CATCH
|
||||
Catch
|
||||
|
||||
Message.Error(sPath & "\nUnable to load file.\n" & Error.Text)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB Save(OPTIONAL bSaveAs AS Boolean)
|
||||
Public Sub Save(Optional bSaveAs As Boolean)
|
||||
|
||||
IF bSaveAs OR NOT $sPath THEN
|
||||
IF Dialog.SaveFile() THEN RETURN
|
||||
If bSaveAs Or Not $sPath Then
|
||||
If Dialog.SaveFile() Then Return
|
||||
SetPath(Dialog.Path)
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
File.Save($sPath, txtNotepad.Text)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuOpen_Click()
|
||||
Public Sub mnuOpen_Click()
|
||||
|
||||
DIM sPath AS String
|
||||
Dim sPath As String
|
||||
|
||||
Dialog.Filter = ["*", "All files", "*.{c;cpp;h}", "C/C++ files", "*.txt", "Text files", "*.desktop", "Desktop files"]
|
||||
|
||||
IF Dialog.OpenFile() THEN RETURN
|
||||
Load(Dialog.Path)
|
||||
If Dialog.OpenFile() Then Return
|
||||
LoadFile(Dialog.Path)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuSave_Click()
|
||||
Public Sub mnuSave_Click()
|
||||
|
||||
Save
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuSaveAs_Click()
|
||||
Public Sub mnuSaveAs_Click()
|
||||
|
||||
Save(TRUE)
|
||||
Save(True)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuQuit_Click()
|
||||
Public Sub mnuQuit_Click()
|
||||
|
||||
ME.Close
|
||||
Me.Close
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB txtNotepad_Change()
|
||||
Public Sub txtNotepad_Change()
|
||||
|
||||
SetModify(TRUE)
|
||||
SetModify(True)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuClose_Click()
|
||||
Public Sub mnuClose_Click()
|
||||
|
||||
CloseDoc
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB Form_Close()
|
||||
Public Sub Form_Close()
|
||||
|
||||
IF CloseDoc() THEN STOP EVENT
|
||||
If CloseDoc() Then Stop Event
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuAbout_Click()
|
||||
Public Sub mnuAbout_Click()
|
||||
|
||||
INC Application.Busy
|
||||
'Inc Application.Busy
|
||||
FAbout.Run
|
||||
DEC Application.Busy
|
||||
'Dec Application.Busy
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuCopy_Click()
|
||||
Public Sub mnuCopy_Click()
|
||||
|
||||
txtNotepad.Copy
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuPaste_Click()
|
||||
Public Sub mnuPaste_Click()
|
||||
|
||||
txtNotepad.Paste
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuCut_Click()
|
||||
Public Sub mnuCut_Click()
|
||||
|
||||
txtNotepad.Cut
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuUndo_Click()
|
||||
Public Sub mnuUndo_Click()
|
||||
|
||||
txtNotepad.Undo
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuRedo_Click()
|
||||
Public Sub mnuRedo_Click()
|
||||
|
||||
txtNotepad.Redo
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB mnuFont_Click()
|
||||
Public Sub mnuFont_Click()
|
||||
|
||||
Dialog.Font = txtNotepad.Font
|
||||
IF Dialog.SelectFont() THEN RETURN
|
||||
If Dialog.SelectFont() Then Return
|
||||
txtNotepad.Font = Dialog.Font
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB mnuWrap_Click()
|
||||
Public Sub mnuWrap_Click()
|
||||
|
||||
mnuWrap.Checked = NOT mnuWrap.Checked
|
||||
mnuWrap.Checked = Not mnuWrap.Checked
|
||||
txtNotePad.Wrap = mnuWrap.Checked
|
||||
|
||||
END
|
||||
End
|
||||
|
@ -901,7 +901,9 @@ void CLASS_make_description(CLASS *class, CLASS_DESC *desc, int n_desc, int *fir
|
||||
|
||||
if (check_override(parent_type, type))
|
||||
{
|
||||
#if DEBUG_DESC
|
||||
fprintf(stderr, "type = '%c' parent_type = '%c'\n", type, parent_type);
|
||||
#endif
|
||||
THROW(E_OVERRIDE, parent->name, cds->name, class->name);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "gb_common.h"
|
||||
#include "CDraw.h"
|
||||
#include "cpaint.h"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user