Commit 8a47766f authored by Martin Wierich's avatar Martin Wierich
Browse files

small changes

parent 1f59deae
...@@ -203,7 +203,7 @@ HANDLE setupDevmode(int size, char *pData) ...@@ -203,7 +203,7 @@ HANDLE setupDevmode(int size, char *pData)
return hDevmode; return hDevmode;
} }
void passBackPrintSetup(PRINTDLG *pd, CleanString *o_devmode, void get_printSetup_with_PRINTDLG(PRINTDLG *pd, CleanString *o_devmode,
CleanString *o_device, CleanString *o_driver, CleanString *o_output) CleanString *o_device, CleanString *o_driver, CleanString *o_output)
{ {
char *newDriver, *newDevice, *newOutput; char *newDriver, *newDevice, *newOutput;
...@@ -224,14 +224,11 @@ void passBackPrintSetup(PRINTDLG *pd, CleanString *o_devmode, ...@@ -224,14 +224,11 @@ void passBackPrintSetup(PRINTDLG *pd, CleanString *o_devmode,
LocalUnlock(pd->hDevNames); LocalUnlock(pd->hDevNames);
} }
void get_printSetup_with_PRINTDLG(PRINTDLG *pd, CleanString *o_devmode, int release_memory_handles(PRINTDLG *pd, int os) {
CleanString *o_device, CleanString *o_driver, CleanString *o_output)
{
//rMessageBox(NULL, MB_APPLMODAL, "in get_printSetup_with_PRINTDLG", "pd:%i", pd);
passBackPrintSetup(pd, o_devmode, o_device, o_driver, o_output);
LocalFree(pd->hDevNames); LocalFree(pd->hDevNames);
LocalFree(pd->hDevMode); LocalFree(pd->hDevMode);
} return os;
}
UINT APIENTRY DialogToFrontHook(HWND hdl, UINT msg, WPARAM wParam, LPARAM lParam) UINT APIENTRY DialogToFrontHook(HWND hdl, UINT msg, WPARAM wParam, LPARAM lParam)
// This function hooks the Print dialog. It's purpose is to set the dialog in the // This function hooks the Print dialog. It's purpose is to set the dialog in the
......
...@@ -36,16 +36,11 @@ os_getpagedimensions :: !PrintSetup !Bool ...@@ -36,16 +36,11 @@ os_getpagedimensions :: !PrintSetup !Bool
!(!Int,!Int)) !(!Int,!Int))
os_defaultprintsetup :: !*env os_defaultprintsetup :: !*env
-> (!PrintSetup, !*env) -> (!PrintSetup, !*env)
/* MW was
os_printsetupdialog :: !Bool !PrintSetup !*env
-> (!PrintSetup, !*env)
*/
os_printsetupvalid :: !PrintSetup !*env os_printsetupvalid :: !PrintSetup !*env
-> (!Bool, !*env) -> (!Bool, !*env)
class PrintEnvironments printEnv class PrintEnvironments printEnv
where where
// MW11 changed Point into Point2
os_printpageperpage os_printpageperpage
:: !.Bool !Bool :: !.Bool !Bool
!.x !.x
......
...@@ -44,7 +44,7 @@ os_defaultprintsetup env ...@@ -44,7 +44,7 @@ os_defaultprintsetup env
= ({devmode=devmode, device=device, driver=driver, output=output}, env) = ({devmode=devmode, device=device, driver=driver, output=output}, env)
printSetupDialogBoth :: !PrintSetup !(Maybe *Context) -> (!PrintSetup, !Maybe *Context) printSetupDialogBoth :: !PrintSetup !(Maybe *Context) -> (!PrintSetup, !Maybe *Context)
printSetupDialogBoth {devmode,device,driver,output} mb_context printSetupDialogBoth print_setup=:{devmode,device,driver,output} mb_context
# (os, mb_context) = EnvGetOS mb_context # (os, mb_context) = EnvGetOS mb_context
(devmodePtr,os) = WinMakeCString devmode os (devmodePtr,os) = WinMakeCString devmode os
(devicePtr,os) = WinMakeCString device os (devicePtr,os) = WinMakeCString device os
...@@ -56,31 +56,12 @@ printSetupDialogBoth {devmode,device,driver,output} mb_context ...@@ -56,31 +56,12 @@ printSetupDialogBoth {devmode,device,driver,output} mb_context
os = WinReleaseCString driverPtr os os = WinReleaseCString driverPtr os
os = WinReleaseCString outputPtr os os = WinReleaseCString outputPtr os
| ok==0 | ok==0
= ({devmode="\0",device="\0",driver="\0",output="\0"}, EnvSetOS os mb_context) # os = release_memory_handles pdPtr os
# (ndevmode,ndevice,ndriver,noutput,os) = get_printSetup_with_PRINTDLG pdPtr os = (print_setup, EnvSetOS os mb_context)
# ((ndevmode,ndevice,ndriver,noutput),os) = get_printSetup_with_PRINTDLG pdPtr os
os = release_memory_handles pdPtr os
= ({devmode=ndevmode,device=ndevice,driver=ndriver,output=noutput}, EnvSetOS os mb_context) = ({devmode=ndevmode,device=ndevice,driver=ndriver,output=noutput}, EnvSetOS os mb_context)
/* MW was
os_printsetupdialog :: !Bool !PrintSetup !*env
-> (!PrintSetup, !*env)
os_printsetupdialog isWorld {devmode,device,driver,output} env
# (os, env) = EnvGetOS env
# (devmodePtr,os) = WinMakeCString devmode os
(devicePtr,os) = WinMakeCString device os
(driverPtr,os) = WinMakeCString driver os
(outputPtr,os) = WinMakeCString output os
(ok, pdPtr, os)
= CCPrintSetupDialog isWorld (size devmode) devmodePtr devicePtr driverPtr outputPtr os
os = WinReleaseCString devmodePtr os
os = WinReleaseCString devicePtr os
os = WinReleaseCString driverPtr os
os = WinReleaseCString outputPtr os
| ok==0
= ({devmode="\0",device="\0",driver="\0",output="\0"}, EnvSetOS os env)
# (ndevmode,ndevice,ndriver,noutput,os) = get_printSetup_with_PRINTDLG pdPtr os
= ({devmode=ndevmode,device=ndevice,driver=ndriver,output=noutput}, EnvSetOS os env)
*/
os_printsetupvalid :: !PrintSetup !*env os_printsetupvalid :: !PrintSetup !*env
-> (!Bool, !*env) -> (!Bool, !*env)
os_printsetupvalid {devmode,device,driver} env os_printsetupvalid {devmode,device,driver} env
...@@ -95,7 +76,6 @@ os_printsetupvalidC _ _ _ _ ...@@ -95,7 +76,6 @@ os_printsetupvalidC _ _ _ _
class PrintEnvironments printEnv class PrintEnvironments printEnv
where where
// MW11 changed Point into Point2
os_printpageperpage :: !.Bool !Bool os_printpageperpage :: !.Bool !Bool
!.x !.x
.(.x -> .(PrintInfo -> .(*Picture -> ((.Bool,Point2),(.state,*Picture))))) .(.x -> .(PrintInfo -> .(*Picture -> ((.Bool,Point2),(.state,*Picture)))))
...@@ -256,10 +236,13 @@ getPrintInfo doDialog emulateScreen {devmode, device, driver, output} mb_context ...@@ -256,10 +236,13 @@ getPrintInfo doDialog emulateScreen {devmode, device, driver, output} mb_context
os = WinReleaseCString driverPtr os os = WinReleaseCString driverPtr os
os = WinReleaseCString outputPtr os os = WinReleaseCString outputPtr os
| doDialog && (err==(-1)) | doDialog && (err==(-1))
= continuation err data mb_context (get_printSetup_with_PRINTDLG pdPtr os) # (setup_strings, os) = get_printSetup_with_PRINTDLG pdPtr os
= continuation err data mb_context (devmode,device,driver,output,os) os = release_memory_handles pdPtr os
= continuation err data mb_context (setup_strings, os)
# os = release_memory_handles pdPtr os
= continuation err data mb_context ((devmode,device,driver,output),os)
where where
continuation err (first,last,copies,hdc) mb_context (devmode,device,driver,output,os) continuation err (first,last,copies,hdc) mb_context ((devmode,device,driver,output),os)
# first` = max 1 first # first` = max 1 first
last` = max first` last last` = max first` last
copies` = max 1 copies copies` = max 1 copies
...@@ -398,13 +381,20 @@ printSetup _ _ _ _ _ _ _ ...@@ -398,13 +381,20 @@ printSetup _ _ _ _ _ _ _
ccall printSetup "IIIIII:VII:I" ccall printSetup "IIIIII:VII:I"
} }
get_printSetup_with_PRINTDLG :: !Int !*OSToolbox -> (!String, !String, !String, !String, !*OSToolbox) get_printSetup_with_PRINTDLG :: !Int !*OSToolbox -> (!(!String, !String, !String, !String), !*OSToolbox)
get_printSetup_with_PRINTDLG _ _ get_printSetup_with_PRINTDLG _ _
= code = code
{ {
ccall get_printSetup_with_PRINTDLG "I:VSSSS:I" ccall get_printSetup_with_PRINTDLG "I:VSSSS:I"
} }
release_memory_handles :: !Int !*OSToolbox -> *OSToolbox
release_memory_handles _ _
= code
{
ccall release_memory_handles "II-I"
}
startPage :: !HDC !*OSToolbox -> (!OkReturn, !*OSToolbox) startPage :: !HDC !*OSToolbox -> (!OkReturn, !*OSToolbox)
startPage _ _ startPage _ _
= code = code
......
...@@ -111,7 +111,6 @@ printUpdateFunction doDialog updateFunc rectangles printSetup printEnv ...@@ -111,7 +111,6 @@ printUpdateFunction doDialog updateFunc rectangles printSetup printEnv
clipsOfOneRectangle rectangle clipsOfOneRectangle rectangle
= clipRectangles = clipRectangles
where where
// MW11 was (x1,y1,x2,y2) = RectangleToRect rectangle
{rleft=x1,rtop=y1,rright=x2,rbottom=y2} = RectangleToRect rectangle {rleft=x1,rtop=y1,rright=x2,rbottom=y2} = RectangleToRect rectangle
wR = x2-x1+1 wR = x2-x1+1
hR = y2-y1+1 hR = y2-y1+1
...@@ -134,7 +133,6 @@ printUpdateFunction doDialog updateFunc rectangles printSetup printEnv ...@@ -134,7 +133,6 @@ printUpdateFunction doDialog updateFunc rectangles printSetup printEnv
((printSetup,rest), appClipPicture (toRegion clipRect) drawFunction picture) ((printSetup,rest), appClipPicture (toRegion clipRect) drawFunction picture)
) )
// MW11 changed Point into Point2
printPagePerPage :: !Bool !Bool printPagePerPage :: !Bool !Bool
.x .x
.(.x -> .(PrintInfo -> .(*Picture -> ((.Bool,Point2),(.state,*Picture))))) .(.x -> .(PrintInfo -> .(*Picture -> ((.Bool,Point2),(.state,*Picture)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment