[DEVELOPMENT ENVIRONMENT]

* BUG: Don't show '$' in the dependencies combo-box of the component 
  property dialog.

[INTERPRETER]
* NEW: GB.Every() is a new API that allows a component to call a callback
  regularly. Useful for polling something for example.


git-svn-id: svn://localhost/gambas/trunk@3429 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-01-02 17:09:54 +00:00
parent 61acd2084d
commit 3ead02082c
10 changed files with 89 additions and 37 deletions

View File

@ -134,7 +134,7 @@ msgstr ""
msgid "Image routines from the Imlib2 library"
msgstr ""
#: CComponent.class:108 FPropertyComponent.class:388
#: CComponent.class:108 FPropertyComponent.class:390
msgid "Image loading and saving"
msgstr ""
@ -242,15 +242,15 @@ msgstr ""
msgid "Web applications tools"
msgstr ""
#: CComponent.class:140 FPropertyComponent.class:376
#: CComponent.class:140 FPropertyComponent.class:378
msgid "Graphical form management"
msgstr ""
#: CComponent.class:141 FPropertyComponent.class:382
#: CComponent.class:141 FPropertyComponent.class:384
msgid "Event loop management"
msgstr ""
#: CComponent.class:143 FPropertyComponent.class:394
#: CComponent.class:143 FPropertyComponent.class:396
msgid "OpenGL display"
msgstr ""
@ -262,7 +262,7 @@ msgstr ""
msgid "Experimental"
msgstr ""
#: CComponentBox.class:215 FPropertyComponent.class:323
#: CComponentBox.class:215 FPropertyComponent.class:325
msgid "Not finished but stable"
msgstr ""
@ -270,7 +270,7 @@ msgstr ""
msgid "Authors"
msgstr ""
#: CComponentBox.class:230 FPropertyComponent.class:356
#: CComponentBox.class:230 FPropertyComponent.class:358
msgid "Requires"
msgstr ""
@ -393,7 +393,7 @@ msgstr ""
#: FConnectionEditor.class:411 FCreateFile.class:922 FFontChooser.class:79
#: FGotoLine.class:57 FList.class:331 FMain.class:1677 FMenu.class:1238
#: FNewConnection.class:573 FNewTable.class:159 FNewTranslation.class:64
#: FOpenProject.class:496 FPasteSpecial.class:273 FPropertyComponent.class:465
#: FOpenProject.class:496 FPasteSpecial.class:273 FPropertyComponent.class:467
#: FPropertyProject.class:252 FReportBorderChooser.class:213
#: FReportCoordChooser.class:120 FSaveProjectAs.class:124
#: FSelectExtraFile.class:72 FSelectIcon.class:268 FSnippet.class:136
@ -479,7 +479,7 @@ msgstr ""
#: FImportTable.class:39 FList.class:155 FMain.class:193
#: FMakeInstall.class:326 FMenu.class:1243 FNewConnection.class:317
#: FNewTable.class:165 FNewTranslation.class:70 FOpenProject.class:502
#: FOption.class:600 FPasteSpecial.class:279 FPropertyComponent.class:471
#: FOption.class:600 FPasteSpecial.class:279 FPropertyComponent.class:473
#: FPropertyProject.class:801 FReportBorderChooser.class:207
#: FReportCoordChooser.class:114 FSave.class:118 FSaveProjectAs.class:130
#: FSelectExtraFile.class:78 FSelectIcon.class:273 FSnippet.class:142
@ -951,7 +951,7 @@ msgid "Style sheet"
msgstr ""
#: FCreateFile.class:791 FCreateProject.class:535 FImportTable.class:526
#: FPropertyComponent.class:306 FPropertyProject.class:1372
#: FPropertyComponent.class:308 FPropertyProject.class:1372
msgid "Options"
msgstr ""
@ -1208,7 +1208,7 @@ msgstr ""
msgid "Add expression"
msgstr ""
#: FDebugInfo.class:1231 FMakeInstall.class:1655 FPropertyComponent.class:434
#: FDebugInfo.class:1231 FMakeInstall.class:1655 FPropertyComponent.class:436
msgid "&Add"
msgstr ""
@ -1217,7 +1217,7 @@ msgid "Remove current expression"
msgstr ""
#: FDebugInfo.class:1239 FMain.class:2661 FMakeInstall.class:1661
#: FOption.class:1581 FPropertyComponent.class:440 FPropertyProject.class:1586
#: FOption.class:1581 FPropertyComponent.class:442 FPropertyProject.class:1586
msgid "&Remove"
msgstr ""
@ -1973,7 +1973,7 @@ msgstr ""
msgid "This file has not been modified since the last commit."
msgstr ""
#: FInfo.class:305 FOption.class:948 FPropertyComponent.class:293
#: FInfo.class:305 FOption.class:948 FPropertyComponent.class:295
#: FPropertyProject.class:1283
msgid "General"
msgstr ""
@ -2386,7 +2386,7 @@ msgstr ""
msgid "Project properties"
msgstr ""
#: FMain.class:2796 FPropertyComponent.class:279
#: FMain.class:2796 FPropertyComponent.class:281
msgid "Component properties"
msgstr ""
@ -3091,11 +3091,11 @@ msgstr ""
msgid "Sort properties"
msgstr ""
#: FOption.class:1028 FPropertyComponent.class:340 FPropertyProject.class:1425
#: FOption.class:1028 FPropertyComponent.class:342 FPropertyProject.class:1425
msgid "No"
msgstr ""
#: FOption.class:1028 FPropertyComponent.class:340 FPropertyProject.class:1425
#: FOption.class:1028 FPropertyComponent.class:342 FPropertyProject.class:1425
msgid "Yes"
msgstr ""
@ -3350,35 +3350,35 @@ msgstr ""
msgid "Cannot write component description file."
msgstr ""
#: FPropertyComponent.class:316
#: FPropertyComponent.class:318
msgid "Component advancement"
msgstr ""
#: FPropertyComponent.class:323
#: FPropertyComponent.class:325
msgid "Finished and stable"
msgstr ""
#: FPropertyComponent.class:323
#: FPropertyComponent.class:325
msgid "Beta version"
msgstr ""
#: FPropertyComponent.class:334
#: FPropertyComponent.class:336
msgid "This component is hidden"
msgstr ""
#: FPropertyComponent.class:347
#: FPropertyComponent.class:349
msgid "Exported classes"
msgstr ""
#: FPropertyComponent.class:361
#: FPropertyComponent.class:363
msgid "Features"
msgstr ""
#: FPropertyComponent.class:402 FPropertyProject.class:1637
#: FPropertyComponent.class:404 FPropertyProject.class:1637
msgid "Components"
msgstr ""
#: FPropertyComponent.class:446
#: FPropertyComponent.class:448
msgid "Remove All"
msgstr ""

