More SC++ fixes; HelpGen starting to compile with VC++; image sample now compiles/runs

with VC++


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-01-09 20:18:06 +00:00
parent 687d733769
commit 3d05544e4e
27 changed files with 345 additions and 122 deletions

View File

@@ -36,7 +36,7 @@ zip32 -@ %dest\wx200cw.zip < %src\distrib\msw\cw.rsp
zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp
rem Tex2RTF rem Tex2RTF
zip32 -@ %dest\tex2rtf.zip < %src\distrib\msw\tex2rtf.rsp zip32 -@ %dest\tex2rtf2.zip < %src\distrib\msw\tex2rtf.rsp
copy %src\docs\changes.txt %dest copy %src\docs\changes.txt %dest
copy %src\docs\msw\install.txt %dest\install_msw.txt copy %src\docs\msw\install.txt %dest\install_msw.txt

View File

@@ -41,6 +41,12 @@ image, using Borland Image Editor. WIN16 doesn't have a function
for specifying which image to use, so the larger one gets used for specifying which image to use, so the larger one gets used
erroneously. erroneously.
Add headers to VC++ project files.
Test GLCanvas.
Distribution naming?
LOW PRIORITY (MEDIUM TERM) LOW PRIORITY (MEDIUM TERM)
-------------------------- --------------------------

View File

@@ -18,6 +18,7 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/string.h" #include "wx/string.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/stream.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
@@ -43,8 +44,8 @@ class WXDLLEXPORT wxImageHandler: public wxObject
public: public:
wxImageHandler() { m_name = ""; m_extension = ""; m_type = 0; } wxImageHandler() { m_name = ""; m_extension = ""; m_type = 0; }
virtual bool LoadFile( wxImage *image, const wxString& name ); virtual bool LoadFile( wxImage *image, wxInputStream& stream );
virtual bool SaveFile( wxImage *image, const wxString& name ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
inline void SetName(const wxString& name) { m_name = name; } inline void SetName(const wxString& name) { m_name = name; }
inline void SetExtension(const wxString& ext) { m_extension = ext; } inline void SetExtension(const wxString& ext) { m_extension = ext; }
@@ -78,8 +79,8 @@ public:
m_type = wxBITMAP_TYPE_PNG; m_type = wxBITMAP_TYPE_PNG;
}; };
virtual bool LoadFile( wxImage *image, const wxString& name ); virtual bool LoadFile( wxImage *image, wxInputStream& stream );
virtual bool SaveFile( wxImage *image, const wxString& name ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
}; };
#endif #endif
@@ -100,7 +101,7 @@ public:
m_type = wxBITMAP_TYPE_BMP; m_type = wxBITMAP_TYPE_BMP;
}; };
virtual bool LoadFile( wxImage *image, const wxString& name ); virtual bool LoadFile( wxImage *image, wxInputStream& stream );
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -118,6 +119,7 @@ public:
wxImage(); wxImage();
wxImage( int width, int height ); wxImage( int width, int height );
wxImage( const wxString& name, long type = wxBITMAP_TYPE_PNG ); wxImage( const wxString& name, long type = wxBITMAP_TYPE_PNG );
wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_PNG );
wxImage( const wxImage& image ); wxImage( const wxImage& image );
wxImage( const wxImage* image ); wxImage( const wxImage* image );
@@ -138,7 +140,9 @@ public:
unsigned char GetBlue( int x, int y ); unsigned char GetBlue( int x, int y );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG ); virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_PNG );
virtual bool SaveFile( const wxString& name, int type ); virtual bool SaveFile( const wxString& name, int type );
virtual bool SaveFile( wxOutputStream& stream, int type );
bool Ok() const; bool Ok() const;
int GetWidth() const; int GetWidth() const;

View File

