Improve: #48 Support sorting in file management dialog
This commit is contained in:
@@ -281,6 +281,7 @@
|
|||||||
<ClInclude Include="ServicesDlg.h" />
|
<ClInclude Include="ServicesDlg.h" />
|
||||||
<ClInclude Include="SettingDlg.h" />
|
<ClInclude Include="SettingDlg.h" />
|
||||||
<ClInclude Include="ShellDlg.h" />
|
<ClInclude Include="ShellDlg.h" />
|
||||||
|
<ClInclude Include="SortListCtrl.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="SystemDlg.h" />
|
<ClInclude Include="SystemDlg.h" />
|
||||||
<ClInclude Include="sys\CCreateTaskDlg.h" />
|
<ClInclude Include="sys\CCreateTaskDlg.h" />
|
||||||
@@ -334,6 +335,7 @@
|
|||||||
<ClCompile Include="ServicesDlg.cpp" />
|
<ClCompile Include="ServicesDlg.cpp" />
|
||||||
<ClCompile Include="SettingDlg.cpp" />
|
<ClCompile Include="SettingDlg.cpp" />
|
||||||
<ClCompile Include="ShellDlg.cpp" />
|
<ClCompile Include="ShellDlg.cpp" />
|
||||||
|
<ClCompile Include="SortListCtrl.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ BOOL CFileManagerDlg::OnInitDialog()
|
|||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
||||||
m_wndToolBar_Local.AddDropDownButton(this, IDT_LOCAL_VIEW, IDR_LOCAL_VIEW);
|
m_wndToolBar_Local.AddDropDownButton(this, IDT_LOCAL_VIEW, IDR_LOCAL_VIEW);
|
||||||
|
|
||||||
|
|
||||||
if (!m_wndToolBar_Remote.Create(this, WS_CHILD |
|
if (!m_wndToolBar_Remote.Create(this, WS_CHILD |
|
||||||
WS_VISIBLE | CBRS_ALIGN_ANY | CBRS_TOOLTIPS | CBRS_FLYBY, ID_REMOTE_TOOLBAR)
|
WS_VISIBLE | CBRS_ALIGN_ANY | CBRS_TOOLTIPS | CBRS_FLYBY, ID_REMOTE_TOOLBAR)
|
||||||
||!m_wndToolBar_Remote.LoadToolBar(IDR_TOOLBAR2))
|
||!m_wndToolBar_Remote.LoadToolBar(IDR_TOOLBAR2))
|
||||||
@@ -284,6 +283,8 @@ BOOL CFileManagerDlg::OnInitDialog()
|
|||||||
m_ProgressCtrl->SetRange(0, 100); //<2F><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
m_ProgressCtrl->SetRange(0, 100); //<2F><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
||||||
m_ProgressCtrl->SetPos(20); //<2F><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰλ<C7B0><CEBB>
|
m_ProgressCtrl->SetPos(20); //<2F><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰλ<C7B0><CEBB>
|
||||||
|
|
||||||
|
m_list_local.ModifyStyle(FALSE, LVS_REPORT);
|
||||||
|
m_list_remote.ModifyStyle(FALSE, LVS_REPORT);
|
||||||
FixedLocalDriveList();
|
FixedLocalDriveList();
|
||||||
FixedRemoteDriveList();
|
FixedRemoteDriveList();
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
#include "IOCPServer.h"
|
#include "IOCPServer.h"
|
||||||
|
#include "SortListCtrl.h"
|
||||||
|
|
||||||
#define CIOCPServer IOCPServer
|
#define CIOCPServer IOCPServer
|
||||||
|
|
||||||
@@ -120,8 +121,8 @@ public:
|
|||||||
enum { IDD = IDD_FILE };
|
enum { IDD = IDD_FILE };
|
||||||
CComboBox m_Remote_Directory_ComboBox;
|
CComboBox m_Remote_Directory_ComboBox;
|
||||||
CComboBox m_Local_Directory_ComboBox;
|
CComboBox m_Local_Directory_ComboBox;
|
||||||
CListCtrl m_list_remote;
|
CSortListCtrl m_list_remote;
|
||||||
CListCtrl m_list_local;
|
CSortListCtrl m_list_local;
|
||||||
//}}AFX_DATA
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
34
server/2015Remote/SortListCtrl.cpp
Normal file
34
server/2015Remote/SortListCtrl.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "SortListCtrl.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CSortListCtrl, CListCtrl)
|
||||||
|
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, CSortListCtrl::OnLvnColumnclick)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
int CALLBACK ListCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
|
{
|
||||||
|
CSortListCtrl* This = (CSortListCtrl*)lParamSort;
|
||||||
|
CString item1 = This->GetItemText(lParam1, This->m_nSortedCol);
|
||||||
|
CString item2 = This->GetItemText(lParam2, This->m_nSortedCol);
|
||||||
|
int asc = This->m_bAsc ? 1 : -1;
|
||||||
|
int ret = item1.Compare(item2);
|
||||||
|
return ret * asc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSortListCtrl::OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
|
||||||
|
|
||||||
|
if(pNMLV->iSubItem == m_nSortedCol) {
|
||||||
|
m_bAsc = !m_bAsc;
|
||||||
|
} else {
|
||||||
|
m_bAsc = TRUE;
|
||||||
|
m_nSortedCol = pNMLV->iSubItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
SortItemsEx(ListCompare, (DWORD_PTR)this);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
19
server/2015Remote/SortListCtrl.h
Normal file
19
server/2015Remote/SortListCtrl.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "afxcmn.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
class CSortListCtrl : public CListCtrl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSortListCtrl(void) : m_bAsc(false), m_nSortedCol(0){}
|
||||||
|
|
||||||
|
~CSortListCtrl(void){}
|
||||||
|
|
||||||
|
// 是否为升序
|
||||||
|
bool m_bAsc;
|
||||||
|
// 当前排列的序
|
||||||
|
int m_nSortedCol;
|
||||||
|
|
||||||
|
afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user