diff --git a/TEMPLATE/conf/gb.gui.conf b/TEMPLATE/conf/gb.gmp.conf similarity index 65% rename from TEMPLATE/conf/gb.gui.conf rename to TEMPLATE/conf/gb.gmp.conf index 1020ce554..70af8182d 100644 --- a/TEMPLATE/conf/gb.gui.conf +++ b/TEMPLATE/conf/gb.gmp.conf @@ -1,22 +1,22 @@ /* Copyrights */ -#define __COPYRIGHT (c) 2007 +#define __COPYRIGHT (c) 2012 #define __AUTHOR Benoît Minisini #define __EMAIL /* Name of the component */ -#define __COMPONENT gb.gui +#define __COMPONENT gb.gmp /* Name of the component with points replaced by underscore */ -#define __COMPONENT_UNDERSCORE gb_gui +#define __COMPONENT_UNDERSCORE gb_gmp /* Short name of the component */ -#define __NAME gui +#define __NAME gmp /* Short name of the component in uppercase */ -#define __UNAME GUI +#define __UNAME GMP /* Description of the component */ -#define __DESCRIPTION QT/GTK+ GUI switcher component +#define __DESCRIPTION GNU multi-precision arithmetic library component /* If the component detection uses pkg-config */ #define __USE_PKGCONFIG 0 @@ -24,10 +24,10 @@ #if __USE_PKGCONFIG /* Name of the package for pkg-config */ - #define __PKGCONFIG_NAME test-1.0 + #define __PKGCONFIG_NAME gsl /* Minimum version needed */ - #define __PKGCONFIG_VERSION 1.2.8 + #define __PKGCONFIG_VERSION #else /* __USE_PKGCONFIG */ @@ -44,30 +44,33 @@ #define __USE_XWINDOW 0 /* Includes to search for */ - #define __SEARCH_INCLUDE + #define __SEARCH_INCLUDE gmp.h /* Includes directories search path */ - #define __SEARCH_INCLUDE_PATH + #define __SEARCH_INCLUDE_PATH /usr/local /usr /* Includes sub-directories search */ - #define __SEARCH_INCLUDE_DIR + #define __SEARCH_INCLUDE_DIR include /* Libraries to search for */ - #define __SEARCH_LIBRARY + #define __SEARCH_LIBRARY libgmp.$SHLIBEXT /* Libraries directories search path */ - #define __SEARCH_LIBRARY_PATH + #define __SEARCH_LIBRARY_PATH /usr/local /usr /* Libraries sub-directories search path */ - #define __SEARCH_LIBRARY_DIR + #define __SEARCH_LIBRARY_DIR lib/* lib /* Libraries to link with */ - #define __LIBRARY + #define __LIBRARY -lgmp + + /* Includes to link with */ + #define __INCLUDE #endif /* __USE_PKGCONFIG */ /* Source file list */ -#define __SOURCES main.c main.h test.c test.h +#define __SOURCES main.c main.h /* Main C/C++ source basename in uppercase */ #define __MAIN_UNAME MAIN diff --git a/TEMPLATE/template/configure.ac b/TEMPLATE/template/configure.ac index 852ce826f..8e3885369 100644 --- a/TEMPLATE/template/configure.ac +++ b/TEMPLATE/template/configure.ac @@ -18,7 +18,7 @@ GB_FIND_QT_MOC GB_COMPONENT_PKG_CONFIG( __NAME, __UNAME, - [__DESCRIPTION], + __COMPONENT, [src], __PKGCONFIG_NAME) @@ -45,7 +45,7 @@ GB_COMPONENT_PKG_CONFIG( GB_COMPONENT( __NAME, __UNAME, - [__DESCRIPTION], + __COMPONENT, [src], #ifdef __SEARCH_INCLUDE [GB_FIND(__SEARCH_INCLUDE, __SEARCH_INCLUDE_PATH, __SEARCH_INCLUDE_DIR)], diff --git a/TODO b/TODO index cd9c56763..2ea9ea044 100644 --- a/TODO +++ b/TODO @@ -43,7 +43,6 @@ DEVELOPMENT ENVIRONMENT - An option to interpret "." and "," when reading float in a CSV import. - Class template files. - Redesign the source code navigator (F2 and SHIFT+F2). -- TODO / FIXME keywords in a tab. GUI RELATED STUFF diff --git a/comp/src/gb.form/.lang/.pot b/comp/src/gb.form/.lang/.pot index 3eaddc239..a5882c5d5 100644 --- a/comp/src/gb.form/.lang/.pot +++ b/comp/src/gb.form/.lang/.pot @@ -95,7 +95,7 @@ msgid "OK" msgstr "" #: FDirChooser.form:168 FEditBookmark.class:109 FInputBox.form:49 -#: FSidePanel.class:931 FWizard.form:54 +#: FSidePanel.class:945 FWizard.form:54 msgid "Cancel" msgstr "" @@ -255,11 +255,11 @@ msgstr "" msgid "Do not display this message again" msgstr "" -#: FSidePanel.class:921 +#: FSidePanel.class:935 msgid "Hidden" msgstr "" -#: FSidePanel.class:925 Form1.form:21 +#: FSidePanel.class:939 Form1.form:21 msgid "Transparent" msgstr "" diff --git a/comp/src/gb.form/.project b/comp/src/gb.form/.project index 62ed49563..82bbf3ec3 100644 --- a/comp/src/gb.form/.project +++ b/comp/src/gb.form/.project @@ -15,11 +15,10 @@ Translate=1 Language=en Type=Component Maintainer=David Villalobos Cambronero -Vendor=Princeton Address=david_villalobos_c@yahoo.com License=General Public Licence Prefix=1 -PackageName=gambas3-princeton-gb-form-2.99 +PackageName=gambas3-gb-form-3.2.90 Packager=1 -Systems=autotools,debian +Systems=debian Groups=debian:"embedded" diff --git a/comp/src/gb.form/.src/SidePanel/FSidePanel.class b/comp/src/gb.form/.src/SidePanel/FSidePanel.class index 54630612e..556d08465 100644 --- a/comp/src/gb.form/.src/SidePanel/FSidePanel.class +++ b/comp/src/gb.form/.src/SidePanel/FSidePanel.class @@ -336,6 +336,9 @@ End Private Sub RefreshAll() Dim D As Integer + Dim hParent As Container + Dim hTabStrip As TabStrip + Dim iIndex As Integer If Not $bOpened Then Return @@ -358,7 +361,18 @@ Private Sub RefreshAll() If Not $hShowPanel Then - $hShowPanel = New Panel(Me.Parent.Parent) As "panMove" + hParent = Me.Parent.Parent + + If hParent Is TabStrip Then + hTabStrip = hParent + iIndex = hTabStrip.Index + hTabStrip.Index = hTabStrip.FindIndex(Me.Parent) + Endif + + $hShowPanel = New Panel(hParent) As "panMove" + + If hTabStrip Then hTabStrip.Index = iIndex + $hShowPanel.Ignore = True $hShowPanel.Mouse = Mouse.Pointing $hShowButtonLeft = CreateShowButton() diff --git a/gb.desktop/src/gb.desktop/.settings b/gb.desktop/src/gb.desktop/.settings index 4b92f18ec..8cd9ea95d 100644 --- a/gb.desktop/src/gb.desktop/.settings +++ b/gb.desktop/src/gb.desktop/.settings @@ -24,10 +24,11 @@ SearchComment=False SearchString=True [OpenFile] -Active=1 -File[1]=".src/Desktop.class:203.0" +File[1]=".src/Desktop.class:29.2" File[2]=".src/_Desktop_Passwords.class:26.24" -Count=2 +Active=3 +File[3]="xdg-utils/xdg-email:44.8" +Count=3 [Watches] Count=0 diff --git a/gb.gmp/AUTHORS b/gb.gmp/AUTHORS new file mode 100644 index 000000000..e69de29bb diff --git a/gb.gmp/COPYING b/gb.gmp/COPYING new file mode 120000 index 000000000..012065c85 --- /dev/null +++ b/gb.gmp/COPYING @@ -0,0 +1 @@ +../COPYING \ No newline at end of file diff --git a/gb.gmp/ChangeLog b/gb.gmp/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/gb.gmp/INSTALL b/gb.gmp/INSTALL new file mode 120000 index 000000000..99d491b4f --- /dev/null +++ b/gb.gmp/INSTALL @@ -0,0 +1 @@ +../INSTALL \ No newline at end of file diff --git a/gb.gmp/Makefile.am b/gb.gmp/Makefile.am new file mode 100644 index 000000000..28e8c41a5 --- /dev/null +++ b/gb.gmp/Makefile.am @@ -0,0 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 --install +SUBDIRS = @GMP_DIR@ +EXTRA_DIST = reconf gambas.h gb*.h diff --git a/gb.gmp/NEWS b/gb.gmp/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/gb.gmp/README b/gb.gmp/README new file mode 100644 index 000000000..e69de29bb diff --git a/gb.gmp/acinclude.m4 b/gb.gmp/acinclude.m4 new file mode 120000 index 000000000..d84c32a31 --- /dev/null +++ b/gb.gmp/acinclude.m4 @@ -0,0 +1 @@ +../acinclude.m4 \ No newline at end of file diff --git a/gb.gmp/component.am b/gb.gmp/component.am new file mode 120000 index 000000000..2f0eee34f --- /dev/null +++ b/gb.gmp/component.am @@ -0,0 +1 @@ +../component.am \ No newline at end of file diff --git a/gb.gmp/configure.ac b/gb.gmp/configure.ac new file mode 100644 index 000000000..c9eaac68e --- /dev/null +++ b/gb.gmp/configure.ac @@ -0,0 +1,17 @@ +dnl ---- configure.ac for gb.gmp + +AC_INIT(configure.ac) +AC_CONFIG_MACRO_DIR([m4]) +GB_INIT(gb.gmp) +AC_PROG_LIBTOOL +GB_COMPONENT( + gmp, + GMP, + gb.gmp, + [src], + [GB_FIND(gmp.h, /usr/local /usr, include)], + [GB_FIND(libgmp.$SHLIBEXT, /usr/local /usr, lib)], + [$C_LIB -lgmp], + [ ]) +AC_OUTPUT( Makefile src/Makefile ) +GB_PRINT_MESSAGES diff --git a/gb.gmp/gambas.h b/gb.gmp/gambas.h new file mode 120000 index 000000000..03677ecd0 --- /dev/null +++ b/gb.gmp/gambas.h @@ -0,0 +1 @@ +../main/share/gambas.h \ No newline at end of file diff --git a/gb.gmp/gb_common.h b/gb.gmp/gb_common.h new file mode 120000 index 000000000..707d79da6 --- /dev/null +++ b/gb.gmp/gb_common.h @@ -0,0 +1 @@ +../main/share/gb_common.h \ No newline at end of file diff --git a/gb.gmp/m4 b/gb.gmp/m4 new file mode 120000 index 000000000..7d49a2a4b --- /dev/null +++ b/gb.gmp/m4 @@ -0,0 +1 @@ +../m4 \ No newline at end of file diff --git a/gb.gmp/missing b/gb.gmp/missing new file mode 120000 index 000000000..f3ade9ba1 --- /dev/null +++ b/gb.gmp/missing @@ -0,0 +1 @@ +../missing \ No newline at end of file diff --git a/gb.gmp/reconf b/gb.gmp/reconf new file mode 120000 index 000000000..48a376da6 --- /dev/null +++ b/gb.gmp/reconf @@ -0,0 +1 @@ +../reconf \ No newline at end of file diff --git a/gb.gmp/src/Makefile.am b/gb.gmp/src/Makefile.am new file mode 100644 index 000000000..39518f992 --- /dev/null +++ b/gb.gmp/src/Makefile.am @@ -0,0 +1,10 @@ +COMPONENT = gb.gmp +include $(top_srcdir)/component.am + +gblib_LTLIBRARIES = gb.gmp.la + +gb_gmp_la_LIBADD = @GMP_LIB@ +gb_gmp_la_LDFLAGS = -module @LD_FLAGS@ @GMP_LDFLAGS@ +gb_gmp_la_CPPFLAGS = @GMP_INC@ + +gb_gmp_la_SOURCES = main.c main.h diff --git a/gb.gmp/src/gb.gmp.component b/gb.gmp/src/gb.gmp.component new file mode 100644 index 000000000..10e636c3f --- /dev/null +++ b/gb.gmp/src/gb.gmp.component @@ -0,0 +1,3 @@ +[Component] +Author= +Alpha=1 diff --git a/gb.gmp/src/main.c b/gb.gmp/src/main.c new file mode 100644 index 000000000..8f044051e --- /dev/null +++ b/gb.gmp/src/main.c @@ -0,0 +1,28 @@ +/*************************************************************************** + + main.c + + gb.gmp component + + (c) 2012 Benoît Minisini + + 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#define __MAIN_C + +#include "main.h" diff --git a/gb.gmp/src/main.h b/gb.gmp/src/main.h new file mode 100644 index 000000000..24fdda4d7 --- /dev/null +++ b/gb.gmp/src/main.h @@ -0,0 +1,35 @@ +/*************************************************************************** + + main.h + + gb.gmp component + + (c) 2012 Benoît Minisini + + 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __MAIN_H +#define __MAIN_H + +#include "gambas.h" + +#ifndef __MAIN_C +extern GB_INTERFACE GB; +#endif + +#endif /* __MAIN_H */ diff --git a/gb.gtk/src/CTabStrip.cpp b/gb.gtk/src/CTabStrip.cpp index 9f7f94131..eb8db789b 100644 --- a/gb.gtk/src/CTabStrip.cpp +++ b/gb.gtk/src/CTabStrip.cpp @@ -302,6 +302,17 @@ BEGIN_PROPERTY(CTAB_visible) END_PROPERTY +BEGIN_METHOD(TabStrip_FindIndex, GB_OBJECT child) + + CWIDGET *child = (CWIDGET *)VARG(child); + + if (GB.CheckObject(child)) + return; + + GB.ReturnInteger(TABSTRIP->findIndex(child->widget)); + +END_METHOD + /*************************************************************************** @@ -309,9 +320,9 @@ END_PROPERTY ***************************************************************************/ -GB_DESC CTabChildrenDesc[] = +GB_DESC CTabStripContainerChildrenDesc[] = { - GB_DECLARE(".Tab.Children", 0), GB_VIRTUAL_CLASS(), + GB_DECLARE_VIRTUAL(".TabStripContainer.Children"), GB_METHOD("_next", "Control", CTAB_next, NULL), GB_PROPERTY_READ("Count", "i", CTAB_count), @@ -321,16 +332,16 @@ GB_DESC CTabChildrenDesc[] = }; -GB_DESC CTabDesc[] = +GB_DESC CTabStripContainerDesc[] = { - GB_DECLARE(".Tab", 0), GB_VIRTUAL_CLASS(), + GB_DECLARE_VIRTUAL(".TabStripContainer"), GB_PROPERTY("Text", "s", CTAB_text), GB_PROPERTY("Picture", "Picture", CTAB_picture), GB_PROPERTY("Caption", "s", CTAB_text), GB_PROPERTY("Enabled", "b", CTAB_enabled), GB_PROPERTY("Visible", "b", CTAB_visible), - GB_PROPERTY_SELF("Children", ".Tab.Children"), + GB_PROPERTY_SELF("Children", ".TabStripContainer.Children"), GB_METHOD("Delete", 0, CTAB_delete, 0), GB_END_DECLARE @@ -350,7 +361,7 @@ GB_DESC CTabStripDesc[] = GB_PROPERTY("Picture", "Picture", CTABSTRIP_picture), GB_PROPERTY("Closable", "b", TabStrip_Closable), GB_PROPERTY("Caption", "s", CTABSTRIP_text), - GB_PROPERTY_READ("Current", ".Tab", CTABSTRIP_current), + GB_PROPERTY_READ("Current", ".TabStripContainer", CTABSTRIP_current), GB_PROPERTY("Index", "i", CTABSTRIP_index), GB_PROPERTY("Orientation", "i", CTABSTRIP_orientation), @@ -362,7 +373,8 @@ GB_DESC CTabStripDesc[] = GB_PROPERTY("Indent", "b", CCONTAINER_indent), GB_PROPERTY("Invert", "b", Container_Invert), - GB_METHOD("_get", ".Tab", CTABSTRIP_get, "(Index)i"), + GB_METHOD("_get", ".TabStripContainer", CTABSTRIP_get, "(Index)i"), + GB_METHOD("FindIndex", "i", TabStrip_FindIndex, "(Child)Control;"), GB_EVENT("Click", NULL, NULL, &EVENT_Click), GB_EVENT("Close", NULL, "(Index)i", &EVENT_Close), diff --git a/gb.gtk/src/CTabStrip.h b/gb.gtk/src/CTabStrip.h index 67805e9f8..b052631c4 100644 --- a/gb.gtk/src/CTabStrip.h +++ b/gb.gtk/src/CTabStrip.h @@ -31,8 +31,8 @@ #ifndef __CTABSTRIP_CPP extern GB_DESC CTabStripDesc[]; -extern GB_DESC CTabDesc[]; -extern GB_DESC CTabChildrenDesc[]; +extern GB_DESC CTabStripContainerDesc[]; +extern GB_DESC CTabStripContainerChildrenDesc[]; #else diff --git a/gb.gtk/src/gcontrol.cpp b/gb.gtk/src/gcontrol.cpp index e27cb3841..99fadaaa2 100644 --- a/gb.gtk/src/gcontrol.cpp +++ b/gb.gtk/src/gcontrol.cpp @@ -969,8 +969,9 @@ void gControl::lower() gpointer *p; GList *chd; GtkWidget *child; - gControl *Br; + gControl *br; int x,y; + GtkContainer *parent; if (!pr) return; if (pr->getClass()==Type_gSplitter) return; @@ -993,17 +994,23 @@ void gControl::lower() { child = (GtkWidget*)chd->data; - Br = (gControl *)g_object_get_data(G_OBJECT(child), "gambas-control");; + br = (gControl *)g_object_get_data(G_OBJECT(child), "gambas-control");; - if (Br && Br != this) + if (br && br != this) { - x = Br->x(); - y = Br->y(); - g_object_ref(G_OBJECT(Br->border)); - gtk_container_remove(GTK_CONTAINER(pr->getContainer()),Br->border); - gtk_container_add(GTK_CONTAINER(pr->getContainer()),Br->border); - pr->moveChild(Br, x, y); - g_object_unref(G_OBJECT(Br->border)); + x = br->x(); + y = br->y(); + parent = GTK_CONTAINER(gtk_widget_get_parent(br->border)); + g_object_ref(G_OBJECT(br->border)); + gtk_container_remove(parent, br->border); + gtk_container_add(parent, br->border); + + if (GTK_IS_LAYOUT(parent)) + gtk_layout_move(GTK_LAYOUT(parent), br->border, x, y); + else + gtk_fixed_move(GTK_FIXED(parent), br->border, x, y); + + g_object_unref(G_OBJECT(br->border)); } chd = g_list_next(chd); @@ -1025,7 +1032,8 @@ void gControl::lower() void gControl::raise() { - int x,y; + int x, y; + GtkContainer *parent; if (!pr) return; if (pr->getClass()==Type_gSplitter) return; @@ -1040,17 +1048,23 @@ void gControl::raise() { //fprintf(stderr, "gb.gtk: warning: gControl::raise(): no window\n"); - x=left(); - y=top(); + x = left(); + y = top(); + parent = GTK_CONTAINER(gtk_widget_get_parent(border)); g_object_ref(G_OBJECT(border)); - gtk_container_remove(GTK_CONTAINER(pr->getContainer()),border); - gtk_container_add(GTK_CONTAINER(pr->getContainer()),border); - pr->moveChild(this, x, y); + gtk_container_remove(parent, border); + gtk_container_add(parent, border); + + //pr->moveChild(this, x, y); + if (GTK_IS_LAYOUT(parent)) + gtk_layout_move(GTK_LAYOUT(parent), border, x, y); + else + gtk_fixed_move(GTK_FIXED(parent), border, x, y); + g_object_unref(G_OBJECT(border)); } g_ptr_array_remove(pr->_children, this); - g_ptr_array_add(pr->_children, this); pr->updateFocusChain(); diff --git a/gb.gtk/src/gtabstrip.cpp b/gb.gtk/src/gtabstrip.cpp index 554d8c8fe..caecfd3ef 100644 --- a/gb.gtk/src/gtabstrip.cpp +++ b/gb.gtk/src/gtabstrip.cpp @@ -28,7 +28,7 @@ #include "gdesktop.h" #include "gtabstrip.h" - +#if 0 static int gTabStrip_buttonRelease(GtkWidget *wid,GdkEventButton *e,gTabStrip *d) { if (!gApplication::userEvents()) return false; @@ -59,6 +59,7 @@ static int gTabStrip_buttonPress(GtkWidget *wid,GdkEventButton *e,gTabStrip *d) } return false; } +#endif static void cb_click(GtkNotebook *nb,GtkNotebookPage *pg,guint pnum,gTabStrip *data) { @@ -688,7 +689,6 @@ gControl *gTabStrip::tabChild(int ind, int n) const } return NULL; - } int gTabStrip::childCount() const @@ -788,4 +788,18 @@ void gTabStrip::setClosable(bool v) get(i)->updateButton(); } - +int gTabStrip::findIndex(gControl *child) const +{ + int i; + GtkWidget *page; + + page = gtk_widget_get_parent(child->border); + + for (i = 0; i < count(); i++) + { + if (get(i)->widget == page) + return i; + } + + return -1; +} diff --git a/gb.gtk/src/gtabstrip.h b/gb.gtk/src/gtabstrip.h index 42e7b2f80..2df5343df 100644 --- a/gb.gtk/src/gtabstrip.h +++ b/gb.gtk/src/gtabstrip.h @@ -45,6 +45,7 @@ public: char *tabText(int ind) const; int tabCount(int ind) const; gControl *tabChild(int ind, int n) const; + int findIndex(gControl *child) const; bool setCount(int vl); void setIndex(int vl); diff --git a/gb.gtk/src/main.cpp b/gb.gtk/src/main.cpp index 10dfd93e0..394bc2629 100644 --- a/gb.gtk/src/main.cpp +++ b/gb.gtk/src/main.cpp @@ -188,8 +188,8 @@ extern "C" CColumnViewColumnsDesc, CColumnViewDesc, CTabStripDesc, - CTabDesc, - CTabChildrenDesc, + CTabStripContainerDesc, + CTabStripContainerChildrenDesc, CPluginDesc, CScrollViewDesc, CSpinBoxDesc, diff --git a/gb.qt4/src/CTabStrip.cpp b/gb.qt4/src/CTabStrip.cpp index da0b0dc3c..ee0ab2edb 100644 --- a/gb.qt4/src/CTabStrip.cpp +++ b/gb.qt4/src/CTabStrip.cpp @@ -430,7 +430,7 @@ static int get_real_index(CTABSTRIP *_object) } -BEGIN_METHOD(CTABSTRIP_new, GB_OBJECT parent) +BEGIN_METHOD(TabStrip_new, GB_OBJECT parent) MyTabWidget *wid = new MyTabWidget(QCONTAINER(VARG(parent))); //, 0, Qt::WNoMousePropagation); @@ -456,7 +456,7 @@ BEGIN_METHOD_VOID(TabStrip_free) END_METHOD -BEGIN_PROPERTY(CTABSTRIP_count) +BEGIN_PROPERTY(TabStrip_Count) if (READ_PROPERTY) GB.ReturnInteger(WIDGET->stack.count()); @@ -466,7 +466,7 @@ BEGIN_PROPERTY(CTABSTRIP_count) END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_index) +BEGIN_PROPERTY(TabStrip_Index) if (READ_PROPERTY) { @@ -491,7 +491,7 @@ BEGIN_PROPERTY(CTABSTRIP_index) END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_current) +BEGIN_PROPERTY(TabStrip_Current) THIS->index = get_real_index(THIS); if (THIS->index < 0) @@ -502,7 +502,7 @@ BEGIN_PROPERTY(CTABSTRIP_current) END_PROPERTY -BEGIN_METHOD(CTABSTRIP_get, GB_INTEGER index) +BEGIN_METHOD(TabStrip_get, GB_INTEGER index) int index = VARG(index); @@ -515,7 +515,7 @@ BEGIN_METHOD(CTABSTRIP_get, GB_INTEGER index) END_METHOD -BEGIN_PROPERTY(CTABSTRIP_orientation) +BEGIN_PROPERTY(TabStrip_Orientation) if (READ_PROPERTY) { @@ -726,7 +726,7 @@ BEGIN_METHOD_VOID(CTAB_delete) END_METHOD -BEGIN_PROPERTY(CTABSTRIP_enabled) +BEGIN_PROPERTY(TabStrip_Enabled) int i; @@ -742,7 +742,7 @@ BEGIN_PROPERTY(CTABSTRIP_enabled) END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_text) +BEGIN_PROPERTY(TabStrip_Text) THIS->index = -1; CTAB_text(_object, _param); @@ -755,7 +755,7 @@ BEGIN_PROPERTY(CTABSTRIP_text) END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_picture) +BEGIN_PROPERTY(TabStrip_Picture) THIS->index = -1; CTAB_picture(_object, _param); @@ -772,34 +772,58 @@ BEGIN_PROPERTY(TabStrip_Closable) END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_client_x) +BEGIN_PROPERTY(TabStrip_ClientX) Container_X(_object, _param); END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_client_y) +BEGIN_PROPERTY(TabStrip_ClientY) Container_Y(_object, _param); END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_client_width) +BEGIN_PROPERTY(TabStrip_ClientWidth) GB.ReturnInteger(THIS->container->width()); END_PROPERTY -BEGIN_PROPERTY(CTABSTRIP_client_height) +BEGIN_PROPERTY(TabStrip_ClientHeight) GB.ReturnInteger(THIS->container->height()); END_PROPERTY +BEGIN_METHOD(TabStrip_FindIndex, GB_OBJECT child) + + void *child = VARG(child); + int i; + QWidget *parent; + + if (GB.CheckObject(child)) + return; + + parent = QWIDGET(child)->parentWidget(); + + for (i = 0; i < WIDGET->stack.count(); i++) + { + if (parent == WIDGET->stack.at(i)->widget) + { + GB.ReturnInteger(i); + return; + } + } + + GB.ReturnInteger(-1); + +END_METHOD + /** Class CTabStrip ******************************************************/ @@ -841,9 +865,9 @@ void CTabStrip::tabCloseRequested(int index) /** Descriptions *********************************************************/ -GB_DESC CTabChildrenDesc[] = +GB_DESC CTabStripContainerChildrenDesc[] = { - GB_DECLARE(".Tab.Children", 0), GB_VIRTUAL_CLASS(), + GB_DECLARE_VIRTUAL(".TabStripContainer.Children"), GB_METHOD("_next", "Control", CTAB_next, NULL), GB_PROPERTY_READ("Count", "i", CTAB_count), @@ -853,16 +877,16 @@ GB_DESC CTabChildrenDesc[] = }; -GB_DESC CTabDesc[] = +GB_DESC CTabStripContainerDesc[] = { - GB_DECLARE(".Tab", 0), GB_VIRTUAL_CLASS(), + GB_DECLARE_VIRTUAL(".TabStripContainer"), GB_PROPERTY("Text", "s", CTAB_text), GB_PROPERTY("Picture", "Picture", CTAB_picture), GB_PROPERTY("Caption", "s", CTAB_text), GB_PROPERTY("Enabled", "b", CTAB_enabled), GB_PROPERTY("Visible", "b", CTAB_visible), - GB_PROPERTY_SELF("Children", ".Tab.Children"), + GB_PROPERTY_SELF("Children", ".TabStripContainer.Children"), GB_METHOD("Delete", NULL, CTAB_delete, NULL), GB_END_DECLARE @@ -873,26 +897,26 @@ GB_DESC CTabStripDesc[] = { GB_DECLARE("TabStrip", sizeof(CTABSTRIP)), GB_INHERITS("Container"), - GB_METHOD("_new", NULL, CTABSTRIP_new, "(Parent)Container;"), + GB_METHOD("_new", NULL, TabStrip_new, "(Parent)Container;"), GB_METHOD("_free", NULL, TabStrip_free, NULL), - GB_PROPERTY("Count", "i", CTABSTRIP_count), - GB_PROPERTY("Text", "s", CTABSTRIP_text), + GB_PROPERTY("Count", "i", TabStrip_Count), + GB_PROPERTY("Text", "s", TabStrip_Text), GB_PROPERTY("TextFont", "Font", TabStrip_TextFont), - GB_PROPERTY("Picture", "Picture", CTABSTRIP_picture), + GB_PROPERTY("Picture", "Picture", TabStrip_Picture), GB_PROPERTY("Closable", "b", TabStrip_Closable), - GB_PROPERTY("Caption", "s", CTABSTRIP_text), - GB_PROPERTY_READ("Current", ".Tab", CTABSTRIP_current), - GB_PROPERTY("Index", "i", CTABSTRIP_index), - GB_PROPERTY("Orientation", "i", CTABSTRIP_orientation), - GB_PROPERTY("Enabled", "b", CTABSTRIP_enabled), + GB_PROPERTY("Caption", "s", TabStrip_Text), + GB_PROPERTY_READ("Current", ".TabStripContainer", TabStrip_Current), + GB_PROPERTY("Index", "i", TabStrip_Index), + GB_PROPERTY("Orientation", "i", TabStrip_Orientation), + GB_PROPERTY("Enabled", "b", TabStrip_Enabled), - GB_PROPERTY_READ("ClientX", "i", CTABSTRIP_client_x), - GB_PROPERTY_READ("ClientY", "i", CTABSTRIP_client_y), - GB_PROPERTY_READ("ClientW", "i", CTABSTRIP_client_width), - GB_PROPERTY_READ("ClientWidth", "i", CTABSTRIP_client_width), - GB_PROPERTY_READ("ClientH", "i", CTABSTRIP_client_height), - GB_PROPERTY_READ("ClientHeight", "i", CTABSTRIP_client_height), + GB_PROPERTY_READ("ClientX", "i", TabStrip_ClientX), + GB_PROPERTY_READ("ClientY", "i", TabStrip_ClientY), + GB_PROPERTY_READ("ClientW", "i", TabStrip_ClientWidth), + GB_PROPERTY_READ("ClientWidth", "i", TabStrip_ClientWidth), + GB_PROPERTY_READ("ClientH", "i", TabStrip_ClientHeight), + GB_PROPERTY_READ("ClientHeight", "i", TabStrip_ClientHeight), GB_PROPERTY("Arrangement", "i", Container_Arrangement), GB_PROPERTY("AutoResize", "b", Container_AutoResize), @@ -902,7 +926,8 @@ GB_DESC CTabStripDesc[] = GB_PROPERTY("Indent", "b", Container_Indent), GB_PROPERTY("Invert", "b", Container_Invert), - GB_METHOD("_get", ".Tab", CTABSTRIP_get, "(Index)i"), + GB_METHOD("_get", ".TabStripContainer", TabStrip_get, "(Index)i"), + GB_METHOD("FindIndex", "i", TabStrip_FindIndex, "(Child)Control;"), TABSTRIP_DESCRIPTION, diff --git a/gb.qt4/src/CTabStrip.h b/gb.qt4/src/CTabStrip.h index 2de9ce88e..52eae9deb 100644 --- a/gb.qt4/src/CTabStrip.h +++ b/gb.qt4/src/CTabStrip.h @@ -37,8 +37,8 @@ #ifndef __CTABSTRIP_CPP extern GB_DESC CTabStripDesc[]; -extern GB_DESC CTabDesc[]; -extern GB_DESC CTabChildrenDesc[]; +extern GB_DESC CTabStripContainerDesc[]; +extern GB_DESC CTabStripContainerChildrenDesc[]; #else #define QTABWIDGET(object) ((MyTabWidget *)((CWIDGET *)object)->widget) @@ -60,9 +60,7 @@ typedef QWidget *container; CARRANGEMENT arrangement; CFONT *textFont; - int index; - int id; - unsigned geom : 1; + int index; unsigned lock : 1; } CTABSTRIP; diff --git a/gb.qt4/src/ext/gview.cpp b/gb.qt4/src/ext/gview.cpp index 7985c00bd..ccffa6964 100644 --- a/gb.qt4/src/ext/gview.cpp +++ b/gb.qt4/src/ext/gview.cpp @@ -576,12 +576,14 @@ static QColor calc_color(QColor ca, QColor cb, QColor cd) if (!cb.isValid()) return ca; - #define test(x) r *= x.red(); g *= x.green(); b *= x.blue(); n++; + return QColor((ca.red() + cb.red()) / 2, (ca.green() + cb.green()) / 2, (ca.blue() + cb.blue()) / 2); + + /*#define test(x) r *= x.red(); g *= x.green(); b *= x.blue(); n++; test(ca); test(cb); n = (n == 2) ? 255 : (n == 3) ? 255*255 : 1; - return QColor(r / n, g / n, b / n); + return QColor(r / n, g / n, b / n);*/ } void GEditor::drawTextWithTab(QPainter &p, int sx, int x, int y, const QString &s) diff --git a/gb.qt4/src/main.cpp b/gb.qt4/src/main.cpp index b2d750236..2893c5cf2 100644 --- a/gb.qt4/src/main.cpp +++ b/gb.qt4/src/main.cpp @@ -1033,7 +1033,7 @@ GB_DESC *GB_CLASSES[] EXPORT = //CColumnView2ItemDesc, CColumnView2ColumnDesc, CColumnView2ColumnsDesc, CColumnView2Desc, CFrameDesc, CPanelDesc, CHBoxDesc, CVBoxDesc, CHPanelDesc, CVPanelDesc, CHSplitDesc, CVSplitDesc, - CTabChildrenDesc, CTabDesc, CTabStripDesc, + CTabStripContainerChildrenDesc, CTabStripContainerDesc, CTabStripDesc, CScrollViewDesc, CDrawingAreaDesc, CProgressDesc, CSliderDesc, CSpinBoxDesc, CMovieBoxDesc, CScrollBarDesc,