]> git.saurik.com Git - wxWidgets.git/commitdiff
OS/2 updates
authorDavid Webster <Dave.Webster@bhmi.com>
Fri, 30 Jul 1999 21:47:13 +0000 (21:47 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Fri, 30 Jul 1999 21:47:13 +0000 (21:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3219 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/spinbutt.h
include/wx/textfile.h
include/wx/utils.h
src/common/imagpng.cpp
src/common/textfile.cpp
src/common/timercmn.cpp
src/common/txtstrm.cpp
src/common/utilscmn.cpp

index 3a6feca894699aacefc99c9d420994a69474a98f..f28d46ce624a99e2e5bb5ec980c37c1eec55e76d 100644 (file)
@@ -107,10 +107,15 @@ public:
 typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
 
 // macros for handling spin events
+#ifndef EVT_SPIN_UP
 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
+#endif
+#ifndef EVT_SPIN_DOWN
 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
+#endif
+#ifndef EVT_SPIN
 #define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
+#endif
 
 #endif // wxUSE_SPINBTN
 
index a078a518bf208a7eedb6aba4a4f5cd04f2439dd7..84042ca0196f6f3591b36d626355044830513f9a 100644 (file)
@@ -41,7 +41,8 @@ enum wxTextFileType
     wxTextFileType_None,  // incomplete (the last line of the file only)
     wxTextFileType_Unix,  // line is terminated with 'LF' = 0xA = 10 = '\n'
     wxTextFileType_Dos,   //                         'CR' 'LF'
-    wxTextFileType_Mac    //                         'CR' = 0xD = 13 = '\r'
+    wxTextFileType_Mac,   //                         'CR' = 0xD = 13 = '\r'
+    wxTextFileType_Os2    //                         'CR' 'LF'
 };
 
 WX_DEFINE_ARRAY(wxTextFileType, ArrayFileType);
index 8ab3168cc9d493f0e1143c01dea2459407723a02..1349c6dda2ad587ba43f58a3e0f0cabbdf625767 100644 (file)
@@ -41,7 +41,7 @@ class WXDLLEXPORT wxProcess;
 class WXDLLEXPORT wxFrame;
 
 // FIXME should use wxStricmp() instead
-#ifdef __GNUWIN32__
+#if defined(__GNUWIN32__)
     #define stricmp strcasecmp
     #define strnicmp strncasecmp
 #endif
index b3b7482131b4d36f7b0cdc846f3d00a0624926e0..1b3a06663955197325bcd50795226113c0b2018f 100644 (file)
@@ -59,12 +59,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
 
 #if wxUSE_STREAMS
 
-static void _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
+#if defined(__VISAGECPP__)
+#define LINKAGEMODE _Optlink
+#else
+#define LINKAGEMODE
+#endif
+
+static void LINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
 {
     ((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
 }
 
-static void _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length )
+static void LINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length )
 {
     ((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length);
 }
@@ -73,56 +79,56 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
 {
     // VZ: as this function uses setjmp() the only fool proof error handling
     //     method is to use goto (setjmp is not really C++ dtors friendly...)
-    
+
     unsigned char **lines;
     unsigned int i;
     png_infop info_ptr = (png_infop) NULL;
-    
+
     image->Destroy();
-    
+
     png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
         (voidp) NULL,
         (png_error_ptr) NULL,
         (png_error_ptr) NULL );
     if (!png_ptr)
         goto error_nolines;
-    
+
     info_ptr = png_create_info_struct( png_ptr );
     if (!info_ptr)
         goto error_nolines;
-    
+
     if (setjmp(png_ptr->jmpbuf))
         goto error_nolines;
-    
+
     if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
         goto error_nolines;
-    
+
     png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
-    
+
     png_uint_32 width,height;
     int bit_depth,color_type,interlace_type;
-    
+
     png_read_info( png_ptr, info_ptr );
     png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, (int*) NULL, (int*) NULL );
-    
+
     if (color_type == PNG_COLOR_TYPE_PALETTE)
         png_set_expand( png_ptr );
-    
+
     png_set_strip_16( png_ptr );
     png_set_packing( png_ptr );
     if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS))
         png_set_expand( png_ptr );
     png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER );
-    
+
     image->Create( width, height );
-    
+
     if (!image->Ok())
         goto error_nolines;
-    
+
     lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
     if (lines == NULL)
         goto error_nolines;
-    
+
     for (i = 0; i < height; i++)
     {
         if ((lines[i] = (unsigned char *)malloc(width * (sizeof(unsigned char) * 4))) == NULL)
@@ -132,7 +138,7 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
             goto error;
         }
     }
-    
+
     // loaded successfully!
     {
         int transp = 0;
@@ -193,11 +199,11 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
                 }
             }
         }
-        
+
         for ( unsigned int j = 0; j < height; j++ )
             free( lines[j] );
         free( lines );
-        
+
         if (transp)
         {
             image->SetMaskColour( 255, 0, 255 );
@@ -207,24 +213,24 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
             image->SetMask( FALSE );
         }
     }
-    
+
     return TRUE;
 
  error_nolines:
     lines = NULL; // called from before it was set
  error:
     wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));
-    
+
     if ( image->Ok() )
     {
         image->Destroy();
     }
-    
+
     if ( lines )
     {
         free( lines );
     }
-    
+
     if ( png_ptr )
     {
         if ( info_ptr )
@@ -247,26 +253,26 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
         {
             return FALSE;
         }
-        
+
         png_infop info_ptr = png_create_info_struct(png_ptr);
         if (info_ptr == NULL)
         {
             png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
             return FALSE;
         }
-        
+
         if (setjmp(png_ptr->jmpbuf))
         {
             png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
             return FALSE;
         }
-        
+
         png_set_write_fn( png_ptr, &stream, _PNG_stream_writer, NULL);
-        
+
         png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), 8,
             PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
             PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
-        
+
         png_color_8 sig_bit;
         sig_bit.red = 8;
         sig_bit.green = 8;
@@ -276,14 +282,14 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
         png_write_info( png_ptr, info_ptr );
         png_set_shift( png_ptr, &sig_bit );
         png_set_packing( png_ptr );
-        
+
         unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 );
         if (!data)
         {
             png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
             return FALSE;
         }
-        
+
         for (int y = 0; y < image->GetHeight(); y++)
         {
             unsigned char *ptr = image->GetData() + (y * image->GetWidth() * 3);
@@ -306,7 +312,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
             png_bytep row_ptr = data;
             png_write_rows( png_ptr, &row_ptr, 1 );
         }
-        
+
         free(data);
         png_write_end( png_ptr, info_ptr );
         png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
@@ -314,9 +320,9 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
     return TRUE;
 }
 
-#endif 
+#endif
   // wxUSE_STREAMS
 
-#endif 
+#endif
   // wxUSE_LIBPNG
 
index b2a1c2afa755331738ee4d7f96386056e678929a..174cde4d304c13c3f41a521755f8cf3fb75a8718 100644 (file)
@@ -53,6 +53,8 @@ const wxTextFileType wxTextFile::typeDefault =
   wxTextFileType_Unix;
 #elif defined(__WXMAC__)
   wxTextFileType_Mac;
+#elif defined(__WXPM__)
+  wxTextFileType_Os2;
 #else
   wxTextFileType_None;
   #error  "wxTextFile: unsupported platform."
index fc09fd1313d28a431a6d1267b9cec4a8e6290b43..862c1c05f1fde81512188a42e070e40367680f40 100644 (file)
@@ -83,7 +83,7 @@ void wxStartTimer(void)
 #endif
   wxStartTime = 1000*tp.tv_sec + tp.tv_usec/1000;
 #elif (defined(__SC__) || defined(__SGI__) || defined(___BSDI__) || defined(__ALPHA__) || \
-       defined(__MINGW32__) || defined(__MWERKS__) || defined(__FreeBSD__) ) 
+       defined(__MINGW32__) || defined(__MWERKS__) || defined(__FreeBSD__) )
   time_t t0;
   struct tm *tp;
   time(&t0);
@@ -136,7 +136,7 @@ long wxGetElapsedTime(bool resetTimer)
 #ifndef __VMS__
 bool wxGetLocalTime(long *timeZone, int *dstObserved)
 {
-#if defined(__MINGW32__) 
+#if defined(__MINGW32__)
   time_t t0;
   struct tm *tp;
   time(&t0);
@@ -157,38 +157,41 @@ bool wxGetLocalTime(long *timeZone, int *dstObserved)
   *dstObserved = tp->tm_isdst;
 #else
 
-#if (((defined(__SYSV__) && !defined(__HPUX__)) || defined(__MSDOS__) || defined(__WXMSW__)) \
+#if (((defined(__SYSV__) && !defined(__HPUX__)) || defined(__MSDOS__) || defined(__WXMSW__) || defined(__WXPM__)) \
    && !defined(__GNUWIN32__) && !defined(__MWERKS__) )
