From a3198eeb093898b83f84cdc38156b82cca683212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 14 May 2011 22:21:23 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Disable kill buttons correctly in database editor window. [GB.FORM] * BUG: Fix a possible crash in TableView when the editor control is moved. [GB.QT4] * NEW: The GridView Change event is raised when there is no current row now. git-svn-id: svn://localhost/gambas/trunk@3843 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- .../.src/Editor/Connection/FConnectionEditor.class | 3 +++ comp/src/gb.form/.src/TableView.class | 7 ++++++- gb.qt4/src/CGridView.cpp | 12 ++++++++---- main/gbc/gbc_read.c | 2 +- main/gbc/gbc_trans.c | 2 +- main/gbx/gbx_api.c | 2 -- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/src/gambas3/.src/Editor/Connection/FConnectionEditor.class b/app/src/gambas3/.src/Editor/Connection/FConnectionEditor.class index d1790f018..389af8343 100644 --- a/app/src/gambas3/.src/Editor/Connection/FConnectionEditor.class +++ b/app/src/gambas3/.src/Editor/Connection/FConnectionEditor.class @@ -1442,12 +1442,14 @@ Private Sub UpdateFieldToolbar() btnDownField.Enabled = tbvField.Row >= 0 And tbvField.Row < (tbvField.Rows.Count - 1) btnUpField.Enabled = tbvField.Row > 0 + btnKillField.Enabled = tbvField.Row >= 0 End Public Sub tbvField_Change() + Debug tbvField.Row UpdateFieldToolbar End @@ -1456,6 +1458,7 @@ Private Sub UpdateIndexToolbar() btnDownIndex.Enabled = CanDownIndex() btnUpIndex.Enabled = CanUpIndex() + btnKillIndex.Enabled = tbvIndex.Row >= 0 End diff --git a/comp/src/gb.form/.src/TableView.class b/comp/src/gb.form/.src/TableView.class index 182cddc55..aebbdb22f 100644 --- a/comp/src/gb.form/.src/TableView.class +++ b/comp/src/gb.form/.src/TableView.class @@ -106,18 +106,23 @@ Private Sub MoveEditor() If Not $hEditor Then Return + $bDoNotHideEditor = True + X = Me.ScreenX - Me.Window.ScreenX - Me.Window.ClientX + Me.Rows.Width - Me.ScrollX + Me.ClientX Y = Me.ScreenY - Me.Window.ScreenY - Me.Window.ClientY + Me.Columns.Height - Me.ScrollY + Me.ClientY + $bDoNotHideEditor = False + With Me[$iRow, $iCol] + X += .X Y += .Y + If Me.Grid Then $hEditor.Move(X, Y, .Width, .Height) Else $hEditor.Move(X, Y, .Width + 1, .Height + 1) Endif - 'DEBUG ' Debug .X;; .Y;; .W;; .H;; "/";; Me.ClientW;; Me.ClientH;; "/";; Me.W;; Me.H ' diff --git a/gb.qt4/src/CGridView.cpp b/gb.qt4/src/CGridView.cpp index 66173f70b..3125fa4c2 100644 --- a/gb.qt4/src/CGridView.cpp +++ b/gb.qt4/src/CGridView.cpp @@ -769,10 +769,13 @@ void MyTable::setNumCols(int newCols) void MyTable::setNumRows(int newRows) { bool b; + int row, col; if (newRows < 0) return; + getCurrentCell(&row, &col); + BEGIN_NO_REPAINT { _rows = newRows; @@ -781,13 +784,14 @@ void MyTable::setNumRows(int newRows) b = signalsBlocked(); blockSignals(true); Q3Table::setNumRows(newRows); - blockSignals(b); - clearSelection(); + blockSignals(b); } END_NO_REPAINT + setCurrentCell(row, col); emit currentChanged(-1, -1); + emit selectionChanged(); } @@ -2384,8 +2388,8 @@ void CGridView::changed(void) w->updateCurrentCell(); w->getCurrentCell(&row, &col); - if (row < 0 || col < 0) - return; + //if (row < 0 || col < 0) + // return; GB.Raise(THIS, EVENT_Change, 0); } diff --git a/main/gbc/gbc_read.c b/main/gbc/gbc_read.c index 5d7d8cbe4..05ce8a60a 100644 --- a/main/gbc/gbc_read.c +++ b/main/gbc/gbc_read.c @@ -889,7 +889,7 @@ static void add_string() const char *end; int i; - start = source_ptr; + start = end = source_ptr; len = 0; newline = 0; jump = FALSE; diff --git a/main/gbc/gbc_trans.c b/main/gbc/gbc_trans.c index 212b19b81..3f454db95 100644 --- a/main/gbc/gbc_trans.c +++ b/main/gbc/gbc_trans.c @@ -65,8 +65,8 @@ static bool read_integer(char *number, int base, bool minus, int64_t *result) switch (base) { case 2: nmax = 64; break; - case 10: nmax = 19; break; case 16: nmax = 16; break; + case 10: default: nmax = 19; break; } if (base == 10) diff --git a/main/gbx/gbx_api.c b/main/gbx/gbx_api.c index be9cc0905..e4f973d78 100644 --- a/main/gbx/gbx_api.c +++ b/main/gbx/gbx_api.c @@ -408,8 +408,6 @@ void GB_GetProperty(void *object, const char *property) static bool init = FALSE; static GB_FUNCTION func; - va_list args; - if (!init) { GB_GetFunction(&func, (void *)CLASS_find("Object"), "GetProperty", NULL, NULL);