From 27815f2cce37721ae1c524669c3e19cff8a50894 Mon Sep 17 00:00:00 2001 From: Leo Date: Sun, 22 Feb 2009 03:39:40 +0000 Subject: Fixes for VS 2005. git-svn-id: http://svn.leocad.org/tags/leocad-0.75@741 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/Cadview.cpp | 1 + win/Clrpick.cpp | 4 +++- win/Clrpopup.cpp | 5 ++++- win/Colorlst.cpp | 5 ++++- win/Figdlg.cpp | 4 +++- win/Flatbar.cpp | 3 ++- win/Libdlg.cpp | 3 ++- win/Piecebar.cpp | 2 +- win/Piecebar.h | 2 +- win/Print.cpp | 7 ++++++- win/Stdafx.h | 48 +++++++++++++++++++++++++++++++++++++++++++----- win/Tools.cpp | 4 +++- win/arraydlg.cpp | 8 ++++++-- win/disabtab.cpp | 2 +- win/rmodel.h | 2 +- win/terrctrl.cpp | 24 ++++++++++++++++++------ 16 files changed, 99 insertions(+), 25 deletions(-) (limited to 'win') diff --git a/win/Cadview.cpp b/win/Cadview.cpp index f38c80b..5098986 100644 --- a/win/Cadview.cpp +++ b/win/Cadview.cpp @@ -3,6 +3,7 @@ #include "stdafx.h" #include "LeoCAD.h" +#include #include "CADDoc.h" #include "CADView.h" diff --git a/win/Clrpick.cpp b/win/Clrpick.cpp index 1d920fa..7b5ddae 100644 --- a/win/Clrpick.cpp +++ b/win/Clrpick.cpp @@ -142,7 +142,9 @@ void CColorPicker::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { for (int x = rect.left; x < rect.right; x++) { - for (int y = rect.top; y < rect.bottom; y+=4) + int y; + + for (y = rect.top; y < rect.bottom; y+=4) { if (y == rect.top) y += x%4; pDC->SetPixel (x,y,RGB(255,255,255)); diff --git a/win/Clrpopup.cpp b/win/Clrpopup.cpp index aa3daa9..8a5ae3c 100644 --- a/win/Clrpopup.cpp +++ b/win/Clrpopup.cpp @@ -783,11 +783,14 @@ void CColorPopup::DrawCell(CDC* pDC, int nIndex) { for (int x = rect.left; x < rect.right; x++) { - for (int y = rect.top; y < rect.bottom; y+=4) + int y; + + for (y = rect.top; y < rect.bottom; y+=4) { if (y == rect.top) y += x%4; pDC->SetPixel (x,y,RGB(255,255,255)); } + for (y = rect.bottom; y > rect.top; y-=4) { if (y == rect.bottom) y-= x%4; diff --git a/win/Colorlst.cpp b/win/Colorlst.cpp index 06eb038..b335247 100644 --- a/win/Colorlst.cpp +++ b/win/Colorlst.cpp @@ -62,11 +62,14 @@ void CColorsList::DrawItem(LPDRAWITEMSTRUCT lpDIS) if (x > 13 && x < 22) for (x = lpDIS->rcItem.left; x < lpDIS->rcItem.right; x++) { - for (int y = lpDIS->rcItem.top; y < lpDIS->rcItem.bottom; y+=4) + int y; + + for (y = lpDIS->rcItem.top; y < lpDIS->rcItem.bottom; y+=4) { if (y == lpDIS->rcItem.top) y += x%4; SetPixelV (lpDIS->hDC, x,y,RGB(255,255,255)); } + for (y = lpDIS->rcItem.bottom; y > lpDIS->rcItem.top; y-=4) { if (y == lpDIS->rcItem.bottom) y-= x%4; diff --git a/win/Figdlg.cpp b/win/Figdlg.cpp index 3b78e52..ed01889 100644 --- a/win/Figdlg.cpp +++ b/win/Figdlg.cpp @@ -99,7 +99,9 @@ LRESULT CALLBACK GLWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara m_pMinifigWnd->CreateEx (0, MINIFIG_CLASSNAME, "LeoCAD", WS_BORDER | WS_CHILD | WS_VISIBLE, r, this, 0, m_pMinifig); - for (int i = 0; i < LC_MFW_NUMITEMS; i++) + int i; + + for (i = 0; i < LC_MFW_NUMITEMS; i++) ((CColorPicker*)GetDlgItem (IDC_MF_HATCOLOR+i))->SetColorIndex (m_pMinifig->m_Colors[i]); for (i = 0; i < LC_MFW_NUMITEMS; i++) diff --git a/win/Flatbar.cpp b/win/Flatbar.cpp index 4f6de8e..187f575 100644 --- a/win/Flatbar.cpp +++ b/win/Flatbar.cpp @@ -459,8 +459,9 @@ CSize CFlatToolBar::CalcLayout(DWORD dwMode, int nLength) int nControlCount = 0; BOOL bIsDelayed = m_bDelayedButtonLayout; m_bDelayedButtonLayout = FALSE; + int i; - for(int i = 0; i < nCount; i++) + for(i = 0; i < nCount; i++) if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0)) nControlCount++; diff --git a/win/Libdlg.cpp b/win/Libdlg.cpp index 7fb05b3..17a0964 100644 --- a/win/Libdlg.cpp +++ b/win/Libdlg.cpp @@ -382,8 +382,9 @@ void CLibraryDlg::UpdateList() for (int i = 0; i < Lib->GetPieceCount(); i++) { PieceInfo* Info = Lib->GetPieceInfo(i); + int j; - for (int j = 0; j < Lib->GetNumCategories(); j++) + for (j = 0; j < Lib->GetNumCategories(); j++) { if (Lib->PieceInCategory(Info, Lib->GetCategoryKeywords(j))) break; diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp index b72b5c5..7cce48c 100644 --- a/win/Piecebar.cpp +++ b/win/Piecebar.cpp @@ -434,7 +434,7 @@ void CPiecesBar::OnPaint() CPaintDC dc(this); } -UINT CPiecesBar::OnNcHitTest(CPoint point) +NCHITTESTRETURN CPiecesBar::OnNcHitTest(CPoint point) { if (IsFloating()) return CControlBar::OnNcHitTest(point); diff --git a/win/Piecebar.h b/win/Piecebar.h index 609419f..3e2736c 100644 --- a/win/Piecebar.h +++ b/win/Piecebar.h @@ -111,7 +111,7 @@ protected: afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnCaptureChanged(CWnd *pWnd); - afx_msg UINT OnNcHitTest(CPoint point); + afx_msg NCHITTESTRETURN OnNcHitTest(CPoint point); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); diff --git a/win/Print.cpp b/win/Print.cpp index 6f693f8..09a18b5 100644 --- a/win/Print.cpp +++ b/win/Print.cpp @@ -5,6 +5,8 @@ #include "stdafx.h" #include "leocad.h" +#include + #include "Print.h" #include "project.h" #include "pieceinf.h" @@ -22,9 +24,12 @@ static void PrintCatalogThread (CWnd* pParent, CFrameWnd* pMainFrame) PiecesLibrary *pLib = lcGetPiecesLibrary(); int bricks = 0; - for (int j = 0; j < pLib->GetPieceCount (); j++) + int j; + + for (j = 0; j < pLib->GetPieceCount (); j++) if (pLib->GetPieceInfo(j)->m_strDescription[0] != '~') bricks++; + int rows = theApp.GetProfileInt("Default", "Catalog Rows", 10); int cols = theApp.GetProfileInt("Default", "Catalog Columns", 3); PD->m_pd.lpfnPrintHook = PrintHookProc; diff --git a/win/Stdafx.h b/win/Stdafx.h index 1332794..e92ba02 100644 --- a/win/Stdafx.h +++ b/win/Stdafx.h @@ -1,7 +1,6 @@ // stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// +// or project specific include files that are used frequently, +// but are changed infrequently #if !defined(AFX_STDAFX_H__195E1F4C_3FF2_11D2_8202_D2B1707B2D1B__INCLUDED_) #define AFX_STDAFX_H__195E1F4C_3FF2_11D2_8202_D2B1707B2D1B__INCLUDED_ @@ -10,12 +9,39 @@ #pragma once #endif // _MSC_VER >= 1000 +#define _CRT_SECURE_NO_DEPRECATE 1 + +#ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#if _MSC_VER >= 1400 + +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif -#include // GlobalFreePtr() +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#endif + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS #include // MFC core and standard components #include // MFC extensions +#include +#include #ifndef _AFX_NO_AFXCMN_SUPPORT #include // MFC support for Windows Common Controls @@ -27,7 +53,19 @@ typedef DWORD ACTIVATEAPPPARAM; typedef HTASK ACTIVATEAPPPARAM; #endif -//#include // CSharedFile +#if _MFC_VER < 0x0800 +#define _strcmpi strcmp +#define _strlwr strlwr +#define _strupr strupr +#else +#define snprintf _snprintf +#endif + +#if _MFC_VER >= 0x0800 +typedef LRESULT NCHITTESTRETURN; +#else +typedef UINT NCHITTESTRETURN; +#endif #include "opengl.h" diff --git a/win/Tools.cpp b/win/Tools.cpp index cdf49a4..4028a72 100644 --- a/win/Tools.cpp +++ b/win/Tools.cpp @@ -547,8 +547,10 @@ void Export3DStudio() { if (j == *info) { + UINT k; + info++; - for (UINT k = 0; k < *info; k += 4) + for (k = 0; k < *info; k += 4) { mobj->matarray[i].faceindex[facecount] = curface; facecount++; diff --git a/win/arraydlg.cpp b/win/arraydlg.cpp index f033510..37aa5a8 100644 --- a/win/arraydlg.cpp +++ b/win/arraydlg.cpp @@ -90,8 +90,9 @@ BOOL CArrayDlg::OnInitDialog() IDC_ARRAY_3D_X_SPIN, IDC_ARRAY_3D_Y_SPIN, IDC_ARRAY_3D_Z_SPIN, IDC_ARRAY_MOVE_X_SPIN, IDC_ARRAY_ROTATE_X_SPIN, IDC_ARRAY_MOVE_Y_SPIN, IDC_ARRAY_ROTATE_Y_SPIN, IDC_ARRAY_MOVE_Z_SPIN, IDC_ARRAY_ROTATE_Z_SPIN }; + int i; - for (int i = 0; i < 3; i++) + for (i = 0; i < 3; i++) ((CSpinButtonCtrl*)GetDlgItem(IDs[i]))->SetRange(1, 1000); for (i = 3; i < 15; i++) ((CSpinButtonCtrl*)GetDlgItem(IDs[i]))->SetRange(-1000, 1000); @@ -107,7 +108,10 @@ void CArrayDlg::OnArrayDimension() return; UpdateData(); - for (UINT u = IDC_ARRAY_2D_COUNT; u <= IDC_ARRAY_2D_Z; u++) + + UINT u; + + for (u = IDC_ARRAY_2D_COUNT; u <= IDC_ARRAY_2D_Z; u++) GetDlgItem(u)->EnableWindow(m_nArrayDimension > 0); for (u = IDC_ARRAY_2D_X_SPIN; u <= IDC_ARRAY_2D_Z_SPIN; u++) GetDlgItem(u)->EnableWindow(m_nArrayDimension > 0); diff --git a/win/disabtab.cpp b/win/disabtab.cpp index 930a686..69e5a74 100644 --- a/win/disabtab.cpp +++ b/win/disabtab.cpp @@ -32,7 +32,7 @@ CTabCtrlWithDisable::~CTabCtrlWithDisable() } // Subclass the tab control: also make ownder-draw -CTabCtrlWithDisable::SubclassDlgItem(UINT nID, CWnd* pParent) +BOOL CTabCtrlWithDisable::SubclassDlgItem(UINT nID, CWnd* pParent) { if (!CTabCtrl::SubclassDlgItem(nID, pParent)) return FALSE; diff --git a/win/rmodel.h b/win/rmodel.h index 5a110cc..c81dcbe 100644 --- a/win/rmodel.h +++ b/win/rmodel.h @@ -86,7 +86,7 @@ protected: int build_hierarchy(); - friend RAPID_Collide(double R1[3][3], double T1[3], double s1, CRModel *RAPID_model1, + friend int RAPID_Collide(double R1[3][3], double T1[3], double s1, CRModel *RAPID_model1, double R2[3][3], double T2[3], double s2, CRModel *RAPID_model2, int flag); }; diff --git a/win/terrctrl.cpp b/win/terrctrl.cpp index 853138f..284d8db 100644 --- a/win/terrctrl.cpp +++ b/win/terrctrl.cpp @@ -511,7 +511,9 @@ void CTerrainCtrl::OnDraw(CDC* pDC) */ // calc bottom int bottom = GetFixedRowHeight(); - for (int i = idTopLeft.row; i < m_nRows; i++) + int i; + + for (i = idTopLeft.row; i < m_nRows; i++) { bottom += GetRowHeight(i); if (bottom >= clientRect.bottom) @@ -1293,7 +1295,9 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck) else if (point.x < fixedColWidth) // in fixed col { int xpos = 0; - for (int col = 0; col < m_nFixedCols; col++) + int col; + + for (col = 0; col < m_nFixedCols; col++) { xpos += GetColumnWidth(col); if (xpos > point.x) break; @@ -1303,7 +1307,9 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck) else // in non-fixed col { int xpos = fixedColWidth; - for (int col = idTopLeft.col; col < m_nCols; col++) + int col; + + for (col = idTopLeft.col; col < m_nCols; col++) { xpos += GetColumnWidth(col); if (xpos > point.x) break; @@ -1322,7 +1328,9 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck) else if (point.y < fixedRowHeight) // in fixed col { int ypos = 0; - for (int row = 0; row < m_nFixedRows; row++) + int row; + + for (row = 0; row < m_nFixedRows; row++) { ypos += GetRowHeight(row); if (ypos > point.y) break; @@ -1332,7 +1340,9 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck) else { int ypos = fixedRowHeight; - for (int row = idTopLeft.row; row < GetRowCount(); row++) + int row; + + for (row = idTopLeft.row; row < GetRowCount(); row++) { ypos += GetRowHeight(row); if (ypos > point.y) break; @@ -1792,7 +1802,9 @@ void CTerrainCtrl::EnsureVisible(int nRow, int nCol) // calc bottom int bottom = GetFixedRowHeight(); - for (int i = idTopLeft.row; i < m_nRows; i++) + int i; + + for (i = idTopLeft.row; i < m_nRows; i++) { bottom += GetRowHeight(i); if (bottom >= rect.bottom) -- cgit v1.2.3