Updates for 0.9.19 release. Added authorization code to permit Fontconfig files to be installed on first launch from a non-admin account. Fixed possible lockups in fullscreen mode when attempting to print.
This commit is contained in:
parent
3c062cd1e1
commit
04506fa385
10 changed files with 264 additions and 118 deletions
6
src/im.c
6
src/im.c
|
|
@ -40,7 +40,13 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __APPLE_10_2_8__
|
||||
#include <wchar.h>
|
||||
#else
|
||||
#define wchar_t char
|
||||
#endif
|
||||
|
||||
#include "im.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -83,13 +83,10 @@ NSData* printData = nil;
|
|||
- (BOOL) wait
|
||||
{
|
||||
while (!_complete) {
|
||||
|
||||
NSEvent *event;
|
||||
|
||||
event = [ NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:[ NSDate distantFuture ]
|
||||
inMode: NSDefaultRunLoopMode dequeue:YES ];
|
||||
|
||||
[ NSApp sendEvent:event ];
|
||||
}
|
||||
|
||||
|
|
@ -204,14 +201,10 @@ NSPrintInfo* LoadPrintInfo( const SDL_Surface *surface )
|
|||
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
|
||||
|
||||
if( standardUserDefaults )
|
||||
{
|
||||
printData = [ standardUserDefaults dataForKey:@"PrintInfo" ];
|
||||
}
|
||||
|
||||
if( printData )
|
||||
{
|
||||
printInfo = (NSPrintInfo*)[ NSUnarchiver unarchiveObjectWithData:printData ];
|
||||
}
|
||||
else
|
||||
{
|
||||
printInfo = [ NSPrintInfo sharedPrintInfo ];
|
||||
|
|
@ -234,9 +227,7 @@ void SavePrintInfo( NSPrintInfo* printInfo )
|
|||
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
|
||||
|
||||
if( standardUserDefaults )
|
||||
{
|
||||
[ standardUserDefaults setObject:printData forKey:@"PrintInfo" ];
|
||||
}
|
||||
}
|
||||
|
||||
int DisplayPageSetup( const SDL_Surface * surface )
|
||||
|
|
@ -275,12 +266,16 @@ const char* SurfacePrint( SDL_Surface *surface, int showDialog )
|
|||
NSPrintInfo* printInfo;
|
||||
ModalDelegate* delegate;
|
||||
BOOL ok = YES;
|
||||
const char* error = NULL;
|
||||
|
||||
|
||||
// check if printers are available
|
||||
NSArray* printerNames = [NSPrinter printerNames];
|
||||
if( [printerNames count] == 0 && !showDialog)
|
||||
return "No printer is available. Run Tux Paint in window mode (not fullscreen), and select File > Print... to choose a printer.";
|
||||
|
||||
// create image for surface
|
||||
image = CreateImage( surface );
|
||||
if( image == nil )
|
||||
return "Could not create image";
|
||||
return "Could not create a print image.";
|
||||
|
||||
// create print control objects
|
||||
printInfo = LoadPrintInfo( surface );
|
||||
|
|
@ -299,18 +294,15 @@ const char* SurfacePrint( SDL_Surface *surface, int showDialog )
|
|||
|
||||
NSSize imageSize = pageSize;
|
||||
if( pageRatio > surfaceRatio ) // wide page
|
||||
{
|
||||
imageSize.width = surface->w * pageSize.height / surface->h;
|
||||
}
|
||||
else // tall page
|
||||
{
|
||||
imageSize.height = surface->h * pageSize.width / surface->w;
|
||||
}
|
||||
|
||||
|
||||
// create print view
|
||||
printView = [ [ [ ImageView alloc ] initWithFrame: NSMakeRect( 0, 0, imageSize.width, imageSize.height ) ] autorelease ];
|
||||
if (printView == nil)
|
||||
return "Could not create print view";
|
||||
return "Could not create a print view.";
|
||||
|
||||
[ image setSize:imageSize ];
|
||||
[ printView setImage:image ];
|
||||
|
||||
|
|
@ -324,14 +316,12 @@ const char* SurfacePrint( SDL_Surface *surface, int showDialog )
|
|||
delegate:delegate didRunSelector:@selector(printDidRun:success:contextInfo:) contextInfo:nil ];
|
||||
|
||||
ok = [ delegate wait ];
|
||||
if (!ok)
|
||||
error = "Canceled or error when printing";
|
||||
|
||||
macosx.cocoaKeystrokes = 0;
|
||||
|
||||
SavePrintInfo( printInfo );
|
||||
[ image release ];
|
||||
|
||||
return error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -987,12 +987,12 @@ static SDL_Surface *render_text(TuxPaint_Font * restrict font,
|
|||
fflush(stdout);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (macosx.buildingFontCache == 1)
|
||||
displayMessage( MSG_FONT_CACHE );
|
||||
#endif
|
||||
|
||||
displayMessage(MSG_FONT_CACHE);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SDLPANGO
|
||||
if (font->typ == FONT_TYPE_PANGO)
|
||||
{
|
||||
|
|
@ -1008,15 +1008,15 @@ static SDL_Surface *render_text(TuxPaint_Font * restrict font,
|
|||
ret = SDLPango_CreateSurfaceDraw(font->pango_context);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (macosx.buildingFontCache = 1)
|
||||
if (macosx.buildingFontCache == 1)
|
||||
{
|
||||
macosx.buildingFontCache = 0;
|
||||
hideMessage();
|
||||
macosx.buildingFontCache = 0;
|
||||
hideMessage();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (font->typ == FONT_TYPE_TTF)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
|
@ -2211,7 +2211,7 @@ static void mainloop(void)
|
|||
cursor_y = min(cursor_y + font_height, canvas->h - font_height);
|
||||
|
||||
playsound(screen, 0, SND_RETURN, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
|
||||
#ifndef NOSOUND
|
||||
#ifdef SPEECH
|
||||
#ifdef __APPLE__
|
||||
if (use_sound)
|
||||
speak_string(texttool_str);
|
||||
|
|
@ -2229,7 +2229,7 @@ static void mainloop(void)
|
|||
texttool_len = 0;
|
||||
cursor_textwidth = 0;
|
||||
}
|
||||
#ifndef NOSOUND
|
||||
#ifdef SPEECH
|
||||
#ifdef __APPLE__
|
||||
if (use_sound)
|
||||
speak_string(texttool_str);
|
||||
|
|
@ -15054,12 +15054,13 @@ void do_print(void)
|
|||
int show = ( ( want_alt_printcommand || macosx.menuAction ) && !fullscreen);
|
||||
|
||||
const char *error = SurfacePrint(canvas, show);
|
||||
/*
|
||||
|
||||
if (error)
|
||||
{
|
||||
fprintf(stderr, "Cannot print: %s\n", error);
|
||||
else
|
||||
do_prompt_snd(PROMPT_PRINT_TXT, PROMPT_PRINT_YES, "", SND_TUXOK);
|
||||
*/
|
||||
do_prompt_snd(error, PROMPT_PRINT_YES, "", SND_TUXOK, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue