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:
authorassarbad <none@none>2004-11-12 03:47:42 +0300
committerassarbad <none@none>2004-11-12 03:47:42 +0300
commitff2b3b550cecfaddb550651631e49e1d822254a3 (patch)
treea2c821041b7a0cabe80054196e57c0f2ff68f9de
parenta9dcc8f69e364313444dc87965eba08f613ec786 (diff)
- Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
-rw-r--r--CHANGELOG.txt7
-rw-r--r--TODO.txt10
-rw-r--r--common/version.h5
-rw-r--r--windirstat/SelectDrivesDlg.cpp13
-rw-r--r--windirstat/SelectDrivesDlg.h6
-rw-r--r--windirstat/TreeListControl.cpp12
-rw-r--r--windirstat/TreeListControl.h6
-rw-r--r--windirstat/globalhelpers.cpp21
-rw-r--r--windirstat/item.cpp32
-rw-r--r--windirstat/item.h6
-rw-r--r--windirstat/ownerdrawnlistcontrol.cpp27
-rw-r--r--windirstat/ownerdrawnlistcontrol.h11
-rw-r--r--windirstat/typeview.cpp13
-rw-r--r--windirstat/typeview.h6
14 files changed, 126 insertions, 49 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 99adcac..dfa1d62 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,13 @@ changelog.txt - What has been done to WinDirStat (newest top)
Last modified: $Date$
=============================================================
+2004-11-12 assarbad
+ * Coloring for compressed and encrypted items spans the
+ full row (for list control in another state than "Full
+ row select" the style needs to be decided, yet).
+ * Renamed "Table Of Contents.hhc" to toc.hhc, as Linux
+ CVS cannot handle filenames with blanks in them.
+
2004-11-07 assarbad/bseifert
* French part for setup.rc
* Minor bugfix concerning "follow junction points"
diff --git a/TODO.txt b/TODO.txt
index c8d2d62..fdc27c3 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -12,11 +12,8 @@ Last modified: $Date$
- Date/time formatting more flexible
=> bseifert
-- Coloring for compressed and encrypted items should span the full row
- => assarbad
-
- Add a column for file attributes to the directory list. Same design
- as in Windows Explorer "R A H" etc.
+ as in Windows Explorer "RHSAEC" etc.
=> assarbad
- The "Browse dialog" called from the drive selection dialog should
@@ -32,11 +29,6 @@ Last modified: $Date$
- Unicode file releases
=> bseifert
-
-- Rename "Table Of Contents.hhc" to toc.hhc,
- as Linux cvs cannot handle filenames with blanks in them.
- => bseifert
-
Possible additional useful features:
- Show element size for selected element(s) in status bar
diff --git a/common/version.h b/common/version.h
index 3cf591a..9f6bb06 100644
--- a/common/version.h
+++ b/common/version.h
@@ -43,7 +43,7 @@
// The following line is automatically incremented by linkcounter.exe.
// Format: #define blank LINKCOUNT blanks decimal
// Reset this to zero only when you increment VERNUM_MAJOR/MINOR/REVISION.
-#define LINKCOUNT 146
+#define LINKCOUNT 186
//-------------------------------------------------------------------
// Release candidate number. Relevant for BC_RELEASECANDIDATE.
@@ -99,6 +99,9 @@
// $Log$
+// Revision 1.13 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.12 2004/11/09 23:23:03 bseifert
// Committed new LINKCOUNT to demonstrate merge conflict.
//
diff --git a/windirstat/SelectDrivesDlg.cpp b/windirstat/SelectDrivesDlg.cpp
index 7a5a2b2..13811a8 100644
--- a/windirstat/SelectDrivesDlg.cpp
+++ b/windirstat/SelectDrivesDlg.cpp
@@ -172,11 +172,11 @@ int CDriveItem::GetImage() const
return GetMyImageList()->GetFileImage(m_path);
}
-bool CDriveItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol) const
+bool CDriveItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
if (subitem == COL_NAME)
{
- DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft, textcol);
+ DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft);
return true;
}
else if (subitem == COL_GRAPH)
@@ -246,6 +246,12 @@ CString CDriveItem::GetText(int subitem) const
return s;
}
+COLORREF CDriveItem::GetItemTextColor() const
+{
+ // No coloring in the drive selection box
+ return CLR_NONE;
+}
+
CString CDriveItem::GetPath() const
{
return m_path;
@@ -839,6 +845,9 @@ void CSelectDrivesDlg::OnSysColorChange()
}
// $Log$
+// Revision 1.13 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.12 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/SelectDrivesDlg.h b/windirstat/SelectDrivesDlg.h
index ebd63fe..7d14656 100644
--- a/windirstat/SelectDrivesDlg.h
+++ b/windirstat/SelectDrivesDlg.h
@@ -57,8 +57,9 @@ public:
CString GetDrive() const;
bool IsRemote() const;
bool IsSUBSTed() const;
- virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol = CLR_NONE) const;
+ virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const;
virtual CString GetText(int subitem) const;
+ virtual COLORREF GetItemTextColor() const;
int GetImage() const;
private:
@@ -186,6 +187,9 @@ protected:
};
// $Log$
+// Revision 1.8 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.7 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/TreeListControl.cpp b/windirstat/TreeListControl.cpp
index a8e4c18..d96c7c8 100644
--- a/windirstat/TreeListControl.cpp
+++ b/windirstat/TreeListControl.cpp
@@ -63,7 +63,7 @@ CTreeListItem::~CTreeListItem()
delete m_vi;
}
-bool CTreeListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol) const
+bool CTreeListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
if (subitem != 0)
return false;
@@ -74,7 +74,7 @@ bool CTreeListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int
CRect rcLabel= rc;
rcLabel.left= rcNode.right;
- DrawLabel(GetTreeListControl(), GetMyImageList(), pdc, rcLabel, state, width, focusLeft, false, textcol);
+ DrawLabel(GetTreeListControl(), GetMyImageList(), pdc, rcLabel, state, width, focusLeft, false);
if (width != NULL)
{
@@ -94,6 +94,11 @@ CString CTreeListItem::GetText(int /*subitem*/) const
return _T("test");
}
+COLORREF CTreeListItem::GetItemTextColor() const
+{
+ return CLR_NONE;
+}
+
int CTreeListItem::GetImage() const
{
ASSERT(IsVisible());
@@ -849,6 +854,9 @@ void CTreeListControl::MeasureItem(LPMEASUREITEMSTRUCT mis)
// $Log$
+// Revision 1.7 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.6 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/TreeListControl.h b/windirstat/TreeListControl.h
index e9f8e71..ce6f5e3 100644
--- a/windirstat/TreeListControl.h
+++ b/windirstat/TreeListControl.h
@@ -62,8 +62,9 @@ public:
virtual int CompareSibling(const CTreeListItem *tlib, int subitem) const =0;
- virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol = CLR_NONE) const;
+ virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const;
virtual CString GetText(int subitem) const;
+ virtual COLORREF GetItemTextColor() const;
virtual int GetImage() const;
virtual int Compare(const CSortingListItem *other, int subitem) const;
virtual CTreeListItem *GetTreeListChild(int i) const =0;
@@ -173,6 +174,9 @@ protected:
// $Log$
+// Revision 1.6 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.5 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/globalhelpers.cpp b/windirstat/globalhelpers.cpp
index c15dae9..48c1a7f 100644
--- a/windirstat/globalhelpers.cpp
+++ b/windirstat/globalhelpers.cpp
@@ -594,22 +594,25 @@ ULONGLONG MyGetFileSize(CFileFind* finder)
{
// Try to use the NT-specific API
CGetCompressedFileSizeApi api;
-
+
if (api.IsSupported())
{
- ULARGE_INTEGER ret;
- ret.LowPart = api.GetCompressedFileSize(finder->GetFilePath(), &ret.HighPart);
- TRACE(_T("Compressed size %d.\r\n"), ret.LowPart);
- if ((GetLastError() != NO_ERROR) && (ret.LowPart == INVALID_FILE_SIZE))
- return finder->GetLength();
- else
- return ret.QuadPart;
+ ULARGE_INTEGER ret;
+ ret.LowPart = api.GetCompressedFileSize(finder->GetFilePath(), &ret.HighPart);
+ TRACE(_T("Compressed size %d.\r\n"), ret.LowPart);
+ if ((GetLastError() != NO_ERROR) && (ret.LowPart == INVALID_FILE_SIZE))
+ return finder->GetLength();
+ else
+ return ret.QuadPart;
}
else
- return finder->GetLength();
+ return finder->GetLength();
}
// $Log$
+// Revision 1.13 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.12 2004/11/07 21:10:25 assarbad
// - Corrected IF statement
// - Changed solution file to build consistent "Unicode Debug" configuration for "Unicode Debug" of main project
diff --git a/windirstat/item.cpp b/windirstat/item.cpp
index 86f7b5a..1992bf1 100644
--- a/windirstat/item.cpp
+++ b/windirstat/item.cpp
@@ -74,19 +74,11 @@ CItem::~CItem()
delete m_children[i];
}
-bool CItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol) const
+bool CItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
if (subitem == COL_NAME)
{
- if (textcol == CLR_NONE)
- {
- if (GetApp()->IsCompressed(GetPath()))
- textcol = GetApp()->AltColor();
- else
- if (GetApp()->IsEncrypted(GetPath()))
- textcol = GetApp()->AltEncryptionColor();
- }
- return CTreeListItem::DrawSubitem(subitem, pdc, rc, state, width, focusLeft, textcol);
+ return CTreeListItem::DrawSubitem(subitem, pdc, rc, state, width, focusLeft);
}
if (subitem != COL_SUBTREEPERCENTAGE)
return false;
@@ -191,6 +183,23 @@ CString CItem::GetText(int subitem) const
return s;
}
+COLORREF CItem::GetItemTextColor() const
+{
+ // Get the file/folder attributes
+ DWORD dwAttr = GetFileAttributes(GetPath());
+
+ // Check for compressed flag
+ if (dwAttr & FILE_ATTRIBUTE_COMPRESSED)
+ return GetApp()->AltColor();
+ else
+ // Check for encrypted flag
+ if (dwAttr & FILE_ATTRIBUTE_ENCRYPTED)
+ return GetApp()->AltEncryptionColor();
+ else
+ // The rest is not colored
+ return CLR_NONE;
+}
+
int CItem::CompareSibling(const CTreeListItem *tlib, int subitem) const
{
CItem *other= (CItem *)tlib;
@@ -1515,6 +1524,9 @@ void CItem::DrivePacman()
// $Log$
+// Revision 1.16 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.15 2004/11/10 01:03:00 assarbad
// - Style cleaning of the alternative coloring code for compressed/encrypted items
//
diff --git a/windirstat/item.h b/windirstat/item.h
index 4a2c0b7..09f34e4 100644
--- a/windirstat/item.h
+++ b/windirstat/item.h
@@ -109,8 +109,9 @@ public:
~CItem();
// CTreeListItem Interface
- virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol = CLR_NONE) const;
+ virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const;
virtual CString GetText(int subitem) const;
+ virtual COLORREF GetItemTextColor() const;
virtual int CompareSibling(const CTreeListItem *tlib, int subitem) const;
virtual int GetChildrenCount() const;
virtual CTreeListItem *GetTreeListChild(int i) const;
@@ -225,6 +226,9 @@ private:
// $Log$
+// Revision 1.9 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.8 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/ownerdrawnlistcontrol.cpp b/windirstat/ownerdrawnlistcontrol.cpp
index 7c07c4a..6fa8463 100644
--- a/windirstat/ownerdrawnlistcontrol.cpp
+++ b/windirstat/ownerdrawnlistcontrol.cpp
@@ -50,11 +50,12 @@ COwnerDrawnListItem::~COwnerDrawnListItem()
{
}
-// Draws an item (icon, text and so on) in all parts of the WinDirStat view
-void COwnerDrawnListItem::DrawLabel(COwnerDrawnListControl *list, CImageList *il, CDC *pdc, CRect& rc, UINT state, int *width, int *focusLeft, bool indent, COLORREF textcol) const
+// Draws an item label (icon, text) in all parts of the WinDirStat view
+// the rest is drawn by DrawItem()
+void COwnerDrawnListItem::DrawLabel(COwnerDrawnListControl *list, CImageList *il, CDC *pdc, CRect& rc, UINT state, int *width, int *focusLeft, bool indent) const
{
CRect rcRest= rc;
- // Increase indentation according to tree-level
+ // Increase indentation according to tree-level
if (indent)
rcRest.left+= GENERAL_INDENT;
@@ -102,9 +103,10 @@ void COwnerDrawnListItem::DrawLabel(COwnerDrawnListControl *list, CImageList *il
pdc->FillSolidRect(selection, list->GetHighlightColor());
}
else
- // If given (and item not selected), draw the text in a specific color
- if (textcol != CLR_NONE)
- textColor = textcol;
+ // Use the color designated for this item (if it is != CLR_NONE)
+ // This is currently only for encrypted and compressed items
+ if (GetItemTextColor() != CLR_NONE)
+ textColor = GetItemTextColor();
// Set text color for device context
CSetTextColor stc(pdc, textColor);
if (width == NULL)
@@ -437,7 +439,15 @@ void COwnerDrawnListControl::DrawItem(LPDRAWITEMSTRUCT pdis)
CString s= item->GetText(subitem);
UINT align= IsColumnRightAligned(subitem) ? DT_RIGHT : DT_LEFT;
- CSetTextColor tc(&dcmem, GetItemSelectionTextColor(pdis->itemID));
+ // Get the correct color in case of compressed or encrypted items
+ COLORREF textColor = item->GetItemTextColor();
+ // Except if the item is selected - in this case just use standard colors
+ if ((pdis->itemState & ODS_SELECTED) && (HasFocus() || IsShowSelectionAlways()))
+ textColor = GetItemSelectionTextColor(pdis->itemID);
+
+ // Set the text color
+ CSetTextColor tc(&dcmem, textColor);
+ // Draw the (sub)item text
dcmem.DrawText(s, rcText, DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS | DT_NOPREFIX | align);
// Test: dcmem.FillSolidRect(rcDraw, 0);
}
@@ -705,6 +715,9 @@ void COwnerDrawnListControl::OnHdnItemchanging(NMHDR * /*pNMHDR*/, LRESULT *pRes
// $Log$
+// Revision 1.11 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.10 2004/11/07 23:28:14 assarbad
// - Partial implementation for coloring of compressed/encrypted files
//
diff --git a/windirstat/ownerdrawnlistcontrol.h b/windirstat/ownerdrawnlistcontrol.h
index 11a4695..b7adc56 100644
--- a/windirstat/ownerdrawnlistcontrol.h
+++ b/windirstat/ownerdrawnlistcontrol.h
@@ -42,19 +42,21 @@ public:
virtual ~COwnerDrawnListItem();
// This text is drawn, if DrawSubitem returns false
- virtual CString GetText(int subitem) const =0;
+ virtual CString GetText(int subitem) const = 0;
+ // This color is used for the current item
+ virtual COLORREF GetItemTextColor() const = 0;
// Returnvalue is true, if the item draws itself.
// width != NULL -> only determine width, do not draw.
// If focus rectangle shall not begin leftmost, set *focusLeft
// to the left edge of the desired focus rectangle.
- virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol = CLR_NONE) const =0;
+ virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const =0;
virtual void DrawAdditionalState(CDC * /*pdc*/, const CRect& /*rcLabel*/) const {}
void DrawSelection(COwnerDrawnListControl *list, CDC *pdc, CRect rc, UINT state) const;
protected:
- void DrawLabel(COwnerDrawnListControl *list, CImageList *il, CDC *pdc, CRect& rc, UINT state, int *width, int *focusLeft, bool indent = true, COLORREF textcol = CLR_NONE) const;
+ void DrawLabel(COwnerDrawnListControl *list, CImageList *il, CDC *pdc, CRect& rc, UINT state, int *width, int *focusLeft, bool indent = true) const;
void DrawPercentage(CDC *pdc, CRect rc, double fraction, COLORREF color) const;
};
@@ -126,6 +128,9 @@ protected:
// $Log$
+// Revision 1.8 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.7 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/typeview.cpp b/windirstat/typeview.cpp
index 59cd698..8d4622a 100644
--- a/windirstat/typeview.cpp
+++ b/windirstat/typeview.cpp
@@ -43,11 +43,11 @@ CExtensionListControl::CListItem::CListItem(CExtensionListControl *list, LPCTSTR
m_image= -1;
}
-bool CExtensionListControl::CListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol) const
+bool CExtensionListControl::CListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
if (subitem == COL_EXTENSION)
{
- DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft, textcol);
+ DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft);
}
else if (subitem == COL_COLOR)
{
@@ -108,6 +108,12 @@ CString CExtensionListControl::CListItem::GetText(int subitem) const
}
}
+COLORREF CExtensionListControl::CListItem::GetItemTextColor() const
+{
+ // No coloring for extension list control
+ return CLR_NONE;
+}
+
CString CExtensionListControl::CListItem::GetExtension() const
{
return m_extension;
@@ -535,6 +541,9 @@ void CTypeView::OnSetFocus(CWnd* /*pOldWnd*/)
// $Log$
+// Revision 1.10 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.9 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)
diff --git a/windirstat/typeview.h b/windirstat/typeview.h
index 75034f1..d5414b6 100644
--- a/windirstat/typeview.h
+++ b/windirstat/typeview.h
@@ -50,8 +50,9 @@ protected:
public:
CListItem(CExtensionListControl *list, LPCTSTR extension, SExtensionRecord r);
- virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft, COLORREF textcol = CLR_NONE) const;
+ virtual bool DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const;
virtual CString GetText(int subitem) const;
+ virtual COLORREF GetItemTextColor() const;
CString GetExtension() const;
int GetImage() const;
@@ -148,6 +149,9 @@ inline CDirstatDoc* CTypeView::GetDocument() const
// $Log$
+// Revision 1.8 2004/11/12 00:47:42 assarbad
+// - Fixed the code for coloring of compressed/encrypted items. Now the coloring spans the full row!
+//
// Revision 1.7 2004/11/08 00:46:26 assarbad
// - Added feature to distinguish compressed and encrypted files/folders by color as in the Windows 2000/XP explorer.
// Same rules apply. (Green = encrypted / Blue = compressed)