Small changes to make Metrowerks CodeWarrior for Windows work.

See seperate posting with CodeWarrior project file.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2334 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2002-06-29 00:10:05 +00:00
parent fb54e06306
commit 2d30a9e6fa
11 changed files with 86 additions and 62 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: math.h,v 1.4.2.4.2.2 2002/06/27 20:52:44 easysw Exp $" // "$Id: math.h,v 1.4.2.4.2.3 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// Math header file for the Fast Light Tool Kit (FLTK). // Math header file for the Fast Light Tool Kit (FLTK).
// //
@@ -43,16 +43,16 @@
# include <float.h> # include <float.h>
# endif # endif
# if (defined(WIN32) || defined(CRAY)) && !__MINGW32__ # if (defined(WIN32) || defined(CRAY)) && !__MINGW32__ && !__MWERKS__
inline double rint(double v) {return floor(v+.5);} inline double rint(double v) {return floor(v+.5);}
inline double copysign(double a, double b) {return b<0 ? -a : a;} inline double copysign(double a, double b) {return b<0 ? -a : a;}
# endif // (WIN32 || CRAY) && !__MINGW32__ # endif // (WIN32 || CRAY) && !__MINGW32__ && !__MWERKS__
#endif // !fl_math_h #endif // !fl_math_h
// //
// End of "$Id: math.h,v 1.4.2.4.2.2 2002/06/27 20:52:44 easysw Exp $". // End of "$Id: math.h,v 1.4.2.4.2.3 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $" // "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.19 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@@ -294,7 +294,7 @@ Fl_Image *Fl_Pixmap::copy(int W, int H) {
} }
} }
new_image = new Fl_Pixmap(new_data); new_image = new Fl_Pixmap((char*const*)new_data);
new_image->alloc_data = 1; new_image->alloc_data = 1;
return new_image; return new_image;
@@ -465,5 +465,5 @@ void Fl_Pixmap::desaturate() {
} }
// //
// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $". // End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.19 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+8 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.7 2002/05/24 14:19:19 easysw Exp $" // "$Id: Fl_Slider.cxx,v 1.8.2.10.2.8 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// Slider widget for the Fast Light Tool Kit (FLTK). // Slider widget for the Fast Light Tool Kit (FLTK).
// //
@@ -226,7 +226,10 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
int X = mx-offcenter; int X = mx-offcenter;
double v; double v;
TRY_AGAIN: char tryAgain = 1;
while (tryAgain)
{
tryAgain = 0;
if (X < 0) { if (X < 0) {
X = 0; X = 0;
offcenter = mx; if (offcenter < 0) offcenter = 0; offcenter = mx; if (offcenter < 0) offcenter = 0;
@@ -239,7 +242,8 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
if (event == FL_PUSH && v == value()) { if (event == FL_PUSH && v == value()) {
offcenter = S/2; offcenter = S/2;
event = FL_DRAG; event = FL_DRAG;
goto TRY_AGAIN; tryAgain = 1;
}
} }
handle_drag(clamp(v)); handle_drag(clamp(v));
} return 1; } return 1;
@@ -291,5 +295,5 @@ int Fl_Slider::handle(int event) {
} }
// //
// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.7 2002/05/24 14:19:19 easysw Exp $". // End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.8 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+7 -2
View File
@@ -1,5 +1,5 @@
/* /*
* "$Id: fl_call_main.c,v 1.1.2.11.2.1 2002/01/01 15:11:32 easysw Exp $" * "$Id: fl_call_main.c,v 1.1.2.11.2.2 2002/06/29 00:10:04 matthiaswm Exp $"
* *
* Copyright 1998-2002 by Bill Spitzak and others. * Copyright 1998-2002 by Bill Spitzak and others.
* *
@@ -50,7 +50,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef __MWERKS__
# include <crtl.h>
#endif
extern int main(int, char *[]); extern int main(int, char *[]);
#ifdef BORLAND5 #ifdef BORLAND5
# define __argc _argc # define __argc _argc
# define __argv _argv # define __argv _argv
@@ -85,6 +90,6 @@ static void dummy(void) {dummy();}
#endif #endif
/* /*
* End of "$Id: fl_call_main.c,v 1.1.2.11.2.1 2002/01/01 15:11:32 easysw Exp $". * End of "$Id: fl_call_main.c,v 1.1.2.11.2.2 2002/06/29 00:10:04 matthiaswm Exp $".
*/ */
+13 -13
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_dnd_win32.cxx,v 1.5.2.11 2002/06/07 16:37:48 easysw Exp $" // "$Id: fl_dnd_win32.cxx,v 1.5.2.12 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// Drag & Drop code for the Fast Light Tool Kit (FLTK). // Drag & Drop code for the Fast Light Tool Kit (FLTK).
// //
@@ -82,7 +82,7 @@ public:
delete this; delete this;
return nTemp; return nTemp;
} }
HRESULT STDMETHODCALLTYPE DragEnter( IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { HRESULT STDMETHODCALLTYPE DragEnter( IDataObject *pDataObj, DWORD /*grfKeyState*/, POINTL pt, DWORD *pdwEffect) {
if( !pDataObj ) return E_INVALIDARG; if( !pDataObj ) return E_INVALIDARG;
// set e_modifiers here from grfKeyState, set e_x and e_root_x // set e_modifiers here from grfKeyState, set e_x and e_root_x
// check if FLTK handles this drag and return if it can't (i.e. BMP drag without filename) // check if FLTK handles this drag and return if it can't (i.e. BMP drag without filename)
@@ -105,7 +105,7 @@ public:
lastEffect = *pdwEffect; lastEffect = *pdwEffect;
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE DragOver( DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { HRESULT STDMETHODCALLTYPE DragOver( DWORD /*grfKeyState*/, POINTL pt, DWORD *pdwEffect) {
if ( px==pt.x && py==pt.y ) if ( px==pt.x && py==pt.y )
{ {
*pdwEffect = lastEffect; *pdwEffect = lastEffect;
@@ -140,7 +140,7 @@ public:
} }
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE Drop( IDataObject *data, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { HRESULT STDMETHODCALLTYPE Drop( IDataObject *data, DWORD /*grfKeyState*/, POINTL pt, DWORD* /*pdwEffect*/) {
if ( !fl_dnd_target_window ) if ( !fl_dnd_target_window )
return S_OK; return S_OK;
Fl_Window *target = fl_dnd_target_window; Fl_Window *target = fl_dnd_target_window;
@@ -299,14 +299,14 @@ public:
return DV_E_FORMATETC; return DV_E_FORMATETC;
} }
// all the following methods are not really needed for a DnD object // all the following methods are not really needed for a DnD object
HRESULT STDMETHODCALLTYPE GetDataHere( FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE GetDataHere( FORMATETC* /*pformatetcIn*/, STGMEDIUM* /*pmedium*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc( FORMATETC *in, FORMATETC *out) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc( FORMATETC* /*in*/, FORMATETC* /*out*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE SetData( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE SetData( FORMATETC* /*pformatetc*/, STGMEDIUM* /*pmedium*/, BOOL /*fRelease*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD dir, IEnumFORMATETC **ppenumFormatEtc) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD /*dir*/, IEnumFORMATETC** /*ppenumFormatEtc*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE DAdvise( FORMATETC *pformatetc, DWORD advf, HRESULT STDMETHODCALLTYPE DAdvise( FORMATETC* /*pformatetc*/, DWORD /*advf*/,
IAdviseSink *pAdvSink, DWORD *pdwConnection) { return E_NOTIMPL; } IAdviseSink* /*pAdvSink*/, DWORD* /*pdwConnection*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE DUnadvise( DWORD dwConnection) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE DUnadvise( DWORD /*dwConnection*/) { return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE EnumDAdvise( IEnumSTATDATA **ppenumAdvise) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE EnumDAdvise( IEnumSTATDATA** /*ppenumAdvise*/) { return E_NOTIMPL; }
}; };
@@ -349,5 +349,5 @@ int Fl::dnd()
// //
// End of "$Id: fl_dnd_win32.cxx,v 1.5.2.11 2002/06/07 16:37:48 easysw Exp $". // End of "$Id: fl_dnd_win32.cxx,v 1.5.2.12 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+6 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_images_core.cxx,v 1.1.2.1 2002/06/28 21:19:42 easysw Exp $" // "$Id: fl_images_core.cxx,v 1.1.2.2 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// FLTK images library core. // FLTK images library core.
// //
@@ -68,6 +68,8 @@ fl_check_images(const char *name, // I - Filename
#ifdef HAVE_LIBPNG #ifdef HAVE_LIBPNG
if (memcmp(header, "\211PNG", 4) == 0) // PNG header if (memcmp(header, "\211PNG", 4) == 0) // PNG header
return new Fl_PNG_Image(name); return new Fl_PNG_Image(name);
#else
header = header; name = name; headerlen = headerlen; // avoid warnings
#endif // HAVE_LIBPNG #endif // HAVE_LIBPNG
#ifdef HAVE_LIBJPEG #ifdef HAVE_LIBJPEG
@@ -75,6 +77,8 @@ fl_check_images(const char *name, // I - Filename
header[3] >= 0xe0 && header[3] <= 0xef) header[3] >= 0xe0 && header[3] <= 0xef)
// APPn // APPn
return new Fl_JPEG_Image(name); return new Fl_JPEG_Image(name);
#else
header = header; name = name; headerlen = headerlen; // avoid warnings
#endif // HAVE_LIBJPEG #endif // HAVE_LIBJPEG
return 0; return 0;
@@ -82,5 +86,5 @@ fl_check_images(const char *name, // I - Filename
// //
// End of "$Id: fl_images_core.cxx,v 1.1.2.1 2002/06/28 21:19:42 easysw Exp $". // End of "$Id: fl_images_core.cxx,v 1.1.2.2 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+6 -6
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.6 2002/04/01 15:42:17 easysw Exp $" // "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.7 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// WIN32 font utilities for the Fast Light Tool Kit (FLTK). // WIN32 font utilities for the Fast Light Tool Kit (FLTK).
// //
@@ -52,8 +52,8 @@ static int fl_free_font = FL_FREE_FONT;
static int CALLBACK static int CALLBACK
enumcb(CONST LOGFONT *lpelf, enumcb(CONST LOGFONT *lpelf,
CONST TEXTMETRIC *lpntm, CONST TEXTMETRIC * /*lpntm*/,
DWORD FontType, DWORD /*FontType*/,
LPARAM p) { LPARAM p) {
if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1; if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
const char *n = lpelf->lfFaceName; const char *n = lpelf->lfFaceName;
@@ -84,10 +84,10 @@ static int cyPerInch;
static int sizes[128]; static int sizes[128];
static int CALLBACK static int CALLBACK
EnumSizeCb(CONST LOGFONT *lpelf, EnumSizeCb(CONST LOGFONT * /*lpelf*/,
CONST TEXTMETRIC *lpntm, CONST TEXTMETRIC *lpntm,
DWORD fontType, DWORD fontType,
LPARAM p) { LPARAM /*p*/) {
if ((fontType & RASTER_FONTTYPE) == 0) { if ((fontType & RASTER_FONTTYPE) == 0) {
sizes[0] = 0; sizes[0] = 0;
nbSize = 1; nbSize = 1;
@@ -135,5 +135,5 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
// //
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.6 2002/04/01 15:42:17 easysw Exp $". // End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.7 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+13 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: forms_timer.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $" // "$Id: forms_timer.cxx,v 1.4.2.3.2.2 2002/06/29 00:10:04 matthiaswm Exp $"
// //
// Forms timer object for the Fast Light Tool Kit (FLTK). // Forms timer object for the Fast Light Tool Kit (FLTK).
// //
@@ -31,8 +31,12 @@
#include <FL/Fl_Timer.H> #include <FL/Fl_Timer.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#ifdef WIN32 #ifdef WIN32
# ifdef __MWERKS__
# include <time.h>
# else
# include <sys/types.h> # include <sys/types.h>
# include <sys/timeb.h> # include <sys/timeb.h>
# endif
#else #else
# include <sys/time.h> # include <sys/time.h>
#endif #endif
@@ -42,10 +46,17 @@
void fl_gettime(long* sec, long* usec) { void fl_gettime(long* sec, long* usec) {
#ifdef WIN32 #ifdef WIN32
# ifdef __MWERKS__
time_t localTime = time(NULL);
struct tm *now = localtime(&localTime);
*sec = now->tm_sec + 60*now->tm_min + 3600*now->tm_hour + 24*3600*now->tm_yday;
*usec = 0;
# else
struct timeb tp; struct timeb tp;
ftime(&tp); ftime(&tp);
*sec = tp.time; *sec = tp.time;
*usec = tp.millitm * 1000; *usec = tp.millitm * 1000;
# endif
#else #else
struct timeval tp; struct timeval tp;
struct timezone tzp; struct timezone tzp;
@@ -150,5 +161,5 @@ void Fl_Timer::suspended(char d) {
} }
// //
// End of "$Id: forms_timer.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $". // End of "$Id: forms_timer.cxx,v 1.4.2.3.2.2 2002/06/29 00:10:04 matthiaswm Exp $".
// //
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: demo.cxx,v 1.8.2.5.2.6 2002/03/25 21:08:42 easysw Exp $" // "$Id: demo.cxx,v 1.8.2.5.2.7 2002/06/29 00:10:05 matthiaswm Exp $"
// //
// Main demo program for the Fast Light Tool Kit (FLTK). // Main demo program for the Fast Light Tool Kit (FLTK).
// //
@@ -317,7 +317,7 @@ int main(int argc, char **argv) {
create_the_forms(); create_the_forms();
char buf[256]; char buf[256];
strcpy(buf, argv[0]); strcpy(buf, argv[0]);
#if defined _MSC_VER && defined _DEBUG #if ( defined _MSC_VER || defined __MWERKS__ ) && defined _DEBUG
// MS_VisualC appends a 'd' to debugging executables. remove it. // MS_VisualC appends a 'd' to debugging executables. remove it.
fl_filename_setext( buf, "" ); fl_filename_setext( buf, "" );
buf[ strlen(buf)-1 ] = 0; buf[ strlen(buf)-1 ] = 0;
@@ -340,6 +340,6 @@ int main(int argc, char **argv) {
} }
// //
// End of "$Id: demo.cxx,v 1.8.2.5.2.6 2002/03/25 21:08:42 easysw Exp $". // End of "$Id: demo.cxx,v 1.8.2.5.2.7 2002/06/29 00:10:05 matthiaswm Exp $".
// //
+4 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: editor.cxx,v 1.2.2.3.2.10 2002/06/10 21:04:20 easysw Exp $" // "$Id: editor.cxx,v 1.2.2.3.2.11 2002/06/29 00:10:05 matthiaswm Exp $"
// //
// A simple text editor program for the Fast Light Tool Kit (FLTK). // A simple text editor program for the Fast Light Tool Kit (FLTK).
// //
@@ -314,8 +314,8 @@ void
style_update(int pos, // I - Position of update style_update(int pos, // I - Position of update
int nInserted, // I - Number of inserted chars int nInserted, // I - Number of inserted chars
int nDeleted, // I - Number of deleted chars int nDeleted, // I - Number of deleted chars
int nRestyled, // I - Number of restyled chars int /*nRestyled*/, // I - Number of restyled chars
const char *deletedText, // I - Text that was deleted const char * /*deletedText*/, // I - Text that was deleted
void *cbArg) { // I - Callback data void *cbArg) { // I - Callback data
int start, // Start of text int start, // Start of text
end; // End of text end; // End of text
@@ -758,5 +758,5 @@ int main(int argc, char **argv) {
} }
// //
// End of "$Id: editor.cxx,v 1.2.2.3.2.10 2002/06/10 21:04:20 easysw Exp $". // End of "$Id: editor.cxx,v 1.2.2.3.2.11 2002/06/29 00:10:05 matthiaswm Exp $".
// //
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: tile.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:33 easysw Exp $" // "$Id: tile.cxx,v 1.4.2.3.2.2 2002/06/29 00:10:05 matthiaswm Exp $"
// //
// Tile test program for the Fast Light Tool Kit (FLTK). // Tile test program for the Fast Light Tool Kit (FLTK).
// //
@@ -40,7 +40,7 @@ int main(int argc, char** argv) {
box0.align(FL_ALIGN_CLIP); box0.align(FL_ALIGN_CLIP);
Fl_Window w1(150,0,150,150,"1"); Fl_Window w1(150,0,150,150,"1");
w1.box(FL_NO_BOX); w1.box(FL_NO_BOX);
Fl_Box box1(0,0,150,150,"1\nThis is a\nchild\nX window"); Fl_Box box1(0,0,150,150,"1\nThis is a\nchild\nwindow");
box1.box(FL_DOWN_BOX); box1.box(FL_DOWN_BOX);
box1.color(19); box1.color(19);
box1.labelsize(18); box1.labelsize(18);
@@ -86,5 +86,5 @@ int main(int argc, char** argv) {
} }
// //
// End of "$Id: tile.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:33 easysw Exp $". // End of "$Id: tile.cxx,v 1.4.2.3.2.2 2002/06/29 00:10:05 matthiaswm Exp $".
// //