View File

@ -162,6 +162,8 @@ Private Sub ReadComponent()
ReadComponentFile
For Each hComp In CComponent.All
If hComp.Hidden Then Continue
If hComp.Key = CComponent.PROJECT_NAME Then Continue
If hComp.Key = Project.Name Then Continue
If hComp.Key = "gb" Then Continue
aComp.Add(hComp.Key)

View File

@ -775,7 +775,6 @@ static void hook_post(void)
static void hook_quit()
{
QWidgetList list;
QWidget *w;
int i;
//qApp->closeAllWindows();
@ -783,10 +782,10 @@ static void hook_quit()
list = QApplication::topLevelWidgets();
for (i = 0; i < list.count(); i++)
{
w = list.at(i);
w->close();
}
list.at(i)->close();
for (i = 0; i < list.count(); i++)
list.at(i)->deleteLater();
}

View File

@ -86,6 +86,7 @@ void *GAMBAS_Api[] =
(void *)WATCH_one_loop,
(void *)EVENT_post,
(void *)EVENT_post2,
(void *)CTIMER_every,
(void *)GB_Raise,
(void *)EVENT_post_event,
(void *)EVENT_check_post,

View File

@ -44,11 +44,32 @@ static void enable_timer(CTIMER *_object, bool on)
GB_Error("Too many active timers");
}
CTIMER *CTIMER_every(int delay, GB_TIMER_CALLBACK callback)
{
CTIMER *timer;
timer = OBJECT_create_native(CLASS_Timer, NULL);
OBJECT_REF(timer, "CTIMER_every");
timer->callback = callback;
timer->delay = delay;
enable_timer(timer, TRUE);
return timer;
}
void CTIMER_raise(void *_object)
{
if (GB_Raise(THIS, EVENT_Timer, 0))
enable_timer(THIS, FALSE);
if (THIS->callback)
{
if (!(*(THIS->callback))())
return;
}
else
{
if (!GB_Raise(THIS, EVENT_Timer, 0))
return;
}
enable_timer(THIS, FALSE);
}

