diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2002-06-29 00:10:05 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2002-06-29 00:10:05 +0000 |
| commit | 2d30a9e6fa5f7a328c942fe7b0b68908339c9076 (patch) | |
| tree | 0727ed8801c736d52d6b8cf2ea7cb282af99f3ff | |
| parent | fb54e063066c11bfe8d4918bd68453c3b64a68db (diff) | |
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
| -rw-r--r-- | FL/math.h | 8 | ||||
| -rw-r--r-- | src/Fl_Pixmap.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Slider.cxx | 36 | ||||
| -rw-r--r-- | src/fl_call_main.c | 13 | ||||
| -rw-r--r-- | src/fl_dnd_win32.cxx | 26 | ||||
| -rw-r--r-- | src/fl_images_core.cxx | 8 | ||||
| -rwxr-xr-x | src/fl_set_fonts_win32.cxx | 12 | ||||
| -rw-r--r-- | src/forms_timer.cxx | 19 | ||||
| -rw-r--r-- | test/demo.cxx | 6 | ||||
| -rw-r--r-- | test/editor.cxx | 8 | ||||
| -rwxr-xr-x | test/tile.cxx | 6 |
11 files changed, 86 insertions, 62 deletions
@@ -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). // @@ -43,16 +43,16 @@ # include <float.h> # 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 copysign(double a, double b) {return b<0 ? -a : a;} -# endif // (WIN32 || CRAY) && !__MINGW32__ +# endif // (WIN32 || CRAY) && !__MINGW32__ && !__MWERKS__ #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 $". // diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 176d5293e..ab7308e75 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -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). // @@ -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; 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 $". // diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx index c1c1e0b22..5233c5c56 100644 --- a/src/Fl_Slider.cxx +++ b/src/Fl_Slider.cxx @@ -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). // @@ -226,20 +226,24 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) { int X = mx-offcenter; double v; - TRY_AGAIN: - if (X < 0) { - X = 0; - offcenter = mx; if (offcenter < 0) offcenter = 0; - } else if (X > (W-S)) { - X = W-S; - offcenter = mx-X; if (offcenter > S) offcenter = S; - } - v = round(X*(maximum()-minimum())/(W-S) + minimum()); - // make sure a click outside the sliderbar moves it: - if (event == FL_PUSH && v == value()) { - offcenter = S/2; - event = FL_DRAG; - goto TRY_AGAIN; + char tryAgain = 1; + while (tryAgain) + { + tryAgain = 0; + if (X < 0) { + X = 0; + offcenter = mx; if (offcenter < 0) offcenter = 0; + } else if (X > (W-S)) { + X = W-S; + offcenter = mx-X; if (offcenter > S) offcenter = S; + } + v = round(X*(maximum()-minimum())/(W-S) + minimum()); + // make sure a click outside the sliderbar moves it: + if (event == FL_PUSH && v == value()) { + offcenter = S/2; + event = FL_DRAG; + tryAgain = 1; + } } handle_drag(clamp(v)); } 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 $". // diff --git a/src/fl_call_main.c b/src/fl_call_main.c index 6867d0492..4aa26c026 100644 --- a/src/fl_call_main.c +++ b/src/fl_call_main.c @@ -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. * @@ -50,10 +50,15 @@ #include <stdio.h> #include <stdlib.h> +#ifdef __MWERKS__ +# include <crtl.h> +#endif + extern int main(int, char *[]); + #ifdef BORLAND5 -#define __argc _argc -#define __argv _argv +# define __argc _argc +# define __argv _argv #endif int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, @@ -85,6 +90,6 @@ static void dummy(void) {dummy();} #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 $". */ diff --git a/src/fl_dnd_win32.cxx b/src/fl_dnd_win32.cxx index 48d0231c1..92ad1aaa3 100644 --- a/src/fl_dnd_win32.cxx +++ b/src/fl_dnd_win32.cxx @@ -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). // @@ -82,7 +82,7 @@ public: delete this; 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; // 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) @@ -105,7 +105,7 @@ public: lastEffect = *pdwEffect; 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 ) { *pdwEffect = lastEffect; @@ -140,7 +140,7 @@ public: } 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 ) return S_OK; Fl_Window *target = fl_dnd_target_window; @@ -299,14 +299,14 @@ public: return DV_E_FORMATETC; } // all the following methods are not really needed for a DnD object - HRESULT STDMETHODCALLTYPE GetDataHere( FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { 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 EnumFormatEtc( DWORD dir, IEnumFORMATETC **ppenumFormatEtc) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE DAdvise( FORMATETC *pformatetc, DWORD advf, - IAdviseSink *pAdvSink, DWORD *pdwConnection) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE DUnadvise( DWORD dwConnection) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE EnumDAdvise( IEnumSTATDATA **ppenumAdvise) { 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 SetData( FORMATETC* /*pformatetc*/, STGMEDIUM* /*pmedium*/, BOOL /*fRelease*/) { return E_NOTIMPL; } + HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD /*dir*/, IEnumFORMATETC** /*ppenumFormatEtc*/) { return E_NOTIMPL; } + HRESULT STDMETHODCALLTYPE DAdvise( FORMATETC* /*pformatetc*/, DWORD /*advf*/, + IAdviseSink* /*pAdvSink*/, DWORD* /*pdwConnection*/) { return E_NOTIMPL; } + HRESULT STDMETHODCALLTYPE DUnadvise( DWORD /*dwConnection*/) { 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 $". // diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index 264a37ad9..d3cccd210 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -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. // @@ -68,6 +68,8 @@ fl_check_images(const char *name, // I - Filename #ifdef HAVE_LIBPNG if (memcmp(header, "\211PNG", 4) == 0) // PNG header return new Fl_PNG_Image(name); +#else + header = header; name = name; headerlen = headerlen; // avoid warnings #endif // HAVE_LIBPNG #ifdef HAVE_LIBJPEG @@ -75,6 +77,8 @@ fl_check_images(const char *name, // I - Filename header[3] >= 0xe0 && header[3] <= 0xef) // APPn return new Fl_JPEG_Image(name); +#else + header = header; name = name; headerlen = headerlen; // avoid warnings #endif // HAVE_LIBJPEG 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 $". // diff --git a/src/fl_set_fonts_win32.cxx b/src/fl_set_fonts_win32.cxx index 696710ea8..ac2395d6c 100755 --- a/src/fl_set_fonts_win32.cxx +++ b/src/fl_set_fonts_win32.cxx @@ -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). // @@ -52,8 +52,8 @@ static int fl_free_font = FL_FREE_FONT; static int CALLBACK enumcb(CONST LOGFONT *lpelf, - CONST TEXTMETRIC *lpntm, - DWORD FontType, + CONST TEXTMETRIC * /*lpntm*/, + DWORD /*FontType*/, LPARAM p) { if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1; const char *n = lpelf->lfFaceName; @@ -84,10 +84,10 @@ static int cyPerInch; static int sizes[128]; static int CALLBACK -EnumSizeCb(CONST LOGFONT *lpelf, +EnumSizeCb(CONST LOGFONT * /*lpelf*/, CONST TEXTMETRIC *lpntm, DWORD fontType, - LPARAM p) { + LPARAM /*p*/) { if ((fontType & RASTER_FONTTYPE) == 0) { sizes[0] = 0; 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 $". // diff --git a/src/forms_timer.cxx b/src/forms_timer.cxx index d1ee76388..983095e1f 100644 --- a/src/forms_timer.cxx +++ b/src/forms_timer.cxx @@ -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). // @@ -31,8 +31,12 @@ #include <FL/Fl_Timer.H> #include <FL/fl_draw.H> #ifdef WIN32 -# include <sys/types.h> -# include <sys/timeb.h> +# ifdef __MWERKS__ +# include <time.h> +# else +# include <sys/types.h> +# include <sys/timeb.h> +# endif #else # include <sys/time.h> #endif @@ -42,10 +46,17 @@ void fl_gettime(long* sec, long* usec) { #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; ftime(&tp); *sec = tp.time; *usec = tp.millitm * 1000; +# endif #else struct timeval tp; 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 $". // diff --git a/test/demo.cxx b/test/demo.cxx index 94739d16f..fa137a07e 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -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). // @@ -317,7 +317,7 @@ int main(int argc, char **argv) { create_the_forms(); char buf[256]; 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. fl_filename_setext( buf, "" ); 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 $". // diff --git a/test/editor.cxx b/test/editor.cxx index eb4c057b3..0f9a151e3 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -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). // @@ -314,8 +314,8 @@ void style_update(int pos, // I - Position of update int nInserted, // I - Number of inserted chars int nDeleted, // I - Number of deleted chars - int nRestyled, // I - Number of restyled chars - const char *deletedText, // I - Text that was deleted + int /*nRestyled*/, // I - Number of restyled chars + const char * /*deletedText*/, // I - Text that was deleted void *cbArg) { // I - Callback data int start, // Start 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 $". // diff --git a/test/tile.cxx b/test/tile.cxx index 51f46c78a..50ccf3d83 100755 --- a/test/tile.cxx +++ b/test/tile.cxx @@ -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). // @@ -40,7 +40,7 @@ int main(int argc, char** argv) { box0.align(FL_ALIGN_CLIP); Fl_Window w1(150,0,150,150,"1"); 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.color(19); 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 $". // |
