514 lines
11 KiB
C++
Raw Normal View History

/***************************************************************************
main.cpp
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.image.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 "crect.h"
#include "CScreen.h"
#include "CDraw.h"
#include "CConst.h"
#include "CColor.h"
#include "CFont.h"
#include "CKey.h"
#include "CPicture.h"
#include "CImage.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 "cprinter.h"
#include "csvgimage.h"
#include <gtk/gtk.h>
#include <string.h>
GB_CLASS CLASS_Picture;
GB_CLASS CLASS_Image;
GB_CLASS CLASS_DrawingArea;
GB_CLASS CLASS_Menu;
GB_CLASS CLASS_Window;
GB_CLASS CLASS_Printer;
GB_CLASS CLASS_SvgImage;
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);
static bool post_Check=false;
static bool _application_keypress = false;
static GB_FUNCTION _application_keypress_func;
int MAIN_scale = 0;
extern "C"
{
GB_INTERFACE GB EXPORT;
IMAGE_INTERFACE IMAGE EXPORT;
GB_DESC *GB_CLASSES[] EXPORT =
{
RectDesc,
[CONFIGURATION] * NEW: Qt 4.5.0 is now required to compile the gb.qt4 components. [INTERPRETER] * NEW: You can now define a non-creatable but auto-creatable class. It means that you cannot instanciate the class, but you can use it statically. [GB.GTK] * NEW: Screens is a new pseudo-array of all screens. * NEW: Screen is a new class that represents the geometry of a screen. The X, Y, Width and Height properties return the full geometry. The AvailableX, AvailableY, AvailableWidth and AvailableHeight properties return the geometry available to the windows. The screen class can be used statically to get the geometry of the default screen. BEWARE: The available geometry is not yet implemented on gb.gtk! * NEW: Window.Screen is a new property that returns the screen where most of the window is located. * NEW: Desktop.{X,Y,Width,Height} are four new properties that return the available geometry of the default screen. It is an equivalent of Screen.{AvailableX,AvailableY,AvailableWidth,AvailableHeight}. [GB.QT4] * NEW: Screens is a new pseudo-array of all screens. * NEW: Screen is a new class that represents the geometry of a screen. The X, Y, Width and Height properties return the full geometry. The AvailableX, AvailableY, AvailableWidth and AvailableHeight properties return the geometry available to the windows. The screen class can be used statically to get the geometry of the default screen. * NEW: Window.Screen is a new property that returns the screen where most of the window is located. * NEW: Desktop.{X,Y,Width,Height} are four new properties that return the available geometry of the default screen. It is an equivalent of Screen.{AvailableX,AvailableY,AvailableWidth,AvailableHeight}. git-svn-id: svn://localhost/gambas/trunk@3413 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2010-12-30 01:52:40 +00:00
ScreenDesc,
ScreensDesc,
DesktopDesc,
ApplicationTooltipDesc,
ApplicationDesc,
CSelectDesc,
CAlignDesc,
CArrangeDesc,
CBorderDesc,
CScrollDesc,
CLineDesc,
CFillDesc,
CColorDesc,
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,
CWindowTypeDesc,
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,
PrinterDesc,
SvgImageDesc,
NULL
};
void *GB_GTK_1[] EXPORT =
{
(void *)GTK_INTERFACE_VERSION,
(void *)my_main,
(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);
// Thanks again to GTK+ 2.18 :-(
#if GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 18
//putenv((char *)"GDK_NATIVE_WINDOWS=1");
#endif
GB.LoadComponent("gb.draw");
GB.GetInterface("gb.image", IMAGE_INTERFACE_VERSION, &IMAGE);
IMAGE.SetDefaultFormat(GB_IMAGE_RGBA);
DRAW_init();
CWatcher::init();
//CLASS_Control = GB.FindClass("Control");
//CLASS_Container = GB.FindClass("Container");
//CLASS_UserControl = GB.FindClass("UserControl");
//CLASS_UserContainer = GB.FindClass("UserContainer");
CLASS_Window = GB.FindClass("Window");
CLASS_Menu = GB.FindClass("Menu");
CLASS_Picture = GB.FindClass("Picture");
//CLASS_Drawing = GB.FindClass("Drawing");
CLASS_DrawingArea = GB.FindClass("DrawingArea");
CLASS_Printer = GB.FindClass("Printer");
CLASS_Image = GB.FindClass("Image");
CLASS_SvgImage = GB.FindClass("SvgImage");
return -1;
}
void EXPORT GB_EXIT()
{
CWatcher::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 bool global_key_event_handler(int type)
{
GB.Call(&_application_keypress_func, 0, FALSE);
return GB.Stopped();
}
static void my_main(int *argc, char **argv)
{
static bool init = false;
if (init)
return;
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
if (GB.GetFunction(&_application_keypress_func, (void *)GB.Application.StartupClass(), "Application_KeyPress", "", "") == 0)
{
_application_keypress = true;
gApplication::onKeyEvent = global_key_event_handler;
}
init = true;
}
/*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()
{
[DEVELOPMENT ENVIRONMENT] * BUG: The button that switches between form and class editor is not shown anymore when a module or a class is edited. [GB.GTK] * BUG: Font management was redesigned. It does not leak memory anymore, and now behaves like in gb.qt. * BUG: Tristate CheckBox controls now work as expected. * BUG: Destroy pending deleted controls before entering the event loop, to avoid some memory leaks if the event loop is immediately aborted. * BUG: Detach destroyed controls from their event listener, as in gb.qt. * BUG: Now menu shortcuts are active even if the menu bar is hidden. But the menu must be visible. To create an hidden active top-level menu, just set its Text property to NULL, but keep it visible. * NEW: Top-level menus with a void Text property are not shown anymore. * BUG: Showing and hiding top-level menu now work correctly. [GB.QT] * BUG: Font properties are correctly inherited between containers and children controls. * BUG: Showing a tray icon does not eat focus events anymore. * NEW: Top-level menus with a void Text property are not shown anymore. [GB.QT4] * BUG: Font properties are correctly inherited between containers and children controls. * BUG: Shortcut management was fixed. * BUG: Now menu shortcuts are active even if the menu bar is hidden. But the menu must be visible. To create an hidden active top-level menu, just set its Text property to NULL, but keep it visible. * NEW: Top-level menus with a void Text property are not shown anymore. * BUG: Showing and hiding top-level menu now work correctly. git-svn-id: svn://localhost/gambas/trunk@2034 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2009-06-22 11:16:34 +00:00
gControl::cleanRemovedControls();
while (!must_quit())
do_iteration(false);
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.Title());
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
gApplication::_loopLevel++;
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);
gApplication::_loopLevel--;
if (post_Check) { post_Check=false; GB.CheckPost(); }
gControl::cleanRemovedControls();
}