-#if defined(__BORLANDC__)
+#  if defined(__BORLANDC__)
   /* Borland uses underscores */
   *timeZone = _timezone;
   *dstObserved = _daylight;
-#elif defined(__SALFORDC__)
+#  elif defined(__SALFORDC__)
   *timeZone = _timezone;
   *dstObserved = daylight;
-#else
+#  elif defined(__VISAGECPP__)
+  *timeZone = _timezone;
+  *dstObserved = daylight;
+#  else
   *timeZone = timezone;
   *dstObserved = daylight;
-#endif
+#  endif
 #elif defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) || defined(__MWERKS__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) // || defined(__AIXV3__)
-#ifndef __MWERKS__ // shouldn't this be one scope below ?
+#  ifndef __MWERKS__ // shouldn't this be one scope below ?
   struct timeval tp;
-#endif 
-#if defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32))
+#  endif
+#  if defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32))
   struct timezone tz;
   gettimeofday(&tp, &tz);
   *timeZone = 60*(tz.tz_minuteswest);
   *dstObserved = tz.tz_dsttime;
-#else
+#  else
   time_t t0;
   struct tm *tp;
   time(&t0);
   tp = localtime(&t0);
-#ifndef __MWERKS__
+#  ifndef __MWERKS__
   *timeZone = tp->tm_gmtoff; // ???
-#else
+#  else
   *timeZone = 0 ;
-#endif
+#  endif
   *dstObserved = tp->tm_isdst;
 #endif
 #elif defined(__WXSTUBS__)
index e4d260bcf19c43cf444c16dae43f45bdd6ee4661..70ca315e43d15ca2e33284c23989344279f66d17 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     28/06/98
 // RCS-ID:      $Id$
-// Copyright:   (c) Guilhem Lavaux 
+// Copyright:   (c) Guilhem Lavaux
 // Licence:    wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
@@ -55,7 +55,7 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
         c = m_input->GetC();
        if (!m_input) return (wxChar) 0;
        
-       if (c != _T('\n') && 
+       if (c != _T('\n') &&
            c != _T('\r') &&
            c != _T('\t') &&
            c != _T(' '))
@@ -63,7 +63,7 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
            return c;
        }
     }
-    
+
     // this shouldn't happen
     return (wxChar) 0;
 }
