diff options
author | Oliver Schneider <oliver@assarbad.net> | 2017-11-22 22:54:49 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2017-11-22 22:54:49 +0300 |
commit | ea449d28c1582161a3007e8c168dd56b7ce867d3 (patch) | |
tree | 4d94cfd19d15a67549d095b3cc814e0b11ecaafe | |
parent | 05211c399e7385436053739df1424eb7411c67a1 (diff) |
Replaced own countof by the _countof from stdlib.h
Moved numerous headers out of stdafx.h so these won't cause unnecessary recompiles
35 files changed, 321 insertions, 274 deletions
diff --git a/common/commonhelpers.cpp b/common/commonhelpers.cpp index 48f94b5..6678dca 100644 --- a/common/commonhelpers.cpp +++ b/common/commonhelpers.cpp @@ -20,6 +20,8 @@ // #include "stdafx.h" +#include <common/mdexceptions.h> +#include <common/wds_constants.h> CString MyStrRetToString(const LPITEMIDLIST pidl, const STRRET *strret) { diff --git a/common/tracer.h b/common/tracer.h index d85bfa7..b50172f 100644 --- a/common/tracer.h +++ b/common/tracer.h @@ -23,11 +23,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // -// Author(s): - oliver -> http://windirstat.net/contact/oliver/ -// #ifndef __TRACER_H_VER__ -#define __TRACER_H_VER__ 2014012617 +#define __TRACER_H_VER__ 2017112219 #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif // Check for "#pragma once" support diff --git a/common/wds_constants.cpp b/common/wds_constants.cpp index 007e770..d8dda1e 100644 --- a/common/wds_constants.cpp +++ b/common/wds_constants.cpp @@ -17,14 +17,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// Author(s): - oliver -> http://windirstat.net/contact/oliver/ -// #include "stdafx.h" #include "wds_constants.h" namespace wds { +#if 0 demangle_t translator_demangle_email[] = { { L'/', L'-' }, @@ -37,7 +36,7 @@ namespace wds { { L"Bernhard Seifert", 0, L"https://windirstat.net/contact/bernhard/", L"Creator of the project, original author" }, { L"Oliver Schneider", 0, L"https://windirstat.net/contact/oliver/", L"Project maintainer" }, - { L"Chris Wimmer", 0, L"http://sourceforge.net/users/dezipaitor", L"Contributor" }, + { L"Chris Wimmer", 0, L"https://sourceforge.net/users/dezipaitor", L"Contributor" }, { 0 }, }; @@ -178,4 +177,5 @@ namespace wds 0 /* end marker */ }, }; +#endif // 0 } diff --git a/common/wds_constants.h b/common/wds_constants.h index 966b6df..96e0066 100644 --- a/common/wds_constants.h +++ b/common/wds_constants.h @@ -20,38 +20,13 @@ // #ifndef __WDS_CONSTANTS_H_VER__ -#define __WDS_CONSTANTS_H_VER__ 2014021723 +#define __WDS_CONSTANTS_H_VER__ 2017112218 #if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once #endif // Check for "#pragma once" support namespace wds { - const size_t maxContacts = 5; - typedef struct _demangle_t - { - WCHAR from; - WCHAR to; - } demangle_t; - typedef struct _contact_t - { - LPWSTR name; - LPWSTR mail; - LPWSTR weburl; - LPWSTR description; - } contact_t; - typedef struct _translator_t - { - LCID id; - LPWSTR lngNative; - LPWSTR lngEnglish; - LPWSTR lngISO639_1; - contact_t translators[maxContacts]; - } translator_t; - extern translator_t translators[]; - extern contact_t authors[]; - extern demangle_t translator_demangle_email[]; - // Single character constants const TCHAR chrSharp = _T('#'); const TCHAR chrBracketOpen = _T('('); @@ -89,14 +64,26 @@ namespace wds const LPCTSTR strLangPrefix = _T(STR_RESOURCE_PREFIX); const LPCTSTR strInvalidAttributes = _T("??????"); - const LPCTSTR strAttributeReadonly = _T("R"); - const LPCTSTR strAttributeHidden = _T("H"); - const LPCTSTR strAttributeSystem = _T("S"); - const LPCTSTR strAttributeArchive = _T("A"); - const LPCTSTR strAttributeCompressed = _T("R"); - const LPCTSTR strAttributeEncrypted = _T("E"); + const LPCTSTR strAttributeReadonly = _T("R"); /*FILE_ATTRIBUTE_READONLY*/ + const LPCTSTR strAttributeHidden = _T("H"); /*FILE_ATTRIBUTE_HIDDEN*/ + const LPCTSTR strAttributeSystem = _T("S"); /*FILE_ATTRIBUTE_SYSTEM*/ + /* don't need FILE_ATTRIBUTE_DIRECTORY, directories are visualized in other ways */ + const LPCTSTR strAttributeArchive = _T("A"); /*FILE_ATTRIBUTE_ARCHIVE*/ + /* don't need FILE_ATTRIBUTE_DEVICE */ + /* don't need FILE_ATTRIBUTE_NORMAL */ + const LPCTSTR strAttributeTemporary = _T("T"); /*FILE_ATTRIBUTE_TEMPORARY*/ + const LPCTSTR strAttributeSparse = _T("~"); /*FILE_ATTRIBUTE_SPARSE_FILE*/ + const LPCTSTR strAttributeReparsePoint = _T("@"); /*FILE_ATTRIBUTE_REPARSE_POINT*/ + const LPCTSTR strAttributeCompressed = _T("C"); /*FILE_ATTRIBUTE_COMPRESSED*/ + const LPCTSTR strAttributeOffline = _T("_"); /*FILE_ATTRIBUTE_OFFLINE*/ + const LPCTSTR strAttributeNotContentIndexed = _T("i"); /*FILE_ATTRIBUTE_NOT_CONTENT_INDEXED*/ + const LPCTSTR strAttributeEncrypted = _T("E"); /*FILE_ATTRIBUTE_ENCRYPTED*/ + const LPCTSTR strAttributeIntegrityStream = _T("I"); /*FILE_ATTRIBUTE_INTEGRITY_STREAM*/ + const LPCTSTR strAttributeVirtual = _T("V"); /*FILE_ATTRIBUTE_VIRTUAL*/ + /* don't need FILE_ATTRIBUTE_NO_SCRUB_DATA */ + const LPCTSTR strAttributeEA = _T("+"); /*FILE_ATTRIBUTE_EA*/ - const int iLangCodeLength = 4; + const int iLangCodeLength = _countof(STR_RESOURCE_PREFIX); const int iNumDriveLetters = (chrCapZ - chrCapA) + 1; } diff --git a/windirstat/Controls/ColorButton.cpp b/windirstat/Controls/ColorButton.cpp index 372addd..5e05074 100644 --- a/windirstat/Controls/ColorButton.cpp +++ b/windirstat/Controls/ColorButton.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "colorbutton.h" +#include <common/wds_constants.h> #ifdef _DEBUG #define new DEBUG_NEW diff --git a/windirstat/Controls/TreeListControl.cpp b/windirstat/Controls/TreeListControl.cpp index e2ca8a4..8271d1d 100644 --- a/windirstat/Controls/TreeListControl.cpp +++ b/windirstat/Controls/TreeListControl.cpp @@ -23,6 +23,7 @@ #include "windirstat.h" #include "dirstatdoc.h" #include "dirstatview.h" +#include "selectobject.h" #include "TreeListControl.h" #ifdef _DEBUG diff --git a/windirstat/Controls/graphview.cpp b/windirstat/Controls/graphview.cpp index 5856fe5..d5d34f6 100644 --- a/windirstat/Controls/graphview.cpp +++ b/windirstat/Controls/graphview.cpp @@ -25,6 +25,7 @@ #include "dirstatdoc.h" #include "dirstatview.h" #include "item.h" +#include "selectobject.h" #include "graphview.h" diff --git a/windirstat/Controls/myimagelist.cpp b/windirstat/Controls/myimagelist.cpp index 235435a..38b2261 100644 --- a/windirstat/Controls/myimagelist.cpp +++ b/windirstat/Controls/myimagelist.cpp @@ -21,6 +21,8 @@ #include "stdafx.h" #include "windirstat.h" +#include "selectobject.h" +#include "treemap.h" #include "myimagelist.h" #ifdef _DEBUG diff --git a/windirstat/Controls/ownerdrawnlistcontrol.cpp b/windirstat/Controls/ownerdrawnlistcontrol.cpp index 275ce86..5878f93 100644 --- a/windirstat/Controls/ownerdrawnlistcontrol.cpp +++ b/windirstat/Controls/ownerdrawnlistcontrol.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "windirstat.h" #include "treemap.h" // CColorSpace +#include "selectobject.h" #include "ownerdrawnlistcontrol.h" #ifdef _DEBUG diff --git a/windirstat/Controls/pacman.cpp b/windirstat/Controls/pacman.cpp index a083b25..3e4d801 100644 --- a/windirstat/Controls/pacman.cpp +++ b/windirstat/Controls/pacman.cpp @@ -20,6 +20,7 @@ // #include "stdafx.h" +#include "selectobject.h" #include "pacman.h" #ifdef _DEBUG diff --git a/windirstat/Controls/sortinglistcontrol.cpp b/windirstat/Controls/sortinglistcontrol.cpp index bc958e6..7f17115 100644 --- a/windirstat/Controls/sortinglistcontrol.cpp +++ b/windirstat/Controls/sortinglistcontrol.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "windirstat.h" +#include "options.h" #include "sortinglistcontrol.h" #ifdef _DEBUG diff --git a/windirstat/Controls/treemap.cpp b/windirstat/Controls/treemap.cpp index 8dcecf6..cf40972 100644 --- a/windirstat/Controls/treemap.cpp +++ b/windirstat/Controls/treemap.cpp @@ -20,6 +20,7 @@ // #include "stdafx.h" +#include "selectobject.h" #include "treemap.h" #ifdef _DEBUG @@ -176,19 +177,19 @@ void CTreemap::GetDefaultPalette(CArray<COLORREF, COLORREF&>& palette) { if(CColorSpace::Is256Colors()) { - palette.SetSize(countof(_defaultCushionColors256)); - for(int i = 0; i < countof(_defaultCushionColors256); i++) + palette.SetSize(_countof(_defaultCushionColors256)); + for(int i = 0; i < _countof(_defaultCushionColors256); i++) { palette[i]= _defaultCushionColors256[i]; } // We don't do - // EqualizeColors(_defaultCushionColors256, countof(_defaultCushionColors256), palette); + // EqualizeColors(_defaultCushionColors256, _countof(_defaultCushionColors256), palette); // because on 256 color screens, the resulting colors are not distinguishable. } else { - EqualizeColors(_defaultCushionColors, countof(_defaultCushionColors), palette); + EqualizeColors(_defaultCushionColors, _countof(_defaultCushionColors), palette); } } diff --git a/windirstat/Controls/typeview.cpp b/windirstat/Controls/typeview.cpp index 29db0c4..3a83972 100644 --- a/windirstat/Controls/typeview.cpp +++ b/windirstat/Controls/typeview.cpp @@ -24,7 +24,9 @@ #include "item.h" #include "mainframe.h" #include "dirstatdoc.h" +#include <common/commonhelpers.h> #include "typeview.h" +#include "globalhelpers.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/windirstat/Controls/xyslider.cpp b/windirstat/Controls/xyslider.cpp index 64ce63a..c9fef55 100644 --- a/windirstat/Controls/xyslider.cpp +++ b/windirstat/Controls/xyslider.cpp @@ -20,6 +20,7 @@ // #include "stdafx.h" +#include "selectobject.h" #include "xyslider.h" #ifdef _DEBUG diff --git a/windirstat/Dialogs/SelectDrivesDlg.cpp b/windirstat/Dialogs/SelectDrivesDlg.cpp index 09c344f..034d22e 100644 --- a/windirstat/Dialogs/SelectDrivesDlg.cpp +++ b/windirstat/Dialogs/SelectDrivesDlg.cpp @@ -21,6 +21,10 @@ #include "stdafx.h" #include "windirstat.h" +#include <common/cotaskmem.h> +#include <common/commonhelpers.h> +#include "options.h" +#include "globalhelpers.h" #include "SelectDrivesDlg.h" #ifdef _DEBUG diff --git a/windirstat/Dialogs/SelectDrivesDlg.h b/windirstat/Dialogs/SelectDrivesDlg.h index 1084980..b9fd84d 100644 --- a/windirstat/Dialogs/SelectDrivesDlg.h +++ b/windirstat/Dialogs/SelectDrivesDlg.h @@ -26,6 +26,7 @@ #include "ownerdrawnlistcontrol.h" #include "layout.h" #include "resource.h" +#include "set.h" // // The dialog has these three radio buttons. diff --git a/windirstat/Dialogs/aboutdlg.cpp b/windirstat/Dialogs/aboutdlg.cpp index 14c9d63..b4e58c0 100644 --- a/windirstat/Dialogs/aboutdlg.cpp +++ b/windirstat/Dialogs/aboutdlg.cpp @@ -22,6 +22,8 @@ #include "stdafx.h" #include "windirstat.h" #include <common/wds_constants.h> +#include <common/mdexceptions.h> +#include <common/commonhelpers.h> #include "aboutdlg.h" #ifdef _DEBUG @@ -267,6 +269,7 @@ CString CAboutDlg::GetAppVersion() CString CAboutDlg::GetDevelList() { CString retval; +#if 0 using wds::authors; using wds::contact_t; @@ -290,12 +293,14 @@ CString CAboutDlg::GetDevelList() } } } +#endif // 0 return retval; } CString CAboutDlg::GetTranslatorList() { CString retval; +#if 0 using wds::translators; using wds::translator_t; @@ -328,6 +333,7 @@ CString CAboutDlg::GetTranslatorList() } } } +#endif // 0 return retval; } diff --git a/windirstat/PageCleanups.cpp b/windirstat/PageCleanups.cpp index 0d13433..f768475 100644 --- a/windirstat/PageCleanups.cpp +++ b/windirstat/PageCleanups.cpp @@ -21,6 +21,8 @@ #include "stdafx.h" #include "windirstat.h" +#include <common/commonhelpers.h> +#include "options.h" #include "PageCleanups.h" #ifdef _DEBUG diff --git a/windirstat/PageGeneral.cpp b/windirstat/PageGeneral.cpp index 165df68..9819097 100644 --- a/windirstat/PageGeneral.cpp +++ b/windirstat/PageGeneral.cpp @@ -1,188 +1,190 @@ -// PageGeneral.cpp - Implementation of CPageGeneral -// -// WinDirStat - Directory Statistics -// Copyright (C) 2003-2005 Bernhard Seifert -// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "stdafx.h" -#include "windirstat.h" -#include "mainframe.h" // COptionsPropertySheet -#include "PageGeneral.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -IMPLEMENT_DYNAMIC(CPageGeneral, CPropertyPage) - -CPageGeneral::CPageGeneral() - : CPropertyPage(CPageGeneral::IDD) -{ -} - -CPageGeneral::~CPageGeneral() -{ -} - -COptionsPropertySheet *CPageGeneral::GetSheet() -{ - COptionsPropertySheet *sheet = DYNAMIC_DOWNCAST(COptionsPropertySheet, GetParent()); - ASSERT(sheet != NULL); - return sheet; -} - -void CPageGeneral::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - DDX_Check(pDX, IDC_HUMANFORMAT, m_humanFormat); - DDX_Check(pDX, IDC_FOLLOWMOUNTPOINTS, m_followMountPoints); - DDX_Check(pDX, IDC_FOLLOWJUNCTIONS, m_followJunctionPoints); - DDX_Check(pDX, IDC_USEWDSLOCALE, m_useWdsLocale); - DDX_Control(pDX, IDC_COMBO, m_combo); - DDX_Control(pDX, IDC_FOLLOWMOUNTPOINTS, m_ctlFollowMountPoints); - DDX_Control(pDX, IDC_FOLLOWJUNCTIONS, m_ctlFollowJunctionPoints); - DDX_Check(pDX, IDC_SHOWGRID, m_listGrid); - DDX_Check(pDX, IDC_SHOWSTRIPES, m_listStripes); - DDX_Check(pDX, IDC_FULLROWSELECTION, m_listFullRowSelection); - DDX_Check(pDX, IDC_SKIPHIDDEN, m_skipHidden); -} - - -BEGIN_MESSAGE_MAP(CPageGeneral, CPropertyPage) - ON_BN_CLICKED(IDC_HUMANFORMAT, OnBnClickedHumanformat) - ON_BN_CLICKED(IDC_FOLLOWMOUNTPOINTS, OnBnClickedFollowmountpoints) - ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, OnBnClickedFollowjunctionpoints) - ON_BN_CLICKED(IDC_USEWDSLOCALE, OnBnClickedUseWdsLocale) - ON_CBN_SELENDOK(IDC_COMBO, OnCbnSelendokCombo) - ON_BN_CLICKED(IDC_SHOWGRID, OnBnClickedListGrid) - ON_BN_CLICKED(IDC_SHOWSTRIPES, OnBnClickedListStripes) - ON_BN_CLICKED(IDC_FULLROWSELECTION, OnBnClickedListFullRowSelection) +// PageGeneral.cpp - Implementation of CPageGeneral
+//
+// WinDirStat - Directory Statistics
+// Copyright (C) 2003-2005 Bernhard Seifert
+// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net)
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+
+#include "stdafx.h"
+#include "windirstat.h"
+#include "mainframe.h" // COptionsPropertySheet
+#include "PageGeneral.h"
+#include "options.h"
+#include "globalhelpers.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+IMPLEMENT_DYNAMIC(CPageGeneral, CPropertyPage)
+
+CPageGeneral::CPageGeneral()
+ : CPropertyPage(CPageGeneral::IDD)
+{
+}
+
+CPageGeneral::~CPageGeneral()
+{
+}
+
+COptionsPropertySheet *CPageGeneral::GetSheet()
+{
+ COptionsPropertySheet *sheet = DYNAMIC_DOWNCAST(COptionsPropertySheet, GetParent());
+ ASSERT(sheet != NULL);
+ return sheet;
+}
+
+void CPageGeneral::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_HUMANFORMAT, m_humanFormat);
+ DDX_Check(pDX, IDC_FOLLOWMOUNTPOINTS, m_followMountPoints);
+ DDX_Check(pDX, IDC_FOLLOWJUNCTIONS, m_followJunctionPoints);
+ DDX_Check(pDX, IDC_USEWDSLOCALE, m_useWdsLocale);
+ DDX_Control(pDX, IDC_COMBO, m_combo);
+ DDX_Control(pDX, IDC_FOLLOWMOUNTPOINTS, m_ctlFollowMountPoints);
+ DDX_Control(pDX, IDC_FOLLOWJUNCTIONS, m_ctlFollowJunctionPoints);
+ DDX_Check(pDX, IDC_SHOWGRID, m_listGrid);
+ DDX_Check(pDX, IDC_SHOWSTRIPES, m_listStripes);
+ DDX_Check(pDX, IDC_FULLROWSELECTION, m_listFullRowSelection);
+ DDX_Check(pDX, IDC_SKIPHIDDEN, m_skipHidden);
+}
+
+
+BEGIN_MESSAGE_MAP(CPageGeneral, CPropertyPage)
+ ON_BN_CLICKED(IDC_HUMANFORMAT, OnBnClickedHumanformat)
+ ON_BN_CLICKED(IDC_FOLLOWMOUNTPOINTS, OnBnClickedFollowmountpoints)
+ ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, OnBnClickedFollowjunctionpoints)
+ ON_BN_CLICKED(IDC_USEWDSLOCALE, OnBnClickedUseWdsLocale)
+ ON_CBN_SELENDOK(IDC_COMBO, OnCbnSelendokCombo)
+ ON_BN_CLICKED(IDC_SHOWGRID, OnBnClickedListGrid)
+ ON_BN_CLICKED(IDC_SHOWSTRIPES, OnBnClickedListStripes)
+ ON_BN_CLICKED(IDC_FULLROWSELECTION, OnBnClickedListFullRowSelection)
ON_BN_CLICKED(IDC_SKIPHIDDEN, OnBnClickedSkipHidden)
-END_MESSAGE_MAP() - - -BOOL CPageGeneral::OnInitDialog() -{ - int i = 0; - CPropertyPage::OnInitDialog(); - - m_humanFormat = GetOptions()->IsHumanFormat(); - m_listGrid = GetOptions()->IsListGrid(); - m_listStripes = GetOptions()->IsListStripes(); - m_listFullRowSelection = GetOptions()->IsListFullRowSelection(); - - m_followMountPoints = GetOptions()->IsFollowMountPoints(); - m_followJunctionPoints = GetOptions()->IsFollowJunctionPoints(); - m_useWdsLocale = GetOptions()->IsUseWdsLocale(); - m_skipHidden = GetOptions()->IsSkipHidden(); - - m_followMountPoints = false; // Otherwise we would see pacman only. - m_ctlFollowMountPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. - // The same for junction points - m_followJunctionPoints = false; // Otherwise we would see pacman only. - m_ctlFollowJunctionPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. - - int k = m_combo.AddString(GetLocaleLanguage(GetWDSApp()->GetBuiltInLanguage())); - m_combo.SetItemData(k, GetWDSApp()->GetBuiltInLanguage()); - - CArray<LANGID, LANGID> langid; - GetWDSApp()->GetAvailableResourceDllLangids(langid); - - for(i = 0; i < langid.GetSize(); i++) - { - k = m_combo.AddString(GetLocaleLanguage(langid[i])); - m_combo.SetItemData(k, langid[i]); - } - - m_originalLanguage = 0; - for(i = 0; i < m_combo.GetCount(); i++) - { - if(m_combo.GetItemData(i) == CLanguageOptions::GetLanguage()) - { - m_combo.SetCurSel(i); - m_originalLanguage = i; - break; - } - } - - UpdateData(false); - return TRUE; -} - -void CPageGeneral::OnOK() -{ - UpdateData(); - GetOptions()->SetHumanFormat(FALSE != m_humanFormat); - GetOptions()->SetFollowMountPoints(FALSE != m_followMountPoints); - GetOptions()->SetFollowJunctionPoints(FALSE != m_followJunctionPoints); - GetOptions()->SetUseWdsLocale(FALSE != m_useWdsLocale); - GetOptions()->SetListGrid(FALSE != m_listGrid); - GetOptions()->SetListStripes(FALSE != m_listStripes); - GetOptions()->SetListFullRowSelection(FALSE != m_listFullRowSelection); - GetOptions()->SetSkipHidden(FALSE != m_skipHidden); - - LANGID id = (LANGID)m_combo.GetItemData(m_combo.GetCurSel()); - CLanguageOptions::SetLanguage(id); - - CPropertyPage::OnOK(); -} - -void CPageGeneral::OnBnClickedHumanformat() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedFollowmountpoints() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedFollowjunctionpoints() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedUseWdsLocale() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListGrid() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListStripes() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListFullRowSelection() -{ - SetModified(); -} - -void CPageGeneral::OnCbnSelendokCombo() -{ - int i = m_combo.GetCurSel(); - GetSheet()->SetLanguageChanged(i != m_originalLanguage); - SetModified(); -} +END_MESSAGE_MAP()
+
+
+BOOL CPageGeneral::OnInitDialog()
+{
+ int i = 0;
+ CPropertyPage::OnInitDialog();
+
+ m_humanFormat = GetOptions()->IsHumanFormat();
+ m_listGrid = GetOptions()->IsListGrid();
+ m_listStripes = GetOptions()->IsListStripes();
+ m_listFullRowSelection = GetOptions()->IsListFullRowSelection();
+
+ m_followMountPoints = GetOptions()->IsFollowMountPoints();
+ m_followJunctionPoints = GetOptions()->IsFollowJunctionPoints();
+ m_useWdsLocale = GetOptions()->IsUseWdsLocale();
+ m_skipHidden = GetOptions()->IsSkipHidden();
+
+ m_followMountPoints = false; // Otherwise we would see pacman only.
+ m_ctlFollowMountPoints.ShowWindow(SW_HIDE); // Ignorance is bliss.
+ // The same for junction points
+ m_followJunctionPoints = false; // Otherwise we would see pacman only.
+ m_ctlFollowJunctionPoints.ShowWindow(SW_HIDE); // Ignorance is bliss.
+
+ int k = m_combo.AddString(GetLocaleLanguage(GetWDSApp()->GetBuiltInLanguage()));
+ m_combo.SetItemData(k, GetWDSApp()->GetBuiltInLanguage());
+
+ CArray<LANGID, LANGID> langid;
+ GetWDSApp()->GetAvailableResourceDllLangids(langid);
+
+ for(i = 0; i < langid.GetSize(); i++)
+ {
+ k = m_combo.AddString(GetLocaleLanguage(langid[i]));
+ m_combo.SetItemData(k, langid[i]);
+ }
+
+ m_originalLanguage = 0;
+ for(i = 0; i < m_combo.GetCount(); i++)
+ {
+ if(m_combo.GetItemData(i) == CLanguageOptions::GetLanguage())
+ {
+ m_combo.SetCurSel(i);
+ m_originalLanguage = i;
+ break;
+ }
+ }
+
+ UpdateData(false);
+ return TRUE;
+}
+
+void CPageGeneral::OnOK()
+{
+ UpdateData();
+ GetOptions()->SetHumanFormat(FALSE != m_humanFormat);
+ GetOptions()->SetFollowMountPoints(FALSE != m_followMountPoints);
+ GetOptions()->SetFollowJunctionPoints(FALSE != m_followJunctionPoints);
+ GetOptions()->SetUseWdsLocale(FALSE != m_useWdsLocale);
+ GetOptions()->SetListGrid(FALSE != m_listGrid);
+ GetOptions()->SetListStripes(FALSE != m_listStripes);
+ GetOptions()->SetListFullRowSelection(FALSE != m_listFullRowSelection);
+ GetOptions()->SetSkipHidden(FALSE != m_skipHidden);
+
+ LANGID id = (LANGID)m_combo.GetItemData(m_combo.GetCurSel());
+ CLanguageOptions::SetLanguage(id);
+
+ CPropertyPage::OnOK();
+}
+
+void CPageGeneral::OnBnClickedHumanformat()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedFollowmountpoints()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedFollowjunctionpoints()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedUseWdsLocale()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedListGrid()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedListStripes()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnBnClickedListFullRowSelection()
+{
+ SetModified();
+}
+
+void CPageGeneral::OnCbnSelendokCombo()
+{
+ int i = m_combo.GetCurSel();
+ GetSheet()->SetLanguageChanged(i != m_originalLanguage);
+ SetModified();
+}
void CPageGeneral::OnBnClickedSkipHidden()
diff --git a/windirstat/PageTreelist.cpp b/windirstat/PageTreelist.cpp index 0caf25d..8fb5e09 100644 --- a/windirstat/PageTreelist.cpp +++ b/windirstat/PageTreelist.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "windirstat.h" +#include "options.h" #include "PageTreelist.h" #ifdef _DEBUG diff --git a/windirstat/PageTreemap.cpp b/windirstat/PageTreemap.cpp index 98a5b0c..91e420f 100644 --- a/windirstat/PageTreemap.cpp +++ b/windirstat/PageTreemap.cpp @@ -21,6 +21,8 @@ #include "stdafx.h" #include "windirstat.h" +#include <common/commonhelpers.h> +#include "options.h" #include "PageTreemap.h" #ifdef _DEBUG diff --git a/windirstat/dirstatdoc.cpp b/windirstat/dirstatdoc.cpp index d512b29..213f913 100644 --- a/windirstat/dirstatdoc.cpp +++ b/windirstat/dirstatdoc.cpp @@ -24,8 +24,12 @@ #include "item.h" #include "mainframe.h" #include "osspecific.h" +#include "globalhelpers.h" #include "deletewarningdlg.h" #include "modalshellapi.h" +#include <common/mdexceptions.h> +#include <common/cotaskmem.h> +#include <common/commonhelpers.h> #include "dirstatdoc.h" #ifdef _DEBUG diff --git a/windirstat/dirstatview.cpp b/windirstat/dirstatview.cpp index 4dddf1f..75ae516 100644 --- a/windirstat/dirstatview.cpp +++ b/windirstat/dirstatview.cpp @@ -25,8 +25,10 @@ #include "dirstatdoc.h" #include "item.h" #include "mainframe.h" +#include <common/commonhelpers.h> #include "dirstatview.h" #include "osspecific.h" +#include "globalhelpers.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/windirstat/getosplatformstring.cpp b/windirstat/getosplatformstring.cpp index 3684cf3..b77bf48 100644 --- a/windirstat/getosplatformstring.cpp +++ b/windirstat/getosplatformstring.cpp @@ -21,6 +21,7 @@ #include "stdafx.h"
#include "windirstat.h"
+#include <common/commonhelpers.h> #include "getosplatformstring.h"
#ifdef _DEBUG
diff --git a/windirstat/globalhelpers.cpp b/windirstat/globalhelpers.cpp index dced820..1404c53 100644 --- a/windirstat/globalhelpers.cpp +++ b/windirstat/globalhelpers.cpp @@ -22,7 +22,11 @@ #include "stdafx.h" #include "windirstat.h" +#include <common/mdexceptions.h> +#include <common/cotaskmem.h> +#include <common/commonhelpers.h> #include "globalhelpers.h" +#include "options.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -243,6 +247,21 @@ CString FormatFileTime(const FILETIME& t) CString FormatAttributes(DWORD attr) { + // order: + // strAttributeReadonly + // strAttributeHidden + // strAttributeSystem + // strAttributeArchive + // strAttributeTemporary + // strAttributeCompressed + // strAttributeEncrypted + // strAttributeIntegrityStream + // strAttributeVirtual + // strAttributeReparsePoint + // strAttributeSparse + // strAttributeOffline + // strAttributeNotContentIndexed + // strAttributeEA if(attr == INVALID_FILE_ATTRIBUTES) { return wds::strInvalidAttributes; diff --git a/windirstat/item.cpp b/windirstat/item.cpp index c06e107..cdb567d 100644 --- a/windirstat/item.cpp +++ b/windirstat/item.cpp @@ -23,8 +23,11 @@ #include "windirstat.h" #include "dirstatdoc.h" // GetItemColor() #include "mainframe.h" -#include "item.h" +#include <common/commonhelpers.h> +#include "selectobject.h" #include "WorkLimiter.h" +#include "item.h" +#include "globalhelpers.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/windirstat/layout.cpp b/windirstat/layout.cpp index 2134dff..bbdd7ce 100644 --- a/windirstat/layout.cpp +++ b/windirstat/layout.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "windirstat.h" #include "options.h" +#include "selectobject.h" #include "layout.h" #ifdef _DEBUG diff --git a/windirstat/mainframe.cpp b/windirstat/mainframe.cpp index 9b8b6c6..25d3a43 100644 --- a/windirstat/mainframe.cpp +++ b/windirstat/mainframe.cpp @@ -28,6 +28,7 @@ #include "typeview.h" #include "dirstatdoc.h" #include "osspecific.h" +#include "globalhelpers.h" #include "item.h" #include "pagecleanups.h" @@ -35,6 +36,9 @@ #include "pagetreemap.h" #include "pagegeneral.h" +#include <common/mdexceptions.h> +#include <common/commonhelpers.h> + #include "mainframe.h" #ifdef _DEBUG @@ -680,13 +684,13 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) VERIFY(m_wndToolBar.LoadToolBar(IDR_MAINFRAME)); UINT *indic = indicators; - UINT size = countof(indicators); + UINT size = _countof(indicators); // If psapi is not supported, don't show that pane. if(GetWDSApp()->GetCurrentProcessMemoryInfo() == wds::strEmpty) { indic = indicatorsWithoutMemoryUsage; - size = countof(indicatorsWithoutMemoryUsage); + size = _countof(indicatorsWithoutMemoryUsage); } VERIFY(m_wndStatusBar.Create(this)); diff --git a/windirstat/mountpoints.cpp b/windirstat/mountpoints.cpp index d160349..a3e3b3e 100644 --- a/windirstat/mountpoints.cpp +++ b/windirstat/mountpoints.cpp @@ -23,6 +23,7 @@ #include "osspecific.h" #include "mountpoints.h" #include "globalhelpers.h" +#include <common/tracer.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -73,7 +74,7 @@ void CReparsePoints::GetDriveVolumes() CString s; s.Format(_T("%c:\\"), i + wds::chrCapA); - BOOL b = ::GetVolumeNameForVolumeMountPoint(s, volume, countof(volume)); + BOOL b = ::GetVolumeNameForVolumeMountPoint(s, volume, _countof(volume)); if(!b) { @@ -94,21 +95,21 @@ void CReparsePoints::GetDriveVolumes() void CReparsePoints::GetAllMountPoints() { TCHAR volume[_MAX_PATH]; - HANDLE hvol = ::FindFirstVolume(volume, countof(volume)); + HANDLE hvol = ::FindFirstVolume(volume, _countof(volume)); if(hvol == INVALID_HANDLE_VALUE) { VTRACE(_T("No volumes found.")); return; } - for(BOOL bContinue = true; bContinue; bContinue = ::FindNextVolume(hvol, volume, countof(volume))) + for(BOOL bContinue = true; bContinue; bContinue = ::FindNextVolume(hvol, volume, _countof(volume))) { TCHAR fsname[_MAX_PATH], vname[_MAX_PATH]; PointVolumeArray *pva = new PointVolumeArray; ASSERT_VALID(pva); DWORD fsflags; - BOOL b = ::GetVolumeInformation(volume, vname, countof(vname), NULL, NULL, &fsflags, fsname, countof(fsname)); + BOOL b = ::GetVolumeInformation(volume, vname, _countof(vname), NULL, NULL, &fsflags, fsname, _countof(fsname)); if(!b) { @@ -132,7 +133,7 @@ void CReparsePoints::GetAllMountPoints() } TCHAR point[_MAX_PATH]; - HANDLE h = ::FindFirstVolumeMountPoint(volume, point, countof(point)); + HANDLE h = ::FindFirstVolumeMountPoint(volume, point, _countof(point)); if(h == INVALID_HANDLE_VALUE) { # ifdef _DEBUG @@ -152,13 +153,13 @@ void CReparsePoints::GetAllMountPoints() continue; } - for(BOOL bCont = TRUE; bCont; bCont = ::FindNextVolumeMountPoint(h, point, countof(point))) + for(BOOL bCont = TRUE; bCont; bCont = ::FindNextVolumeMountPoint(h, point, _countof(point))) { CString uniquePath = volume; uniquePath += point; TCHAR mountedVolume[_MAX_PATH]; - const BOOL bGotMountPoints = ::GetVolumeNameForVolumeMountPoint(uniquePath, mountedVolume, countof(mountedVolume)); + const BOOL bGotMountPoints = ::GetVolumeNameForVolumeMountPoint(uniquePath, mountedVolume, _countof(mountedVolume)); if(!bGotMountPoints) { diff --git a/windirstat/options.cpp b/windirstat/options.cpp index f8f338a..da5ae91 100644 --- a/windirstat/options.cpp +++ b/windirstat/options.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "windirstat.h" #include "dirstatdoc.h" +#include <common/commonhelpers.h> #include "options.h" #ifdef _DEBUG diff --git a/windirstat/selectobject.h b/windirstat/selectobject.h index aa9ad0c..40163d1 100644 --- a/windirstat/selectobject.h +++ b/windirstat/selectobject.h @@ -27,9 +27,11 @@ // CSelectObject sobrush(pdc, &brush); // and the destructor will reselect the old object. -#ifndef __WDS_SELECTOBJECT_H__ -#define __WDS_SELECTOBJECT_H__ +#ifndef __SELECTOBJECT_H_VER__ +#define __SELECTOBJECT_H_VER__ 2017112219 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once +#endif /* Check for "#pragma once" support */ #include "stdafx.h" class CSelectObject @@ -116,4 +118,4 @@ inline COLORREF MakeShadowColor(COLORREF c, int percent) ); } -#endif // __WDS_SELECTOBJECT_H__ +#endif /* __SELECTOBJECT_H_VER__ */ diff --git a/windirstat/stdafx.cpp b/windirstat/stdafx.cpp index d8e8b87..d469c3e 100644 --- a/windirstat/stdafx.cpp +++ b/windirstat/stdafx.cpp @@ -1,6 +1,4 @@ // stdafx.cpp - source file that includes just the standard includes
-// windirstat.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
//
// WinDirStat - Directory Statistics
// Copyright (C) 2003-2005 Bernhard Seifert
diff --git a/windirstat/stdafx.h b/windirstat/stdafx.h index 8245bf3..ee2164d 100644 --- a/windirstat/stdafx.h +++ b/windirstat/stdafx.h @@ -21,9 +21,11 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -#ifndef __WDS_STDAFX_H__ -#define __WDS_STDAFX_H__ +#ifndef __STDAFX_H_VER__ +#define __STDAFX_H_VER__ 2017112218 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once +#endif /* Check for "#pragma once" support */ #if (defined(HAVE_WIN7_SDK) && HAVE_WIN7_SDK) || (_MSC_VER >= 1600) # define SUPPORT_W7_TASKBAR 1 @@ -54,34 +56,22 @@ #include <afxinet.h> // For CInternet* classes #include <io.h> // _access() -#include <math.h> // floor(), fmod(), sqrt() etc. +#include <cmath> // floor(), fmod(), sqrt() etc. +#include <cfloat> // DBL_MAX #include <psapi.h> // PROCESS_MEMORY_INFO -#include <lmcons.h> // UNLEN -#include <float.h> // DBL_MAX -#include <atlbase.h> // USES_CONVERSION, ComPtr<> +#include <atlbase.h> // ComPtr<> -#include <common/mdexceptions.h> -#include <common/cotaskmem.h> -#include <common/commonhelpers.h> -#include <common/tracer.h> -#include <common/wds_constants.h> +// Aliasing the macros from wingdi.h +#define RGB_GET_RVALUE(rgb) GetRValue(rgb) +#define RGB_GET_GVALUE(rgb) GetGValue(rgb) +#define RGB_GET_BVALUE(rgb) GetBValue(rgb) -#define RGB_GET_RVALUE(rgb) (rgb & 0xFF) -#define RGB_GET_GVALUE(rgb) ((rgb & 0xFF00) >> 8) -#define RGB_GET_BVALUE(rgb) ((rgb & 0xFF0000) >> 16) - -// General purpose headers -#include "selectobject.h" -#include "set.h" - -#define countof(arr) (sizeof(arr)/sizeof((arr)[0])) - -template<class T> int signum(T x) { return (x) < 0 ? -1 : (x) == 0 ? 0 : 1; } +template<typename T> int signum(T x) { return (x) < 0 ? -1 : (x) == 0 ? 0 : 1; } /// signum function for unsigned numbers. -template<class T> int usignum(T x, T y) { return (x) < (y) ? -1 : (x) == (y) ? 0 : 1; } +template<typename T> int usignum(T x, T y) { return (x) < (y) ? -1 : (x) == (y) ? 0 : 1; } #define WEAK_ASSERT /##/ ASSERT -#endif // __WDS_STDAFX_H__ +#endif /* __STDAFX_H_VER__ */ diff --git a/windirstat/windirstat.cpp b/windirstat/windirstat.cpp index d28bd5b..29ad50c 100644 --- a/windirstat/windirstat.cpp +++ b/windirstat/windirstat.cpp @@ -23,12 +23,15 @@ #include "stdafx.h" #include "windirstat.h" +#include <common/mdexceptions.h> +#include <common/commonhelpers.h> #include "mainframe.h" #include "selectdrivesdlg.h" #include "aboutdlg.h" #include "dirstatdoc.h" #include "graphview.h" #include "osspecific.h" +#include "globalhelpers.h" #include "WorkLimiter.h" #pragma warning(push) #pragma warning(disable : 4091) @@ -105,8 +108,8 @@ CDirstatApp::CDirstatApp() # endif # if SUPPORT_ELEVATION - m_ElevationEventName.Format(WINDIRSTAT_EVENT_NAME_FMT, static_cast<LPCTSTR>(GetCurrentDesktopName()), static_cast<LPCTSTR>(GetCurrentWinstaName())); - VTRACE(_T("Elevation event: %s"), static_cast<LPCTSTR>(m_ElevationEventName)); + m_ElevationEventName.Format(WINDIRSTAT_EVENT_NAME_FMT, GetCurrentDesktopName().GetBuffer(), GetCurrentWinstaName().GetBuffer()); + VTRACE(_T("Elevation event: %s"), m_ElevationEventName.GetBuffer()); # endif // SUPPORT_ELEVATION } diff --git a/windirstat/windirstat.h b/windirstat/windirstat.h index e3fbb99..0066378 100644 --- a/windirstat/windirstat.h +++ b/windirstat/windirstat.h @@ -20,15 +20,15 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -#ifndef __WDS_WINDIRSTAT_H__ -#define __WDS_WINDIRSTAT_H__ +#ifndef __WINDIRSTAT_H_VER__ +#define __WINDIRSTAT_H_VER__ 2017112219 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once +#endif /* Check for "#pragma once" support */ + #include <Windows.h> #include "resource.h" #include "myimagelist.h" -#include "osspecific.h" -#include "globalhelpers.h" -#include "options.h" #include "mountpoints.h" #include "helpmap.h" #include <common/tracer.h> @@ -140,4 +140,5 @@ protected: afx_msg void OnHelpManual(); afx_msg void OnAppAbout(); }; -#endif // __WDS_WINDIRSTAT_H__ + +#endif /* __WINDIRSTAT_H_VER__ */ |