summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/print.tcl16
-rw-r--r--macosx/tkMacOSXPrint.c13
2 files changed, 13 insertions, 16 deletions
diff --git a/library/print.tcl b/library/print.tcl
index 4c9e13e..bed0cd3 100644
--- a/library/print.tcl
+++ b/library/print.tcl
@@ -861,7 +861,6 @@ namespace eval ::tk::print {
variable printcopies
variable p
-
#First, generate print file.
if {[winfo class $w] eq "Text"} {
@@ -954,7 +953,6 @@ proc ::tk::print::canvas {w} {
}
-
proc ::tk::print::text {w} {
if {[tk windowingsystem] eq "win32"} {
@@ -965,19 +963,19 @@ proc ::tk::print::text {w} {
close $print_txt
::tk::print::_print_file $x 1 {Arial 12}
}
- if {[tk windowingsystem] eq "x11"} {
+ if {[tk windowingsystem] eq "x11"} {
::tk::print::_print $w
- }
+ }
if {[tk windowingsystem] eq "aqua"} {
- set txt [$w get 1.0 end]
- set file /tmp/tk_text.txt
- set print_txt [open $file w]
- puts $print_txt $txt
+ set txt [$w get 1.0 end]
+ set file /tmp/tk_text.txt
+ set print_txt [open $file w]
+ puts $print_txt $txt
close $print_txt
set printfile /tmp/tk_text.pdf
catch {exec /usr/sbin/cupsfilter $file > $printfile}
::tk::print::_print $printfile
- }
+ }
}
#Add this command to the tk command ensemble: tk print
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
index fcb5663..cd55975 100644
--- a/macosx/tkMacOSXPrint.c
+++ b/macosx/tkMacOSXPrint.c
@@ -23,7 +23,7 @@
/* Forward declarations of functions and variables. */
NSString * fileName = nil;
CFStringRef urlFile = NULL;
-int StartPrint(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]);
+int StartPrint(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
OSStatus FinishPrint(NSString * file, int buttonValue);
int MacPrint_Init(Tcl_Interp * interp);
@@ -69,9 +69,9 @@ int MacPrint_Init(Tcl_Interp * interp);
*----------------------------------------------------------------------
*/
-int StartPrint(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]) {
+int StartPrint(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
- void clientData;
+ (void) clientData;
NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintPanel * printPanel = [NSPrintPanel printPanel];
int accepted;
@@ -82,7 +82,7 @@ int StartPrint(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *con
OSStatus status = noErr;
/* Check for proper number of arguments. */
- if (objc != 2) {
+ if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "file");
return TCL_ERROR;
}
@@ -92,8 +92,7 @@ int StartPrint(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *con
CFRetain(urlFile);
/* Initialize the delegate for the callback from the page panel. */
- PrintDelegate * printDelegate = [
- [PrintDelegate alloc] init];
+ PrintDelegate * printDelegate = [[PrintDelegate alloc] init];
status = PMCreateSession( & printSession);
if (status != noErr) {
@@ -175,7 +174,7 @@ OSStatus FinishPrint(NSString * file, int buttonValue) {
printSettings = (PMPrintSettings)[printInfo PMPrintSettings];
/*Handle print operation.*/
- if (buttonValue = NSModalResponseOK) {
+ if (buttonValue == NSModalResponseOK) {
if (urlFile == NULL) {
NSLog(@ "Could not get file to print.");