Added support for building on a Windows system using MinGW/MSYS.

After building and installing all the dependencies I used these commands,
in MSYS, to build, install and run:

    export set CPATH=/usr/local/include
    export set LIBRARY_PATH=/usr/local/bin:/usr/local/lib
    make win32
    make install-win32
    tuxpaint
This commit is contained in:
John Popplewell 2005-02-26 02:26:40 +00:00
parent e1ce8e1ddb
commit 778bd2f897
4 changed files with 264 additions and 252 deletions

167
Makefile
View file

@ -22,6 +22,7 @@ PKG_ROOT=
# Program: # Program:
BIN_PREFIX=$(PKG_ROOT)/$(PREFIX)/bin BIN_PREFIX=$(PKG_ROOT)/$(PREFIX)/bin
EXE_EXT=
# Data: # Data:
@ -144,6 +145,22 @@ beos:
ARCH_HEADERS="src/BeOS_Print.h" \ ARCH_HEADERS="src/BeOS_Print.h" \
ARCH_LIBS="obj/BeOS_print.o" ARCH_LIBS="obj/BeOS_print.o"
# "make win32" builds the program for Windows using MinGW/MSYS
win32:
make \
PREFIX=/usr/local \
BIN_PREFIX=$(PREFIX)/bin \
EXE_EXT=.exe \
DATA_PREFIX=$(PREFIX)/share/tuxpaint/ \
DOC_PREFIX=$(PREFIX)/share/doc/tuxpaint/ \
MAN_PREFIX=$(PREFIX)/share/man/ \
ICON_PREFIX=./ \
X11_ICON_PREFIX=./ \
LOCALE_PREFIX=$(PREFIX)/share/locale/ \
CONFDIR=$(PREFIX)/etc/tuxpaint \
ARCH_LINKS="-lintl-3 -lpng12 -lwinspool" \
ARCH_HEADERS="src/win32_print.h" \
ARCH_LIBS="obj/win32_print.o"
# "make install" installs all of the various parts # "make install" installs all of the various parts
# (depending on the *PREFIX variables at the top, you probably need # (depending on the *PREFIX variables at the top, you probably need
@ -172,6 +189,30 @@ install: install-bin install-data install-man install-doc \
@echo @echo
# "make private-win32" installs all of the various parts for MinGW
install-private-win32: install-bin install-data install-man install-doc \
install-icon install-gettext install-importscript \
install-default-config install-example-stamps \
install-example-starters
@echo
@echo "--------------------------------------------------------------"
@echo
@echo "All done!"
@echo "Now you can type the command 'tuxpaint' to run the program!!!"
@echo
@echo "For more information, see the 'tuxpaint' man page,"
@echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)README.txt"
@echo
@echo "Visit Tux Paint's home page for more information, updates"
@echo "and to learn how you can help out!"
@echo
@echo " http://www.newbreedsoftware.com/tuxpaint/"
@echo
@echo "Enjoy!"
@echo
# "make install-beos" installs Tux Paint, but using BeOS settings # "make install-beos" installs Tux Paint, but using BeOS settings
install-beos: install-beos:
@ -182,7 +223,7 @@ install-beos:
DOC_PREFIX=./docs/ \ DOC_PREFIX=./docs/ \
MAN_PREFIX=./src/ \ MAN_PREFIX=./src/ \
CONFDIR=./src/ \ CONFDIR=./src/ \
ICON_PREFIX=./ ICON_PREFIX=./ \
X11_ICON_PREFIX=./ \ X11_ICON_PREFIX=./ \
LOCALE_PREFIX=/boot/home/config/share/locale/ \ LOCALE_PREFIX=/boot/home/config/share/locale/ \
CFLAGS="-O1 -funroll-loops -fomit-frame-pointer -pipe -Wall" \ CFLAGS="-O1 -funroll-loops -fomit-frame-pointer -pipe -Wall" \
@ -192,6 +233,22 @@ install-beos:
ARCH_HEADERS="src/BeOS_Print.h" \ ARCH_HEADERS="src/BeOS_Print.h" \
ARCH_LIBS="obj/BeOS_print.o" ARCH_LIBS="obj/BeOS_print.o"
# "make install-win32" installs Tux Paint, but using MinGW/MSYS settings
install-win32:
make install-private-win32 \
PREFIX=/usr/local \
BIN_PREFIX=$(PREFIX)/bin \
EXE_EXT=.exe \
DATA_PREFIX=$(PREFIX)/share/tuxpaint/ \
DOC_PREFIX=$(PREFIX)/share/doc/tuxpaint/ \
MAN_PREFIX=$(PREFIX)/share/man/ \
ICON_PREFIX=./ \
X11_ICON_PREFIX=./ \
LOCALE_PREFIX=$(PREFIX)/share/locale/ \
CONFDIR=$(PREFIX)/etc/tuxpaint \
ARCH_LINKS="-lintl-3 -lpng12 -lwinspool" \
ARCH_HEADERS="src/win32_print.h" \
ARCH_LIBS="obj/win32_print.o"
# "make clean" deletes the program, the compiled objects and the # "make clean" deletes the program, the compiled objects and the
# built man page (returns to factory archive, pretty much...) # built man page (returns to factory archive, pretty much...)
@ -421,7 +478,7 @@ install-bin:
@echo "...Installing program itself..." @echo "...Installing program itself..."
@install -d $(BIN_PREFIX) @install -d $(BIN_PREFIX)
@cp tuxpaint $(BIN_PREFIX) @cp tuxpaint $(BIN_PREFIX)
@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint @chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint$(EXE_EXT)
# Install the import script: # Install the import script:
@ -779,6 +836,12 @@ obj/BeOS_Print.o: src/BeOS_Print.cpp obj src/BeOS_print.h
@$(CC) $(CFLAGS) $(SDL_CFLAGS) $(DEFS) \ @$(CC) $(CFLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/BeOS_print.cpp -o obj/BeOS_print.o -c src/BeOS_print.cpp -o obj/BeOS_print.o
obj/win32_print.o: src/win32_print.c obj src/win32_print.h
@echo
@echo "...Compiling win32 print support..."
@$(CC) $(CFLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/win32_print.c -o obj/win32_print.o
# Build the translation files for gettext # Build the translation files for gettext
@ -841,203 +904,203 @@ trans:
trans/af.mo: src/po/af.po trans/af.mo: src/po/af.po
@echo " af_ZA ...Afrikaans..." @echo " af_ZA ...Afrikaans..."
@msgfmt src/po/af.po -o trans/af.mo @msgfmt -o trans/af.mo src/po/af.po
trans/be.mo: src/po/be.po trans/be.mo: src/po/be.po
@echo " be_BY ...Belarusian..." @echo " be_BY ...Belarusian..."
@msgfmt src/po/be.po -o trans/be.mo @msgfmt -o trans/be.mo src/po/be.po
trans/bg.mo: src/po/bg.po trans/bg.mo: src/po/bg.po
@echo " bg_BG ...Bulgarian..." @echo " bg_BG ...Bulgarian..."
@msgfmt src/po/bg.po -o trans/bg.mo @msgfmt -o trans/bg.mo src/po/bg.po
trans/br.mo: src/po/br.po trans/br.mo: src/po/br.po
@echo " br_FR ...Breton..." @echo " br_FR ...Breton..."
@msgfmt src/po/br.po -o trans/br.mo @msgfmt -o trans/br.mo src/po/br.po
trans/ca.mo: src/po/ca.po trans/ca.mo: src/po/ca.po
@echo " ca_ES ...Catalan..." @echo " ca_ES ...Catalan..."
@msgfmt src/po/ca.po -o trans/ca.mo @msgfmt -o trans/ca.mo src/po/ca.po
trans/cy.mo: src/po/cy.po trans/cy.mo: src/po/cy.po
@echo " cy_GB ...Welsh..." @echo " cy_GB ...Welsh..."
@msgfmt src/po/cy.po -o trans/cy.mo @msgfmt -o trans/cy.mo src/po/cy.po
trans/cs.mo: src/po/cs.po trans/cs.mo: src/po/cs.po
@echo " cs_CZ ...Czech..." @echo " cs_CZ ...Czech..."
@msgfmt src/po/cs.po -o trans/cs.mo @msgfmt -o trans/cs.mo src/po/cs.po
trans/da.mo: src/po/da.po trans/da.mo: src/po/da.po
@echo " da_DK ...Danish..." @echo " da_DK ...Danish..."
@msgfmt src/po/da.po -o trans/da.mo @msgfmt -o trans/da.mo src/po/da.po
trans/de.mo: src/po/de.po trans/de.mo: src/po/de.po
@echo " de_DE ...German..." @echo " de_DE ...German..."
@msgfmt src/po/de.po -o trans/de.mo @msgfmt -o trans/de.mo src/po/de.po
trans/et.mo: src/po/et.po trans/et.mo: src/po/et.po
@echo " et_EE ...Estonian..." @echo " et_EE ...Estonian..."
@msgfmt src/po/et.po -o trans/et.mo @msgfmt -o trans/et.mo src/po/et.po
trans/el.mo: src/po/el.po trans/el.mo: src/po/el.po
@echo " el_GR ...Greek..." @echo " el_GR ...Greek..."
@msgfmt src/po/el.po -o trans/el.mo @msgfmt -o trans/el.mo src/po/el.po
trans/en_gb.mo: src/po/en_gb.po trans/en_gb.mo: src/po/en_gb.po
@echo " en_GB ...British English..." @echo " en_GB ...British English..."
@msgfmt src/po/en_gb.po -o trans/en_gb.mo @msgfmt -o trans/en_gb.mo src/po/en_gb.po
trans/es.mo: src/po/es.po trans/es.mo: src/po/es.po
@echo " es_ES ...Spanish..." @echo " es_ES ...Spanish..."
@msgfmt src/po/es.po -o trans/es.mo @msgfmt -o trans/es.mo src/po/es.po
trans/eu.mo: src/po/eu.po trans/eu.mo: src/po/eu.po
@echo " eu_ES ...Basque..." @echo " eu_ES ...Basque..."
@msgfmt src/po/eu.po -o trans/eu.mo @msgfmt -o trans/eu.mo src/po/eu.po
trans/fi.mo: src/po/fi.po trans/fi.mo: src/po/fi.po
@echo " fi_FI ...Finnish..." @echo " fi_FI ...Finnish..."
@msgfmt src/po/fi.po -o trans/fi.mo @msgfmt -o trans/fi.mo src/po/fi.po
trans/fr.mo: src/po/fr.po trans/fr.mo: src/po/fr.po
@echo " fr_FR ...French..." @echo " fr_FR ...French..."
@msgfmt src/po/fr.po -o trans/fr.mo @msgfmt -o trans/fr.mo src/po/fr.po
trans/ga.mo: src/po/ga.po trans/ga.mo: src/po/ga.po
@echo " ga_IE ...Gaelic..." @echo " ga_IE ...Gaelic..."
@msgfmt src/po/ga.po -o trans/ga.mo @msgfmt -o trans/ga.mo src/po/ga.po
trans/gl.mo: src/po/gl.po trans/gl.mo: src/po/gl.po
@echo " gl_ES ...Galician..." @echo " gl_ES ...Galician..."
@msgfmt src/po/gl.po -o trans/gl.mo @msgfmt -o trans/gl.mo src/po/gl.po
trans/he.mo: src/po/he.po trans/he.mo: src/po/he.po
@echo " he_IL ...Hebrew..." @echo " he_IL ...Hebrew..."
@msgfmt src/po/he.po -o trans/he.mo @msgfmt -o trans/he.mo src/po/he.po
trans/hi.mo: src/po/hi.po trans/hi.mo: src/po/hi.po
@echo " hi_IN ...Hindi..." @echo " hi_IN ...Hindi..."
@msgfmt src/po/hi.po -o trans/hi.mo @msgfmt -o trans/hi.mo src/po/hi.po
trans/hr.mo: src/po/hr.po trans/hr.mo: src/po/hr.po
@echo " hr_HR ...Croatian..." @echo " hr_HR ...Croatian..."
@msgfmt src/po/hr.po -o trans/hr.mo @msgfmt -o trans/hr.mo src/po/hr.po
trans/hu.mo: src/po/hu.po trans/hu.mo: src/po/hu.po
@echo " hu_HU ...Hungarian..." @echo " hu_HU ...Hungarian..."
@msgfmt src/po/hu.po -o trans/hu.mo @msgfmt -o trans/hu.mo src/po/hu.po
trans/tlh.mo: src/po/tlh.po trans/tlh.mo: src/po/tlh.po
@echo " tlh ...Klingon (Romanized)..." @echo " tlh ...Klingon (Romanized)..."
@msgfmt src/po/tlh.po -o trans/tlh.mo @msgfmt -o trans/tlh.mo src/po/tlh.po
trans/id.mo: src/po/id.po trans/id.mo: src/po/id.po
@echo " id_ID ...Indonesian..." @echo " id_ID ...Indonesian..."
@msgfmt src/po/id.po -o trans/id.mo @msgfmt -o trans/id.mo src/po/id.po
trans/is.mo: src/po/is.po trans/is.mo: src/po/is.po
@echo " is_IS ...Icelandic..." @echo " is_IS ...Icelandic..."
@msgfmt src/po/is.po -o trans/is.mo @msgfmt -o trans/is.mo src/po/is.po
trans/it.mo: src/po/it.po trans/it.mo: src/po/it.po
@echo " it_IT ...Italian..." @echo " it_IT ...Italian..."
@msgfmt src/po/it.po -o trans/it.mo @msgfmt -o trans/it.mo src/po/it.po
trans/ja.mo: src/po/ja.po trans/ja.mo: src/po/ja.po
@echo " ja_JP ...Japanese..." @echo " ja_JP ...Japanese..."
@msgfmt src/po/ja.po -o trans/ja.mo @msgfmt -o trans/ja.mo src/po/ja.po
trans/ko.mo: src/po/ko.po trans/ko.mo: src/po/ko.po
@echo " ko_KR ...Korean..." @echo " ko_KR ...Korean..."
@msgfmt src/po/ko.po -o trans/ko.mo @msgfmt -o trans/ko.mo src/po/ko.po
trans/lt.mo: src/po/lt.po trans/lt.mo: src/po/lt.po
@echo " lt_LT ...Lithuanian..." @echo " lt_LT ...Lithuanian..."
@msgfmt src/po/lt.po -o trans/lt.mo @msgfmt -o trans/lt.mo src/po/lt.po
trans/ms.mo: src/po/ms.po trans/ms.mo: src/po/ms.po
@echo " ms_MY ...Malay..." @echo " ms_MY ...Malay..."
@msgfmt src/po/ms.po -o trans/ms.mo @msgfmt -o trans/ms.mo src/po/ms.po
trans/nl.mo: src/po/nl.po trans/nl.mo: src/po/nl.po
@echo " nl_NL ...Dutch..." @echo " nl_NL ...Dutch..."
@msgfmt src/po/nl.po -o trans/nl.mo @msgfmt -o trans/nl.mo src/po/nl.po
trans/nb.mo: src/po/nb.po trans/nb.mo: src/po/nb.po
@echo " nb_NO ...Norwegian Bokmal..." @echo " nb_NO ...Norwegian Bokmal..."
@msgfmt src/po/nb.po -o trans/nb.mo @msgfmt -o trans/nb.mo src/po/nb.po
trans/nn.mo: src/po/nn.po trans/nn.mo: src/po/nn.po
@echo " nn_NO ...Norwegian Nynorsk..." @echo " nn_NO ...Norwegian Nynorsk..."
@msgfmt src/po/nn.po -o trans/nn.mo @msgfmt -o trans/nn.mo src/po/nn.po
trans/pl.mo: src/po/pl.po trans/pl.mo: src/po/pl.po
@echo " pl_PL ...Polish..." @echo " pl_PL ...Polish..."
@msgfmt src/po/pl.po -o trans/pl.mo @msgfmt -o trans/pl.mo src/po/pl.po
trans/pt_pt.mo: src/po/pt_pt.po trans/pt_pt.mo: src/po/pt_pt.po
@echo " pt_PT ...Portuguese..." @echo " pt_PT ...Portuguese..."
@msgfmt src/po/pt_pt.po -o trans/pt_pt.mo @msgfmt -o trans/pt_pt.mo src/po/pt_pt.po
trans/pt_br.mo: src/po/pt_br.po trans/pt_br.mo: src/po/pt_br.po
@echo " pt_BR ...Brazilian Portuguese..." @echo " pt_BR ...Brazilian Portuguese..."
@msgfmt src/po/pt_br.po -o trans/pt_br.mo @msgfmt -o trans/pt_br.mo src/po/pt_br.po
trans/ro.mo: src/po/ro.po trans/ro.mo: src/po/ro.po
@echo " ro_RO ...Romanian..." @echo " ro_RO ...Romanian..."
@msgfmt src/po/ro.po -o trans/ro.mo @msgfmt -o trans/ro.mo src/po/ro.po
trans/ru.mo: src/po/ru.po trans/ru.mo: src/po/ru.po
@echo " ru_RU ...Russian..." @echo " ru_RU ...Russian..."
@msgfmt src/po/ru.po -o trans/ru.mo @msgfmt -o trans/ru.mo src/po/ru.po
trans/sk.mo: src/po/sk.po trans/sk.mo: src/po/sk.po
@echo " sk_SK ...Slovak..." @echo " sk_SK ...Slovak..."
@msgfmt src/po/sk.po -o trans/sk.mo @msgfmt -o trans/sk.mo src/po/sk.po
trans/sl.mo: src/po/sl.po trans/sl.mo: src/po/sl.po
@echo " sl_SI ...Slovenian..." @echo " sl_SI ...Slovenian..."
@msgfmt src/po/sl.po -o trans/sl.mo @msgfmt -o trans/sl.mo src/po/sl.po
trans/sq.mo: src/po/sq.po trans/sq.mo: src/po/sq.po
@echo " sq_AL ...Albanian..." @echo " sq_AL ...Albanian..."
@msgfmt src/po/sq.po -o trans/sq.mo @msgfmt -o trans/sq.mo src/po/sq.po
trans/sr.mo: src/po/sr.po trans/sr.mo: src/po/sr.po
@echo " sr_YU ...Serbian..." @echo " sr_YU ...Serbian..."
@msgfmt src/po/sr.po -o trans/sr.mo @msgfmt -o trans/sr.mo src/po/sr.po
trans/sv.mo: src/po/sv.po trans/sv.mo: src/po/sv.po
@echo " sv_SE ...Swedish..." @echo " sv_SE ...Swedish..."
@msgfmt src/po/sv.po -o trans/sv.mo @msgfmt -o trans/sv.mo src/po/sv.po
trans/sw.mo: src/po/sw.po trans/sw.mo: src/po/sw.po
@echo " sw_TZ ...Swahili..." @echo " sw_TZ ...Swahili..."
@msgfmt src/po/sw.po -o trans/sw.mo @msgfmt -o trans/sw.mo src/po/sw.po
trans/ta.mo: src/po/ta.po trans/ta.mo: src/po/ta.po
@echo " ta_IN ...Tamil..." @echo " ta_IN ...Tamil..."
@msgfmt src/po/ta.po -o trans/ta.mo @msgfmt -o trans/ta.mo src/po/ta.po
trans/tr.mo: src/po/tr.po trans/tr.mo: src/po/tr.po
@echo " tr_TR ...Turkish..." @echo " tr_TR ...Turkish..."
@msgfmt src/po/tr.po -o trans/tr.mo @msgfmt -o trans/tr.mo src/po/tr.po
trans/vi.mo: src/po/vi.po trans/vi.mo: src/po/vi.po
@echo " vi_VN ...Vietnamese..." @echo " vi_VN ...Vietnamese..."
@msgfmt src/po/vi.po -o trans/vi.mo @msgfmt -o trans/vi.mo src/po/vi.po
trans/wa.mo: src/po/wa.po trans/wa.mo: src/po/wa.po
@echo " wa_BE ...Walloon..." @echo " wa_BE ...Walloon..."
@msgfmt src/po/wa.po -o trans/wa.mo @msgfmt -o trans/wa.mo src/po/wa.po
trans/zh_cn.mo: src/po/zh_cn.po trans/zh_cn.mo: src/po/zh_cn.po
@echo " zh_CN ...Chinese..." @echo " zh_CN ...Chinese..."
@msgfmt src/po/zh_cn.po -o trans/zh_cn.mo @msgfmt -o trans/zh_cn.mo src/po/zh_cn.po
trans/zh_tw.mo: src/po/zh_tw.po trans/zh_tw.mo: src/po/zh_tw.po
@echo " zh_TW ...Chinese..." @echo " zh_TW ...Chinese..."
@msgfmt src/po/zh_tw.po -o trans/zh_tw.mo @msgfmt -o trans/zh_tw.mo src/po/zh_tw.po

View file

@ -41,6 +41,9 @@
// plan to rip this out as soon as it is considered stable // plan to rip this out as soon as it is considered stable
//#define THREADED_FONTS //#define THREADED_FONTS
#define FORKED_FONTS #define FORKED_FONTS
#ifdef WIN32
#undef FORKED_FONTS
#endif
/* Method for printing images: */ /* Method for printing images: */
@ -159,16 +162,6 @@ static scaleparams scaletable[] = {
#include <wctype.h> #include <wctype.h>
#endif #endif
#ifdef WIN32_OLD
/* The following are required by libintl.h, so must be defined first: */
#define LC_MESSAGES 1729
#define HAVE_LC_MESSAGES 1
#define ENABLE_NLS 1
#define HAVE_LOCALE_H 1
#define HAVE_GETTEXT 1
#define HAVE_DCGETTEXT 1
#endif
#include <libintl.h> #include <libintl.h>
#ifndef gettext_noop #ifndef gettext_noop
#define gettext_noop(String) String #define gettext_noop(String) String
@ -187,8 +180,6 @@ static scaleparams scaletable[] = {
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
@ -211,38 +202,15 @@ typedef struct safer_dirent {
extern WrapperData macosx; extern WrapperData macosx;
#endif #endif
#else #else
#include "win32_dirent.h"
#include <unistd.h>
#include <dirent.h>
#include <malloc.h>
#include "win32_print.h" #include "win32_print.h"
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
/* Enables win32 apps to get a GNU compatible locale string */
extern char* g_win32_getlocale(void);
/* Set this to 0 during developement and testing in Visual-Studio
Set this to 1 to make the final executable */
#if 1
#define DOC_PREFIX "docs/"
#define DATA_PREFIX "data/"
#define LOCALEDIR "locale"
#else
#define DOC_PREFIX "../../docs/"
#define DATA_PREFIX "../../data/"
#define LOCALEDIR "../../locale"
#endif /* 1/0 */
#define mkdir(path,access) _mkdir(path) #define mkdir(path,access) _mkdir(path)
#define strcasecmp stricmp
#define strncasecmp strnicmp
#define snprintf _snprintf
#define S_ISDIR(i) ((i&_S_IFDIR)!=0)
#define alloca _alloca
#endif /* WIN32 */ #endif /* WIN32 */
@ -250,7 +218,7 @@ extern char* g_win32_getlocale(void);
#include <sys/stat.h> #include <sys/stat.h>
#include "SDL.h" #include "SDL.h"
#ifndef _SDL_H #if !defined(_SDL_H)
#error "---------------------------------------------------" #error "---------------------------------------------------"
#error "If you installed SDL from a package, be sure to get" #error "If you installed SDL from a package, be sure to get"
#error "the development package, as well!" #error "the development package, as well!"
@ -259,30 +227,26 @@ extern char* g_win32_getlocale(void);
#endif #endif
#include "SDL_image.h" #include "SDL_image.h"
#ifndef _SDL_IMAGE_H #if !defined(_SDL_IMAGE_H) && !defined(_IMG_h)
#ifndef _IMG_h
#error "---------------------------------------------------" #error "---------------------------------------------------"
#error "If you installed SDL_image from a package, be sure" #error "If you installed SDL_image from a package, be sure"
#error "to get the development package, as well!" #error "to get the development package, as well!"
#error "(e.g., 'libsdl-image1.2-devel.rpm')" #error "(e.g., 'libsdl-image1.2-devel.rpm')"
#error "---------------------------------------------------" #error "---------------------------------------------------"
#endif #endif
#endif
#include "SDL_ttf.h" #include "SDL_ttf.h"
#ifndef _SDL_TTF_h #if !defined(_SDL_TTF_H) && !defined(_SDLttf_h)
#ifndef _SDLttf_h
#error "---------------------------------------------------" #error "---------------------------------------------------"
#error "If you installed SDL_ttf from a package, be sure" #error "If you installed SDL_ttf from a package, be sure"
#error "to get the development package, as well!" #error "to get the development package, as well!"
#error "(e.g., 'libsdl-ttf1.2-devel.rpm')" #error "(e.g., 'libsdl-ttf1.2-devel.rpm')"
#error "---------------------------------------------------" #error "---------------------------------------------------"
#endif #endif
#endif
#ifndef NOSOUND #ifndef NOSOUND
#include "SDL_mixer.h" #include "SDL_mixer.h"
#ifndef _MIXER_H_ #if !defined(_SDL_MIXER_H) && !defined(_MIXER_H_)
#error "---------------------------------------------------" #error "---------------------------------------------------"
#error "If you installed SDL_mixer from a package, be sure" #error "If you installed SDL_mixer from a package, be sure"
#error "to get the development package, as well!" #error "to get the development package, as well!"
@ -389,7 +353,6 @@ static void win32_perror(const char * const str)
#endif #endif
#ifndef WIN32
#ifdef __GNUC__ #ifdef __GNUC__
// This version has strict type checking for safety. // This version has strict type checking for safety.
// See the "unnecessary" pointer comparison. (from Linux) // See the "unnecessary" pointer comparison. (from Linux)
@ -407,7 +370,6 @@ static void win32_perror(const char * const str)
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b))
#endif #endif
#endif
#define clamp(lo,value,hi) (min(max(value,lo),hi)) #define clamp(lo,value,hi) (min(max(value,lo),hi))
@ -718,25 +680,12 @@ static void set_current_language(void)
lang = LANG_EN; lang = LANG_EN;
#ifndef WIN32
loc = setlocale(LC_MESSAGES, NULL); loc = setlocale(LC_MESSAGES, NULL);
if (loc != NULL) if (loc != NULL)
{ {
if (strstr(loc, "LC_MESSAGES") != NULL) if (strstr(loc, "LC_MESSAGES") != NULL)
loc = getenv("LANG"); loc = getenv("LANG");
} }
#else
loc = getenv("LANGUAGE");
if (!loc)
{
loc = g_win32_getlocale();
if (loc)
{
snprintf(str, sizeof(str), "LANGUAGE=%s", loc);
putenv(strdup(str));
}
}
#endif
debug(loc); debug(loc);
@ -15123,7 +15072,7 @@ static int charsize(char c)
str[0] = c; str[0] = c;
str[1] = '\0'; str[1] = '\0';
TTF_SizeUNICODE(fonts[cur_font], str, &w, &h); TTF_SizeUNICODE(getfonthandle(cur_font), str, &w, &h);
return w; return w;
} }

View file

@ -23,9 +23,9 @@
/* Oct. 07, 2003 - added banding support */ /* Oct. 07, 2003 - added banding support */
/* - prints using 24-bit (not 32-bit) bitmap */ /* - prints using 24-bit (not 32-bit) bitmap */
#include <windows.h>
#include "SDL_syswm.h" #include "SDL_syswm.h"
#include "win32_print.h" #include "win32_print.h"
#include "resource.h"
#define NOREF(x) ((x)=(x)) #define NOREF(x) ((x)=(x))
@ -42,7 +42,7 @@ static PRINTDLG global_pd = {
0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF,
1, 1,
NULL, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
@ -96,10 +96,10 @@ static SDL_Surface *make24bitDIB( SDL_Surface *surf )
/* returns 0 if failed */ /* returns 0 if failed */
static int GetDefaultPrinterStrings(char *device, char *driver, char *output) static int GetDefaultPrinterStrings(char *device, char *driver, char *output)
{ {
const char *section = "windows";
const char *key = "device";
const char *def = "NODEFAULTPRINTER";
char buff[MAX_PATH]; char buff[MAX_PATH];
char *section = "windows";
char *key = "device";
char *def = "NODEFAULTPRINTER";
char *dev,*drv,*out; char *dev,*drv,*out;
if (!GetProfileString(section, key, def, buff, sizeof(buff))) if (!GetProfileString(section, key, def, buff, sizeof(buff)))
@ -278,7 +278,7 @@ int IsPrinterAvailable( void )
const char *SurfacePrint(SDL_Surface *surf, const char *printcfg, int showdialog) const char *SurfacePrint(SDL_Surface *surf, const char *printcfg, int showdialog)
{ {
char *res = NULL; const char *res = NULL;
HWND hWnd; HWND hWnd;
DOCINFO di; DOCINFO di;
int nError; int nError;
@ -357,12 +357,12 @@ const char *SurfacePrint( SDL_Surface *surf, const char *printcfg, int showdialo
res = "win32_print: failed to get window DC."; res = "win32_print: failed to get window DC.";
goto error; goto error;
} }
fLogPelsX1 = (float)GetDeviceCaps(hDCwindow, LOGPIXELSX); fLogPelsX1 = GetDeviceCaps(hDCwindow, LOGPIXELSX);
fLogPelsY1 = (float)GetDeviceCaps(hDCwindow, LOGPIXELSY); fLogPelsY1 = GetDeviceCaps(hDCwindow, LOGPIXELSY);
ReleaseDC(hWnd, hDCwindow); ReleaseDC(hWnd, hDCwindow);
fLogPelsX2 = (float)GetDeviceCaps(hDCprinter, LOGPIXELSX); fLogPelsX2 = GetDeviceCaps(hDCprinter, LOGPIXELSX);
fLogPelsY2 = (float)GetDeviceCaps(hDCprinter, LOGPIXELSY); fLogPelsY2 = GetDeviceCaps(hDCprinter, LOGPIXELSY);
if (fLogPelsX1 > fLogPelsX2) if (fLogPelsX1 > fLogPelsX2)
fScaleX = (fLogPelsX1/fLogPelsX2); fScaleX = (fLogPelsX1/fLogPelsX2);
@ -392,7 +392,7 @@ const char *SurfacePrint( SDL_Surface *surf, const char *printcfg, int showdialo
if (IsBandingRequired(hDCprinter)) if (IsBandingRequired(hDCprinter))
{ {
RECT rcBand = { 0 }; RECT rcBand = { 0, 0, 0, 0 };
RECT rcPrinter; RECT rcPrinter;
RECT rcImage; RECT rcImage;