From 7cdc2f1e4263b8069921c023a780e7feb05816c5 Mon Sep 17 00:00:00 2001 From: David Webster Date: Tue, 19 Oct 1999 21:03:55 +0000 Subject: [PATCH] Fixes for long to wxCoord git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/dc.h | 66 ++++++++++----------- src/os2/dc.cpp | 140 ++++++++++++++++++++++---------------------- src/os2/file.lst | 78 ++++++++++++++++++++++++ src/os2/utils.cpp | 8 ++- 4 files changed, 186 insertions(+), 106 deletions(-) create mode 100644 src/os2/file.lst diff --git a/include/wx/os2/dc.h b/include/wx/os2/dc.h index ae043b7989..225756a7a7 100644 --- a/include/wx/os2/dc.h +++ b/include/wx/os2/dc.h @@ -95,13 +95,13 @@ public: virtual void DestroyClippingRegion(); - virtual long GetCharHeight() const; - virtual long GetCharWidth() const; - virtual void GetTextExtent(const wxString& string, - long *x, long *y, - long *descent = NULL, - long *externalLeading = NULL, - wxFont *theFont = NULL) const; + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; virtual bool CanDrawBitmap() const; virtual bool CanGetTextExtent() const; @@ -112,8 +112,8 @@ public: virtual void SetUserScale(double x, double y); virtual void SetSystemScale(double x, double y); virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(long x, long y); - virtual void SetDeviceOrigin(long x, long y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); virtual void SetLogicalFunction(int function); @@ -135,45 +135,45 @@ public: } protected: - virtual void DoFloodFill(long x, long y, const wxColour& col, + virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE); - virtual bool DoGetPixel(long x, long y, wxColour *col) const; + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - virtual void DoDrawPoint(long x, long y); - virtual void DoDrawLine(long x1, long y1, long x2, long y2); + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - virtual void DoDrawArc(long x1, long y1, - long x2, long y2, - long xc, long yc); - virtual void DoDrawEllipticArc(long x, long y, long w, long h, + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea); - virtual void DoDrawRectangle(long x, long y, long width, long height); - virtual void DoDrawRoundedRectangle(long x, long y, - long width, long height, + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, double radius); - virtual void DoDrawEllipse(long x, long y, long width, long height); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoCrossHair(long x, long y); + virtual void DoCrossHair(wxCoord x, wxCoord y); - virtual void DoDrawIcon(const wxIcon& icon, long x, long y); - virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y, + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = FALSE); - virtual void DoDrawText(const wxString& text, long x, long y); + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual bool DoBlit(long xdest, long ydest, long width, long height, - wxDC *source, long xsrc, long ysrc, + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE); // this is gnarly - we can't even call this function DoSetClippingRegion() // because of virtual function hiding virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(long x, long y, - long width, long height); - virtual void DoGetClippingRegion(long *x, long *y, - long *width, long *height) + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *width, wxCoord *height) { GetClippingBox(x, y, width, height); } @@ -182,9 +182,9 @@ protected: virtual void DoGetSizeMM(int* width, int* height) const; virtual void DoDrawLines(int n, wxPoint points[], - long xoffset, long yoffset); + wxCoord xoffset, wxCoord yoffset); virtual void DoDrawPolygon(int n, wxPoint points[], - long xoffset, long yoffset, + wxCoord xoffset, wxCoord yoffset, int fillStyle = wxODDEVEN_RULE); #if wxUSE_SPLINES diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index a5787d1f03..14f009b007 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -127,8 +127,8 @@ void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) // TODO } -void wxDC::DoSetClippingRegion( long x, long y - ,long width, long height +void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y + ,wxCoord width, wxCoord height ) { // TODO @@ -182,8 +182,8 @@ void wxDC::Clear() // TODO } -void wxDC::DoFloodFill( long x - ,long y +void wxDC::DoFloodFill( wxCoord x + ,wxCoord y ,const wxColour& col ,int style ) @@ -191,37 +191,37 @@ void wxDC::DoFloodFill( long x // TODO } -bool wxDC::DoGetPixel(long x, long y, wxColour *col) const +bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const { // TODO return(TRUE); } -void wxDC::DoCrossHair(long x, long y) +void wxDC::DoCrossHair(wxCoord x, wxCoord y) { // TODO } -void wxDC::DoDrawLine(long x1, long y1, long x2, long y2) +void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { // TODO } -void wxDC::DoDrawArc( long x1, long y1 - ,long x2, long y2 - ,long xc, long yc +void wxDC::DoDrawArc( wxCoord x1, wxCoord y1 + ,wxCoord x2, wxCoord y2 + ,wxCoord xc, wxCoord yc ) { // TODO } -void wxDC::DoDrawPoint(long x, long y) +void wxDC::DoDrawPoint(wxCoord x, wxCoord y) { // TODO } void wxDC::DoDrawPolygon(int n, wxPoint points[] - ,long xoffset, long yoffset + ,wxCoord xoffset, wxCoord yoffset ,int fillStyle ) { @@ -229,34 +229,34 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[] } void wxDC::DoDrawLines( int n, wxPoint points[] - ,long xoffset, long yoffset + ,wxCoord xoffset, wxCoord yoffset ) { // TODO } -void wxDC::DoDrawRectangle(long x, long y, long width, long height) +void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { // TODO } -void wxDC::DoDrawRoundedRectangle( long x, long y - ,long width, long height +void wxDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y + ,wxCoord width, wxCoord height ,double radius ) { // TODO } -void wxDC::DoDrawEllipse(long x, long y, long width, long height) +void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { // TODO } -void wxDC::DoDrawEllipticArc( long x - ,long y - ,long w - ,long h +void wxDC::DoDrawEllipticArc( wxCoord x + ,wxCoord y + ,wxCoord w + ,wxCoord h ,double sa ,double ea ) @@ -264,20 +264,20 @@ void wxDC::DoDrawEllipticArc( long x // TODO } -void wxDC::DoDrawIcon(const wxIcon& icon, long x, long y) +void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) { // TODO } void wxDC::DoDrawBitmap( const wxBitmap &bmp - ,long x, long y + ,wxCoord x, wxCoord y ,bool useMask ) { // TODO } -void wxDC::DoDrawText(const wxString& text, long x, long y) +void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) { // TODO } @@ -374,25 +374,25 @@ void wxDC::EndPage() // text metrics // --------------------------------------------------------------------------- -long wxDC::GetCharHeight() const +wxCoord wxDC::GetCharHeight() const { // TODO return(1); } -long wxDC::GetCharWidth() const +wxCoord wxDC::GetCharWidth() const { // TODO return(1); } -void wxDC::GetTextExtent( const wxString& string - ,long* x - ,long* y - ,long* decent - ,long* externalLeading - ,wxFont* theFont - ) const +void wxDC::DoGetTextExtent( const wxString& string + ,wxCoord* x + ,wxCoord* y + ,wxCoord* decent + ,wxCoord* externalLeading + ,wxFont* theFont + ) const { // TODO: } @@ -426,12 +426,12 @@ void wxDC::SetSystemScale(double x, double y) SetMapMode(m_mappingMode); } -void wxDC::SetLogicalOrigin( long x, long y ) +void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y ) { // TODO: }; -void wxDC::SetDeviceOrigin( long x, long y ) +void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y ) { // TODO: }; @@ -440,85 +440,85 @@ void wxDC::SetDeviceOrigin( long x, long y ) // coordinates transformations // --------------------------------------------------------------------------- -long wxDCBase::DeviceToLogicalX(long x) const +wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const { - long new_x = x - m_deviceOriginX; + wxCoord new_x = x - m_deviceOriginX; if (new_x > 0) - return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; + return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; else - return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; + return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; }; -long wxDCBase::DeviceToLogicalXRel(long x) const +wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const { if (x > 0) - return (long)((double)(x) / m_scaleX + 0.5); + return (wxCoord)((double)(x) / m_scaleX + 0.5); else - return (long)((double)(x) / m_scaleX - 0.5); + return (wxCoord)((double)(x) / m_scaleX - 0.5); }; -long wxDCBase::DeviceToLogicalY(long y) const +wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const { - long new_y = y - m_deviceOriginY; + wxCoord new_y = y - m_deviceOriginY; if (new_y > 0) - return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; + return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; else - return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; + return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; }; -long wxDCBase::DeviceToLogicalYRel(long y) const +wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const { if (y > 0) - return (long)((double)(y) / m_scaleY + 0.5); + return (wxCoord)((double)(y) / m_scaleY + 0.5); else - return (long)((double)(y) / m_scaleY - 0.5); + return (wxCoord)((double)(y) / m_scaleY - 0.5); }; -long wxDCBase::LogicalToDeviceX(long x) const +wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const { - long new_x = x - m_logicalOriginX; + wxCoord new_x = x - m_logicalOriginX; if (new_x > 0) - return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; else - return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; }; -long wxDCBase::LogicalToDeviceXRel(long x) const +wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const { if (x > 0) - return (long)((double)(x) * m_scaleX + 0.5); + return (wxCoord)((double)(x) * m_scaleX + 0.5); else - return (long)((double)(x) * m_scaleX - 0.5); + return (wxCoord)((double)(x) * m_scaleX - 0.5); }; -long wxDCBase::LogicalToDeviceY(long y) const +wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const { - long new_y = y - m_logicalOriginY; + wxCoord new_y = y - m_logicalOriginY; if (new_y > 0) - return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; else - return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; }; -long wxDCBase::LogicalToDeviceYRel(long y) const +wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const { if (y > 0) - return (long)((double)(y) * m_scaleY + 0.5); + return (wxCoord)((double)(y) * m_scaleY + 0.5); else - return (long)((double)(y) * m_scaleY - 0.5); + return (wxCoord)((double)(y) * m_scaleY - 0.5); }; // --------------------------------------------------------------------------- // bit blit // --------------------------------------------------------------------------- -bool wxDC::DoBlit( long xdest - ,long ydest - ,long width - ,long height +bool wxDC::DoBlit( wxCoord xdest + ,wxCoord ydest + ,wxCoord width + ,wxCoord height ,wxDC *source - ,long xsrc - ,long ysrc + ,wxCoord xsrc + ,wxCoord ysrc ,int rop ,bool useMask ) @@ -555,7 +555,7 @@ void wxDC::DoGetTextExtent(const wxString& string, float *x, float *y, float *descent, float *externalLeading, wxFont *theFont, bool use16bit) const { - long x1, y1, descent1, externalLeading1; + wxCoord x1, y1, descent1, externalLeading1; GetTextExtent(string, & x1, & y1, & descent1, & externalLeading1, theFont, use16bit); *x = x1; *y = y1; if (descent) diff --git a/src/os2/file.lst b/src/os2/file.lst new file mode 100644 index 0000000000..f60b0f3cb0 --- /dev/null +++ b/src/os2/file.lst @@ -0,0 +1,78 @@ +List of files yet to be implemented. As you finish a file, delete it from the list + + ..\os2\$D\accel.obj \ + ..\os2\$D\app.obj \ + ..\os2\$D\bitmap.obj \ + ..\os2\$D\bmpbuttn.obj \ + ..\os2\$D\brush.obj \ + ..\os2\$D\button.obj \ + ..\os2\$D\checkbox.obj \ + ..\os2\$D\checklst.obj \ + ..\os2\$D\choice.obj \ + ..\os2\$D\clipbrd.obj \ + ..\os2\$D\colour.obj \ + ..\os2\$D\combobox.obj \ + ..\os2\$D\control.obj \ + ..\os2\$D\cursor.obj \ + ..\os2\$D\data.obj \ + ..\os2\$D\dc.obj \ + ..\os2\$D\dcclient.obj \ + ..\os2\$D\dcmemory.obj \ + ..\os2\$D\dcprint.obj \ + ..\os2\$D\dcscreen.obj \ + ..\os2\$D\dialog.obj \ + ..\os2\$D\dirdlg.obj \ + ..\os2\$D\dnd.obj \ + ..\os2\$D\filedlg.obj \ + ..\os2\$D\font.obj \ + ..\os2\$D\fontdlg.obj \ + ..\os2\$D\frame.obj \ + ..\os2\$D\gauge.obj \ + ..\os2\$D\gdiobj.obj \ + ..\os2\$D\gsocket.obj \ + ..\os2\$D\helpwin.obj \ + ..\os2\$D\icon.obj \ + ..\os2\$D\imaglist.obj \ + ..\os2\$D\iniconf.obj \ + ..\os2\$D\joystick.obj \ + ..\os2\$D\listbox.obj \ + ..\os2\$D\listctrl.obj \ + ..\os2\$D\main.obj \ + ..\os2\$D\mdi.obj \ + ..\os2\$D\menu.obj \ + ..\os2\$D\menuitem.obj \ + ..\os2\$D\metafile.obj \ + ..\os2\$D\minifram.obj \ + ..\os2\$D\msgdlg.obj \ + ..\os2\$D\nativdlg.obj \ + ..\os2\$D\notebook.obj \ + ..\os2\$D\ownerdrw.obj \ + ..\os2\$D\palette.obj \ + ..\os2\$D\pen.obj \ + ..\os2\$D\pnghand.obj \ + ..\os2\$D\print.obj \ + ..\os2\$D\radiobox.obj \ + ..\os2\$D\radiobut.obj \ + ..\os2\$D\region.obj \ + ..\os2\$D\scrolbar.obj \ + ..\os2\$D\settings.obj \ + ..\os2\$D\slider.obj \ + ..\os2\$D\spinbutt.obj \ + ..\os2\$D\spinctrl.obj \ + ..\os2\$D\statbmp.obj \ + ..\os2\$D\statbox.obj \ + ..\os2\$D\stattext.obj \ + ..\os2\$D\statbrpm.obj \ + ..\os2\$D\tabctrl.obj \ + ..\os2\$D\taskbar.obj \ + ..\os2\$D\textctrl.obj \ + ..\os2\$D\thread.obj \ + ..\os2\$D\timer.obj \ + ..\os2\$D\toolbar.obj \ + ..\os2\$D\tooltip.obj \ + ..\os2\$D\treectrl.obj \ + ..\os2\$D\utils.obj \ + ..\os2\$D\utilsexc.obj \ + ..\os2\$D\wave.obj \ + ..\os2\$D\window.obj + diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index d494fca7a4..d536b29ebe 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -42,7 +42,9 @@ #include #include #define PURE_32 -#include +#include +#include +#include // In the WIN.INI file static const wxChar WX_SECTION[] = _T("wxWindows"); @@ -66,8 +68,8 @@ bool wxGetHostName(wxChar *buf, int maxSize) unsigned long ulBuffer; unsigned long* pulTotalAvail; - NetBios32GetInfo( server - ,computer + NetBios32GetInfo( (const unsigned char*)server + ,(const unsigned char*)computer ,ulLevel ,pbBuffer ,ulBuffer -- 2.45.2