@@ -7,7 +7,17 @@
* *
*/ */
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif
#include "wx/image.h" #include "wx/image.h"
// derived classes // derived classes
@@ -77,6 +87,8 @@ END_EVENT_TABLE()
MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, const wxSize &size ) MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER ) : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
{ {
SetBackgroundColour(* wxWHITE);
wxBitmap bitmap( 100, 100 ); wxBitmap bitmap( 100, 100 );
wxMemoryDC dc; wxMemoryDC dc;
@@ -85,14 +97,20 @@ MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, c
dc.SetPen( *wxWHITE_PEN ); dc.SetPen( *wxWHITE_PEN );
dc.DrawRectangle( 0, 0, 100, 100 ); dc.DrawRectangle( 0, 0, 100, 100 );
dc.SelectObject( wxNullBitmap ); dc.SelectObject( wxNullBitmap );
wxString dir("");
#ifdef __WXGTK__
dir = wxString("../");
#endif
wxImage image( bitmap ); wxImage image( bitmap );
image.SaveFile( "../test.png", wxBITMAP_TYPE_PNG ); image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
image.LoadFile( "../horse.png", wxBITMAP_TYPE_PNG ); image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG );
my_horse = new wxBitmap( image.ConvertToBitmap() ); my_horse = new wxBitmap( image.ConvertToBitmap() );
image.LoadFile( "../test.png", wxBITMAP_TYPE_PNG ); image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
my_square = new wxBitmap( image.ConvertToBitmap() ); my_square = new wxBitmap( image.ConvertToBitmap() );
} }
@@ -140,8 +158,7 @@ MyFrame::MyFrame(void) :
wxMenuBar *menu_bar = new wxMenuBar(); wxMenuBar *menu_bar = new wxMenuBar();
menu_bar->Append(file_menu, "File"); menu_bar->Append(file_menu, "File");
menu_bar->Show( TRUE );
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
CreateStatusBar(2); CreateStatusBar(2);
@@ -166,7 +183,8 @@ void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
int w,h; int w,h;
GetClientSize( &w, &h ); GetClientSize( &w, &h );
m_canvas->SetSize( w, h ); if (m_canvas)
m_canvas->SetSize( w, h );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -188,7 +206,3 @@ bool MyApp::OnInit(void)
return TRUE; return TRUE;
} }

3
samples/image/image.rc Normal file
View File

@@ -0,0 +1,3 @@
/* mondrian ICON "mondrian.ico" */
#include "wx/msw/wx.rc"

64
samples/image/makefile.nt Normal file
View File

@@ -0,0 +1,64 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds image example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
WXUSINGDLL=0
!include $(WXDIR)\src\ntwxwin.mak
THISDIR = $(WXDIR)\samples\image
PROGRAM=image
OBJECTS = $(PROGRAM).obj
$(PROGRAM): $(PROGRAM).exe
all: wx $(PROGRAM).exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.nt clean
cd $(THISDIR)
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb

View File