@@ -71,11 +71,11 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
 void wxTextInputStream::SkipIfEndOfLine( wxChar c )
 {
     if (c == _T('\n'))
-    { 
+    {
         // eat on UNIX
        return;
     }
-    
+
     if (c == _T('\r'))
     {
         // eat on both Mac and DOS
@@ -84,7 +84,7 @@ void wxTextInputStream::SkipIfEndOfLine( wxChar c )
         if (!m_input) return;
        
         if (c2 == _T('\n'))
-        {  
+        {
            // eat on DOS
            return;
        }
@@ -106,32 +106,32 @@ wxUint32 wxTextInputStream::Read32()
     /* I only implemented a simple integer parser */
     int sign;
     wxInt32 i;
-    
+
     int c = NextNonWhiteSpace();
     if (!m_input) return 0;
 
     i = 0;
-    if (! (c == _T('-') || c == _T('+') || isdigit(c)) ) 
+    if (! (c == _T('-') || c == _T('+') || isdigit(c)) )
     {
         m_input->Ungetch(c);
         return 0;
     }
 
-    if (c == _T('-')) 
+    if (c == _T('-'))
     {
         sign = -1;
         c = m_input->GetC();
-    } else 
-    if (c == _T('+')) 
+    } else
+    if (c == _T('+'))
     {
         sign = 1;
         c = m_input->GetC();
-    } else 
+    } else
     {
         sign = 1;
     }
 
-    while (isdigit(c)) 
+    while (isdigit(c))
     {
         i = i*10 + (c - (int)_T('0'));
         c = m_input->GetC();
@@ -164,54 +164,54 @@ double wxTextInputStream::ReadDouble()
     if (!m_input) return 0.0;
 
     f = 0.0;
-    if (! (c == _T('.') || c == _T('-') || c == _T('+') || isdigit(c)) ) 
+    if (! (c == _T('.') || c == _T('-') || c == _T('+') || isdigit(c)) )
     {
         m_input->Ungetch(c);
         return 0.0;
     }
 
-    if (c == _T('-')) 
+    if (c == _T('-'))
     {
         sign = -1;
         c = m_input->GetC();
-    } else 
-    if (c == _T('+')) 
+    } else
+    if (c == _T('+'))
     {
         sign = 1;
         c = m_input->GetC();
-    } 
-    else 
+    }
+    else
     {
         sign = 1;
     }
 
-    while (isdigit(c)) 
+    while (isdigit(c))
     {
         f = f*10 + (c - _T('0'));
         c = m_input->GetC();
     }
 
-    if (c == _T('.')) 
+    if (c == _T('.'))
     {
         double f_multiplicator = (double) 0.1;
 
         c = m_input->GetC();
 
-        while (isdigit(c)) 
+        while (isdigit(c))
        {
             f += (c-_T('0'))*f_multiplicator;
             f_multiplicator /= 10;
             c = m_input->GetC();
         }
 
-        if (c == _T('e')) 
+        if (c == _T('e'))
        {
             double f_multiplicator = 0.0;
             int i, e;
 
             c = m_input->GetC();
 
-            switch (c) 
+            switch (c)
            {
                 case _T('-'): f_multiplicator = 0.1;  break;
                case _T('+'): f_multiplicator = 10.0; break;
@@ -221,7 +221,7 @@ double wxTextInputStream::ReadDouble()
 
             for (i=0;i<e;i++)
                 f *= f_multiplicator;
-        } 
+        }
        else
            SkipIfEndOfLine( c );
     }
@@ -240,7 +240,7 @@ wxString wxTextInputStream::ReadString()
     wxChar c;
     wxString line;
 
-    for (;;) 
+    for (;;)
     {
         c = m_input->GetC();
         if (!m_input) break;
@@ -254,12 +254,12 @@ wxString wxTextInputStream::ReadString()
         if (c == _T('\r'))
         {
             // eat on both Mac and DOS
-           
+       
             wxChar c2 = m_input->GetC();
            if (!m_input) break;
-           
+       
            if (c2 == _T('\n'))
-            {  
+            {
                // eat on DOS
                break;
            }
@@ -273,10 +273,10 @@ wxString wxTextInputStream::ReadString()
        
         line += c;
     }
-    
+
     return line;
 }
-  
+
 wxTextInputStream& wxTextInputStream::operator>>(wxString& line)
 {
   line = ReadString();
@@ -291,13 +291,13 @@ wxTextInputStream& wxTextInputStream::operator>>(wxChar& c)
         c = (wxChar) 0;
         return *this;
     }
-    
+
     if (c1 == _T('\r'))
     {
         c = _T('\n');
         wxChar c2 = m_input->GetC();
        if (!m_input) return *this;
-           
+       
        if (c2 != _T('\n'))
        {
            // we are on a Mac
@@ -308,7 +308,7 @@ wxTextInputStream& wxTextInputStream::operator>>(wxChar& c)
     {
         c = c1;
     }
-    
+
     return *this;
 }
 
@@ -361,7 +361,7 @@ void wxTextOutputStream::Write32(wxUint32 i)
 {
     wxString str;
     str.Printf(_T("%u"), i);
-    
+
     WriteString(str);
 }
 
@@ -369,7 +369,7 @@ void wxTextOutputStream::Write16(wxUint16 i)
 {
     wxString str;
     str.Printf(_T("%u"), i);
-    
+
     WriteString(str);
 }
 
@@ -377,7 +377,7 @@ void wxTextOutputStream::Write8(wxUint8 i)
 {
     wxString str;
     str.Printf(_T("%u"), i);
-    
+
     WriteString(str);
 }
 
@@ -407,6 +407,11 @@ void wxTextOutputStream::WriteString(const wxString& string)
 #elif defined(__WXMAC__)
             c = _T('\r');
             m_output->Write( (const void*)(&c), sizeof(wxChar) );
+#elif   defined(__OS2__)
+            c = _T('\r');
+            m_output->Write( (const void*)(&c), sizeof(wxChar) );
+            c = _T('\n');
+            m_output->Write( (const void*)(&c), sizeof(wxChar) );
 #else
             #error  "wxTextOutputStream: unsupported platform."
 #endif
index 4b6e87cbce6b3cb833e1c02acf1973ef5c4d0cfe..08eed2a299b45a68c5579d139c8a822df147c7d9 100644 (file)
@@ -177,6 +177,10 @@ extern "C"
 #endif
 #endif  /* __WXMSW__ */
 
+#ifdef __WXPM__
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#endif
 
 wxChar *
 copystring (const wxChar *s)