Split XBM cursor #includes and set/free functions into "cursor.h" and
"cursor.c" source files.
This commit is contained in:
parent
aee93b1713
commit
410c156d16
5 changed files with 171 additions and 61 deletions
12
Makefile
12
Makefile
|
|
@ -950,11 +950,11 @@ install-man:
|
||||||
|
|
||||||
# Build the program!
|
# Build the program!
|
||||||
|
|
||||||
tuxpaint: obj/tuxpaint.o obj/i18n.o $(HQXX_O) $(ARCH_LIBS)
|
tuxpaint: obj/tuxpaint.o obj/i18n.o obj/cursor.o $(HQXX_O) $(ARCH_LIBS)
|
||||||
@echo
|
@echo
|
||||||
@echo "...Linking Tux Paint..."
|
@echo "...Linking Tux Paint..."
|
||||||
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
|
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
|
||||||
-o tuxpaint obj/tuxpaint.o obj/i18n.o $(HQXX_O) \
|
-o tuxpaint obj/tuxpaint.o obj/i18n.o obj/cursor.o $(HQXX_O) \
|
||||||
$(ARCH_LIBS) $(SDL_LIBS) \
|
$(ARCH_LIBS) $(SDL_LIBS) \
|
||||||
-lm $(ARCH_LINKS)
|
-lm $(ARCH_LINKS)
|
||||||
@$(RSRC_CMD)
|
@$(RSRC_CMD)
|
||||||
|
|
@ -964,7 +964,7 @@ tuxpaint: obj/tuxpaint.o obj/i18n.o $(HQXX_O) $(ARCH_LIBS)
|
||||||
# Build the object for the program!
|
# Build the object for the program!
|
||||||
|
|
||||||
obj/tuxpaint.o: src/tuxpaint.c obj \
|
obj/tuxpaint.o: src/tuxpaint.c obj \
|
||||||
src/i18n.h \
|
src/i18n.h src/cursor.h \
|
||||||
src/tools.h src/titles.h src/colors.h src/shapes.h \
|
src/tools.h src/titles.h src/colors.h src/shapes.h \
|
||||||
src/magic.h src/sounds.h src/tip_tux.h src/great.h \
|
src/magic.h src/sounds.h src/tip_tux.h src/great.h \
|
||||||
$(HQXX_H) \
|
$(HQXX_H) \
|
||||||
|
|
@ -993,6 +993,12 @@ obj/i18n.o: src/i18n.c src/i18n.h
|
||||||
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(DEFS) \
|
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(DEFS) \
|
||||||
-c src/i18n.c -o obj/i18n.o
|
-c src/i18n.c -o obj/i18n.o
|
||||||
|
|
||||||
|
obj/cursor.o: src/cursor.c src/cursor.h
|
||||||
|
@echo
|
||||||
|
@echo "...Compiling cursor support..."
|
||||||
|
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(MOUSE_CFLAGS) $(DEFS) \
|
||||||
|
-c src/cursor.c -o obj/cursor.o
|
||||||
|
|
||||||
|
|
||||||
obj/BeOS_Print.o: src/BeOS_Print.cpp obj src/BeOS_print.h
|
obj/BeOS_Print.o: src/BeOS_Print.cpp obj src/BeOS_print.h
|
||||||
@echo
|
@echo
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ $Id$
|
||||||
* Split language-related variables, enumerations, arrays and helper
|
* Split language-related variables, enumerations, arrays and helper
|
||||||
functions in to "i18n.c" and "i18n.h" source files.
|
functions in to "i18n.c" and "i18n.h" source files.
|
||||||
|
|
||||||
|
* Split XBM cursor #includes and set/free functions into "cursor.h" and
|
||||||
|
"cursor.c" source files.
|
||||||
|
|
||||||
* Made sure GPL notice was included in all other source files.
|
* Made sure GPL notice was included in all other source files.
|
||||||
|
|
||||||
* Added script to create "locale" during Build process in Xcode on
|
* Added script to create "locale" during Build process in Xcode on
|
||||||
|
|
|
||||||
79
src/cursor.c
Normal file
79
src/cursor.c
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
cursor.c
|
||||||
|
|
||||||
|
For Tux Paint
|
||||||
|
Bitmapped mouse pointer (cursor)
|
||||||
|
|
||||||
|
Copyright (c) 2002-2006 by Bill Kendrick and others
|
||||||
|
bill@newbreedsoftware.com
|
||||||
|
http://www.newbreedsoftware.com/tuxpaint/
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
(See COPYING.txt)
|
||||||
|
|
||||||
|
June 14, 2002 - February 17, 2006
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cursor.h"
|
||||||
|
|
||||||
|
#define UNUSED(arg) ((void)(arg))
|
||||||
|
|
||||||
|
SDL_Cursor * cursor_hand, * cursor_arrow, * cursor_watch,
|
||||||
|
* cursor_up, * cursor_down, * cursor_tiny, * cursor_crosshair,
|
||||||
|
* cursor_brush, * cursor_wand, * cursor_insertion, * cursor_rotate;
|
||||||
|
|
||||||
|
int no_fancy_cursors;
|
||||||
|
|
||||||
|
void do_setcursor(SDL_Cursor * c)
|
||||||
|
{
|
||||||
|
/* Shut GCC up over the fact that the XBMs are #included within cursor.h
|
||||||
|
but used in tuxpaint.c (and not cursor.c) */
|
||||||
|
|
||||||
|
UNUSED(watch_bits);
|
||||||
|
UNUSED(watch_mask_bits);
|
||||||
|
UNUSED(hand_bits);
|
||||||
|
UNUSED(hand_mask_bits);
|
||||||
|
UNUSED(wand_bits);
|
||||||
|
UNUSED(wand_mask_bits);
|
||||||
|
UNUSED(insertion_bits);
|
||||||
|
UNUSED(insertion_mask_bits);
|
||||||
|
UNUSED(brush_bits);
|
||||||
|
UNUSED(brush_mask_bits);
|
||||||
|
UNUSED(crosshair_bits);
|
||||||
|
UNUSED(crosshair_mask_bits);
|
||||||
|
UNUSED(rotate_bits);
|
||||||
|
UNUSED(rotate_mask_bits);
|
||||||
|
UNUSED(up_bits);
|
||||||
|
UNUSED(up_mask_bits);
|
||||||
|
UNUSED(down_bits);
|
||||||
|
UNUSED(down_mask_bits);
|
||||||
|
UNUSED(tiny_bits);
|
||||||
|
UNUSED(tiny_mask_bits);
|
||||||
|
UNUSED(arrow_bits);
|
||||||
|
UNUSED(arrow_mask_bits);
|
||||||
|
|
||||||
|
if (!no_fancy_cursors)
|
||||||
|
SDL_SetCursor(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_cursor(SDL_Cursor ** cursor)
|
||||||
|
{
|
||||||
|
if (*cursor)
|
||||||
|
{
|
||||||
|
SDL_FreeCursor(*cursor);
|
||||||
|
*cursor = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
78
src/cursor.h
Normal file
78
src/cursor.h
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
cursor.h
|
||||||
|
|
||||||
|
For Tux Paint
|
||||||
|
Bitmapped mouse pointer (cursor)
|
||||||
|
|
||||||
|
Copyright (c) 2002-2006 by Bill Kendrick and others
|
||||||
|
bill@newbreedsoftware.com
|
||||||
|
http://www.newbreedsoftware.com/tuxpaint/
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
(See COPYING.txt)
|
||||||
|
|
||||||
|
June 14, 2002 - February 17, 2006
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CURSOR_H
|
||||||
|
#define CURSOR_H
|
||||||
|
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
#include "watch.xbm"
|
||||||
|
#include "watch-mask.xbm"
|
||||||
|
|
||||||
|
#include "hand.xbm"
|
||||||
|
#include "hand-mask.xbm"
|
||||||
|
|
||||||
|
#include "wand.xbm"
|
||||||
|
#include "wand-mask.xbm"
|
||||||
|
|
||||||
|
#include "insertion.xbm"
|
||||||
|
#include "insertion-mask.xbm"
|
||||||
|
|
||||||
|
#include "brush.xbm"
|
||||||
|
#include "brush-mask.xbm"
|
||||||
|
|
||||||
|
#include "crosshair.xbm"
|
||||||
|
#include "crosshair-mask.xbm"
|
||||||
|
|
||||||
|
#include "rotate.xbm"
|
||||||
|
#include "rotate-mask.xbm"
|
||||||
|
|
||||||
|
#include "up.xbm"
|
||||||
|
#include "up-mask.xbm"
|
||||||
|
|
||||||
|
#include "down.xbm"
|
||||||
|
#include "down-mask.xbm"
|
||||||
|
|
||||||
|
#include "tiny.xbm"
|
||||||
|
#include "tiny-mask.xbm"
|
||||||
|
|
||||||
|
#include "arrow.xbm"
|
||||||
|
#include "arrow-mask.xbm"
|
||||||
|
|
||||||
|
extern SDL_Cursor * cursor_hand, * cursor_arrow, * cursor_watch,
|
||||||
|
* cursor_up, * cursor_down, * cursor_tiny, * cursor_crosshair,
|
||||||
|
* cursor_brush, * cursor_wand, * cursor_insertion, * cursor_rotate;
|
||||||
|
|
||||||
|
extern int no_fancy_cursors;
|
||||||
|
|
||||||
|
void do_setcursor(SDL_Cursor * c);
|
||||||
|
void free_cursor(SDL_Cursor ** cursor);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -337,6 +337,7 @@ static int font_scanner_pid;
|
||||||
static int font_socket_fd;
|
static int font_socket_fd;
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
#include "cursor.h"
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "titles.h"
|
#include "titles.h"
|
||||||
|
|
@ -348,39 +349,6 @@ static int font_socket_fd;
|
||||||
#include "great.h"
|
#include "great.h"
|
||||||
|
|
||||||
|
|
||||||
#include "watch.xbm"
|
|
||||||
#include "watch-mask.xbm"
|
|
||||||
|
|
||||||
#include "hand.xbm"
|
|
||||||
#include "hand-mask.xbm"
|
|
||||||
|
|
||||||
#include "wand.xbm"
|
|
||||||
#include "wand-mask.xbm"
|
|
||||||
|
|
||||||
#include "insertion.xbm"
|
|
||||||
#include "insertion-mask.xbm"
|
|
||||||
|
|
||||||
#include "brush.xbm"
|
|
||||||
#include "brush-mask.xbm"
|
|
||||||
|
|
||||||
#include "crosshair.xbm"
|
|
||||||
#include "crosshair-mask.xbm"
|
|
||||||
|
|
||||||
#include "rotate.xbm"
|
|
||||||
#include "rotate-mask.xbm"
|
|
||||||
|
|
||||||
#include "up.xbm"
|
|
||||||
#include "up-mask.xbm"
|
|
||||||
|
|
||||||
#include "down.xbm"
|
|
||||||
#include "down-mask.xbm"
|
|
||||||
|
|
||||||
#include "tiny.xbm"
|
|
||||||
#include "tiny-mask.xbm"
|
|
||||||
|
|
||||||
#include "arrow.xbm"
|
|
||||||
#include "arrow-mask.xbm"
|
|
||||||
|
|
||||||
#ifdef DEBUG_MALLOC
|
#ifdef DEBUG_MALLOC
|
||||||
#include "malloc.c"
|
#include "malloc.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -933,7 +901,7 @@ static void update_canvas(int x1, int y1, int x2, int y2)
|
||||||
|
|
||||||
static int use_sound, fullscreen, disable_quit, simple_shapes,
|
static int use_sound, fullscreen, disable_quit, simple_shapes,
|
||||||
disable_print, print_delay, only_uppercase, promptless_save, grab_input,
|
disable_print, print_delay, only_uppercase, promptless_save, grab_input,
|
||||||
wheely, no_fancy_cursors, keymouse, mouse_x, mouse_y,
|
wheely, keymouse, mouse_x, mouse_y,
|
||||||
mousekey_up, mousekey_down, mousekey_left, mousekey_right,
|
mousekey_up, mousekey_down, mousekey_left, mousekey_right,
|
||||||
dont_do_xor, use_print_config, dont_load_stamps, noshortcuts,
|
dont_do_xor, use_print_config, dont_load_stamps, noshortcuts,
|
||||||
no_system_fonts, no_button_distinction,
|
no_system_fonts, no_button_distinction,
|
||||||
|
|
@ -1704,11 +1672,6 @@ static Mix_Chunk * sounds[NUM_SOUNDS];
|
||||||
#define ERASER_MAX 128
|
#define ERASER_MAX 128
|
||||||
|
|
||||||
|
|
||||||
static SDL_Cursor * cursor_hand, * cursor_arrow, * cursor_watch,
|
|
||||||
* cursor_up, * cursor_down, * cursor_tiny, * cursor_crosshair,
|
|
||||||
* cursor_brush, * cursor_wand, * cursor_insertion, * cursor_rotate;
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned cur_color;
|
static unsigned cur_color;
|
||||||
static int cur_tool, cur_brush, cur_stamp, cur_shape, cur_magic;
|
static int cur_tool, cur_brush, cur_stamp, cur_shape, cur_magic;
|
||||||
static int cur_font, cur_eraser;
|
static int cur_font, cur_eraser;
|
||||||
|
|
@ -1853,7 +1816,6 @@ static int do_prompt_image_snd(const char * const text, const char * const btn_y
|
||||||
static int do_prompt(const char * const text, const char * const btn_yes, const char * const btn_no);
|
static int do_prompt(const char * const text, const char * const btn_yes, const char * const btn_no);
|
||||||
static int do_prompt_snd(const char * const text, const char * const btn_yes, const char * const btn_no, int snd);
|
static int do_prompt_snd(const char * const text, const char * const btn_yes, const char * const btn_no, int snd);
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
static void free_cursor(SDL_Cursor ** cursor);
|
|
||||||
static void free_surface(SDL_Surface **surface_array);
|
static void free_surface(SDL_Surface **surface_array);
|
||||||
static void free_surface_array(SDL_Surface *surface_array[], int count);
|
static void free_surface_array(SDL_Surface *surface_array[], int count);
|
||||||
//static void update_shape(int cx, int ox1, int ox2, int cy, int oy1, int oy2,
|
//static void update_shape(int cx, int ox1, int ox2, int cy, int oy1, int oy2,
|
||||||
|
|
@ -1890,7 +1852,6 @@ static Uint32 scrolltimer_callback(Uint32 interval, void *param);
|
||||||
static Uint32 drawtext_callback(Uint32 interval, void *param);
|
static Uint32 drawtext_callback(Uint32 interval, void *param);
|
||||||
static void control_drawtext_timer(Uint32 interval, const char * const text);
|
static void control_drawtext_timer(Uint32 interval, const char * const text);
|
||||||
static void parse_options(FILE * fi);
|
static void parse_options(FILE * fi);
|
||||||
static void do_setcursor(SDL_Cursor * c);
|
|
||||||
static const char * great_str(void);
|
static const char * great_str(void);
|
||||||
static void draw_image_title(int t, SDL_Rect dest);
|
static void draw_image_title(int t, SDL_Rect dest);
|
||||||
static void handle_keymouse(SDLKey key, Uint8 updown);
|
static void handle_keymouse(SDLKey key, Uint8 updown);
|
||||||
|
|
@ -12438,16 +12399,6 @@ static void cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void free_cursor(SDL_Cursor ** cursor)
|
|
||||||
{
|
|
||||||
if (*cursor)
|
|
||||||
{
|
|
||||||
SDL_FreeCursor(*cursor);
|
|
||||||
*cursor = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void free_surface(SDL_Surface **surface_array)
|
static void free_surface(SDL_Surface **surface_array)
|
||||||
{
|
{
|
||||||
if (*surface_array)
|
if (*surface_array)
|
||||||
|
|
@ -15485,13 +15436,6 @@ static char * debug_gettext(const char * str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void do_setcursor(SDL_Cursor * c)
|
|
||||||
{
|
|
||||||
if (!no_fancy_cursors)
|
|
||||||
SDL_SetCursor(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char * great_str(void)
|
static const char * great_str(void)
|
||||||
{
|
{
|
||||||
return(great_strs[rand() % (sizeof(great_strs) / sizeof(char *))]);
|
return(great_strs[rand() % (sizeof(great_strs) / sizeof(char *))]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue