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 8cf965d30911170435t2d516c93u153e3a92a73c88c8@mail.gmail.com
Whole thread Raw
In response to Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image  (Dave Page <dpage@pgadmin.org>)
Responses Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image
List pgadmin-hackers
Hi All,

After a long time, I got some time to refine/correct the patch.

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)

Can anybody please help on this?

--
Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA -
The Enterprise Postgres Company

"Make everything as simple as possible, but not simpler..." -- Albert Einstein
"We are what our thoughts have made us; so take care about what you think." -- Swami Vivekananda

Attachment

pgadmin-hackers by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: Suggestion for pgAgent
Next
From: Dave Page
Date:
Subject: Re: Suggestion for pgAgent