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:
@@ -36,7 +36,7 @@ zip32 -@ %dest\wx200cw.zip < %src\distrib\msw\cw.rsp
|
||||
zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp
|
||||
|
||||
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\msw\install.txt %dest\install_msw.txt
|
||||
|
@@ -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
|
||||
erroneously.
|
||||
|
||||
Add headers to VC++ project files.
|
||||
|
||||
Test GLCanvas.
|
||||
|
||||
Distribution naming?
|
||||
|
||||
LOW PRIORITY (MEDIUM TERM)
|
||||
--------------------------
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/stream.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@@ -43,8 +44,8 @@ class WXDLLEXPORT wxImageHandler: public wxObject
|
||||
public:
|
||||
wxImageHandler() { m_name = ""; m_extension = ""; m_type = 0; }
|
||||
|
||||
virtual bool LoadFile( wxImage *image, const wxString& name );
|
||||
virtual bool SaveFile( wxImage *image, const wxString& name );
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
|
||||
|
||||
inline void SetName(const wxString& name) { m_name = name; }
|
||||
inline void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
@@ -78,8 +79,8 @@ public:
|
||||
m_type = wxBITMAP_TYPE_PNG;
|
||||
};
|
||||
|
||||
virtual bool LoadFile( wxImage *image, const wxString& name );
|
||||
virtual bool SaveFile( wxImage *image, const wxString& name );
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -100,7 +101,7 @@ public:
|
||||
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( int width, int height );
|
||||
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 );
|
||||
@@ -138,7 +140,9 @@ public:
|
||||
unsigned char GetBlue( int x, int y );
|
||||
|
||||
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( wxOutputStream& stream, int type );
|
||||
|
||||
bool Ok() const;
|
||||
int GetWidth() const;
|
||||
|
@@ -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"
|
||||
#endif
|
||||
|
||||
#include "wx/image.h"
|
||||
|
||||
// derived classes
|
||||
@@ -77,6 +87,8 @@ END_EVENT_TABLE()
|
||||
MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, const wxSize &size )
|
||||
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
|
||||
{
|
||||
SetBackgroundColour(* wxWHITE);
|
||||
|
||||
wxBitmap bitmap( 100, 100 );
|
||||
|
||||
wxMemoryDC dc;
|
||||
@@ -86,13 +98,19 @@ MyCanvas::MyCanvas( wxWindow *parent, const wxWindowID id, const wxPoint &pos, c
|
||||
dc.DrawRectangle( 0, 0, 100, 100 );
|
||||
dc.SelectObject( wxNullBitmap );
|
||||
|
||||
wxImage image( bitmap );
|
||||
image.SaveFile( "../test.png", wxBITMAP_TYPE_PNG );
|
||||
wxString dir("");
|
||||
|
||||
image.LoadFile( "../horse.png", wxBITMAP_TYPE_PNG );
|
||||
#ifdef __WXGTK__
|
||||
dir = wxString("../");
|
||||
#endif
|
||||
|
||||
wxImage image( bitmap );
|
||||
image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
||||
|
||||
image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG );
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -140,7 +158,6 @@ MyFrame::MyFrame(void) :
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, "File");
|
||||
menu_bar->Show( TRUE );
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
@@ -166,6 +183,7 @@ void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
int w,h;
|
||||
GetClientSize( &w, &h );
|
||||
if (m_canvas)
|
||||
m_canvas->SetSize( w, h );
|
||||
}
|
||||
|
||||
@@ -188,7 +206,3 @@ bool MyApp::OnInit(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
samples/image/image.rc
Normal file
3
samples/image/image.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
/* mondrian ICON "mondrian.ico" */
|
||||
#include "wx/msw/wx.rc"
|
||||
|
64
samples/image/makefile.nt
Normal file
64
samples/image/makefile.nt
Normal 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
|
@@ -26,6 +26,7 @@
|
||||
#include "../png/png.h"
|
||||
#endif
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h>
|
||||
@@ -91,6 +92,11 @@ wxImage::wxImage( const wxString& name, long type )
|
||||
LoadFile( name, type );
|
||||
}
|
||||
|
||||
wxImage::wxImage( wxInputStream& stream, long type )
|
||||
{
|
||||
LoadFile( stream, type );
|
||||
}
|
||||
|
||||
wxImage::wxImage( const wxImage& image )
|
||||
{
|
||||
Ref(image);
|
||||
@@ -296,14 +302,22 @@ int wxImage::GetHeight() const
|
||||
|
||||
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." );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxImage::LoadFile( wxInputStream& stream, long type )
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxImageRefData;
|
||||
|
||||
@@ -316,10 +330,20 @@ bool wxImage::LoadFile( const wxString& filename, long type )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return handler->LoadFile( this, filename );
|
||||
return handler->LoadFile( this, stream );
|
||||
}
|
||||
|
||||
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" );
|
||||
|
||||
@@ -332,7 +356,7 @@ bool wxImage::SaveFile( const wxString& filename, int type )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return handler->SaveFile( this, filename );
|
||||
return handler->SaveFile( this, stream );
|
||||
}
|
||||
|
||||
void wxImage::AddHandler( wxImageHandler *handler )
|
||||
@@ -424,12 +448,12 @@ void wxImage::CleanUpHandlers()
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
|
||||
#endif
|
||||
|
||||
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) )
|
||||
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) )
|
||||
bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -444,8 +468,26 @@ bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), const wxString& WXUNUSE
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
|
||||
#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();
|
||||
|
||||
png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
|
||||
@@ -470,9 +512,7 @@ bool wxPNGHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FILE *f = fopen( name, "rb" );
|
||||
png_init_io( png_ptr, f );
|
||||
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
|
||||
|
||||
png_uint_32 width,height;
|
||||
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,
|
||||
(voidp) NULL, (png_error_ptr) NULL, (png_error_ptr) NULL);
|
||||
{
|
||||
png_structp png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
{
|
||||
fclose( f );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
{
|
||||
fclose(f);
|
||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
{
|
||||
fclose( f );
|
||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||
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_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
@@ -637,7 +672,6 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
|
||||
unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 );
|
||||
if (!data)
|
||||
{
|
||||
fclose( f );
|
||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||
return FALSE;
|
||||
}
|
||||
@@ -668,9 +702,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
|
||||
free(data);
|
||||
png_write_end( png_ptr, info_ptr );
|
||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -686,9 +718,8 @@ bool wxPNGHandler::SaveFile( wxImage *image, const wxString& name )
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
|
||||
#endif
|
||||
|
||||
bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
{
|
||||
FILE *file;
|
||||
unsigned char *data, *ptr;
|
||||
int done, i, bpp, planes, comp, ncolors, line, column,
|
||||
linesize, linepos, rshift = 0, gshift = 0, bshift = 0;
|
||||
@@ -696,6 +727,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
short int word;
|
||||
long int dbuf[4], dword, rmask = 0, gmask = 0, bmask = 0, offset,
|
||||
size;
|
||||
off_t start_offset = stream.TellI();
|
||||
signed char bbuf[4];
|
||||
struct _cmap
|
||||
{
|
||||
@@ -714,56 +746,48 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
|
||||
image->Destroy();
|
||||
|
||||
file = fopen(name, "r");
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
done = 0;
|
||||
/*
|
||||
* 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];
|
||||
offset = dbuf[2];
|
||||
|
||||
fread(dbuf, 4, 2, file);
|
||||
stream.Read(dbuf, 4 * 2);
|
||||
int width = (int)dbuf[0];
|
||||
int height = (int)dbuf[1];
|
||||
if (width > 32767)
|
||||
{
|
||||
wxLogError( "Image width > 32767 pixels for file\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
if (height > 32767)
|
||||
{
|
||||
wxLogError( "Image height > 32767 pixels for file\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
fread(&word, 2, 1, file);
|
||||
stream.Read(&word, 2);
|
||||
planes = (int)word;
|
||||
fread(&word, 2, 1, file);
|
||||
stream.Read(&word, 2);
|
||||
bpp = (int)word;
|
||||
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
|
||||
{
|
||||
wxLogError( "unknown bitdepth in file\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
fread(dbuf, 4, 4, file);
|
||||
stream.Read(dbuf, 4 * 4);
|
||||
comp = (int)dbuf[0];
|
||||
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
||||
{
|
||||
wxLogError( "unknown encoding in Windows BMP file\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
fread(dbuf, 4, 2, file);
|
||||
stream.Read(dbuf, 4 * 2);
|
||||
ncolors = (int)dbuf[0];
|
||||
if (ncolors == 0)
|
||||
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)))
|
||||
{
|
||||
wxLogError( "encoding of BMP doesn't match bitdepth\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
if (bpp < 16)
|
||||
@@ -781,7 +804,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
if (!cmap)
|
||||
{
|
||||
wxLogError( "Cannot allocate RAM for color map in BMP file\n" );
|
||||
fclose(file);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -793,7 +815,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
if (!ptr)
|
||||
{
|
||||
wxLogError( "Cannot allocate RAM for RGB data in file\n" );
|
||||
fclose(file);
|
||||
if (cmap)
|
||||
free(cmap);
|
||||
return FALSE;
|
||||
@@ -806,7 +827,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
{
|
||||
for (i = 0; i < ncolors; i++)
|
||||
{
|
||||
fread(bbuf, 1, 4, file);
|
||||
stream.Read(bbuf, 4);
|
||||
cmap[i].b = bbuf[0];
|
||||
cmap[i].g = bbuf[1];
|
||||
cmap[i].r = bbuf[2];
|
||||
@@ -818,7 +839,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
{
|
||||
int bit = 0;
|
||||
|
||||
fread(dbuf, 4, 3, file);
|
||||
stream.Read(dbuf, 4 * 3);
|
||||
bmask = dbuf[0];
|
||||
gmask = dbuf[1];
|
||||
rmask = dbuf[2];
|
||||
@@ -856,7 +877,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
/*
|
||||
* Reading the image data
|
||||
*/
|
||||
fseek(file, offset, SEEK_SET);
|
||||
stream.SeekI(start_offset + offset);
|
||||
data = ptr;
|
||||
|
||||
/* set the whole image to the background color */
|
||||
@@ -889,7 +910,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
int index;
|
||||
|
||||
linepos++;
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
if (bpp == 1)
|
||||
{
|
||||
int bit = 0;
|
||||
@@ -935,7 +956,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
unsigned char first;
|
||||
|
||||
first = aByte;
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
if (first == 0)
|
||||
{
|
||||
if (aByte == 0)
|
||||
@@ -949,10 +970,10 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
}
|
||||
else if (aByte == 2)
|
||||
{
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
column += aByte;
|
||||
linepos = column * bpp / 8;
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
line += aByte;
|
||||
}
|
||||
else
|
||||
@@ -962,14 +983,14 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
for (i = 0; i < absolute; i++)
|
||||
{
|
||||
linepos++;
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
ptr[poffset] = cmap[aByte].r;
|
||||
ptr[poffset + 1] = cmap[aByte].g;
|
||||
ptr[poffset + 2] = cmap[aByte].b;
|
||||
column++;
|
||||
}
|
||||
if (absolute & 0x01)
|
||||
aByte = getc(file);
|
||||
aByte = stream.GetC();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -996,7 +1017,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
}
|
||||
else if (bpp == 24)
|
||||
{
|
||||
linepos += fread(&bbuf, 1, 3, file);
|
||||
stream.Read(&bbuf, 3);
|
||||
linepos += 3;
|
||||
ptr[poffset] = (unsigned char)bbuf[2];
|
||||
ptr[poffset + 1] = (unsigned char)bbuf[1];
|
||||
ptr[poffset + 2] = (unsigned char)bbuf[0];
|
||||
@@ -1006,7 +1028,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
{
|
||||
unsigned char temp;
|
||||
|
||||
linepos += fread(&word, 2, 1, file);
|
||||
stream.Read(&word, 2);
|
||||
linepos += 2;
|
||||
temp = (word & rmask) >> rshift;
|
||||
ptr[poffset] = temp;
|
||||
temp = (word & gmask) >> gshift;
|
||||
@@ -1019,7 +1042,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
{
|
||||
unsigned char temp;
|
||||
|
||||
linepos += fread(&dword, 4, 1, file);
|
||||
stream.Read(&dword, 4);
|
||||
linepos += 4;
|
||||
temp = (dword & rmask) >> rshift;
|
||||
ptr[poffset] = temp;
|
||||
temp = (dword & gmask) >> gshift;
|
||||
@@ -1031,10 +1055,9 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
}
|
||||
while ((linepos < linesize) && (comp != 1) && (comp != 2))
|
||||
{
|
||||
int temp = fread(&aByte, 1, 1, file);
|
||||
|
||||
linepos += temp;
|
||||
if (!temp)
|
||||
stream.Read(&aByte, 1);
|
||||
linepos += 1;
|
||||
if (stream.LastError() != wxStream_NOERROR)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1065,6 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
|
||||
image->SetMask( FALSE );
|
||||
|
||||
fclose(file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,9 @@
|
||||
#include "wx/icon.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
// Doesn't compile in WIN16 mode
|
||||
#ifndef __WIN16__
|
||||
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/dynarray.h"
|
||||
@@ -1210,5 +1213,5 @@ void wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName)
|
||||
|
||||
#endif // OS type
|
||||
|
||||
/* vi: set cin tw=80 ts=4 sw=4: */
|
||||
|
||||
#endif
|
||||
// __WIN16__
|
||||
|
@@ -76,7 +76,7 @@
|
||||
|
||||
#include "wx/settings.h"
|
||||
|
||||
#if (defined(__BORLANDC__) && defined(__WIN16__))
|
||||
#if ((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__))
|
||||
|
||||
// Forward (private) declarations
|
||||
bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
|
||||
@@ -704,7 +704,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
|
||||
wxItemResource *item = table->FindResource(resource);
|
||||
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);
|
||||
return wxNullBitmap;
|
||||
@@ -859,7 +859,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
|
||||
wxItemResource *item = table->FindResource(resource);
|
||||
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);
|
||||
return wxNullIcon;
|
||||
@@ -1482,7 +1482,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
|
||||
|
||||
wxItemResource *resource = table->FindResource((const char *)resourceName);
|
||||
// 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)))
|
||||
return FALSE;
|
||||
|
||||
|
@@ -1431,7 +1431,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr)
|
||||
|
||||
// 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
|
||||
*/
|
||||
|
@@ -16,17 +16,18 @@ CC=sc
|
||||
RC=rc
|
||||
|
||||
# WIN16 settings
|
||||
#CFLAGS = -Jm -ml -W -D__WXMSW__ -D__WXDEBUG__ -D__WINDOWS__ -D__WIN16__ $(EXTRACPPFLAGS)
|
||||
#LDFLAGS = -ml -W
|
||||
#CFLAGS = -Jm -ml -W -D__WXMSW__ -D__SC__ -D__WXDEBUG__ -D__WINDOWS__ -D__WIN16__ $(EXTRACPPFLAGS)
|
||||
#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
|
||||
|
||||
# WIN32 settings
|
||||
CFLAGS = -o -mn -W -D__NT__ -DWIN32 -D__WIN32__ -D__WINDOWS__ -D__WXMSW__ -D__SC__ -D__WXDEBUG__ $(EXTRACPPFLAGS)
|
||||
LDFLAGS = -Llink386.exe $(EXTRALDFLAGS)
|
||||
LINKER = link386
|
||||
LDFLAGS = -L$(LINKER).exe $(EXTRALDFLAGS)
|
||||
LIBS=$(WXLIB) $(EXTRALIBS) ctl3d32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib kernel32.lib winmm.lib
|
||||
DEFFILE=sc32.def
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $(OPTIONS) $< -o$@
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "wx/dc.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/intl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
@@ -248,7 +249,8 @@ bool wxApp::Initialize()
|
||||
|
||||
// This is to foil optimizations in Visual C++ that
|
||||
// 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;
|
||||
if (wxDummyChar) wxDummyChar++;
|
||||
#endif
|
||||
|
@@ -22,8 +22,6 @@
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/font.h"
|
||||
@@ -35,6 +33,8 @@
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/msw/checklst.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
@@ -39,8 +39,11 @@
|
||||
#pragma hdrstop
|
||||
#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;
|
||||
#endif
|
||||
|
||||
#if defined(WXUSINGDLL)
|
||||
|
||||
|
@@ -17,5 +17,9 @@
|
||||
|
||||
#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;
|
||||
#endif
|
||||
|
||||
|
@@ -77,6 +77,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\object.obj \
|
||||
$(COMMDIR)\prntbase.obj \
|
||||
$(COMMDIR)\resource.obj \
|
||||
$(COMMDIR)\resourc2.obj \
|
||||
$(COMMDIR)\tbarbase.obj \
|
||||
$(COMMDIR)\tbarsmpl.obj \
|
||||
$(COMMDIR)\textfile.obj \
|
||||
@@ -88,14 +89,6 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\hash.obj \
|
||||
$(COMMDIR)\list.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)\tokenzr.obj \
|
||||
$(COMMDIR)\wxexpr.obj \
|
||||
@@ -111,6 +104,16 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\variant.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
|
||||
# $(COMMDIR)\db.obj \
|
||||
# $(COMMDIR)\dbtable.obj \
|
||||
|
@@ -28,6 +28,9 @@
|
||||
#include <wx/app.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
#ifndef __WIN16__
|
||||
|
||||
#include <wx/msw/registry.h>
|
||||
#include <wx/msw/regconf.h>
|
||||
|
||||
@@ -471,3 +474,7 @@ bool wxRegConfig::DeleteAll()
|
||||
|
||||
return bOk;
|
||||
}
|
||||
|
||||
#endif
|
||||
// __WIN16__
|
||||
|
||||
|
@@ -27,9 +27,10 @@
|
||||
#include "wx/string.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/config.h" // for wxExpandEnvVars
|
||||
|
||||
#ifndef __WIN16__
|
||||
|
||||
// Windows headers
|
||||
/*
|
||||
#define STRICT
|
||||
@@ -799,3 +800,7 @@ void RemoveTrailingSeparator(wxString& str)
|
||||
if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR )
|
||||
str.Truncate(str.Len() - 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
// __WIN16__
|
||||
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/defs.h"
|
||||
#include "wx/window.h"
|
||||
@@ -32,6 +30,7 @@
|
||||
|
||||
#ifdef __WIN95__
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <wx/msw/taskbar.h>
|
||||
#include <wx/msw/private.h>
|
||||
|
@@ -100,7 +100,7 @@ EXTRADLLFLAGS=$(EXTRADLLFLAGS) /DNOMAIN
|
||||
!endif
|
||||
|
||||
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
|
||||
FINAL=0
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#define __SRCPARSER_G__
|
||||
|
||||
#if defined( wxUSE_TEMPLATE_STL )
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -28,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wxstlvec.h"
|
||||
|
||||
|
@@ -12,13 +12,16 @@
|
||||
#ifndef __WXSTLAC_G__
|
||||
#define __WXSTLAC_G__
|
||||
|
||||
#ifdef new
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <memory.h>
|
||||
#include <limits.h>
|
||||
#include <new.h>
|
||||
|
||||
|
||||
// the below macro used internally (see actual interface after this macro)
|
||||
|
||||
// arguments:
|
||||
|
@@ -12,6 +12,10 @@
|
||||
#ifndef __WXSTLLST_G__
|
||||
#define __WXSTLLST_G__
|
||||
|
||||
#ifdef new
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <memory.h>
|
||||
|
@@ -12,6 +12,10 @@
|
||||
#ifndef __WXSTLVEC_G__
|
||||
#define __WXSTLVEC_G__
|
||||
|
||||
#ifdef new
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h> // imports memmove()
|
||||
#include <stddef.h>
|
||||
|
@@ -40,10 +40,11 @@
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/file.h>
|
||||
#include <wx/dynarray.h>
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include <wx/file.h>
|
||||
|
||||
// C++ parsing classes
|
||||
#include "cjparser.h"
|
||||
|
||||
@@ -69,6 +70,10 @@ static wxString GetAllComments(const spContext& ctx);
|
||||
|
||||
// get the string with current time (returns pointer to static buffer)
|
||||
// timeFormat is used for the call of strftime(3)
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
|
||||
static const char *GetCurrentTime(const char *timeFormat);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
3
utils/HelpGen/src/HelpGen.rc
Normal file
3
utils/HelpGen/src/HelpGen.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
/* mondrian ICON "mondrian.ico" */
|
||||
#include "wx/msw/wx.rc"
|
||||
|
66
utils/HelpGen/src/makefile.nt
Normal file
66
utils/HelpGen/src/makefile.nt
Normal 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
|
Reference in New Issue
Block a user