@@ -26,6 +26,7 @@
#include "../png/png.h" #include "../png/png.h"
#endif #endif
#include "wx/filefn.h" #include "wx/filefn.h"
#include "wx/wfstream.h"
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> #include <windows.h>
@@ -91,6 +92,11 @@ wxImage::wxImage( const wxString& name, long type )
LoadFile( name, type ); LoadFile( name, type );
} }
wxImage::wxImage( wxInputStream& stream, long type )
{
LoadFile( stream, type );
}
wxImage::wxImage( const wxImage& image ) wxImage::wxImage( const wxImage& image )
{ {
Ref(image); Ref(image);
@@ -296,15 +302,23 @@ int wxImage::GetHeight() const
bool wxImage::LoadFile( const wxString& filename, long type ) bool wxImage::LoadFile( const wxString& filename, long type )
{ {
UnRef(); if (wxFileExists(filename))
if (!wxFileExists(filename))
{ {
wxFileInputStream stream(filename);
return LoadFile(stream, type);
}
else {
wxLogWarning( "Image file does not exist." ); wxLogWarning( "Image file does not exist." );
return FALSE; return FALSE;
} }
}
bool wxImage::LoadFile( wxInputStream& stream, long type )
{
UnRef();
m_refData = new wxImageRefData; m_refData = new wxImageRefData;
wxImageHandler *handler = FindHandler(type); wxImageHandler *handler = FindHandler(type);
@@ -316,10 +330,20 @@ bool wxImage::LoadFile( const wxString& filename, long type )
return FALSE; return FALSE;
} }
return handler->LoadFile( this, filename ); return handler->LoadFile( this, stream );
} }
bool wxImage::SaveFile( const wxString& filename, int type ) bool wxImage::SaveFile( const wxString& filename, int type )
{
wxFileOutputStream stream(filename);
if ( stream.LastError() == wxStream_NOERROR )
return SaveFile(stream, type);
else
return FALSE;
}
bool wxImage::SaveFile( wxOutputStream& stream, int type )
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid image" ); wxCHECK_MSG( Ok(), FALSE, "invalid image" );
@@ -332,7 +356,7 @@ bool wxImage::SaveFile( const wxString& filename, int type )
return FALSE; return FALSE;
} }
return handler->SaveFile( this, filename ); return handler->SaveFile( this, stream );
} }
void wxImage::AddHandler( wxImageHandler *handler ) void wxImage::AddHandler( wxImageHandler *handler )
@@ -424,12 +448,12 @@ void wxImage::CleanUpHandlers()
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif #endif
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) ) bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{ {
return FALSE; return FALSE;
} }
bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) ) bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream) )
{ {
return FALSE; return FALSE;
} }
@@ -443,9 +467,27 @@ bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), const wxString& WXUNUSE
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
#endif #endif
bool wxPNGHandler::LoadFile( wxImage *image, const wxString& name )
static void _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 )
{
((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length);
}
bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
{
// png_structp png_ptr;
// png_infop info_ptr;
// unsigned char *ptr, **lines, *ptr2;
// int transp,bit_depth,color_type,interlace_type;
//png_uint_32 width, height;
//unsigned int i;
image->Destroy(); image->Destroy();
png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
@@ -469,10 +511,8 @@ bool wxPNGHandler::LoadFile( wxImage *image, const wxString& name )
{ {
png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL ); png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL );
return FALSE; return FALSE;
} }
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
FILE *f = fopen( name, "rb" );
png_init_io( png_ptr, f );
png_uint_32 width,height; png_uint_32 width,height;
int bit_depth,color_type,interlace_type; int bit_depth,color_type,interlace_type;
@@ -591,35 +631,30 @@ bool wxPNGHandler::LoadFile( wxImage *image, const wxString& name )
} }
bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name ) bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
{ {
FILE *f = fopen( name, "wb" ); {
if (!f) return FALSE; png_structp png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_structp png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING,
(voidp) NULL, (png_error_ptr) NULL, (png_error_ptr) NULL);
if (!png_ptr) if (!png_ptr)
{ {
fclose( f ); return FALSE;
return FALSE;
} }
png_infop info_ptr = png_create_info_struct(png_ptr); png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) if (info_ptr == NULL)
{ {
fclose(f); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
png_destroy_write_struct( &png_ptr, (png_infopp) NULL ); return FALSE;
return FALSE;
} }
if (setjmp(png_ptr->jmpbuf)) if (setjmp(png_ptr->jmpbuf))
{ {
fclose( f ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
png_destroy_write_struct( &png_ptr, (png_infopp) NULL ); return FALSE;
return FALSE;
} }
png_init_io( png_ptr, f ); png_set_write_fn( png_ptr, &stream, _PNG_stream_writer, NULL);
png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), 8, png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), 8,
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
@@ -637,9 +672,8 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 ); unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 );
if (!data) if (!data)
{ {
fclose( f ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
png_destroy_write_struct( &png_ptr, (png_infopp) NULL ); return FALSE;
return FALSE;
} }
for (int y = 0; y < image->GetHeight(); y++) for (int y = 0; y < image->GetHeight(); y++)
@@ -667,11 +701,9 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
free(data); free(data);
png_write_end( png_ptr, info_ptr ); png_write_end( png_ptr, info_ptr );
png_destroy_write_struct( &png_ptr, (png_infopp) NULL ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
}
fclose(f); return TRUE;
return TRUE;
} }
#endif #endif
@@ -686,9 +718,8 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif #endif
bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name ) bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{ {
FILE *file;
unsigned char *data, *ptr; unsigned char *data, *ptr;
int done, i, bpp, planes, comp, ncolors, line, column, int done, i, bpp, planes, comp, ncolors, line, column,
linesize, linepos, rshift = 0, gshift = 0, bshift = 0; linesize, linepos, rshift = 0, gshift = 0, bshift = 0;
@@ -696,6 +727,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
short int word; short int word;
long int dbuf[4], dword, rmask = 0, gmask = 0, bmask = 0, offset, long int dbuf[4], dword, rmask = 0, gmask = 0, bmask = 0, offset,
size; size;
off_t start_offset = stream.TellI();
signed char bbuf[4]; signed char bbuf[4];
struct _cmap struct _cmap
{ {
@@ -714,56 +746,48 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
image->Destroy(); image->Destroy();
file = fopen(name, "r");
if (!file)
return NULL;
done = 0; done = 0;
/* /*
* Reading the bmp header * Reading the bmp header
*/ */
fread(&bbuf, 1, 2, file); stream.Read(&bbuf, 2);
fread(dbuf, 4, 4, file); stream.Read(dbuf, 4 * 4);
size = dbuf[0]; size = dbuf[0];
offset = dbuf[2]; offset = dbuf[2];
fread(dbuf, 4, 2, file); stream.Read(dbuf, 4 * 2);
int width = (int)dbuf[0]; int width = (int)dbuf[0];
int height = (int)dbuf[1]; int height = (int)dbuf[1];
if (width > 32767) if (width > 32767)
{ {
wxLogError( "Image width > 32767 pixels for file\n" ); wxLogError( "Image width > 32767 pixels for file\n" );
fclose(file);
return FALSE; return FALSE;
} }
if (height > 32767) if (height > 32767)
{ {
wxLogError( "Image height > 32767 pixels for file\n" ); wxLogError( "Image height > 32767 pixels for file\n" );
fclose(file);
return FALSE; return FALSE;
} }
fread(&word, 2, 1, file); stream.Read(&word, 2);
planes = (int)word; planes = (int)word;
fread(&word, 2, 1, file); stream.Read(&word, 2);
bpp = (int)word; bpp = (int)word;
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32) if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
{ {
wxLogError( "unknown bitdepth in file\n" ); wxLogError( "unknown bitdepth in file\n" );
fclose(file);
return FALSE; return FALSE;
} }
fread(dbuf, 4, 4, file); stream.Read(dbuf, 4 * 4);
comp = (int)dbuf[0]; comp = (int)dbuf[0];
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS) if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
{ {
wxLogError( "unknown encoding in Windows BMP file\n" ); wxLogError( "unknown encoding in Windows BMP file\n" );
fclose(file);
return FALSE; return FALSE;
} }
fread(dbuf, 4, 2, file); stream.Read(dbuf, 4 * 2);
ncolors = (int)dbuf[0]; ncolors = (int)dbuf[0];
if (ncolors == 0) if (ncolors == 0)
ncolors = 1 << bpp; ncolors = 1 << bpp;
@@ -771,7 +795,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
if (((comp == BI_RLE4) && (bpp != 4)) || ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32))) if (((comp == BI_RLE4) && (bpp != 4)) || ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
{ {
wxLogError( "encoding of BMP doesn't match bitdepth\n" ); wxLogError( "encoding of BMP doesn't match bitdepth\n" );
fclose(file);
return FALSE; return FALSE;
} }
if (bpp < 16) if (bpp < 16)
@@ -781,7 +804,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
if (!cmap) if (!cmap)
{ {
wxLogError( "Cannot allocate RAM for color map in BMP file\n" ); wxLogError( "Cannot allocate RAM for color map in BMP file\n" );
fclose(file);
return FALSE; return FALSE;
} }
} }
@@ -793,7 +815,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
if (!ptr) if (!ptr)
{ {
wxLogError( "Cannot allocate RAM for RGB data in file\n" ); wxLogError( "Cannot allocate RAM for RGB data in file\n" );
fclose(file);
if (cmap) if (cmap)
free(cmap); free(cmap);
return FALSE; return FALSE;
@@ -806,7 +827,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
{ {
for (i = 0; i < ncolors; i++) for (i = 0; i < ncolors; i++)
{ {
fread(bbuf, 1, 4, file); stream.Read(bbuf, 4);
cmap[i].b = bbuf[0]; cmap[i].b = bbuf[0];
cmap[i].g = bbuf[1]; cmap[i].g = bbuf[1];
cmap[i].r = bbuf[2]; cmap[i].r = bbuf[2];
@@ -818,7 +839,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
{ {
int bit = 0; int bit = 0;
fread(dbuf, 4, 3, file); stream.Read(dbuf, 4 * 3);
bmask = dbuf[0]; bmask = dbuf[0];
gmask = dbuf[1]; gmask = dbuf[1];
rmask = dbuf[2]; rmask = dbuf[2];
@@ -856,7 +877,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
/* /*
* Reading the image data * Reading the image data
*/ */
fseek(file, offset, SEEK_SET); stream.SeekI(start_offset + offset);
data = ptr; data = ptr;
/* set the whole image to the background color */ /* set the whole image to the background color */
@@ -889,7 +910,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
int index; int index;
linepos++; linepos++;
aByte = getc(file); aByte = stream.GetC();
if (bpp == 1) if (bpp == 1)
{ {
int bit = 0; int bit = 0;
@@ -935,7 +956,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
unsigned char first; unsigned char first;
first = aByte; first = aByte;
aByte = getc(file); aByte = stream.GetC();
if (first == 0) if (first == 0)
{ {
if (aByte == 0) if (aByte == 0)
@@ -949,10 +970,10 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
} }
else if (aByte == 2) else if (aByte == 2)
{ {
aByte = getc(file); aByte = stream.GetC();
column += aByte; column += aByte;
linepos = column * bpp / 8; linepos = column * bpp / 8;
aByte = getc(file); aByte = stream.GetC();
line += aByte; line += aByte;
} }
else else
@@ -962,14 +983,14 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
for (i = 0; i < absolute; i++) for (i = 0; i < absolute; i++)
{ {
linepos++; linepos++;
aByte = getc(file); aByte = stream.GetC();
ptr[poffset] = cmap[aByte].r; ptr[poffset] = cmap[aByte].r;
ptr[poffset + 1] = cmap[aByte].g; ptr[poffset + 1] = cmap[aByte].g;
ptr[poffset + 2] = cmap[aByte].b; ptr[poffset + 2] = cmap[aByte].b;
column++; column++;
} }
if (absolute & 0x01) if (absolute & 0x01)
aByte = getc(file); aByte = stream.GetC();
} }
} }
else else
@@ -996,7 +1017,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
} }
else if (bpp == 24) else if (bpp == 24)
{ {
linepos += fread(&bbuf, 1, 3, file); stream.Read(&bbuf, 3);
linepos += 3;
ptr[poffset] = (unsigned char)bbuf[2]; ptr[poffset] = (unsigned char)bbuf[2];
ptr[poffset + 1] = (unsigned char)bbuf[1]; ptr[poffset + 1] = (unsigned char)bbuf[1];
ptr[poffset + 2] = (unsigned char)bbuf[0]; ptr[poffset + 2] = (unsigned char)bbuf[0];
@@ -1006,7 +1028,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
{ {
unsigned char temp; unsigned char temp;
linepos += fread(&word, 2, 1, file); stream.Read(&word, 2);
linepos += 2;
temp = (word & rmask) >> rshift; temp = (word & rmask) >> rshift;
ptr[poffset] = temp; ptr[poffset] = temp;
temp = (word & gmask) >> gshift; temp = (word & gmask) >> gshift;
@@ -1019,7 +1042,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
{ {
unsigned char temp; unsigned char temp;
linepos += fread(&dword, 4, 1, file); stream.Read(&dword, 4);
linepos += 4;
temp = (dword & rmask) >> rshift; temp = (dword & rmask) >> rshift;
ptr[poffset] = temp; ptr[poffset] = temp;
temp = (dword & gmask) >> gshift; temp = (dword & gmask) >> gshift;
@@ -1031,10 +1055,9 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
} }
while ((linepos < linesize) && (comp != 1) && (comp != 2)) while ((linepos < linesize) && (comp != 1) && (comp != 2))
{ {
int temp = fread(&aByte, 1, 1, file); stream.Read(&aByte, 1);
linepos += 1;
linepos += temp; if (stream.LastError() != wxStream_NOERROR)
if (!temp)
break; break;
} }
} }
@@ -1042,7 +1065,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
image->SetMask( FALSE ); image->SetMask( FALSE );
fclose(file);
return TRUE; return TRUE;
} }

View File

@@ -34,6 +34,9 @@
#include "wx/icon.h" #include "wx/icon.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
// Doesn't compile in WIN16 mode
#ifndef __WIN16__
#include "wx/log.h" #include "wx/log.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/dynarray.h" #include "wx/dynarray.h"
@@ -1210,5 +1213,5 @@ void wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName)
#endif // OS type #endif // OS type
/* vi: set cin tw=80 ts=4 sw=4: */ #endif
// __WIN16__

View File

@@ -76,7 +76,7 @@
#include "wx/settings.h" #include "wx/settings.h"
#if (defined(__BORLANDC__) && defined(__WIN16__)) #if ((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__))
// Forward (private) declarations // Forward (private) declarations
bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db); bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
@@ -704,7 +704,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0) if ((item->GetType() == "") || (item->GetType() != "wxBitmap"))
{ {
wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource); wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource);
return wxNullBitmap; return wxNullBitmap;
@@ -859,7 +859,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
if ((item->GetType() == "") || strcmp(item->GetType(), "wxIcon") != 0) if ((item->GetType() == "") || (item->GetType() != "wxIcon"))
{ {
wxLogWarning(_("%s not an icon resource specification."), (const char*) resource); wxLogWarning(_("%s not an icon resource specification."), (const char*) resource);
return wxNullIcon; return wxNullIcon;
@@ -1482,7 +1482,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
wxItemResource *resource = table->FindResource((const char *)resourceName); wxItemResource *resource = table->FindResource((const char *)resourceName);
// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX))
if (!resource || !resource->GetType() || if (!resource || (resource->GetType() == "") ||
! ((strcmp(resource->GetType(), "wxDialog") == 0) || (strcmp(resource->GetType(), "wxPanel") == 0))) ! ((strcmp(resource->GetType(), "wxDialog") == 0) || (strcmp(resource->GetType(), "wxPanel") == 0)))
return FALSE; return FALSE;

View File

@@ -1431,7 +1431,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr)
// Separate file for the remainder of this, for BC++/Win16 // Separate file for the remainder of this, for BC++/Win16
#if !(defined(__BORLANDC__) && defined(__WIN16__)) #if !((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__))
/* /*
* (Re)allocate buffer for reading in from resource file * (Re)allocate buffer for reading in from resource file
*/ */

View File

@@ -16,17 +16,18 @@ CC=sc
RC=rc RC=rc
# WIN16 settings # WIN16 settings
#CFLAGS = -Jm -ml -W -D__WXMSW__ -D__WXDEBUG__ -D__WINDOWS__ -D__WIN16__ $(EXTRACPPFLAGS) #CFLAGS = -Jm -ml -W -D__WXMSW__ -D__SC__ -D__WXDEBUG__ -D__WINDOWS__ -D__WIN16__ $(EXTRACPPFLAGS)
#LDFLAGS = -ml -W
#LINKER = link #LINKER = link
#LIBS=$(WXLIB) $(EXTRALIBS) libw.lib commdlg.lib ddeml.lib shell.lib #LDFLAGS = -ml -W -L$(LINKER).exe $(EXTRALDFLAGS)
#LIBS=$(WXLIB) $(EXTRALIBS) libw.lib commdlg.lib ddeml.lib shell.lib # $(LIB)\ctl3dv2.lib
#DEFFILE=sc16.def #DEFFILE=sc16.def
# WIN32 settings # WIN32 settings
CFLAGS = -o -mn -W -D__NT__ -DWIN32 -D__WIN32__ -D__WINDOWS__ -D__WXMSW__ -D__SC__ -D__WXDEBUG__ $(EXTRACPPFLAGS) CFLAGS = -o -mn -W -D__NT__ -DWIN32 -D__WIN32__ -D__WINDOWS__ -D__WXMSW__ -D__SC__ -D__WXDEBUG__ $(EXTRACPPFLAGS)
LDFLAGS = -Llink386.exe $(EXTRALDFLAGS)
LINKER = link386 LINKER = link386
LDFLAGS = -L$(LINKER).exe $(EXTRALDFLAGS)
LIBS=$(WXLIB) $(EXTRALIBS) ctl3d32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib kernel32.lib winmm.lib LIBS=$(WXLIB) $(EXTRALIBS) ctl3d32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib kernel32.lib winmm.lib
DEFFILE=sc32.def
.$(SRCSUFF).obj: .$(SRCSUFF).obj:
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $(OPTIONS) $< -o$@ *$(CC) -c $(CFLAGS) -I$(INCLUDE) $(OPTIONS) $< -o$@

View File

@@ -33,6 +33,7 @@
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/intl.h"
#endif #endif
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -248,7 +249,8 @@ bool wxApp::Initialize()
// This is to foil optimizations in Visual C++ that // This is to foil optimizations in Visual C++ that
// throw out dummy.obj. // throw out dummy.obj.
#if (_MSC_VER >= 800) && !defined(WXMAKINGDLL) // #if (_MSC_VER >= 800) && !defined(WXMAKINGDLL)
#if defined(_MSC_VER) && defined(__WIN16__) && !defined(WXMAKINGDLL)
extern char wxDummyChar; extern char wxDummyChar;
if (wxDummyChar) wxDummyChar++; if (wxDummyChar) wxDummyChar++;
#endif #endif

View File

@@ -22,8 +22,6 @@
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
#include <windows.h>
#include "wx/object.h" #include "wx/object.h"
#include "wx/colour.h" #include "wx/colour.h"
#include "wx/font.h" #include "wx/font.h"
@@ -35,6 +33,8 @@
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/msw/checklst.h" #include "wx/msw/checklst.h"
#include <windows.h>
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================

View File

@@ -39,8 +39,11 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
// Foils optimizations in Visual C++ (see also wx_main.cc) // Foils optimizations in Visual C++ (see also app.cpp). Without it,
// dummy.obj isn't linked and we get a linker error.
#if defined(_MSC_VER) && defined(__WIN16__)
char wxDummyChar=0; char wxDummyChar=0;
#endif
#if defined(WXUSINGDLL) #if defined(WXUSINGDLL)

View File

@@ -17,5 +17,9 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
// Foils optimizations in Visual C++ (see also wx_main.cc) // Foils optimizations in Visual C++ (see also app.cpp). Without it,
// dummy.obj isn't linked and we get a linker error.
#if defined(_MSC_VER) && defined(__WIN16__)
char wxDummyChar=0; char wxDummyChar=0;
#endif

View File

@@ -77,6 +77,7 @@ COMMONOBJS = \
$(COMMDIR)\object.obj \ $(COMMDIR)\object.obj \
$(COMMDIR)\prntbase.obj \ $(COMMDIR)\prntbase.obj \
$(COMMDIR)\resource.obj \ $(COMMDIR)\resource.obj \
$(COMMDIR)\resourc2.obj \
$(COMMDIR)\tbarbase.obj \ $(COMMDIR)\tbarbase.obj \
$(COMMDIR)\tbarsmpl.obj \ $(COMMDIR)\tbarsmpl.obj \
$(COMMDIR)\textfile.obj \ $(COMMDIR)\textfile.obj \
@@ -88,14 +89,6 @@ COMMONOBJS = \
$(COMMDIR)\hash.obj \ $(COMMDIR)\hash.obj \
$(COMMDIR)\list.obj \ $(COMMDIR)\list.obj \
$(COMMDIR)\string.obj \ $(COMMDIR)\string.obj \
$(COMMDIR)\socket.obj \
$(COMMDIR)\sckaddr.obj \
$(COMMDIR)\sckfile.obj \
$(COMMDIR)\sckipc.obj \
$(COMMDIR)\sckstrm.obj \
$(COMMDIR)\url.obj \
$(COMMDIR)\http.obj \
$(COMMDIR)\protocol.obj \
$(COMMDIR)\time.obj \ $(COMMDIR)\time.obj \
$(COMMDIR)\tokenzr.obj \ $(COMMDIR)\tokenzr.obj \
$(COMMDIR)\wxexpr.obj \ $(COMMDIR)\wxexpr.obj \
@@ -111,6 +104,16 @@ COMMONOBJS = \
$(COMMDIR)\variant.obj \ $(COMMDIR)\variant.obj \
$(COMMDIR)\wincmn.obj $(COMMDIR)\wincmn.obj
# Don't compile for WIN16
# $(COMMDIR)\socket.obj \
# $(COMMDIR)\sckaddr.obj \
# $(COMMDIR)\sckfile.obj \
# $(COMMDIR)\sckipc.obj \
# $(COMMDIR)\sckstrm.obj \
# $(COMMDIR)\url.obj \
# $(COMMDIR)\http.obj \
# $(COMMDIR)\protocol.obj \
# Don't compile # Don't compile
# $(COMMDIR)\db.obj \ # $(COMMDIR)\db.obj \
# $(COMMDIR)\dbtable.obj \ # $(COMMDIR)\dbtable.obj \

View File

@@ -28,6 +28,9 @@
#include <wx/app.h> #include <wx/app.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/config.h> #include <wx/config.h>
#ifndef __WIN16__
#include <wx/msw/registry.h> #include <wx/msw/registry.h>
#include <wx/msw/regconf.h> #include <wx/msw/regconf.h>
@@ -471,3 +474,7 @@ bool wxRegConfig::DeleteAll()
return bOk; return bOk;
} }
#endif
// __WIN16__

View File

@@ -27,9 +27,10 @@
#include "wx/string.h" #include "wx/string.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/config.h" // for wxExpandEnvVars #include "wx/config.h" // for wxExpandEnvVars
#ifndef __WIN16__
// Windows headers // Windows headers
/* /*
#define STRICT #define STRICT
@@ -799,3 +800,7 @@ void RemoveTrailingSeparator(wxString& str)
if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR ) if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR )
str.Truncate(str.Len() - 1); str.Truncate(str.Len() - 1);
} }
#endif
// __WIN16__

View File

@@ -21,8 +21,6 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#include <windows.h>
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/window.h" #include "wx/window.h"
@@ -32,6 +30,7 @@
#ifdef __WIN95__ #ifdef __WIN95__
#include <windows.h>
#include <string.h> #include <string.h>
#include <wx/msw/taskbar.h> #include <wx/msw/taskbar.h>
#include <wx/msw/private.h> #include <wx/msw/private.h>

View File

@@ -100,7 +100,7 @@ EXTRADLLFLAGS=$(EXTRADLLFLAGS) /DNOMAIN
!endif !endif
INC=-I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib $(EXTRAINC) INC=-I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib $(EXTRAINC)
LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\zlib.lib
!ifndef FINAL !ifndef FINAL
FINAL=0 FINAL=0

View File

@@ -15,7 +15,6 @@
#define __SRCPARSER_G__ #define __SRCPARSER_G__
#if defined( wxUSE_TEMPLATE_STL ) #if defined( wxUSE_TEMPLATE_STL )
#include <vector> #include <vector>
#ifdef WIN32 #ifdef WIN32
@@ -28,7 +27,6 @@
#endif #endif
#else #else
#include "wx/string.h" #include "wx/string.h"
#include "wxstlvec.h" #include "wxstlvec.h"

View File

@@ -12,13 +12,16 @@
#ifndef __WXSTLAC_G__ #ifndef __WXSTLAC_G__
#define __WXSTLAC_G__ #define __WXSTLAC_G__
#ifdef new
#undef new
#endif
#include <stddef.h> #include <stddef.h>
#include <sys/types.h> #include <sys/types.h>
#include <memory.h> #include <memory.h>
#include <limits.h> #include <limits.h>
#include <new.h> #include <new.h>
// the below macro used internally (see actual interface after this macro) // the below macro used internally (see actual interface after this macro)
// arguments: // arguments:

View File

@@ -12,6 +12,10 @@
#ifndef __WXSTLLST_G__ #ifndef __WXSTLLST_G__
#define __WXSTLLST_G__ #define __WXSTLLST_G__
#ifdef new
#undef new
#endif
#include <stddef.h> #include <stddef.h>
#include <sys/types.h> #include <sys/types.h>
#include <memory.h> #include <memory.h>

View File

@@ -12,6 +12,10 @@
#ifndef __WXSTLVEC_G__ #ifndef __WXSTLVEC_G__
#define __WXSTLVEC_G__ #define __WXSTLVEC_G__
#ifdef new
#undef new
#endif
#include <memory.h> #include <memory.h>
#include <string.h> // imports memmove() #include <string.h> // imports memmove()
#include <stddef.h> #include <stddef.h>

View File

@@ -40,10 +40,11 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <wx/string.h> #include <wx/string.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/file.h>
#include <wx/dynarray.h> #include <wx/dynarray.h>
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include <wx/file.h>
// C++ parsing classes // C++ parsing classes
#include "cjparser.h" #include "cjparser.h"
@@ -69,6 +70,10 @@ static wxString GetAllComments(const spContext& ctx);
// get the string with current time (returns pointer to static buffer) // get the string with current time (returns pointer to static buffer)
// timeFormat is used for the call of strftime(3) // timeFormat is used for the call of strftime(3)
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
static const char *GetCurrentTime(const char *timeFormat); static const char *GetCurrentTime(const char *timeFormat);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@@ -0,0 +1,3 @@
/* mondrian ICON "mondrian.ico" */
#include "wx/msw/wx.rc"

View File

@@ -0,0 +1,66 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds minimal example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
WXUSINGDLL=0
!include $(WXDIR)\src\ntwxwin.mak
THISDIR = $(WXDIR)\utils\HelpGen\src
PROGRAM=HelpGen
EXTRAINC=-I..\include
OBJECTS = $(PROGRAM).obj cjparser.obj ifcontext.obj markup.obj\
scriptbinder.obj srcparser.obj sourcepainter.obj
$(PROGRAM): $(PROGRAM).exe
all: wx $(PROGRAM).exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.nt clean
cd $(THISDIR)
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb