Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2017-01-10 00:46:40 +0300
committerOliver Schneider <oliver@assarbad.net>2017-01-10 00:46:40 +0300
commit7ec44caad3fdc9fa92312e82b3d2a7200615a39a (patch)
treec6012b7a93df84af05a7362ebc6e1eb646c19b07 /windirstat/Controls
parentc40cbf3095e4c769d80c6837476a7b0fb452fbf0 (diff)
All source files now with LF line endings again
Updated the logo files a bit, renamed some others
Diffstat (limited to 'windirstat/Controls')
-rw-r--r--windirstat/Controls/ColorButton.cpp2
-rw-r--r--windirstat/Controls/ColorButton.h2
-rw-r--r--windirstat/Controls/TreeListControl.cpp2
-rw-r--r--windirstat/Controls/TreeListControl.h2
-rw-r--r--windirstat/Controls/graphview.cpp2
-rw-r--r--windirstat/Controls/graphview.h2
-rw-r--r--windirstat/Controls/myimagelist.cpp2
-rw-r--r--windirstat/Controls/myimagelist.h2
-rw-r--r--windirstat/Controls/ownerdrawnlistcontrol.cpp2
-rw-r--r--windirstat/Controls/ownerdrawnlistcontrol.h2
-rw-r--r--windirstat/Controls/pacman.cpp2
-rw-r--r--windirstat/Controls/pacman.h2
-rw-r--r--windirstat/Controls/sortinglistcontrol.cpp634
-rw-r--r--windirstat/Controls/sortinglistcontrol.h222
-rw-r--r--windirstat/Controls/treemap.cpp2
-rw-r--r--windirstat/Controls/treemap.h2
-rw-r--r--windirstat/Controls/typeview.cpp2
-rw-r--r--windirstat/Controls/typeview.h2
-rw-r--r--windirstat/Controls/xyslider.cpp2
-rw-r--r--windirstat/Controls/xyslider.h2
20 files changed, 446 insertions, 446 deletions
diff --git a/windirstat/Controls/ColorButton.cpp b/windirstat/Controls/ColorButton.cpp
index 4bf3617..632a734 100644
--- a/windirstat/Controls/ColorButton.cpp
+++ b/windirstat/Controls/ColorButton.cpp
@@ -17,7 +17,7 @@
// 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 "colorbutton.h"
diff --git a/windirstat/Controls/ColorButton.h b/windirstat/Controls/ColorButton.h
index 1afdd9e..a174a62 100644
--- a/windirstat/Controls/ColorButton.h
+++ b/windirstat/Controls/ColorButton.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_COLORBUTTON_H__
#define __WDS_COLORBUTTON_H__
diff --git a/windirstat/Controls/TreeListControl.cpp b/windirstat/Controls/TreeListControl.cpp
index 362b19c..ba1ba10 100644
--- a/windirstat/Controls/TreeListControl.cpp
+++ b/windirstat/Controls/TreeListControl.cpp
@@ -17,7 +17,7 @@
// 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"
diff --git a/windirstat/Controls/TreeListControl.h b/windirstat/Controls/TreeListControl.h
index 8e47863..b9d1a48 100644
--- a/windirstat/Controls/TreeListControl.h
+++ b/windirstat/Controls/TreeListControl.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_TREELISTCONTROL_H__
#define __WDS_TREELISTCONTROL_H__
diff --git a/windirstat/Controls/graphview.cpp b/windirstat/Controls/graphview.cpp
index 19601e4..db72836 100644
--- a/windirstat/Controls/graphview.cpp
+++ b/windirstat/Controls/graphview.cpp
@@ -17,7 +17,7 @@
// 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"
diff --git a/windirstat/Controls/graphview.h b/windirstat/Controls/graphview.h
index c97adb6..356a6f8 100644
--- a/windirstat/Controls/graphview.h
+++ b/windirstat/Controls/graphview.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_GRAPHVIEW_H__
#define __WDS_GRAPHVIEW_H__
diff --git a/windirstat/Controls/myimagelist.cpp b/windirstat/Controls/myimagelist.cpp
index 656a276..961dcce 100644
--- a/windirstat/Controls/myimagelist.cpp
+++ b/windirstat/Controls/myimagelist.cpp
@@ -17,7 +17,7 @@
// 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"
diff --git a/windirstat/Controls/myimagelist.h b/windirstat/Controls/myimagelist.h
index e373971..851067b 100644
--- a/windirstat/Controls/myimagelist.h
+++ b/windirstat/Controls/myimagelist.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_MYIMAGELIST_H__
#define __WDS_MYIMAGELIST_H__
diff --git a/windirstat/Controls/ownerdrawnlistcontrol.cpp b/windirstat/Controls/ownerdrawnlistcontrol.cpp
index 4347f98..48f6c8b 100644
--- a/windirstat/Controls/ownerdrawnlistcontrol.cpp
+++ b/windirstat/Controls/ownerdrawnlistcontrol.cpp
@@ -17,7 +17,7 @@
// 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"
diff --git a/windirstat/Controls/ownerdrawnlistcontrol.h b/windirstat/Controls/ownerdrawnlistcontrol.h
index 511974e..3701d8e 100644
--- a/windirstat/Controls/ownerdrawnlistcontrol.h
+++ b/windirstat/Controls/ownerdrawnlistcontrol.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_OWNERDRAWNLISTCONTROL_H__
#define __WDS_OWNERDRAWNLISTCONTROL_H__
diff --git a/windirstat/Controls/pacman.cpp b/windirstat/Controls/pacman.cpp
index 7d16f89..ca95dd6 100644
--- a/windirstat/Controls/pacman.cpp
+++ b/windirstat/Controls/pacman.cpp
@@ -17,7 +17,7 @@
// 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 "pacman.h"
diff --git a/windirstat/Controls/pacman.h b/windirstat/Controls/pacman.h
index e389143..01e4fd5 100644
--- a/windirstat/Controls/pacman.h
+++ b/windirstat/Controls/pacman.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_PACMAN_H__
#define __WDS_PACMAN_H__
diff --git a/windirstat/Controls/sortinglistcontrol.cpp b/windirstat/Controls/sortinglistcontrol.cpp
index 0c6648f..6de005b 100644
--- a/windirstat/Controls/sortinglistcontrol.cpp
+++ b/windirstat/Controls/sortinglistcontrol.cpp
@@ -1,317 +1,317 @@
-// sortinglistcontrol.cpp - Implementation of CSortingListItem and CSortingListControl
-//
-// WinDirStat - Directory Statistics
-// Copyright (C) 2003-2005 Bernhard Seifert
-// Copyright (C) 2004-2016 WinDirStat team (windirstat.info)
-//
-// 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 "sortinglistcontrol.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-
-CString CSortingListItem::GetText(int subitem) const
-{
- // Dummy implementation
- CString s;
- s.Format(_T("subitem %d"), subitem);
- return s;
-}
-
-int CSortingListItem::GetImage() const
-{
- // Dummy implementation
- return 0;
-}
-
-// Return value:
-// <= -2: this is less than other regardless of ascending flag
-// -1: this is less than other
-// 0: this equals other
-// +1: this is greater than other
-// >= +1: this is greater than other regardless of ascending flag.
-//
-int CSortingListItem::Compare(const CSortingListItem *other, int subitem) const
-{
- // Default implementation compares strings
- return signum(GetText(subitem).CompareNoCase(other->GetText(subitem)));
-}
-
-// TODO: check how suitable those are for Unicode-only strings (say Russian)
-int CSortingListItem::CompareS(const CSortingListItem *other, const SSorting& sorting) const
-{
- int r = Compare(other, sorting.column1);
- if(abs(r) < 2 && !sorting.ascending1)
- {
- r = -r;
- }
-
- if(r == 0 && sorting.column2 != sorting.column1)
- {
- r = Compare(other, sorting.column2);
- if(abs(r) < 2 && !sorting.ascending2)
- {
- r = -r;
- }
- }
- return r;
-}
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-IMPLEMENT_DYNAMIC(CSortingListControl, CListCtrl)
-
-CSortingListControl::CSortingListControl(LPCTSTR name)
-{
- m_name = name;
- m_indicatedColumn = -1;
-}
-
-CSortingListControl::~CSortingListControl()
-{
-}
-
-void CSortingListControl::LoadPersistentAttributes()
-{
- int i = 0;
- CArray<int, int> arr;
- arr.SetSize(GetHeaderCtrl()->GetItemCount());
-
- GetColumnOrderArray(arr.GetData(), arr.GetSize());
- CPersistence::GetColumnOrder(m_name, arr);
- SetColumnOrderArray(int(arr.GetSize()), arr.GetData());
-
- for(i = 0; i < arr.GetSize(); i++)
- {
- arr[i]= GetColumnWidth(i);
- }
- CPersistence::GetColumnWidths(m_name, arr);
- for(i = 0; i < arr.GetSize(); i++)
- {
- // To avoid "insane" settings we set the column width to
- // maximal twice the default width.
- int maxWidth = GetColumnWidth(i) * 2;
- int w = min(arr[i], maxWidth);
- SetColumnWidth(i, w);
- }
-
- // Not so good: CPersistence::GetSorting(m_name, GetHeaderCtrl()->GetItemCount(), m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
- // We refrain from saving the sorting because it is too likely, that
- // users start up with insane settings and don't get it.
-}
-
-void CSortingListControl::SavePersistentAttributes()
-{
- CArray<int, int> arr;
- arr.SetSize(GetHeaderCtrl()->GetItemCount());
-
- GetColumnOrderArray(arr.GetData(), arr.GetSize());
- CPersistence::SetColumnOrder(m_name, arr);
-
- for(int i = 0; i < arr.GetSize(); i++)
- {
- arr[i]= GetColumnWidth(i);
- }
- CPersistence::SetColumnWidths(m_name, arr);
-
- // Not so good: CPersistence::SetSorting(m_name, m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
-}
-
-void CSortingListControl::AddExtendedStyle(DWORD exStyle)
-{
- SetExtendedStyle(GetExtendedStyle() | exStyle);
-}
-
-void CSortingListControl::RemoveExtendedStyle(DWORD exStyle)
-{
- SetExtendedStyle(GetExtendedStyle() & ~exStyle);
-}
-
-
-const SSorting& CSortingListControl::GetSorting()
-{
- return m_sorting;
-}
-
-void CSortingListControl::SetSorting(const SSorting& sorting)
-{
- m_sorting = sorting;
-}
-
-void CSortingListControl::SetSorting(int sortColumn1, bool ascending1, int sortColumn2, bool ascending2)
-{
- m_sorting.column1 = sortColumn1;
- m_sorting.ascending1 = ascending1;
- m_sorting.column2 = sortColumn2;
- m_sorting.ascending2 = ascending2;
-}
-
-void CSortingListControl::SetSorting(int sortColumn, bool ascending)
-{
- m_sorting.column2 = m_sorting.column1;
- m_sorting.ascending2 = m_sorting.ascending1;
- m_sorting.column1 = sortColumn;
- m_sorting.ascending1 = ascending;
-}
-
-void CSortingListControl::InsertListItem(int i, CSortingListItem *item)
-{
- LVITEM lvitem;
- ZeroMemory(&lvitem, sizeof(lvitem));
-
- lvitem.mask = LVIF_TEXT | LVIF_PARAM;
- if(HasImages())
- {
- lvitem.mask |= LVIF_IMAGE;
- }
-
- lvitem.iItem = i;
- lvitem.pszText = LPSTR_TEXTCALLBACK;
- lvitem.iImage = I_IMAGECALLBACK;
- lvitem.lParam = (LPARAM)item;
-
- VERIFY(i == CListCtrl::InsertItem(&lvitem));
-}
-
-CSortingListItem *CSortingListControl::GetSortingListItem(int i)
-{
- return (CSortingListItem *)GetItemData(i);
-}
-
-void CSortingListControl::SortItems()
-{
- VERIFY(CListCtrl::SortItems(&_CompareFunc, (DWORD_PTR)&m_sorting));
-
- HDITEM hditem;
- ZeroMemory(&hditem, sizeof(hditem));
-
- if(m_indicatedColumn != -1)
- {
- CString text;
- hditem.mask = HDI_TEXT;
- hditem.pszText = text.GetBuffer(256);
- hditem.cchTextMax = 256;
- GetHeaderCtrl()->GetItem(m_indicatedColumn, &hditem);
- text.ReleaseBuffer();
- text = text.Mid(2);
- hditem.pszText = (LPTSTR)(LPCTSTR)text;
- GetHeaderCtrl()->SetItem(m_indicatedColumn, &hditem);
- }
-
- CString text;
- hditem.mask = HDI_TEXT;
- hditem.pszText = text.GetBuffer(256);
- hditem.cchTextMax = 256;
- GetHeaderCtrl()->GetItem(m_sorting.column1, &hditem);
- text.ReleaseBuffer();
- text = (m_sorting.ascending1 ? _T("< ") : _T("> ")) + text;
- hditem.pszText = (LPTSTR)(LPCTSTR)text;
- GetHeaderCtrl()->SetItem(m_sorting.column1, &hditem);
- m_indicatedColumn = m_sorting.column1;
-}
-
-bool CSortingListControl::GetAscendingDefault(int /*column*/)
-{
- return true;
-}
-
-bool CSortingListControl::HasImages()
-{
- return false;
-}
-
-# if (_MFC_VER <=0x0800)
-BOOL CSortingListControl::GetColumnOrderArray(LPINT piArray, INT_PTR iCount)
-{
- ASSERT(iCount <= INT_MAX);
- return dynamic_cast<CListCtrl*>(this)->GetColumnOrderArray(piArray, (int)iCount);
-}
-# endif
-
-int CALLBACK CSortingListControl::_CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
-{
- CSortingListItem *item1 = (CSortingListItem *)lParam1;
- CSortingListItem *item2 = (CSortingListItem *)lParam2;
- SSorting *sorting = (SSorting *)lParamSort;
-
- return item1->CompareS(item2, *sorting);
-}
-
-BEGIN_MESSAGE_MAP(CSortingListControl, CListCtrl)
- ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnLvnGetdispinfo)
- ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHdnItemclick)
- ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHdnItemclick)
- ON_NOTIFY(HDN_ITEMDBLCLICKA, 0, OnHdnItemdblclick)
- ON_NOTIFY(HDN_ITEMDBLCLICKW, 0, OnHdnItemdblclick)
- ON_WM_DESTROY()
-END_MESSAGE_MAP()
-
-void CSortingListControl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
-{
- NMLVDISPINFO *di = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
- *pResult = 0;
-
- CSortingListItem *item = (CSortingListItem *)(di->item.lParam);
-
- if((di->item.mask & LVIF_TEXT) != 0)
- {
- _tcscpy_s(di->item.pszText, di->item.cchTextMax, item->GetText(di->item.iSubItem));
- }
-
- if((di->item.mask & LVIF_IMAGE) != 0)
- {
- di->item.iImage = item->GetImage();
- }
-}
-
-void CSortingListControl::OnHdnItemclick(NMHDR *pNMHDR, LRESULT *pResult)
-{
- LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
- *pResult = 0;
- const int col = phdr->iItem;
-
- if(col == m_sorting.column1)
- {
- m_sorting.ascending1 = !m_sorting.ascending1;
- }
- else
- {
- SetSorting(col, GetAscendingDefault(col));
- }
-
- SortItems();
-}
-
-
-void CSortingListControl::OnHdnItemdblclick(NMHDR *pNMHDR, LRESULT *pResult)
-{
- OnHdnItemclick(pNMHDR, pResult);
-}
-
-void CSortingListControl::OnDestroy()
-{
- SavePersistentAttributes();
- CListCtrl::OnDestroy();
-}
+// sortinglistcontrol.cpp - Implementation of CSortingListItem and CSortingListControl
+//
+// WinDirStat - Directory Statistics
+// Copyright (C) 2003-2005 Bernhard Seifert
+// Copyright (C) 2004-2016 WinDirStat team (windirstat.info)
+//
+// 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 "sortinglistcontrol.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+CString CSortingListItem::GetText(int subitem) const
+{
+ // Dummy implementation
+ CString s;
+ s.Format(_T("subitem %d"), subitem);
+ return s;
+}
+
+int CSortingListItem::GetImage() const
+{
+ // Dummy implementation
+ return 0;
+}
+
+// Return value:
+// <= -2: this is less than other regardless of ascending flag
+// -1: this is less than other
+// 0: this equals other
+// +1: this is greater than other
+// >= +1: this is greater than other regardless of ascending flag.
+//
+int CSortingListItem::Compare(const CSortingListItem *other, int subitem) const
+{
+ // Default implementation compares strings
+ return signum(GetText(subitem).CompareNoCase(other->GetText(subitem)));
+}
+
+// TODO: check how suitable those are for Unicode-only strings (say Russian)
+int CSortingListItem::CompareS(const CSortingListItem *other, const SSorting& sorting) const
+{
+ int r = Compare(other, sorting.column1);
+ if(abs(r) < 2 && !sorting.ascending1)
+ {
+ r = -r;
+ }
+
+ if(r == 0 && sorting.column2 != sorting.column1)
+ {
+ r = Compare(other, sorting.column2);
+ if(abs(r) < 2 && !sorting.ascending2)
+ {
+ r = -r;
+ }
+ }
+ return r;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_DYNAMIC(CSortingListControl, CListCtrl)
+
+CSortingListControl::CSortingListControl(LPCTSTR name)
+{
+ m_name = name;
+ m_indicatedColumn = -1;
+}
+
+CSortingListControl::~CSortingListControl()
+{
+}
+
+void CSortingListControl::LoadPersistentAttributes()
+{
+ int i = 0;
+ CArray<int, int> arr;
+ arr.SetSize(GetHeaderCtrl()->GetItemCount());
+
+ GetColumnOrderArray(arr.GetData(), arr.GetSize());
+ CPersistence::GetColumnOrder(m_name, arr);
+ SetColumnOrderArray(int(arr.GetSize()), arr.GetData());
+
+ for(i = 0; i < arr.GetSize(); i++)
+ {
+ arr[i]= GetColumnWidth(i);
+ }
+ CPersistence::GetColumnWidths(m_name, arr);
+ for(i = 0; i < arr.GetSize(); i++)
+ {
+ // To avoid "insane" settings we set the column width to
+ // maximal twice the default width.
+ int maxWidth = GetColumnWidth(i) * 2;
+ int w = min(arr[i], maxWidth);
+ SetColumnWidth(i, w);
+ }
+
+ // Not so good: CPersistence::GetSorting(m_name, GetHeaderCtrl()->GetItemCount(), m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
+ // We refrain from saving the sorting because it is too likely, that
+ // users start up with insane settings and don't get it.
+}
+
+void CSortingListControl::SavePersistentAttributes()
+{
+ CArray<int, int> arr;
+ arr.SetSize(GetHeaderCtrl()->GetItemCount());
+
+ GetColumnOrderArray(arr.GetData(), arr.GetSize());
+ CPersistence::SetColumnOrder(m_name, arr);
+
+ for(int i = 0; i < arr.GetSize(); i++)
+ {
+ arr[i]= GetColumnWidth(i);
+ }
+ CPersistence::SetColumnWidths(m_name, arr);
+
+ // Not so good: CPersistence::SetSorting(m_name, m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
+}
+
+void CSortingListControl::AddExtendedStyle(DWORD exStyle)
+{
+ SetExtendedStyle(GetExtendedStyle() | exStyle);
+}
+
+void CSortingListControl::RemoveExtendedStyle(DWORD exStyle)
+{
+ SetExtendedStyle(GetExtendedStyle() & ~exStyle);
+}
+
+
+const SSorting& CSortingListControl::GetSorting()
+{
+ return m_sorting;
+}
+
+void CSortingListControl::SetSorting(const SSorting& sorting)
+{
+ m_sorting = sorting;
+}
+
+void CSortingListControl::SetSorting(int sortColumn1, bool ascending1, int sortColumn2, bool ascending2)
+{
+ m_sorting.column1 = sortColumn1;
+ m_sorting.ascending1 = ascending1;
+ m_sorting.column2 = sortColumn2;
+ m_sorting.ascending2 = ascending2;
+}
+
+void CSortingListControl::SetSorting(int sortColumn, bool ascending)
+{
+ m_sorting.column2 = m_sorting.column1;
+ m_sorting.ascending2 = m_sorting.ascending1;
+ m_sorting.column1 = sortColumn;
+ m_sorting.ascending1 = ascending;
+}
+
+void CSortingListControl::InsertListItem(int i, CSortingListItem *item)
+{
+ LVITEM lvitem;
+ ZeroMemory(&lvitem, sizeof(lvitem));
+
+ lvitem.mask = LVIF_TEXT | LVIF_PARAM;
+ if(HasImages())
+ {
+ lvitem.mask |= LVIF_IMAGE;
+ }
+
+ lvitem.iItem = i;
+ lvitem.pszText = LPSTR_TEXTCALLBACK;
+ lvitem.iImage = I_IMAGECALLBACK;
+ lvitem.lParam = (LPARAM)item;
+
+ VERIFY(i == CListCtrl::InsertItem(&lvitem));
+}
+
+CSortingListItem *CSortingListControl::GetSortingListItem(int i)
+{
+ return (CSortingListItem *)GetItemData(i);
+}
+
+void CSortingListControl::SortItems()
+{
+ VERIFY(CListCtrl::SortItems(&_CompareFunc, (DWORD_PTR)&m_sorting));
+
+ HDITEM hditem;
+ ZeroMemory(&hditem, sizeof(hditem));
+
+ if(m_indicatedColumn != -1)
+ {
+ CString text;
+ hditem.mask = HDI_TEXT;
+ hditem.pszText = text.GetBuffer(256);
+ hditem.cchTextMax = 256;
+ GetHeaderCtrl()->GetItem(m_indicatedColumn, &hditem);
+ text.ReleaseBuffer();
+ text = text.Mid(2);
+ hditem.pszText = (LPTSTR)(LPCTSTR)text;
+ GetHeaderCtrl()->SetItem(m_indicatedColumn, &hditem);
+ }
+
+ CString text;
+ hditem.mask = HDI_TEXT;
+ hditem.pszText = text.GetBuffer(256);
+ hditem.cchTextMax = 256;
+ GetHeaderCtrl()->GetItem(m_sorting.column1, &hditem);
+ text.ReleaseBuffer();
+ text = (m_sorting.ascending1 ? _T("< ") : _T("> ")) + text;
+ hditem.pszText = (LPTSTR)(LPCTSTR)text;
+ GetHeaderCtrl()->SetItem(m_sorting.column1, &hditem);
+ m_indicatedColumn = m_sorting.column1;
+}
+
+bool CSortingListControl::GetAscendingDefault(int /*column*/)
+{
+ return true;
+}
+
+bool CSortingListControl::HasImages()
+{
+ return false;
+}
+
+# if (_MFC_VER <=0x0800)
+BOOL CSortingListControl::GetColumnOrderArray(LPINT piArray, INT_PTR iCount)
+{
+ ASSERT(iCount <= INT_MAX);
+ return dynamic_cast<CListCtrl*>(this)->GetColumnOrderArray(piArray, (int)iCount);
+}
+# endif
+
+int CALLBACK CSortingListControl::_CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{
+ CSortingListItem *item1 = (CSortingListItem *)lParam1;
+ CSortingListItem *item2 = (CSortingListItem *)lParam2;
+ SSorting *sorting = (SSorting *)lParamSort;
+
+ return item1->CompareS(item2, *sorting);
+}
+
+BEGIN_MESSAGE_MAP(CSortingListControl, CListCtrl)
+ ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnLvnGetdispinfo)
+ ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHdnItemclick)
+ ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHdnItemclick)
+ ON_NOTIFY(HDN_ITEMDBLCLICKA, 0, OnHdnItemdblclick)
+ ON_NOTIFY(HDN_ITEMDBLCLICKW, 0, OnHdnItemdblclick)
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+void CSortingListControl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ NMLVDISPINFO *di = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
+ *pResult = 0;
+
+ CSortingListItem *item = (CSortingListItem *)(di->item.lParam);
+
+ if((di->item.mask & LVIF_TEXT) != 0)
+ {
+ _tcscpy_s(di->item.pszText, di->item.cchTextMax, item->GetText(di->item.iSubItem));
+ }
+
+ if((di->item.mask & LVIF_IMAGE) != 0)
+ {
+ di->item.iImage = item->GetImage();
+ }
+}
+
+void CSortingListControl::OnHdnItemclick(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
+ *pResult = 0;
+ const int col = phdr->iItem;
+
+ if(col == m_sorting.column1)
+ {
+ m_sorting.ascending1 = !m_sorting.ascending1;
+ }
+ else
+ {
+ SetSorting(col, GetAscendingDefault(col));
+ }
+
+ SortItems();
+}
+
+
+void CSortingListControl::OnHdnItemdblclick(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ OnHdnItemclick(pNMHDR, pResult);
+}
+
+void CSortingListControl::OnDestroy()
+{
+ SavePersistentAttributes();
+ CListCtrl::OnDestroy();
+}
diff --git a/windirstat/Controls/sortinglistcontrol.h b/windirstat/Controls/sortinglistcontrol.h
index 8f0acde..3a2c82f 100644
--- a/windirstat/Controls/sortinglistcontrol.h
+++ b/windirstat/Controls/sortinglistcontrol.h
@@ -1,111 +1,111 @@
-// sortinglistcontrol.h - Declaration of CSortingListItem and CSortingListControl
-//
-// WinDirStat - Directory Statistics
-// Copyright (C) 2003-2005 Bernhard Seifert
-// Copyright (C) 2004-2016 WinDirStat team (windirstat.info)
-//
-// 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
-//
-//
-
-#ifndef __WDS_SORTINGLISTCONTROL_H__
-#define __WDS_SORTINGLISTCONTROL_H__
-#pragma once
-
-//
-// SSorting. A sorting specification. We sort by column1, and if two items
-// equal in column1, we sort them by column2.
-//
-struct SSorting
-{
- SSorting() { column1 = column2 = 0; ascending1 = ascending2 = true; }
- int column1;
- bool ascending1;
- int column2;
- bool ascending2;
-};
-
-//
-// CSortingListItem. An item in a CSortingListControl.
-//
-class CSortingListItem
-{
-public:
- virtual CString GetText(int subitem) const;
- virtual int GetImage() const;
- virtual int Compare(const CSortingListItem *other, int subitem) const;
- int CompareS(const CSortingListItem *other, const SSorting& sorting) const;
-};
-
-
-//
-// CSortingListControl. The base class for all our ListControls.
-// The lParams of the items are pointers to CSortingListItems.
-// The items use LPSTR_TEXTCALLBACK and I_IMAGECALLBACK.
-// And the items can compare to one another.
-// CSortingListControl maintains a SSorting and handles clicks
-// on the header items. It also indicates the sorting to the user
-// by adding a "<" or ">" to the header items.
-//
-class CSortingListControl: public CListCtrl
-{
- DECLARE_DYNAMIC(CSortingListControl)
-public:
- // Construction
- CSortingListControl(LPCTSTR name);
- virtual ~CSortingListControl();
-
- // Public methods
- void LoadPersistentAttributes();
-
- void AddExtendedStyle(DWORD exStyle);
- void RemoveExtendedStyle(DWORD exStyle);
-
- const SSorting& GetSorting();
- void GetSorting(int& sortColumn1, bool& ascending1, int& sortColumn2, bool& ascending2);
-
- void SetSorting(const SSorting& sorting);
- void SetSorting(int sortColumn1, bool ascending1, int sortColumn2, bool ascending2);
- void SetSorting(int sortColumn, bool ascending);
-
- void InsertListItem(int i, CSortingListItem *item);
- CSortingListItem *GetSortingListItem(int i);
-
- // Overridables
- virtual void SortItems();
- virtual bool GetAscendingDefault(int column);
- virtual bool HasImages();
-
-# if (_MFC_VER <=0x0800)
- BOOL GetColumnOrderArray(LPINT piArray, INT_PTR iCount = -1);
-# endif
-
-private:
- void SavePersistentAttributes();
- static int CALLBACK _CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
-
- CString m_name; // for persistence
- SSorting m_sorting;
-
- int m_indicatedColumn;
-
- DECLARE_MESSAGE_MAP()
- afx_msg void OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult);
- afx_msg void OnHdnItemclick(NMHDR *pNMHDR, LRESULT *pResult);
- afx_msg void OnHdnItemdblclick(NMHDR *pNMHDR, LRESULT *pResult);
- afx_msg void OnDestroy();
-};
-
-#endif // __WDS_SORTINGLISTCONTROL_H__
+// sortinglistcontrol.h - Declaration of CSortingListItem and CSortingListControl
+//
+// WinDirStat - Directory Statistics
+// Copyright (C) 2003-2005 Bernhard Seifert
+// Copyright (C) 2004-2016 WinDirStat team (windirstat.info)
+//
+// 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
+//
+//
+
+#ifndef __WDS_SORTINGLISTCONTROL_H__
+#define __WDS_SORTINGLISTCONTROL_H__
+#pragma once
+
+//
+// SSorting. A sorting specification. We sort by column1, and if two items
+// equal in column1, we sort them by column2.
+//
+struct SSorting
+{
+ SSorting() { column1 = column2 = 0; ascending1 = ascending2 = true; }
+ int column1;
+ bool ascending1;
+ int column2;
+ bool ascending2;
+};
+
+//
+// CSortingListItem. An item in a CSortingListControl.
+//
+class CSortingListItem
+{
+public:
+ virtual CString GetText(int subitem) const;
+ virtual int GetImage() const;
+ virtual int Compare(const CSortingListItem *other, int subitem) const;
+ int CompareS(const CSortingListItem *other, const SSorting& sorting) const;
+};
+
+
+//
+// CSortingListControl. The base class for all our ListControls.
+// The lParams of the items are pointers to CSortingListItems.
+// The items use LPSTR_TEXTCALLBACK and I_IMAGECALLBACK.
+// And the items can compare to one another.
+// CSortingListControl maintains a SSorting and handles clicks
+// on the header items. It also indicates the sorting to the user
+// by adding a "<" or ">" to the header items.
+//
+class CSortingListControl: public CListCtrl
+{
+ DECLARE_DYNAMIC(CSortingListControl)
+public:
+ // Construction
+ CSortingListControl(LPCTSTR name);
+ virtual ~CSortingListControl();
+
+ // Public methods
+ void LoadPersistentAttributes();
+
+ void AddExtendedStyle(DWORD exStyle);
+ void RemoveExtendedStyle(DWORD exStyle);
+
+ const SSorting& GetSorting();
+ void GetSorting(int& sortColumn1, bool& ascending1, int& sortColumn2, bool& ascending2);
+
+ void SetSorting(const SSorting& sorting);
+ void SetSorting(int sortColumn1, bool ascending1, int sortColumn2, bool ascending2);
+ void SetSorting(int sortColumn, bool ascending);
+
+ void InsertListItem(int i, CSortingListItem *item);
+ CSortingListItem *GetSortingListItem(int i);
+
+ // Overridables
+ virtual void SortItems();
+ virtual bool GetAscendingDefault(int column);
+ virtual bool HasImages();
+
+# if (_MFC_VER <=0x0800)
+ BOOL GetColumnOrderArray(LPINT piArray, INT_PTR iCount = -1);
+# endif
+
+private:
+ void SavePersistentAttributes();
+ static int CALLBACK _CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+ CString m_name; // for persistence
+ SSorting m_sorting;
+
+ int m_indicatedColumn;
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnHdnItemclick(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnHdnItemdblclick(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnDestroy();
+};
+
+#endif // __WDS_SORTINGLISTCONTROL_H__
diff --git a/windirstat/Controls/treemap.cpp b/windirstat/Controls/treemap.cpp
index 8cfce56..0264f5d 100644
--- a/windirstat/Controls/treemap.cpp
+++ b/windirstat/Controls/treemap.cpp
@@ -17,7 +17,7 @@
// 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 "treemap.h"
diff --git a/windirstat/Controls/treemap.h b/windirstat/Controls/treemap.h
index 28bbf3c..99cfe48 100644
--- a/windirstat/Controls/treemap.h
+++ b/windirstat/Controls/treemap.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_TREEMAP_H__
#define __WDS_TREEMAP_H__
diff --git a/windirstat/Controls/typeview.cpp b/windirstat/Controls/typeview.cpp
index e49c359..6618dd4 100644
--- a/windirstat/Controls/typeview.cpp
+++ b/windirstat/Controls/typeview.cpp
@@ -17,7 +17,7 @@
// 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"
diff --git a/windirstat/Controls/typeview.h b/windirstat/Controls/typeview.h
index 3ed260d..a1c215a 100644
--- a/windirstat/Controls/typeview.h
+++ b/windirstat/Controls/typeview.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_TYPEVIEW_H__
#define __WDS_TYPEVIEW_H__
diff --git a/windirstat/Controls/xyslider.cpp b/windirstat/Controls/xyslider.cpp
index 5cc4793..ac405eb 100644
--- a/windirstat/Controls/xyslider.cpp
+++ b/windirstat/Controls/xyslider.cpp
@@ -17,7 +17,7 @@
// 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 "xyslider.h"
diff --git a/windirstat/Controls/xyslider.h b/windirstat/Controls/xyslider.h
index 8fd9247..c048852 100644
--- a/windirstat/Controls/xyslider.h
+++ b/windirstat/Controls/xyslider.h
@@ -17,7 +17,7 @@
// 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
-//
+//
#ifndef __WDS_XYSLIDER_H__
#define __WDS_XYSLIDER_H__