* Squelching a lot of debugging output, unless DEBUG is #define'd
* Added "--joystick-dev" option, for specifying which joystick device Tux Paint should listen to * "--joystick-dev list" is now used to list the available devices * Cleaned up some 'usage' output
This commit is contained in:
parent
a09d239eaf
commit
0b27bec2e8
11 changed files with 153 additions and 48 deletions
2
Makefile
2
Makefile
|
|
@ -4,7 +4,7 @@
|
||||||
# bill@newbreedsoftware.com
|
# bill@newbreedsoftware.com
|
||||||
# http://www.tuxpaint.org/
|
# http://www.tuxpaint.org/
|
||||||
|
|
||||||
# June 14, 2002 - January 4, 2014
|
# June 14, 2002 - March 30, 2014
|
||||||
|
|
||||||
|
|
||||||
# The version number, for release:
|
# The version number, for release:
|
||||||
|
|
|
||||||
|
|
@ -386,11 +386,15 @@ Windows Users
|
||||||
|
|
||||||
onscreen-keyboard-disable-change=yes
|
onscreen-keyboard-disable-change=yes
|
||||||
Disables the possibility for changing the layout of the
|
Disables the possibility for changing the layout of the
|
||||||
on-screen keyboard when using the Text and Label tools,
|
on-screen keyboard when using the Text and Label tools, useful
|
||||||
usefull for simplifying things for the small children.
|
for simplifying things for the small children.
|
||||||
Note: Using this option implies automatically
|
Note: Using this option implies automatically
|
||||||
onscreen-keyboard=yes, so setting both is redundant.
|
onscreen-keyboard=yes, so setting both is redundant.
|
||||||
|
|
||||||
|
joystick-dev=N
|
||||||
|
Specify which joystick device should be used by Tux Paint.
|
||||||
|
Default value is 0 (the first joystick).
|
||||||
|
|
||||||
joystick-slowness=SPEED
|
joystick-slowness=SPEED
|
||||||
Sets a delay at each axis motion, allowing to slow the
|
Sets a delay at each axis motion, allowing to slow the
|
||||||
joystick. Allowed values are from 0 to 500. Default value is
|
joystick. Allowed values are from 0 to 500. Default value is
|
||||||
|
|
@ -417,7 +421,7 @@ Windows Users
|
||||||
|
|
||||||
joystick-btn-escape=BUTTON NUMBER
|
joystick-btn-escape=BUTTON NUMBER
|
||||||
Selects the joystick button number, as seen by SDL, that will
|
Selects the joystick button number, as seen by SDL, that will
|
||||||
be used to generate a escape event. Usefull to dismiss dialogs
|
be used to generate a escape event. Useful to dismiss dialogs
|
||||||
and quit.
|
and quit.
|
||||||
|
|
||||||
joystick-btn-brush=BUTTON NUMBER
|
joystick-btn-brush=BUTTON NUMBER
|
||||||
|
|
@ -1028,6 +1032,9 @@ Command-Line Informational Options
|
||||||
--lang help
|
--lang help
|
||||||
Display a list of available languages in Tux Paint.
|
Display a list of available languages in Tux Paint.
|
||||||
|
|
||||||
|
--joystick-dev list
|
||||||
|
Display list of attached joysticks available to Tux Paint.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Choosing a Different Language
|
Choosing a Different Language
|
||||||
|
|
|
||||||
|
|
@ -482,11 +482,17 @@ New Breed Software</p>
|
||||||
<dt><code><b>onscreen-keyboard-disable-change=yes</b></code></dt>
|
<dt><code><b>onscreen-keyboard-disable-change=yes</b></code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Disables the possibility for changing the layout of the on-screen keyboard when using the <b>Text</b> and
|
Disables the possibility for changing the layout of the on-screen keyboard when using the <b>Text</b> and
|
||||||
<b>Label</b> tools, usefull for simplifying things for the small children.<br>
|
<b>Label</b> tools, useful for simplifying things for the small children.<br>
|
||||||
Note: Using this option implies automatically <b>onscreen-keyboard=yes</b>, so setting both is redundant.
|
Note: Using this option implies automatically <b>onscreen-keyboard=yes</b>, so setting both is redundant.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
|
||||||
|
<dt><code><b>joystick-dev=<i>N</i></b></code></dt>
|
||||||
|
<dd>
|
||||||
|
Specify which joystick device should be used by Tux Paint.
|
||||||
|
Default value is 0 (the first joystick).
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt><code><b>joystick-slowness=<i>SPEED</i></b></code></dt>
|
<dt><code><b>joystick-slowness=<i>SPEED</i></b></code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Sets a delay at each axis motion, allowing to slow the joystick.
|
Sets a delay at each axis motion, allowing to slow the joystick.
|
||||||
|
|
@ -520,7 +526,7 @@ New Breed Software</p>
|
||||||
<dt><code><b>joystick-btn-escape=<i>BUTTON NUMBER</i></b></code></dt>
|
<dt><code><b>joystick-btn-escape=<i>BUTTON NUMBER</i></b></code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Selects the joystick button number, as seen by SDL, that will be used to generate a escape event.
|
Selects the joystick button number, as seen by SDL, that will be used to generate a escape event.
|
||||||
Usefull to dismiss dialogs and quit.
|
Useful to dismiss dialogs and quit.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><code><b>joystick-btn-brush=<i>BUTTON NUMBER</i></b></code></dt>
|
<dt><code><b>joystick-btn-brush=<i>BUTTON NUMBER</i></b></code></dt>
|
||||||
|
|
@ -1527,6 +1533,11 @@ New Breed Software</p>
|
||||||
<dd>
|
<dd>
|
||||||
Display a list of available languages in Tux Paint.
|
Display a list of available languages in Tux Paint.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><code><b>--joystick-dev list</b></code></dt>
|
||||||
|
<dd>
|
||||||
|
Display list of attached joysticks available to Tux Paint.
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
dirwalk.c
|
dirwalk.c
|
||||||
|
|
||||||
Copyright (c) 2009
|
Copyright (c) 2009-2014
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -107,13 +107,17 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
||||||
char fname[512];
|
char fname[512];
|
||||||
TuxPaint_Font *font;
|
TuxPaint_Font *font;
|
||||||
snprintf(fname, sizeof fname, "%s/%s", dir, files[i].str);
|
snprintf(fname, sizeof fname, "%s/%s", dir, files[i].str);
|
||||||
/* */printf("Loading font: %s (locale is: %s)\n", fname, (locale ? locale : "NULL")); /**/ //EP
|
#ifdef DEBUG
|
||||||
|
printf("Loading font: %s (locale is: %s)\n", fname, (locale ? locale : "NULL")); //EP
|
||||||
|
#endif
|
||||||
if (locale && strstr(fname, "locale") && !all_locale_fonts)
|
if (locale && strstr(fname, "locale") && !all_locale_fonts)
|
||||||
{
|
{
|
||||||
char fname_check[512];
|
char fname_check[512];
|
||||||
/* We're (probably) loading from our locale fonts folder; ONLY load our locale's font */
|
/* We're (probably) loading from our locale fonts folder; ONLY load our locale's font */
|
||||||
snprintf(fname_check, sizeof fname_check, "%s/%s.ttf", dir, locale);
|
snprintf(fname_check, sizeof fname_check, "%s/%s.ttf", dir, locale);
|
||||||
/* */printf("checking vs \"%s\" vs \"%s\"\n", fname_check, fname); /**/ //EP
|
#ifdef DEBUG
|
||||||
|
printf("checking \"%s\" vs \"%s\"\n", fname_check, fname); //EP
|
||||||
|
#endif
|
||||||
if (strcmp(fname, fname_check) == 0)
|
if (strcmp(fname, fname_check) == 0)
|
||||||
font = TuxPaint_Font_OpenFont("", fname, text_sizes[text_size]);
|
font = TuxPaint_Font_OpenFont("", fname, text_sizes[text_size]);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
fonts.c
|
fonts.c
|
||||||
|
|
||||||
Copyright (c) 2009
|
Copyright (c) 2009-2014
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -259,11 +259,15 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
|
||||||
|
|
||||||
void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("TuxPaint_Font_CloseFont step 1 (%p)\n", tpf); //EP
|
printf("TuxPaint_Font_CloseFont step 1 (%p)\n", tpf); //EP
|
||||||
|
#endif
|
||||||
if (!tpf) return; //EP
|
if (!tpf) return; //EP
|
||||||
|
|
||||||
#ifndef NO_SDLPANGO
|
#ifndef NO_SDLPANGO
|
||||||
|
#ifdef DEBUG
|
||||||
printf("TuxPaint_Font_CloseFont step 2 (%p, %d)\n", tpf->pango_context, tpf->typ); //EP
|
printf("TuxPaint_Font_CloseFont step 2 (%p, %d)\n", tpf->pango_context, tpf->typ); //EP
|
||||||
|
#endif
|
||||||
if (tpf->typ == FONT_TYPE_PANGO)
|
if (tpf->typ == FONT_TYPE_PANGO)
|
||||||
if (tpf->pango_context) //EP
|
if (tpf->pango_context) //EP
|
||||||
{
|
{
|
||||||
|
|
@ -274,7 +278,9 @@ void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("TuxPaint_Font_CloseFont step 3 (%p, %d)\n", tpf->ttf_font, tpf->typ); //EP
|
printf("TuxPaint_Font_CloseFont step 3 (%p, %d)\n", tpf->ttf_font, tpf->typ); //EP
|
||||||
|
#endif
|
||||||
if (tpf->typ == FONT_TYPE_TTF)
|
if (tpf->typ == FONT_TYPE_TTF)
|
||||||
if (tpf->ttf_font) //EP
|
if (tpf->ttf_font) //EP
|
||||||
{
|
{
|
||||||
|
|
|
||||||
16
src/i18n.c
16
src/i18n.c
|
|
@ -4,7 +4,7 @@
|
||||||
For Tux Paint
|
For Tux Paint
|
||||||
Language-related functions
|
Language-related functions
|
||||||
|
|
||||||
Copyright (c) 2002-2012 by Bill Kendrick and others
|
Copyright (c) 2002-2014 by Bill Kendrick and others
|
||||||
bill@newbreedsoftware.com
|
bill@newbreedsoftware.com
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
June 14, 2002 - March 28, 2013
|
June 14, 2002 - March 29, 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -697,8 +697,6 @@ static void set_langint_from_locale_string(const char *restrict loc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEBUG
|
|
||||||
|
|
||||||
#define HAVE_SETENV
|
#define HAVE_SETENV
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#undef HAVE_SETENV
|
#undef HAVE_SETENV
|
||||||
|
|
@ -729,12 +727,15 @@ static int set_current_language(const char *restrict loc)
|
||||||
/* First set the locale according to the environment, then try to overwrite with loc,
|
/* First set the locale according to the environment, then try to overwrite with loc,
|
||||||
after that, ctype_utf8() call will test the compatibility with utf8 and try to load
|
after that, ctype_utf8() call will test the compatibility with utf8 and try to load
|
||||||
a different locale if the resulting one is not compatible. */
|
a different locale if the resulting one is not compatible. */
|
||||||
|
#ifdef DEBUG
|
||||||
printf ("Locale BEFORE is: %s\n", setlocale(LC_ALL,NULL));//EP
|
printf ("Locale BEFORE is: %s\n", setlocale(LC_ALL,NULL));//EP
|
||||||
|
#endif
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
setlocale(LC_ALL, loc);
|
setlocale(LC_ALL, loc);
|
||||||
ctype_utf8();
|
ctype_utf8();
|
||||||
|
#ifdef DEBUG
|
||||||
printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
|
printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
|
||||||
|
#endif
|
||||||
|
|
||||||
bindtextdomain("tuxpaint", LOCALEDIR);
|
bindtextdomain("tuxpaint", LOCALEDIR);
|
||||||
/* Old version of glibc does not have bind_textdomain_codeset() */
|
/* Old version of glibc does not have bind_textdomain_codeset() */
|
||||||
|
|
@ -821,14 +822,19 @@ printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
|
||||||
|
|
||||||
free(oldloc);
|
free(oldloc);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("lang_prefixes[%d] is \"%s\"\n", get_current_language(), lang_prefixes[get_current_language()]);
|
printf("lang_prefixes[%d] is \"%s\"\n", get_current_language(), lang_prefixes[get_current_language()]);
|
||||||
|
#endif
|
||||||
|
|
||||||
return y_nudge;
|
return y_nudge;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setup_i18n(const char *restrict lang, const char *restrict locale)
|
int setup_i18n(const char *restrict lang, const char *restrict locale)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("lang %p, locale %p\n", lang, locale);
|
printf("lang %p, locale %p\n", lang, locale);
|
||||||
printf("lang \"%s\", locale \"%s\"\n", lang, locale);
|
printf("lang \"%s\", locale \"%s\"\n", lang, locale);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(locale)
|
if(locale)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
.\" tuxpaint.1 - 2011.06.30
|
.\" tuxpaint.1 - 2014.03.30
|
||||||
.TH TUXPAINT 1 "30 June 2011" "0.9.22" "Tux Paint"
|
.TH TUXPAINT 1 "30 March 2014" "0.9.22" "Tux Paint"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
tuxpaint -- "Tux Paint", a drawing program for young children.
|
tuxpaint -- "Tux Paint", a drawing program for young children.
|
||||||
|
|
||||||
|
|
@ -67,6 +67,10 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
||||||
.br
|
.br
|
||||||
[\-\-onscreen-keyboard]
|
[\-\-onscreen-keyboard]
|
||||||
.br
|
.br
|
||||||
|
[\-\-joystick-dev=\fIDEVICE\fP]
|
||||||
|
.br
|
||||||
|
[\-\-joystick-dev=list]
|
||||||
|
.br
|
||||||
[\-\-joystick-slowness=\fISPEED\fP]
|
[\-\-joystick-slowness=\fISPEED\fP]
|
||||||
.br
|
.br
|
||||||
[\-\-joystick-threshold=\fITHRESHOLD\fP]
|
[\-\-joystick-threshold=\fITHRESHOLD\fP]
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ mouse-accessibility, POSBOOL(mouseaccessibility)
|
||||||
onscreen-keyboard, POSBOOL(onscreen_keyboard)
|
onscreen-keyboard, POSBOOL(onscreen_keyboard)
|
||||||
onscreen-keyboard-layout, MULTI(onscreen_keyboard_layout)
|
onscreen-keyboard-layout, MULTI(onscreen_keyboard_layout)
|
||||||
onscreen-keyboard-disable-change, POSBOOL(onscreen_keyboard_disable_change)
|
onscreen-keyboard-disable-change, POSBOOL(onscreen_keyboard_disable_change)
|
||||||
|
joystick-dev, MULTI(joystick_dev)
|
||||||
joystick-slowness, MULTI(joystick_slowness)
|
joystick-slowness, MULTI(joystick_slowness)
|
||||||
joystick-threshold, MULTI(joystick_lowthreshold)
|
joystick-threshold, MULTI(joystick_lowthreshold)
|
||||||
joystick-maxsteps, MULTI(joystick_maxsteps)
|
joystick-maxsteps, MULTI(joystick_maxsteps)
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ struct cfginfo
|
||||||
const char *onscreen_keyboard;
|
const char *onscreen_keyboard;
|
||||||
const char *onscreen_keyboard_layout;
|
const char *onscreen_keyboard_layout;
|
||||||
const char *onscreen_keyboard_disable_change;
|
const char *onscreen_keyboard_disable_change;
|
||||||
|
const char *joystick_dev;
|
||||||
const char *joystick_slowness;
|
const char *joystick_slowness;
|
||||||
const char *joystick_lowthreshold;
|
const char *joystick_lowthreshold;
|
||||||
const char *joystick_maxsteps;
|
const char *joystick_maxsteps;
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ _tuxpaint()
|
||||||
--onscreen-keyboard \
|
--onscreen-keyboard \
|
||||||
--onscreen-keyboard-layout \
|
--onscreen-keyboard-layout \
|
||||||
--onscreen-keyboard-disable-change \
|
--onscreen-keyboard-disable-change \
|
||||||
|
--joystick-dev \
|
||||||
--joystick-slowness \
|
--joystick-slowness \
|
||||||
--joystick-threshold \
|
--joystick-threshold \
|
||||||
--joystick-maxsteps \
|
--joystick-maxsteps \
|
||||||
|
|
|
||||||
118
src/tuxpaint.c
118
src/tuxpaint.c
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Tux Paint - A simple drawing program for children.
|
Tux Paint - A simple drawing program for children.
|
||||||
|
|
||||||
Copyright (c) 2002-2012 by Bill Kendrick and others; see AUTHORS.txt
|
Copyright (c) 2002-2014 by Bill Kendrick and others; see AUTHORS.txt
|
||||||
bill@newbreedsoftware.com
|
bill@newbreedsoftware.com
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - March 2, 2012
|
June 14, 2002 - March 30, 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1092,6 +1092,7 @@ static int fullscreen;
|
||||||
static int native_screensize;
|
static int native_screensize;
|
||||||
static int grab_input;
|
static int grab_input;
|
||||||
static int rotate_orientation;
|
static int rotate_orientation;
|
||||||
|
static int joystick_dev = 0;
|
||||||
|
|
||||||
static int disable_print;
|
static int disable_print;
|
||||||
static int print_delay;
|
static int print_delay;
|
||||||
|
|
@ -6381,16 +6382,17 @@ void show_usage(int exitcode)
|
||||||
" %s [--colorfile FILE]\n"
|
" %s [--colorfile FILE]\n"
|
||||||
" %s [--mouse-accessibility]\n"
|
" %s [--mouse-accessibility]\n"
|
||||||
" %s [--onscreen-keyboard]\n"
|
" %s [--onscreen-keyboard]\n"
|
||||||
" %s [--joystick-slowness] (0-500). Default value is 15\n"
|
" %s [--joystick-dev N] (default=0)\n"
|
||||||
" %s [--joystick-threshold] (0-32766). Default value is 3200\n"
|
" %s [--joystick-slowness N] (0-500; default value is 15)\n"
|
||||||
" %s [--joystick-maxsteps] (1-7). Default value is 7\n"
|
" %s [--joystick-threshold N] (0-32766; default value is 3200)\n"
|
||||||
|
" %s [--joystick-maxsteps N] (1-7; default value is 7)\n"
|
||||||
"\n",
|
"\n",
|
||||||
progname, progname,
|
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, 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
|
#ifdef WIN32
|
||||||
blank,
|
blank,
|
||||||
|
|
@ -7531,28 +7533,40 @@ static int generate_fontconfig_cache_real(void)
|
||||||
SDL_Surface * tmp_surf;
|
SDL_Surface * tmp_surf;
|
||||||
SDL_Color black = { 0, 0, 0, 0 };
|
SDL_Color black = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- Hello from generate_fontconfig_cache() (thread # %d)\n", SDL_ThreadID()); fflush(stdout);
|
printf("-- Hello from generate_fontconfig_cache() (thread # %d)\n", SDL_ThreadID()); fflush(stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
tmp_font = TuxPaint_Font_OpenFont(PANGO_DEFAULT_FONT, NULL, 12);
|
tmp_font = TuxPaint_Font_OpenFont(PANGO_DEFAULT_FONT, NULL, 12);
|
||||||
|
|
||||||
if (tmp_font != NULL)
|
if (tmp_font != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- Generated a font.\n"); fflush(stdout);
|
printf("-- Generated a font.\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
tmp_surf = render_text(tmp_font, "Test", black);
|
tmp_surf = render_text(tmp_font, "Test", black);
|
||||||
if (tmp_surf != NULL) {
|
if (tmp_surf != NULL) {
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- Generated a surface\n"); fflush(stdout);
|
printf("-- Generated a surface\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
SDL_FreeSurface(tmp_surf);
|
SDL_FreeSurface(tmp_surf);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- Failed to make a surface!\n"); fflush(stdout);
|
printf("-- Failed to make a surface!\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
TuxPaint_Font_CloseFont(tmp_font);
|
TuxPaint_Font_CloseFont(tmp_font);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- Failed to generate a font!\n"); fflush(stdout);
|
printf("-- Failed to generate a font!\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fontconfig_thread_done = 1;
|
fontconfig_thread_done = 1;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("-- generate_fontconfig_cache() is done\n"); fflush(stdout);
|
printf("-- generate_fontconfig_cache() is done\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -12197,21 +12211,27 @@ static void cleanup(void)
|
||||||
|
|
||||||
if (medium_font != NULL)
|
if (medium_font != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("cleanup: medium font\n"); //EP
|
printf("cleanup: medium font\n"); //EP
|
||||||
|
#endif
|
||||||
TuxPaint_Font_CloseFont(medium_font);
|
TuxPaint_Font_CloseFont(medium_font);
|
||||||
medium_font = NULL;
|
medium_font = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (small_font != NULL)
|
if (small_font != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("cleanup: small font\n"); //EP
|
printf("cleanup: small font\n"); //EP
|
||||||
|
#endif
|
||||||
TuxPaint_Font_CloseFont(small_font);
|
TuxPaint_Font_CloseFont(small_font);
|
||||||
small_font = NULL;
|
small_font = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (large_font != NULL)
|
if (large_font != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf("cleanup: large font\n"); //EP
|
printf("cleanup: large font\n"); //EP
|
||||||
|
#endif
|
||||||
TuxPaint_Font_CloseFont(large_font);
|
TuxPaint_Font_CloseFont(large_font);
|
||||||
large_font = NULL;
|
large_font = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -21841,6 +21861,19 @@ static void setup_config(char *argv[])
|
||||||
if(tmpcfg.papersize)
|
if(tmpcfg.papersize)
|
||||||
papersize = tmpcfg.papersize;
|
papersize = tmpcfg.papersize;
|
||||||
#endif
|
#endif
|
||||||
|
if(tmpcfg.joystick_dev)
|
||||||
|
{
|
||||||
|
if(strcmp(tmpcfg.joystick_dev, "list") == 0) {
|
||||||
|
joystick_dev = -1;
|
||||||
|
} else {
|
||||||
|
if(strtof(tmpcfg.joystick_dev, NULL) < 0 || strtof(tmpcfg.joystick_dev, NULL) > 100)
|
||||||
|
{
|
||||||
|
printf("Joystick dev (now %s) must be between 0 and 100.\n", tmpcfg.joystick_dev);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
joystick_dev = strtof(tmpcfg.joystick_dev, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(tmpcfg.joystick_slowness)
|
if(tmpcfg.joystick_slowness)
|
||||||
{
|
{
|
||||||
if(strtof(tmpcfg.joystick_slowness, NULL) < 0 || strtof(tmpcfg.joystick_slowness, NULL) > 500)
|
if(strtof(tmpcfg.joystick_slowness, NULL) < 0 || strtof(tmpcfg.joystick_slowness, NULL) > 500)
|
||||||
|
|
@ -22063,7 +22096,9 @@ static void setup_config(char *argv[])
|
||||||
onscreen_keyboard = TRUE;
|
onscreen_keyboard = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("\n\nPromptless save:\nask: %d\nnew: %d\nover: %d\n\n", _promptless_save_over_ask, _promptless_save_over_new, _promptless_save_over);
|
printf("\n\nPromptless save:\nask: %d\nnew: %d\nover: %d\n\n", _promptless_save_over_ask, _promptless_save_over_new, _promptless_save_over);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_promptless_save_over_ask) {
|
if (_promptless_save_over_ask) {
|
||||||
promptless_save = SAVE_OVER_PROMPT;
|
promptless_save = SAVE_OVER_PROMPT;
|
||||||
|
|
@ -22081,7 +22116,9 @@ static void chdir_to_binary(char *argv0)
|
||||||
{
|
{
|
||||||
char curdir[256]; //EP added this block to print out of current directory
|
char curdir[256]; //EP added this block to print out of current directory
|
||||||
getcwd(curdir, sizeof(curdir));
|
getcwd(curdir, sizeof(curdir));
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Binary Path: %s\nCurrent directory at launchtime: %s\n", argv0, curdir);
|
printf("Binary Path: %s\nCurrent directory at launchtime: %s\n", argv0, curdir);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(WIN32) || defined(__APPLE__) //EP added __APPLE__
|
#if defined(__BEOS__) || defined(WIN32) || defined(__APPLE__) //EP added __APPLE__
|
||||||
/* if run from gui, like OpenTracker in BeOS or Explorer in Windows,
|
/* if run from gui, like OpenTracker in BeOS or Explorer in Windows,
|
||||||
|
|
@ -22445,8 +22482,7 @@ static void setup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (joystick_dev != -1)
|
||||||
|
|
||||||
do_lock_file();
|
do_lock_file();
|
||||||
|
|
||||||
init_flags = SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK;
|
init_flags = SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK;
|
||||||
|
|
@ -22487,6 +22523,34 @@ static void setup(void)
|
||||||
SDL_SetEventFilter(TP_EventFilter);
|
SDL_SetEventFilter(TP_EventFilter);
|
||||||
|
|
||||||
|
|
||||||
|
/* Set up joystick */
|
||||||
|
|
||||||
|
if (joystick_dev == -1) {
|
||||||
|
printf("%i joystick(s) were found:\n", SDL_NumJoysticks() );
|
||||||
|
|
||||||
|
for( i=0; i < SDL_NumJoysticks(); i++ )
|
||||||
|
{
|
||||||
|
printf(" %d: %s\n", i, SDL_JoystickName(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
joystick = SDL_JoystickOpen(joystick_dev);
|
||||||
|
if (joystick == NULL) {
|
||||||
|
fprintf(stderr, "Could not open joystick device %d: %s\n", joystick_dev, SDL_GetError());
|
||||||
|
} else {
|
||||||
|
SDL_JoystickEventState(SDL_ENABLE);
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Number of Axes: %d\n", SDL_JoystickNumAxes(joystick));
|
||||||
|
printf("Number of Buttons: %d\n", SDL_JoystickNumButtons(joystick));
|
||||||
|
printf("Number of Balls: %d\n", SDL_JoystickNumBalls(joystick));
|
||||||
|
printf("Number of Hats: %d\n", SDL_JoystickNumHats(joystick));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NOSOUND
|
#ifndef NOSOUND
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
if (use_sound && Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024) < 0)
|
if (use_sound && Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024) < 0)
|
||||||
|
|
@ -22738,28 +22802,36 @@ static void setup(void)
|
||||||
|
|
||||||
fontconfig_thread_done = 0;
|
fontconfig_thread_done = 0;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Spawning Pango thread\n"); fflush(stdout);
|
printf("Spawning Pango thread\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
fontconfig_thread = SDL_CreateThread(generate_fontconfig_cache, NULL);
|
fontconfig_thread = SDL_CreateThread(generate_fontconfig_cache, NULL);
|
||||||
if (fontconfig_thread == NULL) {
|
if (fontconfig_thread == NULL) {
|
||||||
fprintf(stderr, "Failed to create Pango setup thread: %s\n", SDL_GetError());
|
fprintf(stderr, "Failed to create Pango setup thread: %s\n", SDL_GetError());
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Thread spawned\n"); fflush(stdout);
|
printf("Thread spawned\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
if (generate_fontconfig_cache_spinner(screen)) /* returns 1 if aborted */
|
if (generate_fontconfig_cache_spinner(screen)) /* returns 1 if aborted */
|
||||||
{
|
{
|
||||||
printf("Aborted!\n"); fflush(stdout);
|
printf("Pango thread aborted!\n"); fflush(stdout);
|
||||||
SDL_KillThread(fontconfig_thread);
|
SDL_KillThread(fontconfig_thread);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit(0);
|
exit(0);
|
||||||
/* FIXME: Let's be more graceful about exiting (e.g., clean up lockfile!) -bjk 2010.04.27 */
|
/* FIXME: Let's be more graceful about exiting (e.g., clean up lockfile!) -bjk 2010.04.27 */
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Done generating cache\n"); fflush(stdout);
|
printf("Done generating cache\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
/* NOW we can fork our own font scanner stuff, and let it run in the bgkd -bjk 2010.04.27 */
|
/* NOW we can fork our own font scanner stuff, and let it run in the bgkd -bjk 2010.04.27 */
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Now running font scanner\n"); fflush(stdout);
|
printf("Now running font scanner\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -23473,7 +23545,6 @@ int main(int argc, char *argv[])
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
strftime(logTime, sizeof(logTime), "%A %d/%m/%Y %H:%M:%S", localtime(&t));
|
strftime(logTime, sizeof(logTime), "%A %d/%m/%Y %H:%M:%S", localtime(&t));
|
||||||
printf("Tux Paint log - %s\n", logTime);
|
printf("Tux Paint log - %s\n", logTime);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chdir_to_binary(argv[0]);
|
chdir_to_binary(argv[0]);
|
||||||
|
|
@ -23484,11 +23555,15 @@ int main(int argc, char *argv[])
|
||||||
// must start ASAP, but depends on locale which in turn needs the config
|
// must start ASAP, but depends on locale which in turn needs the config
|
||||||
#ifdef NO_SDLPANGO
|
#ifdef NO_SDLPANGO
|
||||||
/* Only fork it now if we're not planning on creating a thread to handle fontconfig stuff -bjk 2010.04.27 */
|
/* Only fork it now if we're not planning on creating a thread to handle fontconfig stuff -bjk 2010.04.27 */
|
||||||
|
#ifdef DEBUG
|
||||||
printf("Running font scanner\n"); fflush(stdout);
|
printf("Running font scanner\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
||||||
#else
|
#else
|
||||||
|
#ifdef DEBUG
|
||||||
printf("NOT running font scanner\n"); fflush(stdout);
|
printf("NOT running font scanner\n"); fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Warnings to satisfy SF.net Bug #3327493 -bjk 2011.06.24 */
|
/* Warnings to satisfy SF.net Bug #3327493 -bjk 2011.06.24 */
|
||||||
|
|
@ -23516,21 +23591,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
claim_to_be_ready();
|
claim_to_be_ready();
|
||||||
printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
|
|
||||||
printf("The names of the joysticks are:\n");
|
|
||||||
|
|
||||||
for( i=0; i < SDL_NumJoysticks(); i++ )
|
|
||||||
{
|
|
||||||
printf(" %s\n", SDL_JoystickName(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
joystick = SDL_JoystickOpen(0);
|
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
|
||||||
|
|
||||||
printf("Number of Axes: %d\n", SDL_JoystickNumAxes(joystick));
|
|
||||||
printf("Number of Buttons: %d\n", SDL_JoystickNumButtons(joystick));
|
|
||||||
printf("Number of Balls: %d\n", SDL_JoystickNumBalls(joystick));
|
|
||||||
printf("Number of Hats: %d\n", SDL_JoystickNumHats(joystick));
|
|
||||||
|
|
||||||
mainloop();
|
mainloop();
|
||||||
|
|
||||||
|
|
@ -23979,7 +24039,7 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
|
||||||
ts -= 2;
|
ts -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't need this ATM, but better left it ready in case the number of tools grows enouth */
|
/* We don't need this ATM, but better left it ready in case the number of tools grows enough */
|
||||||
while (eby > real_r_tools.y + real_r_tools.h + ts / 2 * button_h)
|
while (eby > real_r_tools.y + real_r_tools.h + ts / 2 * button_h)
|
||||||
{
|
{
|
||||||
ev.button.y = real_r_tools.y + real_r_tools.h + 1;
|
ev.button.y = real_r_tools.y + real_r_tools.h + 1;
|
||||||
|
|
@ -23995,7 +24055,11 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
|
||||||
ev.button.type = SDL_MOUSEBUTTONUP;
|
ev.button.type = SDL_MOUSEBUTTONUP;
|
||||||
ev.button.state = SDL_RELEASED;
|
ev.button.state = SDL_RELEASED;
|
||||||
}
|
}
|
||||||
printf("result %d %d\n", ev.button.x, ev.button.y);
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("result %d %d\n", ev.button.x, ev.button.y);
|
||||||
|
#endif
|
||||||
|
|
||||||
SDL_PushEvent(&ev);
|
SDL_PushEvent(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue