Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile30
-rw-r--r--activity/NEWS21
-rw-r--r--activity/activity-icon.svg73
-rw-r--r--activity/activity.info46
-rw-r--r--src/fonts.c19
-rw-r--r--src/i18n.c2
-rw-r--r--src/im.c113
-rw-r--r--src/shapes.h32
-rw-r--r--src/sounds.h60
-rw-r--r--src/sugar.c207
-rw-r--r--src/sugar.h49
-rw-r--r--src/tip_tux.h12
-rw-r--r--src/tools.h32
-rw-r--r--src/tuxpaint.c378
-rw-r--r--src/tuxpaint.h29
15 files changed, 233 insertions, 870 deletions
diff --git a/Makefile b/Makefile
index bff94f8..707cf67 100644
--- a/Makefile
+++ b/Makefile
@@ -132,6 +132,9 @@ DEVDOC_PREFIX:=$(DESTDIR)$(PREFIX)/share/doc/tuxpaint-dev
MAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man
DEVMAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man
+# BASH tab-completion file:
+COMPLETIONDIR:=$(DESTDIR)/etc/bash_completion.d
+
# 'System-wide' Config file:
ifeq ($(PREFIX),/usr)
CONFDIR:=$(DESTDIR)/etc/tuxpaint
@@ -143,9 +146,6 @@ ifeq ($(SYSNAME),Haiku)
CONFDIR:=$(shell finddir B_USER_SETTINGS_DIRECTORY)/TuxPaint
endif
-# BASH tab-completion file:
-COMPLETIONDIR:=$(CONFDIR)/../bash_completion.d
-
# Icons and launchers:
ICON_PREFIX:=$(DESTDIR)$(PREFIX)/share/pixmaps
X11_ICON_PREFIX:=$(DESTDIR)$(PREFIX)/X11R6/include/X11/pixmaps
@@ -194,10 +194,6 @@ NOSVGFLAG:=$(if $(SVG_LIB),,-DNOSVG$(warning No SVG for you!))
# SVG support uses libcairo1
OLDSVGFLAG:=$(if $(filter -lsvg-cairo,$(SVG_LIB)),-DOLD_SVG,)
-# Sugar DE support
-SUGAR_CFLAGS = $(if $(SUGAR), $(shell $(PKG_CONFIG) --cflags polyol-ds polyol-shell))
-SUGAR_LIBS = $(if $(SUGAR), $(shell $(PKG_CONFIG) --libs polyol-ds polyol-shell))
-SUGAR_OBJS = $(if $(SUGAR), obj/sugar.o)
ifeq ($(hack),1)
hack:
@@ -225,12 +221,14 @@ CFLAGS:=$(CPPFLAGS) $(OPTFLAGS) -W -Wall -fno-common -ffloat-store \
$(shell src/test-option.sh -Wstrict-aliasing=2)
DEFS:=-DVER_DATE=\"$(VER_DATE)\" -DVER_VERSION=\"$(VER_VERSION)\" \
- -DDEFAULT_DATA_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DATA_PREFIX))/\" \
- -DDEFAULT_LOCALEDIR=\"$(patsubst $(DESTDIR)%,%,$(LOCALE_PREFIX))/\" \
+ -DDATA_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DATA_PREFIX))/\" \
+ -DDOC_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DOC_PREFIX))/\" \
+ -DLOCALEDIR=\"$(patsubst $(DESTDIR)%,%,$(LOCALE_PREFIX))/\" \
+ -DIMDIR=\"$(patsubst $(DESTDIR)%,%,$(IM_PREFIX))/\" \
-DCONFDIR=\"$(patsubst $(DESTDIR)%,%,$(CONFDIR))/\" \
- -DDEFAULT_MAGIC_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(MAGIC_PREFIX))/\" \
+ -DMAGIC_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(MAGIC_PREFIX))/\" \
$(NOSOUNDFLAG) $(NOSVGFLAG) $(OLDSVGFLAG) $(NOPANGOFLAG) \
- $(MAEMOFLAG) $(if $(SUGAR), -DSUGAR)
+ $(MAEMOFLAG)
DEBUG_FLAGS:=
#DEBUG_FLAGS:=-g
@@ -915,13 +913,13 @@ install-man:
tuxpaint: obj/tuxpaint.o obj/i18n.o obj/im.o obj/cursor.o obj/pixels.o \
obj/rgblinear.o obj/playsound.o obj/fonts.o obj/parse.o \
- obj/progressbar.o obj/dirwalk.o obj/get_fname.o $(SUGAR_OBJS) \
+ obj/progressbar.o obj/dirwalk.o obj/get_fname.o \
$(ARCH_LIBS)
@echo
@echo "...Linking Tux Paint..."
$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(FRIBIDI_CFLAGS) $(DEFS) \
-o tuxpaint $^ \
- $(SDL_LIBS) $(SVG_LIB) $(ARCH_LINKS) $(SUGAR_LIBS)
+ $(SDL_LIBS) $(SVG_LIB) $(ARCH_LINKS)
@$(RSRC_CMD)
@$(MIMESET_CMD)
@@ -936,7 +934,6 @@ obj/tuxpaint.o: src/tuxpaint.c \
src/tools.h src/titles.h src/colors.h src/shapes.h \
src/sounds.h src/tip_tux.h src/great.h \
src/tp_magic_api.h src/parse.h \
- src/sugar.h \
src/$(MOUSEDIR)/arrow.xbm src/$(MOUSEDIR)/arrow-mask.xbm \
src/$(MOUSEDIR)/hand.xbm src/$(MOUSEDIR)/hand-mask.xbm \
src/$(MOUSEDIR)/insertion.xbm \
@@ -1064,11 +1061,6 @@ obj/resource.o: win32/resources.rc win32/resource.h
@echo "...Compiling win32 resources..."
@$(WINDRES) -i win32/resources.rc -o obj/resource.o
-obj/sugar.o: src/sugar.c src/sugar.h
- @echo
- @echo "...Compiling sugar support..."
- @$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SUGAR_CFLAGS) $(DEFS) \
- -c src/sugar.c -o obj/sugar.o
src/tp_magic_api.h: src/tp_magic_api.h.in
@echo
diff --git a/activity/NEWS b/activity/NEWS
deleted file mode 100644
index 957eb59..0000000
--- a/activity/NEWS
+++ /dev/null
@@ -1,21 +0,0 @@
-v5 2010-06-10
-~~~~~~~~~~~~~
-* Revert save button to save current image (not keep)
-* Revert open button to import image from the Journal
-* Save image preview in Journal objects
-* Set correct MIME type for created Journal objects
-* List of MIME types supported my activity
-
-v4 2010-05-12
-~~~~~~~~~~~~~
-* Update tuxpaint to 0.9.22 version
-* Initial Journal integration
-* Tuxpaint without stamp to make bundle as minimal as possible
- stamps will be added as optional dependency after implementing
- this feature in 0install
-
-v3 2009-05-31
-~~~~~~~~~~~~~
-* Pick up existed TuxPaint bundle
-* Update tuxpaint to 0.9.20 version
-* Include x86_64 binaries to bundle
diff --git a/activity/activity-icon.svg b/activity/activity-icon.svg
deleted file mode 100644
index cf7ed1d..0000000
--- a/activity/activity-icon.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_svg "http://www.w3.org/2000/svg">
- <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
- <!ENTITY stroke_color "#000000">
- <!ENTITY fill_color "#AAAAAA">
-]>
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="50"
- height="50"
- id="svg23699">
- <g
- transform="translate(2.2795368,2.5500192)"
- id="g4446">
- <path
- d="M 17.127187,43.376532 C 16.055758,43.019389 14.092211,41.983376 13.621861,40.427607 C 13.295451,39.347958 12.917163,38.225465 13.376702,34.972914 C 13.648257,33.050879 14.757464,31.474464 15.519574,30.369835 L 16.318562,29.211768 C 16.318562,29.211768 14.389784,25.680946 10.51897,23.0325 C 10.51897,23.0325 8.4758522,15.614009 8.4758522,15.614009 C 8.4758522,15.614009 12.989071,12.642629 13.847113,12.703921 C 15.256756,12.489408 13.423877,16.731327 13.423877,16.731327 C 13.574018,17.436467 14.11217,17.474975 15.399238,18.608812 C 16.349208,19.360696 18.218513,20.876497 18.218513,20.876497 C 18.218513,20.876497 18.249159,18.915264 18.770114,18.087858 C 19.371128,17.073659 19.781376,16.708861 20.670065,16.095979 C 21.313594,15.758891 21.957133,15.544378 22.69259,15.360511 C 22.815175,15.05407 23.060324,8.3123078 28.208576,6.4736389 C 33.356839,4.6349803 35.318072,9.2929243 35.318072,9.2929243 C 37.892208,14.25731 37.064802,21.611965 36.819653,22.745802 C 36.697078,23.787711 37.463182,24.369958 37.463182,24.369958 C 37.463182,24.369958 44.082369,30.560119 43.530769,32.827804 C 43.775918,35.40193 40.956642,38.037348 40.466334,38.466374 C 40.405042,38.956683 40.095064,42.124763 38.071254,43.434286 L 17.127187,43.376532 z "
-
-style="font-size:12px;fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23504" />
- <path
- d="M 20.551936,42.861105 C 20.403653,42.790501 19.844548,42.212494 19.690752,41.865324 C 19.536956,41.518155 17.345338,38.355037 18.114326,34.960475 C 18.883315,31.565914 21.228718,32.91602 21.382524,31.411616 C 21.53632,29.907201 21.88236,28.788538 23.920173,28.557095 C 25.957996,28.325642 27.57286,29.212862 28.149604,30.717266 C 28.726348,32.221681 29.72603,35.076192 29.72603,36.387736 C 29.72603,37.69927 29.649132,40.862388 29.649132,40.862388 C 29.649132,40.862388 29.513806,42.25469 28.828615,42.816075"
-
-style="font-size:12px;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23514" />
- <path
- d="M 10.976567,43.126565 C 13.613535,41.605552 11.143208,25.559436 9.565049,20.959802 C 9.1485887,19.273152 7.7419761,13.639765 7.7419761,13.639765 C 7.7419761,13.639765 8.9750209,10.823686 8.341352,7.9638238 C 7.4936144,4.1378303 5.3961269,4.4428542 5.5611779,1.4068893 C 5.5611779,1.4068893 3.8594947,2.8602418 3.5714737,3.5757333 C 3.2769165,4.3075092 1.966256,7.4771361 1.8465285,8.5538109 C 1.5213107,11.357893 4.1555913,14.324277 4.1555913,14.324277 C 4.1555913,14.324277 4.0990523,18.891917 4.2068152,20.118323 C 3.8152281,27.425484 10.6208,43.583506 10.976567,43.126565 z "
-
-style="fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3.38242745;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23530" />
- <path
- d="M 8.3154767,14.058809 C 7.2963858,14.341552 4.3847683,14.497268 3.7761688,14.736506"
-
-style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:1.98436975;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23532" />
- <path
- d="M 25.695742,9.8430418 C 26.43121,9.7204672 27.110878,10.018171 27.386673,10.477833 C 27.662468,10.937495 27.579831,10.745425 27.746737,11.613898 C 27.733052,12.069648 27.739571,12.457156 27.751091,12.566045 C 27.930604,12.734902 28.637602,9.6285296 30.813348,9.8736878 C 31.756532,9.9454934 32.692273,10.349129 32.590725,12.172018 C 32.06977,20.476643 27.631165,16.740723 27.319292,16.553602 C 26.835401,16.351697 27.084112,15.968511 26.782815,15.832282 C 26.491578,15.82142 26.483047,16.128867 26.098691,16.082359 C 25.897915,16.079597 24.990921,15.910627 24.8377,15.849335 C 24.68448,15.788053 23.458704,15.696114 23.48935,14.470339 C 23.305483,13.305855 24.085282,10.500266 25.695742,9.8430418 z "
-
-style="font-size:12px;fill:&stroke_color;;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23506" />
- <path
- d="M 23.404475,16.087432 C 24.07865,16.056796 27.02051,16.730971 28.36886,17.680942 C 29.71721,18.630922 30.330103,20.101847 30.207529,21.266331 C 30.097593,22.283219 29.681246,24.548861 28.123711,24.943658 C 25.716019,25.515546 23.689253,24.762471 20.891631,23.687236 C 17.548588,22.414161 17.888489,15.903565 23.404475,16.087432 z "
-
-style="font-size:12px;fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:2.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path23510" />
- <path
- d="M 30.798954,14.698748 C 30.961271,14.055137 30.730835,13.444154 30.284263,13.334084 C 29.83768,13.224004 29.344066,13.656521 29.181749,14.300132 C 29.019422,14.943733 29.249859,15.554716 29.696441,15.664796 C 30.143013,15.774866 30.636627,15.342349 30.798954,14.698748 L 30.798954,14.698748 z "
- style="font-size:12px;fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
- id="path23524" />
- <path
- d="M 26.399896,14.243316 C 26.562213,13.451536 26.331787,12.699888 25.885205,12.564469 C 25.438622,12.429062 24.945008,12.961145 24.782691,13.752936 C 24.620364,14.544717 24.850801,15.296364 25.297383,15.431783 C 25.743955,15.567201 26.237569,15.035107 26.399896,14.243316 L 26.399896,14.243316 z "
- style="font-size:12px;fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
- id="path23622" />
- <path
- d="M 21.061566,20.090535 C 20.852555,20.92655 21.047758,21.716661 21.497554,21.855303 C 21.947359,21.99395 22.481424,21.42862 22.690434,20.592604 C 22.899444,19.7566 22.704251,18.966481 22.254446,18.827836 C 21.804648,18.689202 21.270578,19.254519 21.061566,20.090535 L 21.061566,20.090535 z "
- style="font-size:12px;fill:&stroke_color;;fill-opacity:1;fill-rule:evenodd;stroke-width:1pt"
- id="path23624" />
- <path
- d="M 35.647787,40.034689 C 37.65407,39.950738 39.29654,39.045147 39.950741,38.340559"
-
-style="font-size:12px;fill:none;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path851" />
- <path
- d="M 33.638016,28.886874 C 33.638016,30.159245 34.122729,30.704546 34.213612,30.825724 C 34.516558,31.431614 35.9404,32.310156 35.9404,33.643115 C 35.728339,34.915485 34.940681,35.218431 34.577147,35.521376 C 34.213612,35.824321 32.196784,38.44704 34.927524,39.847794"
-
-style="font-size:12px;fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path854" />
- </g>
-</svg>
diff --git a/activity/activity.info b/activity/activity.info
deleted file mode 100644
index a6b4c52..0000000
--- a/activity/activity.info
+++ /dev/null
@@ -1,46 +0,0 @@
-[DEFAULT]
-depends = base/libpaper; base/librsvg; base/cairo; base/fribidi; base/sdl
- base/sdl-image; base/sdl-mixer; base/sdl-ttf; base/sdl-pango
- sdk/polyol
-
-[Activity]
-implement = tuxpaint
-name = Tux Paint
-summary = Drawing program designed for young children
-description = Tux Paint is a free, award-winning drawing program for children
- ages 3 to 12 (for example, preschool and K-6). It combines an
- easy-to-use interface, fun sound effects, and an encouraging
- cartoon mascot who guides children as they use the program.
-license = GPLv2
-homepage = http://www.tuxpaint.org/
-category = Education; Art
-icon = activity-icon
-
-version = 0.9.22
-stability = stable
-
-requires = %(depends)s
-exec = activity/tuxpaint
-mime_types = image/bmp;image/gif;image/jpeg;image/png;image/tiff
-
-# activity.info original options
-activity_version = 5
-bundle_id = org.tuxpaint
-
-[Application]
-binding = TUXPAINT_DATA_PREFIX share/tuxpaint
- TUXPAINT_LOCALEDIR share/locale
- TUXPAINT_MAGIC_PREFIX lib/tuxpaint/plugins
-exec = bin/tuxpaint --nolockfile
-
-[Archive]
-arch = any
-
-[Build]
-requires = %(depends)s; base/pkg-config; base/make; base/gcc-c; base/gperf
-make = make PREFIX=%(PREFIX)s SUGAR=1 OPTFLAGS="%(CFLAGS)s"
-install = make PREFIX=%(PREFIX)s SUGAR=1 DESTDIR=%(DESTDIR)s install
-
-[Source]
-exclude = CVS; *.patch; *.o; /build; obj/*.c; *.mo; /tuxpaint; *.tar.*;
- /tuxpaint-stamps**; lockfile.dat
diff --git a/src/fonts.c b/src/fonts.c
index 3fe0574..7671c08 100644
--- a/src/fonts.c
+++ b/src/fonts.c
@@ -123,8 +123,6 @@ SDL_Thread *font_thread;
#endif
-#include "tuxpaint.h"
-
#ifdef FORKED_FONTS
int no_system_fonts;
@@ -195,7 +193,7 @@ static TuxPaint_Font *try_alternate_font(int size)
if ((p = strrchr(prefix, '_')) != NULL)
{
*p = 0;
- snprintf(str, sizeof(str), "%s/fonts/locale/%s.ttf", DATA_PREFIX, prefix);
+ snprintf(str, sizeof(str), "%sfonts/locale/%s.ttf", DATA_PREFIX, prefix);
return TuxPaint_Font_OpenFont("", str, size);
}
@@ -215,14 +213,14 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
else
{
char str[128];
- snprintf(str, sizeof(str), "%s/fonts/locale/%s.ttf", DATA_PREFIX, lang_prefix);
+ snprintf(str, sizeof(str), "%sfonts/locale/%s.ttf", DATA_PREFIX, lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size);
#ifdef __APPLE__
if (!ret)
{
- snprintf(str, sizeof(str), "%s/fonts/%s.ttf", DATA_PREFIX, lang_prefix);
+ snprintf(str, sizeof(str), "%sfonts/%s.ttf", DATA_PREFIX, lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size);
}
@@ -337,13 +335,6 @@ TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffile
}
#endif
- char fname_buf[MAX_PATH];
- if (ttffilename[0] != '/')
- {
- snprintf(fname_buf, sizeof(fname_buf), "%s/%s", DATA_PREFIX, ttffilename);
- ttffilename = fname_buf;
- }
-
tpf = (TuxPaint_Font *) malloc(sizeof(TuxPaint_Font));
tpf->typ = FONT_TYPE_TTF;
tpf->ttf_font = TTF_OpenFont(ttffilename, size);
@@ -944,12 +935,10 @@ static void loadfonts(SDL_Surface * screen, const char *const dir)
/* static */ int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict const locale)
{
char *homedirdir;
- char str[MAX_PATH];
(void) vp; // junk passed by threading library
- snprintf(str, sizeof(str), "%s/fonts", DATA_PREFIX);
- loadfonts_locale_filter(screen, str, locale);
+ loadfonts_locale_filter(screen, DATA_PREFIX "fonts", locale);
if (!no_system_fonts)
{
diff --git a/src/i18n.c b/src/i18n.c
index ab2444d..fd24fbc 100644
--- a/src/i18n.c
+++ b/src/i18n.c
@@ -64,8 +64,6 @@
#include <wctype.h>
#endif
-#include "tuxpaint.h"
-
/* Globals: */
diff --git a/src/im.c b/src/im.c
index 4c869f9..cfbb746 100644
--- a/src/im.c
+++ b/src/im.c
@@ -43,7 +43,6 @@
#include <wchar.h>
#include "im.h"
-#include "tuxpaint.h"
@@ -831,6 +830,7 @@ static void im_fullreset(IM_DATA* im)
*/
static int im_event_zh_tw(IM_DATA* im, SDL_keysym ks)
{
+ static const char* lang_file = IMDIR "zh_tw.im";
enum { SEC_ENGLISH, SEC_ZH_TW, SEC_TOTAL };
static CHARMAP cm;
@@ -860,25 +860,20 @@ static int im_event_zh_tw(IM_DATA* im, SDL_keysym ks)
break;
case IM_REQ_INIT: /* Initialization */
- {
- char lang_file[MAX_PATH];
- snprintf(lang_file, sizeof(lang_file), "%s/im/zh_tw.im", DATA_PREFIX);
+ charmap_init(&cm);
- charmap_init(&cm);
-
- if(charmap_load(&cm, lang_file)) {
- fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
- im->lang = LANG_DEFAULT;
- return im_event_c(im, ks);
- }
+ if(charmap_load(&cm, lang_file)) {
+ fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
+ im->lang = LANG_DEFAULT;
+ return im_event_c(im, ks);
+ }
- im_fullreset(im);
+ im_fullreset(im);
- #ifdef DEBUG
- printf("IM: Loaded '%s'\n", lang_file);
- #endif
- break;
- }
+ #ifdef DEBUG
+ printf("IM: Loaded '%s'\n", lang_file);
+ #endif
+ break;
}
if(im->request != IM_REQ_TRANSLATE) return 0;
@@ -1020,6 +1015,7 @@ static int im_event_zh_tw(IM_DATA* im, SDL_keysym ks)
*/
static int im_event_th(IM_DATA* im, SDL_keysym ks)
{
+ static const char* lang_file = IMDIR "th.im";
enum { SEC_ENGLISH, SEC_THAI, SEC_TOTAL };
static CHARMAP cm;
@@ -1049,25 +1045,20 @@ static int im_event_th(IM_DATA* im, SDL_keysym ks)
break;
case IM_REQ_INIT: /* Initialization */
- {
- char lang_file[MAX_PATH];
- snprintf(lang_file, sizeof(lang_file), "%s/im/th.im", DATA_PREFIX);
+ charmap_init(&cm);
- charmap_init(&cm);
-
- if(charmap_load(&cm, lang_file)) {
- fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
- im->lang = LANG_DEFAULT;
- return im_event_c(im, ks);
- }
+ if(charmap_load(&cm, lang_file)) {
+ fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
+ im->lang = LANG_DEFAULT;
+ return im_event_c(im, ks);
+ }
- im_fullreset(im);
+ im_fullreset(im);
- #ifdef DEBUG
- printf("IM: Loaded '%s'\n", lang_file);
- #endif
- break;
- }
+ #ifdef DEBUG
+ printf("IM: Loaded '%s'\n", lang_file);
+ #endif
+ break;
}
if(im->request != IM_REQ_TRANSLATE) return 0;
@@ -1210,6 +1201,7 @@ static int im_event_th(IM_DATA* im, SDL_keysym ks)
*/
static int im_event_ja(IM_DATA* im, SDL_keysym ks)
{
+ static const char* lang_file = IMDIR "ja.im";
enum { SEC_ENGLISH, SEC_HIRAGANA, SEC_KATAKANA, SEC_TOTAL };
static CHARMAP cm;
@@ -1239,25 +1231,20 @@ static int im_event_ja(IM_DATA* im, SDL_keysym ks)
break;
case IM_REQ_INIT: /* Initialization */
- {
- char lang_file[MAX_PATH];
- snprintf(lang_file, sizeof(lang_file), "%s/im/ja.im", DATA_PREFIX);
+ charmap_init(&cm);
- charmap_init(&cm);
-
- if(charmap_load(&cm, lang_file)) {
- fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
- im->lang = LANG_DEFAULT;
- return im_event_c(im, ks);
- }
+ if(charmap_load(&cm, lang_file)) {
+ fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
+ im->lang = LANG_DEFAULT;
+ return im_event_c(im, ks);
+ }
- im_fullreset(im);
+ im_fullreset(im);
- #ifdef DEBUG
- printf("IM: Loaded '%s'\n", lang_file);
- #endif
- break;
- }
+ #ifdef DEBUG
+ printf("IM: Loaded '%s'\n", lang_file);
+ #endif
+ break;
}
if(im->request != IM_REQ_TRANSLATE) return 0;
@@ -1425,6 +1412,7 @@ static int im_event_ko_isvowel(CHARMAP* cm, wchar_t c)
*/
static int im_event_ko(IM_DATA* im, SDL_keysym ks)
{
+ static const char* lang_file = IMDIR "ko.im";
enum { SEC_ENGLISH, SEC_HANGUL, SEC_TOTAL };
static CHARMAP cm;
@@ -1454,25 +1442,20 @@ static int im_event_ko(IM_DATA* im, SDL_keysym ks)
break;
case IM_REQ_INIT: /* Initialization */
- {
- char lang_file[MAX_PATH];
- snprintf(lang_file, sizeof(lang_file), "%s/im/ko.im", DATA_PREFIX);
+ charmap_init(&cm);
- charmap_init(&cm);
-
- if(charmap_load(&cm, lang_file)) {
- fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
- im->lang = LANG_DEFAULT;
- return im_event_c(im, ks);
- }
+ if(charmap_load(&cm, lang_file)) {
+ fprintf(stderr, "Unable to load %s, defaulting to im_event_c\n", lang_file);
+ im->lang = LANG_DEFAULT;
+ return im_event_c(im, ks);
+ }
- im_fullreset(im);
+ im_fullreset(im);
- #ifdef DEBUG
- printf("IM: Loaded '%s'\n", lang_file);
- #endif
- break;
- }
+ #ifdef DEBUG
+ printf("IM: Loaded '%s'\n", lang_file);
+ #endif
+ break;
}
if(im->request != IM_REQ_TRANSLATE) return 0;
diff --git a/src/shapes.h b/src/shapes.h
index 5b08a83..456a0bc 100644
--- a/src/shapes.h
+++ b/src/shapes.h
@@ -247,20 +247,20 @@ const char *const shape_tips[NUM_SHAPES] = {
/* Shape icon filenames: */
const char *const shape_img_fnames[NUM_SHAPES] = {
- "images/shapes/square.png",
- "images/shapes/square_f.png",
- "images/shapes/rectangle.png",
- "images/shapes/rectangle_f.png",
- "images/shapes/circle.png",
- "images/shapes/circle_f.png",
- "images/shapes/oval.png",
- "images/shapes/oval_f.png",
- "images/shapes/triangle.png",
- "images/shapes/triangle_f.png",
- "images/shapes/pentagon.png",
- "images/shapes/pentagon_f.png",
- "images/shapes/diamond.png",
- "images/shapes/diamond_f.png",
- "images/shapes/octagon.png",
- "images/shapes/octagon_f.png"
+ DATA_PREFIX "images/shapes/square.png",
+ DATA_PREFIX "images/shapes/square_f.png",
+ DATA_PREFIX "images/shapes/rectangle.png",
+ DATA_PREFIX "images/shapes/rectangle_f.png",
+ DATA_PREFIX "images/shapes/circle.png",
+ DATA_PREFIX "images/shapes/circle_f.png",
+ DATA_PREFIX "images/shapes/oval.png",
+ DATA_PREFIX "images/shapes/oval_f.png",
+ DATA_PREFIX "images/shapes/triangle.png",
+ DATA_PREFIX "images/shapes/triangle_f.png",
+ DATA_PREFIX "images/shapes/pentagon.png",
+ DATA_PREFIX "images/shapes/pentagon_f.png",
+ DATA_PREFIX "images/shapes/diamond.png",
+ DATA_PREFIX "images/shapes/diamond_f.png",
+ DATA_PREFIX "images/shapes/octagon.png",
+ DATA_PREFIX "images/shapes/octagon_f.png"
};
diff --git a/src/sounds.h b/src/sounds.h
index 828f1fa..b794729 100644
--- a/src/sounds.h
+++ b/src/sounds.h
@@ -78,36 +78,36 @@ enum
-bjk 2007.07.17 */
static const char *sound_fnames[NUM_SOUNDS] = {
- "sounds/harp.wav",
- "sounds/click.wav",
- "sounds/bleep.wav",
- "sounds/bubble.wav",
- "sounds/stamp.wav",
- "sounds/line_start.wav",
- "sounds/line_end.wav",
- "sounds/scroll.wav",
- "sounds/paint1.wav",
- "sounds/paint2.wav",
- "sounds/paint3.wav",
- "sounds/paint4.wav",
- "sounds/eraser1.wav",
- "sounds/eraser2.wav",
- "sounds/save.wav",
- "sounds/prompt.wav",
- "sounds/flip.wav",
- "sounds/mirror.wav",
- "sounds/keyclick.wav",
- "sounds/typewriterbell.wav",
- "sounds/return.wav",
- "sounds/shrink.wav",
- "sounds/grow.wav",
- "sounds/italic_on.wav",
- "sounds/italic_off.wav",
- "sounds/areyousure.wav",
- "sounds/youcannot.wav",
- "sounds/tuxok.wav",
- "sounds/thick.wav",
- "sounds/thin.wav"
+ DATA_PREFIX "sounds/harp.wav",
+ DATA_PREFIX "sounds/click.wav",
+ DATA_PREFIX "sounds/bleep.wav",
+ DATA_PREFIX "sounds/bubble.wav",
+ DATA_PREFIX "sounds/stamp.wav",
+ DATA_PREFIX "sounds/line_start.wav",
+ DATA_PREFIX "sounds/line_end.wav",
+ DATA_PREFIX "sounds/scroll.wav",
+ DATA_PREFIX "sounds/paint1.wav",
+ DATA_PREFIX "sounds/paint2.wav",
+ DATA_PREFIX "sounds/paint3.wav",
+ DATA_PREFIX "sounds/paint4.wav",
+ DATA_PREFIX "sounds/eraser1.wav",
+ DATA_PREFIX "sounds/eraser2.wav",
+ DATA_PREFIX "sounds/save.wav",
+ DATA_PREFIX "sounds/prompt.wav",
+ DATA_PREFIX "sounds/flip.wav",
+ DATA_PREFIX "sounds/mirror.wav",
+ DATA_PREFIX "sounds/keyclick.wav",
+ DATA_PREFIX "sounds/typewriterbell.wav",
+ DATA_PREFIX "sounds/return.wav",
+ DATA_PREFIX "sounds/shrink.wav",
+ DATA_PREFIX "sounds/grow.wav",
+ DATA_PREFIX "sounds/italic_on.wav",
+ DATA_PREFIX "sounds/italic_off.wav",
+ DATA_PREFIX "sounds/areyousure.wav",
+ DATA_PREFIX "sounds/youcannot.wav",
+ DATA_PREFIX "sounds/tuxok.wav",
+ DATA_PREFIX "sounds/thick.wav",
+ DATA_PREFIX "sounds/thin.wav"
};
#endif
diff --git a/src/sugar.c b/src/sugar.c
deleted file mode 100644
index a3cd78b..0000000
--- a/src/sugar.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- sugar.c
-
- Sugar DE integration
-
- Copyright (C) 2010, Aleksey Lim
-
- 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)
-*/
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <SDL/SDL_syswm.h>
-
-#include <polyol/env.h>
-#include <polyol/ds.h>
-#include <polyol/shell.h>
-
-#include "sugar.h"
-
-static void chooser_response_cb(GObject*, const gchar*);
-
-static SugarShell *shell;
-static SugarJournal *journal;
-static SugarJobject *jobject;
-static gboolean new_jobject;
-static GMainLoop *chooser_loop;
-static char *chosen_object_id;
-
-void sugar_setup(int * argc, char *** argv)
-{
- g_type_init();
-
- if (!sugar_init(argv, argc))
- return;
-
- g_debug("Use sugar mode");
-
- sugar_environ_set_sync_dbus(TRUE);
-
- if (sugar_environ_get_object_id() != NULL)
- jobject = sugar_jobject_find(sugar_environ_get_object_id());
-
- if (jobject != NULL)
- g_debug("Journal entry %s was found", sugar_environ_get_object_id());
- else
- {
- jobject = sugar_jobject_create();
- g_debug("Create new Journal entry");
- }
-
- shell = sugar_shell_new();
-
- journal = sugar_journal_new();
- g_signal_connect(journal, "chooser-response",
- G_CALLBACK(chooser_response_cb), NULL);
-
- chooser_loop = g_main_loop_new (NULL, FALSE);
-}
-
-int sugar_detected()
-{
- return sugar_environ_get_initialized();
-}
-
-void sugar_cleanup()
-{
- if (!sugar_detected())
- return;
-
- g_debug("Cleanup sugar mode");
-
- if (new_jobject)
- sugar_journal_show_object(journal, sugar_jobject_get_uid(jobject));
-
- g_object_unref(G_OBJECT(jobject));
- jobject = NULL;
-
- g_object_unref(G_OBJECT(shell));
- shell = NULL;
-
- g_object_unref(G_OBJECT(journal));
- journal = NULL;
-
- g_main_loop_unref(chooser_loop);
- chooser_loop = NULL;
-}
-
-void sugar_setup_x11(int * window_width, int * window_height)
-{
- if (!sugar_detected())
- return;
-
- SDL_SysWMinfo wminfo;
- SDL_VERSION(&wminfo.version);
-
- if (SDL_GetWMInfo(&wminfo))
- {
- Display * display = wminfo.info.x11.display;
- Window window = wminfo.info.x11.wmwindow;
-
- wminfo.info.x11.lock_func();
-
- sugar_environ_set_window(display, window);
- *window_width = DisplayWidth(display, DefaultScreen(display));
- *window_height = DisplayHeight(display, DefaultScreen(display));
-
- wminfo.info.x11.unlock_func();
- }
- else
- {
- g_warning ("Cannot get WMInfo to setup X11 properties");
- }
-}
-
-const char *sugar_get_savedir(void)
-{
- return sugar_environ_get_activity_root();
-}
-
-char *sugar_get_image_file()
-{
- if (!sugar_detected())
- return NULL;
-
- const char * file_path = sugar_jobject_get_file_path(jobject);
-
- if (file_path != NULL)
- g_debug("Load image from journal entry %s", sugar_jobject_get_uid(jobject));
-
- return g_strdup(file_path);
-}
-
-void sugar_save_image(char *path)
-{
- if (!sugar_detected())
- return;
-
- if (sugar_jobject_get_uid(jobject) == NULL)
- new_jobject |= TRUE;
-
- sugar_jobject_set_mime_type(jobject, "image/png");
- sugar_jobject_write_file(jobject, path, TRUE);
-
- g_debug("Saved %s image to journal entry %s", path,
- sugar_jobject_get_uid(jobject));
-}
-
-void sugar_save_thumb(char *path)
-{
- struct stat fstat;
- g_return_if_fail(stat(path, &fstat) == 0);
-
- FILE *fp = fopen(path, "rb");
- g_return_if_fail(fp);
-
- GArray *preview = g_array_new(FALSE, FALSE, 1);
- g_array_set_size(preview, fstat.st_size);
-
- if (fread(preview->data, 1, fstat.st_size, fp) == (size_t) fstat.st_size)
- {
- sugar_jobject_set_preview(jobject, preview);
- sugar_jobject_write(jobject);
- }
-
- fclose(fp);
- unlink(path);
-}
-
-const char *sugar_open()
-{
- sugar_journal_choose_object(journal, SUGAR_MIME_IMAGE);
- g_main_loop_run(chooser_loop);
-
- if (chosen_object_id == NULL)
- return NULL;
-
- SugarJobject *image_jobject = sugar_jobject_find(chosen_object_id);
- g_free(chosen_object_id);
- chosen_object_id = NULL;
- g_return_val_if_fail(image_jobject, NULL);
-
- const char *image_path = sugar_jobject_get_file_path(image_jobject);
- g_return_val_if_fail(image_path, NULL);
-
- return g_strdup(image_path);
-}
-
-static void chooser_response_cb(GObject *sender, const gchar *object_id)
-{
- g_debug("SugarShell.chooser_response_cb=%s", object_id);
- chosen_object_id = g_strdup(object_id);
- g_main_loop_quit(chooser_loop);
-}
diff --git a/src/sugar.h b/src/sugar.h
deleted file mode 100644
index bacd387..0000000
--- a/src/sugar.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- sugar.h
-
- Sugar DE integration
-
- Copyright (C) 2010, Aleksey Lim
-
- 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)
-*/
-
-#ifndef SUGAR_H
-#define SUGAR_H
-
-#ifdef SUGAR
- void sugar_setup(int * argc, char *** argv);
- void sugar_cleanup(void);
- void sugar_setup_x11(int * window_width, int * window_height);
- int sugar_detected(void);
- const char *sugar_get_savedir(void);
- char *sugar_get_image_file(void);
- void sugar_save_image(char *path);
- void sugar_save_thumb(char *path);
- const char *sugar_open(void);
-#else
- void sugar_setup(int * argc, char *** argv) { }
- void sugar_cleanup(void) { }
- void sugar_setup_x11(int * window_width, int * window_height) { }
- int sugar_detected(void) { return 0; }
- const char *sugar_get_savedir(void) { return NULL; }
- char *sugar_get_image_file(void) { return NULL; }
- void sugar_save_image(char *path) { }
- void sugar_save_thumb(char *path) { }
- const char *sugar_open(void) { return NULL; }
-#endif
-
-#endif
diff --git a/src/tip_tux.h b/src/tip_tux.h
index 346eba2..6f68b4c 100644
--- a/src/tip_tux.h
+++ b/src/tip_tux.h
@@ -48,12 +48,12 @@ enum
/* Tux filenames: */
const char *const tux_img_fnames[NUM_TIP_TUX] = {
- "images/tux/default.png",
- "images/tux/kiss.png",
- "images/tux/bored.png",
- "images/tux/great.png",
- "images/tux/oops.png",
- "images/tux/wait.png"
+ DATA_PREFIX "images/tux/default.png",
+ DATA_PREFIX "images/tux/kiss.png",
+ DATA_PREFIX "images/tux/bored.png",
+ DATA_PREFIX "images/tux/great.png",
+ DATA_PREFIX "images/tux/oops.png",
+ DATA_PREFIX "images/tux/wait.png"
};
#endif /* TIP_TUX_H */
diff --git a/src/tools.h b/src/tools.h
index d5e7bc8..9a29acb 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -176,22 +176,22 @@ const char *const tool_tips[NUM_TOOLS] = {
/* Tool icon filenames: */
const char *const tool_img_fnames[NUM_TOOLS] = {
- "images/tools/brush.png",
- "images/tools/stamp.png",
- "images/tools/lines.png",
- "images/tools/shapes.png",
- "images/tools/text.png",
- "images/tools/label.png",
- "images/ui/dead40x40.png",
- "images/tools/magic.png",
- "images/tools/undo.png",
- "images/tools/redo.png",
- "images/tools/eraser.png",
- "images/tools/new.png",
- "images/tools/open.png",
- "images/tools/save.png",
- "images/tools/print.png",
- "images/tools/quit.png"
+ DATA_PREFIX "images/tools/brush.png",
+ DATA_PREFIX "images/tools/stamp.png",
+ DATA_PREFIX "images/tools/lines.png",
+ DATA_PREFIX "images/tools/shapes.png",
+ DATA_PREFIX "images/tools/text.png",
+ DATA_PREFIX "images/tools/label.png",
+ DATA_PREFIX "images/ui/dead40x40.png",
+ DATA_PREFIX "images/tools/magic.png",
+ DATA_PREFIX "images/tools/undo.png",
+ DATA_PREFIX "images/tools/redo.png",
+ DATA_PREFIX "images/tools/eraser.png",
+ DATA_PREFIX "images/tools/new.png",
+ DATA_PREFIX "images/tools/open.png",
+ DATA_PREFIX "images/tools/save.png",
+ DATA_PREFIX "images/tools/print.png",
+ DATA_PREFIX "images/tools/quit.png"
};
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index 71fcfef..b55ebde 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -57,6 +57,7 @@
/*#define PRINTMETHOD_PNG_PNM_PS*/ /* Output PNG, assuming it gets printed */
+#define MAX_PATH 256
/* Compile-time options: */
@@ -463,9 +464,6 @@ extern WrapperData macosx;
#include "compiler.h"
-#include "sugar.h"
-#include "tuxpaint.h"
-
#if VIDEO_BPP==32
#ifdef __GNUC__
@@ -586,9 +584,6 @@ static int NUM_COLORS;
static Uint8 * * color_hexes;
static char * * color_names;
-const char *DATA_PREFIX = DEFAULT_DATA_PREFIX;
-const char *MAGIC_PREFIX = DEFAULT_MAGIC_PREFIX;
-const char *LOCALEDIR = DEFAULT_LOCALEDIR;
/* Show debugging stuff: */
@@ -1628,7 +1623,7 @@ static SDL_Cursor *get_cursor(unsigned char *bits, unsigned char *mask_bits,
unsigned int x, unsigned int y);
static void seticon(void);
static SDL_Surface *loadimage(const char *const fname);
-static SDL_Surface *do_loadimage(const char *fname, int abort_on_error);
+static SDL_Surface *do_loadimage(const char *const fname, int abort_on_error);
static void draw_toolbar(void);
static void draw_magic(void);
static void draw_brushes(void);
@@ -1689,8 +1684,6 @@ static void playstampdesc(int chan);
#endif
static void do_wait(int counter);
static void load_current(void);
-static char * get_current_image_file(void);
-static void load_current_image(char * fname);
static void save_current(void);
static int do_prompt_image_flash(const char *const text,
const char *const btn_yes,
@@ -1735,7 +1728,6 @@ Bytef * get_chunk_data (FILE * fp, char *fname, png_structp png_ptr,
static void get_new_file_id(void);
static int do_quit(int tool);
static int do_open(void);
-static int do_open_image(void);
static int do_new_dialog(void);
static int do_color_picker(void);
static int do_slideshow(void);
@@ -5686,7 +5678,9 @@ static void show_version(int details)
printf(" Data directory (DATA_PREFIX) = %s\n", DATA_PREFIX);
printf(" Plugin directory (MAGIC_PREFIX) = %s\n", MAGIC_PREFIX);
+ printf(" Doc directory (DOC_PREFIX) = %s\n", DOC_PREFIX);
printf(" Locale directory (LOCALEDIR) = %s\n", LOCALEDIR);
+ printf(" Input Method directory (IMDIR) = %s\n", IMDIR);
printf(" System config directory (CONFDIR) = %s\n", CONFDIR);
@@ -5911,20 +5905,9 @@ static void loadbrush_callback(SDL_Surface * screen,
static void load_brush_dir(SDL_Surface * screen, const char *restrict const dir)
{
char buf[TP_FTW_PATHSIZE];
- unsigned dirlen;
-
- if (dir[0] != '/')
- {
- snprintf(buf, sizeof(buf), "%s/%s", DATA_PREFIX, dir);
- dirlen = strlen(buf);
- }
- else
- {
- dirlen = strlen(dir);
- memcpy(buf, dir, dirlen);
- buf[dirlen] = '\0';
- }
+ unsigned dirlen = strlen(dir);
+ memcpy(buf, dir, dirlen);
tp_ftw(screen, buf, dirlen, 0, loadbrush_callback, NULL);
}
@@ -6793,23 +6776,9 @@ static void loadstamp_callback(SDL_Surface * screen,
static void load_stamp_dir(SDL_Surface * screen, const char *const dir)
{
char buf[TP_FTW_PATHSIZE];
- char dir_buf[TP_FTW_PATHSIZE];
- unsigned dirlen;
-
- if (dir[0] != '/')
- {
- snprintf(buf, sizeof(buf), "%s/%s", DATA_PREFIX, dir);
- dirlen = strlen(buf);
- }
- else
- {
- dirlen = strlen(dir);
- memcpy(buf, dir, dirlen);
- buf[dirlen] = '\0';
- }
-
- strncpy(dir_buf, buf, TP_FTW_PATHSIZE);
- load_stamp_basedir = dir_buf;
+ unsigned dirlen = strlen(dir);
+ memcpy(buf, dir, dirlen);
+ load_stamp_basedir = dir;
tp_ftw(screen, buf, dirlen, 0, loadstamp_callback, NULL);
}
@@ -6821,7 +6790,7 @@ static void load_stamps(SDL_Surface * screen)
default_stamp_size = compute_default_scale_factor(1.0);
load_stamp_dir(screen, homedirdir);
- load_stamp_dir(screen, "stamps");
+ load_stamp_dir(screen, DATA_PREFIX "stamps");
#ifdef __APPLE__
load_stamp_dir(screen, "/Library/Application Support/TuxPaint/stamps");
#endif
@@ -6834,8 +6803,8 @@ static void load_stamps(SDL_Surface * screen)
if (num_stamps[0] == 0)
{
fprintf(stderr,
- "\nWarning: No stamps found in %s/stamps/\n"
- "or %s\n\n", DATA_PREFIX, homedirdir);
+ "\nWarning: No stamps found in " DATA_PREFIX "stamps/\n"
+ "or %s\n\n", homedirdir);
}
num_stamp_groups = stamp_group + 1;
@@ -6985,23 +6954,21 @@ static void seticon(void)
Uint8 *mask;
#endif
SDL_Surface *icon;
- char fname_buf[MAX_PATH];
/* Load icon into a surface: */
#ifndef WIN32
- snprintf(fname_buf, sizeof(fname_buf), "%s/images/icon.png", DATA_PREFIX);
+ icon = IMG_Load(DATA_PREFIX "images/icon.png");
#else
- snprintf(fname_buf, sizeof(fname_buf), "%s/images/icon32x32.png", DATA_PREFIX);
+ icon = IMG_Load(DATA_PREFIX "images/icon32x32.png");
#endif
- icon = IMG_Load(fname_buf);
if (icon == NULL)
{
fprintf(stderr,
"\nWarning: I could not load the icon image: %s\n"
"The Simple DirectMedia error that occurred was:\n"
- "%s/images/icon.png", SDL_GetError(), DATA_PREFIX);
+ "%s\n\n", DATA_PREFIX "images/icon.png", SDL_GetError());
return;
}
@@ -7089,16 +7056,10 @@ static SDL_Surface *loadimage(const char *const fname)
/* Load an image: */
-static SDL_Surface *do_loadimage(const char *fname, int abort_on_error)
+static SDL_Surface *do_loadimage(const char *const fname, int abort_on_error)
{
SDL_Surface *s, *disp_fmt_s;
- char fname_buf[MAX_PATH];
- if (fname[0] != '/')
- {
- snprintf(fname_buf, sizeof(fname_buf), "%s/%s", DATA_PREFIX, fname);
- fname = fname_buf;
- }
/* Load the image file: */
@@ -9886,18 +9847,12 @@ static void playstampdesc(int chan)
#ifndef NOSOUND
-static Mix_Chunk *loadsound_extra(const char *fname, const char *extra)
+static Mix_Chunk *loadsound_extra(const char *const fname, const char *extra)
{
char *snd_fname;
char tmp_str[MAX_PATH], ext[5];
Mix_Chunk *tmp_snd;
- char fname_buf[MAX_PATH];
- if (fname[0] != '/')
- {
- snprintf(fname_buf, "%s/%s", DATA_PREFIX, fname);
- fname = fname_buf;
- }
if (strcasestr(fname, ".png") != NULL)
{
@@ -10457,16 +10412,13 @@ static void load_starter_id(char *saved_id, FILE *fil)
static void load_starter(char *img_id)
{
char *dirname;
- char fname[MAX_PATH];
+ char fname[256];
SDL_Surface *tmp_surf;
/* Determine path to starter files: */
if (starter_personal == 0)
- {
- snprintf(fname, sizeof(fname), "%s/starters", DATA_PREFIX);
- dirname = strdup(fname);
- }
+ dirname = strdup(DATA_PREFIX "starters");
else
dirname = get_fname("starters", DIR_DATA);
@@ -10635,16 +10587,13 @@ static void load_starter(char *img_id)
static void load_template(char *img_id)
{
char *dirname;
- char fname[MAX_PATH];
+ char fname[256];
SDL_Surface *tmp_surf;
/* Determine path to starter files: */
if (template_personal == 0)
- {
- snprintf(fname, sizeof(fname), "%s/templates", DATA_PREFIX);
- dirname = strdup(fname);
- }
+ dirname = strdup(DATA_PREFIX "templates");
else
dirname = get_fname("templates", DIR_DATA);
@@ -10717,22 +10666,7 @@ static void load_template(char *img_id)
static void load_current(void)
{
- char *fname = NULL;
-
- if (sugar_detected())
- fname = sugar_get_image_file();
- else
- fname = get_current_image_file();
-
- if (fname != NULL)
- load_current_image(fname);
-
- free(fname);
-}
-
-static char * get_current_image_file(void)
-{
- char *result = NULL;
+ SDL_Surface *tmp, *org_surf;
char *fname;
char ftmp[1024];
FILE *fi;
@@ -10780,15 +10714,7 @@ static char * get_current_image_file(void)
snprintf(ftmp, sizeof(ftmp), "saved/%s%s",
file_id, FNAME_EXTENSION);
- result = get_fname(ftmp, DIR_SAVE);
- }
-
- return result;
-}
-
-static void load_current_image(char * fname)
-{
- SDL_Surface *tmp, *org_surf;
+ fname = get_fname(ftmp, DIR_SAVE);
tmp = IMG_Load(fname);
@@ -10829,6 +10755,9 @@ static void load_current_image(char * fname)
load_embedded_data(fname, org_surf);
}
+
+ free(fname);
+ }
}
@@ -12111,8 +12040,6 @@ static int do_save(int tool, int dont_show_success_results)
}
}
- if (sugar_detected())
- sugar_save_image(fname);
free(fname);
@@ -12158,8 +12085,6 @@ static int do_save(int tool, int dont_show_success_results)
}
SDL_FreeSurface(thm);
- if (sugar_detected())
- sugar_save_thumb(fname);
free(fname);
#if 0 /* No more writing the .dat file */
@@ -12203,10 +12128,6 @@ static int do_save(int tool, int dont_show_success_results)
}
undo_tmp_applied_text();
-
- if (sugar_detected())
- /* In sugar, files are not stored in savedir, thus no need in file_id */
- file_id[0] = '\0';
return 1;
}
@@ -12850,50 +12771,6 @@ static int do_quit(int tool)
static int do_open(void)
{
- if (sugar_detected())
- {
- const char *fname = sugar_open();
- if (fname)
- {
- do_setcursor(cursor_watch);
- SDL_Flip(screen);
- show_progress_bar(screen);
- SDL_UpdateRect(screen, 0, 0, 0, 0);
- SDL_Flip(screen);
-
- free_surface(&img_starter);
- free_surface(&img_starter_bkgd);
- starter_id[0] = '\0';
- template_id[0] = '\0';
- starter_mirrored = 0;
- starter_flipped = 0;
- starter_personal = 0;
- starter_modified = 0;
- canvas_color_r = canvas_color_g = canvas_color_b = 255;
-
- SDL_Surface *tmp, *org_surf;
- tmp = IMG_Load(fname);
- org_surf = SDL_DisplayFormat(tmp);
- autoscale_copy_smear_free(tmp, canvas, SDL_BlitSurface);
- load_embedded_data(fname, org_surf);
- free(fname);
-
- cur_undo = 0;
- oldest_undo = 0;
- newest_undo = 0;
- been_saved = 1;
- tool_avail_bak[TOOL_UNDO] = 0;
- tool_avail_bak[TOOL_REDO] = 0;
-
- update_canvas(0, 0, canvas->w, canvas->h);
- }
- } else {
- do_open_image();
- }
-}
-
-static int do_open_image(void)
-{
SDL_Surface *img, *img1, *img2, *org_surf;
int things_alloced;
SDL_Surface **thumbs = NULL;
@@ -16729,7 +16606,7 @@ static void load_magic_plugins(void)
{
struct stat sbuf;
- snprintf(fname, sizeof(fname), "%s/%s", place, f->d_name);
+ snprintf(fname, sizeof(fname), "%s%s", place, f->d_name);
if (!stat(fname, &sbuf) && S_ISREG(sbuf.st_mode))
{
/* Get just the name of the object (e.g., "negative"), w/o filename
@@ -17314,8 +17191,8 @@ static int do_new_dialog(void)
{
/* Finally, check for system-wide coloring-book style
'starter' images: */
- snprintf(fname, sizeof(fname), "%s/starters", DATA_PREFIX);
- dirname[places_to_look] = strdup(fname);
+
+ dirname[places_to_look] = strdup(DATA_PREFIX "starters");
}
else if (places_to_look == PLACE_PERSONAL_TEMPLATES_DIR)
{
@@ -17326,8 +17203,8 @@ static int do_new_dialog(void)
else if (places_to_look == PLACE_TEMPLATES_DIR)
{
/* Finally, check for system-wide 'template' images: */
- snprintf(fname, sizeof(fname), "%s/templates", DATA_PREFIX);
- dirname[places_to_look] = strdup(fname);
+
+ dirname[places_to_look] = strdup(DATA_PREFIX "templates");
}
@@ -18157,7 +18034,7 @@ static int do_new_dialog(void)
if (!been_saved && !disable_save)
{
- if (!sugar_detected() && do_prompt_image_snd(PROMPT_OPEN_SAVE_TXT,
+ if (do_prompt_image_snd(PROMPT_OPEN_SAVE_TXT,
PROMPT_OPEN_SAVE_YES,
PROMPT_OPEN_SAVE_NO,
img_tools[TOOL_SAVE], NULL, NULL,
@@ -19957,7 +19834,6 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
int ldelta, ldata, fgnd, bgnd;
int num_unknowns = 0;
SDL_Surface *aux_surf;
- unsigned char png_sig[8];
png_structp png_ptr;
png_infop info_ptr;
@@ -19975,14 +19851,6 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
return;
}
- fread(png_sig, 1, sizeof(png_sig), fp);
- if (png_sig_cmp(png_sig, 0, sizeof(png_sig)) != 0)
- {
- fprintf(stderr, "\nError: Wrong PNG image!\n%s\n\n", fname);
- return;
- }
- fseek(fp, 0, SEEK_SET);
-
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL)
{
@@ -20892,7 +20760,7 @@ static void do_lock_file(void)
/* (Make sure the directory exists, first!) */
homedirdir = get_fname("", DIR_SAVE);
- mkdir(homedirdir, 0775);
+ mkdir(homedirdir, 0755);
free(homedirdir);
@@ -21012,9 +20880,6 @@ static void setup(void)
}
}
- // sugar X properties should be set before the window is shown on the screen
- if (sugar_detected())
- sugar_setup_x11(&WINDOW_WIDTH, &WINDOW_HEIGHT);
#ifndef NOSOUND
#ifndef WIN32
@@ -21034,17 +20899,7 @@ static void setup(void)
i = NUM_SOUNDS;
while (use_sound && i--)
{
- if (sound_fnames[i][0] != '/')
- {
- char fname_buf[MAX_PATH];
- snprintf(fname_buf, sizeof(fname_buf), "%s/%s", DATA_PREFIX,
- sound_fnames[i]);
- sounds[i] = Mix_LoadWAV(fname_buf);
- }
- else
- {
- sounds[i] = Mix_LoadWAV(sound_fnames[i]);
- }
+ sounds[i] = Mix_LoadWAV(sound_fnames[i]);
if (sounds[i] == NULL)
{
@@ -21188,9 +21043,9 @@ static void setup(void)
/* quickly: title image, version, progress bar, and watch cursor */
- img_title = loadimage("images/title.png");
- img_title_credits = loadimage("images/title-credits.png");
- img_progress = loadimage("images/ui/progress.png");
+ img_title = loadimage(DATA_PREFIX "images/title.png");
+ img_title_credits = loadimage(DATA_PREFIX "images/title-credits.png");
+ img_progress = loadimage(DATA_PREFIX "images/ui/progress.png");
if (screen->w - img_title->w >= 410 && screen->h - img_progress->h - img_title_credits->h - 40) /* FIXME: Font */
big_title = 1;
@@ -21199,9 +21054,9 @@ static void setup(void)
if (big_title)
- img_title_tuxpaint = loadimage("images/title-tuxpaint-2x.png");
+ img_title_tuxpaint = loadimage(DATA_PREFIX "images/title-tuxpaint-2x.png");
else
- img_title_tuxpaint = loadimage("images/title-tuxpaint.png");
+ img_title_tuxpaint = loadimage(DATA_PREFIX "images/title-tuxpaint.png");
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));
@@ -21299,16 +21154,16 @@ static void setup(void)
#endif
medium_font = TuxPaint_Font_OpenFont(PANGO_DEFAULT_FONT,
- "fonts/default_font.ttf",
+ DATA_PREFIX "fonts/default_font.ttf",
18 - (only_uppercase * 3));
if (medium_font == NULL)
{
fprintf(stderr,
"\nError: Can't load font file: "
- "%s/fonts/default_font.ttf\n"
+ DATA_PREFIX "fonts/default_font.ttf\n"
"The Simple DirectMedia Layer error that occurred was:\n"
- "%s\n\n", DATA_PREFIX, SDL_GetError());
+ "%s\n\n", SDL_GetError());
cleanup();
exit(1);
@@ -21479,20 +21334,20 @@ static void setup(void)
for (i = 0; i < NUM_TOOLS; i++)
img_tools[i] = loadimage(tool_img_fnames[i]);
- img_title_on = loadimage("images/ui/title.png");
- img_title_large_on = loadimage("images/ui/title_large.png");
- img_title_off = loadimage("images/ui/no_title.png");
- img_title_large_off = loadimage("images/ui/no_title_large.png");
+ img_title_on = loadimage(DATA_PREFIX "images/ui/title.png");
+ img_title_large_on = loadimage(DATA_PREFIX "images/ui/title_large.png");
+ img_title_off = loadimage(DATA_PREFIX "images/ui/no_title.png");
+ img_title_large_off = loadimage(DATA_PREFIX "images/ui/no_title_large.png");
- img_btn_up = loadimage("images/ui/btn_up.png");
- img_btn_down = loadimage("images/ui/btn_down.png");
- img_btn_off = loadimage("images/ui/btn_off.png");
+ img_btn_up = loadimage(DATA_PREFIX "images/ui/btn_up.png");
+ img_btn_down = loadimage(DATA_PREFIX "images/ui/btn_down.png");
+ img_btn_off = loadimage(DATA_PREFIX "images/ui/btn_off.png");
- img_btnsm_up = loadimage("images/ui/btnsm_up.png");
- img_btnsm_off = loadimage("images/ui/btnsm_off.png");
+ img_btnsm_up = loadimage(DATA_PREFIX "images/ui/btnsm_up.png");
+ img_btnsm_off = loadimage(DATA_PREFIX "images/ui/btnsm_off.png");
- img_sfx = loadimage("images/tools/sfx.png");
- img_speak = loadimage("images/tools/speak.png");
+ img_sfx = loadimage(DATA_PREFIX "images/tools/sfx.png");
+ img_speak = loadimage(DATA_PREFIX "images/tools/speak.png");
img_black = SDL_CreateRGBSurface(SDL_SRCALPHA | SDL_SWSURFACE,
img_btn_off->w, img_btn_off->h,
@@ -21515,54 +21370,54 @@ static void setup(void)
show_progress_bar(screen);
- img_yes = loadimage("images/ui/yes.png");
- img_no = loadimage("images/ui/no.png");
+ img_yes = loadimage(DATA_PREFIX "images/ui/yes.png");
+ img_no = loadimage(DATA_PREFIX "images/ui/no.png");
- img_prev = loadimage("images/ui/prev.png");
- img_next = loadimage("images/ui/next.png");
+ img_prev = loadimage(DATA_PREFIX "images/ui/prev.png");
+ img_next = loadimage(DATA_PREFIX "images/ui/next.png");
- img_mirror = loadimage("images/ui/mirror.png");
- img_flip = loadimage("images/ui/flip.png");
+ img_mirror = loadimage(DATA_PREFIX "images/ui/mirror.png");
+ img_flip = loadimage(DATA_PREFIX "images/ui/flip.png");
- img_open = loadimage("images/ui/open.png");
- img_erase = loadimage("images/ui/erase.png");
- img_back = loadimage("images/ui/back.png");
- img_trash = loadimage("images/ui/trash.png");
+ img_open = loadimage(DATA_PREFIX "images/ui/open.png");
+ img_erase = loadimage(DATA_PREFIX "images/ui/erase.png");
+ img_back = loadimage(DATA_PREFIX "images/ui/back.png");
+ img_trash = loadimage(DATA_PREFIX "images/ui/trash.png");
- img_slideshow = loadimage("images/ui/slideshow.png");
- img_play = loadimage("images/ui/play.png");
- img_select_digits = loadimage("images/ui/select_digits.png");
+ img_slideshow = loadimage(DATA_PREFIX "images/ui/slideshow.png");
+ img_play = loadimage(DATA_PREFIX "images/ui/play.png");
+ img_select_digits = loadimage(DATA_PREFIX "images/ui/select_digits.png");
- img_popup_arrow = loadimage("images/ui/popup_arrow.png");
+ img_popup_arrow = loadimage(DATA_PREFIX "images/ui/popup_arrow.png");
- img_dead40x40 = loadimage("images/ui/dead40x40.png");
+ img_dead40x40 = loadimage(DATA_PREFIX "images/ui/dead40x40.png");
- img_printer = loadimage("images/ui/printer.png");
- img_printer_wait = loadimage("images/ui/printer_wait.png");
+ img_printer = loadimage(DATA_PREFIX "images/ui/printer.png");
+ img_printer_wait = loadimage(DATA_PREFIX "images/ui/printer_wait.png");
- img_save_over = loadimage("images/ui/save_over.png");
+ img_save_over = loadimage(DATA_PREFIX "images/ui/save_over.png");
- img_grow = loadimage("images/ui/grow.png");
- img_shrink = loadimage("images/ui/shrink.png");
+ img_grow = loadimage(DATA_PREFIX "images/ui/grow.png");
+ img_shrink = loadimage(DATA_PREFIX "images/ui/shrink.png");
- img_magic_paint = loadimage("images/ui/magic_paint.png");
- img_magic_fullscreen = loadimage("images/ui/magic_fullscreen.png");
+ img_magic_paint = loadimage(DATA_PREFIX "images/ui/magic_paint.png");
+ img_magic_fullscreen = loadimage(DATA_PREFIX "images/ui/magic_fullscreen.png");
- img_bold = loadimage("images/ui/bold.png");
- img_italic = loadimage("images/ui/italic.png");
+ img_bold = loadimage(DATA_PREFIX "images/ui/bold.png");
+ img_italic = loadimage(DATA_PREFIX "images/ui/italic.png");
- img_label = loadimage("images/tools/label.png");
- img_label_select = loadimage("images/tools/label_select.png");
+ img_label = loadimage(DATA_PREFIX "images/tools/label.png");
+ img_label_select = loadimage(DATA_PREFIX "images/tools/label_select.png");
show_progress_bar(screen);
- tmp_imgcurup = loadimage("images/ui/cursor_up_large.png");
- tmp_imgcurdown = loadimage("images/ui/cursor_down_large.png");
+ tmp_imgcurup = loadimage(DATA_PREFIX "images/ui/cursor_up_large.png");
+ tmp_imgcurdown = loadimage(DATA_PREFIX "images/ui/cursor_down_large.png");
img_cursor_up = thumbnail(tmp_imgcurup, THUMB_W, THUMB_H, 0);
img_cursor_down = thumbnail(tmp_imgcurdown, THUMB_W, THUMB_H, 0);
- tmp_imgcurup = loadimage("images/ui/cursor_starter_up.png");
- tmp_imgcurdown = loadimage("images/ui/cursor_starter_down.png");
+ tmp_imgcurup = loadimage(DATA_PREFIX "images/ui/cursor_starter_up.png");
+ tmp_imgcurdown = loadimage(DATA_PREFIX "images/ui/cursor_starter_down.png");
img_cursor_starter_up = thumbnail(tmp_imgcurup, THUMB_W, THUMB_H, 0);
img_cursor_starter_down = thumbnail(tmp_imgcurdown, THUMB_W, THUMB_H, 0);
SDL_FreeSurface(tmp_imgcurup);
@@ -21570,22 +21425,22 @@ static void setup(void)
show_progress_bar(screen);
- img_scroll_up = loadimage("images/ui/scroll_up.png");
- img_scroll_down = loadimage("images/ui/scroll_down.png");
+ img_scroll_up = loadimage(DATA_PREFIX "images/ui/scroll_up.png");
+ img_scroll_down = loadimage(DATA_PREFIX "images/ui/scroll_down.png");
- img_scroll_up_off = loadimage("images/ui/scroll_up_off.png");
+ img_scroll_up_off = loadimage(DATA_PREFIX "images/ui/scroll_up_off.png");
img_scroll_down_off =
- loadimage("images/ui/scroll_down_off.png");
+ loadimage(DATA_PREFIX "images/ui/scroll_down_off.png");
#ifdef LOW_QUALITY_COLOR_SELECTOR
- img_paintcan = loadimage("images/ui/paintcan.png");
+ img_paintcan = loadimage(DATA_PREFIX "images/ui/paintcan.png");
#endif
show_progress_bar(screen);
/* Load brushes: */
- load_brush_dir(screen, "brushes");
+ load_brush_dir(screen, DATA_PREFIX "brushes");
homedirdir = get_fname("brushes", DIR_DATA);
load_brush_dir(screen, homedirdir);
#ifdef WIN32
@@ -21597,8 +21452,8 @@ static void setup(void)
if (num_brushes == 0)
{
fprintf(stderr,
- "\nError: No brushes found in %s/brushes/\n"
- "or %s\n\n", DATA_PREFIX, homedirdir);
+ "\nError: No brushes found in " DATA_PREFIX "brushes/\n"
+ "or %s\n\n", homedirdir);
cleanup();
exit(1);
}
@@ -21609,16 +21464,16 @@ static void setup(void)
/* Load system fonts: */
large_font = TuxPaint_Font_OpenFont(PANGO_DEFAULT_FONT,
- "fonts/default_font.ttf",
+ DATA_PREFIX "fonts/default_font.ttf",
30 - (only_uppercase * 3));
if (large_font == NULL)
{
fprintf(stderr,
"\nError: Can't load font file: "
- "%s/fonts/default_font.ttf\n"
+ DATA_PREFIX "fonts/default_font.ttf\n"
"The Simple DirectMedia Layer error that occurred was:\n"
- "%s\n\n", DATA_PREFIX, SDL_GetError());
+ "%s\n\n", SDL_GetError());
cleanup();
exit(1);
@@ -21626,7 +21481,7 @@ static void setup(void)
small_font = TuxPaint_Font_OpenFont(PANGO_DEFAULT_FONT,
- "fonts/default_font.ttf",
+ DATA_PREFIX "fonts/default_font.ttf",
#ifdef __APPLE__
12 - (only_uppercase * 2));
#else
@@ -21637,9 +21492,9 @@ static void setup(void)
{
fprintf(stderr,
"\nError: Can't load font file: "
- "%s/fonts/default_font.ttf\n"
+ DATA_PREFIX "fonts/default_font.ttf\n"
"The Simple DirectMedia Layer error that occurred was:\n"
- "%s\n\n", DATA_PREFIX, SDL_GetError());
+ "%s\n\n", SDL_GetError());
cleanup();
exit(1);
@@ -21681,12 +21536,12 @@ static void setup(void)
show_progress_bar(screen);
- img_mouse = loadimage("images/ui/mouse.png");
- img_mouse_click = loadimage("images/ui/mouse_click.png");
+ img_mouse = loadimage(DATA_PREFIX "images/ui/mouse.png");
+ img_mouse_click = loadimage(DATA_PREFIX "images/ui/mouse_click.png");
show_progress_bar(screen);
- img_color_picker = loadimage("images/ui/color_picker.png");
+ img_color_picker = loadimage(DATA_PREFIX "images/ui/color_picker.png");
/* Create toolbox and selector labels: */
@@ -21720,7 +21575,7 @@ static void setup(void)
#ifndef LOW_QUALITY_COLOR_SELECTOR
/* Create appropriately-shaped buttons: */
- img1 = loadimage("images/ui/paintwell.png");
+ img1 = loadimage(DATA_PREFIX "images/ui/paintwell.png");
img_paintwell = thumbnail(img1, color_button_w, color_button_h, 0);
tmp_btn_up = thumbnail(img_btn_up, color_button_w, color_button_h, 0);
tmp_btn_down = thumbnail(img_btn_down, color_button_w, color_button_h, 0);
@@ -21977,24 +21832,7 @@ int main(int argc, char *argv[])
CLOCK_TYPE time2;
CLOCK_TYPE time3;
- char *data_prefix_realpath = NULL;
- char *magic_prefix_realpath = NULL;
- char *localedir_realpath = NULL;
- const char *envdir = NULL;
-
- envdir = getenv("TUXPAINT_DATA_PREFIX");
- if (envdir)
- DATA_PREFIX = data_prefix_realpath = realpath(envdir, NULL);
-
- envdir = getenv("TUXPAINT_MAGIC_PREFIX");
- if (envdir)
- MAGIC_PREFIX = magic_prefix_realpath = realpath(envdir, NULL);
-
- envdir = getenv("TUXPAINT_LOCALEDIR");
- if (envdir)
- LOCALEDIR = localedir_realpath = realpath(envdir, NULL);
-
- sugar_setup(&argc, &argv);
+ (void)argc;
CLOCK_ASM(time1);
@@ -22003,12 +21841,6 @@ int main(int argc, char *argv[])
chdir_to_binary(argv[0]);
setup_config(argv);
- if (sugar_detected()) {
- savedir = sugar_get_savedir();
- /* With saving to Sugar Journal, only followed settings make sense */
- promptless_save = SAVE_OVER_ALWAYS;
- autosave_on_quit = 1;
- }
@@ -22044,11 +21876,5 @@ int main(int argc, char *argv[])
save_current();
wait_for_sfx();
cleanup();
- sugar_cleanup();
-
- free(data_prefix_realpath);
- free(magic_prefix_realpath);
- free(localedir_realpath);
-
return 0;
}
diff --git a/src/tuxpaint.h b/src/tuxpaint.h
deleted file mode 100644
index 369b0f3..0000000
--- a/src/tuxpaint.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- tuxpaint.h
-
- 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)
-*/
-
-#ifndef TUXPAINT_H
-#define TUXPAINT_H
-
-#define MAX_PATH 256
-
-extern const char *DATA_PREFIX;
-extern const char *MAGIC_PREFIX;
-extern const char *LOCALEDIR;
-
-#endif