Skip site navigation (1) Skip section navigation (2)

Re: wxWidgets 2.9 build

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: wxWidgets 2.9 build
Date: 2011-01-26 18:41:33
Message-ID: AANLkTike7TQqc0dLdZHgpU+OKyBLZ8=PErgHFEGPpDzL@mail.gmail.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
I've decided to take the program's actual behaviour on my system as an
indication of its intended behaviour in terms of the evaluation order
of arguments. So:

Breakpoint 4, gqbGridPanel::OnButtonUp (this=0x179fc10) at
./gqb/gqbViewPanels.cpp:208
208		allowSelCells = false;
(gdb) n
209		if((selTop >= 0 && selBottom == -1) || (selTop == selBottom))
(gdb) n
211			gModel->changesPositions(selTop, selTop--); // seltop is less
than selltop--
(gdb) n

Here's how I've decided to explicate that behaviour:

diff --git a/pgadmin/gqb/gqbViewPanels.cpp b/pgadmin/gqb/gqbViewPanels.cpp
index 3937753..d3087f8 100644
--- a/pgadmin/gqb/gqbViewPanels.cpp
+++ b/pgadmin/gqb/gqbViewPanels.cpp
@@ -208,7 +208,8 @@ void gqbGridPanel::OnButtonUp(wxCommandEvent &)
        allowSelCells = false;
        if((selTop >= 0 && selBottom == -1) || (selTop == selBottom))
        {
-               gModel->changesPositions(selTop, selTop--);
+               --selTop;
+               gModel->changesPositions(selTop, selTop + 1);
                if(selTop < 0)
                {
                        selTop = 0;
@@ -289,7 +290,8 @@ void gqbGridPanel::OnButtonDown(wxCommandEvent &)
        // A single row is selected
        if((selTop >= 0 && selBottom == -1) || (selTop == selBottom))
        {
-               gModel->changesPositions(selTop, selTop++);
+               ++selTop;
+               gModel->changesPositions(selTop, selTop - 1);

                // Adjust selection when selected item it's last item.
                if(selTop == gModel->GetNumberRows())
@@ -1130,7 +1132,8 @@ void gqbOrderPanel::OnButtonUp(wxCommandEvent &)
        allowSelCells = false;
        if((selRightTop >= 0 && selRightBottom == -1) || (selRightTop
== selRightBottom))
        {
-               tableRight->changesPositions(selRightTop, selRightTop--);
+               --selRightTop;
+               tableRight->changesPositions(selRightTop, selRightTop + 1);
                if(selRightTop < 0)
                {
                        selRightTop = 0;
@@ -1211,7 +1214,8 @@ void gqbOrderPanel::OnButtonDown(wxCommandEvent &)
        // A single row is selected
        if((selRightTop >= 0 && selRightBottom == -1) || (selRightTop
== selRightBottom))
        {
-               tableRight->changesPositions(selRightTop, selRightTop++);
+               ++selRightTop;
+               tableRight->changesPositions(selRightTop, selRightTop - 1);

                // Adjust selection when selected item it's last item.
                if(selRightTop == tableRight->GetNumberRows())


Attached patch fixes all warnings, and builds against wx 2.8 and 2.9,
or would were it not for OGL and Flex/Bison issues with 2.9.

-- 
Regards,
Peter Geoghegan

Attachment: stopgap.patch
Description: text/x-patch (59.8 KB)

In response to

Responses

pgadmin-hackers by date

Next:From: Guillaume LelargeDate: 2011-01-27 21:24:43
Subject: Re: pgAdmin III commit: Fix copy bug in the edit grid
Previous:From: Luis OchoaDate: 2011-01-26 16:42:21
Subject: Re: wxWidgets 2.9 build

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group