516 lines
11 KiB
C++
Raw Normal View History

/***************************************************************************
main.cpp
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
GTK+ component
Realizado para la Junta de Extremadura.
Consejería de Educación Ciencia y Tecnología.
Proyecto gnuLinEx
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 1, 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.
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.
***************************************************************************/
#define __MAIN_C
#include <stdio.h>
#include "gmemory.h"
#include "main.h"
#include "gb.gtk.h"
#include "watcher.h"
[CONFIGURATION] * BUG: Libraries and include files are automatically searched inside 64 bits specific directories. [DEVELOPMENT ENVIRONMENT] * NEW: Automatically convert old Border property to the new Border and Resizable properties. * BUG: The "Theme" tab of the option dialog is correctly initialized the first time Gambas is run. * BUG: Going to a non-existing line number in the editor does not crash the IDE anymore. * NEW: The IDE forms now use the new Border, Resizable and Type properties of the Window class. [COMPILER] * BUG: Do not print error messages on unexpected strings with newline inside. Just claim that an unexpected string has been encountered. [GB.EVAL] * BUG: Do not print error messages on unexpected strings with newline inside. Just claim that an unexpected string has been encountered. [GB.GTK] * NEW: The old Border property of the Window class has been replaced by a two boolean properties: Border and Resizable. * NEW: Window.Type is a new property to set the window manager type of a window: Normal, ToolBar, Splash... * NEW: The Window.ToolBox property has been removed. * NEW: A newly opened non-modal window stays automatically on top of the application main window. [GB.QT] * NEW: The old Border property of the Window class has been replaced by a two boolean properties: Border and Resizable. * NEW: Window.Type is a new property to set the window manager type of a window: Normal, ToolBar, Splash... * NEW: The Window.ToolBox property has been removed. * NEW: A newly opened non-modal window stays automatically on top of the application main window. git-svn-id: svn://localhost/gambas/trunk@1321 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-04-18 23:43:38 +00:00
#include "x11.h"
#include "CScreen.h"
#include "CDraw.h"
#include "CConst.h"
#include "CColor.h"
#include "CFont.h"
#include "CKey.h"
#include "CPicture.h"
#include "CClipboard.h"
#include "CMouse.h"
#include "CMessage.h"
#include "CDialog.h"
#include "CWatcher.h"
#include "CWidget.h"
#include "CProgress.h"
#include "CDrawingArea.h"
#include "CContainer.h"
#include "CFrame.h"
#include "CMenu.h"
#include "CWindow.h"
#include "CLabel.h"
#include "CButton.h"
#include "CPictureBox.h"
#include "CTextBox.h"
#include "CTextArea.h"
#include "CListBox.h"
#include "CTreeView.h"
#include "CSlider.h"
#include "CTabStrip.h"
#include "CTrayIcon.h"
#include "CScrollView.h"
#include "CSpinBox.h"
#include "CSplitter.h"
#include "CStock.h"
#include "CIconView.h"
#include "CGridView.h"
#include "CSeparator.h"
#include <gtk/gtk.h>
#include <string.h>
static int hook_image(CIMAGE **pimage, GB_IMAGE_INFO *info);
static int hook_picture(CPICTURE **ppicture, GB_PICTURE_INFO *info);
static void my_lang(char *lang,int rtl1);
static void my_error(int code,char *error,char *where);
static void my_quit (void);
static void my_main(int *argc, char **argv);
static void my_timer(GB_TIMER *timer,bool on);
[DEVELOPMENT ENVIRONMENT] * NEW: Store the component version inside the .component files for component projects. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * BUG: Do not increment version release if the packager wizard is cancelled. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * NEW: The package wizard remembers the last directory used for storing packages. * BUG: The default directory where packages are stored is the home directory now. * BUG: Fix the signature display routine that sometimes underlined incorrectly. * BUG: Use version program at each project configuration write. * NEW: A "paste special" function in the code editor, that allows to insert plain text or HTML text from the clipboard, and can comment it, quote it as a Gambas string, or transform it into PRINT instructions. * BUG: Some fix related to the now immediate invalidity of deleted forms. [SCRIPTER] * NEW: Support for gambas server pages! * NEW: Server page are now run by a program named 'gbw2', which is just a symbolic link to 'gbs2'. [GB.GTK] * BUG: Window.Picture property now works correctly when the window is embedded inside a container. * BUG: Embedded windows having a background picture are now correctly updated when they are resized. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: The combo-box behaves now like the qt one. Its first item is always selected at startup. * NEW: Now deleted forms become immediately invalid. [GB.QT] * BUG: Clipboard.Paste() now returns an UTF-8 string. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: Checking if the application must quit is deferred, so that closing a form and opeing another one keeps the application running. * NEW: Now deleted forms become immediately invalid. [GB.QT.EXT] * BUG: Fix the Editor drawing while scrolling. * BUG: Fix conversion from cursor position to text column in Editor. * BUG: Fix the Editor drawing when it has been scrolled to the right. * BUG: Don't paste in Editor if there is nothing to paste. git-svn-id: svn://localhost/gambas/trunk@1605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-09-26 02:25:29 +00:00
static void my_wait(int duration);
static void my_post(void);
static int my_loop();
[DEVELOPMENT ENVIRONMENT] * NEW: Store the component version inside the .component files for component projects. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * BUG: Do not increment version release if the packager wizard is cancelled. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * NEW: The package wizard remembers the last directory used for storing packages. * BUG: The default directory where packages are stored is the home directory now. * BUG: Fix the signature display routine that sometimes underlined incorrectly. * BUG: Use version program at each project configuration write. * NEW: A "paste special" function in the code editor, that allows to insert plain text or HTML text from the clipboard, and can comment it, quote it as a Gambas string, or transform it into PRINT instructions. * BUG: Some fix related to the now immediate invalidity of deleted forms. [SCRIPTER] * NEW: Support for gambas server pages! * NEW: Server page are now run by a program named 'gbw2', which is just a symbolic link to 'gbs2'. [GB.GTK] * BUG: Window.Picture property now works correctly when the window is embedded inside a container. * BUG: Embedded windows having a background picture are now correctly updated when they are resized. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: The combo-box behaves now like the qt one. Its first item is always selected at startup. * NEW: Now deleted forms become immediately invalid. [GB.QT] * BUG: Clipboard.Paste() now returns an UTF-8 string. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: Checking if the application must quit is deferred, so that closing a form and opeing another one keeps the application running. * NEW: Now deleted forms become immediately invalid. [GB.QT.EXT] * BUG: Fix the Editor drawing while scrolling. * BUG: Fix conversion from cursor position to text column in Editor. * BUG: Fix the Editor drawing when it has been scrolled to the right. * BUG: Don't paste in Editor if there is nothing to paste. git-svn-id: svn://localhost/gambas/trunk@1605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-09-26 02:25:29 +00:00
static void my_watch(int fd, int type, void *callback, intptr_t param);
bool post_Check=false;
int MAIN_scale = 8;
extern "C"
{
GB_INTERFACE GB EXPORT;
GB_DESC *GB_CLASSES[] EXPORT =
{
CDesktopDesc,
CApplicationTooltipDesc,
CApplicationDesc,
CSelectDesc,
CAlignDesc,
CArrangeDesc,
CBorderDesc,
CScrollDesc,
CLineDesc,
CFillDesc,
CColorDesc,
CColorInfoDesc,
CFontsDesc,
CFontDesc,
CKeyDesc,
CImageDesc,
CPictureDesc,
CClipboardDesc,
CDragDesc,
CCursorDesc,
CMouseDesc,
CMessageDesc,
CDialogDesc,
CWatcherDesc,
CWidgetDesc,
CChildrenDesc,
CContainerDesc,
CDrawingAreaDesc,
CFrameDesc,
CHSplitDesc,
CVSplitDesc,
CUserControlDesc,
CUserContainerDesc,
CPanelDesc,
CHBoxDesc,
CVBoxDesc,
CHPanelDesc,
CVPanelDesc,
CMenuDesc,
CMenuChildrenDesc,
CTrayIconDesc,
CTrayIconsDesc,
CWindowMenusDesc,
CWindowControlsDesc,
CWindowDesc,
CWindowsDesc,
CFormDesc,
CProgressDesc,
CLabelDesc,
CTextLabelDesc,
CSliderDesc,
CScrollBarDesc,
CButtonDesc,
CToggleButtonDesc,
CCheckBoxDesc,
CRadioButtonDesc,
CToolButtonDesc,
CPictureBoxDesc,
CMovieBoxDesc,
CListBoxDesc,
CListBoxItemDesc,
CTextBoxSelectionDesc,
CTextBoxDesc,
CTextAreaDesc,
CTextAreaSelectionDesc,
CComboBoxDesc,
CComboBoxItemDesc,
CListViewItemDesc,
CListViewDesc,
CTreeViewItemDesc,
CTreeViewDesc,
CIconViewItemDesc,
CIconViewDesc,
CColumnViewItemDesc,
CColumnViewColumnDesc,
CColumnViewColumnsDesc,
CColumnViewDesc,
CTabStripDesc,
CTabDesc,
CTabChildrenDesc,
CPluginDesc,
CScrollViewDesc,
CSpinBoxDesc,
CSeparatorDesc,
CGridViewItemDesc,
CGridViewDataDesc,
CGridViewColumnDesc,
CGridViewRowDesc,
CGridViewColumnsDesc,
CGridViewRowsDesc,
CGridViewDesc,
CStockDesc,
NULL
};
void *GB_GTK_1[] EXPORT =
{
(void *)GTK_INTERFACE_VERSION,
(void *)GTK_GetPicture,
(void *)GTK_GetImage,
(void *)CGRIDVIEW_footer,
(void *)CGRIDVIEW_column_footer_text,
(void *)CGRIDVIEW_columns_get,
(void *)DRAW_get_drawable,
(void *)DRAW_get_style,
(void *)DRAW_get_state,
(void *)DRAW_get_shadow,
(void *)DRAW_set_state,
(void *)DRAW_set_shadow,
NULL
};
const char *GB_INCLUDE EXPORT = "gb.draw";
int EXPORT GB_INIT(void)
{
GB.Hook(GB_HOOK_QUIT, (void *)my_quit);
GB.Hook(GB_HOOK_MAIN, (void *)my_main);
GB.Hook(GB_HOOK_WAIT, (void *)my_wait);
GB.Hook(GB_HOOK_LOOP, (void *)my_loop);
GB.Hook(GB_HOOK_TIMER,(void *)my_timer);
GB.Hook(GB_HOOK_WATCH,(void *)my_watch);
GB.Hook(GB_HOOK_POST,(void*)my_post);
GB.Hook(GB_HOOK_ERROR,(void*)my_error);
GB.Hook(GB_HOOK_LANG,(void*)my_lang);
GB.Hook(GB_HOOK_IMAGE, (void *)hook_image);
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
GB.Hook(GB_HOOK_PICTURE, (void *)hook_picture);
GB.LoadComponent("gb.draw");
return TRUE;
}
void EXPORT GB_EXIT()
{
}
int EXPORT GB_INFO(const char *key, void **value)
{
if (!strcasecmp(key, "DISPLAY"))
{
#ifdef GDK_WINDOWING_X11
#ifndef GAMBAS_DIRECTFB
*value = (void *)gdk_x11_display_get_xdisplay(gdk_display_get_default());
#else
// For DirectFB
*value=0;
stub("DIRECTFB/EXPORT GB_INFO");
#endif
#else
// For Win32
*value=0;
stub("no-X11/EXPORT GB_INFO");
#endif
return TRUE;
}
else if (!strcasecmp(key, "ROOT_WINDOW"))
{
#ifdef GDK_WINDOWING_X11
#ifndef GAMBAS_DIRECTFB
*value = (void *)gdk_x11_get_default_root_xwindow();
#else
// For DirectFB
*value=0;
stub("DIRECTFB/EXPORT GB_INFO");
#endif
#else
// For Win32
*value=0;
stub("no-X11/EXPORT GB_INFO");
#endif
return TRUE;
}
else
return FALSE;
}
}
void my_quit (void)
{
CWINDOW *win=WINDOW_get_main();
gApplication::suspendEvents(false);
if (win)
{
while (gtk_events_pending ()) gtk_main_iteration();
if (win->ob.widget) ((gMainWindow*)win->ob.widget)->destroy();
while (gtk_events_pending ()) gtk_main_iteration();
}
}
static void my_main(int *argc, char **argv)
{
gApplication::init(argc, &argv);
gApplication::setDefaultTitle(GB.Application.Title());
gDesktop::init();
MAIN_scale = gDesktop::scale();
[CONFIGURATION] * BUG: Libraries and include files are automatically searched inside 64 bits specific directories. [DEVELOPMENT ENVIRONMENT] * NEW: Automatically convert old Border property to the new Border and Resizable properties. * BUG: The "Theme" tab of the option dialog is correctly initialized the first time Gambas is run. * BUG: Going to a non-existing line number in the editor does not crash the IDE anymore. * NEW: The IDE forms now use the new Border, Resizable and Type properties of the Window class. [COMPILER] * BUG: Do not print error messages on unexpected strings with newline inside. Just claim that an unexpected string has been encountered. [GB.EVAL] * BUG: Do not print error messages on unexpected strings with newline inside. Just claim that an unexpected string has been encountered. [GB.GTK] * NEW: The old Border property of the Window class has been replaced by a two boolean properties: Border and Resizable. * NEW: Window.Type is a new property to set the window manager type of a window: Normal, ToolBar, Splash... * NEW: The Window.ToolBox property has been removed. * NEW: A newly opened non-modal window stays automatically on top of the application main window. [GB.QT] * NEW: The old Border property of the Window class has been replaced by a two boolean properties: Border and Resizable. * NEW: Window.Type is a new property to set the window manager type of a window: Normal, ToolBar, Splash... * NEW: The Window.ToolBox property has been removed. * NEW: A newly opened non-modal window stays automatically on top of the application main window. git-svn-id: svn://localhost/gambas/trunk@1321 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-04-18 23:43:38 +00:00
#ifdef GDK_WINDOWING_X11
X11_init(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gdk_x11_get_default_root_xwindow());
#endif
}
/*static void raise_timer(GB_TIMER *timer)
{
GB.RaiseTimer(timer);
GB.Unref(POINTER(&timer));
}*/
typedef
struct {
GTimer *timer;
int timeout;
}
MyTimerTag;
gboolean my_timer_function(GB_TIMER *timer)
{
if (timer->id)
{
GB.RaiseTimer(timer);
if (timer->id)
{
MyTimerTag *tag = (MyTimerTag *)timer->tag;
GTimer *t = tag->timer;
int elapsed = (int)(g_timer_elapsed(t, NULL) * 1000) - tag->timeout;
int next = timer->delay - elapsed;
if (next < 10)
next = 10;
tag->timeout = next;
g_timer_start(t);
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
timer->id = (intptr_t)g_timeout_add(next, (GSourceFunc)my_timer_function,(gpointer)timer);
//fprintf(stderr, "elapsed = %d delay = %d next = %d\n", elapsed, timer->delay, next);
}
}
return false;
}
static void my_timer(GB_TIMER *timer,bool on)
{
if (timer->id) {
MyTimerTag *tag = (MyTimerTag *)timer->tag;
g_source_remove(timer->id);
g_timer_destroy(tag->timer);
g_free(tag);
timer->id = 0;
timer->tag = 0;
}
if (on)
{
MyTimerTag *tag = g_new(MyTimerTag, 1);
tag->timer = g_timer_new();
tag->timeout = timer->delay;
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
timer->tag = (intptr_t)tag;
timer->id = (intptr_t)g_timeout_add(timer->delay,(GSourceFunc)my_timer_function,(gpointer)timer);
return;
}
}
static void my_post(void)
{
post_Check=true;
}
static bool must_quit(void)
{
//fprintf(stderr, "must_quit: %p %d\n", WINDOW_get_main(), CWatcher::count());
return !WINDOW_get_main() && CWatcher::count() == 0; // && in_event_loop;
}
static int my_loop()
{
while (!must_quit())
do_iteration(false);
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
while (gtk_events_pending ()) gtk_main_iteration();
CWatcher::Clear();
gApplication::exit();
return 0;
}
[DEVELOPMENT ENVIRONMENT] * NEW: Store the component version inside the .component files for component projects. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * BUG: Do not increment version release if the packager wizard is cancelled. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * NEW: The package wizard remembers the last directory used for storing packages. * BUG: The default directory where packages are stored is the home directory now. * BUG: Fix the signature display routine that sometimes underlined incorrectly. * BUG: Use version program at each project configuration write. * NEW: A "paste special" function in the code editor, that allows to insert plain text or HTML text from the clipboard, and can comment it, quote it as a Gambas string, or transform it into PRINT instructions. * BUG: Some fix related to the now immediate invalidity of deleted forms. [SCRIPTER] * NEW: Support for gambas server pages! * NEW: Server page are now run by a program named 'gbw2', which is just a symbolic link to 'gbs2'. [GB.GTK] * BUG: Window.Picture property now works correctly when the window is embedded inside a container. * BUG: Embedded windows having a background picture are now correctly updated when they are resized. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: The combo-box behaves now like the qt one. Its first item is always selected at startup. * NEW: Now deleted forms become immediately invalid. [GB.QT] * BUG: Clipboard.Paste() now returns an UTF-8 string. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: Checking if the application must quit is deferred, so that closing a form and opeing another one keeps the application running. * NEW: Now deleted forms become immediately invalid. [GB.QT.EXT] * BUG: Fix the Editor drawing while scrolling. * BUG: Fix conversion from cursor position to text column in Editor. * BUG: Fix the Editor drawing when it has been scrolled to the right. * BUG: Don't paste in Editor if there is nothing to paste. git-svn-id: svn://localhost/gambas/trunk@1605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-09-26 02:25:29 +00:00
static void my_wait(int duration)
{
do_iteration(true, true);
}
[DEVELOPMENT ENVIRONMENT] * NEW: Store the component version inside the .component files for component projects. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * BUG: Do not increment version release if the packager wizard is cancelled. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * NEW: The package wizard remembers the last directory used for storing packages. * BUG: The default directory where packages are stored is the home directory now. * BUG: Fix the signature display routine that sometimes underlined incorrectly. * BUG: Use version program at each project configuration write. * NEW: A "paste special" function in the code editor, that allows to insert plain text or HTML text from the clipboard, and can comment it, quote it as a Gambas string, or transform it into PRINT instructions. * BUG: Some fix related to the now immediate invalidity of deleted forms. [SCRIPTER] * NEW: Support for gambas server pages! * NEW: Server page are now run by a program named 'gbw2', which is just a symbolic link to 'gbs2'. [GB.GTK] * BUG: Window.Picture property now works correctly when the window is embedded inside a container. * BUG: Embedded windows having a background picture are now correctly updated when they are resized. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: The combo-box behaves now like the qt one. Its first item is always selected at startup. * NEW: Now deleted forms become immediately invalid. [GB.QT] * BUG: Clipboard.Paste() now returns an UTF-8 string. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: Checking if the application must quit is deferred, so that closing a form and opeing another one keeps the application running. * NEW: Now deleted forms become immediately invalid. [GB.QT.EXT] * BUG: Fix the Editor drawing while scrolling. * BUG: Fix conversion from cursor position to text column in Editor. * BUG: Fix the Editor drawing when it has been scrolled to the right. * BUG: Don't paste in Editor if there is nothing to paste. git-svn-id: svn://localhost/gambas/trunk@1605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-09-26 02:25:29 +00:00
static void my_watch(int fd, int type, void *callback, intptr_t param)
{
CWatcher::Add(fd,type,callback,param);
}
static void my_error(int code,char *error,char *where)
{
char *showstr;
char scode[10];
sprintf(scode,"%d",code);
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
showstr=g_strconcat("<b>This application has raised an unexpected<br>error and must abort.</b><p>[", scode, "] ", error, ".\n", where, (void *)NULL);
gMessage::setTitle(GB.Application.Name());
gMessage::showError(showstr,NULL,NULL,NULL);
g_free(showstr);
}
static void my_lang(char *lang,int rtl)
{
[DEVELOPMENT ENVIRONMENT] * NEW: Store the component version inside the .component files for component projects. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * BUG: Do not increment version release if the packager wizard is cancelled. * NEW: Package dependencies on component use the previous version stored in the .component file if it is available. Otherwise the current Gambas interpreter version is used. * NEW: The package wizard remembers the last directory used for storing packages. * BUG: The default directory where packages are stored is the home directory now. * BUG: Fix the signature display routine that sometimes underlined incorrectly. * BUG: Use version program at each project configuration write. * NEW: A "paste special" function in the code editor, that allows to insert plain text or HTML text from the clipboard, and can comment it, quote it as a Gambas string, or transform it into PRINT instructions. * BUG: Some fix related to the now immediate invalidity of deleted forms. [SCRIPTER] * NEW: Support for gambas server pages! * NEW: Server page are now run by a program named 'gbw2', which is just a symbolic link to 'gbs2'. [GB.GTK] * BUG: Window.Picture property now works correctly when the window is embedded inside a container. * BUG: Embedded windows having a background picture are now correctly updated when they are resized. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: The combo-box behaves now like the qt one. Its first item is always selected at startup. * NEW: Now deleted forms become immediately invalid. [GB.QT] * BUG: Clipboard.Paste() now returns an UTF-8 string. * BUG: Correctly handle a form close or destroy during an event handler. * BUG: Checking if the application must quit is deferred, so that closing a form and opeing another one keeps the application running. * NEW: Now deleted forms become immediately invalid. [GB.QT.EXT] * BUG: Fix the Editor drawing while scrolling. * BUG: Fix conversion from cursor position to text column in Editor. * BUG: Fix the Editor drawing when it has been scrolled to the right. * BUG: Don't paste in Editor if there is nothing to paste. git-svn-id: svn://localhost/gambas/trunk@1605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-09-26 02:25:29 +00:00
int bucle, ct;
gControl *iter;
if (rtl==1)
gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
else
gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR);
ct=gApplication::controlCount();
for (bucle=0;bucle<ct;bucle++)
{
iter=gApplication::controlItem(bucle);
if (iter->isVisible() && iter->isContainer())
((gContainer*)iter)->performArrange();
}
}
void do_iteration(bool do_not_block, bool do_not_sleep)
{
struct timespec mywait;
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
if (do_not_block)
{
if (gtk_events_pending ())
gtk_main_iteration_do (false);
else if (!do_not_sleep)
{
mywait.tv_sec=0;
mywait.tv_nsec=100000;
nanosleep(&mywait,NULL);
}
}
else
gtk_main_iteration_do(true);
if (post_Check) { post_Check=false; GB.CheckPost(); }
gControl::cleanRemovedControls();
}
// BM: New image & picture hook syntax
// BM: Conversion functions are now in the interpreter API
static int hook_image(CIMAGE **pimage, GB_IMAGE_INFO *info)
{
CIMAGE *image = *pimage;
gPicture *img;
const guchar *buf;
if (!image)
{
img = new gPicture(gPicture::MEMORY, info->width, info->height, GB_IMAGE_TRANSPARENT(info->format));
buf = gdk_pixbuf_get_pixels(img->getPixbuf());
if (info->data)
GB.Image.Convert((void *)buf, GB_IMAGE_RGBA, info->data, info->format, info->width, info->height);
image = CIMAGE_create(img);
*pimage = image;
}
else
{
info->data = gdk_pixbuf_get_pixels(image->picture->getPixbuf());
info->width = image->picture->width();
info->height = image->picture->height();
info->format = image->picture->isTransparent() ? GB_IMAGE_RGBA : GB_IMAGE_RGBX;
}
return 0;
}
static int hook_picture(CPICTURE **ppicture, GB_PICTURE_INFO *info)
{
CPICTURE *picture = *ppicture;
gPicture *img;
void *buf;
if (!picture)
{
img = new gPicture(gPicture::MEMORY, info->width, info->height, GB_IMAGE_TRANSPARENT(info->format));
buf = gdk_pixbuf_get_pixels(img->getPixbuf());
if (info->data)
GB.Image.Convert((void *)buf, GB_IMAGE_RGBA, info->data, info->format, info->width, info->height);
picture = CPICTURE_create(img);
*ppicture = picture;
}
else
{
info->data = NULL;
info->width = picture->picture->width();
info->height = picture->picture->height();
info->format = picture->picture->isTransparent() ? GB_IMAGE_RGBA : GB_IMAGE_RGBX;
}
return 0;
}