Merge branch 'master' into sdl2.0
This commit is contained in:
commit
716e4ec55d
25 changed files with 765 additions and 166 deletions
45
src/debug.h
45
src/debug.h
|
|
@ -1,4 +1,49 @@
|
|||
#define DEBUG
|
||||
#define VERBOSE
|
||||
|
||||
/*
|
||||
* Enable verbose logging if requested on platforms that support it.
|
||||
*
|
||||
* Verbose logging adds metadata to printf, including the source file location
|
||||
* from where printf was called and the time it was called at runtime.
|
||||
*/
|
||||
#if defined(DEBUG) && defined(VERBOSE) && defined(__GNUC__)
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#define printf(args...) do { \
|
||||
time_t now = time(NULL); \
|
||||
printf("\n### %s, line %d in %s() @ %s", __FILE__, __LINE__, __FUNCTION__, ctime(&now)); \
|
||||
printf(args); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Define a convenience macro DEBUG_PRINTF(). This macro resolves to printf()
|
||||
* if and only if DEBUG is enabled, otherwise resolves to nothing. In other
|
||||
* words,
|
||||
*
|
||||
* DEBUG_PRINTF("Hello, world!\n");
|
||||
*
|
||||
* ... is equivalent to:
|
||||
*
|
||||
* #if defined(DEBUG)
|
||||
* printf("Hello, world!\n");
|
||||
* #endif
|
||||
*
|
||||
* (To be precise, the semicolon falls outside of the #if test, but an empty
|
||||
* semicolon resolves to nothing in standard C.)
|
||||
*
|
||||
* If VERBOSE logging is enabled, DEBUG_PRINTF should resolve to the verbose
|
||||
* version of printf() defined earlier in this file.
|
||||
*/
|
||||
#if defined(DEBUG)
|
||||
#define DEBUG_PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_PRINTF(...)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
|
|
|
|||
40
src/macos_print.h
Normal file
40
src/macos_print.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// macosx_print.h
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Darrell Walisser on Sat Mar 15 2003.
|
||||
// Modified by Martin Fuhrer 2007.
|
||||
// Copyright (c) 2007 Darrell Walisser, Martin Fuhrer. All rights reserved.
|
||||
// $Id$
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// (See COPYING.txt)
|
||||
//
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
const char *SurfacePrint(SDL_Surface * surface, int showDialog);
|
||||
int DisplayPageSetup(const SDL_Surface * surface);
|
||||
|
||||
#ifdef OBJECTIVEC
|
||||
|
||||
@interface PrintSheetController:NSObject
|
||||
{
|
||||
bool displayPrintSetupSheet;
|
||||
bool displayPrintSheet;
|
||||
}
|
||||
|
||||
-@end
|
||||
#endif /* OBJECTIVEC */
|
||||
330
src/macos_print.m
Normal file
330
src/macos_print.m
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
//
|
||||
// macos_print.m
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Darrell Walisser on Sat Mar 15 2003.
|
||||
// Modified by Martin Fuhrer 2007.
|
||||
// Modified by Mark Kim 2018.
|
||||
// Copyright (c) 2018 Darrell Walisser, Martin Fuhrer, Mark Kim.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// (See COPYING.txt)
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
#import "macos_print.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
struct {
|
||||
int cocoaKeystrokes; // should keystrokes be intercepted by Cocoa wrapper?
|
||||
} macos;
|
||||
|
||||
NSData* printData = nil;
|
||||
|
||||
// this object presents the image to the printing layer
|
||||
@interface ImageView : NSView
|
||||
{
|
||||
NSImage* _image;
|
||||
}
|
||||
- (void) setImage:(NSImage*)image;
|
||||
@end
|
||||
|
||||
@implementation ImageView
|
||||
|
||||
- (void) setImage:(NSImage*)image
|
||||
{
|
||||
_image = [ image retain ];
|
||||
}
|
||||
|
||||
- (void) drawRect:(NSRect)rect
|
||||
{
|
||||
[ _image compositeToPoint: NSMakePoint( 0, 0 ) operation: NSCompositeCopy ];
|
||||
}
|
||||
|
||||
- (BOOL) scalesWhenResized
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// this object waits for the print dialog to go away
|
||||
@interface ModalDelegate : NSObject
|
||||
{
|
||||
BOOL _complete;
|
||||
BOOL _wasOK;
|
||||
}
|
||||
- (id) init;
|
||||
- (BOOL) wait;
|
||||
- (void) reset;
|
||||
- (BOOL) wasOK;
|
||||
@end
|
||||
|
||||
@implementation ModalDelegate
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [ super init ];
|
||||
_complete = NO;
|
||||
_wasOK = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) wait
|
||||
{
|
||||
while (!_complete) {
|
||||
NSEvent *event;
|
||||
event = [ NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:[ NSDate distantFuture ]
|
||||
inMode: NSDefaultRunLoopMode dequeue:YES ];
|
||||
[ NSApp sendEvent:event ];
|
||||
}
|
||||
|
||||
return [ self wasOK ];
|
||||
}
|
||||
|
||||
- (void) reset
|
||||
{
|
||||
_complete = NO;
|
||||
_wasOK = NO;
|
||||
}
|
||||
|
||||
- (BOOL) wasOK
|
||||
{
|
||||
return _wasOK;
|
||||
}
|
||||
|
||||
- (void)printDidRun:(NSPrintOperation *)printOperation
|
||||
success:(BOOL)success contextInfo:(void *)contextInfo
|
||||
{
|
||||
_complete = YES;
|
||||
_wasOK = success;
|
||||
}
|
||||
|
||||
- (void)pageLayoutEnded:(NSPageLayout *)pageLayout
|
||||
returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
_complete = YES;
|
||||
_wasOK = returnCode == NSOKButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSImage* CreateImage( SDL_Surface *surface )
|
||||
{
|
||||
NSBitmapImageRep* imageRep;
|
||||
NSSize imageSize;
|
||||
NSImage* image;
|
||||
SDL_Surface* surface32RGBA;
|
||||
|
||||
// convert surface to 32bit RGBA
|
||||
#ifdef BIG_ENDIAN_ARCH
|
||||
surface32RGBA = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h,
|
||||
32, 0xff<<24, 0xff<<16, 0xff<<8, 0xff<<0 );
|
||||
#else
|
||||
surface32RGBA = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h,
|
||||
32, 0xff<<0, 0xff<<8, 0xff<<16, 0xff<<24 );
|
||||
#endif
|
||||
if( surface32RGBA == NULL ) {
|
||||
NSLog (@"CreateImage: Cannot allocate conversion surface");
|
||||
return nil;
|
||||
}
|
||||
|
||||
SDL_BlitSurface( surface, NULL, surface32RGBA, NULL );
|
||||
|
||||
// convert surface to an NSBitmapImageRep
|
||||
imageRep = [ [ NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes:(unsigned char **)&surface32RGBA->pixels
|
||||
pixelsWide:surface->w
|
||||
pixelsHigh:surface->h
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:surface->w * 4
|
||||
bitsPerPixel:32 ];
|
||||
if( imageRep == nil ) {
|
||||
NSLog (@"CreateImage: Could not create image representation.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
imageSize = NSMakeSize( surface->w, surface->h );
|
||||
|
||||
image = [ [ NSImage alloc ] initWithSize:imageSize ];
|
||||
if( image == nil ) {
|
||||
NSLog (@"CreateImage: Could not allocate image");
|
||||
return nil;
|
||||
}
|
||||
|
||||
[ image addRepresentation:imageRep ];
|
||||
[ image setScalesWhenResized:YES ];
|
||||
[ image setDataRetained:YES ];
|
||||
|
||||
[ image autorelease ];
|
||||
[ imageRep release ];
|
||||
free( surface32RGBA );
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void DefaultPrintSettings( const SDL_Surface *surface, NSPrintInfo *printInfo )
|
||||
{
|
||||
if( surface->w > surface->h )
|
||||
[ printInfo setOrientation:NSLandscapeOrientation ];
|
||||
else
|
||||
[ printInfo setOrientation:NSPortraitOrientation ];
|
||||
|
||||
[ printInfo setHorizontallyCentered:true ];
|
||||
[ printInfo setVerticallyCentered:true ];
|
||||
[ printInfo setVerticalPagination:NSFitPagination ];
|
||||
[ printInfo setHorizontalPagination:NSFitPagination ];
|
||||
}
|
||||
|
||||
NSPrintInfo* LoadPrintInfo( const SDL_Surface *surface )
|
||||
{
|
||||
NSUserDefaults* standardUserDefaults;
|
||||
NSPrintInfo* printInfo;
|
||||
NSData* printData = nil;
|
||||
static BOOL firstTime = YES;
|
||||
|
||||
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
|
||||
|
||||
if( standardUserDefaults )
|
||||
printData = [ standardUserDefaults dataForKey:@"PrintInfo" ];
|
||||
|
||||
if( printData )
|
||||
printInfo = (NSPrintInfo*)[ NSUnarchiver unarchiveObjectWithData:printData ];
|
||||
else
|
||||
{
|
||||
printInfo = [ NSPrintInfo sharedPrintInfo ];
|
||||
if( firstTime == YES )
|
||||
{
|
||||
DefaultPrintSettings( surface, printInfo );
|
||||
firstTime = NO;
|
||||
}
|
||||
}
|
||||
|
||||
return printInfo;
|
||||
}
|
||||
|
||||
void SavePrintInfo( NSPrintInfo* printInfo )
|
||||
{
|
||||
NSUserDefaults* standardUserDefaults;
|
||||
NSData* printData = nil;
|
||||
|
||||
printData = [ NSArchiver archivedDataWithRootObject:printInfo ];
|
||||
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
|
||||
|
||||
if( standardUserDefaults )
|
||||
[ standardUserDefaults setObject:printData forKey:@"PrintInfo" ];
|
||||
}
|
||||
|
||||
int DisplayPageSetup( const SDL_Surface * surface )
|
||||
{
|
||||
NSPageLayout* pageLayout;
|
||||
NSPrintInfo* printInfo;
|
||||
ModalDelegate* delegate;
|
||||
BOOL result;
|
||||
|
||||
macos.cocoaKeystrokes = 1;
|
||||
|
||||
printInfo = LoadPrintInfo( surface );
|
||||
|
||||
delegate = [ [ [ ModalDelegate alloc ] init ] autorelease ];
|
||||
pageLayout = [ NSPageLayout pageLayout ];
|
||||
[ pageLayout beginSheetWithPrintInfo:printInfo
|
||||
modalForWindow:[ NSApp mainWindow ]
|
||||
delegate:delegate
|
||||
didEndSelector:@selector(pageLayoutEnded:returnCode:contextInfo:)
|
||||
contextInfo:nil ];
|
||||
|
||||
result = [ delegate wait ];
|
||||
SavePrintInfo( printInfo );
|
||||
|
||||
macos.cocoaKeystrokes = 0;
|
||||
|
||||
return (int)( result );
|
||||
}
|
||||
|
||||
const char* SurfacePrint( SDL_Surface *surface, int showDialog )
|
||||
{
|
||||
NSImage* image;
|
||||
ImageView* printView;
|
||||
NSWindow* printWindow;
|
||||
NSPrintOperation* printOperation;
|
||||
NSPrintInfo* printInfo;
|
||||
ModalDelegate* delegate;
|
||||
BOOL ok = YES;
|
||||
|
||||
// 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 a print image.";
|
||||
|
||||
// create print control objects
|
||||
printInfo = LoadPrintInfo( surface );
|
||||
|
||||
NSRect pageRect = [ printInfo imageablePageBounds ];
|
||||
NSSize pageSize = pageRect.size;
|
||||
NSPoint pageOrigin = pageRect.origin;
|
||||
|
||||
[ printInfo setTopMargin:pageOrigin.y ];
|
||||
[ printInfo setLeftMargin:pageOrigin.x ];
|
||||
[ printInfo setRightMargin:pageOrigin.x ];
|
||||
[ printInfo setBottomMargin:pageOrigin.y ];
|
||||
|
||||
float surfaceRatio = (float)( surface->w ) / (float)( surface->h );
|
||||
float pageRatio = pageSize.width / pageSize.height;
|
||||
|
||||
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 a print view.";
|
||||
|
||||
[ image setSize:imageSize ];
|
||||
[ printView setImage:image ];
|
||||
|
||||
// run printing
|
||||
printOperation = [ NSPrintOperation printOperationWithView:printView printInfo:printInfo ];
|
||||
[ printOperation setShowsPrintPanel:showDialog ]; //EP replaced setShowPanels by setShowsPrintPanel
|
||||
|
||||
macos.cocoaKeystrokes = 1;
|
||||
delegate = [ [ [ ModalDelegate alloc ] init ] autorelease ];
|
||||
[ printOperation runOperationModalForWindow:[ NSApp mainWindow ]
|
||||
delegate:delegate didRunSelector:@selector(printDidRun:success:contextInfo:) contextInfo:nil ];
|
||||
|
||||
ok = [ delegate wait ];
|
||||
|
||||
macos.cocoaKeystrokes = 0;
|
||||
|
||||
SavePrintInfo( printInfo );
|
||||
[ image release ];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
.\" tuxpaint.1 - 2018.08.19
|
||||
.TH TUXPAINT 1 "19 August 2018" "0.9.23" "Tux Paint"
|
||||
.\" tuxpaint.1 - 2018.09.24
|
||||
.TH TUXPAINT 1 "24 September 2018" "0.9.23c" "Tux Paint"
|
||||
.SH NAME
|
||||
tuxpaint -- "Tux Paint", a drawing program for young children.
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ mirrorstamps, POSBOOL(mirrorstamps)
|
|||
mixedcase, NEGBOOL(only_uppercase)
|
||||
mouse, NEGBOOL(keymouse)
|
||||
native, POSBOOL(native_screensize)
|
||||
newcolorsfirst, NEGBOOL(new_colors_last)
|
||||
newcolorslast, POSBOOL(new_colors_last)
|
||||
orient, MULTI(rotate_orientation)
|
||||
outlines, NEGBOOL(dont_do_xor)
|
||||
papersize, MULTI(papersize)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ struct cfginfo
|
|||
const char *keymouse;
|
||||
const char *mirrorstamps;
|
||||
const char *native_screensize;
|
||||
const char *new_colors_last;
|
||||
const char *no_button_distinction;
|
||||
const char *no_fancy_cursors;
|
||||
const char *no_system_fonts;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
# FIXME: See http://www.debian-administration.org/articles/316 for an intro
|
||||
# to how we should be doing this... -bjk 2009.09.09
|
||||
|
||||
# FIXME: Use the source to list all of the available options -bjk 2018.12.18
|
||||
|
||||
have tuxpaint &&
|
||||
_tuxpaint()
|
||||
{
|
||||
|
|
@ -41,6 +43,7 @@ _tuxpaint()
|
|||
--nobuttondistinction --buttondistinction \
|
||||
--outlines --nooutlines \
|
||||
--stamps --nostamps \
|
||||
--newcolorsfirst --newcolorslast \
|
||||
--sysfonts --nosysfonts \
|
||||
--nostampcontrols --stampcontrols \
|
||||
--nomagiccontrols --magiccontrols \
|
||||
|
|
|
|||
342
src/tuxpaint.c
342
src/tuxpaint.c
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - August 28, 2018
|
||||
June 14, 2002 - December 18, 2018
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -302,6 +302,17 @@ typedef struct safer_dirent
|
|||
|
||||
#else /* __BEOS__ */
|
||||
|
||||
/* Not BeOS */
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
/* Apple */
|
||||
|
||||
#include "macos_print.h"
|
||||
|
||||
#else /* __APPLE__ */
|
||||
|
||||
/* Not Windows, not BeOS, not Apple */
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#define AUTOSAVE_GOING_BACKGROUND
|
||||
|
|
@ -310,12 +321,14 @@ typedef struct safer_dirent
|
|||
|
||||
#else
|
||||
|
||||
/* Not Windows, not BeOS, not Android */
|
||||
/* Not Windows, not BeOS, not Apple, not Android*/
|
||||
|
||||
#include "postscript_print.h"
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
#else /* WIN32 */
|
||||
|
|
@ -1280,6 +1293,7 @@ static int dont_load_stamps;
|
|||
static int mirrorstamps;
|
||||
static int disable_stamp_controls;
|
||||
static int stamp_size_override = -1;
|
||||
static int new_colors_last;
|
||||
|
||||
#ifdef NOKIA_770
|
||||
static int simple_shapes = 1;
|
||||
|
|
@ -1450,7 +1464,7 @@ enum
|
|||
static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
|
||||
|
||||
|
||||
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
#include <paper.h>
|
||||
#if !defined(PAPER_H)
|
||||
#error "---------------------------------------------------"
|
||||
|
|
@ -2046,6 +2060,7 @@ static void get_new_file_id(void);
|
|||
static int do_quit(int tool);
|
||||
static int do_open(void);
|
||||
static int do_new_dialog(void);
|
||||
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette);
|
||||
static int do_color_picker(void);
|
||||
static int do_color_sel(void);
|
||||
static int do_slideshow(void);
|
||||
|
|
@ -2716,6 +2731,14 @@ static void mainloop(void)
|
|||
|
||||
magic_switchin(canvas);
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && !noshortcuts)
|
||||
{
|
||||
/* Ctrl-Shft-P - Page Setup */
|
||||
if (!disable_print)
|
||||
DisplayPageSetup(canvas);
|
||||
}
|
||||
#endif
|
||||
else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts)
|
||||
{
|
||||
/* Ctrl-P - Print */
|
||||
|
|
@ -6648,80 +6671,92 @@ void show_version(int details)
|
|||
void show_usage(int exitcode)
|
||||
{
|
||||
FILE *f = exitcode ? stderr : stdout;
|
||||
char *blank;
|
||||
unsigned i;
|
||||
|
||||
blank = strdup(progname);
|
||||
|
||||
for (i = 0; i < strlen(blank); i++)
|
||||
blank[i] = ' ';
|
||||
|
||||
fprintf(f,
|
||||
"\n"
|
||||
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
|
||||
"\n"
|
||||
" %s [--windowed | --fullscreen]\n"
|
||||
" %s [--WIDTHxHEIGHT | --native]\n"
|
||||
" %s [--disablescreensaver | --allowscreensaver ]\n"
|
||||
" %s [--orient=landscape | --orient=portrait]\n"
|
||||
" %s [--startblank | --startlast]\n"
|
||||
" %s [--sound | --nosound]\n"
|
||||
" %s [--quit | --noquit]\n"
|
||||
" %s [--print | --noprint]\n"
|
||||
" %s [--complexshapes | --simpleshapes]\n"
|
||||
" %s [--mixedcase | --uppercase]\n"
|
||||
" %s [--fancycursors | --nofancycursors]\n"
|
||||
" %s [--hidecursor | --showcursor]\n"
|
||||
" %s [--mouse | --keyboard]\n"
|
||||
" %s [--dontgrab | --grab]\n"
|
||||
" %s [--noshortcuts | --shortcuts]\n"
|
||||
" %s [--wheelmouse | --nowheelmouse]\n"
|
||||
" %s [--nobuttondistinction | --buttondistinction]\n"
|
||||
" %s [--outlines | --nooutlines]\n"
|
||||
" %s [--stamps | --nostamps]\n"
|
||||
" %s [--sysfonts | --nosysfonts]\n"
|
||||
" %s [--nostampcontrols | --stampcontrols]\n"
|
||||
" %s [--nomagiccontrols | --magiccontrols]\n"
|
||||
" %s [--nolabel | --label]\n"
|
||||
" %s [--mirrorstamps | --dontmirrorstamps]\n"
|
||||
" %s [--stampsize=[0-10] | --stampsize=default]\n"
|
||||
" %s [--saveoverask | --saveover | --saveovernew]\n"
|
||||
" %s [--nosave | --save]\n"
|
||||
" %s [--autosave | --noautosave]\n" " %s [--savedir DIRECTORY]\n" " %s [--datadir DIRECTORY]\n"
|
||||
" Config:\n"
|
||||
" [--nosysconfig]\n"
|
||||
"\n"
|
||||
" Video/Sound:\n"
|
||||
" [--windowed | --fullscreen]\n"
|
||||
" [--WIDTHxHEIGHT | --native]\n"
|
||||
" [--orient=landscape | --orient=portrait]\n"
|
||||
" [--disablescreensaver | --allowscreensaver ]\n"
|
||||
" [--sound | --nosound]\n"
|
||||
" [--colorfile FILE]\n"
|
||||
"\n"
|
||||
" Mouse/Keyboard:\n"
|
||||
" [--fancycursors | --nofancycursors]\n"
|
||||
" [--hidecursor | --showcursor]\n"
|
||||
" [--noshortcuts | --shortcuts]\n"
|
||||
" [--dontgrab | --grab]\n"
|
||||
" [--wheelmouse | --nowheelmouse]\n"
|
||||
" [--nobuttondistinction | --buttondistinction]\n"
|
||||
"\n"
|
||||
" Simplification:\n"
|
||||
" [--complexshapes | --simpleshapes]\n"
|
||||
" [--outlines | --nooutlines]\n"
|
||||
" [--mixedcase | --uppercase]\n"
|
||||
" [--stampsize=[0-10] | --stampsize=default]\n"
|
||||
" [--quit | --noquit]\n"
|
||||
" [--stamps | --nostamps]\n"
|
||||
" [--nostampcontrols | --stampcontrols]\n"
|
||||
" [--nomagiccontrols | --magiccontrols]\n"
|
||||
" [--nolabel | --label]\n"
|
||||
" [--newcolorsfirst | --newcolorslast]\n"
|
||||
"\n"
|
||||
" Languages:\n"
|
||||
" [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
|
||||
" [--mirrorstamps | --dontmirrorstamps]\n"
|
||||
" [--sysfonts | --nosysfonts]\n"
|
||||
" [--currentlocalefont | --alllocalefonts]\n"
|
||||
"\n"
|
||||
" Printing:\n"
|
||||
" [--print | --noprint]\n"
|
||||
" [--printdelay=SECONDS]\n"
|
||||
" [--altprintmod | --altprintalways | --altprintnever]\n"
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
" %s [--printcfg | --noprintcfg]\n"
|
||||
" [--printcfg | --noprintcfg]\n"
|
||||
#endif
|
||||
" %s [--printdelay=SECONDS]\n" " %s [--altprintmod | --altprintalways | --altprintnever]\n"
|
||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
" %s [--papersize PAPERSIZE | --papersize help]\n"
|
||||
#endif
|
||||
" %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
|
||||
" %s [--nosysconfig]\n"
|
||||
" %s [--nolockfile]\n"
|
||||
" %s [--colorfile FILE]\n"
|
||||
" %s [--mouse-accessibility]\n"
|
||||
" %s [--onscreen-keyboard]\n"
|
||||
" %s [--joystick-dev N] (default=0)\n"
|
||||
" %s [--joystick-slowness N] (0-500; default value is 15)\n"
|
||||
" %s [--joystick-threshold N] (0-32766; default value is 3200)\n"
|
||||
" %s [--joystick-maxsteps N] (1-7; default value is 7)\n"
|
||||
"\n",
|
||||
progname, progname,
|
||||
blank, blank, blank, blank,
|
||||
blank, blank, blank, blank,
|
||||
blank, blank, blank, blank,
|
||||
blank, blank, blank, blank,
|
||||
blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank,
|
||||
#ifdef WIN32
|
||||
blank,
|
||||
#endif
|
||||
blank, blank,
|
||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
blank,
|
||||
#endif
|
||||
blank, blank, blank, blank, blank, blank, blank, blank, blank, blank);
|
||||
|
||||
free(blank);
|
||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
" [--printcommand=COMMAND]\n"
|
||||
" [--altprintcommand=COMMAND]\n"
|
||||
" [--papersize PAPERSIZE | --papersize help]\n"
|
||||
#endif
|
||||
"\n"
|
||||
" Saving:\n"
|
||||
" [--saveoverask | --saveover | --saveovernew]\n"
|
||||
" [--startblank | --startlast]\n"
|
||||
" [--savedir DIRECTORY]\n"
|
||||
" [--nosave | --save]\n"
|
||||
" [--autosave | --noautosave]\n"
|
||||
"\n"
|
||||
" Data:\n"
|
||||
" [--nolockfile]\n"
|
||||
" [--datadir DIRECTORY]\n"
|
||||
"\n"
|
||||
" Accessibility:\n"
|
||||
" [--mouse-accessibility]\n"
|
||||
" [--mouse | --keyboard]\n"
|
||||
" [--onscreen-keyboard]\n"
|
||||
" [--onscreen-keyboard-layout=LAYOUT]\n"
|
||||
" [--onscreen-keyboard-disable-change]\n"
|
||||
"\n"
|
||||
" Joystick:\n"
|
||||
" [--joystick-dev N] (default=0)\n"
|
||||
" [--joystick-slowness N] (0-500; default value is 15)\n"
|
||||
" [--joystick-threshold N] (0-32766; default value is 3200)\n"
|
||||
" [--joystick-maxsteps N] (1-7; default value is 7)\n"
|
||||
" [--joystick-hat-slowness N] (0-500; default value is 15)\n"
|
||||
" [--joystick-hat-timeout N] (0-3000; default value is 1000)\n"
|
||||
" [--joystick-buttons-ignore=BUTTON1,BUTTON2,...]\n"
|
||||
" [--joystick-btn-COMMAND=BUTTON]\n"
|
||||
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
|
||||
"\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -7698,7 +7733,7 @@ static void loadstamp_callback(SDL_Surface * screen,
|
|||
(void)locale;
|
||||
#ifdef DEBUG
|
||||
/* FIXME: Stderr instead of stdout? */
|
||||
printf("loadstamp_callback: %s\n", dir);
|
||||
printf("loadstamp_callback (%d): %s\n", i, dir);
|
||||
#endif
|
||||
|
||||
if (num_stamps[stamp_group] > 0)
|
||||
|
|
@ -7738,7 +7773,6 @@ static void loadstamp_callback(SDL_Surface * screen,
|
|||
|
||||
|
||||
/* Sort and iterate the file list: */
|
||||
|
||||
qsort(files, i, sizeof *files, compare_ftw_str);
|
||||
while (i--)
|
||||
{
|
||||
|
|
@ -7784,7 +7818,11 @@ static void loadstamp_callback(SDL_Surface * screen,
|
|||
}
|
||||
#endif
|
||||
|
||||
show_progress_bar(screen);
|
||||
/*
|
||||
* Showing the progress bar across the screen can be CPU-intensive, so
|
||||
* update infrequently.
|
||||
*/
|
||||
if((i % 32) == 0) show_progress_bar(screen);
|
||||
|
||||
if (dotext > files[i].str && !strcasecmp(dotext, ext)
|
||||
&& (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname))
|
||||
|
|
@ -16686,7 +16724,7 @@ void do_print(void)
|
|||
SDL_BlitSurface(canvas, NULL, save_canvas, NULL);
|
||||
SDL_BlitSurface(label, NULL, save_canvas, NULL);
|
||||
|
||||
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
const char *pcmd;
|
||||
FILE *pi;
|
||||
|
||||
|
|
@ -16738,6 +16776,17 @@ void do_print(void)
|
|||
/* BeOS */
|
||||
|
||||
SurfacePrint(save_canvas);
|
||||
#elif defined(__APPLE__)
|
||||
/* Mac OS X */
|
||||
int show = (want_alt_printcommand && !fullscreen);
|
||||
|
||||
const char *error = SurfacePrint(save_canvas, show);
|
||||
|
||||
if (error)
|
||||
{
|
||||
fprintf(stderr, "Cannot print: %s\n", error);
|
||||
do_prompt_snd(error, PROMPT_PRINT_YES, "", SND_TUXOK, 0, 0);
|
||||
}
|
||||
|
||||
#elif defined(__ANDROID__)
|
||||
|
||||
|
|
@ -18969,8 +19018,6 @@ static int do_new_dialog(void)
|
|||
int places_to_look;
|
||||
int tot;
|
||||
int first_starter, first_template;
|
||||
int added;
|
||||
Uint8 r, g, b;
|
||||
int white_in_palette;
|
||||
int val_x, val_y, motioner;
|
||||
int valhat_x, valhat_y, hatmotioner;
|
||||
|
|
@ -19092,8 +19139,10 @@ static int do_new_dialog(void)
|
|||
|
||||
|
||||
/* (Re)allocate space for the information about these files: */
|
||||
tot = num_files_in_dirs;
|
||||
|
||||
tot = num_files_in_dirs + NUM_COLORS;
|
||||
/* And colors... */
|
||||
tot += NUM_COLORS;
|
||||
|
||||
thumbs = (SDL_Surface * *)malloc(sizeof(SDL_Surface *) * tot);
|
||||
d_places = (int *)malloc(sizeof(int) * tot);
|
||||
|
|
@ -19106,66 +19155,13 @@ static int do_new_dialog(void)
|
|||
qsort(fs, num_files_in_dirs, sizeof(struct dirent2), (int (*)(const void *, const void *))compare_dirent2s);
|
||||
|
||||
|
||||
/* Throw the color palette at the beginning: */
|
||||
/* Throw the color palette at the beginning (default): */
|
||||
|
||||
white_in_palette = -1;
|
||||
|
||||
for (j = -1; j < NUM_COLORS; j++)
|
||||
{
|
||||
added = 0;
|
||||
|
||||
if (j < NUM_COLORS - 1)
|
||||
{
|
||||
if (j == -1 || /* (short circuit) */
|
||||
color_hexes[j][0] != 255 || /* Ignore white, we'll have already added it */
|
||||
color_hexes[j][1] != 255 || color_hexes[j][2] != 255)
|
||||
{
|
||||
/* Palette colors: */
|
||||
|
||||
thumbs[num_files] = SDL_CreateRGBSurface(screen->flags,
|
||||
THUMB_W - 20, THUMB_H - 20,
|
||||
screen->format->BitsPerPixel,
|
||||
screen->format->Rmask,
|
||||
screen->format->Gmask, screen->format->Bmask, 0);
|
||||
|
||||
if (thumbs[num_files] != NULL)
|
||||
{
|
||||
if (j == -1)
|
||||
{
|
||||
r = g = b = 255; /* White */
|
||||
}
|
||||
else
|
||||
{
|
||||
r = color_hexes[j][0];
|
||||
g = color_hexes[j][1];
|
||||
b = color_hexes[j][2];
|
||||
}
|
||||
SDL_FillRect(thumbs[num_files], NULL, SDL_MapRGB(thumbs[num_files]->format, r, g, b));
|
||||
added = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
white_in_palette = j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Color picker: */
|
||||
|
||||
thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0);
|
||||
added = 1;
|
||||
}
|
||||
|
||||
if (added)
|
||||
{
|
||||
d_places[num_files] = PLACE_COLOR_PALETTE;
|
||||
d_names[num_files] = NULL;
|
||||
d_exts[num_files] = NULL;
|
||||
|
||||
num_files++;
|
||||
}
|
||||
}
|
||||
if (!new_colors_last) {
|
||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||
}
|
||||
|
||||
first_starter = num_files;
|
||||
first_template = -1; /* In case there are none... */
|
||||
|
|
@ -19468,10 +19464,15 @@ static int do_new_dialog(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Throw the color palette at the end (alternative option): */
|
||||
|
||||
if (new_colors_last) {
|
||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%d files were found!\n", num_files);
|
||||
printf("%d files and colors were found!\n", num_files);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -20129,6 +20130,76 @@ static int do_new_dialog(void)
|
|||
return (which != -1);
|
||||
}
|
||||
|
||||
/* Add colors to the "New" dialog's list of choices;
|
||||
normally appears at the beginning (above Starts & Templates),
|
||||
but may be placed at the end with the "--newcolorslast" option.
|
||||
*/
|
||||
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette) {
|
||||
int j;
|
||||
int added;
|
||||
Uint8 r, g, b;
|
||||
|
||||
for (j = -1; j < NUM_COLORS; j++)
|
||||
{
|
||||
added = 0;
|
||||
|
||||
if (j < NUM_COLORS - 1)
|
||||
{
|
||||
if (j == -1 || /* (short circuit) */
|
||||
color_hexes[j][0] != 255 || /* Ignore white, we'll have already added it */
|
||||
color_hexes[j][1] != 255 || color_hexes[j][2] != 255)
|
||||
{
|
||||
/* Palette colors: */
|
||||
|
||||
thumbs[num_files] = SDL_CreateRGBSurface(screen->flags,
|
||||
THUMB_W - 20, THUMB_H - 20,
|
||||
screen->format->BitsPerPixel,
|
||||
screen->format->Rmask,
|
||||
screen->format->Gmask, screen->format->Bmask, 0);
|
||||
|
||||
if (thumbs[num_files] != NULL)
|
||||
{
|
||||
if (j == -1)
|
||||
{
|
||||
r = g = b = 255; /* White */
|
||||
}
|
||||
else
|
||||
{
|
||||
r = color_hexes[j][0];
|
||||
g = color_hexes[j][1];
|
||||
b = color_hexes[j][2];
|
||||
}
|
||||
SDL_FillRect(thumbs[num_files], NULL, SDL_MapRGB(thumbs[num_files]->format, r, g, b));
|
||||
added = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*white_in_palette = j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Color picker: */
|
||||
|
||||
thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0);
|
||||
added = 1;
|
||||
}
|
||||
|
||||
if (added)
|
||||
{
|
||||
d_places[num_files] = PLACE_COLOR_PALETTE;
|
||||
d_names[num_files] = NULL;
|
||||
d_exts[num_files] = NULL;
|
||||
|
||||
num_files++;
|
||||
}
|
||||
}
|
||||
|
||||
return num_files;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
*/
|
||||
|
|
@ -22582,7 +22653,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
|||
|
||||
/* ================================================================================== */
|
||||
|
||||
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
|
||||
/**
|
||||
* FIXME
|
||||
*/
|
||||
|
|
@ -22946,6 +23017,7 @@ static void setup_config(char *argv[])
|
|||
SETBOOL(keymouse);
|
||||
SETBOOL(mirrorstamps);
|
||||
SETBOOL(native_screensize);
|
||||
SETBOOL(new_colors_last);
|
||||
SETBOOL(no_button_distinction);
|
||||
SETBOOL(no_fancy_cursors);
|
||||
SETBOOL(no_system_fonts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue