diff options
author | Kevin Walzer <kw@codebykevin.com> | 2019-03-07 03:56:19 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2019-03-07 03:56:19 (GMT) |
commit | 537386f4a6d884537e64d0a994b375d97d5ccf10 (patch) | |
tree | e155a1632f76a8ede4a6919c4eefac0e2b5e53fc /macosx | |
parent | e7619b55d90b8d69afd4424ee4a897553a305427 (diff) | |
download | tk-537386f4a6d884537e64d0a994b375d97d5ccf10.zip tk-537386f4a6d884537e64d0a994b375d97d5ccf10.tar.gz tk-537386f4a6d884537e64d0a994b375d97d5ccf10.tar.bz2 |
Clean up implementation and documentation of ::tk::mac::PrintDocument command; was mapped internally to ::tk::mac::OpenDocument and print event never fired; changed parameter to a single file path
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXHLEvents.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 0bd2d5e..d2843a8 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -126,9 +126,24 @@ static int ReallyKillMe(Tcl_Event *eventPtr, int flags); - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { - tkMacOSXProcessFiles(event, replyEvent, _eventInterp, "::tk::mac::PrintDocument"); + + NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] + stringValue]; + const char *printFile=[file UTF8String]; + Tcl_DString print; + Tcl_DStringInit(&print); + if (Tcl_FindCommand(_eventInterp, "::tk::mac::PrintDocument", NULL, 0)) { + Tcl_DStringAppend(&print, "::tk::mac::PrintDocument", -1); + } + Tcl_DStringAppendElement(&print, printFile); + int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&print), + Tcl_DStringLength(&print), TCL_EVAL_GLOBAL); + if (tclErr!= TCL_OK) { + Tcl_BackgroundException(_eventInterp, tclErr); + } } + - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { |