lots of functions made static (some had to be moved)
This commit is contained in:
parent
463564076f
commit
3d15a468cd
11 changed files with 884 additions and 916 deletions
1221
src/fonts.c
1221
src/fonts.c
File diff suppressed because it is too large
Load diff
28
src/fonts.h
28
src/fonts.h
|
|
@ -68,14 +68,12 @@
|
||||||
|
|
||||||
extern SDL_Thread *font_thread;
|
extern SDL_Thread *font_thread;
|
||||||
|
|
||||||
extern volatile long font_thread_done, font_thread_aborted;
|
extern volatile long font_thread_done;
|
||||||
extern volatile long waiting_for_fonts;
|
extern volatile long waiting_for_fonts;
|
||||||
extern int font_scanner_pid;
|
|
||||||
extern int font_socket_fd;
|
extern int font_socket_fd;
|
||||||
|
|
||||||
extern int no_system_fonts;
|
extern int no_system_fonts;
|
||||||
extern int all_locale_fonts;
|
extern int all_locale_fonts;
|
||||||
extern int was_bad_font;
|
|
||||||
|
|
||||||
/* FIXME: SDL_ttf is up to 2.0.8, so we can probably fully remove this;
|
/* FIXME: SDL_ttf is up to 2.0.8, so we can probably fully remove this;
|
||||||
-bjk 2007.06.05 */
|
-bjk 2007.06.05 */
|
||||||
|
|
@ -106,13 +104,8 @@ typedef struct TuxPaint_Font_s {
|
||||||
int TuxPaint_Font_FontHeight(TuxPaint_Font * tpf);
|
int TuxPaint_Font_FontHeight(TuxPaint_Font * tpf);
|
||||||
|
|
||||||
|
|
||||||
TuxPaint_Font *try_alternate_font(int size);
|
|
||||||
TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size);
|
|
||||||
int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict locale);
|
|
||||||
|
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
void reliable_write(int fd, const void *buf, size_t count);
|
void reliable_write(int fd, const void *buf, size_t count);
|
||||||
void reliable_read(int fd, void *buf, size_t count);
|
|
||||||
void run_font_scanner(SDL_Surface * screen, const char *restrict locale);
|
void run_font_scanner(SDL_Surface * screen, const char *restrict locale);
|
||||||
void receive_some_font_info(SDL_Surface * screen);
|
void receive_some_font_info(SDL_Surface * screen);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -171,7 +164,6 @@ extern TuxPaint_Font *medium_font, *small_font, *large_font, *locale_font;
|
||||||
|
|
||||||
extern family_info **user_font_families;
|
extern family_info **user_font_families;
|
||||||
extern int num_font_families;
|
extern int num_font_families;
|
||||||
extern int num_font_families_max;
|
|
||||||
|
|
||||||
extern style_info **user_font_styles;
|
extern style_info **user_font_styles;
|
||||||
extern int num_font_styles;
|
extern int num_font_styles;
|
||||||
|
|
@ -179,19 +171,8 @@ extern int num_font_styles_max;
|
||||||
|
|
||||||
extern int button_label_y_nudge;
|
extern int button_label_y_nudge;
|
||||||
|
|
||||||
int compar_fontgroup(const void *v1, const void *v2);
|
|
||||||
int compar_fontkiller(const void *v1, const void *v2);
|
|
||||||
int compar_fontscore(const void *v1, const void *v2);
|
|
||||||
void parse_font_style(style_info * si);
|
|
||||||
void groupfonts_range(style_info ** base, int count);
|
|
||||||
void dupe_markdown_range(family_info ** base, int count);
|
|
||||||
void groupfonts(void);
|
|
||||||
TuxPaint_Font *getfonthandle(int desire);
|
TuxPaint_Font *getfonthandle(int desire);
|
||||||
void loadfonts(SDL_Surface * screen, const char *const dir);
|
|
||||||
|
|
||||||
int do_surfcmp(const SDL_Surface * const *const v1,
|
|
||||||
const SDL_Surface * const *const v2);
|
|
||||||
int surfcmp(const void *s1, const void *s2);
|
|
||||||
int charset_works(TuxPaint_Font * font, const char *s);
|
int charset_works(TuxPaint_Font * font, const char *s);
|
||||||
|
|
||||||
TuxPaint_Font * TuxPaint_Font_OpenFont(const char * pangodesc, const char * ttffilename, int size);
|
TuxPaint_Font * TuxPaint_Font_OpenFont(const char * pangodesc, const char * ttffilename, int size);
|
||||||
|
|
@ -199,9 +180,10 @@ void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf);
|
||||||
const char * TuxPaint_Font_FontFaceFamilyName(TuxPaint_Font * tpf);
|
const char * TuxPaint_Font_FontFaceFamilyName(TuxPaint_Font * tpf);
|
||||||
const char * TuxPaint_Font_FontFaceStyleName(TuxPaint_Font * tpf);
|
const char * TuxPaint_Font_FontFaceStyleName(TuxPaint_Font * tpf);
|
||||||
|
|
||||||
#ifndef NO_SDLPANGO
|
#ifdef NO_SDLPANGO
|
||||||
void sdl_color_to_pango_color(SDL_Color sdl_color,
|
TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size);
|
||||||
SDLPango_Matrix * pango_color);
|
#else
|
||||||
|
void sdl_color_to_pango_color(SDL_Color sdl_color, SDLPango_Matrix *pango_color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
254
src/im.c
254
src/im.c
|
|
@ -654,6 +654,139 @@ static const wchar_t* charmap_search(CHARMAP* cm, wchar_t* s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ***************************************************************************
|
||||||
|
* GENERIC IM FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default C IM event handler.
|
||||||
|
*
|
||||||
|
* @see im_read
|
||||||
|
*/
|
||||||
|
static int im_event_c(IM_DATA* im, SDL_keysym ks)
|
||||||
|
{
|
||||||
|
/* Handle event requests */
|
||||||
|
im->s[0] = L'\0';
|
||||||
|
if(im->request != IM_REQ_TRANSLATE) return 0;
|
||||||
|
|
||||||
|
/* Handle key stroke */
|
||||||
|
switch(ks.sym) {
|
||||||
|
case SDLK_BACKSPACE: im->s[0] = L'\b'; break;
|
||||||
|
case SDLK_TAB: im->s[0] = L'\t'; break;
|
||||||
|
case SDLK_RETURN: im->s[0] = L'\r'; break;
|
||||||
|
default: im->s[0] = ks.unicode;
|
||||||
|
}
|
||||||
|
im->s[1] = L'\0';
|
||||||
|
im->buf[0] = L'\0';
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ***************************************************************************
|
||||||
|
* PUBLIC IM FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IM-process a character. This function simply looks up the language from
|
||||||
|
* IM and calls the appropriate im_event_<lang>() language-specific IM event
|
||||||
|
* handler. im_event_c() is called by default if no language-specific
|
||||||
|
* function is specified for the specified language.
|
||||||
|
*
|
||||||
|
* @param im IM-processed data to return to the caller function.
|
||||||
|
* @param ks SDL_keysym typed on the keyboard.
|
||||||
|
*
|
||||||
|
* @return The number of characters in im->s that should not be committed.
|
||||||
|
* In other words, the returned number of characters at the end of
|
||||||
|
* im->s should be overwritten the next time im_read is called.
|
||||||
|
*
|
||||||
|
* @see im_event_c()
|
||||||
|
* @see im_event_fns
|
||||||
|
*/
|
||||||
|
int im_read(IM_DATA* im, SDL_keysym ks)
|
||||||
|
{
|
||||||
|
IM_EVENT_FN im_event_fp = NULL;
|
||||||
|
int redraw = 0;
|
||||||
|
|
||||||
|
/* Sanity check */
|
||||||
|
if(im->lang < 0 || im->lang >= NUM_LANGS) {
|
||||||
|
fprintf(stderr, "im->lang out of range (%d), using default\n", im->lang);
|
||||||
|
im->lang = LANG_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function pointer to the language-specific im_event_* function */
|
||||||
|
im_event_fp = im_event_fns[im->lang];
|
||||||
|
|
||||||
|
/* Run the language-specific IM or run the default C IM */
|
||||||
|
if(im_event_fp) redraw = (*im_event_fp)(im, ks);
|
||||||
|
else redraw = im_event_c(im, ks);
|
||||||
|
|
||||||
|
#ifdef IM_DEBUG
|
||||||
|
wprintf(L"* [%8ls] [%8ls] %2d %2d (%2d)\n", im->s, im->buf, wcslen(im->s), wcslen(im->buf), im->redraw);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return redraw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ***************************************************************************
|
||||||
|
* OTHER STATIC IM FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic event handler that calls the appropriate language handler.
|
||||||
|
* im->request should have the event ID.
|
||||||
|
*/
|
||||||
|
static void im_event(IM_DATA* im)
|
||||||
|
{
|
||||||
|
SDL_keysym ks;
|
||||||
|
|
||||||
|
ks.sym = 0;
|
||||||
|
ks.unicode = 0;
|
||||||
|
|
||||||
|
im_read(im, ks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make an event request and call the event handler.
|
||||||
|
*/
|
||||||
|
static void im_request(IM_DATA* im, int request)
|
||||||
|
{
|
||||||
|
im->request = request;
|
||||||
|
im_event(im);
|
||||||
|
im->request = IM_REQ_TRANSLATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ***************************************************************************
|
||||||
|
* PUBLIC IM FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free any allocated resources.
|
||||||
|
*/
|
||||||
|
static void im_free(IM_DATA* im)
|
||||||
|
{
|
||||||
|
im_request(im, IM_REQ_FREE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void im_softreset(IM_DATA* im)
|
||||||
|
{
|
||||||
|
im->s[0] = L'\0';
|
||||||
|
im->buf[0] = L'\0';
|
||||||
|
|
||||||
|
im_request(im, IM_REQ_RESET_SOFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void im_fullreset(IM_DATA* im)
|
||||||
|
{
|
||||||
|
im->s[0] = L'\0';
|
||||||
|
im->buf[0] = L'\0';
|
||||||
|
|
||||||
|
im_request(im, IM_REQ_RESET_FULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ***************************************************************************
|
/* ***************************************************************************
|
||||||
* LANGUAGE-SPECIFIC IM FUNCTIONS
|
* LANGUAGE-SPECIFIC IM FUNCTIONS
|
||||||
*
|
*
|
||||||
|
|
@ -690,30 +823,6 @@ static const wchar_t* charmap_search(CHARMAP* cm, wchar_t* s)
|
||||||
* functions.
|
* functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Default C IM event handler.
|
|
||||||
*
|
|
||||||
* @see im_read
|
|
||||||
*/
|
|
||||||
static int im_event_c(IM_DATA* im, SDL_keysym ks)
|
|
||||||
{
|
|
||||||
/* Handle event requests */
|
|
||||||
im->s[0] = L'\0';
|
|
||||||
if(im->request != IM_REQ_TRANSLATE) return 0;
|
|
||||||
|
|
||||||
/* Handle key stroke */
|
|
||||||
switch(ks.sym) {
|
|
||||||
case SDLK_BACKSPACE: im->s[0] = L'\b'; break;
|
|
||||||
case SDLK_TAB: im->s[0] = L'\t'; break;
|
|
||||||
case SDLK_RETURN: im->s[0] = L'\r'; break;
|
|
||||||
default: im->s[0] = ks.unicode;
|
|
||||||
}
|
|
||||||
im->s[1] = L'\0';
|
|
||||||
im->buf[0] = L'\0';
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chinese Traditional IM.
|
* Chinese Traditional IM.
|
||||||
*
|
*
|
||||||
|
|
@ -1529,36 +1638,6 @@ static int im_event_ko(IM_DATA* im, SDL_keysym ks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ***************************************************************************
|
|
||||||
* OTHER STATIC IM FUNCTIONS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic event handler that calls the appropriate language handler.
|
|
||||||
* im->request should have the event ID.
|
|
||||||
*/
|
|
||||||
static void im_event(IM_DATA* im)
|
|
||||||
{
|
|
||||||
SDL_keysym ks;
|
|
||||||
|
|
||||||
ks.sym = 0;
|
|
||||||
ks.unicode = 0;
|
|
||||||
|
|
||||||
im_read(im, ks);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make an event request and call the event handler.
|
|
||||||
*/
|
|
||||||
static void im_request(IM_DATA* im, int request)
|
|
||||||
{
|
|
||||||
im->request = request;
|
|
||||||
im_event(im);
|
|
||||||
im->request = IM_REQ_TRANSLATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ***************************************************************************
|
/* ***************************************************************************
|
||||||
* PUBLIC IM FUNCTIONS
|
* PUBLIC IM FUNCTIONS
|
||||||
*/
|
*/
|
||||||
|
|
@ -1601,73 +1680,6 @@ void im_init(IM_DATA* im, int lang)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void im_softreset(IM_DATA* im)
|
|
||||||
{
|
|
||||||
im->s[0] = L'\0';
|
|
||||||
im->buf[0] = L'\0';
|
|
||||||
|
|
||||||
im_request(im, IM_REQ_RESET_SOFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void im_fullreset(IM_DATA* im)
|
|
||||||
{
|
|
||||||
im->s[0] = L'\0';
|
|
||||||
im->buf[0] = L'\0';
|
|
||||||
|
|
||||||
im_request(im, IM_REQ_RESET_FULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free any allocated resources.
|
|
||||||
*/
|
|
||||||
void im_free(IM_DATA* im)
|
|
||||||
{
|
|
||||||
im_request(im, IM_REQ_FREE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM-process a character. This function simply looks up the language from
|
|
||||||
* IM and calls the appropriate im_event_<lang>() language-specific IM event
|
|
||||||
* handler. im_event_c() is called by default if no language-specific
|
|
||||||
* function is specified for the specified language.
|
|
||||||
*
|
|
||||||
* @param im IM-processed data to return to the caller function.
|
|
||||||
* @param ks SDL_keysym typed on the keyboard.
|
|
||||||
*
|
|
||||||
* @return The number of characters in im->s that should not be committed.
|
|
||||||
* In other words, the returned number of characters at the end of
|
|
||||||
* im->s should be overwritten the next time im_read is called.
|
|
||||||
*
|
|
||||||
* @see im_event_c()
|
|
||||||
* @see im_event_fns
|
|
||||||
*/
|
|
||||||
int im_read(IM_DATA* im, SDL_keysym ks)
|
|
||||||
{
|
|
||||||
IM_EVENT_FN im_event_fp = NULL;
|
|
||||||
int redraw = 0;
|
|
||||||
|
|
||||||
/* Sanity check */
|
|
||||||
if(im->lang < 0 || im->lang >= NUM_LANGS) {
|
|
||||||
fprintf(stderr, "im->lang out of range (%d), using default\n", im->lang);
|
|
||||||
im->lang = LANG_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function pointer to the language-specific im_event_* function */
|
|
||||||
im_event_fp = im_event_fns[im->lang];
|
|
||||||
|
|
||||||
/* Run the language-specific IM or run the default C IM */
|
|
||||||
if(im_event_fp) redraw = (*im_event_fp)(im, ks);
|
|
||||||
else redraw = im_event_c(im, ks);
|
|
||||||
|
|
||||||
#ifdef IM_DEBUG
|
|
||||||
wprintf(L"* [%8ls] [%8ls] %2d %2d (%2d)\n", im->s, im->buf, wcslen(im->s), wcslen(im->buf), im->redraw);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return redraw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* vim:ts=2:et
|
/* vim:ts=2:et
|
||||||
|
|
|
||||||
3
src/im.h
3
src/im.h
|
|
@ -50,10 +50,7 @@ typedef struct IM_DATA {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void im_init(IM_DATA* im, int lang); /* Initialize IM */
|
void im_init(IM_DATA* im, int lang); /* Initialize IM */
|
||||||
void im_fullreset(IM_DATA* im); /* Full Reset IM */
|
|
||||||
void im_softreset(IM_DATA* im); /* Soft Reset IM */
|
void im_softreset(IM_DATA* im); /* Soft Reset IM */
|
||||||
void im_free(IM_DATA* im); /* Free IM resources */
|
|
||||||
|
|
||||||
int im_read(IM_DATA* im, SDL_keysym ks);
|
int im_read(IM_DATA* im, SDL_keysym ks);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
const char PARSE_YES[] = "yes";
|
static const char PARSE_YES[] = "yes";
|
||||||
const char PARSE_NO[] = "no";
|
const char PARSE_NO[] = "no";
|
||||||
const char PARSE_CLOBBER[] = ":-("; // for painful lang/locale priority situation
|
const char PARSE_CLOBBER[] = ":-("; // for painful lang/locale priority situation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
||||||
extern const char PARSE_YES[];
|
//extern const char PARSE_YES[];
|
||||||
extern const char PARSE_NO[];
|
extern const char PARSE_NO[];
|
||||||
extern const char PARSE_CLOBBER[];
|
extern const char PARSE_CLOBBER[];
|
||||||
|
|
||||||
|
|
|
||||||
16
src/pixels.c
16
src/pixels.c
|
|
@ -32,7 +32,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
/* Draw a single pixel into the surface: */
|
/* Draw a single pixel into the surface: */
|
||||||
void putpixel8(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
static void putpixel8(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ void putpixel8(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a single pixel into the surface: */
|
/* Draw a single pixel into the surface: */
|
||||||
void putpixel16(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
static void putpixel16(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ void putpixel16(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a single pixel into the surface: */
|
/* Draw a single pixel into the surface: */
|
||||||
void putpixel24(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
static void putpixel24(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ void putpixel24(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a single pixel into the surface: */
|
/* Draw a single pixel into the surface: */
|
||||||
void putpixel32(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
static void putpixel32(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ void putpixel32(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a pixel: */
|
/* Get a pixel: */
|
||||||
Uint32 getpixel8(SDL_Surface * surface, int x, int y)
|
static Uint32 getpixel8(SDL_Surface * surface, int x, int y)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -162,7 +162,7 @@ Uint32 getpixel8(SDL_Surface * surface, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a pixel: */
|
/* Get a pixel: */
|
||||||
Uint32 getpixel16(SDL_Surface * surface, int x, int y)
|
static Uint32 getpixel16(SDL_Surface * surface, int x, int y)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
@ -188,7 +188,7 @@ Uint32 getpixel16(SDL_Surface * surface, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a pixel: */
|
/* Get a pixel: */
|
||||||
Uint32 getpixel24(SDL_Surface * surface, int x, int y)
|
static Uint32 getpixel24(SDL_Surface * surface, int x, int y)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
Uint32 pixel;
|
Uint32 pixel;
|
||||||
|
|
@ -222,7 +222,7 @@ Uint32 getpixel24(SDL_Surface * surface, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a pixel: */
|
/* Get a pixel: */
|
||||||
Uint32 getpixel32(SDL_Surface * surface, int x, int y)
|
static Uint32 getpixel32(SDL_Surface * surface, int x, int y)
|
||||||
{
|
{
|
||||||
Uint8 *p;
|
Uint8 *p;
|
||||||
|
|
||||||
|
|
|
||||||
11
src/pixels.h
11
src/pixels.h
|
|
@ -32,18 +32,7 @@
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
void putpixel8(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
|
||||||
void putpixel16(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
|
||||||
void putpixel24(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
|
||||||
void putpixel32(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
|
||||||
|
|
||||||
extern void (*putpixels[]) (SDL_Surface *, int, int, Uint32);
|
extern void (*putpixels[]) (SDL_Surface *, int, int, Uint32);
|
||||||
|
|
||||||
Uint32 getpixel8(SDL_Surface * surface, int x, int y);
|
|
||||||
Uint32 getpixel16(SDL_Surface * surface, int x, int y);
|
|
||||||
Uint32 getpixel24(SDL_Surface * surface, int x, int y);
|
|
||||||
Uint32 getpixel32(SDL_Surface * surface, int x, int y);
|
|
||||||
|
|
||||||
extern Uint32(*getpixels[]) (SDL_Surface *, int, int);
|
extern Uint32(*getpixels[]) (SDL_Surface *, int, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Mix_Chunk *sounds[NUM_SOUNDS];
|
||||||
|
|
||||||
int mute;
|
int mute;
|
||||||
int use_sound = 1;
|
int use_sound = 1;
|
||||||
int old_sound[4] = { -1, -1, -1, -1 };
|
static int old_sound[4] = { -1, -1, -1, -1 };
|
||||||
|
|
||||||
void playsound(SDL_Surface * screen, int chan, int s, int override, int x,
|
void playsound(SDL_Surface * screen, int chan, int s, int override, int x,
|
||||||
int y)
|
int y)
|
||||||
|
|
|
||||||
|
|
@ -66,15 +66,12 @@
|
||||||
|
|
||||||
#define my_min(x,y) ((x < y) ? (x) : (y))
|
#define my_min(x,y) ((x < y) ? (x) : (y))
|
||||||
|
|
||||||
int f2int(float f);
|
static int f2int(float f)
|
||||||
int f2dec(float f);
|
|
||||||
|
|
||||||
int f2int(float f)
|
|
||||||
{
|
{
|
||||||
return ((int)f);
|
return ((int)f);
|
||||||
}
|
}
|
||||||
|
|
||||||
int f2dec(float f)
|
static int f2dec(float f)
|
||||||
{
|
{
|
||||||
return (int)((f - f2int(f)) * 100);
|
return (int)((f - f2int(f)) * 100);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
254
src/tuxpaint.c
254
src/tuxpaint.c
|
|
@ -529,9 +529,9 @@ enum
|
||||||
|
|
||||||
/* Color globals (copied from colors.h, if no colors specified by user) */
|
/* Color globals (copied from colors.h, if no colors specified by user) */
|
||||||
|
|
||||||
int NUM_COLORS;
|
static int NUM_COLORS;
|
||||||
Uint8 * * color_hexes;
|
static Uint8 * * color_hexes;
|
||||||
char * * color_names;
|
static char * * color_names;
|
||||||
|
|
||||||
|
|
||||||
/* Show debugging stuff: */
|
/* Show debugging stuff: */
|
||||||
|
|
@ -619,8 +619,8 @@ static int WINDOW_WIDTH = 800;
|
||||||
static int WINDOW_HEIGHT = 600;
|
static int WINDOW_HEIGHT = 600;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
static void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
|
||||||
Uint32 magic_getpixel(SDL_Surface * surface, int x, int y);
|
static Uint32 magic_getpixel(SDL_Surface * surface, int x, int y);
|
||||||
|
|
||||||
|
|
||||||
static void setup_normal_screen_layout(void)
|
static void setup_normal_screen_layout(void)
|
||||||
|
|
@ -965,9 +965,9 @@ static int starter_personal;
|
||||||
static int template_personal;
|
static int template_personal;
|
||||||
|
|
||||||
static Uint8 canvas_color_r, canvas_color_g, canvas_color_b;
|
static Uint8 canvas_color_r, canvas_color_g, canvas_color_b;
|
||||||
Uint8 * touched;
|
static Uint8 * touched;
|
||||||
|
|
||||||
int shape_radius;
|
static int shape_radius;
|
||||||
|
|
||||||
/* Text label tool struct to hold information about text on the label layer */
|
/* Text label tool struct to hold information about text on the label layer */
|
||||||
typedef struct label_node
|
typedef struct label_node
|
||||||
|
|
@ -1010,37 +1010,37 @@ static unsigned select_text_size;
|
||||||
static int coming_from_undo_or_redo = FALSE;
|
static int coming_from_undo_or_redo = FALSE;
|
||||||
|
|
||||||
|
|
||||||
void add_label_node(int, int, Uint16, Uint16, struct label_node**, SDL_Surface* label_node_surface);
|
static void add_label_node(int, int, Uint16, Uint16, struct label_node**, SDL_Surface* label_node_surface);
|
||||||
void load_info_about_label_surface(char[1024]);
|
static void load_info_about_label_surface(char[1024]);
|
||||||
|
|
||||||
struct label_node* search_label_list(struct label_node**, Uint16, Uint16, int hover);
|
static struct label_node* search_label_list(struct label_node**, Uint16, Uint16, int hover);
|
||||||
|
|
||||||
void do_undo_label_node(void);
|
static void do_undo_label_node(void);
|
||||||
void do_redo_label_node(void);
|
static void do_redo_label_node(void);
|
||||||
void rec_undo_label(void);
|
static void rec_undo_label(void);
|
||||||
|
|
||||||
void render_all_nodes_starting_at(struct label_node**);
|
static void render_all_nodes_starting_at(struct label_node**);
|
||||||
void simply_render_node(struct label_node*);
|
static void simply_render_node(struct label_node*);
|
||||||
|
|
||||||
void derender_node(struct label_node**);
|
static void derender_node(struct label_node**);
|
||||||
|
|
||||||
void delete_label_list(struct label_node**);
|
static void delete_label_list(struct label_node**);
|
||||||
|
|
||||||
static void myblit(SDL_Surface * src_surf, SDL_Rect * src_rect,
|
static void myblit(SDL_Surface * src_surf, SDL_Rect * src_rect,
|
||||||
SDL_Surface * dest_surf, SDL_Rect * dest_rect);
|
SDL_Surface * dest_surf, SDL_Rect * dest_rect);
|
||||||
|
|
||||||
void set_label_fonts(void);
|
static void set_label_fonts(void);
|
||||||
|
|
||||||
void tmp_apply_uncommited_text(void);
|
static void tmp_apply_uncommited_text(void);
|
||||||
void undo_tmp_applied_text(void);
|
static void undo_tmp_applied_text(void);
|
||||||
|
|
||||||
|
|
||||||
/* Magic tools API and tool handles: */
|
/* Magic tools API and tool handles: */
|
||||||
|
|
||||||
#include "tp_magic_api.h"
|
#include "tp_magic_api.h"
|
||||||
|
|
||||||
void update_progress_bar(void);
|
static void update_progress_bar(void);
|
||||||
void special_notify(int flags);
|
static void special_notify(int flags);
|
||||||
|
|
||||||
typedef struct magic_funcs_s {
|
typedef struct magic_funcs_s {
|
||||||
int (*get_tool_count)(magic_api *);
|
int (*get_tool_count)(magic_api *);
|
||||||
|
|
@ -1078,10 +1078,10 @@ typedef struct magic_s {
|
||||||
/* FIXME: Drop the 512 constants :^P */
|
/* FIXME: Drop the 512 constants :^P */
|
||||||
|
|
||||||
static int num_plugin_files; /* How many shared object files we went through */
|
static int num_plugin_files; /* How many shared object files we went through */
|
||||||
void * magic_handle[512]; /* Handle to shared object (to be unloaded later) */ /* FIXME: Unload them! */
|
static void * magic_handle[512]; /* Handle to shared object (to be unloaded later) */ /* FIXME: Unload them! */
|
||||||
magic_funcs_t magic_funcs[512]; /* Pointer to shared objects' functions */
|
static magic_funcs_t magic_funcs[512]; /* Pointer to shared objects' functions */
|
||||||
|
|
||||||
magic_t magics[512];
|
static magic_t magics[512];
|
||||||
static int num_magics; /* How many magic tools were loaded (note: shared objs may report more than 1 tool) */
|
static int num_magics; /* How many magic tools were loaded (note: shared objs may report more than 1 tool) */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -1093,7 +1093,7 @@ enum {
|
||||||
NUM_MAGIC_PLACES
|
NUM_MAGIC_PLACES
|
||||||
};
|
};
|
||||||
|
|
||||||
magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
|
static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
|
||||||
|
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
|
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__)
|
||||||
|
|
@ -1160,7 +1160,7 @@ static SDL_Surface *img_magic_paint, *img_magic_fullscreen;
|
||||||
static SDL_Surface *img_bold, *img_italic;
|
static SDL_Surface *img_bold, *img_italic;
|
||||||
static SDL_Surface *img_label, *img_label_select;
|
static SDL_Surface *img_label, *img_label_select;
|
||||||
static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell;
|
static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell;
|
||||||
int color_picker_x, color_picker_y;
|
static int color_picker_x, color_picker_y;
|
||||||
|
|
||||||
static SDL_Surface *img_title_on, *img_title_off,
|
static SDL_Surface *img_title_on, *img_title_off,
|
||||||
*img_title_large_on, *img_title_large_off;
|
*img_title_large_on, *img_title_large_off;
|
||||||
|
|
@ -1247,6 +1247,8 @@ static Uint16 *wcstou16(const wchar_t * str)
|
||||||
/* This is a bodge, but it seems unlikely that a case-conversion
|
/* This is a bodge, but it seems unlikely that a case-conversion
|
||||||
will cause a change from one utf16 character into two....
|
will cause a change from one utf16 character into two....
|
||||||
(though at least UTF-8 suffers from this problem) */
|
(though at least UTF-8 suffers from this problem) */
|
||||||
|
|
||||||
|
// FIXME: mangles non-BMP characters rather than using UTF-16 surrogates!
|
||||||
res[i] = (Uint16) str[i];
|
res[i] = (Uint16) str[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1409,7 +1411,7 @@ static unsigned int stamp_group_dir_depth = 1; /* How deep (how many slashes in
|
||||||
|
|
||||||
static int stamp_group = 0;
|
static int stamp_group = 0;
|
||||||
|
|
||||||
const char *load_stamp_basedir;
|
static const char *load_stamp_basedir;
|
||||||
static int num_stamp_groups = 0;
|
static int num_stamp_groups = 0;
|
||||||
static int num_stamps[MAX_STAMP_GROUPS];
|
static int num_stamps[MAX_STAMP_GROUPS];
|
||||||
static int max_stamps[MAX_STAMP_GROUPS];
|
static int max_stamps[MAX_STAMP_GROUPS];
|
||||||
|
|
@ -1469,7 +1471,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static SDL_Surface *img_cur_brush;
|
static SDL_Surface *img_cur_brush;
|
||||||
int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h,
|
static int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h,
|
||||||
img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_spacing;
|
img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_spacing;
|
||||||
static int brush_counter, brush_frame;
|
static int brush_counter, brush_frame;
|
||||||
|
|
||||||
|
|
@ -1575,8 +1577,8 @@ static void rect_xor(int x1, int y1, int x2, int y2);
|
||||||
static void draw_blinking_cursor(void);
|
static void draw_blinking_cursor(void);
|
||||||
static void hide_blinking_cursor(void);
|
static void hide_blinking_cursor(void);
|
||||||
|
|
||||||
void reset_brush_counter_and_frame(void);
|
static void reset_brush_counter_and_frame(void);
|
||||||
void reset_brush_counter(void);
|
static void reset_brush_counter(void);
|
||||||
|
|
||||||
#ifdef LOW_QUALITY_STAMP_OUTLINE
|
#ifdef LOW_QUALITY_STAMP_OUTLINE
|
||||||
#define stamp_xor(x,y) rect_xor( \
|
#define stamp_xor(x,y) rect_xor( \
|
||||||
|
|
@ -1656,21 +1658,21 @@ static int do_png_save(FILE * fi, const char *const fname,
|
||||||
SDL_Surface * surf);
|
SDL_Surface * surf);
|
||||||
static void get_new_file_id(void);
|
static void get_new_file_id(void);
|
||||||
static int do_quit(int tool);
|
static int do_quit(int tool);
|
||||||
int do_open(void);
|
static int do_open(void);
|
||||||
int do_new_dialog(void);
|
static int do_new_dialog(void);
|
||||||
int do_color_picker(void);
|
static int do_color_picker(void);
|
||||||
int do_slideshow(void);
|
static int do_slideshow(void);
|
||||||
void play_slideshow(int * selected, int num_selected, char * dirname,
|
static void play_slideshow(int * selected, int num_selected, char * dirname,
|
||||||
char **d_names, char **d_exts, int speed);
|
char **d_names, char **d_exts, int speed);
|
||||||
void draw_selection_digits(int right, int bottom, int n);
|
static void draw_selection_digits(int right, int bottom, int n);
|
||||||
static void wait_for_sfx(void);
|
static void wait_for_sfx(void);
|
||||||
static void rgbtohsv(Uint8 r8, Uint8 g8, Uint8 b8, float *h, float *s,
|
static void rgbtohsv(Uint8 r8, Uint8 g8, Uint8 b8, float *h, float *s,
|
||||||
float *v);
|
float *v);
|
||||||
static void hsvtorgb(float h, float s, float v, Uint8 * r8, Uint8 * g8,
|
static void hsvtorgb(float h, float s, float v, Uint8 * r8, Uint8 * g8,
|
||||||
Uint8 * b8);
|
Uint8 * b8);
|
||||||
|
|
||||||
SDL_Surface *flip_surface(SDL_Surface * s);
|
static SDL_Surface *flip_surface(SDL_Surface * s);
|
||||||
SDL_Surface *mirror_surface(SDL_Surface * s);
|
static SDL_Surface *mirror_surface(SDL_Surface * s);
|
||||||
|
|
||||||
static void print_image(void);
|
static void print_image(void);
|
||||||
static void do_print(void);
|
static void do_print(void);
|
||||||
|
|
@ -1700,45 +1702,45 @@ static void load_template(char *img_id);
|
||||||
static SDL_Surface *duplicate_surface(SDL_Surface * orig);
|
static SDL_Surface *duplicate_surface(SDL_Surface * orig);
|
||||||
static void mirror_starter(void);
|
static void mirror_starter(void);
|
||||||
static void flip_starter(void);
|
static void flip_starter(void);
|
||||||
int valid_click(Uint8 button);
|
static int valid_click(Uint8 button);
|
||||||
int in_circle(int x, int y);
|
static int in_circle(int x, int y);
|
||||||
int in_circle_rad(int x, int y, int rad);
|
static int in_circle_rad(int x, int y, int rad);
|
||||||
int paintsound(int size);
|
static int paintsound(int size);
|
||||||
void load_magic_plugins(void);
|
static void load_magic_plugins(void);
|
||||||
int magic_sort(const void * a, const void * b);
|
static int magic_sort(const void * a, const void * b);
|
||||||
|
|
||||||
Mix_Chunk * magic_current_snd_ptr;
|
Mix_Chunk * magic_current_snd_ptr;
|
||||||
void magic_playsound(Mix_Chunk * snd, int left_right, int up_down);
|
static void magic_playsound(Mix_Chunk * snd, int left_right, int up_down);
|
||||||
void magic_stopsound(void);
|
static void magic_stopsound(void);
|
||||||
void magic_line_func(void * mapi,
|
static void magic_line_func(void * mapi,
|
||||||
int which, SDL_Surface * canvas, SDL_Surface * last,
|
int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||||
int x1, int y1, int x2, int y2, int step,
|
int x1, int y1, int x2, int y2, int step,
|
||||||
void (*cb)(void *, int, SDL_Surface *, SDL_Surface *,
|
void (*cb)(void *, int, SDL_Surface *, SDL_Surface *,
|
||||||
int, int));
|
int, int));
|
||||||
|
|
||||||
Uint8 magic_linear_to_sRGB(float lin);
|
static Uint8 magic_linear_to_sRGB(float lin);
|
||||||
float magic_sRGB_to_linear(Uint8 srgb);
|
static float magic_sRGB_to_linear(Uint8 srgb);
|
||||||
int magic_button_down(void);
|
static int magic_button_down(void);
|
||||||
SDL_Surface * magic_scale(SDL_Surface * surf, int w, int h, int aspect);
|
static SDL_Surface * magic_scale(SDL_Surface * surf, int w, int h, int aspect);
|
||||||
void reset_touched(void);
|
static void reset_touched(void);
|
||||||
Uint8 magic_touched(int x, int y);
|
static Uint8 magic_touched(int x, int y);
|
||||||
|
|
||||||
void magic_switchin(SDL_Surface * last);
|
static void magic_switchin(SDL_Surface * last);
|
||||||
void magic_switchout(SDL_Surface * last);
|
static void magic_switchout(SDL_Surface * last);
|
||||||
int magic_modeint(int mode);
|
static int magic_modeint(int mode);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static char *debug_gettext(const char *str);
|
static char *debug_gettext(const char *str);
|
||||||
static int charsize(Uint16 c);
|
static int charsize(Uint16 c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Surface * load_kpx(char * file);
|
static SDL_Surface * load_kpx(char * file);
|
||||||
#ifndef NOSVG
|
#ifndef NOSVG
|
||||||
SDL_Surface * load_svg(char * file);
|
static SDL_Surface * load_svg(char * file);
|
||||||
float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
static float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
||||||
unsigned int max_w, unsigned int max_h);
|
unsigned int max_w, unsigned int max_h);
|
||||||
#endif
|
#endif
|
||||||
SDL_Surface * myIMG_Load(char * file);
|
static SDL_Surface * myIMG_Load(char * file);
|
||||||
|
|
||||||
|
|
||||||
#define MAX_UTF8_CHAR_LENGTH 6
|
#define MAX_UTF8_CHAR_LENGTH 6
|
||||||
|
|
@ -3753,7 +3755,7 @@ static void mainloop(void)
|
||||||
{
|
{
|
||||||
if(cur_select == SELECT_OFF)
|
if(cur_select == SELECT_OFF)
|
||||||
{
|
{
|
||||||
label_node_to_edit=search_label_list(¤t_label_node, old_x, old_y, 0);
|
label_node_to_edit=search_label_list(¤t_label_node, old_x, old_y, 0);
|
||||||
if(label_node_to_edit)
|
if(label_node_to_edit)
|
||||||
{
|
{
|
||||||
cur_thing=label_node_to_edit->save_cur_font;
|
cur_thing=label_node_to_edit->save_cur_font;
|
||||||
|
|
@ -4409,12 +4411,13 @@ static void mainloop(void)
|
||||||
if (cur_label == LABEL_LABEL)
|
if (cur_label == LABEL_LABEL)
|
||||||
do_setcursor(cursor_insertion);
|
do_setcursor(cursor_insertion);
|
||||||
else if (cur_label == LABEL_SELECT && cur_select == SELECT_OFF)
|
else if (cur_label == LABEL_SELECT && cur_select == SELECT_OFF)
|
||||||
{
|
{
|
||||||
if (search_label_list(¤t_label_node, event.button.x - 96, event.button.y, 1))
|
do_setcursor(cursor_arrow);
|
||||||
do_setcursor(cursor_hand);
|
if (search_label_list(¤t_label_node, event.button.x - 96, event.button.y, 1))
|
||||||
else
|
do_setcursor(cursor_hand);
|
||||||
do_setcursor(cursor_arrow);
|
else
|
||||||
}
|
do_setcursor(cursor_arrow);
|
||||||
|
}
|
||||||
else if (cur_label == LABEL_SELECT && cur_select == SELECT_ON)
|
else if (cur_label == LABEL_SELECT && cur_select == SELECT_ON)
|
||||||
do_setcursor(cursor_insertion);
|
do_setcursor(cursor_insertion);
|
||||||
/* else if (cur_label == LABEL_ROTATE &&cur_select == SELECT_OFF) */
|
/* else if (cur_label == LABEL_ROTATE &&cur_select == SELECT_OFF) */
|
||||||
|
|
@ -9065,10 +9068,10 @@ static void draw_tux_text(int which_tux, const char *const str,
|
||||||
draw_tux_text_ex(which_tux, str, want_right_to_left, 0);
|
draw_tux_text_ex(which_tux, str, want_right_to_left, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int latest_tux;
|
static int latest_tux;
|
||||||
const char * latest_tux_text;
|
static const char * latest_tux_text;
|
||||||
int latest_r2l;
|
static int latest_r2l;
|
||||||
Uint8 latest_locale_text;
|
static Uint8 latest_locale_text;
|
||||||
|
|
||||||
static void redraw_tux_text(void)
|
static void redraw_tux_text(void)
|
||||||
{
|
{
|
||||||
|
|
@ -12160,7 +12163,7 @@ static int do_quit(int tool)
|
||||||
/* FIXME: This, do_slideshow() and do_new_dialog() should be combined
|
/* FIXME: This, do_slideshow() and do_new_dialog() should be combined
|
||||||
and modularized! */
|
and modularized! */
|
||||||
|
|
||||||
int do_open(void)
|
static int do_open(void)
|
||||||
{
|
{
|
||||||
SDL_Surface *img, *img1, *img2;
|
SDL_Surface *img, *img1, *img2;
|
||||||
int things_alloced;
|
int things_alloced;
|
||||||
|
|
@ -13249,7 +13252,7 @@ int do_open(void)
|
||||||
|
|
||||||
/* Slide Show Selection Screen: */
|
/* Slide Show Selection Screen: */
|
||||||
|
|
||||||
int do_slideshow(void)
|
static int do_slideshow(void)
|
||||||
{
|
{
|
||||||
SDL_Surface *img, *img1, *img2;
|
SDL_Surface *img, *img1, *img2;
|
||||||
int things_alloced;
|
int things_alloced;
|
||||||
|
|
@ -13998,7 +14001,7 @@ int do_slideshow(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void play_slideshow(int * selected, int num_selected, char * dirname,
|
static void play_slideshow(int * selected, int num_selected, char * dirname,
|
||||||
char **d_names, char **d_exts, int speed)
|
char **d_names, char **d_exts, int speed)
|
||||||
{
|
{
|
||||||
int i, which, next, done;
|
int i, which, next, done;
|
||||||
|
|
@ -14223,7 +14226,7 @@ void play_slideshow(int * selected, int num_selected, char * dirname,
|
||||||
|
|
||||||
/* Draws large, bitmap digits over thumbnails in slideshow selection screen: */
|
/* Draws large, bitmap digits over thumbnails in slideshow selection screen: */
|
||||||
|
|
||||||
void draw_selection_digits(int right, int bottom, int n)
|
static void draw_selection_digits(int right, int bottom, int n)
|
||||||
{
|
{
|
||||||
SDL_Rect src, dest;
|
SDL_Rect src, dest;
|
||||||
int i, v, len, place;
|
int i, v, len, place;
|
||||||
|
|
@ -15438,7 +15441,7 @@ static void flip_starter(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int valid_click(Uint8 button)
|
static int valid_click(Uint8 button)
|
||||||
{
|
{
|
||||||
if (button == 1 || ((button == 2 || button == 3) && no_button_distinction))
|
if (button == 1 || ((button == 2 || button == 3) && no_button_distinction))
|
||||||
return (1);
|
return (1);
|
||||||
|
|
@ -15447,7 +15450,7 @@ int valid_click(Uint8 button)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int in_circle(int x, int y)
|
static int in_circle(int x, int y)
|
||||||
{
|
{
|
||||||
if ((x * x) + (y * y) - (16 * 16) < 0)
|
if ((x * x) + (y * y) - (16 * 16) < 0)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
@ -15455,7 +15458,7 @@ int in_circle(int x, int y)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int in_circle_rad(int x, int y, int rad)
|
static int in_circle_rad(int x, int y, int rad)
|
||||||
{
|
{
|
||||||
if ((x * x) + (y * y) - (rad * rad) < 0)
|
if ((x * x) + (y * y) - (rad * rad) < 0)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
@ -15463,7 +15466,7 @@ int in_circle_rad(int x, int y, int rad)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int paintsound(int size)
|
static int paintsound(int size)
|
||||||
{
|
{
|
||||||
if (SND_PAINT1 + (size / 12) >= SND_PAINT4)
|
if (SND_PAINT1 + (size / 12) >= SND_PAINT4)
|
||||||
return(SND_PAINT4);
|
return(SND_PAINT4);
|
||||||
|
|
@ -15480,7 +15483,7 @@ int paintsound(int size)
|
||||||
Based on cairo-demo/sdl/main.c from Cairo (GPL'd, (c) 2004 Eric Windisch):
|
Based on cairo-demo/sdl/main.c from Cairo (GPL'd, (c) 2004 Eric Windisch):
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SDL_Surface * load_svg(char * file)
|
static SDL_Surface * load_svg(char * file)
|
||||||
{
|
{
|
||||||
svg_cairo_t * scr;
|
svg_cairo_t * scr;
|
||||||
int bpp, btpp, stride;
|
int bpp, btpp, stride;
|
||||||
|
|
@ -15640,7 +15643,7 @@ SDL_Surface * load_svg(char * file)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* New libcairo2, rsvg and rsvg-cairo based code */
|
/* New libcairo2, rsvg and rsvg-cairo based code */
|
||||||
SDL_Surface * load_svg(char * file)
|
static SDL_Surface * load_svg(char * file)
|
||||||
{
|
{
|
||||||
cairo_surface_t * cairo_surf;
|
cairo_surface_t * cairo_surf;
|
||||||
cairo_t * cr;
|
cairo_t * cr;
|
||||||
|
|
@ -15819,7 +15822,7 @@ SDL_Surface * load_svg(char * file)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
static float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
||||||
unsigned int max_w, unsigned int max_h)
|
unsigned int max_w, unsigned int max_h)
|
||||||
{
|
{
|
||||||
float aspect, scale, wscale, hscale;
|
float aspect, scale, wscale, hscale;
|
||||||
|
|
@ -15906,7 +15909,7 @@ float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
||||||
if we notice it's an SVG file (if available!);
|
if we notice it's an SVG file (if available!);
|
||||||
call load_kpx() if we notice it's a KPX file (JPEG with wrapper);
|
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.) */
|
otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */
|
||||||
SDL_Surface * myIMG_Load(char * file)
|
static SDL_Surface * myIMG_Load(char * file)
|
||||||
{
|
{
|
||||||
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0)
|
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0)
|
||||||
return(load_kpx(file));
|
return(load_kpx(file));
|
||||||
|
|
@ -15918,7 +15921,7 @@ SDL_Surface * myIMG_Load(char * file)
|
||||||
return(IMG_Load(file));
|
return(IMG_Load(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface * load_kpx(char * file)
|
static SDL_Surface * load_kpx(char * file)
|
||||||
{
|
{
|
||||||
SDL_RWops * data;
|
SDL_RWops * data;
|
||||||
FILE * fi;
|
FILE * fi;
|
||||||
|
|
@ -15946,7 +15949,7 @@ SDL_Surface * load_kpx(char * file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void load_magic_plugins(void)
|
static void load_magic_plugins(void)
|
||||||
{
|
{
|
||||||
int res, n, i, plc;
|
int res, n, i, plc;
|
||||||
char * place;
|
char * place;
|
||||||
|
|
@ -16347,7 +16350,7 @@ void load_magic_plugins(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int magic_sort(const void * a, const void * b)
|
static int magic_sort(const void * a, const void * b)
|
||||||
{
|
{
|
||||||
magic_t * am = (magic_t *) a;
|
magic_t * am = (magic_t *) a;
|
||||||
magic_t * bm = (magic_t *) b;
|
magic_t * bm = (magic_t *) b;
|
||||||
|
|
@ -16356,12 +16359,12 @@ int magic_sort(const void * a, const void * b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void update_progress_bar(void)
|
static void update_progress_bar(void)
|
||||||
{
|
{
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void magic_line_func(void * mapi,
|
static void magic_line_func(void * mapi,
|
||||||
int which, SDL_Surface * canvas, SDL_Surface * last,
|
int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||||
int x1, int y1, int x2, int y2, int step,
|
int x1, int y1, int x2, int y2, int step,
|
||||||
void (*cb)(void *, int, SDL_Surface *, SDL_Surface *,
|
void (*cb)(void *, int, SDL_Surface *, SDL_Surface *,
|
||||||
|
|
@ -16443,7 +16446,7 @@ void magic_line_func(void * mapi,
|
||||||
/* Handle special things that some magic tools do that
|
/* Handle special things that some magic tools do that
|
||||||
need to affect more than just the current canvas: */
|
need to affect more than just the current canvas: */
|
||||||
|
|
||||||
void special_notify(int flags)
|
static void special_notify(int flags)
|
||||||
{
|
{
|
||||||
int tmp_int;
|
int tmp_int;
|
||||||
|
|
||||||
|
|
@ -16475,7 +16478,7 @@ void special_notify(int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void magic_stopsound(void)
|
static void magic_stopsound(void)
|
||||||
{
|
{
|
||||||
#ifndef NOSOUND
|
#ifndef NOSOUND
|
||||||
if (mute || !use_sound)
|
if (mute || !use_sound)
|
||||||
|
|
@ -16485,7 +16488,7 @@ void magic_stopsound(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void magic_playsound(Mix_Chunk * snd, int left_right, int up_down)
|
static void magic_playsound(Mix_Chunk * snd, int left_right, int up_down)
|
||||||
{
|
{
|
||||||
#ifndef NOSOUND
|
#ifndef NOSOUND
|
||||||
|
|
||||||
|
|
@ -16527,29 +16530,29 @@ void magic_playsound(Mix_Chunk * snd, int left_right, int up_down)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8 magic_linear_to_sRGB(float lin)
|
static Uint8 magic_linear_to_sRGB(float lin)
|
||||||
{
|
{
|
||||||
return(linear_to_sRGB(lin));
|
return(linear_to_sRGB(lin));
|
||||||
}
|
}
|
||||||
|
|
||||||
float magic_sRGB_to_linear(Uint8 srgb)
|
static float magic_sRGB_to_linear(Uint8 srgb)
|
||||||
{
|
{
|
||||||
return(sRGB_to_linear_table[srgb]);
|
return(sRGB_to_linear_table[srgb]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int magic_button_down(void)
|
static int magic_button_down(void)
|
||||||
{
|
{
|
||||||
return(button_down);
|
return(button_down);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface * magic_scale(SDL_Surface * surf, int w, int h, int aspect)
|
static SDL_Surface * magic_scale(SDL_Surface * surf, int w, int h, int aspect)
|
||||||
{
|
{
|
||||||
return(thumbnail2(surf, w, h, aspect, 1));
|
return(thumbnail2(surf, w, h, aspect, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This, do_open() and do_slideshow() should be combined and modularized! */
|
/* FIXME: This, do_open() and do_slideshow() should be combined and modularized! */
|
||||||
|
|
||||||
int do_new_dialog(void)
|
static int do_new_dialog(void)
|
||||||
{
|
{
|
||||||
SDL_Surface *img, *img1, *img2;
|
SDL_Surface *img, *img1, *img2;
|
||||||
int things_alloced;
|
int things_alloced;
|
||||||
|
|
@ -17676,7 +17679,7 @@ int do_new_dialog(void)
|
||||||
|
|
||||||
/* FIXME: Use a bitmask! */
|
/* FIXME: Use a bitmask! */
|
||||||
|
|
||||||
void reset_touched(void)
|
static void reset_touched(void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
|
@ -17689,7 +17692,7 @@ void reset_touched(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8 magic_touched(int x, int y)
|
static Uint8 magic_touched(int x, int y)
|
||||||
{
|
{
|
||||||
Uint8 res;
|
Uint8 res;
|
||||||
|
|
||||||
|
|
@ -17702,7 +17705,7 @@ Uint8 magic_touched(int x, int y)
|
||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_color_picker(void)
|
static int do_color_picker(void)
|
||||||
{
|
{
|
||||||
#ifndef NO_PROMPT_SHADOWS
|
#ifndef NO_PROMPT_SHADOWS
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -18134,18 +18137,18 @@ int do_color_picker(void)
|
||||||
return(chose);
|
return(chose);
|
||||||
}
|
}
|
||||||
|
|
||||||
void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
static void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
{
|
{
|
||||||
putpixels[surface->format->BytesPerPixel](surface, x, y, pixel);
|
putpixels[surface->format->BytesPerPixel](surface, x, y, pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 magic_getpixel(SDL_Surface * surface, int x, int y)
|
static Uint32 magic_getpixel(SDL_Surface * surface, int x, int y)
|
||||||
{
|
{
|
||||||
return(getpixels[surface->format->BytesPerPixel](surface, x, y));
|
return(getpixels[surface->format->BytesPerPixel](surface, x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void magic_switchout(SDL_Surface * last)
|
static void magic_switchout(SDL_Surface * last)
|
||||||
{
|
{
|
||||||
if (cur_tool == TOOL_MAGIC)
|
if (cur_tool == TOOL_MAGIC)
|
||||||
{
|
{
|
||||||
|
|
@ -18157,7 +18160,7 @@ void magic_switchout(SDL_Surface * last)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void magic_switchin(SDL_Surface * last)
|
static void magic_switchin(SDL_Surface * last)
|
||||||
{
|
{
|
||||||
if (cur_tool == TOOL_MAGIC)
|
if (cur_tool == TOOL_MAGIC)
|
||||||
{
|
{
|
||||||
|
|
@ -18175,7 +18178,7 @@ void magic_switchin(SDL_Surface * last)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int magic_modeint(int mode)
|
static int magic_modeint(int mode)
|
||||||
{
|
{
|
||||||
if (mode == MODE_PAINT)
|
if (mode == MODE_PAINT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -18185,7 +18188,7 @@ int magic_modeint(int mode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_label_node(int w, int h, Uint16 x, Uint16 y, struct label_node** node_to_disable, SDL_Surface* label_node_surface)
|
static void add_label_node(int w, int h, Uint16 x, Uint16 y, struct label_node** node_to_disable, SDL_Surface* label_node_surface)
|
||||||
{
|
{
|
||||||
struct label_node* new_node = malloc(sizeof(struct label_node));
|
struct label_node* new_node = malloc(sizeof(struct label_node));
|
||||||
struct label_node* aux_node;
|
struct label_node* aux_node;
|
||||||
|
|
@ -18239,7 +18242,7 @@ void add_label_node(int w, int h, Uint16 x, Uint16 y, struct label_node** node_t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct label_node* search_label_list(struct label_node** ref_head, Uint16 x, Uint16 y, int hover)
|
static struct label_node* search_label_list(struct label_node** ref_head, Uint16 x, Uint16 y, int hover)
|
||||||
{
|
{
|
||||||
struct label_node* current_node;
|
struct label_node* current_node;
|
||||||
struct label_node* tmp_node = NULL;
|
struct label_node* tmp_node = NULL;
|
||||||
|
|
@ -18263,11 +18266,11 @@ struct label_node* search_label_list(struct label_node** ref_head, Uint16 x, Uin
|
||||||
if (current_node->is_enabled == TRUE)
|
if (current_node->is_enabled == TRUE)
|
||||||
{
|
{
|
||||||
if (tmp_node == NULL) /* Preselecting the top label at x,y position*/
|
if (tmp_node == NULL) /* Preselecting the top label at x,y position*/
|
||||||
{
|
{
|
||||||
if (hover == 1)
|
if (hover == 1)
|
||||||
return(current_node);
|
return(current_node);
|
||||||
tmp_node = current_node;
|
tmp_node = current_node;
|
||||||
}
|
}
|
||||||
SDL_GetRGBA(getpixels[current_node->label_node_surface->format->BytesPerPixel](current_node->label_node_surface, x - current_node->save_x, y - current_node->save_y),
|
SDL_GetRGBA(getpixels[current_node->label_node_surface->format->BytesPerPixel](current_node->label_node_surface, x - current_node->save_x, y - current_node->save_y),
|
||||||
current_node->label_node_surface->format, &r, &g, &b, &a);
|
current_node->label_node_surface->format, &r, &g, &b, &a);
|
||||||
if (a != SDL_ALPHA_TRANSPARENT)
|
if (a != SDL_ALPHA_TRANSPARENT)
|
||||||
|
|
@ -18313,7 +18316,7 @@ struct label_node* search_label_list(struct label_node** ref_head, Uint16 x, Uin
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rec_undo_label(void)
|
static void rec_undo_label(void)
|
||||||
{
|
{
|
||||||
printf("rec\n");
|
printf("rec\n");
|
||||||
if (first_label_node_in_redo_stack != NULL)
|
if (first_label_node_in_redo_stack != NULL)
|
||||||
|
|
@ -18356,7 +18359,7 @@ void rec_undo_label(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_undo_label_node()
|
static void do_undo_label_node()
|
||||||
{
|
{
|
||||||
if (text_undo[(cur_undo + 1) % NUM_UNDO_BUFS] == 1)
|
if (text_undo[(cur_undo + 1) % NUM_UNDO_BUFS] == 1)
|
||||||
if (current_label_node != NULL)
|
if (current_label_node != NULL)
|
||||||
|
|
@ -18378,7 +18381,7 @@ void do_undo_label_node()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_redo_label_node()
|
static void do_redo_label_node()
|
||||||
{
|
{
|
||||||
if ( (text_undo[cur_undo] == 1) &&
|
if ( (text_undo[cur_undo] == 1) &&
|
||||||
(first_label_node_in_redo_stack != NULL) )
|
(first_label_node_in_redo_stack != NULL) )
|
||||||
|
|
@ -18404,7 +18407,7 @@ void do_redo_label_node()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void simply_render_node(struct label_node* node)
|
static void simply_render_node(struct label_node* node)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_Surface *tmp_surf;
|
SDL_Surface *tmp_surf;
|
||||||
|
|
@ -18491,7 +18494,7 @@ void simply_render_node(struct label_node* node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_all_nodes_starting_at(struct label_node** node)
|
static void render_all_nodes_starting_at(struct label_node** node)
|
||||||
{
|
{
|
||||||
struct label_node* current_node;
|
struct label_node* current_node;
|
||||||
if (*node!=NULL)
|
if (*node!=NULL)
|
||||||
|
|
@ -18511,7 +18514,7 @@ void render_all_nodes_starting_at(struct label_node** node)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This should search for the top-down of the overlaping labels and only re-render from it */
|
/* FIXME: This should search for the top-down of the overlaping labels and only re-render from it */
|
||||||
void derender_node(struct label_node** ref_head)
|
static void derender_node(struct label_node** ref_head)
|
||||||
{
|
{
|
||||||
struct label_node* current_node;
|
struct label_node* current_node;
|
||||||
SDL_Rect r_tmp_derender;
|
SDL_Rect r_tmp_derender;
|
||||||
|
|
@ -18526,7 +18529,7 @@ void derender_node(struct label_node** ref_head)
|
||||||
render_all_nodes_starting_at(&start_label_node);
|
render_all_nodes_starting_at(&start_label_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_label_list(struct label_node** ref_head)
|
static void delete_label_list(struct label_node** ref_head)
|
||||||
{
|
{
|
||||||
struct label_node* current = *ref_head;
|
struct label_node* current = *ref_head;
|
||||||
struct label_node* next;
|
struct label_node* next;
|
||||||
|
|
@ -18584,7 +18587,7 @@ static void myblit(SDL_Surface * src_surf, SDL_Rect * src_rect,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_info_about_label_surface(char lfname[1024])
|
static void load_info_about_label_surface(char lfname[1024])
|
||||||
{
|
{
|
||||||
struct label_node* new_node;
|
struct label_node* new_node;
|
||||||
int list_ctr;
|
int list_ctr;
|
||||||
|
|
@ -18756,7 +18759,7 @@ void load_info_about_label_surface(char lfname[1024])
|
||||||
set_label_fonts();
|
set_label_fonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_label_fonts()
|
static void set_label_fonts()
|
||||||
{
|
{
|
||||||
struct label_node* node;
|
struct label_node* node;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -18815,7 +18818,7 @@ void set_label_fonts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void tmp_apply_uncommited_text()
|
static void tmp_apply_uncommited_text()
|
||||||
{
|
{
|
||||||
if (texttool_len > 0)
|
if (texttool_len > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -18862,7 +18865,7 @@ void tmp_apply_uncommited_text()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo_tmp_applied_text()
|
static void undo_tmp_applied_text()
|
||||||
{
|
{
|
||||||
struct label_node* aux_label_node;
|
struct label_node* aux_label_node;
|
||||||
|
|
||||||
|
|
@ -20101,8 +20104,11 @@ static void setup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NO_SDLPANGO
|
||||||
locale_font = load_locale_font(medium_font, 18);
|
locale_font = load_locale_font(medium_font, 18);
|
||||||
|
#else
|
||||||
|
locale_font = medium_font;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue