Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image

From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: PATCH(WIP): Printing Support And Save GQB/Explain as an image
Date: 2009-11-17 12:35:05
Message-ID: 8cf965d30911170435t2d516c93u153e3a92a73c88c8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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<http://www.enterprisedb.com>

"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 Content-Type Size
PrintSupport_Query_Builder_WIP_Ticket_14_v3.patch text/x-patch 62.1 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2009-11-17 18:15:32 Re: Suggestion for pgAgent
Previous Message Albe Laurenz 2009-11-17 07:50:06 Re: Suggestion for pgAgent