Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image - Mailing list pgadmin-hackers

From Ashesh Vashi
Subject Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image
Date
Msg-id 4A9D029F.1000503@enterprisedb.com
Whole thread Raw
In response to PATCH(WIP): Printing Support And Save GQB/Explain as an image  (Ashesh Vashi <ashesh.vashi@enterprisedb.com>)
List pgadmin-hackers
Hi All,

(Please see below...)

Ashesh Vashi wrote:
Hi Team,

Please find the WIP patch for "Printing Support in frmQuery (QueryBuilder/Graphical Query Builder(GQB)/Explain) & Save as an image".

Modified/Added file list and explanation are given below:
Print support on Gtk (Linux)

*
xtra/wx-build/build-wxgtk
  - We have to modify this script, added few new flags) to enable printing on Gtk.
  Please follow these links for more details:
  http://docs.wxwidgets.org/trunk/overview_unixprinting.html
  http://wiki.wxwidgets.org/Printing
  http://docs.wxwidgets.org/stable/wx_printingoverview.html

Print support/Save as an image in Explain window

* pgadmin/ctl/explainPrintout.cpp (Added)
  - Definition for the new introduced class - ExplainPrintout
  - A helping class for support for the printing the explain
*
pgadmin/gqb/gqbPrintout.cpp (Added)
  - Definition for the new introduced class - gqbPrintout
 
- A helping class for support for the printing the GQB
* pgadmin/ctl/explainCanvas.cpp
* pgadmin/include/ctl/explainCanvas.h
  - Added new function ExplainCanvas::SaveAsImage(filename) to save Explain as an image (bmp for now)
  - Removed a unused variable lastShape

Print support for the Query window

* pgadmin/include/ctl/ctlSQLBox.h
*
pgadmin/include/frm/frmQuery.h
*
pgadmin/include/gqb/gqbViewController.h
*
pgadmin/frm/frmQuery.cpp
* pgadmin/gqb/gqbController.cpp

Print support/Save as an image in GQB

* pgadmin/include/gqb/gqbEvents.h
* pgadmin/include/gqb/gqbGraphSimple.h
  - I had to use wxMemoryDC instead of wxBufferedDC to enable printing
* pgadmin/include/gqb/gqbGraphBehavior.h
* pgadmin/gqb/gqbGraphSimple.cpp
* pgadmin/gqb/gqbView.cpp
  - Change the function definition drawAll(wxBufferedDB& bdc) to drawAll(wxMemoryDC& bdc, bool adjustScrolling)
  - Using the same function to draw on PrintDC/PrintPreviewDC and Canvas.
  - In case of PrintDC/PrintPreviewDC, we do not need this function to adjust the scrolling according to the canvas
  - Introduced a new variable modelSize to take care of the total size of the Model (Model consists of tables & Joins)
  - Introduced a new function updateModelSize(...) to update the model size on demand

Data/Project Initialization & new menu declaration

* pgadmin/include/frm/menu.h
* pgadmin/include/utils/sysSettings.h
* pgadmin/pgAdmin3.cpp
- Initialize the Print objects for Query/Explain/GQB.

pgAdmin Build addition (Added new files)

* pgadmin/pgAdmin3.vcproj
* pgadmin/gqb/module.mk
* pgadmin/ctl/module.mk

I have tested this patch on linux (Ubuntu having libgnome installed), Window Vista and Mac 10.5.
I am having couple of problems with this patch.
1. On OSX (Mac):
   - If I see a print preview for any of Query/Explain/GQB, it works perfectly.
     But, when we close the Print-Preview dialog, the query dialog is not getting enabled.
     Something is missing, but I am not able to figure out the same.
2. On all the platforms:
   - If I call the new function updateModelSize(...), when we add new table to the model.
   - In this case, after selecting a table/view from the left size tree (browser), if I click couple of times (five-six times), then the program is getting crashed.
   - I tried to use the mutex/Semaphore, but it was still not working. :(
   (For the same reason, I have not added the updateModelSize(...) function, while creating/deleting a table/view, in this patch)
One more issue:
The text font in the GQB/Explain (Print/Print-Preview) does not look good. (fading a little bit)

Please help.

--
Thanks & Regards,
Ashesh Vashi

EnterpriseDB INDIA: http://www.enterprisedb.com

pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r8018 - in branches/REL-1_10_0_PATCHES/pgadmin3: . pgadmin/schema
Next
From: "pgAdmin Trac"
Date:
Subject: [pgAdmin III] #54: Wrong display of privileges on Procedural Language in SQL window