Merge branch 'master' into sdl2.0
Merging master 2019-september-24 into sdl2.0 branch
This commit is contained in:
commit
a1c778135d
52 changed files with 921 additions and 803 deletions
|
|
@ -5,7 +5,7 @@
|
|||
for Tux Paint
|
||||
|
||||
Mostly by Albert Cahalan <albert@users.sf.net>
|
||||
Copyright (c) 2002-2006
|
||||
Copyright (c) 2002-2019
|
||||
|
||||
http://www.newbreedsoftware.com/tuxpaint/
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - December 30, 2017
|
||||
June 14, 2002 - September 12, 2019
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -127,3 +127,13 @@
|
|||
#undef CLOCK_ASM
|
||||
#define CLOCK_ASM(x) x=42
|
||||
#endif
|
||||
|
||||
/* h/t https://tutel.me/c/programming/questions/45349079/how+to+use+__attribute__fallthrough+correctly+in+gcc */
|
||||
#ifndef FALLTHROUGH
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7
|
||||
#define FALL_THROUGH __attribute__ ((fallthrough))
|
||||
#else
|
||||
#define FALL_THROUGH ((void)0)
|
||||
#endif /* __GNUC__ >= 7 */
|
||||
#endif
|
||||
|
||||
|
|
|
|||
170
src/fill.c
Normal file
170
src/fill.c
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
fill.c
|
||||
|
||||
Fill tool
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
Copyright (c) 2002-2019 by Bill Kendrick and others; see AUTHORS.txt
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
Flood fill code based on Wikipedia example:
|
||||
http://www.wikipedia.org/wiki/Flood_fill/C_example
|
||||
by Damian Yerrick - http://www.wikipedia.org/wiki/Damian_Yerrick
|
||||
|
||||
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)
|
||||
|
||||
Last updated: September 14, 2019
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "fill.h"
|
||||
#include "rgblinear.h"
|
||||
#include "playsound.h"
|
||||
#include "pixels.h"
|
||||
|
||||
|
||||
/* Local function prototypes: */
|
||||
|
||||
int colors_close(SDL_Surface * canvas, Uint32 c1, Uint32 c2);
|
||||
|
||||
|
||||
int colors_close(SDL_Surface * canvas, Uint32 c1, Uint32 c2)
|
||||
{
|
||||
Uint8 r1, g1, b1, r2, g2, b2;
|
||||
|
||||
if (c1 == c2)
|
||||
{
|
||||
/* Get it over with quick, if possible! */
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
double r, g, b;
|
||||
|
||||
SDL_GetRGB(c1, canvas->format, &r1, &g1, &b1);
|
||||
SDL_GetRGB(c2, canvas->format, &r2, &g2, &b2);
|
||||
|
||||
// use distance in linear RGB space
|
||||
r = sRGB_to_linear_table[r1] - sRGB_to_linear_table[r2];
|
||||
r *= r;
|
||||
g = sRGB_to_linear_table[g1] - sRGB_to_linear_table[g2];
|
||||
g *= g;
|
||||
b = sRGB_to_linear_table[b1] - sRGB_to_linear_table[b2];
|
||||
b *= b;
|
||||
|
||||
// easy to confuse:
|
||||
// dark grey, brown, purple
|
||||
// light grey, tan
|
||||
// red, orange
|
||||
return r + g + b < 0.04;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int would_flood_fill(SDL_Surface * canvas, Uint32 cur_colr, Uint32 old_colr)
|
||||
{
|
||||
if (cur_colr == old_colr || colors_close(canvas, cur_colr, old_colr))
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void do_flood_fill(SDL_Surface * canvas, int x, int y, Uint32 cur_colr, Uint32 old_colr, int * x1, int * y1, int * x2, int * y2)
|
||||
{
|
||||
int fillL, fillR, i, in_line;
|
||||
static unsigned char prog_anim;
|
||||
|
||||
|
||||
if (cur_colr == old_colr || colors_close(canvas, cur_colr, old_colr))
|
||||
return;
|
||||
|
||||
if (y < *y1)
|
||||
{
|
||||
*y1 = y;
|
||||
}
|
||||
if (y > *y2)
|
||||
{
|
||||
*y2 = y;
|
||||
}
|
||||
|
||||
|
||||
fillL = x;
|
||||
fillR = x;
|
||||
|
||||
prog_anim++;
|
||||
if ((prog_anim % 4) == 0)
|
||||
{
|
||||
/* FIXME: api->update_progress_bar(); */
|
||||
playsound(canvas, 1, SND_FILL, 1, x, SNDDIST_NEAR);
|
||||
}
|
||||
|
||||
|
||||
/* Find left side, filling along the way */
|
||||
|
||||
in_line = 1;
|
||||
|
||||
while (in_line)
|
||||
{
|
||||
putpixels[canvas->format->BytesPerPixel] (canvas, fillL, y, cur_colr);
|
||||
fillL--;
|
||||
|
||||
in_line = (fillL < 0) ? 0 : colors_close(canvas, getpixels[canvas->format->BytesPerPixel] (canvas, fillL, y), old_colr);
|
||||
}
|
||||
|
||||
if (fillL < *x1)
|
||||
{
|
||||
*x1 = fillL;
|
||||
}
|
||||
|
||||
fillL++;
|
||||
|
||||
/* Find right side, filling along the way */
|
||||
|
||||
in_line = 1;
|
||||
while (in_line)
|
||||
{
|
||||
putpixels[canvas->format->BytesPerPixel] (canvas, fillR, y, cur_colr);
|
||||
fillR++;
|
||||
|
||||
in_line = (fillR >= canvas->w) ? 0 : colors_close(canvas, getpixels[canvas->format->BytesPerPixel] (canvas, fillR, y), old_colr);
|
||||
}
|
||||
|
||||
if (fillR > *x2)
|
||||
{
|
||||
*x2 = fillR;
|
||||
}
|
||||
|
||||
fillR--;
|
||||
|
||||
|
||||
/* Search top and bottom */
|
||||
|
||||
for (i = fillL; i <= fillR; i++)
|
||||
{
|
||||
if (y > 0 && colors_close(canvas, getpixels[canvas->format->BytesPerPixel] (canvas, i, y - 1), old_colr))
|
||||
do_flood_fill(canvas, i, y - 1, cur_colr, old_colr, x1, y1, x2, y2);
|
||||
|
||||
if (y < canvas->h && colors_close(canvas, getpixels[canvas->format->BytesPerPixel] (canvas, i, y + 1), old_colr))
|
||||
do_flood_fill(canvas, i, y + 1, cur_colr, old_colr, x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
38
src/fill.h
Normal file
38
src/fill.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
fill.h
|
||||
|
||||
Fill tool
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
Copyright (c) 2002-2019 by Bill Kendrick and others; see AUTHORS.txt
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
Flood fill code based on Wikipedia example:
|
||||
http://www.wikipedia.org/wiki/Flood_fill/C_example
|
||||
by Damian Yerrick - http://www.wikipedia.org/wiki/Damian_Yerrick
|
||||
|
||||
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)
|
||||
|
||||
Last updated: September 14, 2019
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
int would_flood_fill(SDL_Surface * canvas, Uint32 cur_colr, Uint32 old_colr);
|
||||
void do_flood_fill(SDL_Surface * canvas, int x, int y, Uint32 cur_colr, Uint32 old_colr, int * x1, int * y1, int * x2, int * y2);
|
||||
|
||||
|
|
@ -972,10 +972,12 @@ static void loadfonts(SDL_Surface * screen, SDL_Texture * texture, SDL_Renderer
|
|||
|
||||
result = find_directory(B_SYSTEM_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
loadfonts(screen, texture, renderer, buffer);
|
||||
result = find_directory(B_COMMON_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
result = find_directory(B_SYSTEM_NONPACKAGED_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
loadfonts(screen, texture, renderer, buffer);
|
||||
result = find_directory(B_USER_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
loadfonts(screen, texture, renderer, buffer);
|
||||
result = find_directory(B_USER_NONPACKAGED_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
loadfonts(screen, texture, renderer, buffer);
|
||||
#elif defined(__APPLE__)
|
||||
loadfonts(screen, texture, renderer, "/System/Library/Fonts");
|
||||
loadfonts(screen, texture, renderer, "/Library/Fonts");
|
||||
|
|
|
|||
22
src/i18n.c
22
src/i18n.c
|
|
@ -4,7 +4,7 @@
|
|||
For Tux Paint
|
||||
Language-related functions
|
||||
|
||||
Copyright (c) 2002-2014 by Bill Kendrick and others
|
||||
Copyright (c) 2002-2019 by Bill Kendrick and others
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
$Id$
|
||||
|
||||
June 14, 2002 - December 11, 2016
|
||||
June 14, 2002 - August 29, 2019
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -1010,9 +1010,10 @@ static int set_current_language(const char *restrict locale_choice) MUST_CHECK;
|
|||
static int set_current_language(const char *restrict loc)
|
||||
{
|
||||
int i;
|
||||
int y_nudge = 0;
|
||||
int j = 0;
|
||||
char *oldloc;
|
||||
char *env_language;
|
||||
char *env_language_lang;
|
||||
|
||||
|
||||
if (strlen(loc) > 0)
|
||||
|
|
@ -1107,8 +1108,6 @@ static int set_current_language(const char *restrict loc)
|
|||
mysetenv("LANGUAGE", "C");
|
||||
}
|
||||
env_language = strdup(getenv("LANGUAGE"));
|
||||
int j = 0;
|
||||
char *env_language_lang;
|
||||
|
||||
if (*env_language)
|
||||
{
|
||||
|
|
@ -1128,7 +1127,6 @@ static int set_current_language(const char *restrict loc)
|
|||
if (lang_y_nudge[i][0] == langint)
|
||||
{
|
||||
wished_langs[j].lang_y_nudge = lang_y_nudge[i][1];
|
||||
//printf("y_nudge = %d\n", y_nudge);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1154,18 +1152,6 @@ static int set_current_language(const char *restrict loc)
|
|||
need_right_to_left = wished_langs[0].need_right_to_left;
|
||||
need_right_to_left_word = wished_langs[0].need_right_to_left_word;
|
||||
|
||||
#if 0
|
||||
for (i = 0; lang_y_nudge[i][0] != -1; i++)
|
||||
{
|
||||
// printf("lang_y_nudge[%d][0] = %d\n", i, lang_y_nudge[i][0]);
|
||||
if (lang_y_nudge[i][0] == langint)
|
||||
{
|
||||
y_nudge = lang_y_nudge[i][1];
|
||||
//printf("y_nudge = %d\n", y_nudge);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: Language is %s (%d) %s/%s\n",
|
||||
lang_prefix, langint, need_right_to_left ? "(RTL)" : "", need_right_to_left_word ? "(RTL words)" : "");
|
||||
|
|
|
|||
21
src/im.c
21
src/im.c
|
|
@ -2,7 +2,7 @@
|
|||
im.c
|
||||
|
||||
Input method handling
|
||||
Copyright (c)2007 by Mark K. Kim and others
|
||||
Copyright (c) 2007-2019 by Mark K. Kim and others
|
||||
|
||||
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
|
||||
|
|
@ -48,7 +48,6 @@
|
|||
#include "android_mbstowcs.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* ***************************************************************************
|
||||
* I18N GETTEXT
|
||||
*/
|
||||
|
|
@ -941,12 +940,12 @@ static int im_event_zh_tw(IM_DATA * im, SDL_Event event)
|
|||
|
||||
case IM_REQ_FREE: /* Free allocated resources */
|
||||
charmap_free(&cm);
|
||||
/* go onto full reset */
|
||||
FALL_THROUGH; /* go onto full reset */
|
||||
|
||||
case IM_REQ_RESET_FULL: /* Full reset */
|
||||
cm.section = SEC_ENGLISH;
|
||||
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
|
||||
/* go onto soft reset */
|
||||
FALL_THROUGH; /* go onto soft reset */
|
||||
|
||||
case IM_REQ_RESET_SOFT: /* Soft reset */
|
||||
im->s[0] = L'\0';
|
||||
|
|
@ -1164,12 +1163,12 @@ static int im_event_th(IM_DATA * im, SDL_Event event)
|
|||
|
||||
case IM_REQ_FREE: /* Free allocated resources */
|
||||
charmap_free(&cm);
|
||||
/* go onto full reset */
|
||||
FALL_THROUGH; /* go onto full reset */
|
||||
|
||||
case IM_REQ_RESET_FULL: /* Full reset */
|
||||
cm.section = SEC_ENGLISH;
|
||||
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
|
||||
/* go onto soft reset */
|
||||
FALL_THROUGH; /* go onto soft reset */
|
||||
|
||||
case IM_REQ_RESET_SOFT: /* Soft reset */
|
||||
im->s[0] = L'\0';
|
||||
|
|
@ -1384,12 +1383,12 @@ static int im_event_ja(IM_DATA * im, SDL_Event event)
|
|||
|
||||
case IM_REQ_FREE: /* Free allocated resources */
|
||||
charmap_free(&cm);
|
||||
/* go onto full reset */
|
||||
FALL_THROUGH; /* go onto full reset */
|
||||
|
||||
case IM_REQ_RESET_FULL: /* Full reset */
|
||||
cm.section = SEC_ENGLISH;
|
||||
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
|
||||
/* go onto soft reset */
|
||||
FALL_THROUGH; /* go onto soft reset */
|
||||
|
||||
case IM_REQ_RESET_SOFT: /* Soft reset */
|
||||
im->s[0] = L'\0';
|
||||
|
|
@ -1634,12 +1633,12 @@ static int im_event_ko(IM_DATA * im, SDL_Event event)
|
|||
|
||||
case IM_REQ_FREE: /* Free allocated resources */
|
||||
charmap_free(&cm);
|
||||
/* go onto full reset */
|
||||
FALL_THROUGH; /* go onto full reset */
|
||||
|
||||
case IM_REQ_RESET_FULL: /* Full reset */
|
||||
cm.section = SEC_ENGLISH;
|
||||
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
|
||||
/* go onto soft reset */
|
||||
FALL_THROUGH; /* go onto soft reset */
|
||||
|
||||
case IM_REQ_RESET_SOFT: /* Soft reset */
|
||||
im->s[0] = L'\0';
|
||||
|
|
@ -1724,7 +1723,7 @@ static int im_event_ko(IM_DATA * im, SDL_Event event)
|
|||
im->redraw--;
|
||||
event.text.text[0] = L'\0';
|
||||
}
|
||||
/* continue processing: */
|
||||
FALL_THROUGH; /* continue processing: */
|
||||
|
||||
/* Actual character processing */
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
/*
|
||||
* FIXME
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "macos.h"
|
||||
|
||||
#define MACOS_FONTS_PATH "%s/Library/Fonts"
|
||||
|
|
@ -12,7 +14,7 @@
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
const char *macos_fontsPath()
|
||||
const char *macos_fontsPath(void)
|
||||
{
|
||||
static char *p = NULL;
|
||||
|
||||
|
|
@ -35,7 +37,7 @@ const char *macos_fontsPath()
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
const char *macos_preferencesPath()
|
||||
const char *macos_preferencesPath(void)
|
||||
{
|
||||
static char *p = NULL;
|
||||
|
||||
|
|
@ -58,7 +60,7 @@ const char *macos_preferencesPath()
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
const char *macos_globalPreferencesPath()
|
||||
const char *macos_globalPreferencesPath(void)
|
||||
{
|
||||
return MACOS_GLOBAL_PREFERENCES_PATH;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef __MACOS_H__
|
||||
#define __MACOS_H__
|
||||
|
||||
const char *macos_fontsPath();
|
||||
const char *macos_preferencesPath();
|
||||
const char *macos_globalPreferencesPath();
|
||||
const char *macos_fontsPath(void);
|
||||
const char *macos_preferencesPath(void);
|
||||
const char *macos_globalPreferencesPath(void);
|
||||
|
||||
|
||||
#endif /* __MACOS_H__ */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
.\" tuxpaint.1 - 2018.09.24
|
||||
.TH TUXPAINT 1 "24 September 2018" "0.9.23c" "Tux Paint"
|
||||
.\" tuxpaint.1 - 2019.09.21
|
||||
.TH TUXPAINT 1 "21 September 2019" "0.9.24" "Tux Paint"
|
||||
.SH NAME
|
||||
tuxpaint -- "Tux Paint", a drawing program for young children.
|
||||
|
||||
|
|
@ -23,6 +23,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
|||
.br
|
||||
[\-\-nosound]
|
||||
.br
|
||||
[\-\-nostereo]
|
||||
.br
|
||||
[\-\-noquit]
|
||||
.br
|
||||
[\-\-noprint]
|
||||
|
|
@ -61,6 +63,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
|||
.br
|
||||
[\-\-nolabel]
|
||||
.br
|
||||
[\-\-newcolorslast]
|
||||
.br
|
||||
[\-\-mirrorstamps]
|
||||
.br
|
||||
[\-\-mouse-accessibility]
|
||||
|
|
@ -151,6 +155,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
|||
.br
|
||||
[\-\-sound]
|
||||
.br
|
||||
[\-\-stereo]
|
||||
.br
|
||||
[\-\-quit]
|
||||
.br
|
||||
[\-\-print]
|
||||
|
|
@ -187,6 +193,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
|||
.br
|
||||
[\-\-label]
|
||||
.br
|
||||
[\-\-newcolorsfirst]
|
||||
.br
|
||||
[\-\-dontmirrorstamps]
|
||||
.br
|
||||
[\-\-stampsize=default]
|
||||
|
|
@ -273,7 +281,7 @@ orientations are both supported. (Also see \-\-orient, below.)
|
|||
|
||||
.TP 8
|
||||
.B \-\-orient=landscape \-\-orient=portrait
|
||||
If \-\-orient=portraitis set, asks \fITux Paint\fP to swap the WIDTH and HEIGHT
|
||||
If \-\-orient=portrait is set, asks \fITux Paint\fP to swap the WIDTH and HEIGHT
|
||||
values it uses for windowed or fullscreen mode, without having to actually
|
||||
change the WIDTH and HEIGHT values in the configuration file or on the
|
||||
command-line. (This is useful on devices where the screen can be rotated,
|
||||
|
|
@ -283,6 +291,10 @@ e.g. tablet PCs.)
|
|||
.B \-\-nosound \-\-sound
|
||||
Disable or enable (default) sound.
|
||||
|
||||
.TP 8
|
||||
.B \-\-nostereo \-\-stereo
|
||||
Disable or enable (default) stereo panning support.
|
||||
|
||||
.TP 8
|
||||
.B \-\-noquit \-\-quit
|
||||
Disable or enable (default) the on-screen \fIQuit\fP button and \fIEscape\fP
|
||||
|
|
@ -408,6 +420,11 @@ controllable.)
|
|||
Disable or enable (default) the \fILabel\fP tool, which lets you create
|
||||
text which can be altered or moved later.
|
||||
|
||||
.TP 8
|
||||
.B \-\-newcolorslast \-\-newcolorsfirst
|
||||
List solid (blank) colors at the end, or beginning (default) of the
|
||||
options displayed when using the \fINew\fP tool to start a new picture.
|
||||
|
||||
.TP 8
|
||||
.B \-\-mirrorstamps \-\-dontmirrorstamps
|
||||
With \fImirrorstamps\fP set, stamps which can be mirrored will appear
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ static struct osk_layout *load_layout(on_screen_keyboard * keyboard, char *layou
|
|||
char *filename;
|
||||
char *key, *value;
|
||||
osk_layout *layout;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
layout = malloc(sizeof(osk_layout));
|
||||
layout->name = NULL;
|
||||
|
|
@ -205,7 +206,7 @@ static struct osk_layout *load_layout(on_screen_keyboard * keyboard, char *layou
|
|||
|
||||
while (!feof(fi))
|
||||
{
|
||||
fgets(line, 1023, fi);
|
||||
tmp_ptr = fgets(line, 1023, fi);
|
||||
|
||||
if (is_blank_or_comment(line))
|
||||
continue;
|
||||
|
|
@ -277,6 +278,7 @@ void load_hlayout(osk_layout * layout, char *hlayout_name)
|
|||
char *key, *fontpath;
|
||||
char *plain_label, *top_label, *altgr_label, *shift_altgr_label;
|
||||
FILE *fi;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
key_number = line_number = 0;
|
||||
width = height = 0;
|
||||
|
|
@ -342,7 +344,7 @@ void load_hlayout(osk_layout * layout, char *hlayout_name)
|
|||
allocated = 1;
|
||||
}
|
||||
|
||||
fgets(line, 1023, fi);
|
||||
tmp_ptr = fgets(line, 1023, fi);
|
||||
|
||||
if (is_blank_or_comment(line))
|
||||
continue;
|
||||
|
|
@ -466,6 +468,7 @@ void load_keymap(osk_layout * layout, char *keymap_name)
|
|||
char *ksname1, *ksname2, *ksname3, *ksname4;
|
||||
char *line;
|
||||
FILE *fi;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
filename = malloc(sizeof(char) * 255);
|
||||
|
||||
|
|
@ -502,7 +505,7 @@ void load_keymap(osk_layout * layout, char *keymap_name)
|
|||
|
||||
while (!feof(fi))
|
||||
{
|
||||
fgets(line, 1023, fi);
|
||||
tmp_ptr = fgets(line, 1023, fi);
|
||||
|
||||
if (is_blank_or_comment(line))
|
||||
continue;
|
||||
|
|
@ -652,6 +655,7 @@ static void load_composemap(osk_layout * layout, char *composemap_name)
|
|||
char **pointer;
|
||||
char *line;
|
||||
FILE *fi;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
pointer = malloc(sizeof(wchar_t *));
|
||||
filename = malloc(sizeof(char) * 255);
|
||||
|
|
@ -684,7 +688,7 @@ static void load_composemap(osk_layout * layout, char *composemap_name)
|
|||
|
||||
while (!feof(fi))
|
||||
{
|
||||
fgets(line, 1023, fi);
|
||||
tmp_ptr = fgets(line, 1023, fi);
|
||||
|
||||
if (is_blank_or_comment(line))
|
||||
continue;
|
||||
|
|
@ -760,6 +764,7 @@ static void load_keysymdefs(osk_layout * layout, char *keysymdefs_name)
|
|||
char *filename;
|
||||
char *line;
|
||||
FILE *fi;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
filename = malloc(sizeof(char) * 255);
|
||||
|
||||
|
|
@ -789,7 +794,7 @@ static void load_keysymdefs(osk_layout * layout, char *keysymdefs_name)
|
|||
|
||||
while (!feof(fi))
|
||||
{
|
||||
fgets(line, 1023, fi);
|
||||
tmp_ptr = fgets(line, 1023, fi);
|
||||
if (strncmp("#define XK_", line, 11) != 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ struct cfg
|
|||
#define NEGBOOL(x) (void*)(offsetof(struct cfginfo,x)|NEG)
|
||||
#define IMM(x) imm_##x
|
||||
|
||||
/* Prototypes of what's in tuxpaint.c: */
|
||||
void show_version(int details);
|
||||
void show_usage(int exitcode);
|
||||
|
||||
static void imm_version(void)
|
||||
{
|
||||
show_version(0);
|
||||
|
|
@ -142,6 +146,7 @@ shortcuts, NEGBOOL(noshortcuts)
|
|||
showcursor, NEGBOOL(hide_cursor)
|
||||
simpleshapes, POSBOOL(simple_shapes)
|
||||
sound, POSBOOL(use_sound)
|
||||
stereo, POSBOOL(use_stereo)
|
||||
stampcontrols, NEGBOOL(disable_stamp_controls)
|
||||
stamps, NEGBOOL(dont_load_stamps)
|
||||
stampsize, MULTI(stamp_size_override)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ struct cfginfo
|
|||
const char *start_blank;
|
||||
const char *use_print_config;
|
||||
const char *use_sound;
|
||||
const char *use_stereo;
|
||||
const char *wheely;
|
||||
const char *mouseaccessibility;
|
||||
const char *onscreen_keyboard;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
playsound.c
|
||||
|
||||
Copyright (c) 2002-2009
|
||||
Copyright (c) 2002-2019
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -31,6 +31,7 @@ Mix_Chunk *sounds[NUM_SOUNDS];
|
|||
|
||||
int mute;
|
||||
int use_sound = 1;
|
||||
int use_stereo = 1;
|
||||
static int old_sound[4] = { -1, -1, -1, -1 };
|
||||
|
||||
/**
|
||||
|
|
@ -80,22 +81,31 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
|
|||
dist = (255 * ((screen->h - 1) - y)) / (screen->h - 1);
|
||||
}
|
||||
|
||||
if (x == SNDPOS_LEFT)
|
||||
left = 255 - dist;
|
||||
else if (x == SNDPOS_CENTER)
|
||||
left = (255 - dist) / 2;
|
||||
else if (x == SNDPOS_RIGHT)
|
||||
left = 0;
|
||||
|
||||
if (use_stereo)
|
||||
{
|
||||
if (x == SNDPOS_LEFT)
|
||||
left = 255 - dist;
|
||||
else if (x == SNDPOS_CENTER)
|
||||
left = (255 - dist) / 2;
|
||||
else if (x == SNDPOS_RIGHT)
|
||||
left = 0;
|
||||
else
|
||||
{
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
else if (x >= screen->w)
|
||||
x = screen->w - 1;
|
||||
|
||||
left = ((255 - dist) * ((screen->w - 1) - x)) / (screen->w - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
else if (x >= screen->w)
|
||||
x = screen->w - 1;
|
||||
|
||||
left = ((255 - dist) * ((screen->w - 1) - x)) / (screen->w - 1);
|
||||
/* Stereo disabled; treat everything like a SNDPOS_CENTER
|
||||
(equal amount in each of the left/right channels) */
|
||||
left = (255 - dist) / 2;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255 - dist) - left);
|
||||
fflush(stdout);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* playsound.h
|
||||
|
||||
Copyright (c) 2002-2009
|
||||
Copyright (c) 2002-2019
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
#define SNDDIST_NEAR -999
|
||||
|
||||
extern Mix_Chunk *sounds[NUM_SOUNDS];
|
||||
extern int mute, use_sound;
|
||||
extern int mute, use_sound, use_stereo;
|
||||
|
||||
void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
For Tux Paint
|
||||
List of sound effects.
|
||||
|
||||
Copyright (c) 2002-2007 by Bill Kendrick and others
|
||||
Copyright (c) 2002-2019 by Bill Kendrick and others
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 15, 2002 - July 5, 2007
|
||||
June 15, 2002 - September 12, 2019
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ enum
|
|||
SND_TUXOK, /* "Ok" */
|
||||
SND_THICK,
|
||||
SND_THIN,
|
||||
SND_FILL,
|
||||
NUM_SOUNDS
|
||||
};
|
||||
|
||||
|
|
@ -107,7 +108,8 @@ static const char *sound_fnames[NUM_SOUNDS] = {
|
|||
DATA_PREFIX "sounds/youcannot.wav",
|
||||
DATA_PREFIX "sounds/tuxok.wav",
|
||||
DATA_PREFIX "sounds/thick.wav",
|
||||
DATA_PREFIX "sounds/thin.wav"
|
||||
DATA_PREFIX "sounds/thin.wav",
|
||||
DATA_PREFIX "sounds/fill.wav"
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
16
src/tools.h
16
src/tools.h
|
|
@ -19,11 +19,11 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
Copyright (c) 2002-2009 by Bill Kendrick
|
||||
Copyright (c) 2002-2019 by Bill Kendrick
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
June 14, 2002 - October 9, 2009
|
||||
June 14, 2002 - September 12, 2019
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ enum
|
|||
TOOL_SHAPES,
|
||||
TOOL_TEXT,
|
||||
TOOL_LABEL,
|
||||
TOOL_NA,
|
||||
TOOL_FILL,
|
||||
TOOL_MAGIC,
|
||||
TOOL_UNDO,
|
||||
TOOL_REDO,
|
||||
|
|
@ -76,8 +76,8 @@ const char *const tool_names[NUM_TOOLS] = {
|
|||
// Label tool
|
||||
gettext_noop("Label"),
|
||||
|
||||
// Reserved...
|
||||
" ",
|
||||
// Fill tool
|
||||
gettext_noop("Fill"),
|
||||
|
||||
// "Magic" effects tools (blur, flip image, etc.)
|
||||
gettext_noop("Magic"),
|
||||
|
|
@ -132,8 +132,8 @@ const char *const tool_tips[NUM_TOOLS] = {
|
|||
gettext_noop
|
||||
("Choose a style of text. Click on your drawing and you can start typing. Press [Enter] or [Tab] to complete the text. By using the selector button and clicking an existing label, you can move it, edit it and change its text style."),
|
||||
|
||||
// Reserved...
|
||||
" ",
|
||||
// Fill tool instructions
|
||||
gettext_noop("Click in the picture to fill that area with color."),
|
||||
|
||||
// Magic tool instruction
|
||||
gettext_noop("Pick a magical effect to use on your drawing!"),
|
||||
|
|
@ -185,7 +185,7 @@ const char *const tool_img_fnames[NUM_TOOLS] = {
|
|||
DATA_PREFIX "images/tools/shapes.png",
|
||||
DATA_PREFIX "images/tools/text.png",
|
||||
DATA_PREFIX "images/tools/label.png",
|
||||
DATA_PREFIX "images/ui/dead40x40.png",
|
||||
DATA_PREFIX "images/tools/fill.png",
|
||||
DATA_PREFIX "images/tools/magic.png",
|
||||
DATA_PREFIX "images/tools/undo.png",
|
||||
DATA_PREFIX "images/tools/redo.png",
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ _tuxpaint()
|
|||
--orient=landscape --orient=portrait \
|
||||
-b --startblank --startlast \
|
||||
--sound -q --nosound \
|
||||
--stereo --nostereo \
|
||||
-x --noquit --quit
|
||||
-p --print --noprint \
|
||||
--complexshapes -s --simpleshapes \
|
||||
|
|
|
|||
147
src/tuxpaint.c
147
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 - April 3, 2019
|
||||
June 14, 2002 - September 21, 2019
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -478,9 +478,7 @@ static void mtw(wchar_t * wtok, char *tok)
|
|||
#else
|
||||
|
||||
#include <librsvg/rsvg.h>
|
||||
#include <librsvg/rsvg-cairo.h>
|
||||
/* #include "rsvg.h" */
|
||||
/* #include "rsvg-cairo.h" */
|
||||
|
||||
#if !defined(RSVG_H) || !defined(RSVG_CAIRO_H)
|
||||
#error "---------------------------------------------------"
|
||||
#error "If you installed libRSVG from packages, be sure"
|
||||
|
|
@ -527,6 +525,8 @@ static void mtw(wchar_t * wtok, char *tok)
|
|||
#include "tip_tux.h"
|
||||
#include "great.h"
|
||||
|
||||
#include "fill.h"
|
||||
|
||||
#include "im.h"
|
||||
|
||||
|
||||
|
|
@ -2144,17 +2144,19 @@ static char *debug_gettext(const char *str);
|
|||
static int charsize(Uint16 c);
|
||||
#endif
|
||||
|
||||
static SDL_Surface *load_kpx(char *file);
|
||||
static SDL_Surface *load_kpx(const char *file);
|
||||
|
||||
#ifndef NOSVG
|
||||
static SDL_Surface *load_svg(char *file);
|
||||
static SDL_Surface *load_svg(const char *file);
|
||||
static float pick_best_scape(unsigned int orig_w, unsigned int orig_h, unsigned int max_w, unsigned int max_h);
|
||||
#endif
|
||||
static SDL_Surface *myIMG_Load_RWops(char *file);
|
||||
static SDL_Surface *myIMG_Load(char *file);
|
||||
static SDL_Surface *myIMG_Load_RWops(const char *file);
|
||||
static SDL_Surface *myIMG_Load(const char *file);
|
||||
static int trash(char *path);
|
||||
int file_exists(char *path);
|
||||
|
||||
int generate_fontconfig_cache_spinner(SDL_Surface * screen);
|
||||
|
||||
|
||||
#define MAX_UTF8_CHAR_LENGTH 6
|
||||
|
||||
|
|
@ -3263,6 +3265,12 @@ static void mainloop(void)
|
|||
draw_brushes();
|
||||
draw_colors(COLORSEL_ENABLE);
|
||||
}
|
||||
else if (cur_tool == TOOL_FILL)
|
||||
{
|
||||
keybd_flag = 0;
|
||||
draw_none();
|
||||
draw_colors(COLORSEL_ENABLE);
|
||||
}
|
||||
else if (cur_tool == TOOL_SHAPES)
|
||||
{
|
||||
keybd_flag = 0;
|
||||
|
|
@ -4606,6 +4614,35 @@ static void mainloop(void)
|
|||
if (mouseaccessibility)
|
||||
emulate_button_pressed = !emulate_button_pressed;
|
||||
}
|
||||
else if (cur_tool == TOOL_FILL)
|
||||
{
|
||||
Uint32 draw_color, canv_color;
|
||||
|
||||
/* Fill */
|
||||
|
||||
draw_color = SDL_MapRGB(canvas->format,
|
||||
color_hexes[cur_color][0],
|
||||
color_hexes[cur_color][1],
|
||||
color_hexes[cur_color][2]);
|
||||
canv_color = getpixels[canvas->format->BytesPerPixel] (canvas, old_x, old_y);
|
||||
|
||||
if (would_flood_fill(canvas, draw_color, canv_color))
|
||||
{
|
||||
/* We only bother recording an undo buffer
|
||||
(which may kill our redos) if we're about
|
||||
to actually change the picture */
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
rec_undo_buffer();
|
||||
|
||||
x1 = x2 = old_x;
|
||||
y1 = y2 = old_y;
|
||||
|
||||
do_flood_fill(canvas, old_x, old_y, draw_color, canv_color, &x1, &y1, &x2, &y2);
|
||||
|
||||
update_canvas(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
else if (cur_tool == TOOL_TEXT || cur_tool == TOOL_LABEL)
|
||||
{
|
||||
if (onscreen_keyboard && !kbd)
|
||||
|
|
@ -4807,7 +4844,8 @@ static void mainloop(void)
|
|||
|
||||
if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_STAMP ||
|
||||
cur_tool == TOOL_SHAPES || cur_tool == TOOL_LINES ||
|
||||
cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT || cur_tool == TOOL_ERASER || cur_tool == TOOL_LABEL)
|
||||
cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT ||
|
||||
cur_tool == TOOL_ERASER || cur_tool == TOOL_LABEL)
|
||||
{
|
||||
|
||||
/* Left tools scroll */
|
||||
|
|
@ -5424,7 +5462,7 @@ static void mainloop(void)
|
|||
do_setcursor(cursor_brush);
|
||||
else if (cur_tool == TOOL_STAMP)
|
||||
do_setcursor(cursor_tiny);
|
||||
else if (cur_tool == TOOL_LINES)
|
||||
else if (cur_tool == TOOL_LINES || cur_tool == TOOL_FILL)
|
||||
do_setcursor(cursor_crosshair);
|
||||
else if (cur_tool == TOOL_SHAPES)
|
||||
{
|
||||
|
|
@ -5455,7 +5493,6 @@ static void mainloop(void)
|
|||
do_setcursor(cursor_arrow);
|
||||
}
|
||||
}
|
||||
|
||||
else if (cur_tool == TOOL_MAGIC)
|
||||
do_setcursor(cursor_wand);
|
||||
else if (cur_tool == TOOL_ERASER)
|
||||
|
|
@ -6706,6 +6743,7 @@ void show_usage(int exitcode)
|
|||
" [--orient=landscape | --orient=portrait]\n"
|
||||
" [--disablescreensaver | --allowscreensaver ]\n"
|
||||
" [--sound | --nosound]\n"
|
||||
" [--stereo | --nostereo]\n"
|
||||
" [--colorfile FILE]\n"
|
||||
"\n"
|
||||
" Mouse/Keyboard:\n"
|
||||
|
|
@ -8036,7 +8074,7 @@ static int generate_fontconfig_cache_real(void)
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
static int generate_fontconfig_cache(void *vp)
|
||||
static int generate_fontconfig_cache(__attribute__((unused)) void *vp)
|
||||
{
|
||||
return generate_fontconfig_cache_real();
|
||||
}
|
||||
|
|
@ -9648,13 +9686,6 @@ static SDL_Surface *thumbnail2(SDL_Surface * src, int max_x, int max_y, int keep
|
|||
for (x = 0; x < max_x; x++)
|
||||
{
|
||||
#ifndef LOW_QUALITY_THUMBNAILS
|
||||
|
||||
#ifdef GAMMA_CORRECTED_THUMBNAILS
|
||||
/* per: http://www.4p8.com/eric.brasseur/gamma.html */
|
||||
float gamma = 2.2;
|
||||
float gamma_invert = 1.0 / gamma;
|
||||
#endif
|
||||
|
||||
tr = 0;
|
||||
tg = 0;
|
||||
tb = 0;
|
||||
|
|
@ -9669,9 +9700,8 @@ static SDL_Surface *thumbnail2(SDL_Surface * src, int max_x, int max_y, int keep
|
|||
SDL_GetRGBA(getpixel(src, src_x, src_y), src->format, &r, &g, &b, &a);
|
||||
|
||||
#ifdef GAMMA_CORRECTED_THUMBNAILS
|
||||
// tr = tr + pow((float)r, gamma);
|
||||
// tb = tb + pow((float)b, gamma);
|
||||
// tg = tg + pow((float)g, gamma);
|
||||
/* per: http://www.4p8.com/eric.brasseur/gamma.html */
|
||||
|
||||
tr = tr + sRGB_to_linear_table[r];
|
||||
tg = tg + sRGB_to_linear_table[g];
|
||||
tb = tb + sRGB_to_linear_table[b];
|
||||
|
|
@ -9694,9 +9724,6 @@ static SDL_Surface *thumbnail2(SDL_Surface * src, int max_x, int max_y, int keep
|
|||
ta = ta / tmp;
|
||||
|
||||
#ifdef GAMMA_CORRECTED_THUMBNAILS
|
||||
// tr = ceil(pow(tr, gamma_invert));
|
||||
// tg = ceil(pow(tg, gamma_invert));
|
||||
// tb = ceil(pow(tb, gamma_invert));
|
||||
tr = linear_to_sRGB(tr);
|
||||
tg = linear_to_sRGB(tg);
|
||||
tb = linear_to_sRGB(tb);
|
||||
|
|
@ -10425,11 +10452,6 @@ static void reset_avail_tools(void)
|
|||
tool_avail[TOOL_LABEL] = 0;
|
||||
|
||||
|
||||
/* TBD... */
|
||||
|
||||
tool_avail[TOOL_NA] = 0;
|
||||
|
||||
|
||||
/* Disable save? */
|
||||
|
||||
if (disable_save)
|
||||
|
|
@ -11593,7 +11615,8 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
|||
char fname[FILENAME_MAX];
|
||||
FILE *fi;
|
||||
char color_tag;
|
||||
int r, g, b, tmp;
|
||||
int r, g, b, __attribute__((unused))tmp;
|
||||
char * __attribute__((unused)) tmp_ptr;
|
||||
|
||||
rname = NULL;
|
||||
|
||||
|
|
@ -11651,7 +11674,7 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
|||
|
||||
if (!feof(fi) && color_tag == 'T')
|
||||
{
|
||||
tmp = fgets(template_id, sizeof(template_id), fi);
|
||||
tmp_ptr = fgets(template_id, sizeof(template_id), fi);
|
||||
template_id[strlen(template_id) - 1] = '\0';
|
||||
tmp = fscanf(fi, "%d", &template_personal);
|
||||
/* FIXME: Debug only? */
|
||||
|
|
@ -11679,12 +11702,12 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
static SDL_Surface *load_starter_helper(char *path_and_basename, char *extension, SDL_Surface * (*load_func) (char *))
|
||||
static SDL_Surface *load_starter_helper(char *path_and_basename, const char *extension, SDL_Surface * (*load_func) (const char *))
|
||||
{
|
||||
char *ext;
|
||||
char fname[256];
|
||||
SDL_Surface *surf;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
ext = strdup(extension);
|
||||
snprintf(fname, sizeof(fname), "%s.%s", path_and_basename, ext);
|
||||
|
|
@ -12249,7 +12272,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
int i;
|
||||
SDL_Surface *alpha_surf;
|
||||
#endif
|
||||
int img1_w, img2_w, img3_w, max_img_w, img_x, img_y, offset;
|
||||
int img1_w, img2_w, img3_w, max_img_w, img_y, offset;
|
||||
SDL_Surface *img1b;
|
||||
int free_img1b;
|
||||
int txt_left, txt_right, img_left, btn_left, txt_btn_left, txt_btn_right;
|
||||
|
|
@ -12432,7 +12455,6 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
|
||||
/* Draw the images (if any, and if not animated): */
|
||||
|
||||
img_x = img_left;
|
||||
img_y = 100 + PROMPTOFFSETY + 4;
|
||||
|
||||
if (img1b != NULL)
|
||||
|
|
@ -13619,9 +13641,9 @@ static void set_chunk_data(unsigned char **chunk_data, size_t * chunk_data_len,
|
|||
|
||||
strcat(headers, "Tuxpaint\n");
|
||||
strcat(headers, "Tuxpaint_" VER_VERSION "\n");
|
||||
sprintf(line, "%d%s", uncompressed_size, "\n");
|
||||
sprintf(line, "%lu%s", uncompressed_size, "\n");
|
||||
strcat(headers, line);
|
||||
sprintf(line, "%d%s", dataLen, "\n");
|
||||
sprintf(line, "%lu%s", dataLen, "\n");
|
||||
strcat(headers, line);
|
||||
|
||||
headersLen = strlen(headers);
|
||||
|
|
@ -13696,7 +13718,9 @@ static void do_png_embed_data(png_structp png_ptr)
|
|||
/* Starter foreground */
|
||||
if (img_starter)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Saving starter... %d\n", (int)(intptr_t) img_starter); //EP added (intptr_t) to avoid warning on x64
|
||||
#endif
|
||||
sbk_pixs = malloc(img_starter->h * img_starter->w * 4);
|
||||
compressedLen = compressBound(img_starter->h * img_starter->w * 4);
|
||||
|
||||
|
|
@ -17922,7 +17946,7 @@ static int paintsound(int size)
|
|||
/* Old libcairo1, svg and svg-cairo based code
|
||||
Based on cairo-demo/sdl/main.c from Cairo (GPL'd, (c) 2004 Eric Windisch):
|
||||
*/
|
||||
static SDL_Surface *load_svg(char *file)
|
||||
static SDL_Surface *load_svg(const char *file)
|
||||
{
|
||||
svg_cairo_t *scr;
|
||||
int bpp, btpp, stride;
|
||||
|
|
@ -18081,7 +18105,7 @@ static SDL_Surface *load_svg(char *file)
|
|||
* FIXME
|
||||
*/
|
||||
/* New libcairo2, rsvg and rsvg-cairo based code */
|
||||
static SDL_Surface *load_svg(char *file)
|
||||
static SDL_Surface *load_svg(const char *file)
|
||||
{
|
||||
cairo_surface_t *cairo_surf;
|
||||
cairo_t *cr;
|
||||
|
|
@ -18332,7 +18356,7 @@ static float pick_best_scape(unsigned int orig_w, unsigned int orig_h, unsigned
|
|||
*/
|
||||
/* FIXME: we can remove this after SDL folks fix their bug at http://bugzilla.libsdl.org/show_bug.cgi?id=1485 */
|
||||
/* Try to load an image with IMG_Load(), if it fails, then try with RWops() */
|
||||
static SDL_Surface *myIMG_Load_RWops(char *file)
|
||||
static SDL_Surface *myIMG_Load_RWops(const char *file)
|
||||
{
|
||||
SDL_Surface *surf;
|
||||
FILE *fi;
|
||||
|
|
@ -18366,7 +18390,7 @@ static SDL_Surface *myIMG_Load_RWops(char *file)
|
|||
if we notice it's an SVG file (if available!);
|
||||
call load_kpx() if we notice it's a KPX file (JPEG with wrapper);
|
||||
otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */
|
||||
static SDL_Surface *myIMG_Load(char *file)
|
||||
static SDL_Surface *myIMG_Load(const char *file)
|
||||
{
|
||||
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0)
|
||||
{
|
||||
|
|
@ -18387,7 +18411,7 @@ static SDL_Surface *myIMG_Load(char *file)
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
static SDL_Surface *load_kpx(char *file)
|
||||
static SDL_Surface *load_kpx(const char *file)
|
||||
{
|
||||
SDL_RWops *data;
|
||||
FILE *fi;
|
||||
|
|
@ -19000,7 +19024,15 @@ static void magic_playsound(Mix_Chunk * snd, int left_right, int up_down)
|
|||
else if (left_right > 255)
|
||||
left_right = 255;
|
||||
|
||||
left = ((255 - dist) * (255 - left_right)) / 255;
|
||||
if (use_stereo)
|
||||
{
|
||||
left = ((255 - dist) * (255 - left_right)) / 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Stereo disabled; no panning (see playsound.c) */
|
||||
left = (255 - dist) / 2;
|
||||
}
|
||||
|
||||
Mix_SetPanning(0, left, (255 - dist) - left);
|
||||
#endif
|
||||
|
|
@ -19243,7 +19275,8 @@ static int do_new_dialog(void)
|
|||
/* Support legacy BMP files for load: */
|
||||
|| strcasestr(f->d_name, ".bmp") != NULL
|
||||
/* Support for KPX (Kid Pix templates; just a JPEG with resource fork header): */
|
||||
|| strcasestr(f->d_name, ".kpx") != NULL || strcasestr(f->d_name, ".jpg") != NULL
|
||||
|| strcasestr(f->d_name, ".kpx") != NULL
|
||||
|| strcasestr(f->d_name, ".jpg") != NULL
|
||||
#ifndef NOSVG
|
||||
|| strcasestr(f->d_name, ".svg") != NULL
|
||||
#endif
|
||||
|
|
@ -19366,11 +19399,12 @@ static int do_new_dialog(void)
|
|||
{
|
||||
/* No thumbnail - load original: */
|
||||
|
||||
/* Make sure we have a ~/.tuxpaint/saved directory: */
|
||||
if (make_directory("saved", "Can't create user data directory"))
|
||||
/* Make sure we have a ~/.tuxpaint/[starters|templates] directory: */
|
||||
if (make_directory(dirname[d_places[num_files]], "Can't create user data directory"))
|
||||
{
|
||||
/* (Make sure we have a .../saved/.thumbs/ directory:) */
|
||||
make_directory("saved/.thumbs", "Can't create user data thumbnail directory");
|
||||
/* (Make sure we have a .../[starters|templates]/.thumbs/ directory:) */
|
||||
snprintf(fname, sizeof(fname), "%s/.thumbs", dirname[d_places[num_files]]);
|
||||
make_directory(fname, "Can't create user data thumbnail directory");
|
||||
}
|
||||
|
||||
img = NULL;
|
||||
|
|
@ -19382,8 +19416,6 @@ static int do_new_dialog(void)
|
|||
If it exists, it should give a better idea of what the
|
||||
starter looks like, compared to the overlay image... */
|
||||
|
||||
/* FIXME: Add .jpg support -bjk 2007.03.22 */
|
||||
|
||||
/* (Try JPEG first) */
|
||||
snprintf(fname, sizeof(fname), "%s/%s-back",
|
||||
dirname[d_places[num_files]], d_names[num_files]);
|
||||
|
|
@ -19524,9 +19556,9 @@ static int do_new_dialog(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("%d files and colors were found!\n", num_files);
|
||||
#endif
|
||||
printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter,
|
||||
first_template, num_files);
|
||||
#endif
|
||||
|
||||
|
||||
/* Let user choose a color or image: */
|
||||
|
|
@ -20309,7 +20341,8 @@ static int do_color_sel(void)
|
|||
int i, dx, dy;
|
||||
int done, chose;
|
||||
int back_left, back_top;
|
||||
int color_sel_x, color_sel_y;
|
||||
int color_sel_x = 0, color_sel_y = 0;
|
||||
int want_animated_popups = 1;
|
||||
SDL_Surface *tmp_btn_up, *tmp_btn_down;
|
||||
|
||||
Uint32(*getpixel_tmp_btn_up) (SDL_Surface *, int, int);
|
||||
|
|
@ -20330,7 +20363,6 @@ static int do_color_sel(void)
|
|||
|
||||
/* FIXME this is the first step to make animated popups optional,
|
||||
to be removed from here when implemented in a more general way */
|
||||
int want_animated_popups = 1;
|
||||
|
||||
hide_blinking_cursor();
|
||||
|
||||
|
|
@ -21626,7 +21658,7 @@ static void render_all_nodes_starting_at(struct label_node **node)
|
|||
* FIXME
|
||||
*/
|
||||
/* FIXME: This should search for the top-down of the overlaping labels and only re-render from it */
|
||||
static void derender_node(struct label_node **ref_head)
|
||||
static void derender_node(__attribute__((unused)) struct label_node **ref_head)
|
||||
{
|
||||
SDL_Rect r_tmp_derender;
|
||||
|
||||
|
|
@ -22958,7 +22990,7 @@ static void setup_config(char *argv[])
|
|||
char buffer[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
||||
status_t result;
|
||||
|
||||
result = find_directory(B_USER_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
result = find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
asprintf((char **)&savedir, "%s/%s", buffer, "TuxPaint");
|
||||
#elif __APPLE__
|
||||
savedir = strdup(macos.preferencesPath());
|
||||
|
|
@ -23086,6 +23118,7 @@ static void setup_config(char *argv[])
|
|||
SETBOOL(start_blank);
|
||||
SETBOOL(use_print_config);
|
||||
SETBOOL(use_sound);
|
||||
SETBOOL(use_stereo);
|
||||
SETBOOL(wheely);
|
||||
SETBOOL(mouseaccessibility);
|
||||
SETBOOL(onscreen_keyboard);
|
||||
|
|
@ -23409,7 +23442,7 @@ static void setup_config(char *argv[])
|
|||
{
|
||||
char *token;
|
||||
|
||||
token = strtok(tmpcfg.joystick_buttons_ignore, ",");
|
||||
token = strtok((char *) tmpcfg.joystick_buttons_ignore, ",");
|
||||
while (token != NULL)
|
||||
{
|
||||
if (strtof(token, NULL) < 0 || strtof(token, NULL) > 254)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
# http://www.tuxpaint.org/
|
||||
#
|
||||
# Default distribution version last modified:
|
||||
# April 30, 2012
|
||||
# September 21, 2019
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
|
@ -76,6 +76,13 @@
|
|||
# sound=yes
|
||||
|
||||
|
||||
### Disable stereo sound (only use mono)?
|
||||
### -------------------------------------
|
||||
#
|
||||
# nostereo=yes
|
||||
# stereo=yes
|
||||
|
||||
|
||||
### Disable the on-screen 'Quit' button in the toolbar?
|
||||
### ---------------------------------------------------
|
||||
### Note: Pressing the [Escape] key,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue