diff options
author | Dan Gudmundsson <[email protected]> | 2013-01-15 09:18:49 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-01-15 09:18:49 +0100 |
commit | 0e044f3525d22de4c4c471f601de50ad3acda304 (patch) | |
tree | dfbbcc31814b0890fcb7774a48cf43322b29ac94 /lib/wx/examples/sudoku/sudoku_gui.erl | |
parent | fdd0b38e2c85d897a240e5f8f79e268c6540dbfd (diff) | |
parent | c384a91846f7d0aff189fb51d1d502330d7abef4 (diff) | |
download | otp-0e044f3525d22de4c4c471f601de50ad3acda304.tar.gz otp-0e044f3525d22de4c4c471f601de50ad3acda304.tar.bz2 otp-0e044f3525d22de4c4c471f601de50ad3acda304.zip |
Merge branch 'dgud/wx/fix-wx-2.9-compat/OTP-10407'
* dgud/wx/fix-wx-2.9-compat/OTP-10407: (26 commits)
wx: Fix comments
wx: Workaround wx-2.9 bugs
wx: Mac fixes
wx: Fix demo and tests
wx: Allow 64 bits compilation on mac, requires wxWidgets-2.9
appmon: Move runtime part to runtime_tools app
reltool: fix wxWidgets-2.9 compability
debugger: Fix 2.9 compat
observer: Fix check for graphics contexts
Observer: Fix distribution dialog
observer: Fix font sizes
wx: Fix the demo
wx: Fix loading icons and cursors in Windows
wx: Remove unnecessary casts
wx: Fix changed getfunctions
wx: Depricate wxCursor new functions
wx: Fix int to enum
wx: Include correct m4 file in 2.9
wx: Update examples so they work with both wxWidgets 2.8 and 2.9
wx: Modify tests so they work on wxWidgets-2.9
...
Diffstat (limited to 'lib/wx/examples/sudoku/sudoku_gui.erl')
-rw-r--r-- | lib/wx/examples/sudoku/sudoku_gui.erl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/wx/examples/sudoku/sudoku_gui.erl b/lib/wx/examples/sudoku/sudoku_gui.erl index 3d0c95ffa7..5f3f1a2621 100644 --- a/lib/wx/examples/sudoku/sudoku_gui.erl +++ b/lib/wx/examples/sudoku/sudoku_gui.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -307,19 +307,19 @@ dialog(?PRINT_PAGE_SETUP, S = #gs{frame=Frame, print_psdd=PsDD0, print_d=PD0}) - wxPageSetupDialogData:destroy(PsDD0), wxPrintData:destroy(PD0), S#gs{print_psdd=PsDD, print_d=PD}; -dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD}) -> +dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD, board=Board}) -> + {ok, BoardS} = sudoku_board:get_state(Board), PDD = wxPrintDialogData:new(PD), - Printout1 = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout1 = wxPrintout:new("Print 1", fun(This,Page) -> printout(This,Page,BoardS, S) end, [{getPageInfo, fun getPageInfo/1}]), - Printout2 = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout2 = wxPrintout:new("Print 2", fun(This,Page) -> printout(This,Page,BoardS, S) end, [{getPageInfo, fun getPageInfo/1}]), - Preview = wxPrintPreview:new(Printout1, [{printoutForPrinting,Printout2},{data,PDD}]), + Preview = wxPrintPreview:new(Printout1, [{printoutForPrinting,Printout2},{data,PDD}]), case wxPrintPreview:isOk(Preview) of true -> PF = wxPreviewFrame:new(Preview, Frame, [{title, "Print Preview"}]), wxPreviewFrame:centre(PF, [{dir, ?wxBOTH}]), wxPreviewFrame:initialize(PF), - wxPreviewFrame:centre(PF), wxPreviewFrame:show(PF); false -> io:format("Could not create preview window.\n" @@ -327,10 +327,11 @@ dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD}) -> wxPrintPreview:destroy(Preview) end, S; -dialog(?PRINT, S = #gs{frame=Frame, print_d=PD}) -> +dialog(?PRINT, S = #gs{frame=Frame, print_d=PD, board=Board}) -> + {ok, BoardS} = sudoku_board:get_state(Board), PDD = wxPrintDialogData:new(PD), Printer = wxPrinter:new([{data,PDD}]), - Printout = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,BoardS,S) end, [{getPageInfo, fun getPageInfo/1}]), case wxPrinter:print(Printer, Frame, Printout, [{prompt,true}]) of @@ -374,16 +375,14 @@ init_printer(S) -> getPageInfo(_This) -> {1,1,1,1}. -printout(This, _Page, #gs{board=Board, print_psdd=PsDD}) -> +printout(This, _Page, Board, #gs{print_psdd=PsDD}) -> MX = MY = 500, wxPrintout:fitThisSizeToPageMargins(This, {MX,MY}, PsDD), - + _DBG = {_X,_Y,W,H} = wxPrintout:getLogicalPageMarginsRect(This, PsDD), wxPrintout:offsetLogicalOrigin(This,(W-MX) div 2, (H-MY) div 2), -%% io:format("~p ->{~p,~p} ~n", [_DBG, (W-MX) div 2, (H-MY) div 2]), - DC = wxPrintout:getDC(This), - sudoku_board:draw(Board, DC, {500,500}), + sudoku_board:redraw(DC, {500,500}, Board), true. set_val(Id, Val, Board, G) -> |