View File

@ -39,5 +39,6 @@ extern GB_DESC NATIVE_Timer[];
#endif
void CTIMER_raise(void *_object);
CTIMER *CTIMER_every(int delay, GB_TIMER_CALLBACK callback);
#endif

View File

@ -378,6 +378,7 @@ EXTERN CLASS *CLASS_Application;
EXTERN CLASS *CLASS_Process;
EXTERN CLASS *CLASS_Component;
EXTERN CLASS *CLASS_Observer;
EXTERN CLASS *CLASS_Timer;
EXTERN CLASS *CLASS_BooleanArray;
EXTERN CLASS *CLASS_ByteArray;

View File

@ -57,7 +57,7 @@ CLASS *CLASS_AppEnv = NULL;
CLASS *CLASS_Process = NULL;
CLASS *CLASS_Component = NULL;
CLASS *CLASS_Observer = NULL;
//CLASS *CLASS_Proxy = NULL;
CLASS *CLASS_Timer = NULL;
CLASS *CLASS_Array = NULL;
CLASS *CLASS_BooleanArray = NULL;
@ -110,7 +110,7 @@ static const CLASS_INIT init_list[] =
{ NATIVE_System, NULL },
{ NATIVE_User, NULL },
{ NATIVE_String, NULL },
{ NATIVE_Timer, NULL },
{ NATIVE_Timer, &CLASS_Timer },
{ NATIVE_Observer, &CLASS_Observer },
//{ NATIVE_Proxy, &CLASS_Proxy },

View File

@ -235,12 +235,25 @@ END_METHOD
BEGIN_METHOD(CDEBUG_write, GB_STRING data)
const char *data = STRING(data);
int len = LENGTH(data);
if (_fdw < 0)
return;
if (STRING(data))
write(_fdw, STRING(data), LENGTH(data));
write(_fdw, "\n", 1);
if (data && len > 0)
{
if (write(_fdw, data, len) != len)
goto __ERROR;
}
if (write(_fdw, "\n", 1) != 1)
goto __ERROR;
return;
__ERROR:
fprintf(stderr, "gb.debug: warning: unable to send data to the debugger: %s\n", strerror(errno));
END_METHOD

View File

@ -566,6 +566,12 @@ typedef
#define GB_WATCH_WRITE 2
/* Type of a generic callback */
typedef
void (*GB_CALLBACK)();
/* Type of a watch callback function */
typedef
@ -590,6 +596,12 @@ typedef
void (*GB_BROWSE_CALLBACK)(const char *, int64_t);
/* Type of a timer callback */
typedef
int (*GB_TIMER_CALLBACK)();
/* Type of a posted function */
typedef
@ -751,6 +763,7 @@ typedef
intptr_t id;
intptr_t tag;
int delay;
GB_TIMER_CALLBACK callback;
}
GB_TIMER;
@ -781,8 +794,9 @@ typedef
void *(*GetClassInterface)(GB_CLASS, const char *);
int (*Loop)(int);
void (*Post)(void (*)(), intptr_t);
void (*Post2)(void (*)(), intptr_t, intptr_t);
void (*Post)(GB_CALLBACK, intptr_t);
void (*Post2)(GB_CALLBACK, intptr_t, intptr_t);
GB_TIMER *(*Every)(int, GB_TIMER_CALLBACK);
int (*Raise)(void *, int, int, ...);
void (*RaiseLater)(void *, int);
void (*CheckPost)(void);