Re-ran indent on .c files
Also, added a few places where indent is disabled (via `/* *INDENT-OFF* */`). See https://sourceforge.net/p/tuxpaint/mailman/message/36077409/ from Oct. 2017.
This commit is contained in:
parent
99b566ae26
commit
4e3a9fbc8c
7 changed files with 184 additions and 148 deletions
|
|
@ -979,7 +979,9 @@ static void mysetenv(const char *name, const char *value)
|
||||||
* @param loc Locale
|
* @param loc Locale
|
||||||
* @return The Y-nudge value for font rendering in the language.
|
* @return The Y-nudge value for font rendering in the language.
|
||||||
*/
|
*/
|
||||||
|
/* *INDENT-OFF* */
|
||||||
static int set_current_language(const char *restrict locale_choice) MUST_CHECK;
|
static int set_current_language(const char *restrict locale_choice) MUST_CHECK;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static int set_current_language(const char *restrict loc)
|
static int set_current_language(const char *restrict loc)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
8
src/im.c
8
src/im.c
|
|
@ -971,7 +971,7 @@ static int im_event_zh_tw(IM_DATA * im, SDL_keysym ks)
|
||||||
/* Left-Alt & Right-Alt mapped to mode-switch */
|
/* Left-Alt & Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
case SDLK_LALT:
|
case SDLK_LALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1190,7 +1190,7 @@ static int im_event_th(IM_DATA * im, SDL_keysym ks)
|
||||||
|
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1409,7 +1409,7 @@ static int im_event_ja(IM_DATA * im, SDL_keysym ks)
|
||||||
|
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1656,7 +1656,7 @@ static int im_event_ko(IM_DATA * im, SDL_keysym ks)
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_LALT:
|
case SDLK_LALT:
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
|
||||||
40
src/macos.c
40
src/macos.c
|
|
@ -12,18 +12,21 @@
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_fontsPath()
|
const char *macos_fontsPath()
|
||||||
{
|
{
|
||||||
static char* p = NULL;
|
static char *p = NULL;
|
||||||
|
|
||||||
if(!p) {
|
if (!p)
|
||||||
const char* home = getenv("HOME");
|
{
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
|
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
|
||||||
|
|
||||||
if(p) sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
|
if (p)
|
||||||
else perror("macos_fontsPath");
|
sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
|
||||||
}
|
else
|
||||||
|
perror("macos_fontsPath");
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
@ -32,18 +35,21 @@ const char* macos_fontsPath()
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_preferencesPath()
|
const char *macos_preferencesPath()
|
||||||
{
|
{
|
||||||
static char* p = NULL;
|
static char *p = NULL;
|
||||||
|
|
||||||
if(!p) {
|
if (!p)
|
||||||
const char* home = getenv("HOME");
|
{
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
|
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
|
||||||
|
|
||||||
if(p) sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
|
if (p)
|
||||||
else perror("macos_preferencesPath");
|
sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
|
||||||
}
|
else
|
||||||
|
perror("macos_preferencesPath");
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +58,7 @@ const char* macos_preferencesPath()
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_globalPreferencesPath()
|
const char *macos_globalPreferencesPath()
|
||||||
{
|
{
|
||||||
return MACOS_GLOBAL_PREFERENCES_PATH;
|
return MACOS_GLOBAL_PREFERENCES_PATH;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
|
||||||
if (!mute && use_sound && s != SND_NONE)
|
if (!mute && use_sound && s != SND_NONE)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ", sounds[s]);
|
printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ",
|
||||||
fflush(stdout);
|
sounds[s]);
|
||||||
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
if (override || !Mix_Playing(chan))
|
if (override || !Mix_Playing(chan))
|
||||||
{
|
{
|
||||||
|
|
@ -96,8 +97,8 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255-dist)-left);
|
printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255 - dist) - left);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
Mix_SetPanning(chan, left, (255 - dist) - left);
|
Mix_SetPanning(chan, left, (255 - dist) - left);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,8 +306,10 @@ int do_ps_save(FILE * fi,
|
||||||
child_pid = pclose(fi);
|
child_pid = pclose(fi);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("pclose returned %d\n", child_pid); fflush(stdout);
|
printf("pclose returned %d\n", child_pid);
|
||||||
printf("errno = %d\n", errno); fflush(stdout);
|
fflush(stdout);
|
||||||
|
printf("errno = %d\n", errno);
|
||||||
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (child_pid < 0 || (errno != 0 && errno != EAGAIN))
|
if (child_pid < 0 || (errno != 0 && errno != EAGAIN))
|
||||||
|
|
@ -324,15 +326,26 @@ int do_ps_save(FILE * fi,
|
||||||
w = waitpid(child_pid, &status, 0);
|
w = waitpid(child_pid, &status, 0);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); }
|
if (w == -1)
|
||||||
if (WIFEXITED(status)) {
|
{
|
||||||
printf("exited, status=%d\n", WEXITSTATUS(status));
|
perror("waitpid");
|
||||||
} else if (WIFSIGNALED(status)) {
|
exit(EXIT_FAILURE);
|
||||||
printf("killed by signal %d\n", WTERMSIG(status));
|
}
|
||||||
} else if (WIFSTOPPED(status)) {
|
if (WIFEXITED(status))
|
||||||
printf("stopped by signal %d\n", WSTOPSIG(status));
|
{
|
||||||
} else if (WIFCONTINUED(status)) {
|
printf("exited, status=%d\n", WEXITSTATUS(status));
|
||||||
printf("continued\n");
|
}
|
||||||
|
else if (WIFSIGNALED(status))
|
||||||
|
{
|
||||||
|
printf("killed by signal %d\n", WTERMSIG(status));
|
||||||
|
}
|
||||||
|
else if (WIFSTOPPED(status))
|
||||||
|
{
|
||||||
|
printf("stopped by signal %d\n", WSTOPSIG(status));
|
||||||
|
}
|
||||||
|
else if (WIFCONTINUED(status))
|
||||||
|
{
|
||||||
|
printf("continued\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
181
src/tuxpaint.c
181
src/tuxpaint.c
|
|
@ -47,21 +47,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VIDEO_BPP
|
#ifndef VIDEO_BPP
|
||||||
/*# define VIDEO_BPP 15 *//* saves memory */
|
/*# define VIDEO_BPP 15 *//* saves memory */
|
||||||
/*# define VIDEO_BPP 16 *//* causes discoloration */
|
/*# define VIDEO_BPP 16 *//* causes discoloration */
|
||||||
/*# define VIDEO_BPP 24 *//* compromise */
|
/*# define VIDEO_BPP 24 *//* compromise */
|
||||||
#define VIDEO_BPP 32 /* might be fastest, if conversion funcs removed */
|
#define VIDEO_BPP 32 /* might be fastest, if conversion funcs removed */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* #define CORNER_SHAPES *//* need major work! */
|
/* #define CORNER_SHAPES *//* need major work! */
|
||||||
|
|
||||||
|
|
||||||
/* Method for printing images: */
|
/* Method for printing images: */
|
||||||
|
|
||||||
#define PRINTMETHOD_PS /* Direct to PostScript */
|
#define PRINTMETHOD_PS /* Direct to PostScript */
|
||||||
/*#define PRINTMETHOD_PNM_PS*//* Output PNM, assuming it gets printed */
|
/*#define PRINTMETHOD_PNM_PS *//* Output PNM, assuming it gets printed */
|
||||||
/*#define PRINTMETHOD_PNG_PNM_PS*//* Output PNG, assuming it gets printed */
|
/*#define PRINTMETHOD_PNG_PNM_PS *//* Output PNG, assuming it gets printed */
|
||||||
|
|
||||||
|
|
||||||
#define MAX_PATH 256
|
#define MAX_PATH 256
|
||||||
|
|
@ -557,7 +557,7 @@ static void mtw(wchar_t * wtok, char *tok)
|
||||||
int TP_EventFilter(const SDL_Event * event);
|
int TP_EventFilter(const SDL_Event * event);
|
||||||
|
|
||||||
|
|
||||||
/* #define fmemopen_alternative */ /* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
/* #define fmemopen_alternative *//* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
||||||
|
|
||||||
#if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) /* MINGW/MSYS, NetBSD, and MacOSX need it, at least for now */
|
#if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) /* MINGW/MSYS, NetBSD, and MacOSX need it, at least for now */
|
||||||
#define fmemopen_alternative
|
#define fmemopen_alternative
|
||||||
|
|
@ -641,7 +641,7 @@ enum
|
||||||
LABEL_OFF,
|
LABEL_OFF,
|
||||||
LABEL_LABEL,
|
LABEL_LABEL,
|
||||||
LABEL_SELECT
|
LABEL_SELECT
|
||||||
/* , LABEL_ROTATE */
|
/* , LABEL_ROTATE */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -685,7 +685,7 @@ typedef struct
|
||||||
Uint8 rows, cols;
|
Uint8 rows, cols;
|
||||||
} grid_dims;
|
} grid_dims;
|
||||||
|
|
||||||
/* static SDL_Rect r_screen; *//* was 640x480 @ 0,0 -- but this isn't so useful */
|
/* static SDL_Rect r_screen; *//* was 640x480 @ 0,0 -- but this isn't so useful */
|
||||||
static SDL_Rect r_canvas; /* was 448x376 @ 96,0 */
|
static SDL_Rect r_canvas; /* was 448x376 @ 96,0 */
|
||||||
static SDL_Rect r_tools; /* was 96x336 @ 0,40 */
|
static SDL_Rect r_tools; /* was 96x336 @ 0,40 */
|
||||||
static SDL_Rect r_sfx;
|
static SDL_Rect r_sfx;
|
||||||
|
|
@ -710,7 +710,7 @@ static grid_dims gd_tools; /* was 2x7 */
|
||||||
static grid_dims gd_sfx;
|
static grid_dims gd_sfx;
|
||||||
static grid_dims gd_toolopt; /* was 2x7 */
|
static grid_dims gd_toolopt; /* was 2x7 */
|
||||||
|
|
||||||
/* static grid_dims gd_open; *//* was 4x4 */
|
/* static grid_dims gd_open; *//* was 4x4 */
|
||||||
static grid_dims gd_colors; /* was 17x1 */
|
static grid_dims gd_colors; /* was 17x1 */
|
||||||
|
|
||||||
#define HEIGHTOFFSET (((WINDOW_HEIGHT - 480) / 48) * 48)
|
#define HEIGHTOFFSET (((WINDOW_HEIGHT - 480) / 48) * 48)
|
||||||
|
|
@ -1960,7 +1960,8 @@ static void get_new_file_id(void);
|
||||||
static int do_quit(int tool);
|
static int do_quit(int tool);
|
||||||
static int do_open(void);
|
static int do_open(void);
|
||||||
static int do_new_dialog(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_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_picker(void);
|
||||||
static int do_color_sel(void);
|
static int do_color_sel(void);
|
||||||
static int do_slideshow(void);
|
static int do_slideshow(void);
|
||||||
|
|
@ -2722,7 +2723,7 @@ static void mainloop(void)
|
||||||
add_label_node(0, 0, 0, 0, NULL);
|
add_label_node(0, 0, 0, 0, NULL);
|
||||||
derender_node(&label_node_to_edit);
|
derender_node(&label_node_to_edit);
|
||||||
label_node_to_edit = NULL;
|
label_node_to_edit = NULL;
|
||||||
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); */ /* FIXME lack of specific sound */
|
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); *//* FIXME lack of specific sound */
|
||||||
|
|
||||||
if (been_saved)
|
if (been_saved)
|
||||||
{
|
{
|
||||||
|
|
@ -2836,7 +2837,7 @@ static void mainloop(void)
|
||||||
add_label_node(0, 0, 0, 0, NULL);
|
add_label_node(0, 0, 0, 0, NULL);
|
||||||
derender_node(&label_node_to_edit);
|
derender_node(&label_node_to_edit);
|
||||||
label_node_to_edit = NULL;
|
label_node_to_edit = NULL;
|
||||||
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); */ /* FIXME lack of specific sound */
|
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); *//* FIXME lack of specific sound */
|
||||||
|
|
||||||
if (been_saved)
|
if (been_saved)
|
||||||
{
|
{
|
||||||
|
|
@ -3546,11 +3547,9 @@ static void mainloop(void)
|
||||||
old_size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size;
|
old_size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size;
|
||||||
|
|
||||||
stamp_data[stamp_group][cur_stamp[stamp_group]]->size =
|
stamp_data[stamp_group][cur_stamp[stamp_group]]->size =
|
||||||
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE +
|
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE + 1
|
||||||
1
|
|
||||||
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
|
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
|
||||||
) * (event.button.x -
|
) * (event.button.x - (WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
||||||
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
|
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
|
||||||
|
|
@ -3975,11 +3974,11 @@ static void mainloop(void)
|
||||||
|
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
/*
|
/*
|
||||||
snprintf(font_tux_text, sizeof font_tux_text, "%s (%s).",
|
snprintf(font_tux_text, sizeof font_tux_text, "%s (%s).",
|
||||||
TTF_FontFaceFamilyName(getfonthandle(cur_font)),
|
TTF_FontFaceFamilyName(getfonthandle(cur_font)),
|
||||||
TTF_FontFaceStyleName(getfonthandle(cur_font)));
|
TTF_FontFaceStyleName(getfonthandle(cur_font)));
|
||||||
draw_tux_text(TUX_GREAT, font_tux_text, 1);
|
draw_tux_text(TUX_GREAT, font_tux_text, 1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (do_draw)
|
if (do_draw)
|
||||||
draw_fonts();
|
draw_fonts();
|
||||||
|
|
@ -5362,12 +5361,11 @@ static void mainloop(void)
|
||||||
w = CUR_STAMP_W;
|
w = CUR_STAMP_W;
|
||||||
h = CUR_STAMP_H;
|
h = CUR_STAMP_H;
|
||||||
|
|
||||||
stamp_data[stamp_group][cur_stamp[stamp_group]]->size =
|
stamp_data[stamp_group][cur_stamp[stamp_group]]->size = (((MAX_STAMP_SIZE - MIN_STAMP_SIZE + 1
|
||||||
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE +
|
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
|
||||||
1
|
) * (event.button.x -
|
||||||
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
|
(WINDOW_WIDTH - 96))) / 96) +
|
||||||
) * (event.button.x -
|
MIN_STAMP_SIZE;
|
||||||
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
|
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
|
||||||
|
|
@ -6399,6 +6397,7 @@ void show_usage(int exitcode)
|
||||||
{
|
{
|
||||||
FILE *f = exitcode ? stderr : stdout;
|
FILE *f = exitcode ? stderr : stdout;
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"\n"
|
"\n"
|
||||||
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
|
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
|
||||||
|
|
@ -6483,6 +6482,7 @@ void show_usage(int exitcode)
|
||||||
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
|
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
|
||||||
"\n",
|
"\n",
|
||||||
progname);
|
progname);
|
||||||
|
/* *INDENT-ON* */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7539,13 +7539,14 @@ static void loadstamp_callback(SDL_Surface * screen,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Showing the progress bar across the screen can be CPU-intensive, so
|
* Showing the progress bar across the screen can be CPU-intensive, so
|
||||||
* update infrequently.
|
* update infrequently.
|
||||||
*/
|
*/
|
||||||
if((i % 32) == 0) show_progress_bar(screen);
|
if ((i % 32) == 0)
|
||||||
|
show_progress_bar(screen);
|
||||||
|
|
||||||
if (dotext > files[i].str && !strcasecmp(dotext, ext)
|
if (dotext > files[i].str && !strcasecmp(dotext, ext)
|
||||||
&& (dotext - files[i].str + 1 + dirlen < (int) (sizeof fname))
|
&& (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname))
|
||||||
&& !strcasestr(files[i].str, mirror_ext)
|
&& !strcasestr(files[i].str, mirror_ext)
|
||||||
&& !strcasestr(files[i].str, flip_ext) && !strcasestr(files[i].str, mirrorflip_ext))
|
&& !strcasestr(files[i].str, flip_ext) && !strcasestr(files[i].str, mirrorflip_ext))
|
||||||
{
|
{
|
||||||
|
|
@ -7736,16 +7737,20 @@ static int generate_fontconfig_cache(void *vp)
|
||||||
static void signal_handler(int sig)
|
static void signal_handler(int sig)
|
||||||
{
|
{
|
||||||
// It is not legal to call printf or most other functions here!
|
// It is not legal to call printf or most other functions here!
|
||||||
if (sig == SIGUSR1 || sig == SIGUSR2) {
|
if (sig == SIGUSR1 || sig == SIGUSR2)
|
||||||
autosave_on_quit = 1;
|
{
|
||||||
no_prompt_on_quit = 1;
|
autosave_on_quit = 1;
|
||||||
if (sig == SIGUSR1) {
|
no_prompt_on_quit = 1;
|
||||||
promptless_save = SAVE_OVER_NO;
|
if (sig == SIGUSR1)
|
||||||
} else {
|
{
|
||||||
promptless_save = SAVE_OVER_ALWAYS;
|
promptless_save = SAVE_OVER_NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
promptless_save = SAVE_OVER_ALWAYS;
|
||||||
|
}
|
||||||
|
raise(SIGTERM);
|
||||||
}
|
}
|
||||||
raise(SIGTERM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -11885,14 +11890,16 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
int valhat_x, valhat_y, hatmotioner;
|
int valhat_x, valhat_y, hatmotioner;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(snd >= 0) {
|
if (snd >= 0)
|
||||||
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
|
{
|
||||||
fflush(stdout);
|
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
|
||||||
}
|
fflush(stdout);
|
||||||
else {
|
}
|
||||||
printf("Prompt without sound\n");
|
else
|
||||||
fflush(stdout);
|
{
|
||||||
}
|
printf("Prompt without sound\n");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
val_x = val_y = motioner = 0;
|
val_x = val_y = motioner = 0;
|
||||||
|
|
@ -18716,10 +18723,11 @@ static int do_new_dialog(void)
|
||||||
|
|
||||||
white_in_palette = -1;
|
white_in_palette = -1;
|
||||||
|
|
||||||
if (!new_colors_last) {
|
if (!new_colors_last)
|
||||||
first_color = 0;
|
{
|
||||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
first_color = 0;
|
||||||
}
|
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||||
|
}
|
||||||
|
|
||||||
first_starter = num_files;
|
first_starter = num_files;
|
||||||
first_template = -1; /* In case there are none... */
|
first_template = -1; /* In case there are none... */
|
||||||
|
|
@ -19024,16 +19032,18 @@ static int do_new_dialog(void)
|
||||||
|
|
||||||
/* Throw the color palette at the end (alternative option): */
|
/* Throw the color palette at the end (alternative option): */
|
||||||
|
|
||||||
if (new_colors_last) {
|
if (new_colors_last)
|
||||||
first_color = num_files;
|
{
|
||||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
first_color = num_files;
|
||||||
}
|
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("%d files and colors were found!\n", num_files);
|
printf("%d files and colors were found!\n", num_files);
|
||||||
#endif
|
#endif
|
||||||
printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter, first_template, num_files);
|
printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter,
|
||||||
|
first_template, num_files);
|
||||||
|
|
||||||
|
|
||||||
/* Let user choose a color or image: */
|
/* Let user choose a color or image: */
|
||||||
|
|
@ -19477,7 +19487,8 @@ static int do_new_dialog(void)
|
||||||
label_node_to_edit = NULL;
|
label_node_to_edit = NULL;
|
||||||
have_to_rec_label_node = FALSE;
|
have_to_rec_label_node = FALSE;
|
||||||
|
|
||||||
if (which >= first_starter && (first_template == -1 || which < first_template) && (!new_colors_last || which < first_color))
|
if (which >= first_starter && (first_template == -1 || which < first_template)
|
||||||
|
&& (!new_colors_last || which < first_color))
|
||||||
{
|
{
|
||||||
/* Load a starter: */
|
/* Load a starter: */
|
||||||
|
|
||||||
|
|
@ -19601,7 +19612,7 @@ static int do_new_dialog(void)
|
||||||
starter_personal = 0;
|
starter_personal = 0;
|
||||||
starter_modified = 0;
|
starter_modified = 0;
|
||||||
|
|
||||||
which = which - first_color;
|
which = which - first_color;
|
||||||
|
|
||||||
/* Launch color picker if they chose that: */
|
/* Launch color picker if they chose that: */
|
||||||
|
|
||||||
|
|
@ -19682,7 +19693,9 @@ static int do_new_dialog(void)
|
||||||
normally appears at the beginning (above Starts & Templates),
|
normally appears at the beginning (above Starts & Templates),
|
||||||
but may be placed at the end with the "--newcolorslast" option.
|
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) {
|
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 j;
|
||||||
int added;
|
int added;
|
||||||
Uint8 r, g, b;
|
Uint8 r, g, b;
|
||||||
|
|
@ -21217,7 +21230,7 @@ static void load_info_about_label_surface(FILE * lfi)
|
||||||
int new_pos;
|
int new_pos;
|
||||||
int x, y;
|
int x, y;
|
||||||
int tmp_fscanf_return;
|
int tmp_fscanf_return;
|
||||||
char * tmp_fgets_return;
|
char *tmp_fgets_return;
|
||||||
Uint8 a;
|
Uint8 a;
|
||||||
|
|
||||||
/* Clear label surface */
|
/* Clear label surface */
|
||||||
|
|
@ -21914,10 +21927,10 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
||||||
|
|
||||||
/* First we search for the things that usually were in the .dat file, so if a starter or a
|
/* First we search for the things that usually were in the .dat file, so if a starter or a
|
||||||
template is found and if it is not modified, we can load it clean (i.e. not rebluring a
|
template is found and if it is not modified, we can load it clean (i.e. not rebluring a
|
||||||
blured when scaled one)*/
|
blured when scaled one) */
|
||||||
for (u = 0; u < num_unknowns; u++)
|
for (u = 0; u < num_unknowns; u++)
|
||||||
{
|
{
|
||||||
printf("%s, %d\n", unknowns[u].name, (int) unknowns[u].size);
|
printf("%s, %d\n", unknowns[u].name, (int)unknowns[u].size);
|
||||||
|
|
||||||
if (chunk_is_valid("tpDT", unknowns[u]))
|
if (chunk_is_valid("tpDT", unknowns[u]))
|
||||||
{
|
{
|
||||||
|
|
@ -22435,6 +22448,7 @@ static void setup_config(char *argv[])
|
||||||
savedir = strdup(macos_preferencesPath());
|
savedir = strdup(macos_preferencesPath());
|
||||||
#else
|
#else
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
|
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
|
||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -22484,7 +22498,7 @@ static void setup_config(char *argv[])
|
||||||
/* EP added this conditional section for Mac to fix
|
/* EP added this conditional section for Mac to fix
|
||||||
folder & extension inconsistency with Tux Paint Config application) */
|
folder & extension inconsistency with Tux Paint Config application) */
|
||||||
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
|
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
|
||||||
application support folder */
|
application support folder */
|
||||||
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_globalPreferencesPath());
|
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_globalPreferencesPath());
|
||||||
parse_file_options(&tmpcfg_sys, str);
|
parse_file_options(&tmpcfg_sys, str);
|
||||||
#else
|
#else
|
||||||
|
|
@ -22596,9 +22610,9 @@ application support folder */
|
||||||
}
|
}
|
||||||
/* FIXME: make this dynamic (accelerometer or OLPC XO-1 rotation button) */
|
/* FIXME: make this dynamic (accelerometer or OLPC XO-1 rotation button) */
|
||||||
if (tmpcfg.rotate_orientation)
|
if (tmpcfg.rotate_orientation)
|
||||||
rotate_orientation = !strcmp(tmpcfg.rotate_orientation, "portrait"); /* alternative is "landscape" */
|
rotate_orientation = !strcmp(tmpcfg.rotate_orientation, "portrait"); /* alternative is "landscape" */
|
||||||
if (tmpcfg.colorfile)
|
if (tmpcfg.colorfile)
|
||||||
strcpy(colorfile, tmpcfg.colorfile); /* FIXME can overflow */
|
strcpy(colorfile, tmpcfg.colorfile); /* FIXME can overflow */
|
||||||
if (tmpcfg.print_delay)
|
if (tmpcfg.print_delay)
|
||||||
{
|
{
|
||||||
print_delay = atoi(tmpcfg.print_delay);
|
print_delay = atoi(tmpcfg.print_delay);
|
||||||
|
|
@ -22618,7 +22632,7 @@ application support folder */
|
||||||
else if (!strcmp(tmpcfg.alt_print_command_default, "never"))
|
else if (!strcmp(tmpcfg.alt_print_command_default, "never"))
|
||||||
alt_print_command_default = ALTPRINT_NEVER;
|
alt_print_command_default = ALTPRINT_NEVER;
|
||||||
else
|
else
|
||||||
alt_print_command_default = ALTPRINT_MOD; /* default ("mod") */
|
alt_print_command_default = ALTPRINT_MOD; /* default ("mod") */
|
||||||
}
|
}
|
||||||
#ifdef PAPER_H
|
#ifdef PAPER_H
|
||||||
if (tmpcfg.papersize)
|
if (tmpcfg.papersize)
|
||||||
|
|
@ -22922,16 +22936,16 @@ application support folder */
|
||||||
static void chdir_to_binary(char *argv0)
|
static void chdir_to_binary(char *argv0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
char curdir[256];
|
char curdir[256];
|
||||||
*/
|
*/
|
||||||
/* EP added this block to print out of current directory */
|
/* EP added this block to print out of current directory */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
getcwd(curdir, sizeof(curdir));
|
getcwd(curdir, sizeof(curdir));
|
||||||
#ifdef DEBUG
|
#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
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(WIN32) || defined(__APPLE__)
|
#if defined(__BEOS__) || defined(WIN32) || defined(__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,
|
||||||
|
|
@ -22953,12 +22967,12 @@ static void chdir_to_binary(char *argv0)
|
||||||
// E.g., "/Applications/TuxPaint.app/Contents/MacOS/tuxpaint"
|
// E.g., "/Applications/TuxPaint.app/Contents/MacOS/tuxpaint"
|
||||||
// But we want to point somewhere higher up, say to "Contents", so we can access
|
// But we want to point somewhere higher up, say to "Contents", so we can access
|
||||||
// the resources in Resources folder. So move up one level.
|
// the resources in Resources folder. So move up one level.
|
||||||
int levels = 1; /* we need to back up 1 level */
|
int levels = 1; /* we need to back up 1 level */
|
||||||
|
|
||||||
while ((levels-- > 0) && (slash))
|
while ((levels-- > 0) && (slash))
|
||||||
{
|
{
|
||||||
*slash = '\0'; /* this overwrites the \0 at end of string */
|
*slash = '\0'; /* this overwrites the \0 at end of string */
|
||||||
slash = strrchr(app_path, '/'); /* so we can carry on our back-pedaling... */
|
slash = strrchr(app_path, '/'); /* so we can carry on our back-pedaling... */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -22973,9 +22987,9 @@ static void chdir_to_binary(char *argv0)
|
||||||
}
|
}
|
||||||
free(app_path);
|
free(app_path);
|
||||||
/*
|
/*
|
||||||
getcwd(curdir, sizeof(curdir));
|
getcwd(curdir, sizeof(curdir));
|
||||||
printf("New current directory for runtime: %s\n", curdir);
|
printf("New current directory for runtime: %s\n", curdir);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void)argv0;
|
(void)argv0;
|
||||||
|
|
@ -24381,7 +24395,7 @@ int main(int argc, char *argv[])
|
||||||
* file may not exist on the runtime system, however, so we copy the file
|
* file may not exist on the runtime system, however, so we copy the file
|
||||||
* into our app bundle at compile time, and tell Fontconfig here to look for
|
* into our app bundle at compile time, and tell Fontconfig here to look for
|
||||||
* the file within the app bundle. */
|
* the file within the app bundle. */
|
||||||
putenv((char*) "FONTCONFIG_PATH=Resources/etc");
|
putenv((char *)"FONTCONFIG_PATH=Resources/etc");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
|
|
@ -24959,4 +24973,3 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
|
||||||
if (!ignore)
|
if (!ignore)
|
||||||
SDL_PushEvent(&ev);
|
SDL_PushEvent(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* For Win32 that lacks Unix direct support. */
|
/* For Win32 that lacks Unix direct support. */
|
||||||
/* - avoids including "windows.h" */
|
/* - avoids including "windows.h" */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2002 John Popplewell */
|
/* Copyright (c) 2002 John Popplewell */
|
||||||
/* john@johnnypops.demon.co.uk */
|
/* john@johnnypops.demon.co.uk */
|
||||||
/* */
|
/* */
|
||||||
/* Version 1.0.1 - fixed bug in opendir() */
|
/* Version 1.0.1 - fixed bug in opendir() */
|
||||||
/* Version 1.0.0 - initial version */
|
/* Version 1.0.0 - initial version */
|
||||||
/* */
|
/* */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -25,14 +25,14 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "win32_dirent.h"
|
#include "win32_dirent.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
@ -42,11 +42,12 @@
|
||||||
* @param pSpec Path of directory to open
|
* @param pSpec Path of directory to open
|
||||||
* @return Opened directory, or NULL on failure
|
* @return Opened directory, or NULL on failure
|
||||||
*/
|
*/
|
||||||
DIR * opendir(const char *pSpec)
|
DIR *opendir(const char *pSpec)
|
||||||
{
|
{
|
||||||
char pathname[MAX_PATH + 2];
|
char pathname[MAX_PATH + 2];
|
||||||
|
|
||||||
DIR * pDir = calloc(1, sizeof(DIR));
|
DIR *pDir = calloc(1, sizeof(DIR));
|
||||||
|
|
||||||
if (!pDir)
|
if (!pDir)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(pathname, pSpec);
|
strcpy(pathname, pSpec);
|
||||||
|
|
@ -65,7 +66,7 @@ DIR * opendir(const char *pSpec)
|
||||||
*
|
*
|
||||||
* @param pDir Opened directory to close.
|
* @param pDir Opened directory to close.
|
||||||
*/
|
*/
|
||||||
void closedir(DIR * pDir)
|
void closedir(DIR * pDir)
|
||||||
{
|
{
|
||||||
assert(pDir != NULL);
|
assert(pDir != NULL);
|
||||||
free(pDir);
|
free(pDir);
|
||||||
|
|
@ -77,15 +78,15 @@ void closedir(DIR * pDir)
|
||||||
* @param pDir Opened directory from which to read.
|
* @param pDir Opened directory from which to read.
|
||||||
* @return The next entry from the directory
|
* @return The next entry from the directory
|
||||||
*/
|
*/
|
||||||
struct dirent *readdir(struct DIR *pDir)
|
struct dirent *readdir(struct DIR *pDir)
|
||||||
{
|
{
|
||||||
assert(pDir != NULL);
|
assert(pDir != NULL);
|
||||||
if (pDir->hFind)
|
if (pDir->hFind)
|
||||||
|
|
||||||
{
|
{
|
||||||
strcpy(pDir->de.d_name, (const char *)pDir->wfd.cFileName);
|
strcpy(pDir->de.d_name, (const char *)pDir->wfd.cFileName);
|
||||||
if (!FindNextFile(pDir->hFind, &pDir->wfd))
|
if (!FindNextFile(pDir->hFind, &pDir->wfd))
|
||||||
|
|
||||||
{
|
{
|
||||||
FindClose(pDir->hFind);
|
FindClose(pDir->hFind);
|
||||||
pDir->hFind = NULL;
|
pDir->hFind = NULL;
|
||||||
|
|
@ -104,7 +105,7 @@ struct dirent *readdir(struct DIR *pDir)
|
||||||
* filename of dir entry 'a' is found, respectively, to be less than,
|
* filename of dir entry 'a' is found, respectively, to be less than,
|
||||||
* to match, or be greater than that of 'b'.
|
* to match, or be greater than that of 'b'.
|
||||||
*/
|
*/
|
||||||
int alphasort(const void *a, const void *b)
|
int alphasort(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return (strcmp((*(const struct dirent **)a)->d_name, (*(const struct dirent **)b)->d_name));
|
return (strcmp((*(const struct dirent **)a)->d_name, (*(const struct dirent **)b)->d_name));
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +119,7 @@ int alphasort(const void *a, const void *b)
|
||||||
* @param entry The directory entry to add to 'namelist'
|
* @param entry The directory entry to add to 'namelist'
|
||||||
* @return New count of items, or -1 on error (e.g., failed malloc())
|
* @return New count of items, or -1 on error (e.g., failed malloc())
|
||||||
*/
|
*/
|
||||||
static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
struct dirent *block;
|
struct dirent *block;
|
||||||
|
|
@ -144,9 +145,9 @@ static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
||||||
* @param compar Callback for sorting items in the list (via qsort()).
|
* @param compar Callback for sorting items in the list (via qsort()).
|
||||||
* @return Count of items, or -1 on error.
|
* @return Count of items, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar)
|
int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar)
|
||||||
{
|
{
|
||||||
DIR * pDir;
|
DIR *pDir;
|
||||||
int count;
|
int count;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue