From c45a644eda9a0c6309090d8450780ca37faed9c8 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 23 Jul 1999 18:50:12 +0000 Subject: [PATCH] Finished MingW32 makefiles More drawing tests and corrections Distrib things git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- BuildCVS.txt | 16 +- distrib/msw/copy_src.bat | 5 + distrib/msw/tmake/filelist.txt | 1 - distrib/msw/tmake/g95.t | 164 ++++++++++------ samples/drawing/drawing.cpp | 28 ++- src/msw/dc.cpp | 11 +- src/msw/dcclient.cpp | 10 + src/msw/dcmemory.cpp | 17 +- src/msw/dcscreen.cpp | 5 + src/msw/makefile.g95 | 165 ++++++++++------ src/msw/pen.cpp | 344 +++++++++++++++++---------------- 11 files changed, 476 insertions(+), 290 deletions(-) diff --git a/BuildCVS.txt b/BuildCVS.txt index 0feea2c139..71ee27375c 100644 --- a/BuildCVS.txt +++ b/BuildCVS.txt @@ -17,6 +17,10 @@ a stand alone port without the infamous Cygwin.dll from http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32 +The makefile has small problems with Cygwin´s tools +so it is recommended not to use these (but MingGW32 +and its make.exe). + -> Set your path so that it includes the directory where your compiler and tools reside -> Assume that you installed the wxWindows sources @@ -25,16 +29,18 @@ a stand alone port without the infamous Cygwin.dll from to c:\wxWin\include\wx\msw\setup.h -> Edit c:\wxWin\include\wx\msw\setup.h so that most features are enabled (i.e. defined to 1) with - #define wxUSE_SOCKETS 1 - #define wxUSE_HTML 1 + #define wxUSE_SOCKETS 0 + #define wxUSE_HTML 0 #define wxUSE_THREADS 1 - #define wxUSE_FS_INET 1 - #define wxUSE_FS_ZIP 1 + #define wxUSE_FS_INET 0 + #define wxUSE_FS_ZIP 0 #define wxUSE_BUSYINFO 1 #define wxUSE_DYNLIB_CLASS 1 #define wxUSE_ZIPSTREAM 1 + #define wxUSE_JPEGLIB 1 + #define wxUSE_PNGLIB 1 - and disbale iostreams with + and disable iostreams with #define wxUSE_STD_IOSTREAM 0 -> type: cd c:\wxWin\src\msw -> type: make -f makefile.g95 diff --git a/distrib/msw/copy_src.bat b/distrib/msw/copy_src.bat index 7ef2fc7f0d..f804709bb1 100755 --- a/distrib/msw/copy_src.bat +++ b/distrib/msw/copy_src.bat @@ -144,6 +144,11 @@ md \wxmsw_dist\wxMSW\src\jpeg copy *.* \wxmsw_dist\wxMSW\src\jpeg cd .. +cd xpm +md \wxmsw_dist\wxMSW\src\xpm +copy *.* \wxmsw_dist\wxMSW\src\xpm +cd .. + cd .. echo Samples dir.. diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 5cab7e9814..409210bfeb 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -102,7 +102,6 @@ protocol.cpp C S resource.cpp C sckaddr.cpp C S sckfile.cpp C S -sckint.cpp C S sckipc.cpp C S sckstrm.cpp C S socket.cpp C S diff --git a/distrib/msw/tmake/g95.t b/distrib/msw/tmake/g95.t index 885706cbe9..7ba3b7d772 100644 --- a/distrib/msw/tmake/g95.t +++ b/distrib/msw/tmake/g95.t @@ -2,7 +2,7 @@ #! File: g95.t #! Purpose: tmake template file from which makefile.g95 is generated by running #! tmake -t g95 wxwin.pro -o makefile.g95 -#! Author: Vadim Zeitlin +#! Author: Vadim Zeitlin, Robert Roebling, Julian Smart #! Created: 14.07.99 #! Version: $Id$ #!############################################################################# @@ -51,67 +51,129 @@ # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T! # -# File: makefile.unx -# Author: Julian Smart +# File: makefile.g95 +# Author: Julian Smart, Robert Roebling, Vadim Zeitlin # Created: 1993 -# Updated: -# Copyright:(c) 1993, AIAI, University of Edinburgh -# -# "@(#)makefile.unx 1.2 5/9/94" +# Updated: 1999 +# Copyright:(c) 1993, AIAI, University of Edinburgh, +# Copyright:(c) 1999, Vadim Zeitlin +# Copyright:(c) 1999, Robert Roebling # # Makefile for libwx.a # Replace this with your own path if necessary WXDIR = ../.. -# All common UNIX compiler flags and options are now in +# All common compiler flags and options are now in # this central makefile. include $(WXDIR)/src/makeg95.env -# IMPORTANT: if you want to link in subsidiary libraries, -# required for some optional parts of wxWindows, you must -# set EXTRATARGETS and EXTRAOBJS to match the settings in wx_setup.h. -# Having done this, you won't have to worry about linking them -# into each application. -# -# Here's the full list. -# prologio: Required if using the wxWindows resource facility -# USE_WX_RESOURCES should be 1 -# xmgauge: Gauge class (required for Motif only) -# USE_GAUGE should be 1 -# xpm: XPM pixmap support -# USE_XPM_IN_X should be 1 -# wxstring: string class -# USE_GNU_WXSTRING should be 1 -# -# Unfortunately, 'ar' doesn't like combining objects and libraries, -# so we must identify all the objects from the subordinate libraries. Yuck! -XPMSRC=../../contrib/wxxpm/objects$(GUISUFFIX) -XPMOBJS=$(XPMSRC)/crbuffri.$(OBJSUFF) $(XPMSRC)/crbuffrp.$(OBJSUFF) $(XPMSRC)/crdatfri.$(OBJSUFF) $(XPMSRC)/crdatfrp.$(OBJSUFF)\ - $(XPMSRC)/create.$(OBJSUFF) $(XPMSRC)/crifrbuf.$(OBJSUFF) $(XPMSRC)/crifrdat.$(OBJSUFF) $(XPMSRC)/crpfrbuf.$(OBJSUFF) $(XPMSRC)/crpfrdat.$(OBJSUFF)\ - $(XPMSRC)/data.$(OBJSUFF) $(XPMSRC)/hashtab.$(OBJSUFF) $(XPMSRC)/misc.$(OBJSUFF) $(XPMSRC)/parse.$(OBJSUFF) $(XPMSRC)/rdftodat.$(OBJSUFF)\ - $(XPMSRC)/rdftoi.$(OBJSUFF) $(XPMSRC)/rdftop.$(OBJSUFF) $(XPMSRC)/rgb.$(OBJSUFF) $(XPMSRC)/scan.$(OBJSUFF) $(XPMSRC)/simx.$(OBJSUFF)\ - $(XPMSRC)/wrffrdat.$(OBJSUFF) $(XPMSRC)/wrffri.$(OBJSUFF) $(XPMSRC)/wrffrp.$(OBJSUFF) - # Subordinate library possibilities EXTRAOBJS= -GENDIR=../generic -COMMDIR=../common -XPMDIR=../xpm -OLEDIR=ole -MSWDIR=. +GENDIR = $(WXDIR)/src/generic +COMMDIR = $(WXDIR)/src/common +XPMDIR = $(WXDIR)/src/xpm +PNGDIR = $(WXDIR)/src/png +JPEGDIR = $(WXDIR)/src/jpeg +ZLIBDIR = $(WXDIR)/src/zlib +OLEDIR = $(WXDIR)/src/msw/ole +MSWDIR = $(WXDIR)/src/msw DOCDIR = $(WXDIR)\docs -GENERICOBJS= #$ ExpandList("WXGENERICOBJS"); +GENERICOBJS = \ + #$ ExpandList("WXGENERICOBJS"); -COMMONOBJS = \ +COMMONOBJS = \ $(COMMDIR)/y_tab.$(OBJSUFF) \ #$ ExpandList("WXCOMMONOBJS"); -MSWOBJS = #$ ExpandList("WXMSWOBJS"); +MSWOBJS = \ + #$ ExpandList("WXMSWOBJS"); + +ZLIBOBJS = \ + $(ZLIBDIR)/adler32.$(OBJSUFF) \ + $(ZLIBDIR)/compress.$(OBJSUFF) \ + $(ZLIBDIR)/crc32.$(OBJSUFF) \ + $(ZLIBDIR)/gzio.$(OBJSUFF) \ + $(ZLIBDIR)/uncompr.$(OBJSUFF) \ + $(ZLIBDIR)/deflate.$(OBJSUFF) \ + $(ZLIBDIR)/trees.$(OBJSUFF) \ + $(ZLIBDIR)/zutil.$(OBJSUFF) \ + $(ZLIBDIR)/inflate.$(OBJSUFF) \ + $(ZLIBDIR)/infblock.$(OBJSUFF) \ + $(ZLIBDIR)/inftrees.$(OBJSUFF) \ + $(ZLIBDIR)/infcodes.$(OBJSUFF) \ + $(ZLIBDIR)/infutil.$(OBJSUFF) \ + $(ZLIBDIR)/inffast.$(OBJSUFF) + +PNGOBJS = \ + $(PNGDIR)/png.$(OBJSUFF) \ + $(PNGDIR)/pngread.$(OBJSUFF) \ + $(PNGDIR)/pngrtran.$(OBJSUFF) \ + $(PNGDIR)/pngrutil.$(OBJSUFF) \ + $(PNGDIR)/pngpread.$(OBJSUFF) \ + $(PNGDIR)/pngtrans.$(OBJSUFF) \ + $(PNGDIR)/pngwrite.$(OBJSUFF) \ + $(PNGDIR)/pngwtran.$(OBJSUFF) \ + $(PNGDIR)/pngwutil.$(OBJSUFF) \ + $(PNGDIR)/pngerror.$(OBJSUFF) \ + $(PNGDIR)/pngmem.$(OBJSUFF) \ + $(PNGDIR)/pngwio.$(OBJSUFF) \ + $(PNGDIR)/pngrio.$(OBJSUFF) \ + $(PNGDIR)/pngget.$(OBJSUFF) \ + $(PNGDIR)/pngset.$(OBJSUFF) + + +JPEGOBJS = \ + $(JPEGDIR)/jcomapi.$(OBJSUFF) \ + $(JPEGDIR)/jutils.$(OBJSUFF) \ + $(JPEGDIR)/jerror.$(OBJSUFF) \ + $(JPEGDIR)/jmemmgr.$(OBJSUFF) \ + $(JPEGDIR)/jmemnobs.$(OBJSUFF) \ + $(JPEGDIR)/jcapimin.$(OBJSUFF) \ + $(JPEGDIR)/jcapistd.$(OBJSUFF) \ + $(JPEGDIR)/jctrans.$(OBJSUFF) \ + $(JPEGDIR)/jcparam.$(OBJSUFF) \ + $(JPEGDIR)/jdatadst.$(OBJSUFF) \ + $(JPEGDIR)/jcinit.$(OBJSUFF) \ + $(JPEGDIR)/jcmaster.$(OBJSUFF) \ + $(JPEGDIR)/jcmarker.$(OBJSUFF) \ + $(JPEGDIR)/jcmainct.$(OBJSUFF) \ + $(JPEGDIR)/jcprepct.$(OBJSUFF) \ + $(JPEGDIR)/jccoefct.$(OBJSUFF) \ + $(JPEGDIR)/jccolor.$(OBJSUFF) \ + $(JPEGDIR)/jcsample.$(OBJSUFF) \ + $(JPEGDIR)/jchuff.$(OBJSUFF) \ + $(JPEGDIR)/jcphuff.$(OBJSUFF) \ + $(JPEGDIR)/jcdctmgr.$(OBJSUFF) \ + $(JPEGDIR)/jfdctfst.$(OBJSUFF) \ + $(JPEGDIR)/jfdctflt.$(OBJSUFF) \ + $(JPEGDIR)/jfdctint.$(OBJSUFF) \ + $(JPEGDIR)/jdapimin.$(OBJSUFF) \ + $(JPEGDIR)/jdapistd.$(OBJSUFF) \ + $(JPEGDIR)/jdtrans.$(OBJSUFF) \ + $(JPEGDIR)/jdatasrc.$(OBJSUFF) \ + $(JPEGDIR)/jdmaster.$(OBJSUFF) \ + $(JPEGDIR)/jdinput.$(OBJSUFF) \ + $(JPEGDIR)/jdmarker.$(OBJSUFF) \ + $(JPEGDIR)/jdhuff.$(OBJSUFF) \ + $(JPEGDIR)/jdphuff.$(OBJSUFF) \ + $(JPEGDIR)/jdmainct.$(OBJSUFF) \ + $(JPEGDIR)/jdcoefct.$(OBJSUFF) \ + $(JPEGDIR)/jdpostct.$(OBJSUFF) \ + $(JPEGDIR)/jddctmgr.$(OBJSUFF) \ + $(JPEGDIR)/jidctfst.$(OBJSUFF) \ + $(JPEGDIR)/jidctflt.$(OBJSUFF) \ + $(JPEGDIR)/jidctint.$(OBJSUFF) \ + $(JPEGDIR)/jidctred.$(OBJSUFF) \ + $(JPEGDIR)/jdsample.$(OBJSUFF) \ + $(JPEGDIR)/jdcolor.$(OBJSUFF) \ + $(JPEGDIR)/jquant1.$(OBJSUFF) \ + $(JPEGDIR)/jquant2.$(OBJSUFF) \ + $(JPEGDIR)/jdmerge.$(OBJSUFF) XPMOBJECTS = $(XPMDIR)/crbuffri.o\ $(XPMDIR)/crdatfri.o\ @@ -125,15 +187,11 @@ XPMOBJECTS = $(XPMDIR)/crbuffri.o\ $(XPMDIR)/simx.o $(XPMDIR)/wrffrdat.o\ $(XPMDIR)/wrffrp.o $(XPMDIR)/wrffri.o -OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) # $(XPMOBJECTS) +OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) \ + $(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS) all: $(OBJECTS) $(WXLIB) -base: - cd $(WXDIR)/src/common; $(MAKE) -f makefile.g95 GUI=$(GUI) GUISUFFIX=$(GUISUFFIX) CC=$(CC)\ - OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' - - $(WXLIB): $(OBJECTS) $(EXTRAOBJS) ar $(AROPTIONS) $@ $(EXTRAOBJS) $(OBJECTS) $(RANLIB) $@ @@ -179,15 +237,6 @@ $(COMMDIR)/lex_yy.c: $(COMMDIR)/doslex.c # $(YACC) $(COMMDIR)/parser.y # mv y.tab.c $(COMMDIR)/y_tab.c -# Extra targets -rcparser: - cd $(WXDIR)/utils/rcparser/src; $(MAKE) -f makefile.g95 - cd $(WXDIR)/src/msw - -clean_rcp: - cd $(WXDIR)/utils/rcparser/src; $(MAKE) -f makefile.g95 clean - cd $(WXDIR)/src/msw - clean: -erase *.o -erase core @@ -195,6 +244,9 @@ clean: -erase ..\common\lex_yy.c -erase ..\common\*.o -erase ..\generic\*.o + -erase ..\png\*.o + -erase ..\zlib\*.o + -erase ..\jpeg\*.o -erase ..\..\lib\libwx$(GUISUFFIX).a cleanall: clean diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index a85be22c80..8ad6661781 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -276,15 +276,33 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event)) dc.DrawText( "This is text", 110, 10 ); - dc.DrawIcon( wxICON(mondrian), 110, 40 ); + dc.SetFont( wxFont( 18, wxSWISS, 0, 0 ) ); + + dc.DrawText( "This is Swiss 18pt text.", 110, 40 ); + + long length; + long height; + long descent; + dc.GetTextExtent( "This is Swiss 18pt text.", &length, &height, &descent ); + wxString text; + text.Printf( "Dimensions are length %ld, height %ld, descent %ld", length, height, descent ); + dc.DrawText( text, 110, 80 ); + + dc.DrawRectangle( 100, 40, 4, height ); + + text.Printf( "CharHeight() returns: %d", dc.GetCharHeight() ); + dc.DrawText( text, 110, 120 ); + + + dc.DrawIcon( wxICON(mondrian), 310, 40 ); - DrawTestLines( 0, 20, 0, dc ); + DrawTestLines( 0, 200, 0, dc ); - DrawTestLines( 0, 220, 1, dc ); + DrawTestLines( 0, 400, 1, dc ); - DrawTestLines( 0, 420, 2, dc ); + DrawTestLines( 0, 600, 2, dc ); - DrawTestLines( 0, 620, 6, dc ); + DrawTestLines( 0, 800, 6, dc ); } diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index fa53cd8b6e..d693d7a278 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -638,6 +638,10 @@ void wxDC::DoDrawText(const wxString& text, long x, long y) if (m_textBackgroundColour.Ok()) (void)SetBkColor(GetHdc(), old_background); + // background colour is used only for DrawText, otherwise + // always TRANSPARENT, RR + SetBkMode(GetHdc(), TRANSPARENT); + CalcBoundingBox(x, y); long w, h; @@ -821,10 +825,15 @@ void wxDC::SetBackgroundMode(int mode) { m_backgroundMode = mode; + // SetBackgroundColour now only refers to text background + // and m_backgroundMode is used there + +/* if (m_backgroundMode == wxTRANSPARENT) ::SetBkMode(GetHdc(), TRANSPARENT); else - ::SetBkMode(GetHdc(), OPAQUE); + ::SetBkMode(GetHdc(), OPAQUE); +*/ } void wxDC::SetLogicalFunction(int function) diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index b6b44efe1b..ea236015d5 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -135,6 +135,11 @@ wxClientDC::wxClientDC(wxWindow *the_canvas) m_canvas = the_canvas; m_hDC = (WXHDC) ::GetDC(GetWinHwnd(the_canvas)); + // the background mode is only used for text background + // and is set in DrawText() to OPAQUE as required, other- + // wise always TRANSPARENT, RR + ::SetBkMode( GetHdc(), TRANSPARENT ); + SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); } @@ -205,6 +210,11 @@ wxPaintDC::wxPaintDC(wxWindow *canvas) ms_cache.Add(new wxPaintDCInfo(m_canvas, this)); } + // the background mode is only used for text background + // and is set in DrawText() to OPAQUE as required, other- + // wise always TRANSPARENT, RR + ::SetBkMode( GetHdc(), TRANSPARENT ); + SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); } diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index 1a4b151391..03e89a1c91 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -24,10 +24,9 @@ #include "wx/utils.h" #endif -#include "wx/dcmemory.h" +#include "wx/msw/private.h" -#include -#include "wx/msw/winundef.h" +#include "wx/dcmemory.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) @@ -46,6 +45,12 @@ wxMemoryDC::wxMemoryDC(void) SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); + + // the background mode is only used for text background + // and is set in DrawText() to OPAQUE as required, other- + // wise always TRANSPARENT, RR + ::SetBkMode( GetHdc(), TRANSPARENT ); + } wxMemoryDC::wxMemoryDC(wxDC *old_dc) @@ -59,6 +64,12 @@ wxMemoryDC::wxMemoryDC(wxDC *old_dc) SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); + + // the background mode is only used for text background + // and is set in DrawText() to OPAQUE as required, other- + // wise always TRANSPARENT, RR + ::SetBkMode( GetHdc(), TRANSPARENT ); + } wxMemoryDC::~wxMemoryDC(void) diff --git a/src/msw/dcscreen.cpp b/src/msw/dcscreen.cpp index 64c6908cfd..470feded37 100644 --- a/src/msw/dcscreen.cpp +++ b/src/msw/dcscreen.cpp @@ -38,6 +38,11 @@ wxScreenDC::wxScreenDC(void) { m_hDC = (WXHDC) ::GetDC((HWND) NULL); m_hDCCount ++; + + // the background mode is only used for text background + // and is set in DrawText() to OPAQUE as required, other- + // wise always TRANSPARENT, RR + ::SetBkMode( GetHdc(), TRANSPARENT ); } wxScreenDC::~wxScreenDC(void) diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 6b006ef58c..04190303e5 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -1,64 +1,43 @@ -# This file was automatically generated by tmake at 17:20, 1999/07/21 +# This file was automatically generated by tmake at 17:53, 1999/07/23 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T! # -# File: makefile.unx -# Author: Julian Smart +# File: makefile.g95 +# Author: Julian Smart, Robert Roebling, Vadim Zeitlin # Created: 1993 -# Updated: -# Copyright:(c) 1993, AIAI, University of Edinburgh -# -# "@(#)makefile.unx 1.2 5/9/94" +# Updated: 1999 +# Copyright:(c) 1993, AIAI, University of Edinburgh, +# Copyright:(c) 1999, Vadim Zeitlin +# Copyright:(c) 1999, Robert Roebling # # Makefile for libwx.a # Replace this with your own path if necessary WXDIR = ../.. -# All common UNIX compiler flags and options are now in +# All common compiler flags and options are now in # this central makefile. include $(WXDIR)/src/makeg95.env -# IMPORTANT: if you want to link in subsidiary libraries, -# required for some optional parts of wxWindows, you must -# set EXTRATARGETS and EXTRAOBJS to match the settings in wx_setup.h. -# Having done this, you won't have to worry about linking them -# into each application. -# -# Here's the full list. -# prologio: Required if using the wxWindows resource facility -# USE_WX_RESOURCES should be 1 -# xmgauge: Gauge class (required for Motif only) -# USE_GAUGE should be 1 -# xpm: XPM pixmap support -# USE_XPM_IN_X should be 1 -# wxstring: string class -# USE_GNU_WXSTRING should be 1 -# -# Unfortunately, 'ar' doesn't like combining objects and libraries, -# so we must identify all the objects from the subordinate libraries. Yuck! -XPMSRC=../../contrib/wxxpm/objects$(GUISUFFIX) -XPMOBJS=$(XPMSRC)/crbuffri.$(OBJSUFF) $(XPMSRC)/crbuffrp.$(OBJSUFF) $(XPMSRC)/crdatfri.$(OBJSUFF) $(XPMSRC)/crdatfrp.$(OBJSUFF)\ - $(XPMSRC)/create.$(OBJSUFF) $(XPMSRC)/crifrbuf.$(OBJSUFF) $(XPMSRC)/crifrdat.$(OBJSUFF) $(XPMSRC)/crpfrbuf.$(OBJSUFF) $(XPMSRC)/crpfrdat.$(OBJSUFF)\ - $(XPMSRC)/data.$(OBJSUFF) $(XPMSRC)/hashtab.$(OBJSUFF) $(XPMSRC)/misc.$(OBJSUFF) $(XPMSRC)/parse.$(OBJSUFF) $(XPMSRC)/rdftodat.$(OBJSUFF)\ - $(XPMSRC)/rdftoi.$(OBJSUFF) $(XPMSRC)/rdftop.$(OBJSUFF) $(XPMSRC)/rgb.$(OBJSUFF) $(XPMSRC)/scan.$(OBJSUFF) $(XPMSRC)/simx.$(OBJSUFF)\ - $(XPMSRC)/wrffrdat.$(OBJSUFF) $(XPMSRC)/wrffri.$(OBJSUFF) $(XPMSRC)/wrffrp.$(OBJSUFF) - # Subordinate library possibilities EXTRAOBJS= -GENDIR=../generic -COMMDIR=../common -XPMDIR=../xpm -OLEDIR=ole -MSWDIR=. +GENDIR = $(WXDIR)/src/generic +COMMDIR = $(WXDIR)/src/common +XPMDIR = $(WXDIR)/src/xpm +PNGDIR = $(WXDIR)/src/png +JPEGDIR = $(WXDIR)/src/jpeg +ZLIBDIR = $(WXDIR)/src/zlib +OLEDIR = $(WXDIR)/src/msw/ole +MSWDIR = $(WXDIR)/src/msw DOCDIR = $(WXDIR)\docs -GENERICOBJS= $(GENDIR)/busyinfo.$(OBJSUFF) \ +GENERICOBJS = \ + $(GENDIR)/busyinfo.$(OBJSUFF) \ $(GENDIR)/choicdgg.$(OBJSUFF) \ $(GENDIR)/dirdlgg.$(OBJSUFF) \ $(GENDIR)/extdlgg.$(OBJSUFF) \ @@ -77,7 +56,7 @@ GENERICOBJS= $(GENDIR)/busyinfo.$(OBJSUFF) \ $(GENDIR)/textdlgg.$(OBJSUFF) \ $(GENDIR)/tipdlg.$(OBJSUFF) -COMMONOBJS = \ +COMMONOBJS = \ $(COMMDIR)/y_tab.$(OBJSUFF) \ $(COMMDIR)/cmndata.$(OBJSUFF) \ $(COMMDIR)/config.$(OBJSUFF) \ @@ -129,7 +108,6 @@ COMMONOBJS = \ $(COMMDIR)/resource.$(OBJSUFF) \ $(COMMDIR)/sckaddr.$(OBJSUFF) \ $(COMMDIR)/sckfile.$(OBJSUFF) \ - $(COMMDIR)/sckint.$(OBJSUFF) \ $(COMMDIR)/sckipc.$(OBJSUFF) \ $(COMMDIR)/sckstrm.$(OBJSUFF) \ $(COMMDIR)/socket.$(OBJSUFF) \ @@ -156,7 +134,8 @@ COMMONOBJS = \ $(COMMDIR)/zipstream.$(OBJSUFF) \ $(COMMDIR)/zstream.$(OBJSUFF) -MSWOBJS = accel.$(OBJSUFF) \ +MSWOBJS = \ + accel.$(OBJSUFF) \ app.$(OBJSUFF) \ bitmap.$(OBJSUFF) \ bmpbuttn.$(OBJSUFF) \ @@ -241,6 +220,88 @@ MSWOBJS = accel.$(OBJSUFF) \ window.$(OBJSUFF) \ xpmhand.$(OBJSUFF) +ZLIBOBJS = \ + $(ZLIBDIR)/adler32.$(OBJSUFF) \ + $(ZLIBDIR)/compress.$(OBJSUFF) \ + $(ZLIBDIR)/crc32.$(OBJSUFF) \ + $(ZLIBDIR)/gzio.$(OBJSUFF) \ + $(ZLIBDIR)/uncompr.$(OBJSUFF) \ + $(ZLIBDIR)/deflate.$(OBJSUFF) \ + $(ZLIBDIR)/trees.$(OBJSUFF) \ + $(ZLIBDIR)/zutil.$(OBJSUFF) \ + $(ZLIBDIR)/inflate.$(OBJSUFF) \ + $(ZLIBDIR)/infblock.$(OBJSUFF) \ + $(ZLIBDIR)/inftrees.$(OBJSUFF) \ + $(ZLIBDIR)/infcodes.$(OBJSUFF) \ + $(ZLIBDIR)/infutil.$(OBJSUFF) \ + $(ZLIBDIR)/inffast.$(OBJSUFF) + +PNGOBJS = \ + $(PNGDIR)/png.$(OBJSUFF) \ + $(PNGDIR)/pngread.$(OBJSUFF) \ + $(PNGDIR)/pngrtran.$(OBJSUFF) \ + $(PNGDIR)/pngrutil.$(OBJSUFF) \ + $(PNGDIR)/pngpread.$(OBJSUFF) \ + $(PNGDIR)/pngtrans.$(OBJSUFF) \ + $(PNGDIR)/pngwrite.$(OBJSUFF) \ + $(PNGDIR)/pngwtran.$(OBJSUFF) \ + $(PNGDIR)/pngwutil.$(OBJSUFF) \ + $(PNGDIR)/pngerror.$(OBJSUFF) \ + $(PNGDIR)/pngmem.$(OBJSUFF) \ + $(PNGDIR)/pngwio.$(OBJSUFF) \ + $(PNGDIR)/pngrio.$(OBJSUFF) \ + $(PNGDIR)/pngget.$(OBJSUFF) \ + $(PNGDIR)/pngset.$(OBJSUFF) + + +JPEGOBJS = \ + $(JPEGDIR)/jcomapi.$(OBJSUFF) \ + $(JPEGDIR)/jutils.$(OBJSUFF) \ + $(JPEGDIR)/jerror.$(OBJSUFF) \ + $(JPEGDIR)/jmemmgr.$(OBJSUFF) \ + $(JPEGDIR)/jmemnobs.$(OBJSUFF) \ + $(JPEGDIR)/jcapimin.$(OBJSUFF) \ + $(JPEGDIR)/jcapistd.$(OBJSUFF) \ + $(JPEGDIR)/jctrans.$(OBJSUFF) \ + $(JPEGDIR)/jcparam.$(OBJSUFF) \ + $(JPEGDIR)/jdatadst.$(OBJSUFF) \ + $(JPEGDIR)/jcinit.$(OBJSUFF) \ + $(JPEGDIR)/jcmaster.$(OBJSUFF) \ + $(JPEGDIR)/jcmarker.$(OBJSUFF) \ + $(JPEGDIR)/jcmainct.$(OBJSUFF) \ + $(JPEGDIR)/jcprepct.$(OBJSUFF) \ + $(JPEGDIR)/jccoefct.$(OBJSUFF) \ + $(JPEGDIR)/jccolor.$(OBJSUFF) \ + $(JPEGDIR)/jcsample.$(OBJSUFF) \ + $(JPEGDIR)/jchuff.$(OBJSUFF) \ + $(JPEGDIR)/jcphuff.$(OBJSUFF) \ + $(JPEGDIR)/jcdctmgr.$(OBJSUFF) \ + $(JPEGDIR)/jfdctfst.$(OBJSUFF) \ + $(JPEGDIR)/jfdctflt.$(OBJSUFF) \ + $(JPEGDIR)/jfdctint.$(OBJSUFF) \ + $(JPEGDIR)/jdapimin.$(OBJSUFF) \ + $(JPEGDIR)/jdapistd.$(OBJSUFF) \ + $(JPEGDIR)/jdtrans.$(OBJSUFF) \ + $(JPEGDIR)/jdatasrc.$(OBJSUFF) \ + $(JPEGDIR)/jdmaster.$(OBJSUFF) \ + $(JPEGDIR)/jdinput.$(OBJSUFF) \ + $(JPEGDIR)/jdmarker.$(OBJSUFF) \ + $(JPEGDIR)/jdhuff.$(OBJSUFF) \ + $(JPEGDIR)/jdphuff.$(OBJSUFF) \ + $(JPEGDIR)/jdmainct.$(OBJSUFF) \ + $(JPEGDIR)/jdcoefct.$(OBJSUFF) \ + $(JPEGDIR)/jdpostct.$(OBJSUFF) \ + $(JPEGDIR)/jddctmgr.$(OBJSUFF) \ + $(JPEGDIR)/jidctfst.$(OBJSUFF) \ + $(JPEGDIR)/jidctflt.$(OBJSUFF) \ + $(JPEGDIR)/jidctint.$(OBJSUFF) \ + $(JPEGDIR)/jidctred.$(OBJSUFF) \ + $(JPEGDIR)/jdsample.$(OBJSUFF) \ + $(JPEGDIR)/jdcolor.$(OBJSUFF) \ + $(JPEGDIR)/jquant1.$(OBJSUFF) \ + $(JPEGDIR)/jquant2.$(OBJSUFF) \ + $(JPEGDIR)/jdmerge.$(OBJSUFF) + XPMOBJECTS = $(XPMDIR)/crbuffri.o\ $(XPMDIR)/crdatfri.o\ $(XPMDIR)/create.o $(XPMDIR)/crifrbuf.o\ @@ -253,15 +314,11 @@ XPMOBJECTS = $(XPMDIR)/crbuffri.o\ $(XPMDIR)/simx.o $(XPMDIR)/wrffrdat.o\ $(XPMDIR)/wrffrp.o $(XPMDIR)/wrffri.o -OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) # $(XPMOBJECTS) +OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) \ + $(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS) all: $(OBJECTS) $(WXLIB) -base: - cd $(WXDIR)/src/common; $(MAKE) -f makefile.g95 GUI=$(GUI) GUISUFFIX=$(GUISUFFIX) CC=$(CC)\ - OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' - - $(WXLIB): $(OBJECTS) $(EXTRAOBJS) ar $(AROPTIONS) $@ $(EXTRAOBJS) $(OBJECTS) $(RANLIB) $@ @@ -307,15 +364,6 @@ $(COMMDIR)/lex_yy.c: $(COMMDIR)/doslex.c # $(YACC) $(COMMDIR)/parser.y # mv y.tab.c $(COMMDIR)/y_tab.c -# Extra targets -rcparser: - cd $(WXDIR)/utils/rcparser/src; $(MAKE) -f makefile.g95 - cd $(WXDIR)/src/msw - -clean_rcp: - cd $(WXDIR)/utils/rcparser/src; $(MAKE) -f makefile.g95 clean - cd $(WXDIR)/src/msw - clean: -erase *.o -erase core @@ -323,6 +371,9 @@ clean: -erase ..\common\lex_yy.c -erase ..\common\*.o -erase ..\generic\*.o + -erase ..\png\*.o + -erase ..\zlib\*.o + -erase ..\jpeg\*.o -erase ..\..\lib\libwx$(GUISUFFIX).a cleanall: clean diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index cf710db37d..53b26ab1e3 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -69,7 +69,7 @@ wxPenRefData::~wxPenRefData() wxPen::wxPen() { - if ( wxThePenList ) + if (wxThePenList) wxThePenList->AddPen(this); } @@ -125,145 +125,168 @@ wxPen::wxPen(const wxColour& col, int Width, int Style) wxPen::wxPen(const wxBitmap& stipple, int Width) { - m_refData = new wxPenRefData; + m_refData = new wxPenRefData; // M_PENDATA->m_colour = col; - M_PENDATA->m_stipple = stipple; - M_PENDATA->m_width = Width; - M_PENDATA->m_style = wxSTIPPLE; - M_PENDATA->m_join = wxJOIN_ROUND ; - M_PENDATA->m_cap = wxCAP_ROUND ; - M_PENDATA->m_nbDash = 0 ; - M_PENDATA->m_dash = 0 ; - M_PENDATA->m_hPen = 0 ; + M_PENDATA->m_stipple = stipple; + M_PENDATA->m_width = Width; + M_PENDATA->m_style = wxSTIPPLE; + M_PENDATA->m_join = wxJOIN_ROUND ; + M_PENDATA->m_cap = wxCAP_ROUND ; + M_PENDATA->m_nbDash = 0 ; + M_PENDATA->m_dash = 0 ; + M_PENDATA->m_hPen = 0 ; - RealizeResource(); + RealizeResource(); - if ( wxThePenList ) - wxThePenList->AddPen(this); + if (wxThePenList) + wxThePenList->AddPen(this); } bool wxPen::RealizeResource() { - if (M_PENDATA && (M_PENDATA->m_hPen == 0)) - { - if (M_PENDATA->m_style==wxTRANSPARENT) - { - M_PENDATA->m_hPen = (WXHPEN) ::GetStockObject(NULL_PEN); - return TRUE; - } - - COLORREF ms_colour = 0 ; - ms_colour = M_PENDATA->m_colour.GetPixel() ; - - // Join style, Cap style, Pen Stippling only on Win32. - // Currently no time to find equivalent on Win3.1, sorry - // [if such equiv exist!!] + if (M_PENDATA && (M_PENDATA->m_hPen == 0)) + { + if (M_PENDATA->m_style==wxTRANSPARENT) + { + M_PENDATA->m_hPen = (WXHPEN) ::GetStockObject(NULL_PEN); + return TRUE; + } + + COLORREF ms_colour = 0; + ms_colour = M_PENDATA->m_colour.GetPixel(); + + // Join style, Cap style, Pen Stippling only on Win32. + // Currently no time to find equivalent on Win3.1, sorry + // [if such equiv exist!!] #ifdef __WIN32__ - if (M_PENDATA->m_join==wxJOIN_ROUND && - M_PENDATA->m_cap==wxCAP_ROUND && - M_PENDATA->m_style!=wxUSER_DASH && - M_PENDATA->m_style!=wxSTIPPLE && - M_PENDATA->m_width <= 1 - ) - M_PENDATA->m_hPen = (WXHPEN) CreatePen(wx2msPenStyle(M_PENDATA->m_style), M_PENDATA->m_width, ms_colour); - else - { - DWORD ms_style = PS_GEOMETRIC|wx2msPenStyle(M_PENDATA->m_style) ; - - LOGBRUSH logb ; - - switch(M_PENDATA->m_join) - { - case wxJOIN_BEVEL: ms_style |= PS_JOIN_BEVEL ; break ; - case wxJOIN_MITER: ms_style |= PS_JOIN_MITER ; break ; - default: - case wxJOIN_ROUND: ms_style |= PS_JOIN_ROUND ; break ; - } - - switch(M_PENDATA->m_cap) - { - case wxCAP_PROJECTING: ms_style |= PS_ENDCAP_SQUARE ; break ; - case wxCAP_BUTT: ms_style |= PS_ENDCAP_FLAT ; break ; - default: - case wxCAP_ROUND: ms_style |= PS_ENDCAP_ROUND ; break ; - } - - switch(M_PENDATA->m_style) - { - case wxSTIPPLE: - logb.lbStyle = BS_PATTERN ; - if (M_PENDATA->m_stipple.Ok()) - logb.lbHatch = (LONG)M_PENDATA->m_stipple.GetHBITMAP() ; - else - logb.lbHatch = (LONG)0 ; - break ; - case wxBDIAGONAL_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_BDIAGONAL ; - break ; - case wxCROSSDIAG_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_DIAGCROSS ; - break ; - case wxFDIAGONAL_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_FDIAGONAL ; - break ; - case wxCROSS_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_CROSS ; - break ; - case wxHORIZONTAL_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_HORIZONTAL ; - break ; - case wxVERTICAL_HATCH: - logb.lbStyle = BS_HATCHED ; - logb.lbHatch = HS_VERTICAL ; - break ; - default: - logb.lbStyle = BS_SOLID ; - // this should be unnecessary (it's unused) but suppresses the Purigy - // messages about uninitialized memory read + if (M_PENDATA->m_join==wxJOIN_ROUND && + M_PENDATA->m_cap==wxCAP_ROUND && + M_PENDATA->m_style!=wxUSER_DASH && + M_PENDATA->m_style!=wxSTIPPLE && + M_PENDATA->m_width <= 1) + { + M_PENDATA->m_hPen = + (WXHPEN) CreatePen( wx2msPenStyle(M_PENDATA->m_style), + M_PENDATA->m_width, + ms_colour ); + } + else + { + DWORD ms_style = PS_GEOMETRIC | wx2msPenStyle(M_PENDATA->m_style); + + switch(M_PENDATA->m_join) + { + case wxJOIN_BEVEL: ms_style |= PS_JOIN_BEVEL; break; + case wxJOIN_MITER: ms_style |= PS_JOIN_MITER; break; + default: + case wxJOIN_ROUND: ms_style |= PS_JOIN_ROUND; break; + } + + switch(M_PENDATA->m_cap) + { + case wxCAP_PROJECTING: ms_style |= PS_ENDCAP_SQUARE; break; + case wxCAP_BUTT: ms_style |= PS_ENDCAP_FLAT; break; + default: + case wxCAP_ROUND: ms_style |= PS_ENDCAP_ROUND; break; + } + + LOGBRUSH logb; + + switch(M_PENDATA->m_style) + { + case wxSTIPPLE: + logb.lbStyle = BS_PATTERN ; + if (M_PENDATA->m_stipple.Ok()) + logb.lbHatch = (LONG)M_PENDATA->m_stipple.GetHBITMAP(); + else + logb.lbHatch = (LONG)0; + break; + case wxBDIAGONAL_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_BDIAGONAL; + break; + case wxCROSSDIAG_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_DIAGCROSS; + break; + case wxFDIAGONAL_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_FDIAGONAL; + break; + case wxCROSS_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_CROSS; + break; + case wxHORIZONTAL_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_HORIZONTAL; + break; + case wxVERTICAL_HATCH: + logb.lbStyle = BS_HATCHED; + logb.lbHatch = HS_VERTICAL; + break; + default: + logb.lbStyle = BS_SOLID; #ifdef __WXDEBUG__ - logb.lbHatch = 0; + // this should be unnecessary (it's unused) but suppresses the Purigy + // messages about uninitialized memory read + logb.lbHatch = 0; #endif - break ; - } - logb.lbColor = ms_colour ; - wxDash *real_dash ; - if (M_PENDATA->m_style==wxUSER_DASH && M_PENDATA->m_nbDash && M_PENDATA->m_dash) - { - wxBell(); - real_dash = new wxDash[M_PENDATA->m_nbDash] ; - int i; - for (i=0;im_nbDash;i++) - real_dash[i] = M_PENDATA->m_dash[i] * M_PENDATA->m_width ; - } - else - real_dash = 0 ; - - // Win32s doesn't have ExtCreatePen function... - if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95) - M_PENDATA->m_hPen = (WXHPEN) ExtCreatePen(ms_style,M_PENDATA->m_width,&logb, - M_PENDATA->m_style==wxUSER_DASH ? M_PENDATA->m_nbDash:0, (const DWORD *)real_dash); - else - M_PENDATA->m_hPen = (WXHPEN) CreatePen(wx2msPenStyle(M_PENDATA->m_style), M_PENDATA->m_width, ms_colour); - - if (real_dash) - delete [] real_dash ; - } + break; + } + + logb.lbColor = ms_colour; + + wxDash *real_dash; + if (M_PENDATA->m_style==wxUSER_DASH && M_PENDATA->m_nbDash && M_PENDATA->m_dash) + { + real_dash = new wxDash[M_PENDATA->m_nbDash]; + int i; + for (i=0; im_nbDash; i++) + real_dash[i] = M_PENDATA->m_dash[i] * M_PENDATA->m_width; + } + else + { + real_dash = 0; + } + + // Win32s doesn't have ExtCreatePen function... + if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95) + { + M_PENDATA->m_hPen = + (WXHPEN) ExtCreatePen( ms_style, + M_PENDATA->m_width, + &logb, + M_PENDATA->m_style==wxUSER_DASH + ? M_PENDATA->m_nbDash + : 0, + (const DWORD*)real_dash ); + } + else + { + M_PENDATA->m_hPen = + (WXHPEN) CreatePen( wx2msPenStyle(M_PENDATA->m_style), + M_PENDATA->m_width, + ms_colour ); + } + + if (real_dash) + delete [] real_dash; + } #else - M_PENDATA->m_hPen = (WXHPEN) CreatePen(wx2msPenStyle(M_PENDATA->m_style), M_PENDATA->m_width, ms_colour); + M_PENDATA->m_hPen = + (WXHPEN) CreatePen( wx2msPenStyle(M_PENDATA->m_style), + M_PENDATA->m_width, + ms_colour ); #endif #ifdef WXDEBUG_CREATE - if (M_PENDATA->m_hPen==0) - wxError("Cannot create pen","Internal error") ; + if (M_PENDATA->m_hPen==0) + wxError("Cannot create pen","Internal error") ; #endif - return TRUE; - } - return FALSE; + return TRUE; + } + return FALSE; } WXHANDLE wxPen::GetResourceHandle() @@ -381,45 +404,42 @@ void wxPen::SetCap(int Cap) int wx2msPenStyle(int wx_style) { - int cstyle; -/*** + int cstyle; + switch (wx_style) + { + case wxDOT: + cstyle = PS_DOT; + break; + + case wxDOT_DASH: + cstyle = PS_DASHDOT; + break; + + case wxSHORT_DASH: + case wxLONG_DASH: + cstyle = PS_DASH; + break; + + case wxTRANSPARENT: + cstyle = PS_NULL; + break; + + case wxUSER_DASH: #ifdef __WIN32__ - DWORD vers = GetVersion() ; - WORD high = HIWORD(vers) ; // high bit=0 for NT, 1 for Win32s -#endif -***/ - switch (wx_style) - { - case wxDOT: - cstyle = PS_DOT; - break; - case wxSHORT_DASH: - case wxLONG_DASH: - cstyle = PS_DASH; - break; - case wxTRANSPARENT: - cstyle = PS_NULL; - break; - case wxUSER_DASH: - // User dash style not supported on Win3.1, sorry... -#ifdef __WIN32__ - // Win32s doesn't have PS_USERSTYLE -/*** - if ((high&0x8000)==0) -***/ - if (wxGetOsVersion()==wxWINDOWS_NT) - cstyle = PS_USERSTYLE ; - else - cstyle = PS_DOT ; // We must make a choice... This is mine! + // Win32s doesn't have PS_USERSTYLE + if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95) + cstyle = PS_USERSTYLE; + else + cstyle = PS_DOT; // We must make a choice... This is mine! #else - cstyle = PS_DASH ; + cstyle = PS_DASH; #endif - break ; - case wxSOLID: - default: - cstyle = PS_SOLID; - break; - } - return cstyle; + break; + case wxSOLID: + default: + cstyle = PS_SOLID; + break; + } + return cstyle; } -- 2.45.2