diff --git a/reactos/subsys/system/explorer/Seashell/.cvsignore b/reactos/subsys/system/explorer/Seashell/.cvsignore deleted file mode 100644 index 161ec452252..00000000000 --- a/reactos/subsys/system/explorer/Seashell/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -Debug -Release -*.coff -*.exe -*.d -*.o -*.sym -*.map -*.aps -*.res -*.opt -*.ncb diff --git a/reactos/subsys/system/explorer/Seashell/FilterDlg.cpp b/reactos/subsys/system/explorer/Seashell/FilterDlg.cpp deleted file mode 100644 index 70ed2b451ab..00000000000 --- a/reactos/subsys/system/explorer/Seashell/FilterDlg.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// FilterDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "SeaShell.h" -#include "FilterDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CFilterDlg dialog - - -CFilterDlg::CFilterDlg(CWnd* pParent /*=NULL*/) - : CDialog(CFilterDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CFilterDlg) - m_FileType = _T(""); - m_Filter = _T(""); - //}}AFX_DATA_INIT -} - - -void CFilterDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CFilterDlg) - DDX_Text(pDX, IDC_EDIT_FILE_TYPE, m_FileType); - DDX_Text(pDX, IDC_EDIT_FILTER, m_Filter); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CFilterDlg, CDialog) - //{{AFX_MSG_MAP(CFilterDlg) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CFilterDlg message handlers - -BOOL CFilterDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // TODO: Add extra initialization here - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/reactos/subsys/system/explorer/Seashell/FilterDlg.h b/reactos/subsys/system/explorer/Seashell/FilterDlg.h deleted file mode 100644 index 33dd924e1bb..00000000000 --- a/reactos/subsys/system/explorer/Seashell/FilterDlg.h +++ /dev/null @@ -1,47 +0,0 @@ -#if !defined(AFX_FILTERDLG_H__72E6269E_A226_4DA4_83CB_28B40EFDB28E__INCLUDED_) -#define AFX_FILTERDLG_H__72E6269E_A226_4DA4_83CB_28B40EFDB28E__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// FilterDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CFilterDlg dialog - -class CFilterDlg : public CDialog -{ -// Construction -public: - CFilterDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CFilterDlg) - enum { IDD = IDD_FILTER }; - CString m_FileType; - CString m_Filter; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CFilterDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CFilterDlg) - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_FILTERDLG_H__72E6269E_A226_4DA4_83CB_28B40EFDB28E__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/LeftView.cpp b/reactos/subsys/system/explorer/Seashell/LeftView.cpp deleted file mode 100644 index d43e631f9b9..00000000000 --- a/reactos/subsys/system/explorer/Seashell/LeftView.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// LeftView.cpp : implementation of the CLeftView class -// - -#include "stdafx.h" -#include "SeaShell.h" - -#include "SeaShellDoc.h" -#include "LeftView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CLeftView - -IMPLEMENT_DYNCREATE(CLeftView, CIEShellTreeView) - -BEGIN_MESSAGE_MAP(CLeftView, CIEShellTreeView) - //{{AFX_MSG_MAP(CLeftView) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP - // Standard printing commands - ON_COMMAND(ID_FILE_PRINT, CIEShellTreeView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_DIRECT, CIEShellTreeView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_PREVIEW, CIEShellTreeView::OnFilePrintPreview) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CLeftView construction/destruction - -CLeftView::CLeftView() -{ - // TODO: add construction code here - -} - -CLeftView::~CLeftView() -{ -} - -BOOL CLeftView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return CIEShellTreeView::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CLeftView drawing - -void CLeftView::OnDraw(CDC* pDC) -{ - CSeaShellDoc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); - - // TODO: add draw code for native data here -} - - -///////////////////////////////////////////////////////////////////////////// -// CLeftView printing - -BOOL CLeftView::OnPreparePrinting(CPrintInfo* pInfo) -{ - // default preparation - return DoPreparePrinting(pInfo); -} - -void CLeftView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) -{ - // TODO: add extra initialization before printing -} - -void CLeftView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) -{ - // TODO: add cleanup after printing -} - -void CLeftView::OnInitialUpdate() -{ - CIEShellTreeView::OnInitialUpdate(); - - // TODO: You may populate your TreeView with items by directly accessing - // its tree control through a call to GetTreeCtrl(). -} - -///////////////////////////////////////////////////////////////////////////// -// CLeftView diagnostics - -#ifdef _DEBUG -void CLeftView::AssertValid() const -{ - CIEShellTreeView::AssertValid(); -} - -void CLeftView::Dump(CDumpContext& dc) const -{ - CIEShellTreeView::Dump(dc); -} - -CSeaShellDoc* CLeftView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSeaShellDoc))); - return (CSeaShellDoc*)m_pDocument; -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CLeftView message handlers diff --git a/reactos/subsys/system/explorer/Seashell/LeftView.h b/reactos/subsys/system/explorer/Seashell/LeftView.h deleted file mode 100644 index 0a6c03fe42c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/LeftView.h +++ /dev/null @@ -1,71 +0,0 @@ -// LeftView.h : interface of the CLeftView class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_LEFTVIEW_H__A7EC0A9D_0FD3_4C0B_8853_C94ACB0213E2__INCLUDED_) -#define AFX_LEFTVIEW_H__A7EC0A9D_0FD3_4C0B_8853_C94ACB0213E2__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -class CSeaShellDoc; - -#include "IEShellTreeView.h" - -class CLeftView : public CIEShellTreeView -{ -protected: // create from serialization only - CLeftView(); - DECLARE_DYNCREATE(CLeftView) - -// Attributes -public: - CSeaShellDoc* GetDocument(); - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CLeftView) - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - protected: - virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); - virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); - virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); - virtual void OnInitialUpdate(); // called first time after construct - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CLeftView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CLeftView) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -#ifndef _DEBUG // debug version in LeftView.cpp -inline CSeaShellDoc* CLeftView::GetDocument() - { return (CSeaShellDoc*)m_pDocument; } -#endif - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_LEFTVIEW_H__A7EC0A9D_0FD3_4C0B_8853_C94ACB0213E2__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.cpp b/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.cpp deleted file mode 100644 index d156cbac1cb..00000000000 --- a/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// MFCExplorerDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "SeaShell.h" -#include "MFCExplorerDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMFCExplorerDlg dialog - - -CMFCExplorerDlg::CMFCExplorerDlg(LPCTSTR pszPath,CWnd* pParent /*=NULL*/) - : CDialog(CMFCExplorerDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CMFCExplorerDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - if (pszPath) - m_sPath = pszPath; -} - - -void CMFCExplorerDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CMFCExplorerDlg) - DDX_Control(pDX, IDC_TREE_SHELL, m_tcShell); - DDX_Control(pDX, IDC_LIST_SHELL, m_lcShell); - DDX_Control(pDX, IDC_COMBO_SHELL, m_cbShell); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CMFCExplorerDlg, CDialog) - //{{AFX_MSG_MAP(CMFCExplorerDlg) - ON_BN_CLICKED(IDC_MFC_BUTT_DETAILS, OnMfcButtDetails) - ON_BN_CLICKED(IDC_MFC_BUTT_LARGE_ICONS, OnMfcButtLargeIcons) - ON_BN_CLICKED(IDC_MFC_BUTT_REPORT, OnMfcButtReport) - ON_BN_CLICKED(IDC_MFC_BUTT_SMALL_ICONS, OnMfcButtSmallIcons) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMFCExplorerDlg message handlers - -void CMFCExplorerDlg::OnMfcButtDetails() -{ - // TODO: Add your control notification handler code here - m_lcShell.SetViewType(LVS_LIST); -} - -void CMFCExplorerDlg::OnMfcButtLargeIcons() -{ - // TODO: Add your control notification handler code here - m_lcShell.SetViewType(LVS_ICON); -} - -void CMFCExplorerDlg::OnMfcButtReport() -{ - // TODO: Add your control notification handler code here - m_lcShell.SetViewType(LVS_REPORT); -} - -void CMFCExplorerDlg::OnMfcButtSmallIcons() -{ - // TODO: Add your control notification handler code here - m_lcShell.SetViewType(LVS_SMALLICON); -} - -BOOL CMFCExplorerDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // TODO: Add extra initialization here - m_cbShell.SetTreeCtrlWnd(m_tcShell.GetSafeHwnd()); - m_tcShell.SetListCtrlWnd(m_lcShell.GetSafeHwnd()); - m_tcShell.SetComboBoxWnd(m_cbShell.GetSafeHwnd()); - m_tcShell.LoadFolderItems(m_sPath); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.h b/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.h deleted file mode 100644 index aaa016a9b13..00000000000 --- a/reactos/subsys/system/explorer/Seashell/MFCExplorerDlg.h +++ /dev/null @@ -1,56 +0,0 @@ -#if !defined(AFX_MFCEXPLORERDLG_H__CDBB7A42_DEE1_4AFC_A7A3_13FE102A30EE__INCLUDED_) -#define AFX_MFCEXPLORERDLG_H__CDBB7A42_DEE1_4AFC_A7A3_13FE102A30EE__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// MFCExplorerDlg.h : header file -// -#include "IEShellTreeCtrl.h" -#include "IEShellListCtrl.h" -#include "IEShellComboBox.h" -///////////////////////////////////////////////////////////////////////////// -// CMFCExplorerDlg dialog - -class CMFCExplorerDlg : public CDialog -{ -// Construction -public: - CMFCExplorerDlg(LPCTSTR pszPath=NULL,CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CMFCExplorerDlg) - enum { IDD = IDD_MFC_EXPLORER }; - CIEShellTreeCtrl m_tcShell; - CIEShellListCtrl m_lcShell; - CIEShellComboBox m_cbShell; - //}}AFX_DATA - - void SetPath(LPCTSTR pszPath) { m_sPath = pszPath; } -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMFCExplorerDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CMFCExplorerDlg) - afx_msg void OnMfcButtDetails(); - afx_msg void OnMfcButtLargeIcons(); - afx_msg void OnMfcButtReport(); - afx_msg void OnMfcButtSmallIcons(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - CString m_sPath; -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MFCEXPLORERDLG_H__CDBB7A42_DEE1_4AFC_A7A3_13FE102A30EE__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/MainFrm.cpp b/reactos/subsys/system/explorer/Seashell/MainFrm.cpp deleted file mode 100644 index 93e6acd289c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/MainFrm.cpp +++ /dev/null @@ -1,262 +0,0 @@ -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "SeaShell.h" -#include "MFCExplorerDlg.h" -#include "FilterDlg.h" -#include "ShellTreeDlg.h" -#include "MainFrm.h" -#include "LeftView.h" -#include "SeaShellView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNCREATE(CMainFrame, CUIExplorerFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CUIExplorerFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) - ON_WM_CREATE() - ON_COMMAND(ID_VIEW_EXPLORERDIALOG, OnViewExplorerdialog) - ON_COMMAND(ID_VIEW_FILEFILTER, OnViewFilefilter) - ON_COMMAND(ID_VIEW_TREEDIALOG, OnViewTreedialog) - //}}AFX_MSG_MAP - ON_UPDATE_COMMAND_UI_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, OnUpdateViewStyles) - ON_COMMAND_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, OnViewStyle) - ON_MESSAGE(WM_SETTINGCHANGE,OnSettingChange) -END_MESSAGE_MAP() - -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() -{ - // TODO: add member initialization code here - m_IDToolbar = IDR_MAINFRAME; - SetExplorerView(RUNTIME_CLASS(CSeaShellView)); -} - -CMainFrame::~CMainFrame() -{ -} - -void CMainFrame::CreateCoolBar() -{ - if (m_pwndCoolBar == NULL) - m_pwndCoolBar = new CWebBrowserCoolBar; - // hook up the frame window for notification messages - ((CWebBrowserCoolBar*)m_pwndCoolBar)->GetComboBox().SetTreeCtrlWnd(GetSafeHwnd()); -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CUIExplorerFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - if( !CUIExplorerFrameWnd::PreCreateWindow(cs) ) - return FALSE; - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - CUIExplorerFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - CUIExplorerFrameWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers - -CSeaShellView* CMainFrame::GetRightPane() -{ - CWnd* pWnd = GetSplitterWnd().GetPane(0, 1); - CSeaShellView* pView = DYNAMIC_DOWNCAST(CSeaShellView, pWnd); - return pView; -} - -void CMainFrame::OnUpdateViewStyles(CCmdUI* pCmdUI) -{ - // TODO: customize or extend this code to handle choices on the - // View menu. - - CSeaShellView* pView = GetRightPane(); - - // if the right-hand pane hasn't been created or isn't a view, - // disable commands in our range - - if (pView == NULL) - pCmdUI->Enable(FALSE); - else - { - DWORD dwStyle = pView->GetListCtrl().GetViewType(); - - // if the command is ID_VIEW_LINEUP, only enable command - // when we're in LVS_ICON or LVS_SMALLICON mode - - if (pCmdUI->m_nID == ID_VIEW_LINEUP) - { - if (dwStyle == LVS_ICON || dwStyle == LVS_SMALLICON) - pCmdUI->Enable(); - else - pCmdUI->Enable(FALSE); - } - else - { - // otherwise, use dots to reflect the style of the view - pCmdUI->Enable(); - BOOL bChecked = FALSE; - - switch (pCmdUI->m_nID) - { - case ID_VIEW_DETAILS: - bChecked = (dwStyle == LVS_REPORT); - break; - - case ID_VIEW_SMALLICON: - bChecked = (dwStyle == LVS_SMALLICON); - break; - - case ID_VIEW_LARGEICON: - bChecked = (dwStyle == LVS_ICON); - break; - - case ID_VIEW_LIST: - bChecked = (dwStyle == LVS_LIST); - break; - - default: - bChecked = FALSE; - break; - } - - pCmdUI->SetRadio(bChecked ? 1 : 0); - } - } -} - - -void CMainFrame::OnViewStyle(UINT nCommandID) -{ - // TODO: customize or extend this code to handle choices on the - // View menu. - CSeaShellView* pView = (CSeaShellView*)theApp.GetView(RUNTIME_CLASS(CSeaShellView));; - - // if the right-hand pane has been created and is a CSeaShellView, - // process the menu commands... - if (pView != NULL) - { - DWORD dwStyle = -1; - - switch (nCommandID) - { - case ID_VIEW_LINEUP: - { - // ask the list control to snap to grid - CListCtrl& refListCtrl = pView->GetListCtrl(); - refListCtrl.Arrange(LVA_SNAPTOGRID); - } - break; - - // other commands change the style on the list control - case ID_VIEW_DETAILS: - dwStyle = LVS_REPORT; - break; - - case ID_VIEW_SMALLICON: - dwStyle = LVS_SMALLICON; - break; - - case ID_VIEW_LARGEICON: - dwStyle = LVS_ICON; - break; - - case ID_VIEW_LIST: - dwStyle = LVS_LIST; - break; - } - - // change the style; window will repaint automatically - if (dwStyle != -1) - pView->GetListCtrl().SetViewType(dwStyle); - } -} - -LRESULT CMainFrame::OnSettingChange(WPARAM wParam, LPARAM lParam) -{ - TRACE(_T("OnSettingChange\n")); - CSeaShellView *pListView = (CSeaShellView*)theApp.GetView(RUNTIME_CLASS(CSeaShellView)); - if (pListView) - pListView->GetListCtrl().SendMessage(WM_SETTINGCHANGE,wParam,lParam); - return 1; -} - -void CMainFrame::OnViewExplorerdialog() -{ - // TODO: Add your command handler code here - CLeftView *pTreeView = (CLeftView*)theApp.GetView(RUNTIME_CLASS(CLeftView)); - CMFCExplorerDlg dlg; - if (pTreeView && pTreeView->GetShellTreeCtrl().GetSelectedItem() != pTreeView->GetShellTreeCtrl().GetRootItem()) - { - dlg.SetPath(pTreeView->GetShellTreeCtrl().GetSelectedPath()); - } - dlg.DoModal(); -} - -void CMainFrame::OnViewFilefilter() -{ - // TODO: Add your command handler code here - CSeaShellView *pListView = (CSeaShellView*)theApp.GetView(RUNTIME_CLASS(CSeaShellView)); - if (pListView) - { - CFilterDlg dlg; - dlg.m_Filter = pListView->GetShellListCtrl().GetFileFilter(); - if (!pListView->GetShellListCtrl().GetExcludedFileTypes().IsEmpty()) - dlg.m_FileType = pListView->GetShellListCtrl().GetExcludedFileTypes().GetHead(); - if (dlg.DoModal() == IDOK) - { - if (!dlg.m_FileType.IsEmpty()) - pListView->GetShellListCtrl().ExcludeFileType(dlg.m_FileType); - pListView->GetShellListCtrl().SetFileFilter(dlg.m_Filter); - pListView->GetShellListCtrl().Refresh(); - } - } -} - -void CMainFrame::OnViewTreedialog() -{ - // TODO: Add your command handler code here - CShellTreeDlg dlg; - dlg.DoModal(); -} diff --git a/reactos/subsys/system/explorer/Seashell/MainFrm.h b/reactos/subsys/system/explorer/Seashell/MainFrm.h deleted file mode 100644 index 4df50a30f89..00000000000 --- a/reactos/subsys/system/explorer/Seashell/MainFrm.h +++ /dev/null @@ -1,70 +0,0 @@ -// MainFrm.h : interface of the CMainFrame class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_MAINFRM_H__476445A6_F5F7_4383_B534_EBAB2D5728B1__INCLUDED_) -#define AFX_MAINFRM_H__476445A6_F5F7_4383_B534_EBAB2D5728B1__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -class CSeaShellView; - -#include "UIExplorerFrameWnd.h" - -class CMainFrame : public CUIExplorerFrameWnd -{ - -protected: // create from serialization only - CMainFrame(); - DECLARE_DYNCREATE(CMainFrame) - -// Attributes -protected: -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainFrame) - public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual void CreateCoolBar(); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainFrame(); - CSeaShellView* GetRightPane(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; - -// Generated message map functions -protected: - //{{AFX_MSG(CMainFrame) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg LRESULT OnSettingChange(WPARAM wParam,LPARAM lParam); - afx_msg void OnViewExplorerdialog(); - afx_msg void OnViewFilefilter(); - afx_msg void OnViewTreedialog(); - //}}AFX_MSG - afx_msg void OnUpdateViewStyles(CCmdUI* pCmdUI); - afx_msg void OnViewStyle(UINT nCommandID); - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINFRM_H__476445A6_F5F7_4383_B534_EBAB2D5728B1__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/Resource.h b/reactos/subsys/system/explorer/Seashell/Resource.h deleted file mode 100644 index 2a4417e44ff..00000000000 --- a/reactos/subsys/system/explorer/Seashell/Resource.h +++ /dev/null @@ -1,67 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by SeaShell.rc -// -#define IDD_ABOUTBOX 100 -#define ID_VIEW_ARRANGE 127 -#define IDR_MAINFRAME 128 -#define IDR_SEASHETYPE 129 -#define IDD_SHELL_TREE 130 -#define IDD_MFC_EXPLORER 132 -#define IDD_FILTER 133 -#define IDR_POPUPMENU_LISTCTRL 204 -#define IDR_POPUPMENU_HEADERCTRL 205 -#define IDR_POPUPMENU_DRAGDROP 208 -#define IDR_POPUPMENU_TREE_FOLDER 209 -#define IDB_COLDTOOLBAR 210 -#define IDB_HOTTOOLBAR 211 -#define IDC_SHELL_TREE 1000 -#define IDC_ST_PATH 1001 -#define IDC_ST_HELP 1002 -#define IDC_LIST_TEST 1003 -#define IDC_BUTT_PROGRESS 1004 -#define IDC_BUTT_NORMAL 1005 -#define IDC_BUTT_DOWNLOAD 1006 -#define IDC_TREE_SHELL 1012 -#define IDC_LIST_SHELL 1013 -#define IDC_MFC_BUTT_REPORT 1014 -#define IDC_MFC_BUTT_SMALL_ICONS 1015 -#define IDC_MFC_BUTT_LARGE_ICONS 1016 -#define IDC_MFC_BUTT_DETAILS 1017 -#define IDC_COMBO_SHELL 1018 -#define IDC_EDIT_FILTER 1020 -#define IDC_EDIT_FILE_TYPE 1021 -#define ID_VIEW_EXPLORERDIALOG 32771 -#define ID_VIEW_FILEFILTER 32772 -#define ID_VIEW_TREEDIALOG 32773 -#define ID_POPUP_DD_MOVE 42768 -#define ID_POPUP_DD_COPY 42769 -#define ID_POPUP_DD_CANCEL 42770 -#define ID_UI_VIEW_LARGE_ICONS 42771 -#define ID_UI_VIEW_SMALL_ICONS 42772 -#define ID_UI_VIEW_DETAILS 42773 -#define ID_UI_VIEW_LIST 42774 -#define ID_UI_VIEW_GRIDLINES 42775 -#define ID_UI_VIEW_COLUMN_ORDERING 42778 -#define ID_UI_VIEW_FULL_ROW_SELECTION 42779 -#define ID_UI_VIEW_TRACK_SELECT 42780 -#define ID_UI_VIEW_COLUMN_SIZING 42781 -#define ID_HEADER_REMOVE_COL 42782 -#define ID_HEADER_EDIT_TEXT 42783 -#define ID_HEADER_RESET 42784 -#define ID_UI_VIEW_EDIT_COLUMN 42786 -#define ID_POPUP_TF_NEW_FOLDER 42801 -#define ID_POPUP_TF_DELETE_FOLDER 42802 -#define ID_POPUP_TF_REFRESH 42803 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 131 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShell.cpp b/reactos/subsys/system/explorer/Seashell/SeaShell.cpp deleted file mode 100644 index a563a6a5a76..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShell.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// SeaShell.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "SeaShell.h" - -#include "MainFrm.h" -#include "SeaShellDoc.h" -#include "LeftView.h" -#include "UICtrl.h" -#include "TextProgressCtrl.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#define WM_APP_UPDATE_PROGRESS WM_APP+1 -#define WM_APP_FINISH_PROGRESS WM_APP+2 -///////////////////////////////////////////////////////////////////////////// -// CSeaShellApp - -BEGIN_MESSAGE_MAP(CSeaShellApp, CUIApp) - //{{AFX_MSG_MAP(CSeaShellApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CUIApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CUIApp::OnFileOpen) - // Standard print setup command - ON_COMMAND(ID_FILE_PRINT_SETUP, CUIApp::OnFilePrintSetup) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellApp construction - -CSeaShellApp::CSeaShellApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CSeaShellApp object - -CSeaShellApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellApp initialization - -BOOL CSeaShellApp::InitInstance() -{ - AfxEnableControlContainer(); - - if (!AfxOleInit()) - { - AfxMessageBox(_T("COM Failed to initialize")); - return FALSE; - } - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - // Change the registry key under which our settings are stored. - // TODO: You should modify this string to be something appropriate - // such as the name of your company or organization. - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - - LoadStdProfileSettings(); // Load standard INI file options (including MRU) - - // Register the application's document templates. Document templates - // serve as the connection between documents, frame windows and views. - - CSingleDocTemplate* pDocTemplate; - pDocTemplate = new CSingleDocTemplate( - IDR_MAINFRAME, - RUNTIME_CLASS(CSeaShellDoc), - RUNTIME_CLASS(CMainFrame), // main SDI frame window - RUNTIME_CLASS(CLeftView)); - AddDocTemplate(pDocTemplate); - - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - - // Dispatch commands specified on the command line - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - - // The one and only window has been initialized, so show and update it. - m_pMainWnd->ShowWindow(SW_SHOW); - m_pMainWnd->UpdateWindow(); - - return TRUE; -} - -typedef struct THREADINFO -{ - int nRow; - HWND hWnd; - HANDLE hEvent; -} *LPTHREADINFO; -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - - CUIODListCtrl m_lcTest; - //}}AFX_DATA - enum Cols { COL_FILE_SIZE, COL_STATUS, COL_PROGRESS }; - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - CEvent m_Event; - CWinThread *m_pThread; - static UINT ThreadFunc(LPVOID pParam); -// Implementation -protected: - virtual BOOL OnInitDialog(); - void PumpMessages(); - //{{AFX_MSG(CAboutDlg) - afx_msg void OnButtProgress(); - afx_msg void OnButtNormal(); - afx_msg void OnButtDownload(); - afx_msg LRESULT OnAppUpdateProgress(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppFinishProgress(WPARAM wParam, LPARAM lParam ); - afx_msg void OnDestroy(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT - m_pThread = NULL; -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - DDX_Control(pDX, IDC_LIST_TEST, m_lcTest); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) - //{{AFX_MSG_MAP(CAboutDlg) - ON_BN_CLICKED(IDC_BUTT_PROGRESS, OnButtProgress) - ON_BN_CLICKED(IDC_BUTT_NORMAL, OnButtNormal) - ON_BN_CLICKED(IDC_BUTT_DOWNLOAD, OnButtDownload) - ON_MESSAGE(WM_APP_UPDATE_PROGRESS,OnAppUpdateProgress) - ON_MESSAGE(WM_APP_FINISH_PROGRESS,OnAppFinishProgress) - ON_WM_DESTROY() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -// App command to run the dialog -void CSeaShellApp::OnAppAbout() -{ - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellApp message handlers - - -void CAboutDlg::OnButtProgress() -{ - // TODO: Add your control notification handler code here - int nRow = m_lcTest.AddTextItem(); - m_lcTest.AddString(nRow,COL_FILE_SIZE,nRow+1); - m_lcTest.AddString(nRow,COL_STATUS,_T("Downloading")); - CTextProgressCtrl *pPB = m_lcTest.AddProgressBar(nRow,COL_PROGRESS,0,100); - if (pPB) - { - pPB->SetShowText(true); - pPB->SetPos(0); - pPB->SetRange(0,100); - for (int i = 0; i < (nRow+1); i++) - { - pPB->StepIt(); - } - } -} - -void CAboutDlg::PumpMessages() -{ - // Must call Create() before using the dialog - ASSERT(m_hWnd!=NULL); - - MSG msg; - // Handle dialog messages - while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - if(!IsDialogMessage(&msg)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } -} - -BOOL CAboutDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // TODO: Add extra initialization here - m_lcTest.InitListCtrl(_T("File Size|Status|Progress")); - m_lcTest.SetColumnFormat(COL_FILE_SIZE,LVCFMT_CENTER); - m_lcTest.SetColumnFormat(COL_STATUS,LVCFMT_CENTER); - m_lcTest.AddIcon(IDR_MAINFRAME); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CAboutDlg::OnButtNormal() -{ - // TODO: Add your control notification handler code here - int nRow = m_lcTest.AddTextItem(); - m_lcTest.AddString(nRow,COL_FILE_SIZE,nRow+1); - m_lcTest.SetTextColor(nRow,COL_FILE_SIZE,RGB(0,0,128)); - m_lcTest.AddString(nRow,COL_STATUS,_T("Normal")); - m_lcTest.SetTextColor(nRow,COL_STATUS,RGB(70,38,10)); - m_lcTest.AddString(nRow,COL_PROGRESS,_T("Progress")); - if (nRow % 2) - { - m_lcTest.SetBkColor(nRow,-1,RGB(20,100,20)); - m_lcTest.SetRowBold(nRow,-1); - } -} - -void CAboutDlg::OnButtDownload() -{ - // TODO: Add your control notification handler code here - if (m_lcTest.GetCurSel() == -1) - return; - CTextProgressCtrl *pCtrl = m_lcTest.AddProgressBar(m_lcTest.GetCurSel(),COL_PROGRESS,0,120000); - pCtrl->SetBgColor(CLR_DEFAULT,RGB(255,255,255)); - pCtrl->SetBarColor(CLR_DEFAULT,::GetSysColor(COLOR_MENU)); - LPTHREADINFO pth = new THREADINFO; - pth->nRow = m_lcTest.GetCurSel(); - pth->hWnd = this->GetSafeHwnd(); - pth->hEvent = m_Event.m_hObject; - m_pThread = AfxBeginThread(CAboutDlg::ThreadFunc,(LPVOID)pth); - m_pThread->m_bAutoDelete = FALSE; -} - -UINT CAboutDlg::ThreadFunc(LPVOID pParam) -{ - LPTHREADINFO pth = (LPTHREADINFO)pParam; - ASSERT(pth); - DWORD dw; - for(int i=1;i < 120;i++) - { - dw = WaitForMultipleObjects(1,&pth->hEvent,TRUE,1000); - if ((dw - WAIT_OBJECT_0) == 0) - break; - ::PostMessage(pth->hWnd,WM_APP_UPDATE_PROGRESS,pth->nRow,i*1000); - } - if (::IsWindow(pth->hWnd)) - ::PostMessage(pth->hWnd,WM_APP_FINISH_PROGRESS,pth->nRow,0); - delete pth; - TRACE0("Download thread is exiting\n"); - return 1; -} - - -LRESULT CAboutDlg::OnAppUpdateProgress(WPARAM wParam, LPARAM lParam) -{ - m_lcTest.AddString(wParam,COL_FILE_SIZE,lParam); - m_lcTest.UpdateProgressBar(wParam,COL_PROGRESS,lParam); - return 1; -} - -LRESULT CAboutDlg::OnAppFinishProgress(WPARAM wParam, LPARAM lParam) -{ - delete m_pThread; - m_pThread = NULL; - m_lcTest.DeleteProgressBar(wParam,COL_PROGRESS); - return 1; -} - -void CAboutDlg::OnDestroy() -{ - if (m_pThread) - { - m_Event.SetEvent(); - ::WaitForSingleObject(m_pThread->m_hThread, INFINITE); - delete m_pThread; - m_pThread = NULL; - } - CDialog::OnDestroy(); - // TODO: Add your message handler code here -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShell.dsp b/reactos/subsys/system/explorer/Seashell/SeaShell.dsp deleted file mode 100644 index e881568e800..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShell.dsp +++ /dev/null @@ -1,559 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SeaShell" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SeaShell - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SeaShell.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SeaShell.mak" CFG="SeaShell - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SeaShell - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SeaShell - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SeaShell - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "SeaShellExt\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "SeaShell - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "SeaShellExt\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SeaShell - Win32 Release" -# Name "SeaShell - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\FilterDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\LeftView.cpp -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.cpp -# End Source File -# Begin Source File - -SOURCE=.\MFCExplorerDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShell.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShell.rc -# End Source File -# Begin Source File - -SOURCE=.\SeaShellDoc.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellView.cpp -# End Source File -# Begin Source File - -SOURCE=.\ShellTreeDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\SeaShellExt\Include\cbformats.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\Dirwalk.h -# End Source File -# Begin Source File - -SOURCE=.\FilterDlg.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\HtmlCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEFolderTreeCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellComboBox.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellDragDrop.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellListCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellListView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellTreeCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\IEShellTreeView.h -# End Source File -# Begin Source File - -SOURCE=.\LeftView.h -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\PIDL.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\Refresh.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShell.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellDoc.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\ShellContextMenu.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\ShellDetails.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\ShellPidl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\ShellSettings.h -# End Source File -# Begin Source File - -SOURCE=.\ShellTreeDlg.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\TextParse.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIApp.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UICONT.H -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UICoolBar.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UICoolMenu.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\Uictrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIDATA.H -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\uidragdropctrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIDragDropTree.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\uidragimage.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\uidroptarget.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIExplorerFrameWnd.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIFixTB.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIFlatBar.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIFolderRefresh.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIFrameWnd.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIHtmlView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIImageDropTarget.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIListView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIMenuBar.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIMessages.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UIStatusBar.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UISubclass.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UITabSplitterWnd.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UITabView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UITreeCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\UITreeView.h -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Include\WindowPlacement.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\coldtool.bmp -# End Source File -# Begin Source File - -SOURCE=.\res\hottoolb.bmp -# End Source File -# Begin Source File - -SOURCE=.\res\SeaShell.ico -# End Source File -# Begin Source File - -SOURCE=.\res\SeaShell.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\SeaShellDoc.ico -# End Source File -# Begin Source File - -SOURCE=.\res\Toolbar.bmp -# End Source File -# End Group -# Begin Group "SeaShellExt" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\SeaShellExt\cbformats.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\HtmlCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEFolderTreeCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellComboBox.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellDragDrop.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellListCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellListView.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellTreeCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\IEShellTreeView.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\InPlaceEdit.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\LocaleInfo.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\PIDL.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\ShellContextMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\ShellDetails.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\ShellPidl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\ShellSettings.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\TextParse.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\TextProgressCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIApp.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UICONT.CPP -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UICoolBar.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UICoolMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\Uictrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIDATA.CPP -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\uidragdropctrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIDragDropTree.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\uidragimage.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\uidroptarget.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIExplorerFrameWnd.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIFixTB.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIFlatBar.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIFrameWnd.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIHtmlView.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIImageDropTarget.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIListView.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIMenuBar.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIModulVer.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UIStatusBar.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UISubclass.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UITabSplitterWnd.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UITreeCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\UITreeView.cpp -# End Source File -# Begin Source File - -SOURCE=.\SeaShellExt\WindowPlacement.cpp -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/reactos/subsys/system/explorer/Seashell/SeaShell.dsw b/reactos/subsys/system/explorer/Seashell/SeaShell.dsw deleted file mode 100644 index 8a8e37d4baf..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShell.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SeaShell"=".\SeaShell.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShell.h b/reactos/subsys/system/explorer/Seashell/SeaShell.h deleted file mode 100644 index 8e1202d1b01..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShell.h +++ /dev/null @@ -1,50 +0,0 @@ -// SeaShell.h : main header file for the SEASHELL application -// - -#if !defined(AFX_SEASHELL_H__6922416D_59C7_4311_9767_0AF1B6CD7C95__INCLUDED_) -#define AFX_SEASHELL_H__6922416D_59C7_4311_9767_0AF1B6CD7C95__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellApp: -// See SeaShell.cpp for the implementation of this class -// -#include "UIApp.h" - -class CSeaShellApp : public CUIApp -{ -public: - CSeaShellApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CSeaShellApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - //{{AFX_MSG(CSeaShellApp) - afx_msg void OnAppAbout(); - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -extern CSeaShellApp theApp; -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SEASHELL_H__6922416D_59C7_4311_9767_0AF1B6CD7C95__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShell.rc b/reactos/subsys/system/explorer/Seashell/SeaShell.rc deleted file mode 100644 index 658bd355bd1..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShell.rc +++ /dev/null @@ -1,553 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\SeaShell.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#include ""afxprint.rc"" // printing/print preview resources\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\SeaShell.ico" -IDR_SEASHETYPE ICON DISCARDABLE "res\\SeaShellDoc.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" -IDB_COLDTOOLBAR BITMAP FIXED IMPURE "res\\coldtool.bmp" -IDB_HOTTOOLBAR BITMAP FIXED IMPURE "res\\hottoolb.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Toolbar -// - -IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15 -BEGIN - BUTTON ID_FILE_NEW - BUTTON ID_FILE_OPEN - BUTTON ID_FILE_SAVE - SEPARATOR - BUTTON ID_EDIT_CUT - BUTTON ID_EDIT_COPY - BUTTON ID_EDIT_PASTE - SEPARATOR - BUTTON ID_FILE_PRINT - SEPARATOR - BUTTON ID_VIEW_LARGEICON - BUTTON ID_VIEW_SMALLICON - BUTTON ID_VIEW_LIST - BUTTON ID_VIEW_DETAILS - SEPARATOR - BUTTON ID_APP_ABOUT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New\tCtrl+N", ID_FILE_NEW - MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN - MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE - MENUITEM "Save &As...", ID_FILE_SAVE_AS - MENUITEM SEPARATOR - MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT - MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW - MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP - MENUITEM SEPARATOR - MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&Edit" - BEGIN - MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO - MENUITEM SEPARATOR - MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE - END - POPUP "&View" - BEGIN - MENUITEM "&Toolbar", ID_VIEW_TOOLBAR - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - MENUITEM SEPARATOR - MENUITEM "&Explorer Dialog", ID_VIEW_EXPLORERDIALOG - MENUITEM "&Tree Dialog", ID_VIEW_TREEDIALOG - MENUITEM "&File Filter", ID_VIEW_FILEFILTER - END - POPUP "&Help" - BEGIN - MENUITEM "&About SeaShell...", ID_APP_ABOUT - END -END - -IDR_POPUPMENU_LISTCTRL MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - POPUP "&View" - BEGIN - MENUITEM "&List", ID_UI_VIEW_LIST - MENUITEM "&Details", ID_UI_VIEW_DETAILS - MENUITEM "&Small Icons", ID_UI_VIEW_SMALL_ICONS - MENUITEM "&Large Icons", ID_UI_VIEW_LARGE_ICONS - END - MENUITEM SEPARATOR - MENUITEM "&Grid Lines", ID_UI_VIEW_GRIDLINES - MENUITEM "&Hot Tracking", ID_UI_VIEW_TRACK_SELECT - MENUITEM SEPARATOR - MENUITEM "&Full Row Selection", ID_UI_VIEW_FULL_ROW_SELECTION - - MENUITEM "&Column Sizing", ID_UI_VIEW_COLUMN_SIZING - MENUITEM "Column &Ordering", ID_UI_VIEW_COLUMN_ORDERING - MENUITEM SEPARATOR - MENUITEM "&Rename", ID_UI_VIEW_EDIT_COLUMN - END -END - -IDR_POPUPMENU_DRAGDROP MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "&Move Here", ID_POPUP_DD_MOVE - MENUITEM "&Copy Here", ID_POPUP_DD_COPY - MENUITEM SEPARATOR - MENUITEM "Cancel", ID_POPUP_DD_CANCEL - END -END - -IDR_POPUPMENU_HEADERCTRL MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "&Delete", ID_HEADER_REMOVE_COL - MENUITEM SEPARATOR - MENUITEM "&Rename", ID_HEADER_EDIT_TEXT - MENUITEM "Reset &Header", ID_HEADER_RESET - END -END - -IDR_POPUPMENU_TREE_FOLDER MENU DISCARDABLE -BEGIN - POPUP "" - BEGIN - MENUITEM "&New Folder", ID_POPUP_TF_NEW_FOLDER - MENUITEM "&Delete Folder", ID_POPUP_TF_DELETE_FOLDER - MENUITEM SEPARATOR - MENUITEM "&Refresh", ID_POPUP_TF_REFRESH - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE -BEGIN - "N", ID_FILE_NEW, VIRTKEY, CONTROL - "O", ID_FILE_OPEN, VIRTKEY, CONTROL - "S", ID_FILE_SAVE, VIRTKEY, CONTROL - "P", ID_FILE_PRINT, VIRTKEY, CONTROL - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL - "X", ID_EDIT_CUT, VIRTKEY, CONTROL - "C", ID_EDIT_COPY, VIRTKEY, CONTROL - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL - VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT - VK_F6, ID_NEXT_PANE, VIRTKEY - VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 390, 266 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About SeaShell" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20 - LTEXT "SeaShell Version 1.0",IDC_STATIC,40,10,119,8, - SS_NOPREFIX - LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,333,7,50,14,WS_GROUP - CONTROL "List1",IDC_LIST_TEST,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS | - WS_BORDER | WS_TABSTOP,7,67,376,170 - PUSHBUTTON "&Progress",IDC_BUTT_PROGRESS,7,245,50,14 - PUSHBUTTON "N&ormal",IDC_BUTT_NORMAL,60,245,50,14 - PUSHBUTTON "&Download",IDC_BUTT_DOWNLOAD,114,245,50,14 -END - -IDD_MFC_EXPLORER DIALOG DISCARDABLE 0, 0, 342, 223 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "MFC Explorer" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,7,202,50,14 - PUSHBUTTON "Cancel",IDCANCEL,61,202,50,14 - CONTROL "Tree1",IDC_TREE_SHELL,"SysTreeView32",WS_BORDER | - WS_TABSTOP,7,7,127,189 - CONTROL "List1",IDC_LIST_SHELL,"SysListView32",LVS_REPORT | - WS_BORDER | WS_TABSTOP,139,7,196,167 - CONTROL "",IDC_COMBO_SHELL,"ComboBoxEx32",CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP,138,202,197,132 - PUSHBUTTON "R",IDC_MFC_BUTT_REPORT,141,180,21,14 - PUSHBUTTON "S",IDC_MFC_BUTT_SMALL_ICONS,168,180,20,14 - PUSHBUTTON "L",IDC_MFC_BUTT_LARGE_ICONS,193,180,20,14 - PUSHBUTTON "D",IDC_MFC_BUTT_DETAILS,219,181,21,14 -END - -IDD_FILTER DIALOG DISCARDABLE 0, 0, 186, 85 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Enter File Filter" -FONT 8, "MS Sans Serif" -BEGIN - EDITTEXT IDC_EDIT_FILTER,7,18,172,14,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_FILE_TYPE,7,46,172,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,7,64,50,14 - PUSHBUTTON "Cancel",IDCANCEL,64,64,50,14 - LTEXT "Filter:",IDC_STATIC,7,7,80,8 - LTEXT "File Type:",IDC_STATIC,7,36,34,8 -END - -IDD_SHELL_TREE DIALOG DISCARDABLE 0, 0, 306, 218 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Shell Tree" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Close",IDOK,117,197,50,14 - CONTROL "Tree1",IDC_SHELL_TREE,"SysTreeView32",WS_BORDER | - WS_TABSTOP,7,7,292,139 - LTEXT "Static",IDC_ST_HELP,49,171,247,21 - LTEXT "Static",IDC_ST_PATH,48,155,246,8 - LTEXT "Path:",IDC_STATIC,7,153,29,8 - LTEXT "Help Text:",IDC_STATIC,7,172,34,8 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "SeaShell MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "SeaShell\0" - VALUE "LegalCopyright", "Copyright (C) 2000\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "SeaShell.EXE\0" - VALUE "ProductName", "SeaShell Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 383 - TOPMARGIN, 7 - BOTTOMMARGIN, 259 - END - - IDD_MFC_EXPLORER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 335 - TOPMARGIN, 7 - BOTTOMMARGIN, 216 - END - - IDD_FILTER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 78 - END - - IDD_SHELL_TREE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 299 - TOPMARGIN, 7 - BOTTOMMARGIN, 211 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDR_MAINFRAME "SeaShell\n\nSeaShe\n\n\nSeaShell.Document\nSeaShe Document" -END - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - AFX_IDS_APP_TITLE "SeaShell" - AFX_IDS_IDLEMESSAGE "Ready" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "CAP" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "SCRL" - ID_INDICATOR_OVR "OVR" - ID_INDICATOR_REC "REC" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_NEW "Create a new document\nNew" - ID_FILE_OPEN "Open an existing document\nOpen" - ID_FILE_CLOSE "Close the active document\nClose" - ID_FILE_SAVE "Save the active document\nSave" - ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" - ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" - ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" - ID_FILE_PRINT "Print the active document\nPrint" - ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_APP_ABOUT "Display program information, version number and copyright\nAbout" - ID_APP_EXIT "Quit the application; prompts to save documents\nExit" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_MRU_FILE1 "Open this document" - ID_FILE_MRU_FILE2 "Open this document" - ID_FILE_MRU_FILE3 "Open this document" - ID_FILE_MRU_FILE4 "Open this document" - ID_FILE_MRU_FILE5 "Open this document" - ID_FILE_MRU_FILE6 "Open this document" - ID_FILE_MRU_FILE7 "Open this document" - ID_FILE_MRU_FILE8 "Open this document" - ID_FILE_MRU_FILE9 "Open this document" - ID_FILE_MRU_FILE10 "Open this document" - ID_FILE_MRU_FILE11 "Open this document" - ID_FILE_MRU_FILE12 "Open this document" - ID_FILE_MRU_FILE13 "Open this document" - ID_FILE_MRU_FILE14 "Open this document" - ID_FILE_MRU_FILE15 "Open this document" - ID_FILE_MRU_FILE16 "Open this document" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_NEXT_PANE "Switch to the next window pane\nNext Pane" - ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_WINDOW_SPLIT "Split the active window into panes\nSplit" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_EDIT_CLEAR "Erase the selection\nErase" - ID_EDIT_CLEAR_ALL "Erase everything\nErase All" - ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" - ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" - ID_EDIT_FIND "Find the specified text\nFind" - ID_EDIT_PASTE "Insert Clipboard contents\nPaste" - ID_EDIT_REPEAT "Repeat the last action\nRepeat" - ID_EDIT_REPLACE "Replace specific text with different text\nReplace" - ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" - ID_EDIT_UNDO "Undo the last action\nUndo" - ID_EDIT_REDO "Redo the previously undone action\nRedo" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" - ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" - ID_VIEW_AUTOARRANGE "Arrange icons on a grid." -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCSIZE "Change the window size" - AFX_IDS_SCMOVE "Change the window position" - AFX_IDS_SCMINIMIZE "Reduce the window to an icon" - AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" - AFX_IDS_SCNEXTWINDOW "Switch to the next document window" - AFX_IDS_SCPREVWINDOW "Switch to the previous document window" - AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCRESTORE "Restore the window to normal size" - AFX_IDS_SCTASKLIST "Activate Task List" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_SMALLICON "Display items by using small icons.\nSmall Icons" - ID_VIEW_LARGEICON "Display items by using large icons.\nLarge Icons" - ID_VIEW_LIST "Displays items in a list.\nList" - ID_VIEW_DETAILS "Displays detailed information about each item in the window.\nDetails" - ID_VIEW_LINEUP "Arranges icons in a grid." - ID_VIEW_BYNAME "Sorts the icons alphabetically." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_EXPLORERDIALOG "Show a explorer dialog with tree, list and combo" - ID_VIEW_FILEFILTER "Filter the file selection with wild cards" - ID_VIEW_TREEDIALOG "Show a dialog with just the shell tree control" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\SeaShell.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#include "afxprint.rc" // printing/print preview resources -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellDoc.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellDoc.cpp deleted file mode 100644 index 9a84c484573..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellDoc.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// SeaShellDoc.cpp : implementation of the CSeaShellDoc class -// - -#include "stdafx.h" -#include "SeaShell.h" - -#include "SeaShellDoc.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellDoc - -IMPLEMENT_DYNCREATE(CSeaShellDoc, CDocument) - -BEGIN_MESSAGE_MAP(CSeaShellDoc, CDocument) - //{{AFX_MSG_MAP(CSeaShellDoc) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellDoc construction/destruction - -CSeaShellDoc::CSeaShellDoc() -{ - // TODO: add one-time construction code here - -} - -CSeaShellDoc::~CSeaShellDoc() -{ -} - -BOOL CSeaShellDoc::OnNewDocument() -{ - if (!CDocument::OnNewDocument()) - return FALSE; - - // TODO: add reinitialization code here - // (SDI documents will reuse this document) - - return TRUE; -} - - - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellDoc serialization - -void CSeaShellDoc::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - // TODO: add storing code here - } - else - { - // TODO: add loading code here - } -} - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellDoc diagnostics - -#ifdef _DEBUG -void CSeaShellDoc::AssertValid() const -{ - CDocument::AssertValid(); -} - -void CSeaShellDoc::Dump(CDumpContext& dc) const -{ - CDocument::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellDoc commands diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellDoc.h b/reactos/subsys/system/explorer/Seashell/SeaShellDoc.h deleted file mode 100644 index 18812e9a9ad..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellDoc.h +++ /dev/null @@ -1,57 +0,0 @@ -// SeaShellDoc.h : interface of the CSeaShellDoc class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_SEASHELLDOC_H__8B4AAB8C_DC87_4F7D_9171_BCE406941600__INCLUDED_) -#define AFX_SEASHELLDOC_H__8B4AAB8C_DC87_4F7D_9171_BCE406941600__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -class CSeaShellDoc : public CDocument -{ -protected: // create from serialization only - CSeaShellDoc(); - DECLARE_DYNCREATE(CSeaShellDoc) - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CSeaShellDoc) - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CSeaShellDoc(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CSeaShellDoc) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SEASHELLDOC_H__8B4AAB8C_DC87_4F7D_9171_BCE406941600__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/.cvsignore b/reactos/subsys/system/explorer/Seashell/SeaShellExt/.cvsignore deleted file mode 100644 index 9a65f4b5980..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -*.coff -*.exe -*.d -*.o -*.sym -*.map -*.aps -*.res -*.opt -*.ncb diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/HtmlCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/HtmlCtrl.cpp deleted file mode 100644 index dd97efb9dbf..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/HtmlCtrl.cpp +++ /dev/null @@ -1,120 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Microsoft Systems Journal -- December 1999 -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// Compiles with Visual C++ 6.0, runs on Windows 98 and probably NT too. -// -#include "StdAfx.h" -#include "HtmlCtrl.h" -#include "UIMessages.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CHtmlCtrl, CUIHtmlView) -BEGIN_MESSAGE_MAP(CHtmlCtrl, CUIHtmlView) - ON_WM_DESTROY() - ON_WM_MOUSEACTIVATE() - ON_MESSAGE(WM_APP_CB_IE_SEL_CHANGE,OnAppCbIeSelChange) -END_MESSAGE_MAP() - -BOOL CHtmlCtrl::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - BOOL bRet = CHtmlView::PreCreateWindow(cs); - return bRet; -} - -////////////////// -// Create control in same position as an existing static control with -// the same ID (could be any kind of control, really) -// -BOOL CHtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent) -{ - CStatic wndStatic; - if (!wndStatic.SubclassDlgItem(nID, pParent)) - return FALSE; - - // Get static control rect, convert to parent's client coords. - CRect rc; - wndStatic.GetWindowRect(&rc); - pParent->ScreenToClient(&rc); - wndStatic.DestroyWindow(); - - // create HTML control (CHtmlView) - return Create(NULL, // class name - NULL, // title - (WS_CHILD | WS_VISIBLE ), // style - rc, // rectangle - pParent, // parent - nID, // control ID - NULL); // frame/doc context not used -} - -//////////////// -// Override to avoid CView stuff that assumes a frame. -// -void CHtmlCtrl::OnDestroy() -{ - // This is probably unecessary since ~CHtmlView does it, but - // safer to mimic CHtmlView::OnDestroy. - if (m_pBrowserApp) { - m_pBrowserApp->Release(); - m_pBrowserApp = NULL; - } - CWnd::OnDestroy(); // bypass CView doc/frame stuff -} - -//////////////// -// Override to avoid CView stuff that assumes a frame. -// -int CHtmlCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT msg) -{ - // bypass CView doc/frame stuff - return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, msg); -} - -////////////////// -// Override navigation handler to pass to "app:" links to virtual handler. -// Cancels the navigation in the browser, since app: is a pseudo-protocol. -// -void CHtmlCtrl::OnBeforeNavigate2( LPCTSTR lpszURL, - DWORD nFlags, - LPCTSTR lpszTargetFrameName, - CByteArray& baPostedData, - LPCTSTR lpszHeaders, - BOOL* pbCancel ) -{ - CUIHtmlView::OnBeforeNavigate2(lpszURL,nFlags,lpszTargetFrameName,baPostedData,lpszHeaders,pbCancel); - LPCTSTR APP_PROTOCOL = _T("app:"); - int len = _tcslen(APP_PROTOCOL); - if (_tcsnicmp(lpszURL, APP_PROTOCOL, len)==0) { - OnAppCmd(lpszURL + len); - *pbCancel = TRUE; - } -} - -////////////////// -// Called when the browser attempts to navigate to "app:foo" -// with "foo" as lpszWhere. Override to handle app commands. -// -void CHtmlCtrl::OnAppCmd(LPCTSTR lpszWhere) -{ - // default: do nothing -} - -LRESULT CHtmlCtrl::OnAppCbIeSelChange(WPARAM wParam, LPARAM lParam) -{ - if (wParam) - Navigate((LPCTSTR)wParam); - return 1; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEFolderTreeCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEFolderTreeCtrl.cpp deleted file mode 100644 index d8a04bb22e5..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEFolderTreeCtrl.cpp +++ /dev/null @@ -1,548 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - - -#include "stdafx.h" -#include "IEFolderTreeCtrl.h" -#include "UIMessages.h" -#include -#include - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -typedef map mapPidlToHTREEITEM; -typedef vector vecPidl; - -int CALLBACK CIEFolderTreeCtrl::CompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) -{ - LPTVITEMDATA lptvid1 = (LPTVITEMDATA)((CUIListCtrlData*)lParam1)->GetExtData(); - LPTVITEMDATA lptvid2 = (LPTVITEMDATA)((CUIListCtrlData*)lParam2)->GetExtData(); - LPSHELLFOLDER psfParent = (LPSHELLFOLDER)lParamSort; - - HRESULT hr = psfParent->CompareIDs (0, lptvid1->lpi, lptvid2->lpi); - if (FAILED (hr)) - return 0; - return (short)hr; -} - -///////////////////////////////////////////////////////////////////////////// -// CIEFolderTreeCtrl - -CIEFolderTreeCtrl::CIEFolderTreeCtrl() -{ - SHGetMalloc(&m_pMalloc); - m_hImageList = NULL; -} - -CIEFolderTreeCtrl::~CIEFolderTreeCtrl() -{ - // Free our memory allocator - if (m_pMalloc) - m_pMalloc->Release(); -} - -void CIEFolderTreeCtrl::Refresh() -{ - HTREEITEM hItem = GetRootItem(); - if (hItem == NULL) - return; - CWaitCursor w; - SetRedraw(FALSE); - RefreshNode(hItem); - SetRedraw(TRUE); -} - -void CIEFolderTreeCtrl::OnDeleteItemData(DWORD dwData) -{ - LPTVITEMDATA pItemData=(LPTVITEMDATA)dwData; - if (pItemData == NULL) - return; - if (pItemData->lpsfParent) - pItemData->lpsfParent->Release(); - if (pItemData->lpi) - m_pMalloc->Free(pItemData->lpi); - if (pItemData->lpifq) - m_pMalloc->Free(pItemData->lpifq); - m_pMalloc->Free(pItemData); -} - -BOOL CIEFolderTreeCtrl::LoadURL(HTREEITEM hItem) -{ - if (GetRootItem() == hItem) - return FALSE; - if (ItemHasChildren(hItem)) - return FALSE; - CString strText(GetItemText(hItem)); - AfxMessageBox(strText); - return TRUE; -} - -bool CIEFolderTreeCtrl::LoadItems(LPCTSTR pszPath,DWORD dwFolderType) -{ - ASSERT(m_pMalloc); - if (m_hImageList == NULL) - Init(); - bool bRet = false; - - CWaitCursor w; - DeleteAllItems(); - //DeleteItemData(); - - LPITEMIDLIST pidl=NULL; - LPSHELLFOLDER psfDesktop=NULL; - LPSHELLFOLDER pSubFolder=NULL; - HRESULT hr = SHGetDesktopFolder(&psfDesktop); - - if (dwFolderType) - { - hr = SHGetSpecialFolderLocation(NULL, dwFolderType, &pidl); -#ifdef _DEBUG - CString sPath; - GetShellPidl().SHPidlToPathEx(pidl,sPath); - TRACE1("Populating special folder %s\n",sPath); -#endif - hr = psfDesktop->BindToObject(pidl, 0, IID_IShellFolder,(LPVOID*)&pSubFolder); - } - else - { - if (pszPath && *pszPath != '\0') - { - hr = m_ShellPidl.SHPathToPidlEx(pszPath,&pidl,psfDesktop); - if (SUCCEEDED(hr)) - { - hr = psfDesktop->BindToObject(pidl, 0, IID_IShellFolder,(LPVOID*)&pSubFolder); - if (SUCCEEDED(hr)) - m_sRootPath = pszPath; - } - } - else - { - hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); - } - } - LPCTSTR pszTitle=NULL; - SHFILEINFO fileInfo; - ZeroMemory(&fileInfo,sizeof(fileInfo)); - int nImage=0, nSelImage=0; - if (pidl) - { - SHGetFileInfo((LPCTSTR)pidl, NULL, &fileInfo, sizeof(fileInfo), SHGFI_PIDL|SHGFI_ATTRIBUTES|SHGFI_DISPLAYNAME); - pszTitle = fileInfo.szDisplayName; - m_ShellPidl.GetNormalAndSelectedIcons(pidl, nImage, nSelImage); - if (nImage < 0) - nImage = 0; - if (nSelImage < 0) - nSelImage = 0; - } - if (SUCCEEDED(hr)) - { - LPTVITEMDATA lptvid = (LPTVITEMDATA)m_pMalloc->Alloc(sizeof(TVITEMDATA)); - if (lptvid == NULL) - return bRet; - ZeroMemory(lptvid,sizeof(TVITEMDATA)); - // Now make a copy of the ITEMIDLIST. - lptvid->lpi = m_ShellPidl.CopyLastItemID(pidl); - lptvid->lpifq = m_ShellPidl.CopyItemIDList(pidl); - lptvid->lpsfParent = NULL; - if (lptvid->lpsfParent) - lptvid->lpsfParent->AddRef(); - - HTREEITEM hRootItem = AddAnItem((HTREEITEM)NULL,pszTitle,(LPARAM)lptvid,(HTREEITEM)TVI_ROOT,nImage,nSelImage); - AddItems(hRootItem,pSubFolder ? pSubFolder : psfDesktop); - Expand(hRootItem,TVE_EXPAND); - PostMessage(WM_APP_POPULATE_TREE); - bRet = true; - } - if (pidl) - m_pMalloc->Free(pidl); - if (pSubFolder) - pSubFolder->Release(); - if (psfDesktop) - psfDesktop->Release(); - return bRet; -} - -bool CIEFolderTreeCtrl::AddItems(HTREEITEM hItem,IShellFolder* pFolder) -{ - IEnumIDList* pItems = NULL; - LPITEMIDLIST pidlNext = NULL; - DWORD dwFlags = SHCONTF_FOLDERS; - if (GetShellSettings().ShowAllObjects() && !GetShellSettings().ShowSysFiles()) - dwFlags |= SHCONTF_INCLUDEHIDDEN; - // Enumerate all object in the given folder - HRESULT hr = pFolder->EnumObjects(NULL, dwFlags, &pItems); - if (hr != NOERROR) - return false; - while (NOERROR == hr) - { - hr = pItems->Next(1, &pidlNext, NULL); - if (hr == S_FALSE || pidlNext == NULL) - break; - if (AddFolder(hItem,pidlNext,pFolder) == NULL) - m_pMalloc->Free(pidlNext); - pidlNext = NULL; - } - if (pidlNext) - m_pMalloc->Free(pidlNext); - if (pItems) - pItems->Release(); - Sort(hItem,pFolder); - return true; -} - -void CIEFolderTreeCtrl::Sort(HTREEITEM hParent,LPSHELLFOLDER pFolder) -{ - // Sort the the node based on pidls - TVSORTCB cbSort; - cbSort.hParent = hParent; - cbSort.lpfnCompare = CompareProc; - cbSort.lParam = (LPARAM)pFolder; - SortChildrenCB(&cbSort); -} - -HTREEITEM CIEFolderTreeCtrl::AddFolder(HTREEITEM hItem,LPCTSTR pszPath) -{ - LPITEMIDLIST pidlfq=NULL; - HRESULT hr = GetShellPidl().SHPathToPidlEx(pszPath,&pidlfq,NULL); - if (FAILED(hr)) - return NULL; - LPTVITEMDATA lptvid = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(lptvid); - LPITEMIDLIST pidl = GetShellPidl().CopyLastItemID(pidlfq); - HTREEITEM hFolderItem = AddFolder(hItem,pidl,lptvid->lpsfParent); - if (pidlfq) - m_pMalloc->Free(pidlfq); - return hFolderItem; -} - -HTREEITEM CIEFolderTreeCtrl::AddFolder(HTREEITEM hItem,LPITEMIDLIST pidl,LPSHELLFOLDER pFolder) -{ - ASSERT(m_pMalloc); - LPTSTR pszFilePath = NULL; - STRRET StrRetFilePath; - SHFILEINFO FileInfo; - - ZeroMemory(&FileInfo,sizeof(FileInfo)); - FileInfo.dwAttributes=SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - HRESULT hr = pFolder->GetAttributesOf(1,(LPCITEMIDLIST*)&pidl,&FileInfo.dwAttributes); - if (FAILED(hr)) - return NULL; -// Create a submenu if this item is a folder - if (!(FileInfo.dwAttributes & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER))) - return NULL; - pFolder->GetDisplayNameOf(pidl,SHGDN_INFOLDER,&StrRetFilePath); - GetShellPidl().StrRetToStr(StrRetFilePath, &pszFilePath, pidl); - if (pszFilePath) - { - lstrcpy(FileInfo.szDisplayName,pszFilePath); - m_pMalloc->Free(pszFilePath); - pszFilePath = NULL; - } - // allocate new itemdata - LPTVITEMDATA lptvid = (LPTVITEMDATA)m_pMalloc->Alloc(sizeof(TVITEMDATA)); - if (lptvid == NULL) - return NULL; - ZeroMemory(lptvid,sizeof(TVITEMDATA)); - // get itemdata for current node - LPTVITEMDATA lpptvid = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(lpptvid); - // create new fully qualified pidl - lptvid->lpifq = m_ShellPidl.ConcatPidl(lpptvid->lpifq,pidl); - // save relative pidl (will be freed in the clean up) - lptvid->lpi = pidl; - int nImage=0; - int nSelImage=0; - // get icons for new fq pidl - m_ShellPidl.GetNormalAndSelectedIcons(lptvid->lpifq, nImage, nSelImage); - // save folder for later use(when node is expanded) - lptvid->lpsfParent = pFolder; // pointer to parent folder - // keep hold of it(will be released in clean up) - lptvid->lpsfParent->AddRef(); - // add the node to the tree unsorted (will be sorted later) - int nChildren = 0; - if (FileInfo.dwAttributes & SFGAO_HASSUBFOLDER) - { - nChildren=1; - } - HTREEITEM hNewItem = AddAnItem(hItem,FileInfo.szDisplayName,(DWORD)lptvid,(HTREEITEM)TVI_FIRST,nImage,nSelImage,nChildren); - // set overlay images - if (hNewItem) - { - SetAttributes(hNewItem,pFolder,pidl); - } - return hNewItem; -} - -void CIEFolderTreeCtrl::SetAttributes(HTREEITEM hItem,LPSHELLFOLDER pFolder,LPITEMIDLIST pidl) -{ - DWORD dwAttributes = SFGAO_DISPLAYATTRMASK | SFGAO_REMOVABLE; - HRESULT hr = pFolder->GetAttributesOf(1,(LPCITEMIDLIST*)&pidl,&dwAttributes); - if (FAILED(hr)) - return; - if ((dwAttributes & SFGAO_COMPRESSED) && GetShellSettings().ShowCompColor()) - SetTextColor(hItem,RGB(0,0,255)); - else - SetDefaultTextColor(hItem); - if (dwAttributes & SFGAO_GHOSTED) - SetItemState(hItem,TVIS_CUT,TVIS_CUT); - else - SetItemState(hItem,TVIS_CUT,0); - if (dwAttributes & SFGAO_LINK) - SetItemState(hItem,INDEXTOOVERLAYMASK(2),TVIS_OVERLAYMASK); - else - SetItemState(hItem,0,TVIS_OVERLAYMASK); - if (dwAttributes & SFGAO_SHARE) - SetItemState(hItem,INDEXTOOVERLAYMASK(1),TVIS_OVERLAYMASK); - else - SetItemState(hItem,0,TVIS_OVERLAYMASK); -} - -BEGIN_MESSAGE_MAP(CIEFolderTreeCtrl, CUITreeCtrl) - //{{AFX_MSG_MAP(CIEFolderTreeCtrl) - ON_WM_CREATE() - ON_WM_DESTROY() - ON_MESSAGE(WM_SETTINGCHANGE,OnSettingChange) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEFolderTreeCtrl message handlers - -int CIEFolderTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CUITreeCtrl::OnCreate(lpCreateStruct) == -1) - return -1; - - // TODO: Add your specialized creation code here - - return 0; -} - -BOOL CIEFolderTreeCtrl::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - // No label editing for Explorer items - cs.style |= (TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS); - return CTreeCtrl::PreCreateWindow(cs); -} - -void CIEFolderTreeCtrl::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) -{ - // TODO: Add your specialized code here and/or call the base class - - CUITreeCtrl::CalcWindowRect(lpClientRect, nAdjustType); -} - -LPCITEMIDLIST CIEFolderTreeCtrl::GetPathPidl(HTREEITEM hItem) -{ - if (hItem == NULL) - return NULL; - LPLVITEMDATA plvit = (LPLVITEMDATA)GetItemData(hItem); - ASSERT(plvit); - if (plvit == NULL) - return NULL; - return plvit->lpifq; -} - -LPSHELLFOLDER CIEFolderTreeCtrl::GetItemFolder(HTREEITEM hItem) -{ - LPTVITEMDATA lpidCurr = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(lpidCurr); - if (lpidCurr == NULL) - return NULL; - LPSHELLFOLDER psfCurr=NULL; - -#if 1 // bug fix by Gregoire - LPSHELLFOLDER psfDesktop=NULL; - SHGetDesktopFolder(&psfDesktop); - psfDesktop->BindToObject(lpidCurr->lpifq,0,IID_IShellFolder,(LPVOID*)&psfCurr); -#else - if (lpidCurr->lpsfParent) - lpidCurr->lpsfParent->BindToObject(lpidCurr->lpi,0,IID_IShellFolder,(LPVOID*)&psfCurr); -#endif - - if (psfCurr == NULL) - { - SHGetDesktopFolder(&psfCurr); - } - return psfCurr; -} - -CString CIEFolderTreeCtrl::GetPathName(HTREEITEM hItem) -{ - if (hItem == NULL) - hItem = GetSelectedItem(); - CString sPath; - if (hItem == NULL) - return sPath; - LPTVITEMDATA lptvid = (LPTVITEMDATA)GetItemData(hItem); - if (lptvid != NULL) - { - SHGetPathFromIDList(lptvid->lpifq,sPath.GetBuffer(MAX_PATH)); - sPath.ReleaseBuffer(); - } - return sPath; -} - - -void CIEFolderTreeCtrl::SetButtonState(HTREEITEM hItem) -{ - LPSHELLFOLDER psfCurr=GetItemFolder(hItem); - if (psfCurr == NULL) - return; - IEnumIDList* pItems=NULL; - HRESULT hr = psfCurr->EnumObjects(NULL, SHCONTF_FOLDERS, &pItems); - int nChildren=0; - if (SUCCEEDED(hr)) - { - pItems->Release(); - nChildren=1; - } - if (nChildren == 1 && !ItemHasChildren(hItem)) - { - TVITEM tv; - tv.mask = TVIF_CHILDREN; - ZeroMemory(&tv,sizeof(tv)); - SetItem(&tv); - } - psfCurr->Release(); -} - -void CIEFolderTreeCtrl::RefreshNode(HTREEITEM hItem) -{ - // If the item is not expanded, update its button state and return. - if (!(GetItemState(hItem, TVIS_EXPANDED) & TVIS_EXPANDED)) - { - SetButtonState(hItem); - return; - } - LPSHELLFOLDER psfCurr=GetItemFolder(hItem); - if (psfCurr == NULL) - return; - mapPidlToHTREEITEM mPidlCurr; - vecPidl vPidlNew; - HTREEITEM hSelItem = GetSelectedItem(); - HTREEITEM hChild = GetChildItem(hItem); - while (hChild != NULL) - { - HTREEITEM hNextItem = GetNextSiblingItem(hChild); - LPTVITEMDATA lpid = (LPTVITEMDATA)GetItemData(hChild); - mPidlCurr[CShellPidlCompare(psfCurr,lpid->lpi)] = hChild; - hChild = hNextItem; - } - LPITEMIDLIST pidlNext=NULL; - LPITEMIDLIST pidlCopy=NULL; - IEnumIDList* pItems=NULL; - DWORD dwFlags = SHCONTF_FOLDERS; - if (GetShellSettings().ShowAllObjects() && !GetShellSettings().ShowSysFiles()) - dwFlags |= SHCONTF_INCLUDEHIDDEN; - HRESULT hr = psfCurr->EnumObjects(NULL, dwFlags, &pItems); - while (NOERROR == hr) - { - hr = pItems->Next(1, &pidlNext, NULL); - if (hr == S_FALSE || pidlNext == NULL)// || pidlNext == pidlCopy) - break; - pidlCopy = pidlNext; - mapPidlToHTREEITEM::iterator it = mPidlCurr.find(CShellPidlCompare(psfCurr,pidlNext)); - if (it != mPidlCurr.end()) - { - mPidlCurr.erase(it); - } - else - { - SetAttributes((*it).second,psfCurr,pidlNext); - vPidlNew.push_back(GetShellPidl().CopyItemIDList(pidlNext)); - } - GetShellPidl().FreePidl(pidlNext); - pidlNext=NULL; - } - if (pItems) - pItems->Release(); - for(mapPidlToHTREEITEM::iterator it1=mPidlCurr.begin();it1 != mPidlCurr.end();it1++) - { - HTREEITEM hDelItem = (*it1).second; -#ifdef _DEBUG - CString sPath; - GetShellPidl().SHPidlToPathEx((*it1).first.GetPidl(),sPath,psfCurr); - TRACE1("Deleting item %s in tree refresh\n",sPath); -#endif - DeleteItem(hDelItem); - } - HTREEITEM hSortItem=NULL; - for(vecPidl::iterator it2=vPidlNew.begin();it2 != vPidlNew.end();it2++) - { - AddFolder(hItem,*it2,psfCurr); - hSortItem = hItem; - } - if (hSortItem) - Sort(hSortItem,psfCurr); - // Remove all items from the map - mPidlCurr.erase(mPidlCurr.begin(),mPidlCurr.end()); - vPidlNew.erase(vPidlNew.begin(),vPidlNew.end()); - psfCurr->Release(); - // Now repeat this procedure for hItem's children. - hChild = GetChildItem(hItem); - - while (hChild != NULL) - { - RefreshNode(hChild); - hChild = GetNextSiblingItem (hChild); - } -} - -void CIEFolderTreeCtrl::Init() -{ - CUITreeCtrl::Init(); - - GetShellSettings().GetSettings(); - // TODO: Add your specialized code here and/or call the base class - // Get the handle to the system image list, for our icons - SHFILEINFO sfi; - - m_hImageList = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T("C:\\"), - 0, - &sfi, - sizeof(SHFILEINFO), - SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to TreeCtrl - if (m_hImageList) - ::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM) TVSIL_NORMAL,(LPARAM)m_hImageList); -} - -void CIEFolderTreeCtrl::OnDestroy() -{ - SetImageList(NULL,TVSIL_NORMAL); - CUITreeCtrl::OnDestroy(); -} - -LRESULT CIEFolderTreeCtrl::OnSettingChange(WPARAM wParam,LPARAM lParam) -{ - LPCTSTR lpszSection=(LPCTSTR)lParam; - if (lpszSection == NULL) - return 0L; - if (lstrcmpi(lpszSection, _T("ShellState")) == 0) - { - GetShellSettings().GetSettings(); - Refresh(); - } - return 1L; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellComboBox.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellComboBox.cpp deleted file mode 100644 index e18068f6c97..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellComboBox.cpp +++ /dev/null @@ -1,549 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IEShellComboBox.cpp : implementation file -// - -#include "stdafx.h" -#include "UIMessages.h" -#include "IEShellComboBox.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -const CString strURLKey(_T("Software\\Microsoft\\Internet Explorer\\TypedURLs")); -const CString strIEKey(_T("\\CLSID\\{0002DF01-0000-0000-C000-000000000046}\\LocalServer32")); -///////////////////////////////////////////////////////////////////////////// -// CIEShellComboBox - -CIEShellComboBox::CIEShellComboBox() -{ - m_pidlMyComputer = NULL; - m_pidlMyDocuments = NULL; - m_pidlInternet = NULL; - m_hImageList = NULL; - m_hTreeWnd = NULL; - m_hIcon = NULL; - SHGetMalloc(&m_pMalloc); - m_bInternet = false; -} - -CIEShellComboBox::~CIEShellComboBox() -{ - DeleteAllItemData(); - CShCMSort *pItem=NULL; - STL_FOR_ITERATOR(vecCMSort,m_vItems) - { - pItem = STL_GET_CURRENT(m_vItems); - DeleteItemData((LPTVITEMDATA)pItem->GetItemData()); - delete pItem; - } - if (m_pMalloc) - { - if (m_pidlInternet) - m_pMalloc->Free(m_pidlInternet); - if (m_pidlMyComputer) - m_pMalloc->Free(m_pidlMyComputer); - if (m_pidlMyDocuments) - m_pMalloc->Free(m_pidlMyDocuments); - m_pMalloc->Release(); - } - if (m_hIcon) - ::DestroyIcon(m_hIcon); -} - -void CIEShellComboBox::DeleteAllItemData() -{ - for(vecItemData::iterator it=m_vecItemData.begin();it != m_vecItemData.end();it++) - { - DeleteItemData(*it); - } - m_vecItemData.erase(m_vecItemData.begin(),m_vecItemData.end()); -} - -void CIEShellComboBox::DeleteItemData(LPTVITEMDATA pItemData) -{ - if (pItemData == NULL) - return; - if (pItemData->lpsfParent) - pItemData->lpsfParent->Release(); - if (pItemData->lpi) - m_pMalloc->Free(pItemData->lpi); - if (pItemData->lpifq) - m_pMalloc->Free(pItemData->lpifq); - m_pMalloc->Free(pItemData); -} - -LPITEMIDLIST CIEShellComboBox::GetSelectedPidl() -{ - int nCurSel = GetCurSel(); - if (nCurSel == -1) - return NULL; - LPTVITEMDATA lptvid = (LPTVITEMDATA)GetItemData(nCurSel); - if (lptvid == NULL) - return NULL; - return GetShellPidl().CopyItemIDList(lptvid->lpifq); -} - -BEGIN_MESSAGE_MAP(CIEShellComboBox, CComboBoxEx) - //{{AFX_MSG_MAP(CIEShellComboBox) - ON_MESSAGE(WM_APP_CB_IE_HIT_ENTER,OnAppCbIeHitEnter) - ON_WM_CREATE() - ON_WM_DESTROY() - ON_WM_SETFOCUS() - ON_WM_KILLFOCUS() - ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropDown) - ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelChange) - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_CB_IE_POPULATE,OnCBIEPopulate) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEShellComboBox message handlers - -void CIEShellComboBox::Populate(LPITEMIDLIST pidlAbsSel) -{ - if (m_hImageList == NULL) - SetShellImageList(); - if (STL_EMPTY(m_vItems)) - InitItems(pidlAbsSel); - if (GetShellPidl().ComparePidls(NULL,pidlAbsSel,m_pidlInternet)) - LoadURLPrevList(); - else - LoadItems(pidlAbsSel); -} - -void CIEShellComboBox::LoadURLPrevList() -{ - if (m_ImageList.m_hImageList) - ::SendMessage(GetSafeHwnd(), CBEM_SETIMAGELIST, 0, (LPARAM)m_ImageList.m_hImageList); - ResetContent(); - HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER,strURLKey,0,KEY_READ,&hKey) != ERROR_SUCCESS) - return; - TCHAR szValueName[_MAX_PATH]; - BYTE pData[_MAX_PATH]; - DWORD dwSizeValueName = sizeof(szValueName)-1; - DWORD dwSizeData = sizeof(pData)-1; - DWORD dwType=0; - COMBOBOXEXITEM item; - ZeroMemory(&item,sizeof(item)); - item.mask |= (CBEIF_IMAGE | CBEIF_TEXT | CBEIF_SELECTEDIMAGE); - item.iItem = -1; - item.iImage = 0; - for(DWORD dwIndex=0;RegEnumValue(hKey, - dwIndex, - szValueName, - &dwSizeValueName, - NULL, - &dwType, - pData, - &dwSizeData) == ERROR_SUCCESS;dwIndex++) - { - item.pszText = (LPTSTR)(LPCTSTR)pData; - item.cchTextMax = lstrlen(item.pszText); - InsertItem(&item); - dwSizeValueName = sizeof(szValueName)-1; - dwSizeData = sizeof(pData)-1; - } - RegCloseKey(hKey); - m_bInternet = true; -} - -void CIEShellComboBox::InitItems(LPITEMIDLIST pidlAbsSel) -{ - LPSHELLFOLDER psfDesktop=NULL; - LPITEMIDLIST pidlDesktop=NULL; - HRESULT hr = SHGetDesktopFolder(&psfDesktop); - SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop); - SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &m_pidlMyComputer); - SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &m_pidlMyDocuments); - SHGetSpecialFolderLocation(NULL, CSIDL_INTERNET, &m_pidlInternet); - int nImage=0, nSelImage=0; - SHFILEINFO fileInfo; - SHGetFileInfo((LPCTSTR)pidlDesktop, NULL, &fileInfo, sizeof(fileInfo), SHGFI_PIDL|SHGFI_ATTRIBUTES|SHGFI_DISPLAYNAME); - m_ShellPidl.GetNormalAndSelectedIcons(pidlDesktop, nImage, nSelImage); - CShCMSort *pItem = new CShCMSort; - pItem->SetText(fileInfo.szDisplayName); - pItem->SetImage(nImage); - pItem->SetSelImage(nSelImage); - LPTVITEMDATA lptvid = (LPTVITEMDATA)m_pMalloc->Alloc(sizeof(TVITEMDATA)); - lptvid->lpi = GetShellPidl().CopyItemID(pidlDesktop); - lptvid->lpifq = GetShellPidl().CopyItemIDList(pidlDesktop); - lptvid->lpsfParent = NULL; - STL_ADD_ITEM(m_vItems,pItem); - BuildFolderList(psfDesktop,pidlDesktop,pidlAbsSel,1); - if (m_pMalloc) - { - if (pidlDesktop) - m_pMalloc->Free(pidlDesktop); - } - psfDesktop->Release(); -} - -void CIEShellComboBox::BuildFolderList(LPSHELLFOLDER pFolder,LPITEMIDLIST pidl,LPITEMIDLIST pidlAbsSel, int nIndent) -{ - vecCMSort vItems; - AddItems(vItems,pFolder,pidl,nIndent); - // Sort the this node based on pidls - STL_SORT(vItems,pFolder,STL_SORT_FUNC); - CShCMSort *pItem=NULL; - STL_FOR_ITERATOR(vecCMSort,vItems) - { - pItem = STL_GET_CURRENT(vItems); - STL_ADD_ITEM(m_vItems,pItem); - if (GetShellPidl().ComparePidls(pFolder,pItem->GetPidl(),m_pidlMyComputer)) - { - LPSHELLFOLDER pSubFolder=NULL; - HRESULT hr = pFolder->BindToObject(pItem->GetPidl(), 0, IID_IShellFolder,(LPVOID*)&pSubFolder); - if (SUCCEEDED(hr)) - { - BuildFolderList(pSubFolder,pItem->GetPidl(),pidlAbsSel,nIndent+1); - pSubFolder->Release(); - } - } - } -} - -void CIEShellComboBox::LoadItems(LPITEMIDLIST pidlAbsSel) -{ - if (m_hImageList) - ::SendMessage(GetSafeHwnd(), CBEM_SETIMAGELIST, 0, (LPARAM)m_hImageList); - GetComboBoxCtrl()->ResetContent(); - DeleteAllItemData(); - - CShCMSort *pItem=NULL; - int nCount = GetShellPidl().GetCount(pidlAbsSel); - LPITEMIDLIST pidlCompare=NULL; - int nSelItem=-1; - int nItem=0; - int n=0; - int nIndent=0; - CString sPath; - STL_FOR_ITERATOR(vecCMSort,m_vItems) - { - pItem = STL_GET_CURRENT(m_vItems); - nItem = AddItem(pItem); - nIndent = pItem->GetIndent(); - if (nIndent == 0) - nIndent = 1; -// TRACE2("Getting pidl %d of %u\n",nIndent,nCount); - pidlCompare=GetShellPidl().CopyItemID(pidlAbsSel,nIndent); - // Desktop item - if (nCount == 0 && n == 0) - { - nSelItem = 0; - sPath = pItem->GetText(); - } - else if (nCount == 1 && GetShellPidl().ComparePidls(NULL,pItem->GetPidl(),pidlAbsSel) == true) - { - nSelItem = nItem; - sPath = pItem->GetText(); - } - else if (GetShellPidl().CompareMemPidls(pItem->GetPidl(),pidlCompare) == true - && GetShellPidl().CompareMemPidls(pItem->GetPidl(),m_pidlMyComputer) == false) - { - LPITEMIDLIST pidlAbs=NULL; - CString sDisplayName; - CShCMSort Item; - int nImage=0; - int nSelImage=0; - for(int i=nIndent+1;i < (nCount+1);i++) - { - pidlAbs = GetShellPidl().CopyAbsItemID(pidlAbsSel,i); - if (pidlAbs) - { - GetShellPidl().SHPidlToPathEx(pidlAbs,sPath,NULL); - GetShellPidl().GetDisplayName(pidlAbs,sDisplayName); - GetShellPidl().GetNormalAndSelectedIcons(pidlAbs,nImage,nSelImage); - Item.SetText(sDisplayName); - Item.SetImage(nImage); - Item.SetSelImage(nSelImage); - LPTVITEMDATA lptvid = (LPTVITEMDATA)m_pMalloc->Alloc(sizeof(TVITEMDATA)); - lptvid->lpi = GetShellPidl().CopyItemID(pidlAbs); - lptvid->lpifq = pidlAbs; - LPTVITEMDATA dt_lptvid = (LPTVITEMDATA)pItem->GetItemData(); - lptvid->lpsfParent = dt_lptvid->lpsfParent; - lptvid->lpsfParent->AddRef(); - Item.SetItemData((DWORD)lptvid); - Item.SetIndent(i); - m_vecItemData.push_back(lptvid); - nItem = AddItem(&Item); - } - } - if (nSelItem == -1) - nSelItem = nItem; - if (sPath.Find(_T("::")) == 0) - GetShellPidl().GetDisplayName(pidlAbsSel,sPath); - else if(sPath.IsEmpty()) - sPath = pItem->GetText(); - } - if (pidlCompare) - { - m_pMalloc->Free(pidlCompare); - pidlCompare = NULL; - } - n++; - } - if (nSelItem >= 0) - GetComboBoxCtrl()->SetCurSel(nSelItem); - GetEditCtrl()->SetWindowText(sPath); - m_bInternet = false; -} - -int CIEShellComboBox::AddItem(const CShCMSort *pItem) -{ - // add the node to the combo box - COMBOBOXEXITEM item; - ZeroMemory(&item,sizeof(item)); - item.mask |= (CBEIF_IMAGE | CBEIF_INDENT | CBEIF_LPARAM | CBEIF_TEXT | CBEIF_SELECTEDIMAGE); - item.iItem = -1; - item.pszText = (LPTSTR)(LPCTSTR)pItem->GetText(); - item.cchTextMax = lstrlen(item.pszText); - item.iImage = pItem->GetImage(); - item.iSelectedImage = pItem->GetSelImage(); - item.iOverlay = pItem->GetOverlayImage(); - item.iIndent = pItem->GetIndent(); - item.lParam = (LPARAM)pItem->GetItemData(); - return InsertItem(&item); -} - -void CIEShellComboBox::AddItems(vecCMSort &vItems,IShellFolder* pFolder,LPITEMIDLIST pidlAbs,int nIndent) -{ - IEnumIDList* pItems = NULL; - LPITEMIDLIST pidlNext = NULL; - LPITEMIDLIST pidlCopy = NULL; - LPTSTR pszFilePath = NULL; - STRRET StrRetFilePath; - // Enumerate all object in the given folder - HRESULT hr = pFolder->EnumObjects(NULL, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS, &pItems); - SHFILEINFO fileinfo; - while (NOERROR == hr) - { - hr = pItems->Next(1, &pidlNext, NULL); - if (hr == S_FALSE || pidlNext == NULL || pidlNext == pidlCopy) - break; - pidlCopy = pidlNext; - pFolder->GetDisplayNameOf(pidlNext,SHGDN_INFOLDER,&StrRetFilePath); - GetShellPidl().StrRetToStr(StrRetFilePath, &pszFilePath, pidlNext); - ZeroMemory(&fileinfo,sizeof(fileinfo)); - fileinfo.dwAttributes=SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - hr = pFolder->GetAttributesOf(1,(const struct _ITEMIDLIST **)&pidlCopy,&fileinfo.dwAttributes); - if (SUCCEEDED(hr)) - lstrcpy(fileinfo.szDisplayName,pszFilePath); - // Create a submenu if this item is a folder - if (fileinfo.dwAttributes & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) - { - if (fileinfo.dwAttributes & SFGAO_FOLDER) - { - AddFolder(vItems,fileinfo,pidlAbs,pidlNext,pFolder,nIndent); - } - } - if (pszFilePath) - m_pMalloc->Free(pszFilePath); - } - if (pidlNext) - m_pMalloc->Free(pidlNext); - if (pItems) - pItems->Release(); -} - -void CIEShellComboBox::AddFolder(vecCMSort &vItems,const SHFILEINFO &FileInfo,LPITEMIDLIST pidlAbs,LPITEMIDLIST pidl,LPSHELLFOLDER pFolder,int nIndent) -{ - ASSERT(m_pMalloc); - // allocate new itemdata - LPTVITEMDATA lptvid = (LPTVITEMDATA)m_pMalloc->Alloc(sizeof(TVITEMDATA)); - if (lptvid == NULL) - return; - ZeroMemory(lptvid,sizeof(TVITEMDATA)); - // create new fully qualified pidl - lptvid->lpifq = m_ShellPidl.ConcatPidl(pidlAbs,pidl); - // Now make a copy of the last item in the pidl. - lptvid->lpi = pidl; - int nImage=0; - int nSelImage=0; - // get icons for new fq pidl - m_ShellPidl.GetNormalAndSelectedIcons(lptvid->lpifq, nImage, nSelImage); - // save folder for later use(when node is expanded) - lptvid->lpsfParent = pFolder; // pointer to parent folder - // keep hold of it(will be released in clean up) - lptvid->lpsfParent->AddRef(); - CShCMSort *pSMI = new CShCMSort; - pSMI->SetPidl(pidl); - pSMI->SetText(FileInfo.szDisplayName); - pSMI->SetImage(nImage); - pSMI->SetSelImage(nSelImage); - pSMI->SetItemData((DWORD)lptvid); - pSMI->SetIndent(nIndent); - STL_ADD_ITEM(vItems,pSMI); -} - -void CIEShellComboBox::SetShellImageList() -{ - // TODO: Add your specialized creation code here - HKEY hKey; - if (RegOpenKeyEx(HKEY_CLASSES_ROOT,strIEKey,0,KEY_READ,&hKey) == ERROR_SUCCESS) - { - BYTE szValueName[_MAX_PATH]; - DWORD dwType=0; - DWORD dwSizeData = sizeof(szValueName)-1; - RegQueryValueEx(hKey,NULL,0,&dwType,szValueName,&dwSizeData); - CString sPath((LPCTSTR)szValueName); - if (sPath.Left(1) == _T('"')) - sPath = sPath.Right(sPath.GetLength()-1); - if (sPath.Right(1) == _T('"')) - sPath = sPath.Left(sPath.GetLength()-1); - if (sPath.Find(_T("%")) != -1) - { - TCHAR szPath[MAX_PATH]; - if (ExpandEnvironmentStrings(sPath,szPath,sizeof(szPath)) > 0) - sPath = szPath; - } - if (sPath.Find(_T("~")) != -1) - { - TCHAR szPath[MAX_PATH]; - if (GetLongPathName(sPath,szPath,sizeof(szPath)) > 0) - sPath = szPath; - } - ExtractIconEx(sPath, 1, NULL, &m_hIcon, 1); - // create the small icon image list - UINT cxSmallIcon = ::GetSystemMetrics(SM_CXSMICON); - UINT cySmallIcon = ::GetSystemMetrics(SM_CYSMICON); - if (m_ImageList.GetSafeHandle() != NULL) - m_ImageList.DeleteImageList(); - m_ImageList.Create(cxSmallIcon, - cySmallIcon, - ILC_MASK | ILC_COLOR16, - 1, - 1); - if (m_hIcon) - m_ImageList.Add(m_hIcon); - } - SHFILEINFO sfi; - m_hImageList = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T("C:\\"), - 0, - &sfi, - sizeof(SHFILEINFO), - SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to the window - if (m_hImageList) - ::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)m_hImageList); -} - -void CIEShellComboBox::SelectionChanged(bool bEnter) -{ - LPITEMIDLIST pidlSel = GetSelectedPidl(); - GetEditCtrl()->GetWindowText(m_sText); - UINT mess=WM_APP_CB_IE_SEL_CHANGE; - if (bEnter) - mess=WM_APP_CB_IE_HIT_ENTER; - if (m_hTreeWnd) - { - if (mess == WM_APP_CB_IE_SEL_CHANGE) - ::SendMessage(m_hTreeWnd,mess,(WPARAM)pidlSel,(LPARAM)(LPCTSTR)m_sText); - else - ::SendMessage(m_hTreeWnd,mess,(WPARAM)m_bInternet,(LPARAM)(LPCTSTR)m_sText); - } -} - -int CIEShellComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CComboBoxEx::OnCreate(lpCreateStruct) == -1) - return -1; - - SetShellImageList(); - - if (m_cbEdit.GetSafeHwnd() == NULL) - { - m_cbEdit.SubclassWindow(GetEditCtrl()->GetSafeHwnd()); - m_cbEdit.SetTreeWnd(m_hTreeWnd); - } - return 0; -} - -void CIEShellComboBox::OnDestroy() -{ - SetImageList(NULL); - - CComboBoxEx::OnDestroy(); - - // TODO: Add your message handler code here - -} - -LRESULT CIEShellComboBox::OnCBIEPopulate(WPARAM wParam,LPARAM lParam) -{ - Populate((LPITEMIDLIST)wParam); - return 1L; -} - -void CIEShellComboBox::OnDropDown() -{ -} - -void CIEShellComboBox::OnSelChange() -{ - SelectionChanged(false); -} - -void CIEShellComboBox::OnKillFocus(CWnd *pNewWnd) -{ - CComboBoxEx::OnKillFocus(pNewWnd); - SetEditSel(-1,0); -} - -void CIEShellComboBox::OnSetFocus(CWnd *pWnd) -{ - CComboBoxEx::OnSetFocus(pWnd); - SetEditSel(-1,-1); -} - -BOOL CIEShellComboBoxEdit::PreTranslateMessage(MSG* pMsg) -{ - // TODO: Add your specialized code here and/or call the base class - if (pMsg->message == WM_KEYDOWN) - { - if (pMsg->wParam == VK_RETURN) - { - GetParent()->GetParent()->PostMessage(WM_APP_CB_IE_HIT_ENTER); - return TRUE; - } - } - return CEdit::PreTranslateMessage(pMsg); -} - -void CIEShellComboBox::PreSubclassWindow() -{ - // TODO: Add your specialized code here and/or call the base class - CComboBoxEx::PreSubclassWindow(); - - if (m_cbEdit.GetSafeHwnd() == NULL) - { - m_cbEdit.SubclassWindow(GetEditCtrl()->GetSafeHwnd()); - m_cbEdit.SetTreeWnd(m_hTreeWnd); - } -} - -LRESULT CIEShellComboBox::OnAppCbIeHitEnter(WPARAM wParam, LPARAM lParam) -{ - SelectionChanged(true); - return 1; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellDragDrop.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellDragDrop.cpp deleted file mode 100644 index ec89f503a06..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellDragDrop.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "IEShellDragDrop.h" -#include "cbformats.h" - -#ifndef OleStdGetDropEffect -#define OleStdGetDropEffect(grfKeyState) \ - ( (grfKeyState & MK_CONTROL) ? \ - ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY ) : \ - ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_MOVE : DROPEFFECT_NONE ) ) -#endif - -bool CIEShellDragDrop::DragEnter(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl) -{ -// DWORD dwEffect = m_ShellPidl.GetDragDropAttributes(pInfo->GetDataObject()->m_lpDataObject); - IDropTarget *pdt=NULL; - if (psfFolder == NULL) - psfFolder = m_psfDesktop; - HRESULT hr = psfFolder->GetUIObjectOf(pInfo->GetSafeHwnd(),1,(LPCITEMIDLIST*)&pidl, IID_IDropTarget, NULL, (LPVOID*)&pdt); - if (FAILED(hr)) - return false; - DWORD dwKeyState = pInfo->GetKeyboardState(); - CPoint pt(pInfo->GetPoint()); - ::ClientToScreen(pInfo->GetSafeHwnd(),&pt); - POINTL ptl; - ptl.x = pt.x; - ptl.y = pt.y; - DWORD dwEffect=0; - pdt->DragEnter(pInfo->GetDataObject()->m_lpDataObject, dwKeyState, ptl, &dwEffect); - pdt->DragLeave(); - pInfo->SetDropEffect(dwEffect); - pdt->Release(); - return true; -} - -bool CIEShellDragDrop::DragLeave(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CIEShellDragDrop::DragOver(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl) -{ - pInfo->SetDropEffect(DROPEFFECT_NONE); - - IDropTarget *pdt=NULL; - if (psfFolder == NULL) - psfFolder = m_psfDesktop; - HRESULT hr = psfFolder->GetUIObjectOf(pInfo->GetSafeHwnd(),1,(LPCITEMIDLIST*)&pidl, IID_IDropTarget, NULL, (LPVOID*)&pdt); - if (FAILED(hr)) - return false; - - DWORD dwKeyState = pInfo->GetKeyboardState(); - TRACE1("dwKeyState=%u\n",dwKeyState); - CPoint pt(pInfo->GetPoint()); - ::ClientToScreen(pInfo->GetSafeHwnd(),&pt); - POINTL ptl; - ptl.x = pt.x; - ptl.y = pt.y; - DWORD dwEffect=OleStdGetDropEffect(dwKeyState); - if (dwEffect == DROPEFFECT_NONE) - dwEffect = DROPEFFECT_MOVE | DROPEFFECT_COPY | DROPEFFECT_LINK; - TRACE1("dropEffect=%u\n",dwEffect); - pdt->DragEnter(pInfo->GetDataObject()->m_lpDataObject, dwKeyState, ptl, &dwEffect); - pdt->DragOver(dwKeyState, ptl, &dwEffect); - pdt->DragLeave(); - pdt->Release(); - pInfo->SetDropEffect(dwEffect); - return true; -} - -bool CIEShellDragDrop::DragDrop(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl) -{ - IDropTarget *pdt=NULL; - if (psfFolder == NULL) - psfFolder = m_psfDesktop; - HRESULT hr = psfFolder->GetUIObjectOf(pInfo->GetSafeHwnd(),1,(LPCITEMIDLIST*)&pidl, IID_IDropTarget, NULL, (LPVOID*)&pdt); - if (FAILED(hr)) - return false; - CPoint pt(pInfo->GetPoint()); - TRACE2("Drop received at point(client) %d,%d\n",pt.x,pt.y); - ::ClientToScreen(pInfo->GetSafeHwnd(),&pt); - TRACE2("Drop received at point(screen) %d,%d\n",pt.x,pt.y); - CWDClipboardData::Instance()->IsDataAvailable(pInfo->GetDataObject()); -#ifdef _DEBUG - if (pInfo->GetDataObject()->IsDataAvailable(CF_TEXT)) - { - CCF_String cfString; - if (CWDClipboardData::Instance()->GetData(pInfo->GetDataObject(),&cfString,CWDClipboardData::e_cfString)) - { - TRACE1("Received CF_TEXT %s\n",cfString.GetString()); - } - } - if (pInfo->GetDataObject()->IsDataAvailable(CF_HDROP)) - { - CCF_HDROP cfHDROP; - if (CWDClipboardData::Instance()->GetData(pInfo->GetDataObject(),&cfHDROP,CWDClipboardData::e_cfHDROP)) - { - for(UINT i=0;i < cfHDROP.GetCount();i++) - TRACE2("Received CF_HDROP %s (%u)\n",cfHDROP.GetFileName(i),i); - } - } -#endif - POINTL ptl; - ptl.x = pt.x; - ptl.y = pt.y; - DWORD dwKeyState = pInfo->GetKeyboardState(); - DWORD dw = DROPEFFECT_MOVE; - pdt->DragEnter(pInfo->GetDataObject()->m_lpDataObject, dwKeyState, ptl, &dw); - pdt->DragOver(dwKeyState, ptl, &dw); - DWORD dwEffect = m_ShellPidl.GetDragDropAttributes(pInfo->GetDataObject()); - TRACE2("Keyboardstate=%u DragDropEffect=%u\n",dwKeyState,dwEffect); - pdt->Drop(pInfo->GetDataObject()->m_lpDataObject, dwKeyState, ptl, &dwEffect); - pdt->Release(); - return true; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListCtrl.cpp deleted file mode 100644 index c040fcbe2fa..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListCtrl.cpp +++ /dev/null @@ -1,1310 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IEShellListCtrl.cpp : implementation file -#include "stdafx.h" -#include "IEShellListCtrl.h" -#include "UIMessages.h" -#include "dirwalk.h" -#include "cbformats.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#define UMAKEINT64(low,high) ((unsigned __int64)(((DWORD)(low)) | ((unsigned __int64)((DWORD)(high))) << 32)) -///////////////////////////////////////////////////////////////////////////// -// CIEShellListCtrl - -CIEShellListCtrl::CIEShellListCtrl() -{ - SetEditSubItems(false); - SetDropFiles(false); - ZeroMemory(&m_tvid,sizeof(m_tvid)); - m_psfSubFolder = NULL; - m_pMalloc = NULL; - m_bCallBack = false; - m_bNoExt = false; - m_nThreadCount = 0; - m_bRefreshAllowed = true; - m_bPopulateInit = false; - m_bInitiliazed = false; - m_bNotifyParent = false; - m_pidlInternet = NULL; - SHGetMalloc(&m_pMalloc); - SHGetSpecialFolderLocation(NULL,CSIDL_INTERNET,&m_pidlInternet); - m_sColumns = _T("Name|Size|Type|Modified"); -} - -CIEShellListCtrl::~CIEShellListCtrl() -{ - FreeTVID(); - AllItemsDeleted(); - if (m_pidlInternet) - m_pMalloc->Release(); - if (m_pMalloc) - m_pMalloc->Release(); -} - -void CIEShellListCtrl::PopupTheMenu(int nRow,CPoint point) -{ - if (!GetSelectedCount()) - return; - int nSel=-1; - LPLVITEMDATA lplvid=NULL; - LPITEMIDLIST *pidls=(LPITEMIDLIST*)GetShellPidl().GetMalloc()->Alloc(GetSelectedCount()*sizeof(LPITEMIDLIST)); - int i=0; - while ((nSel = GetNextSel(nSel)) != -1) - { - lplvid=(LPLVITEMDATA)GetItemData(nSel); - pidls[i] = lplvid->lpi; - i++; - } - // at least one - if (pidls && i) - { - GetShellPidl().PopupTheMenu(m_hWnd, lplvid->lpsfParent, pidls, i, &point); - } - GetShellPidl().Free(pidls); -} - -void CIEShellListCtrl::ShellExecute(int nRow,LPCTSTR pszVerb) -{ - SHELLEXECUTEINFO si; - ZeroMemory(&si,sizeof(si)); - si.cbSize = sizeof(si); - si.hwnd = GetSafeHwnd(); - si.nShow = SW_SHOW; - si.lpIDList = (LPVOID)GetPathPidl(nRow); - si.fMask = SEE_MASK_INVOKEIDLIST; - if (pszVerb) - si.lpVerb = pszVerb; - ShellExecuteEx(&si); -} - -void CIEShellListCtrl::SetNotificationObject(bool bNotify) -{ - if (bNotify) - CreateFileChangeThread(GetSafeHwnd()); - else - DestroyThreads(); -} - -void CIEShellListCtrl::FreeInterface(IUnknown *pInterface) -{ - if (pInterface) - pInterface->Release(); -} - -void CIEShellListCtrl::DestroyThreads() -{ - if (m_nThreadCount == 0) - return; - for (UINT i=0; iRelease(); - if (m_tvid.lpi) - m_pMalloc->Free(m_tvid.lpi); - if (m_tvid.lpifq) - m_pMalloc->Free(m_tvid.lpifq); - ZeroMemory(&m_tvid,sizeof(m_tvid)); - if (m_psfSubFolder) - m_psfSubFolder->Release(); - m_psfSubFolder = NULL; -} - -CString CIEShellListCtrl::GetCurrPathName() -{ - return GetPathName(GetCurSel()); -} - -CString CIEShellListCtrl::GetPathName(int nRow) -{ - if (nRow == -1) - nRow = GetCurSel(); - CString sPath; - if (nRow == -1) - return sPath; - LPLVITEMDATA plvit = (LPLVITEMDATA)GetItemData(nRow); - ASSERT(plvit); - if (plvit == NULL) - return sPath; - SHGetPathFromIDList(plvit->lpifq,sPath.GetBuffer(MAX_PATH)); - sPath.ReleaseBuffer(); - return sPath; -} - -LPCITEMIDLIST CIEShellListCtrl::GetPathPidl(int nRow) -{ - if (nRow == -1) - return NULL; - LPLVITEMDATA plvit = (LPLVITEMDATA)GetItemData(nRow); - ASSERT(plvit); - if (plvit == NULL) - return NULL; - return plvit->lpifq; -} - -void CIEShellListCtrl::FillExcludedFileTypes(CComboBox &cb) -{ - cb.ResetContent(); - for(POSITION pos=m_ExcludedLookup.GetHeadPosition();pos != NULL;m_ExcludedLookup.GetNext(pos)) - { - cb.AddString(m_ExcludedLookup.GetAt(pos)); - } -} - -void CIEShellListCtrl::SetExcludedFileTypes(CComboBox &cb) -{ - m_ExcludedLookup.RemoveAll(); - CString sText; - for(int i=0;i < cb.GetCount();i++) - { - cb.GetLBText(i,sText); - m_ExcludedLookup.AddHead(sText); - } -} - -void CIEShellListCtrl::LoadFilterFiles(const CString &sFileFilter) -{ - m_FilterLookup.RemoveAll(); - CFileFind ff; - CString sPath; - if (FAILED(GetShellPidl().SHPidlToPathEx(m_tvid.lpifq,sPath))) - return; - if (sPath.Right(1) != _T('\\')) - sPath += _T('\\'); - CString sFindPath; - CString sMask; - LPCTSTR pszFilter=sFileFilter; - pszFilter = GetFilterMask(pszFilter,sMask); - while (pszFilter != NULL) - { - sFindPath = sPath; - sFindPath += sMask; - BOOL bFind = ff.FindFile(sFindPath); - while (bFind) - { - bFind = ff.FindNextFile(); - m_FilterLookup.AddHead(ff.GetFilePath()); - } - pszFilter = GetFilterMask(pszFilter,sMask); - } -} - -LPCTSTR CIEShellListCtrl::GetFilterMask(LPCTSTR pszFilter,CString &sMask) -{ - if (*pszFilter == '\0') - return NULL; - TCHAR szMask[MAX_PATH]; - szMask[0] = 0; - for(int i=0;*pszFilter != '\0';i++) - { - if (*pszFilter == _T(';') || *pszFilter == _T(',')) - { - pszFilter = _tcsinc(pszFilter); - break; - } - szMask[i] = *pszFilter; - pszFilter = _tcsinc(pszFilter); - } - szMask[i] = 0; - sMask = szMask; - return pszFilter; -} - -void CIEShellListCtrl::AllItemsDeleted() -{ - LPLVITEMDATA pItemData=NULL; - for(vecListItemData::iterator it=m_vecItemData.begin();it != m_vecItemData.end();it++) - { - pItemData = *it; - if (pItemData) - { - if (pItemData->lpsfParent) - pItemData->lpsfParent->Release(); - if (pItemData->lpi) - m_pMalloc->Free(pItemData->lpi); - if (pItemData->lpifq) - m_pMalloc->Free(pItemData->lpifq); - if (pItemData->lParam) - { - PSLC_COLUMN_DATA pColData = (PSLC_COLUMN_DATA)pItemData->lParam; - if (pColData->pidl) - GetShellPidl().FreePidl(pColData->pidl); - delete pColData; - } - m_pMalloc->Free(pItemData); - } - } - m_vecItemData.erase(m_vecItemData.begin(),m_vecItemData.end()); -} - -void CIEShellListCtrl::StartPopulate() -{ - m_bPopulateInit = true; - DeleteAllItems(); - for(UINT i=0;i < m_nThreadCount;i++) - m_MonitorEvent[i].SetEvent(); - if (m_sFileFilter.IsEmpty() || m_sFileFilter == _T("*.*") || m_sFileFilter == _T("*")) - return; - LoadFilterFiles(m_sFileFilter); -} - -void CIEShellListCtrl::EndPopulate() -{ - m_bPopulateInit = false; - Sort(); - SetColumnWidths(); -} - -BOOL CIEShellListCtrl::Populate(LPTVITEMDATA lptvid) -{ - IShellFolder *pFolder=NULL; - BOOL bRet=FALSE; - HRESULT hr=E_FAIL; - if (lptvid->lpsfParent) - { - hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,0,IID_IShellFolder,(LPVOID*)&pFolder); - } - else - { - LPSHELLFOLDER psfDesktop; - LPITEMIDLIST pidlDesktop=NULL; - hr=SHGetDesktopFolder(&psfDesktop); - SHGetSpecialFolderLocation(NULL,CSIDL_DESKTOP,&pidlDesktop); - if (GetShellPidl().ComparePidls(NULL,lptvid->lpifq,pidlDesktop)) - { - pFolder = psfDesktop; - } - else - { - hr=psfDesktop->BindToObject(lptvid->lpifq,0,IID_IShellFolder,(LPVOID*)&pFolder); - psfDesktop->Release(); - } - if (pidlDesktop) - GetShellPidl().FreePidl(pidlDesktop); - } - if (SUCCEEDED(hr)) - { - bRet = Populate(lptvid,pFolder,true); - pFolder->Release(); - } - return bRet; -} - -BOOL CIEShellListCtrl::Populate(LPCTSTR pszPath, bool bCallBack) -{ - LPITEMIDLIST pidlfq=NULL; - LPITEMIDLIST pidl=NULL; - LPSHELLFOLDER pDesktop = NULL; - SHGetDesktopFolder(&pDesktop); - if (FAILED(GetShellPidl().SHPathToPidlEx(pszPath,&pidlfq,pDesktop))) - return FALSE; - LPSHELLFOLDER pSubFolder = NULL; -#if 1 // bug fix by Dion Loy - if (FAILED(pDesktop->BindToObject(pidlfq, 0, IID_IShellFolder,(LPVOID*)&pSubFolder))) -#else - if (FAILED(pDesktop->BindToObject(pidl, 0, IID_IShellFolder,(LPVOID*)&pSubFolder))) -#endif - return FALSE; - pidl = GetShellPidl().CopyLastItemID(pidlfq); - TVITEMDATA tvid; - tvid.lpifq = pidlfq; - tvid.lpi = pidl; - tvid.lpsfParent = NULL; - BOOL bRet = Populate(&tvid,pSubFolder,bCallBack); - if (pDesktop) - pDesktop->Release(); - if (pSubFolder) - pSubFolder->Release(); - if (pidl) - m_pMalloc->Free(pidl); - if (pidlfq) - m_pMalloc->Free(pidlfq); - - return bRet; -} - -BOOL CIEShellListCtrl::Populate(LPTVITEMDATA lptvid,LPSHELLFOLDER psfFolder,bool bCallBack) -{ - m_bCallBack = bCallBack; - FreeTVID(); - m_tvid.lpi = GetShellPidl().CopyItemIDList(lptvid->lpi); - m_tvid.lpifq = GetShellPidl().CopyItemIDList(lptvid->lpifq); -#ifdef _DEBUG - CString sPath; - GetShellPidl().SHPidlToPathEx(m_tvid.lpifq,sPath,NULL); - TRACE1("Populating path %s in CIEShellListCtrl\n",sPath); -#endif - if (lptvid->lpsfParent) - { - m_tvid.lpsfParent = lptvid->lpsfParent; - m_tvid.lpsfParent->AddRef(); - } - m_psfSubFolder = psfFolder; - m_psfSubFolder->AddRef(); - Load(); - return TRUE; -} - -CString CIEShellListCtrl::GetColumns() -{ - SHELLDETAILS sd; - LPTSTR pszHeader=NULL; - CString sColumns; - for(int i=0;SUCCEEDED(m_ShellDetails.GetDetailsOf(NULL,i,&sd));i++) - { - GetShellPidl().StrRetToStr(sd.str,&pszHeader,NULL); - if (pszHeader) - { - TRACE1("Column found %s\n",pszHeader); - if (!sColumns.IsEmpty()) - sColumns += _T("|"); - sColumns += pszHeader; - GetShellPidl().Free(pszHeader); - pszHeader= NULL; - } - } - return sColumns; -} - -void CIEShellListCtrl::InitColumns() -{ - CString sColumns = GetColumns(); - if (sColumns.IsEmpty()) - sColumns = m_sColumns; - InitListCtrl(sColumns); -} - -void CIEShellListCtrl::SetColumnWidths() -{ - if (!m_bCallBack) - { - for(int i=0;i < GetColumnCount();i++) - SetColumnWidth(i,LVSCW_AUTOSIZE); - } -} - -void CIEShellListCtrl::Refresh() -{ - if (m_psfSubFolder==NULL) - return; - SetRefreshAllowed(false); - SetRedraw(FALSE); - int nCurSel = GetCurSel(); - TRACE(_T("Refreshing shell list control\n")); - Load(); - SetCurSel(nCurSel); - LONG Result; - OnSelChanged(nCurSel,&Result); - SetRedraw(TRUE); - SetRefreshAllowed(true); -} - -void CIEShellListCtrl::Load() -{ - CWaitCursor w; - if (!InitItems(&m_tvid,m_bCallBack)) - return; -} - -void CIEShellListCtrl::Init() -{ - if (m_bInitiliazed) - return; - CUIODListCtrl::Init(); - InitShellSettings(); - InitImageLists(); - m_bInitiliazed = true; -} - -BOOL CIEShellListCtrl::InitItems(LPTVITEMDATA lptvid, bool bCallBack) -{ - CWaitCursor w; - - Init(); - - ASSERT(m_psfSubFolder); - if (m_psfSubFolder == NULL) - return FALSE; - - // Try to initialize columns from shell - m_ShellDetails.SetShellDetails(NULL); - IShellFolder2 *pShellFolder2=NULL; - HRESULT hr=m_psfSubFolder->QueryInterface(IID_IShellFolder2,(LPVOID*)&pShellFolder2); - if (SUCCEEDED(hr)) - { - LPUNKNOWN pUnk=NULL; - if (SUCCEEDED(pShellFolder2->QueryInterface(IID_IUnknown,(LPVOID*)&pUnk))) - { - m_ShellDetails.SetShellDetails(pUnk); - pUnk->Release(); - } - m_ShellDetails.SetShellDetails((LPUNKNOWN)pShellFolder2); - pShellFolder2->Release(); - } - else - { - IShellDetails *pShellDetails=NULL; - HRESULT hr = m_psfSubFolder->CreateViewObject(GetSafeHwnd(), IID_IShellDetails, (LPVOID*)&pShellDetails); - if (SUCCEEDED(hr)) - { - LPUNKNOWN pUnk=NULL; - if (SUCCEEDED(pShellDetails->QueryInterface(IID_IUnknown,(LPVOID*)&pUnk))) - { - m_ShellDetails.SetShellDetails(pUnk); - pUnk->Release(); - } - pShellDetails->Release(); - } - } - InitColumns(); - - DWORD dwExStyle = GetExStyle(); - if(!m_ShellSettings.DoubleClickInWebView()) - { - dwExStyle |= LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT; - } - else - { - dwExStyle &= ~LVS_EX_ONECLICKACTIVATE; - dwExStyle &= ~LVS_EX_TRACKSELECT; - dwExStyle &= ~LVS_EX_UNDERLINEHOT; - } - SetExStyle(dwExStyle); - - LPITEMIDLIST lpi=NULL; - LPENUMIDLIST lpe=NULL; - LPLVITEMDATA lplvid=NULL; - LPSHELLFOLDER lpsf=m_psfSubFolder; - ULONG ulFetched, ulAttrs; - HWND hwnd=::GetParent(m_hWnd); - DWORD dwFlags = SHCONTF_NONFOLDERS; - - if (GetShellSettings().ShowAllObjects() && !GetShellSettings().ShowSysFiles()) - dwFlags |= SHCONTF_INCLUDEHIDDEN; - hr=lpsf->EnumObjects(hwnd,dwFlags, &lpe); - - if (FAILED(hr)) - return FALSE; - - bool bEndPopulate=false; - if (m_bPopulateInit == false) - { - StartPopulate(); - bEndPopulate = true; - } - while (NO_ERROR==lpe->Next(1, &lpi, &ulFetched)) - { - ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER | SFGAO_DISPLAYATTRMASK | SFGAO_CONTENTSMASK | SFGAO_REMOVABLE; - lpsf->GetAttributesOf(1, (LPCITEMIDLIST*)&lpi, &ulAttrs); - if (!FilterItem(lpsf,lpi,ulAttrs)) - { - m_pMalloc->Free(lpi); // free PIDL the shell gave you - lpi=NULL; - continue; - } - lplvid = (LPLVITEMDATA)m_pMalloc->Alloc(sizeof(LVITEMDATA)); - if (!lplvid) - break; - ZeroMemory(lplvid,sizeof(LVITEMDATA)); - m_vecItemData.push_back(lplvid); - - lplvid->ulAttribs=ulAttrs; - - lplvid->lpifq=m_ShellPidl.ConcatPidl(lptvid->lpifq, lpi); - - lplvid->lpsfParent=lpsf; - lplvid->lpsfParent->AddRef(); - - // Now make a copy of the ITEMIDLIST. - lplvid->lpi=m_ShellPidl.CopyItemID(lpi); - - // Add the item to the list view control. - int nRow=-1; - if (bCallBack) - { - nRow = AddCallBackItem((DWORD)lplvid,I_IMAGECALLBACK); - if ((ulAttrs & SFGAO_COMPRESSED) && m_ShellSettings.ShowCompColor()) - SetTextColor(nRow,0,RGB(0,0,255)); - else - SetDefaultTextColor(nRow,-1); - } - else - { - nRow = AddTextItem(); - if (nRow != -1) - { - TCHAR szText[MAX_PATH+1]; - SetItemData(nRow,(DWORD)lplvid); - LV_DISPINFO dsp; - ZeroMemory(&dsp,sizeof(LV_DISPINFO)); - dsp.item.mask |= (LVIF_TEXT | LVIF_IMAGE); - for(int i=0; i < GetColumnCount();i++) - { - szText[0] = 0; - dsp.item.iItem = nRow; - dsp.item.iSubItem = i; - dsp.item.cchTextMax = MAX_PATH; - dsp.item.pszText = szText; - if (i > 0) - dsp.item.mask &= ~LVIF_IMAGE; - m_bCallBack = true; - GetDispInfo(&dsp); - m_bCallBack = false; - SetIcon(nRow,dsp.item.iImage); - AddString(nRow,i,szText); - } - } - } - m_pMalloc->Free(lpi); // free PIDL the shell gave you - lpi=NULL; - } - - if (lpe) - lpe->Release(); - - // The following two if statements will be TRUE only if you got here - // on an error condition from the goto statement. Otherwise, free - // this memory at the end of the while loop above. - if (lpi) - m_pMalloc->Free(lpi); - - if (bEndPopulate) - EndPopulate(); - return TRUE; -} - -bool CIEShellListCtrl::FilterItem(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl,UINT ulAttrs) -{ - if ((m_sFileFilter.IsEmpty() || m_sFileFilter == _T("*.*") || m_sFileFilter == _T("*")) - && m_ExcludedLookup.IsEmpty()) - return true; - bool bRet=false; - if (m_sFileFilter == _T("*.*") || m_sFileFilter == _T("*")) - { - bRet=true; - } - else if (!m_sFileFilter.IsEmpty()) - { - CString sPath; - GetShellPidl().SHPidlToPathEx(pidl,sPath,pFolder); - if (m_FilterLookup.Find(sPath)) - bRet = true; - } - if (bRet == false) - return bRet; - if (!m_ExcludedLookup.IsEmpty()) - { - SHFILEINFO fileInfo; - ZeroMemory(&fileInfo,sizeof(fileInfo)); - SHGetFileInfo((LPCTSTR)pidl, NULL, &fileInfo, sizeof(fileInfo), SHGFI_PIDL|SHGFI_TYPENAME); - if (m_ExcludedLookup.Find(fileInfo.szTypeName)) - { - bRet = false; - } - } - return bRet; -} - -void CIEShellListCtrl::InitShellSettings() -{ - m_ShellSettings.GetSettings(); -} - -BOOL CIEShellListCtrl::InitImageLists() -{ - HIMAGELIST himlSmall; - HIMAGELIST himlLarge; - SHFILEINFO sfi; - BOOL bSuccess=TRUE; - - himlSmall = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T("C:\\"), - 0, - &sfi, - sizeof(SHFILEINFO), - SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - himlLarge = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T("C:\\"), - 0, - &sfi, - sizeof(SHFILEINFO), - SHGFI_SYSICONINDEX | SHGFI_LARGEICON); - - if (himlSmall && himlLarge) - { - ::SendMessage(GetSafeHwnd(), LVM_SETIMAGELIST, (WPARAM)LVSIL_SMALL, - (LPARAM)himlSmall); - ::SendMessage(GetSafeHwnd(), LVM_SETIMAGELIST, (WPARAM)LVSIL_NORMAL, - (LPARAM)himlLarge); - } - else - bSuccess = FALSE; - - return bSuccess; -} - -BEGIN_MESSAGE_MAP(CIEShellListCtrl, CUIODListCtrl) - //{{AFX_MSG_MAP(CIEShellListCtrl) - ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring) - ON_MESSAGE(WM_SETTINGCHANGE,OnSettingChange) - // NOTE - the ClassWizard will add and remove mapping macros here. - ON_WM_DESTROY() - ON_WM_MENUSELECT() - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_ON_DELETE_KEY,OnAppDeleteKey) - ON_MESSAGE(WM_APP_ON_PROPERTIES_KEY,OnAppPropertiesKey) - ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS,OnAppUpdateAllViews) - ON_MESSAGE(WM_APP_FILE_CHANGE_NEW_PATH,OnAppFileChangeNewPath) - ON_MESSAGE(WM_APP_FILE_CHANGE_EVENT,OnAppFileChangeEvent) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEShellListCtrl message handlers -void CIEShellListCtrl::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) -{ - CUIODListCtrl::OnMenuSelect(nItemID,nFlags,hSysMenu); -} - -void CIEShellListCtrl::ShowPopupMenu(int nRow,int nCol,CPoint point) -{ - if ((nCol > 0 || nRow == -1) || (m_PopupID || m_MultiPopupID)) - { - CUIODListCtrl::ShowPopupMenu(nRow,nCol,point); - return; - } - PopupTheMenu(nRow,point); -} - -void CIEShellListCtrl::OnDestroy() -{ - SetImageList(NULL,LVSIL_SMALL); - SetImageList(NULL,LVSIL_NORMAL); - DestroyThreads(); - CUIODListCtrl::OnDestroy(); -} - -bool CIEShellListCtrl::UseShellColumns() -{ - return m_ShellDetails.IsValidDetails(); -} - -BOOL CIEShellListCtrl::GetDispInfo(LV_DISPINFO *pDispInfo) -{ - // TODO: Add your specialized code here and/or call the base class - if (m_psfSubFolder == NULL || m_bCallBack == false) - return CUIODListCtrl::GetDispInfo(pDispInfo); - LPLVITEMDATA lplvid = (LPLVITEMDATA)GetItemData(pDispInfo->item.iItem); - ASSERT(lplvid); - if (lplvid == NULL) - return FALSE; - PSLC_COLUMN_DATA pColData=(PSLC_COLUMN_DATA)lplvid->lParam; - if (pColData == NULL) - { - pColData = new SLC_COLUMN_DATA; - pColData->sItems.SetSize(GetColumnCount()); - lplvid->lParam = (LPARAM)pColData; - } - if (pColData->pidl == NULL) - pColData->pidl = m_ShellPidl.ConcatPidl(m_tvid.lpifq, lplvid->lpi); - if (pDispInfo->item.mask & LVIF_IMAGE) - { - if (pColData->iImage == -1) - { - pColData->iImage = m_ShellPidl.GetIcon(pColData->pidl,SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - } - pDispInfo->item.iImage = pColData->iImage; - if (lplvid->ulAttribs & SFGAO_GHOSTED) - { - pDispInfo->item.mask |= LVIF_STATE; - pDispInfo->item.stateMask = LVIS_CUT; - pDispInfo->item.state = LVIS_CUT; - } - if (lplvid->ulAttribs & SFGAO_LINK) - { - pDispInfo->item.mask |= LVIF_STATE; - pDispInfo->item.stateMask = LVIS_OVERLAYMASK; - pDispInfo->item.state = INDEXTOOVERLAYMASK(2); - } - if (lplvid->ulAttribs & SFGAO_SHARE) - { - pDispInfo->item.mask |= LVIF_STATE; - pDispInfo->item.stateMask = LVIS_OVERLAYMASK; - pDispInfo->item.state = INDEXTOOVERLAYMASK(1); - } - } - if (pDispInfo->item.mask & LVIF_TEXT) - { - if (UseShellColumns()) - { - if (pDispInfo->item.iSubItem == COL_NAME) - { - if (pColData->sItems[pDispInfo->item.iSubItem].IsEmpty()) - m_ShellPidl.GetName(lplvid->lpsfParent, lplvid->lpi, SHGDN_NORMAL, pColData->sItems[pDispInfo->item.iSubItem]); - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - if (m_bNoExt) - RemoveExt(pDispInfo->item.pszText); - } - else - { - if (pColData->sItems[pDispInfo->item.iSubItem].IsEmpty()) - { - SHELLDETAILS sd; - ZeroMemory(&sd,sizeof(sd)); - HRESULT hr = m_ShellDetails.GetDetailsOf(lplvid->lpi,pDispInfo->item.iSubItem,&sd); - LPTSTR pszText=NULL; - GetShellPidl().StrRetToStr(sd.str,&pszText,lplvid->lpi); - if (pszText) - { - _tcscpy(pDispInfo->item.pszText,pszText); - GetShellPidl().Free(pszText); - } - } - else - { - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - } - } - } - else - { - GetText(pColData,pDispInfo,lplvid); - } - } - return TRUE; -} - -bool CIEShellListCtrl::GetColText(int nCol,LPCITEMIDLIST pidlAbs,LPLVITEMDATA lplvid,CString &sText) -{ - return false; -} - -void CIEShellListCtrl::GetText(PSLC_COLUMN_DATA pColData,LV_DISPINFO *pDispInfo,LPLVITEMDATA lplvid) -{ - if (!pColData->sItems[pDispInfo->item.iSubItem].IsEmpty()) - { - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - return; - } - LPITEMIDLIST pidlAbs = pColData->pidl; - CString sText; - if (GetColText(pDispInfo->item.iSubItem,pidlAbs,lplvid,sText)) - { - pColData->sItems[pDispInfo->item.iSubItem] = sText; - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - return; - } - if (pDispInfo->item.iSubItem == COL_NAME) - { - if (pColData->sItems[pDispInfo->item.iSubItem].IsEmpty()) - m_ShellPidl.GetName(lplvid->lpsfParent, lplvid->lpi, SHGDN_NORMAL,pColData->sItems[pDispInfo->item.iSubItem]); - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - if (m_bNoExt) - RemoveExt(pDispInfo->item.pszText); - } - else if (pDispInfo->item.iSubItem == COL_TYPE) - { - if (pColData->sItems[pDispInfo->item.iSubItem].IsEmpty()) - { - SHFILEINFO fileInfo; - if (SHGetFileInfo((LPCTSTR)lplvid->lpi, NULL, &fileInfo, sizeof(fileInfo), SHGFI_PIDL|SHGFI_TYPENAME)) - { - pColData->sItems[pDispInfo->item.iSubItem] = fileInfo.szTypeName; - } - } - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - } - else if (pDispInfo->item.iSubItem == COL_SIZE || pDispInfo->item.iSubItem == COL_MODIFIED) - { - if (pColData->sItems[COL_SIZE].IsEmpty() || (pColData->sItems[COL_MODIFIED].IsEmpty())) - { - CString sSize; - CString sDateTime; - GetFileDetails(pidlAbs,sSize,sDateTime); - if (pDispInfo->item.iSubItem == COL_SIZE) - pColData->sItems[pDispInfo->item.iSubItem] = sSize; - else if (pDispInfo->item.iSubItem == COL_MODIFIED) - pColData->sItems[pDispInfo->item.iSubItem] = sDateTime; - } - if (pDispInfo->item.iSubItem == COL_SIZE) - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - else if (pDispInfo->item.iSubItem == COL_MODIFIED) - _tcscpy(pDispInfo->item.pszText,pColData->sItems[pDispInfo->item.iSubItem]); - } -} - -void CIEShellListCtrl::GetFileDetails(LPCITEMIDLIST pidl, CString &sSize, CString &sDateTime) -{ - CString sPath; - GetShellPidl().SHPidlToPathEx((LPITEMIDLIST)pidl,sPath,NULL); - if (sPath.GetLength() <= 3) - return; - WIN32_FIND_DATA FindFileData; - HANDLE hFind = FindFirstFile(sPath,&FindFileData); - if (hFind != INVALID_HANDLE_VALUE) - { - if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - { - unsigned __int64 fs = UMAKEINT64(FindFileData.nFileSizeLow, FindFileData.nFileSizeHigh); - unsigned __int64 kb=1; - TCHAR szText[1024]; - if (fs > 1024) - { - kb = fs / 1024; - if (fs % 1024) - kb++; - } - _ui64tot(kb,szText,10); - sSize = szText; - AddThousandSeps(sSize); - sSize += _T(" KB"); - } - if ((FindFileData.ftLastWriteTime.dwLowDateTime != 0) || (FindFileData.ftLastWriteTime.dwHighDateTime != 0)) - { - sDateTime = CLocaleInfo::Instance()->FormatDateTime(FindFileData.ftLastWriteTime); - } - else - { - sDateTime = CLocaleInfo::Instance()->FormatDateTime(FindFileData.ftCreationTime); - } - FindClose(hFind); - } -} - -void CIEShellListCtrl::RemoveExt(LPTSTR pszFileName) -{ - if (pszFileName == NULL) - return; - LPTSTR pExtPos=NULL; - LPTSTR pEndPos = pszFileName+lstrlen(pszFileName); - LPTSTR pStartPos = pszFileName; - while (pEndPos > pStartPos) - { - if (*pEndPos == '.') - { - pExtPos = pEndPos; - break; - } - pEndPos = _tcsdec(pStartPos,pEndPos); - } - if (pExtPos) - *pExtPos = '\0'; -} - -int CALLBACK ShellCompareFunc(LPARAM lparam1, - LPARAM lparam2, - LPARAM lparamSort); - -PFNLVCOMPARE CIEShellListCtrl::GetCompareFunc() -{ - if (m_bCallBack) - return ShellCompareFunc; - return CUIODListCtrl::GetCompareFunc(); -} - -int CALLBACK ShellCompareFunc(LPARAM lParam1, - LPARAM lParam2, - LPARAM lParamSort) -{ - CUIListCtrlData *pData1 = (CUIListCtrlData*)lParam1; - CUIListCtrlData *pData2 = (CUIListCtrlData*)lParam2; - LPLVITEMDATA lplvid1=(LPLVITEMDATA)pData1->GetExtData(); - LPLVITEMDATA lplvid2=(LPLVITEMDATA)pData2->GetExtData(); - CUIODListCtrlSortInfo *pSortInfo = (CUIODListCtrlSortInfo*)lParamSort; - int nRet=0; - HRESULT hr = lplvid1->lpsfParent->CompareIDs(pSortInfo->GetColumn(),lplvid1->lpi,lplvid2->lpi); - if (SUCCEEDED(hr)) - nRet = (short)hr; - if (!pSortInfo->Ascending()) - nRet = -nRet; - return nRet; -} - -///////////////////////////////////////////////////////////////////////// -// Thread function for detecting file system changes -UINT CIEShellListCtrl::ThreadFunc (LPVOID pParam) -{ - /////////////////////// - PFC_THREADINFO pThreadInfo = (PFC_THREADINFO)pParam; - HANDLE hEvent = pThreadInfo->hEvent; - HANDLE hMonitorEvent = pThreadInfo->hMonitorEvent; - CIEShellListCtrl *pListCtrl = pThreadInfo->pListCtrl; - HWND hWnd = pListCtrl->GetSafeHwnd(); - delete pThreadInfo; - //////////////////////// - TCHAR szPath[MAX_PATH]; - int nHandles=2; - int nRet=0; - HANDLE hFileChange=NULL; - HANDLE aHandles[3]; - aHandles[0] = hMonitorEvent; - aHandles[1] = hEvent; - aHandles[2] = NULL; - BOOL bContinue = TRUE; - // Sleep until a file change notification wakes this thread or - // m_event becomes set indicating it's time for the thread to end. - while (bContinue) - { - TRACE(_T("ListControl waiting for %u multiple objects\n"),nHandles); - DWORD dw = ::WaitForMultipleObjects (nHandles, aHandles, FALSE, INFINITE); - if (dw >= WAIT_ABANDONED && dw <= (WAIT_ABANDONED+(nHandles-1))) - { - TRACE(_T("ListControl waiting abandoned\n"),nHandles); - break; - } - // Reset Event - if(dw - WAIT_OBJECT_0 == 0) - { - if (hFileChange && hFileChange != INVALID_HANDLE_VALUE) - ::FindCloseChangeNotification(hFileChange); - if (::SendMessage(hWnd, WM_APP_FILE_CHANGE_NEW_PATH, (WPARAM)szPath, 0)) - { - if (szPath[0] == 0) - { - TRACE(_T("File notify path was returned empty\n")); - hFileChange = NULL; - aHandles[2] = hFileChange; - continue; - } - TRACE(_T("File notify path returned %s\n"),szPath); - hFileChange = ::FindFirstChangeNotification (szPath, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE); - if (hFileChange == INVALID_HANDLE_VALUE) - { - TRACE(_T("File notify thread was unable to create notification object\n")); - hFileChange = NULL; - aHandles[2] = hFileChange; - continue; - } - else - { - if (nHandles == 2) - { - TRACE(_T("File notify thread has created the notification object for the first time\n")); - nHandles++; - } - TRACE(_T("File notify thread has created the notification object\n")); - aHandles[2] = hFileChange; - } - } - } - // End Event - else if(dw - WAIT_OBJECT_0 == 1) - { - bContinue = FALSE; - TRACE(_T("File Notify Thread was signalled to stop\n")); - } - // File Change Event - else if (dw - WAIT_OBJECT_0 == 2) - { // Respond to a change notification. - ::FindNextChangeNotification (hFileChange); - TRACE(_T("-- File notify event was fired in CIEShellListCtrl --\n")); - if (pListCtrl->RefreshAllowed()) - { - ::PostMessage (hWnd, WM_APP_FILE_CHANGE_EVENT,0,0); - } - else - { - TRACE(_T("but not sending as refreshing\n")); - pListCtrl->SetRefreshAllowed(true); - TRACE(_T("Refresh is now allowed\n")); - } - } - } - if (hFileChange && hFileChange != INVALID_HANDLE_VALUE) - ::FindCloseChangeNotification (hFileChange); - TRACE(_T("File Notify Thread is ending\n")); - return nRet; -} - -LRESULT CIEShellListCtrl::OnAppFileChangeNewPath(WPARAM wParam, LPARAM lParam) -{ - ASSERT(wParam); - SHGetPathFromIDList(m_tvid.lpifq,(LPTSTR)wParam); - return 1; -} - -LRESULT CIEShellListCtrl::OnAppFileChangeEvent(WPARAM wParam, LPARAM lParam) -{ - if (!RefreshAllowed()) - return 1L; - Refresh(); - if (m_bNotifyParent) - GetParent()->SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)HINT_SHELL_FILE_CHANGED,(LPARAM)(LPCTSTR)m_sMonitorPath); - return 1L; -} - -void CIEShellListCtrl::PreSubclassWindow() -{ - CUIODListCtrl::PreSubclassWindow(); - CreateFileChangeThread(GetSafeHwnd()); -} - -void CIEShellListCtrl::CreateFileChangeThread(HWND hwnd) -{ - if (m_nThreadCount >= MAX_THREADS) - return; - PFC_THREADINFO pThreadInfo = new FC_THREADINFO; // Thread will delete - pThreadInfo->hMonitorEvent = m_MonitorEvent[m_nThreadCount].m_hObject; - pThreadInfo->hEvent = m_event[m_nThreadCount].m_hObject; - pThreadInfo->pListCtrl = this; - - CWinThread* pThread = AfxBeginThread (ThreadFunc, pThreadInfo, - THREAD_PRIORITY_IDLE); - - pThread->m_bAutoDelete = FALSE; - m_hThreads[m_nThreadCount] = pThread->m_hThread; - m_pThreads[m_nThreadCount++] = pThread; -} - -bool CIEShellListCtrl::DragDrop(CDD_OleDropTargetInfo *pInfo) -{ - // TODO: Add your specialized code here and/or call the base class - return m_ShellDragDrop.DragDrop(pInfo,m_tvid.lpsfParent,m_tvid.lpi); -} - -bool CIEShellListCtrl::DragEnter(CDD_OleDropTargetInfo *pInfo) -{ - // TODO: Add your specialized code here and/or call the base class - return m_ShellDragDrop.DragEnter(pInfo,m_tvid.lpsfParent,m_tvid.lpi); -} - -bool CIEShellListCtrl::DragLeave(CDD_OleDropTargetInfo *pInfo) -{ - // TODO: Add your specialized code here and/or call the base class - return m_ShellDragDrop.DragLeave(pInfo); -} - -bool CIEShellListCtrl::DragOver(CDD_OleDropTargetInfo *pInfo) -{ - // TODO: Add your specialized code here and/or call the base class - return m_ShellDragDrop.DragOver(pInfo,m_tvid.lpsfParent,m_tvid.lpi); -} - -// When the use starts a drag drop source -DROPEFFECT CIEShellListCtrl::DoDragDrop(int *pnRows,COleDataSource *pOleDataSource) -{ - CShellPidl pidl; - CCF_ShellIDList sl; - CCF_HDROP cf_hdrop; - CCF_String cf_text; - cf_hdrop.AddDropPoint(CPoint(),FALSE); - CString sPath; - CString sText; - LPLVITEMDATA plvid=NULL; - if (GetShellPidl().IsDesktopFolder(m_psfSubFolder)) - sl.AddPidl(GetShellPidl().GetEmptyPidl()); - else - sl.AddPidl(m_tvid.lpifq); - for(int i=0;*pnRows != -1;i++) - { - plvid = (LPLVITEMDATA)GetItemData(*pnRows); - ASSERT(plvid); - sl.AddPidl(plvid->lpi); - pidl.SHPidlToPathEx(plvid->lpi,sPath,plvid->lpsfParent); - cf_hdrop.AddFileName(sPath); - sText += sPath; - sText += _T("\n"); - pnRows++; - } - cf_text.SetString(sText); - if (i > 0) - { - CWDClipboardData::Instance()->SetData(pOleDataSource,&cf_text,CWDClipboardData::e_cfString); - CWDClipboardData::Instance()->SetData(pOleDataSource,&sl,CWDClipboardData::e_cfShellIDList); - CWDClipboardData::Instance()->SetData(pOleDataSource,&cf_hdrop,CWDClipboardData::e_cfHDROP); - } - return GetShellPidl().GetDragDropAttributes(plvid); -} - - -LRESULT CIEShellListCtrl::OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam) -{ - if (wParam == HINT_TREE_SEL_CHANGED) - { - ASSERT(lParam); - const CRefreshShellFolder *pRefresh = reinterpret_cast(lParam); - if (pRefresh) - { - LPTVITEMDATA lptvid = reinterpret_cast(pRefresh->GetItemData()); - ASSERT(lptvid); - if (lptvid == NULL) - return 1L; - bool bInternet=GetShellPidl().ComparePidls(NULL,lptvid->lpifq,m_pidlInternet); - if (GetParent()) - GetParent()->SendMessage(WM_APP_UPDATE_ALL_VIEWS,HINT_TREE_INTERNET_FOLDER_SELECTED,(LPARAM)(bInternet ? 1 : 0)); - if (bInternet == false) - Populate(lptvid); - } - } - return 1L; -} - -LRESULT CIEShellListCtrl::OnSettingChange(WPARAM wParam,LPARAM lParam) -{ - InitShellSettings(); - Refresh(); - LPCTSTR lpszSection=(LPCTSTR)lParam; - TRACE1("OnSettingsChange in CIEShellListCtrl with %s\n",lpszSection ? lpszSection : _T("null")); - return 1L; -} - -BOOL CIEShellListCtrl::DoubleClick(NM_LISTVIEW* pNMListView) -{ - // TODO: Add your specialized code here and/or call the base class - if (m_ShellSettings.DoubleClickInWebView()) - { - ShellExecute(pNMListView->iItem); - return TRUE; - } - return CUIODListCtrl::DoubleClick(pNMListView); -} - -BOOL CIEShellListCtrl::OnEnter(NM_LISTVIEW* pNMListView) -{ - // TODO: Add your specialized code here and/or call the base class - ShellExecute(pNMListView->iItem); - return TRUE; -} - -LRESULT CIEShellListCtrl::OnAppDeleteKey(WPARAM wParam, LPARAM lParam) -{ - // TODO: Add your specialized code here and/or call the base class - UINT nSize = GetSelectedCount()*MAX_PATH; - if (nSize == 0) - return 0L; - SetRefreshAllowed(false); - SHFILEOPSTRUCT shf; - ZeroMemory(&shf,sizeof(shf)); - LPTSTR pszFrom=new TCHAR[nSize]; - LPTSTR pszStartFrom=pszFrom; - ZeroMemory(pszFrom,nSize*sizeof(TCHAR)); - CString sPath; - int item=-1; - while ((item = GetNextSel(item)) != -1) - { - sPath = GetPathName(item); - lstrcpy(pszFrom,(LPCTSTR)sPath); - pszFrom += sPath.GetLength()+1; - } - shf.hwnd = GetSafeHwnd(); - shf.wFunc = FO_DELETE; - shf.pFrom = (LPCTSTR)pszStartFrom; - shf.fFlags = GetKeyState(VK_SHIFT) < 0 ? 0 : FOF_ALLOWUNDO; - if (SHFileOperation(&shf) != 0) - SetRefreshAllowed(true); - delete []pszStartFrom; - return 1L; -} - -LRESULT CIEShellListCtrl::OnAppPropertiesKey(WPARAM wParam, LPARAM lParam) -{ - // TODO: Add your specialized code here and/or call the base class - if (GetSelectedCount() == 0) - return 0L; - SHELLEXECUTEINFO si; - ZeroMemory(&si,sizeof(si)); - si.cbSize = sizeof(si); - si.hwnd = GetSafeHwnd(); - si.nShow = SW_SHOW; - si.fMask = SEE_MASK_INVOKEIDLIST; - si.lpVerb = _T("properties"); - int item=GetCurSel(); - while ((item = GetNextSel(item)) != -1) - { - CString sPath(GetPathName(item)); - si.lpFile = (LPCTSTR)sPath; - ShellExecuteEx(&si); - } - return 1L; -} - -bool CIEShellListCtrl::EndLabelEdit(int nRow,int nCol,LPCTSTR pszText) -{ - // TODO: Add your specialized code here and/or call the base class - if (nCol != 0) - return CUIODListCtrl::EndLabelEdit(nRow,nCol,pszText); - CString sFromPath(GetPathName(nRow)); - CString sToPath; - CSplitPath path(sFromPath); - if (GetShellSettings().ShowExtensions()) - { - CSplitPath file(pszText); - path.SetFileName(file.GetFileName()); - path.SetExt(file.GetExt()); - } - else - { - path.SetFileName(pszText); - } - path.Make(); - sToPath = path.GetPath(); - SHFILEOPSTRUCT shf; - TCHAR szFrom[MAX_PATH+1]; - TCHAR szTo[MAX_PATH+1]; - ZeroMemory(szFrom,sizeof(szFrom)); - lstrcpy(szFrom,sFromPath); - ZeroMemory(szTo,sizeof(szTo)); - lstrcpy(szTo,sToPath); - ZeroMemory(&shf,sizeof(shf)); - shf.hwnd = GetSafeHwnd(); - shf.wFunc = FO_RENAME; - shf.pFrom = szFrom; - shf.pTo = szTo; -#ifdef _DEBUG - CString sMess; - sMess = szFrom; - sMess += _T("\n"); - sMess += szTo; - AfxMessageBox(sMess); -#endif - int nRet = SHFileOperation(&shf); - TRACE1("SHFileOperation returned %u\n",nRet); - return false; -} - -void CIEShellListCtrl::GoBack(int nRow) -{ - // TODO: Add your specialized code here and/or call the base class - AfxMessageBox(_T("Needs to be implemented")); -} - -void CIEShellListCtrl::ChangeStyle(UINT &dwStyle) -{ - // TODO: Add your specialized code here and/or call the base class - CUIODListCtrl::ChangeStyle(dwStyle); - - dwStyle |= (LVS_SHAREIMAGELISTS | LVS_EDITLABELS); -} - -LRESULT CIEShellListCtrl::OnSetmessagestring(WPARAM wParam, LPARAM lParam) -{ - if (GetParent()) - return GetParent()->SendMessage(WM_SETMESSAGESTRING,wParam,lParam); - return 0; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListView.cpp deleted file mode 100644 index ad30c25eab3..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellListView.cpp +++ /dev/null @@ -1,174 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IEShellListView.cpp : implementation file -#include "stdafx.h" -#include "UIRes.h" -#include "IEShellListView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIEShellListView - -IMPLEMENT_DYNCREATE(CIEShellListView,CUIListView) - -CIEShellListView::CIEShellListView() - : CUIListView(IDC_LIST_SHELL) -{ - m_pActiveWnd = NULL; -} - - -CIEShellListView::~CIEShellListView() -{ -} - -void CIEShellListView::SetActiveWindow(CWnd *pWnd) -{ - ASSERT_VALID(pWnd); - if (pWnd->GetSafeHwnd() == NULL) - return; - if (m_pActiveWnd->GetSafeHwnd() == pWnd->GetSafeHwnd()) - return; - CRect rect; - m_pActiveWnd->GetWindowRect(rect); - ScreenToClient(&rect); - m_pActiveWnd->ShowWindow(SW_HIDE); - - m_pActiveWnd = pWnd; - m_pActiveWnd->ShowWindow(SW_SHOW); - m_pActiveWnd->MoveWindow(&rect); -} - -void CIEShellListView::LoadShellFolderItems(const CRefreshShellFolder &rFolder) -{ - LPTVITEMDATA lptvid = reinterpret_cast(rFolder.GetItemData()); - if (lptvid == NULL) - return; - GetShellListCtrl().Populate(lptvid); -} - -BEGIN_MESSAGE_MAP(CIEShellListView, CUIListView) - //{{AFX_MSG_MAP(CIEShellListView) - ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring) - ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS,OnAppUpdateAllViews) - ON_WM_SIZE() - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_CB_IE_SEL_CHANGE,OnCBIESelChange) - ON_MESSAGE(WM_APP_CB_IE_HIT_ENTER,OnCBIEHitEnter) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEShellListView message handlers - -void CIEShellListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) -{ - // TODO: Add your specialized code here and/or call the base class - if (lHint == HINT_TREE_SEL_CHANGED) - { - GetListCtrl().SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)lHint,(LPARAM)pHint); - } -} - -void CIEShellListView::CreateListCtrl() -{ - // TODO: Add your specialized code here and/or call the base class - m_pListCtrl = new CIEShellListCtrl; - m_pActiveWnd = m_pListCtrl; -} - -CIEShellListCtrl &CIEShellListView::GetShellListCtrl() -{ - // TODO: Add your specialized code here and/or call the base class - - return static_cast(GetListCtrl()); -} - -LRESULT CIEShellListView::OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam) -{ - if (wParam == HINT_TREE_INTERNET_FOLDER_SELECTED) - { - if (lParam) - { - if (m_htmlCtrl.GetSafeHwnd() == NULL) - { - if (m_htmlCtrl.Create(NULL, // class name - NULL, // title - (WS_CHILD | WS_VISIBLE), // style - CRect(), // rectangle - this, // parent - 2000, // control ID - NULL)) // frame/doc context not use - { - m_htmlCtrl.SetNotifyWnd(GetParentFrame()->GetSafeHwnd()); - m_htmlCtrl.GoHome(); - } - } - else - GetParentFrame()->SendMessage(WM_APP_CB_IE_SET_EDIT_TEXT,(WPARAM)(LPCTSTR)m_htmlCtrl.GetLocationURL(),0); - SetActiveWindow(&m_htmlCtrl); - } - else - SetActiveWindow(m_pListCtrl); - } - return 1; -} - -void CIEShellListView::OnSize(UINT nType, int cx, int cy) -{ - // TODO: Add your message handler code here - if (m_pActiveWnd && m_pActiveWnd->GetSafeHwnd()) - m_pActiveWnd->MoveWindow(0,0,cx,cy); - else - CView::OnSize(nType, cx, cy); -} - -LRESULT CIEShellListView::OnCBIESelChange(WPARAM wParam,LPARAM lParam) -{ - if (m_pActiveWnd->GetSafeHwnd() == m_htmlCtrl.GetSafeHwnd()) - { - ASSERT(lParam); - if (lParam) - m_htmlCtrl.Navigate((LPCTSTR)lParam); - } - return 1L; -} - -LRESULT CIEShellListView::OnCBIEHitEnter(WPARAM wParam,LPARAM lParam) -{ - if (m_pActiveWnd->GetSafeHwnd() == m_htmlCtrl.GetSafeHwnd()) - { - ASSERT(lParam); - if (lParam) - m_htmlCtrl.Navigate((LPCTSTR)lParam); - } - return 1L; -} - -LRESULT CIEShellListView::OnSetmessagestring(WPARAM wParam, LPARAM lParam) -{ - CFrameWnd *pFrame = GetParentFrame(); - if (pFrame) - return pFrame->SendMessage(WM_SETMESSAGESTRING,wParam,lParam); - return 0; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeCtrl.cpp deleted file mode 100644 index 3b88fde889b..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeCtrl.cpp +++ /dev/null @@ -1,691 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IEShellTreeCtrl.cpp : implementation file -#include "stdafx.h" -#include "IEShellTreeCtrl.h" -#include "cbformats.h" -#include "UIMessages.h" -#include "dirwalk.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeCtrl - -CIEShellTreeCtrl::CIEShellTreeCtrl() -{ - m_lptvid = NULL; - m_hListWnd = NULL; - m_hComboWnd = NULL; - m_nThreadCount = 0; - m_bRefreshAllowed = true; - m_bNotifyParent = false; - // Turn off WM_DROPFILES - SetDropFiles(false); -} - -CIEShellTreeCtrl::~CIEShellTreeCtrl() -{ -} - -void CIEShellTreeCtrl::ShellExecute(HTREEITEM hItem,LPCTSTR pszVerb) -{ - SHELLEXECUTEINFO si; - ZeroMemory(&si,sizeof(si)); - si.cbSize = sizeof(si); - si.hwnd = GetSafeHwnd(); - si.nShow = SW_SHOW; - si.lpIDList = (LPVOID)GetPathPidl(hItem); - si.fMask = SEE_MASK_INVOKEIDLIST; - if (pszVerb) - si.lpVerb = pszVerb; - ShellExecuteEx(&si); -} - -void CIEShellTreeCtrl::RefreshComboBox(LPTVITEMDATA lptvid) -{ - if (m_hComboWnd) - { - ::PostMessage(m_hComboWnd,WM_APP_CB_IE_POPULATE,(WPARAM)lptvid->lpifq,0); - } -} - -void CIEShellTreeCtrl::SetNotificationObject(bool bNotify) -{ - if (bNotify) - CreateFileChangeThreads(GetSafeHwnd()); - else - DestroyThreads(); -} - -void CIEShellTreeCtrl::UpOneLevel(HTREEITEM hItem) -{ - if (hItem == NULL) - { - hItem = GetSelectedItem(); - } - if (hItem == NULL) - return; - HTREEITEM hParentItem = GetParentItem(hItem); - if (hParentItem) - Select(hParentItem,TVGN_CARET); -} - -void CIEShellTreeCtrl::DestroyThreads() -{ - if (m_nThreadCount == 0) - return; - for (UINT i=0;i < m_nThreadCount; i++) - m_event[i].SetEvent(); - ::WaitForMultipleObjects (m_nThreadCount, m_hThreads, TRUE, INFINITE); - for (i=0; i < m_nThreadCount; i++) - delete m_pThreads[i]; - m_nThreadCount = 0; -} - -void CIEShellTreeCtrl::CreateFileChangeThreads(HWND hwnd) -{ - if (m_nThreadCount) - return; - TCHAR szDrives[MAX_PATH]; - DWORD dwSize = sizeof(szDrives)/sizeof(TCHAR); - DWORD dwChars = GetLogicalDriveStrings(dwSize,szDrives); - if (dwChars == 0 || dwChars > dwSize) - { - TRACE(_T("Warning: CreateFileChangeThreads failed in GetLogicalDriveStrings\n")); - return; - } - UINT nType; - CString sDrive; - LPCTSTR pszDrives=szDrives; - while (*pszDrives != '\0') - { - sDrive = pszDrives; - nType = ::GetDriveType(sDrive); - if (nType == DRIVE_FIXED || nType == DRIVE_REMOTE || nType == DRIVE_RAMDISK) - { - CreateFileChangeThread(sDrive,hwnd); - } -#if 1 // bugfix by mad79 - pszDrives=pszDrives+sDrive.GetLength()+1; -#else - pszDrives = _tcsninc(pszDrives,sDrive.GetLength()+1); -#endif - } -} - -void CIEShellTreeCtrl::CreateFileChangeThread(const CString& sPath,HWND hwnd) -{ - if (m_nThreadCount >= MAX_THREADS) - return; - PDC_THREADINFO pThreadInfo = new DC_THREADINFO; // Thread will delete - pThreadInfo->sPath = sPath; - pThreadInfo->hEvent = m_event[m_nThreadCount].m_hObject; - pThreadInfo->pTreeCtrl = this; - - CWinThread* pThread = AfxBeginThread (ThreadFunc, pThreadInfo, - THREAD_PRIORITY_IDLE); - - pThread->m_bAutoDelete = FALSE; - m_hThreads[m_nThreadCount] = pThread->m_hThread; - m_pThreads[m_nThreadCount++] = pThread; -} - -HTREEITEM CIEShellTreeCtrl::SearchSiblings(HTREEITEM hItem,LPITEMIDLIST pidlAbs) -{ - LPTVITEMDATA pItem = NULL; - HTREEITEM hChildItem = GetChildItem(hItem); - HTREEITEM hFoundItem; - while (hChildItem) - { - pItem = (LPTVITEMDATA)GetItemData(hChildItem); - if (GetShellPidl().ComparePidls(NULL,pItem->lpifq,pidlAbs)) - break; - hFoundItem = SearchSiblings(hChildItem,pidlAbs); - if (hFoundItem) - return hFoundItem; - hChildItem = GetNextSiblingItem(hChildItem); - } - return hChildItem; -} - -HTREEITEM CIEShellTreeCtrl::ExpandMyComputer(LPITEMIDLIST pidlAbs) -{ - HTREEITEM hItem=NULL; - if (pidlAbs == NULL) - return hItem; - LPITEMIDLIST pidlMyComputer=NULL; - LPITEMIDLIST pidlFirst=GetShellPidl().CopyItemID(pidlAbs); - SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidlMyComputer); - if (GetShellPidl().ComparePidls(NULL,pidlMyComputer,pidlFirst)) - { - hItem = ExpandPidl(pidlMyComputer); - } - if (pidlMyComputer) - GetShellPidl().FreePidl(pidlMyComputer); - if (pidlFirst) - GetShellPidl().FreePidl(pidlFirst); - return hItem; -} - -HTREEITEM CIEShellTreeCtrl::ExpandPidl(LPITEMIDLIST pidlAbs) -{ - HTREEITEM hItem = SearchSiblings(GetRootItem(),pidlAbs); - if (hItem) - { - Expand(hItem,TVE_EXPAND); - } - return hItem; -} - -HTREEITEM CIEShellTreeCtrl::FindPidl(LPITEMIDLIST pidlAbs,BOOL bSelect) -{ - HTREEITEM hItem = NULL; - if (pidlAbs == NULL) - hItem = GetRootItem(); - else - hItem = SearchSiblings(GetRootItem(),pidlAbs); - if (bSelect && hItem != GetSelectedItem()) - { - SelectItem(hItem); - SelectionChanged(hItem,GetItemData(hItem)); - } - return hItem; -} - -HTREEITEM CIEShellTreeCtrl::FindItem (HTREEITEM hItem, const CString& strTarget) -{ - while (hItem != NULL) - { - if (GetItemText (hItem) == strTarget) - break; - hItem = GetNextSiblingItem (hItem); - } - return hItem; -} - -UINT CIEShellTreeCtrl::DeleteChildren (HTREEITEM hItem) -{ - UINT nCount = 0; - HTREEITEM hChild = GetChildItem (hItem); - - while (hChild != NULL) - { - HTREEITEM hNextItem = GetNextSiblingItem (hChild); - DeleteItem (hChild); - hChild = hNextItem; - nCount++; - } - return nCount; -} - -void CIEShellTreeCtrl::Init() -{ - ModifyStyle(0,TVS_EDITLABELS); - CIEFolderTreeCtrl::Init(); -} - -void CIEShellTreeCtrl::Refresh() -{ - SetRefreshAllowed(false); - CIEFolderTreeCtrl::Refresh(); - SetRefreshAllowed(true); -} - -bool CIEShellTreeCtrl::DragEnter(CDD_OleDropTargetInfo *pInfo) -{ - HTREEITEM hItem = pInfo->GetTreeItem(); - if (hItem == NULL) - return false; - LPTVITEMDATA ptvid = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(ptvid); - if (ptvid == NULL) - return false; - return m_ShellDragDrop.DragEnter(pInfo,ptvid->lpsfParent,ptvid->lpi); -} - -bool CIEShellTreeCtrl::DragLeave(CDD_OleDropTargetInfo *pInfo) -{ - return m_ShellDragDrop.DragLeave(pInfo); -} - -bool CIEShellTreeCtrl::DragOver(CDD_OleDropTargetInfo *pInfo) -{ - pInfo->SetDropEffect(DROPEFFECT_NONE); - - HTREEITEM hItem = pInfo->GetTreeItem(); - if (hItem == NULL) - return false; - LPTVITEMDATA ptvid = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(ptvid); - if (ptvid == NULL) - return false; - return m_ShellDragDrop.DragOver(pInfo,ptvid->lpsfParent,ptvid->lpi); -} - -bool CIEShellTreeCtrl::DragDrop(CDD_OleDropTargetInfo *pInfo) -{ - HTREEITEM hItem = pInfo->GetTreeItem(); - if (hItem == NULL) - return false; - LPTVITEMDATA ptvid = (LPTVITEMDATA)GetItemData(hItem); - ASSERT(ptvid); - if (ptvid == NULL) - return false; - return m_ShellDragDrop.DragDrop(pInfo,ptvid->lpsfParent,ptvid->lpi); -} - -DROPEFFECT CIEShellTreeCtrl::DoDragDrop(NM_TREEVIEW* pNMTreeView,COleDataSource *pOleDataSource) -{ - if (pNMTreeView->itemNew.hItem == GetRootItem()) - return DROPEFFECT_NONE; - CCF_ShellIDList sl; - CShellPidl pidl; - HTREEITEM hParentItem = GetParentItem(pNMTreeView->itemNew.hItem); - LPTVITEMDATA ptvid = (LPTVITEMDATA)GetItemData(pNMTreeView->itemNew.hItem); - LPTVITEMDATA ptvid_parent = (LPTVITEMDATA)GetItemData(hParentItem); - ASSERT(ptvid); - ASSERT(ptvid_parent); - if (GetShellPidl().IsDesktopFolder(ptvid->lpsfParent)) - sl.AddPidl(GetShellPidl().GetEmptyPidl()); - else - sl.AddPidl(ptvid_parent->lpifq); - sl.AddPidl(ptvid->lpi); - CCF_HDROP cf_hdrop; - CCF_String cf_text; - CString sPath; - pidl.SHPidlToPathEx(ptvid->lpifq,sPath); - cf_hdrop.AddDropPoint(CPoint(pNMTreeView->ptDrag),FALSE); - cf_hdrop.AddFileName(sPath); - sPath += _T("\r\n"); - cf_text.SetString(sPath); - CWDClipboardData::Instance()->SetData(pOleDataSource,&cf_text,CWDClipboardData::e_cfString); - CWDClipboardData::Instance()->SetData(pOleDataSource,&cf_hdrop,CWDClipboardData::e_cfHDROP); - CWDClipboardData::Instance()->SetData(pOleDataSource,&sl,CWDClipboardData::e_cfShellIDList); - return GetShellPidl().GetDragDropAttributes(ptvid); -} - -bool CIEShellTreeCtrl::EndLabelEdit(HTREEITEM hItem,LPCTSTR pszText) -{ - LPTVITEMDATA plvit = (LPTVITEMDATA)GetItemData(hItem); - CString sFromPath; - CString sToPath; - GetShellPidl().SHPidlToPathEx(plvit->lpifq,sFromPath); - sToPath = sFromPath; - sToPath.Replace(GetItemText(hItem),pszText); - SHFILEOPSTRUCT shf; - TCHAR szFrom[MAX_PATH+1]; - TCHAR szTo[MAX_PATH+1]; - ZeroMemory(szFrom,sizeof(szFrom)); - lstrcpy(szFrom,sFromPath); - ZeroMemory(szTo,sizeof(szTo)); - lstrcpy(szTo,sToPath); - ZeroMemory(&shf,sizeof(shf)); - shf.hwnd = GetSafeHwnd(); - shf.wFunc = FO_RENAME; - shf.pFrom = szFrom; - shf.pTo = szTo; -#ifdef _DEBUG - CString sMess; - sMess = szFrom; - sMess += _T("\n"); - sMess += szTo; - AfxMessageBox(sMess); -#endif - if (SHFileOperation(&shf) == 0) - return true; - SetRefreshAllowed(false); - return false; -} - -bool CIEShellTreeCtrl::SHMoveFile(HTREEITEM hSrcItem,HTREEITEM hDestItem) -{ - LPTVITEMDATA plvit_src = (LPTVITEMDATA)GetItemData(hSrcItem); - LPTVITEMDATA plvit_dest = (LPTVITEMDATA)GetItemData(hDestItem); - CString sFromPath; - CString sToPath; - GetShellPidl().SHPidlToPathEx(plvit_src->lpifq,sFromPath); - GetShellPidl().SHPidlToPathEx(plvit_dest->lpifq,sToPath); - SHFILEOPSTRUCT shf; - TCHAR szFrom[MAX_PATH+1]; - TCHAR szTo[MAX_PATH+1]; - ZeroMemory(szFrom,sizeof(szFrom)); - lstrcpy(szFrom,sFromPath); - ZeroMemory(szTo,sizeof(szTo)); - lstrcpy(szTo,sToPath); - ZeroMemory(&shf,sizeof(shf)); - shf.hwnd = GetSafeHwnd(); - shf.wFunc = FO_MOVE; - shf.pFrom = szFrom; - shf.pTo = szTo; - return SHFileOperation(&shf) == 0 ? true : false; -} - -BOOL CIEShellTreeCtrl::TransferItem(HTREEITEM hitemDrag, HTREEITEM hitemDrop) -{ - return SHMoveFile(hitemDrag,hitemDrop) ? TRUE : FALSE; -} - -bool CIEShellTreeCtrl::GetFolderInfo(HTREEITEM hItem,CString &sPath,CString &sName) -{ - LPTVITEMDATA lptvid = (LPTVITEMDATA)GetItemData(hItem); - if (lptvid == NULL) - return false; - GetShellPidl().SHPidlToPathEx(lptvid->lpifq,sPath,NULL,SHGDN_NORMAL); - GetShellPidl().GetDisplayName(lptvid->lpi,sName); - return true; -} - -bool CIEShellTreeCtrl::LoadFolderItems(LPCTSTR pszPath) -{ - return LoadItems(pszPath); -} - -CRefresh *CIEShellTreeCtrl::CreateRefreshObject(HTREEITEM hItem,LPARAM lParam) -{ - CRefreshShellFolder *pRefresh=NULL; - if (lParam) - { - pRefresh = new CRefreshShellFolder(hItem,lParam); - } - return pRefresh; -} - -bool CIEShellTreeCtrl::Expanding(NM_TREEVIEW *nmtvw) -{ - if ((nmtvw->itemNew.state & TVIS_EXPANDEDONCE) || nmtvw->itemNew.hItem == GetRootItem()) - return false; - - LPSHELLFOLDER pFolder=NULL; - CUIListCtrlData *pData = (CUIListCtrlData*)nmtvw->itemNew.lParam; - ASSERT(pData); - ASSERT_KINDOF(CUIListCtrlData,pData); - LPTVITEMDATA lptvid=(LPTVITEMDATA)pData->GetExtData(); - if (lptvid) - { - HRESULT hr=lptvid->lpsfParent->BindToObject(lptvid->lpi, - 0, IID_IShellFolder,(LPVOID*)&pFolder); - - if (SUCCEEDED(hr)) - { - if (!AddItems(nmtvw->itemNew.hItem,pFolder)) - SetButtonState(nmtvw->itemNew.hItem); - } - return false; - } - // prevent from expanding - return true; -} - -BEGIN_MESSAGE_MAP(CIEShellTreeCtrl, CIEFolderTreeCtrl) - //{{AFX_MSG_MAP(CIEShellTreeCtrl) - ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring) - ON_MESSAGE(WM_APP_CB_IE_HIT_ENTER,OnAppCbIeHitEnter) - // NOTE - the ClassWizard will add and remove mapping macros here. - ON_WM_DESTROY() - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_POPULATE_TREE,OnAppPopulateTree) - ON_MESSAGE(WM_APP_CB_IE_SEL_CHANGE,OnCBIESelChange) - ON_MESSAGE(WM_APP_DIR_CHANGE_EVENT,OnAppDirChangeEvent) - -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeCtrl message handlers -BOOL CIEShellTreeCtrl::OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult ) -{ - if ((message == WM_MEASUREITEM || message == WM_DRAWITEM && wParam == 0) || message == WM_INITMENUPOPUP) - { - if (m_lptvid) - { - return GetShellPidl().HandleMenuMsg(m_hWnd,m_lptvid->lpsfParent, m_lptvid->lpi, - message,wParam,lParam); - } - } - return CIEFolderTreeCtrl::OnWndMsg(message, wParam, lParam, pResult ); -} - -void CIEShellTreeCtrl::PreSubclassWindow() -{ - CIEFolderTreeCtrl::PreSubclassWindow(); - CreateFileChangeThreads(GetSafeHwnd()); -} - -///////////////////////////////////////////////////////////////////////// -// Thread function for detecting file system changes -UINT CIEShellTreeCtrl::ThreadFunc (LPVOID pParam) -{ - /////////////////////////////// - PDC_THREADINFO pThreadInfo = (PDC_THREADINFO) pParam; - HANDLE hEvent = pThreadInfo->hEvent; - CIEShellTreeCtrl *pTreeCtrl = pThreadInfo->pTreeCtrl; - HWND hWnd = pTreeCtrl->GetSafeHwnd(); - TCHAR szPath[MAX_PATH]; - lstrcpy(szPath,pThreadInfo->sPath); - delete pThreadInfo; - //////////////////////////////////// - - // Get a handle to a file change notification object. - TRACE(_T("Creating directory thread handler for %s\n"),szPath); - HANDLE hDirChange = ::FindFirstChangeNotification (szPath,TRUE,FILE_NOTIFY_CHANGE_DIR_NAME); - - // Return now if ::FindFirstChangeNotification failed. - if (hDirChange == INVALID_HANDLE_VALUE) - return 1; - const int nHandles=2; - HANDLE aHandles[nHandles]; - aHandles[0] = hDirChange; - aHandles[1] = hEvent; - BOOL bContinue = TRUE; - - // Sleep until a file change notification wakes this thread or - // m_event becomes set indicating it's time for the thread to end. - while (bContinue) - { - TRACE(_T("TreeControl waiting for %u multiple objects\n"),nHandles); - DWORD dw = ::WaitForMultipleObjects (nHandles, aHandles, FALSE, INFINITE); - if (dw - WAIT_OBJECT_0 == 0) - { // Respond to a change notification. - ::FindNextChangeNotification (hDirChange); - TRACE(_T("-- Directory notify event was fired in CIEShellTreeCtrl --\n")); - if (pTreeCtrl->RefreshAllowed()) - { - ::PostMessage (hWnd, WM_APP_DIR_CHANGE_EVENT,0,0); - } - else - { - TRACE(_T("but not sending as refresh disallowed\n")); - pTreeCtrl->SetRefreshAllowed(true); - TRACE(_T("Refresh is now allowed\n")); - } - } - else if(dw - WAIT_OBJECT_0 == 1) - { - bContinue = FALSE; - TRACE(_T("Directory Notify Thread was signalled to stop\n")); - } - } - - // Close the file change notification handle and return. - ::FindCloseChangeNotification (hDirChange); - TRACE(_T("Directory Notify Thread is ending\n")); - return 0; -} - -void CIEShellTreeCtrl::OnDestroy() -{ - DestroyThreads(); - CIEFolderTreeCtrl::OnDestroy(); -} - -LRESULT CIEShellTreeCtrl::OnAppDirChangeEvent(WPARAM wParam, LPARAM lParam) -{ - if (!RefreshAllowed()) - return 1L; - Refresh(); - if (m_bNotifyParent) - GetParent()->SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)HINT_SHELL_DIR_CHANGED,(LPARAM)(LPCTSTR)GetRootPath()); - return 1L; -} - -LRESULT CIEShellTreeCtrl::OnCBIESelChange(WPARAM wParam,LPARAM lParam) -{ - LPITEMIDLIST pidl = (LPITEMIDLIST)wParam; - ExpandMyComputer(pidl); - FindPidl(pidl); - GetShellPidl().FreePidl(pidl); - SetFocus(); - return 1L; -} - -// Selection has changed -void CIEShellTreeCtrl::UpdateEvent(LPARAM lHint,CObject *pHint) -{ - // TODO: Add your specialized code here and/or call the base class - // Notify the combo box - const CRefreshShellFolder *pRefresh = static_cast(pHint); - LPTVITEMDATA lptvid = reinterpret_cast(pRefresh->GetItemData()); - ASSERT(lptvid); - // Notify combo box - RefreshComboBox(lptvid); - // Notify list control - if (m_hListWnd) - { - ::SendMessage(m_hListWnd,WM_APP_UPDATE_ALL_VIEWS,(WPARAM)lHint,(LPARAM)pHint); - return; - } - // or let base class handle it - CUITreeCtrl::UpdateEvent(lHint,pHint); -} - -LRESULT CIEShellTreeCtrl::OnAppPopulateTree(WPARAM wParam, LPARAM lParam) -{ - TRACE0("Selecting root item\n"); - HTREEITEM hRoot = GetRootItem(); - if (hRoot == NULL) - return 1L; - SelectItem(hRoot); -#ifndef _DEBUG - SelectionChanged(hRoot,GetItemData(hRoot)); -#else - LPTVITEMDATA lptvid = reinterpret_cast(GetItemData(hRoot)); - RefreshComboBox(lptvid); -#endif - return 1; -} - -void CIEShellTreeCtrl::DeleteKey(HTREEITEM hItem) -{ - // TODO: Add your specialized code here and/or call the base class - SHFILEOPSTRUCT shf; - ZeroMemory(&shf,sizeof(shf)); - TCHAR szFrom[MAX_PATH+1]; - ZeroMemory(szFrom,sizeof(szFrom)*sizeof(TCHAR)); - lstrcpy(szFrom,GetPathName(hItem)); - shf.hwnd = GetSafeHwnd(); - shf.wFunc = FO_DELETE; - shf.pFrom = szFrom; - shf.fFlags = GetKeyState(VK_SHIFT) < 0 ? 0 : FOF_ALLOWUNDO; - SHFileOperation(&shf); -} - -void CIEShellTreeCtrl::DoubleClick(HTREEITEM hItem) -{ - // TODO: Add your specialized code here and/or call the base class - ShellExecute(hItem); -} - -void CIEShellTreeCtrl::GoBack(HTREEITEM hItem) -{ - // TODO: Add your specialized code here and/or call the base class - UpOneLevel(hItem); -} - -void CIEShellTreeCtrl::ShowPopupMenu(HTREEITEM hItem,CPoint point) -{ - // TODO: Add your specialized code here and/or call the base class - if (m_PopupID) - { - CUITreeCtrl::ShowPopupMenu(hItem,point); - } - // TODO: Add your control notification handler code here - m_lptvid = (LPTVITEMDATA)GetItemData(hItem); - if (m_lptvid) - GetShellPidl().PopupTheMenu(m_hWnd,m_lptvid->lpsfParent, &m_lptvid->lpi, 1, &point); -} - -void CIEShellTreeCtrl::ShowProperties(HTREEITEM hItem) -{ - // TODO: Add your specialized code here and/or call the base class - ShellExecute(hItem,_T("properties")); -} - -LRESULT CIEShellTreeCtrl::OnAppCbIeHitEnter(WPARAM wParam, LPARAM lParam) -{ - if (lParam == NULL) - return 0L; - LPCTSTR pszPath = (LPCTSTR)lParam; - LPITEMIDLIST pidl=NULL; - GetShellPidl().SHPathToPidlEx(pszPath,&pidl,NULL); - if (pidl == NULL) - return 0L; - int nCount = GetShellPidl().GetCount(pidl); - LPITEMIDLIST pidlPart=NULL; - LPITEMIDLIST pidlFull=NULL; - HTREEITEM hItem=NULL; - SetRedraw(FALSE); - for(int i=0;i < nCount;i++) - { - pidlPart=GetShellPidl().CopyItemID(pidl,i+1); - if (pidlPart) - { - pidlFull = GetShellPidl().ConcatPidl(pidlFull,pidlPart); - hItem = ExpandPidl(pidlFull); - if (hItem == NULL) - break; - GetShellPidl().FreePidl(pidlPart); - } - } - if (hItem && GetShellPidl().ComparePidls(NULL,pidl,pidlFull)) - { - Select(hItem,TVGN_CARET); - } - else - { - CString sMess; - sMess.Format(_T("%s was not found"),pszPath); - AfxMessageBox(sMess,MB_ICONSTOP); - } - if (pidl) - GetShellPidl().FreePidl(pidl); - if (pidlFull) - GetShellPidl().FreePidl(pidlFull); - SetRedraw(TRUE); - return 1; -} - -LRESULT CIEShellTreeCtrl::OnSetmessagestring(WPARAM wParam, LPARAM lParam) -{ - if (GetParent()) - return GetParent()->SendMessage(WM_SETMESSAGESTRING,wParam,lParam); - return 0; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeView.cpp deleted file mode 100644 index ce281d7bf71..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/IEShellTreeView.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IEShellTreeView.cpp : implementation file -#include "stdafx.h" -#include "UIRes.h" -#include "UIMessages.h" -#include "IEShellTreeView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeView - -IMPLEMENT_DYNCREATE(CIEShellTreeView,CUITreeView) - -CIEShellTreeView::CIEShellTreeView() - : CUITreeView(IDC_TREE_SHELL) -{ - m_bPopulated = false; -} - - -CIEShellTreeView::~CIEShellTreeView() -{ -} - -LPTVITEMDATA CIEShellTreeView::GetSelectedItemData() -{ - HTREEITEM hItem = GetShellTreeCtrl().GetSelectedItem(); - LPTVITEMDATA ptvid=NULL; - if (hItem) - ptvid = (LPTVITEMDATA)GetShellTreeCtrl().GetItemData(hItem); - return ptvid; -} - -void CIEShellTreeView::OnInitialUpdate() -{ - CUITreeView::OnInitialUpdate(); - - // TODO: Add your specialized code here and/or call the base class - if (!m_bPopulated) - { - GetShellTreeCtrl().SetComboBoxWnd(GetParentFrame()->GetSafeHwnd()); - PopulateTree(NULL); - } -} - -bool CIEShellTreeView::PopulateTree(LPCTSTR pszPath) -{ - CIEShellTreeCtrl *pCtrl = (CIEShellTreeCtrl*)m_pTreeCtrl; - m_bPopulated = pCtrl->LoadFolderItems(pszPath); - return m_bPopulated; -} - -void CIEShellTreeView::CreateTreeCtrl() -{ - // TODO: Add your specialized code here and/or call the base class - m_pTreeCtrl = new CIEShellTreeCtrl; -} - -BEGIN_MESSAGE_MAP(CIEShellTreeView, CUITreeView) - //{{AFX_MSG_MAP(CIEShellTreeView) - ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeView message handlers - -void CIEShellTreeView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) -{ - if (bActivate && pDeactiveView != NULL) - { -// theApp.SwitchTab(CViewTabView::TAB_LIST_FOLDER); - GetTreeCtrl().SetFocus(); - } - CView::OnActivateView(bActivate, pActivateView, pDeactiveView); -} - - -LRESULT CIEShellTreeView::OnSetmessagestring(WPARAM wParam, LPARAM lParam) -{ - CFrameWnd *pFrame = GetParentFrame(); - if (pFrame) - return pFrame->SendMessage(WM_SETMESSAGESTRING,wParam,lParam); - return 0; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/InPlaceEdit.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/InPlaceEdit.cpp deleted file mode 100644 index d7dd2950608..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/InPlaceEdit.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// InPlaceEdit.cpp : implementation file -// -// Zafir Anjum - -#include "stdafx.h" -#include "InPlaceEdit.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CInPlaceEdit - -CInPlaceEdit::CInPlaceEdit(int iItem, int iSubItem, CString sInitText) -:m_sInitText( sInitText ) -{ - m_iItem = iItem; - m_iSubItem = iSubItem; - m_bESC = FALSE; -} - -CInPlaceEdit::~CInPlaceEdit() -{ -} - - -BEGIN_MESSAGE_MAP(CInPlaceEdit, CEdit) - //{{AFX_MSG_MAP(CInPlaceEdit) - ON_WM_KILLFOCUS() - ON_WM_NCDESTROY() - ON_WM_CHAR() - ON_WM_CREATE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CInPlaceEdit message handlers - -BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg) -{ - if( pMsg->message == WM_KEYDOWN ) - { - if(pMsg->wParam == VK_RETURN - || pMsg->wParam == VK_DELETE - || pMsg->wParam == VK_ESCAPE - || GetKeyState( VK_CONTROL) - ) - { - ::TranslateMessage(pMsg); - ::DispatchMessage(pMsg); - return TRUE; // DO NOT process further - } - } - - return CEdit::PreTranslateMessage(pMsg); -} - - -void CInPlaceEdit::OnKillFocus(CWnd* pNewWnd) -{ - CEdit::OnKillFocus(pNewWnd); - - CString str; - GetWindowText(str); - - // Send Notification to parent of ListView ctrl - LV_DISPINFO dispinfo; - dispinfo.hdr.hwndFrom = GetParent()->m_hWnd; - dispinfo.hdr.idFrom = GetDlgCtrlID(); - dispinfo.hdr.code = LVN_ENDLABELEDIT; - - dispinfo.item.mask = LVIF_TEXT; - dispinfo.item.iItem = m_iItem; - dispinfo.item.iSubItem = m_iSubItem; - dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str); - dispinfo.item.cchTextMax = str.GetLength(); - - GetParent()->GetParent()->SendMessage( WM_NOTIFY, GetParent()->GetDlgCtrlID(), - (LPARAM)&dispinfo ); - - DestroyWindow(); -} - -void CInPlaceEdit::OnNcDestroy() -{ - CEdit::OnNcDestroy(); - - delete this; -} - - -void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -{ - if( nChar == VK_ESCAPE || nChar == VK_RETURN) - { - if( nChar == VK_ESCAPE ) - m_bESC = TRUE; - GetParent()->SetFocus(); - return; - } - - - CEdit::OnChar(nChar, nRepCnt, nFlags); - - // Resize edit control if needed - - // Get text extent - CString str; - - GetWindowText( str ); - CWindowDC dc(this); - CFont *pFont = GetParent()->GetFont(); - CFont *pFontDC = dc.SelectObject( pFont ); - CSize size = dc.GetTextExtent( str ); - dc.SelectObject( pFontDC ); - size.cx += 5; // add some extra buffer - - // Get client rect - CRect rect, parentrect; - GetClientRect( &rect ); - GetParent()->GetClientRect( &parentrect ); - - // Transform rect to parent coordinates - ClientToScreen( &rect ); - GetParent()->ScreenToClient( &rect ); - - // Check whether control needs to be resized - // and whether there is space to grow - if( size.cx > rect.Width() ) - { - if( size.cx + rect.left < parentrect.right ) - rect.right = rect.left + size.cx; - else - rect.right = parentrect.right; - MoveWindow( &rect ); - } -} - -int CInPlaceEdit::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CEdit::OnCreate(lpCreateStruct) == -1) - return -1; - - // Set the proper font - CFont* font = GetParent()->GetFont(); - SetFont(font); - - SetWindowText( m_sInitText ); - SetFocus(); - SetSel( 0, -1 ); - return 0; -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Dirwalk.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Dirwalk.h deleted file mode 100644 index ec24f4d8522..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Dirwalk.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef __DIRWALK_H__ -#define __DIRWALK_H__ - -//////////////////////////////////////////////// -// CSplitPath -//////////////////////////////////////////////// -class CTRL_EXT_CLASS CSplitPath -{ -public: - CSplitPath(LPCTSTR pszPath); - CSplitPath(); - virtual ~CSplitPath(); -// operations -public: - void Split(LPCTSTR pszPath); - void Make(); -// attributes -public: - CString GetPath() const; - CString GetDrive() const; - CString GetDir() const; - CString GetFileName() const; - CString GetExt() const; - void SetDrive(LPCTSTR pszDrive); - void SetDir(LPCTSTR pszDir); - void SetFileName(LPCTSTR pszFileName); - void SetExt(LPCTSTR pszExt); -protected: - void Init(); -private: - TCHAR m_szPath[MAX_PATH]; - TCHAR m_szDrive[_MAX_DRIVE]; - TCHAR m_szDir[_MAX_DIR]; - TCHAR m_szFname[_MAX_FNAME]; - TCHAR m_szExt[_MAX_EXT]; -}; - -inline CSplitPath::CSplitPath() -{ - Init(); -} - -inline CSplitPath::CSplitPath(LPCTSTR pszPath) -{ - Init(); - Split(pszPath); -} - -inline void CSplitPath::Init() -{ - m_szPath[0] = 0; - m_szDrive[0] = 0; - m_szDir[0] = 0; - m_szFname[0] = 0; - m_szExt[0] = 0; -} - -inline CSplitPath::~CSplitPath() -{ - -} - -inline CString CSplitPath::GetPath() const -{ - return m_szPath; -} - -inline CString CSplitPath::GetDrive() const -{ - return m_szDrive; -} - -inline CString CSplitPath::GetDir() const -{ - return m_szDir; -} - -inline CString CSplitPath::GetFileName() const -{ - return m_szFname; -} - -inline CString CSplitPath::GetExt() const -{ - return m_szExt; -} - -inline void CSplitPath::SetDrive(LPCTSTR pszDrive) -{ - lstrcpy(m_szDrive,pszDrive); -} - -inline void CSplitPath::SetDir(LPCTSTR pszDir) -{ - lstrcpy(m_szDir,pszDir); -} - -inline void CSplitPath::SetFileName(LPCTSTR pszFileName) -{ - lstrcpy(m_szFname,pszFileName); -} - -inline void CSplitPath::SetExt(LPCTSTR pszExt) -{ - lstrcpy(m_szExt,pszExt); -} - -inline void CSplitPath::Split(LPCTSTR pszPath) -{ - _tsplitpath(pszPath,m_szDrive,m_szDir,m_szFname,m_szExt); -} - -inline void CSplitPath::Make() -{ - _tmakepath(m_szPath,m_szDrive,m_szDir,m_szFname,m_szExt); -} - -#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) - -#endif //__DIRWALK_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/HtmlCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/HtmlCtrl.h deleted file mode 100644 index d0edf30fd27..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/HtmlCtrl.h +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Microsoft Systems Journal -- December 1999 -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// Compiles with Visual C++ 6.0, runs on Windows 98 and probably NT too. -// -#include "UIHtmlView.h" - -class CTRL_EXT_CLASS CHtmlCtrl : public CUIHtmlView { -public: - CHtmlCtrl() { } - ~CHtmlCtrl() { } - - BOOL CreateFromStatic(UINT nID, CWnd* pParent); - - // Normally, CHtmlView destroys itself in PostNcDestroy, - // but we don't want to do that for a control since a control - // is usually implemented as a stack object in a dialog. - // - virtual void PostNcDestroy() { } - - // overrides to bypass MFC doc/view frame dependencies - afx_msg void OnDestroy(); - afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT msg); - - // override to trap "app:" pseudo protocol - virtual void OnBeforeNavigate2( LPCTSTR lpszURL, - DWORD nFlags, - LPCTSTR lpszTargetFrameName, - CByteArray& baPostedData, - LPCTSTR lpszHeaders, - BOOL* pbCancel ); - - // override to handle links to "app:mumble...". lpszWhere will be "mumble" - virtual void OnAppCmd(LPCTSTR lpszWhere); - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - - DECLARE_MESSAGE_MAP(); - afx_msg LRESULT OnAppCbIeSelChange(WPARAM wParam, LPARAM lParam ); - DECLARE_DYNAMIC(CHtmlCtrl) -}; - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEFolderTreeCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEFolderTreeCtrl.h deleted file mode 100644 index 1a5ca161529..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEFolderTreeCtrl.h +++ /dev/null @@ -1,128 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_) -#define AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// IEFolderTreeCtrl.h : header file -// -#include "ShellPidl.h" -#include "ShellSettings.h" -#include "Refresh.h" -#include "UITreeCtrl.h" -///////////////////////////////////////////////////////////////////////////// -// CIEFolderTreeCtrl window -#include - -class CTRL_EXT_CLASS CIEFolderTreeCtrl : public CUITreeCtrl -{ -// Construction -public: - CIEFolderTreeCtrl(); - -// Attributes -public: - CShellPidl &GetShellPidl(); - CString GetRootPath(); - void SetRootPath(const CString &sPath); - const CShellSettings &GetShellSettings() const; - CShellSettings &GetShellSettings(); - virtual LPCITEMIDLIST GetPathPidl(HTREEITEM hItem); - virtual CString GetPathName(HTREEITEM hItem=NULL); - -// Operations -public: - virtual void Sort(HTREEITEM hParent,LPSHELLFOLDER pFolder); - virtual void Refresh(); -protected: - virtual LPSHELLFOLDER GetItemFolder(HTREEITEM hItem); - virtual HTREEITEM AddFolder(HTREEITEM hItem,LPITEMIDLIST pidl,LPSHELLFOLDER pFolder); - virtual HTREEITEM AddFolder(HTREEITEM hItem,LPCTSTR pszPath); - virtual bool LoadItems(LPCTSTR pszPath=NULL,DWORD dwFolderType=0); - virtual bool AddItems(HTREEITEM hItem,IShellFolder* pFolder); - virtual void OnDeleteItemData(DWORD dwData); - virtual void SetButtonState(HTREEITEM hItem); - virtual void RefreshNode(HTREEITEM hItem); - virtual void SetAttributes(HTREEITEM hItem,LPSHELLFOLDER pFolder,LPITEMIDLIST pidl); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEFolderTreeCtrl) - public: - virtual void Init(); - protected: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder); - //}}AFX_VIRTUAL - virtual BOOL LoadURL(HTREEITEM hItem); - -// Implementation -public: - virtual ~CIEFolderTreeCtrl(); - - // Generated message map functions -protected: - static int CALLBACK CompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); - //{{AFX_MSG(CIEFolderTreeCtrl) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg LRESULT OnSettingChange(WPARAM wParam,LPARAM lParam); - afx_msg void OnDestroy(); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -private: - IMalloc* m_pMalloc; - CShellPidl m_ShellPidl; - CString m_sRootPath; - HIMAGELIST m_hImageList; - CShellSettings m_ShellSettings; -}; - -inline const CShellSettings &CIEFolderTreeCtrl::GetShellSettings() const -{ - return m_ShellSettings; -} - -inline CShellSettings &CIEFolderTreeCtrl::GetShellSettings() -{ - return m_ShellSettings; -} - -inline CString CIEFolderTreeCtrl::GetRootPath() -{ - return m_sRootPath; -} - -inline void CIEFolderTreeCtrl::SetRootPath(const CString &sPath) -{ - m_sRootPath = sPath; -} - -inline CShellPidl &CIEFolderTreeCtrl::GetShellPidl() -{ - return m_ShellPidl; -} -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellComboBox.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellComboBox.h deleted file mode 100644 index 017ed16e360..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellComboBox.h +++ /dev/null @@ -1,142 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - - -#if !defined(AFX_IESHELLCOMBOBOX_H__1EABA279_32DD_4A2D_8957_F478E4D3E5EB__INCLUDED_) -#define AFX_IESHELLCOMBOBOX_H__1EABA279_32DD_4A2D_8957_F478E4D3E5EB__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// IEShellComboBox.h : header file -// -#include "ShellContextMenu.h" -#include "ShellPidl.h" -#include "Refresh.h" - -//////////////////////////////////////////////// -// CIEShellComboBoxEdit -//////////////////////////////////////////////// -class CIEShellComboBoxEdit : public CEdit -{ -public: - CIEShellComboBoxEdit(); - virtual ~CIEShellComboBoxEdit(); - -public: - CString &GetText() { GetWindowText(m_sText); return m_sText; } - void SetTreeWnd(HWND hWnd); - virtual BOOL PreTranslateMessage(MSG* pMsg); -protected: -private: - CString m_sText; - HWND m_hTreeWnd; -}; - -inline CIEShellComboBoxEdit::CIEShellComboBoxEdit() -{ - m_hTreeWnd = NULL; -} - -inline CIEShellComboBoxEdit::~CIEShellComboBoxEdit() -{ - -} - -inline void CIEShellComboBoxEdit::SetTreeWnd(HWND hWnd) -{ - m_hTreeWnd = hWnd; -} - -///////////////////////////////////////////////////////////////////////////// -// CIEShellComboBox window - -class CTRL_EXT_CLASS CIEShellComboBox : public CComboBoxEx -{ -// Construction -public: - CIEShellComboBox(); - -// Attributes -public: - CShellPidl &GetShellPidl() { return m_ShellPidl; } - LPITEMIDLIST GetSelectedPidl(); - void SetTreeCtrlWnd(HWND hWnd) { m_hTreeWnd = hWnd; } -// Operations -public: - void Populate(LPITEMIDLIST pidlAbsSel=NULL); -protected: - void BuildFolderList(LPSHELLFOLDER pFolder,LPITEMIDLIST pidl,LPITEMIDLIST pidlAbsSel,int nIndent); - void InitItems(LPITEMIDLIST pidlAbsSel); - void LoadItems(LPITEMIDLIST pidlAbsSel); - void LoadURLPrevList(); - void SetShellImageList(); - int AddItem(const CShCMSort *pItem); - void DeleteItemData(LPTVITEMDATA pItemData); - void DeleteAllItemData(); - void AddItems(vecCMSort &vItems,IShellFolder* pFolder,LPITEMIDLIST pidlAbs,int nIndent); - void AddFolder(vecCMSort &vItems,const SHFILEINFO &FileInfo,LPITEMIDLIST pidlAbs,LPITEMIDLIST pidl,LPSHELLFOLDER pFolder,int nIndent); - void SelectionChanged(bool bEnter=false); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEShellComboBox) - public: - virtual void PreSubclassWindow(); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CIEShellComboBox(); - - // Generated message map functions -protected: - //{{AFX_MSG(CIEShellComboBox) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDestroy(); - afx_msg void OnKillFocus(CWnd *pNewWnd); - afx_msg void OnSetFocus(CWnd *pWnd); - afx_msg void OnDropDown(); - afx_msg void OnSelChange(); - afx_msg LRESULT OnCBIEPopulate(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnAppCbIeHitEnter(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -private: - LPMALLOC m_pMalloc; - LPITEMIDLIST m_pidlMyComputer; - LPITEMIDLIST m_pidlMyDocuments; - LPITEMIDLIST m_pidlInternet; - CShellPidl m_ShellPidl; - vecItemData m_vecItemData; - vecCMSort m_vItems; - HIMAGELIST m_hImageList; - CImageList m_ImageList; - HWND m_hTreeWnd; - HICON m_hIcon; - CIEShellComboBoxEdit m_cbEdit; - CString m_sText; - bool m_bInternet; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_IESHELLCOMBOBOX_H__1EABA279_32DD_4A2D_8957_F478E4D3E5EB__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellDragDrop.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellDragDrop.h deleted file mode 100644 index c30243253f8..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellDragDrop.h +++ /dev/null @@ -1,55 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __IESHELLDRAGDROP_H__ -#define __IESHELLDRAGDROP_H__ - -#include "UIDragDropCtrl.h" -#include "ShellPidl.h" -//////////////////////////////////////////////// -// CIEShellDragDrop -//////////////////////////////////////////////// -class CIEShellDragDrop -{ -public: - CIEShellDragDrop(); - virtual ~CIEShellDragDrop(); - -public: - virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl); - virtual bool DragOver(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl); - virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo,LPSHELLFOLDER psfFolder,LPITEMIDLIST pidl); - virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo); -protected: -private: - CShellPidl m_ShellPidl; - LPSHELLFOLDER m_psfDesktop; -}; - -inline CIEShellDragDrop::CIEShellDragDrop() -{ - m_psfDesktop = NULL; - SHGetDesktopFolder(&m_psfDesktop); -} - -inline CIEShellDragDrop::~CIEShellDragDrop() -{ - if (m_psfDesktop) - m_psfDesktop->Release(); -} - -#endif //__IESHELLDRAGDROP_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListCtrl.h deleted file mode 100644 index 90c7c3e4062..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListCtrl.h +++ /dev/null @@ -1,215 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __IESHELLLISTCTRL_H__ -#define __IESHELLLISTCTRL_H__ - -#ifndef __AFXMT_H__ -#include "afxmt.h" -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -typedef struct SLC_COLUMN_DATA -{ - SLC_COLUMN_DATA() { pidl = NULL; iImage = -1;} - CStringArray sItems; - LPITEMIDLIST pidl; - int iImage; -} SLC_COLUMN_DATA, *PSLC_COLUMN_DATA; - -class CCF_HDROP; - -// IEShellListCtrl.h : header file -// -#include -#include "UICtrl.h" -#include "ShellPidl.h" -#include "ShellDetails.h" -#include "ShellSettings.h" -#include "Refresh.h" -#include "IEShellDragDrop.h" -///////////////////////////////////////////////////////////////////////////// -// CIEShellListCtrl window -#include -using namespace std; -typedef vector vecListItemData; - -class CTRL_EXT_CLASS CIEShellListCtrl : public CUIODListCtrl -{ -// Construction -public: - CIEShellListCtrl(); - - enum Cols - { - COL_NAME, - COL_SIZE, - COL_TYPE, - COL_MODIFIED, - COL_MAX - }; -// Attributes -public: - void SetFileFilter(LPCTSTR pszFilter) { m_sFileFilter = pszFilter; } - CString GetFileFilter() { return m_sFileFilter.IsEmpty() ? _T("*.*") : m_sFileFilter; } - void SetNotifyParent(bool bNotifyParent) { m_bNotifyParent = bNotifyParent; } - void NoExtAllowed() { m_bNoExt = true; } - void ExcludeFileType(LPCTSTR pszType) { m_ExcludedLookup.AddHead(pszType); } - CStringList &GetExcludedFileTypes() { return m_ExcludedLookup; } - void FillExcludedFileTypes(CComboBox &cb); - void SetExcludedFileTypes(CComboBox &cb); - bool RefreshAllowed() { return m_bRefreshAllowed; } - void SetRefreshAllowed(bool bRefresh) { m_bRefreshAllowed = bRefresh; } - CShellPidl &GetShellPidl() { return m_ShellPidl; } - LPMALLOC GetMalloc() { return m_pMalloc; } - LPTVITEMDATA GetTVID() { return &m_tvid; } - LPSHELLFOLDER GetShellFolder() { return m_tvid.lpsfParent; } - bool GetCallBack() { return m_bCallBack; } - CString GetPathName(int nRow); - CString GetCurrPathName(); - LPCITEMIDLIST GetPathPidl(int nRow); - const CShellSettings &GetShellSettings() const; - CShellSettings &GetShellSettings(); -// Operations -public: - virtual void PopupTheMenu(int nRow,CPoint point); - virtual void ShellExecute(int nRow,LPCTSTR pszVerb=NULL); - virtual void SetNotificationObject(bool bNotify); - virtual BOOL Populate(LPTVITEMDATA lptvid,LPSHELLFOLDER psfFolder,bool bCallBack); - virtual BOOL Populate(LPCTSTR pszPath, bool bCallBack=false); - virtual BOOL Populate(LPTVITEMDATA lptvid); - virtual void Refresh(); - virtual void StartPopulate(); - virtual void EndPopulate(); -// Overridables -protected: - virtual void DestroyThreads(); - virtual void Load(); - virtual void SetColumnWidths(); - virtual void RemoveExt(LPTSTR pszFileName); - virtual void InitColumns(); - virtual CString GetColumns(); - virtual BOOL InitImageLists(); - virtual BOOL InitItems(LPTVITEMDATA lptvid, bool bCallBack); - virtual void InitShellSettings(); - virtual bool FilterItem(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl,UINT ulAttrs); - virtual bool GetColText(int nCol,LPCITEMIDLIST pidlAbs,LPLVITEMDATA lplvid,CString &sText); - virtual void GetText(PSLC_COLUMN_DATA pColData,LV_DISPINFO *pDispInfo,LPLVITEMDATA lplvid); - virtual void GetFileDetails(LPCITEMIDLIST pidl, CString &sSize, CString &sDateTime); - virtual void CreateFileChangeThread(HWND hwnd); - virtual void FreeTVID(); - virtual void FreeInterface(IUnknown *pInterface); - virtual bool UseShellColumns(); - virtual LPCTSTR GetFilterMask(LPCTSTR pszFilter,CString &sMask); -private: - void LoadFilterFiles(const CString &sFileFilter); -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEShellListCtrl) - public: - virtual void ChangeStyle(UINT &dwStyle); - virtual void Init(); - protected: - virtual void GoBack(int nRow); - virtual void ShowPopupMenu(int nRow,int nCol,CPoint point); - virtual BOOL OnEnter(NM_LISTVIEW* pNMListView); - virtual BOOL DoubleClick(NM_LISTVIEW* pNMListView); - virtual void PreSubclassWindow(); - virtual bool DragOver(CDD_OleDropTargetInfo *pInfo); - virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo); - virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo); - virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo); - virtual BOOL GetDispInfo(LV_DISPINFO *pDispInfo); - virtual PFNLVCOMPARE GetCompareFunc(); - virtual void AllItemsDeleted(); - virtual DROPEFFECT DoDragDrop(int *pnRows,COleDataSource *pOleDataSource); - virtual bool EndLabelEdit(int nRow,int nCol,LPCTSTR pszText); - //}}AFX_VIRTUAL -// Implementation -public: - virtual ~CIEShellListCtrl(); - -// Generated message map functions -protected: - //{{AFX_MSG(CIEShellListCtrl) - // NOTE - the ClassWizard will add and remove member functions here. - afx_msg void OnDestroy(); - afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu); - afx_msg LRESULT OnAppFileChangeNewPath(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnAppFileChangeEvent(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnSettingChange(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - afx_msg LRESULT OnAppDeleteKey(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnAppPropertiesKey(WPARAM wParam, LPARAM lParam); - DECLARE_MESSAGE_MAP() -private: - static UINT ThreadFunc (LPVOID pParam); - enum { MAX_THREADS=1 }; - - vecListItemData m_vecItemData; - CShellPidl m_ShellPidl; - TVITEMDATA m_tvid; - LPSHELLFOLDER m_psfSubFolder; - LPITEMIDLIST m_pidlInternet; - IMalloc *m_pMalloc; - HANDLE m_hThreads[MAX_THREADS]; - CWinThread *m_pThreads[MAX_THREADS]; - CEvent m_event[MAX_THREADS]; - CEvent m_MonitorEvent[MAX_THREADS]; - CString m_sMonitorPath; - CIEShellDragDrop m_ShellDragDrop; - CShellDetails m_ShellDetails; - CShellSettings m_ShellSettings; - CString m_sColumns; - CString m_sFileFilter; - CStringList m_FilterLookup; - CStringList m_ExcludedLookup; - int m_nThreadCount; - bool m_bCallBack; - bool m_bNoExt; - bool m_bRefreshAllowed; - bool m_bPopulateInit; - bool m_bInitiliazed; - bool m_bNotifyParent; -}; -///////////////////////////////////////////////////////////////////////////// -typedef struct FC_THREADINFO -{ - HANDLE hEvent; - HANDLE hMonitorEvent; - CIEShellListCtrl *pListCtrl; -} FC_THREADINFO, *PFC_THREADINFO; - -inline const CShellSettings &CIEShellListCtrl::GetShellSettings() const -{ - return m_ShellSettings; -} - -inline CShellSettings &CIEShellListCtrl::GetShellSettings() -{ - return m_ShellSettings; -} - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif //__IESHELLLISTCTRL_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListView.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListView.h deleted file mode 100644 index cf4d6fb2539..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellListView.h +++ /dev/null @@ -1,81 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __IESHELLLISTVIEW_H__ -#define __IESHELLLISTVIEW_H__ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// IEShellListView.h : header file -// -#include "IEShellListCtrl.h" -#include "UIListView.h" -#include "HtmlCtrl.h" -///////////////////////////////////////////////////////////////////////////// -// CIEShellListView window - -class CTRL_EXT_CLASS CIEShellListView : public CUIListView -{ -// Construction -protected: - CIEShellListView(); - DECLARE_DYNCREATE(CIEShellListView) - -// Attributes -public: - CIEShellListCtrl &GetShellListCtrl(); - -// Operations -public: -// Overrides - -protected: - virtual void LoadShellFolderItems(const CRefreshShellFolder &rFolder); - virtual void SetActiveWindow(CWnd *pWnd); - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEShellListView) - public: - virtual void CreateListCtrl(); - virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); - //}}AFX_VIRTUAL -// Implementation -public: - virtual ~CIEShellListView(); - -// Generated message map functions -protected: - //{{AFX_MSG(CIEShellListView) - // NOTE - the ClassWizard will add and remove member functions here. - afx_msg LRESULT OnAppUpdateAllViews(WPARAM wParam,LPARAM lParam); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - afx_msg LRESULT OnCBIESelChange(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnCBIEHitEnter(WPARAM wParam,LPARAM lParam); - DECLARE_MESSAGE_MAP() -private: - CWnd *m_pActiveWnd; - CHtmlCtrl m_htmlCtrl; -}; -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif //__IESHELLLISTVIEW_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeCtrl.h deleted file mode 100644 index b11ac6b0fb1..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeCtrl.h +++ /dev/null @@ -1,137 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __IESHELLTREECTRL_H__ -#define __IESHELLTREECTRL_H__ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXMT_H__ -#include "afxmt.h" -#endif -// IEShellTreeCtrl.h : header file -// -#include -#include "IEFolderTreeCtrl.h" -#include "IEShellDragDrop.h" -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeCtrl window - -class CTRL_EXT_CLASS CIEShellTreeCtrl : public CIEFolderTreeCtrl -{ -// Construction -public: - CIEShellTreeCtrl(); - -// Attributes -public: - void SetNotifyParent(bool bNotifyParent) { m_bNotifyParent = bNotifyParent; } - bool RefreshAllowed() { return m_bRefreshAllowed; } - void SetRefreshAllowed(bool bRefresh) { m_bRefreshAllowed = bRefresh; } - void SetListCtrlWnd(HWND hWnd) { m_hListWnd = hWnd; } - void SetComboBoxWnd(HWND hWnd) { m_hComboWnd = hWnd; } - CString GetSelectedPath() { return GetPathName(); } -// Operations -public: - virtual void UpOneLevel(HTREEITEM hItem=NULL); - virtual void ShellExecute(HTREEITEM hItem,LPCTSTR pszVerb=NULL); - virtual void SetNotificationObject(bool bNotify); - virtual bool LoadFolderItems(LPCTSTR pszPath=NULL); - virtual bool GetFolderInfo(HTREEITEM hItem,CString &sPath,CString &sName); - virtual void Refresh(); - virtual HTREEITEM FindPidl(LPITEMIDLIST pidlAbs,BOOL bSelect=TRUE); - virtual HTREEITEM ExpandPidl(LPITEMIDLIST pidlAbs); - virtual HTREEITEM ExpandMyComputer(LPITEMIDLIST pidlAbs); -// Overrides -protected: - virtual void RefreshComboBox(LPTVITEMDATA lptvid); - virtual void DestroyThreads(); - virtual void CreateFileChangeThreads(HWND hwnd); - virtual void CreateFileChangeThread (const CString& sPath,HWND hwnd); - virtual HTREEITEM SearchSiblings(HTREEITEM hItem,LPITEMIDLIST pidlAbs); - virtual HTREEITEM FindItem(HTREEITEM hItem, const CString& strTarget); - virtual UINT DeleteChildren(HTREEITEM hItem); - virtual bool SHMoveFile(HTREEITEM hSrcItem,HTREEITEM hDestItem); - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEShellTreeCtrl) - virtual BOOL OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult ); - virtual bool Expanding(NM_TREEVIEW *nmtvw); - virtual CRefresh *CreateRefreshObject(HTREEITEM hItem,LPARAM lParam); - virtual DROPEFFECT DoDragDrop(NM_TREEVIEW* pNMTreeView,COleDataSource *pOleDataSource); - virtual bool EndLabelEdit(HTREEITEM hItem,LPCTSTR pszText); - virtual BOOL TransferItem(HTREEITEM hitemDrag, HTREEITEM hitemDrop); - protected: - virtual void Init(); - virtual void ShowProperties(HTREEITEM hItem); - virtual void ShowPopupMenu(HTREEITEM hItem,CPoint point); - virtual void DoubleClick(HTREEITEM hItem); - virtual void DeleteKey(HTREEITEM hItem); - virtual void GoBack(HTREEITEM hItem); - virtual void PreSubclassWindow(); - virtual void UpdateEvent(LPARAM lHint,CObject *pHint); - virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo); - virtual bool DragOver(CDD_OleDropTargetInfo *pInfo); - virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo); - virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo); - //}}AFX_VIRTUAL -// Implementation -public: - virtual ~CIEShellTreeCtrl(); - -// Generated message map functions -protected: - //{{AFX_MSG(CIEShellTreeCtrl) - // NOTE - the ClassWizard will add and remove member functions here. - afx_msg BOOL OnRclick(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnDestroy(); - afx_msg LRESULT OnAppDirChangeEvent(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnCBIESelChange(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnAppPopulateTree(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppCbIeHitEnter(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - enum { MAX_THREADS=32 }; - static UINT ThreadFunc (LPVOID pParam); - LPTVITEMDATA m_lptvid; - HANDLE m_hThreads[MAX_THREADS]; - CWinThread *m_pThreads[MAX_THREADS]; - CEvent m_event[MAX_THREADS]; - int m_nThreadCount; - bool m_bRefreshAllowed; - bool m_bNotifyParent; - CIEShellDragDrop m_ShellDragDrop; - HWND m_hListWnd; - HWND m_hComboWnd; -}; - -///////////////////////////////////////////////////////////////////////////// -typedef struct DC_THREADINFO -{ - HANDLE hEvent; - CIEShellTreeCtrl *pTreeCtrl; - CString sPath; -} DC_THREADINFO, *PDC_THREADINFO; - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif //__IESHELLTREECTRL_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeView.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeView.h deleted file mode 100644 index d3c68966c10..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/IEShellTreeView.h +++ /dev/null @@ -1,84 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __IESHELLTREEVIEW_H__ -#define __IESHELLTREEVIEW_H__ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// IEShellTreeView.h : header file -// -#include "IEShellTreeCtrl.h" -#include "UITreeView.h" -///////////////////////////////////////////////////////////////////////////// -// CIEShellTreeView window - -class CTRL_EXT_CLASS CIEShellTreeView : public CUITreeView -{ -// Construction -protected: - CIEShellTreeView(); - DECLARE_DYNCREATE(CIEShellTreeView) - -// Attributes -public: - CIEShellTreeCtrl &GetShellTreeCtrl(); - void SetPath(LPCTSTR pszPath); - LPTVITEMDATA GetSelectedItemData(); -// Operations -public: -// Overrides - virtual bool PopulateTree(LPCTSTR pszPath); -protected: - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEShellTreeView) - virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); - virtual void CreateTreeCtrl(); - virtual void OnInitialUpdate(); - //}}AFX_VIRTUAL -// Implementation -public: - virtual ~CIEShellTreeView(); - -// Generated message map functions -protected: - //{{AFX_MSG(CIEShellTreeView) - // NOTE - the ClassWizard will add and remove member functions here. - afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - bool m_bPopulated; - CString m_sPath; -}; -///////////////////////////////////////////////////////////////////////////// -inline void CIEShellTreeView::SetPath(LPCTSTR pszPath) -{ - m_sPath = pszPath; -} - -inline CIEShellTreeCtrl &CIEShellTreeView::GetShellTreeCtrl() -{ - return static_cast(GetTreeCtrl()); -} - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif //__IESHELLTREEVIEW_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/InPlaceEdit.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/InPlaceEdit.h deleted file mode 100644 index a49ea2f3781..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/InPlaceEdit.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __INPLACEEDIT_H__ -#define __INPLACEEDIT_H__ -///////////////////////////////////////////////////////////////////////////// -// CInPlaceEdit window -// Zafir Anjum - -class CInPlaceEdit : public CEdit -{ -// Construction -public: - CInPlaceEdit(int iItem, int iSubItem, CString sInitText); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CInPlaceEdit) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CInPlaceEdit(); - - // Generated message map functions -protected: - //{{AFX_MSG(CInPlaceEdit) - afx_msg void OnKillFocus(CWnd* pNewWnd); - afx_msg void OnNcDestroy(); - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -private: - int m_iItem; - int m_iSubItem; - CString m_sInitText; - BOOL m_bESC; // To indicate whether ESC key was pressed -}; -///////////////////////////////////////////////////////////////////////////// - - -#endif //__INPLACEEDIT_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/LocaleInfo.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/LocaleInfo.h deleted file mode 100644 index cbf5d09de1b..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/LocaleInfo.h +++ /dev/null @@ -1,111 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// LocaleInfo.h: interface for the CLocaleInfo class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_LOCALEINFO_H__53D6820E_C28F_4DB9_AB7D_87B9E8EAE233__INCLUDED_) -#define AFX_LOCALEINFO_H__53D6820E_C28F_4DB9_AB7D_87B9E8EAE233__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -class CTRL_EXT_CLASS CLocaleInfo -{ -public: - CLocaleInfo(); - virtual ~CLocaleInfo(); -public: -// Properties - LPCTSTR GetNegativeSign() const; - LPCTSTR GetDecimalSep() const; - LPCTSTR GetThousandSep() const; - LPCTSTR GetLongDate() const; - LPCTSTR GetShortDate() const; - LPCTSTR GetShortTime() const; - LPCTSTR GetLongTime() const; - LPCTSTR GetDateSep() const; - LPCTSTR GetTimeSep() const; - CString ConvertStdToWinFormat(LPCTSTR pszFormat); - CString FormatDateTime(const COleDateTime &oleDateTime); - CString FormatDateTime(const FILETIME &ft); -protected: - void StdToWinFormatCode(CString &sCode); - void GetAllLocaleInfo(); - void AllocLocaleInfo(LCTYPE lctype,LPTSTR *pszInfo); -private: - LPTSTR m_pszNegativeSign; - LPTSTR m_pszDecimalSep; - LPTSTR m_pszThousandSep; - LPTSTR m_pszLongDate; - LPTSTR m_pszShortDate; - LPTSTR m_pszLongTime; - LPTSTR m_pszShortTime; - LPTSTR m_pszDateSep; - LPTSTR m_pszTimeSep; -public: - static CLocaleInfo *CLocaleInfo::Instance(); -}; - -inline LPCTSTR CLocaleInfo::GetNegativeSign() const -{ - return m_pszNegativeSign; -} - -inline LPCTSTR CLocaleInfo::GetDecimalSep() const -{ - return m_pszDecimalSep; -} - -inline LPCTSTR CLocaleInfo::GetThousandSep() const -{ - return m_pszThousandSep; -} - -inline LPCTSTR CLocaleInfo::GetLongDate() const -{ - return m_pszLongDate; -} - -inline LPCTSTR CLocaleInfo::GetShortTime() const -{ - return m_pszShortTime; -} - -inline LPCTSTR CLocaleInfo::GetLongTime() const -{ - return m_pszLongTime; -} - -inline LPCTSTR CLocaleInfo::GetShortDate() const -{ - return m_pszShortDate; -} - -inline LPCTSTR CLocaleInfo::GetDateSep() const -{ - return m_pszDateSep; -} - -inline LPCTSTR CLocaleInfo::GetTimeSep() const -{ - return m_pszTimeSep; -} - -#endif // !defined(AFX_LOCALEINFO_H__53D6820E_C28F_4DB9_AB7D_87B9E8EAE233__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/PIDL.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/PIDL.h deleted file mode 100644 index 138d7c17c7c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/PIDL.h +++ /dev/null @@ -1,108 +0,0 @@ -//////////////////////////////////////////////////////////////////// -// PIDL.h: interface for the CPIDL class. -// - -#ifndef __PIDL_H -#define __PIDL_H - -#include - -class CPIDL -{ -public: - LPITEMIDLIST m_pidl; - -// == Construction/Destruction == // - - CPIDL() : m_pidl(NULL) {} - - // Copy constructor - CPIDL(const CPIDL& cpidl) : m_pidl(NULL) { Set(cpidl); } - - // From path (szPath relative to the folder psf) - see Set() - CPIDL(LPCTSTR szPath, LPSHELLFOLDER psf = m_sfDesktop); - - // From a list ptr - *doesn't* copy the actual data - see Set() - CPIDL(LPITEMIDLIST pidl) : m_pidl(pidl) {} - - virtual ~CPIDL(); - - -// == Assignment == // - - // Make a copy of cpidl's list data - HRESULT Set(const CPIDL& cpidl); - - // Set by path: szPath relative to the folder psf. - HRESULT Set(LPCTSTR szPath, LPSHELLFOLDER psf = m_sfDesktop); - - // Points the CPIDL to an existing item list: does *not* copy - // the actual data - just the pointer (unlike MakeCopyOf()). - HRESULT Set(LPITEMIDLIST pidl); - - // Special Assignment: Copies the data of an exisiting list. - HRESULT MakeCopyOf(LPITEMIDLIST pidl); - - // Special Assignment: Makes a PIDL rooted at the desktop. - HRESULT MakeAbsPIDLOf(LPSHELLFOLDER psf, LPITEMIDLIST pidl); - - -// == Item Access == // - - // Returns a pointer to the first item in the list - LPSHITEMID GetFirstItemID() const { return (LPSHITEMID)m_pidl; } - - // Points to the next item in the list - void GetNextItemID(LPSHITEMID& pid) const - { (LPBYTE &)pid += pid->cb; } - - -// == General Operations == // - - void Free(); // Frees the memory used by the item id list - UINT GetSize() const; // Counts the actual memory in use - - // Split into direct parent and object pidls - void Split(CPIDL& parent, CPIDL& obj) const; - - // Concatenation - CPIDL operator + (CPIDL& pidl) const; // using + operator - static void Concat(const CPIDL &a, const CPIDL& b, - CPIDL& result); // result = a+b (faster) - - -// == Shell Name-space Access Helper Functions == // - - // 1) Won't always work: psf->GetUIObjectOf(pidl, ... ) - // 2) Will always work: pidl.GetUIObjectOf(..., psf) - HRESULT GetUIObjectOf(REFIID riid, LPVOID *ppvOut, - HWND hWnd = NULL, LPSHELLFOLDER psf = m_sfDesktop); - - // Places the STRRET string in the cStr field. - void ExtractCStr(STRRET& strRet) const; - - -// == Conversion Operators == // - - operator LPITEMIDLIST& () { return m_pidl; } - operator LPITEMIDLIST * () { return &m_pidl; } - operator LPCITEMIDLIST () const { return m_pidl; } - operator LPCITEMIDLIST* () const - { return (LPCITEMIDLIST *)&m_pidl; } - -protected: - static LPSHELLFOLDER m_sfDesktop; // desktop object - static LPMALLOC m_pAllocator; // system allocator - - // allocate memory for the pidl using the system allocator - void AllocMem(int iAllocSize); - - // initializer (used for automatic initialization) - static struct pidl_initializer { - pidl_initializer(); - ~pidl_initializer(); - } m_initializer; - friend struct pidl_initializer; -}; - -#endif // __PIDL_H diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Refresh.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Refresh.h deleted file mode 100644 index 9fffc2b9413..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Refresh.h +++ /dev/null @@ -1,68 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __REFRESH_H__ -#define __REFRESH_H__ - -#include "UIFolderRefresh.h" - -// SHELL ITEM DATA STRUCTURES - -// List Control -typedef struct tagLVID -{ - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - ULONG ulAttribs; - LPARAM lParam; -} LVITEMDATA, *LPLVITEMDATA; - -// Tree Control -typedef struct tagTVID -{ - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - LPARAM lParam; -} TVITEMDATA, *LPTVITEMDATA; - -#include -using namespace std; -typedef vector vecItemData; - -class CRefreshIEFolder : public CRefresh -{ -private: - CRefreshIEFolder(const CRefreshIEFolder &rRefresh); - CRefreshIEFolder &operator=(const CRefreshIEFolder &rRefresh); -public: - CRefreshIEFolder(HTREEITEM hItem,LPARAM lParam) : CRefresh(hItem,lParam) {} - LPTVITEMDATA GetItemData() const { return (LPTVITEMDATA)GetExtData(); } -}; - -class CRefreshShellFolder : public CRefresh -{ -private: - CRefreshShellFolder(const CRefreshShellFolder &rRefresh); - CRefreshShellFolder &operator=(const CRefreshShellFolder &rRefresh); -public: - CRefreshShellFolder(HTREEITEM hItem,LPARAM lParam) : CRefresh(hItem,lParam) {} - LPTVITEMDATA GetItemData() const { return (LPTVITEMDATA)GetExtData(); } -}; - -#endif //__REFRESH_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/SeaShellExt.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/SeaShellExt.h deleted file mode 100644 index 9bf2f5b285a..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/SeaShellExt.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __SEASHELLEXT_H__ -#define __SEASHELLEXT_H__ - -#ifdef _DEBUG -#pragma warning(disable : 4127) -#endif -#pragma warning(disable : 4514) -#pragma warning(disable : 4710) -#pragma warning(disable : 4786) -#pragma warning(disable : 4511 4512) - -#include -#include -#include -#include -#include -#include "W2KFix.h" - -#define CTRL_EXT_CLASS - -#endif //__SEASHELLEXT_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellContextMenu.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellContextMenu.h deleted file mode 100644 index a5f0e16d7b0..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellContextMenu.h +++ /dev/null @@ -1,381 +0,0 @@ -/***************************************************************************/ -/* NOTE: */ -/* This document is copyright (c) by Oz Solomonovich. All non-commercial */ -/* use is allowed, as long as this document is not altered in any way, and */ -/* due credit is given. */ -/***************************************************************************/ - -// ShellContextMenu.h : header file -// - -#if !defined(AFX_SHELLCONTEXTMENU_H__24BAC666_2B03_11D3_B9C1_0000861DFCE7__INCLUDED_) -#define AFX_SHELLCONTEXTMENU_H__24BAC666_2B03_11D3_B9C1_0000861DFCE7__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -//#define USESTL - -#if defined USESTL -#include -#include -using namespace std; -typedef vector vecODMenu; -#define STL_FOR_ITERATOR(t,v) for(t::iterator it=v.begin();it != v.end();it++) -#define STL_ERASE_ALL(v) v.erase(v.begin(),v.end()) -#define STL_GET_CURRENT(v) *it -#define STL_ADD_ITEM(v,i) v.push_back(i); -#define STL_EMPTY(v) v.empty() -#define STL_SORT(v,f,c) TRACE0("Sorting with STL\n"); is_less_than_pidl::psf = f; sort(v.begin(),v.end(),c); -#else -#include -typedef CArray vecODMenu; -#define STL_FOR_ITERATOR(t,v) for (int i=0;i < v.GetSize();i++) -#define STL_ERASE_ALL(v) v.RemoveAll() -#define STL_GET_CURRENT(v) v.GetAt(i) -#define STL_ADD_ITEM(v,i) v.Add(i); -#define STL_EMPTY(v) v.GetSize() == 0 -#define STL_SORT(v,f,c) TRACE0("Sorting with MFC\n"); is_less_than_pidl::psf = f; qsort(v.GetData(),v.GetSize(),sizeof(void*),c); -#endif - -#include "PIDL.h" - -class CShellContextMenu -{ - LPCONTEXTMENU m_lpcm; - LPSHELLFOLDER m_psfParent; - LPITEMIDLIST m_pidl; - LPITEMIDLIST *m_ppidl; - UINT m_cidl; - CString m_sAbsPath; - HWND m_hWnd; - CMenu * m_pSendToMenu; - vecODMenu m_OwnerDrawMenus; - CSize m_szOldButtonSize; -public: - CShellContextMenu(HWND m_hWnd, const CString &sAbsPath, LPITEMIDLIST *ppidl, UINT cidl, LPSHELLFOLDER psfParent); - ~CShellContextMenu(); - - bool IsMenuCommand(int iCmd) const; - void InvokeCommand(int iCmd) const; - - void CShellContextMenu::SetMenu(CMenu *pMenu); - -protected: - void AddKey(CString &sDestKey,const CString &sSrcKey) const; - CString GetExt(const CString &sPath) const; - void GetAppDetails(const CString &sAppName,CString &sDisplayName,CString &sCommand,HICON &hAppIcon) const; - void CShellContextMenu::FillSendToMenu(CMenu *pMenu, - LPSHELLFOLDER pSF, UINT &idm); - void FillOpenWithMenu(CMenu *pMenu,const CString &sExt); -}; - -///////////////////////////////////////////////////////////////////////////// -// Addition: Philip Oldaker -// Maybe overkill to sort the SendTo menu but could be useful -///////////////////////////////////////////////////////////////////////////// -class CShCMSort -{ -public: - CShCMSort(UINT nID,LPITEMIDLIST pidl,HICON hIcon,const CString &sText,DWORD dwItemData); - CShCMSort(); - ~CShCMSort(); - CShCMSort(const CShCMSort &rOther); - const CShCMSort &operator=(const CShCMSort &rOther); -// Properties - void SetIndent(int nIndent); - int GetIndent() const; -public: - void SetImage(int nImage); - int GetImage() const; - void SetSelImage(int nSelImage); - int GetSelImage() const; - void SetOverlayImage(int nOverlayImage); - int GetOverlayImage() const; - void SetPidl(LPITEMIDLIST pidl); - const LPITEMIDLIST GetPidl() const; - void SetIcon(HICON hIcon); - HICON GetIcon() const; - void SetItemID(UINT nID); - UINT GetItemID() const; - void SetText(const CString &sText); - const CString &GetText() const; - void SetItemData(DWORD dwItemData); - DWORD GetItemData() const; -private: - // relative pidl - LPITEMIDLIST m_pidl; - int m_nIndent; - int m_nImage; - int m_nSelImage; - int m_nOverlayImage; - HICON m_hIcon; - UINT m_ID; - CString m_sText; - DWORD m_dwItemData; -}; - -inline void CShCMSort::SetIndent(int nIndent) -{ - m_nIndent = nIndent; -} - -inline int CShCMSort::GetIndent() const -{ - return m_nIndent; -} - -inline void CShCMSort::SetImage(int nImage) -{ - m_nImage = nImage; -} - -inline int CShCMSort::GetImage() const -{ - return m_nImage; -} - -inline void CShCMSort::SetSelImage(int nSelImage) -{ - m_nSelImage = nSelImage; -} - -inline int CShCMSort::GetSelImage() const -{ - return m_nSelImage; -} - -inline void CShCMSort::SetOverlayImage(int nOverlayImage) -{ - m_nOverlayImage = nOverlayImage; -} - -inline int CShCMSort::GetOverlayImage() const -{ - return m_nOverlayImage; -} - -inline CShCMSort::CShCMSort() -{ - m_ID = 0; - m_dwItemData = 0; - m_pidl = NULL; - m_hIcon = NULL; - m_nIndent = 0; - m_nImage = 0; - m_nSelImage = 0; - m_nOverlayImage = 0; -} - -inline CShCMSort::CShCMSort(UINT nID,LPITEMIDLIST pidl,HICON hIcon,const CString &sText,DWORD dwItemData) -: m_ID(nID), - m_pidl(pidl), - m_hIcon(hIcon), - m_sText(sText), - m_dwItemData(dwItemData) -{ -} - -inline CShCMSort::~CShCMSort() -{ - -} - - -inline CShCMSort::CShCMSort(const CShCMSort &rOther) - : m_pidl(rOther.m_pidl), - m_hIcon(rOther.m_hIcon), - m_ID(rOther.m_ID), - m_sText(rOther.m_sText), - m_dwItemData(rOther.m_dwItemData), - m_nIndent(rOther.m_nIndent), - m_nImage(rOther.m_nImage), - m_nSelImage(rOther.m_nSelImage), - m_nOverlayImage(rOther.m_nOverlayImage) -{ -} - -inline const CShCMSort &CShCMSort::operator=(const CShCMSort &rOther) -{ - if (this == &rOther) - return *this; - - m_pidl = rOther.m_pidl; - m_hIcon = rOther.m_hIcon; - m_ID = rOther.m_ID; - m_sText = rOther.m_sText; - m_dwItemData = rOther.m_dwItemData; - m_nIndent = rOther.m_nIndent; - m_nImage = rOther.m_nImage; - m_nSelImage = rOther.m_nSelImage; - m_nOverlayImage = rOther.m_nOverlayImage; - - return *this; -} - -inline void CShCMSort::SetPidl(LPITEMIDLIST pidl) -{ - m_pidl = pidl; -} - -inline const LPITEMIDLIST CShCMSort::GetPidl() const -{ - return m_pidl; -} - -inline void CShCMSort::SetIcon(HICON hIcon) -{ - m_hIcon = hIcon; -} - -inline HICON CShCMSort::GetIcon() const -{ - return m_hIcon; -} - -inline void CShCMSort::SetItemID(UINT nID) -{ - m_ID = nID; -} - -inline UINT CShCMSort::GetItemID() const -{ - return m_ID; -} - -inline void CShCMSort::SetText(const CString &sText) -{ - m_sText = sText; -} - -inline const CString &CShCMSort::GetText() const -{ - return m_sText; -} - -inline void CShCMSort::SetItemData(DWORD dwItemData) -{ - m_dwItemData = dwItemData; -} - -inline DWORD CShCMSort::GetItemData() const -{ - return m_dwItemData; -} - -// STL predicate helpers - -// sort by pidl -class is_less_than_pidl -{ -public: - is_less_than_pidl() {} - // STL - bool operator()(const CShCMSort *x,const CShCMSort *y) - { - return ComparePidls(x,y) < 0; - } - int ComparePidls(const CShCMSort *x,const CShCMSort *y) - { - ASSERT(is_less_than_pidl::psf); - HRESULT hr = is_less_than_pidl::psf->CompareIDs(0, x->GetPidl(), y->GetPidl()); - if (FAILED(hr)) - return 0; - return (short)hr; - } - // MFC - static int compare(const void *x, const void *y) - { - const CShCMSort *x1 = *(const CShCMSort**)x; - const CShCMSort *y1 = *(const CShCMSort**)y; - return is_less_than_pidl().ComparePidls(x1,y1); - } -public: - CTRL_EXT_CLASS static LPSHELLFOLDER psf; -}; - -class is_greater_than_pidl -{ -public: - is_greater_than_pidl() { } - // STL - bool operator()(const CShCMSort *x,const CShCMSort *y) - { - return ComparePidls(x,y) > 0; - } - int ComparePidls(const CShCMSort *x,const CShCMSort *y) - { - HRESULT hr = is_greater_than_pidl::psf->CompareIDs(0, x->GetPidl(), y->GetPidl()); - if (FAILED (hr)) - return 0; - return (short)hr; - } - // MFC - static int compare(const void *x, const void *y) - { - const CShCMSort *x1 = *(const CShCMSort**)x; - const CShCMSort *y1 = *(const CShCMSort**)y; - return is_greater_than_pidl().ComparePidls(x1,y1); - } -public: - CTRL_EXT_CLASS static LPSHELLFOLDER psf; -}; - -// sort by text -class is_less_than_text -{ -public: - // STL - bool operator()(const CShCMSort *x,const CShCMSort *y) - { - return CompareText(x,y) < 0; - } - int CompareText(const CShCMSort *x,const CShCMSort *y) - { - return x->GetText() < y->GetText(); - } - // MFC - static int compare(const void *x, const void *y) - { - const CShCMSort *x1 = *(const CShCMSort**)x; - const CShCMSort *y1 = *(const CShCMSort**)y; - return is_less_than_text().CompareText(x1,y1); - } -}; - -class is_greater_than_text -{ -public: - // STL - bool operator()(const CShCMSort *x,const CShCMSort *y) - { - return CompareText(x,y) < 0; - } - int CompareText(const CShCMSort *x,const CShCMSort *y) - { - return x->GetText() > y->GetText(); - } - // MFC - static int compare(const void *x, const void *y) - { - const CShCMSort *x1 = *(const CShCMSort**)x; - const CShCMSort *y1 = *(const CShCMSort**)y; - return is_greater_than_text().CompareText(x1,y1); - } -}; - -#if defined USESTL -typedef vector vecCMSort; -#define STL_SORT_FUNC is_less_than_pidl() -#else -typedef CArray vecCMSort; -#define STL_SORT_FUNC is_less_than_pidl::compare -#endif - -///////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SHELLCONTEXTMENU_H__24BAC666_2B03_11D3_B9C1_0000861DFCE7__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellDetails.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellDetails.h deleted file mode 100644 index 1da920981d2..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellDetails.h +++ /dev/null @@ -1,43 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __SHELLDETAILS_H__ -#define __SHELLDETAILS_H__ - -//////////////////////////////////////////////// -// CShellDetails -//////////////////////////////////////////////// -class CShellDetails -{ -public: - CShellDetails(const CShellDetails &rOther); - const CShellDetails &operator=(const CShellDetails &rOther); - CShellDetails(); - virtual ~CShellDetails(); -// Attributes - void SetShellDetails(IUnknown *pUnk); - bool IsValidDetails(); -// Operations - HRESULT GetDetailsOf(LPCITEMIDLIST pidl,UINT iColumn,LPSHELLDETAILS pDetail); -protected: - void FreeInterfaces(); -private: - IUnknown *m_pUnk; -}; - - -#endif //__SHELLDETAILS_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellPidl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellPidl.h deleted file mode 100644 index 073aa24ed73..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellPidl.h +++ /dev/null @@ -1,158 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// ShellPidl.h: interface for the CShellPidl class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_SHELLPIDL_H__D704F47E_1D35_4C7C_9F90_B3071B25DCB2__INCLUDED_) -#define AFX_SHELLPIDL_H__D704F47E_1D35_4C7C_9F90_B3071B25DCB2__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "Refresh.h" - -class CTRL_EXT_CLASS CShellPidl -{ -public: - CShellPidl(); - virtual ~CShellPidl(); -public: - virtual BOOL PopupTheMenu(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST *lpi, UINT cidl, LPPOINT lppt); - virtual BOOL HandleMenuMsg(HWND hwnd, LPSHELLFOLDER lpsfParent, - LPITEMIDLIST lpi, UINT uMsg, WPARAM wParam, LPARAM lParam); -#ifdef _UNICODE - STDMETHOD(StrRetToStr)(STRRET StrRet, LPTSTR* str, LPITEMIDLIST pidl); -#else - STDMETHOD(StrRetToStr)(STRRET StrRet, LPTSTR* str, LPITEMIDLIST pidl); -#endif - STDMETHOD(ResolveChannel)(IShellFolder* pFolder, LPCITEMIDLIST pidl, LPTSTR* lpszURL); - STDMETHOD(ResolveHistoryShortcut)(LPSHELLFOLDER pFolder,LPCITEMIDLIST *ppidl,CString &sURL); - STDMETHOD(ResolveInternetShortcut)(LPCTSTR lpszLinkFile, LPTSTR* lpszURL); - STDMETHOD(ResolveLink)(HWND hWnd,LPCTSTR lpszLinkFile, LPTSTR* lpszPath); - STDMETHOD(SHPathToPidlEx)(LPCTSTR szPath, LPITEMIDLIST* ppidl, LPSHELLFOLDER pFolder=NULL); - STDMETHOD(SHPidlToPathEx)(LPCITEMIDLIST pidl, CString &sPath, LPSHELLFOLDER pFolder=NULL,DWORD dwFlags=SHGDN_FORPARSING); - LPITEMIDLIST CopyItemIDList(LPITEMIDLIST pidl); - LPITEMIDLIST CopyItemID(LPITEMIDLIST pidl,int n=0); - LPITEMIDLIST CopyLastItemID(LPITEMIDLIST pidl); - LPITEMIDLIST CopyAbsItemID(LPITEMIDLIST pidl,int n); - LPITEMIDLIST ConcatPidl(LPITEMIDLIST pidlDest,LPITEMIDLIST pidlSrc); - LPITEMIDLIST Next(LPCITEMIDLIST pidl); - LPSHELLFOLDER GetFolder(LPITEMIDLIST pidl); - LPSHELLFOLDER GetDesktopFolder(); - LPCITEMIDLIST GetEmptyPidl(); - bool IsDesktopFolder(LPSHELLFOLDER psFolder); - DWORD GetDragDropAttributes(COleDataObject *pDataObject); - DWORD GetDragDropAttributes(LPTVITEMDATA ptvid); - DWORD GetDragDropAttributes(LPLVITEMDATA plvid); - DWORD GetDragDropAttributes(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl); - UINT GetSize(LPCITEMIDLIST pidl); - UINT GetCount(LPCITEMIDLIST pidl); - void GetTypeName(LPITEMIDLIST lpi,CString &sTypeName); - void GetDisplayName(LPITEMIDLIST lpi,CString &sDisplayName); - int GetIcon(LPITEMIDLIST lpi, UINT uFlags); - void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, int &iImage, int &iSelectedImage); - BOOL GetName (LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, CString &sFriendlyName); - bool ComparePidls(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2); - bool CompareMemPidls(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2); - IMalloc *GetMalloc(); - void FreePidl(LPITEMIDLIST pidl); - void Free(void *pv); -protected: - STDMETHOD(GetURL)(IDataObject *pDataObj,CString &sURL); -private: - ITEMIDLIST m_EmptyPidl; - LPMALLOC m_pMalloc; - LPSHELLFOLDER m_psfDesktop; -}; - -//////////////////////////////////////////////// -// CShellPidlCompare -//////////////////////////////////////////////// -class CShellPidlCompare -{ -public: - CShellPidlCompare(LPSHELLFOLDER pFolder,LPITEMIDLIST pidl); - CShellPidlCompare(const CShellPidlCompare &rOther); - const CShellPidlCompare &operator=(const CShellPidlCompare &rOther); - bool operator==(const CShellPidlCompare &rhs) const; - bool operator<(const CShellPidlCompare &rhs) const; - virtual ~CShellPidlCompare(); - LPCITEMIDLIST GetPidl() const; - LPSHELLFOLDER GetFolder() const; -public: -protected: -private: - LPITEMIDLIST m_pidl; - LPSHELLFOLDER m_pFolder; -}; - - -inline CShellPidlCompare::CShellPidlCompare(const CShellPidlCompare &rOther) - : m_pidl(rOther.m_pidl), - m_pFolder(rOther.m_pFolder) -{ -} - -inline bool CShellPidlCompare::operator==(const CShellPidlCompare &rhs) const -{ - HRESULT hr = m_pFolder->CompareIDs(0,m_pidl,rhs.m_pidl); - return (short)hr == 0; -} - -inline bool CShellPidlCompare::operator<(const CShellPidlCompare &rhs) const -{ - HRESULT hr = m_pFolder->CompareIDs(0,m_pidl,rhs.m_pidl); - return (short)hr < 0; -} - -inline const CShellPidlCompare &CShellPidlCompare::operator=(const CShellPidlCompare &rOther) -{ - if (this == &rOther) - return *this; - - m_pidl = rOther.m_pidl; - m_pFolder = rOther.m_pFolder; - - return *this; -} - -inline CShellPidlCompare::CShellPidlCompare(LPSHELLFOLDER pFolder,LPITEMIDLIST pidl) -: m_pidl(pidl), - m_pFolder(pFolder) -{ - -} - -inline CShellPidlCompare::~CShellPidlCompare() -{ - -} - -inline LPCITEMIDLIST CShellPidlCompare::GetPidl() const -{ - return m_pidl; -} - -inline LPSHELLFOLDER CShellPidlCompare::GetFolder() const -{ - return m_pFolder; -} - -#endif // !defined(AFX_SHELLPIDL_H__D704F47E_1D35_4C7C_9F90_B3071B25DCB2__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellSettings.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellSettings.h deleted file mode 100644 index 250f55abeb0..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/ShellSettings.h +++ /dev/null @@ -1,57 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __SHELLSETTINGS_H__ -#define __SHELLSETTINGS_H__ - -//////////////////////////////////////////////// -// CShellSettings -//////////////////////////////////////////////// -class CShellSettings -{ -public: - CShellSettings(); - virtual ~CShellSettings(); - -public: -// attributes - bool DesktopHTML() const { return m_sfs.fDesktopHTML != 0; } - bool DontPrettyPath() const { return m_sfs.fDontPrettyPath != 0; } - bool DoubleClickInWebView() const { return m_sfs.fDoubleClickInWebView != 0; } - bool HideIcons() const { return m_sfs.fHideIcons != 0; } - bool MapNetDrvBtn() const { return m_sfs.fMapNetDrvBtn != 0; } - bool NoConfirmRecycle() const { return m_sfs.fNoConfirmRecycle != 0; } - bool ShowAllObjects() const { return m_sfs.fShowAllObjects != 0; } - bool ShowAttribCol() const { return m_sfs.fShowAttribCol != 0; } - bool ShowCompColor() const { return m_sfs.fShowCompColor != 0; } - bool ShowExtensions() const { return m_sfs.fShowExtensions != 0; } - bool ShowInfoTip() const { return m_sfs.fShowInfoTip != 0; } - bool ShowSysFiles() const { return m_sfs.fShowSysFiles != 0; } - bool Win95Classic() const { return m_sfs.fWin95Classic != 0; } -// operations - bool GetSettings(); - const SHELLFLAGSTATE &GetSFS() const { return m_sfs; } -// conversions - operator const SHELLFLAGSTATE& () { return m_sfs; } - operator const SHELLFLAGSTATE* () { return &m_sfs; } -protected: -private: - SHELLFLAGSTATE m_sfs; - HINSTANCE m_hinstShell32; -}; - -#endif //__SHELLSETTINGS_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextParse.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextParse.h deleted file mode 100644 index 26d6d3520d4..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextParse.h +++ /dev/null @@ -1,331 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __LINEPARSE_H__ -#define __LINEPARSE_H__ - -#define CPP_SPACE ' ' -#define CPP_TAB '\t' -#define CPP_NEWLINE '\n' -#define CPP_CRLF _T("\r\n") -#define CPP_WHITE_SPACE _T(" \t") - -class CTRL_EXT_CLASS CTextParse -{ - enum { MAX_BUF = 4096 }; -public: - CTextParse(); - CTextParse(const CTextParse &tp); - CTextParse(LPCTSTR pszLine); - ~CTextParse(); -public: - operator LPCTSTR() const; - operator LPTSTR(); - const CTextParse& operator=(LPCTSTR lpsz); - const CTextParse& operator=(const CTextParse &tp); - LPCTSTR operator++(int); - LPTSTR &operator++(); - LPCTSTR operator--(int); - LPCTSTR &operator--(); - int GetMax(); - void Set(LPCTSTR p); - void Reset(); - void SaveCurPos(); - void RestorePos(); - void SetAtCurrent(int c); - void MoveForward(); - void MoveBack(); - void MoveForward(int nCount); - void MoveBack(int nCount); - BOOL IsVirtualFunc(); - BOOL IsPrivate(); - BOOL IsPublic(); - BOOL IsProtected(); - BOOL IsEnd(); - BOOL IsClass(); - BOOL IsStartBrace(); - BOOL IsEndBrace(); - BOOL IsAccessSpecifier(); - BOOL IsMsgMap(); - BOOL IsDeclareMacro(); - BOOL IsStartCommentBlock(); - BOOL IsEndCommentBlock(); - BOOL IsConstructor(LPCTSTR pszClassName); - BOOL IsValidCPP(LPCTSTR pszText); - BOOL CharAtStart(int c); - BOOL CharAtStart(LPCTSTR strTok); - BOOL CharAtCurrent(int c); - BOOL CharAtCurrent(LPCTSTR strTok); - BOOL StringAtStart(LPCTSTR str); - BOOL StringAtCurrent(LPCTSTR str); - BOOL CharExist(int c,BOOL bForward = TRUE); - BOOL StringExist(LPCTSTR str); - BOOL StringExistInString(LPCTSTR str); - BOOL SkipWord(BOOL bForward = TRUE); - BOOL SkipWhiteSpace(BOOL bForward = TRUE); - - BOOL CharExistFromCurPos(int c,BOOL bForward = TRUE); - BOOL ValidCppCharExist(int c,BOOL bForward = TRUE); - BOOL CharExist(LPCTSTR str); - BOOL FindString(LPCTSTR str); - BOOL FindChar(int c); - BOOL MoveWhileWhiteSpace(BOOL bForward = TRUE); - BOOL MoveUntilWhiteSpace(BOOL bForward = TRUE); - BOOL MoveUntilChar(int c,BOOL bForward = TRUE); - BOOL MoveUntilChar(LPCTSTR strTok,BOOL bForward = TRUE); - BOOL MoveUntilString(LPCTSTR str,BOOL bForward = TRUE); - BOOL MoveWhileChar(int c,BOOL bForward = TRUE); - BOOL MoveWhileChar(LPCTSTR strTok,BOOL bForward = TRUE); - void MoveToLastChar(); - LPCTSTR CopyUntilWhiteSpace(); - LPCTSTR CopyUntilChar(int c); - LPCTSTR CopyUntilString(LPCTSTR pszText); - LPCTSTR CopyUntilChar(LPCTSTR strTok); - LPCTSTR CopyWhileChar(int c); - LPCTSTR CopyWhileChar(LPCTSTR strTok); - LPCTSTR CopyFuncUntilChar(LPCTSTR strTok); - LPCTSTR CopyUntilEnd(); - LPCTSTR CopyWhileWhiteSpace(); - BOOL IsCommentBlock(LPCTSTR strStart,LPCTSTR strEnd); - BOOL ExtractArgs(CString &sRet,CStringArray &asArgs); - LPCTSTR ExtractDeclareMacro(); - LPCTSTR ExtractConstructor(); - LPCTSTR ExtractFuncName(); - LPCTSTR ExtractClassName(); - LPCTSTR ExtractBaseClassName(); - LPCTSTR ExtractHTMLText(bool bRemoveCRLF=false); - LPCTSTR ExtractHTMLText(LPCTSTR pszUntil,bool bRemoveCRLF=false); - LPCTSTR ExtractHTMLLink(); - LPCTSTR ExtractDefaultArgs(); - LPCTSTR CopyWholeWord(); - bool FindWholeWord(LPCTSTR pszText); - int GetWordLen(); - int GetCurrentChar(); - bool SkipHTMLCommand(bool bSkipCRLF=true); - void SkipHTMLCommands(bool bSkipCRLF=true); -protected: - BOOL IsToken(LPCTSTR strTok,LPCTSTR p); - BOOL IsString(LPCTSTR str); -private: - LPCTSTR m_pLine; - LPCTSTR m_pStartLine; - LPCTSTR m_pSavePos; - TCHAR m_szCopyBuf[MAX_BUF+1]; - TCHAR m_szBuffer[MAX_BUF+1]; -}; - -inline void CTextParse::MoveForward() -{ - m_pLine = _tcsinc(m_pLine); -} - -inline void CTextParse::MoveBack() -{ - m_pLine = _tcsdec(m_pStartLine,m_pLine); -} - -inline void CTextParse::MoveForward(int nCount) -{ - m_pLine = _tcsninc(m_pLine,nCount); -} - -inline void CTextParse::MoveBack(int nCount) -{ - int i=nCount; - LPCTSTR p = m_pLine; - while (p > m_pStartLine && i > 0) - { - p = _tcsdec(m_pLine,p); - i--; - } - m_pLine = p; -} - -inline CTextParse::operator LPCTSTR() const -{ - return m_pStartLine; -} - -inline CTextParse::operator LPTSTR() -{ - Reset(); - return m_szBuffer; -} - -// prefix -inline LPCTSTR CTextParse::operator++(int) -{ - MoveForward(); - return (LPCTSTR&)*m_pLine; -} - -// postfix -inline LPTSTR &CTextParse::operator++() -{ - LPCTSTR p = m_pLine; - MoveForward(); - return (LPTSTR&)*p; -} - -inline LPCTSTR CTextParse::operator--(int) -{ - MoveBack(); - return m_pLine; -} - -inline LPCTSTR &CTextParse::operator--() -{ - LPCTSTR p = m_pLine; - MoveBack(); - return (LPCTSTR&)*p; -} - -inline BOOL CTextParse::IsEnd() -{ - return *m_pLine == '\0'; -} - -inline int CTextParse::GetMax() -{ - return MAX_BUF; -} - -inline int CTextParse::GetCurrentChar() -{ - return *m_pLine; -} - -inline void CTextParse::SetAtCurrent(int c) -{ - int i = m_pLine-m_szBuffer; - m_szBuffer[i] = c; -} - -inline void CTextParse::Set(LPCTSTR p) -{ - m_pStartLine = p; - m_pLine = p; - m_pSavePos = p; -} - -inline void CTextParse::Reset() -{ - m_pLine = m_pStartLine; -} - -inline void CTextParse::SaveCurPos() -{ - m_pSavePos = m_pLine; -} - -inline void CTextParse::RestorePos() -{ - m_pLine = m_pSavePos; -} - -inline BOOL CTextParse::CharAtStart(int c) -{ - return *m_pStartLine == c; -} - -inline BOOL CTextParse::CharAtStart(LPCTSTR strTok) -{ - return IsToken(strTok,m_pStartLine); -} - -inline BOOL CTextParse::CharAtCurrent(int c) -{ - return *m_pLine == c; -} - -inline BOOL CTextParse::CharAtCurrent(LPCTSTR strTok) -{ - return IsToken(strTok,m_pLine); -} - -inline BOOL CTextParse::StringAtStart(LPCTSTR str) -{ - return(_tcsncmp(m_pStartLine,str,_tcslen(str)) == 0); -} - -inline BOOL CTextParse::StringAtCurrent(LPCTSTR str) -{ - return(_tcsncmp(m_pLine,str,_tcslen(str)) == 0); -} - -inline BOOL CTextParse::CharExist(int c,BOOL bForward) -{ - return _tcschr(m_pStartLine,c) != NULL; -} - -inline BOOL CTextParse::StringExist(LPCTSTR str) -{ - return _tcsstr(m_pLine,str) != NULL; -} - -inline BOOL CTextParse::StringExistInString(LPCTSTR str) -{ - return _tcsstr(m_pStartLine,str) != NULL; -} - -inline BOOL CTextParse::SkipWord(BOOL bForward) -{ - return MoveUntilChar(CPP_WHITE_SPACE,bForward); -} - -inline BOOL CTextParse::SkipWhiteSpace(BOOL bForward) -{ - return MoveWhileChar(CPP_WHITE_SPACE,bForward); -} - -inline BOOL CTextParse::IsString(LPCTSTR str) -{ - return(_tcsncmp(m_pLine,str,_tcslen(str)) == 0); -} - -inline LPCTSTR CTextParse::CopyUntilWhiteSpace() -{ - return CopyUntilChar(CPP_WHITE_SPACE); -} - -inline LPCTSTR CTextParse::CopyWhileWhiteSpace() -{ - return CopyWhileChar(CPP_WHITE_SPACE); -} - -inline BOOL CTextParse::MoveWhileWhiteSpace(BOOL bForward) -{ - return MoveWhileChar(CPP_WHITE_SPACE,bForward); -} - -inline BOOL CTextParse::MoveUntilWhiteSpace(BOOL bForward) -{ - return MoveUntilChar(CPP_WHITE_SPACE,bForward); -} - -// move to last char -inline void CTextParse::MoveToLastChar() -{ - LPCTSTR p = m_pLine; - while (*p != '\0') - p = _tcsinc(p); - if (p != m_pLine) - p = _tcsdec(m_pStartLine,p); - m_pLine = p; -} - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextProgressCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextProgressCtrl.h deleted file mode 100644 index a4b97f65891..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/TextProgressCtrl.h +++ /dev/null @@ -1,97 +0,0 @@ -#if !defined(AFX_TEXTPROGRESSCTRL_H__4C78DBBE_EFB6_11D1_AB14_203E25000000__INCLUDED_) -#define AFX_TEXTPROGRESSCTRL_H__4C78DBBE_EFB6_11D1_AB14_203E25000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -// TextProgressCtrl.h : header file -// -// Written by Chris Maunder (cmaunder@mail.com) -// Copyright 1998. -// -// TextProgressCtrl is a drop-in replacement for the standard -// CProgressCtrl that displays text in a progress control. -// -// This code may be used in compiled form in any way you desire. This -// file may be redistributed by any means PROVIDING it is not sold for -// profit without the authors written consent, and providing that this -// notice and the authors name is included. If the source code in -// this file is used in any commercial application then an email to -// the me would be nice. -// -// This file is provided "as is" with no expressed or implied warranty. -// The author accepts no liability if it causes any damage to your -// computer, causes your pet cat to fall ill, increases baldness or -// makes you car start emitting strange noises when you start it up. -// -// Expect bugs. -// -// Please use and enjoy. Please let me know of any bugs/mods/improvements -// that you have found/implemented and I will fix/incorporate them into this -// file. -#include "UIData.h" -///////////////////////////////////////////////////////////////////////////// -// CTextProgressCtrl window - -class CTextProgressCtrl : public CUIODColumnCtrl -{ - DECLARE_DYNAMIC(CTextProgressCtrl) -// Construction -public: - CTextProgressCtrl(); - -// Attributes -public: - -// Operations -public: - int SetPos(int nPos); - int StepIt(); - void SetRange(int nLower, int nUpper); - void GetRange(int& nLower, int& nUpper) const; - int OffsetPos(int nPos); - int SetStep(int nStep); -// Attributes - void SetShowText(BOOL bShow); - COLORREF SetTextColor(COLORREF crTextClr = CLR_DEFAULT,COLORREF crSelTextClr=CLR_DEFAULT); - COLORREF GetTextColor() const; - COLORREF GetSelTextColor() const; - COLORREF SetBarColor(COLORREF crBarClr = CLR_DEFAULT,COLORREF crSelBarClr = CLR_DEFAULT); - COLORREF GetBarColor() const; - COLORREF GetSelBarColor() const; - COLORREF SetBgColor(COLORREF crBgClr = CLR_DEFAULT,COLORREF crSelBgClr = CLR_DEFAULT); - COLORREF GetBgColor() const; - COLORREF GetSelBgColor() const; -public: -// Overrides - virtual void DoPaint(CDC *PaintDC,CRect rcClient,bool bSelected); - -// Implementation -public: - virtual ~CTextProgressCtrl(); - - // Generated message map functions -protected: - int m_nPos, - m_nStepSize, - m_nMax, - m_nMin; - CString m_strText; - BOOL m_bShowText; - int m_nBarWidth; -private: - COLORREF m_crBarClr, - m_crSelBarClr, - m_crTextClr, - m_crSelTextClr, - m_crBgClr, - m_crSelBgClr; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TEXTPROGRESSCTRL_H__4C78DBBE_EFB6_11D1_AB14_203E25000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIApp.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIApp.h deleted file mode 100644 index b9fd8eb8fb9..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIApp.h +++ /dev/null @@ -1,117 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __UIAPP_H__ -#define __UIAPP_H__ - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -class CTRL_EXT_CLASS CUIApp : public CWinApp -{ - DECLARE_DYNAMIC(CUIApp) -public: - CUIApp(); - - void SetStatusBarText(UINT nPaneID,LPCTSTR Text,UINT nIconID=0); - void SetStatusBarText(UINT nPaneID,LPCTSTR Text,CView *pView,UINT nIconID=0); - void SetStatusBarText(UINT nPaneID,UINT nResID,UINT nIconID=0); - void SetStatusBarText(LPCTSTR Text); - void SetStatusBarIcon(UINT nPaneID,UINT nIconID,bool bAdd); - void SetStatusBarIdleMessage(); - CString GetRegAppKey(); - - static bool COMMessage(HRESULT hr,UINT nID); - static void ErrorMessage(UINT nID,DWORD dwError=0); - static bool COMMessage(HRESULT hr,LPCTSTR pszMess=NULL); - static void ErrorMessage(LPCTSTR pszMess=NULL,DWORD dwError=0); -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL -// CMultiDocTemplate* m_pWebSitesDocTemplate; - void ChangeProfile(LPCTSTR szRegistryKey,LPCTSTR szProfileName); - void RestoreProfile(); -// Implementation - CFrameWnd *GetMainFrame(CWnd *pWnd); - CView *GetView(CRuntimeClass *pClass); - CDocTemplate *GetFirstDocTemplate(); - CDocument *GetDocument(); -protected: - bool RegisterMyClass(); - BOOL FirstInstance(); - //{{AFX_MSG(CUIApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - CString m_strOldProfileName; - CString m_strOldRegistryKey; - CString m_sMyClassName; - UINT m_IDMyIcon; - bool m_bMyClassRegistered; -public: - void SetMyClass(const CString &sMyClassName,UINT nIconID); - LPCTSTR GetMyClass() const; - bool IsMyClassRegistered() const; -}; - -inline bool CUIApp::IsMyClassRegistered() const -{ - return m_bMyClassRegistered; -} - -inline void CUIApp::SetMyClass(const CString &sMyClassName,UINT nIconID) -{ - m_sMyClassName = sMyClassName; - m_IDMyIcon = nIconID; -} - -inline LPCTSTR CUIApp::GetMyClass() const -{ - return m_sMyClassName; -} - -///////////////////////////////////////////////////////////////////////////// -class CTRL_EXT_CLASS CAppReg -{ -public: - CAppReg(CWinApp *pApp,LPCTSTR szRegistryKey,LPCTSTR szProfileName); - ~CAppReg(); - CString GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL ); - BOOL WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue ); -private: - CUIApp *m_pApp; -}; - -inline BOOL CAppReg::WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue ) -{ - return m_pApp->WriteProfileString(lpszSection,lpszEntry,lpszValue); -} - -inline CString CAppReg::GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault) -{ - return m_pApp->GetProfileString(lpszSection,lpszEntry,lpszDefault); -} - - -#endif //__UIAPP_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICONT.H b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICONT.H deleted file mode 100644 index 06ed3d93ebf..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICONT.H +++ /dev/null @@ -1,46 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __OBJLIST_H__ -#define __OBJLIST_H__ - -#include "UIData.h" - -class CTRL_EXT_CLASS CUIObjList : public CObList -{ - DECLARE_SERIAL(CUIObjList) -public: - CUIObjList(); - ~CUIObjList(); - void DeleteAll(); - CUIListCtrlData* RemoveHead(); - CUIListCtrlData* GetNext(POSITION& rPos); - void Append(CUIListCtrlData* pListObj); - BOOL Remove(CUIListCtrlData* pListObj); -}; - -inline CUIListCtrlData* CUIObjList::RemoveHead() -{ - return (CUIListCtrlData*) CObList::RemoveHead(); -} - -inline CUIListCtrlData* CUIObjList::GetNext(POSITION& rPos) -{ - return (CUIListCtrlData*) CObList::GetNext(rPos); -} - -#endif // __OBJLIST_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolBar.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolBar.h deleted file mode 100644 index 66514c0d999..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolBar.h +++ /dev/null @@ -1,121 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef __COOLBAR_H -#define __COOLBAR_H - -////////////////// -// CCoolBar encapsulates IE common coolbar (rebar) for MFC. To use it, -// -// * derive your own CMyCoolBar from CCoolBar -// * implement OnCreateBands to create whatever bands you want -// * instantiate CMyCoolBar in your frame window as you would a toolbar -// * create and load it, etc from CMainFrame::OnCreate -// -// See MBTest for example of how to use. -// -class CTRL_EXT_CLASS CCoolBar : public CControlBar { -public: - CCoolBar(); - virtual ~CCoolBar(); - - BOOL Create(CWnd* pParentWnd, DWORD dwStyle, - DWORD dwAfxBarStyle = CBRS_ALIGN_TOP, - UINT nID = AFX_IDW_TOOLBAR); - - // message wrappers - BOOL GetBarInfo(LPREBARINFO lp) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_GETBARINFO, 0, (LPARAM)lp); } - - BOOL SetBarInfo(LPREBARINFO lp) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_SETBARINFO, 0, (LPARAM)lp); } - - BOOL GetBandInfo(int iBand, LPREBARBANDINFO lp) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_GETBANDINFO, iBand, (LPARAM)lp); } - - BOOL SetBandInfo(int iBand, LPREBARBANDINFO lp) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_SETBANDINFO, iBand, (LPARAM)lp); } - - BOOL InsertBand(int iWhere, LPREBARBANDINFO lp) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_INSERTBAND, (WPARAM)iWhere, (LPARAM)lp); } - - BOOL DeleteBand(int nWhich) - { ASSERT(::IsWindow(m_hWnd)); - return (BOOL)SendMessage(RB_DELETEBAND, (WPARAM)nWhich); } - - int GetBandCount() - { ASSERT(::IsWindow(m_hWnd)); - return (int)SendMessage(RB_GETBANDCOUNT); } - - int GetRowCount() - { ASSERT(::IsWindow(m_hWnd)); - return (int)SendMessage(RB_GETROWCOUNT); } - - int GetRowHeight(int nWhich) - { ASSERT(::IsWindow(m_hWnd)); - return (int)SendMessage(RB_GETROWHEIGHT, (WPARAM)nWhich); } - - // Call these handy functions from your OnCreateBands to do stuff - // more easily than the Windows way. - // - BOOL InsertBand(CWnd* pWnd, CSize szMin, int cx = 0, - LPCTSTR lpText=NULL, int iWhere=-1, BOOL bNewRow =FALSE); - void SetColors(COLORREF clrFG, COLORREF clrBG); - void SetBackgroundBitmap(CBitmap* pBitmap); - void Invalidate(BOOL bErase = TRUE); // invalidates children too - - static BOOL bTRACE; // Set TRUE to see extra diagnostics in DEBUG code - -protected: - // YOU MUST OVERRIDE THIS in your derived class to create bands. - virtual BOOL OnCreateBands() = 0; // return -1 if failed - - // Virtual fn called when the coolbar height changes as a result of moving - // bands around. Override only if you want to do something different. - virtual void OnHeightChange(const CRect& rcNew); - - // overrides to fix problems w/MFC. No need to override yourself. - virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); - virtual CSize CalcDynamicLayout(int nLength, DWORD nMode); - virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler); - - // message handlers - afx_msg int OnCreate(LPCREATESTRUCT lpcs); - afx_msg void OnPaint(); - afx_msg void OnHeightChange(NMHDR* pNMHDR, LRESULT* pRes); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - - DECLARE_MESSAGE_MAP() - DECLARE_DYNAMIC(CCoolBar) -}; - -////////////////// -// Programmer-friendly REBARINFO initializes itself. -// -class CRebarInfo : public REBARINFO { -public: - CRebarInfo() { - memset(this, 0, sizeof(REBARINFO)); - cbSize = sizeof(REBARINFO); - } -}; - -////////////////// -// Programmer-friendly REBARBANDINFO initializes itself. -// -class CRebarBandInfo : public REBARBANDINFO { -public: - CRebarBandInfo() { - memset(this, 0, sizeof(REBARBANDINFO)); - cbSize = sizeof(REBARBANDINFO); - } -}; - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolMenu.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolMenu.h deleted file mode 100644 index e7d74832078..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UICoolMenu.h +++ /dev/null @@ -1,174 +0,0 @@ -//////////////////////////////////////////////////////////////// -// 199 Microsoft Systems Journal. -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// ========================================================================== -// HISTORY: -// ========================================================================== -// 1.01 13 Aug 1998 - Andrew Bancroft [ABancroft@lgc.com] - Since we've already -// added the entire toolbar to the imagelist we need to -// increment nNextImage even if we didn't add this button to -// m_mapIDtoImage in the LoadToolbar() method. -// 1.01a 13 Aug 1998 - Peter Tewkesbury - Added AddSingleBitmap(...) -// method for adding a single bitmap to a pulldown -// menu item. -// 1.02 13 Aug 1998 - Omar L Francisco - Fixed bug with lpds->CtlType -// and lpds->itemData item checking. -// 1.03 12 Nov 1998 - Fixes debug assert in system menu. - Wang Jun -// 1.04 17 Nov 1998 - Fixes debug assert when you maximize a view - Wang Jun -// window, then try to use the system menu for the view. -// 1.05 09 Jan 1998 - Seain B. Conover [sc@tarasoft.com] - Fix for virtual -// key names. -// 1.06 24 Feb 1999 - Michael Lange [michael.home@topdogg.com] - Fix for memory -// leak in CMyItemData structure, added a destructor that -// calls text.Empty(). -// - Boris Kartamishev [kbv@omegasoftware.com] - Fix for resource -// ID bug. -// - Jeremy Horgan [jeremyhorgan@hotmail.com] - During -// accelerator key processing OnInitMenuPopup() calls -// ConvertMenu() which allocates a new CMyItemData for each -// menu item. This is memory is normally freed by a call to -// OnMenuSelect(), which is not called when processing -// accelerator keys. This results in a memory leak. This was -// fixed by modifying the ~CCoolMenuManager() destructor. -// 1.07 24 Feb 1999 - Koji MATSUNAMI [kmatsu@inse.co.jp] - Fixed problem with -// popup menus being drawn correctly as cool menus. -// ========================================================================== -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef __COOLMENU_H__ -#define __COOLMENU_H__ - -#include "UISubClass.h" - -////////////////// -// CCoolMenuManager implements "cool" menus with buttons in them. To use: -// -// * Instantiate in your CMainFrame. -// * Call Install to install it -// * Call LoadToolbars or LoadToolbar to load toolbars -// -// Don't forget to link with CoolMenu.cpp, Subclass.cpp and DrawTool.cpp! -// -class CTRL_EXT_CLASS CCoolMenuManager : public CSubclassWnd -{ -public: - DECLARE_DYNAMIC(CCoolMenuManager) - CCoolMenuManager(); - ~CCoolMenuManager(); - - // You can set these any time - BOOL m_bShowButtons; // use to control whether buttons are shown - BOOL m_bAutoAccel; // generate auto accelerators - BOOL m_bUseDrawState; // use ::DrawState for disabled buttons - BOOL m_bDrawDisabledButtonsInColor; // draw disabled buttons in color - // (only if m_bUseDrawState = FALSE) - - // public functions to use - void Install(CWnd* pFrame); // connect to main frame - void Uninstall(); // disconnect from main frame - BOOL LoadToolbars(const UINT* arIDs, int n); // load multiple toolbars - BOOL LoadToolbar(UINT nID); // load one toolbar - CSize SetButtonSize(CSize &sz=CSize(0,0)); // Set up button sizes if not using toolbar - BOOL AddSingleBitmap(UINT nBitmapID, UINT n, UINT *nID); - - // O.S. - item access - static void *SetItemData(HMENU hMenu, void *pData, UINT uItem, BOOL bByPosition = FALSE); - static void *GetItemData(HMENU hMenu, UINT uItem, BOOL bByPosition = FALSE); - static HICON SetItemIcon(HMENU hMenu, HICON hIcon, UINT uItem, BOOL bByPosition = FALSE); - static HICON GetItemIcon(HMENU hMenu, UINT uItem, BOOL bByPosition = FALSE); - - // O.S. -- stuff for submenus - void SetSubMenuIcon(HMENU hSubMenu, int nID); // nID == -1 -> never convert this submenu - void UnmanageSubMenu(HMENU hSubMenu); - // shell menu functions - void SetShellContextMenu(LPCONTEXTMENU lpcm,UINT nIDFirst,UINT nIDLast); - void AddShellContextMenu(CMenu *pMenu, LPCONTEXTMENU lpm, int iIndex); - // Conversion routines - // Switch between MyItemData and their item data - DWORD SwitchContextItemData(CMenu *pMenu, int iCmd, DWORD dwItemData=0, BOOL bByPosition=TRUE); - void ConvertMenu(CMenu *pMenu); - void UnconvertMenu(CMenu *pMenu); - void ConvertMenuItem(CMenu *pMenu, int iIndex, bool bRecurse = true, - bool bUnconvert = false); - - // should never need to call: - virtual void Destroy(); // destroys everything--to re-load new toolbars? - virtual void Refresh(); // called when system colors, etc change - static HBITMAP GetMFCDotBitmap(); // get.. - static void FixMFCDotBitmap(); // and fix MFC's dot bitmap - - static BOOL bTRACE; // Set TRUE to see extra diagnostics in DEBUG code - -protected: - CWnd* m_pFrame; // frame window I belong to - CUIntArray m_arToolbarID; // array of toolbar IDs loaded - CImageList m_ilButtons; // image list for all buttons - CImageList m_ilTemp; // image list for all buttons - CMapWordToPtr m_mapIDtoImage;// maps command ID -> image list index - CMapWordToPtr m_mapIDtoAccel;// maps command ID -> ACCEL* - CMapPtrToWord m_mapHMENUtoID; - HACCEL m_hAccel; // current accelerators, if any - ACCEL* m_pAccel; // ..and table in memory - CPtrList m_menuList; // list of HMENU's initialized - CSize m_szBitmap; // size of button bitmap - CSize m_szButton; // size of button (including shadow) - CFont m_fontMenu; // menu font - /////////////////////////// - // Addition: Philip Oldaker - // Shell helpers to show help string on the status bar - UINT m_idShellMenuFirst; - UINT m_idShellMenuLast; - LPCONTEXTMENU m_lpcm; - ////////////////////////// - void ConvertMenu(CMenu* pMenu,UINT nIndex,BOOL bSysMenu,BOOL bShowButtons); - - // helpers - void DestroyAccel(); - void DrawMenuText(CDC& dc, CRect rc, CString text, COLORREF color); - BOOL Draw3DCheckmark(CDC& dc, const CRect& rc, BOOL bSelected, - HBITMAP hbmCheck=NULL); - void LoadAccel(HACCEL hAccel); - CString GetVirtualKeyName( const CString strVirtKey ) const; - BOOL AppendAccelName(CString& sItemName, UINT nID); - CFont* GetMenuFont(); - - // Get button index for given command ID, or -1 if not found - int GetButtonIndex(WORD nID) { - void* val; - return m_mapIDtoImage.Lookup(nID, val) ? (int)val : -1; - } - - // Get ACCEL structure associated with a given command ID - ACCEL* GetAccel(WORD nID) { - void* val; - return m_mapIDtoAccel.Lookup(nID, val) ? (ACCEL*)val : NULL; - } - - // window proc to hook frame using CCoolMenuSubclassWnd implementation - virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp); - - // CCoolMenuSubclassWnd message handlers - virtual void OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu); - virtual BOOL OnMeasureItem(LPMEASUREITEMSTRUCT lpms); - virtual BOOL OnDrawItem(LPDRAWITEMSTRUCT lpds); - virtual LONG OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu); - virtual void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu); -}; - -// the one and only manager -extern CCoolMenuManager g_CoolMenuManager; - -////////////////// -// Friendly version of MENUITEMINFO initializes itself -// -struct CMenuItemInfo : public MENUITEMINFO { - CMenuItemInfo() - { memset(this, 0, sizeof(MENUITEMINFO)); - cbSize = sizeof(MENUITEMINFO); - } -}; - -#endif // __COOLMENU_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDATA.H b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDATA.H deleted file mode 100644 index f76d13cff89..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDATA.H +++ /dev/null @@ -1,300 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __LISTCTRLDATA_H__ -#define __LISTCTRLDATA_H__ - -//////////////////////////////////////////////// -// CUIODColumnCtrl -// Interface for an owner draw control in a list control column -//////////////////////////////////////////////// -class CUIODColumnCtrl : public CObject -{ - DECLARE_DYNAMIC(CUIODColumnCtrl); -public: - CUIODColumnCtrl(); - virtual ~CUIODColumnCtrl(); -public: - virtual void DoPaint(CDC *PaintDC,CRect rcClient,bool bSelected)=0; -protected: -private: -}; - -inline CUIODColumnCtrl::CUIODColumnCtrl() -{ -} - -inline CUIODColumnCtrl::~CUIODColumnCtrl() -{ -} - -// Internal extension data for each row in the list control -// if you wish to override the default behaviour -// a class should be derived from this one and the GetListCtrlData method -// should be overridden in the list control class -class CTRL_EXT_CLASS CUIListCtrlData : public CObject -{ -public: - DECLARE_DYNAMIC(CUIListCtrlData) - CUIListCtrlData(int nCols=1); - ~CUIListCtrlData(); - void Init(int nCols); - // functions to change the color of each row - COLORREF GetTextColor(int nCol=0) const; - COLORREF GetBkColor(int nCol=0) const; - const CFont *GetFont(int nCol=0) const; - void SetBkColor(COLORREF BkColor,int nCol=-1); - void SetTextColor(COLORREF TextColor,int nCol=-1); - void SetDefaultBkColor(int nCol=-1); - void SetDefaultTextColor(int nCol=-1); - void SetFont(CFont *pFont,int nCol=-1); - void SetCtrl(CUIODColumnCtrl *pCtrl,int nCol); - void DestroyCtrl(int nCol); - // emulate the CListCtrl class by allowing user defined extension data - DWORD GetExtData() const; - void SetExtData(DWORD dwExtData); - BOOL IsFontSet(int nCol=-1) const; -protected: - void DestroyFonts(); - void DestroyCtrls(); - void CreateNewFont(int nCol,LOGFONT &lf); -// Get/Set Methods -public: - void SetAutoDelete(bool bAutoDelete); - bool GetAutoDelete() const; - int GetCtrlCount() const; - CUIODColumnCtrl *GetCtrl(int nCol) const; - void SetDeleted(bool bDeleted); - bool IsDeleted() const; -private: - CDWordArray m_arBkColors; - CDWordArray m_arTextColors; - CObArray m_arFonts; - DWORD m_dwExtData; - CObArray m_arCtrl; - bool m_bAutoDelete; - bool m_bDeleted; -}; - -inline int CUIListCtrlData::GetCtrlCount() const -{ - int nCount=0; - for(int i=0;i < m_arCtrl.GetSize();i++) - { - if (m_arCtrl.GetAt(i) != NULL) - { - nCount++; - } - } - return nCount; -} - -inline CUIODColumnCtrl *CUIListCtrlData::GetCtrl(int nCol) const -{ - CUIODColumnCtrl *pCtrl = (CUIODColumnCtrl*)m_arCtrl.GetAt(nCol); - return pCtrl; -} - -inline void CUIListCtrlData::DestroyCtrl(int nCol) -{ - CUIODColumnCtrl *pOldCtrl = (CUIODColumnCtrl*)m_arCtrl[nCol]; - delete pOldCtrl; - m_arCtrl[nCol] = NULL; -} - -inline void CUIListCtrlData::SetCtrl(CUIODColumnCtrl *pCtrl,int nCol) -{ - DestroyCtrl(nCol); - ASSERT_KINDOF(CUIODColumnCtrl,pCtrl); - m_arCtrl[nCol] = pCtrl; -} - -inline void CUIListCtrlData::SetAutoDelete(bool bAutoDelete) -{ - m_bAutoDelete = bAutoDelete; -} - -inline bool CUIListCtrlData::GetAutoDelete() const -{ - return m_bAutoDelete; -} - -inline void CUIListCtrlData::SetDeleted(bool bDeleted) -{ - m_bDeleted = bDeleted; -} - -inline bool CUIListCtrlData::IsDeleted() const -{ - return m_bDeleted; -} - -inline const CFont *CUIListCtrlData::GetFont(int nCol) const -{ - return (const CFont*)m_arFonts[nCol]; -} - -inline COLORREF CUIListCtrlData::GetTextColor(int nCol) const -{ - return m_arTextColors[nCol]; -} - -inline COLORREF CUIListCtrlData::GetBkColor(int nCol) const -{ - return m_arBkColors[nCol]; -} - -inline DWORD CUIListCtrlData::GetExtData() const -{ - return m_dwExtData; -} - -inline void CUIListCtrlData::SetBkColor(COLORREF BkColor,int nCol) -{ - if (nCol == -1) - { - for(int i=0;i < m_arBkColors.GetSize();i++) - { - m_arBkColors[i] = BkColor; - } - } - else - m_arBkColors[nCol] = BkColor; -} - -inline void CUIListCtrlData::SetTextColor(COLORREF TextColor,int nCol) -{ - if (nCol == -1) - { - for(int i=0;i < m_arTextColors.GetSize();i++) - { - m_arTextColors[i] = TextColor; - } - } - else - m_arTextColors[nCol] = TextColor; -} - -inline void CUIListCtrlData::SetDefaultTextColor(int nCol) -{ - SetTextColor(::GetSysColor(COLOR_WINDOWTEXT),nCol); -} - -inline void CUIListCtrlData::SetDefaultBkColor(int nCol) -{ - SetBkColor(::GetSysColor(COLOR_WINDOW),nCol); -} - -inline void CUIListCtrlData::SetExtData(DWORD dwExtData) -{ - m_dwExtData = dwExtData; -} - -// for ODBC databases -class CTRL_EXT_CLASS CUIDBListCtrlData : public CUIListCtrlData -{ -public: - CUIDBListCtrlData(int nCols) : CUIListCtrlData(nCols) { } - DECLARE_DYNAMIC(CUIDBListCtrlData) - const GetRecNum() { return m_nRecNum; } - void SetRecNum(long nRecNum) { m_nRecNum = nRecNum; } -private: - long m_nRecNum; // for ODBC connection to record sets -}; - -// used by the Ownerdraw combo box -class CTRL_EXT_CLASS CUIComboBoxData : public CUIListCtrlData -{ - DECLARE_DYNAMIC(CUIComboBoxData) -public: - CUIComboBoxData(int nCols) : CUIListCtrlData(nCols), m_nImageIndex(-1) {} - CString GetText(int nCol = -1) const; - int GetImageIndex() const { return m_nImageIndex; } - void SetText(LPCTSTR szText) { m_strText = szText; } - void SetImageIndex(int nImageIndex) { m_nImageIndex = nImageIndex; } -private: - CString m_strText; // for displaying text in OD combo boxes with columns - int m_nImageIndex; -}; - -// keep our own copy of strings in the list control to ease sorting -class CTRL_EXT_CLASS CUIStrListCtrlData : public CUIListCtrlData -{ -public: - DECLARE_DYNAMIC(CUIStrListCtrlData) - CUIStrListCtrlData(int nColumns); - CUIStrListCtrlData(); - LPTSTR GetString(int nCol); - const CString &GetExtraString() const; - void AddExtraString(LPCTSTR pszExtraText); - int GetStringLen(int nCol) const; - BOOL AddString(int nCol,LPCTSTR szText); -private: - CStringArray m_StringArray; - CString m_strExtraText; -}; - -inline int CUIStrListCtrlData::GetStringLen(int nCol) const -{ - return m_StringArray[nCol].GetLength(); -} - -inline void CUIStrListCtrlData::AddExtraString(LPCTSTR pszExtraText) -{ - m_strExtraText = pszExtraText; -} - -inline const CString &CUIStrListCtrlData::GetExtraString() const -{ - return m_strExtraText; -} - -// Used internally to help sorting -class CUIODListCtrlSortInfo : public CObject -{ -public: - CUIODListCtrlSortInfo(int nSubItem,int ColType,BOOL bSortAscending); - BOOL Ascending() const; - int GetColumn() const; - int GetColType() const; -private: - BOOL m_bSortAscending; - int m_nSubItem; - int m_ColType; -}; - -inline CUIODListCtrlSortInfo::CUIODListCtrlSortInfo(int nSubItem,int ColType,BOOL bSortAscending) - : m_nSubItem(nSubItem),m_ColType(ColType),m_bSortAscending(bSortAscending) -{ -} - -inline BOOL CUIODListCtrlSortInfo::Ascending() const -{ - return m_bSortAscending; -} - -inline int CUIODListCtrlSortInfo::GetColumn() const -{ - return m_nSubItem; -} - -inline int CUIODListCtrlSortInfo::GetColType() const -{ - return m_ColType; -} - -#endif // __LISTCTRLDATA_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDragDropTree.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDragDropTree.h deleted file mode 100644 index 8658ca0d381..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIDragDropTree.h +++ /dev/null @@ -1,180 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_DRAGDROPTREE_H__072E5B93_FD2A_11D0_ADBE_0000E81B9EF1__INCLUDED_) -#define AFX_DRAGDROPTREE_H__072E5B93_FD2A_11D0_ADBE_0000E81B9EF1__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// DragDropTree.h : header file -// - -#include "UIImageDropTarget.h" -// /////////////////////////////////////////////////////////////////////////// -class CUI_TreeDropTarget : public CUI_ImageDropTarget -{ -public: - virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ); - virtual void OnDragLeave( CWnd* pWnd); -protected: - DWORD m_dwKeyboardState; - DWORD m_dwEnterKeyboardState; -}; - -///////////////////////////////////////////////////////////////////////////// -// CUIDragDropTree window - -class CTRL_EXT_CLASS CUIDragDropTree : public CTreeCtrl -{ - friend class CUI_TreeDropTarget; -// Construction -public: - DECLARE_DYNAMIC(CUIDragDropTree) - CUIDragDropTree(bool bDragDrop=true); - -// Attributes -public: - enum CopyMode - { - eDDNull, - eDDMove, - eDDCopy, - eDDCancel - }; - enum SCROLLMODE - { - SCROLL_UP_SLOW, - SCROLL_DOWN_SLOW, - SCROLL_UP_NORMAL, - SCROLL_DOWN_NORMAL - }; - - const COleDropTarget &GetDropTarget(); - -// Operations -public: - void RegisterDropTarget(); - void SetDragTimer(); - void KillDragTimer(); - - virtual DROPEFFECT SelectCurrentTarget(CDD_OleDropTargetInfo *pInfo); -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIDragDropTree) - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CUIDragDropTree(); - -protected: - HTREEITEM GetDragItem(); - HTREEITEM GetDropItem(); - virtual BOOL IsChildNodeOf(HTREEITEM hitemChild, HTREEITEM hitemSuspectedParent); - virtual BOOL NeedToScroll( CPoint ptMouse ); - virtual SCROLLMODE RefineScrollMode( CPoint ptMouse ); - virtual BOOL TransferItem(HTREEITEM hitem, HTREEITEM hNewParent); - virtual void OnButtonUp(bool bMove); - virtual void OnDropFile(HTREEITEM hItem,LPCTSTR pszFile,UINT nFlags); - virtual void NewTransferItem(HTREEITEM hNewItem); - virtual BOOL StartDragDrop(NM_TREEVIEW* pNMTreeView); - virtual bool GetRDragMenu(CMenu *pMenu); - virtual void EndDragging(); - // Generated message map functions -protected: - //{{AFX_MSG(CUIDragDropTree) - afx_msg BOOL OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnBeginRDrag(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnRButtonUp(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnDestroy(); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDropFiles( HDROP hDropInfo); - afx_msg void OnDDMove(); - afx_msg void OnDDCopy(); - afx_msg void OnDDCancel(); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -private: - bool m_bDragDrop; - bool m_bDropFiles; - CImageList* m_pImageList; - BOOL m_bDragging; - HTREEITEM m_hitemDrag; - HTREEITEM m_hitemDrop; - UINT m_nTimerID; - int m_nSlowScrollTimeout; - int m_nUpperYCoor; - int m_nLowerYCoor; - int m_nScrollBarSize; - CUI_TreeDropTarget m_OleDropTarget; - COleDataSource m_OleDataSource; -protected: - CopyMode m_CopyMode; -public: - void SetDragDrop(bool bDragDrop); - bool GetDragDrop(); - void SetDropFiles(bool bDropFiles); - bool GetDropFiles(); -}; - -inline void CUIDragDropTree::SetDragDrop(bool bDragDrop) -{ - m_bDragDrop = bDragDrop; -} - -inline bool CUIDragDropTree::GetDragDrop() -{ - return m_bDragDrop; -} - -inline void CUIDragDropTree::SetDropFiles(bool bDropFiles) -{ - m_bDropFiles = bDropFiles; -} - -inline bool CUIDragDropTree::GetDropFiles() -{ - return m_bDropFiles; -} - -inline const COleDropTarget &CUIDragDropTree::GetDropTarget() -{ - return m_OleDropTarget; -} - -inline HTREEITEM CUIDragDropTree::GetDragItem() -{ - return m_hitemDrag; -} - -inline HTREEITEM CUIDragDropTree::GetDropItem() -{ - return m_hitemDrop; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_DRAGDROPTREE_H__072E5B93_FD2A_11D0_ADBE_0000E81B9EF1__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIExplorerFrameWnd.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIExplorerFrameWnd.h deleted file mode 100644 index e95e38fcaf5..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIExplorerFrameWnd.h +++ /dev/null @@ -1,77 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_EXPLORERFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_) -#define AFX_EXPLORERFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// EXPLORERFRAMEWND.h : header file -// -#include "UIFrameWnd.h" -#include "UITabSplitterWnd.h" - -class CTRL_EXT_CLASS CUIExplorerFrameWnd : public CUIFrameWnd -{ - DECLARE_DYNAMIC(CUIExplorerFrameWnd) -protected: - CUIExplorerFrameWnd(); // protected constructor used by dynamic creation - -// Attributes -public: - void SetExplorerView(CRuntimeClass *pClass); - CTabSplitterWnd &GetSplitterWnd(); -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIExplorerFrameWnd) - virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); - //}}AFX_VIRTUAL - -// Implementation -protected: - virtual ~CUIExplorerFrameWnd(); - - // Generated message map functions - //{{AFX_MSG(CUIExplorerFrameWnd) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -protected: -private: - CTabSplitterWnd m_wndSplitter; - CRuntimeClass *m_pExplorerView; -}; - -inline void CUIExplorerFrameWnd::SetExplorerView(CRuntimeClass *pClass) -{ - m_pExplorerView = pClass; -} - -inline CTabSplitterWnd &CUIExplorerFrameWnd::GetSplitterWnd() -{ - return m_wndSplitter; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_EXPLORERFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFixTB.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFixTB.h deleted file mode 100644 index 32f1743179d..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFixTB.h +++ /dev/null @@ -1,64 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef __FIXTB_H -#define __FIXTB_H - -////////////////// -// This class fixes the sizing bugs in MFC that calculates the -// size of toolbars incorrectly for modern toobars (comctl32 version >= 4.71) -// It also contains a number of wrappers for function that CToolBar doesn't -// have (so you don't have to use GetToolBarCtrl). -// -// Generally, you should use CFlatToolBar instead of CFixMFCToolBar (even -// if you're not using the flat style), but you can use CFixMFCToolBar if -// all you want is the sizing fix for MFC tooblars. -// -class CTRL_EXT_CLASS CFixMFCToolBar : public CToolBar { -public: - CFixMFCToolBar(); - virtual ~CFixMFCToolBar(); - - static int iVerComCtl32; // version of commctl32.dll (eg 471) - - // There is a bug in comctl32.dll, version 4.71+ that causes it to - // draw vertical separators in addition to horizontal ones, when the - // toolbar is vertically docked. If the toolbar has no dropdown buttons, - // this is not a problem because the separators are ignored when calculating - // the width of the toolbar. If, however, you have dropdown buttons, then the - // width of a vertically docked toolbar will be too narrow to show the - // dropdown arrow. This is in fact what happens in Visual Studio. If you - // want to show the dropdown arrow when vertical, set this to TRUE - // (default = FALSE) - // - BOOL m_bShowDropdownArrowWhenVertical; - - virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); - virtual CSize CalcDynamicLayout(int nLength, DWORD nMode); - - CSize CalcLayout(DWORD nMode, int nLength = -1); - CSize CalcSize(TBBUTTON* pData, int nCount); - int WrapToolBar(TBBUTTON* pData, int nCount, int nWidth); - void SizeToolBar(TBBUTTON* pData, int nCount, int nLength, - BOOL bVert = FALSE); - virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle); - - virtual CSize GetButtonSize(TBBUTTON* pData, int iButton); - - // MFC has versions of these that are protected--but why? - // - void GetButton(int nIndex, TBBUTTON* pButton) const; - void SetButton(int nIndex, TBBUTTON* pButton); - -protected: - LRESULT OnSizeHelper(CSize& sz, LPARAM lp); - afx_msg LRESULT OnSetBitmapSize(WPARAM, LPARAM); - afx_msg LRESULT OnSetButtonSize(WPARAM, LPARAM); - afx_msg LRESULT OnSettingChange(WPARAM, LPARAM); - DECLARE_MESSAGE_MAP() - DECLARE_DYNAMIC(CFixMFCToolBar) -}; - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFlatBar.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFlatBar.h deleted file mode 100644 index 6b8654df0e6..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFlatBar.h +++ /dev/null @@ -1,195 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef __FLATBAR_H -#define __FLATBAR_H - -#ifndef TB_SETEXTENDEDSTYLE -#error FlatBar.h requires a newer version of the SDK than you have! -#error Please update your SDK files. -#endif - -#ifndef countof -#define countof(x) (sizeof(x)/sizeof(x[0])) -#endif -#ifndef _tsizeof -#define _tsizeof(s) sizeof(s)/sizeof(TCHAR) -#endif - -#include "UIFixTB.h" - -// fwd ref -struct DROPDOWNBUTTON; - -#define CFlatToolBarBase CFixMFCToolBar - -////////////////// -// CFlatToolbar is a drop-in replacement for CToolBar that supports -// flat-style buttons and gripper handles. Use instead of CToolBar in your -// CMainFrame. CFlatTooBar's don'tK actually have to have the flat style, -// but they do by default. If you don't want the flat look, you can call -// ModifyStyle(TBSTYLE_FLAT, 0); -// -// CFlatToolBar overcomes various MFC drawing bugs that cause it not to work -// with flat-style buttons. CFlatToolBar Can also used inside a coolbar -// (unlike CToolBar). -// -// CFlatToolBar has other good stuff too, like an easy way to handle drop-down -// buttons--See MBTest for example how to use. -// -class CTRL_EXT_CLASS CFlatToolBar : public CFlatToolBarBase { -public: - CFlatToolBar(); - virtual ~CFlatToolBar(); - - static BOOL bTRACE; // to see TRACE diagnostics - - // set these before creation: - BOOL m_bDrawDisabledButtonsInColor; // draw disabled buttons in color - BOOL m_bInCoolBar; // set if flatbar is inside coolbar - - // You must call one of these to get the flat look; if not, you must - // set TBSTYLE_FLAT yourself. - BOOL LoadToolBar(LPCTSTR lpszResourceName); - BOOL LoadToolBar(UINT nIDResource) - { return LoadToolBar(MAKEINTRESOURCE(nIDResource)); } - - // call to add drop-down buttons - BOOL AddDropDownButton(UINT nIDButton, UINT nIDMenu, BOOL bArrow); - - // Use these to get/set the flat style. By default, LoadToolBar calls - // SetFlatStyle(TRUE); if you create some other way, you must call it - // yourself. - BOOL SetFlatStyle(BOOL bFlat) { - return ModifyStyle(bFlat ? 0 : TBSTYLE_FLAT, bFlat ? TBSTYLE_FLAT : 0); - } - BOOL GetFlatStyle() { - return (GetStyle() & TBSTYLE_FLAT)!=0; - } - - // silly function to fake out compiler with const-ness - LRESULT SendMessageC(UINT m, WPARAM wp=0, LPARAM lp=0) const - { return ((CFixMFCToolBar*)this)->SendMessage(m, wp, lp); } - - // Wrappers that are not in MFC but should be; - // I copied these from CToolBarCtrl - BOOL EnableButton(int nID, BOOL bEnable) - { return SendMessage(TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); } - BOOL CheckButton(int nID, BOOL bCheck) - { return SendMessage(TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); } - BOOL PressButton(int nID, BOOL bPress) - { return SendMessage(TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); } - BOOL HideButton(int nID, BOOL bHide) - { return SendMessage(TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); } - BOOL Indeterminate(int nID, BOOL bIndeterminate) - { return SendMessage(TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); } - BOOL IsButtonEnabled(int nID) const - { return SendMessageC(TB_ISBUTTONENABLED, nID); } - BOOL IsButtonChecked(int nID) const - { return SendMessageC(TB_ISBUTTONCHECKED, nID); } - BOOL IsButtonPressed(int nID) const - { return SendMessageC(TB_ISBUTTONPRESSED, nID); } - BOOL IsButtonHidden(int nID) const - { return SendMessageC(TB_ISBUTTONHIDDEN, nID); } - BOOL IsButtonIndeterminate(int nID) const - { return SendMessageC(TB_ISBUTTONINDETERMINATE, nID); } - BOOL SetState(int nID, UINT nState) - { return SendMessage(TB_SETSTATE, nID, MAKELPARAM(nState, 0)); } - int GetState(int nID) const - { return SendMessageC(TB_GETSTATE, nID); } - BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons) - { return SendMessage(TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); } - BOOL InsertButton(int nIndex, LPTBBUTTON lpButton) - { return SendMessage(TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); } - BOOL DeleteButton(int nIndex) - { return SendMessage(TB_DELETEBUTTON, nIndex); } - int GetButtonCount() const - { return SendMessageC(TB_BUTTONCOUNT); } - UINT CommandToIndex(UINT nID) const - { return SendMessageC(TB_COMMANDTOINDEX, nID); } - void Customize() - { SendMessage(TB_CUSTOMIZE, 0, 0L); } - int AddStrings(LPCTSTR lpszStrings) - { return SendMessage(TB_ADDSTRING, 0, (LPARAM)lpszStrings); } - void SetButtonStructSize(int nSize) - { SendMessage(TB_BUTTONSTRUCTSIZE, nSize); } - BOOL SetButtonSize(CSize sz) - { return SendMessage(TB_SETBUTTONSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); } - BOOL SetBitmapSize(CSize sz) - { return SendMessage(TB_SETBITMAPSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); } - void AutoSize() - { SendMessage(TB_AUTOSIZE); } - CToolTipCtrl* GetToolTips() const - { return (CToolTipCtrl*)CWnd::FromHandle((HWND)SendMessageC(TB_GETTOOLTIPS)); } - void SetToolTips(CToolTipCtrl* pTip) - { SendMessage(TB_SETTOOLTIPS, (WPARAM)pTip->m_hWnd); } -// NO!!!--this is not the same as the MFC owner -// void SetOwner(CWnd* pWnd) -// { SendMessage(TB_SETPARENT, (WPARAM)pWnd->m_hWnd); } - void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) - { SendMessage(TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); } - int GetRows() const - { return (int) SendMessageC(TB_GETROWS); } - BOOL SetCmdID(int nIndex, UINT nID) - { return SendMessage(TB_SETCMDID, nIndex, nID); } - UINT GetBitmapFlags() const - { return (UINT) SendMessageC(TB_GETBITMAPFLAGS); } - - // Wrappers for some of the newer messages--not complete - BOOL SetIndent(int indent) - { return SendMessage(TB_SETINDENT, indent); } - HIMAGELIST GetImageList() const - { return (HIMAGELIST)SendMessageC(TB_GETIMAGELIST); } - HIMAGELIST SetImageList(HIMAGELIST hImgList) - { return (HIMAGELIST)SendMessage(TB_SETIMAGELIST, 0, (LPARAM)hImgList); } - int GetBitmap(UINT nIdButton) const - { return SendMessageC(TB_GETBITMAP, nIdButton); } - DWORD SetExtendedStyle(DWORD dwStyle) - { return SendMessage(TB_SETEXTENDEDSTYLE, 0, dwStyle); } - BOOL GetRect(UINT nIdButton, RECT& rc) const - { return SendMessageC(TB_GETRECT, nIdButton, (LPARAM)&rc); } - DWORD GetToolbarStyle() const - { return SendMessageC(TB_GETSTYLE); } - void SetToolbarStyle(DWORD dwStyle) - { SendMessage(TB_SETSTYLE, 0, dwStyle); } - int HitTest(CPoint p) const - { return SendMessageC(TB_HITTEST, 0, (LPARAM)&p); } - int GetHotItem() const - { if (GetSafeHwnd()) return SendMessageC(TB_GETHOTITEM); return 0; } - void SetHotItem(int iHot) - { if (GetSafeHwnd()) SendMessage(TB_SETHOTITEM, iHot); } - BOOL MapAccelerator(TCHAR ch, UINT& nID) const - { return SendMessageC(TB_MAPACCELERATOR, (WPARAM)ch, (LPARAM)&nID); } - CSize GetPadding() const - { return SendMessageC(TB_GETPADDING); } - CSize SetPadding(CSize sz) - { return SendMessage(TB_SETPADDING, 0, MAKELPARAM(sz.cx,sz.cy)); } - -protected: - CRect m_rcOldPos; // used when toolbar is moved - DROPDOWNBUTTON* m_pDropDownButtons; // list of dropdown button/menu pairs - BOOL m_bNoEntry; // implementation hack - - // override to do your own weird drop-down buttons - virtual void OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc); - DROPDOWNBUTTON* FindDropDownButton(UINT nID); - - // helpers - virtual void InvalidateOldPos(const CRect& rcInvalid); - - afx_msg int OnCreate(LPCREATESTRUCT lpcs); - afx_msg void OnTbnDropDown(NMHDR* pNMHDR, LRESULT* pRes); - afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos); - afx_msg void OnWindowPosChanged(LPWINDOWPOS lpWndPos); - afx_msg void OnNcCalcSize(BOOL bCalc, NCCALCSIZE_PARAMS* pncp ); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpcs); - afx_msg void OnPaint(); - - DECLARE_MESSAGE_MAP() - DECLARE_DYNAMIC(CFlatToolBar) -}; - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFolderRefresh.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFolderRefresh.h deleted file mode 100644 index 00faf795e64..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFolderRefresh.h +++ /dev/null @@ -1,47 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __UI_FOLDER_REFRESH_H__ -#define __UI_FOLDER_REFRESH_H__ - -class CTRL_EXT_CLASS CRefresh : public CObject -{ - DECLARE_DYNAMIC(CRefresh) -public: - CRefresh(HTREEITEM hItem,LPARAM lParam) : m_hItem(hItem), m_lParam(lParam) {}; - ~CRefresh() {}; - LPARAM GetExtData() const { return m_lParam; } - HTREEITEM GetItem() const { return m_hItem; } -private: - LPARAM m_lParam; - HTREEITEM m_hItem; -}; - -class CTRL_EXT_CLASS CRefreshCategory : public CRefresh -{ - DECLARE_DYNAMIC(CRefreshCategory) -public: - CRefreshCategory(HTREEITEM hItem,LPARAM lParam,long nCategory=0) - : m_nCategory(nCategory),CRefresh(hItem,lParam) - {} -public: - long GetCategory() const { return m_nCategory; } -private: - long m_nCategory; -}; - -#endif //__UI_FOLDER_REFRESH_H__ diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFrameWnd.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFrameWnd.h deleted file mode 100644 index edcaf8827dc..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIFrameWnd.h +++ /dev/null @@ -1,134 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_SPAWNFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_) -#define AFX_SPAWNFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// SpawnFrameWnd.h : header file -// -#include "UIStatusBar.h" -#include "UIFlatBar.h" -#include "UICoolMenu.h" -#include "UICoolBar.h" -#include "UIMenuBar.h" -#include "IEShellComboBox.h" - -///////////////////////////////////////////////////////////////////////////// -// CUIFrameWnd frame -class CTRL_EXT_CLASS CToolBarComboBox : public CIEShellComboBox -{ -public: -protected: - DECLARE_MESSAGE_MAP() -private: -}; - -class CTRL_EXT_CLASS CReallyCoolBar : public CCoolBar -{ -protected: - DECLARE_DYNAMIC(CReallyCoolBar) - CFlatToolBar m_wndToolBar; // toolbar - CMenuBar m_wndMenuBar; // menu bar - virtual BOOL OnCreateBands(); // fn to create the bands - void SetToolBarID(UINT IDToolbar); -protected: - UINT m_IDToolbar; -}; - -class CTRL_EXT_CLASS CWebBrowserCoolBar : public CReallyCoolBar -{ -protected: - DECLARE_DYNAMIC(CWebBrowserCoolBar) - CFlatToolBar m_wndBrowserBar; // toolbar - virtual BOOL OnCreateBands(); // fn to create the bands - CToolBarComboBox &GetComboBox() { return m_wndCombo; } -protected: - CToolBarComboBox m_wndCombo; - CString m_sCBValue; -}; - -class CTRL_EXT_CLASS CUIFrameWnd : public CFrameWnd -{ - DECLARE_DYNAMIC(CUIFrameWnd) -protected: - CUIFrameWnd(); // protected constructor used by dynamic creation - -// Attributes -public: -// COOLMENU SUPPORT -// END COOLMENU SUPPORT - CDialogBar m_wndFieldChooser; - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIFrameWnd) - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual void GetMessageString( UINT nID, CString& rMessage ) const; - //}}AFX_VIRTUAL - virtual CUIStatusBar &GetStatusBar(); - virtual CReallyCoolBar &GetCoolBar(); - virtual CCoolMenuManager &GetMenuManager(); - virtual void RestoreWindow(UINT nCmdShow); - -// Implementation -protected: - virtual ~CUIFrameWnd(); - virtual void CreateCoolBar(); - - void SetReportCtrl(bool bSet); - // Generated message map functions - //{{AFX_MSG(CUIFrameWnd) - afx_msg void OnClose(); - afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu); - afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); - //}}AFX_MSG - afx_msg LRESULT OnRegisteredMouseWheel(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnCBIESelChange(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnCBIEPopulate(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnCBIEHitEnter(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnCBIESetEditText(WPARAM wParam,LPARAM lParam); - DECLARE_MESSAGE_MAP() -protected: - UINT m_IDToolbar; - CReallyCoolBar *m_pwndCoolBar; -private: - CUIStatusBar m_wndStatusBar; - CCoolMenuManager m_menuManager; // cool (bitmap button) menus - bool m_bReportCtrl; - static LPCTSTR szMainFrame; -}; - -inline void CUIFrameWnd::SetReportCtrl(bool bSet) -{ - m_bReportCtrl = bSet; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SPAWNFRAMEWND_H__13CAB7C3_D316_11D1_8693_000000000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIHtmlView.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIHtmlView.h deleted file mode 100644 index 6fb74ff4884..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIHtmlView.h +++ /dev/null @@ -1,141 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_) -#define AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// HtmlMsgView.h : header file -// -///////////////////////////////////////////////////////////////////////////// -// CUIHtmlView html view - -interface IHTMLDocument2; -interface IHTMLElement; -interface IHTMLImgElement; -interface IHTMLObjectElement; - -#ifndef __AFXEXT_H__ -#include -#endif -#include - -#include - -class CTRL_EXT_CLASS CUIHtmlView : public CHtmlView -{ -protected: - CUIHtmlView(); // protected constructor used by dynamic creation - DECLARE_DYNAMIC(CUIHtmlView) - -// html Data -public: - //{{AFX_DATA(CUIHtmlView) - // NOTE: the ClassWizard will add data members here - //}}AFX_DATA - -// Attributes -public: - void SetNotifyWnd(HWND hwnd); - bool IsWorking() { return m_pHTMLDocument2 == NULL; } - IHTMLDocument2 *GetHTMLDocument(); - void GetElement(LPCTSTR pszID,IHTMLElement **pElement); - CString GetBodyText(); -// Operations -public: - virtual bool ExecScript(LPCTSTR pszScript,LPCTSTR pszLang=NULL,_variant_t *pvt=NULL); - virtual bool SetElementText(LPCTSTR pszElemID,LPCTSTR pszText); - virtual bool SetElementHTML(LPCTSTR pszElemID,LPCTSTR pszText); - virtual bool SetElementValue(LPCTSTR pszElemID,LPCTSTR pszText); - virtual bool SetImageSource(LPCTSTR pszElemID,LPCTSTR pszText); - virtual bool AddOptionString(LPCTSTR pszElemID,LPCTSTR pszText,LPCTSTR pszValue,bool bSelect=false); - virtual bool SetOptionString(LPCTSTR pszElemID,LPCTSTR pszText); - virtual bool GetOptionString(LPCTSTR pszElemID,CString &sText,CString &sValue); - virtual CString GetElementText(LPCTSTR pszElemID); - virtual CString GetElementHTML(LPCTSTR pszElemID); - virtual CString GetElementValue(LPCTSTR pszElemID); - virtual void ParseDocument(); - -protected: - virtual void DocumentReady(); - virtual void ActiveXControl(IHTMLObjectElement *pObj); - virtual void ImageElement(IHTMLImgElement *pImg); - virtual void Element(IHTMLElement *pElement); -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIHtmlView) - public: - virtual void OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel); - virtual void OnCommandStateChange(long nCommand, BOOL bEnable); - protected: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL); - virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); - virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); - virtual void OnTitleChange(LPCTSTR lpszText); - virtual void OnDocumentComplete(LPCTSTR lpszUrl); - //}}AFX_VIRTUAL - -// Implementation -protected: - void ReleaseDocument(); - virtual ~CUIHtmlView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - - // Generated message map functions - //{{AFX_MSG(CUIHtmlView) - afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - afx_msg void OnBrowserGoBack(); - afx_msg void OnBrowserGoForward(); - afx_msg void OnBrowserGoHome(); - afx_msg void OnBrowserRefresh(); - afx_msg void OnBrowserStop(); - afx_msg void OnUpdateBrowserGoBack(CCmdUI *pUI); - afx_msg void OnUpdateBrowserGoForward(CCmdUI *pUI); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - IHTMLDocument2 *m_pHTMLDocument2; - BOOL m_bDocumentComplete; - BOOL m_bGoBack; - BOOL m_bGoForward; - HWND m_hNotifyWnd; - bool m_bSetCursor; -}; - -inline void CUIHtmlView::SetNotifyWnd(HWND hwnd) -{ - m_hNotifyWnd = hwnd; -} - -inline IHTMLDocument2 *CUIHtmlView::GetHTMLDocument() -{ - ASSERT(m_pHTMLDocument2); - return m_pHTMLDocument2; -} -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIImageDropTarget.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIImageDropTarget.h deleted file mode 100644 index e17d7667d21..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIImageDropTarget.h +++ /dev/null @@ -1,106 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_IM_OLEIMAGEDROPTARGET_H__BC21D3A1_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_) -#define AFX_IM_OLEIMAGEDROPTARGET_H__BC21D3A1_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// IM_OleImageDropTarget.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// CUI_ImageDropTarget window -#include "UIDragDropCtrl.h" - -class CDragDropImage; - -class CUI_ImageDropTarget : public COleDropTarget -{ -// Construction -public: - CUI_ImageDropTarget(); - -// Attributes -public: - inline UINT GetClipboardFormat() const; - inline BOOL ImageSetup() const; - -// Operations -public: - -// Overrides - virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ); - virtual void OnDragLeave( CWnd* pWnd); -// Implementation -public: - virtual ~CUI_ImageDropTarget(); - void EraseOldImage(); - void SetImageWin(CWnd *pWnd); - -protected: - const CDragDropImage *GetDropImage(); - CWnd *GetImageWin(CWnd *pWnd); -private: - int m_nImage; - CRect m_rcTotalItem; - CPoint m_ptItem; - CPoint m_ptPrevPos; - CPoint m_ptOldImage; - CSize m_sizeDelta; - CDragDropImage *m_pImage; - UINT m_nCFFormat; - CWnd *m_pWnd; -}; - -inline UINT CUI_ImageDropTarget::GetClipboardFormat() const -{ - return m_nCFFormat; -} - -inline const CDragDropImage *CUI_ImageDropTarget::GetDropImage() -{ - return m_pImage; -} - -inline void CUI_ImageDropTarget::SetImageWin(CWnd *pWnd) -{ - m_pWnd = pWnd; -} - -inline CWnd *CUI_ImageDropTarget::GetImageWin(CWnd *pWnd) -{ - // use main frame window as default - if (m_pWnd == NULL) - m_pWnd = pWnd; - ASSERT(m_pWnd); - return m_pWnd; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_IM_OLEIMAGEDROPTARGET_H__BC21D3A1_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIListView.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIListView.h deleted file mode 100644 index c292c641abd..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIListView.h +++ /dev/null @@ -1,93 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_UILISTVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_) -#define AFX_UILISTVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -///////////////////////////////////////////////////////////////////////////// -// CUIListView view -#include "UICtrl.h" - -class CTRL_EXT_CLASS CUIListView : public CView -{ -protected: - CUIListView(UINT nID); // protected constructor used by dynamic creation - DECLARE_DYNAMIC(CUIListView) - -// Attributes -public: - virtual CUIODListCtrl &GetListCtrl(); - virtual void CreateListCtrl(); -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUIListView) - protected: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - //}}AFX_VIRTUAL - -// Implementation -protected: - void SetDragDrop(bool bDragDrop); - bool IsDragDrop(); - - virtual ~CUIListView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - - // Generated message map functions -protected: - //{{AFX_MSG(CUIListView) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSetFocus(CWnd* pOldWnd); - afx_msg void OnSize(UINT nType, int cx, int cy); - //}}AFX_MSG - afx_msg LRESULT OnAppUpdateAllViews( WPARAM wParam, LPARAM lParam ); - DECLARE_MESSAGE_MAP() -protected: - CUIODListCtrl *m_pListCtrl; - UINT m_Style; - UINT m_nID; -private: - bool m_bDragDrop; -}; - -inline void CUIListView::SetDragDrop(bool bDragDrop) -{ - m_bDragDrop = bDragDrop; -} - -inline bool CUIListView::IsDragDrop() -{ - return m_bDragDrop; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_UILISTVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMenuBar.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMenuBar.h deleted file mode 100644 index 3f370b09f5f..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMenuBar.h +++ /dev/null @@ -1,125 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef __MENUBAR_H -#define __MENUBAR_H - -#include "UIsubclass.h" - -#include "UIFlatBar.h" - -////////////////// -// CMenuBar uses this private class to intercept messages on behalf -// of its owning frame, as well as the MDI client window. Conceptually, -// these should be two different hooks, but I want to save code. -// -class CMenuBarFrameHook : public CSubclassWnd { -protected: - friend class CMenuBar; - CMenuBar* m_pMenuBar; - CMenuBarFrameHook(); - ~CMenuBarFrameHook(); - BOOL Install(CMenuBar* pMenuBar, HWND hWndToHook); - virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp); -}; - -////////////////// -// CMenuBar implements an Office 97-style menu bar. Use it the way you would -// a CToolBar, only you need not call LoadToolbar. All you have to do is -// -// * Create the CMenuBar from your OnCreate or OnCreateBands handler. -// -// * Call LoadMenu to load a menu. This will set your frame's menu to NULL. -// -// * Implemenent your frame's PreTranslateMessage function, to call -// CMenuBar::TranslateFrameMessage. -// -class CTRL_EXT_CLASS CMenuBar : public CFlatToolBar { -public: - BOOL m_bAutoRemoveFrameMenu; // set frame's menu to NULL - - CMenuBar(); - ~CMenuBar(); - - // You must call this from your frame's PreTranslateMessage fn - virtual BOOL TranslateFrameMessage(MSG* pMsg); - - HMENU LoadMenu(HMENU hmenu); // load menu - HMENU LoadMenu(LPCTSTR lpszMenuName); // ...from resource file - HMENU LoadMenu(UINT nID) { - return LoadMenu(MAKEINTRESOURCE(nID)); - } - HMENU GetMenu() { return m_hmenu; } // get current menu - - enum TRACKINGSTATE { // menubar has three states: - TRACK_NONE = 0, // * normal, not tracking anything - TRACK_BUTTON, // * tracking buttons (F10/Alt mode) - TRACK_POPUP // * tracking popups - }; - - TRACKINGSTATE GetTrackingState(int& iPopup) { - iPopup = m_iPopupTracking; return m_iTrackingState; - } - static BOOL bTRACE; // set TRUE to see TRACE msgs - -protected: - friend class CMenuBarFrameHook; - - CMenuBarFrameHook m_frameHook; // hooks frame window messages - CStringArray m_arStrings; // array of menu item names - HMENU m_hmenu; // the menu - - // menu tracking stuff: - int m_iPopupTracking; // which popup I'm tracking if any - int m_iNewPopup; // next menu to track - BOOL m_bProcessRightArrow; // process l/r arrow keys? - BOOL m_bProcessLeftArrow; // ... - BOOL m_bEscapeWasPressed; // user pressed escape to exit menu - CPoint m_ptMouse; // mouse location when tracking popup - HMENU m_hMenuTracking; // current popup I'm tracking - - TRACKINGSTATE m_iTrackingState; // current tracking state - - // helpers - void RecomputeToolbarSize(); - void RecomputeMenuLayout(); - void UpdateFont(); - int GetNextOrPrevButton(int iButton, BOOL bPrev); - void SetTrackingState(TRACKINGSTATE iState, int iButton=-1); - void TrackPopup(int iButton); - void ToggleTrackButtonMode(); - void CancelMenuAndTrackNewOne(int iButton); - void OnMenuSelect(HMENU hmenu, UINT nItemID); - CPoint ComputeMenuTrackPoint(const CRect& rcButn, TPMPARAMS& tpm); - - BOOL IsValidButton(int iButton) const - { return 0 <= iButton && iButton < GetButtonCount(); } - - virtual BOOL OnMenuInput(MSG& m); // handle popup menu input - - // overrides - virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle); - int HitTest(CPoint p) const; - - // command/message handlers - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnUpdateMenuButton(CCmdUI* pCmdUI); - afx_msg LRESULT OnSetMenuNull(WPARAM wp, LPARAM lp); - - static LRESULT CALLBACK MenuInputFilter(int code, WPARAM wp, LPARAM lp); - - DECLARE_DYNAMIC(CMenuBar) - DECLARE_MESSAGE_MAP() - -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif -}; - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMessages.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMessages.h deleted file mode 100644 index 1f5e629c3f7..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIMessages.h +++ /dev/null @@ -1,68 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// General -#define WM_APP_UPDATE_ALL_VIEWS WM_APP+1001 -#define WM_APP_UPDATE_STATUS WM_APP+1002 -#define WM_APP_RESIZE WM_APP+1003 -#define WM_APP_SHELL_INIT_POPUP WM_APP+1004 -#define WM_APP_CB_IE_HIT_ENTER WM_APP+1005 -#define WM_APP_CB_IE_POPULATE WM_APP+1006 -#define WM_APP_CB_IE_SEL_CHANGE WM_APP+1007 -#define WM_APP_CB_IE_SET_EDIT_TEXT WM_APP+1008 -#define WM_UPDATEHEADERWIDTH WM_APP+1020 -#define WM_HEADERWIDTHCHANGED WM_APP+1021 -// Keyboard -#define WM_APP_ON_CONTEXT_MENU_KEY WM_APP+1100 -#define WM_APP_ON_BACKSPACE_KEY WM_APP+1101 -#define WM_APP_ON_EDIT_KEY WM_APP+1102 -#define WM_APP_ON_REFRESH_KEY WM_APP+1103 -#define WM_APP_ON_DELETE_KEY WM_APP+1104 -#define WM_APP_ON_PROPERTIES_KEY WM_APP+1105 -// Internet -#define WM_APP_INET_PAGE_READY WM_APP+1501 -#define WM_APP_INET_STATUS WM_APP+1502 -// OLE drag and drop -#define WM_APP_OLE_DD_ENTER WM_APP+2001 -#define WM_APP_OLE_DD_LEAVE WM_APP+2002 -#define WM_APP_OLE_DD_DROP WM_APP+2003 -#define WM_APP_OLE_DD_OVER WM_APP+2004 -#define WM_APP_OLE_DD_DODRAGDROP WM_APP+2005 -// Tab views -#define WM_APP_TAB_SEL_CHANGE WM_APP+3001 -#define WM_APP_TAB_UPDATE_VIEWS WM_APP+3002 -// Tree control -#define WM_APP_DD_ADD_FOLDER_ITEMS WM_APP+4001 -#define WM_APP_DD_NEW_FOLDER_ITEM WM_APP+4002 -#define WM_APP_NEW_FOLDER WM_APP+4003 -#define WM_APP_DIR_CHANGE_EVENT WM_APP+4006 -#define WM_APP_TIMER_SEL_CHANGE WM_APP+4007 -#define WM_APP_POPULATE_TREE WM_APP+4008 -// List Control -#define WM_APP_FILE_CHANGE_EVENT WM_APP+5001 -#define WM_APP_FILE_CHANGE_NEW_PATH WM_APP+5002 -// Tray Icon -#define WM_APP_TRAY_NOTIFY WM_APP+6001 - -// Hints for UpdateAllViews -#define HINT_BASE_CTRL_EXT 1000 -#define HINT_TREE_SEL_CHANGED HINT_BASE_CTRL_EXT+1 -#define HINT_TREE_INTERNET_FOLDER_SELECTED HINT_BASE_CTRL_EXT+2 -#define HINT_SHELL_FILE_CHANGED HINT_BASE_CTRL_EXT+3 -#define HINT_SHELL_DIR_CHANGED HINT_BASE_CTRL_EXT+4 -#define HINT_STATUS_BAR_TEXT HINT_BASE_CTRL_EXT+5 - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIModulVer.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIModulVer.h deleted file mode 100644 index 35a78046a70..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIModulVer.h +++ /dev/null @@ -1,64 +0,0 @@ -//////////////////////////////////////////////////////////////// -// 1998 Microsoft Systems Journal -// -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef __MODULEVER_H -#define __MODULEVER_H - -//#undef _INC_SHLWAPI -//#undef NOSHLWAPI -#include - -// tell linker to link with version.lib for VerQueryValue, etc. -#pragma comment(linker, "/defaultlib:version.lib") - -#ifndef DLLVER_PLATFORM_WINDOWS -#error ModuleVer.h requires a newer version of the SDK than you have! -#error Please update your SDK files. -#endif - -////////////////// -// This class loads a library. Destructor frees for automatic cleanup. -// -class CTRL_EXT_CLASS CLoadLibrary { -private: - HINSTANCE m_hinst; -public: - CLoadLibrary(LPCTSTR lpszName) : m_hinst(LoadLibrary(lpszName)) { } - ~CLoadLibrary() { FreeLibrary(m_hinst); } - operator HINSTANCE () { return m_hinst; } // cast operator -}; - -////////////////// -// CModuleVersion version info about a module. -// To use: -// -// CModuleVersion ver -// if (ver.GetFileVersionInfo("_T("mymodule))) { -// // info is in ver, you can call GetValue to get variable info like -// CString s = ver.GetValue(_T("CompanyName")); -// } -// -// You can also call the static fn DllGetVersion to get DLLVERSIONINFO. -// -class CTRL_EXT_CLASS CModuleVersion : public VS_FIXEDFILEINFO { -protected: - BYTE* m_pVersionInfo; // all version info - - struct TRANSLATION { - WORD langID; // language ID - WORD charset; // character set (code page) - } m_translation; - -public: - CModuleVersion(); - virtual ~CModuleVersion(); - - BOOL GetFileVersionInfo(LPCTSTR modulename); - CString GetValue(LPCTSTR lpKeyName); - static BOOL DllGetVersion(LPCTSTR modulename, DLLVERSIONINFO& dvi); -}; - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIStatusBar.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIStatusBar.h deleted file mode 100644 index c7e0980a085..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIStatusBar.h +++ /dev/null @@ -1,307 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __STATUSBAROPTIONS_H__ -#define __STATUSBAROPTIONS_H__ - -// CStatusBarPane holds the information required for each pane -// if m_bActive is false the pane will not be shown -typedef CList CListImages; - -class CStatusBarPane : public CObject -{ - DECLARE_SERIAL(CStatusBarPane) -public: - - CStatusBarPane(); - CStatusBarPane(UINT nID,BOOL bActive); - CStatusBarPane(const CStatusBarPane &rOther); - virtual ~CStatusBarPane(); - - BOOL IsPaneActive() const; - UINT GetCommandID() const; - UINT GetStyle() const; - void SetPaneActive(BOOL bActive); - void AddImage(int nIndex); - void SetStyle(UINT nStyle); - void RemoveImage(int nIndex); - bool FindImage(int nIndex); - void RemoveAllImages(); - CListImages &GetImageIndex(); - - CStatusBarPane &operator=(const CStatusBarPane &rOther); -// Overrides - virtual void Serialize(CArchive &ar); -private: - void DoCopy(const CStatusBarPane &rOther); - -private: - UINT m_nID; - UINT m_nStyle; - BOOL m_bActive; -// Icons - CListImages m_listImageIndex; -}; - -inline CStatusBarPane::CStatusBarPane() -{ -} - -inline CStatusBarPane::CStatusBarPane(UINT nID,BOOL bActive) - : m_nID(nID), - m_bActive(bActive) -{ - m_nStyle = SBPS_NORMAL; -} - -inline CStatusBarPane::~CStatusBarPane() -{ -} - -inline void CStatusBarPane::SetStyle(UINT nStyle) -{ - m_nStyle = nStyle; -} - -inline UINT CStatusBarPane::GetStyle() const -{ - return m_nStyle; -} - -inline void CStatusBarPane::SetPaneActive(BOOL bActive) -{ - m_bActive = bActive; -} - -inline bool CStatusBarPane::FindImage(int nIndex) -{ - return m_listImageIndex.Find(nIndex) != NULL; -} - -// index into an ImageList -inline void CStatusBarPane::AddImage(int nIndex) -{ - m_listImageIndex.AddHead(nIndex); -} - -inline void CStatusBarPane::RemoveAllImages() -{ - m_listImageIndex.RemoveAll(); -} - -inline void CStatusBarPane::RemoveImage(int nIndex) -{ - POSITION pos = m_listImageIndex.Find(nIndex); - if (pos != NULL) - { - m_listImageIndex.RemoveAt(pos); - } -} - -inline CListImages &CStatusBarPane::GetImageIndex() -{ - return m_listImageIndex; -} - -inline BOOL CStatusBarPane::IsPaneActive() const -{ - return m_bActive; -} - -inline UINT CStatusBarPane::GetCommandID() const -{ - return m_nID; -} - -// A configurable status bar that will show its own popup menu to configure it. -// You initially add all the panes and then by using the popup menu you can show or -// hide individual panes. The state can be saved to the registry. -class CTRL_EXT_CLASS CUIStatusBar : public CStatusBar -{ - DECLARE_SERIAL(CUIStatusBar) -public: - // Construction - CUIStatusBar(); - ~CUIStatusBar(); - - void Init(); - void Reset(); - void Load(); - void Save(); - void AddPane(UINT nID,BOOL bActive); - BOOL IsValidPaneID(UINT nID) const; - BOOL IsPaneActive(UINT nID) const; - CStatusBarPane *GetPane(UINT nPaneID) const; - BOOL SetPanes(BOOL bSave); - int GetPaneIndex(UINT nID) const; - UINT GetPaneID(int nPaneIndex); - UINT GetStyle(UINT nID) const; - void TogglePane(UINT nID); - void SetImageList(UINT nBitmapID); - void SetImageList(CImageList *pImageList); - void CreateImageList(); - void AddIcon(UINT nPaneID,UINT nImageID,bool bUpdate=true); - void RemoveIcon(UINT nPaneID,UINT nImageID,bool bUpdate=true); - void SetStyle(UINT nID,UINT nStyle); - void Clear(); - void CopyBar(const CUIStatusBar &rOtherBar); - BOOL IsPanes(); - void UpdatePane(int nIndex); - void SetText(UINT nPaneID,LPCTSTR szText,bool bUpdate); - void RemoveAllIcons(UINT nPaneID); - -// Overrides - virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - virtual void Serialize(CArchive& ar); -protected: - void RemoveIcon(UINT nImageID,CStatusBarPane *pPane,bool bUpdate); - void AddImageIndex(UINT nPaneID,int nIndex,bool bUpdate); - int AddIcon(UINT nID); - int AddIcon(HICON hIcon); - void SetTextPane(const CStatusBarPane *pPane,LPCTSTR szText,bool bUpdate=true); -public: - // Main Pane - UINT m_nStatusPane1ID; - UINT m_nStatusPane1Style; - INT m_nStatusPane1Width; - BOOL m_bMenuSelect; -private: - static LPCTSTR szSection; - static LPCTSTR szPaneEntry; - CList m_PaneList; - CImageList *m_pImageList; - - //{{AFX_MSG(CUIStatusBar) - afx_msg void OnContextMenu(CWnd *pWnd, CPoint point); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - CUIStatusBar &operator=(const CUIStatusBar &rOther); - CMap m_mapImageIndex; -}; - -inline BOOL CUIStatusBar::IsPanes() -{ - return !m_PaneList.IsEmpty(); -} - -inline void CUIStatusBar::CopyBar(const CUIStatusBar &rOtherBar) -{ - *this = rOtherBar; -} - -inline void CUIStatusBar::SetStyle(UINT nID,UINT nStyle) -{ - CStatusBarPane *pPane = GetPane(nID); - ASSERT(pPane); - int nIndex = GetPaneIndex(nID); - UINT nOldStyle; - int nWidth; - GetPaneInfo(nIndex,nID,nOldStyle,nWidth); - SetPaneInfo(nIndex,nID,nStyle,nWidth); - pPane->SetStyle(nStyle); -} - -inline UINT CUIStatusBar::GetStyle(UINT nID) const -{ - const CStatusBarPane *pPane = GetPane(nID); - ASSERT(pPane); - return pPane->GetStyle(); -} - -inline int CUIStatusBar::GetPaneIndex(UINT nID) const -{ - int nIndex = CommandToIndex(nID); - return nIndex; -} - -inline BOOL CUIStatusBar::IsPaneActive(UINT nID) const -{ - const CStatusBarPane *pPane = GetPane(nID); - ASSERT(pPane); - return pPane ? pPane->IsPaneActive() : FALSE; -} - -inline UINT CUIStatusBar::GetPaneID(int nPaneIndex) -{ - UINT nID,nStyle; - int nWidth; - GetPaneInfo(nPaneIndex,nID,nStyle,nWidth); - return nID; -} - -inline BOOL CUIStatusBar::IsValidPaneID(UINT nID) const -{ - if (nID == ID_SEPARATOR) - return FALSE; - const CStatusBarPane *pPane = GetPane(nID); - return pPane != NULL; -} - -///////////////////////////////////////////////////////////////////////////// -// CProgressBar - status bar progress control - -class CTRL_EXT_CLASS CProgressBar : public CProgressCtrl -// Creates a ProgressBar in the status bar -{ -public: - CProgressBar(); - CProgressBar(int nPaneID, CUIStatusBar *pStatusBar, int MaxValue = 100); - ~CProgressBar(); - BOOL Create(int nPaneID, CUIStatusBar *pStatusBar, int MaxValue=100); - - DECLARE_DYNCREATE(CProgressBar) - -// operations -public: - - void SetRange(int nLower, int nUpper, int nStep = 1); - void SetSize(int nSize); - int SetPos(int nPos); - int OffsetPos(int nPos); - int SetStep(int nStep); - int StepIt(); - void Clear(); - -// Overrides - //{{AFX_VIRTUAL(CProgressBar) - //}}AFX_VIRTUAL - -// implementation -protected: - - void Resize(); - -// Generated message map functions -protected: - //{{AFX_MSG(CProgressBar) - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - CUIStatusBar *m_pStatusBar; - int m_nPaneIndex; -}; - -inline void CProgressBar::SetSize(int nSize) -{ - Resize(); -} - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UISubclass.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UISubclass.h deleted file mode 100644 index 166fb62fd8e..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UISubclass.h +++ /dev/null @@ -1,61 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -#ifndef _SUBCLASSW_H -#define _SUBCLASSW_H - -////////////////// -// Generic class to hook messages on behalf of a CWnd. -// Once hooked, all messages go to CSubclassWnd::WindowProc before going -// to the window. Specific subclasses can trap messages and do something. -// -// To use: -// -// * Derive a class from CSubclassWnd. -// -// * Override CSubclassWnd::WindowProc to handle messages. Make sure you call -// CSubclassWnd::WindowProc if you don't handle the message, or your -// window will never get messages. If you write seperate message handlers, -// you can call Default() to pass the message to the window. -// -// * Instantiate your derived class somewhere and call HookWindow(pWnd) -// to hook your window, AFTER it has been created. -// To unhook, call HookWindow(NULL). -// -// This is a very important class, crucial to many of the widgets Window -// widgets implemented in PixieLib. To see how it works, look at the HOOK -// sample program. -// -class CTRL_EXT_CLASS CSubclassWnd : public CObject { -public: - DECLARE_DYNAMIC(CSubclassWnd); - CSubclassWnd(); - ~CSubclassWnd(); - - // Subclass a window. Hook(NULL) to unhook (automatic on WM_NCDESTROY) - BOOL HookWindow(HWND hwnd); - BOOL HookWindow(CWnd* pWnd) { return HookWindow(pWnd->GetSafeHwnd()); } - BOOL IsHooked() { return m_hWnd!=NULL; } - - friend LRESULT CALLBACK HookWndProc(HWND, UINT, WPARAM, LPARAM); - friend class CSubclassWndMap; - -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - HWND m_hWnd; // the window hooked - WNDPROC m_pOldWndProc; // ..and original window proc - CSubclassWnd* m_pNext; // next in chain of hooks for this window - - // Override this to handle messages in specific handlers - virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp); - LRESULT Default(); // call this at the end of handler fns -}; - -#endif // _SUBCLASSW_H - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITabSplitterWnd.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITabSplitterWnd.h deleted file mode 100644 index 4c81c860959..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITabSplitterWnd.h +++ /dev/null @@ -1,79 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __TABSPLITTERWND_H__ -#define __TABSPLITTERWND_H__ - -// This splitter bar is persistent and will restore the previous -// position and will also set the focus back to the previous pane -// after the bar has been respositioned -class CTRL_EXT_CLASS CTabSplitterWnd : public CSplitterWnd -{ - DECLARE_DYNAMIC(CTabSplitterWnd) -public: - CTabSplitterWnd(); - - // for registry - void SetSection(LPCTSTR szSection); -// for workspace - void SetPropertyItem(CRuntimeClass *pPropertyItemClass); - void SetSize(int nCur,int nMin); - void Apply(); - BOOL IsEmpty(); - virtual void SaveSize(); - virtual CWnd *GetActiveWnd(); -public: -// Overrides - virtual void Serialize(CArchive& ar); - virtual BOOL CreateView( int row, int col, CRuntimeClass* pViewClass, SIZE sizeInit, CCreateContext* pContext ); - virtual void ActivateNext(BOOL bPrev); -protected: - virtual void StopTracking(BOOL bAccept); - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Generated message map functions -protected: - //{{AFX_MSG(CTabSplitterWnd) - afx_msg void OnClose(); - afx_msg void OnDestroy(); - afx_msg void OnSetFocus(CWnd* pOldWnd); - afx_msg void OnKillFocus(CWnd* pNewWnd); - afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); - //}}AFX_MSG - LRESULT OnAppSplitterMouseWheel(WPARAM wParam,LPARAM lParam); - DECLARE_MESSAGE_MAP() -protected: - CString m_strSection; - int m_nCurRow; - int m_nCurCol; - int m_cxCur; - int m_cyCur; - int m_cxMin; - int m_cyMin; -private: - static LPCTSTR szSplitterSection; - static LPCTSTR szPaneWidthCurrent; - static LPCTSTR szPaneWidthMinimum; - static LPCTSTR szPaneHeightCurrent; - static LPCTSTR szPaneHeightMinimum; -}; - -inline CTabSplitterWnd::IsEmpty() -{ - return m_nCols == 0 && m_nRows == 0; -} - -#endif //__TABSPLITTERWND_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeCtrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeCtrl.h deleted file mode 100644 index 0a110089e41..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeCtrl.h +++ /dev/null @@ -1,173 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_URLTREECTRL_H__9743E546_1F3A_11D2_A40D_9CB186000000__INCLUDED_) -#define AFX_URLTREECTRL_H__9743E546_1F3A_11D2_A40D_9CB186000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// URLTreeCtrl.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CUITreeCtrl window -#include "UIFolderRefresh.h" -#include "UIDragDropTree.h" -#include "UIData.h" - -class CTRL_EXT_CLASS CUITreeCtrl : public CUIDragDropTree -{ - DECLARE_DYNAMIC(CUITreeCtrl) -// Construction -public: - CUITreeCtrl(bool bDragDrop=true); - -// Attributes -public: - virtual void UpdateCurrentSelection(); - - void SetStyle(UINT nStyle); - void AddStyle(UINT nStyle); - DWORD GetItemData(HTREEITEM hItem) const; - BOOL SetItemData(HTREEITEM hItem,DWORD dwData,bool bAutoDelete=false); - void SetDefaultTextColor(HTREEITEM hItem); - void SetDefaultBkColor(HTREEITEM hItem); - void SetTextColor(HTREEITEM hItem,COLORREF TextColor); - void SetBkColor(HTREEITEM hItem,COLORREF BkColor); - void SetItemFont(HTREEITEM hItem,CFont *pFont); - void SetItemBold(HTREEITEM hItem,bool bBold); -// Operations -public: - virtual void Init(); - virtual HTREEITEM AddAnItem(HTREEITEM hParent, LPCTSTR szText, LPARAM lParam, HTREEITEM hInsAfter,int iImage = 0,int iSelImage = 0,int nChildren = 0); - void SetPopupID(UINT nID); - void SetPopupWnd(CWnd *pWnd); -protected: - virtual void OnDeleteItemData(DWORD dwData); - virtual CUIListCtrlData *GetNewListCtrlData(DWORD dwData,HTREEITEM hParent); - virtual CUIListCtrlData *GetListCtrlData(HTREEITEM hItem) const; - virtual void ItemPostPaint(LPNMTVCUSTOMDRAW lptvcd,LRESULT *pResult); - virtual void ItemPrePaint(LPNMTVCUSTOMDRAW lptvcd,LRESULT *pResult); - virtual bool EndLabelEdit(HTREEITEM hItem,LPCTSTR pszText); - virtual HTREEITEM GetHitItem(CPoint *pt); - virtual UINT GetMenuID(); - virtual CWnd *GetMenuWnd(); - virtual bool Expanding(NM_TREEVIEW *nmtvw); - virtual bool Collapsing(NM_TREEVIEW *nmtvw); - virtual void UpdateEvent(LPARAM lHint,CObject *pHint); - virtual UINT GetIconID(); - virtual UINT GetOpenIconID(); - virtual void DoubleClick(HTREEITEM hItem); - virtual void SelectionChanged(HTREEITEM hItem,LPARAM lParam); - virtual CRefresh *CreateRefreshObject(HTREEITEM hItem,LPARAM lParam); - // OLE Drag and Drop - // This called when a drop source is dropped on the list control - virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo); - // This called when a drop source is currently over the list control - // This called when a drop source is currently over the list control - virtual bool DragOver(CDD_OleDropTargetInfo *pInfo); - virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo); - virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo); - // This called when the user initiates a OLE drag and drop - virtual DROPEFFECT DoDragDrop(NM_TREEVIEW* pNMTreeView,COleDataSource *pOleDataSource); - virtual void DeleteKey(HTREEITEM hItem); - virtual void ShowPopupMenu(HTREEITEM hItem,CPoint point); - virtual void ShowProperties(HTREEITEM hItem); - virtual void Refresh(); - virtual void GoBack(HTREEITEM hItem); -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUITreeCtrl) - public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL PreTranslateMessage(MSG* pMsg); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CUITreeCtrl(); - - // Generated message map functions -protected: - //{{AFX_MSG(CUITreeCtrl) - afx_msg BOOL OnDblclk(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnReturn(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnItemExpanded(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnItemExpanding(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnRclick(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnKeydownFolder(NMHDR* pNMHDR, LRESULT* pResult); - - afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg LRESULT OnTVMGetItem(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnTVMSetItem(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnTVMInsertItem(WPARAM wParam,LPARAM lParam); - //}}AFX_MSG - afx_msg LRESULT OnAppPropertiesKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppDeleteKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppRefreshKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppBackspaceKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppContextMenuKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppEditKey(WPARAM wParam, LPARAM lParam ); - - afx_msg LRESULT OnTimerSelChange(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragDrop(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragOver(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragEnter(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragLeave(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDDDoDragDrop(WPARAM wParam,LPARAM lParam); - - DECLARE_MESSAGE_MAP() -protected: - int m_idxClosed; - int m_idxOpen; - WORD m_vkeydown; -private: - CImageList m_ImageList; - NM_TREEVIEW m_NMTreeView; - LPARAM m_lParam; - UINT m_IDTimer; - UINT m_style; - HFONT m_hOrigFont; - bool m_bMe; -protected: - CWnd *m_pPopupWnd; - UINT m_PopupID; -}; - -inline void CUITreeCtrl::SetStyle(UINT nStyle) -{ - m_style = nStyle; -} - -inline void CUITreeCtrl::AddStyle(UINT nStyle) -{ - m_style |= nStyle; -} - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_URLTREECTRL_H__9743E546_1F3A_11D2_A40D_9CB186000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeView.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeView.h deleted file mode 100644 index 0f9436844db..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UITreeView.h +++ /dev/null @@ -1,82 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_UITREEVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_) -#define AFX_UITREEVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -///////////////////////////////////////////////////////////////////////////// -// CUITreeView view -#include "UITreeCtrl.h" - -class CTRL_EXT_CLASS CUITreeView : public CView -{ -protected: - CUITreeView(UINT nID); // protected constructor used by dynamic creation - DECLARE_DYNAMIC(CUITreeView) - -// Attributes -public: - virtual CUITreeCtrl &GetTreeCtrl(); - virtual void CreateTreeCtrl(); -protected: - virtual void SelectionChanged(const CRefresh &Refresh); -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CUITreeView) - protected: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); - //}}AFX_VIRTUAL - -// Implementation -protected: - virtual ~CUITreeView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - - // Generated message map functions -protected: - //{{AFX_MSG(CUITreeView) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSetFocus(CWnd* pOldWnd); - afx_msg void OnSize(UINT nType, int cx, int cy); - //}}AFX_MSG - afx_msg LRESULT OnAppUpdateAllViews( WPARAM wParam, LPARAM lParam ); - DECLARE_MESSAGE_MAP() -protected: - CUITreeCtrl *m_pTreeCtrl; -private: - UINT m_Style; - UINT m_nID; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_UITREEVIEW__6016F537_2DF1_11D2_A412_E0317E000000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIres.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIres.h deleted file mode 100644 index a671a06bbaa..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/UIres.h +++ /dev/null @@ -1,95 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -#define IDB_DOMAIN 201 -#define IDB_MACHINE 202 -#define IDB_NETWORK 203 -#define IDR_POPUPMENU_LISTCTRL 204 -#define IDR_POPUPMENU_HEADERCTRL 205 -#define IDI_CHECKMARK 206 -#define IDB_MENUCHK 207 -#define IDR_POPUPMENU_DRAGDROP 208 -#define IDR_POPUPMENU_TREE_FOLDER 209 -#define IDB_COLDTOOLBAR 210 -#define IDB_HOTTOOLBAR 211 -#define IDI_FOLDER_CLOSED 212 -#define IDC_NODROP 213 -#define IDB_REPORT 214 -#define IDC_COLUMNLIST 215 -#define ID_VIEW_FIELDCHOOSER 216 -#define CG_IDC_PROGDLG_PROGRESS1 217 -#define CG_IDC_PROGDLG_PROGRESS2 218 -#define CG_IDC_PROGDLG_PERCENT1 219 -#define CG_IDC_PROGDLG_PERCENT2 220 -#define CG_IDC_PROGDLG_STATUS 221 -#define IDC_FOP_LIST_ICONS 222 -#define IDC_NETWORK 223 -#define IDC_EDIT_NEW_CATEGORY 224 -#define IDD_NEW_CATEGORY 225 -#define IDC_UIOD_HAND 226 -#define IDC_LIST_SEARCH 227 -#define IDC_TREE_SHELL 228 -#define IDC_LIST_SHELL 229 -#define IDC_CB_IE_ADDRESS 230 -#define CG_IDD_PROGRESS 1001 -#define IDD_FILEOPENPREVIEW_ICON 1002 -#define IDD_MACHINES 1003 -#define IDD_FIELDCHOOSER 1004 -#define IDC_IMAGE 1005 -#define IDD_FILEOPENPREVIEW_IMAGE 1006 -#define IDC_BUTT_SEARCH 1010 -#define IDC_STATIC_STATUS 1011 -#define IDC_BUTT_OPEN 1012 -#define IDD_FILEOPENPREVIEW_SEARCH 1013 -#define ID_SHELL_POPUP_FIRST 42500 -#define ID_SHELL_POPUP_LAST 42600 -#define ID_POPUP_DD_MOVE 42768 -#define ID_POPUP_DD_COPY 42769 -#define ID_POPUP_DD_CANCEL 42770 -#define ID_UI_VIEW_LARGE_ICONS 42771 -#define ID_UI_VIEW_SMALL_ICONS 42772 -#define ID_UI_VIEW_DETAILS 42773 -#define ID_UI_VIEW_LIST 42774 -#define ID_UI_VIEW_GRIDLINES 42775 -#define ID_UI_VIEW_FULL_SELECTION 42776 -#define ID_UI_VIEW_CHECKBOXES 42777 -#define ID_UI_VIEW_COLUMN_ORDERING 42778 -#define ID_UI_VIEW_FULL_ROW_SELECTION 42779 -#define ID_UI_VIEW_TRACK_SELECT 42780 -#define ID_UI_VIEW_COLUMN_SIZING 42781 -#define ID_HEADER_REMOVE_COL 42782 -#define ID_HEADER_EDIT_TEXT 42783 -#define ID_HEADER_RESET 42784 -#define ID_UI_VIEW_EDIT_COLUMN 42786 -#define ID_BROWSER_GO_BACK 42787 -#define ID_BROWSER_GO_FORWARD 42788 -#define ID_BROWSER_GO_HOME 42789 -#define ID_BROWSER_REFRESH 42790 -#define ID_BROWSER_STOP 42791 -#define ID_BROWSER_SEARCH 42792 -#define ID_BROWSER_FAVORITES 42793 -#define IDS_BROWSER_GO_BACK 42794 -#define IDS_BROWSER_GO_FORWARD 42795 -#define IDS_BROWSER_GO_HOME 42796 -#define IDS_BROWSER_REFRESH 42797 -#define IDS_BROWSER_STOP 42798 -#define IDS_BROWSER_SEARCH 42799 -#define IDS_BROWSER_FAVORITES 42800 -#define ID_POPUP_TF_NEW_FOLDER 42801 -#define CG_IDS_PROGRESS_CAPTION 42801 -#define ID_POPUP_TF_DELETE_FOLDER 42802 -#define IDS_ICON_FILTER 42802 -#define ID_POPUP_TF_REFRESH 42803 -#define IDS_ICON_CAPTION 42803 -#define IDS_SEARCH_CAPTION 42804 -#define IDS_SEARCH_FILTER 42805 -#define IDS_FILE_SELECT_APP 42806 -#define IDS_FILE_SELECT_ICON 42807 -#define IDS_FILE_SELECT_EXEC 42808 -#define IDS_FILE_SELECT_HTML 42809 -#define IDS_FILE_SELECT_COM 42810 -#define IDS_FILE_SELECT_SCRIPT 42811 -#define IDS_FILE_SELECT_APP_EXT 42812 -#define IDS_FILE_SELECT_IMAGES 42813 -#define IDS_FILE_SELECT_AUDIO 42814 -#define IDS_IMAGE_CAPTION 42815 -#define IDS_NO_ITEMS_MESS 42816 diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Uictrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Uictrl.h deleted file mode 100644 index c521924b5da..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/Uictrl.h +++ /dev/null @@ -1,652 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#ifndef __ODLISTCTRL_H__ -#define __ODLISTCTRL_H__ - -#define NUM_BITMAPS 2 -#define MAX_TEXT MAX_PATH - -#include "UICont.h" -#include "UIDropTarget.h" -#include "UIMessages.h" -#include "LocaleInfo.h" - -class CInPlaceEdit; -class CTextProgressCtrl; - -////////////////////////////////////////////////////////// -//CODHeaderCtrl -////////////////////////////////////////////////////////// -class CTRL_EXT_CLASS CODHeaderCtrl : public CHeaderCtrl -{ -public: - CODHeaderCtrl(); - ~CODHeaderCtrl(); -public: - virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - int SetSortImage(int nCol, BOOL bAsc); -protected: - int m_nSortCol; - BOOL m_bSortAsc; -}; - -////////////////////////////////////////////////////////////////////////// -// CUIODListCtrl -// Extension of the MFC class that enacapsulates the windows list control -// makes some things simpler some things harder and some things better. -////////////////////////////////////////////////////////////////////////// -class CTRL_EXT_CLASS CUIODListCtrl : public CListCtrl -{ -public: - enum eColTypes - { - e_Text, - e_Numeric, - e_NumericFormat, - e_NumericFormatComma, - e_NumericFormatTime, - e_Double, - e_DoubleFormat, - e_DoubleFormatComma, - e_DoubleFormatTime, - e_DateTime - }; - DECLARE_SERIAL(CUIODListCtrl) -public: - CUIODListCtrl(bool bDragDrop=true); - virtual ~CUIODListCtrl(); - -// Attributes - const COleDropTarget &GetDropTarget(); - -// Operations -public: - void RegisterDropTarget(); - virtual void SetRowFont(int nRow,CFont *pFont); - virtual void SetRowBold(int nRow,BOOL bBold=TRUE); - virtual void SetColFont(int nRow,int nCol,CFont *pFont); - virtual void SetColBold(int nRow,int nCol,BOOL bBold=TRUE); - virtual BOOL SetColumnFormat(int nCol,int fmt); - virtual void Serialize(CArchive& ar); - - // called from CUIListView::OnCreate - virtual void ChangeStyle(UINT &dwStyle); - virtual void Init(); - virtual void UpdateEvent(LPARAM lHint,CObject *pHint); - // Initialize the list control - // The first parameter is a pointer to an array or single icon - // that will be added to an image list - // The second parameter will create the columns and add the heading - // but must be in this format Column1|Column2 delimited by the or sign - // This MUST BE CALLED first unless you use CListCtrl or API methods to add columns - // then you use AddTextItem to add a row passing the returned row number every time - virtual int InitListCtrl(const UINT *pIconIDs,LPCTSTR szHeadings,LPCTSTR pszProfile=NULL); - virtual int InitListCtrl(UINT IconID,LPCTSTR szHeadings,LPCTSTR pszProfile=NULL); - virtual int InitListCtrl(LPCTSTR szHeadings,LPCTSTR pszProfile=NULL); - // used to add strings after a text row has been created - virtual BOOL AddString(int nRow,int nCol,LPCTSTR szText,CUIODListCtrl::eColTypes type=CUIODListCtrl::e_Text); - virtual BOOL AddString(int nRow,int nCol,int nValue,CUIODListCtrl::eColTypes type=CUIODListCtrl::e_NumericFormatComma); - virtual BOOL AddString(int nRow,int nCol,double dValue,CUIODListCtrl::eColTypes type=CUIODListCtrl::e_DoubleFormatComma); - virtual BOOL AddString(int nRow,int nCol,COleDateTime &dtValue,CUIODListCtrl::eColTypes type=CUIODListCtrl::e_DateTime); - // Refreshes the row after a row has changed after a call to addstring - virtual void UpdateString(int nRow); - // add a new column will return index or -1 on failure - virtual void AddExtraString(int nRow,LPCTSTR pszExtraText); - // Adds a new column - virtual int AddColumn(LPCTSTR szText); - // Change the the window that receives the popup command messages - // default is the control - void SetPopupWnd(CWnd *pPopupWnd); - // Use your own popup menu - void SetPopupID(UINT nPopupID); - // Use your own popup menu when multiple item have been selected - void SetMultiPopupID(UINT nMultiPopupID); - // find a column index by text - int FindColumn(LPCTSTR pszText); - // same as the list control - DWORD GetItemData(int nIndex) const; - // add a row with data on demand see 'GetDispInfo' method - int AddCallBackItem(DWORD dwData=0,int nImage=0); - // add a text row where you supply the string - int AddTextItem(int nImage=0); - // same as list control with extra flag - BOOL SetItemData(int nIndex,DWORD dwData,bool bAutoDelete=false); - // Sets the item data but will also delete the pointer(so make sure it is one) - // be careful with this one - BOOL SetItemDataAutoDelete(int nIndex,CObject *pObj); - void SetDefaultTextColor( int nRow, int nCol); - void SetDefaultBkColor( int nRow, int nCol); - // set the row color (only works with ownerdraw control) - void SetTextColor( int nRow, int nCol, COLORREF TextColor); - // set the row color (only works with ownerdraw control) - void SetBkColor( int nRow, int nCol, COLORREF BkColor); - // toggle between large and small icon - void SetIconSize(int nImageList); - // set the icon passing an ICON id from the resources - int SetIcon(int nRow,UINT nIconID); - // set the icon passing the image index into the internal image list - int SetIcon(int nRow,int nImage); - // find an item by extension data - int FindItem(DWORD dwExtData); - // set the current selection - int SetCurSel(int nSelect); - void SetDragDrop(bool bDragDrop); - void SetDropFiles(bool bDropFiles); - void SetEditSubItems(bool bEdit); - // toggles the column sizing permission - void SetColumnSizing(bool bSet); - void SetToolTips(bool bSet); - BOOL SetGridLines(bool bSet); - BOOL SetTrackSelect(bool bSet); - BOOL SetCheckBoxes(bool bSet); - BOOL SetHeaderDragDrop(bool bSet); - void SetFullRowSel(bool bSet); - // changes the view type between LVS_ICON, LVS_SMALLICON, LVS_REPORT, etc - BOOL SetEditLabels(bool bSet); - - void ToggleColumnSizing(); - void ToggleToolTips(); - // toggles grid lines(IE3.0 controls only) - BOOL ToggleGridLines(); - // toggles hot tracking lines(IE3.0 controls only) - BOOL ToggleTrackSelect(); - // toggles check boxes (IE3.0 controls only) - BOOL ToggleCheckBoxes(); - // toggles between moving columns by dragging the header (IE3.0 controls only) - BOOL ToggleHeaderDragDrop(); - // toggles full row selection lines(IE3.0 controls only) - void ToggleFullRowSel(); - // changes the view type between LVS_ICON, LVS_SMALLICON, LVS_REPORT, etc - BOOL ToggleEditLabels(); - - BOOL SetViewType(DWORD dwViewType,UINT nFlags=0); - BOOL GetFullRowSel() const; - DWORD GetViewType() const; - // (IE3.0 controls only) - // set the extended style for the new IE3.0 common controls - BOOL SetExStyle(UINT nStyle,BOOL bModify=TRUE); - DWORD GetExStyle(); - - int GetIconSize() const; - // call this first to get the current or first selection - // returns -1 if no selection - int GetCurSel() const; - // used to get multiple selection - // returns -1 if no selection - int GetNextSel(int item) const; - // number of rows - int GetCount() const; - // number of columns - int GetColumnCount() const; - // allow the right mouse click to toggle between icons sizes - void SetRCLickChangeIconSize(BOOL bSize); - int HitTestEx(CPoint &point, int *col) const; - CEdit* EditSubLabel( int nItem, int nCol ); - CTextProgressCtrl *AddProgressBar(int nItem,int nCol,int nMin,int nMax); - virtual void UpdateProgressBar(int nRow,int nCol,int nPos); - void DeleteProgressBar(int nItem,int nCol); - // Add an icon to the image list and return the index into the list - int AddIcon(UINT nIconID); - int AddIcon(HICON hIcon,UINT nIconID=0); - int AddIcon(LPCTSTR pszIcon); - // set the column data type primarily for sorting - void SetColType(int nCol,eColTypes ColType); - void SetSection(LPCTSTR pszSection); - void SetSortHeader(); - void SetSortColumn(int nCol,BOOL bAsc); - - // sort by column - virtual void Sort(); - // save our profiles - virtual void SaveProfile(); - virtual void LoadProfile(); - void DelayPaint(bool bDelay); - static CString StripNonNumeric(LPCTSTR pszOldNum,CUIODListCtrl::eColTypes type); -////////////////// -// Overrides -public: - virtual DROPEFFECT SelectCurrentTarget(CDD_OleDropTargetInfo *pInfo); - // ovwner draw - virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - // ovwner draw - virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItem); - virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); - -protected: - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual void ConvertToTime(CString &str); - virtual void AddThousandSeps(CString &str); - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); - // override if you added a callback row and fill in the structure - virtual PFNLVCOMPARE GetCompareFunc(); - virtual BOOL GetDispInfo(LV_DISPINFO *pDispInfo); - virtual BOOL ColumnClick(NM_LISTVIEW* pNMListView); - virtual BOOL DoubleClick(NM_LISTVIEW* pNMListView); - virtual BOOL OnEnter(NM_LISTVIEW* pNMListView); - virtual BOOL OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult); - virtual BOOL OnSelChanged(int nItem, LRESULT* pResult); - // return true to delete the item from the list control - virtual bool DeleteKey(int nRow); - // called when the user has pressed ALt-Enter - virtual void ShowProperties(int nRow); - // called when the user has pressed F5 - virtual void Refresh(); - // called when the user has pressed the backspace key - virtual void GoBack(int nRow); - // called when the user has has finshed editing a column - virtual bool EndLabelEdit(int nRow,int nCol,LPCTSTR pszText); - virtual void PostNcDestroy(); - virtual int OnToolHitTest(CPoint point,TOOLINFO *pTI) const; - virtual void PreSubclassWindow(); - virtual int CellRectFromPoint(CPoint & point, RECT * cellrect, int * col) const; - virtual void AllItemsDeleted(); - virtual void GetImageLists(CImageList **pILSmall,CImageList **pILLarge); - virtual void CreateImageLists(); - // callback called when a new row is added passing the extension data and row index - // not valid for AddTextItem only AddCallbackItem - virtual CUIListCtrlData *GetNewListCtrlData(DWORD dwData,int nItem); - // option to show context menu if user uses keyboard or mouse(point in client co-ords) - virtual void ShowPopupMenu(int nRow,int nCol,CPoint point); - virtual BOOL PopupMenuItem(int nItem,int nCol,CMenu *pPopup,CPoint point); - virtual BOOL ItemPrePaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult); - virtual BOOL ItemPostPaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult); - virtual BOOL SubItemPrePaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult); - virtual BOOL SubItemPostPaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult); - //WM_DROPFILES - virtual void OnDropFile(int nRow,LPCTSTR pszFile,UINT nFlags); - // OLE Drag and Drop - // This called when a drop source is dropped on the tree control - virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo); - // This called when a drop source is currently over the tree control - virtual bool DragOver(CDD_OleDropTargetInfo *pInfo); - // This called when the user entered the window with a drop source - virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo); - // This called when the user leaves the window with a drop source - virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo); - // This called when the user initiates a OLE drag and drop - virtual DROPEFFECT DoDragDrop(int *npRows,COleDataSource *pOleDataSource); - virtual void Empty(); - - void SetNoItemsMess(const CString &strNoItemsMess); - CString GetNoItemsMess() const; - bool IsDragDrop(); - bool IsDropFiles(); - void OnRClickHeader(CPoint point,int nColIndex); - // return a pointer to an extension data object - CUIListCtrlData *GetListCtrlData(int nItem) const; - - int GetHeaderText(CHeaderCtrl *pHeader,int nPos,CString &strText); - void ReplaceString(CString &rStr,LPCTSTR pszOldText,LPCTSTR pszNewText); - // owner draw - BOOL CalcStringEllipsis(HDC hdc, LPTSTR lpszString, int cchMax, UINT uColWidth); - // owner draw - void DrawItemColumn(LPDRAWITEMSTRUCT lpDrawItemStruct, int nSubItem, LPRECT prcClip); - LPCTSTR GetThousandSep() const; - LPCTSTR GetDecimalSep() const; - LPCTSTR GetNegativeSign() const; - LPCTSTR GetTimeSep() const; - LPCTSTR GetDateSep() const; - LPCTSTR GetSection() const; - BOOL InsertItem(LPTSTR szText,LPARAM lParam,int nImage); - void ChangeIconSize(); - int GetImageIndex(UINT nIconID); - // owner draw - static LPCTSTR MakeShortString(CDC* pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset); - void RepaintSelectedItems(); - void DoOleDrag(NM_LISTVIEW* pNMListView,bool bRightMenu); - // for sorting - -protected: - COLORREF m_clrBkgnd; - COLORREF m_clrTextBk; - COLORREF m_clrText; - int m_cxClient; - int m_cxStateImageOffset; - int m_nImageList; - BOOL m_bFullRowSel; - BOOL m_bClientWidthSel; - BOOL m_bColumnSizing; - BOOL m_bHasFocus; - BOOL m_bRClickChangeIconSize; - BOOL m_bSortAscending; - BOOL m_bToolTips; - CUIObjList m_objList; - int m_nColClicked; - int m_nSortColumn; - int m_nImage; - int m_nItems; - int m_nSubItems; - int m_cxSmallIcon; - int m_cySmallIcon; - int m_cxLargeIcon; - int m_cyLargeIcon; - int *m_pColWidths; - int *m_pColOrder; - int *m_pColTypes; - DWORD m_dwExStyle; - DWORD m_dwViewType; - CImageList m_ImageSmall; - CImageList m_ImageLarge; - CString m_strHeadings; - CPoint m_PopupPoint; - HFONT m_hOrigFont; - CString m_strSection; - CMap m_mapImageIndex; - CMap m_mapImageFile; - CODHeaderCtrl m_HeaderCtrl; - - afx_msg LRESULT OnGetItemText(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnSetImageList(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam); -///* * Generated message map functions - //{{AFX_MSG(CUIODListCtrl) - afx_msg LRESULT OnSetColumnWidth(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDeleteAllItems(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDeleteItem(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDeleteColumn(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnUpdateHeaderWidth(WPARAM wParam,LPARAM lParam); - afx_msg void OnInitMenuPopup(CMenu* pPopupMenu,UINT nIndex,BOOL bSysMenu); - afx_msg void OnContextMenu(CWnd*,CPoint point); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnPaint(); - afx_msg void OnSetFocus(CWnd* pOldWnd); - afx_msg void OnKillFocus(CWnd* pNewWnd); - afx_msg void OnViewLargeIcons(); - afx_msg void OnViewSmallIcons(); - afx_msg void OnViewDetails(); - afx_msg void OnViewList(); - afx_msg void OnViewFullRowSelection(); - afx_msg void OnViewColumnOrdering(); - afx_msg void OnViewColumnSizing(); - afx_msg void OnViewGridlines(); - afx_msg void OnViewCheckboxes(); - afx_msg void OnViewTrackSelect(); - afx_msg void OnViewEditColumn(); - afx_msg void OnHeaderRemoveColumn(); - afx_msg void OnHeaderEditText(); - afx_msg void OnHeaderReset(); - afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg BOOL OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg BOOL OnBeginRDrag(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDestroy(); - afx_msg BOOL OnToolTipText(UINT id,NMHDR *pNMHDR,LRESULT *pResult); - afx_msg void OnDropFiles(HDROP hDropInfo); - afx_msg LRESULT OnAppPropertiesKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppDeleteKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppRefreshKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppBackspaceKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppContextMenuKey(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnAppEditKey(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - afx_msg LRESULT OnDragDrop(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragOver(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragEnter(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDragLeave(WPARAM wParam,LPARAM lParam); - afx_msg LRESULT OnDDDoDragDrop(WPARAM wParam,LPARAM lParam); - DECLARE_MESSAGE_MAP() -private: - static LPCTSTR szEntryHeadings; - static LPCTSTR szEntryStyle; - static LPCTSTR szEntryRowSel; - static LPCTSTR szEntryViewType; - static LPCTSTR szEntryColumnSizing; - static LPCTSTR szEntrySortColumn; - static LPCTSTR szEntrySubItems; - static LPCTSTR szEntryColOrder; - static LPCTSTR szEntryColWidths; - CListDropTarget m_OleDropTarget; - COleDataSource m_OleDataSource; - CString m_sToolTipText; - CString m_strNoItemsMess; - bool m_bDelayPaint; - int m_iItemDrop; - bool m_bDragDrop; - bool m_bDropFiles; - bool m_bEditSubItems; - CWnd *m_pPopupWnd; -protected: - UINT m_PopupID; - UINT m_MultiPopupID; -}; - -///////////////////// -// inlines -///////////////////// -inline void CUIODListCtrl::SetEditSubItems(bool bEdit) -{ - m_bEditSubItems = bEdit; -} - -inline void CUIODListCtrl::SetNoItemsMess(const CString &strNoItemsMess) -{ - m_strNoItemsMess = strNoItemsMess; -} - -inline CString CUIODListCtrl::GetNoItemsMess() const -{ - return m_strNoItemsMess; -} - -inline void CUIODListCtrl::SetPopupWnd(CWnd *pPopupWnd) -{ - m_pPopupWnd = pPopupWnd; -} - -inline void CUIODListCtrl::SetPopupID(UINT nPopupID) -{ - m_PopupID = nPopupID; -} - -inline void CUIODListCtrl::SetMultiPopupID(UINT nMultiPopupID) -{ - m_MultiPopupID = nMultiPopupID; -} - -inline bool CUIODListCtrl::IsDragDrop() -{ - return m_bDragDrop; -} - -inline bool CUIODListCtrl::IsDropFiles() -{ - return m_bDropFiles; -} - -inline void CUIODListCtrl::SetDragDrop(bool bDragDrop) -{ - m_bDragDrop = bDragDrop; -} - -inline void CUIODListCtrl::SetDropFiles(bool bDropFiles) -{ - m_bDropFiles = bDropFiles; -} - -inline const COleDropTarget &CUIODListCtrl::GetDropTarget() -{ - return m_OleDropTarget; -} - -inline int CUIODListCtrl::GetIconSize() const -{ - return m_nImageList; -} - -inline int CUIODListCtrl::GetCurSel() const -{ - return GetNextItem(-1,LVNI_SELECTED); -} - -inline int CUIODListCtrl::GetNextSel(int item) const -{ - return GetNextItem(item,LVNI_SELECTED); -} - -inline int CUIODListCtrl::GetCount() const -{ - return GetItemCount(); -} - -inline void CUIODListCtrl::SetRCLickChangeIconSize(BOOL bSize) -{ - m_bRClickChangeIconSize = bSize; -} - -inline void CUIODListCtrl::SetColumnSizing(bool bSet) -{ - m_bColumnSizing = !bSet; - SaveProfile(); -} - -inline void CUIODListCtrl::ToggleColumnSizing() -{ - m_bColumnSizing = !m_bColumnSizing; - SaveProfile(); -} - -inline void CUIODListCtrl::ToggleFullRowSel() -{ - SetFullRowSel(!m_bFullRowSel); -} - -inline BOOL CUIODListCtrl::ToggleHeaderDragDrop() -{ - return SetHeaderDragDrop(!(GetExStyle() & LVS_EX_HEADERDRAGDROP)); -} - -inline BOOL CUIODListCtrl::SetHeaderDragDrop(bool bSet) -{ - return SetExStyle(LVS_EX_HEADERDRAGDROP,bSet); -} - -inline BOOL CUIODListCtrl::ToggleGridLines() -{ - return SetGridLines(!(GetExStyle() & LVS_EX_GRIDLINES)); -} - -inline BOOL CUIODListCtrl::SetGridLines(bool bSet) -{ - return SetExStyle(LVS_EX_GRIDLINES,bSet); -} - -inline BOOL CUIODListCtrl::ToggleTrackSelect() -{ - return SetTrackSelect(!(GetExStyle() & LVS_EX_TRACKSELECT)); -} - -inline BOOL CUIODListCtrl::SetTrackSelect(bool bSet) -{ - return SetExStyle(LVS_EX_TRACKSELECT,bSet); -} - -inline BOOL CUIODListCtrl::ToggleCheckBoxes() -{ - return SetCheckBoxes(!(GetExStyle() & LVS_EX_CHECKBOXES)); -} - -inline BOOL CUIODListCtrl::SetCheckBoxes(bool bSet) -{ - return SetExStyle(LVS_EX_CHECKBOXES,bSet); -} - -inline BOOL CUIODListCtrl::ToggleEditLabels() -{ - return SetEditLabels(!(GetStyle() & LVS_EDITLABELS)); -} - -inline BOOL CUIODListCtrl::SetEditLabels(bool bSet) -{ - return bSet ? ModifyStyle(0,LVS_EDITLABELS) : ModifyStyle(LVS_EDITLABELS,0); -} - -inline void CUIODListCtrl::ToggleToolTips() -{ - m_bToolTips = !m_bToolTips; - SetToolTips(m_bToolTips == TRUE); -} - -inline void CUIODListCtrl::SetToolTips(bool bSet) -{ - m_bToolTips = bSet; - EnableToolTips(m_bToolTips); -} - -inline void CUIODListCtrl::SetColType(int nCol,eColTypes ColType) -{ - ASSERT(nCol < m_nSubItems); - ASSERT(m_pColTypes); - m_pColTypes[nCol] = ColType; -} - -inline int CUIODListCtrl::GetColumnCount() const -{ - return m_nSubItems; -} - -inline LPCTSTR CUIODListCtrl::GetDecimalSep() const -{ - return CLocaleInfo::Instance()->GetDecimalSep(); -} - -inline LPCTSTR CUIODListCtrl::GetThousandSep() const -{ - return CLocaleInfo::Instance()->GetThousandSep(); -} - -inline LPCTSTR CUIODListCtrl::GetNegativeSign() const -{ - return CLocaleInfo::Instance()->GetNegativeSign(); -} - -inline LPCTSTR CUIODListCtrl::GetTimeSep() const -{ - return CLocaleInfo::Instance()->GetTimeSep(); -} - -inline LPCTSTR CUIODListCtrl::GetDateSep() const -{ - return CLocaleInfo::Instance()->GetDateSep(); -} - -inline void CUIODListCtrl::DelayPaint(bool bDelay) -{ - m_bDelayPaint = bDelay; -} - -//////////////////////////////////////////////// -// CChangeViewType -//////////////////////////////////////////////// -class CChangeViewType -{ -public: - CChangeViewType(CUIODListCtrl *pLC,DWORD dwType); - virtual ~CChangeViewType(); -public: -protected: -private: - CUIODListCtrl *m_pLC; - DWORD m_dwType; -}; - - -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/W2KFix.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/W2KFix.h deleted file mode 100644 index ed6b9459599..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/W2KFix.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef __W2KFIX_H__ -#define __W2KFIX_H__ - -#if (_WIN32_IE < 0x0501) -typedef struct _SHELLDETAILS -{ - int fmt; // LVCFMT_* value (header only) - int cxChar; // Number of "average" characters (header only) - STRRET str; // String information -} SHELLDETAILS, *LPSHELLDETAILS; -// {93F2F68C-1D1B-11d3-A30E-00C04F79ABD1} -DEFINE_GUID(IID_IShellFolder2, 0x93f2f68c, 0x1d1b, 0x11d3, 0xa3, 0xe, 0x0, 0xc0, 0x4f, 0x79, 0xab, 0xd1); - -#define SHCDF_UPDATEITEM 0x00000001 // this flag is a hint that the file has changed since the last call to GetItemData - -typedef struct { - GUID fmtid; - DWORD pid; -} SHCOLUMNID, *LPSHCOLUMNID; -typedef const SHCOLUMNID* LPCSHCOLUMNID; - -typedef struct { - ULONG dwFlags ; // combination of SHCDF_ flags. - DWORD dwFileAttributes ; // file attributes. - ULONG dwReserved ; // reserved for future use. - WCHAR* pwszExt ; // address of file name extension - WCHAR wszFile[MAX_PATH] ; // Absolute path of file. -} SHCOLUMNDATA, *LPSHCOLUMNDATA ; -typedef const SHCOLUMNDATA* LPCSHCOLUMNDATA ; - -#define MAX_COLUMN_NAME_LEN 80 -#define MAX_COLUMN_DESC_LEN 128 -typedef struct { - ULONG dwFlags ; // initialization flags - ULONG dwReserved ; // reserved for future use. - WCHAR wszFolder[MAX_PATH]; // fully qualified folder path (or empty if multiple folders) -} SHCOLUMNINIT, *LPSHCOLUMNINIT; -typedef const SHCOLUMNINIT* LPCSHCOLUMNINIT; - -typedef struct { - SHCOLUMNID scid; // OUT the unique identifier of this column - VARTYPE vt; // OUT the native type of the data returned - DWORD fmt; // OUT this listview format (LVCFMT_LEFT, usually) - UINT cChars; // OUT the default width of the column, in characters - DWORD csFlags; // OUT SHCOLSTATE flags - WCHAR wszTitle[MAX_COLUMN_NAME_LEN]; // OUT the title of the column - WCHAR wszDescription[MAX_COLUMN_DESC_LEN]; // OUT full description of this column -} SHCOLUMNINFO, *LPSHCOLUMNINFO ; -typedef const SHCOLUMNINFO* LPCSHCOLUMNINFO ; - -//------------------------------------------------------------------------- -// -// IEnumExtraSearch interface -// -// IShellFolder2::EnumSearches member returns an IEnumExtraSearch object. -// -//------------------------------------------------------------------------- - -typedef struct tagEXTRASEARCH -{ - GUID guidSearch; - WCHAR wszFriendlyName[80]; - WCHAR wszUrl[2084]; -}EXTRASEARCH, *LPEXTRASEARCH; - -typedef struct IEnumExtraSearch *LPENUMEXTRASEARCH; - -#undef INTERFACE -#define INTERFACE IEnumExtraSearch - -DECLARE_INTERFACE_(IEnumExtraSearch, IUnknown) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - // *** IEnumExtraSearch methods *** - STDMETHOD(Next) (THIS_ ULONG celt, EXTRASEARCH *rgelt, ULONG *pceltFetched) PURE; - STDMETHOD(Skip) (THIS_ ULONG celt) PURE; - STDMETHOD(Reset) (THIS) PURE; - STDMETHOD(Clone) (THIS_ IEnumExtraSearch **ppenum) PURE; -}; - -//-------------------------------------------------------------------------- -// IShellFolder2 -// -// [member functions] -// -// IShellFolder2::GetDefaultSearchGUID(LPGUID pGuid) -// Returns the guid of the search that is to be invoked when user clicks -// on the search toolbar button -// -// IShellFolder2::EnumSearches(IEnumExtraSearch **ppenum) -// gives an enumerator of the searches to be added to the search menu -//-------------------------------------------------------------------------- - -// IShellFolder2::GetDefaultColumnState values -typedef enum { - SHCOLSTATE_TYPE_STR = 0x00000001, - SHCOLSTATE_TYPE_INT = 0x00000002, - SHCOLSTATE_TYPE_DATE = 0x00000003, - SHCOLSTATE_TYPEMASK = 0x0000000F, - SHCOLSTATE_ONBYDEFAULT = 0x00000010, // should on by default in details view - SHCOLSTATE_SLOW = 0x00000020, // will be slow to compute, do on a background thread - SHCOLSTATE_EXTENDED = 0x00000040, // provided by a handler, not the folder - SHCOLSTATE_SECONDARYUI = 0x00000080, // not displayed in context menu, but listed in the "More..." dialog - SHCOLSTATE_HIDDEN = 0x00000100, // not displayed in the UI -} SHCOLSTATE; - -#undef INTERFACE -#define INTERFACE IShellFolder2 - -DECLARE_INTERFACE_(IShellFolder2, IShellFolder) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - // *** IShellFolder methods *** - STDMETHOD(ParseDisplayName)(THIS_ HWND hwnd, LPBC pbc, LPOLESTR pszDisplayName, - ULONG *pchEaten, LPITEMIDLIST *ppidl, ULONG *pdwAttributes) PURE; - STDMETHOD(EnumObjects)(THIS_ HWND hwnd, DWORD grfFlags, IEnumIDList **ppenumIDList) PURE; - STDMETHOD(BindToObject)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE; - STDMETHOD(BindToStorage)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE; - STDMETHOD(CompareIDs)(THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE; - STDMETHOD(CreateViewObject)(THIS_ HWND hwnd, REFIID riid, void **ppv) PURE; - STDMETHOD(GetAttributesOf)(THIS_ UINT cidl, LPCITEMIDLIST * apidl, ULONG * drgfInOut) PURE; - STDMETHOD(GetUIObjectOf)(THIS_ HWND hwnd, UINT cidl, LPCITEMIDLIST * apidl, - REFIID riid, UINT * prgfInOut, void **ppv) PURE; - STDMETHOD(GetDisplayNameOf)(THIS_ LPCITEMIDLIST pidl, DWORD uFlags, STRRET *psr) PURE; - STDMETHOD(SetNameOf)(THIS_ HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR pszName, - DWORD uFlags, LPITEMIDLIST *ppidl) PURE; - - // *** IShellFolder2 methods *** - STDMETHOD(GetDefaultSearchGUID)(THIS_ GUID *pguid) PURE; - STDMETHOD(EnumSearches)(THIS_ IEnumExtraSearch **ppenum) PURE; - STDMETHOD(GetDefaultColumn) (THIS_ DWORD dwRes, ULONG *pSort, ULONG *pDisplay) PURE; - STDMETHOD(GetDefaultColumnState)(THIS_ UINT iColumn, DWORD *pcsFlags) PURE; - STDMETHOD(GetDetailsEx)(THIS_ LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) PURE; - STDMETHOD(GetDetailsOf)(THIS_ LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) PURE; - STDMETHOD(MapColumnToSCID)(THIS_ UINT iColumn, SHCOLUMNID *pscid) PURE; -}; - -#undef INTERFACE -#define INTERFACE IShellDetails - -DECLARE_INTERFACE_(IShellDetails, IUnknown) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - // *** IShellDetails methods *** - STDMETHOD(GetDetailsOf)(THIS_ LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *pDetails) PURE; - STDMETHOD(ColumnClick)(THIS_ UINT iColumn) PURE; -}; - - -#endif - - -#endif //__W2KFIX_H__ \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/WindowPlacement.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/WindowPlacement.h deleted file mode 100644 index c9c165ef5a0..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/WindowPlacement.h +++ /dev/null @@ -1,30 +0,0 @@ -// MSJ -// It it works contact Paul DiLascia -// if not you're own your own - -#ifndef __WINDOWPLACEMENT_H__ -#define __WINDOWPLACEMENT_H__ - -// CWindowPlacement reads and writes WINDOWPLACEMENT -// Helper for restoring the app size and placement. -class CTRL_EXT_CLASS CWindowPlacement : public WINDOWPLACEMENT { -public: - CWindowPlacement(); - ~CWindowPlacement(); - - // Read/write to app profile - BOOL GetProfileWP(LPCTSTR lpKeyName); - void WriteProfileWP(LPCTSTR lpKeyName); - - // Save/restore window pos (from app profile) - void Save(LPCTSTR lpKeyName, CWnd* pWnd); - BOOL Restore(LPCTSTR lpKeyName, CWnd* pWnd); - - // Save/restore from archive - friend CArchive& operator<<(CArchive& ar, const CWindowPlacement& wp); - friend CArchive& operator>>(CArchive& ar, CWindowPlacement& wp); -private: - int m_showCmd; -}; - -#endif \ No newline at end of file diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/cbformats.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/cbformats.h deleted file mode 100644 index b573d706f49..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/cbformats.h +++ /dev/null @@ -1,320 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - - -#if !defined(AFX_IMSELECTION_H__BE28E652_2B85_11d1_9B50_006008284B53__INCLUDED_) -#define AFX_IMSELECTION_H__BE28E652_2B85_11d1_9B50_006008284B53__INCLUDED_ -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - -#ifndef DROPEFFECT_ALL -#define DROPEFFECT_ALL DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK -#endif - -////////////////////////////////////////// -class CTRL_EXT_CLASS CCF_App : public CObject -{ -public: - CCF_App() : m_hWnd(NULL) {}; - void SetHwnd(HWND hWnd); - HANDLE GetHwnd(); - virtual void Serialize(CArchive &ar); -private: - HWND m_hWnd; - DECLARE_SERIAL(CCF_App) -}; - -inline void CCF_App::SetHwnd(HWND hWnd) -{ - m_hWnd = hWnd; -} - -inline HANDLE CCF_App::GetHwnd() -{ - return m_hWnd; -} - -////////////////////////////////////////// -class CTRL_EXT_CLASS CCF_FolderType : public CObject -{ -public: - CCF_FolderType(LPCTSTR pszParentCategory,long nCategory,LPCTSTR pszCategory); - CCF_FolderType() { m_nCategory=0; }; - ~CCF_FolderType(); -public: - CCF_FolderType(const CCF_FolderType &WebSite); - const CCF_FolderType &operator=(const CCF_FolderType &rThat); - // virtual - virtual void Serialize(CArchive &ar); - // inline - CString GetParentCategory(); - long GetCategory(); - CString GetCategoryName(); -protected: - long m_nCategory; - CString m_strParentCategory; - CString m_strCategory; - - DECLARE_SERIAL(CCF_FolderType) -}; - -inline CString CCF_FolderType::GetParentCategory() -{ - return m_strParentCategory; -} - -inline long CCF_FolderType::GetCategory() -{ - return m_nCategory; -} - -inline CString CCF_FolderType::GetCategoryName() -{ - return m_strCategory; -} - -////////////////////////////////////////// -class CTRL_EXT_CLASS CCF_ShellIDList : public CObject -{ -public: - CCF_ShellIDList(); - virtual ~CCF_ShellIDList(); -public: - // virtual - virtual void Serialize(CArchive &ar); - virtual void AddPidl(LPCITEMIDLIST pidl); - virtual LPCITEMIDLIST GetPidl(UINT nIndex) const; - virtual UINT GetCount() const; - LPCITEMIDLIST operator[](UINT nIndex) const; -protected: - DECLARE_SERIAL(CCF_ShellIDList) -private: - typedef CArray arItemIDList; - arItemIDList m_pidls; -}; - - -////////////////////////////////////////// -class CTRL_EXT_CLASS CCF_WebSite : public CObject -{ -public: - CCF_WebSite() {}; - CCF_WebSite(LPCTSTR pszURL,LPCTSTR pszTitle); - ~CCF_WebSite(); -public: - CCF_WebSite(const CCF_WebSite &WebSite); - const CCF_WebSite &operator=(const CCF_WebSite &rThat); - // virtual - virtual void Serialize(CArchive &ar); - // inline - virtual LPCTSTR GetURL(); - virtual LPCTSTR GetTitle(); -protected: - CString m_strURL; - CString m_strTitle; -// - DECLARE_SERIAL(CCF_WebSite) -}; - -inline LPCTSTR CCF_WebSite::GetURL() -{ - return m_strURL; -} - -inline LPCTSTR CCF_WebSite::GetTitle() -{ - return m_strTitle; -} - -class CTRL_EXT_CLASS CCF_DBFolderList : public CList -{ -public: - CCF_DBFolderList(HWND hWnd=NULL) { m_App.SetHwnd(hWnd); }; - ~CCF_DBFolderList() {}; - void SetDatabase(const CString &strDatabase); - CString GetDatabase() const; - virtual void Serialize(CArchive &ar); -public: - CCF_App m_App; -protected: - CString m_strDatabase; - DECLARE_SERIAL(CCF_DBFolderList) -}; - -inline void CCF_DBFolderList::SetDatabase(const CString &strDatabase) -{ - m_strDatabase = strDatabase; -} - -inline CString CCF_DBFolderList::GetDatabase() const -{ - return m_strDatabase; -} - -// template CCF_DBFolderList -///////////////////////////////////// -template<> void CTRL_EXT_CLASS AFXAPI SerializeElements (CArchive& ar, CCF_FolderType *pWebSiteCategory, int nCount ); -template<> void CTRL_EXT_CLASS AFXAPI DestructElements(CCF_FolderType *pElements, int nCount); -template<> void CTRL_EXT_CLASS AFXAPI ConstructElements(CCF_FolderType *pElements, int nCount); - -// template CList -///////////////////////////////////// -typedef CList CListWebSites; -template<> void CTRL_EXT_CLASS AFXAPI SerializeElements (CArchive& ar, CCF_WebSite *pWebSite, int nCount ); -template<> void CTRL_EXT_CLASS AFXAPI DestructElements(CCF_WebSite *pElements, int nCount); -template<> void CTRL_EXT_CLASS AFXAPI ConstructElements(CCF_WebSite *pElements, int nCount); - -///////////////////////////////////// -class CTRL_EXT_CLASS CCF_WebSites : public CObject -{ -public: - CCF_WebSites(HWND hWnd=NULL) { m_App.SetHwnd(hWnd); }; - ~CCF_WebSites() {}; - CListWebSites &GetListWebSites(); - POSITION GetHeadPosition(); - CCF_WebSite &GetNext(POSITION &pos); - virtual void Serialize(CArchive &ar); -protected: - CCF_App m_App; - CListWebSites m_listWebSites; - DECLARE_SERIAL(CCF_WebSites) -}; - -inline CCF_WebSite &CCF_WebSites::GetNext(POSITION &pos) -{ - return m_listWebSites.GetNext(pos); -} - -inline POSITION CCF_WebSites::GetHeadPosition() -{ - return m_listWebSites.GetHeadPosition(); -} - -inline CListWebSites &CCF_WebSites::GetListWebSites() -{ - return m_listWebSites; -} - -////////////////////////////////////////// -class CTRL_EXT_CLASS CCF_String : public CObject -{ -public: - CCF_String() {}; - CCF_String(LPCTSTR pszText); - ~CCF_String(); -public: - // virtual - virtual void Serialize(CArchive &ar); - virtual LPCTSTR GetString(); - void SetString(LPCTSTR pszText); - DECLARE_SERIAL(CCF_String) -private: - CString m_sText; -}; - -class CTRL_EXT_CLASS CCF_RightMenu : public CObject -{ -public: - CCF_RightMenu() { m_bRightDrag = false; }; - ~CCF_RightMenu() {}; -public: - void SetRightDrag(bool bRightDrag); - // virtual - virtual void Serialize(CArchive &ar); - virtual bool IsRightDrag(); - - DECLARE_SERIAL(CCF_RightMenu) -private: - bool m_bRightDrag; -}; - -class CTRL_EXT_CLASS CCF_FileGroupDescriptor : public CObject -{ -public: - CCF_FileGroupDescriptor(); - ~CCF_FileGroupDescriptor(); -public: - CString GetFileName(UINT nItem); - CString GetTitle(UINT nItem); - void SetTitle(const CString &sTitle); - LPFILEDESCRIPTOR GetFileDescriptor(UINT nItem); - // virtual - virtual void Serialize(CArchive &ar); - - DECLARE_SERIAL(CCF_FileGroupDescriptor) -private: - CString m_sTitle; - UINT m_nItems; - LPFILEDESCRIPTOR m_pFileDescrs; -}; - -////////////////////////////////// -class CTRL_EXT_CLASS CCF_HDROP : public CObject -{ -public: - CCF_HDROP(); - ~CCF_HDROP(); -public: - UINT GetCount() { return m_sFileNames.GetSize(); } - CString GetFileName(UINT nItem); - void AddFileName(LPCTSTR pszFileName); - void AddDropPoint(CPoint &pt,BOOL bfNC=FALSE); - // virtual - virtual void Serialize(CArchive &ar); - - DECLARE_SERIAL(CCF_HDROP) -private: - CStringArray m_sFileNames; - int m_nFiles; - CPoint m_pt; - BOOL m_fNC; -}; - -class CTRL_EXT_CLASS CWDClipboardData : public CObject -{ -public: - enum eCBFormats - { - e_cfString, - e_cfHDROP, - e_cfWebSiteURL, - e_cfWebSite, - e_cfHTMLFormat, - e_cfFolder, - e_cfRightMenu, - e_cfFileGroupDesc, - e_cfShellIDList, - e_cfMax - }; - CWDClipboardData(); - ~CWDClipboardData(); -public: - void SetData(COleDataSource *pDataSource,CObject *pObj,eCBFormats format,LPFORMATETC lpFormatEtc=NULL); - bool GetData(COleDataObject *pDataObject,CObject *pObj,eCBFormats format); - CLIPFORMAT GetClipboardFormat(eCBFormats format); - bool IsDataAvailable(COleDataObject *pDataObject); - static CWDClipboardData *Instance(); -protected: - bool IsValidFormat(CLIPFORMAT cfFormat); -private: - CLIPFORMAT m_aFormatIDs[e_cfMax]; -}; - -#endif // BE28E652-2B85-11d1-9B50-006008284B53 - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragdropctrl.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragdropctrl.h deleted file mode 100644 index 0acf676b070..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragdropctrl.h +++ /dev/null @@ -1,189 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_DRAGDROPCTRL_H__BC21D3A2_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_) -#define AFX_DRAGDROPCTRL_H__BC21D3A2_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// DragDropCtrl.h : header file -// -class CDD_OleDropTargetInfo : public CObject -{ - DECLARE_DYNAMIC(CDD_OleDropTargetInfo) -public: - CDD_OleDropTargetInfo(HWND hWnd,CPoint &point,COleDataObject *pDataObject); - CDD_OleDropTargetInfo(HWND hWnd); -// Operations - void SetItem(HTREEITEM hItem); - void SetItem(int nItem); - void SetDropEffect(DROPEFFECT dropEffect); - void SetKeyboardState(DWORD dwKeyboardState); -// Attributes - HWND GetSafeHwnd() const; - CPoint GetPoint() const; - DWORD GetKeyboardState() const; - const COleDataObject *GetDataObject() const; - COleDataObject *GetDataObject(); - HTREEITEM GetTreeItem() const; - int GetListItem() const; - DROPEFFECT GetDropEffect() const; -protected: - void InitInfo(HWND hWnd, - const CPoint *pPoint=NULL, - COleDataObject *pDataObject=NULL, - DROPEFFECT dropeEffect=DROPEFFECT_NONE, - DWORD dwKeyState=0, - HTREEITEM hItem=NULL, - int iItem=-1); -private: - HWND m_hWnd; // window mouse currently over - CPoint m_point; // mouse position in client coordinates - DROPEFFECT m_dropEffect; // The type of drop anticipated - COleDataObject *m_pDataObject; // The OLE data that was cached at startup - DWORD m_dwKeyState; // keyboard state when message was received - HTREEITEM m_hDropItem; // tree item the mouse is over or currently selected (NULL if source not a tree control) - int m_nDropItem; // list control item the mouse is over (-1 if source not a list control) -}; - -inline CDD_OleDropTargetInfo::CDD_OleDropTargetInfo(HWND hWnd,CPoint &point,COleDataObject *pDataObject) -{ - InitInfo(hWnd,&point,pDataObject); -} - -inline CDD_OleDropTargetInfo::CDD_OleDropTargetInfo(HWND hWnd) -{ - InitInfo(hWnd); -} - -inline void CDD_OleDropTargetInfo::InitInfo(HWND hWnd, - const CPoint *pPoint, - COleDataObject *pDataObject, - DROPEFFECT dropEffect, - DWORD dwKeyState, - HTREEITEM hItem, - int iItem) -{ - m_hWnd = hWnd; - if (pPoint) - m_point = *pPoint; - else - m_point = CPoint(); - m_pDataObject = pDataObject; - m_dropEffect = dropEffect; - m_dwKeyState = dwKeyState; - m_hDropItem = hItem; - m_nDropItem = iItem; -} - -inline void CDD_OleDropTargetInfo::SetItem(int nItem) -{ - m_nDropItem = nItem; -} - -inline void CDD_OleDropTargetInfo::SetItem(HTREEITEM hItem) -{ - m_hDropItem = hItem; -} - -inline void CDD_OleDropTargetInfo::SetDropEffect(DROPEFFECT dropEffect) -{ - m_dropEffect = dropEffect; -} - -inline void CDD_OleDropTargetInfo::SetKeyboardState(DWORD dwKeyboardState) -{ - m_dwKeyState = dwKeyboardState; -} - -inline DROPEFFECT CDD_OleDropTargetInfo::GetDropEffect() const -{ - return m_dropEffect; -} - -inline HWND CDD_OleDropTargetInfo::GetSafeHwnd() const -{ - return m_hWnd; -} - -inline CPoint CDD_OleDropTargetInfo::GetPoint() const -{ - return m_point; -} - -inline DWORD CDD_OleDropTargetInfo::GetKeyboardState() const -{ - return m_dwKeyState; -} - -inline const COleDataObject *CDD_OleDropTargetInfo::GetDataObject() const -{ - return m_pDataObject; -} - -inline COleDataObject *CDD_OleDropTargetInfo::GetDataObject() -{ - return m_pDataObject; -} - -inline HTREEITEM CDD_OleDropTargetInfo::GetTreeItem() const -{ - return m_hDropItem; -} - -inline int CDD_OleDropTargetInfo::GetListItem() const -{ - return m_nDropItem; -} - -///////////////////////////////////////////////////////////////////////////// -// CDragDropCtrl window - -class CTRL_EXT_CLASS CDragDropCtrl : public COleDropTarget -{ -// Construction -public: - CDragDropCtrl(); - -// Attributes -public: - -// Operations -public: - -// Overrides - virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ); - virtual void OnDragLeave( CWnd* pWnd); - -// Implementation -public: - virtual ~CDragDropCtrl(); - -private: - DWORD m_dwKeyboardState; - DWORD m_dwEnterKeyboardState; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_DRAGDROPCTRL_H__BC21D3A2_332C_11D1_ADE9_0000E81B9EF1__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragimage.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragimage.h deleted file mode 100644 index ebc7b254005..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidragimage.h +++ /dev/null @@ -1,90 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_WIDGBASE_H__877329CA_C22E_11D0_B2D8_444553540000__INCLUDED_) -#define AFX_WIDGBASE_H__877329CA_C22E_11D0_B2D8_444553540000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - -///////////////////////////////////////////////////////////////////////////// -// CDragDropImage command target -class CDragDropItem : public CObject -{ -public: - CDragDropItem(LPCRECT prcItem,LPCRECT prcIcon); - CRect m_rcItem; - CRect m_rcIcon; -}; - -inline CDragDropItem::CDragDropItem(LPCRECT prcItem,LPCRECT prcIcon) : m_rcItem(prcItem),m_rcIcon(prcIcon) -{ -} - -struct DD_ImageData -{ - CRect m_rcItem; - CRect m_rcIcon; - CPoint m_ptDrag; -}; - -class CDragDropImage : public CCmdTarget -{ - DECLARE_DYNCREATE(CDragDropImage) -protected: - CDragDropImage();// protected constructor used by dynamic creation -public: - CDragDropImage(int nSelected,int nType); - virtual ~CDragDropImage(); -// Attributes -public: - -// Operations -public: - void AddItem(LPCRECT prcItem,LPCRECT prcIcon); - - virtual void DrawDragImage (CDC *pDC,POINT point,POINT ActionPoint); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDragDropImage) - //}}AFX_VIRTUAL - -// Implementation -protected: - void DrawItemImage(CDC *pDC, POINT point,const CRect &rcItem,const CRect &rcIcon); - - int m_nSelected; - int m_nType; - CTypedPtrList m_itemList; - - // Generated message map functions - //{{AFX_MSG(CDragDropImage) - // NOTE - the ClassWizard will add and remove member functions here. - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_WIDGBASE_H__877329CA_C22E_11D0_B2D8_444553540000__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidroptarget.h b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidroptarget.h deleted file mode 100644 index be73479c292..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Include/uidroptarget.h +++ /dev/null @@ -1,53 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#if !defined(AFX_DRAGDROPLIST_H__A4325D31_FF52_11D0_ADBF_0000E81B9EF1__INCLUDED_) -#define AFX_DRAGDROPLIST_H__A4325D31_FF52_11D0_ADBF_0000E81B9EF1__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// DragDropList.h : header file -// - -#include "UIImageDropTarget.h" - -class CListDropTarget : public CUI_ImageDropTarget -{ -public: - CListDropTarget(); - - virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ); - virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ); - virtual void OnDragLeave( CWnd* pWnd); -protected: - DWORD m_dwKeyboardState; -}; - -inline CListDropTarget::CListDropTarget() -{ - m_dwKeyboardState = 0; -} - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_DRAGDROPLIST_H__A4325D31_FF52_11D0_ADBF_0000E81B9EF1__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/LocaleInfo.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/LocaleInfo.cpp deleted file mode 100644 index edbd9c927ae..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/LocaleInfo.cpp +++ /dev/null @@ -1,178 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// LocaleInfo.cpp: implementation of the CLocaleInfo class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "LocaleInfo.h" -#include "TextParse.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -// static -CLocaleInfo *CLocaleInfo::Instance() -{ - static CLocaleInfo data; - return &data; -} - -CLocaleInfo::CLocaleInfo() -{ - m_pszNegativeSign = NULL; - m_pszDecimalSep = NULL; - m_pszThousandSep = NULL; - m_pszLongDate = NULL; - m_pszShortDate = NULL; - m_pszShortTime = NULL; - m_pszLongTime = NULL; - m_pszDateSep = NULL; - m_pszTimeSep = NULL; - GetAllLocaleInfo(); -} - -CLocaleInfo::~CLocaleInfo() -{ - delete []m_pszNegativeSign; - delete []m_pszDecimalSep; - delete []m_pszThousandSep; - delete []m_pszLongDate; - delete []m_pszShortDate; - delete []m_pszShortTime; - delete []m_pszLongTime; - delete []m_pszDateSep; - delete []m_pszTimeSep; -} - -void CLocaleInfo::GetAllLocaleInfo() -{ - m_pszShortTime = new TCHAR[MAX_PATH]; - lstrcpy(m_pszShortTime,_T("H:mm")); - AllocLocaleInfo(LOCALE_STIMEFORMAT,&m_pszLongTime); - AllocLocaleInfo(LOCALE_SSHORTDATE,&m_pszShortDate); - AllocLocaleInfo(LOCALE_SLONGDATE,&m_pszLongDate); - AllocLocaleInfo(LOCALE_SDATE,&m_pszDateSep); - AllocLocaleInfo(LOCALE_STIME,&m_pszTimeSep); - AllocLocaleInfo(LOCALE_SNEGATIVESIGN,&m_pszNegativeSign); - AllocLocaleInfo(LOCALE_SDECIMAL,&m_pszDecimalSep); - AllocLocaleInfo(LOCALE_STHOUSAND,&m_pszThousandSep); -} - -void CLocaleInfo::AllocLocaleInfo(LCTYPE lctype,LPTSTR *pszInfo) -{ - int nLen = GetLocaleInfo(LOCALE_USER_DEFAULT,lctype,NULL,0); - if (nLen) - { - *pszInfo = new TCHAR[nLen]; - GetLocaleInfo(LOCALE_USER_DEFAULT,lctype,*pszInfo,nLen); - } -} - -CString CLocaleInfo::FormatDateTime(const COleDateTime &oleDateTime) -{ - CString sDate, sTime; - sDate = oleDateTime.Format(ConvertStdToWinFormat(GetShortDate())); - sTime = oleDateTime.Format(ConvertStdToWinFormat(GetLongTime())); - return sDate + _T(" ") + sTime; -} - -CString CLocaleInfo::FormatDateTime(const FILETIME &ft) -{ - COleDateTime oleDateTime(ft); - return FormatDateTime(oleDateTime); -} - -static struct FormatCodes -{ - LPCTSTR szWinFormat; - LPCTSTR szStdFormat; -} FC[] = { - { _T("M"), _T("%#m") }, - { _T("MM"),_T("%m") }, - { _T("MMM"),_T("%b") }, - { _T("MMMM"),_T("%B") }, - { _T("d"),_T("%#d") }, - { _T("dd"),_T("%d") }, - { _T("dddd"),_T("%A") }, - { _T("yy"),_T("%y") }, - { _T("yyyy"),_T("%Y") }, - { _T("H"),_T("%#H") }, - { _T("HH"),_T("%H") }, - { _T("h"),_T("%#I") }, - { _T("hh"),_T("%I") }, - { _T("mm"),_T("%M") }, - { _T("ss"),_T("%S") }, - { _T("tt"),_T("%p") }, -{ NULL, NULL } -}; - -// Short Format -// M/d/yyyy -// M/d/yy -// MM/dd/yy -// MM/dd/yyyy -// yy/MM/dd -// yyyy-MM-dd -// dd-MMM-yy - -// Long Format -// dddd, MMMM dd, yyyy -// MMMM dd, yyyy -// dddd, dd MMMM, yyyy -// dd MMMM, yyyy - -// Time -// H:mm:ss -// h:mm:ss tt -// hh:mm:ss tt -// HH:mm:ss - -CString CLocaleInfo::ConvertStdToWinFormat(LPCTSTR pszFormat) -{ - CString sCode; - CString sWinFormat; - CTextParse parse(pszFormat); - CString sSeparators(_T(" -/,.:")); - while (!parse.IsEnd()) - { - if (parse.CharAtCurrent(sSeparators)) - { - sCode = parse.CopyWhileChar(sSeparators); - } - else - { - sCode = parse.CopyUntilChar(sSeparators); - } - StdToWinFormatCode(sCode); - sWinFormat += sCode; - } - return sWinFormat; -} - -void CLocaleInfo::StdToWinFormatCode(CString &sCode) -{ - for(int i=0;FC[i].szWinFormat != NULL;i++) - { - if (sCode == FC[i].szWinFormat) - { - sCode = FC[i].szStdFormat; - break; - } - } -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/PIDL.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/PIDL.cpp deleted file mode 100644 index bc5db713962..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/PIDL.cpp +++ /dev/null @@ -1,250 +0,0 @@ -//////////////////////////////////////////////////////////////////// -// PIDL.cpp: implementation of the CPIDL class. -// -// By Oz Solomonovich (osolo@bigfoot.com) - -#include "stdafx.h" -#include -#include "PIDL.h" - -LPSHELLFOLDER CPIDL::m_sfDesktop = NULL; // cached destkop folder -LPMALLOC CPIDL::m_pAllocator = NULL; // cached system allocator - -CPIDL::pidl_initializer CPIDL::m_initializer; // automatic init. obj - - -//////////////////////////////////////////////////////////////////// -// Initialization object -//////////////////////////////////////////////////////////////////// - -// pidl_initializer is used to initialize the static data. The -// constructor and destructor are automatically called for us when -// the program starts/ends. - -CPIDL::pidl_initializer::pidl_initializer() -{ - SHGetDesktopFolder(&m_sfDesktop); // cache d'top folder obj ptr - SHGetMalloc(&m_pAllocator); // cache sys allocator obj ptr -} - -CPIDL::pidl_initializer::~pidl_initializer() -{ - m_sfDesktop->Release(); - m_pAllocator->Release(); -} - - -//////////////////////////////////////////////////////////////////// -// CPIDL Implementation -//////////////////////////////////////////////////////////////////// -CPIDL::CPIDL(LPCTSTR szPath, LPSHELLFOLDER psf) : - m_pidl(NULL) -{ - Set(szPath, psf); -} - - -CPIDL::~CPIDL() -{ - Free(); // just free used memory -} - - -//////////////////////////////////////////////////////////////////// -// Assignment Functions - -HRESULT CPIDL::Set(const CPIDL& cpidl) -{ - return MakeCopyOf(cpidl.m_pidl); -} - -HRESULT CPIDL::Set(LPITEMIDLIST pidl) -{ - Free(); - m_pidl = pidl; - return ERROR_SUCCESS; -} - -HRESULT CPIDL::Set(LPCTSTR szPath, LPSHELLFOLDER psf) -{ - OLECHAR olePath[MAX_PATH]; - ULONG chEaten; - ULONG dwAttributes; - - Free(); -#ifndef _UNICODE - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, - olePath, MAX_PATH); -#else - lstrcpy(olePath,szPath); -#endif - return psf->ParseDisplayName(NULL, NULL, olePath, &chEaten, - &m_pidl, &dwAttributes); -} - -HRESULT CPIDL::MakeCopyOf(LPITEMIDLIST pidl) -{ - Free(); - if (pidl) { - UINT sz = m_pAllocator->GetSize((LPVOID)pidl); - AllocMem(sz); - CopyMemory((LPVOID)m_pidl, (LPVOID)pidl, sz); - } - return ERROR_SUCCESS; -} - -HRESULT CPIDL::MakeAbsPIDLOf(LPSHELLFOLDER psf, LPITEMIDLIST pidl) -{ -USES_CONVERSION; - STRRET str; - HRESULT hr = psf->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str); - if (SUCCEEDED(hr)) { - ExtractCStr(str); - hr = Set(A2T(str.cStr)); - } - return hr; -} - - -//////////////////////////////////////////////////////////////////// -// CPIDL Operations - -void CPIDL::Free() -{ - if (m_pidl) { - m_pAllocator->Free(m_pidl); - m_pidl = NULL; - } -} - -#define CB_SIZE (sizeof(piid->cb)) // size of termination item - -UINT CPIDL::GetSize() const -{ - UINT cbTotal = 0; - LPSHITEMID piid = GetFirstItemID(); - - if (piid) { - do { - cbTotal += piid->cb; - GetNextItemID(piid); - } while (piid->cb); - cbTotal += CB_SIZE; // count the terminator - } - - return cbTotal; -} - -void CPIDL::Split(CPIDL& parent, CPIDL& obj) const -{ - int size = 0; - SHITEMID *piid, *piidLast; - - // find last item-id and calculate total size of pidl - piid = piidLast = &m_pidl->mkid; - while (piid->cb) - { - piidLast = piid; - size += (piid->cb); - piid = (SHITEMID *)((LPBYTE)piid + (piid->cb)); - } - - // copy parent folder portion - size -= piidLast->cb; // don't count "object" item-id - if (size > 0) - { - parent.AllocMem(size + CB_SIZE); - CopyMemory(parent.m_pidl, m_pidl, size); - ZeroMemory((LPBYTE)parent.m_pidl + size, CB_SIZE); // terminator - } - // copy "object" portion - size = piidLast->cb + CB_SIZE; - if (size > 0) - { - obj.AllocMem(size); - CopyMemory(obj.m_pidl, piidLast, size); - } -} - -CPIDL CPIDL::operator + (CPIDL& pidl) const -{ - CPIDL ret; - Concat(*this, pidl, ret); - return ret; -} - -void CPIDL::Concat(const CPIDL &a, const CPIDL& b, CPIDL& result) -{ - result.Free(); - - // both empty->empty | a empty->return b | b empty->return a - if (a.m_pidl == NULL && b.m_pidl == NULL) return; - if (a.m_pidl == NULL) { result.Set(b); return; } - if (a.m_pidl == NULL) { result.Set(a); return; } - - UINT cb1 = a.GetSize() - sizeof(a.m_pidl->mkid.cb); - UINT cb2 = b.GetSize(); - result.AllocMem(cb1 + cb2); // allocate enough memory - CopyMemory(result.m_pidl, a.m_pidl, cb1); // 1st - CopyMemory(((LPBYTE)result.m_pidl) + cb1, b.m_pidl, cb2); // 2nd -} - -HRESULT CPIDL::GetUIObjectOf(REFIID riid, LPVOID *ppvOut, - HWND hWnd /*= NULL*/, LPSHELLFOLDER psf /*= m_sfDesktop*/) -{ - CPIDL parent, obj; - LPSHELLFOLDER psfParent; - HRESULT hr=S_OK; - - Split(parent, obj); - // if no idl the use desktop folder - if (parent.m_pidl == NULL || parent.m_pidl->mkid.cb == 0) - { - psfParent = psf; - psfParent->AddRef(); - } - else - { - // otherwise get the parent - hr = psf->BindToObject(parent, NULL, IID_IShellFolder, - (LPVOID *)&psfParent); // get the IShellFolder of the parent - } - if (SUCCEEDED(hr)) - { - hr = psfParent->GetUIObjectOf(hWnd, 1, obj, riid, 0, ppvOut); - psfParent->Release(); - } - return hr; -} - -void CPIDL::ExtractCStr(STRRET& strRet) const -{ - switch (strRet.uType) - { - case STRRET_WSTR: - { - // pOleStr points to a WCHAR string - convert it to ANSI - LPWSTR pOleStr = strRet.pOleStr; - WideCharToMultiByte(CP_ACP, 0, pOleStr, -1, - strRet.cStr, MAX_PATH, NULL, NULL); - m_pAllocator->Free(pOleStr); - break; - } - - case STRRET_OFFSET: - // The string lives inside the pidl, so copy it out. - strncpy(strRet.cStr, (LPSTR) - ((LPBYTE)m_pidl + strRet.uOffset), MAX_PATH); - break; - } -} - - -//////////////////////////////////////////////////////////////////// -// CPIDL Private Operations - -void CPIDL::AllocMem(int iAllocSize) -{ - Free(); - m_pidl = (LPITEMIDLIST)m_pAllocator->Alloc(iAllocSize); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellContextMenu.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellContextMenu.cpp deleted file mode 100644 index 9c890e30be0..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellContextMenu.cpp +++ /dev/null @@ -1,600 +0,0 @@ -/***************************************************************************/ -/* NOTE: */ -/* This document is copyright (c) by Oz Solomonovich. All non-commercial */ -/* use is allowed, as long as this document is not altered in any way, and */ -/* due credit is given. */ -/***************************************************************************/ - -// ShellContextMenu.cpp : implementation file -// -// Handles the creation of the shell context menu, including the "Send To..." -// sub-menu. -// Personal note: I think that MS should have made the code to populate and -// handle the "Send To..." sub-menu a part of the shell context menu code. -// But they didn't, so now we're forced to write a whole lot of spaghetti COM -// code to do what should have been a trivial part of the OS. See the code -// below and judge for yourself. -// -// ========================================================================== -// HISTORY: -// ========================================================================== -// 1.01 7 Jul 2000 - Philip Oldaker [philip@masmex.com] - Fixed a problem -// with the SendTo menu now checking for menu id. -// Added support for the new OpenWith menu. -// The SendTo Menu is now sorted. - - -#include "stdafx.h" -#include "ShellContextMenu.h" -#include "UICoolMenu.h" -#include -#include "PIDL.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#define IDM_SHELLCTXFIRST 20000 -#define IDM_SHELLCTXLAST 29999 - -#define IDM_SENDTOFIRST 30000 -#define IDM_SENDTOLAST 32000 -#define IDM_OPENWITHFIRST 32001 -#define IDM_OPENWITHLAST 32767 -#define IDM_SENDTOID 20028 -#define IDM_OPENWITHID1 20127 -#define IDM_OPENWITHID2 20128 - -LPSHELLFOLDER is_less_than_pidl::psf; -LPSHELLFOLDER is_greater_than_pidl::psf; - -// OpenWith menu registry keys -static LPCTSTR szAppKey = _T("Applications"); -static LPCTSTR szOpenWithListKey = _T("OpenWithList"); -static LPCTSTR szShellKey = _T("shell"); -static LPCTSTR szCommandKey = _T("command"); -static LPCTSTR szFileExtKey = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts"); -// OpenWith menu entries -static LPCTSTR szMRUListEntry = _T("MRUList"); -static LPCTSTR szDisplayNameEntry = _T("FriendlyCache"); - -static class CShCMInitializer -{ -public: - CShCMInitializer(); - ~CShCMInitializer(); - - static LPSHELLFOLDER m_sfDesktop; - static LPSHELLFOLDER m_sfSendTo; - static CImageList * m_pShellImageList; - static CPIDL m_pidlSendTo; -} stat_data; - -LPSHELLFOLDER CShCMInitializer::m_sfDesktop = NULL; -LPSHELLFOLDER CShCMInitializer::m_sfSendTo = NULL; -CImageList * CShCMInitializer::m_pShellImageList = NULL; -CPIDL CShCMInitializer::m_pidlSendTo; - -CShCMInitializer::CShCMInitializer() -{ - HRESULT hr; - SHFILEINFO sfi; - - SHGetDesktopFolder(&m_sfDesktop); - - hr = SHGetSpecialFolderLocation(NULL, CSIDL_SENDTO, m_pidlSendTo); - if (SUCCEEDED(hr)) - { - hr = m_sfDesktop->BindToObject(m_pidlSendTo, NULL, IID_IShellFolder, - (LPVOID *)&m_sfSendTo); - if (!SUCCEEDED(hr)) - { - m_sfSendTo = NULL; - } - } - else - { - m_sfSendTo = NULL; - } - - m_pShellImageList = CImageList::FromHandle((HIMAGELIST) - SHGetFileInfo((LPCTSTR)_T("C:\\"), 0, &sfi, sizeof(SHFILEINFO), - SHGFI_SYSICONINDEX | SHGFI_SMALLICON)); -} - -CShCMInitializer::~CShCMInitializer() -{ - m_sfSendTo->Release(); - m_sfDesktop->Release(); -} - - - -CShellContextMenu::CShellContextMenu(HWND hWnd,const CString &sAbsPath, LPITEMIDLIST *ppidl, UINT cidl, LPSHELLFOLDER psfParent) -: m_hWnd(hWnd), - m_sAbsPath(sAbsPath), - m_psfParent(psfParent), - m_ppidl(ppidl), - m_cidl(cidl), - m_pSendToMenu(NULL) -{ - m_lpcm = NULL; - m_pidl = *ppidl; - // Initialize button sizes - m_szOldButtonSize = g_CoolMenuManager.SetButtonSize(); -} - -CShellContextMenu::~CShellContextMenu() -{ - if (m_lpcm) m_lpcm->Release(); - - if (m_pSendToMenu) - { - int i = IDM_SENDTOFIRST; - void * pData; - - pData = CCoolMenuManager::GetItemData(*m_pSendToMenu, i); - while (pData) - { - CPIDL toFree((LPITEMIDLIST)pData); - pData = CCoolMenuManager::GetItemData(*m_pSendToMenu, ++i); - } - g_CoolMenuManager.UnconvertMenu(m_pSendToMenu); - m_pSendToMenu = NULL; - } - // Clean up owner draw menus - STL_FOR_ITERATOR(vecODMenu,m_OwnerDrawMenus) - { - g_CoolMenuManager.UnconvertMenu(STL_GET_CURRENT(m_OwnerDrawMenus)); - } - STL_ERASE_ALL(m_OwnerDrawMenus); - g_CoolMenuManager.SetButtonSize(m_szOldButtonSize); - ////////////////////////////// -} - -///////////////////////////// -// Addition: Philip Oldaker -///////////////////////////// -CString CShellContextMenu::GetExt(const CString &sPath) const -{ - TCHAR szDir[_MAX_PATH]; - TCHAR szDrive[_MAX_DRIVE]; - TCHAR szFileName[_MAX_FNAME]; - TCHAR szExt[_MAX_EXT]; - szDir[0] = szDrive[0] = szFileName[0] = szExt[0] = 0; - _tsplitpath(sPath,szDrive,szDir,szFileName,szExt); - return szExt; -} - -// A bunch of registry nonsense to return all relevant details -// but especially the application icon -void CShellContextMenu::GetAppDetails(const CString &sAppName,CString &sDisplayName,CString &sCommand,HICON &hIconApp) const -{ - hIconApp = NULL; - sDisplayName.Empty(); - sCommand.Empty(); - - CString sAppKey(szAppKey); - AddKey(sAppKey,sAppName); - AddKey(sAppKey,szShellKey); - HKEY hKey; - if (RegOpenKeyEx(HKEY_CLASSES_ROOT,sAppKey,0,KEY_READ,&hKey) != ERROR_SUCCESS) - return; - BYTE szDisplayName[_MAX_PATH]; - DWORD dwSize=sizeof(szDisplayName); - DWORD dwType=REG_SZ; - LONG nRet = RegQueryValueEx(hKey,szDisplayNameEntry,NULL,&dwType,szDisplayName,&dwSize); - if (nRet != ERROR_SUCCESS) - { - RegCloseKey(hKey); - return; - } - sDisplayName = szDisplayName; - TCHAR szSubKey[_MAX_PATH]; - TCHAR szClass[_MAX_PATH]; - DWORD dwSizeSubKey = sizeof(szSubKey)-1; - DWORD dwSizeClass = sizeof(szClass)-1; - ZeroMemory(szSubKey,sizeof(szSubKey)); - ZeroMemory(szClass,sizeof(szClass)); - FILETIME ftLastWriteTime; - HKEY hCmdKey=NULL; - CString sCmdKey; - // Search for a key that contains the "command" key as it may not be under "open" - for(DWORD dwIndex=0;RegEnumKeyEx(hKey,dwIndex, - szSubKey, - &dwSizeSubKey, - NULL, - szClass, - &dwSizeClass, - &ftLastWriteTime) == ERROR_SUCCESS;dwIndex++) - { - sCmdKey = szSubKey; - AddKey(sCmdKey,szCommandKey); - if (RegOpenKeyEx(hKey,sCmdKey,0,KEY_READ,&hCmdKey) == ERROR_SUCCESS) - { - break; - } - dwSizeSubKey = sizeof(szSubKey)-1; - dwSizeClass = sizeof(szClass)-1; - } - RegCloseKey(hKey); - hKey = NULL; - if (hCmdKey == NULL) - return; - dwType=REG_SZ | REG_EXPAND_SZ; - BYTE szCommand[_MAX_PATH]; - dwSize=sizeof(szCommand); - nRet = RegQueryValueEx(hCmdKey,NULL,NULL,&dwType,szCommand,&dwSize); - if (nRet != ERROR_SUCCESS) - return; - TCHAR szPath[MAX_PATH]; - sCommand = szCommand; - if (ExpandEnvironmentStrings(sCommand,szPath,sizeof(szPath))) - sCommand = szPath; - CString sIconPath(sCommand); - sIconPath.MakeLower(); - // Only extract icons from exe's at the moment - int nPos = sIconPath.Find(_T(".exe")); - if (nPos == -1) - return; - sIconPath = sIconPath.Left(nPos+4); - // Remove auy quotes - if (sIconPath.Left(1) == '\"') - sIconPath = sIconPath.Right(sIconPath.GetLength()-1); - if (sIconPath.Right(1) == '\"') - sIconPath = sIconPath.Left(sIconPath.GetLength()-1); - ExtractIconEx(sIconPath, 0, NULL, &hIconApp, 1); - - RegCloseKey(hCmdKey); -} - -// reg helper -void CShellContextMenu::AddKey(CString &sDestKey,const CString &sSrcKey) const -{ - if (sDestKey.Right(1) != '\\') - sDestKey += '\\'; - sDestKey += sSrcKey; -} -//////////////////////////////////////// - -bool CShellContextMenu::IsMenuCommand(int iCmd) const -{ - return ( - (IDM_SENDTOFIRST <= iCmd && iCmd <= IDM_SENDTOLAST) || - (IDM_SHELLCTXFIRST <= iCmd && iCmd <= IDM_SHELLCTXLAST) - ); -} - -void CShellContextMenu::InvokeCommand(int iCmd) const -{ - if (!iCmd) - return; -USES_CONVERSION; - ///////////////////////////// - if (IDM_SENDTOFIRST <= iCmd && iCmd <= IDM_SENDTOLAST) - { - // "Send To..." item - - CPIDL pidlFile(m_sAbsPath), pidlDrop; - LPDROPTARGET pDT; - LPDATAOBJECT pDO; - HRESULT hr; - - hr = pidlFile.GetUIObjectOf(IID_IDataObject, (LPVOID *)&pDO, - m_hWnd); - if (SUCCEEDED(hr)) - { - pidlDrop.Set((LPITEMIDLIST) - CCoolMenuManager::GetItemData(*m_pSendToMenu, iCmd)); - hr = pidlDrop.GetUIObjectOf(IID_IDropTarget, - (LPVOID *)&pDT, m_hWnd); - - if (SUCCEEDED(hr)) - { - // do the drop - POINTL pt = { 0, 0 }; - DWORD dwEffect = - DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK; - hr = pDT->DragEnter(pDO, MK_LBUTTON, pt, &dwEffect); - - if (SUCCEEDED(hr) && dwEffect) - { - hr = pDT->Drop(pDO, MK_LBUTTON, pt, &dwEffect); - } - else - { - hr = pDT->DragLeave(); - } - - pDT->Release(); - } - - pidlDrop.m_pidl = NULL; - } - } - else - { - DWORD dwItemData=0; - CMenu *pMenu=NULL; - STL_FOR_ITERATOR(vecODMenu,m_OwnerDrawMenus) - { - pMenu = STL_GET_CURRENT(m_OwnerDrawMenus); - if (pMenu && pMenu->GetMenuItemCount() > 0) - { - // switch to original item data - if ((UINT)iCmd >= pMenu->GetMenuItemID(0) && (UINT)iCmd <= pMenu->GetMenuItemID(pMenu->GetMenuItemCount()-1)) - { - dwItemData = g_CoolMenuManager.SwitchContextItemData(pMenu,iCmd,0,FALSE); - break; - } - } - } - CWaitCursor w; - // Shell command - CMINVOKECOMMANDINFO cmi; - cmi.cbSize = sizeof(cmi); - cmi.fMask = 0; - cmi.hwnd = m_hWnd; - cmi.lpVerb = T2CA(MAKEINTRESOURCE(iCmd - IDM_SHELLCTXFIRST)); - cmi.lpParameters = NULL; - cmi.lpDirectory = NULL; - cmi.nShow = SW_SHOWNORMAL; - cmi.dwHotKey = 0; - cmi.hIcon = NULL; - m_lpcm->InvokeCommand(&cmi); - // switch back to our item data - if (dwItemData) - { - g_CoolMenuManager.SwitchContextItemData(pMenu,iCmd,dwItemData,FALSE); - } - } -} - -// retrieves the shell context menu for a file -void CShellContextMenu::SetMenu(CMenu *pMenu) -{ - if (m_sAbsPath.IsEmpty()) - return; - ASSERT(m_psfParent); - HRESULT hr = m_psfParent->GetUIObjectOf(m_hWnd, m_cidl, (LPCITEMIDLIST*)m_ppidl, IID_IContextMenu, NULL, (LPVOID *)&m_lpcm); -// NOTE: Slight change to return here but change it back if you want: PO - if (FAILED(hr)) - return; - - g_CoolMenuManager.UnconvertMenu(pMenu); - g_CoolMenuManager.SetShellContextMenu(m_lpcm,IDM_SHELLCTXFIRST,IDM_SHELLCTXLAST); - - pMenu->DeleteMenu(0, MF_BYPOSITION); - hr = m_lpcm->QueryContextMenu(*pMenu, 0, IDM_SHELLCTXFIRST, - IDM_SHELLCTXLAST, CMF_EXPLORE); - ///////////////////////////// - // Additions Philip Oldaker - // Check for IContextMenu2 used by owner draw menus - CMenu *pSubMenu; - int count = pMenu->GetMenuItemCount(); - for (int i = 0; i < count; i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE | MIIM_ID; - pMenu->GetMenuItemInfo(i,&mii,TRUE); - if (mii.fType & MFT_OWNERDRAW) - { - TRACE(_T("OwnerDraw menu item found in CShellContextMenu\n")); - g_CoolMenuManager.AddShellContextMenu(pMenu,m_lpcm,i); - STL_ADD_ITEM(m_OwnerDrawMenus,pMenu); - } - pSubMenu = pMenu->GetSubMenu(i); - ///////////////////////////// - // Additions Philip Oldaker - // Search for owner draw menus and add the ICM2 pointer - if (pSubMenu) - { - // NOTE: Remove the TRACE statements if not needed - UINT nSubCount = pSubMenu->GetMenuItemCount(); - TRACE(_T("Count=%u\n"),nSubCount); - for(UINT m=0;m < nSubCount;m++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE; - pSubMenu->GetMenuItemInfo(m,&mii,TRUE); - if (mii.fType & MFT_OWNERDRAW) - { - TRACE(_T("OwnerDraw submenu found in CShellContextMenu\n")); - g_CoolMenuManager.AddShellContextMenu(pSubMenu,m_lpcm,m); - STL_ADD_ITEM(m_OwnerDrawMenus,pSubMenu); - } - } - } - ///////////////////////////// - // find the "Send To" and the new "Open With" submenu: look for a defined menu item id - if (pSubMenu && pSubMenu->GetMenuItemCount() == 1) - { - CString str; - pSubMenu->GetMenuString(0,str,MF_BYPOSITION); - UINT idmFirst = pSubMenu->GetMenuItemID(0); - TRACE(_T("Menu Item %s=%d\n"),str,idmFirst); - ///////////////////////////// - // Additions Philip Oldaker - // Populate the OpenWith menu - if (idmFirst == IDM_OPENWITHID1 || idmFirst == IDM_OPENWITHID2) - { - // ok - found it. now populate it - IContextMenu2 *lpcm2=NULL; - HRESULT hr = m_lpcm->QueryInterface(IID_IContextMenu2,(LPVOID*)&lpcm2); - if (SUCCEEDED(hr)) - { - hr = lpcm2->HandleMenuMsg(WM_INITMENUPOPUP,(WPARAM)pSubMenu->GetSafeHmenu(),0); - lpcm2->Release(); - // We need the extension to search the registry for valid applications - CString sExt(GetExt(m_sAbsPath)); - // No extension then there's nothing to do - if (sExt.IsEmpty()) - continue; - FillOpenWithMenu(pSubMenu,sExt); - STL_ADD_ITEM(m_OwnerDrawMenus,pSubMenu); - } - } - else if (idmFirst == IDM_SENDTOID) - { - UINT idm = IDM_SENDTOFIRST; - // ok - found it. now populate it - m_pSendToMenu = CMenu::FromHandle(::CreatePopupMenu()); - ASSERT_VALID(m_pSendToMenu); - pSubMenu->DestroyMenu(); - pMenu->ModifyMenu(i, MF_BYPOSITION | MF_POPUP, - (UINT)m_pSendToMenu->m_hMenu, str); - FillSendToMenu(m_pSendToMenu, stat_data.m_sfSendTo, idm); - } - ///////////////////////////// - } - } -// Not needed I think :PO - return; -} - -//////////////////////////// -// Additions: Philip Oldaker -// Scan the registry looking for a OpenWithList key in this format -// Entry MRUList contains the alphabetical order eg. afgrde for each entry -// each of these entries points to the application name which in turn -// has the command and display name -//////////////////////////// -void CShellContextMenu::FillOpenWithMenu(CMenu *pMenu,const CString &sExt) -{ - HKEY hKey; - CString sFileExtKey(szFileExtKey); - AddKey(sFileExtKey,sExt); - AddKey(sFileExtKey,szOpenWithListKey); - if (RegOpenKeyEx(HKEY_CURRENT_USER,sFileExtKey,0,KEY_READ,&hKey) != ERROR_SUCCESS) - return; - BYTE szMRUList[_MAX_PATH]; - szMRUList[0] = 0; - DWORD dwSize=sizeof(szMRUList); - DWORD dwType=REG_SZ; - RegQueryValueEx(hKey,szMRUListEntry,NULL,&dwType,szMRUList,&dwSize); - int nLen = _tcslen((LPCTSTR)szMRUList); - TCHAR szOpenWithItemEntry[sizeof(TCHAR)*2]; - ZeroMemory(szOpenWithItemEntry,sizeof(szOpenWithItemEntry)); - BYTE szOpenWithItem[_MAX_PATH]; - CString sDisplayName; - HICON hIconApp; - CString sCommand; - CString sMenuText; - for(int i=0;i < nLen;i++) - { - szOpenWithItemEntry[0] = szMRUList[i]; - dwSize = sizeof(szOpenWithItem); - RegQueryValueEx(hKey,szOpenWithItemEntry,NULL,&dwType,szOpenWithItem,&dwSize); - GetAppDetails(szOpenWithItem, sDisplayName, sCommand, hIconApp); - if (!sCommand.IsEmpty()) - { - for(UINT idm=0;idm < pMenu->GetMenuItemCount();idm++) - { - pMenu->GetMenuString(idm,sMenuText,MF_BYPOSITION); - if (sMenuText == sDisplayName) - { - g_CoolMenuManager.ConvertMenuItem(pMenu, idm); - CCoolMenuManager::SetItemIcon(*pMenu, hIconApp, idm, TRUE); - break; - } - } - } - } - RegCloseKey(hKey); -} - -void CShellContextMenu::FillSendToMenu(CMenu *pMenu, LPSHELLFOLDER pSF, - UINT &idm) -{ - if (pSF == NULL) - return; - USES_CONVERSION; - CPIDL pidl, abspidl; - LPENUMIDLIST peidl; - HRESULT hr; - STRRET str; - UINT idmStart = idm; - LPSHELLFOLDER pSubSF; - SHFILEINFO sfi; - vecCMSort vMenuItems; - - int idx_folder = 0; // folder insertion index - - hr = pSF->EnumObjects(m_hWnd, - SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &peidl); - if (FAILED(hr)) - return; - g_CoolMenuManager.ConvertMenu(pMenu); - while (peidl->Next(1, pidl, NULL) == S_OK && - idm < IDM_SENDTOLAST) - { - hr = pSF->GetDisplayNameOf(pidl, SHGDN_NORMAL, &str); - if (SUCCEEDED(hr)) - { - ULONG ulAttrs = (unsigned)-1; - pSF->GetAttributesOf(1, pidl, &ulAttrs); - abspidl.MakeAbsPIDLOf(pSF, pidl); - SHGetFileInfo((LPCTSTR)abspidl.m_pidl, 0, &sfi, sizeof(sfi), - SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON); - pidl.ExtractCStr(str); - if (ulAttrs & SFGAO_FOLDER) // folder? - { - // create new submenu & recurse - HMENU hSubMenu = ::CreateMenu(); - pMenu->InsertMenu(idx_folder, - MF_POPUP | MF_BYPOSITION | MF_STRING, - (UINT)hSubMenu, A2T(str.cStr)); - g_CoolMenuManager.ConvertMenuItem(pMenu, - idx_folder); - CCoolMenuManager::SetItemIcon(*pMenu, - sfi.hIcon, idx_folder, TRUE); - idx_folder++; - hr = pSF->BindToObject(pidl, NULL, - IID_IShellFolder, (LPVOID *)&pSubSF); - if (!SUCCEEDED(hr)) pSubSF = NULL; - FillSendToMenu(CMenu::FromHandle(hSubMenu), pSubSF, - idm); - if (pSubSF) pSubSF->Release(); - abspidl.Free(); - } - else - { - CShCMSort *pSMI = new CShCMSort(idm,pidl.m_pidl,sfi.hIcon,A2T(str.cStr),(DWORD)abspidl.m_pidl); - STL_ADD_ITEM(vMenuItems,pSMI); - idm++; - } - abspidl.m_pidl = NULL; - } - } - peidl->Release(); -// Addition: Philip Oldaker -// To keep it familiar the SendTo menu is sorted - STL_SORT(vMenuItems,pSF,STL_SORT_FUNC); - CShCMSort *pItem=NULL; - STL_FOR_ITERATOR(vecCMSort,vMenuItems) - { - pItem = STL_GET_CURRENT(vMenuItems); - pMenu->AppendMenu(MF_STRING, pItem->GetItemID(), pItem->GetText()); - g_CoolMenuManager.ConvertMenuItem(pMenu, - pMenu->GetMenuItemCount() - 1); - CCoolMenuManager::SetItemIcon(*pMenu, - pItem->GetIcon(), pItem->GetItemID()); - CCoolMenuManager::SetItemData(*pMenu, - (void*)pItem->GetItemData(), pItem->GetItemID()); - CPIDL toFree(pItem->GetPidl()); - delete pItem; - } - STL_ERASE_ALL(vMenuItems); -////////////////////////////////// - // If the menu is still empty (the user has an empty SendTo folder), - // then add a disabled "(empty)" item so we have at least something - // to display. - if (idm == idmStart) - { - pMenu->AppendMenu(MF_GRAYED | MF_DISABLED | MF_STRING, idm, - _T("(empty)")); - idm++; - } -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellDetails.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellDetails.cpp deleted file mode 100644 index 8ea09578f1f..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellDetails.cpp +++ /dev/null @@ -1,96 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "ShellDetails.h" - -HRESULT CShellDetails::GetDetailsOf(LPCITEMIDLIST pidl,UINT iColumn,LPSHELLDETAILS pDetail) -{ - HRESULT hr=E_FAIL; - if (m_pUnk == NULL) - return hr; - IShellFolder2 *pShellFolder2=NULL; - hr = m_pUnk->QueryInterface(IID_IShellFolder2,(LPVOID*)&pShellFolder2); - if (SUCCEEDED(hr)) - { - hr = pShellFolder2->GetDetailsOf(pidl,iColumn,pDetail); - pShellFolder2->Release(); - } - else - { - IShellDetails *pShellDetails=NULL; - hr = m_pUnk->QueryInterface(IID_IShellDetails,(LPVOID*)&pShellDetails); - if (SUCCEEDED(hr)) - { - hr = pShellDetails->GetDetailsOf(pidl,iColumn,pDetail); - pShellDetails->Release(); - } - } - return hr; -} - -bool CShellDetails::IsValidDetails() -{ - return m_pUnk != NULL; -} - -void CShellDetails::SetShellDetails(IUnknown *pUnk) -{ - FreeInterfaces(); - if (pUnk) - { - m_pUnk = pUnk; - m_pUnk->AddRef(); - } -} - -CShellDetails::CShellDetails(const CShellDetails &rOther) - : m_pUnk(rOther.m_pUnk) -{ - m_pUnk->AddRef(); -} - -const CShellDetails &CShellDetails::operator=(const CShellDetails &rOther) -{ - if (this == &rOther) - return *this; - - FreeInterfaces(); - m_pUnk = rOther.m_pUnk; - m_pUnk->AddRef(); - - return *this; -} - -void CShellDetails::FreeInterfaces() -{ - if (m_pUnk) - { - m_pUnk->Release(); - m_pUnk = NULL; - } -} - -CShellDetails::CShellDetails() -{ - m_pUnk = NULL; -} - -CShellDetails::~CShellDetails() -{ - FreeInterfaces(); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellPidl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellPidl.cpp deleted file mode 100644 index edeb86358fd..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellPidl.cpp +++ /dev/null @@ -1,804 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// ShellPidl.cpp: implementation of the CShellPidl class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "ShellPidl.h" -#include "UIMessages.h" -#include -#include -#include -#include "ShellContextMenu.h" -#include "UICoolMenu.h" -#include "cbformats.h" - -#define SF_DRAGDROP_FLAGS SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK; -UINT CF_IDLIST = RegisterClipboardFormat(CFSTR_SHELLIDLIST); -UINT CF_SHELLURL = RegisterClipboardFormat(CFSTR_SHELLURL); - -#define TPM_FLAGS (TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD) - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CShellPidl::CShellPidl() -{ - SHGetMalloc(&m_pMalloc); - SHGetDesktopFolder(&m_psfDesktop); - ZeroMemory(&m_EmptyPidl,sizeof(ITEMIDLIST)); -} - -CShellPidl::~CShellPidl() -{ - if (m_pMalloc) - m_pMalloc->Release(); - if (m_psfDesktop) - m_psfDesktop->Release(); -} - -IMalloc *CShellPidl::GetMalloc() -{ - return m_pMalloc; -} - -DWORD CShellPidl::GetDragDropAttributes(LPLVITEMDATA plvid) -{ - return GetDragDropAttributes(plvid->lpsfParent,plvid->lpi); -} - -DWORD CShellPidl::GetDragDropAttributes(LPTVITEMDATA ptvid) -{ - return GetDragDropAttributes(ptvid->lpsfParent,ptvid->lpi); -} - -DWORD CShellPidl::GetDragDropAttributes(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl) -{ - if (pFolder == NULL) - pFolder = m_psfDesktop; - DWORD dwAttrs=SF_DRAGDROP_FLAGS; - HRESULT hr = pFolder->GetAttributesOf(1,(LPCITEMIDLIST*)&pidl,&dwAttrs); - if (FAILED(hr)) - dwAttrs = SF_DRAGDROP_FLAGS; - return dwAttrs; -} - -DWORD CShellPidl::GetDragDropAttributes(COleDataObject *pDataObject) -{ - IDataObject *pDataObj = pDataObject->m_lpDataObject; - - STGMEDIUM stgm; - ZeroMemory(&stgm, sizeof(stgm)); - - FORMATETC fetc; - fetc.cfFormat = CF_IDLIST; - fetc.ptd = NULL; - fetc.dwAspect = DVASPECT_CONTENT; - fetc.lindex = -1; - fetc.tymed = TYMED_HGLOBAL; - - DWORD dwAttrs=DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK; - HRESULT hr = pDataObj->QueryGetData(&fetc); - if (FAILED(hr)) - return dwAttrs; - hr = pDataObj->GetData(&fetc, &stgm); - if (FAILED(hr)) - return dwAttrs; - DWORD pData = (DWORD)GlobalLock(stgm.hGlobal); - LPIDA pIDList = (LPIDA)pData; - UINT nFolderOffset = pIDList->aoffset[0]; - TRACE2("PIDL(%u) offfset=%u\n",0,nFolderOffset); - DWORD pFolder = pData+nFolderOffset; - LPITEMIDLIST pidl = (LPITEMIDLIST)pFolder; - LPSHELLFOLDER psfParent = GetFolder(pidl); - if (psfParent) - { - // get attributes for the children - TRACE1("PIDL count=%u\n",pIDList->cidl); - for(UINT i=1;i < (pIDList->cidl+1);i++) - { - UINT nListOffset = pIDList->aoffset[i]; - TRACE2("PIDL(%u) offfset=%u\n",i,nListOffset); - ULONG ulAttrs = SF_DRAGDROP_FLAGS; - DWORD dwPidl = pData+nListOffset; - LPITEMIDLIST pidlist = (LPITEMIDLIST)dwPidl; - psfParent->GetAttributesOf(1,(LPCITEMIDLIST*)&pidlist,&ulAttrs); -#ifdef _DEBUG - CString sPath; - SHPidlToPathEx(pidlist,sPath,psfParent); - TRACE2("Drag drop source path=%s Attributes=%u\n",sPath,ulAttrs); -#endif - if (ulAttrs) - dwAttrs = dwAttrs & ulAttrs; - } - psfParent->Release(); - } - GlobalUnlock(stgm.hGlobal); - ReleaseStgMedium(&stgm); - return dwAttrs; -} - -LPCITEMIDLIST CShellPidl::GetEmptyPidl() -{ - return &m_EmptyPidl; -} - -bool CShellPidl::IsDesktopFolder(LPSHELLFOLDER psFolder) -{ - return psFolder == NULL || psFolder == m_psfDesktop; -} - -LPSHELLFOLDER CShellPidl::GetDesktopFolder() -{ - return m_psfDesktop; -} - -LPSHELLFOLDER CShellPidl::GetFolder(LPITEMIDLIST pidl) -{ - if (pidl == NULL || pidl->mkid.cb == 0) - return m_psfDesktop; - LPSHELLFOLDER pFolder=NULL; - if (FAILED(m_psfDesktop->BindToObject(pidl, 0, IID_IShellFolder,(LPVOID*)&pFolder))) - return NULL; - return pFolder; -} - -// CopyItemID - creates an item identifier list containing the first -// item identifier in the specified list. -// Returns a PIDL if successful, or NULL if out of memory. -LPITEMIDLIST CShellPidl::CopyItemID(LPITEMIDLIST pidl,int n) -{ - // Get the size of the specified item identifier. - ASSERT(pidl); - if (n == 0) - { - int cb = pidl->mkid.cb; - int nSize = cb + sizeof(pidl->mkid.cb); - // Allocate a new item identifier list. - LPITEMIDLIST pidlNew = (LPITEMIDLIST)m_pMalloc->Alloc(nSize); - ZeroMemory(pidlNew,nSize); - if (pidlNew == NULL) - return NULL; - // Copy the specified item identifier. - CopyMemory(pidlNew, pidl, nSize-sizeof(pidl->mkid.cb)); - return pidlNew; - } - else - { - LPITEMIDLIST pidl_index=NULL; - for(int i=0;i < n && pidl->mkid.cb;i++) - { - pidl_index = pidl; - pidl = Next(pidl); - } - return pidl_index ? CopyItemID(pidl_index,0) : NULL; - } - return NULL; -} - -// Returns a PIDL if successful, or NULL if out of memory. -LPITEMIDLIST CShellPidl::CopyLastItemID(LPITEMIDLIST pidl) -{ - // Get the size of the specified item identifier. - ASSERT(pidl); - if (pidl == NULL) - return NULL; - LPITEMIDLIST last_pidl=pidl; - while (pidl->mkid.cb) - { - last_pidl = pidl; - pidl = Next(pidl); - } - if (last_pidl == NULL) - return NULL; - return CopyItemID(last_pidl); -} - -// copies the absolute pidl up till n -LPITEMIDLIST CShellPidl::CopyAbsItemID(LPITEMIDLIST pidl,int n) -{ - // Get the size of the specified item identifier. - ASSERT(pidl); - if (pidl == NULL) - return NULL; - LPITEMIDLIST first_pidl=NULL; - LPITEMIDLIST abs_pidl=NULL; - LPITEMIDLIST new_abs_pidl=NULL; - for(int i=0;i < n && pidl && pidl->mkid.cb;i++) - { - first_pidl = CopyItemID(pidl); - new_abs_pidl = ConcatPidl(abs_pidl,first_pidl); - if (abs_pidl) - { - m_pMalloc->Free(abs_pidl); - } - abs_pidl = new_abs_pidl; - if (first_pidl) - { - m_pMalloc->Free(first_pidl); - } - pidl = Next(pidl); - } - return new_abs_pidl; -} - -// Makes a copy of an ITEMIDLIST -LPITEMIDLIST CShellPidl::CopyItemIDList(LPITEMIDLIST pidl) -{ - // Allocate a new item identifier list. - int nSize = GetSize(pidl); - LPITEMIDLIST pidlNew = (LPITEMIDLIST)m_pMalloc->Alloc(nSize); - ZeroMemory(pidlNew,nSize); - if (pidlNew == NULL) - return NULL; - // Copy the specified item identifier. - CopyMemory(pidlNew, pidl, nSize); - - return pidlNew; -} - -bool CShellPidl::CompareMemPidls(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) -{ - // Allocate a new item identifier list. - if (pidl1 == NULL || pidl2 == NULL) - return false; - return memcmp(pidl1,pidl2,(size_t)GetSize(pidl1)) == 0; -} - -// Returns true if lists are the same -bool CShellPidl::ComparePidls(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) -{ - // Allocate a new item identifier list. - if (pFolder == NULL) - pFolder = GetDesktopFolder(); - if (pidl1 == NULL || pidl2 == NULL) - return false; - return (short)pFolder->CompareIDs(0,pidl1,pidl2) == 0; -} - -void CShellPidl::Free(void *pv) -{ - if (m_pMalloc) - m_pMalloc->Free(pv); -} - -void CShellPidl::FreePidl(LPITEMIDLIST pidl) -{ - if (m_pMalloc) - m_pMalloc->Free(pidl); -} - -UINT CShellPidl::GetCount(LPCITEMIDLIST pidl) -{ - UINT nCount = 0; - if (pidl) - { - while (pidl->mkid.cb) - { - pidl = Next(pidl); - nCount++; - } - } - return nCount; -} - -UINT CShellPidl::GetSize(LPCITEMIDLIST pidl) -{ - UINT cbTotal = 0; - if (pidl) - { - cbTotal += sizeof(pidl->mkid.cb); // Null terminator - while (pidl->mkid.cb) - { - cbTotal += pidl->mkid.cb; - pidl = Next(pidl); - } - } - return cbTotal; -} - -LPITEMIDLIST CShellPidl::Next(LPCITEMIDLIST pidl) -{ - LPSTR lpMem=(LPSTR)pidl; - - lpMem+=pidl->mkid.cb; - - return (LPITEMIDLIST)lpMem; -} - -LPITEMIDLIST CShellPidl::ConcatPidl(LPITEMIDLIST pidlDest,LPITEMIDLIST pidlSrc) -{ - // Get the size of the specified item identifier. - UINT cbDest=0; - UINT cbSrc=0; - if (pidlDest) //May be NULL - cbDest = GetSize(pidlDest) - sizeof(pidlDest->mkid.cb); - cbSrc = GetSize(pidlSrc); - - // Allocate a new item identifier list. - LPITEMIDLIST pidlNew = (LPITEMIDLIST)m_pMalloc->Alloc(cbSrc+cbDest); - if (pidlNew == NULL) - return NULL; - ZeroMemory(pidlNew,cbSrc+cbDest); - // Copy the specified item identifier. - if (pidlDest) - CopyMemory(pidlNew, pidlDest, cbDest); - CopyMemory(((USHORT*)(((LPBYTE)pidlNew)+cbDest)), pidlSrc, cbSrc); - - return pidlNew; -} - -int CShellPidl::GetIcon(LPITEMIDLIST lpi, UINT uFlags) -{ - SHFILEINFO sfi; - ZeroMemory(&sfi,sizeof(sfi)); - if (uFlags == 0) - uFlags |= (SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - uFlags |= SHGFI_PIDL; - SHGetFileInfo((LPCTSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - - return sfi.iIcon; -} - -STDMETHODIMP CShellPidl::SHPidlToPathEx(LPCITEMIDLIST pidl, CString &sPath, LPSHELLFOLDER pFolder, DWORD dwFlags) -{ - STRRET StrRetFilePath; - LPTSTR pszFilePath = NULL; - HRESULT hr=E_FAIL; - if (pFolder == NULL) - pFolder = GetDesktopFolder(); - if (pFolder == NULL) - return E_FAIL; - hr = pFolder->GetDisplayNameOf(pidl, dwFlags, &StrRetFilePath); - if (SUCCEEDED(hr)) - { - StrRetToStr(StrRetFilePath, &pszFilePath, (LPITEMIDLIST)pidl); - sPath = pszFilePath; - } - if (pszFilePath) - m_pMalloc->Free(pszFilePath); - return hr; -} - -STDMETHODIMP CShellPidl::SHPathToPidlEx(LPCTSTR szPath, LPITEMIDLIST* ppidl, LPSHELLFOLDER pFolder) -{ - OLECHAR wszPath[MAX_PATH] = {0}; - ULONG nCharsParsed = 0; - LPSHELLFOLDER pShellFolder = NULL; - BOOL bFreeOnExit = FALSE; -#ifdef UNICODE - lstrcpy(wszPath,szPath); -#else - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, wszPath, MAX_PATH); -#endif - // Use the desktop's IShellFolder by default - if(pFolder == NULL) - { - SHGetDesktopFolder(&pShellFolder); - bFreeOnExit = TRUE; - } - else - pShellFolder = pFolder; - - HRESULT hr = pShellFolder->ParseDisplayName(NULL, NULL, wszPath, &nCharsParsed, ppidl, NULL); - - if(bFreeOnExit) - pShellFolder->Release(); - - return hr; -} - -void CShellPidl::GetTypeName(LPITEMIDLIST lpi,CString &sTypeName) -{ - SHFILEINFO sfi; - ZeroMemory(&sfi,sizeof(sfi)); - UINT uFlags = SHGFI_PIDL | SHGFI_TYPENAME; - SHGetFileInfo((LPCTSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - sTypeName = sfi.szTypeName; -} - -void CShellPidl::GetDisplayName(LPITEMIDLIST lpifq,CString &sDisplayName) -{ - SHFILEINFO sfi; - ZeroMemory(&sfi,sizeof(sfi)); - UINT uFlags = SHGFI_PIDL | SHGFI_DISPLAYNAME; - SHGetFileInfo((LPCTSTR)lpifq, 0, &sfi, sizeof(SHFILEINFO), uFlags); - sDisplayName = sfi.szDisplayName; -} - -void CShellPidl::GetNormalAndSelectedIcons ( - LPITEMIDLIST lpifq, int &iImage, int &iSelectedImage) -{ - // Don't check the return value here. - // If IGetIcon() fails, you're in big trouble. - iImage = GetIcon (lpifq, - SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - iSelectedImage = GetIcon (lpifq, - SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); - - return; -} - -BOOL CShellPidl::HandleMenuMsg(HWND hwnd, LPSHELLFOLDER lpsfParent, - LPITEMIDLIST lpi, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - LPCONTEXTMENU lpcm=NULL; - HRESULT hr=lpsfParent->GetUIObjectOf(hwnd, - 1, // get attributes for this many objects - (const struct _ITEMIDLIST **)&lpi, - IID_IContextMenu, - 0, - (LPVOID *)&lpcm); - if (SUCCEEDED(hr)) - { - LPCONTEXTMENU2 lpcm2=NULL; - hr = lpcm->QueryInterface(IID_IContextMenu2,(LPVOID*)&lpcm2); - lpcm->Release(); - if (SUCCEEDED(hr)) - { - lpcm2->HandleMenuMsg(uMsg,wParam,lParam); - lpcm2->Release(); - } - return TRUE; - } - return FALSE; -} - -BOOL CShellPidl::PopupTheMenu(HWND hwnd, LPSHELLFOLDER lpsfParent, - LPITEMIDLIST *plpi, UINT cidl, LPPOINT lppt) -{ - CMenu menu; - menu.CreatePopupMenu(); - g_CoolMenuManager.Install(CWnd::FromHandle(hwnd)); - CString sPath; - if (lpsfParent == NULL) - lpsfParent = GetDesktopFolder(); - SHPidlToPathEx(*plpi,sPath,lpsfParent); - CShellContextMenu shell_menu(hwnd,sPath,plpi,cidl,lpsfParent); - shell_menu.SetMenu(&menu); - int idCmd = menu.TrackPopupMenu(TPM_FLAGS, lppt->x, lppt->y, CWnd::FromHandle(hwnd)); - shell_menu.InvokeCommand(idCmd); - g_CoolMenuManager.Uninstall(); - return TRUE; -} - -/**************************************************************************** -* -* FUNCTION: GetName(LPSHELLFOLDER lpsf,LPITEMIDLIST lpi,DWORD dwFlags, -* LPSTR lpFriendlyName) -* -* PURPOSE: Gets the friendly name for the folder -* -****************************************************************************/ -BOOL CShellPidl::GetName (LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, - DWORD dwFlags, CString &sFriendlyName) -{ - BOOL bSuccess=TRUE; - STRRET str; - - if (NOERROR==lpsf->GetDisplayNameOf(lpi,dwFlags, &str)) - { - switch (str.uType) - { - case STRRET_WSTR: -#ifdef UNICODE - _tcscpy(sFriendlyName.GetBuffer(MAX_PATH),str.pOleStr); - sFriendlyName.ReleaseBuffer(); -#else - WideCharToMultiByte( - CP_ACP, // code page - 0, // dwFlags - str.pOleStr, // lpWideCharStr - -1, // cchWideCharStr - sFriendlyName.GetBuffer(_MAX_PATH), // lpMultiByteStr - _MAX_PATH, // cchMultiByte - NULL, // lpDefaultChar - NULL); // lpUsedDefaultChar -#endif - sFriendlyName.ReleaseBuffer(); - break; - - case STRRET_OFFSET: - sFriendlyName = (LPTSTR)lpi+str.uOffset; - break; - - case STRRET_CSTR: - sFriendlyName = (LPTSTR)str.cStr; - break; - - default: - bSuccess = FALSE; - break; - } - } - else - bSuccess = FALSE; - - return bSuccess; -} - -// -// ResolveChannel: Resolves a Channel Shortcut to its URL -// -STDMETHODIMP CShellPidl::ResolveChannel(IShellFolder* pFolder, LPCITEMIDLIST pidl, LPTSTR* lpszURL) -{ - IShellLink* pShellLink; - - *lpszURL = NULL; // Assume failure - - // Get a pointer to the IShellLink interface from the given folder - HRESULT hr = pFolder->GetUIObjectOf(NULL, 1, &pidl, IID_IShellLink, NULL, (LPVOID*)&pShellLink); - if (SUCCEEDED(hr)) - { - LPITEMIDLIST pidlChannel; - - // Convert the IShellLink pointer to a PIDL. - hr = pShellLink->GetIDList(&pidlChannel); - if (SUCCEEDED(hr)) - { - IShellFolder* psfDesktop; - - hr = SHGetDesktopFolder(&psfDesktop); - if (SUCCEEDED(hr)) - { - STRRET strret; - - hr = psfDesktop->GetDisplayNameOf(pidlChannel, 0, &strret); - if (SUCCEEDED(hr)) - StrRetToStr(strret, lpszURL, pidlChannel); - - psfDesktop->Release(); - } - } - - pShellLink->Release(); - } - - return hr; -} - -STDMETHODIMP CShellPidl::ResolveHistoryShortcut(LPSHELLFOLDER pFolder,LPCITEMIDLIST *ppidl,CString &sURL) -{ - HRESULT hr=E_FAIL; - IDataObject *pObj=NULL; - hr = pFolder->GetUIObjectOf(NULL, 1, ppidl, IID_IDataObject, NULL, (LPVOID*)&pObj); - if (SUCCEEDED(hr)) - { - hr = GetURL(pObj,sURL); - pObj->Release(); - } - return hr; -} - -STDMETHODIMP CShellPidl::GetURL(IDataObject *pDataObj,CString &sURL) -{ - sURL.Empty(); - STGMEDIUM stgm; - ZeroMemory(&stgm, sizeof(stgm)); - - FORMATETC fetc; - fetc.cfFormat = CF_SHELLURL; - fetc.ptd = NULL; - fetc.dwAspect = DVASPECT_CONTENT; - fetc.lindex = -1; - fetc.tymed = TYMED_HGLOBAL; - - HRESULT hr = pDataObj->QueryGetData(&fetc); - if (FAILED(hr)) - return hr; - hr = pDataObj->GetData(&fetc, &stgm); - if (FAILED(hr)) - return hr; - LPCTSTR pData = (LPCTSTR)GlobalLock(stgm.hGlobal); - sURL = pData; - GlobalUnlock(stgm.hGlobal); - ReleaseStgMedium(&stgm); - return S_OK; -} - -// -// ResolveInternetShortcut: Resolves an Internet Shortcut to its URL -// -STDMETHODIMP CShellPidl::ResolveInternetShortcut(LPCTSTR lpszLinkFile, LPTSTR* lpszURL) -{ - IUniformResourceLocator* pUrlLink = NULL; - - *lpszURL=NULL; - - HRESULT hr = CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, - IID_IUniformResourceLocator, (LPVOID*)&pUrlLink); - if (FAILED(hr)) - return hr; - - IPersistFile* pPersistFile = NULL; - hr = pUrlLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile); - if (SUCCEEDED(hr)) - { - // Ensure that the string is Unicode. - WORD wsz[MAX_PATH]; - #ifdef UNICODE - _tcscpy(wsz,lpszLinkFile); - #else - MultiByteToWideChar(CP_ACP, 0, lpszLinkFile, -1, wsz, MAX_PATH); - #endif - // Load the Internet Shortcut from persistent storage. - hr = pPersistFile->Load(wsz, STGM_READ); - if (SUCCEEDED(hr)) - { - hr = pUrlLink->GetURL(lpszURL); - } - pPersistFile->Release(); - } - pUrlLink->Release(); - - return hr; -} - -// -// ResolveLink: Resolves a Shell Link to its actual folder location -// -STDMETHODIMP CShellPidl::ResolveLink(HWND hWnd,LPCTSTR lpszLinkFile, LPTSTR* lpszURL) -{ - IShellLink* pShellLink = NULL; - - *lpszURL = NULL; // Assume failure - - HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID*)&pShellLink); - if (SUCCEEDED(hr)) - { - IPersistFile* pPersistFile = NULL; - - hr = pShellLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile); - if (SUCCEEDED(hr)) - { - // Ensure that the string is Unicode. - WORD wsz[MAX_PATH]; -#ifdef UNICODE - _tcscpy(wsz,lpszLinkFile); -#else - MultiByteToWideChar(CP_ACP, 0, lpszLinkFile, -1, wsz, MAX_PATH); -#endif - - // Load the shortcut.from persistent storage - hr = pPersistFile->Load(wsz, STGM_READ); - if (SUCCEEDED(hr)) - { - WIN32_FIND_DATA wfd; - - hr = pShellLink->Resolve(hWnd, SLR_NO_UI); - if (NOERROR == hr) - { - // Get the path to the link target. - *lpszURL = (LPTSTR)m_pMalloc->Alloc(MAX_PATH); // Must remember to Free later - - hr = pShellLink->GetPath(*lpszURL, MAX_PATH - 1, (WIN32_FIND_DATA*)&wfd, SLGP_UNCPRIORITY); - } - } - - pPersistFile->Release(); - } - - pShellLink->Release(); - } - - return hr; -} - -// -// This method converts a STRRET structure to a LPTSTR -// -#ifdef UNICODE -STDMETHODIMP CShellPidl::StrRetToStr(STRRET StrRet, LPTSTR* str, LPITEMIDLIST pidl) -{ - HRESULT hr = S_OK; - int cch; - LPSTR strOffset; - - *str = NULL; // Assume failure - - switch (StrRet.uType) - { - case STRRET_WSTR: - cch = wcslen(StrRet.pOleStr) + 1; // NULL terminator - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - lstrcpyn(*str, StrRet.pOleStr, cch); - else - hr = E_FAIL; - break; - - case STRRET_OFFSET: - strOffset = (((char *) pidl) + StrRet.uOffset); - - cch = MultiByteToWideChar(CP_OEMCP, 0, strOffset, -1, NULL, 0); - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - MultiByteToWideChar(CP_OEMCP, 0, strOffset, -1, *str, cch); - else - hr = E_FAIL; - break; - - case STRRET_CSTR: - cch = MultiByteToWideChar(CP_OEMCP, 0, StrRet.cStr, -1, NULL, 0); - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - MultiByteToWideChar(CP_OEMCP, 0, StrRet.cStr, -1, *str, cch); - else - hr = E_FAIL; - - break; - } - - return hr; -} -#else // UNICODE not defined -STDMETHODIMP CShellPidl::StrRetToStr(STRRET StrRet, LPTSTR* str, LPITEMIDLIST pidl) -{ - - HRESULT hr = S_OK; - int cch; - LPSTR strOffset; - - *str = NULL; // Assume failure - - switch (StrRet.uType) - { - case STRRET_WSTR: - cch = WideCharToMultiByte(CP_ACP, 0, StrRet.pOleStr, -1, NULL, 0, NULL, NULL); - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - WideCharToMultiByte(CP_ACP, 0, StrRet.pOleStr, -1, *str, cch, NULL, NULL); - else - hr = E_FAIL; - break; - - case STRRET_OFFSET: - strOffset = (((char *) pidl) + StrRet.uOffset); - - cch = strlen(strOffset) + 1; // NULL terminator - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - strcpy(*str, strOffset); - else - hr = E_FAIL; - break; - - case STRRET_CSTR: - cch = strlen(StrRet.cStr) + 1; // NULL terminator - *str = (LPTSTR)m_pMalloc->Alloc(cch * sizeof(TCHAR)); - - if (*str != NULL) - strcpy(*str, StrRet.cStr); - else - hr = E_FAIL; - - break; - } - - return hr; -} -#endif diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellSettings.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellSettings.cpp deleted file mode 100644 index d6301e52f7d..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/ShellSettings.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "ShellSettings.h" - -typedef void (WINAPI *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); - -CShellSettings::CShellSettings() -{ - // Since SHGetSettings is not implemented in all versions of the shell, - // get the function address manually at run time. - // This allows the extension to run on all platforms. - m_hinstShell32 = LoadLibrary(TEXT("shell32.dll")); - ZeroMemory(&m_sfs, sizeof(m_sfs)); - // The default is classic Windows 95 style. - m_sfs.fWin95Classic = TRUE; -} - -CShellSettings::~CShellSettings() -{ - if (m_hinstShell32) - FreeLibrary(m_hinstShell32); -} - -bool CShellSettings::GetSettings() -{ - if (m_hinstShell32 == NULL) - return false; - PFNSHGETSETTINGSPROC pfnSHGetSettings; - pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(m_hinstShell32, "SHGetSettings"); - if(pfnSHGetSettings) - { - ZeroMemory(&m_sfs, sizeof(m_sfs)); - (*pfnSHGetSettings)(&m_sfs, - SSF_DESKTOPHTML | // The fDesktopHTML member is being requested. - SSF_DONTPRETTYPATH | // The fDontPrettyPath member is being requested. - SSF_DOUBLECLICKINWEBVIEW | // The fDoubleClickInWebView member is being requested. - SSF_HIDEICONS | // The fHideIcons member is being requested. - SSF_MAPNETDRVBUTTON | // The fMapNetDrvBtn member is being requested. - SSF_NOCONFIRMRECYCLE | // The fNoConfirmRecycle member is being requested. - SSF_SHOWALLOBJECTS | // The fShowAllObjects member is being requested. - SSF_SHOWATTRIBCOL | // The fShowAttribCol member is being requested. - SSF_SHOWCOMPCOLOR | // The fShowCompColor member is being requested. - SSF_SHOWEXTENSIONS | // The fShowExtensions member is being requested. - SSF_SHOWINFOTIP | // The fShowInfoTip member is being requested. - SSF_SHOWSYSFILES | // The fShowSysFiles member is being requested. - SSF_WIN95CLASSIC); // The fWin95Classic member is being requested. - } - return true; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextParse.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextParse.cpp deleted file mode 100644 index 134d07a1d84..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextParse.cpp +++ /dev/null @@ -1,758 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "TextParse.h" - -CTextParse::CTextParse() -{ - m_szBuffer[0] = '\0'; - m_pStartLine = m_szBuffer; - m_pLine = m_szBuffer; - m_pSavePos = m_szBuffer; -} - -CTextParse::CTextParse(LPCTSTR pszLine) -{ - m_szBuffer[0] = '\0'; - Set(pszLine); -} - -CTextParse::~CTextParse() -{ -} - -CTextParse::CTextParse(const CTextParse &tp) -{ - m_pLine = tp.m_pLine; - m_pStartLine = tp.m_pStartLine; - m_pSavePos = tp.m_pSavePos; - m_szCopyBuf[0] = '\0'; - m_szBuffer[0] = '\0'; - _tcscpy(m_szCopyBuf,tp.m_szCopyBuf); - _tcscpy(m_szBuffer,tp.m_szBuffer); -} - -const CTextParse& CTextParse::operator=(LPCTSTR lpsz) -{ - Set(lpsz); - m_szCopyBuf[0] = '\0'; - m_szBuffer[0] = '\0'; - return *this; -} - -const CTextParse& CTextParse::operator=(const CTextParse &tp) -{ - if (*this == tp) - return *this; - m_pLine = tp.m_pLine; - m_pStartLine = tp.m_pStartLine; - m_pSavePos = tp.m_pSavePos; - _tcscpy(m_szCopyBuf,tp.m_szCopyBuf); - _tcscpy(m_szBuffer,tp.m_szBuffer); - return *this; -} - -BOOL CTextParse::CharExistFromCurPos(int c,BOOL bForward) -{ - LPCTSTR p = m_pLine; - if (bForward) - { - while (*p && *p != c) - p = _tcsinc(p); - } - else - { - while (p > m_pStartLine && *p != c) - p = _tcsdec(m_pLine,p); - } - return *p == c; -} - -BOOL CTextParse::ValidCppCharExist(int c,BOOL bForward) -{ - LPCTSTR p = m_pLine; - while (*p && *p != c && *p != '/') - p = _tcsinc(p); - return *p == c; -} - -BOOL CTextParse::CharExist(LPCTSTR str) -{ - LPCTSTR p = m_pStartLine; - while (*p && !IsToken(str,p)) - p = _tcsinc(p); - return *p != '\0'; -} - -BOOL CTextParse::FindString(LPCTSTR str) -{ - LPCTSTR p = _tcsstr(m_pLine,str); - if (p) - m_pLine = p; - return p ? TRUE : FALSE; -} - -BOOL CTextParse::FindChar(int c) -{ - LPCTSTR p = _tcschr(m_pLine,c); - if (p) - m_pLine = p; - return p ? TRUE : FALSE; -} - -BOOL CTextParse::MoveUntilChar(int c,BOOL bForward) -{ - if (bForward) - { - while(*m_pLine && *m_pLine != c) - m_pLine = _tcsinc(m_pLine); - return *m_pLine != '\0'; - } - else - { - while(m_pLine > m_pStartLine && *m_pLine != c) - m_pLine = _tcsdec(m_pStartLine,m_pLine); - return *m_pLine == c; - } -} - -BOOL CTextParse::MoveUntilChar(LPCTSTR strTok,BOOL bForward) -{ - if (bForward) - { - while(*m_pLine && !IsToken(strTok,m_pLine)) - m_pLine = _tcsinc(m_pLine); - return *m_pLine != '\0'; - } - else - { - while(m_pLine > m_pStartLine && !IsToken(strTok,m_pLine)) - m_pLine = _tcsdec(m_pStartLine,m_pLine); - return IsToken(strTok,m_pLine); - } -} - -BOOL CTextParse::MoveUntilString(LPCTSTR str,BOOL bForward) -{ - if (bForward) - { - while(*m_pLine && !IsString(str)) - m_pLine = _tcsinc(m_pLine); - return *m_pLine != '\0'; - } - else - { - while(m_pLine > m_pStartLine && !IsString(str)) - m_pLine = _tcsdec(m_pStartLine,m_pLine); - return IsString(str); - } -} - -BOOL CTextParse::MoveWhileChar(int c,BOOL bForward) -{ - if (bForward) - { - while(*m_pLine && *m_pLine == c) - m_pLine = _tcsinc(m_pLine); - return *m_pLine != '\0'; - } - else - { - while(m_pLine > m_pStartLine && *m_pLine == c) - m_pLine = _tcsdec(m_pStartLine,m_pLine); - return *m_pLine == c; - } -} - -BOOL CTextParse::MoveWhileChar(LPCTSTR strTok,BOOL bForward) -{ - if (bForward) - { - while(*m_pLine && IsToken(strTok,m_pLine)) - m_pLine = _tcsinc(m_pLine); - return *m_pLine != '\0'; - } - else - { - while(m_pLine > m_pStartLine && IsToken(strTok,m_pLine)) - m_pLine = _tcsdec(m_pStartLine,m_pLine); - return IsToken(strTok,m_pLine); - } -} - -LPCTSTR CTextParse::CopyWhileChar(int c) -{ - for(int i=0;i < MAX_BUF && *m_pLine != '\0' && *m_pLine == c;i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyUntilString(LPCTSTR pszText) -{ - int nLen = _tcslen(pszText); - for(int i=0;i < MAX_BUF && *m_pLine != '\0' && _tcsncmp(m_pLine,pszText,nLen) != 0;i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyUntilChar(int c) -{ - for(int i=0;i < MAX_BUF && *m_pLine != '\0' && *m_pLine != c;i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyWhileChar(LPCTSTR strTok) -{ - for(int i=0;i < MAX_BUF && *m_pLine != '\0' && IsToken(strTok,m_pLine);i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyUntilChar(LPCTSTR strTok) -{ - for(int i=0;i < MAX_BUF && *m_pLine != '\0' && !IsToken(strTok,m_pLine);i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyFuncUntilChar(LPCTSTR strTok) -{ - for(int i=0;i < MAX_BUF && !IsEnd() && !IsToken(strTok,m_pLine);i++) - { -/* if (*m_pLine == '=') { - MoveUntilChar(",)"); - if (m_szCopyBuf[i-1] == ' ') { - i--; - } - }*/ - if (CharAtCurrent('/')) - { - MoveForward(); - MoveUntilChar(_T("/")); - if (m_szCopyBuf[i-1] == ' ') - { - i--; - MoveForward(); - } - } - m_szCopyBuf[i] = *m_pLine; - MoveForward(); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -BOOL CTextParse::IsToken(LPCTSTR strTok,LPCTSTR p) -{ - while(*strTok) - { - if (*p == *strTok) - break; - strTok = _tcsinc(strTok); - } - return *strTok != '\0'; -} - -LPCTSTR CTextParse::ExtractConstructor() -{ - MoveUntilChar('('); - CopyUntilChar(')'); - _tcscat(m_szCopyBuf,_T(")")); - return m_szCopyBuf; -} - -LPCTSTR CTextParse::ExtractDeclareMacro() -{ - return CopyUntilChar('('); -} - -LPCTSTR CTextParse::ExtractFuncName() -{ - Reset(); - // skip keywords - if (_tcsncmp(m_pLine,_T("const"),5) == 0 || _tcsncmp(m_pLine,_T("afx_msg"),7) == 0 || _tcsncmp(m_pLine,_T("virtual"),7) == 0) - { - CopyUntilWhiteSpace(); - MoveWhileWhiteSpace(); - } - MoveUntilChar(_T("(")); - MoveUntilWhiteSpace(FALSE); - if (*m_pLine == CPP_SPACE) // regular function - MoveWhileWhiteSpace(); - else - { // else constructor or destructor - // allow for virtual destructors - if (_tcsncmp(m_pLine,_T("virtual"),7) == 0) - { - CopyUntilWhiteSpace(); - MoveWhileWhiteSpace(); - } - Reset(); - } - // returning pointer or reference - if (*m_pLine == '*' || *m_pLine == '&') - m_pLine = _tcsinc(m_pLine); - return CopyUntilChar('('); -} - -LPCTSTR CTextParse::ExtractClassName() -{ - MoveWhileWhiteSpace(); - if (_tcsncmp(m_pLine,_T("class"),5) != 0) - { - m_szCopyBuf[0] = 0; - return m_szCopyBuf; - } - Reset(); - // check if derived class - if (!CharExistFromCurPos(':')) - { - if (!CharExistFromCurPos('{')) - { - MoveToLastChar(); - MoveWhileWhiteSpace(FALSE); - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(); - } - else - { - MoveUntilChar('{'); - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(FALSE); - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(); - } - } - else - { - MoveUntilChar(':'); - // go back and skip colon - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(FALSE); - if (CharAtCurrent('>')) - { - MoveUntilChar('<',FALSE); - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(FALSE); - } - MoveUntilWhiteSpace(FALSE); - MoveWhileWhiteSpace(); - } - return CopyUntilChar(_T(" \t<")); -} - -LPCTSTR CTextParse::ExtractBaseClassName() -{ - Reset(); - MoveWhileWhiteSpace(); - if (_tcsncmp(m_pLine,_T("class"),5) != 0) - { - m_szCopyBuf[0] = 0; - return m_szCopyBuf; - } - Reset(); - // check if derived class - if (CharExistFromCurPos(':')) - { - MoveUntilChar(':'); - // go back - MoveWhileChar(':'); - MoveWhileWhiteSpace(); - MoveUntilWhiteSpace(); - MoveWhileWhiteSpace(); - } - else - { - m_szCopyBuf[0] = 0; - return m_szCopyBuf; - } - return CopyUntilChar(_T(" \t<")); -} - -BOOL CTextParse::IsCommentBlock(LPCTSTR strStart,LPCTSTR strEnd) -{ - LPCTSTR p = _tcsstr(m_pLine,strStart); - if (p) - { - if (p == m_pStartLine && *(p+sizeof(TCHAR)*2) == '+') - return FALSE; - if (p == m_pStartLine || (p != m_pStartLine && *(p-sizeof(TCHAR)) != '/') ) - { - if (_tcsstr(m_pLine,strEnd) == NULL) - return TRUE; - } - } - return FALSE; -} - -LPCTSTR CTextParse::CopyWholeWord() -{ - bool bQuote=false; - for(int i=0;i < MAX_BUF && *m_pLine != '\0';i++) - { - if (*m_pLine == '"') - { - bQuote = !bQuote; - } - else if (*m_pLine == ' ' && bQuote == false) - { - break; - } - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - SkipWhiteSpace(); - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::CopyUntilEnd() -{ - for(int i=0;i < MAX_BUF && *m_pLine != '\0';i++) - { - m_szCopyBuf[i] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -bool CTextParse::FindWholeWord(LPCTSTR pszText) -{ - bool bQuote = _tcsstr(pszText,_T("\"")) != NULL; - if (*pszText == '+' || *pszText == '-') - pszText = _tcsinc(pszText); - int nLen = _tcslen(pszText); - int nRet=-1; - for(int i=0;i < MAX_BUF && *m_pLine != '\0';i++) - { - SkipWhiteSpace(); - if (*m_pLine == '"') - { - if (bQuote == true) - { - nRet = _tcsncmp(m_pLine,pszText,nLen); - if (nRet == 0) - break; - } - MoveWhileChar('"'); - MoveUntilChar('"'); - MoveWhileChar('"'); - } - else - { - nRet = _tcsncmp(m_pLine,pszText,GetWordLen()); - if (nRet == 0) - break; - SkipWord(); - } - } - return nRet == 0; -} - -int CTextParse::GetWordLen() -{ - LPCTSTR p = m_pLine; - for (int i=0;*p && !IsToken(CPP_WHITE_SPACE,p);i++) - { - p++; - } - return i; -} - -bool CTextParse::SkipHTMLCommand(bool bSkipCRLF) -{ - if (CharAtCurrent('&')) - { - MoveUntilChar(';'); - if (CharAtCurrent(';')) - MoveForward(); - return true; - } - LPCTSTR p = m_pLine; - if (bSkipCRLF) - { - while (*p == '\r' || *p == '\n') - p = _tcsinc(p); - } - if (*p != '<') - return false; - while (*p != '>' && *p != '\0') - p = _tcsinc(p); - if (*p == '>') - p = _tcsinc(p); - m_pLine = p; - return true; -} - -void CTextParse::SkipHTMLCommands(bool bSkipCRLF) -{ - while (SkipHTMLCommand(bSkipCRLF)) - ; -} - -BOOL CTextParse::IsValidCPP(LPCTSTR pszText) -{ - BOOL bRet=FALSE; - if (FindString(pszText)) - { - // check if a comment - SaveCurPos(); - if (!MoveUntilString(_T("//"),FALSE)) - { - RestorePos(); - if (!MoveUntilString(_T("/*"),FALSE)) - bRet = TRUE; - } - } - Reset(); - return bRet; -} - -BOOL CTextParse::IsPrivate() -{ - return IsValidCPP(_T("private")); -} - -BOOL CTextParse::IsPublic() -{ - return IsValidCPP(_T("public")); -} - -BOOL CTextParse::IsProtected() -{ - return IsValidCPP(_T("protected")); -} - -BOOL CTextParse::IsVirtualFunc() -{ - return IsValidCPP(_T("virtual")); -} - -BOOL CTextParse::IsStartBrace() -{ - return IsValidCPP(_T("{")); -} - -BOOL CTextParse::IsEndBrace() -{ - return IsValidCPP(_T("}")); -} - -BOOL CTextParse::IsAccessSpecifier() -{ - return IsValidCPP(_T(":")); -} - -BOOL CTextParse::IsConstructor(LPCTSTR pszClassName) -{ - CString sTest(pszClassName); - sTest += _T("("); - if (FindChar('~')) - { - Reset(); - return FALSE; - } - return IsValidCPP(sTest); -} - -BOOL CTextParse::IsMsgMap() -{ - return FindString(_T("{{AFX_MSG")); -} - -BOOL CTextParse::IsDeclareMacro() -{ - BOOL bRet = FALSE; - if (IsValidCPP(_T("DECLARE_"))) - { - if (!FindString(_T("()"))) - bRet = TRUE; - Reset(); - } - return bRet; -} - -BOOL CTextParse::IsStartCommentBlock() -{ - if (!FindString(_T("//"))) - return FindString(_T("/*")); - return FALSE; -} - -BOOL CTextParse::IsEndCommentBlock() -{ - return FindString(_T("*/")); -} - -BOOL CTextParse::IsClass() -{ - BOOL bRet=TRUE; - if (FindString(_T("template"))) - { - bRet = FALSE; - } - if (!StringAtCurrent(_T("class "))) - { - bRet = FALSE; - } - Reset(); - // any line comments before 'class ' - MoveUntilString(_T("class ")); - if (MoveUntilString(_T("//"),FALSE)) - { - bRet = FALSE; - } - Reset(); - if (FindChar(_T(';'))) - { - bRet = FALSE; - } - if (FindChar(_T('#'))) - { - bRet = FALSE; - } - Reset(); - return bRet; -} - -BOOL CTextParse::ExtractArgs(CString &sRet,CStringArray &asArgs) -{ - asArgs.RemoveAll(); - SaveCurPos(); - if (!CharAtCurrent('(') && FindChar('(')) - { - RestorePos(); - SkipWhiteSpace(); - if (StringAtCurrent(_T("const"))) - { - MoveUntilWhiteSpace(); - SkipWhiteSpace(); - } - sRet = CopyUntilWhiteSpace(); - if (MoveUntilChar('(')) - { - MoveForward(); - } - else - { - RestorePos(); - } - } - while (!CharAtCurrent(')') && !IsEnd()) - { - SkipWhiteSpace(); - if (StringAtCurrent(_T("const"))) - { - MoveUntilWhiteSpace(); - SkipWhiteSpace(); - } - MoveUntilWhiteSpace(); - SkipWhiteSpace(); - if (StringAtCurrent(_T("void"))) - break; - if (CharAtCurrent('*') || CharAtCurrent('&')) - MoveForward(); - asArgs.Add(CopyUntilChar(_T(",)\t "))); - if (CharAtCurrent(',')) - MoveForward(); - else - SkipWhiteSpace(); - } - return TRUE; -} - -LPCTSTR CTextParse::ExtractHTMLText(bool bRemoveCRLF) -{ - return ExtractHTMLText(_T("<"),bRemoveCRLF); -} - -LPCTSTR CTextParse::ExtractHTMLText(LPCTSTR pszUntil,bool bRemoveCRLF) -{ - int nLen=_tcslen(pszUntil); - int i=0; - bool bEnd = false; - while(i < MAX_BUF && *m_pLine != '\0' && _tcsncmp(m_pLine,pszUntil,nLen) != 0) - { - if (*m_pLine == '<' || *m_pLine == '&') - { - while (SkipHTMLCommand(false)) - { - if (_tcsncmp(m_pLine,pszUntil,nLen) == 0) - { - bEnd = true; - break; - } - } - } - if (bEnd) - break; - if (bRemoveCRLF && (*m_pLine == '\n' || *m_pLine == '\r')) - { - m_pLine = _tcsinc(m_pLine); - } - else - { - m_szCopyBuf[i++] = *m_pLine; - m_pLine = _tcsinc(m_pLine); - } - } - m_szCopyBuf[i] = '\0'; - return m_szCopyBuf; -} - -LPCTSTR CTextParse::ExtractHTMLLink() -{ - m_szCopyBuf[0] = '\0'; - if (!FindString(_T("href="))) - return m_szCopyBuf; - MoveUntilChar('"'); - LPCTSTR p = m_pLine; - if (*p == '"') - { - p = _tcsinc(p); - m_pLine = p; - LPCTSTR pRet = CopyUntilChar('"'); - MoveUntilChar('>'); - MoveWhileChar('>'); - return pRet; - } - return m_szCopyBuf; -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextProgressCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextProgressCtrl.cpp deleted file mode 100644 index 80b15f3c025..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/TextProgressCtrl.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// TextProgressCtrl.cpp : implementation file -// -// Written by Chris Maunder (cmaunder@mail.com) -// Copyright 1998. -// -// TextProgressCtrl is a drop-in replacement for the standard -// CProgressCtrl that displays text in a progress control. -// -// This code may be used in compiled form in any way you desire. This -// file may be redistributed by any means PROVIDING it is not sold for -// profit without the authors written consent, and providing that this -// notice and the authors name is included. If the source code in -// this file is used in any commercial application then an email to -// the me would be nice. -// -// This file is provided "as is" with no expressed or implied warranty. -// The author accepts no liability if it causes any damage to your -// computer or anything else vaguely within it's vicinity. -// -// Expect bugs. -// -// Please use and enjoy. Please let me know of any bugs/mods/improvements -// that you have found/implemented and I will fix/incorporate them into this -// file. -// Modified by Philip Oldaker 2000 - -#include "stdafx.h" -#include "TextProgressCtrl.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CTextProgressCtrl,CUIODColumnCtrl) -///////////////////////////////////////////////////////////////////////////// -// CTextProgressCtrl - -CTextProgressCtrl::CTextProgressCtrl() -{ - m_nPos = 0; - m_nStepSize = 1; - m_nMax = 100; - m_nMin = 0; - m_bShowText = TRUE; - m_crBarClr = CLR_DEFAULT; - m_crBgClr = CLR_DEFAULT; - m_crTextClr = CLR_DEFAULT; - m_crSelBarClr = CLR_DEFAULT; - m_crSelBgClr = CLR_DEFAULT; - m_crSelTextClr = CLR_DEFAULT; -} - -CTextProgressCtrl::~CTextProgressCtrl() -{ -} - -void CTextProgressCtrl::DoPaint(CDC *PaintDC,CRect rcClient,bool bSelected) -{ - if (m_nMin >= m_nMax) - return; - - bool bInvert=bSelected; - COLORREF crBarColour = (m_crBarClr == CLR_DEFAULT)? RGB(10,20,200) : m_crBarClr; - COLORREF crBgColour = (m_crBgClr == CLR_DEFAULT)? ::GetSysColor(COLOR_MENU) : m_crBgClr; - COLORREF crTextColor = (m_crTextClr == CLR_DEFAULT)? ::GetSysColor(COLOR_BTNTEXT) : m_crTextClr; - if (bSelected) - { - if (m_crSelBarClr != CLR_DEFAULT) - { - crBarColour = m_crSelBarClr; - bInvert = false; - } - if (m_crSelBgClr != CLR_DEFAULT) - { - crBgColour = m_crSelBgClr; - bInvert = false; - } - if (m_crSelTextClr != CLR_DEFAULT) - { - crTextColor = m_crSelTextClr; - bInvert = false; - } - } - double Fraction = (double)(m_nPos - m_nMin) / ((double)(m_nMax - m_nMin)); - - CDC &dc = *PaintDC; - dc.Rectangle(rcClient.left+1,rcClient.top+1,rcClient.right-1,rcClient.bottom-1); - rcClient.DeflateRect(2,2); - CRect LeftRect(rcClient); - CRect RightRect(rcClient); - - LeftRect.right = LeftRect.left + (int)((LeftRect.right - LeftRect.left)*Fraction); - RightRect.left = LeftRect.right; - dc.FillSolidRect(LeftRect, crBarColour); - dc.FillSolidRect(RightRect, crBgColour); - // Draw Text if not vertical - if (m_bShowText) - { - CString str; - if (m_strText.GetLength()) - str = m_strText; - else - str.Format(_T("%d%%"), (int)(Fraction*100.0)); - CSize sz = dc.GetTextExtent(str); - int nTextPos = 0; - if (rcClient.Width() > sz.cx) - nTextPos = (rcClient.Width() - sz.cx) / 2; - if (!bSelected && LeftRect.Width() >= nTextPos) - { - dc.SetTextColor(RGB(255,255,255)); - } - else - dc.SetTextColor(crTextColor); - dc.SetBkMode(TRANSPARENT); - DWORD dwTextStyle = DT_CENTER | DT_VCENTER | DT_SINGLELINE; - dc.DrawText(str, rcClient, dwTextStyle); - } - if (bInvert) - { - dc.InvertRect(rcClient); - } -} - -///////////////////////////////////////////////////////////////////////////// -// CTextProgressCtrl operations - -void CTextProgressCtrl::SetShowText(BOOL bShow) -{ - m_bShowText = bShow; -} - -void CTextProgressCtrl::SetRange(int nLower, int nUpper) -{ - m_nMax = nUpper; - m_nMin = nLower; -} - -void CTextProgressCtrl::GetRange(int& nLower, int& nUpper) const -{ - nUpper = m_nMax; - nLower = m_nMin; -} - -int CTextProgressCtrl::SetPos(int nPos) -{ - int nOldPos = m_nPos; - m_nPos = nPos; - return nOldPos; -} - -int CTextProgressCtrl::StepIt() -{ - return SetPos(m_nPos + m_nStepSize); -} - -int CTextProgressCtrl::OffsetPos(int nPos) -{ - return SetPos(m_nPos + nPos); -} - -int CTextProgressCtrl::SetStep(int nStep) -{ - int nOldStep = m_nStepSize; - m_nStepSize = nStep; - return nOldStep; -} - -COLORREF CTextProgressCtrl::SetBarColor(COLORREF crBarClr /*= CLR_DEFAULT*/,COLORREF crSelBarClr /*= CLR_DEFAULT*/) -{ - COLORREF crOldBarClr = m_crBarClr; - m_crBarClr = crBarClr; - m_crSelBarClr = crSelBarClr; - return crOldBarClr; -} - -COLORREF CTextProgressCtrl::GetBarColor() const -{ - return m_crBarClr; -} - -COLORREF CTextProgressCtrl::GetSelBarColor() const -{ - return m_crSelBarClr; -} - -COLORREF CTextProgressCtrl::SetBgColor(COLORREF crBgClr /*= CLR_DEFAULT*/,COLORREF crSelBgClr /*= CLR_DEFAULT*/) -{ - COLORREF crOldBgClr = m_crBgClr; - m_crBgClr = crBgClr; - m_crSelBgClr = crSelBgClr; - return crOldBgClr; -} - -COLORREF CTextProgressCtrl::GetBgColor() const -{ - return m_crBgClr; -} - - -COLORREF CTextProgressCtrl::GetSelBgColor() const -{ - return m_crSelBgClr; -} - -COLORREF CTextProgressCtrl::SetTextColor(COLORREF crTextClr /*= CLR_DEFAULT*/,COLORREF crSelTextClr /*= CLR_DEFAULT*/) -{ - COLORREF crOldTextClr = m_crTextClr; - m_crTextClr = crTextClr; - m_crSelTextClr = crSelTextClr; - return crOldTextClr; -} - -COLORREF CTextProgressCtrl::GetTextColor() const -{ - return m_crTextClr; -} - -COLORREF CTextProgressCtrl::GetSelTextColor() const -{ - return m_crSelTextClr; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIApp.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIApp.cpp deleted file mode 100644 index 222e661a3c5..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIApp.cpp +++ /dev/null @@ -1,368 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIFrameWnd.h" -#include "UIApp.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUIApp - -IMPLEMENT_DYNAMIC(CUIApp,CWinApp) - -BEGIN_MESSAGE_MAP(CUIApp, CWinApp) - //{{AFX_MSG_MAP(CUIApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP - // Standard file based document commands -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUIApp construction - -CUIApp::CUIApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance - m_IDMyIcon = 0; - m_bMyClassRegistered = false; -} - -CDocTemplate *CUIApp::GetFirstDocTemplate() -{ - POSITION posTempl = GetFirstDocTemplatePosition(); - CDocTemplate *pTempl = GetNextDocTemplate(posTempl); - ASSERT(pTempl); - return pTempl; -} - -CFrameWnd *CUIApp::GetMainFrame(CWnd *pWnd) -{ - if (pWnd) - return pWnd->GetParentFrame(); - return (CFrameWnd*)m_pMainWnd; -} - -CString CUIApp::GetRegAppKey() -{ - CString sKey; - sKey += _T("Software"); - sKey += _T("\\"); - sKey += m_pszRegistryKey; - sKey += _T("\\"); - sKey += m_pszProfileName; - sKey += _T("\\"); - return sKey; -} - -BOOL CUIApp::InitInstance() -{ - if (!m_sMyClassName.IsEmpty() && !RegisterMyClass()) - return FALSE; - return CWinApp::InitInstance(); -} - -int CUIApp::ExitInstance() -{ - // TODO: Add your specialized code here and/or call the base class - if(m_bMyClassRegistered) - ::UnregisterClass(m_sMyClassName,AfxGetInstanceHandle()); - - return CWinApp::ExitInstance(); -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CUIApp object -bool CUIApp::RegisterMyClass() -{ - // Register our unique class name so only one instance can be started - ////////////////////////////////////////////////////////////// - ASSERT(!m_sMyClassName.IsEmpty()); - if (m_sMyClassName.IsEmpty()) - return false; - ////////////////////////////////////////////////////////////// - WNDCLASSEX wndcls; - memset(&wndcls, 0, sizeof(WNDCLASSEX)); - wndcls.cbSize = sizeof(WNDCLASSEX); - wndcls.style = CS_DBLCLKS;// | CS_HREDRAW | CS_VREDRAW; - wndcls.lpfnWndProc = ::DefWindowProc; - wndcls.hInstance = AfxGetInstanceHandle(); - if (m_IDMyIcon) - { - wndcls.hIcon = LoadIcon(m_IDMyIcon); - wndcls.hIconSm = (HICON)LoadImage(AfxGetInstanceHandle(), - MAKEINTRESOURCE(m_IDMyIcon), - IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), - 0); - if (wndcls.hIconSm == NULL) - { - ErrorMessage(_T("LoadImage failed")); - } - } - wndcls.hCursor = LoadStandardCursor(IDC_ARROW); - wndcls.hbrBackground = NULL; //(HBRUSH) (COLOR_WINDOW + 1); - wndcls.lpszMenuName = NULL; - // Specify our own class name for using FindWindow later to set focus to running app - wndcls.lpszClassName = m_sMyClassName; - WNDCLASSEX wndclsEx; - if (GetClassInfoEx(wndcls.hInstance, wndcls.lpszClassName, &wndclsEx)) - { - // class already registered - return true; - } - // Register new class and exit if it fails - if(!::RegisterClassEx(&wndcls)) - { - ErrorMessage(_T("Class Registration Failed")); - return false; - } - else - TRACE(_T("Window class %s was registered in CUIApp\n"),GetMyClass()); - m_bMyClassRegistered = true; - return true; -} - -BOOL CUIApp::FirstInstance() -{ - ASSERT(!m_sMyClassName.IsEmpty()); - if (m_sMyClassName.IsEmpty()) - return TRUE; - - CWnd *pWndPrev, *pWndChild; - // Determine if another window with our class name exists... - if (pWndPrev = CWnd::FindWindow(m_sMyClassName,NULL)) - { - // if so, does it have any popups? - pWndChild = pWndPrev->GetLastActivePopup(); - - // If iconic, restore the main window - if (pWndPrev->IsIconic()) - pWndPrev->ShowWindow(SW_RESTORE); - - // Bring the main window or its popup to - // the foreground - pWndChild->SetForegroundWindow(); - - // and we are done activating the previous one. - return FALSE; - } - return TRUE; -} - - -///////////////////////////////////////////////////////////////////////////// -// CUIApp initialization -void CUIApp::SetStatusBarText(UINT nPaneID,LPCTSTR Text,UINT nIconID) -{ - if (m_pMainWnd == NULL) - { - TRACE1("Warning: '%s' SetStatusBarText called before main frame created!\n",Text); - return; - } - CUIFrameWnd *pMainFrame = (CUIFrameWnd*)m_pMainWnd; - if (nIconID) - pMainFrame->GetStatusBar().AddIcon(nPaneID,nIconID,false); - pMainFrame->GetStatusBar().SetText(nPaneID,Text,true); -} - -void CUIApp::SetStatusBarText(LPCTSTR Text) -{ - SetStatusBarText(0,Text); -} - -void CUIApp::SetStatusBarText(UINT nPaneID,LPCTSTR Text,CView *pView,UINT nIconID) -{ - if (m_pMainWnd == NULL) - return; - if (((CFrameWnd*)m_pMainWnd)->GetActiveView() == pView) - SetStatusBarText(nPaneID,Text,nIconID); -} - -void CUIApp::SetStatusBarText(UINT nPaneID,UINT nResID,UINT nIconID) -{ - CString str; - str.LoadString(nResID); - SetStatusBarText(nPaneID,str,nIconID); -} - -void CUIApp::SetStatusBarIcon(UINT nPaneID,UINT nIconID,bool bAdd) -{ - if (m_pMainWnd == NULL) - return; - CUIFrameWnd *pMainFrame = (CUIFrameWnd*)m_pMainWnd; - if (bAdd) - pMainFrame->GetStatusBar().AddIcon(nPaneID,nIconID); - else - pMainFrame->GetStatusBar().RemoveIcon(nPaneID,nIconID); - pMainFrame->GetStatusBar().RedrawWindow(); -} - -void CUIApp::SetStatusBarIdleMessage() -{ - if (m_pMainWnd == NULL) - return; - CUIFrameWnd *pMainFrame = (CUIFrameWnd*)m_pMainWnd; - pMainFrame->GetStatusBar().RemoveAllIcons(0); - SetStatusBarText(0,AFX_IDS_IDLEMESSAGE); -} - -CDocument *CUIApp::GetDocument() -{ - CDocTemplate *pTempl = GetFirstDocTemplate(); - POSITION posDoc = pTempl->GetFirstDocPosition(); - CDocument *pDoc = pTempl->GetNextDoc(posDoc); - ASSERT(pDoc); - return pDoc; -} - -CView *CUIApp::GetView(CRuntimeClass *pClass) -{ - CDocTemplate *pTemplate = GetFirstDocTemplate(); - POSITION posDoc = pTemplate->GetFirstDocPosition(); - while (posDoc) - { - CDocument *pDoc = pTemplate->GetNextDoc(posDoc); - POSITION posView = pDoc->GetFirstViewPosition(); - while (posView) - { - CView *pView = pDoc->GetNextView(posView); - if (pView && pView->IsKindOf(pClass)) - return pView; - } - } - return NULL; -} - -void CUIApp::ChangeProfile(LPCTSTR szRegistryKey,LPCTSTR szProfileName) -{ - m_strOldProfileName = m_pszProfileName; - m_strOldRegistryKey = m_pszRegistryKey; - free((void*)m_pszRegistryKey); - m_pszRegistryKey = _tcsdup(szRegistryKey); - free((void*)m_pszProfileName); - m_pszProfileName = _tcsdup(szProfileName); -} - -void CUIApp::RestoreProfile() -{ - if (!m_strOldProfileName.IsEmpty()) - { - free((void*)m_pszProfileName); - m_pszProfileName = _tcsdup(m_strOldProfileName); - } - if (!m_strOldRegistryKey.IsEmpty()) - { - free((void*)m_pszRegistryKey); - m_pszRegistryKey = _tcsdup(m_strOldRegistryKey); - } -} - -///////////////////////////////////////////////////////////////////////////// -// CAppReg -// Tricks MFC into using another application key -// useful if in HKEY_CURRENT_USER -CAppReg::CAppReg(CWinApp *pApp,LPCTSTR szRegistryKey,LPCTSTR szProfileName) -{ - ASSERT(pApp); - m_pApp = (CUIApp*)pApp; - m_pApp->ChangeProfile(szRegistryKey,szProfileName); -} - -CAppReg::~CAppReg() -{ - ASSERT(m_pApp); - m_pApp->RestoreProfile(); -} - -//static -bool CUIApp::COMMessage(HRESULT hr,UINT nID) -{ - CString sMess; - sMess.LoadString(nID); - return COMMessage(hr,sMess); -} - -bool CUIApp::COMMessage(HRESULT hr,LPCTSTR szText) -{ - if (FAILED(hr)) - { - ErrorMessage(szText,(DWORD)hr); - return false; - } - return true; -} - -void CUIApp::ErrorMessage(UINT nID,DWORD dwError) -{ - CString sMess; - sMess.LoadString(nID); - ErrorMessage(sMess); -} - -void CUIApp::ErrorMessage(LPCTSTR szText,DWORD dwError) -{ - bool bError=true; - if (dwError == 0) - { - dwError = GetLastError(); - bError = true; - } - else - { - bError = FAILED(dwError); - } - LPVOID lpMsgBuf=NULL; - if (bError) - { - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - } - // Process any inserts in lpMsgBuf. - // ... - // Display the string. - CString sMess; - if (lpMsgBuf) - { - sMess = (LPCTSTR)lpMsgBuf; - sMess += _T("\n"); - LocalFree( lpMsgBuf ); - } - if (szText) - { - sMess += szText; - } - AfxMessageBox(sMess, MB_ICONSTOP ); -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICONT.CPP b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICONT.CPP deleted file mode 100644 index 446366121d4..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICONT.CPP +++ /dev/null @@ -1,77 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIData.h" -#include "UICont.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char BASED_CODE THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CListObList - -IMPLEMENT_SERIAL(CUIObjList, CObList, 0) - -CUIObjList::CUIObjList() -{ -} - -CUIObjList::~CUIObjList() -{ - DeleteAll(); -} - - -///////////////////////////////////////////////////////////////////////////// -// CListObList commands - -// Delete al objects in the list -void CUIObjList::DeleteAll() -{ - while(!IsEmpty()) - { - CUIListCtrlData* ptr = RemoveHead(); - if (ptr->GetAutoDelete()) - { - CObject *p =(CObject*)ptr->GetExtData(); - ASSERT_KINDOF(CObject,p); - delete p; - } - delete ptr; - } -} - -// Add a new object to the end of the list -void CUIObjList::Append(CUIListCtrlData* pListObj) -{ - ASSERT(pListObj); - ASSERT(pListObj->IsKindOf(RUNTIME_CLASS(CUIListCtrlData))); - POSITION pos = CObList::AddTail(pListObj); -} - -// Remove an object from the list but don't delete it -BOOL CUIObjList::Remove(CUIListCtrlData* pListObj) -{ - POSITION pos = Find(pListObj); - if (!pos) - return FALSE; - RemoveAt(pos); - return TRUE; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolBar.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolBar.cpp deleted file mode 100644 index 093b928c7f4..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolBar.cpp +++ /dev/null @@ -1,237 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CCoolBar implements coolbars for MFC. -// -#include "StdAfx.h" -#include "UICoolBar.h" -#include "UIModulVer.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// if you want to see extra TRACE diagnostics, set below to TRUE -BOOL CCoolBar::bTRACE = FALSE; - -#ifdef _DEBUG -#define CBTRACEFN \ - CTraceFn __fooble; \ - if (bTRACE) \ - TRACE -#define CBTRACE \ - if (bTRACE) \ - TRACE -#else -#define CBTRACEFN TRACE -#define CBTRACE TRACE -#endif - -IMPLEMENT_DYNAMIC(CCoolBar, CControlBar) - -BEGIN_MESSAGE_MAP(CCoolBar, CControlBar) - //{{AFX_MSG_MAP(CCoolBar) - ON_WM_CREATE() - ON_WM_PAINT() - ON_WM_ERASEBKGND() - ON_NOTIFY_REFLECT(RBN_HEIGHTCHANGE, OnHeightChange) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -CCoolBar::CCoolBar() -{ -} - -CCoolBar::~CCoolBar() -{ -} - -////////////////// -// Create coolbar -// -BOOL CCoolBar::Create(CWnd* pParentWnd, DWORD dwStyle, - DWORD dwAfxBarStyle, UINT nID) -{ - ASSERT_VALID(pParentWnd); // must have a parent - - // dynamic coolbar not supported - dwStyle &= ~CBRS_SIZE_DYNAMIC; - - // save the style (this code copied from MFC--probably unecessary) - m_dwStyle = dwAfxBarStyle; - if (nID == AFX_IDW_TOOLBAR) - m_dwStyle |= CBRS_HIDE_INPLACE; - - // MFC requires these: - dwStyle |= CCS_NODIVIDER|CCS_NOPARENTALIGN; - - // initialize cool common controls - static BOOL bInit = FALSE; - if (!bInit) { - HMODULE h = ::GetModuleHandle(_T("ComCtl32")); - ASSERT(h); - - typedef BOOL (CALLBACK* INITCC)(INITCOMMONCONTROLSEX*); - INITCC pfn = (INITCC)GetProcAddress(h, "InitCommonControlsEx"); - if (pfn) { - INITCOMMONCONTROLSEX sex; - sex.dwSize = sizeof(INITCOMMONCONTROLSEX); - sex.dwICC = ICC_COOL_CLASSES; - (*pfn)(&sex); - } - bInit = TRUE; - } - - // Finally create the cool bar using given style and parent. - CRect rc; - rc.SetRectEmpty(); - return CWnd::CreateEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, - dwStyle, rc, pParentWnd, nID); -} - -////////////////// -// Invalidate coolbar: invalidate children too -// -void CCoolBar::Invalidate(BOOL bErase) -{ - HWND hWndChild = ::GetWindow(m_hWnd, GW_CHILD); - while (hWndChild != NULL) { - ::InvalidateRect(hWndChild, NULL, bErase); - hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT); - } - CControlBar::Invalidate(bErase); -} - -////////////////// -// Set the background bitmap. This sets the background for all bands and -// sets the RBBS_FIXEDBMP style so it looks like one background. -// -void CCoolBar::SetBackgroundBitmap(CBitmap* pBitmap) -{ - HBITMAP hbm = (HBITMAP)pBitmap->GetSafeHandle(); - CRebarBandInfo rbbi; - int n = GetBandCount(); - for (int i=0; i< n; i++) { - rbbi.fMask = RBBIM_STYLE; - GetBandInfo(i, &rbbi); - rbbi.fMask |= RBBIM_BACKGROUND; - rbbi.fStyle |= RBBS_FIXEDBMP; - rbbi.hbmBack = hbm; - SetBandInfo(i, &rbbi); - } -} - -////////////////// -// Set background/foreground colors for all bands -// -void CCoolBar::SetColors(COLORREF clrFG, COLORREF clrBG) -{ - CRebarBandInfo rbbi; - rbbi.fMask = RBBIM_COLORS; - rbbi.clrFore = clrFG; - rbbi.clrBack = clrBG; - int n = GetBandCount(); - for (int i=0; i< n; i++) - SetBandInfo(i, &rbbi); -} - -////////////////// -// Insert band. This overloaded version lets you create a child window band. -// -BOOL CCoolBar::InsertBand(CWnd* pWnd, CSize szMin, int cx, - LPCTSTR lpText, int iPos, BOOL bNewRow) -{ - CRebarBandInfo rbbi; - rbbi.fMask = RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_TEXT; - if (cx>0) { - rbbi.fMask |= RBBIM_SIZE; - rbbi.cx = cx; - } - if (bNewRow) { - rbbi.fMask |= RBBIM_STYLE; - rbbi.fStyle |= RBBS_BREAK; - } - rbbi.hwndChild = pWnd->GetSafeHwnd(); - rbbi.cxMinChild = szMin.cx; - rbbi.cyMinChild = szMin.cy; - rbbi.lpText = (LPTSTR)lpText; - return InsertBand(iPos, &rbbi); -} - -////////////////// -// Handle WM_CREATE: call virtual fn so derived class can create bands. -// -int CCoolBar::OnCreate(LPCREATESTRUCT lpcs) -{ - return (CControlBar::OnCreate(lpcs)==-1 || !OnCreateBands()) ? -1 : 0; -} - -////////////////// -// Standard UI handler updates any controls in the coolbar. -// -void CCoolBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) -{ - UpdateDialogControls(pTarget, bDisableIfNoHndler); -} - -///////////////// -// These two functions are called by MFC to calculate the layout of -// the main frame. Since CCoolBar is not designed to be dynamic, the -// size is always fixed, and the same as the window size. -// -CSize CCoolBar::CalcDynamicLayout(int nLength, DWORD dwMode) -{ - return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZ); -} - -CSize CCoolBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) -{ - CRect rc; - GetWindowRect(&rc); - CSize sz(bHorz && bStretch ? 0x7FFF : rc.Width(), - !bHorz && bStretch ? 0x7FFF : rc.Height()); - return sz; -} - -////////////////// -// Handle RBN_HEIGHTCHANGE notification: pass to virtual fn w/nicer args. -// -void CCoolBar::OnHeightChange(NMHDR* pNMHDR, LRESULT* pRes) -{ - CRect rc; - GetWindowRect(&rc); - OnHeightChange(rc); - *pRes = 0; // why not? -} - -////////////////// -// Height changed: Default implementation does the right thing for MFC -// doc/view: notify parent frame by posting a WM_SIZE message. This will -// cause the frame to do RecalcLayout. The message must be posted, not sent, -// because the coolbar could send RBN_HEIGHTCHANGE while the user is sizing, -// which would be in the middle of a CFrame::RecalcLayout, and RecalcLayout -// doesn't let you re-enter it. Posting guarantees that CFrameWnd can finish -// any recalc it may be in the middle of *before* handling my posted WM_SIZE. -// Very confusing, but that's MFC for you. -// -void CCoolBar::OnHeightChange(const CRect& rcNew) -{ - CWnd* pParent = GetParent(); - CRect rc; - pParent->GetWindowRect(&rc); - pParent->PostMessage(WM_SIZE, 0, MAKELONG(rc.Width(),rc.Height())); -} - -void CCoolBar::OnPaint() -{ - Default(); // bypass CControlBar -} - -BOOL CCoolBar::OnEraseBkgnd(CDC* pDC) -{ - return (BOOL)Default(); // bypass CControlBar -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolMenu.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolMenu.cpp deleted file mode 100644 index b67a47dee91..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UICoolMenu.cpp +++ /dev/null @@ -1,1497 +0,0 @@ -//////////////////////////////////////////////////////////////// -// CoolMenu 1997 Microsoft Systems Journal. -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// ========================================================================== -// HISTORY: -// ========================================================================== -// 1.01 13 Aug 1998 - Andrew Bancroft [ABancroft@lgc.com] - Since we've already -// added the entire toolbar to the imagelist we need to -// increment nNextImage even if we didn't add this button to -// m_mapIDtoImage in the LoadToolbar() method. -// 1.01a 13 Aug 1998 - Peter Tewkesbury - Added AddSingleBitmap(...) -// method for adding a single bitmap to a pulldown -// menu item. -// 1.02 13 Aug 1998 - Omar L Francisco - Fixed bug with lpds->CtlType -// and lpds->itemData item checking. -// 1.03 12 Nov 1998 - Fixes debug assert in system menu. - Wang Jun -// 1.04 17 Nov 1998 - Fixes debug assert when you maximize a view - Wang Jun -// window, then try to use the system menu for the view. -// 1.05 09 Jan 1998 - Seain B. Conover [sc@tarasoft.com] - Fix for virtual -// key names. -// 1.06 24 Feb 1999 - Michael Lange [michael.home@topdogg.com] - Fix for memory -// leak in CMyItemData structure, added a destructor that -// calls text.Empty(). -// - Boris Kartamishev [kbv@omegasoftware.com] - Fix for resource -// ID bug. -// - Jeremy Horgan [jeremyhorgan@hotmail.com] - During -// accelerator key processing OnInitMenuPopup() calls -// ConvertMenu() which allocates a new CMyItemData for each -// menu item. This is memory is normally freed by a call to -// OnMenuSelect(), which is not called when processing -// accelerator keys. This results in a memory leak. This was -// fixed by modifying the ~CCoolMenuManager() destructor. -// 1.07 24 Feb 1999 - Koji MATSUNAMI [kmatsu@inse.co.jp] - Fixed problem with -// popup menus being drawn correctly as cool menus. -// 1.08 7 Jul 2000 - Philip Oldaker [philip@masmex.com] - Added support for -// IContextMenu2 as used by the windows shell for owner draw menus -// ========================================================================== -// -///////////////////////////////////////////////////////////////////////////// - -#include "StdAfx.h" -#include "UICoolMenu.h" - -#include - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#define safe_delete(p){if(p){delete p;p=NULL;}} - -#define USES_ICON -2 - -CCoolMenuManager g_CoolMenuManager; - -// helpers -void PLFillRect(CDC& dc, const CRect& rc, COLORREF color); -void PLDrawEmbossed(CDC& dc, CImageList& il, int i, - CPoint p, BOOL bColor=FALSE); -HBITMAP PLLoadSysColorBitmap(LPCTSTR lpResName, BOOL bMono=FALSE); -inline HBITMAP PLLoadSysColorBitmap(UINT nResID, BOOL bMono=FALSE) { - return PLLoadSysColorBitmap(MAKEINTRESOURCE(nResID), bMono); -} - -// if you want to see extra TRACE diagnostics, set below to TRUE -BOOL CCoolMenuManager::bTRACE = FALSE; - -#ifdef _DEBUG -#define CMTRACEFN \ - CTraceFn __fooble; \ - if (bTRACE) \ - TRACE -#define CMTRACE \ - if (bTRACE) \ - TRACE -#else -#define CMTRACEFN TRACE -#define CMTRACE TRACE -#endif - -// constants used for drawing -const CXGAP = 1; // num pixels between button and text -const CXTEXTMARGIN = 2; // num pixels after hilite to start text -const CXBUTTONMARGIN = 2; // num pixels wider button is than bitmap -const CYBUTTONMARGIN = 2; // ditto for height - -// DrawText flags -const DT_MYSTANDARD = DT_SINGLELINE|DT_LEFT|DT_VCENTER; - -// identifies owner-draw data as mine -const LONG MYITEMID = MAKELONG(MAKEWORD(_T('m'),_T('i')),MAKEWORD(_T('d'),_T('0'))); - -// private struct: one of these for each owner-draw menu item -struct CMyItemData { - long magicNum; // magic number identifying me - CString text; // item text - UINT fType; // original item type flags - int iButton; // index of button image in image list (or USES_ICON) - HICON hIcon; - void * pContext; // item data - LPCONTEXTMENU lpcm; // if set this will handle menu messages (windows shell) - CMyItemData() { lpcm=NULL; magicNum = MYITEMID; iButton = -1; hIcon = 0; pContext = NULL; } - ~CMyItemData() { text.Empty(); if (hIcon) ::DestroyIcon(hIcon); if (lpcm) lpcm->Release(); } - BOOL IsMyItemData() { return this != NULL && magicNum == MYITEMID; } -}; - -static CMyItemData *GetMyItemData(HMENU hMenu, UINT uItem, - BOOL bByPosition = FALSE) -{ - MENUITEMINFO mii; - ZeroMemory(&mii,sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA; - ::GetMenuItemInfo(hMenu, uItem, bByPosition, &mii); - return (CMyItemData *)mii.dwItemData; -} - -static void SetMyItemData(CMyItemData *pmd, HMENU hMenu, UINT uItem, - BOOL bByPosition = FALSE) -{ - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA; - mii.dwItemData = (DWORD)pmd; - ::SetMenuItemInfo(hMenu, uItem, bByPosition, &mii); -} - - -IMPLEMENT_DYNAMIC(CCoolMenuManager, CSubclassWnd) - -CCoolMenuManager::CCoolMenuManager() -{ - m_lpcm = NULL; - m_szBitmap = CSize(0,0); // will compute later - m_szButton = CSize(0,0); - m_bShowButtons = TRUE; // show buttons by default - m_bAutoAccel = TRUE; // auto accelerators by default - m_pAccel = NULL; // no accelerators loaded yet - m_bUseDrawState = FALSE; // use DrawEmbossed by default - m_bDrawDisabledButtonsInColor = FALSE; // use color for disabled buttons - FixMFCDotBitmap(); -} - -CCoolMenuManager::~CCoolMenuManager() -{ - // Jeremy Horgan [jeremyhorgan@hotmail.com] - - while (!m_menuList.IsEmpty()) - { - UnconvertMenu(CMenu::FromHandle((HMENU)m_menuList.RemoveHead())); - } - - Destroy(); -} - -////////////////// -// Destroy everything. Called from destructor and Refresh. -// -void CCoolMenuManager::Destroy() -{ - m_ilButtons.DeleteImageList(); - m_ilTemp.DeleteImageList(); - m_mapIDtoImage.RemoveAll(); - m_mapHMENUtoID.RemoveAll(); - m_szBitmap = m_szButton = CSize(0,0); - m_arToolbarID.RemoveAll(); - m_fontMenu.DeleteObject(); - DestroyAccel(); -} - -///////////////// -// Destroy accelerators -// -void CCoolMenuManager::DestroyAccel() -{ - m_mapIDtoAccel.RemoveAll(); // delete ACCEL entries in map - safe_delete(m_pAccel); // delete current accelerators -} - -////////////////// -// Call this to install the menu manager. Install(NULL) to un-install. -// -void CCoolMenuManager::Install(CWnd* pFrame) -{ - m_pFrame = pFrame; - HookWindow(pFrame); // install message hook -} - -void CCoolMenuManager::Uninstall() -{ - m_pFrame = NULL; - HookWindow((HWND)NULL); -} - -// Addition: Phliip Oldaker -// call this to enable help text on the status bar -void CCoolMenuManager::SetShellContextMenu(LPCONTEXTMENU lpcm,UINT nIDFirst,UINT nIDLast) -{ - m_lpcm = lpcm; - m_idShellMenuFirst = nIDFirst; - m_idShellMenuLast = nIDLast; -} - -////////////////// -// Load array of toolbar IDs. -// -BOOL CCoolMenuManager::LoadToolbars(const UINT* arID, int n) -{ - ASSERT(arID); - BOOL bRet = TRUE; - for (int i=0; iwVersion==1); - - // OK, I have the bitmap and toolbar. - - CSize sz(ptbd->wWidth, ptbd->wHeight); - if (m_szBitmap.cx==0) { - // First toolbar: initialized bitmap/button sizes and create image list. - m_szBitmap = sz; - m_szButton = sz + CSize(CXBUTTONMARGIN<<1, CYBUTTONMARGIN<<1); - VERIFY(m_ilButtons.Create(sz.cx, sz.cy, ILC_COLOR32|ILC_MASK, 0, 10)); - VERIFY(m_ilTemp. Create(sz.cx, sz.cy, ILC_COLOR32|ILC_MASK, 0, 10)); - - } else if (m_szBitmap != sz) { - // button sizes different -- oops - TRACE(_T("*** Toolbar %d button size differs!\n"), nIDToolbar); - return FALSE; - } - - m_ilButtons.SetBkColor(::GetSysColor(COLOR_3DFACE)); - - // I have a good toolbar: now add bitmap to the image list, and each - // command ID to m_mapIDtoImage array. Note that LoadSysColorBitmap will - // change gray -> COLOR_3DFACE, so use that for image list background. - // - int iNextImage = m_ilButtons.GetImageCount(); - m_ilButtons.Add(CBitmap::FromHandle(hbmToolbar), GetSysColor(COLOR_3DFACE)); - for (int i = 0; i < ptbd->wItemCount; i++) { - UINT nID = ptbd->items[i]; - if (nID > 0) { - if (GetButtonIndex(nID) >= 0) { - TRACE(_T("*** Duplicate button ID %d ignored\n"), nID); - } else { - m_mapIDtoImage.SetAt(nID, (void*)iNextImage); - TRACE(_T("CCoolMenuManager::LoadToolbar(). Added Menu Id %d, Button Number %d\n"), nID, iNextImage-1); - } - // AB. 13-08-98. Since we've already added the entire toolbar to the imagelist - // we need to increment nNextImage even if we didn't add this button to - // m_mapIDtoImage. - iNextImage++; - } - } - m_arToolbarID.Add(nIDToolbar); // remember toolbar ID for Refresh - ::DeleteObject(hbmToolbar); - return TRUE; // success! -} - -////////////////// -// Virtual CCoolMenuSubclassWnd window proc. All messages come here before frame -// window. Isn't it cool? Just like in the old days! -// -LRESULT CCoolMenuManager::WindowProc(UINT msg, WPARAM wp, LPARAM lp) -{ - switch(msg) { - case WM_SYSCOLORCHANGE: - case WM_SETTINGCHANGE: - Refresh(); - break; - - case WM_MEASUREITEM: - if (OnMeasureItem((MEASUREITEMSTRUCT*)lp)) - return TRUE; // handled - break; - - case WM_DRAWITEM: - if (OnDrawItem((DRAWITEMSTRUCT*)lp)) - return TRUE; // handled - break; - - case WM_INITMENUPOPUP: - // Very important: must let frame window handle it first! - // Because if someone calls CCmdUI::SetText, MFC will change item to - // MFT_STRING, so I must change back to MFT_OWNERDRAW. - // - CSubclassWnd::WindowProc(msg, wp, lp); - OnInitMenuPopup(CMenu::FromHandle((HMENU)wp), - /*(UINT)LOWORD(lp)*/0, (BOOL)HIWORD(lp)); - return 0; - - case WM_MENUSELECT: - OnMenuSelect((UINT)LOWORD(wp), (UINT)HIWORD(wp), (HMENU)lp); - break; - - case WM_MENUCHAR: - LRESULT lr = OnMenuChar((TCHAR)LOWORD(wp), (UINT)HIWORD(wp), - CMenu::FromHandle((HMENU)lp)); - if (lr!=0) - return lr; - break; - } - return CSubclassWnd::WindowProc(msg, wp, lp); -} - -////////////////// -// Refresh all colors, fonts, etc. For WM_SETTINGCHANGE, WM_SYSCOLORCHANGE. -// -void CCoolMenuManager::Refresh() -{ - // first copy list (array) of toolbar IDs now loaded. - CUIntArray arToolbarID; - arToolbarID.Copy(m_arToolbarID); - - // destroy everything - Destroy(); - - // re-load toolbars. - int nToolbars = arToolbarID.GetSize(); - for (int i = 0; i < nToolbars; i++) - LoadToolbar(arToolbarID[i]); -} - -////////////////// -// Get menu font, creating if needed -// -CFont* CCoolMenuManager::GetMenuFont() -{ - if (!(HFONT)m_fontMenu) { - NONCLIENTMETRICS info; - info.cbSize = sizeof(info); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - VERIFY(m_fontMenu.CreateFontIndirect(&info.lfMenuFont)); - } - return &m_fontMenu; -} - -////////////////// -// Handle WM_MEASUREITEM on behalf of frame: compute menu item size. -// -BOOL CCoolMenuManager::OnMeasureItem(LPMEASUREITEMSTRUCT lpms) -{ - ASSERT(lpms); - CMyItemData* pmd = (CMyItemData*)lpms->itemData; - ASSERT(pmd); - if (lpms->CtlType != ODT_MENU || !pmd->IsMyItemData()) - return FALSE; // not handled by me - // Addition: Philip Oldaker - // Pass it on to the shell if lpcm has been set - if (pmd->lpcm) - { - IContextMenu2 *lpcm2=NULL; - HRESULT hr = pmd->lpcm->QueryInterface(IID_IContextMenu2,(LPVOID*)&lpcm2); - if (SUCCEEDED(hr)) - { - // switch context item data - lpms->itemData = (DWORD)pmd->pContext; - lpcm2->HandleMenuMsg(WM_MEASUREITEM,0,(LPARAM)lpms); - // clean up - lpms->itemData = (DWORD)pmd; - lpcm2->Release(); - } - return TRUE; - } - ///////////////////// - if (pmd->fType & MFT_SEPARATOR) { - // separator: use half system height and zero width - lpms->itemHeight = GetSystemMetrics(SM_CYMENU)>>1; - lpms->itemWidth = 0; - - } else { - - // compute size of text: use DrawText with DT_CALCRECT - - CWindowDC dc(NULL); // screen DC--I won't actually draw on it - CRect rcText(0,0,0,0); - CFont* pOldFont = dc.SelectObject(GetMenuFont()); - dc.DrawText(pmd->text, rcText, DT_MYSTANDARD|DT_CALCRECT); - dc.SelectObject(pOldFont); - - // height of item is just height of a standard menu item - lpms->itemHeight= max(GetSystemMetrics(SM_CYMENU), rcText.Height()); - - // width is width of text plus a bunch of stuff - int cx = rcText.Width(); // text width - cx += CXTEXTMARGIN<<1; // L/R margin for readability - cx += CXGAP; // space between button and menu text - cx += m_szButton.cx<<1; // button width (L=button; R=empty margin) - - // whatever value I return in lpms->itemWidth, Windows will add the - // width of a menu checkmark, so I must subtract to defeat Windows. Argh. - // - cx -= GetSystemMetrics(SM_CXMENUCHECK)-1; - lpms->itemWidth = cx; // done deal - - CMTRACE(_T("OnMeasureItem for '%s':\tw=%d h=%d\n"), (LPCTSTR)pmd->text, - lpms->itemWidth, lpms->itemHeight); - } - return TRUE; // handled -} - -///////////////// -// Handle WM_DRAWITEM on behalf of frame. Note: in all that goes -// below, can't assume rcItem.left=0 because of multi-column menus! -// -BOOL CCoolMenuManager::OnDrawItem(LPDRAWITEMSTRUCT lpds) -{ - ASSERT(lpds); - - // Omar L Francisco - if (lpds->CtlType != ODT_MENU) - return FALSE; - - // Omar L Francisco - CMyItemData* pmd = (CMyItemData*)lpds->itemData; - if (!pmd->IsMyItemData()) - return FALSE; - // Addition: Philip Oldaker - // Pass it on to the shell if this has been set - if (pmd->lpcm) - { - IContextMenu2 *lpcm2=NULL; - HRESULT hr = pmd->lpcm->QueryInterface(IID_IContextMenu2,(LPVOID*)&lpcm2); - if (SUCCEEDED(hr)) - { - lpds->itemData = (DWORD)pmd->pContext; - lpcm2->HandleMenuMsg(WM_DRAWITEM,0,(LPARAM)lpds); - lpds->itemData = (DWORD)pmd; - lpcm2->Release(); - } - return TRUE; - } - //////////////////////////////// - ASSERT(lpds->itemAction != ODA_FOCUS); - ASSERT(lpds->hDC); - CDC dc; - dc.Attach(lpds->hDC); - - const CRect& rcItem = lpds->rcItem; - if (pmd->fType & MFT_SEPARATOR) { - // draw separator - CRect rc = rcItem; // copy rect - rc.top += rc.Height()>>1; // vertical center - dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line - - } else { // not a separator - - CMTRACE(_T("OnDrawItem for '%s':\tw=%d h=%d\n"), (LPCTSTR)pmd->text, - rcItem.Width(), rcItem.Height()); - - BOOL bDisabled = lpds->itemState & ODS_GRAYED; - BOOL bSelected = lpds->itemState & ODS_SELECTED; - BOOL bChecked = lpds->itemState & ODS_CHECKED; - BOOL bHaveButn=FALSE; - - // Paint button, or blank if none - CRect rcButn(rcItem.TopLeft(), m_szButton); // button rect - rcButn += CPoint(0, // center vertically - (rcItem.Height() - rcButn.Height())>>1 ); - - int iButton = pmd->iButton; - if (iButton >= 0 || iButton == USES_ICON) - { - // this item has a button! - bHaveButn = TRUE; - - // compute point to start drawing - CSize sz = rcButn.Size() - m_szBitmap; - sz.cx >>= 1; - sz.cy >>= 1; - CPoint p(rcButn.TopLeft() + sz); - - // draw disabled or normal - if (!bDisabled) { - // normal: fill BG depending on state - PLFillRect(dc, rcButn, GetSysColor( - (bChecked && !bSelected) ? COLOR_3DLIGHT : COLOR_MENU)); - - // draw pushed-in or popped-out edge - if (bSelected || bChecked) { - CRect rc2 = rcButn; - dc.DrawEdge(rc2, bChecked ? BDR_SUNKENOUTER : BDR_RAISEDINNER, - BF_RECT); - } - - // draw the button! - if (iButton != USES_ICON) - { - m_ilButtons.Draw(&dc, iButton, p, ILD_TRANSPARENT); - } - else - { - dc.DrawState(p, CSize(0,0), pmd->hIcon, DSS_NORMAL, - (HBRUSH)NULL); - } - - } else if (m_bUseDrawState) { - // use DrawState to draw disabled button: must convert to icon - if (iButton != USES_ICON) - { - HICON hIcon=m_ilButtons.ExtractIcon(iButton); - ASSERT(hIcon); - dc.DrawState(p, CSize(0,0), hIcon, DSS_DISABLED, (HBRUSH)NULL); - DestroyIcon(hIcon); - } - else - { - dc.DrawState(p, CSize(0,0), pmd->hIcon, DSS_DISABLED, - (HBRUSH)NULL); - } - } else - // use DrawEmbossed to draw disabeld button, w/color flag - if (iButton != USES_ICON) - { - PLDrawEmbossed(dc, m_ilButtons, iButton, p, - m_bDrawDisabledButtonsInColor); - } - else - { - int i = m_ilTemp.Add(pmd->hIcon); - PLDrawEmbossed(dc, m_ilTemp, i, p, - m_bDrawDisabledButtonsInColor); - m_ilTemp.Remove(i); - } - } else { - // no button: look for custom checked/unchecked bitmaps - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS; - GetMenuItemInfo((HMENU)lpds->hwndItem, - lpds->itemID, MF_BYCOMMAND, &info); - if (bChecked || info.hbmpUnchecked) { - bHaveButn = Draw3DCheckmark(dc, rcButn, bSelected, - bChecked ? info.hbmpChecked : info.hbmpUnchecked); - } - } - - // Done with button, now paint text. First do background if needed. - int cxButn = m_szButton.cx; // width of button - COLORREF colorBG = GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - if (bSelected || lpds->itemAction==ODA_SELECT) { - // selected or selection state changed: paint text background - CRect rcBG = rcItem; // whole rectangle - if (bHaveButn) // if there's a button: - rcBG.left += cxButn + CXGAP; // don't paint over it! - PLFillRect(dc, rcBG, colorBG); // paint it! - } - - // compute text rectangle and colors - CRect rcText = rcItem; // start w/whole item - rcText.left += cxButn + CXGAP + CXTEXTMARGIN; // left margin - rcText.right -= cxButn; // right margin - dc.SetBkMode(TRANSPARENT); // paint transparent text - COLORREF colorText = GetSysColor(bDisabled ? COLOR_GRAYTEXT : - bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT); - - // Now paint menu item text. No need to select font, - // because windows sets it up before sending WM_DRAWITEM - // - if (bDisabled && (!bSelected || colorText == colorBG)) { - // disabled: draw hilite text shifted southeast 1 pixel for embossed - // look. Don't do it if item is selected, tho--unless text color same - // as menu highlight color. Got it? - // - DrawMenuText(dc, rcText + CPoint(1,1), pmd->text, - GetSysColor(COLOR_3DHILIGHT)); - } - DrawMenuText(dc, rcText, pmd->text, colorText); // finally! - } - dc.Detach(); - - return TRUE; // handled -} - -///////////////// -// Helper function to draw justified menu text. If the text contains a TAB, -// draw everything after the tab right-aligned -// -void CCoolMenuManager::DrawMenuText(CDC& dc, CRect rc, CString text, - COLORREF color) -{ - CString left = text; - CString right; - int iTabPos = left.Find(_T('\t')); - if (iTabPos >= 0) { - right = left.Right(left.GetLength() - iTabPos - 1); - left = left.Left(iTabPos); - } - dc.SetTextColor(color); - dc.DrawText(left, &rc, DT_MYSTANDARD); - if (iTabPos > 0) - dc.DrawText(right, &rc, DT_MYSTANDARD|DT_RIGHT); -} - -#ifndef OBM_CHECK -#define OBM_CHECK 32760 // from winuser.h -#endif - -////////////////// -// Draw 3D checkmark -// -// dc device context to draw in -// rc rectangle to center bitmap in -// bSelected TRUE if button is also selected -// hbmCheck Checkmark bitmap to use, or NULL for default -// -BOOL CCoolMenuManager::Draw3DCheckmark(CDC& dc, const CRect& rc, - BOOL bSelected, HBITMAP hbmCheck) -{ - // get checkmark bitmap if none, use Windows standard - if (!hbmCheck) { - CBitmap bm; - VERIFY(bm.LoadOEMBitmap(OBM_CHECK)); - hbmCheck = (HBITMAP)bm.Detach(); - ASSERT(hbmCheck); - } - - // center bitmap in caller's rectangle - BITMAP bm; - ::GetObject(hbmCheck, sizeof(bm), &bm); - int cx = bm.bmWidth; - int cy = bm.bmHeight; - CRect rcDest = rc; - CPoint p(0,0); - CSize delta(CPoint((rc.Width() - cx)/2, (rc.Height() - cy)/2)); - if (rc.Width() > cx) - rcDest = CRect(rc.TopLeft() + delta, CSize(cx, cy)); - else - p -= delta; - - // select checkmark into memory DC - CDC memdc; - memdc.CreateCompatibleDC(&dc); - HBITMAP hOldBM = (HBITMAP)::SelectObject(memdc, hbmCheck); - - // set BG color based on selected state - COLORREF colorOld = - dc.SetBkColor(GetSysColor(bSelected ? COLOR_MENU : COLOR_3DLIGHT)); - dc.BitBlt(rcDest.left, rcDest.top, rcDest.Width(), rcDest.Height(), - &memdc, p.x, p.y, SRCCOPY); - dc.SetBkColor(colorOld); - - ::SelectObject(memdc, hOldBM); // restore - - // draw pushed-in hilight. - if (rc.Width() > cx) // if room: - rcDest.InflateRect(1,1); // inflate checkmark by one pixel all around - dc.DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT); - - return TRUE; -} - -////////////////// -// Handle WM_INITMENUPOPUP on behalf of frame. -// -void CCoolMenuManager::OnInitMenuPopup(CMenu* pMenu, - UINT nIndex, BOOL bSysMenu) -{ - // Addition: Philip Oldaker - ///////////////////////// - // Let the shell handle it - if (bSysMenu) - return; - for(UINT i=0;i < pMenu->GetMenuItemCount();i++) - { - CMyItemData* pmd = GetMyItemData(*pMenu,i,TRUE); - if (pmd->IsMyItemData() && pmd->lpcm) - { - IContextMenu2 *lpcm2=NULL; - HRESULT hr = pmd->lpcm->QueryInterface(IID_IContextMenu2,(LPVOID*)&lpcm2); - if (SUCCEEDED(hr)) - { - SetMyItemData((CMyItemData*)pmd->pContext,*pMenu,i,TRUE); - lpcm2->HandleMenuMsg(WM_INITMENUPOPUP,(WPARAM)pMenu->GetSafeHmenu(),0); - SetMyItemData(pmd,*pMenu,i,TRUE); - lpcm2->Release(); - } - return; - } - } - ////////////////////// - if (m_bAutoAccel) - { - // check for new accels. If ASSERT bombs, - // you forgot to call Install. -// ASSERT_VALID(m_pFrame); - -// HACCEL hAccel = m_pFrame->GetDefaultAccelerator(); - HACCEL hAccel = NULL; - - if (hAccel != m_hAccel) - LoadAccel(hAccel); - - // 12 Nov 1998 - Wang Jun - Fixes debug assert in system menu. - // Check if click system menu. - if (!bSysMenu) { - ConvertMenu(pMenu, nIndex, bSysMenu, m_bShowButtons); - } - } - ConvertMenu(pMenu, nIndex, bSysMenu, m_bShowButtons); -} - -////////////////// -// Set the accelerator table used to generate automatic key -// names in menus. Delete previous table if any. -// -void CCoolMenuManager::LoadAccel(HACCEL hAccel) -{ - DestroyAccel(); - int nAccel; - if (hAccel && (nAccel = CopyAcceleratorTable(hAccel, NULL, 0)) > 0) { - m_pAccel = new ACCEL [nAccel]; - ASSERT(m_pAccel); - CopyAcceleratorTable(hAccel, m_pAccel, nAccel); - - // Now I have the accelerators. Look over list, linking each command - // ID with its ACCEL structure--i.e., m_mapIDtoAccel[nID] = ACCEL for - // that ID. If more than one ACCEL for a given command (command has more - // than one shortcut), fix up so ACCEL.cmd is offset of prev ACCEL - // - for (int i=0; iGetSubMenu(iIndex), 0, FALSE, !bUnconvert); - } - - if ((info.fType & MFT_OWNERDRAW) && pmd && !pmd->IsMyItemData()) { - CMTRACE(_T("CCoolMenuManager: ignoring foreign owner-draw item\n")); - return; - // owner-draw menu item isn't mine--leave it alone - } - -/* // Koji MATSUNAMI 1999.2.23 - // - if (bSysMenu && info.wID >= 0xF000) { - CMTRACE(_T("CCoolMenuManager: ignoring sys menu item\n")); - continue; // don't do for system menu commands - } -*/ - // now that I have the info, I will modify it - info.fMask = 0; // assume nothing to change - - if (!bUnconvert) - { - // I'm showing buttons: convert to owner-draw - - if (!(info.fType & MFT_OWNERDRAW)) - { - // If not already owner-draw, make it so. NOTE: If app calls - // pCmdUI->SetText to change the text of a menu item, MFC will - // turn the item to MFT_STRING. So I must set it back to - // MFT_OWNERDRAW again. In this case, the menu item data (pmd) - // will still be there. - // - info.fType |= MFT_OWNERDRAW; - info.fMask |= MIIM_TYPE; - if (!pmd || (pmd && !pmd->IsMyItemData())) - { // if no item data: - if (pmd && !pmd->IsMyItemData()) - { - CMyItemData* pnmd = new CMyItemData; // create one - pnmd->pContext = pmd; - pmd = pnmd; - } - else - pmd = new CMyItemData; // create one - ASSERT(pmd); // (I hope) - pmd->fType = info.fType; // handy when drawing - if (info.hSubMenu) - { - int nID; - if (m_mapHMENUtoID.Lookup((void *)info.wID, (WORD&)nID)) - { - pmd->iButton = GetButtonIndex(nID); - } - else - { - pmd->iButton = -1; - } - } - else - pmd->iButton = GetButtonIndex(info.wID); - - info.dwItemData = (DWORD)pmd; // set in menu item data - info.fMask |= MIIM_DATA; // set item data - } - pmd->text = info.dwTypeData; // copy menu item string - - // append accelerators to menu item name - if (m_pAccel && m_bAutoAccel) - AppendAccelName(pmd->text, info.wID); - } - } - else - { - // no buttons -- I'm converting to strings - - if (info.fType & MFT_OWNERDRAW) // if ownerdraw: - { - info.fType &= ~MFT_OWNERDRAW; // turn it off - info.fMask |= MIIM_TYPE; // change item type - ASSERT(pmd); // sanity check - sItemName = pmd->text; // save name before deleting pmd - } - else // otherwise: - { - sItemName = info.dwTypeData; // use name from MENUITEMINFO - pmd = NULL; - } - - if (pmd) { - // NOTE: pmd (item data) could still be left hanging around even - // if MFT_OWNERDRAW is not set, in case mentioned above where app - // calls pCmdUI->SetText to set text of item and MFC sets the type - // to MFT_STRING. - // - info.dwItemData = (DWORD)pmd->pContext; // item data<-user's context - info.fMask |= MIIM_DATA; // change it - safe_delete(pmd); // and item data too - } - - // possibly add accelerator name - if (m_pAccel && m_bAutoAccel && AppendAccelName(sItemName, info.wID)) - info.fMask |= MIIM_TYPE; // change item type (string) - - if (info.fMask & MIIM_TYPE) { - // if setting name, copy name from CString to buffer and set cch - _tcsncpy(itemname, sItemName, sizeof(itemname)); - info.dwTypeData = itemname; - info.cch = sItemName.GetLength(); - } - } - - // if after all the above, there is anything to change, change it - if (info.fMask) { - CMTRACE(_T("Converting '%s' to %s\n"), itemname, - (info.fType & MFT_OWNERDRAW) ? _T("OWNERDRAW") : _T("STRING")); - SetMenuItemInfo(*pMenu, iIndex, TRUE, &info); - } -} - -/////////////////////// -// Addition: Philip Oldaker -DWORD CCoolMenuManager::SwitchContextItemData(CMenu *pMenu, int iCmd, DWORD dwItemData /*0*/, BOOL bByPosition /*TRUE*/) -{ - CMyItemData* pmd = GetMyItemData(*pMenu,iCmd,bByPosition); - DWORD dwData=0; - if (pmd == NULL) - return dwData; - CMenuItemInfo info; - info.fMask |= MIIM_DATA; // change it - if (pmd->IsMyItemData()) - { - dwData= (DWORD)pmd; - info.dwItemData = (DWORD)pmd->pContext; - SetMenuItemInfo(*pMenu, iCmd, bByPosition, &info); - } - else if (dwItemData) - { - CMyItemData *pMyItemData = (CMyItemData*)dwItemData; - if (pMyItemData->IsMyItemData()) - { - info.dwItemData = dwItemData; - SetMenuItemInfo(*pMenu, iCmd, bByPosition, &info); - } - } - return dwData; -} -// This may not be the best way of doing it but it seems to work -// Just save the IContextMenu2 pointer on behalf of the windows shell -// and create new item data -void CCoolMenuManager::AddShellContextMenu(CMenu *pMenu, LPCONTEXTMENU lpm, int iIndex) -{ - CMyItemData* pmd = GetMyItemData(*pMenu,iIndex,TRUE); - if (pmd == NULL || !pmd->IsMyItemData()) - { - DWORD dw = (DWORD)pmd; - pmd = new CMyItemData; - pmd->pContext = (void*)dw; - } - pmd->lpcm = lpm; - pmd->lpcm->AddRef(); - SetMyItemData(pmd,*pMenu,iIndex,TRUE); -} - -/////////////////////////////// - -////////////////// -// This rather gnarly function is used both to convert the menu from strings to -// owner-draw and vice versa. In either case, it also appends automagic -// accelerator key names to the menu items, if m_bAutoAccel is TRUE. -// -void CCoolMenuManager::ConvertMenu(CMenu* pMenu, UINT nIndex, - BOOL bSysMenu, BOOL bShowButtons) -{ - ASSERT_VALID(pMenu); - - UINT i, nItem; - - // add/remove the menu to/from list of "converted" menus - HMENU hmenu = pMenu->GetSafeHmenu(); - ASSERT(hmenu); - POSITION p = m_menuList.Find(hmenu); - if (!p) - { - if (bShowButtons) - m_menuList.AddHead(hmenu); - } - else - { - if (!bShowButtons) - m_menuList.RemoveAt(p); - } - - nItem = pMenu->GetMenuItemCount(); - - for (i = 0; i < nItem; i++) - { - // loop over each item in menu - ConvertMenuItem(pMenu, i, true, !bShowButtons); - } -} - -void *CCoolMenuManager::SetItemData(HMENU hMenu, void *pData, UINT uItem, BOOL bByPosition /*= FALSE*/) -{ - CMyItemData *pmd = GetMyItemData(hMenu, uItem, bByPosition); - ASSERT(pmd->IsMyItemData()); - void *pOld = pmd->pContext; - pmd->pContext = pData; - SetMyItemData(pmd, hMenu, uItem, bByPosition); - return pOld; -} - -void *CCoolMenuManager::GetItemData(HMENU hMenu, UINT uItem, BOOL bByPosition /*= FALSE*/) -{ - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA | MIIM_TYPE; - mii.dwTypeData = NULL; - mii.cch = 0; - if (!::GetMenuItemInfo(hMenu, uItem, bByPosition, &mii)) - return NULL; -if (mii.dwItemData == -1) _asm int 3; - CMyItemData *pmd = (CMyItemData *)mii.dwItemData; - if ((mii.fType & MFT_OWNERDRAW) && pmd && pmd->IsMyItemData()) - return pmd->pContext; - - return pmd; -} - -HICON CCoolMenuManager::SetItemIcon(HMENU hMenu, HICON hIcon, UINT uItem, BOOL bByPosition /*= FALSE*/) -{ - CMyItemData *pmd = GetMyItemData(hMenu, uItem, bByPosition); - ASSERT(pmd->IsMyItemData()); - HICON hOldIcon = pmd->hIcon; - pmd->hIcon = hIcon; - if (hIcon) - pmd->iButton = USES_ICON; - else - pmd->iButton = -1; - SetMyItemData(pmd, hMenu, uItem, bByPosition); - return hOldIcon; -} - -HICON CCoolMenuManager::GetItemIcon(HMENU hMenu, UINT uItem, BOOL bByPosition /*= FALSE*/) -{ - CMyItemData *pmd = GetMyItemData(hMenu, uItem, bByPosition); - ASSERT(pmd->IsMyItemData()); - return pmd->hIcon; -} - -void CCoolMenuManager::SetSubMenuIcon(HMENU hSubMenu, int nID) -{ - m_mapHMENUtoID[(void *)hSubMenu] = nID; -} - -void CCoolMenuManager::UnmanageSubMenu(HMENU hSubMenu) -{ - m_mapHMENUtoID.RemoveKey((void *)hSubMenu); -} - - -////////////////// -// User typed a char into menu. Look for item with & preceeding the char typed. -// -LRESULT CCoolMenuManager::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu) -{ - ASSERT_VALID(pMenu); - CMyItemData* pmd = GetMyItemData(*pMenu,0,TRUE); - // Addition: Philip Oldaker - // Pass it on to the shell if this has been set - if (pmd->IsMyItemData() && pmd->lpcm) - { - LRESULT lResult=0; - LPCONTEXTMENU3 lpcm3=NULL; - HRESULT hr = pmd->lpcm->QueryInterface(IID_IContextMenu3,(LPVOID*)&lpcm3); - if (SUCCEEDED(hr)) - { - // convert menu back to original item data - UINT nCount = pMenu->GetMenuItemCount(); - DWORD *pArrItemData = new DWORD[nCount]; - for(UINT i1=0;i1 < nCount;i1++) - pArrItemData[i1] = SwitchContextItemData(pMenu,i1); - lpcm3->HandleMenuMsg2(WM_MENUCHAR,MAKELPARAM(nChar,nFlags),(LPARAM)pMenu->GetSafeHmenu(),&lResult); - lpcm3->Release(); - // Convert menu back to back our item data - for(UINT i2=0;i2 < nCount;i2++) - SwitchContextItemData(pMenu,i2,pArrItemData[i2]); - delete []pArrItemData; - } - return lResult; - } - //////////////////////////////// - - UINT iCurrentItem = (UINT)-1; // guaranteed higher than any command ID - CUIntArray arItemsMatched; // items that match the character typed - - UINT nItem = pMenu->GetMenuItemCount(); - for (UINT i=0; i< nItem; i++) { - // get menu info - CMenuItemInfo info; - info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - ::GetMenuItemInfo(*pMenu, i, TRUE, &info); - - CMyItemData* pmd = (CMyItemData*)info.dwItemData; - if ((info.fType & MFT_OWNERDRAW) && pmd && pmd->IsMyItemData()) { - CString& text = pmd->text; - int iAmpersand = text.Find(_T('&')); - if (iAmpersand >=0 && toupper(nChar)==toupper(text[iAmpersand+1])) - arItemsMatched.Add(i); - } - if (info.fState & MFS_HILITE) - iCurrentItem = i; // note index of current item - } - - // arItemsMatched now contains indexes of items that match the char typed. - // - // * if none: beep - // * if one: execute it - // * if more than one: hilite next - // - UINT nFound = arItemsMatched.GetSize(); - if (nFound == 0) - return 0; - - else if (nFound==1) - return MAKELONG(arItemsMatched[0], MNC_EXECUTE); - - // more than one found--return 1st one past current selected item; - UINT iSelect = 0; - for (i=0; i < nFound; i++) { - if (arItemsMatched[i] > iCurrentItem) { - iSelect = i; - break; - } - } - return MAKELONG(arItemsMatched[iSelect], MNC_SELECT); -} - -////////////////// -// Handle WM_MENUSELECT: check for menu closed -// -void CCoolMenuManager::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) -{ - if (m_lpcm) - { - char szHelpText[MAX_PATH]; - ZeroMemory(szHelpText,sizeof(szHelpText)); - if ((nFlags & MF_SYSMENU) != MF_SYSMENU && (nFlags & MF_POPUP) != MF_POPUP) - { - if (nItemID >= m_idShellMenuFirst && nItemID <= m_idShellMenuLast) - { - m_lpcm->GetCommandString(nItemID-m_idShellMenuFirst,GCS_HELPTEXT,NULL,szHelpText,sizeof(szHelpText)); - } - } - CWnd *pWnd=m_pFrame; - if (pWnd == NULL) - pWnd = AfxGetMainWnd(); - if (pWnd) - pWnd->SendMessage(WM_SETMESSAGESTRING,0,(LPARAM)szHelpText); - } - if (hSysMenu==NULL && nFlags==0xFFFF) - { - if (m_lpcm) - { - TRACE0("Setting lpcm to null\n"); - m_lpcm = NULL; - } - /* - // de-comment this code for self destructing menus.s - // Windows has closed the menu: restore all menus to original state - while (!m_menuList.IsEmpty()) - { - ConvertMenu(CMenu::FromHandle((HMENU)m_menuList.RemoveHead()), - 0, FALSE, FALSE); - } - */ - } -} - -// fix for virtual key names - Seain Conover (1999/01/09) - -CString CCoolMenuManager::GetVirtualKeyName( const CString strVirtKey ) const -{ - CString strResult; - - if ( strVirtKey == _T("Num 7")) { strResult = _T("Home"); } - else if ( strVirtKey == _T("Num 1")) { strResult = _T("End"); } - else if ( strVirtKey == _T("Num 9")) { strResult = _T("PgUp"); } - else if ( strVirtKey == _T("Num 3")) { strResult = _T("PgDn"); } - else if ( strVirtKey == _T("Num 0")) { strResult = _T("Ins"); } - else if ( strVirtKey == _T("Num Del")) { strResult = _T("Del"); } - else - { - strResult = strVirtKey; - } - - return strResult; -} - -////////////////// -// Append the name of accelerator for given command ID to menu string. -// sItemName is menu item name, which will have the accelerator appended. -// For example, might call with sItemName = "File &Open" and return with -// sItemName = "File &Open\tCtrl-O". Returns BOOL = whether string changed. -// -BOOL CCoolMenuManager::AppendAccelName(CString& sItemName, UINT nID) -{ - int iTabPos = sItemName.Find(_T('\t')); - if (iTabPos > 0) - sItemName = sItemName.Left(iTabPos); - - BOOL bFound = FALSE; - for (ACCEL* pa = GetAccel(nID); pa; pa -= pa->cmd) { - sItemName += bFound ? _T(", ") : _T("\t"); - if (pa->fVirt & FALT) sItemName += _T("Alt+"); - if (pa->fVirt & FCONTROL) sItemName += _T("Ctrl+"); - if (pa->fVirt & FSHIFT) sItemName += _T("Shift+"); - if (pa->fVirt & FVIRTKEY) { - TCHAR keyname[64]; - UINT vkey = MapVirtualKey(pa->key, 0)<<16; - GetKeyNameText(vkey, keyname, sizeof(keyname)); - // Seain Conover (1999/01/09) - sItemName += GetVirtualKeyName( keyname ); - } else - sItemName += (char)pa->key; - - bFound = TRUE; - if (pa->cmd == 0) - break; - } - return bFound; -} - -////////////////// -// This function fixes MFC's diseased dot bitmap used for -// "radio-style" menu items (CCmdUI->SetRadio), which is completely -// wrong if the menu font is large. -// -void CCoolMenuManager::FixMFCDotBitmap() -{ - HBITMAP hbmDot = GetMFCDotBitmap(); - if (hbmDot) { - // Draw a centered dot of appropriate size - BITMAP bm; - ::GetObject(hbmDot, sizeof(bm), &bm); - CRect rcDot(0,0, bm.bmWidth, bm.bmHeight); - rcDot.DeflateRect((bm.bmWidth>>1)-2, (bm.bmHeight>>1)-2); - - CWindowDC dcScreen(NULL); - CDC memdc; - memdc.CreateCompatibleDC(&dcScreen); - int nSave = memdc.SaveDC(); - memdc.SelectStockObject(BLACK_PEN); - memdc.SelectStockObject(BLACK_BRUSH); - memdc.SelectObject((HGDIOBJ)hbmDot); - memdc.PatBlt(0, 0, bm.bmWidth, bm.bmHeight, WHITENESS); - memdc.Ellipse(&rcDot); - memdc.RestoreDC(nSave); - } -} - -////////////////// -// This function gets MFC's dot bitmap. -// -HBITMAP CCoolMenuManager::GetMFCDotBitmap() -{ - // The bitmap is stored in afxData.hbmMenuDot, but afxData is MFC-private, - // so the only way to get it is create a menu, set the radio check, - // and then see what bitmap MFC set in the menu item. - CMenu menu; - VERIFY(menu.CreateMenu()); - VERIFY(menu.AppendMenu(MFT_STRING, 0, (LPCTSTR)NULL)); - CCmdUI cui; - cui.m_pMenu = &menu; - cui.m_nIndex = 0; - cui.m_nIndexMax = 1; - cui.SetRadio(TRUE); - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS; - GetMenuItemInfo(menu, 0, MF_BYPOSITION, &info); - HBITMAP hbmDot = info.hbmpChecked; - menu.DestroyMenu(); - return hbmDot; -} - -// Peter Tewkesbury -BOOL CCoolMenuManager::AddSingleBitmap(UINT nBitmapID, UINT n, UINT *nID) -{ - // load bitmap - HBITMAP hbmBitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), - MAKEINTRESOURCE(nBitmapID), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); - ASSERT(hbmBitmap); - - if (!hbmBitmap) { - TRACE(_T("*** Can't load bitmap %d!\n"), nBitmapID); - return FALSE; - } - - // Assign Bitmap to CBitmap - CBitmap bmBitmap; - bmBitmap.Attach(hbmBitmap); // destructor will detach & destroy - - // OK, I have the bitmap - Check that Bitmaps are correct size. - if (m_szBitmap.cx==0) - { - // First toolbar: initialized bitmap/button sizes and create image list. - CSize sz(16,15); - m_szBitmap = sz; - m_szButton = sz + CSize(CXBUTTONMARGIN<<1, CYBUTTONMARGIN<<1); - VERIFY(m_ilButtons.Create(sz.cx, sz.cy, ILC_MASK, 0, 10)); - - } - - // Add Bitmap to ImageList - int iNextImage = m_ilButtons.GetImageCount(); - m_ilButtons.Add(&bmBitmap, GetSysColor(COLOR_3DFACE)); - - // Add ID to Map. - for(UINT i=0;i 0) - { - if (GetButtonIndex(nID[i]) >= 0) - { - TRACE(_T("*** Duplicate button ID %d ignored\n"), nID[i]); - } - else m_mapIDtoImage.SetAt(nID[i], (void*)iNextImage++); - } - } - - // All Done. - return TRUE; -} - -//////////////////////////////////////////////////////////////// -// Helper functions - -////////////////// -// Load a bitmap, converting the standard colors. -// Calls AfxLoadSysColorBitmap to do the work. -// -// RGB(0x00, 0x00, 0x00) (black) --> COLOR_BTNTEXT -// RGB(0x80, 0x80, 0x80) (dark gray) --> COLOR_3DSHADOW -// RGB(0xC0, 0xC0, 0xC0) (gray) --> COLOR_3DFACE -// RGB(0xFF, 0xFF, 0xFF) (white) --> COLOR_3DHILIGHT -// -HBITMAP PLLoadSysColorBitmap(LPCTSTR lpResName, BOOL bMono) -{ - HINSTANCE hInst = AfxFindResourceHandle(lpResName, RT_BITMAP); - HRSRC hRsrc = ::FindResource(hInst, lpResName, RT_BITMAP); - if (hRsrc == NULL) - return NULL; - return AfxLoadSysColorBitmap(hInst, hRsrc, bMono); -} - -////////////////// -// Shorthand to fill a rectangle with a solid color. -// -void PLFillRect(CDC& dc, const CRect& rc, COLORREF color) -{ - CBrush brush(color); - CBrush* pOldBrush = dc.SelectObject(&brush); - dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATCOPY); - dc.SelectObject(pOldBrush); -} - -// This is the magic ROP code used to generate the embossed look for -// a disabled button. It's listed in Appendix F of the Win32 Programmer's -// Reference as PSDPxax (!) which is a cryptic reverse-polish notation for -// -// ((Destination XOR Pattern) AND Source) XOR Pattern -// -// which I leave to you to figure out. In the case where I apply it, -// Source is a monochrome bitmap which I want to draw in such a way that -// the black pixels get transformed to the brush color and the white pixels -// draw transparently--i.e. leave the Destination alone. -// -// black ==> Pattern (brush) -// white ==> Destintation (ie, transparent) -// -// 0xb8074a is the ROP code that does this. For more info, see Charles -// Petzold, _Programming Windows_, 2nd Edition, p 622-624. -// -#define TRANSPARENTROP 0xb8074a - -////////////////// -// Draw an image with the embossed (disabled) look. -// -// dc device context to draw in -// il image list containing image -// i index of image to draw -// p point in dc to draw image at -// bColor do color embossing. Default is B/W. -// -void PLDrawEmbossedOld(CDC& dc, CImageList& il, int i, CPoint p, BOOL bColor) -{ - IMAGEINFO info; - VERIFY(il.GetImageInfo(0, &info)); - CRect rc = info.rcImage; - int cx = rc.Width(); - int cy = rc.Height(); - - // create memory dc - CDC memdc; - memdc.CreateCompatibleDC(&dc); - - // create mono or color bitmap - CBitmap bm; - if (bColor) - bm.CreateCompatibleBitmap(&dc, cx, cy); - else - bm.CreateBitmap(cx, cy, 1, 1, NULL); - - // draw image into memory DC--fill BG white first - CBitmap* pOldBitmap = memdc.SelectObject(&bm); - memdc.PatBlt(0, 0, cx, cy, WHITENESS); - il.Draw(&memdc, i, CPoint(0,0), ILD_TRANSPARENT); - - // This seems to be required. Why, I don't know. ??? - COLORREF colorOldBG = dc.SetBkColor(RGB(255,255,255)); // white - - // Draw using hilite offset by (1,1), then shadow - CBrush brShadow(GetSysColor(COLOR_3DSHADOW)); - CBrush brHilite(GetSysColor(COLOR_3DHIGHLIGHT)); - CBrush* pOldBrush = dc.SelectObject(&brHilite); - dc.BitBlt(p.x+1, p.y+1, cx, cy, &memdc, 0, 0, TRANSPARENTROP); - dc.SelectObject(&brShadow); - dc.BitBlt(p.x, p.y, cx, cy, &memdc, 0, 0, TRANSPARENTROP); - dc.SelectObject(pOldBrush); - dc.SetBkColor(colorOldBG); // restore - memdc.SelectObject(pOldBitmap); // ... -} - -#define NEWROP 0x00E20746L - -void PLDrawEmbossed(CDC& dc, CImageList& il, int i, CPoint p, BOOL bColor) -{ - IMAGEINFO info; - VERIFY(il.GetImageInfo(0, &info)); - CRect rc = info.rcImage; - int cx = rc.Width(); - int cy = rc.Height(); - CBitmap patbmp, bmp; - CDC memdc, patdc; - patdc.CreateCompatibleDC(0); - memdc.CreateCompatibleDC(0); - patbmp.CreateCompatibleBitmap(&patdc, cx, cy); - bmp.CreateCompatibleBitmap(&dc, cx, cy); - CBitmap * pddcOldBmp = patdc.SelectObject(&patbmp); - CBitmap * pdcOldBmp = memdc.SelectObject(&bmp); - - il.Draw(&memdc, i, CPoint(0, 0), ILD_NORMAL); //ILD_TRANSPARENT); - - // build a mask - patdc.PatBlt(0, 0, cx, cy, WHITENESS); - memdc.SetBkColor(GetSysColor(COLOR_BTNFACE)); - patdc.BitBlt(0, 0, cx, cy, &memdc, 0, 0, SRCCOPY); - memdc.SetBkColor(GetSysColor(COLOR_BTNHILIGHT)); - patdc.BitBlt(0, 0, cx, cy, &memdc, 0, 0, SRCPAINT); - - memdc.SetBkColor(RGB(0, 0, 0)); - memdc.SetTextColor(RGB(255, 255, 255)); - CBrush brShadow, brHilight; - brHilight.CreateSolidBrush(GetSysColor(COLOR_BTNHILIGHT)); - brShadow.CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW)); - CBrush * pOldBrush = memdc.SelectObject(&brHilight); - memdc.BitBlt(1, 1, cx, cy, &patdc, 0, 0, NEWROP); - memdc.BitBlt(0, 0, cx, cy, &patdc, 0, 0, NEWROP); - memdc.SelectObject(&brShadow); - memdc.BitBlt(0, 0, cx, cy, &patdc, 0, 0, NEWROP); - dc.BitBlt(p.x, p.y, cx, cy, &memdc, 0, 0, SRCCOPY); - - // reset DCs - patdc.SelectObject(pddcOldBmp); - patdc.DeleteDC(); - memdc.SelectObject(pOldBrush); - memdc.SelectObject(pdcOldBmp); - memdc.DeleteDC(); - - brShadow.DeleteObject(); - brHilight.DeleteObject(); - patbmp.DeleteObject(); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDATA.CPP b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDATA.CPP deleted file mode 100644 index c47c0102b3c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDATA.CPP +++ /dev/null @@ -1,202 +0,0 @@ - -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -/**********************************************************/ -/* implementation of class CUIListCtrlData */ -/* */ -/**********************************************************/ - -#include "stdafx.h" -#include "UIData.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char BASED_CODE THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIconObj - -IMPLEMENT_DYNAMIC(CUIODColumnCtrl, CObject) -IMPLEMENT_DYNAMIC(CUIListCtrlData, CObject) -IMPLEMENT_DYNAMIC(CUIDBListCtrlData, CUIListCtrlData) -IMPLEMENT_DYNAMIC(CUIStrListCtrlData, CUIListCtrlData) -IMPLEMENT_DYNAMIC(CUIComboBoxData, CUIListCtrlData) - -///////////////////////////////////////////////////////////////////////////// -// CUIListCtrlData construction/destruction -CUIListCtrlData::CUIListCtrlData(int nCols) -{ - Init(nCols); -} - -void CUIListCtrlData::Init(int nCols) -{ - const int cMaxCols=50; - m_arCtrl.SetSize(nCols < cMaxCols ? cMaxCols : nCols); - m_arFonts.SetSize(nCols < cMaxCols ? cMaxCols : nCols); - m_arTextColors.SetSize(nCols < cMaxCols ? cMaxCols : nCols); - m_arBkColors.SetSize(nCols); - for(int i=0;i < nCols;i++) - { - SetDefaultTextColor(i); - SetDefaultBkColor(i); - } - m_dwExtData = 0; - m_bAutoDelete = false; - m_bDeleted = false; -} - -CUIListCtrlData::~CUIListCtrlData() -{ - DestroyCtrls(); - DestroyFonts(); -} - -void CUIListCtrlData::DestroyFonts() -{ - CFont *pFont=NULL; - for(int i=0;i < m_arFonts.GetSize();i++) - { - pFont = (CFont*)m_arFonts[i]; - delete pFont; - } -} - -void CUIListCtrlData::DestroyCtrls() -{ - CUIODColumnCtrl *pCtrl=NULL; - for(int i=0;i < m_arCtrl.GetSize();i++) - { - pCtrl = (CUIODColumnCtrl*)m_arCtrl[i]; - delete pCtrl; - } -} - -BOOL CUIListCtrlData::IsFontSet(int nCol) const -{ - if (nCol == -1) - { - BOOL bRet=TRUE; - for(int i=0;i < m_arFonts.GetSize();i++) - { - if (m_arFonts[i] == NULL) - { - bRet = FALSE; - break; - } - } - return bRet; - } - return(m_arFonts[nCol] && ((CFont*)m_arFonts[nCol])->GetSafeHandle() != NULL); -} - -void CUIListCtrlData::SetFont(CFont *pFont,int nCol) -{ - LOGFONT lf; - pFont->GetLogFont(&lf); - if (nCol == -1) - { - for(int i=0;i < m_arFonts.GetSize();i++) - { - CreateNewFont(i,lf); - } - } - else - { - CreateNewFont(nCol,lf); - } -} - -void CUIListCtrlData::CreateNewFont(int nCol,LOGFONT &lf) -{ - CFont *pNewFont = NULL; - CFont *pOldFont = (CFont*)m_arFonts[nCol]; - if (pOldFont) - { - if (pOldFont->GetSafeHandle()) - pOldFont->DeleteObject(); - pNewFont = pOldFont; - } - else - pNewFont = new CFont; - pNewFont->CreateFontIndirect(&lf); - m_arFonts[nCol] = pNewFont; -} -///////////////////////////////////////////////////////////////////////////// -// -// CUIComboBoxData -// -///////////////////////////////////////////////////////////////////////////// -// columns in a combo box -CString CUIComboBoxData::GetText(int nCol) const -{ - TCHAR szDest[256]; - if (nCol == -1 || m_strText.IsEmpty()) - return m_strText; - LPCTSTR p = m_strText; - LPTSTR pDest; - nCol++; - while (nCol > 0) - { - pDest = szDest; - while (*p && *p != _T('\t')) - { - *pDest = *p; - pDest = _tcsinc(pDest); - p = _tcsinc(p); - } - nCol--; - if (*p == _T('\t')) - p = _tcsinc(p); - else - break; - - } - *pDest = '\0'; - CString str; - if (nCol) - str.Empty(); - else - str = szDest; - return str; -} - -///////////////////////////////////////////////////////////////////////////// -// CUIStrListCtrlData -///////////////////////////////////////////////////////////////////////////// -CUIStrListCtrlData::CUIStrListCtrlData(int nColumns) : CUIListCtrlData(nColumns) -{ - m_StringArray.SetSize(nColumns); -} - -LPTSTR CUIStrListCtrlData::GetString(int nCol) -{ - return (LPTSTR)(LPCTSTR)m_StringArray[nCol]; -} - -// return TRUE if needs updating -BOOL CUIStrListCtrlData::AddString(int nCol,LPCTSTR szStr) -{ - if (nCol < 0) - return FALSE; - BOOL ret = !m_StringArray[nCol].IsEmpty(); - m_StringArray[nCol] = szStr; - return ret; -} -///////////////////////////////////////////////////////////////////////////// diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDragDropTree.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDragDropTree.cpp deleted file mode 100644 index 39e434aabf3..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIDragDropTree.cpp +++ /dev/null @@ -1,610 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -//////////////////////////////////////////////////////////////////////////////////////--*/ -// UIDragDropTree.cpp : implementation file -// - -#include "stdafx.h" -#include "UICtrl.h" -#include "UIDragDropTree.h" -#include "cbformats.h" -#include "UIRes.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CUIDragDropTree,CTreeCtrl) -///////////////////////////////////////////////// -// -// For OLE drag and drop -// -///////////////////////////////////////////////// -void CUI_TreeDropTarget::OnDragLeave(CWnd* pWnd) -{ - CUIDragDropTree *pTree = static_cast(pWnd); - if (pTree == NULL) - return; - pTree->KillDragTimer(); - pTree->SelectDropTarget(NULL); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd()); - Info.SetItem(pTree->GetDropHilightItem()); - BOOL bRet = pTree->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info); - if (bRet == FALSE) - bRet = pTree->GetParent()->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info); -} - -DROPEFFECT CUI_TreeDropTarget::OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ -// ASSERT_KINDOF(CUIDragDropTree,pWnd); - CUIDragDropTree *pTree = static_cast(pWnd); - if (pTree == NULL) - return DROPEFFECT_NONE; - ((CUIDragDropTree*)pWnd)->SetDragTimer(); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - m_dwEnterKeyboardState = dwKeyState; - Info.SetKeyboardState(dwKeyState); - Info.SetItem(pTree->GetDropHilightItem()); - BOOL bRet = pTree->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info); - if (bRet == FALSE) - bRet = pTree->GetParent()->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info); - return Info.GetDropEffect(); -} - -DROPEFFECT CUI_TreeDropTarget::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - // disallow if the control key pressed - EraseOldImage(); - CUIDragDropTree *pTree = static_cast(pWnd); - if (pTree == NULL) - return DROPEFFECT_NONE; -// ASSERT_KINDOF(CUIDragDropTree,pWnd); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - m_dwKeyboardState = dwKeyState; - Info.SetKeyboardState(dwKeyState); - // WM_APP_OLE_DD_OVER message sent in SelectCurrentTarget - DROPEFFECT dropEffect = pTree->SelectCurrentTarget(&Info); - CUI_ImageDropTarget::OnDragOver(pWnd,pDataObject,dwKeyState,point); - return dropEffect; -} - -BOOL CUI_TreeDropTarget::OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ) -{ - CUIDragDropTree *pTree = static_cast(pWnd); - if (pTree == NULL) - return FALSE; -// ASSERT_KINDOF(CUIDragDropTree,pWnd); - pTree->KillDragTimer(); - HTREEITEM hItem = pTree->GetDropHilightItem(); - BOOL bRet=FALSE; - if (hItem) - { - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetDropEffect(dropEffect); - Info.SetItem(hItem); - if (m_dwEnterKeyboardState & MK_RBUTTON) - m_dwKeyboardState |= MK_RBUTTON; - if (m_dwEnterKeyboardState & MK_LBUTTON) - m_dwKeyboardState |= MK_LBUTTON; - Info.SetKeyboardState(m_dwKeyboardState); - bRet = pTree->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - if (bRet == FALSE) - bRet = pTree->GetParent()->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - } - pTree->SelectDropTarget(NULL); - return bRet; -} - -// During slow scroll, process every third message. -#define SLOWSCROLL_FREQUENCY 3 -///////////////////////////////////////////////////////////////////////////// -// CUIDragDropTree - -CUIDragDropTree::CUIDragDropTree(bool bDragDrop): m_nUpperYCoor(0), - m_nLowerYCoor(0), - m_nSlowScrollTimeout(0), - m_nTimerID(0), - m_bDragging(FALSE), - m_pImageList(NULL), - m_hitemDrag(NULL), - m_hitemDrop(NULL), - m_bDragDrop(bDragDrop), - m_bDropFiles(true) - -{ - m_nScrollBarSize = GetSystemMetrics( SM_CYHSCROLL ); - m_CopyMode = eDDCancel; -} - -CUIDragDropTree::~CUIDragDropTree() -{ -} - -void CUIDragDropTree::OnDropFile(HTREEITEM hItem,LPCTSTR pszFile,UINT nFlags) -{ -} - -BEGIN_MESSAGE_MAP(CUIDragDropTree, CTreeCtrl) - //{{AFX_MSG_MAP(CUIDragDropTree) - ON_NOTIFY_REFLECT_EX(TVN_BEGINDRAG, OnBegindrag) - ON_NOTIFY_REFLECT_EX(TVN_BEGINRDRAG, OnBeginRDrag) - ON_WM_TIMER() - ON_WM_RBUTTONUP() - ON_WM_MOUSEMOVE() - ON_WM_DESTROY() - ON_WM_CREATE() - ON_WM_DROPFILES() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUIDragDropTree message handlers -void CUIDragDropTree::OnDropFiles(HDROP hDropInfo) -{ - UINT wNumFilesDropped = DragQueryFile(hDropInfo, 0XFFFFFFFF, NULL, 0); - TCHAR szFile[MAX_PATH]; - UINT nLen; - UINT nFlags; - POINT pt; - ::DragQueryPoint(hDropInfo,&pt); - HTREEITEM hitemDrag = HitTest(CPoint(pt), &nFlags); - for(UINT i=0; i < wNumFilesDropped;i++) - { - nLen = DragQueryFile(hDropInfo,i,szFile,sizeof(szFile)/sizeof(TCHAR)); - if (nLen) - OnDropFile(hitemDrag,szFile,nFlags); - } -} - -BOOL CUIDragDropTree::OnBeginRDrag(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - return StartDragDrop(pNMTreeView); -} - -BOOL CUIDragDropTree::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - return StartDragDrop(pNMTreeView); -} - -BOOL CUIDragDropTree::StartDragDrop(NM_TREEVIEW* pNMTreeView) -{ - if (GetDragDrop() == false || pNMTreeView->itemNew.hItem == GetRootItem()) - return FALSE; - // See if COM drag drop is implemented in this window or parent window - DWORD dwDragEffect = SendMessage(WM_APP_OLE_DD_DODRAGDROP,(WPARAM)pNMTreeView,(LPARAM)&m_OleDataSource); - if (dwDragEffect == 0) - dwDragEffect = GetParent()->SendMessage(WM_APP_OLE_DD_DODRAGDROP,(WPARAM)pNMTreeView,(LPARAM)&m_OleDataSource); - if (dwDragEffect) - { - CRect rcDrag; - m_hitemDrag = pNMTreeView->itemNew.hItem; - // Define starting rect - GetItemRect(pNMTreeView->itemNew.hItem,rcDrag,TRUE); - // Start the DragDrop - DWORD dwEffect = m_OleDataSource.DoDragDrop(dwDragEffect,rcDrag); - // Clear the cache - m_OleDataSource.Empty(); - } - else // otherwise start local drag drop - { - CPoint ptAction; - UINT nFlags; - - GetCursorPos(&ptAction); - ScreenToClient(&ptAction); - - m_bDragging = TRUE; - m_hitemDrag = HitTest(pNMTreeView->ptDrag, &nFlags); - m_hitemDrop = NULL; - - // Create drag image and begin dragging - m_pImageList = CreateDragImage(m_hitemDrag); - m_pImageList->BeginDrag(0, CPoint(0,0)); - m_pImageList->DragEnter(GetDesktopWindow(), ptAction); - SetCapture(); - - SetDragTimer(); - } - return TRUE; -} - -void CUIDragDropTree::SetDragTimer() -{ - // Set the timer to slow down the scrolling when the dragging cursor - // is close to the top/bottom border of the tree control - if (!m_nTimerID) - { - m_nTimerID = SetTimer(1, 75, NULL); - CRect rect; - GetClientRect(&rect); - ClientToScreen(&rect); - m_nUpperYCoor = rect.top; - m_nLowerYCoor = rect.bottom; - } -} - -void CUIDragDropTree::KillDragTimer() -{ - if (m_nTimerID) - { - KillTimer(m_nTimerID); - } - m_nTimerID = 0; - m_nUpperYCoor = 0; - m_nLowerYCoor = 0; - m_nSlowScrollTimeout = 0; -} - -void CUIDragDropTree::OnTimer(UINT nIDEvent) -{ - // TODO: Add your message handler code here and/or call default - if (nIDEvent != m_nTimerID) - { - CTreeCtrl::OnTimer(nIDEvent); - return; - } - - // Get the "current" mouse position - const MSG* pMessage; - CPoint ptMouse; - pMessage = GetCurrentMessage(); - ASSERT(pMessage); - ptMouse = pMessage->pt; - - // Move the ghost image - if (m_pImageList) - m_pImageList->DragMove(ptMouse); - - // Find out if scrolling is needed. - // Scrolling is not needed for example, if the dragging cursor is - // within the tree control itself - if(!NeedToScroll(ptMouse)) - { - CTreeCtrl::OnTimer(nIDEvent); - return; - } - if (!m_bDragging) - m_OleDropTarget.EraseOldImage(); - - // Refine the scrolling mode - - // Scroll Up/Down, Slow/Normal - int nScrollMode = RefineScrollMode(ptMouse); - - switch(nScrollMode) - { - case SCROLL_UP_SLOW: - case SCROLL_DOWN_SLOW: - if( m_nSlowScrollTimeout == 0) - SendMessage( WM_VSCROLL, - nScrollMode == SCROLL_UP_SLOW ? SB_LINEUP : SB_LINEDOWN); - m_nSlowScrollTimeout = ++m_nSlowScrollTimeout%SLOWSCROLL_FREQUENCY; - break; - case SCROLL_UP_NORMAL: - case SCROLL_DOWN_NORMAL: - SendMessage( WM_VSCROLL, - nScrollMode == SCROLL_UP_NORMAL ? SB_LINEUP : SB_LINEDOWN); - break; - default: - ASSERT(FALSE); - return; - break; - } - if (m_bDragging) - { - // Select the drop target - if (m_pImageList) - m_pImageList->DragLeave(this); - HTREEITEM hitem = GetFirstVisibleItem(); - - switch( nScrollMode ) - { - case SCROLL_UP_SLOW: - case SCROLL_UP_NORMAL: - { - SelectDropTarget(hitem); - m_hitemDrop = hitem; - break; - } - case SCROLL_DOWN_SLOW: - case SCROLL_DOWN_NORMAL: - { - // Get the last visible item in the control - int nCount = GetVisibleCount(); - for ( int i=0; iDragEnter(this, ptMouse); CTreeCtrl::OnTimer(nIDEvent); - } -} - -void CUIDragDropTree::OnRButtonUp(UINT nFlags, CPoint point) -{ - if (!m_bDragging) - return; - // Kill the timer and reset all variables - EndDragging(); - CMenu menu; - VERIFY(menu.LoadMenu(IDR_POPUPMENU_DRAGDROP)); - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup != NULL); - pPopup->SetDefaultItem(ID_POPUP_DD_MOVE); - CPoint pts(point); - ClientToScreen(&pts); - if (GetRDragMenu(pPopup)) - { - UINT nCmd = pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, pts.x, pts.y,this); - if (nCmd == ID_POPUP_DD_MOVE) - { - OnButtonUp(true); - } - else if (nCmd == ID_POPUP_DD_COPY) - { - OnButtonUp(false); - } - } - else - { - // otherwise just move - OnButtonUp(true); - } - SelectDropTarget(NULL); - CTreeCtrl::OnRButtonUp(nFlags, point); -} - -void CUIDragDropTree::OnMouseMove(UINT nFlags, CPoint point) -{ - // TODO: Add your message handler code here and/or call default - HTREEITEM hItem; - UINT flags; - - if (!m_bDragging) - return; - CPoint ptScreen(point); - ClientToScreen(&ptScreen); - - m_pImageList->DragMove(ptScreen); - - m_pImageList->DragShowNolock(FALSE); - - if ((hItem = HitTest(point, &flags)) != NULL) - { - CDD_OleDropTargetInfo Info(this->GetSafeHwnd(),point,NULL); - Info.SetItem(hItem); - LRESULT lResult = SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)&Info); - if (lResult == 0) - { - lResult = GetParent()->SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)&Info); - } - if (lResult) - { - SelectDropTarget(hItem); - m_hitemDrop = hItem; - } - } - m_pImageList->DragShowNolock(TRUE); - - CTreeCtrl::OnMouseMove(nFlags, point); -} - -void CUIDragDropTree::OnButtonUp(bool bMove) -{ - if (!m_bDragging) - return; - EndDragging(); - if (m_hitemDrag && m_hitemDrag != m_hitemDrop && !IsChildNodeOf(m_hitemDrop, m_hitemDrag) && - GetParentItem(m_hitemDrag) != m_hitemDrop) - { - CDD_OleDropTargetInfo Info(GetSafeHwnd(),CPoint(),NULL); - Info.SetDropEffect(bMove ? DROPEFFECT_MOVE : DROPEFFECT_COPY); - Info.SetItem(m_hitemDrop); - LRESULT lResult = SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - if (lResult == 0) - lResult = GetParent()->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - } -} - -void CUIDragDropTree::EndDragging() -{ - if (!m_bDragging) - return; - m_bDragging = FALSE; - if (m_pImageList) - { - m_pImageList->DragLeave(this); - m_pImageList->EndDrag(); - } - delete m_pImageList; - m_pImageList = NULL; - ReleaseCapture(); - KillDragTimer(); -} - -void CUIDragDropTree::NewTransferItem(HTREEITEM hNewItem) -{ -} - -BOOL CUIDragDropTree::TransferItem(HTREEITEM hitemDrag, HTREEITEM hitemDrop) -{ - TV_INSERTSTRUCT tvstruct; - TCHAR sztBuffer[256]; - HTREEITEM hNewItem, hFirstChild; - - // avoid an infinite recursion situation - tvstruct.item.hItem = hitemDrag; - tvstruct.item.cchTextMax = sizeof(sztBuffer)-1; - tvstruct.item.pszText = sztBuffer; - tvstruct.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT | TVIF_PARAM; - GetItem(&tvstruct.item); - tvstruct.hParent = hitemDrop; - tvstruct.hInsertAfter = TVI_SORT; - tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT | TVIF_PARAM; - hNewItem = InsertItem(&tvstruct); - NewTransferItem(hNewItem); - - while ((hFirstChild = GetChildItem(hitemDrag)) != NULL) - { - // recursively transfer all the items - TransferItem(hFirstChild, hNewItem); - // delete the first child and all its children - DeleteItem(hFirstChild); - } - return TRUE; -} - - - -BOOL CUIDragDropTree::NeedToScroll( CPoint ptMouse ) -{ - if (m_bDragging) - { - return ptMouse.y < m_nUpperYCoor || ptMouse.y > m_nLowerYCoor; - } - else - { - return ptMouse.y < m_nUpperYCoor+10 || ptMouse.y > m_nLowerYCoor-30; - } -} - - -CUIDragDropTree::SCROLLMODE CUIDragDropTree::RefineScrollMode( CPoint ptMouse ) -{ - int nYCoor = ptMouse.y; - CUIDragDropTree::SCROLLMODE nScrollMode; - - if (m_bDragging) - { - nScrollMode = nYCoor > m_nLowerYCoor + m_nScrollBarSize ? SCROLL_DOWN_NORMAL : - nYCoor > m_nLowerYCoor ? SCROLL_DOWN_SLOW : - nYCoor < m_nUpperYCoor - m_nScrollBarSize ? SCROLL_UP_NORMAL : - SCROLL_UP_SLOW; - } - else - { - nScrollMode = nYCoor > m_nLowerYCoor-30 ? SCROLL_DOWN_NORMAL : - nYCoor < m_nUpperYCoor-10 ? SCROLL_UP_NORMAL : SCROLL_UP_NORMAL; - } - return nScrollMode; -} - -BOOL CUIDragDropTree::IsChildNodeOf(HTREEITEM hitemChild, HTREEITEM hitemSuspectedParent) -{ - do - { - if (hitemChild == hitemSuspectedParent) - break; - } - while ((hitemChild = GetParentItem(hitemChild)) != NULL); - - return (hitemChild != NULL); -} - -void CUIDragDropTree::RegisterDropTarget() -{ - if (GetDragDrop()) - { - VERIFY(m_OleDropTarget.Register(this)); - if (GetDropFiles()) - DragAcceptFiles(); - } -} - -DROPEFFECT CUIDragDropTree::SelectCurrentTarget(CDD_OleDropTargetInfo *pInfo) -{ - HTREEITEM hItem; - UINT flags; - if ((hItem = HitTest(pInfo->GetPoint(), &flags)) != NULL) - { - // select it - SelectDropTarget(hItem); - // save it - m_hitemDrop = hItem; - // returns 1 if allowed - pInfo->SetItem(hItem); - LRESULT lResult = SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)pInfo); - if (lResult == 0) - { - lResult = GetParent()->SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)pInfo); - } - if (lResult) - { - if (::GetKeyState(VK_LCONTROL) < 0) - { - if (ItemHasChildren(hItem)) - { - Expand(hItem, TVE_EXPAND); - } - } - return pInfo->GetDropEffect(); - } - } - return DROPEFFECT_NONE; -} - -void CUIDragDropTree::OnDestroy() -{ - - CTreeCtrl::OnDestroy(); - - // TODO: Add your message handler code here - -} - -int CUIDragDropTree::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CTreeCtrl::OnCreate(lpCreateStruct) == -1) - return -1; - - // TODO: Add your specialized creation code here - RegisterDropTarget(); - - return 0; -} - -bool CUIDragDropTree::GetRDragMenu(CMenu *pMenu) -{ - return true; -} - -void CUIDragDropTree::OnDDMove() -{ - m_CopyMode = eDDMove; -} - -void CUIDragDropTree::OnDDCopy() -{ - m_CopyMode = eDDCopy; -} - -void CUIDragDropTree::OnDDCancel() -{ - m_CopyMode = eDDCancel; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIExplorerFrameWnd.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIExplorerFrameWnd.cpp deleted file mode 100644 index 894444fa597..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIExplorerFrameWnd.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIExplorerFrameWnd.h" -#include "UIres.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CUIExplorerFrameWnd, CUIFrameWnd) - -CUIExplorerFrameWnd::CUIExplorerFrameWnd() -{ - m_pExplorerView = NULL; -} - -CUIExplorerFrameWnd::~CUIExplorerFrameWnd() -{ -} - -BOOL CUIExplorerFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) -{ - // TODO: Add your specialized code here and/or call the base class - // create a splitter with 1 row, 2 columns - - // if this asserts you forgot to call SetExplorerView - ASSERT(m_pExplorerView); - if (m_pExplorerView == NULL) - return CUIFrameWnd::OnCreateClient(lpcs,pContext); -USES_CONVERSION; - m_wndSplitter.SetSection(A2CT(GetRuntimeClass()->m_lpszClassName)); - if (!m_wndSplitter.CreateStatic(this, 1, 2)) - { - TRACE0("Failed to CreateStatic Splitter\n"); - return FALSE; - } - CSize sizeSplitter(200,0); - // add the second splitter pane - a tab view in column 1 - // add the first splitter pane - the default view in column 0 - if (!m_wndSplitter.CreateView(0, 0, pContext->m_pNewViewClass, sizeSplitter, pContext)) - { - TRACE0("Failed to create first pane\n"); - return FALSE; - TRACE1("Created %s view1\n",m_pExplorerView->m_lpszClassName); - } - if (m_pExplorerView) - { - pContext->m_pNewViewClass = m_pExplorerView; - if (!m_wndSplitter.CreateView(0, 1, pContext->m_pNewViewClass, CSize(0, 0), pContext)) - { - TRACE0("Failed to create second pane\n"); - return FALSE; - } - TRACE1("Created %s view2\n",m_pExplorerView->m_lpszClassName); - } - // activate the input view - SetActiveView((CView*)m_wndSplitter.GetPane(0,0)); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CUIExplorerFrameWnd message handlers -BEGIN_MESSAGE_MAP(CUIExplorerFrameWnd, CUIFrameWnd) - //{{AFX_MSG_MAP(CUIExplorerFrameWnd) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFixTB.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFixTB.cpp deleted file mode 100644 index 04480039d6b..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFixTB.cpp +++ /dev/null @@ -1,558 +0,0 @@ -f//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CFixMFCToolBar fixes sizing bugs in MFC CToolBar, so it works with -// modern toolbars in versions of comctl32.dll > 4.70. -// -// Most of this code is copied from MFC, with slight modifications marked "PD" -// -#include "StdAfx.h" -#include "UIFixTB.h" -#include "UIModulVer.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CFixMFCToolBar, CToolBar) - -BEGIN_MESSAGE_MAP(CFixMFCToolBar, CToolBar) - ON_MESSAGE(TB_SETBITMAPSIZE, OnSetBitmapSize) - ON_MESSAGE(TB_SETBUTTONSIZE, OnSetButtonSize) - ON_MESSAGE(WM_SETTINGCHANGE, OnSettingChange) - ON_MESSAGE(WM_SETFONT, OnSettingChange) -END_MESSAGE_MAP() - -///////////////// -// This function gets the version number of comctl32.dll. -// -static int GetVerComCtl32() -{ - CModuleVersion ver; - DLLVERSIONINFO dvi; - VERIFY(ver.DllGetVersion(_T("comctl32.dll"), dvi)); - return dvi.dwMajorVersion*100 + dvi.dwMinorVersion; -} - -int CFixMFCToolBar::iVerComCtl32 = GetVerComCtl32(); - -CFixMFCToolBar::CFixMFCToolBar() -{ - m_bShowDropdownArrowWhenVertical = FALSE; -} - -CFixMFCToolBar::~CFixMFCToolBar() -{ -} - -////////////////// -// These functions duplicate functionalityin VC 6.0 -// Need to set transparent/flat style before setting -// button/image size or font to allow zero-height border. -// -LRESULT CFixMFCToolBar::OnSetBitmapSize(WPARAM, LPARAM lp) -{ - return OnSizeHelper(m_sizeImage, lp); -} -LRESULT CFixMFCToolBar::OnSetButtonSize(WPARAM, LPARAM lp) -{ - return OnSizeHelper(m_sizeButton, lp); -} -LRESULT CFixMFCToolBar::OnSettingChange(WPARAM, LPARAM lp) -{ - return OnSizeHelper(CSize(0,0), lp); -} -LRESULT CFixMFCToolBar::OnSizeHelper(CSize& sz, LPARAM lp) -{ - ASSERT(iVerComCtl32 > 0); - BOOL bModStyle =FALSE; - DWORD dwStyle =0; - if (iVerComCtl32 >= 471) { - dwStyle = GetStyle(); - bModStyle = ModifyStyle(0, TBSTYLE_TRANSPARENT|TBSTYLE_FLAT); - } - - LRESULT lRet = Default(); - if (lRet) - sz = lp; - - if (bModStyle) - SetWindowLong(m_hWnd, GWL_STYLE, dwStyle); - - return lRet; -} - -////////////////// -// **PD** -// This is the all-important function that gets the true size of a button, -// instead of using m_sizeButton. And it's virtual, so you can override if -// my algorithm doesn't work, as will surely be the case in some circumstances. -// -CSize CFixMFCToolBar::GetButtonSize(TBBUTTON* pData, int iButton) -{ - ASSERT(iVerComCtl32 > 0); - - // Get the actual size of the button, not what's in m_sizeButton. - // Make sure to do SendMessage instead of calling MFC's GetItemRect, - // which has all sorts of bad side-effects! (Go ahead, take a look at it.) - // - CRect rc; - SendMessage(TB_GETITEMRECT, iButton, (LPARAM)&rc); - CSize sz = rc.Size(); - - //////////////// - // Now must do special case for various versions of comctl32.dll, - // - DWORD dwStyle = pData[iButton].fsStyle; - if ((pData[iButton].fsState & TBSTATE_WRAP)) { - if (dwStyle & TBSTYLE_SEP) { - // this is the last separator in the row (eg vertically docked) - // fudge the height, and ignore the width. TB_GETITEMRECT will return - // size = (8 x 22) even for a separator in vertical toolbar - // - if (iVerComCtl32 <= 470) - sz.cy -= 3; // empircally good fudge factor - else if (iVerComCtl32 != 471) - sz.cy = sz.cx; - sz.cx = 0; // separator takes no width if it's the last one - - } else if (dwStyle & TBSTYLE_DROPDOWN && - !m_bShowDropdownArrowWhenVertical) { - // ignore width of dropdown - sz.cx = 0; - } - } - return sz; -} - -////////////////// -// **PD** -// Part 2 of correction for MFC is to recalculate everything when the bar -// goes from docked to undocked because the AdjustSize calculation happens -// when the bar is in the old state, and thus wrong. After the bar is -// docked/undocked, I'll recalculate with the new style and commit the change. -// -void CFixMFCToolBar::OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle) -{ - CToolBar::OnBarStyleChange(dwOldStyle, dwNewStyle); - - if (dwOldStyle != dwNewStyle) { - DWORD dwMode = 0; - if ((dwNewStyle & CBRS_SIZE_DYNAMIC) && (dwNewStyle & CBRS_FLOATING)) - dwMode = LM_HORZ | LM_MRUWIDTH; - else if (dwNewStyle & CBRS_ORIENT_HORZ) - dwMode = LM_HORZ | LM_HORZDOCK; - else - dwMode = LM_VERTDOCK; - - CalcDynamicLayout(-1, dwMode | LM_COMMIT); - } -} - -//////////////////////////////////////////////////////////////// -// Stuff below is copied from MFC; only mod is to call GetButtonSize. - -#ifdef _MAC - #define CX_OVERLAP 1 -#else - #define CX_OVERLAP 0 -#endif - -CSize CFixMFCToolBar::CalcSize(TBBUTTON* pData, int nCount) -{ - ASSERT(pData != NULL && nCount > 0); - - CPoint cur(0,0); - CSize sizeResult(0,0); - int cyTallestOnRow = 0; - - for (int i = 0; i < nCount; i++) - { - if (pData[i].fsState & TBSTATE_HIDDEN) - continue; - - // **PD** - // Load actual size of button into a local variable - // called m_sizeButton. C++ will use this instead of - // CToolBar::m_sizeButton. - // - CSize m_sizeButton = GetButtonSize(pData, i); - - // **PD** - // I also changed the logic below to be more correct. - cyTallestOnRow = max(cyTallestOnRow, m_sizeButton.cy); - sizeResult.cx = max(cur.x + m_sizeButton.cx, sizeResult.cx); - sizeResult.cy = max(cur.y + m_sizeButton.cy, sizeResult.cy); - - cur.x += m_sizeButton.cx - CX_OVERLAP; - - if (pData[i].fsState & TBSTATE_WRAP) - { - cur.x = 0; - cur.y += cyTallestOnRow; - cyTallestOnRow = 0; - if (pData[i].fsStyle & TBSTYLE_SEP) - cur.y += m_sizeButton.cy; - } - } - return sizeResult; -} - -int CFixMFCToolBar::WrapToolBar(TBBUTTON* pData, int nCount, int nWidth) -{ - ASSERT(pData != NULL && nCount > 0); - - int nResult = 0; - int x = 0; - for (int i = 0; i < nCount; i++) - { - pData[i].fsState &= ~TBSTATE_WRAP; - - if (pData[i].fsState & TBSTATE_HIDDEN) - continue; - - int dx, dxNext; - - // **PD** - // Load actual size of button into a local variable - // called m_sizeButton. C++ will use this instead of - // CToolBar::m_sizeButton. - // - CSize m_sizeButton = GetButtonSize(pData, i); - - dx = m_sizeButton.cx; - dxNext = dx - CX_OVERLAP; - - if (x + dx > nWidth) - { - BOOL bFound = FALSE; - for (int j = i; j >= 0 && !(pData[j].fsState & TBSTATE_WRAP); j--) - { - // Find last separator that isn't hidden - // a separator that has a command ID is not - // a separator, but a custom control. - if ((pData[j].fsStyle & TBSTYLE_SEP) && - (pData[j].idCommand == 0) && - !(pData[j].fsState & TBSTATE_HIDDEN)) - { - bFound = TRUE; i = j; x = 0; - pData[j].fsState |= TBSTATE_WRAP; - nResult++; - break; - } - } - if (!bFound) - { - for (int j = i - 1; j >= 0 && !(pData[j].fsState & TBSTATE_WRAP); j--) - { - // Never wrap anything that is hidden, - // or any custom controls - if ((pData[j].fsState & TBSTATE_HIDDEN) || - ((pData[j].fsStyle & TBSTYLE_SEP) && - (pData[j].idCommand != 0))) - continue; - - bFound = TRUE; i = j; x = 0; - pData[j].fsState |= TBSTATE_WRAP; - nResult++; - break; - } - if (!bFound) - x += dxNext; - } - } - else - x += dxNext; - } - return nResult + 1; -} - -////////////////////////////////////////////////////////////////////////// -// **PD** -// Functions below are NOT actually modified. They're only here because they -// calls the modified functions above, which are NOT virtual. -////////////////////////////////////////////////////////////////////////// - -void CFixMFCToolBar::SizeToolBar(TBBUTTON* pData, int nCount, int nLength, BOOL bVert) -{ - ASSERT(pData != NULL && nCount > 0); - - if (!bVert) - { - int nMin, nMax, nTarget, nCurrent, nMid; - - // Wrap ToolBar as specified - nMax = nLength; - nTarget = WrapToolBar(pData, nCount, nMax); - - // Wrap ToolBar vertically - nMin = 0; - nCurrent = WrapToolBar(pData, nCount, nMin); - - if (nCurrent != nTarget) - { - while (nMin < nMax) - { - nMid = (nMin + nMax) / 2; - nCurrent = WrapToolBar(pData, nCount, nMid); - - if (nCurrent == nTarget) - nMax = nMid; - else - { - if (nMin == nMid) - { - WrapToolBar(pData, nCount, nMax); - break; - } - nMin = nMid; - } - } - } - CSize size = CalcSize(pData, nCount); - WrapToolBar(pData, nCount, size.cx); - } - else - { - CSize sizeMax, sizeMin, sizeMid; - - // Wrap ToolBar vertically - WrapToolBar(pData, nCount, 0); - sizeMin = CalcSize(pData, nCount); - - // Wrap ToolBar horizontally - WrapToolBar(pData, nCount, 32767); - sizeMax = CalcSize(pData, nCount); - - while (sizeMin.cx < sizeMax.cx) - { - sizeMid.cx = (sizeMin.cx + sizeMax.cx) / 2; - WrapToolBar(pData, nCount, sizeMid.cx); - sizeMid = CalcSize(pData, nCount); - - if (nLength < sizeMid.cy) - { - if (sizeMin == sizeMid) - { - WrapToolBar(pData, nCount, sizeMax.cx); - return; - } - sizeMin = sizeMid; - } - else if (nLength > sizeMid.cy) - sizeMax = sizeMid; - else - return; - } - } -} - -struct _AFX_CONTROLPOS -{ - int nIndex, nID; - CRect rectOldPos; -}; - -CSize CFixMFCToolBar::CalcLayout(DWORD dwMode, int nLength) -{ - ASSERT_VALID(this); - ASSERT(::IsWindow(m_hWnd)); - if (dwMode & LM_HORZDOCK) - ASSERT(dwMode & LM_HORZ); - - int nCount; - TBBUTTON* pData; - CSize sizeResult(0,0); - - // Load Buttons - { - nCount = SendMessage(TB_BUTTONCOUNT, 0, 0); - if (nCount != 0) - { - int i; - pData = new TBBUTTON[nCount]; - for (i = 0; i < nCount; i++) - GetButton(i, &pData[i]); // **PD** renamed from _GetButton - } - } - - if (nCount > 0) - { - if (!(m_dwStyle & CBRS_SIZE_FIXED)) - { - BOOL bDynamic = m_dwStyle & CBRS_SIZE_DYNAMIC; - - if (bDynamic && (dwMode & LM_MRUWIDTH)) - SizeToolBar(pData, nCount, m_nMRUWidth); - else if (bDynamic && (dwMode & LM_HORZDOCK)) - SizeToolBar(pData, nCount, 32767); - else if (bDynamic && (dwMode & LM_VERTDOCK)) - SizeToolBar(pData, nCount, 0); - else if (bDynamic && (nLength != -1)) - { - CRect rect; rect.SetRectEmpty(); - CalcInsideRect(rect, (dwMode & LM_HORZ)); - BOOL bVert = (dwMode & LM_LENGTHY); - int nLen = nLength + (bVert ? rect.Height() : rect.Width()); - - SizeToolBar(pData, nCount, nLen, bVert); - } - else if (bDynamic && (m_dwStyle & CBRS_FLOATING)) - SizeToolBar(pData, nCount, m_nMRUWidth); - else - SizeToolBar(pData, nCount, (dwMode & LM_HORZ) ? 32767 : 0); - } - - sizeResult = CalcSize(pData, nCount); - - if (dwMode & LM_COMMIT) - { - _AFX_CONTROLPOS* pControl = NULL; - int nControlCount = 0; - BOOL bIsDelayed = m_bDelayedButtonLayout; - m_bDelayedButtonLayout = FALSE; - - for(int i = 0; i < nCount; i++) - if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0)) - nControlCount++; - - if (nControlCount > 0) - { - pControl = new _AFX_CONTROLPOS[nControlCount]; - nControlCount = 0; - - for(int i = 0; i < nCount; i++) - { - if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0)) - { - pControl[nControlCount].nIndex = i; - pControl[nControlCount].nID = pData[i].idCommand; - - CRect rect; - GetItemRect(i, &rect); - ClientToScreen(&rect); - pControl[nControlCount].rectOldPos = rect; - - nControlCount++; - } - } - } - - if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC)) - m_nMRUWidth = sizeResult.cx; - for (i = 0; i < nCount; i++) - SetButton(i, &pData[i]); // **PD** renamed from _SetButton - - if (nControlCount > 0) - { - for (int i = 0; i < nControlCount; i++) - { - CWnd* pWnd = GetDlgItem(pControl[i].nID); - if (pWnd != NULL) - { - CRect rect; - pWnd->GetWindowRect(&rect); - CPoint pt = rect.TopLeft() - pControl[i].rectOldPos.TopLeft(); - GetItemRect(pControl[i].nIndex, &rect); - pt = rect.TopLeft() + pt; - pWnd->SetWindowPos(NULL, pt.x, pt.y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); - } - } - delete[] pControl; - } - m_bDelayedButtonLayout = bIsDelayed; - } - delete[] pData; - } - - //BLOCK: Adjust Margins - { - CRect rect; rect.SetRectEmpty(); - CalcInsideRect(rect, (dwMode & LM_HORZ)); - sizeResult.cy -= rect.Height(); - sizeResult.cx -= rect.Width(); - - CSize size = CControlBar::CalcFixedLayout((dwMode & LM_STRETCH), (dwMode & LM_HORZ)); - sizeResult.cx = max(sizeResult.cx, size.cx); - sizeResult.cy = max(sizeResult.cy, size.cy); - } - return sizeResult; -} - -CSize CFixMFCToolBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) -{ - DWORD dwMode = bStretch ? LM_STRETCH : 0; - dwMode |= bHorz ? LM_HORZ : 0; - - return CalcLayout(dwMode); -} - -CSize CFixMFCToolBar::CalcDynamicLayout(int nLength, DWORD dwMode) -{ - if ((nLength == -1) && !(dwMode & LM_MRUWIDTH) && !(dwMode & LM_COMMIT) && - ((dwMode & LM_HORZDOCK) || (dwMode & LM_VERTDOCK))) - { - return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZDOCK); - } - return CalcLayout(dwMode, nLength); -} - -///////////////////////////////////////////////////////////////////////////// -// CToolBar attribute access - -// **PD** I renamed this from _GetButton. -// -void CFixMFCToolBar::GetButton(int nIndex, TBBUTTON* pButton) const -{ - CToolBar* pBar = (CToolBar*)this; - VERIFY(pBar->SendMessage(TB_GETBUTTON, nIndex, (LPARAM)pButton)); - // TBSTATE_ENABLED == TBBS_DISABLED so invert it - pButton->fsState ^= TBSTATE_ENABLED; -} - -// **PD** I renamed this from _SetButton. -// -void CFixMFCToolBar::SetButton(int nIndex, TBBUTTON* pButton) -{ - // get original button state - TBBUTTON button; - VERIFY(SendMessage(TB_GETBUTTON, nIndex, (LPARAM)&button)); - - // prepare for old/new button comparsion - button.bReserved[0] = 0; - button.bReserved[1] = 0; - // TBSTATE_ENABLED == TBBS_DISABLED so invert it - pButton->fsState ^= TBSTATE_ENABLED; - pButton->bReserved[0] = 0; - pButton->bReserved[1] = 0; - - // nothing to do if they are the same - if (memcmp(pButton, &button, sizeof(TBBUTTON)) != 0) - { - // don't redraw everything while setting the button - DWORD dwStyle = GetStyle(); - ModifyStyle(WS_VISIBLE, 0); - VERIFY(SendMessage(TB_DELETEBUTTON, nIndex, 0)); - VERIFY(SendMessage(TB_INSERTBUTTON, nIndex, (LPARAM)pButton)); - ModifyStyle(0, dwStyle & WS_VISIBLE); - - // invalidate appropriate parts - if (((pButton->fsStyle ^ button.fsStyle) & TBSTYLE_SEP) || - ((pButton->fsStyle & TBSTYLE_SEP) && pButton->iBitmap != button.iBitmap)) - { - // changing a separator - Invalidate(FALSE); - } - else - { - // invalidate just the button - CRect rect; - if (SendMessage(TB_GETITEMRECT, nIndex, (LPARAM)&rect)) - InvalidateRect(rect, FALSE); // don't erase background - } - } -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFlatBar.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFlatBar.cpp deleted file mode 100644 index 2e66ab86729..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFlatBar.cpp +++ /dev/null @@ -1,334 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CFlatToolBar implements dockable flat-style toolbars with "grippers" -// -#include "StdAfx.h" -#include "UIFlatBar.h" -#include "UIModulVer.h" - -// if you want to see extra TRACE diagnostics, set below to TRUE -BOOL CFlatToolBar::bTRACE = FALSE; - -#ifdef _DEBUG -#define FBTRACEFN \ - CTraceFn __fooble; \ - if (bTRACE) \ - TRACE -#define FBTRACE \ - if (bTRACE) \ - TRACE -#else -#define FBTRACEFN TRACE -#define FBTRACE TRACE -#endif - -///////////////// -// One of these for each drop-down button -// -struct DROPDOWNBUTTON { - DROPDOWNBUTTON* next; - UINT idButton; // command ID of button - UINT idMenu; // popup menu to display -}; - -// these define size of grippers -const GRIP_WIDTH = 3; -const GRIP_MARGIN = 5; - -// flags stored in item data -#define ITEMF_INITIALIZED 0x01 // item data initialized -#define ITEMF_CHECKED 0x02 // item is checked - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -//////////////////////////////////////////////////////////////// -// CFlatToolBar--does flat tool bar in MFC. -// -IMPLEMENT_DYNAMIC(CFlatToolBar, CFlatToolBarBase) - -BEGIN_MESSAGE_MAP(CFlatToolBar, CFlatToolBarBase) - ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnTbnDropDown) - ON_WM_WINDOWPOSCHANGING() - ON_WM_WINDOWPOSCHANGED() - ON_WM_NCCALCSIZE() - ON_WM_ERASEBKGND() - ON_WM_NCCREATE() - ON_WM_PAINT() - ON_WM_CREATE() -END_MESSAGE_MAP() - -CFlatToolBar::CFlatToolBar() -{ - FBTRACE(_T("CFlatToolBar::CFlatToolBar, comctl32 version = %d\n"), - iVerComCtl32); - - m_bDrawDisabledButtonsInColor = FALSE; // don't use color - m_bInCoolBar = FALSE; // assume not inside coolbar - m_pDropDownButtons = NULL; // list of drop-down buttons - m_bShowDropdownArrowWhenVertical = TRUE; - m_bNoEntry = FALSE; -} - -CFlatToolBar::~CFlatToolBar() -{ - while (m_pDropDownButtons) { - DROPDOWNBUTTON* pnext = m_pDropDownButtons->next; - delete m_pDropDownButtons; - m_pDropDownButtons = pnext; - } -} - -///////////////// -// Create handler: set flat style by default -// -int CFlatToolBar::OnCreate(LPCREATESTRUCT lpcs) -{ - if (CFlatToolBarBase::OnCreate(lpcs) == -1) - return -1; - ModifyStyle(0, TBSTYLE_FLAT); - return 0; // OK -} - -//////////////// -// Load function sets flat style after loading buttons. -// -BOOL CFlatToolBar::LoadToolBar(LPCTSTR lpszResourceName) -{ - // Set transparent/flat style before loading buttons to allow zero-height - // border. This required because of bug in comctl32.dll that always adds - // a border, unless flat/transparent. - // - DWORD dwStyle = GetStyle(); - ModifyStyle(0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT); - BOOL bRet = CFlatToolBarBase::LoadToolBar(lpszResourceName); - SetWindowLong(m_hWnd, GWL_STYLE, dwStyle); - return bRet; -} - -////////////////// -// Calcluate size of client area. Adds room for grippers -// -void CFlatToolBar::OnNcCalcSize(BOOL bCalc, NCCALCSIZE_PARAMS* pncp) -{ - if (m_bInCoolBar) { // if I am in a coolbar (rebar): - Default(); // ..bypass CToolBar/CControlBar - - } else { - CRect& rc = (CRect&)pncp->rgrc[0]; // rect to return - - // copied from MFC below: - CRect rcMargin(0,0,0,0); - CControlBar::CalcInsideRect(rcMargin, m_dwStyle & CBRS_ORIENT_HORZ); - - // adjust non-client area for border space - rc.left += rcMargin.left; - rc.top += rcMargin.top; // MFC has -2 here, bug for newer comctl32 - rc.right += rcMargin.right; - rc.bottom+= rcMargin.bottom; - } -} - -////////////////// -// MFC doesn't handle moving a TBSTYLE_FLAT toolbar correctly. The simplest -// way to fix it is to repaint whatever was underneath whenever the toolbar -// moves. This is done in this and the following function. All this stuff is -// only required because flat toolbars paint transparently (don't paint their -// backgrounds). -// -void CFlatToolBar::OnWindowPosChanging(LPWINDOWPOS lpwp) -{ - if (m_bInCoolBar) - // inside coolbars, don't do MFC thing - Default(); - else { - CFlatToolBarBase::OnWindowPosChanging(lpwp); - if (!(lpwp->flags & SWP_NOMOVE)) - GetWindowRect(&m_rcOldPos); // remember old position - } -} - -////////////////// -// Now toolbar has really moved: repaint area beneath old position -// -void CFlatToolBar::OnWindowPosChanged(LPWINDOWPOS lpwp) -{ - if (m_bInCoolBar) { - Default(); - } else { - CFlatToolBarBase::OnWindowPosChanged(lpwp); - if (!(lpwp->flags & SWP_NOMOVE)) { // if moved: - InvalidateOldPos(m_rcOldPos); // invalidate area of old position - - // Now paint my non-client area at the new location. - // Without this, you will still have a partial display bug (try it!) - SendMessage(WM_NCPAINT); - } - } -} - -////////////////// -// Invalidate toolbar rectangle. Because flat toolbars are transparent, -// this requires invalidating parent and all siblings that intersect the -// rectangle. -// -void CFlatToolBar::InvalidateOldPos(const CRect& rcInvalid) -{ - // make parent paint the area beneath rectangle - CWnd* pParent = GetParent(); // parent (dock bar/frame) window - ASSERT_VALID(pParent); // check - CRect rc = rcInvalid; // copy rectangle - pParent->ScreenToClient(&rc); // convert to parent client coords - pParent->InvalidateRect(&rc); // invalidate - - // now do same for each sibling too - for (CWnd* pSib = pParent->GetWindow(GW_CHILD); - pSib; - pSib=pSib->GetNextWindow(GW_HWNDNEXT)) { - - CRect rc; // window rect of sibling - pSib->GetWindowRect(&rc); // ... - if (rc.IntersectRect(rc, rcInvalid)) { // if intersects invalid rect - pSib->ScreenToClient(&rc); // convert to sibling coords - pSib->InvalidateRect(&rc); // invalidate - pSib->SendMessage(WM_NCPAINT); // nonclient area too! - } - } -} - -//////////////// -// Override to avoid MFC in case I'm inside a coolbar -// -BOOL CFlatToolBar::OnEraseBkgnd(CDC* pDC) -{ - return m_bInCoolBar ? Default() : CFlatToolBarBase::OnEraseBkgnd(pDC); -} - -////////////////// -// If toolbar is inside a coolbar, need to make the parent frame -// my owner so it will get notifications. -// -BOOL CFlatToolBar::OnNcCreate(LPCREATESTRUCT lpcs) -{ - CWnd* pParent = GetParent(); - ASSERT(pParent); - TCHAR classname[64]; - GetClassName(pParent->m_hWnd, classname, countof(classname)); - if (_tcscmp(classname, REBARCLASSNAME)==0) { - CFrameWnd* pFrame = GetParentFrame(); - ASSERT_VALID(pFrame); - SetOwner(pFrame); - m_bInCoolBar = TRUE; - } - return CFlatToolBarBase::OnNcCreate(lpcs); -} - -////////////////// -// Avoid MFC if I'm inside a coolbar -// -void CFlatToolBar::OnPaint() -{ - if (m_bInCoolBar) - Default(); // bypass CToolBar/CControlBar - else - CFlatToolBarBase::OnPaint(); -} - -//////////////////////////////////////////////////////////////// -// Stuff for handling drop-down buttons in toobars -// - -////////////////// -// Add dropdown buttons. -// The manager takes care of setting appropriate styles, etc. -// -// Args: -// - array of LONGs: MAKELONG(commandID, menuID) -// - number of buttons -// -BOOL CFlatToolBar::AddDropDownButton(UINT nIDButton, UINT nIDMenu, BOOL bArrow) -{ - ASSERT_VALID(this); - - DROPDOWNBUTTON* pb = FindDropDownButton(nIDButton); - if (!pb) { - pb = new DROPDOWNBUTTON; - ASSERT(pb); - pb->next = m_pDropDownButtons; - m_pDropDownButtons = pb; - } - pb->idButton = nIDButton; - pb->idMenu = nIDMenu; - - int iButton = CommandToIndex(nIDButton); - - DWORD dwStyle = GetButtonStyle(iButton); - dwStyle |= TBSTYLE_DROPDOWN; - SetButtonStyle(iButton, dwStyle); - - if (bArrow) - SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS); - - return TRUE; -} - -////////////////// -// Find buttons structure for given ID -// -DROPDOWNBUTTON* CFlatToolBar::FindDropDownButton(UINT nID) -{ - for (DROPDOWNBUTTON* pb = m_pDropDownButtons; pb; pb = pb->next) { - if (pb->idButton == nID) - return pb; - } - return NULL; -} - -////////////////// -// Handle TBN_DROPDOWN -// Default is to display the specified menu at the right place. -// You can override to generate dynamic menus -// -// Args: -// - NMTOOLBAR struct from TBN_DROPDOWN -// - command id of button -// - point to display menu at -// -void CFlatToolBar::OnTbnDropDown(NMHDR* pNMHDR, LRESULT* pRes) -{ - const NMTOOLBAR& nmtb = *(NMTOOLBAR*)pNMHDR; - - // get location of button - CRect rc; - GetRect(nmtb.iItem, rc); - ClientToScreen(&rc); - - // call virtual function to display dropdown menu - OnDropDownButton(nmtb, nmtb.iItem, rc); -} - -///////////////// -// Virtual fn you can override to hand drop-down button -// events with more friendly args -// -void CFlatToolBar::OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc) -{ - DROPDOWNBUTTON* pb = FindDropDownButton(nmtb.iItem); - if (pb && pb->idMenu) { - - // load and display popup menu - CMenu menu; - VERIFY(menu.LoadMenu(pb->idMenu)); - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup); - pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL, - rc.left, rc.bottom, GetOwner(), &rc); - } -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFrameWnd.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFrameWnd.cpp deleted file mode 100644 index 94fbd464320..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIFrameWnd.cpp +++ /dev/null @@ -1,514 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIFrameWnd.h" -#include "UIApp.h" -#include "UIres.h" -#include "UIMessages.h" -#include "WindowPlacement.h" -#include "IEShellTreeView.h" -#include "IEShellListView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -static UINT nMsgMouseWheel = - (((::GetVersion() & 0x80000000) && LOBYTE(LOWORD(::GetVersion()) == 4)) || - (!(::GetVersion() & 0x80000000) && LOBYTE(LOWORD(::GetVersion()) == 3))) - ? ::RegisterWindowMessage(MSH_MOUSEWHEEL) : 0; - -LPCTSTR CUIFrameWnd::szMainFrame = _T("MainFrame"); - -IMPLEMENT_DYNAMIC(CUIFrameWnd, CFrameWnd) - -CUIFrameWnd::CUIFrameWnd() : m_IDToolbar(0),m_pwndCoolBar(NULL) -{ - m_bReportCtrl = false; -} - -CUIFrameWnd::~CUIFrameWnd() -{ - delete m_pwndCoolBar; -} - -void CUIFrameWnd::RestoreWindow(UINT nCmdShow) -{ -// Load window placement from profile - CWindowPlacement wp; - if (!wp.Restore(CUIFrameWnd::szMainFrame, this)) - { - ShowWindow(nCmdShow); - } -} - -CUIStatusBar &CUIFrameWnd::GetStatusBar() -{ - return m_wndStatusBar; -} - -CReallyCoolBar &CUIFrameWnd::GetCoolBar() -{ - ASSERT(m_pwndCoolBar); - return *m_pwndCoolBar; -} - -void CUIFrameWnd::CreateCoolBar() -{ - if (m_pwndCoolBar == NULL) - m_pwndCoolBar = new CReallyCoolBar; -} - -CCoolMenuManager &CUIFrameWnd::GetMenuManager() -{ - return m_menuManager; -} - -BEGIN_MESSAGE_MAP(CUIFrameWnd, CFrameWnd) - //{{AFX_MSG_MAP(CUIFrameWnd) - ON_WM_INITMENUPOPUP() - ON_WM_MENUSELECT() - ON_WM_CREATE() - ON_WM_CLOSE() - ON_WM_MOUSEWHEEL() - //}}AFX_MSG_MAP - ON_REGISTERED_MESSAGE(nMsgMouseWheel, OnRegisteredMouseWheel) - ON_MESSAGE(WM_APP_CB_IE_SET_EDIT_TEXT,OnCBIESetEditText) - ON_MESSAGE(WM_APP_CB_IE_POPULATE,OnCBIEPopulate) - ON_MESSAGE(WM_APP_CB_IE_SEL_CHANGE,OnCBIESelChange) - ON_MESSAGE(WM_APP_CB_IE_HIT_ENTER,OnCBIEHitEnter) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUIFrameWnd message handlers - -BOOL CUIFrameWnd::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - CWinApp *pApp = AfxGetApp(); - if (pApp->IsKindOf(RUNTIME_CLASS(CUIApp))) - { - if (((CUIApp*)pApp)->IsMyClassRegistered()) - { - cs.lpszClass = ((CUIApp*)pApp)->GetMyClass(); - TRACE(_T("Setting to window class %s in CUIFrameWnd\n"),cs.lpszClass); - } - } - if (cs.lpszClass == NULL) - { - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - } - CWindowPlacement wp; - if (wp.GetProfileWP(szMainFrame)) - { - CRect rc(wp.rcNormalPosition); - cs.x = rc.left; - cs.y = rc.top; - cs.cx = rc.Width(); - cs.cy = rc.Height(); - } - return CFrameWnd::PreCreateWindow(cs); -} - -void CUIFrameWnd::OnClose() -{ - // TODO: Add your message handler code here and/or call default - CWindowPlacement wp; - wp.Save(szMainFrame,this); - - CFrameWnd::OnClose(); -} - -void CUIFrameWnd::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) -{ - CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); - // store width of first pane and its style - if (GetStatusBar().m_nStatusPane1Width == -1 && GetStatusBar().m_bMenuSelect) - { - UINT nStatusPane1Style; - GetStatusBar().GetPaneInfo(0, GetStatusBar().m_nStatusPane1ID, - nStatusPane1Style, GetStatusBar().m_nStatusPane1Width); - GetStatusBar().SetPaneInfo(0, GetStatusBar().m_nStatusPane1ID, - SBPS_NOBORDERS|SBPS_STRETCH, 16384); - } -} - - -int CUIFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - // if not tool bar set no point in continuing - ASSERT(m_IDToolbar > 0); - if (m_IDToolbar == 0) - return 0; - - if (!GetStatusBar().Create(this)) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - GetStatusBar().AddPane(ID_SEPARATOR,TRUE); - GetStatusBar().SetPanes(FALSE); - - CreateCoolBar(); - ASSERT(m_pwndCoolBar); - if (m_pwndCoolBar == NULL) - return -1; - CReallyCoolBar& cb = GetCoolBar(); - ASSERT(m_IDToolbar > 0); - cb.SetToolBarID(m_IDToolbar); - VERIFY(cb.Create(this, - WS_CHILD|WS_VISIBLE|WS_BORDER|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - RBS_TOOLTIPS|RBS_BANDBORDERS|RBS_VARHEIGHT)); - - cb.SetColors(GetSysColor(COLOR_BTNTEXT),GetSysColor(COLOR_3DFACE)); - - // install/load cool menus - GetMenuManager().Install(this); - GetMenuManager().LoadToolbar(m_IDToolbar); - if (cb.IsKindOf(RUNTIME_CLASS(CWebBrowserCoolBar))) - GetMenuManager().LoadToolbar(IDB_HOTTOOLBAR); - - if (m_bReportCtrl) - { - if (!m_wndFieldChooser.Create(this, IDD_FIELDCHOOSER, - CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_HIDE_INPLACE, ID_VIEW_FIELDCHOOSER)) - return -1; // fail to create - - EnableDocking(CBRS_ALIGN_ANY); - - m_wndFieldChooser.EnableDocking(0); - m_wndFieldChooser.SetWindowText(_T("Field Chooser")); - - FloatControlBar(&m_wndFieldChooser, CPoint(100, GetSystemMetrics(SM_CYSCREEN) / 3)); - ShowControlBar(&m_wndFieldChooser, FALSE, FALSE); - } - return 0; -} - -void CUIFrameWnd::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) -{ - CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu); - - // Restore first pane of the statusbar? - if (nFlags == 0xFFFF && hSysMenu == 0 && GetStatusBar().m_nStatusPane1Width != -1) - { - GetStatusBar().m_bMenuSelect = FALSE; - GetStatusBar().SetPaneInfo(0, GetStatusBar().m_nStatusPane1ID, GetStatusBar().m_nStatusPane1Style, GetStatusBar().m_nStatusPane1Width); - GetStatusBar().m_nStatusPane1Width = -1; // Set it to illegal value - } - else - { - GetStatusBar().m_bMenuSelect = TRUE; - } -} - -void CUIFrameWnd::GetMessageString( UINT nID, CString& rMessage ) const -{ - CFrameWnd::GetMessageString(nID,rMessage); - CUIFrameWnd *pThis = const_cast(this); - if (pThis->GetStatusBar().IsPanes()) - pThis->GetStatusBar().SetPaneText(0,rMessage); -} - -BOOL CUIFrameWnd::PreTranslateMessage(MSG* pMsg) -{ - return m_pwndCoolBar && m_pwndCoolBar->m_wndMenuBar.TranslateFrameMessage(pMsg) ? - TRUE : CFrameWnd::PreTranslateMessage(pMsg); -} - -//////////////////////////////////////////////////////////////// -// CReallyCoolBar -// -IMPLEMENT_DYNAMIC(CReallyCoolBar, CCoolBar) -IMPLEMENT_DYNAMIC(CWebBrowserCoolBar, CCoolBar) - -//////////////// -// This is the virtual function you have to override to add bands -// -BOOL CReallyCoolBar::OnCreateBands() -{ - ////////////////// - // Create menu bar - CMenuBar& mb = m_wndMenuBar; - - VERIFY(mb.Create(this, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC|CBRS_FLYBY|CBRS_ORIENT_HORZ)); - mb.ModifyStyle(0, TBSTYLE_TRANSPARENT); - - // Load doc or main menu. Only required since this app flips - // between coolbar/toolbars. - CFrameWnd *pParent = GetParentFrame(); - CFrameWnd* pFrame = pParent->GetActiveFrame(); - ASSERT(m_IDToolbar > 0); - mb.LoadMenu(m_IDToolbar); - - CRect rc; - mb.GetItemRect(0, &rc); - CSize szMenu = mb.CalcDynamicLayout(-1, LM_HORZ); // get min horz size - - // create menu bar band. - CSize szMin; - szMin = CSize( szMenu.cx, rc.Height()); - if (!InsertBand(&mb, szMin, 0x7ff)) - return FALSE; - - ////////////////// - // Create tool bar - CFlatToolBar& tb = m_wndToolBar; - VERIFY(tb.Create(this, - WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC|CBRS_FLYBY|CBRS_ORIENT_HORZ)); - VERIFY(tb.LoadToolBar(m_IDToolbar)); - // use transparent so coolbar bitmap will show through - tb.ModifyStyle(0, TBSTYLE_TRANSPARENT); - - // Get minimum size of toolbar, which is basically size of one button - CSize szHorz = tb.CalcDynamicLayout(-1, LM_HORZ); // get min horz size - tb.GetItemRect(0, &rc); - szMin = rc.Size(); // CSize( szHorz.cx, rc.Height()); - - // create toolbar band. Use largest size possible - if (!InsertBand(&tb, szMin, 0x7fff, NULL, -1, TRUE)) - return FALSE; - - return TRUE; // OK -} - -void CReallyCoolBar::SetToolBarID(UINT IDToolbar) -{ - m_IDToolbar = IDToolbar; -} - -BOOL CWebBrowserCoolBar::OnCreateBands() -{ - CReallyCoolBar::OnCreateBands(); - - CFlatToolBar& bb = m_wndBrowserBar; - VERIFY(bb.Create(this, - WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC|CBRS_FLYBY|CBRS_ORIENT_HORZ)); - CImageList img; - CString str; -// bb.GetToolBarCtrl().SetButtonWidth(50, 150); - bb.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS); - img.Create(IDB_HOTTOOLBAR, 22, 0, RGB(255, 0, 255)); - bb.GetToolBarCtrl().SetHotImageList(&img); - img.Detach(); - img.Create(IDB_COLDTOOLBAR, 22, 0, RGB(255, 0, 255)); - bb.GetToolBarCtrl().SetImageList(&img); - img.Detach(); - bb.ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT); - bb.SetButtons(NULL, 7); - // use transparent so coolbar bitmap will show through - bb.ModifyStyle(0, TBSTYLE_TRANSPARENT); - - // set up each toolbar button -/* str.LoadString(IDS_BROWSER_GO_BACK); - bb.SetButtonText(0, str); - str.LoadString(IDS_BROWSER_GO_FORWARD); - bb.SetButtonText(1, str); - str.LoadString(IDS_BROWSER_STOP); - bb.SetButtonText(2, str); - str.LoadString(IDS_BROWSER_REFRESH); - bb.SetButtonText(3, str); - str.LoadString(IDS_BROWSER_GO_HOME); - bb.SetButtonText(4, str); - str.LoadString(IDS_BROWSER_SEARCH); - bb.SetButtonText(5, str); - str.LoadString(IDS_BROWSER_FAVORITES); - bb.SetButtonText(6, str); -*/ - bb.SetButtonInfo(0, ID_BROWSER_GO_BACK, TBSTYLE_BUTTON, 0); - bb.SetButtonInfo(1, ID_BROWSER_GO_FORWARD, TBSTYLE_BUTTON, 1); - bb.SetButtonInfo(2, ID_BROWSER_STOP, TBSTYLE_BUTTON, 2); - bb.SetButtonInfo(3, ID_BROWSER_REFRESH, TBSTYLE_BUTTON, 3); - bb.SetButtonInfo(4, ID_BROWSER_GO_HOME, TBSTYLE_BUTTON, 4); - bb.SetButtonInfo(5, ID_BROWSER_SEARCH, TBSTYLE_BUTTON, 5); - bb.SetButtonInfo(6, ID_BROWSER_FAVORITES, TBSTYLE_BUTTON, 6); - - - CRect rectToolBar; - CRect rc; - // set up toolbar button sizes - bb.GetItemRect(0, &rectToolBar); -// bb.SetSizes(rectToolBar.Size(), CSize(30,20)); - - // Get minimum size of toolbar, which is basically size of one button - CSize szHorz = bb.CalcDynamicLayout(-1, LM_HORZ); // get min horz size - bb.GetItemRect(0, &rc); - CSize szMin = rc.Size(); // CSize( szHorz.cx, rc.Height()); - - // create toolbar band. Use largest size possible - if (!InsertBand(&bb, szMin, 0x7fff, NULL, -1, TRUE)) - return FALSE; - - ////////////////// - // Create combo box and fill with data - - CRect rcCombo(0,0,600,200); - m_wndCombo.Create(WS_VISIBLE|WS_CHILD|WS_VSCROLL|CBS_DROPDOWN| - WS_CLIPCHILDREN|WS_CLIPSIBLINGS, rcCombo, this, IDC_CB_IE_ADDRESS); - m_wndCombo.SetFont(GetFont()); - - CSize szMinCombo = m_wndBrowserBar.CalcDynamicLayout(-1, LM_HORZDOCK); // get min horz size - if (!InsertBand(&m_wndCombo, szMinCombo, 0x7fff, _T("Address"))) - return FALSE; - - return TRUE; -} - -// changed from MFC to use WindowFromPoint instead of GetFocus -LRESULT CUIFrameWnd::OnRegisteredMouseWheel(WPARAM wParam, LPARAM lParam) -{ - // convert from MSH_MOUSEWHEEL to WM_MOUSEWHEEL - TRACE(_T("CUFrameWnd registered mouse wheel message\n")); -// return CFrameWnd::OnRegisteredMouseWheel(wParam,lParam); - - WORD keyState = 0; - keyState |= (::GetKeyState(VK_CONTROL) < 0) ? MK_CONTROL : 0; - keyState |= (::GetKeyState(VK_SHIFT) < 0) ? MK_SHIFT : 0; - - LRESULT lResult; - CPoint point; - ::GetCursorPos(&point); - HWND hwFocus = ::WindowFromPoint(point); -// HWND hwFocus = ::GetFocus(); - const HWND hwDesktop = ::GetDesktopWindow(); - - if (hwFocus == NULL) - lResult = SendMessage(WM_MOUSEWHEEL, (wParam << 16) | keyState, lParam); - else - { - do { - lParam = ::SendMessage(hwFocus, WM_MOUSEWHEEL, - (wParam << 16) | keyState, lParam); - hwFocus = ::GetParent(hwFocus); - } - while (lParam == 0 && hwFocus != NULL && hwFocus != hwDesktop); - } - return lResult; - -} - -BOOL CUIFrameWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -{ - CFrameWnd::OnMouseWheel(nFlags,zDelta,pt); - // TODO: Add your message handler code here and/or call default - TRACE(_T("CUIFrameWnd mouse wheel message\n")); - return TRUE; -} - -LRESULT CUIFrameWnd::OnCBIEPopulate(WPARAM wParam,LPARAM lParam) -{ - TRACE(_T("Received ComboBox populate message in CUIFrameWnd\n")); - if (m_pwndCoolBar && m_pwndCoolBar->IsKindOf(RUNTIME_CLASS(CWebBrowserCoolBar))) - { - TRACE(_T("Sending to ShellComboBox...\n")); - ((CWebBrowserCoolBar*)m_pwndCoolBar)->GetComboBox().SendMessage(WM_APP_CB_IE_POPULATE,wParam,lParam); - } - return 1L; -} - -LRESULT CUIFrameWnd::OnCBIEHitEnter(WPARAM wParam,LPARAM lParam) -{ - if (lParam == NULL) - return 0L; - if (m_pwndCoolBar && m_pwndCoolBar->IsKindOf(RUNTIME_CLASS(CWebBrowserCoolBar))) - { - CWinApp *pApp = AfxGetApp(); - CUIApp *pUIApp=NULL; - if (pApp->IsKindOf(RUNTIME_CLASS(CUIApp))) - pUIApp = (CUIApp*)pApp; - if (pUIApp) - { - CView *pView = NULL; - pView = pUIApp->GetView(RUNTIME_CLASS(CIEShellTreeView)); - if (pView) - { - LRESULT lResult = 0; - if (wParam == 0) - lResult = ((CIEShellTreeView*)pView)->GetShellTreeCtrl().SendMessage(WM_APP_CB_IE_HIT_ENTER,wParam,lParam); - if (lResult == 0) - { - pView = pUIApp->GetView(RUNTIME_CLASS(CIEShellListView)); - if (pView) - pView->SendMessage(WM_APP_CB_IE_HIT_ENTER,wParam,lParam); - } - } - } - } - return 1L; -} - -LRESULT CUIFrameWnd::OnCBIESelChange(WPARAM wParam,LPARAM lParam) -{ - if (m_pwndCoolBar && m_pwndCoolBar->IsKindOf(RUNTIME_CLASS(CWebBrowserCoolBar))) - { - CWinApp *pApp = AfxGetApp(); - CUIApp *pUIApp=NULL; - if (pApp->IsKindOf(RUNTIME_CLASS(CUIApp))) - pUIApp = (CUIApp*)pApp; - if (pUIApp) - { - CView *pView = NULL; - if (wParam) - { - pView = pUIApp->GetView(RUNTIME_CLASS(CIEShellTreeView)); - if (pView) - ((CIEShellTreeView*)pView)->GetShellTreeCtrl().SendMessage(WM_APP_CB_IE_SEL_CHANGE,wParam,lParam); - } - else - { - pView = pUIApp->GetView(RUNTIME_CLASS(CIEShellListView)); - if (pView) - pView->SendMessage(WM_APP_CB_IE_SEL_CHANGE,wParam,lParam); - } - } - } - return 1L; -} - -LRESULT CUIFrameWnd::OnCBIESetEditText(WPARAM wParam,LPARAM lParam) -{ - if (m_pwndCoolBar && m_pwndCoolBar->IsKindOf(RUNTIME_CLASS(CWebBrowserCoolBar))) - { - if (wParam) - ((CWebBrowserCoolBar*)m_pwndCoolBar)->GetComboBox().GetEditCtrl()->SetWindowText((LPCTSTR)wParam); - } - return 1L; -} - - -//////////////////////////////////////////////////////////////// -// CToolBarComboBox -// - -BEGIN_MESSAGE_MAP(CToolBarComboBox, CIEShellComboBox) -END_MESSAGE_MAP() - -////////////////// diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIHtmlView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIHtmlView.cpp deleted file mode 100644 index e9d4efcd19a..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIHtmlView.cpp +++ /dev/null @@ -1,694 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// HtmlMsgView.cpp : implementation file -// - -#include "stdafx.h" -#include "UIHtmlView.h" -#include "UIMessages.h" -#include -#include -#include "UIres.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUIHtmlView - -IMPLEMENT_DYNAMIC(CUIHtmlView, CHtmlView) - -CUIHtmlView::CUIHtmlView() -{ - //{{AFX_DATA_INIT(CUIHtmlView) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_pHTMLDocument2 = NULL; - m_hNotifyWnd = NULL; - m_bSetCursor = false; -} - -CUIHtmlView::~CUIHtmlView() -{ - ReleaseDocument(); -} - -BOOL CUIHtmlView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - BOOL bRet = CHtmlView::PreCreateWindow(cs); - cs.dwExStyle |= WS_EX_CLIENTEDGE; -// cs.style |= WS_BORDER; - return bRet; -} - -void CUIHtmlView::ReleaseDocument() -{ - if (m_pHTMLDocument2) - { - m_pHTMLDocument2->Release(); - m_pHTMLDocument2 = NULL; - } -} - -void CUIHtmlView::DocumentReady() -{ - m_bSetCursor = false; -} - -bool CUIHtmlView::ExecScript(LPCTSTR pszScript,LPCTSTR pszLang,_variant_t *pvt) -{ - bool bRet = false; - CWaitCursor w; - IHTMLWindow2 *pW2=NULL; - IHTMLDocument2 *pDoc = GetHTMLDocument(); - if (pDoc == NULL) - return bRet; - HRESULT hr = pDoc->get_parentWindow(&pW2); - if (SUCCEEDED(hr)) - { - if (pszLang == NULL) - pszLang = _T("JScript"); - _variant_t v; - hr = pW2->execScript(_bstr_t(pszScript),_bstr_t(pszLang),&v); - if (pvt) - *pvt = v; - pW2->Release(); - bRet= true; - } - return bRet; -} - -CString CUIHtmlView::GetBodyText() -{ - IHTMLElement *pElem=NULL; - GetHTMLDocument()->get_body(&pElem); - _bstr_t bstText; - BSTR bsText; - pElem->get_innerText(&bsText); - pElem->Release(); - bstText = bsText; - return (LPCTSTR)bstText; -} - -CString CUIHtmlView::GetElementValue(LPCTSTR pszElemID) -{ - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - BSTR bsText; - _bstr_t bstText; - if (pElem) - { - IHTMLInputTextElement *pInputElem=NULL; - HRESULT hr = pElem->QueryInterface(IID_IHTMLInputTextElement,(LPVOID*)&pInputElem); - if (SUCCEEDED(hr)) - { - pInputElem->get_value(&bsText); - bstText= bsText; - pInputElem->Release(); - pInputElem = NULL; - } - pElem->Release(); - } - return (LPCTSTR)bstText; -} - -CString CUIHtmlView::GetElementText(LPCTSTR pszElemID) -{ - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - if (pElem == NULL) - return _T(""); - BSTR bsText; - _bstr_t bstText; - pElem->get_innerText(&bsText); - bstText = bsText; - pElem->Release(); - pElem = NULL; - return (LPCTSTR)bstText; -} - -CString CUIHtmlView::GetElementHTML(LPCTSTR pszElemID) -{ - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - BSTR bsText; - _bstr_t bstText; - if (pElem) - { - pElem->get_innerHTML(&bsText); - bstText = bsText; - pElem->Release(); - pElem = NULL; - } - return (LPCTSTR)bstText; -} - -bool CUIHtmlView::SetElementValue(LPCTSTR pszElemID,LPCTSTR pszText) -{ - bool bRet=false; - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - if (pElem) - { - IHTMLInputTextElement *pInputElem=NULL; - HRESULT hr = pElem->QueryInterface(IID_IHTMLInputTextElement,(LPVOID*)&pInputElem); - if (SUCCEEDED(hr)) - { - pInputElem->put_value(_bstr_t(pszText)); - pInputElem->Release(); - pInputElem = NULL; - bRet = true; - } - pElem->Release(); - pElem = NULL; - } - return bRet; -} - -bool CUIHtmlView::SetElementText(LPCTSTR pszElemID,LPCTSTR pszText) -{ - bool bRet=false; - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - if (pElem == NULL) - return bRet; - pElem->put_innerText(_bstr_t(pszText)); - pElem->Release(); - pElem = NULL; - bRet= true; - return bRet; -} - -bool CUIHtmlView::SetElementHTML(LPCTSTR pszElemID,LPCTSTR pszText) -{ - bool bRet=false; - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - if (pElem == NULL) - return bRet; - pElem->put_innerHTML(_bstr_t(pszText)); - pElem->Release(); - pElem = NULL; - bRet= true; - return bRet; -} - -bool CUIHtmlView::SetImageSource(LPCTSTR pszElemID,LPCTSTR pszText) -{ - bool bRet=false; - IHTMLElement *pElem=NULL; - GetElement(pszElemID,&pElem); - if (pElem == NULL) - return bRet; - IHTMLImgElement *pImgElem=NULL; - HRESULT hr = pElem->QueryInterface(IID_IHTMLImgElement,(LPVOID*)&pImgElem); - pElem->Release(); - if (SUCCEEDED(hr)) - { - pImgElem->put_src(_bstr_t(pszText)); - pImgElem->Release(); - bRet = true; - } - return bRet; -} - -bool CUIHtmlView::GetOptionString(LPCTSTR pszElemID,CString &sText,CString &sValue) -{ - IHTMLElement *pElement = NULL; - GetElement(pszElemID,&pElement); - bool bRet=false; - if (pElement == NULL) - return bRet; - IHTMLSelectElement *pSelElem=NULL; - HRESULT hr = pElement->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&pSelElem); - pElement->Release(); - pElement = NULL; - if (FAILED(hr)) - return bRet; - long nSelIndex=-1; - pSelElem->get_selectedIndex(&nSelIndex); - if (nSelIndex == -1) - { - pSelElem->Release(); - return bRet; - } - IDispatch *pDisp=NULL; - _variant_t vtName(nSelIndex); - _variant_t vtIndex; - pSelElem->item(vtName,vtIndex,&pDisp); - IHTMLOptionElement *pOptElem=NULL; - hr = pDisp->QueryInterface(IID_IHTMLOptionElement,(LPVOID*)&pOptElem); - if (SUCCEEDED(hr)) - { - _bstr_t bstValue; - BSTR bsValue; - pOptElem->get_value(&bsValue); - bstValue = bsValue; - sValue = (LPCTSTR)bstValue; - BSTR bsText; - _bstr_t bstText; - pOptElem->get_text(&bsText); - bstText = bsText; - sText = (LPCTSTR)bstText; - pOptElem->Release(); - bRet=true; - } - if (pSelElem) - pSelElem->Release(); - return bRet; -} - -bool CUIHtmlView::SetOptionString(LPCTSTR pszElemID,LPCTSTR pszText) -{ - IHTMLElement *pElement = NULL; - GetElement(pszElemID,&pElement); - bool bRet=false; - if (pElement == NULL) - return bRet; - IHTMLSelectElement *pSelElem=NULL; - IDispatch *pDisp=NULL; - HRESULT hr = pElement->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&pSelElem); - if (FAILED(hr)) - goto SOS_CleanUp; - { - long nLength=0; - pSelElem->get_length(&nLength); - for(long i=0;i < nLength;i++) - { - _variant_t vtName(i); - _variant_t vtIndex; - pSelElem->item(vtName,vtIndex,&pDisp); - if (pDisp == NULL) - continue; - IHTMLOptionElement *pOptElem=NULL; - hr = pDisp->QueryInterface(IID_IHTMLOptionElement,(LPVOID*)&pOptElem); - pDisp->Release(); - pDisp = NULL; - if (SUCCEEDED(hr)) - { - _bstr_t bstValue; - _bstr_t bstText; - BSTR bsValue; - BSTR bsText; - pOptElem->get_value(&bsValue); - pOptElem->get_text(&bsText); - bstValue = bsValue; - bstText = bsText; - pOptElem->Release(); - if (_tcsicmp((LPCTSTR)bstText,pszText) == 0) - { - pSelElem->put_selectedIndex(i); - bRet=true; - break; - } - } - } - } -SOS_CleanUp: - if (pElement) - pElement->Release(); - if (pSelElem) - pSelElem->Release(); - return bRet; -} - -bool CUIHtmlView::AddOptionString(LPCTSTR pszElemID,LPCTSTR pszText,LPCTSTR pszValue,bool bSelect) -{ - IHTMLElement *pElement = NULL; - GetElement(pszElemID,&pElement); - bool bRet=false; - if (pElement == NULL) - return bRet; - IHTMLSelectElement *pSelElem=NULL; - HRESULT hr = pElement->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&pSelElem); - pElement->Release(); - if (FAILED(hr)) - return bRet; - IHTMLElement *pNewElem=NULL; - GetHTMLDocument()->createElement(_bstr_t(_T("OPTION")),&pNewElem); - IHTMLOptionElement *pNewOptElem=NULL; - hr = E_FAIL; - if (pNewElem) - hr = pNewElem->QueryInterface(IID_IHTMLOptionElement,(LPVOID*)&pNewOptElem); - if (SUCCEEDED(hr)) - { - if (pszValue) - { - _bstr_t bsValue(pszValue); - pNewOptElem->put_value(bsValue); - } - _bstr_t bsText(pszText); - pNewOptElem->put_text(bsText); - pSelElem->add(pNewElem,_variant_t(vtMissing)); - pNewOptElem->Release(); - if (bSelect) - { - long nLength=0; - pSelElem->get_length(&nLength); - if (nLength > 0) - pSelElem->put_selectedIndex(nLength-1); - } - bRet=true; - } - if (pSelElem) - pSelElem->Release(); - return bRet; -} - -void CUIHtmlView::GetElement(LPCTSTR pszID,IHTMLElement **pElement) -{ - *pElement=NULL; - if (m_pHTMLDocument2 == NULL) - return; - CComQIPtr spAllElements; - m_pHTMLDocument2->get_all(&spAllElements); - if (spAllElements) - { - IDispatch *pDisp=NULL; - HRESULT hr = spAllElements->item(CComVariant(pszID),CComVariant(0),&pDisp); - if (SUCCEEDED(hr)) - { - hr = pDisp->QueryInterface(IID_IHTMLElement,(LPVOID*)pElement); - } - pDisp->Release(); - } -} - -void CUIHtmlView::ParseDocument() -{ - if(m_pHTMLDocument2 == NULL) - return; - try - { - CComQIPtr spDocument(m_pHTMLDocument2); - CComQIPtr spAllElements; - spDocument->get_all(&spAllElements); - CComBSTR bsIsControl(_T("OBJECT")); - CComBSTR bsIsImage(_T("IMG")); - long nElems; - spAllElements->get_length(&nElems); - for(long i = 0; i < nElems; i++) - { - CComVariant vIndex(i, VT_I4); - LPDISPATCH pDisp=NULL; - spAllElements->item(vIndex,vIndex,&pDisp); - CComQIPtr spAnElement(pDisp); - pDisp->Release(); - CComBSTR bsTagName; - spAnElement->get_tagName(&bsTagName); - if(bsTagName == bsIsControl) - { - // This will get you any ActiveX controls in a page. It is possible - // to call methods and properties of the control off the IHTMLElementPtr. - CComQIPtr spObj(spAnElement); - ActiveXControl(spObj); - } - else if(bsTagName == bsIsImage) - { - CComQIPtr spImg(spAnElement); - ImageElement(spImg); - } - else - Element(spAnElement); - } - } - catch(...) - { -#ifdef _DEBUG - AfxMessageBox(_T("Unspecified exception thrown in UIHtmlView"),MB_ICONSTOP); -#endif - throw; - } -} - -void CUIHtmlView::ActiveXControl(IHTMLObjectElement *pObj) -{ -} - -void CUIHtmlView::ImageElement(IHTMLImgElement *pImg) -{ -} - -void CUIHtmlView::Element(IHTMLElement *pElement) -{ -} - -void CUIHtmlView::DoDataExchange(CDataExchange* pDX) -{ - CHtmlView::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CUIHtmlView) - // NOTE: the ClassWizard will add DDX and DDV calls here - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CUIHtmlView, CHtmlView) - //{{AFX_MSG_MAP(CUIHtmlView) - ON_WM_SETCURSOR() - ON_COMMAND(ID_BROWSER_GO_BACK, OnBrowserGoBack) - ON_COMMAND(ID_BROWSER_GO_FORWARD, OnBrowserGoForward) - ON_COMMAND(ID_BROWSER_GO_BACK, OnBrowserGoBack) - ON_UPDATE_COMMAND_UI(ID_BROWSER_GO_FORWARD, OnUpdateBrowserGoForward) - ON_UPDATE_COMMAND_UI(ID_BROWSER_GO_BACK, OnUpdateBrowserGoBack) - ON_COMMAND(ID_BROWSER_GO_HOME, OnBrowserGoHome) - ON_COMMAND(ID_BROWSER_REFRESH, OnBrowserRefresh) - ON_COMMAND(ID_BROWSER_STOP, OnBrowserStop) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUIHtmlView diagnostics - -#ifdef _DEBUG -void CUIHtmlView::AssertValid() const -{ - CHtmlView::AssertValid(); -} - -void CUIHtmlView::Dump(CDumpContext& dc) const -{ - CHtmlView::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CUIHtmlView message handlers - -void CUIHtmlView::DocumentComplete(LPDISPATCH pDisp, VARIANT* URL) -{ - // TODO: Add your specialized code here and/or call the base class - - HRESULT hr; - LPUNKNOWN lpUnknown; - LPUNKNOWN lpUnknownWB = NULL; - LPUNKNOWN lpUnknownDC = NULL; - - lpUnknown = m_wndBrowser.GetControlUnknown(); - ASSERT(lpUnknown); - - if (lpUnknown) - { - // Get the IUnknown of the WebBrowser control being hosted. - // The IUnknown returned from GetControlUnknown is not the - // IUnknown of the WebBrowser control. It's actually a - // IOleObject pointer. - // - hr = lpUnknown->QueryInterface(IID_IUnknown, - (LPVOID*)&lpUnknownWB); - - ASSERT(SUCCEEDED(hr)); - - if (FAILED(hr)) - return; - - // Get the IUnknown of the object that fired this event. - // - hr = pDisp->QueryInterface(IID_IUnknown, (LPVOID*)&lpUnknownDC); - - - ASSERT(SUCCEEDED(hr)); - - if (SUCCEEDED(hr) && lpUnknownWB == lpUnknownDC) - { - // The document has finished loading. - // - LPDISPATCH pDispatch = GetHtmlDocument(); - if (pDispatch) - { - hr = pDispatch->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&m_pHTMLDocument2); - DocumentReady(); - pDispatch->Release(); - } - } - if (lpUnknownWB) - lpUnknownWB->Release(); - - if (lpUnknownDC) - lpUnknownDC->Release(); - } -} - -void CUIHtmlView::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel) -{ - // TODO: Add your specialized code here and/or call the base class ReleaseDocument(); - m_bSetCursor = true; -#ifdef _DEBUG - if (GetKeyState(VK_LCONTROL) < 0) - { - if (baPostedData.GetSize() > 0) - { - LPTSTR pszData = new TCHAR[baPostedData.GetSize()+1]; - LPTSTR pszPosted = pszData; - for(int i=0;i < baPostedData.GetSize();i++) - { - *pszPosted = baPostedData[i]; - pszPosted =_tcsinc(pszPosted); - } - *pszPosted = '\0'; - CString sMess; - sMess = _T("Posted Data: "); - sMess += pszData; - sMess += _T("\n"); - sMess += _T("URL: "); - sMess += lpszURL; - AfxMessageBox(sMess); - delete pszData; - } - } -#endif - ReleaseDocument(); - if (m_hNotifyWnd) - { - ::SendMessage(m_hNotifyWnd,WM_APP_CB_IE_SET_EDIT_TEXT,(WPARAM)lpszURL,0); - } - CHtmlView::OnBeforeNavigate2(lpszURL, nFlags, lpszTargetFrameName, baPostedData, lpszHeaders, pbCancel); -} - -BOOL CUIHtmlView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - // TODO: Add your message handler code here and/or call default - if (m_bSetCursor) - { - SetCursor(::LoadCursor(NULL,IDC_APPSTARTING)); - return TRUE; - } - - return CHtmlView::OnSetCursor(pWnd, nHitTest, message); -} - -void CUIHtmlView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) -{ - // TODO: Add your specialized code here and/or call the base class - -} - -void CUIHtmlView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) -{ - // TODO: Add your specialized code here and/or call the base class - CHtmlView::OnActivateView(bActivate, pActivateView, pDeactiveView); - if (bActivate && pDeactiveView != NULL) - { - OnTitleChange(GetLocationURL()); - SetActiveWindow(); - } -} - -void CUIHtmlView::OnCommandStateChange(long nCommand, BOOL bEnable) -{ - // TODO: Add your specialized code here and/or call the base class - switch(nCommand) - { - case CSC_NAVIGATEFORWARD: - m_bGoForward = bEnable; - break; - case CSC_NAVIGATEBACK: - m_bGoBack = bEnable; - break; - default: - break; - } - - CHtmlView::OnCommandStateChange(nCommand, bEnable); -} - -void CUIHtmlView::OnUpdateBrowserGoBack(CCmdUI *pUI) -{ - pUI->Enable(m_bGoBack); -} - -void CUIHtmlView::OnUpdateBrowserGoForward(CCmdUI *pUI) -{ - pUI->Enable(m_bGoForward); -} - -void CUIHtmlView::OnBrowserGoBack() -{ - // TODO: Add your command handler code here - GoBack(); -} - -void CUIHtmlView::OnBrowserGoForward() -{ - // TODO: Add your command handler code here - GoForward(); -} - -void CUIHtmlView::OnBrowserGoHome() -{ - // TODO: Add your command handler code here - GoHome(); -} - -void CUIHtmlView::OnBrowserRefresh() -{ - // TODO: Add your command handler code here - Refresh(); -} - -void CUIHtmlView::OnBrowserStop() -{ - // TODO: Add your command handler code here - Stop(); -} - -void CUIHtmlView::OnDocumentComplete(LPCTSTR lpszUrl) -{ - // make sure the main frame has the new URL. This call also stops the animation - if (m_hNotifyWnd) - { - ::SendMessage(m_hNotifyWnd,WM_APP_CB_IE_SET_EDIT_TEXT,(WPARAM)lpszUrl,0); - } - CHtmlView::OnDocumentComplete(lpszUrl); -} - -void CUIHtmlView::OnTitleChange(LPCTSTR lpszText) -{ - // this will change the main frame's title bar - if (m_pDocument != NULL) - m_pDocument->SetTitle(lpszText); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIImageDropTarget.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIImageDropTarget.cpp deleted file mode 100644 index 8f76cc71015..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIImageDropTarget.cpp +++ /dev/null @@ -1,173 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// IM_OleImageDropTarget.cpp : implementation file -// - -#include "stdafx.h" -#include "UIDragImage.h" -#include "UIImageDropTarget.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUI_ImageDropTarget - -CUI_ImageDropTarget::CUI_ImageDropTarget() : m_pImage(NULL),m_pWnd(NULL) -{ - m_nCFFormat = ::RegisterClipboardFormat(_T("APP_CF_DD_LISTCTRL_IMAGE")); - m_nImage = -1; -} - -CUI_ImageDropTarget::~CUI_ImageDropTarget() -{ -} - - -///////////////////////////////////////////////// -// -// For OLE drag and drop -// -///////////////////////////////////////////////// -void CUI_ImageDropTarget::OnDragLeave( CWnd* pWnd) -{ - if (m_pImage == NULL) - return; - - // Erase the old drag image and delete the temporary widget. - CClientDC dc(GetImageWin(pWnd)); - m_pImage->DrawDragImage (&dc,m_ptOldImage,m_ptItem); - delete m_pImage; - m_pImage = NULL; - - COleDropTarget::OnDragLeave(pWnd); -} - -DROPEFFECT CUI_ImageDropTarget::OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - DROPEFFECT dwEffect = COleDropTarget::OnDragEnter(pWnd,pDataObject,dwKeyState,point); - HGLOBAL hData = pDataObject->GetGlobalData(GetClipboardFormat()); - if (hData == NULL) - return dwEffect; - // - // Create a temporary image for drag imaging. - // - int *pData = (int*)::GlobalLock(hData); - int nType = *pData++; - int nSelected = *pData++; - DD_ImageData *pImageData = (DD_ImageData*)pData; - CPoint pt = pImageData->m_ptDrag; - int i; - switch (nType) - { - case LVS_ICON: - case LVS_SMALLICON: - case LVS_LIST: - case LVS_REPORT: - m_pImage = new CDragDropImage(nSelected,nType); - for(i=0;i < nSelected;i++) - { - m_pImage->AddItem(&pImageData->m_rcItem,&pImageData->m_rcIcon); - pImageData++; - } - break; - default: - ASSERT(0); - // Just in case - ::GlobalUnlock(hData); - return DROPEFFECT_NONE; - } - // total item - CRect rcItem; - pData = (int*)pImageData; - rcItem.left = *pData++; - rcItem.right = *pData++; - rcItem.top = *pData++; - rcItem.bottom = *pData; - ::GlobalUnlock(hData); - - // - // Begin dragging. - // - CClientDC dc(GetImageWin(pWnd)); - pWnd->ClientToScreen(&point); - m_pWnd->ScreenToClient(&point); - dc.DPtoLP(&point); - m_ptItem = pt; - - CPoint ptDrag (point.x, point.y); - m_ptOldImage.x = m_ptOldImage.y = -32000; - m_ptPrevPos = point; - - return dwEffect; -} - -DROPEFFECT CUI_ImageDropTarget::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - DROPEFFECT dwEffect = COleDropTarget::OnDragOver(pWnd,pDataObject,dwKeyState,point); - if (!pDataObject->IsDataAvailable(GetClipboardFormat())) - return dwEffect; - // Erase the old drag image and draw a new one if the cursor has moved. - CClientDC dc(GetImageWin(pWnd)); - pWnd->ClientToScreen(&point); - m_pWnd->ScreenToClient(&point); - dc.DPtoLP(&point); - if (m_pImage && point != m_ptPrevPos) - { - // erase the old image - m_pImage->DrawDragImage(&dc,m_ptOldImage,m_ptItem); -// CPoint ptDrag (point.x - m_sizeDelta.cx, point.y - m_sizeDelta.cy); - CPoint ptDrag (point.x, point.y); - // draw the new image - m_pImage->DrawDragImage (&dc, ptDrag, m_ptItem); - // save coords - m_ptOldImage = ptDrag; - m_ptPrevPos = point; - } - return dwEffect; -} - -BOOL CUI_ImageDropTarget::OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ) -{ - BOOL bRet = COleDropTarget::OnDrop(pWnd,pDataObject,dropEffect,point); - if (!pDataObject->IsDataAvailable(GetClipboardFormat())) - return bRet; - // - // Erase the old drag image and delete the temporary widget. - // - CClientDC dc(GetImageWin(pWnd)); - if (m_pImage != NULL) - { - m_pImage->DrawDragImage (&dc,m_ptOldImage,m_ptItem); - delete m_pImage; - m_pImage = NULL; - } - return bRet; -} - -void CUI_ImageDropTarget::EraseOldImage() -{ - if (m_pImage == NULL) - return; - CClientDC dc(GetImageWin(NULL)); - m_pImage->DrawDragImage(&dc,m_ptOldImage,m_ptItem); - m_ptOldImage.x = m_ptOldImage.y = -32000; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIListView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIListView.cpp deleted file mode 100644 index 637ea51f156..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIListView.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// TabClientView.cpp : implementation file -// - -#include "stdafx.h" -#include "UIListView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUIListView - -IMPLEMENT_DYNAMIC(CUIListView, CView) - -CUIListView::CUIListView(UINT nID) : m_nID(nID), m_pListCtrl(NULL) -{ - m_Style = WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_SHOWSELALWAYS; - m_bDragDrop = true; -} - -CUIListView::~CUIListView() -{ - delete m_pListCtrl; -} - -CUIODListCtrl &CUIListView::GetListCtrl() -{ - ASSERT(m_pListCtrl); - return *m_pListCtrl; -} - -void CUIListView::CreateListCtrl() -{ - m_pListCtrl = new CUIODListCtrl; - GetListCtrl().SetDragDrop(m_bDragDrop); -} - -BEGIN_MESSAGE_MAP(CUIListView, CView) - //{{AFX_MSG_MAP(CUIListView) - ON_WM_CREATE() - ON_WM_SETFOCUS() - ON_WM_SIZE() - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS, OnAppUpdateAllViews) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUIListView drawing - -void CUIListView::OnDraw(CDC* pDC) -{ - CDocument* pDoc = GetDocument(); - // TODO: add draw code here -} - -///////////////////////////////////////////////////////////////////////////// -// CUIListView diagnostics - -#ifdef _DEBUG -void CUIListView::AssertValid() const -{ - CView::AssertValid(); -} - -void CUIListView::Dump(CDumpContext& dc) const -{ - CView::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CUIListView message handlers - -int CUIListView::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CView::OnCreate(lpCreateStruct) == -1) - return -1; - - CreateListCtrl(); - - // TODO: Add your specialized creation code here -USES_CONVERSION; - GetListCtrl().SetSection(A2CT(GetRuntimeClass()->m_lpszClassName)); - GetListCtrl().ChangeStyle(m_Style); - if (GetListCtrl().Create(m_Style,CRect(0,0,0,0),this,m_nID) == -1) - return -1; - - GetListCtrl().Init(); - - return 0; -} - -void CUIListView::OnSetFocus(CWnd* pOldWnd) -{ - CView::OnSetFocus(pOldWnd); - - // TODO: Add your message handler code here - GetListCtrl().SetFocus(); -} - -void CUIListView::OnSize(UINT nType, int cx, int cy) -{ - CView::OnSize(nType, cx, cy); - - // TODO: Add your message handler code here - if (GetListCtrl().GetSafeHwnd()) - GetListCtrl().MoveWindow(0,0,cx,cy); -} - -LRESULT CUIListView::OnAppUpdateAllViews( WPARAM wParam, LPARAM lParam ) -{ - ASSERT(wParam); - GetDocument()->UpdateAllViews(NULL,wParam,(CObject*)lParam); - return 1L; -} - -BOOL CUIListView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - - return CView::PreCreateWindow(cs); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIMenuBar.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIMenuBar.cpp deleted file mode 100644 index 8e91e005127..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIMenuBar.cpp +++ /dev/null @@ -1,726 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CMenuBar implements menu bar for MFC. See MenuBar.h for how -// to use, and also the MBTest sample application. -// -#include "StdAfx.h" -#include "UIMenuBar.h" - -const UINT MB_SET_MENU_NULL = WM_USER + 1100; - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// if you want to see extra TRACE diagnostics, set CMenuBar::bTRACE = TRUE -BOOL CMenuBar::bTRACE = FALSE; - -#ifdef _DEBUG -#define MBTRACEFN \ - CTraceFn __fooble; \ - if (CMenuBar::bTRACE)\ - TRACE -#define MBTRACE \ - if (CMenuBar::bTRACE)\ - TRACE -#else -#define MBTRACEFN TRACE -#define MBTRACE TRACE -#endif - -IMPLEMENT_DYNAMIC(CMenuBar, CFlatToolBar) - -BEGIN_MESSAGE_MAP(CMenuBar, CFlatToolBar) - ON_WM_CREATE() - ON_WM_LBUTTONDOWN() - ON_WM_MOUSEMOVE() - ON_WM_SIZE() - ON_UPDATE_COMMAND_UI_RANGE(0, 256, OnUpdateMenuButton) - ON_MESSAGE(MB_SET_MENU_NULL, OnSetMenuNull) -END_MESSAGE_MAP() - -CMenuBar::CMenuBar() -{ - if (iVerComCtl32 <= 470) - AfxMessageBox(_T("Warning: This program requires comctl32.dll version 4.71 or greater.")); - - m_iTrackingState = TRACK_NONE; // initial state: not tracking - m_iPopupTracking = m_iNewPopup = -1; // invalid - m_hmenu = NULL; - m_hMenuTracking = NULL; - m_bAutoRemoveFrameMenu = TRUE; // set frame's menu to NULL -} - -CMenuBar::~CMenuBar() -{ -} - -////////////////// -// Menu bar was created: install hook into owner window -// -int CMenuBar::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CFlatToolBar::OnCreate(lpCreateStruct)==-1) - return -1; - UpdateFont(); - CWnd* pFrame = GetOwner(); - ASSERT_VALID(pFrame); - m_frameHook.Install(this, *pFrame); - return 0; // OK -} - -////////////////// -// Set menu bar font from current system menu font -// -void CMenuBar::UpdateFont() -{ - static CFont font; - NONCLIENTMETRICS info; - info.cbSize = sizeof(info); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - if ((HFONT)font) - font.DeleteObject(); - VERIFY(font.CreateFontIndirect(&info.lfMenuFont)); - SetFont(&font); -} - -////////////////// -// The reason for having this is so MFC won't automatically disable -// the menu buttons. Assumes < 256 top-level menu items. The ID of -// the ith menu button is i. IOW, the index and ID are the same. -// -void CMenuBar::OnUpdateMenuButton(CCmdUI* pCmdUI) -{ - ASSERT_VALID(this); - if (IsValidButton(pCmdUI->m_nID)) - pCmdUI->Enable(TRUE); -} - -////////////////// -// Recompute layout of menu bar -// -void CMenuBar::RecomputeMenuLayout() -{ - SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); -} - -////////////////// -// Make frame recalculate control bar sizes after menu change -// -void CMenuBar::RecomputeToolbarSize() -{ - // Force toolbar to recompute size - CFrameWnd* pFrame = (CFrameWnd*)GetOwner(); - ASSERT_VALID(pFrame); - ASSERT(pFrame->IsFrameWnd()); - pFrame->RecalcLayout(); - - // floating frame - pFrame = GetParentFrame(); - if (pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd))) - pFrame->RecalcLayout(); -} - -////////////////// -// Set tracking state: none, button, or popup -// -void CMenuBar::SetTrackingState(TRACKINGSTATE iState, int iButton) -{ - ASSERT_VALID(this); - if (iState != m_iTrackingState) { - if (iState == TRACK_NONE) - iButton = -1; - -#ifdef _DEBUG - static LPCTSTR StateName[] = { _T("NONE"), _T("BUTTON"), _T("POPUP") }; - MBTRACE(_T("CMenuBar::SetTrackingState to %s, button=%d\n"), - StateName[iState], iButton); -#endif - - SetHotItem(iButton); // could be none (-1) - - if (iState==TRACK_POPUP) { - // set related state stuff - m_bEscapeWasPressed = FALSE; // assume Esc key not pressed - m_bProcessRightArrow = // assume left/right arrow.. - m_bProcessLeftArrow = TRUE; // ..will move to prev/next popup - m_iPopupTracking = iButton; // which popup I'm tracking - } - m_iTrackingState = iState; - } -} - -////////////////// -// Toggle state from home state to button-tracking and back -// -void CMenuBar::ToggleTrackButtonMode() -{ - ASSERT_VALID(this); - if (m_iTrackingState == TRACK_NONE || m_iTrackingState == TRACK_BUTTON) { - SetTrackingState(m_iTrackingState == TRACK_NONE ? - TRACK_BUTTON : TRACK_NONE, 0); - } -} - -////////////////// -// Get button index before/after a given button -// -int CMenuBar::GetNextOrPrevButton(int iButton, BOOL bPrev) -{ - ASSERT_VALID(this); - if (bPrev) { - iButton--; - if (iButton <0) - iButton = GetButtonCount() - 1; - } else { - iButton++; - if (iButton >= GetButtonCount()) - iButton = 0; - } - return iButton; -} - -///////////////// -// This is to correct a bug in the system toolbar control: TB_HITTEST only -// looks at the buttons, not the size of the window. So it returns a button -// hit even if that button is totally outside the size of the window! -// -int CMenuBar::HitTest(CPoint p) const -{ - int iHit = CFlatToolBar::HitTest(p); - if (iHit>0) { - CRect rc; - GetClientRect(&rc); - if (!rc.PtInRect(p)) // if point is outside window - iHit = -1; // can't be a hit! - } - return iHit; -} - -////////////////// -// Load a different menu. The HMENU must not belong to any CMenu, -// and you must free it when you're done. Returns old menu. -// -HMENU CMenuBar::LoadMenu(HMENU hmenu) -{ - UINT iPrevID=(UINT)-1; - ASSERT(::IsMenu(hmenu)); - ASSERT_VALID(this); - - if (m_bAutoRemoveFrameMenu) { - CFrameWnd* pFrame = GetParentFrame(); - if (::GetMenu(*pFrame)!=NULL) { - // I would like to set the frame's menu to NULL now, but if I do, MFC - // gets all upset: it calls GetMenu and expects to have a real menu. - // So Instead, I post a message to myself. Because the message is - // posted, not sent, I won't process it until MFC is done with all its - // initialization stuff. (MFC needs to set CFrameWnd::m_hMenuDefault - // to the menu, which it gets by calling GetMenu.) - // - PostMessage(MB_SET_MENU_NULL, (WPARAM)pFrame->GetSafeHwnd()); - } - } - HMENU hOldMenu = m_hmenu; - m_hmenu = hmenu; - - // delete existing buttons - int nCount = GetButtonCount(); - while (nCount--) { - VERIFY(DeleteButton(0)); - } - - SetImageList(NULL); -// SetButtonSize(CSize(0,0)); // This barfs in VC 6.0 - - DWORD dwStyle = GetStyle(); - BOOL bModifyStyle = ModifyStyle(0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT); - - // add text buttons - UINT nMenuItems = hmenu ? ::GetMenuItemCount(hmenu) : 0; - - for (UINT i=0; i < nMenuItems; i++) { - TCHAR name[64]; - memset(name, 0, sizeof(name)); // guarantees double-0 at end - if (::GetMenuString(hmenu, i, name, countof(name)-1, MF_BYPOSITION)) { - TBBUTTON tbb; - memset(&tbb, 0, sizeof(tbb)); - tbb.idCommand = ::GetMenuItemID(hmenu, i); - - // Because the toolbar is too brain-damaged to know if it already has - // a string, and is also too brain-dead to even let you delete strings, - // I have to determine if each string has been added already. Otherwise - // in a MDI app, as the menus are repeatedly switched between doc and - // no-doc menus, I will keep adding strings until somebody runs out of - // memory. Sheesh! - // - int iString = -1; - for (int j=0; j= 0 && iButton 0) { - // process right-arrow iff item is NOT a submenu - m_bProcessRightArrow = (::GetSubMenu(hmenu, iItem) == NULL); - // process left-arrow iff curent menu is one I'm tracking - m_bProcessLeftArrow = hmenu==m_hMenuTracking; - } -} - -// globals--yuk! But no other way using windows hooks. -// -static CMenuBar* g_pMenuBar = NULL; -static HHOOK g_hMsgHook = NULL; - -//////////////// -// Menu filter hook just passes to virtual CMenuBar function -// -LRESULT CALLBACK -CMenuBar::MenuInputFilter(int code, WPARAM wp, LPARAM lp) -{ - return (code==MSGF_MENU && g_pMenuBar && - g_pMenuBar->OnMenuInput(*((MSG*)lp))) ? TRUE - : CallNextHookEx(g_hMsgHook, code, wp, lp); -} - -////////////////// -// Handle menu input event: Look for left/right to change popup menu, -// mouse movement over over a different menu button for "hot" popup effect. -// Returns TRUE if message handled (to eat it). -// -BOOL CMenuBar::OnMenuInput(MSG& m) -{ - ASSERT_VALID(this); - ASSERT(m_iTrackingState == TRACK_POPUP); // sanity check - int msg = m.message; - - if (msg==WM_KEYDOWN) { - // handle left/right-arow. - TCHAR vkey = m.wParam; - if (vkey == VK_LEFT) - MBTRACE(_T("CMenuBar::OnMenuInput: handle VK_LEFT - m_bProcessLeftArrow=%d\n"),m_bProcessLeftArrow); - else if (vkey == VK_RIGHT) - MBTRACE(_T("CMenuBar::OnMenuInput: handle RIGHT - m_bProcessRightArrow=%d\n"),m_bProcessRightArrow); - if ((vkey == VK_LEFT && m_bProcessLeftArrow) || - (vkey == VK_RIGHT && m_bProcessRightArrow)) { - CancelMenuAndTrackNewOne( - GetNextOrPrevButton(m_iPopupTracking, vkey==VK_LEFT)); - return TRUE; // eat it - - } else if (vkey == VK_ESCAPE) { - m_bEscapeWasPressed = TRUE; // (menu will abort itself) - } - - } else if (msg==WM_MOUSEMOVE || msg==WM_LBUTTONDOWN) { - // handle mouse move or click - CPoint pt = m.lParam; - ScreenToClient(&pt); - - if (msg == WM_MOUSEMOVE) { - if (pt != m_ptMouse) { - int iButton = HitTest(pt); - if (IsValidButton(iButton) && iButton != m_iPopupTracking) { - // user moved mouse over a different button: track its popup - CancelMenuAndTrackNewOne(iButton); - } - m_ptMouse = pt; - } - - } else if (msg == WM_LBUTTONDOWN) { - if (HitTest(pt) == m_iPopupTracking) { - // user clicked on same button I am tracking: cancel menu - MBTRACE(_T("CMenuBar:OnMenuInput: handle mouse click to exit popup\n")); - CancelMenuAndTrackNewOne(-1); - return TRUE; // eat it - } - } - } - return FALSE; // not handled -} - -////////////////// -// Cancel the current popup menu by posting WM_CANCELMODE, and track a new -// menu. iNewPopup is which new popup to track (-1 to quit). -// -void CMenuBar::CancelMenuAndTrackNewOne(int iNewPopup) -{ - MBTRACE(_T("CMenuBar::CancelMenuAndTrackNewOne: %d\n"), iNewPopup); - ASSERT_VALID(this); - if (iNewPopup != m_iPopupTracking) { - GetOwner()->PostMessage(WM_CANCELMODE); // quit menu loop - m_iNewPopup = iNewPopup; // go to this popup (-1 = quit) - } -} - -////////////////// -// Track the popup submenu associated with the i'th button in the menu bar. -// This fn actually goes into a loop, tracking different menus until the user -// selects a command or exits the menu. -// -void CMenuBar::TrackPopup(int iButton) -{ - MBTRACE(_T("CMenuBar::TrackPopup %d\n"), iButton); - ASSERT_VALID(this); - ASSERT(m_hmenu); - - CMenu menu; - menu.Attach(m_hmenu); - int nMenuItems = menu.GetMenuItemCount(); - - while (iButton >= 0) { // while user selects another menu - - m_iNewPopup = -1; // assume quit after this - PressButton(iButton, TRUE); // press the button - UpdateWindow(); // and force repaint now - - // post a simulated arrow-down into the message stream - // so TrackPopupMenu will read it and move to the first item - GetOwner()->PostMessage(WM_KEYDOWN, VK_DOWN, 1); - GetOwner()->PostMessage(WM_KEYUP, VK_DOWN, 1); - - SetTrackingState(TRACK_POPUP, iButton); // enter tracking state - - // Need to install a hook to trap menu input in order to make - // left/right-arrow keys and "hot" mouse tracking work. - // - ASSERT(g_pMenuBar == NULL); - g_pMenuBar = this; - ASSERT(g_hMsgHook == NULL); - g_hMsgHook = SetWindowsHookEx(WH_MSGFILTER, - MenuInputFilter, NULL, ::GetCurrentThreadId()); - - // get submenu and display it beneath button - TPMPARAMS tpm; - CRect rcButton; - GetRect(iButton, rcButton); - ClientToScreen(&rcButton); - CPoint pt = ComputeMenuTrackPoint(rcButton, tpm); - HMENU hMenuPopup = ::GetSubMenu(m_hmenu, iButton); - ASSERT(hMenuPopup); - m_hMenuTracking = hMenuPopup; - BOOL bRet = TrackPopupMenuEx(hMenuPopup, - TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL, - pt.x, pt.y, GetOwner()->GetSafeHwnd(), &tpm); - - // uninstall hook. - ::UnhookWindowsHookEx(g_hMsgHook); - g_hMsgHook = NULL; - g_pMenuBar = NULL; - - PressButton(iButton, FALSE); // un-press button - UpdateWindow(); // and force repaint now - - // If the user exited the menu loop by pressing Escape, - // return to track-button state; otherwise normal non-tracking state. - SetTrackingState(m_bEscapeWasPressed ? - TRACK_BUTTON : TRACK_NONE, iButton); - - // If the user moved mouse to a new top-level popup (eg from File to - // Edit button), I will have posted a WM_CANCELMODE to quit - // the first popup, and set m_iNewPopup to the new menu to show. - // Otherwise, m_iNewPopup will be -1 as set above. - // So just set iButton to the next popup menu and keep looping... - iButton = m_iNewPopup; - } - menu.Detach(); - m_hMenuTracking = m_hmenu; -} - -////////////////// -// Given button rectangle, compute point and "exclude rect" for -// TrackPopupMenu, based on current docking style, so that the menu will -// appear always inside the window. -// -CPoint CMenuBar::ComputeMenuTrackPoint(const CRect& rcButn, TPMPARAMS& tpm) -{ - tpm.cbSize = sizeof(tpm); - DWORD dwStyle = m_dwStyle; - CPoint pt; - CRect& rcExclude = (CRect&)tpm.rcExclude; - rcExclude = rcButn; - ::GetWindowRect(::GetDesktopWindow(), &rcExclude); - - switch (dwStyle & CBRS_ALIGN_ANY) { - case CBRS_ALIGN_BOTTOM: - pt = CPoint(rcButn.left, rcButn.top); - rcExclude.top = rcButn.top; - break; - - case CBRS_ALIGN_LEFT: - pt = CPoint(rcButn.right, rcButn.top); - rcExclude.right = rcButn.right; - break; - - case CBRS_ALIGN_RIGHT: - pt = CPoint(rcButn.left, rcButn.top); - rcExclude.left = rcButn.left; - break; - - default: // case CBRS_ALIGN_TOP: - pt = CPoint(rcButn.left, rcButn.bottom); - break; - } - return pt; -} - -////////////////// -// This function translates special menu keys and mouse actions. -// You must call it from your frame's PreTranslateMessage. -// -BOOL CMenuBar::TranslateFrameMessage(MSG* pMsg) -{ - ASSERT_VALID(this); - ASSERT(pMsg); - UINT msg = pMsg->message; - if (WM_LBUTTONDOWN <= msg && msg <= WM_MOUSELAST) { - if (pMsg->hwnd != m_hWnd && m_iTrackingState > 0) { - // user clicked outside menu bar: exit tracking mode - MBTRACE(_T("CMenuBar::TranslateFrameMessage: user clicked outside menu bar: end tracking\n")); - SetTrackingState(TRACK_NONE); - } - - } else if (msg==WM_SYSKEYDOWN || msg==WM_SYSKEYUP || msg==WM_KEYDOWN) { - - BOOL bAlt = HIWORD(pMsg->lParam) & KF_ALTDOWN; // Alt key down - TCHAR vkey = pMsg->wParam; // get virt key - if (vkey==VK_MENU || - (vkey==VK_F10 && !((GetKeyState(VK_SHIFT) & 0x80000000) || - (GetKeyState(VK_CONTROL) & 0x80000000) || bAlt))) { - - // key is VK_MENU or F10 with no alt/ctrl/shift: toggle menu mode - if (msg==WM_SYSKEYUP) { - MBTRACE(_T("CMenuBar::TranslateFrameMessage: handle menu key\n")); - ToggleTrackButtonMode(); - } - return TRUE; - - } else if ((msg==WM_SYSKEYDOWN || msg==WM_KEYDOWN)) { - if (m_iTrackingState == TRACK_BUTTON) { - // I am tracking: handle left/right/up/down/space/Esc - switch (vkey) { - case VK_LEFT: - case VK_RIGHT: - // left or right-arrow: change hot button if tracking buttons - MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_LEFT/RIGHT\n")); - SetHotItem(GetNextOrPrevButton(GetHotItem(), vkey==VK_LEFT)); - return TRUE; - - case VK_SPACE: // (personally, I like SPACE to enter menu too) - case VK_UP: - case VK_DOWN: - // up or down-arrow: move into current menu, if any - MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_UP/DOWN/SPACE\n")); - TrackPopup(GetHotItem()); - return TRUE; - - case VK_ESCAPE: - // escape key: exit tracking mode - MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_ESCAPE\n")); - SetTrackingState(TRACK_NONE); - return TRUE; - } - } - - // Handle alphanumeric key: invoke menu. Note that Alt-X - // chars come through as WM_SYSKEYDOWN, plain X as WM_KEYDOWN. - if ((bAlt || m_iTrackingState == TRACK_BUTTON) && isalnum(vkey)) { - // Alt-X, or else X while in tracking mode - UINT nID; - if (MapAccelerator(vkey, nID)) { - MBTRACE(_T("CMenuBar::TranslateFrameMessage: map acclerator\n")); - TrackPopup(nID); // found menu mnemonic: track it - return TRUE; // handled - } else if (m_iTrackingState==TRACK_BUTTON && !bAlt) { - MessageBeep(0); - return TRUE; - } - } - - // Default for any key not handled so far: return to no-menu state - if (m_iTrackingState > 0) { - MBTRACE(_T("CMenuBar::TranslateFrameMessage: unknown key, stop tracking\n")); - SetTrackingState(TRACK_NONE); - } - } - } - return FALSE; // not handled, pass along -} - -#ifdef _DEBUG -void CMenuBar::AssertValid() const -{ - CFlatToolBar::AssertValid(); - ASSERT(m_hmenu==NULL || ::IsMenu(m_hmenu)); - ASSERT(TRACK_NONE<=m_iTrackingState && m_iTrackingState<=TRACK_POPUP); - m_frameHook.AssertValid(); -} - -void CMenuBar::Dump(CDumpContext& dc) const -{ - CFlatToolBar::Dump(dc); -} -#endif - -////////////////////////////////////////////////////////////////// -// CMenuBarFrameHook is used to trap menu-related messages sent to the owning -// frame. The same class is also used to trap messages sent to the MDI client -// window in an MDI app. I should really use two classes for this, -// but it uses less code to chare the same class. Note however: there -// are two different INSTANCES of CMenuBarFrameHook in CMenuBar: one for -// the frame and one for the MDI client window. -// -CMenuBarFrameHook::CMenuBarFrameHook() -{ -} - -CMenuBarFrameHook::~CMenuBarFrameHook() -{ - HookWindow((HWND)NULL); // (unhook) -} - -////////////////// -// Install hook to trap window messages sent to frame or MDI client. -// -BOOL CMenuBarFrameHook::Install(CMenuBar* pMenuBar, HWND hWndToHook) -{ - ASSERT_VALID(pMenuBar); - m_pMenuBar = pMenuBar; - return HookWindow(hWndToHook); -} - -////////////////////////////////////////////////////////////////// -// Trap frame/MDI client messages specific to menubar. -// -LRESULT CMenuBarFrameHook::WindowProc(UINT msg, WPARAM wp, LPARAM lp) -{ - CMenuBar& mb = *m_pMenuBar; - - switch (msg) { - // The following messages are trapped for the frame window - case WM_SYSCOLORCHANGE: - mb.UpdateFont(); - break; - - case WM_MENUSELECT: - mb.OnMenuSelect((HMENU)lp, (UINT)LOWORD(wp)); - break; - } - return CSubclassWnd::WindowProc(msg, wp, lp); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIModulVer.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIModulVer.cpp deleted file mode 100644 index bcda64468e5..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIModulVer.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//////////////////////////////////////////////////////////////// -// 1998 Microsoft Systems Journal -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CModuleVersion provides an easy way to get version info -// for a module.(DLL or EXE). -// -#include "StdAfx.h" -#include "UIModulVer.h" - -CModuleVersion::CModuleVersion() -{ - m_pVersionInfo = NULL; // raw version info data -} - -////////////////// -// Destroy: delete version info -// -CModuleVersion::~CModuleVersion() -{ - delete [] m_pVersionInfo; -} - -////////////////// -// Get file version info for a given module -// Allocates storage for all info, fills "this" with -// VS_FIXEDFILEINFO, and sets codepage. -// -BOOL CModuleVersion::GetFileVersionInfo(LPCTSTR modulename) -{ - m_translation.charset = 1252; // default = ANSI code page - memset((VS_FIXEDFILEINFO*)this, 0, sizeof(VS_FIXEDFILEINFO)); - - CLoadLibrary lib(modulename); - - // get module handle - TCHAR filename[_MAX_PATH]; - HMODULE hModule = ::GetModuleHandle(modulename); - if (hModule==NULL && modulename!=NULL) - return FALSE; - - // get module file name - DWORD len = GetModuleFileName(hModule, filename, - sizeof(filename)/sizeof(filename[0])); - if (len <= 0) - return FALSE; - - // read file version info - DWORD dwDummyHandle; // will always be set to zero - len = GetFileVersionInfoSize(filename, &dwDummyHandle); - if (len <= 0) - return FALSE; - - if (m_pVersionInfo) - delete m_pVersionInfo; - m_pVersionInfo = new BYTE[len]; // allocate version info - if (!::GetFileVersionInfo(filename, 0, len, m_pVersionInfo)) - return FALSE; - - LPVOID lpvi; - UINT iLen; - if (!VerQueryValue(m_pVersionInfo, _T("\\"), &lpvi, &iLen)) - return FALSE; - - // copy fixed info to myself, which am derived from VS_FIXEDFILEINFO - *(VS_FIXEDFILEINFO*)this = *(VS_FIXEDFILEINFO*)lpvi; - - // Get translation info - // Note: VerQueryValue could return a value > 4, in which case - // mulitple languages are supported and VerQueryValue returns an - // array of langID/codepage pairs and you have to decide which to use. - if (VerQueryValue(m_pVersionInfo, - _T("\\VarFileInfo\\Translation"), &lpvi, &iLen) && iLen >= 4) { - m_translation = *(TRANSLATION*)lpvi; - TRACE1("code page = %d\n", m_translation.charset); - } - - return dwSignature == VS_FFI_SIGNATURE; -} - -////////////////// -// Get string file info. -// Key name is something like "CompanyName". -// returns the value as a CString. -// -CString CModuleVersion::GetValue(LPCTSTR lpKeyName) -{ - CString sVal; - if (m_pVersionInfo) { - - // To get a string value must pass query in the form - // - // "\StringFileInfo\\keyname" - // - // where is the languageID concatenated with the - // code page, in hex. Wow. - // - CString query; - query.Format(_T("\\StringFileInfo\\%04x%04x\\%s"), - m_translation.langID, - m_translation.charset, - lpKeyName); - - LPCTSTR pVal; - UINT iLenVal; - if (VerQueryValue(m_pVersionInfo, (LPTSTR)(LPCTSTR)query, - (LPVOID*)&pVal, &iLenVal)) { - - sVal = pVal; - } - } - return sVal; -} - -// typedef for DllGetVersion proc -typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *); - -///////////////// -// Get DLL Version by calling DLL's DllGetVersion proc -// -BOOL CModuleVersion::DllGetVersion(LPCTSTR modulename, DLLVERSIONINFO& dvi) -{ - CLoadLibrary lib(modulename); - if (!lib) - return FALSE; - - // Must use GetProcAddress because the DLL might not implement - // DllGetVersion. Depending upon the DLL, the lack of implementation of the - // function may be a version marker in itself. - // - DLLGETVERSIONPROC pDllGetVersion = - (DLLGETVERSIONPROC)GetProcAddress(lib, "DllGetVersion"); - if (!pDllGetVersion) - return FALSE; - - memset(&dvi, 0, sizeof(dvi)); // clear - dvi.cbSize = sizeof(dvi); // set size for Windows - - return SUCCEEDED((*pDllGetVersion)(&dvi)); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIStatusBar.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIStatusBar.cpp deleted file mode 100644 index 4fa4c111288..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UIStatusBar.cpp +++ /dev/null @@ -1,623 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIStatusBar.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -/////////////////////////////////// -// -// IMStatusBar -// -/////////////////////////////////// -IMPLEMENT_SERIAL(CUIStatusBar, CStatusBar, 0) -IMPLEMENT_SERIAL(CStatusBarPane, CObject, 0) - -BEGIN_MESSAGE_MAP(CUIStatusBar, CStatusBar) - //{{AFX_MSG_MAP(CUIStatusBar) - ON_WM_CONTEXTMENU() - ON_WM_LBUTTONDOWN() - ON_WM_SETCURSOR() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -LPCTSTR CUIStatusBar::szSection = _T("Settings\\StatusBar"); -LPCTSTR CUIStatusBar::szPaneEntry = _T("Pane"); - -CStatusBarPane::CStatusBarPane(const CStatusBarPane &rOther) -{ - DoCopy(rOther); -} - -CStatusBarPane &CStatusBarPane::operator=(const CStatusBarPane &rOther) -{ - if (this == &rOther) - return *this; - DoCopy(rOther); - return *this; -} - -void CStatusBarPane::DoCopy(const CStatusBarPane &rOther) -{ - m_nID = rOther.m_nID; - m_nStyle = rOther.m_nStyle; - m_bActive = rOther.m_bActive; -// m_listImageIndex = rOther.m_listImageIndex; -} - -void CStatusBarPane::Serialize(CArchive &ar) -{ - if (ar.IsStoring()) - { - ar << m_nID; - ar << m_nStyle; - ar << m_bActive; - } - else - { - ar >> m_nID; - ar >> m_nStyle; - ar >> m_bActive; - } -} - -void CUIStatusBar::OnContextMenu(CWnd *pWnd, CPoint point) -{ -/* CMenu Menu; - - // Build the popup menu - Menu.CreatePopupMenu(); - CStatusBarPane *pPane = NULL; - CString strText; - for(POSITION pos = m_PaneList.GetTailPosition();pos != NULL;) - { - pPane = m_PaneList.GetPrev(pos); - if (pPane->GetCommandID() != ID_SEPARATOR && pPane->GetCommandID() != ID_INDICATOR_MAIN) - { - strText.LoadString(pPane->GetCommandID()); - Menu.AppendMenu(MF_STRING,pPane->GetCommandID(),strText); - } - } - // and display using main frame as message window - Menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_LEFTALIGN,point.x,point.y,theApp.m_pMainWnd); - theApp.m_pMainWnd->SetFocus(); -*/ -} -//////////////////////////////////////////////////////////// - -CUIStatusBar::CUIStatusBar() -{ - Init(); -} - -CUIStatusBar::~CUIStatusBar() -{ - Clear(); -} - -void CUIStatusBar::Reset() -{ - Clear(); - Init(); -} - -void CUIStatusBar::Init() -{ - m_nStatusPane1Width = -1; - m_nStatusPane1Style = SBPS_STRETCH; - m_bMenuSelect = FALSE; - m_nMinHeight = GetSystemMetrics(SM_CYSMICON)+4; - m_pImageList = new CImageList; -} - -void CUIStatusBar::Clear() -{ - CStatusBarPane *pPane; - while (!m_PaneList.IsEmpty()) - { - pPane = m_PaneList.RemoveTail(); - delete pPane; - } - delete m_pImageList; - m_pImageList = NULL; -} - -CUIStatusBar &CUIStatusBar::operator=(const CUIStatusBar &rOther) -{ - if (this == &rOther) - return *this; - for(POSITION pos=rOther.m_PaneList.GetHeadPosition();pos != NULL;) - { - CStatusBarPane *pPane = new CStatusBarPane; - *pPane = *rOther.m_PaneList.GetNext(pos); - m_PaneList.AddTail(pPane); - } - m_nStatusPane1ID = rOther.m_nStatusPane1ID; - m_nStatusPane1Style = rOther.m_nStatusPane1Style; - m_nStatusPane1Width = rOther.m_nStatusPane1Width; - m_bMenuSelect = rOther.m_bMenuSelect; - return *this; -} - -void CUIStatusBar::UpdatePane(int nIndex) -{ - CRect rect; - GetStatusBarCtrl().GetRect(nIndex,&rect); - InvalidateRect(rect); - UpdateWindow(); -} - -CStatusBarPane *CUIStatusBar::GetPane(UINT nPaneID) const -{ - if (nPaneID == 0) - { - nPaneID = ((CUIStatusBar*)this)->GetPaneID(0); - } - CStatusBarPane *pPane = NULL; - for (POSITION pos=m_PaneList.GetHeadPosition();pos != NULL;) - { - pPane = m_PaneList.GetNext(pos); - if (pPane->GetCommandID() == nPaneID) - break; - } - return((pPane && nPaneID == pPane->GetCommandID()) ? pPane : NULL); -} - -void CUIStatusBar::RemoveAllIcons(UINT nPaneID) -{ - CStatusBarPane *pPane = GetPane(nPaneID); - ASSERT(pPane); - pPane->RemoveAllImages(); - UpdatePane(GetPaneIndex(nPaneID)); -} - -void CUIStatusBar::RemoveIcon(UINT nPaneID,UINT nImageID,bool bUpdate) -{ - if (nPaneID == 0) - { - nPaneID = GetPaneID(0); - } - CStatusBarPane *pPane = GetPane(nPaneID); - ASSERT(pPane); - RemoveIcon(nImageID,pPane,bUpdate); -} - -void CUIStatusBar::RemoveIcon(UINT nImageID,CStatusBarPane *pPane,bool bUpdate) -{ - int nImageIndex=-1; - if (m_mapImageIndex.Lookup(nImageID,nImageIndex)) - pPane->RemoveImage(nImageIndex); - if (bUpdate) - UpdatePane(nImageIndex); -} - -void CUIStatusBar::AddIcon(UINT nPaneID,UINT nImageID,bool bUpdate) -{ - int nIndex = -1; - if (!m_mapImageIndex.Lookup(nImageID,nIndex)) - nIndex = AddIcon(nImageID); - // Possibly wrong id using pane index 0 - if (nPaneID == 0) - { - nPaneID = GetPaneID(0); - } - AddImageIndex(nPaneID,nIndex,bUpdate); -} - -// add an image to list of images that will be displayed -// nIndex into the image list -void CUIStatusBar::AddImageIndex(UINT nPaneID,int nImageIndex,bool bUpdate) -{ - CStatusBarPane *pPane = GetPane(nPaneID); - ASSERT(pPane); - int nPaneIndex = GetPaneIndex(nPaneID); - // Pane 0 can have only one icon - if (nPaneIndex == 0) - { - pPane->RemoveAllImages(); - } - if (!pPane->FindImage(nImageIndex)) - { - pPane->AddImage(nImageIndex); - } - UINT nStyle; - int nWidth; - GetPaneInfo(nPaneIndex,nPaneID,nStyle,nWidth); - // Make sure it's owner draw - if (!(nStyle & SBT_OWNERDRAW)) - { - nStyle |= SBT_OWNERDRAW; - SetPaneInfo(nPaneIndex,nPaneID,nStyle,nWidth); - pPane->SetStyle(nStyle); - } - if (bUpdate) - UpdatePane(GetPaneIndex(nPaneID)); -} - -int CUIStatusBar::AddIcon(UINT nID) -{ - if (m_pImageList->m_hImageList == NULL) - CreateImageList(); - ASSERT(m_pImageList->m_hImageList); - HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(nID),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); - if (hIcon) - { - int nIndex = m_pImageList->Add(hIcon); - m_mapImageIndex[nID] = nIndex; - return nIndex; - } - return -1; -} - -// set image list from a bitmap id -void CUIStatusBar::SetImageList(UINT nBitmapID) -{ - delete m_pImageList; - m_pImageList = NULL; - m_pImageList = new CImageList; - m_pImageList->Create(nBitmapID,::GetSystemMetrics(SM_CXSMICON),0,::GetSysColor(COLOR_BTNFACE)); -} - -void CUIStatusBar::CreateImageList() -{ - delete m_pImageList; - m_pImageList = new CImageList; - m_pImageList->Create(::GetSystemMetrics(SM_CXSMICON),::GetSystemMetrics(SM_CYSMICON),ILC_MASK | ILC_COLOR16,0,1); - m_pImageList->SetBkColor(CLR_NONE); -} - -void CUIStatusBar::SetImageList(CImageList *pImageList) -{ - CreateImageList(); - // if one passed in copy it - if (pImageList) - { - int count = pImageList->GetImageCount(); - for(int i=0;i < count;i++) - { - HICON hIcon = pImageList->ExtractIcon(i); - m_pImageList->Add(hIcon); - } - } -} - -void CUIStatusBar::AddPane(UINT nID,BOOL bActive) -{ - CStatusBarPane *pPane = new CStatusBarPane(nID,bActive); - pPane->SetStyle(SBT_OWNERDRAW); - m_PaneList.AddTail(pPane); -} - -BOOL CUIStatusBar::SetPanes(BOOL bSave) -{ - int nSize = 0; - CStatusBarPane *pPane = NULL; - for(POSITION pos = m_PaneList.GetTailPosition();pos != NULL;) - { - pPane = m_PaneList.GetPrev(pos); - nSize += pPane->IsPaneActive(); - } - UINT *pIndicators = new UINT[nSize]; - - int nIndex = 0; - for(pos = m_PaneList.GetHeadPosition();pos != NULL;) - { - pPane = m_PaneList.GetNext(pos); - if (pPane->IsPaneActive()) - { - pIndicators[nIndex++] = pPane->GetCommandID(); - } - } - BOOL ret = SetIndicators(pIndicators, nSize); - delete[] pIndicators; - - UINT nID, nStyle; - int nWidth; - for(pos = m_PaneList.GetTailPosition();pos != NULL;) - { - pPane = m_PaneList.GetPrev(pos); - if (pPane->IsPaneActive() && pPane->GetCommandID() != ID_SEPARATOR) - { - int nIndex = GetPaneIndex(pPane->GetCommandID()); - GetPaneInfo(nIndex,nID,nStyle,nWidth); - SetPaneInfo(nIndex,pPane->GetCommandID(),nStyle | pPane->GetStyle(),nWidth); - SetPaneText(nIndex,_T("")); - } - } - GetPaneInfo(0,nID,nStyle,nWidth); - // First pane has its own style - SetPaneInfo(0,nID,m_nStatusPane1Style,nWidth); - if (bSave) - { - // save to registry - Save(); - } - return ret; -} - -void CUIStatusBar::Load() -{ - CWinApp *pApp = AfxGetApp(); - CString strPane; - CStatusBarPane *pPane = NULL; - int i=0; - for(POSITION pos = m_PaneList.GetTailPosition();pos != NULL;i++) - { - pPane = m_PaneList.GetPrev(pos); - strPane.Format(_T("%s%d"),szPaneEntry,i); - pPane->SetPaneActive(pApp->GetProfileInt(szSection,strPane,pPane->IsPaneActive())); - } -} - -void CUIStatusBar::Save() -{ - CWinApp *pApp = AfxGetApp(); - CString strPane; - CStatusBarPane *pPane = NULL; - int i=0; - for(POSITION pos = m_PaneList.GetTailPosition();pos != NULL;i++) - { - pPane = m_PaneList.GetPrev(pos); - strPane.Format(_T("%s%d"),szPaneEntry,i); - pApp->WriteProfileInt(szSection,strPane,pPane->IsPaneActive()); - } -} - -void CUIStatusBar::TogglePane(UINT nID) -{ - CStatusBarPane *pPane = GetPane(nID); - if (pPane) - { - pPane->SetPaneActive(!pPane->IsPaneActive()); - SetPanes(TRUE); - } -} - -void CUIStatusBar::SetText(UINT nPaneID,LPCTSTR szText,bool bUpdate) -{ - const CStatusBarPane *pPane = GetPane(nPaneID); - ASSERT(pPane); - SetTextPane(pPane,szText,bUpdate); -} - -void CUIStatusBar::SetTextPane(const CStatusBarPane *pPane,LPCTSTR szText,bool bUpdate) -{ - if (!pPane->IsPaneActive()) - return; - - int nIndex = GetPaneIndex(pPane->GetCommandID()); - UINT nStyle; - UINT nPaneID=pPane->GetCommandID(); - int nWidth; - GetPaneInfo(nIndex, nPaneID, nStyle, nWidth); - nStyle |= SBT_OWNERDRAW; - if (nIndex != 0) - { - HGDIOBJ hOldFont = NULL; - HFONT hFont = (HFONT)SendMessage(WM_GETFONT); - CClientDC dc(NULL); - if (hFont != NULL) - hOldFont = dc.SelectObject(hFont); - CSize size = dc.GetTextExtent(szText); - if (hOldFont != NULL) - dc.SelectObject(hOldFont); - nWidth = size.cx; - } - SetPaneInfo(nIndex, nPaneID, nStyle, nWidth); - SetPaneText(nIndex, szText, bUpdate); - if (bUpdate) - UpdateWindow(); -} - -void CUIStatusBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) -{ - CStatusBarPane *pPane = GetPane(GetPaneID(lpDrawItemStruct->itemID)); - if (pPane) - { - // Get the pane rectangle and calculate text coordinates - CRect rect(&lpDrawItemStruct->rcItem); - CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC); - COLORREF oldBkColor = pDC->SetBkColor(::GetSysColor(COLOR_BTNFACE)); - // draw the image - CListImages &listImages = pPane->GetImageIndex(); - // make sure there is an image - if (!listImages.IsEmpty()) - { - for(POSITION pos=listImages.GetTailPosition();pos != NULL;) - { - m_pImageList->Draw(pDC,listImages.GetPrev(pos),CPoint(rect.left,rect.top),ILD_NORMAL); - rect.left += ::GetSystemMetrics(SM_CXSMICON); - rect.left += 5; - } - } - // draw the text - LPCTSTR pszText = (LPCTSTR)lpDrawItemStruct->itemData; - // make sure there is text - if (pszText) - { - UINT nFormat = DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS | DT_NOPREFIX | DT_VCENTER; -// if (pPane->GetStyle() & SBPS_POPOUT) -// nFormat |= DT_VCENTER; -// else -// nFormat |= DT_BOTTOM; - pDC->DrawText(pszText,lstrlen(pszText),rect,nFormat); - } - pDC->SetBkColor(oldBkColor); - } -} - -void CUIStatusBar::Serialize(CArchive &ar) -{ - CStatusBar::Serialize(ar); - m_PaneList.Serialize(ar); -} - -template <> void AFXAPI SerializeElements (CArchive& ar, CStatusBarPane **ppPane, int nCount) -{ - for (int i=0;i < nCount;i++,ppPane++) - { - if (ar.IsLoading()) - { - ar >> *ppPane; - } - else - { - ar << *ppPane; - } - } -} - - -void CUIStatusBar::OnLButtonDown(UINT nFlags, CPoint point) -{ - // TODO: Add your message handler code here and/or call default - CStatusBar::OnLButtonDown(nFlags, point); -} - -BOOL CUIStatusBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - // TODO: Add your message handler code here and/or call default -/* if (theApp.IsLoading()) - { - CPoint point; - ::GetCursorPos(&point); - ScreenToClient(&point); - CRect rect; - GetItemRect(4,&rect); - if (rect.PtInRect(point)) - { - SetCursor(::LoadCursor(NULL,IDC_CROSS)); - return TRUE; - } - } -*/ - return CStatusBar::OnSetCursor(pWnd, nHitTest, message); -} - -//////////////////////////////////////////////////////////////////////// -IMPLEMENT_DYNCREATE(CProgressBar, CProgressCtrl) - -BEGIN_MESSAGE_MAP(CProgressBar, CProgressCtrl) - //{{AFX_MSG_MAP(CProgressBar) - ON_WM_ERASEBKGND() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -CProgressBar::CProgressBar() : m_nPaneIndex(-1), m_pStatusBar(NULL) -{ -} - -CProgressBar::CProgressBar(int nPaneID, CUIStatusBar *pStatusBar, int MaxValue /* = 100 */) -{ - Create(nPaneID, pStatusBar, MaxValue); -} - -CProgressBar::~CProgressBar() -{ - Clear(); -} - -// Create the CProgressCtrl as a child of the status bar -BOOL CProgressBar::Create(int nPaneID, CUIStatusBar *pStatusBar, int MaxValue) -{ - m_pStatusBar = pStatusBar; - m_nPaneIndex = pStatusBar->GetPaneIndex(nPaneID); - if (m_nPaneIndex == -1) - return FALSE; - - // Create the progress bar - if (!CProgressCtrl::Create(WS_CHILD | WS_VISIBLE | PBS_SMOOTH, CRect(0,0,0,0), pStatusBar, 1)) - return FALSE; - - // Set range and step - SetRange(0, MaxValue); - SetStep(1); - - // Resize the control to its desired width - Resize(); - - return TRUE; -} - -void CProgressBar::Clear() -{ -} - -void CProgressBar::SetRange(int nLower, int nUpper, int nStep /* = 1 */) -{ - CProgressCtrl::SetRange(nLower, nUpper); - CProgressCtrl::SetStep(nStep); -} - -int CProgressBar::SetPos(int nPos) -{ - if (m_hWnd == NULL) - return -1; - ModifyStyle(0,WS_VISIBLE); - return CProgressCtrl::SetPos(nPos); -} - -int CProgressBar::OffsetPos(int nPos) -{ - if (m_hWnd == NULL) - return -1; - ModifyStyle(0,WS_VISIBLE); - return CProgressCtrl::OffsetPos(nPos); -} - -int CProgressBar::SetStep(int nStep) -{ - if (m_hWnd == NULL) - return -1; - ModifyStyle(0,WS_VISIBLE); - return CProgressCtrl::SetStep(nStep); -} - -int CProgressBar::StepIt() -{ - if (m_hWnd == NULL) - return -1; - ModifyStyle(0,WS_VISIBLE); - return CProgressCtrl::StepIt(); -} - -void CProgressBar::Resize() -{ - ASSERT(m_pStatusBar); - ASSERT(m_nPaneIndex != -1); - - if (!m_pStatusBar) - return; - - // Now get the rectangle in which we will draw the progress bar - CRect rc; - m_pStatusBar->GetItemRect (m_nPaneIndex, rc); - // Resize the window - if (::IsWindow(m_hWnd)) - MoveWindow(&rc); -} - -BOOL CProgressBar::OnEraseBkgnd(CDC* pDC) -{ - Resize(); - return CProgressCtrl::OnEraseBkgnd(pDC); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UISubclass.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UISubclass.cpp deleted file mode 100644 index 01adf3d8b6c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UISubclass.cpp +++ /dev/null @@ -1,270 +0,0 @@ -//////////////////////////////////////////////////////////////// -// Copyright 1998 Paul DiLascia -// If this code works, it was written by Paul DiLascia. -// If not, I don't know who wrote it. -// -// CSubclassWnd is a generic class for hooking another window's messages. - -#include "StdAfx.h" -#include "UISubclass.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -////////////////// -// The message hook map is derived from CMapPtrToPtr, which associates -// a pointer with another pointer. It maps an HWND to a CSubclassWnd, like -// the way MFC's internal maps map HWND's to CWnd's. The first CSubclassWnd -// attached to a window is stored in the map; all other CSubclassWnd's for that -// window are then chained via CSubclassWnd::m_pNext. -// -class CSubclassWndMap : private CMapPtrToPtr { -public: - CSubclassWndMap(); - ~CSubclassWndMap(); - static CSubclassWndMap& GetHookMap(); - void Add(HWND hwnd, CSubclassWnd* pSubclassWnd); - void Remove(CSubclassWnd* pSubclassWnd); - void RemoveAll(HWND hwnd); - CSubclassWnd* Lookup(HWND hwnd); -}; - -// This trick is used so the hook map isn't -// instantiated until someone actually requests it. -// -#define theHookMap (CSubclassWndMap::GetHookMap()) - -IMPLEMENT_DYNAMIC(CSubclassWnd, CWnd); - -CSubclassWnd::CSubclassWnd() -{ - m_pNext = NULL; - m_pOldWndProc = NULL; - m_hWnd = NULL; -} - -CSubclassWnd::~CSubclassWnd() -{ - if (m_hWnd) - HookWindow((HWND)NULL); // unhook window -} - -////////////////// -// Hook a window. -// This installs a new window proc that directs messages to the CSubclassWnd. -// pWnd=NULL to remove. -// -BOOL CSubclassWnd::HookWindow(HWND hwnd) -{ - ASSERT_VALID(this); - if (hwnd) { - // Hook the window - ASSERT(m_hWnd==NULL); - ASSERT(::IsWindow(hwnd)); - theHookMap.Add(hwnd, this); // Add to map of hooks - - } else if (m_hWnd) { - // Unhook the window - theHookMap.Remove(this); // Remove from map - m_pOldWndProc = NULL; - } - m_hWnd = hwnd; - return TRUE; -} - -////////////////// -// Window proc-like virtual function which specific CSubclassWnds will -// override to do stuff. Default passes the message to the next hook; -// the last hook passes the message to the original window. -// You MUST call this at the end of your WindowProc if you want the real -// window to get the message. This is just like CWnd::WindowProc, except that -// a CSubclassWnd is not a window. -// -LRESULT CSubclassWnd::WindowProc(UINT msg, WPARAM wp, LPARAM lp) -{ -// ASSERT_VALID(this); // removed for speed - ASSERT(m_pOldWndProc); - return m_pNext ? m_pNext->WindowProc(msg, wp, lp) : - ::CallWindowProc(m_pOldWndProc, m_hWnd, msg, wp, lp); -} - -////////////////// -// Like calling base class WindowProc, but with no args, so individual -// message handlers can do the default thing. Like CWnd::Default -// -LRESULT CSubclassWnd::Default() -{ - // MFC stores current MSG in thread state - MSG& curMsg = AfxGetThreadState()->m_lastSentMsg; - // Note: must explicitly call CSubclassWnd::WindowProc to avoid infinte - // recursion on virtual function - return CSubclassWnd::WindowProc(curMsg.message, curMsg.wParam, curMsg.lParam); -} - -#ifdef _DEBUG -void CSubclassWnd::AssertValid() const -{ - CObject::AssertValid(); - ASSERT(m_hWnd==NULL || ::IsWindow(m_hWnd)); - if (m_hWnd) { - for (CSubclassWnd* p = theHookMap.Lookup(m_hWnd); p; p=p->m_pNext) { - if (p==this) - break; - } - ASSERT(p); // should have found it! - } -} - -void CSubclassWnd::Dump(CDumpContext& dc) const -{ - CObject::Dump(dc); -} - -#endif - -////////////////// -// Subclassed window proc for message hooks. Replaces AfxWndProc (or whatever -// else was there before.) -// -LRESULT CALLBACK -HookWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) -{ -#ifdef _USRDLL - // If this is a DLL, need to set up MFC state - AFX_MANAGE_STATE(AfxGetStaticModuleState()); -#endif - - // Set up MFC message state just in case anyone wants it - // This is just like AfxCallWindowProc, but we can't use that because - // a CSubclassWnd is not a CWnd. - // - MSG& curMsg = AfxGetThreadState()->m_lastSentMsg; - MSG oldMsg = curMsg; // save for nesting - curMsg.hwnd = hwnd; - curMsg.message = msg; - curMsg.wParam = wp; - curMsg.lParam = lp; - - // Get hook object for this window. Get from hook map - CSubclassWnd* pSubclassWnd = theHookMap.Lookup(hwnd); - ASSERT(pSubclassWnd); - - LRESULT lr; - if (msg==WM_NCDESTROY) { - // Window is being destroyed: unhook all hooks (for this window) - // and pass msg to orginal window proc - // - WNDPROC wndproc = pSubclassWnd->m_pOldWndProc; - theHookMap.RemoveAll(hwnd); - lr = ::CallWindowProc(wndproc, hwnd, msg, wp, lp); - - } else { - // pass to msg hook - lr = pSubclassWnd->WindowProc(msg, wp, lp); - } - curMsg = oldMsg; // pop state - return lr; -} - -//////////////////////////////////////////////////////////////// -// CSubclassWndMap implementation -// -CSubclassWndMap::CSubclassWndMap() -{ -} - -CSubclassWndMap::~CSubclassWndMap() -{ -// This assert bombs when posting WM_QUIT, so I've deleted it. -// ASSERT(IsEmpty()); // all hooks should be removed! -} - -////////////////// -// Get the one and only global hook map -// -CSubclassWndMap& CSubclassWndMap::GetHookMap() -{ - // By creating theMap here, C++ doesn't instantiate it until/unless - // it's ever used! This is a good trick to use in C++, to - // instantiate/initialize a static object the first time it's used. - // - static CSubclassWndMap theMap; - return theMap; -} - -///////////////// -// Add hook to map; i.e., associate hook with window -// -void CSubclassWndMap::Add(HWND hwnd, CSubclassWnd* pSubclassWnd) -{ - ASSERT(hwnd && ::IsWindow(hwnd)); - - // Add to front of list - pSubclassWnd->m_pNext = Lookup(hwnd); - SetAt(hwnd, pSubclassWnd); - - if (pSubclassWnd->m_pNext==NULL) { - // If this is the first hook added, subclass the window - pSubclassWnd->m_pOldWndProc = - (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)HookWndProc); - - } else { - // just copy wndproc from next hook - pSubclassWnd->m_pOldWndProc = pSubclassWnd->m_pNext->m_pOldWndProc; - } - ASSERT(pSubclassWnd->m_pOldWndProc); -} - -////////////////// -// Remove hook from map -// -void CSubclassWndMap::Remove(CSubclassWnd* pUnHook) -{ - HWND hwnd = pUnHook->m_hWnd; - ASSERT(hwnd && ::IsWindow(hwnd)); - - CSubclassWnd* pHook = Lookup(hwnd); - ASSERT(pHook); - if (pHook==pUnHook) { - // hook to remove is the one in the hash table: replace w/next - if (pHook->m_pNext) - SetAt(hwnd, pHook->m_pNext); - else { - // This is the last hook for this window: restore wnd proc - RemoveKey(hwnd); - SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)pHook->m_pOldWndProc); - } - } else { - // Hook to remove is in the middle: just remove from linked list - while (pHook->m_pNext!=pUnHook) - pHook = pHook->m_pNext; - ASSERT(pHook && pHook->m_pNext==pUnHook); - pHook->m_pNext = pUnHook->m_pNext; - } -} - -////////////////// -// Remove all the hooks for a window -// -void CSubclassWndMap::RemoveAll(HWND hwnd) -{ - CSubclassWnd* pSubclassWnd; - while ((pSubclassWnd = Lookup(hwnd))!=NULL) - pSubclassWnd->HookWindow((HWND)NULL); // (unhook) -} - -///////////////// -// Find first hook associate with window -// -CSubclassWnd* CSubclassWndMap::Lookup(HWND hwnd) -{ - CSubclassWnd* pFound = NULL; - if (!CMapPtrToPtr::Lookup(hwnd, (void*&)pFound)) - return NULL; - ASSERT_KINDOF(CSubclassWnd, pFound); - return pFound; -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITabSplitterWnd.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITabSplitterWnd.cpp deleted file mode 100644 index de510e3f7a9..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITabSplitterWnd.cpp +++ /dev/null @@ -1,274 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UITabSplitterWnd.h" - -///////////////////////////////////////////////////////////////////////////// -// CTabSplitterWnd message handlers - -LPCTSTR CTabSplitterWnd::szSplitterSection = _T("Splitter"); -LPCTSTR CTabSplitterWnd::szPaneWidthCurrent = _T("PaneWidthCurrent"); -LPCTSTR CTabSplitterWnd::szPaneWidthMinimum = _T("PaneWidthMinimum"); -LPCTSTR CTabSplitterWnd::szPaneHeightCurrent = _T("PaneHeightCurrent"); -LPCTSTR CTabSplitterWnd::szPaneHeightMinimum = _T("PaneHeightMinimum"); - -IMPLEMENT_DYNAMIC(CTabSplitterWnd, CSplitterWnd) - -BEGIN_MESSAGE_MAP(CTabSplitterWnd, CSplitterWnd) - //{{AFX_MSG_MAP(CTabSplitterWnd) - ON_WM_CLOSE() - ON_WM_DESTROY() - ON_WM_SETFOCUS() - ON_WM_KILLFOCUS() - ON_WM_MOUSEWHEEL() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -CTabSplitterWnd::CTabSplitterWnd() - : m_strSection(szSplitterSection) -{ - m_nCurCol = m_nCurRow = 0; - m_cxCur = m_cyCur = 0; - m_cxMin = m_cyMin = 0; -} - -void CTabSplitterWnd::SetSection(LPCTSTR szSection) -{ - m_strSection = szSplitterSection; - m_strSection += _T("\\"); - m_strSection += szSection; -} - -CWnd *CTabSplitterWnd::GetActiveWnd() -{ - int row, col; - return GetActivePane(row,col); -} - -void CTabSplitterWnd::ActivateNext(BOOL bPrev) -{ - ASSERT_VALID(this); - - // find the coordinate of the current pane - int row, col; - if (GetActivePane(&row, &col) == NULL) - { - SetActivePane(0,0); - return; - } - ASSERT(row >= 0 && row < m_nRows); - ASSERT(col >= 0 && col < m_nCols); - - // determine next pane - if (bPrev) - { - // prev - if (--col < 0) - { - col = m_nCols - 1; - if (--row < 0) - row = m_nRows - 1; - } - } - else - { - // next - if (++col >= m_nCols) - { - col = 0; - if (++row >= m_nRows) - row = 0; - } - } - - // set newly active pane - SetActivePane(row, col); -} - -void CTabSplitterWnd::SaveSize() -{ -#ifdef _DEBUG - if (m_strSection == szSplitterSection) - TRACE0("Warning: SetSection has not been called in IMSplitterWnd!\n"); -#endif - GetColumnInfo(0,m_cxCur,m_cxMin); - if (m_cxCur) - AfxGetApp()->WriteProfileInt(m_strSection,szPaneWidthCurrent,m_cxCur); - if (m_cxMin) - AfxGetApp()->WriteProfileInt(m_strSection,szPaneWidthMinimum,m_cxMin); - GetRowInfo(0,m_cyCur,m_cyMin); - if (m_cyCur) - AfxGetApp()->WriteProfileInt(m_strSection,szPaneHeightCurrent,m_cyCur); - if (m_cyMin) - AfxGetApp()->WriteProfileInt(m_strSection,szPaneHeightMinimum,m_cyMin); -} - -void CTabSplitterWnd::SetSize(int nCur,int nMin) -{ - if (m_nRows > 1) - { - m_cyCur = nCur; - m_cyMin = nMin; - } - if (m_nCols > 1) - { - m_cxCur = nCur; - m_cxMin = nMin; - } -} - -void CTabSplitterWnd::Apply() -{ - if (m_nRows > 1) - { - SetRowInfo(0,m_cyCur,m_cyMin); - RecalcLayout(); - } - else if (m_nCols > 1) - { - SetColumnInfo(0,m_cxCur,m_cxMin); - RecalcLayout(); - } - else - TRACE0("Applying splitter bar before creating it!\n"); -} - -BOOL CTabSplitterWnd::CreateView(int row,int col,CRuntimeClass* pViewClass,SIZE sizeInit,CCreateContext* pContext) -{ - if (m_nCols > 1) - { - if (m_cxCur) - sizeInit.cx = m_cxCur; - else if (m_strSection != szSplitterSection) - sizeInit.cx = AfxGetApp()->GetProfileInt(m_strSection,szPaneWidthCurrent,sizeInit.cx); - m_cxCur = sizeInit.cx; - } - if (m_nRows > 1) - { - if (m_cyCur) - sizeInit.cy = m_cyCur; - else if (m_strSection != szSplitterSection) - sizeInit.cy = AfxGetApp()->GetProfileInt(m_strSection,szPaneHeightCurrent,sizeInit.cy); - m_cyCur = sizeInit.cy; - } - return CSplitterWnd::CreateView(row,col,pViewClass,sizeInit,pContext); -} - -void CTabSplitterWnd::StopTracking(BOOL bAccept) -{ - // save old active view - CWnd* pOldActiveView = GetActivePane(); - CSplitterWnd::StopTracking(bAccept); - if (bAccept) - { - if (pOldActiveView == GetActivePane()) - { - if (pOldActiveView == NULL) - { - if (m_nCols > 1) - SetActivePane(0, 1); - // pOldActiveView->SetFocus(); // make sure focus is restored - if (m_nRows > 1) - SetActivePane(0, 0); - } - } - SaveSize(); - } -} - -///////////////////////////////////////////////////////////////////////////// -// CTabSplitterWnd message handlers -void CTabSplitterWnd::OnDestroy() -{ - CSplitterWnd::OnDestroy(); - m_nCurRow = -1; - m_nCurCol = -1; -} - -void CTabSplitterWnd::OnClose() -{ - // TODO: Add your message handler code here and/or call default - SaveSize(); - CSplitterWnd::OnClose(); -} - -void CTabSplitterWnd::OnSetFocus(CWnd* pOldWnd) -{ - CSplitterWnd::OnSetFocus(pOldWnd); - - // TODO: Add your message handler code here - if (m_nCurRow >= 0 && m_nCurCol >= 0) - { - SetActivePane(m_nCurRow,m_nCurCol); - CWnd *pWnd = GetPane(m_nCurRow,m_nCurCol); - pWnd->SetFocus(); - } -} - -void CTabSplitterWnd::OnKillFocus(CWnd* pNewWnd) -{ - CSplitterWnd::OnKillFocus(pNewWnd); - - // TODO: Add your message handler code here - GetActivePane(&m_nCurRow,&m_nCurCol); -} - -// This currently only saves the first pane -void CTabSplitterWnd::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - ar << m_cxCur; - ar << m_cxMin; - ar << m_cyCur; - ar << m_cyMin; - } - else - { - ar >> m_cxCur; - ar >> m_cxMin; - ar >> m_cyCur; - ar >> m_cyMin; - } -} - -// mouse wheel handled by the views -BOOL CTabSplitterWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -{ - // TODO: Add your message handler code here and/or call default - TRACE(_T("SplitterWnd mouse wheel message\n")); -/* if (m_nCurRow >= 0 && m_nCurCol >= 0) - { - SetActivePane(m_nCurRow,m_nCurCol); - CWnd *pWnd = GetPane(m_nCurRow,m_nCurCol); - }*/ - return TRUE; -} - -BOOL CTabSplitterWnd::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - - return CSplitterWnd::PreCreateWindow(cs); -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeCtrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeCtrl.cpp deleted file mode 100644 index 98fcb808c67..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeCtrl.cpp +++ /dev/null @@ -1,882 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// URLTreeCtrl.cpp : implementation file -// - -#include "stdafx.h" -#include "UITreeCtrl.h" -#include "UIMessages.h" -#include "cbformats.h" -#include "UIres.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUITreeCtrl -IMPLEMENT_DYNAMIC(CUITreeCtrl,CUIDragDropTree) -IMPLEMENT_DYNAMIC(CRefresh,CObject) -IMPLEMENT_DYNAMIC(CRefreshCategory,CRefresh) - - -CUITreeCtrl::CUITreeCtrl(bool bDragDrop) -: CUIDragDropTree(bDragDrop) -{ - m_idxClosed= 0; - m_idxOpen = 0; - m_vkeydown = 0; - m_IDTimer = 0; - m_style = TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS; - m_PopupID = 0; - m_pPopupWnd = NULL; - m_hOrigFont = NULL; - m_bMe = false; -} - -CUITreeCtrl::~CUITreeCtrl() -{ -} - -void CUITreeCtrl::OnDeleteItemData(DWORD dwData) -{ - -} - -void CUITreeCtrl::ItemPrePaint(LPNMTVCUSTOMDRAW lptvcd,LRESULT *pResult) -{ - *pResult = CDRF_DODEFAULT; - if (lptvcd->nmcd.dwDrawStage & CDDS_ITEM) - { - UINT state = GetItemState((HTREEITEM)lptvcd->nmcd.dwItemSpec,TVIS_SELECTED | TVIS_EXPANDED); - if ((state & TVIS_SELECTED)) - return; - if ((state & TVIS_SELECTED) && (state & TVIS_EXPANDED)) - return; - } - HTREEITEM hItem = (HTREEITEM)lptvcd->nmcd.dwItemSpec; - CUIListCtrlData* pData = GetListCtrlData(hItem); - if (pData == NULL) - return; - *pResult = CDRF_NOTIFYPOSTPAINT; - if (pData->IsFontSet()) - { - CDC *pDC = CDC::FromHandle(lptvcd->nmcd.hdc); - CFont *pOldFont = pDC->SelectObject((CFont*)pData->GetFont()); - m_hOrigFont = (HFONT)pOldFont; - *pResult |= CDRF_NEWFONT; - } - lptvcd->clrText = pData->GetTextColor(); - lptvcd->clrTextBk = pData->GetBkColor(); -} - -void CUITreeCtrl::ItemPostPaint(LPNMTVCUSTOMDRAW lptvcd,LRESULT *pResult) -{ - CDC *pDC = CDC::FromHandle(lptvcd->nmcd.hdc); - if (m_hOrigFont) - { - pDC->SelectObject(CFont::FromHandle(m_hOrigFont)); - m_hOrigFont = NULL; - } - *pResult = CDRF_DODEFAULT; -} - -bool CUITreeCtrl::EndLabelEdit(HTREEITEM hItem,LPCTSTR pszText) -{ - return false; -} - -UINT CUITreeCtrl::GetMenuID() -{ - return m_PopupID; -} - -CWnd *CUITreeCtrl::GetMenuWnd() -{ - return m_pPopupWnd; -} - -void CUITreeCtrl::SetPopupID(UINT nID) -{ - m_PopupID = nID; -} - -void CUITreeCtrl::SetPopupWnd(CWnd *pWnd) -{ - m_pPopupWnd = pWnd; -} - -bool CUITreeCtrl::DragDrop(CDD_OleDropTargetInfo *pInfo) -{ - if (pInfo->GetDataObject() == NULL) - { - HTREEITEM hItem = pInfo->GetTreeItem(); - if (pInfo->GetDropEffect() == DROPEFFECT_MOVE) - { - if (TransferItem(GetDragItem(),hItem)) - { - DeleteItem(GetDragItem()); - } - } - else - { - AfxMessageBox(_T("Copy not supported!")); - } - return true; - } - return false; -} - -bool CUITreeCtrl::DragEnter(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CUITreeCtrl::DragLeave(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CUITreeCtrl::DragOver(CDD_OleDropTargetInfo *pInfo) -{ - // possible non ole drag & drop - if (pInfo->GetDataObject() == NULL) - { - return true; - } - // ole drag and drop expects the dropeffect to be set - // any valid formats? - if (CWDClipboardData::Instance()->IsDataAvailable(pInfo->GetDataObject())) - { - FORMATETC FormatEtc; - FormatEtc.cfFormat = CWDClipboardData::Instance()->GetClipboardFormat(CWDClipboardData::e_cfFileGroupDesc); - FormatEtc.ptd = NULL; - FormatEtc.dwAspect = DVASPECT_CONTENT; - FormatEtc.lindex = -1; - FormatEtc.tymed = TYMED_HGLOBAL; - HRESULT hr = pInfo->GetDataObject()->m_lpDataObject->QueryGetData(&FormatEtc); - if ((pInfo->GetKeyboardState() & MK_SHIFT)) - pInfo->SetDropEffect(DROPEFFECT_MOVE); - else if (hr == S_OK) - { - pInfo->SetDropEffect(DROPEFFECT_COPY); - } - else - pInfo->SetDropEffect(DROPEFFECT_COPY); - return true; - } - return false; -} - -DROPEFFECT CUITreeCtrl::DoDragDrop(NM_TREEVIEW* pNMTreeView,COleDataSource *pOleDataSource) -{ - // non ole drag and drop only within tree - CCF_String ccfText(GetItemText(pNMTreeView->itemNew.hItem)); - CWDClipboardData::Instance()->SetData(pOleDataSource,&ccfText,CWDClipboardData::e_cfString); - return DROPEFFECT_ALL; -} - -CRefresh *CUITreeCtrl::CreateRefreshObject(HTREEITEM hItem,LPARAM lParam) -{ - return new CRefresh(hItem,lParam); -} - -void CUITreeCtrl::UpdateEvent(LPARAM lHint,CObject *pHint) -{ - GetParent()->SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)lHint,(LPARAM)pHint); -} - -void CUITreeCtrl::UpdateCurrentSelection() -{ - HTREEITEM hItem = GetSelectedItem(); - if (hItem) - { - SelectionChanged(hItem,GetItemData(hItem)); - } -} - -void CUITreeCtrl::DoubleClick(HTREEITEM hItem) -{ -} - -void CUITreeCtrl::SelectionChanged(HTREEITEM hItem,LPARAM lParam) -{ - CRefresh *pRefresh = CreateRefreshObject(hItem,lParam); - if (pRefresh) - UpdateEvent(HINT_TREE_SEL_CHANGED,pRefresh); - delete pRefresh; -} - -HTREEITEM CUITreeCtrl::AddAnItem(HTREEITEM hParent, LPCTSTR szText, LPARAM lParam, HTREEITEM hInsAfter,int iImage,int iSelImage, int nChildren) -{ - ASSERT_VALID(this); - - TV_ITEM tvI; - TV_INSERTSTRUCT tvIns; - ZeroMemory(&tvI,sizeof(tvI)); - ZeroMemory(&tvIns,sizeof(tvIns)); - tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - if (nChildren) // get the plus sign - { - tvI.mask |= TVIF_CHILDREN; - tvI.cChildren = nChildren; - } - tvI.pszText = (LPTSTR)szText; - tvI.cchTextMax = lstrlen(szText); - if (iImage == 0) - iImage = m_idxClosed; - tvI.iImage = iImage; - if (iSelImage == 0) - iSelImage = iImage; - tvI.iSelectedImage = iSelImage; - tvI.lParam = (LPARAM)GetNewListCtrlData(lParam,hParent); - tvIns.item = tvI; - tvIns.hInsertAfter = hInsAfter; - tvIns.hParent = hParent; - - m_bMe = true; - HTREEITEM hNewItem = InsertItem(&tvIns); - m_bMe = false; - return hNewItem; -} - -CUIListCtrlData *CUITreeCtrl::GetNewListCtrlData(DWORD dwData,HTREEITEM hParent) -{ - CUIListCtrlData *pListCtrlData = new CUIListCtrlData; - pListCtrlData->SetExtData(dwData); - return pListCtrlData; -} - -DWORD CUITreeCtrl::GetItemData(HTREEITEM hItem) const -{ - if (hItem == NULL) - return 0; - const CUIListCtrlData* pData = GetListCtrlData(hItem); - if (pData) - return pData->GetExtData(); - return 0; -} - -BOOL CUITreeCtrl::SetItemData(HTREEITEM hItem,DWORD dwData,bool bAutoDelete) -{ - ASSERT(hItem); - if (hItem == NULL) - return FALSE; - CUIListCtrlData* pData = GetListCtrlData(hItem); - if (pData == NULL) - return FALSE; - pData->SetExtData(dwData); - pData->SetAutoDelete(bAutoDelete); - return TRUE; -} - -CUIListCtrlData *CUITreeCtrl::GetListCtrlData(HTREEITEM hItem) const -{ - ((CUITreeCtrl*)this)->m_bMe = true; - CUIListCtrlData *pData = (CUIListCtrlData*)CTreeCtrl::GetItemData(hItem); - ((CUITreeCtrl*)this)->m_bMe = false; - if (pData == NULL) - return NULL; - ASSERT(pData->IsKindOf(RUNTIME_CLASS(CUIListCtrlData))); - return pData; -} - -void CUITreeCtrl::SetTextColor(HTREEITEM hItem,COLORREF TextColor) -{ - CUIListCtrlData *pData = GetListCtrlData(hItem); - if (pData) - pData->SetTextColor(TextColor); -}; - -void CUITreeCtrl::SetBkColor(HTREEITEM hItem,COLORREF BkColor) -{ - CUIListCtrlData *pData = GetListCtrlData(hItem); - if (pData) - pData->SetBkColor(BkColor); -} - -void CUITreeCtrl::SetDefaultTextColor(HTREEITEM hItem) -{ - CUIListCtrlData *pData = GetListCtrlData(hItem); - if (pData) - pData->SetDefaultTextColor(); -}; - -void CUITreeCtrl::SetDefaultBkColor(HTREEITEM hItem) -{ - CUIListCtrlData *pData = GetListCtrlData(hItem); - if (pData) - pData->SetDefaultBkColor(); -} - -void CUITreeCtrl::SetItemFont(HTREEITEM hItem,CFont *pFont) -{ - CUIListCtrlData* pData = GetListCtrlData(hItem); - if (pData == NULL) - return; - ASSERT(pFont); - if (pFont) - pData->SetFont(pFont); -} - -void CUITreeCtrl::SetItemBold(HTREEITEM hItem,bool bBold) -{ - CUIListCtrlData* pData = GetListCtrlData(hItem); - if (pData == NULL) - return; - if (!pData->IsFontSet()) - pData->SetFont(GetFont()); - const CFont *pFont = pData->GetFont(); - LOGFONT lf; - ((CFont*)pFont)->GetLogFont(&lf); - lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL; - CFont font; - font.CreateFontIndirect(&lf); - pData->SetFont(&font); - CRect rect; - if (GetItemRect(hItem,&rect,FALSE)) - { - InvalidateRect(rect); - UpdateWindow(); - } -} - -HTREEITEM CUITreeCtrl::GetHitItem(CPoint *pt) -{ - UINT Flag; - HTREEITEM hItem; - CPoint cpt; - - POINT pt1; - GetCursorPos(&pt1); - ScreenToClient(&pt1); - cpt.x = pt1.x; - cpt.y = pt1.y; - hItem = HitTest(cpt, &Flag); - if (hItem && ((Flag & TVHT_ONITEMLABEL) || (Flag & TVHT_ONITEMICON))) - { - if (pt) - *pt = pt1; - return hItem; - } - return NULL; -} - -void CUITreeCtrl::Refresh() -{ -} - -void CUITreeCtrl::DeleteKey(HTREEITEM hItem) -{ -} - -void CUITreeCtrl::GoBack(HTREEITEM hItem) -{ -} - -void CUITreeCtrl::ShowProperties(HTREEITEM hItem) -{ -} - -void CUITreeCtrl::ShowPopupMenu(HTREEITEM hItem,CPoint point) -{ - UINT MenuID = GetMenuID(); - if (MenuID == 0) - return; - CWnd *pWndMess = GetMenuWnd(); - if (pWndMess == NULL) - pWndMess = this; - CMenu menu; - VERIFY(menu.LoadMenu(MenuID)); - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup != NULL); - pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndMess); -} - -BEGIN_MESSAGE_MAP(CUITreeCtrl, CUIDragDropTree) - //{{AFX_MSG_MAP(CUITreeCtrl) - ON_NOTIFY_REFLECT_EX(NM_DBLCLK, OnDblclk) - ON_NOTIFY_REFLECT_EX(NM_RETURN, OnReturn) - ON_NOTIFY_REFLECT_EX(NM_RCLICK, OnRclick) - ON_NOTIFY_REFLECT_EX(NM_CUSTOMDRAW, OnCustomDraw) - ON_NOTIFY_REFLECT_EX(TVN_ITEMEXPANDED, OnItemExpanded) - ON_NOTIFY_REFLECT_EX(TVN_ITEMEXPANDING, OnItemExpanding) - ON_NOTIFY_REFLECT_EX(TVN_SELCHANGED, OnSelchanged) - ON_NOTIFY_REFLECT_EX(TVN_ENDLABELEDIT, OnEndLabelEdit) - ON_NOTIFY_REFLECT_EX(TVN_DELETEITEM, OnDeleteItem) - ON_NOTIFY_REFLECT(TVN_KEYDOWN, OnKeydownFolder) - ON_WM_MOUSEWHEEL() - ON_WM_TIMER() - ON_WM_CREATE() - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_ON_PROPERTIES_KEY,OnAppPropertiesKey) - ON_MESSAGE(WM_APP_ON_DELETE_KEY,OnAppDeleteKey) - ON_MESSAGE(WM_APP_ON_CONTEXT_MENU_KEY,OnAppContextMenuKey) - ON_MESSAGE(WM_APP_ON_BACKSPACE_KEY,OnAppBackspaceKey) - ON_MESSAGE(WM_APP_ON_EDIT_KEY,OnAppEditKey) - ON_MESSAGE(WM_APP_ON_REFRESH_KEY,OnAppRefreshKey) - - ON_MESSAGE(TVM_GETITEM,OnTVMGetItem) - ON_MESSAGE(TVM_SETITEM,OnTVMSetItem) - ON_MESSAGE(TVM_INSERTITEM,OnTVMInsertItem) - ON_MESSAGE(WM_APP_TIMER_SEL_CHANGE,OnTimerSelChange) - ON_MESSAGE(WM_APP_OLE_DD_DODRAGDROP, OnDDDoDragDrop) - ON_MESSAGE(WM_APP_OLE_DD_DROP, OnDragDrop) - ON_MESSAGE(WM_APP_OLE_DD_OVER, OnDragOver) - ON_MESSAGE(WM_APP_OLE_DD_ENTER, OnDragEnter) - ON_MESSAGE(WM_APP_OLE_DD_LEAVE, OnDragLeave) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUITreeCtrl message handlers -BOOL CUITreeCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) -{ - LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)pNMHDR; - if(lptvcd->nmcd.dwDrawStage == CDDS_PREPAINT) - { - *pResult = CDRF_NOTIFYITEMDRAW; - } - else if(lptvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) - { - ItemPrePaint(lptvcd,pResult); - } - else if(lptvcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) - { - ItemPostPaint(lptvcd,pResult); - } - return TRUE; -} - -BOOL CUITreeCtrl::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) -{ - // TODO: Add your control notification handler code here - CPoint point; - HTREEITEM hItem = GetHitItem(&point); - if (hItem == NULL) - return FALSE; - ClientToScreen(&point); - ShowPopupMenu(hItem,point); - *pResult = 0; - return TRUE; -} - -BOOL CUITreeCtrl::OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - // TODO: Add your control notification handler code here - CUIListCtrlData* pData = (CUIListCtrlData*)pNMTreeView->itemOld.lParam; - if (!pData->GetAutoDelete()) - OnDeleteItemData(pData->GetExtData()); - delete pData; - return TRUE; -} - -LRESULT CUITreeCtrl::OnTVMGetItem(WPARAM wParam,LPARAM lParam) -{ - LPTVITEM pitem = (LPTVITEM)lParam; - if (m_bMe == false && pitem->mask & TVIF_PARAM) - { - CUIListCtrlData* pData = GetListCtrlData(pitem->hItem); - if (pData) - { - pitem->lParam = pData->GetExtData(); - pitem->mask &= ~TVIF_PARAM; - } - } - return Default(); -} - -LRESULT CUITreeCtrl::OnTVMSetItem(WPARAM wParam,LPARAM lParam) -{ - LPTVITEM pitem = (LPTVITEM)lParam; - if (m_bMe == false && pitem->mask & TVIF_PARAM) - { - CUIListCtrlData* pData = GetListCtrlData(pitem->hItem); - if (pData) - { - pData->SetExtData(pitem->lParam); - pitem->mask &= ~TVIF_PARAM; - } - } - return Default(); -} - -LRESULT CUITreeCtrl::OnTVMInsertItem(WPARAM wParam,LPARAM lParam) -{ - LPTVINSERTSTRUCT lpis = (LPTVINSERTSTRUCT)lParam; - if (m_bMe == false && lpis->item.mask & TVIF_PARAM) - { - lpis->item.lParam = (LPARAM)GetNewListCtrlData(lpis->item.lParam,lpis->hParent); - } - return Default(); -} - -int CUITreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CUIDragDropTree::OnCreate(lpCreateStruct) == -1) - return -1; - - Init(); - - // TODO: Add your specialized creation code here - return 0; -} - -UINT CUITreeCtrl::GetIconID() -{ - return IDI_FOLDER_CLOSED; -} - -UINT CUITreeCtrl::GetOpenIconID() -{ - return 0; -} - -bool CUITreeCtrl::Expanding(NM_TREEVIEW *nmtvw) -{ - return false; -} - -bool CUITreeCtrl::Collapsing(NM_TREEVIEW *nmtvw) -{ - return true; -} - -void CUITreeCtrl::Init() -{ - // Create the image list we will need - int nCxSmall = GetSystemMetrics(SM_CXSMICON); - int nCySmall = GetSystemMetrics(SM_CYSMICON); - m_ImageList.Create(nCxSmall, - nCySmall, - TRUE, // list does not include masks - 2, - 0 ); // list won't grow - UINT nIconID = GetIconID(); - if (nIconID) - { - HINSTANCE hInstIcon = AfxFindResourceHandle(MAKEINTRESOURCE(nIconID),RT_GROUP_ICON); - HICON hIcon = (HICON)LoadImage( hInstIcon, MAKEINTRESOURCE(nIconID), IMAGE_ICON, - nCxSmall, nCySmall, 0 ); - m_idxClosed = m_ImageList.Add(hIcon); - } - UINT nOpenIconID = GetOpenIconID(); - if (nOpenIconID) - { - HINSTANCE hInstIcon = AfxFindResourceHandle(MAKEINTRESOURCE(nOpenIconID),RT_GROUP_ICON); - HICON hOpenIcon = (HICON)LoadImage( hInstIcon, MAKEINTRESOURCE(nOpenIconID), IMAGE_ICON, - nCxSmall, nCySmall, 0 ); - m_idxOpen = m_ImageList.Add(hOpenIcon); - } - // Associate the image list with the tree - SetImageList(&m_ImageList,TVSIL_NORMAL); - m_ImageList.SetBkColor(CLR_NONE); - ModifyStyle(0,m_style); -} - -BOOL CUITreeCtrl::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.style |= m_style; - return CUIDragDropTree::PreCreateWindow(cs); -} - -BOOL CUITreeCtrl::OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult) -{ - LPNMTVDISPINFO pDispInfo = (LPNMTVDISPINFO)pNMHDR; - if (pDispInfo->item.pszText) - *pResult = EndLabelEdit(pDispInfo->item.hItem,pDispInfo->item.pszText); - return TRUE; -} - -BOOL CUITreeCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) -{ - // TODO: Add your control notification handler code here - HTREEITEM hItem = GetSelectedItem(); - DoubleClick(hItem); - return TRUE; -} - -BOOL CUITreeCtrl::OnReturn(NMHDR* pNMHDR, LRESULT* pResult) -{ - // TODO: Add your control notification handler code here - OnDblclk(pNMHDR,pResult); - return TRUE; -} - -BOOL CUITreeCtrl::OnItemExpanding(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - CWaitCursor w; - // TODO: Add your control notification handler code here - if (pNMTreeView->action == TVE_EXPAND) - { - Expanding(pNMTreeView); - } - else if (pNMTreeView->action == TVE_COLLAPSE) - { - Collapsing(pNMTreeView); - } - return TRUE; -} - -BOOL CUITreeCtrl::OnItemExpanded(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - // TODO: Add your control notification handler code here -/* if (pNMTreeView->action == TVE_EXPAND) - { - SetItemImage(pNMTreeView->itemNew.hItem,m_idxClosed,0); - } - else if (pNMTreeView->action == TVE_COLLAPSE) - { - SetItemImage(pNMTreeView->itemNew.hItem,m_idxOpen,0); - }*/ - return TRUE; -} - -BOOL CUITreeCtrl::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) -{ - //VK_PRIOR 21 page up key - //VK_NEXT 22 page down key - //VK_END 23 end key - //VK_HOME 24 home key - //VK_LEFT 25 left arrow key - //VK_UP 26 up arrow key - //VK_RIGHT 27 right arrow key - //VK_DOWN 28 down arrow key - - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - // TODO: Add your control notification handler code here - if ((pNMTreeView->itemNew.state & TVIS_SELECTED)) - { - if (pNMTreeView->action == TVC_BYMOUSE || pNMTreeView->action == TVC_UNKNOWN) - { - CUIListCtrlData *pData = (CUIListCtrlData*)pNMTreeView->itemNew.lParam; - if (pData) - { - ASSERT_KINDOF(CUIListCtrlData,pData); - SelectionChanged(pNMTreeView->itemNew.hItem,pData->GetExtData()); - } - else - SelectionChanged(pNMTreeView->itemNew.hItem,pNMTreeView->itemNew.lParam); - } - else if (pNMTreeView->action == TVC_BYKEYBOARD) - { - CopyMemory(&m_NMTreeView,pNMTreeView,sizeof(NM_TREEVIEW)); - if (m_vkeydown && m_IDTimer == 0) - { - TRACE0("Timer set\n"); - m_IDTimer = SetTimer(2,100,NULL); - } - } - } - *pResult = 0; - return TRUE; -} - -BOOL CUITreeCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -{ - // TODO: Add your message handler code here and/or call default - return CUIDragDropTree::OnMouseWheel(nFlags, zDelta, pt); -} - -BOOL CUITreeCtrl::PreTranslateMessage(MSG* pMsg) -{ - // TODO: Add your specialized code here and/or call the base class - if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) - { - if (pMsg->wParam == VK_F10 && (GetKeyState(VK_SHIFT) < 0)) - { - PostMessage(WM_APP_ON_CONTEXT_MENU_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_BACK) - { - PostMessage(WM_APP_ON_BACKSPACE_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_F2) - { - PostMessage(WM_APP_ON_EDIT_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_F5) - { - PostMessage(WM_APP_ON_REFRESH_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_DELETE) - { - PostMessage(WM_APP_ON_DELETE_KEY); - return TRUE; - } - else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN) - { - PostMessage(WM_APP_ON_PROPERTIES_KEY); - return TRUE; - } - } - - return CUIDragDropTree::PreTranslateMessage(pMsg); -} - -void CUITreeCtrl::OnKeydownFolder(NMHDR* pNMHDR, LRESULT* pResult) -{ - TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR; - // TODO: Add your control notification handler code here - m_vkeydown = pTVKeyDown->wVKey; - *pResult = 0; -} - -LRESULT CUITreeCtrl::OnTimerSelChange(WPARAM wParam,LPARAM lParam) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)&m_NMTreeView; - CUIListCtrlData *pData = (CUIListCtrlData*)pNMTreeView->itemNew.lParam; - if (pData) - { - ASSERT_KINDOF(CUIListCtrlData,pData); - SelectionChanged(pNMTreeView->itemNew.hItem,pData->GetExtData()); - } - else - SelectionChanged(pNMTreeView->itemNew.hItem,pNMTreeView->itemNew.lParam); - return 1L; -} - -void CUITreeCtrl::OnTimer( UINT nIDEvent ) -{ - CUIDragDropTree::OnTimer(nIDEvent); - if (nIDEvent == m_IDTimer) - { - if (m_vkeydown) - { - SHORT sRet = GetAsyncKeyState(m_vkeydown); - if (sRet >= 0) - { - KillTimer(m_IDTimer); - m_IDTimer = 0; - m_vkeydown = 0; - PostMessage(WM_APP_TIMER_SEL_CHANGE); - } - } - } -} - -LRESULT CUITreeCtrl::OnDragDrop(WPARAM wParam,LPARAM lParam) -{ - if (GetDragDrop() == false) - return 1L; - // get the info we need - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - if (pInfo->GetDataObject() != NULL) - return DragDrop(pInfo) ? 1 : 0; - else - return 1; -} - -// user is currently over the tree view window -// return 1 if we are interested in the CB format -LRESULT CUITreeCtrl::OnDragOver(WPARAM wParam,LPARAM lParam) -{ - if (GetDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - if (pInfo->GetDataObject() != NULL) - return DragOver(pInfo) ? 1 : 0; - else - return 1; -} - -LRESULT CUITreeCtrl::OnDragEnter(WPARAM wParam,LPARAM lParam) -{ - if (GetDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - if (pInfo->GetDataObject() != NULL) - return DragEnter(pInfo) ? 1 : 0; - else - return 1; -} - -LRESULT CUITreeCtrl::OnDragLeave(WPARAM wParam,LPARAM lParam) -{ - if (GetDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - if (pInfo->GetDataObject() != NULL) - return DragLeave(pInfo) ? 1 : 0; - else - return 1; -} - -// Drag and drop initiated -// Return 1 if processed -LRESULT CUITreeCtrl::OnDDDoDragDrop(WPARAM wParam,LPARAM lParam) -{ - if (GetDragDrop() == false) - return 1L; - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)wParam; - COleDataSource *pOleDataSource = (COleDataSource*)lParam; - ASSERT(pOleDataSource); - return DoDragDrop(pNMTreeView,pOleDataSource); -} - -LRESULT CUITreeCtrl::OnAppPropertiesKey(WPARAM wParam, LPARAM lParam) -{ - ShowProperties(GetSelectedItem()); - return 1L; -} - -LRESULT CUITreeCtrl::OnAppDeleteKey(WPARAM wParam, LPARAM lParam) -{ - DeleteItem(GetSelectedItem()); - return 1L; -} - -LRESULT CUITreeCtrl::OnAppRefreshKey(WPARAM wParam, LPARAM lParam) -{ - Refresh(); - return 1L; -} - -LRESULT CUITreeCtrl::OnAppEditKey(WPARAM wParam, LPARAM lParam) -{ - EditLabel(GetSelectedItem()); - return 1L; -} - -LRESULT CUITreeCtrl::OnAppContextMenuKey(WPARAM wParam, LPARAM lParam) -{ - CRect rc; - GetItemRect(GetSelectedItem(),&rc,FALSE); - ClientToScreen(&rc); - ShowPopupMenu(GetSelectedItem(),rc.CenterPoint()); - return 1L; -} - -LRESULT CUITreeCtrl::OnAppBackspaceKey(WPARAM wParam, LPARAM lParam) -{ - GoBack(GetSelectedItem()); - return 1L; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeView.cpp deleted file mode 100644 index 2b2d6a52c1d..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/UITreeView.cpp +++ /dev/null @@ -1,159 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -// TabClientView.cpp : implementation file -// - -#include "stdafx.h" -#include "UITreeView.h" -#include "UIMessages.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CUITreeView - -IMPLEMENT_DYNAMIC(CUITreeView, CView) - -CUITreeView::CUITreeView(UINT nID) : m_nID(nID), m_pTreeCtrl(NULL) -{ - m_Style = WS_VISIBLE | /*WS_BORDER |*/ WS_CHILD | LVS_REPORT; -} - -CUITreeView::~CUITreeView() -{ - delete m_pTreeCtrl; -} - -CUITreeCtrl &CUITreeView::GetTreeCtrl() -{ - ASSERT(m_pTreeCtrl); - return *m_pTreeCtrl; -} - -void CUITreeView::CreateTreeCtrl() -{ - m_pTreeCtrl = new CUITreeCtrl; -} - -void CUITreeView::SelectionChanged(const CRefresh &Refresh) -{ -} - -BEGIN_MESSAGE_MAP(CUITreeView, CView) - //{{AFX_MSG_MAP(CUITreeView) - ON_WM_CREATE() - ON_WM_SETFOCUS() - ON_WM_SIZE() - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS, OnAppUpdateAllViews) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUITreeView drawing - -void CUITreeView::OnDraw(CDC* pDC) -{ - CDocument* pDoc = GetDocument(); - // TODO: add draw code here -} - -///////////////////////////////////////////////////////////////////////////// -// CUITreeView diagnostics - -#ifdef _DEBUG -void CUITreeView::AssertValid() const -{ - CView::AssertValid(); -} - -void CUITreeView::Dump(CDumpContext& dc) const -{ - CView::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CUITreeView message handlers - -int CUITreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CView::OnCreate(lpCreateStruct) == -1) - return -1; - - CreateTreeCtrl(); - - if (GetTreeCtrl().Create(m_Style,CRect(0,0,0,0),this,m_nID) == -1) - return -1; - - return 0; -} - -BOOL CUITreeView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Add your specialized code here and/or call the base class - cs.lpszClass = AfxRegisterWndClass( - CS_DBLCLKS, - NULL, - NULL, - NULL); - ASSERT(cs.lpszClass); - BOOL ret = CView::PreCreateWindow(cs); - cs.dwExStyle |= WS_EX_CLIENTEDGE; - return ret; -} - -void CUITreeView::OnSetFocus(CWnd* pOldWnd) -{ - CView::OnSetFocus(pOldWnd); - - // TODO: Add your message handler code here - GetTreeCtrl().SetFocus(); -} - -void CUITreeView::OnSize(UINT nType, int cx, int cy) -{ - CView::OnSize(nType, cx, cy); - - // TODO: Add your message handler code here - if (GetTreeCtrl().GetSafeHwnd()) - GetTreeCtrl().MoveWindow(0,0,cx,cy); -} - -LRESULT CUITreeView::OnAppUpdateAllViews( WPARAM wParam, LPARAM lParam ) -{ - ASSERT(wParam); - GetDocument()->UpdateAllViews(NULL,wParam,(CObject*)lParam); - return 1L; -} - -void CUITreeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) -{ - // TODO: Add your specialized code here and/or call the base class - if (lHint == HINT_TREE_SEL_CHANGED) - { - ASSERT(pHint); - ASSERT_KINDOF(CRefresh,pHint); - CRefresh *pRefresh = (CRefresh*)pHint; - SelectionChanged(*pRefresh); - } -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Uictrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/Uictrl.cpp deleted file mode 100644 index b816c382053..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/Uictrl.cpp +++ /dev/null @@ -1,3092 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UICtrl.h" -#include "InPlaceEdit.h" -#include "TextProgressCtrl.h" -#include "UIres.h" -#include "ctype.h" -#include "cbformats.h" -#include - -////////////////////////////////////////////////////// -// Temporarily changes the view type -////////////////////////////////////////////////////// -CChangeViewType::CChangeViewType(CUIODListCtrl *pLC,DWORD dwType) -{ - m_pLC = pLC; - m_dwType = m_pLC->GetViewType(); - m_pLC->SetViewType(dwType); -} - -CChangeViewType::~CChangeViewType() -{ - m_pLC->SetViewType(m_dwType); -} -////////////////////////////////////////////////////////// - -LPCTSTR CUIODListCtrl::szEntryHeadings = _T("Headings"); -LPCTSTR CUIODListCtrl::szEntryStyle = _T("Style"); -LPCTSTR CUIODListCtrl::szEntryRowSel = _T("RowSelection"); -LPCTSTR CUIODListCtrl::szEntryViewType = _T("ViewType"); -LPCTSTR CUIODListCtrl::szEntryColumnSizing = _T("ColumnSizing"); -LPCTSTR CUIODListCtrl::szEntrySortColumn = _T("SortColumn"); -LPCTSTR CUIODListCtrl::szEntrySubItems = _T("Columns"); -LPCTSTR CUIODListCtrl::szEntryColOrder = _T("ColumnOrder"); -LPCTSTR CUIODListCtrl::szEntryColWidths = _T("ColumnWidths"); - -IMPLEMENT_SERIAL(CUIODListCtrl, CListCtrl, 0) - -#define COLUMN_DELIMITER '|' -#define COLUMN_DELIMITER_STR "|" - -const int nMaxDigLen = _MAX_INT_DIG*4; - -////////////////////////////// -// -// CUIODListCtrl -// -////////////////////////////// -BEGIN_MESSAGE_MAP(CUIODListCtrl, CListCtrl) - //{{AFX_MSG_MAP(CUIODListCtrl) - ON_MESSAGE(WM_APP_ON_PROPERTIES_KEY,OnAppPropertiesKey) - ON_MESSAGE(WM_APP_ON_DELETE_KEY,OnAppDeleteKey) - ON_MESSAGE(WM_APP_ON_CONTEXT_MENU_KEY,OnAppContextMenuKey) - ON_MESSAGE(WM_APP_ON_BACKSPACE_KEY,OnAppBackspaceKey) - ON_MESSAGE(WM_APP_ON_EDIT_KEY,OnAppEditKey) - ON_MESSAGE(WM_APP_ON_REFRESH_KEY,OnAppRefreshKey) - - ON_NOTIFY_REFLECT_EX(LVN_BEGINDRAG, OnBegindrag) - ON_NOTIFY_REFLECT_EX(LVN_BEGINRDRAG, OnBeginRDrag) - ON_WM_CREATE() - ON_WM_DESTROY() - ON_MESSAGE(LVM_SETCOLUMNWIDTH,OnSetColumnWidth) - ON_MESSAGE(LVM_DELETEALLITEMS,OnDeleteAllItems) - ON_MESSAGE(LVM_DELETEITEM,OnDeleteItem) - ON_MESSAGE(LVM_DELETECOLUMN,OnDeleteColumn) - ON_MESSAGE(WM_UPDATEHEADERWIDTH,OnUpdateHeaderWidth) - ON_WM_SIZE() - ON_WM_PAINT() - ON_WM_SETFOCUS() - ON_WM_KILLFOCUS() - ON_WM_CONTEXTMENU() - ON_WM_INITMENUPOPUP() - ON_WM_LBUTTONDOWN() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_COMMAND(ID_UI_VIEW_LARGE_ICONS,OnViewLargeIcons) - ON_COMMAND(ID_UI_VIEW_SMALL_ICONS,OnViewSmallIcons) - ON_COMMAND(ID_UI_VIEW_DETAILS,OnViewDetails) - ON_COMMAND(ID_UI_VIEW_LIST,OnViewList) - ON_COMMAND(ID_UI_VIEW_FULL_ROW_SELECTION,OnViewFullRowSelection) - ON_COMMAND(ID_UI_VIEW_COLUMN_ORDERING,OnViewColumnOrdering) - ON_COMMAND(ID_UI_VIEW_COLUMN_SIZING,OnViewColumnSizing) - ON_COMMAND(ID_UI_VIEW_GRIDLINES,OnViewGridlines) - ON_COMMAND(ID_UI_VIEW_CHECKBOXES,OnViewCheckboxes) - ON_COMMAND(ID_UI_VIEW_TRACK_SELECT,OnViewTrackSelect) - ON_COMMAND(ID_UI_VIEW_EDIT_COLUMN,OnViewEditColumn) - ON_COMMAND(ID_HEADER_REMOVE_COL,OnHeaderRemoveColumn) - ON_COMMAND(ID_HEADER_EDIT_TEXT,OnHeaderEditText) - ON_COMMAND(ID_HEADER_RESET,OnHeaderReset) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) - ON_WM_DROPFILES() - ON_MESSAGE(LVM_SETIMAGELIST, OnSetImageList) - ON_MESSAGE(LVM_SETTEXTCOLOR, OnSetTextColor) - ON_MESSAGE(LVM_SETTEXTBKCOLOR, OnSetTextBkColor) - ON_MESSAGE(LVM_SETBKCOLOR, OnSetBkColor) - ON_MESSAGE(LVM_GETITEMTEXT, OnGetItemText) - //}}AFX_MSG_MAP - ON_MESSAGE(WM_APP_OLE_DD_DROP, OnDragDrop) - ON_MESSAGE(WM_APP_OLE_DD_DODRAGDROP, OnDDDoDragDrop) - ON_MESSAGE(WM_APP_OLE_DD_OVER, OnDragOver) - ON_MESSAGE(WM_APP_OLE_DD_ENTER, OnDragEnter) - ON_MESSAGE(WM_APP_OLE_DD_LEAVE, OnDragLeave) -END_MESSAGE_MAP() - - -CUIODListCtrl::CUIODListCtrl(bool bDragDrop) -{ - m_PopupID = 0; - m_MultiPopupID = 0; - m_bDragDrop = bDragDrop; - m_bDropFiles = true; - m_pColWidths = NULL; - m_pColOrder = NULL; - m_pColTypes = NULL; - m_hOrigFont = NULL; - m_pPopupWnd = NULL; - m_nImageList = LVSIL_SMALL; - m_nColClicked = -1; - m_nSortColumn = 0; - m_nSubItems = 0; - m_nItems = 0; - m_nImage = 0; - m_dwExStyle = LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP; - m_dwViewType = LVS_REPORT; - m_bDelayPaint = false; - m_bColumnSizing=TRUE; - m_bRClickChangeIconSize = TRUE; - // this is toggled on in InitListCtrl - m_bFullRowSel=FALSE; - m_bClientWidthSel=TRUE; - m_bSortAscending=TRUE; - m_bToolTips=FALSE; - m_bEditSubItems = true; - m_cxClient=0; - m_cxStateImageOffset=0; - - m_clrText=::GetSysColor(COLOR_WINDOWTEXT); - m_clrTextBk=::GetSysColor(COLOR_WINDOW); - m_clrBkgnd=::GetSysColor(COLOR_WINDOW); - m_strNoItemsMess.LoadString(IDS_NO_ITEMS_MESS); -} - -CUIODListCtrl::~CUIODListCtrl() -{ - Empty(); -} - -void CUIODListCtrl::AllItemsDeleted() -{ - -} - -void CUIODListCtrl::Empty() -{ - m_objList.DeleteAll(); - delete []m_pColWidths; - delete []m_pColOrder; - delete []m_pColTypes; - m_pColWidths = NULL; - m_pColOrder = NULL; - m_pColTypes = NULL; -} - -// should be overridden to do any initialization -void CUIODListCtrl::Init() -{ -} - -void CUIODListCtrl::UpdateEvent(LPARAM lHint,CObject *pHint) -{ - GetParent()->SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)lHint,(LPARAM)pHint); -} - -BOOL CUIODListCtrl::SetViewType(DWORD dwViewType,UINT nFlags) -{ - BOOL bRet = ModifyStyle(LVS_TYPEMASK,dwViewType & LVS_TYPEMASK,nFlags); - if (bRet) - SaveProfile(); - return bRet; -} - -DWORD CUIODListCtrl::GetViewType() const -{ - return(GetStyle() & LVS_TYPEMASK); -} - -void CUIODListCtrl::ChangeStyle(UINT &dwStyle) -{ - LoadProfile(); - dwStyle |= LVS_SHOWSELALWAYS | m_dwViewType; -} - -// offsets for first and other columns -#define OFFSET_FIRST 2 -#define OFFSET_OTHER 6 - -void CUIODListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) -{ - CDC* pDC=CDC::FromHandle(lpDrawItemStruct->hDC); - CRect rcItem(lpDrawItemStruct->rcItem); - UINT uiFlags=ILD_TRANSPARENT; - CImageList* pImageList; - int nItem=lpDrawItemStruct->itemID; - BOOL bFocus=(GetFocus()==this); - COLORREF clrTextSave, clrBkSave; - COLORREF clrImage=m_clrBkgnd; - static _TCHAR szBuff[MAX_PATH]; - LPCTSTR pszText; - - if (m_cxClient == 0) - { - CRect rcClient; - GetClientRect(rcClient); - m_cxClient = rcClient.Width(); - } -// get item data - - LV_ITEM lvi; - lvi.mask=LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM; - lvi.iItem=nItem; - lvi.iSubItem=0; - lvi.pszText=szBuff; - lvi.cchTextMax=sizeof(szBuff); - lvi.stateMask=0xFFFF; // get all state flags - GetItem(&lvi); - - BOOL bSelected=(bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED; - bSelected=bSelected || (lvi.state & LVIS_DROPHILITED); - -// set colors if item is selected - - CRect rcAllLabels; - GetItemRect(nItem,rcAllLabels,LVIR_BOUNDS); - CRect rcLabel; - GetItemRect(nItem,rcLabel,LVIR_LABEL); - rcAllLabels.left=rcLabel.left; -// if(m_bClientWidthSel && rcAllLabels.rightSetBkMode(TRANSPARENT); - CUIListCtrlData *pData = (CUIListCtrlData*)lvi.lParam; - ASSERT(pData->IsKindOf(RUNTIME_CLASS(CUIListCtrlData))); - CFont *pOldFont = NULL; - if (pData && pData->IsFontSet()) - { - pOldFont = pDC->SelectObject((CFont*)pData->GetFont()); - } - if(bSelected) - { - if (bFocus) - { - clrTextSave=pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT)); - clrBkSave=pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT)); - pDC->FillRect(rcAllLabels,&CBrush(::GetSysColor(COLOR_HIGHLIGHT))); - } - else - { - clrTextSave=pDC->GetTextColor(); - clrBkSave=pDC->GetBkColor(); - DWORD clrTextBk; - if (pData) - { - pDC->SetTextColor(pData->GetTextColor()); - clrTextBk = pData->GetBkColor(); - } - else - { - clrTextBk = m_clrTextBk; - pDC->SetTextColor(m_clrText); - } - CRect rc(rcAllLabels); - pDC->FillRect(rcAllLabels,&CBrush(clrTextBk)); - pDC->FrameRect(rc,&CBrush(::GetSysColor(COLOR_HIGHLIGHT))); - } - } - else - { - CUIListCtrlData *pData = (CUIListCtrlData *)lvi.lParam; - if (pData) - { - ASSERT(pData->IsKindOf(RUNTIME_CLASS(CUIListCtrlData))); - pDC->SetTextColor(pData->GetTextColor()); - pDC->SetBkColor(pData->GetBkColor()); - pDC->FillRect(rcAllLabels,&CBrush(pData->GetBkColor())); - } - else - pDC->FillRect(rcAllLabels,&CBrush(m_clrTextBk)); - } -// set color and mask for the icon - - if(lvi.state & LVIS_CUT) - { - clrImage=m_clrBkgnd; - uiFlags|=ILD_BLEND50; - } - else if(bSelected) - { - clrImage=::GetSysColor(COLOR_HIGHLIGHT); - uiFlags|=ILD_BLEND50; - } - -// draw state icon - - UINT nStateImageMask=lvi.state & LVIS_STATEIMAGEMASK; - if(nStateImageMask) - { - int nImage=(nStateImageMask>>12)-1; - pImageList=GetImageList(LVSIL_STATE); - if(pImageList) - pImageList->Draw(pDC,nImage,CPoint(rcItem.left,rcItem.top),ILD_TRANSPARENT); - } - -// draw normal and overlay icon - - CRect rcIcon; - GetItemRect(nItem,rcIcon,LVIR_ICON); - - pImageList=GetImageList(LVSIL_SMALL); - if(pImageList) - { - UINT nOvlImageMask=lvi.state & LVIS_OVERLAYMASK; - if(rcItem.leftm_hImageList,lvi.iImage,pDC->m_hDC,rcIcon.left,rcIcon.top,16,16,m_clrBkgnd,clrImage,uiFlags | nOvlImageMask); - } - -// draw item label - - GetItemRect(nItem,rcItem,LVIR_LABEL); - rcItem.right-=m_cxStateImageOffset; - - pszText=MakeShortString(pDC,szBuff,rcItem.right-rcItem.left,2*OFFSET_FIRST); - - rcLabel=rcItem; - rcLabel.left+=OFFSET_FIRST; - rcLabel.right-=OFFSET_FIRST; - - pDC->DrawText(pszText,-1,rcLabel,DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER); -// draw labels for extra columns - - LV_COLUMN lvc; - lvc.mask=LVCF_FMT | LVCF_WIDTH; - - for(int nColumn=1; GetColumn(nColumn,&lvc); nColumn++) - { - rcItem.left=rcItem.right; - rcItem.right+=lvc.cx; - - int nRetLen=GetItemText(nItem,nColumn,szBuff,sizeof(szBuff)); - if(nRetLen==0) continue; - - pszText=MakeShortString(pDC,szBuff,rcItem.right-rcItem.left,2*OFFSET_OTHER); - - UINT nJustify=DT_LEFT; - - if(pszText==szBuff) - { - switch(lvc.fmt & LVCFMT_JUSTIFYMASK) - { - case LVCFMT_RIGHT: - nJustify=DT_RIGHT; - break; - case LVCFMT_CENTER: - nJustify=DT_CENTER; - break; - default: - break; - } - } - - rcLabel=rcItem; - rcLabel.left+=OFFSET_OTHER; - rcLabel.right-=OFFSET_OTHER; - - pDC->DrawText(pszText,-1,rcLabel,nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER); - } - if (pData->IsKindOf(RUNTIME_CLASS(CUIStrListCtrlData))) - { - CUIStrListCtrlData *pStrData = (CUIStrListCtrlData*)pData; - if (!pStrData->GetExtraString().IsEmpty()) - { - rcLabel=rcAllLabels; - rcLabel.top += (m_cySmallIcon+1); - pDC->DrawText(pStrData->GetExtraString(),-1,rcLabel,DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER); - } - } -// draw focus rectangle if item has focus - - if(lvi.state & LVIS_FOCUSED && bFocus) - pDC->DrawFocusRect(rcAllLabels); - -// set original colors if item was selected - - if(bSelected) - { - pDC->SetTextColor(clrTextSave); - pDC->SetBkColor(clrBkSave); - } - if (pOldFont) - pDC->SelectObject(pOldFont); - pDC->SetBkMode(BkMode); -} - -LPCTSTR CUIODListCtrl::MakeShortString(CDC* pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset) -{ - static const _TCHAR szThreeDots[]=_T("..."); - - int nStringLen=lstrlen(lpszLong); - - if(nStringLen==0 || pDC->GetTextExtent(lpszLong,nStringLen).cx+nOffset<=nColumnLen) - return(lpszLong); - - static _TCHAR szShort[MAX_PATH]; - - lstrcpy(szShort,lpszLong); - int nAddLen=pDC->GetTextExtent(szThreeDots,sizeof(szThreeDots)).cx; - - for(int i=nStringLen-1; i>0; i--) - { - szShort[i]=0; - if(pDC->GetTextExtent(szShort,i).cx+nOffset+nAddLen<=nColumnLen) - break; - } - - lstrcat(szShort,szThreeDots); - - return(szShort); -} - -void CUIODListCtrl::RepaintSelectedItems() -{ - CRect rcItem, rcLabel; - -// invalidate focused item so it can repaint properly - - int nItem=GetNextItem(-1,LVNI_FOCUSED); - - if(nItem!=-1) - { - GetItemRect(nItem,rcItem,LVIR_BOUNDS); - GetItemRect(nItem,rcLabel,LVIR_LABEL); - rcItem.left=rcLabel.left; - - InvalidateRect(rcItem,FALSE); - } - -// if selected items should not be preserved, invalidate them - -// if(!(GetStyle() & LVS_SHOWSELALWAYS)) -// { - for(nItem=GetNextItem(-1,LVNI_SELECTED); - nItem!=-1; nItem=GetNextItem(nItem,LVNI_SELECTED)) - { - GetItemRect(nItem,rcItem,LVIR_BOUNDS); - GetItemRect(nItem,rcLabel,LVIR_LABEL); - rcItem.left=rcLabel.left; - - InvalidateRect(rcItem,FALSE); - } -// } - -// update changes - - UpdateWindow(); -} - -void CUIODListCtrl::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItem) -{ - lpMeasureItem->itemHeight = (m_cySmallIcon+1)*3; -} - - -BOOL CUIODListCtrl::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) -{ - LPNMHDR pnmh; - - switch (message) - { - case WM_DRAWITEM: - ASSERT(pResult == NULL); - DrawItem((LPDRAWITEMSTRUCT)lParam); - break; - case WM_MEASUREITEM: - ASSERT(pResult == NULL); - MeasureItem((LPMEASUREITEMSTRUCT)lParam); - break; - case WM_NOTIFY: - pnmh = (LPNMHDR)lParam; - if (pnmh->code == LVN_ITEMCHANGED) - { - NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pnmh; - if ((pNMListView->uNewState & LVIS_SELECTED) == LVIS_SELECTED && - (pNMListView->uNewState & LVIS_FOCUSED) == LVIS_FOCUSED) - { - return OnSelChanged(pNMListView->iItem,pResult); - } - } - else if (pnmh->code == LVN_GETDISPINFO) - { - return GetDispInfo((LV_DISPINFO*)pnmh); - } - else if (pnmh->code == LVN_COLUMNCLICK) - { - return ColumnClick((NM_LISTVIEW*)pnmh); - } - else if (pnmh->code == LVN_ENDLABELEDIT) - { - return OnEndLabelEdit(pnmh,pResult); - } - else if (pnmh->code == NM_DBLCLK) - { - return DoubleClick((NM_LISTVIEW*)pnmh); - } - else if (pnmh->code == NM_RETURN) - { - return OnEnter((NM_LISTVIEW*)pnmh); - } - else if (pnmh->code == NM_CUSTOMDRAW) - { - LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; - if(lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT) - { - //tell the control we want pre-paint notifications for each item - *pResult = CDRF_NOTIFYITEMDRAW; - return TRUE; - } - if (lplvcd->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT | CDDS_SUBITEM)) - { - return SubItemPrePaint(lplvcd,pResult); - } - if (lplvcd->nmcd.dwDrawStage == (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM)) - { - return SubItemPostPaint(lplvcd,pResult); - } - if (lplvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) - { - return ItemPrePaint(lplvcd,pResult); - } - if (lplvcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) - { - return ItemPostPaint(lplvcd,pResult); - } - } - } - return CWnd::OnChildNotify(message, wParam, lParam, pResult); -} - -LRESULT CUIODListCtrl::OnUpdateHeaderWidth(WPARAM wParam,LPARAM lParam) -{ - // lParam = column that has changed its width - int nItem = lParam; - m_pColWidths[nItem] = GetColumnWidth(nItem); - GetParent()->SendMessage(WM_HEADERWIDTHCHANGED,(WPARAM)GetSafeHwnd(),nItem); - return TRUE; -} - -BOOL CUIODListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) -{ - LPNMHDR pnmh = (LPNMHDR)lParam; - if ((pnmh->code == HDN_BEGINTRACKW || pnmh->code == HDN_BEGINTRACKA)) - { - if (m_bColumnSizing == FALSE) - { - *pResult = TRUE; - return TRUE; - } - LPNMHEADER phdr = (LPNMHEADER)lParam; - if (phdr->pitem->mask & HDI_WIDTH) - { - } - } - if ((pnmh->code == HDN_ITEMCHANGINGW || pnmh->code == HDN_ITEMCHANGINGA)) - { - LPNMHEADER phdr = (LPNMHEADER)lParam; - } - if ((pnmh->code == HDN_ENDTRACKW || pnmh->code == HDN_ENDTRACKA)) - { - HD_NOTIFY *phdn = (HD_NOTIFY*)pnmh; - LPNMHEADER phdr = (LPNMHEADER)lParam; - if (m_bColumnSizing == TRUE && (phdr->pitem->mask & HDI_WIDTH)) - PostMessage(WM_UPDATEHEADERWIDTH,(WPARAM)phdn->hdr.hwndFrom,(LPARAM)phdn->iItem); - } - // wParam is zero for Header ctrl - if( wParam == 0 && pnmh->code == NM_RCLICK ) - { - // Right button was clicked on header - CPoint ptScreen(GetMessagePos()); - CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0); - ASSERT(pHeader); - CPoint ptClient(ptScreen); - pHeader->ScreenToClient(&ptClient); - - // Determine the column index - int index=-1; - CRect rcCol; - for( int i=0; Header_GetItemRect(pHeader->m_hWnd, i, &rcCol); i++ ) - { - if( rcCol.PtInRect( ptClient ) ) - { - index = i; - break; - } - } - OnRClickHeader(ptScreen,index); - } - return CWnd::OnNotify(wParam,lParam,pResult); -} - -DWORD CUIODListCtrl::GetItemData(int nIndex) const -{ - if (nIndex != LB_ERR) - { - const CUIListCtrlData* pListObj = GetListCtrlData(nIndex); - if (pListObj) - return pListObj->GetExtData(); - } - return 0; -} - -BOOL CUIODListCtrl::SetItemDataAutoDelete(int nIndex,CObject *pObj) -{ - ASSERT_KINDOF(CObject,pObj); - return SetItemData(nIndex,(DWORD)pObj,true); -} - -BOOL CUIODListCtrl::SetItemData(int nIndex,DWORD dwData,bool bAutoDelete) -{ - if (nIndex != LB_ERR) - { - CUIListCtrlData* pListObj = GetListCtrlData(nIndex); - if (pListObj) - { - pListObj->SetExtData(dwData); - pListObj->SetAutoDelete(bAutoDelete); - return TRUE; - } - } - return FALSE; -} - -int CUIODListCtrl::SetIcon(int nRow,int nImage) -{ - LV_ITEM lvItem; - ZeroMemory(&lvItem,sizeof(LV_ITEM)); - lvItem.mask = LVIF_IMAGE; - lvItem.iItem = nRow; - lvItem.iImage = nImage; - SetItem(&lvItem); - return lvItem.iImage; -} - -int CUIODListCtrl::SetIcon(int nRow,UINT nIconID) -{ - int nImage = GetImageIndex(nIconID); - return SetIcon(nRow,nImage); -} - -BOOL CUIODListCtrl::SetColumnFormat(int nCol,int fmt) -{ - LVCOLUMN lvCol; - ZeroMemory(&lvCol,sizeof(lvCol)); - lvCol.mask = LVCF_FMT; - lvCol.fmt = fmt; - return SetColumn(nCol,&lvCol); -} - -void CUIODListCtrl::SetTextColor(int nRow, int nCol, COLORREF TextColor) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - if (pData) - pData->SetTextColor(TextColor,nCol); -} - -void CUIODListCtrl::SetDefaultTextColor(int nRow,int nCol) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - if (pData) - pData->SetDefaultTextColor(nCol); -} - -void CUIODListCtrl::SetBkColor(int nRow,int nCol,COLORREF BkColor) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - if (pData) - pData->SetBkColor(BkColor,nCol); -} - -void CUIODListCtrl::SetDefaultBkColor(int nRow,int nCol) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - if (pData) - pData->SetDefaultBkColor(nCol); -} - -CUIListCtrlData *CUIODListCtrl::GetListCtrlData(int nItem) const -{ - CUIListCtrlData *pData = (CUIListCtrlData *)CListCtrl::GetItemData(nItem); - if (pData == NULL) - return NULL; - ASSERT(pData->IsKindOf(RUNTIME_CLASS(CUIListCtrlData))); - return pData; -} - -int CUIODListCtrl::AddColumn(LPCTSTR szText) -{ - // don't add again - int nCol = FindColumn(szText); - if (nCol >= 0) - return nCol; - nCol = InsertColumn(m_nSubItems,szText); - if (nCol != -1) - { - m_strHeadings += COLUMN_DELIMITER_STR; - m_strHeadings += szText; - m_nSubItems++; - SaveProfile(); - LoadProfile(); - } - return nCol; -} - -int CUIODListCtrl::FindColumn(LPCTSTR pszText) -{ - LPCTSTR pszHeadings = m_strHeadings; - int nCol=0; - while (*pszHeadings != '\0') - { - if (*pszHeadings == COLUMN_DELIMITER) - nCol++; - if (_tcsnicmp(pszHeadings,pszText,_tcslen(pszText)) == 0) - { - break; - } - pszHeadings = _tcsinc(pszHeadings); - } - return *pszHeadings == '\0' ? -1 : nCol; -} - -BOOL CUIODListCtrl::InitListCtrl(UINT IconID,LPCTSTR szHeadings,LPCTSTR pszProfile) -{ - static UINT Icons[2]; - - Icons[0] = IconID; - Icons[1] = 0; - return InitListCtrl(&Icons[0],szHeadings,pszProfile); -} - -BOOL CUIODListCtrl::InitListCtrl(LPCTSTR szHeadings,LPCTSTR pszProfile) -{ - static UINT Icons[1]; - - Icons[0] = 0; - return InitListCtrl(&Icons[0],szHeadings,pszProfile); -} - -int CUIODListCtrl::InitListCtrl(const UINT *pIconIDs,LPCTSTR szHeadings,LPCTSTR pszProfile) -{ - BOOL bFailed = FALSE; - // TODO: Add extra initialization here - if (pszProfile) - { - SetSection(pszProfile); - } - //clean up - if (m_nSubItems) - { - if (m_strHeadings == szHeadings) - return m_nSubItems; - DeleteAllItems(); - int nSubItems=m_nSubItems; - for(int i=0;i < nSubItems;i++) - DeleteColumn(0); - m_nSubItems = 0; - Empty(); - } - if (pszProfile == NULL) - { - if (!m_strSection.IsEmpty()) - pszProfile = m_strSection; - } - if (pszProfile) - { - LoadProfile(); - // Use profile headings if found - if (!m_strHeadings.IsEmpty()) - { - if (m_strHeadings != szHeadings) - { - m_strHeadings = szHeadings; - SaveProfile(); - } - } - } - if (m_dwExStyle) - SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, m_dwExStyle); - - // at least one image - if (pIconIDs && *pIconIDs) - { - // load the icons and add them to the image lists - int i; - for(i=0;*pIconIDs;i++,pIconIDs++) - { - if (AddIcon(*pIconIDs) == -1) - bFailed = TRUE; - } - } - - // Now initialize the columns we will need - // Initialize the LV_COLUMN structure - // the mask specifies that the .fmt, .ex, width, and .subitem members - // of the structure are valid, - LV_COLUMN lvC; - lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvC.fmt = LVCFMT_LEFT; // left align the column - - if (szHeadings) - { - // parse the string, format it and get column count - const int MAX_HEADING_LEN = 512; - TCHAR szHeadingsCopy[MAX_HEADING_LEN]; - if (_tcslen(szHeadings) >= MAX_HEADING_LEN-1) - { - _tcsncpy(szHeadingsCopy,szHeadings,MAX_HEADING_LEN-1); - szHeadingsCopy[MAX_HEADING_LEN-1] = '\0'; - } - else - _tcscpy(szHeadingsCopy,szHeadings); - LPTSTR p = szHeadingsCopy; - int nCols = 0; - while (*p != '\0') - { - if (*p == COLUMN_DELIMITER) - { - nCols++; - *p = '\0'; - } - p = _tcsinc(p); - } - if (*szHeadingsCopy) - nCols++; - LPTSTR pszText = szHeadingsCopy; - m_nSubItems = nCols; - for (int index = 0;index < nCols; index++) - { - lvC.iSubItem = index; - lvC.pszText = pszText; -// lvC.cx = LVSCW_AUTOSIZE_USEHEADER; - lvC.cx = 100; - if (InsertColumn(index, &lvC) == -1) - { - TRACE(_T("InsertColumn failed\n")); - m_nSubItems--; - bFailed = TRUE; - } - while (*pszText) - pszText = _tcsinc(pszText); - pszText = _tcsinc(pszText); // Runs past the end of the buffer - } - // Add the columns. - m_strHeadings = szHeadings; - if (pszProfile) - { - SaveProfile(); - LoadProfile(); - } - if (m_pColOrder) - { - SendMessage(LVM_SETCOLUMNORDERARRAY,(WPARAM)nCols,(LPARAM)m_pColOrder); - } - if (m_pColWidths) - { - for(int i=0;i < nCols;i++) - { - if (m_pColWidths[i] != 0) - SetColumnWidth(i,m_pColWidths[i]); - } - } - else - { - m_pColWidths = new int[nCols]; - for(int i=0;i < nCols;i++) - { - m_pColWidths[i] = GetColumnWidth(i); - } - } - if (m_pColTypes == NULL) - { - // set default column types - m_pColTypes = new int[nCols]; - for(int i=0;i < nCols;i++) - { - m_pColTypes[i] = e_Text; - } - } - } - SetSortHeader(); - return m_nSubItems; -} - -void CUIODListCtrl::GetImageLists(CImageList **pILSmall,CImageList **pILLarge) -{ - *pILSmall = GetImageList(LVSIL_SMALL); - if (*pILSmall == NULL) - { - CreateImageLists(); - *pILSmall = GetImageList(LVSIL_SMALL); - } - *pILLarge = GetImageList(LVSIL_NORMAL); - ASSERT(*pILSmall); - ASSERT(*pILLarge); -} - -void CUIODListCtrl::CreateImageLists() -{ - m_cxSmallIcon = ::GetSystemMetrics(SM_CXSMICON); - m_cySmallIcon = ::GetSystemMetrics(SM_CYSMICON); - m_cxLargeIcon = ::GetSystemMetrics(SM_CXICON); - m_cyLargeIcon = ::GetSystemMetrics(SM_CYICON); - if (m_ImageSmall.GetSafeHandle() != NULL) - m_ImageSmall.DeleteImageList(); - if (m_ImageLarge.GetSafeHandle() != NULL) - m_ImageLarge.DeleteImageList(); - // create the small icon image list - m_ImageSmall.Create(m_cxSmallIcon, - m_cySmallIcon, - ILC_MASK | ILC_COLOR16, - 1, - 1); - // create the large icon image list - m_ImageLarge.Create(m_cxLargeIcon, - m_cyLargeIcon, - ILC_MASK | ILC_COLOR16, - 1, - 1); - // Associate the image lists with the list view - SetImageList(&m_ImageSmall, LVSIL_SMALL); - SetImageList(&m_ImageLarge, LVSIL_NORMAL); -} - -void CUIODListCtrl::AddExtraString(int nRow,LPCTSTR pszExtraText) -{ - CUIStrListCtrlData *pData = (CUIStrListCtrlData *)GetListCtrlData(nRow); - ASSERT_KINDOF(CUIStrListCtrlData,pData); - pData->AddExtraString(pszExtraText); -} - -void CUIODListCtrl::ConvertToTime(CString &str) -{ - int nPoint = str.Find(GetDecimalSep()); - int nSecs=0; - if (nPoint == -1) - nSecs = _ttoi(str); - else - { - LPTSTR pszStop; - double dSecs = _tcstod(str,&pszStop); - nSecs = dSecs; - } - if (nSecs == 0) - return; - int nMins = nSecs / 60; - nSecs = nSecs % 60; - str.Format(_T("%u:%u"),nMins,nSecs); -} - -void CUIODListCtrl::AddThousandSeps(CString &str) -{ - CString strTemp; - CString strExp; - CString strNeg; - int nDouble = str.Find(GetDecimalSep()); - if (nDouble >= 0) - { - strTemp = str.Left(nDouble); - strExp = str.Right(str.GetLength()-nDouble); - } - else - { - if (str.Find(GetNegativeSign()) == 0) - { - strNeg = str.Left(1); - strTemp = str.Right(str.GetLength()-1); - } - else - strTemp = str; - } - int len = strTemp.GetLength(); - if (len <= 3 || len > nMaxDigLen) - return; - LPCTSTR pBuf = strTemp; - pBuf += (len-1); - TCHAR tempbuf[nMaxDigLen+1]; - LPTSTR pTempBuf = tempbuf; - LPCTSTR pSep = GetThousandSep(); - for(int i=0;i < len;i++) - { - if (i && ((i % 3) == 0)) - { - if (*pTempBuf != *pSep) - { - *pTempBuf = *pSep; - pTempBuf = _tcsinc(pTempBuf); - } - } - *pTempBuf = *pBuf; - pTempBuf = _tcsinc(pTempBuf); - pBuf = _tcsdec(strTemp,pBuf); - } - *pTempBuf = '\0'; - _tcsrev(tempbuf); - str = strNeg; - str += tempbuf; - str += strExp; -} - -BOOL CUIODListCtrl::AddString(int nRow,int nCol,int nValue,CUIODListCtrl::eColTypes type) -{ - CString sValue; - sValue.Format(_T("%d"),nValue); - return AddString(nRow,nCol,sValue,type); -} - -BOOL CUIODListCtrl::AddString(int nRow,int nCol,double dValue,CUIODListCtrl::eColTypes type) -{ - char szBuf[nMaxDigLen]; - _gcvt(dValue,_MAX_INT_DIG,szBuf); -#ifdef _UNICODE -USES_CONVERSION; - return AddString(nRow,nCol,A2W(szBuf),type); -#else - return AddString(nRow,nCol,szBuf,type); -#endif -} - -BOOL CUIODListCtrl::AddString(int nRow,int nCol,COleDateTime &dtValue,CUIODListCtrl::eColTypes type) -{ - return AddString(nRow,nCol,dtValue.Format(),type); -} - -BOOL CUIODListCtrl::AddString(int nRow,int nCol,LPCTSTR szItem,CUIODListCtrl::eColTypes type) -{ - if (m_nItems == 0) - { - TRACE(_T("No rows defined in ODListCtrl\n")); - return FALSE; - } - if (nCol >= m_nSubItems) - { - TRACE(_T("Tried to add invalid column number(%d) in ODListCtrl\n"),nCol); - return FALSE; - } - SetColType(nCol,type); -// return SetItemText(nRow,nCol/*+m_nImage*/,szItem); - CUIStrListCtrlData *pData = (CUIStrListCtrlData *)GetListCtrlData(nRow); - ASSERT_KINDOF(CUIStrListCtrlData,pData); - BOOL ret=FALSE; - if (type == e_NumericFormatComma || type == e_DoubleFormatComma) - { - CString sBuf(szItem); - AddThousandSeps(sBuf); - ret = pData->AddString(nCol,sBuf); - } - else if (type == e_NumericFormatTime || type == e_DoubleFormatTime) - { - CString sBuf(szItem); - ConvertToTime(sBuf); - ret = pData->AddString(nCol,sBuf); - } - else - ret = pData->AddString(nCol,szItem); - return ret; -} - -void CUIODListCtrl::UpdateString(int nRow) -{ - CRect rect; - if (GetItemRect(nRow,&rect,LVIR_BOUNDS)) - { - RedrawItems(nRow,nRow); - UpdateWindow(); - } -} - -int CUIODListCtrl::AddCallBackItem(DWORD dwData,int nImage) -{ - if (m_nSubItems == 0) - { - TRACE(_T("No columns defined in ODListCtrl\n")); - return FALSE; - } - CUIListCtrlData *pListCtrlData = GetNewListCtrlData(dwData,m_nItems); - BOOL ret = InsertItem(LPSTR_TEXTCALLBACK,(LPARAM)pListCtrlData,nImage); - if (ret) - m_objList.Append(pListCtrlData); - else - delete pListCtrlData; - return ret ? m_nItems-1 : -1; -} - -int CUIODListCtrl::AddTextItem(int nImage) -{ - CUIStrListCtrlData *pListCtrlData = new CUIStrListCtrlData(m_nSubItems); - if (InsertItem(LPSTR_TEXTCALLBACK,(LPARAM)pListCtrlData,nImage)) - { - m_objList.Append(pListCtrlData); - return m_nItems-1; - } - delete pListCtrlData; - return -1; -} - -int CUIODListCtrl::GetImageIndex(UINT nIconID) -{ - int nImage = 0; - if (nIconID) - { - if (!m_mapImageIndex.Lookup(nIconID,nImage)) - { - nImage = AddIcon(nIconID); - } - } - return nImage; -} - -// from handle -int CUIODListCtrl::AddIcon(HICON hIcon,UINT nIconID) -{ - CImageList *pILSmall = NULL; - CImageList *pILLarge = NULL; - GetImageLists(&pILSmall,&pILLarge); - int nSmallIndex = pILSmall->Add(hIcon); - // save the image ID - if (nIconID) - m_mapImageIndex[nIconID] = nSmallIndex; - int nLargeIndex = pILLarge->Add(hIcon); - if (nSmallIndex == -1 || nLargeIndex == -1) - { - TRACE(_T("Failed to add icon to image list in CUIODListCtrl\n")); - return -1; - } - return nSmallIndex; -} - -// from resource id -int CUIODListCtrl::AddIcon(UINT nIconID) -{ - HICON hIcon = AfxGetApp()->LoadIcon(nIconID); - if (hIcon == NULL) - { - TRACE(_T("LoadIcon failed in CUIODListCtrl\n")); - return -1; - } - return AddIcon(hIcon,nIconID); -} - -// from file -int CUIODListCtrl::AddIcon(LPCTSTR pszIcon) -{ - CString sImageFile; - int nIndex; - if (m_mapImageFile.Lookup(sImageFile,nIndex)) - { - return nIndex; - } - HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), - pszIcon, - IMAGE_ICON, - ::GetSystemMetrics(SM_CXICON), - ::GetSystemMetrics(SM_CYICON), - LR_LOADFROMFILE); - if (hIcon == NULL) - { - TRACE(_T("LoadImage(Large) failed in CUIODListCtrl\n")); - } - HICON hIconSm = (HICON)LoadImage(AfxGetInstanceHandle(), - pszIcon, - IMAGE_ICON, - ::GetSystemMetrics(SM_CXSMICON), - ::GetSystemMetrics(SM_CYSMICON), - LR_LOADFROMFILE); - if (hIconSm == NULL) - { - TRACE(_T("LoadImage(Small) failed in CUIODListCtrl\n")); - } - if (hIcon == NULL && hIconSm == NULL) - return -1; - CImageList *pILSmall = NULL; - CImageList *pILLarge = NULL; - GetImageLists(&pILSmall,&pILLarge); - int nSmallIndex = pILSmall->Add(hIconSm); - int nLargeIndex = pILLarge->Add(hIcon); - if (nSmallIndex == -1 || nLargeIndex == -1) - { - TRACE(_T("Failed to add icon to image list in CUIODListCtrl\n")); - return -1; - } - sImageFile = pszIcon; - m_mapImageFile[sImageFile] = nSmallIndex; - return nSmallIndex; -} - -BOOL CUIODListCtrl::InsertItem(LPTSTR szItem,LPARAM lParam,int nImage) -{ - LV_ITEM lvi; - lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE; - lvi.state = 0; - lvi.stateMask = 0; - - lvi.iItem = m_nItems; - lvi.iSubItem = 0; - lvi.pszText = szItem; - lvi.cchTextMax = MAX_TEXT; - lvi.iImage = nImage; - lvi.lParam = lParam; - if (CListCtrl::InsertItem(&lvi) == -1) - { - TRACE1("Unable to insert item %u into list control\n",m_nItems); - return FALSE; - } - if (nImage) - m_nImage = 1; - m_nItems++; - return TRUE; -} - -int CUIODListCtrl::SetCurSel(int nSelect) -{ - if (GetItemCount() && SetItemState(nSelect,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED)) - return TRUE; - return -1; -} - -// messages -LRESULT CUIODListCtrl::OnSetColumnWidth(WPARAM wParam,LPARAM lParam) -{ - Default(); - return TRUE; -} - -LRESULT CUIODListCtrl::OnDeleteAllItems(WPARAM wParam,LPARAM lParam) -{ - m_nItems=0; - m_nImage=0; - m_hOrigFont=NULL; - AllItemsDeleted(); - m_objList.DeleteAll(); - TRACE0("All items deleted in CUIODListCtrl\n"); - Default(); - return TRUE; -} - -CUIListCtrlData *CUIODListCtrl::GetNewListCtrlData(DWORD dwData,int nItem) -{ - CUIListCtrlData *pListCtrlData = new CUIListCtrlData(m_nSubItems); - pListCtrlData->SetExtData(dwData); - return pListCtrlData; -} - -int CUIODListCtrl::FindItem(DWORD dwExtData) -{ - int count = GetItemCount(); - CUIListCtrlData *pData; - for(int i=0;i < count;i++) - { - pData = GetListCtrlData(i); - if (pData->GetExtData() == dwExtData) - break; - } - return i == count ? -1 : i; -} - -BOOL CUIODListCtrl::GetFullRowSel() const -{ - return(m_bFullRowSel); -} - -DWORD CUIODListCtrl::GetExStyle() -{ - return SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE); -} - -BOOL CUIODListCtrl::SetExStyle(UINT nStyle,BOOL bModify) -{ - DWORD dwStyle = GetExStyle(); - if (bModify) - dwStyle |= nStyle; - else - dwStyle &= ~nStyle; - BOOL bRet = SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle); - if (bRet) - SaveProfile(); - return bRet; -} - -void CUIODListCtrl::SetFullRowSel(bool bSet) -{ - // no painting during change - if ((bSet && m_bFullRowSel==TRUE) || (!bSet && m_bFullRowSel==FALSE)) - return; - m_bFullRowSel=bSet; - if(!(GetStyle() & LVS_OWNERDRAWFIXED)) - { - SetExStyle(LVS_EX_FULLROWSELECT,m_bFullRowSel); - } - RedrawItems(GetCurSel(),GetCurSel()); - SaveProfile(); -} - -void CUIODListCtrl::SetIconSize(int nImageList) -{ - m_nImageList = nImageList; - - CRect rc; - GetWindowRect(rc); - GetParent()->ScreenToClient(rc); - rc.bottom++; // Force a WM_MEASUREITEM message - MoveWindow(rc,FALSE); - rc.bottom--; // We really don't want to resize it - MoveWindow(rc,TRUE); -} - -void CUIODListCtrl::ChangeIconSize() -{ - SetCurSel(0); - EnsureVisible(0,0); - if (m_nImageList == LVSIL_NORMAL) - SetIconSize(LVSIL_SMALL); - else - SetIconSize(LVSIL_NORMAL); -} - -BOOL CUIODListCtrl::GetDispInfo(LV_DISPINFO *pDispInfo) -{ - CUIStrListCtrlData *pData = (CUIStrListCtrlData*)pDispInfo->item.lParam; - ASSERT_KINDOF(CUIStrListCtrlData,pData); - if (!pData->IsKindOf(RUNTIME_CLASS(CUIStrListCtrlData))) - return FALSE; - pDispInfo->item.pszText = pData->GetString(pDispInfo->item.iSubItem); - return TRUE; -} - -BOOL CUIODListCtrl::PopupMenuItem(int nItem,int nCol,CMenu *pPopup,CPoint point) -{ - int nCurSel = GetCurSel(); - int nSel = GetNextSel(nCurSel); - UINT nPopupID = (nSel == -1 ? m_PopupID : m_MultiPopupID); - if (nPopupID && (nCol == 0 && nItem != -1)) - { - CMenu menu; - VERIFY(menu.LoadMenu(nPopupID)); - CMenu* pMyPopup = menu.GetSubMenu(0); - ASSERT(pMyPopup != NULL); - if (m_pPopupWnd == NULL) - m_pPopupWnd = this; - pMyPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, m_pPopupWnd); - return TRUE; - } - return nSel == -1 ? FALSE : TRUE; -} - -int CUIODListCtrl::HitTestEx(CPoint &point, int *col) const -{ - int colnum = 0; - int row = HitTest( point, NULL ); - - if( col ) *col = 0; - - // Make sure that the ListView is in LVS_REPORT - if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT) - return row; - - // Get the top and bottom row visible - row = GetTopIndex(); - int bottom = row + GetCountPerPage(); - if( bottom > GetItemCount() ) - bottom = GetItemCount(); - - // Get the number of columns - CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0); - int nColumnCount = pHeader->GetItemCount(); - CRect rcHeader; - pHeader->GetClientRect(&rcHeader); - if (point.y >= 0 && point.y <= rcHeader.Height()) - return -2; - - // Loop through the visible rows - for( ;row <=bottom;row++) - { - // Get bounding rect of item and check whether point falls in it. - CRect rect; - GetItemRect( row, &rect, LVIR_BOUNDS ); - if( rect.PtInRect(point) ) - { - // Now find the column - for( colnum = 0; colnum < nColumnCount; colnum++ ) - { - int colwidth = GetColumnWidth(colnum); - if( point.x >= rect.left - && point.x <= (rect.left + colwidth ) ) - { - if( col ) *col = colnum; - return row; - } - rect.left += colwidth; - } - } - } - return -1; -} - -CEdit* CUIODListCtrl::EditSubLabel( int nItem, int nCol ) -{ - // The returned pointer should not be saved - if (m_bEditSubItems == false || (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_EDITLABELS) != LVS_EDITLABELS) - { - return NULL; - } - - // Make sure that the item is visible - if( !EnsureVisible( nItem, TRUE ) ) - return NULL; - - // Make sure that nCol is valid - CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0); - if (pHeader == NULL) - return NULL; - int nColumnCount = pHeader->GetItemCount(); - if( nCol >= nColumnCount || GetColumnWidth(nCol) < 5 ) - return NULL; - - // Get the column offset - int offset = 0; - for( int i = 0; i < nCol; i++ ) - offset += GetColumnWidth( i ); - - CRect rect; - GetItemRect( nItem, &rect, LVIR_BOUNDS ); - - // Now scroll if we need to expose the column - CRect rcClient; - GetClientRect( &rcClient ); - if( offset + rect.left < 0 || offset + rect.left > rcClient.right ) - { - CSize size; - size.cx = offset + rect.left; - size.cy = 0; - Scroll( size ); - rect.left -= size.cx; - } - - // Get Column alignment - LV_COLUMN lvcol; - lvcol.mask = LVCF_FMT; - GetColumn( nCol, &lvcol ); - DWORD dwStyle ; - if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT) - dwStyle = ES_LEFT; - else if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT) - dwStyle = ES_RIGHT; - else dwStyle = ES_CENTER; - - rect.left += offset+4; - rect.right = rect.left + GetColumnWidth( nCol ) - 3 ; - if( rect.right > rcClient.right) rect.right = rcClient.right; - - dwStyle |= WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL; - CEdit *pEdit = new CInPlaceEdit(nItem, nCol, GetItemText( nItem, nCol )); - pEdit->Create( dwStyle, rect, this, -1/*IDC_IPEDIT*/ ); - - return pEdit; -} - -void CUIODListCtrl::DeleteProgressBar(int nRow,int nCol) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - if (pData) - { - pData->DestroyCtrl(nCol); - RedrawItems(nRow,nRow); - } -} - -void CUIODListCtrl::UpdateProgressBar(int nRow,int nCol,int nPos) -{ - CUIListCtrlData *pData = GetListCtrlData(nRow); - ASSERT(pData); - if (pData == NULL) - return; - CTextProgressCtrl *pCtrl = (CTextProgressCtrl*)pData->GetCtrl(nCol); - if (pCtrl) - { - pCtrl->SetPos(nPos); - RedrawItems(nRow,nRow); - } -} - -CTextProgressCtrl *CUIODListCtrl::AddProgressBar(int nItem,int nCol,int nMin,int nMax) -{ - // The returned pointer should not be saved - if (GetViewType() != LVS_REPORT) - return NULL; - CUIListCtrlData *pData = GetListCtrlData(nItem); - if (pData == NULL) - return NULL; - CTextProgressCtrl *pCtrl = new CTextProgressCtrl; - pData->SetCtrl(pCtrl,nCol); - pCtrl->SetRange(nMin,nMax); - return pCtrl; -} - -// -// Message handlers -// -void CUIODListCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - if (GetFocus() != this) - SetFocus(); - CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar); -} - -void CUIODListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - if (GetFocus() != this) - SetFocus(); - CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar); -} - -void CUIODListCtrl::OnLButtonDown(UINT nFlags, CPoint point) -{ - CListCtrl::OnLButtonDown(nFlags, point); -} - -BOOL CUIODListCtrl::OnSelChanged(int nItem, LRESULT* pResult) -{ - *pResult = 0; - return FALSE; -} - -BOOL CUIODListCtrl::OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult) -{ - LV_DISPINFO *plvDispInfo = (LV_DISPINFO *)pNMHDR; - LV_ITEM *plvItem = &plvDispInfo->item; - - if (plvItem->pszText != NULL) - { - if (plvItem->iItem == -1) - { - CHeaderCtrl *pHeader = (CHeaderCtrl*)GetDlgItem(0); - if (pHeader) - { - CString strText; - GetHeaderText(pHeader,plvItem->iSubItem,strText); - HD_ITEM hdItem; - ZeroMemory(&hdItem,sizeof(hdItem)); - hdItem.mask = HDI_TEXT; - hdItem.pszText = plvItem->pszText; - hdItem.cchTextMax = lstrlen(plvItem->pszText); - ReplaceString(m_strHeadings,strText,plvItem->pszText); - if (EndLabelEdit(plvItem->iItem,plvItem->iSubItem,plvItem->pszText)) - pHeader->SetItem(plvItem->iSubItem,&hdItem); - } - } - else - { - if (EndLabelEdit(plvItem->iItem,plvItem->iSubItem,plvItem->pszText)) - AddString(plvItem->iItem, plvItem->iSubItem, plvItem->pszText); - } - } - *pResult = FALSE; - return TRUE; -} - -LRESULT CUIODListCtrl::OnDeleteItem(WPARAM wParam,LPARAM lParam) -{ - if (m_nItems) - m_nItems--; - TRACE(_T("Item deleted %d\n"),wParam); - return Default(); -} - -LRESULT CUIODListCtrl::OnDeleteColumn(WPARAM wParam,LPARAM lParam) -{ - if (m_nSubItems) - m_nSubItems--; - TRACE(_T("Column deleted %d\n"),wParam); - return Default(); -} - -LRESULT CUIODListCtrl::OnSetImageList(WPARAM wParam, LPARAM lParam) -{ - if((int)wParam==LVSIL_STATE) - { - int cx, cy; - - if(::ImageList_GetIconSize((HIMAGELIST)lParam,&cx,&cy)) - m_cxStateImageOffset=cx; - else - m_cxStateImageOffset=0; - } - - return Default(); -} - -LRESULT CUIODListCtrl::OnSetTextColor(WPARAM wParam, LPARAM lParam) -{ - m_clrText=(COLORREF)lParam; - return(Default()); -} - -LRESULT CUIODListCtrl::OnSetTextBkColor(WPARAM wParam, LPARAM lParam) -{ - m_clrTextBk=(COLORREF)lParam; - return(Default()); -} - -LRESULT CUIODListCtrl::OnSetBkColor(WPARAM wParam, LPARAM lParam) -{ - m_clrBkgnd=(COLORREF)lParam; - return(Default()); -} - -void CUIODListCtrl::OnSize(UINT nType, int cx, int cy) -{ - m_cxClient=cx; - CListCtrl::OnSize(nType, cx, cy); -} - -void CUIODListCtrl::OnPaint() -{ - if (m_bDelayPaint) - return; - Default(); - if (GetItemCount() <= 0) - { - COLORREF clrText = ::GetSysColor(COLOR_WINDOWTEXT); - COLORREF clrTextBk = ::GetSysColor(COLOR_WINDOW); - - CDC* pDC = GetDC(); - // Save dc state - int nSavedDC = pDC->SaveDC(); - - CRect rc; - GetWindowRect(&rc); - ScreenToClient(&rc); - - CHeaderCtrl* pHC; - pHC = GetHeaderCtrl(); - if (pHC != NULL) - { - CRect rcH; - pHC->GetItemRect(0, &rcH); - rc.top += rcH.bottom; - } - rc.top += 10; - - pDC->SetTextColor(clrText); - pDC->SetBkColor(clrTextBk); - pDC->FillRect(rc, &CBrush(clrTextBk)); - pDC->SelectStockObject(ANSI_VAR_FONT); - pDC->DrawText(m_strNoItemsMess, -1, rc, - DT_CENTER | DT_WORDBREAK | DT_NOPREFIX | DT_NOCLIP); - - // Restore dc - pDC->RestoreDC(nSavedDC); - ReleaseDC(pDC); - } - // Do not call CListCtrl::OnPaint() for painting messages - // in full row select mode, we need to extend the clipping region - // so we can paint a selection all the way to the right - if(m_bClientWidthSel && (GetStyle() & LVS_TYPEMASK)==LVS_REPORT && GetFullRowSel() && (GetStyle() & LVS_OWNERDRAWFIXED)) - { - CRect rcAllLabels; - GetItemRect(0,rcAllLabels,LVIR_BOUNDS); - - if(rcAllLabels.rightm_hWnd)) - { - // check if we are getting focus from label edit box - if(pOldWnd!=NULL && pOldWnd->GetParent()==this) - return; - } -} - -void CUIODListCtrl::OnKillFocus(CWnd* pNewWnd) -{ - CListCtrl::OnKillFocus(pNewWnd); - - // check if we are losing focus to label edit box - if (pNewWnd!=NULL && pNewWnd->GetParent()==this) - return; -} - -void CUIODListCtrl::OnRClickHeader(CPoint point,int nColIndex) -{ - m_nColClicked = nColIndex; - CMenu menu; - VERIFY(menu.LoadMenu(IDR_POPUPMENU_HEADERCTRL)); - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup != NULL); - pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,this); -} - -void CUIODListCtrl::OnHeaderRemoveColumn() -{ - if (m_nColClicked != -1) - { - int nWidth = GetColumnWidth(m_nColClicked); - if (nWidth) - { - m_pColWidths[m_nColClicked] = nWidth; - SetColumnWidth(m_nColClicked,0); - } - m_nColClicked = -1; - } -} - -void CUIODListCtrl::OnHeaderEditText() -{ - CHeaderCtrl *pHeader = (CHeaderCtrl*)GetDlgItem(0); - if (pHeader == NULL) - return; - - CString strText; - int cxy = GetHeaderText(pHeader,m_nColClicked,strText); - int xPos = 0; - for(int i=0;i < m_nSubItems;i++) - { - if (i == m_nColClicked) - break; - xPos += m_pColWidths[i]; - } - CRect rect; - rect.left = xPos; - rect.right = rect.left+cxy; - rect.top = 0; - rect.bottom = GetSystemMetrics(SM_CXHSCROLL); - TRACE2("Creating header edit control at left=%d,right=%d\n",rect.left,rect.right); - DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL; - CEdit *pEdit = new CInPlaceEdit(-1, m_nColClicked, strText); - pEdit->Create( dwStyle, rect, this, -1/*IDC_IPEDIT*/ ); - m_nColClicked = -1; -} - -int CUIODListCtrl::GetHeaderText(CHeaderCtrl *pHeader,int nPos,CString &strText) -{ - HD_ITEM hdItem; - ZeroMemory(&hdItem,sizeof(hdItem)); - int nLen = 128; - int nRes; - do - { - nLen *= 2; - hdItem.mask = HDI_TEXT | HDI_WIDTH; - hdItem.cchTextMax = nLen; - hdItem.pszText = strText.GetBufferSetLength(nLen); - pHeader->GetItem(nPos,&hdItem); - nRes = lstrlen(hdItem.pszText); - } while (nRes == nLen-1); - strText.ReleaseBuffer(-1); - return hdItem.cxy; -} - -void CUIODListCtrl::OnHeaderReset() -{ - for(int i=0;i < m_nSubItems;i++) - { - SetColumnWidth(i,m_pColWidths[i]); - } - m_nColClicked = -1; -} - -void CUIODListCtrl::OnContextMenu(CWnd *pWnd,CPoint point) -{ - CPoint ptClient(point); - ScreenToClient(&ptClient); - int nCol; - int nRow = HitTestEx(ptClient,&nCol); - if (nRow == -2) - return; - ShowPopupMenu(nRow,nCol,point); -} - -void CUIODListCtrl::ShowPopupMenu(int nRow,int nCol,CPoint point) -{ - CMenu menu; - VERIFY(menu.LoadMenu(IDR_POPUPMENU_LISTCTRL)); - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup != NULL); - m_PopupPoint.x = 0; - m_PopupPoint.y = 0; - if (PopupMenuItem(nRow,nCol,pPopup,point)) - return; - m_PopupPoint = point; - pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,this); -} - -void CUIODListCtrl::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) -{ - // is it for us? - if (m_PopupPoint.x == 0 && m_PopupPoint.y == 0) - return; - if (pPopupMenu->GetMenuItemID(0) == ID_HEADER_REMOVE_COL) - { - if (m_nColClicked == -1) - { - pPopupMenu->EnableMenuItem(ID_HEADER_EDIT_TEXT,MF_BYCOMMAND | MF_GRAYED); - pPopupMenu->EnableMenuItem(ID_HEADER_RESET,MF_BYCOMMAND | MF_GRAYED); - } - return; - } - // These commands are only available in report mode(detail mode) - UINT nEnabled = (GetViewType() == LVS_REPORT) ? MF_ENABLED : MF_GRAYED; - pPopupMenu->EnableMenuItem(ID_UI_VIEW_FULL_ROW_SELECTION,MF_BYCOMMAND | nEnabled); - pPopupMenu->EnableMenuItem(ID_UI_VIEW_GRIDLINES,MF_BYCOMMAND | nEnabled); - pPopupMenu->EnableMenuItem(ID_UI_VIEW_COLUMN_SIZING,MF_BYCOMMAND | nEnabled); - pPopupMenu->EnableMenuItem(ID_UI_VIEW_COLUMN_ORDERING,MF_BYCOMMAND | nEnabled); - if (nEnabled == MF_ENABLED) - pPopupMenu->EnableMenuItem(ID_UI_VIEW_EDIT_COLUMN,MF_BYCOMMAND | (m_bEditSubItems && (GetStyle() & LVS_EDITLABELS)) ? MF_ENABLED : MF_GRAYED); - else - pPopupMenu->EnableMenuItem(ID_UI_VIEW_EDIT_COLUMN,MF_BYCOMMAND | MF_GRAYED); - // won't work with owner draw list control - if (GetStyle() & LVS_OWNERDRAWFIXED) - { - pPopupMenu->EnableMenuItem(ID_UI_VIEW_CHECKBOXES,MF_BYCOMMAND | MF_GRAYED); - } - UINT nIDItem=ID_VIEW_DETAILS; - switch(GetViewType()) - { - case LVS_ICON: - nIDItem = ID_UI_VIEW_LARGE_ICONS; - break; - case LVS_SMALLICON: - nIDItem = ID_UI_VIEW_SMALL_ICONS; - break; - case LVS_LIST: - nIDItem = ID_UI_VIEW_LIST; - break; - case LVS_REPORT: - nIDItem = ID_UI_VIEW_DETAILS; - break; - } - pPopupMenu->CheckMenuRadioItem(ID_UI_VIEW_LARGE_ICONS,ID_VIEW_LIST,nIDItem,MF_BYCOMMAND); - DWORD dwExStyle = GetExStyle(); - if (m_bFullRowSel) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_FULL_ROW_SELECTION,MF_BYCOMMAND | MF_CHECKED); - if (m_bColumnSizing) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_COLUMN_SIZING,MF_BYCOMMAND | MF_CHECKED); - if ((dwExStyle & LVS_EX_HEADERDRAGDROP)) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_COLUMN_ORDERING,MF_BYCOMMAND | MF_CHECKED); - if ((dwExStyle & LVS_EX_GRIDLINES)) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_GRIDLINES,MF_BYCOMMAND | MF_CHECKED); - if ((dwExStyle & LVS_EX_CHECKBOXES)) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_CHECKBOXES,MF_BYCOMMAND | MF_CHECKED); - if ((dwExStyle & LVS_EX_TRACKSELECT)) - pPopupMenu->CheckMenuItem(ID_UI_VIEW_TRACK_SELECT,MF_BYCOMMAND | MF_CHECKED); -} - -void CUIODListCtrl::OnViewLargeIcons() -{ - SetViewType(LVS_ICON); -} - -void CUIODListCtrl::OnViewSmallIcons() -{ - SetViewType(LVS_SMALLICON); -} - -void CUIODListCtrl::OnViewDetails() -{ - SetViewType(LVS_REPORT); -} - -void CUIODListCtrl::OnViewList() -{ - SetViewType(LVS_LIST); -} - -void CUIODListCtrl::OnViewFullRowSelection() -{ - ToggleFullRowSel(); -} - -void CUIODListCtrl::OnViewTrackSelect() -{ - ToggleTrackSelect(); -} - -void CUIODListCtrl::OnViewGridlines() -{ - ToggleGridLines(); -} - -void CUIODListCtrl::OnViewCheckboxes() -{ - ToggleCheckBoxes(); -} - -void CUIODListCtrl::OnViewColumnOrdering() -{ - ToggleHeaderDragDrop(); -} - -void CUIODListCtrl::OnViewColumnSizing() -{ - ToggleColumnSizing(); -} - -void CUIODListCtrl::OnViewEditColumn() -{ - int index; - int colnum; - CPoint point(m_PopupPoint); - ScreenToClient(&point); - if (( index = HitTestEx( point, &colnum )) != -1) - { - UINT flag = LVIS_FOCUSED; - if( (GetItemState( index, flag ) & flag) == flag && colnum > 0) - { - // Add check for LVS_EDITLABELS - EditSubLabel( index, colnum ); - } - } -} - -LRESULT CUIODListCtrl::OnGetItemText(WPARAM wParam, LPARAM lParam) -{ - int iItem = (int)wParam; - LV_ITEM *pitem = (LV_ITEM*)lParam; - int nSubItem = pitem->iSubItem; - int nLen = pitem->cchTextMax; - const CUIStrListCtrlData *pData = (CUIStrListCtrlData *)GetListCtrlData(iItem); -// ASSERT_KINDOF(CUIStrListCtrlData,pData); - if (!pData->IsKindOf(RUNTIME_CLASS(CUIStrListCtrlData))) - { - NMLVDISPINFO di; - di.hdr.hwndFrom = GetSafeHwnd(); - di.hdr.code = LVN_GETDISPINFO; - memcpy(&di.item,pitem,sizeof(LVITEM)); - di.item.mask = LVIF_TEXT; -#if 1 // bugfix by Rex Lee - di.item.iItem = iItem; -#endif - SendMessage(WM_NOTIFY,0,(LPARAM)&di); - _tcsncpy(pitem->pszText,di.item.pszText,nLen); - } - else - { - LPTSTR pStr = ((CUIStrListCtrlData *)pData)->GetString(nSubItem); - if (pStr) - { - _tcsncpy(pitem->pszText,pStr,nLen); - nLen = min(lstrlen(pStr)+1,nLen); - pitem->pszText[nLen-1] = '\0'; - return nLen; - } - } - return 0L; -} - -int CUIODListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CListCtrl::OnCreate(lpCreateStruct) == -1) - return -1; - - // TODO: Add your specialized creation code here - RegisterDropTarget(); - - return 0; -} - -int CALLBACK CompareFunc(LPARAM lParam1,LPARAM lParam2,LPARAM lParamSort); - -PFNLVCOMPARE CUIODListCtrl::GetCompareFunc() -{ - return CompareFunc; -} - -BOOL CUIODListCtrl::ColumnClick(NM_LISTVIEW* pNMListView) -{ - if (pNMListView->iSubItem != m_nSortColumn) - m_bSortAscending = TRUE; - else - m_bSortAscending = !m_bSortAscending; - m_nSortColumn = pNMListView->iSubItem; - - m_HeaderCtrl.SetSortImage(m_nSortColumn,m_bSortAscending); - ASSERT(m_pColTypes); - CUIODListCtrlSortInfo sortinfo(pNMListView->iSubItem,m_pColTypes[pNMListView->iSubItem],m_bSortAscending); - SortItems(GetCompareFunc(),(DWORD)&sortinfo); - int item = GetCurSel(); - EnsureVisible(item,0); - return TRUE; -} - -/////////////////////////////////////////////// -// static callback for sorting when the header is clicked in report mode -int CALLBACK CompareFunc(LPARAM lParam1,LPARAM lParam2,LPARAM lParamSort) -{ - CUIStrListCtrlData *pData1 = (CUIStrListCtrlData*)lParam1; - CUIStrListCtrlData *pData2 = (CUIStrListCtrlData*)lParam2; - ASSERT(pData1); - ASSERT(pData2); - ASSERT_KINDOF(CUIStrListCtrlData,pData1); - ASSERT_KINDOF(CUIStrListCtrlData,pData2); - CUIODListCtrlSortInfo *pSortInfo = (CUIODListCtrlSortInfo *)lParamSort; - int ret=0; - switch(pSortInfo->GetColType()) - { - case CUIODListCtrl::e_DateTime: - { - COleDateTime time1; - CString str1(pData1->GetString(pSortInfo->GetColumn())); - if (!str1.IsEmpty()) - time1.ParseDateTime(str1); - COleDateTime time2; - CString str2(pData2->GetString(pSortInfo->GetColumn())); - if (!str2.IsEmpty()) - time2.ParseDateTime(str2); - if (time1 > time2) - ret = 1; - else if (time1 < time2) - ret = -1; - break; - } - case CUIODListCtrl::e_NumericFormat: - { - int num1 = _ttoi(CUIODListCtrl::StripNonNumeric((LPCTSTR)pData1->GetString(pSortInfo->GetColumn()),CUIODListCtrl::e_Numeric)); - int num2 = _ttoi(CUIODListCtrl::StripNonNumeric((LPCTSTR)pData2->GetString(pSortInfo->GetColumn()),CUIODListCtrl::e_Numeric)); - ret = num1-num2; - break; - } - case CUIODListCtrl::e_Numeric: - { - int num1 = _ttoi((LPCTSTR)pData1->GetString(pSortInfo->GetColumn())); - int num2 = _ttoi((LPCTSTR)pData2->GetString(pSortInfo->GetColumn())); - ret = num1-num2; - break; - } - case CUIODListCtrl::e_DoubleFormat: - { - double num1 = _tcstod(CUIODListCtrl::StripNonNumeric((LPCTSTR)pData1->GetString(pSortInfo->GetColumn()),CUIODListCtrl::e_Double),NULL); - double num2 = _tcstod(CUIODListCtrl::StripNonNumeric((LPCTSTR)pData2->GetString(pSortInfo->GetColumn()),CUIODListCtrl::e_Double),NULL); - if (num1 > num2) - ret = 1; - else if (num1 < num2) - ret = -1; - break; - } - case CUIODListCtrl::e_Double: - { - double num1 = _tcstod((LPCTSTR)pData1->GetString(pSortInfo->GetColumn()),NULL); - double num2 = _tcstod((LPCTSTR)pData2->GetString(pSortInfo->GetColumn()),NULL); - if (num1 > num2) - ret = 1; - else if (num1 < num2) - ret = -1; - break; - } - case CUIODListCtrl::e_Text: - default: - ret = CompareString(LOCALE_USER_DEFAULT,NORM_IGNORECASE | NORM_IGNOREKANATYPE, - (LPCTSTR)pData1->GetString(pSortInfo->GetColumn()), - pData1->GetStringLen(pSortInfo->GetColumn()), - (LPCTSTR)pData2->GetString(pSortInfo->GetColumn()), - pData2->GetStringLen(pSortInfo->GetColumn())) - 2; - break; - } - if (!pSortInfo->Ascending()) - ret = -ret; - return ret; -} - -void CUIODListCtrl::ReplaceString(CString &rStr,LPCTSTR pszOldText,LPCTSTR pszNewText) -{ - int nPos = rStr.Find(pszOldText); - CString strLeft; - if (nPos != -1) - { - strLeft = rStr.Left(nPos); - CString strRight(rStr.Right(rStr.GetLength()-(nPos+lstrlen(pszOldText)))); - strLeft += pszNewText; - strLeft += strRight; - } - rStr = strLeft; -} - -void CUIODListCtrl::Sort() -{ - ASSERT(m_pColTypes); - CUIODListCtrlSortInfo sortinfo(m_nSortColumn,m_pColTypes[m_nSortColumn],m_bSortAscending); - SortItems(GetCompareFunc(),(DWORD)&sortinfo); - m_HeaderCtrl.SetSortImage(m_nSortColumn,m_bSortAscending); - TRACE1("Sorting column %d\n",m_nSortColumn); -} - -void CUIODListCtrl::SetColFont(int nRow,int nCol,CFont *pFont) -{ - CUIListCtrlData* pListObj = GetListCtrlData(nRow); - if (pListObj) - { - ASSERT(pFont); - if (pFont) - pListObj->SetFont(pFont,nCol); - } -} - -void CUIODListCtrl::SetRowFont(int nRow,CFont *pFont) -{ - CUIListCtrlData* pListObj = GetListCtrlData(nRow); - if (pListObj) - { - ASSERT(pFont); - if (pFont) - pListObj->SetFont(pFont); - } -} - -void CUIODListCtrl::SetColBold(int nRow,int nCol,BOOL bBold) -{ - CUIListCtrlData* pListObj = GetListCtrlData(nRow); - if (pListObj) - { - if (!pListObj->IsFontSet(nCol)) - { - pListObj->SetFont(GetFont(),nCol); - } - const CFont *pFont = pListObj->GetFont(nCol); - LOGFONT lf; - ((CFont*)pFont)->GetLogFont(&lf); - lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL; - CFont font; - font.CreateFontIndirect(&lf); - pListObj->SetFont(&font,nCol); - CRect rect; - RedrawItems(nRow,nRow); - UpdateWindow(); - } -} - -void CUIODListCtrl::SetRowBold(int nRow,BOOL bBold) -{ - CUIListCtrlData* pListObj = GetListCtrlData(nRow); - if (pListObj) - { - if (!pListObj->IsFontSet(-1)) - { - pListObj->SetFont(GetFont()); - } - const CFont *pFont = pListObj->GetFont(); - LOGFONT lf; - ((CFont*)pFont)->GetLogFont(&lf); - lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL; - CFont font; - font.CreateFontIndirect(&lf); - pListObj->SetFont(&font); - CRect rect; - RedrawItems(nRow,nRow); - UpdateWindow(); - } -} - -BOOL CUIODListCtrl::SubItemPostPaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult) -{ - if (m_hOrigFont) - { - CDC *pDC = CDC::FromHandle(lplvcd->nmcd.hdc); - pDC->SelectObject(CFont::FromHandle(m_hOrigFont)); - m_hOrigFont = NULL; - } - return TRUE; -} - -BOOL CUIODListCtrl::SubItemPrePaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult) -{ - *pResult = CDRF_DODEFAULT; - int nRow = lplvcd->nmcd.dwItemSpec; - int nCol = lplvcd->iSubItem; - CUIListCtrlData* pListObj = GetListCtrlData(nRow); - if (pListObj == NULL) - return FALSE; - *pResult = CDRF_NOTIFYPOSTPAINT; - lplvcd->clrText = pListObj->GetTextColor(nCol); - lplvcd->clrTextBk = pListObj->GetBkColor(nCol); - if (pListObj->IsFontSet(nCol)) - { - CDC *pDC = CDC::FromHandle(lplvcd->nmcd.hdc); - CFont *pOldFont = pDC->SelectObject((CFont*)pListObj->GetFont(nCol)); - m_hOrigFont = (HFONT)pOldFont; - *pResult |= CDRF_NEWFONT; - } - CTextProgressCtrl *pWnd = (CTextProgressCtrl*)pListObj->GetCtrl(nCol); - if (pWnd == NULL) - return TRUE; - CRect rcItem; - GetItemRect(nRow,rcItem,LVIR_LABEL); - rcItem.left = lplvcd->nmcd.rc.left; - rcItem.right = lplvcd->nmcd.rc.right; - CDC *pDC = CDC::FromHandle(lplvcd->nmcd.hdc); - pWnd->DoPaint(pDC,rcItem,GetItemState(nRow,LVIS_SELECTED) == LVIS_SELECTED); - *pResult = CDRF_SKIPDEFAULT; - return TRUE; -} - -BOOL CUIODListCtrl::ItemPrePaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult) -{ - *pResult = CDRF_NOTIFYSUBITEMDRAW; - return TRUE; -} - -BOOL CUIODListCtrl::ItemPostPaint(LPNMLVCUSTOMDRAW lplvcd,LRESULT *pResult) -{ - *pResult = CDRF_DODEFAULT; - return TRUE; -} - -/////////////////////////////////////////////// -// Persistence -/////////////////////////////////////////////// -void CUIODListCtrl::SetSection(LPCTSTR pszSection) -{ - if (pszSection == NULL) - m_strSection.Empty(); - else - { - SaveProfile(); - m_strSection = _T("UIODListControl\\"); - m_strSection += pszSection; - } -} - -LPCTSTR CUIODListCtrl::GetSection() const -{ - return m_strSection; -} - -void CUIODListCtrl::LoadProfile() -{ - if (m_strSection.IsEmpty()) - return; - CWinApp *pApp = AfxGetApp(); - if (pApp == NULL) - return; - LPCTSTR pszSection = GetSection(); - - m_strHeadings = pApp->GetProfileString(pszSection,szEntryHeadings); - m_dwExStyle = pApp->GetProfileInt(pszSection,szEntryStyle,m_dwExStyle); - m_bFullRowSel = pApp->GetProfileInt(pszSection,szEntryRowSel,m_bFullRowSel); - m_dwViewType = pApp->GetProfileInt(pszSection,szEntryViewType,m_dwViewType); - m_bColumnSizing = pApp->GetProfileInt(pszSection,szEntryColumnSizing,m_bColumnSizing); - m_nSortColumn = pApp->GetProfileInt(pszSection,szEntrySortColumn,m_nSortColumn); - int nSubItems = pApp->GetProfileInt(pszSection,szEntrySubItems,0); - if (nSubItems) - { - delete []m_pColOrder; - delete []m_pColWidths; - m_pColOrder = new int[nSubItems]; - m_pColWidths = new int[nSubItems]; - CString strEntry; - for(int i=0;i < nSubItems;i++) - { - strEntry.Format(_T("%s%d"),szEntryColOrder,i+1); - m_pColOrder[i] = pApp->GetProfileInt(pszSection,strEntry,0); - strEntry.Format(_T("%s%d"),szEntryColWidths,i+1); - m_pColWidths[i] = pApp->GetProfileInt(pszSection,strEntry,0); - } - } -} - -void CUIODListCtrl::SaveProfile() -{ - if (m_strSection.IsEmpty()) - return; - CWinApp *pApp = AfxGetApp(); - if (pApp == NULL) - return; - LPCTSTR pszSection = GetSection(); - - pApp->WriteProfileString(pszSection,szEntryHeadings,m_strHeadings); - pApp->WriteProfileInt(pszSection,szEntryStyle,SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE)); - pApp->WriteProfileInt(pszSection,szEntryRowSel,m_bFullRowSel); - pApp->WriteProfileInt(pszSection,szEntryViewType,GetViewType()); - pApp->WriteProfileInt(pszSection,szEntryColumnSizing,m_bColumnSizing); - pApp->WriteProfileInt(pszSection,szEntrySubItems,m_nSubItems); - pApp->WriteProfileInt(pszSection,szEntrySortColumn,m_nSortColumn); - if (m_nSubItems) - { - delete []m_pColOrder; - m_pColOrder = new int[m_nSubItems],0; - SendMessage(LVM_GETCOLUMNORDERARRAY,(WPARAM)m_nSubItems,(LPARAM)m_pColOrder); - CString strEntry; - for(int i=0;i < m_nSubItems;i++) - { - strEntry.Format(_T("%s%d"),szEntryColOrder,i+1); - pApp->WriteProfileInt(pszSection,strEntry,m_pColOrder[i]); - if (m_pColWidths) - { - strEntry.Format(_T("%s%d"),szEntryColWidths,i+1); - pApp->WriteProfileInt(pszSection,strEntry,m_pColWidths[i]); - } - } - } -} - -void CUIODListCtrl::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - ar << m_strHeadings; - ar << m_nSubItems; - m_pColOrder = new int[m_nSubItems]; - SendMessage(LVM_GETCOLUMNORDERARRAY,(WPARAM)m_nSubItems,(LPARAM)m_pColOrder); - for(int i=0;i < m_nSubItems;i++) - { - ar << (int)m_pColOrder[i]; - ar << (int)GetColumnWidth(i); - } - delete []m_pColOrder; - m_pColOrder = NULL; - ar << SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE); - ar << m_dwViewType; - ar << m_bFullRowSel; - ar << m_bColumnSizing; - } - else - { - ar >> m_strHeadings; - ar >> m_nSubItems; - delete []m_pColOrder; - delete []m_pColWidths; - m_pColOrder = new int[m_nSubItems]; - m_pColWidths = new int[m_nSubItems]; - for(int i=0;i < m_nSubItems;i++) - { - ar >> (int)m_pColOrder[i]; - ar >> (int)m_pColWidths[i]; - } - ar >> m_dwExStyle; - ar >> m_bFullRowSel; - ar >> m_dwViewType; - ar >> m_bColumnSizing; - } -} -///////////////////////////////////////////////////////////////// -// OLE drag and drop -///////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// - -// CUIODListCtrl message handlers -#include "UIDragImage.h" - -BOOL CUIODListCtrl::OnBeginRDrag(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; - // TODO: Add your control notification handler code here - *pResult = 0; - DoOleDrag(pNMListView,true); - return TRUE; -} - -BOOL CUIODListCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; - // TODO: Add your control notification handler code here - *pResult = 0; - DoOleDrag(pNMListView,false); - return TRUE; -} - -void CUIODListCtrl::DoOleDrag(NM_LISTVIEW* pNMListView,bool bRightMenu) -{ - int nSelected = GetSelectedCount(); - if (nSelected == 0 || pNMListView->iItem == -1) - return; - BOOL bRet=TRUE; - if (bRet == FALSE) - return; - // View type LVS_ICON etc - int nType = GetViewType(); - // 2 ints(nSelected,nType) + ImageData + CRect - HANDLE hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,sizeof(int)*2+sizeof(DD_ImageData)*nSelected+sizeof(CRect)); - int *pData = (int*)::GlobalLock(hData); - *pData++ = nType; - *pData++ = nSelected; - // add the selections - DD_ImageData *pImageData = (DD_ImageData*)pData; - CRect rcItem; - CRect rcIcon; - CRect rcTotalItem; - int iItem = pNMListView->iItem; - GetItemRect(iItem,rcItem,LVIR_LABEL); - GetItemRect(iItem,rcIcon,LVIR_ICON); - rcTotalItem.left = rcIcon.left; - rcTotalItem.top = rcIcon.top; - rcTotalItem.right = rcIcon.right+rcItem.right; - rcTotalItem.bottom = 0; - CPoint point(pNMListView->ptAction); - CPoint ptHitTest; - UINT flag=0; - iItem = GetNextSel(-1); - int *pRows = new int[nSelected+1]; - pRows[0] = iItem; - for(int i=1;iItem != -1;i++) - { - GetItemRect(iItem,rcItem,LVIR_LABEL); - GetItemRect(iItem,rcIcon,LVIR_ICON); - ptHitTest.x = rcItem.left; - ptHitTest.y = rcItem.top; - HitTest(ptHitTest,&flag); - if ((flag & LVHT_BELOW) != LVHT_BELOW && (flag & LVHT_ABOVE) != LVHT_ABOVE) - { - pImageData->m_rcItem = rcItem; - pImageData->m_rcIcon = rcIcon; - pImageData->m_ptDrag = point; - rcTotalItem.bottom += rcIcon.bottom; - pImageData++; - } - CCF_String ccfText(GetItemText(iItem,0)); - CWDClipboardData::Instance()->SetData(&m_OleDataSource,&ccfText,CWDClipboardData::e_cfString); - iItem = GetNextSel(iItem); - pRows[i] = iItem; - } - pData = (int*)pImageData; - *pData++ = rcTotalItem.left; - *pData++ = rcTotalItem.right; - *pData++ = rcTotalItem.top; - *pData = rcTotalItem.bottom; - ::GlobalUnlock (hData); - m_OleDataSource.CacheGlobalData(m_OleDropTarget.GetClipboardFormat(), hData); - CCF_RightMenu rm; - rm.SetRightDrag(bRightMenu); - CWDClipboardData::Instance()->SetData(&m_OleDataSource,&rm,CWDClipboardData::e_cfRightMenu); - DWORD dwDragEffect = SendMessage(WM_APP_OLE_DD_DODRAGDROP,(WPARAM)pRows,(LPARAM)&m_OleDataSource); - if (dwDragEffect == 0) - dwDragEffect = GetParent()->SendMessage(WM_APP_OLE_DD_DODRAGDROP,(WPARAM)pRows,(LPARAM)&m_OleDataSource); - if (dwDragEffect) - { - // Start the DragDrop - DROPEFFECT effect = m_OleDataSource.DoDragDrop(dwDragEffect,NULL); - // Clear the cache - m_OleDataSource.Empty(); - } - delete []pRows; -} - -void CUIODListCtrl::RegisterDropTarget() -{ - if (!IsDragDrop()) - return; - VERIFY(m_OleDropTarget.Register(this)); - if (IsDropFiles()) - DragAcceptFiles(); -} - -DROPEFFECT CUIODListCtrl::SelectCurrentTarget(CDD_OleDropTargetInfo *pInfo) -{ - // No method to select a list ctrl item during drag and drop - UINT flags; - int iItem = HitTest(pInfo->GetPoint(), &flags); - pInfo->SetItem(iItem); - // save it - m_iItemDrop = iItem; - LRESULT lResult = SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)pInfo); - if (lResult == 0) - { - lResult = GetParent()->SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)pInfo); - } - // returns 0 if allowed (so the default is allowed) - if (lResult) - { - // return what was ever set - return pInfo->GetDropEffect(); - } - return DROPEFFECT_NONE; -} - -/////////////////////////////////////////////// - -void CUIODListCtrl::PostNcDestroy() -{ - // TODO: Add your specialized code here and/or call the base class - - CListCtrl::PostNcDestroy(); -} - -void CUIODListCtrl::OnDestroy() -{ - SaveProfile(); - - CListCtrl::OnDestroy(); - - // TODO: Add your message handler code here -} - -void CUIODListCtrl::PreSubclassWindow() -{ - CListCtrl::PreSubclassWindow(); - - // Add initialization code - EnableToolTips(m_bToolTips); - SetSortHeader(); -} - -int CUIODListCtrl::OnToolHitTest(CPoint point, TOOLINFO * pTI) const -{ - int row, col; - CRect cellrect; - row = CellRectFromPoint(point, &cellrect, &col ); - - if ( row == -1 ) - return -1; - if (GetStringWidth(GetItemText(row,col))-10 < cellrect.Width()) - return -1; - - CToolTipCtrl* pToolTip = AfxGetThreadState()->m_pToolTip; - pToolTip->SendMessage(TTM_SETDELAYTIME,TTDT_AUTOPOP,10000); - pToolTip->SendMessage(TTM_SETMAXTIPWIDTH,0,30); - - pTI->hwnd = m_hWnd; - pTI->uId = (UINT)((row<<10)+(col&0x3ff)+1); - pTI->lpszText = LPSTR_TEXTCALLBACK; - - pTI->rect = cellrect; - return pTI->uId; -} - -// CellRectFromPoint - Determine the row, col and bounding rect of a cell -// Returns - row index on success, -1 otherwise// point - point to be tested. -// cellrect - to hold the bounding rect// col - to hold the column index -int CUIODListCtrl::CellRectFromPoint(CPoint & point, RECT * cellrect, int * col) const -{ - int colnum; - // Make sure that the ListView is in LVS_REPORT - if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT) - return -1; - // Get the top and bottom row visible - int row = GetTopIndex(); - int bottom = row + GetCountPerPage(); - if( bottom > GetItemCount() ) - bottom = GetItemCount(); - // Get the number of columns - CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0); - int nColumnCount = pHeader->GetItemCount(); - // Loop through the visible rows - for( ;row <=bottom;row++) - { - // Get bounding rect of item and check whether point falls in it. - CRect rect; - GetItemRect( row, &rect, LVIR_BOUNDS ); - if( rect.PtInRect(point) ) - { - // Now find the column - for( colnum = 0; colnum < nColumnCount; colnum++ ) - { - int colwidth = GetColumnWidth(colnum); - if( point.x >= rect.left && point.x <= (rect.left + colwidth ) ) - { - RECT rectClient; - GetClientRect( &rectClient ); - if( col ) - { - CUIODListCtrl *pThis = const_cast(this); - if (m_pColOrder && pThis->SendMessage(LVM_GETCOLUMNORDERARRAY,(WPARAM)m_nSubItems,(LPARAM)m_pColOrder)) - *col = m_pColOrder[colnum]; - else - *col = colnum; - } - rect.right = rect.left + colwidth; - // Make sure that the right extent does not exceed - // the client area - if( rect.right > rectClient.right ) - rect.right = rectClient.right; - *cellrect = rect; - return row; - } - rect.left += colwidth; - } - } - } - return -1; -} - -BOOL CUIODListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) -{ - // need to handle both ANSI and UNICODE versions of the message - static WCHAR szToolTipW[256]; - static char szToolTipA[256]; - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - UINT nID = pNMHDR->idFrom; - if( nID == 0 ) - { - // Notification in NT from automatically - return FALSE; - } - // created tooltip - int row = ((nID-1) >> 10) & 0x3fffff; - int col = (nID-1) & 0x3ff; - m_sToolTipText = GetItemText( row, col ); -#ifndef _UNICODE -// if (pNMHDR->code == TTN_NEEDTEXTA) -// lstrcpyn(pTTTA->szText, strTipText, 80); -// else -// _mbstowcsz(pTTTW->szText, strTipText, 80); - if (pNMHDR->code == TTN_NEEDTEXTA) - { - pTTTA->lpszText = (LPSTR)(LPCSTR)m_sToolTipText; - } - else - { - _mbstowcsz(szToolTipW, m_sToolTipText, sizeof(szToolTipW)-1); - pTTTW->lpszText = szToolTipW; - } -#else - if (pNMHDR->code == TTN_NEEDTEXTW) - { - pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_sToolTipText; - } - else - { - _wcstombsz(szToolTipA, m_sToolTipText, sizeof(szToolTipA)-1); - pTTTA->lpszText = szToolTipA; - } -// pTTTA->lpszText = (LPTSTR)(LPCTSTR)m_sToolTipText; -// if (pNMHDR->code == TTN_NEEDTEXTA) -// _wcstombsz(pTTTA->szText, strTipText, 80); -// else -// lstrcpyn(pTTTW->szText, strTipText, 80); -#endif - *pResult = 0; - return TRUE; - // message was handled -} - -CODHeaderCtrl::CODHeaderCtrl() -{ - m_nSortCol = -1; -} - -CODHeaderCtrl::~CODHeaderCtrl() -{ -} - -int CODHeaderCtrl::SetSortImage(int nCol, BOOL bAsc) -{ - if (m_hWnd == NULL) - return -1; - int nPrevCol = m_nSortCol; - - m_nSortCol = nCol; - m_bSortAsc = bAsc; - // Change the item to ownder drawn - HD_ITEM hditem; - hditem.mask = HDI_FORMAT; - GetItem( nCol, &hditem ); - hditem.fmt |= HDF_OWNERDRAW; - SetItem( nCol, &hditem ); // Invalidate header control so that it gets redrawn - Invalidate(); - return nPrevCol; -} - -void CODHeaderCtrl::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) -{ - CDC dc; - - dc.Attach( lpDrawItemStruct->hDC ); - - // Get the column rect - CRect rcLabel( lpDrawItemStruct->rcItem ); - - // Save DC - int nSavedDC = dc.SaveDC(); - - // Set clipping region to limit drawing within column - CRgn rgn; - rgn.CreateRectRgnIndirect( &rcLabel ); - dc.SelectObject( &rgn ); - rgn.DeleteObject(); - - // Draw the background - dc.FillRect(rcLabel, &CBrush(::GetSysColor(COLOR_3DFACE))); - - // Labels are offset by a certain amount - // This offset is related to the width of a space character - int offset = dc.GetTextExtent(_T(" "), 1 ).cx*2; - - - // Get the column text and format - TCHAR buf[256]; - HD_ITEM hditem; - - hditem.mask = HDI_TEXT | HDI_FORMAT; - hditem.pszText = buf; - hditem.cchTextMax = 255; - - GetItem( lpDrawItemStruct->itemID, &hditem ); - - // Determine format for drawing column label - UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP - | DT_VCENTER | DT_END_ELLIPSIS ; - - if( hditem.fmt & HDF_CENTER) - uFormat |= DT_CENTER; - else if( hditem.fmt & HDF_RIGHT) - uFormat |= DT_RIGHT; - else - uFormat |= DT_LEFT; - - // Adjust the rect if the mouse button is pressed on it - if( lpDrawItemStruct->itemState == ODS_SELECTED ) - { - rcLabel.left++; - rcLabel.top += 2; - rcLabel.right++; - } - - // Adjust the rect further if Sort arrow is to be displayed - if( lpDrawItemStruct->itemID == (UINT)m_nSortCol ) - { - rcLabel.right -= 3 * offset; - } - - rcLabel.left += offset; - rcLabel.right -= offset; - - // Draw column label - if( rcLabel.left < rcLabel.right ) - dc.DrawText(buf,-1,rcLabel, uFormat); - - // Draw the Sort arrow - if( lpDrawItemStruct->itemID == (UINT)m_nSortCol ) - { - CRect rcIcon( lpDrawItemStruct->rcItem ); - - // Set up pens to use for drawing the triangle - CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT)); - CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)); - CPen *pOldPen = dc.SelectObject( &penLight ); - - if( m_bSortAsc ) - { - // Draw triangle pointing upwards - dc.MoveTo( rcIcon.right - 2*offset, offset-1); - dc.LineTo( rcIcon.right - 3*offset/2, rcIcon.bottom - offset ); - dc.LineTo( rcIcon.right - 5*offset/2-2, rcIcon.bottom - offset ); - dc.MoveTo( rcIcon.right - 5*offset/2-1, rcIcon.bottom - offset-1 ); - - dc.SelectObject( &penShadow ); - dc.LineTo( rcIcon.right - 2*offset, offset-2); - } - else - { - // Draw triangle pointing downwords - dc.MoveTo( rcIcon.right - 3*offset/2, offset-1); - dc.LineTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset + 1 ); - dc.MoveTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset ); - - dc.SelectObject( &penShadow ); - dc.LineTo( rcIcon.right - 5*offset/2-1, offset -1 ); - dc.LineTo( rcIcon.right - 3*offset/2, offset -1); - } - - // Restore the pen - dc.SelectObject( pOldPen ); - } - - // Restore dc - dc.RestoreDC( nSavedDC ); - - // Detach the dc before returning - dc.Detach(); -} - -void CUIODListCtrl::SetSortColumn(int nCol,BOOL bAsc) -{ - m_nSortColumn = nCol; - m_bSortAscending = bAsc; - m_HeaderCtrl.SetSortImage(nCol,bAsc); -} - -void CUIODListCtrl::SetSortHeader() -{ - if (m_HeaderCtrl.GetSafeHwnd() == NULL && m_hWnd != NULL) - { - m_HeaderCtrl.SubclassWindow( ::GetDlgItem(m_hWnd,0) ); - } -} - -CString CUIODListCtrl::StripNonNumeric(LPCTSTR pszOldNum,CUIODListCtrl::eColTypes type) -{ - TCHAR szNewNum[255]; - LPTSTR pszNewNum = szNewNum; - while (*pszOldNum != '\0') - { - if ((type == CUIODListCtrl::e_Double && *pszOldNum == '.') || *pszOldNum == '-' || *pszOldNum == '+' || _istdigit(*pszOldNum)) - { - *pszNewNum = *pszOldNum; - pszNewNum = _tcsinc(pszNewNum); - } - pszOldNum = _tcsinc(pszOldNum); - } - *pszNewNum = '\0'; - return szNewNum; -} - -BOOL CUIODListCtrl::PreTranslateMessage(MSG* pMsg) -{ - if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) - { - if (pMsg->wParam == VK_F10 && (GetKeyState(VK_SHIFT) < 0)) - { - PostMessage(WM_APP_ON_CONTEXT_MENU_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_BACK) - { - PostMessage(WM_APP_ON_BACKSPACE_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_F2) - { - PostMessage(WM_APP_ON_EDIT_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_F5) - { - PostMessage(WM_APP_ON_REFRESH_KEY); - return TRUE; - } - else if (pMsg->wParam == VK_DELETE) - { - PostMessage(WM_APP_ON_DELETE_KEY); - return TRUE; - } - else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN) - { - PostMessage(WM_APP_ON_PROPERTIES_KEY); - return TRUE; - } - } - return CListCtrl::PreTranslateMessage(pMsg); -} - -// User has finished editing a column -bool CUIODListCtrl::EndLabelEdit(int nRow,int nCol,LPCTSTR pszText) -{ - return false; -} - -// Left mouse button double clicked -BOOL CUIODListCtrl::DoubleClick(NM_LISTVIEW* pNMListView) -{ - return FALSE; -} - -// Enter Pressed -BOOL CUIODListCtrl::OnEnter(NM_LISTVIEW* pNMListView) -{ - return FALSE; -} - -// Delete key pressed -bool CUIODListCtrl::DeleteKey(int nRow) -{ - return false; -} - -// ALt-Enter pressed -void CUIODListCtrl::ShowProperties(int nRow) -{ -} - -// F5 key pressed -void CUIODListCtrl::Refresh() -{ -} - -// Backspace key pressed -void CUIODListCtrl::GoBack(int nSelRow) -{ -} - -LRESULT CUIODListCtrl::OnDragDrop(WPARAM wParam,LPARAM lParam) -{ - if (IsDragDrop() == false) - return 1L; - // get the info we need - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - return DragDrop(pInfo) ? 1 : 0; -} - -// user is currently over the list view window -// return 1 if we are interested in the Clipboard format -LRESULT CUIODListCtrl::OnDragOver(WPARAM wParam,LPARAM lParam) -{ - if (IsDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - return DragOver(pInfo) ? 1 : 0; -} - -LRESULT CUIODListCtrl::OnDragEnter(WPARAM wParam,LPARAM lParam) -{ - if (IsDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - return DragEnter(pInfo) ? 1 : 0; -} - -LRESULT CUIODListCtrl::OnDragLeave(WPARAM wParam,LPARAM lParam) -{ - if (IsDragDrop() == false) - return 1L; - CDD_OleDropTargetInfo *pInfo = (CDD_OleDropTargetInfo*)wParam; - ASSERT(pInfo); - return DragLeave(pInfo) ? 1 : 0; -} - -// Drag and drop initiated -// Return 1 if processed -LRESULT CUIODListCtrl::OnDDDoDragDrop(WPARAM wParam,LPARAM lParam) -{ - if (IsDragDrop() == false) - return 1L; - COleDataSource *pOleDataSource = (COleDataSource*)lParam; - int *pRows = (int*)wParam; - ASSERT(pOleDataSource); - return DoDragDrop(pRows,pOleDataSource); -} - -bool CUIODListCtrl::DragDrop(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CUIODListCtrl::DragOver(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CUIODListCtrl::DragEnter(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -bool CUIODListCtrl::DragLeave(CDD_OleDropTargetInfo *pInfo) -{ - return false; -} - -DROPEFFECT CUIODListCtrl::DoDragDrop(int *pnRows,COleDataSource *pOleDataSource) -{ - return true; -} - -void CUIODListCtrl::OnDropFiles(HDROP hDropInfo) -{ - UINT wNumFilesDropped = DragQueryFile(hDropInfo, 0XFFFFFFFF, NULL, 0); - TCHAR szFile[MAX_PATH]; - UINT nLen; - UINT nFlags; - POINT pt; - ::DragQueryPoint(hDropInfo,&pt); - int nRow = HitTest(CPoint(pt), &nFlags); - for(UINT i=0; i < wNumFilesDropped;i++) - { - nLen = DragQueryFile(hDropInfo,i,szFile,sizeof(szFile)/sizeof(TCHAR)); - if (nLen) - OnDropFile(nRow,szFile,nFlags); - } -} - -void CUIODListCtrl::OnDropFile(int nRow,LPCTSTR pszFile,UINT nFlags) -{ -} - -LRESULT CUIODListCtrl::OnAppPropertiesKey(WPARAM wParam, LPARAM lParam) -{ - int item=-1; - while ((item = GetNextSel(item)) != -1) - { - ShowProperties(item); - } - return 1L; -} - -LRESULT CUIODListCtrl::OnAppDeleteKey(WPARAM wParam, LPARAM lParam) -{ - int nNewItem = -1; - int item=-1; - CUIListCtrlData *pData = NULL; - while ((item = GetNextSel(item)) != -1) - { - pData = GetListCtrlData(item); - if (DeleteKey(item)) - { - pData->SetDeleted(true); - } - nNewItem = item; - } - while ((item = GetCurSel()) != -1) - { - pData = GetListCtrlData(item); - if (pData->IsDeleted()) - { - if (!DeleteItem(item)) - SetItemState(item,0,LVIS_SELECTED); - } - else - { - SetItemState(item,0,LVIS_SELECTED); - } - if (GetItemCount() == 0) - break; - } - if (nNewItem != -1) - { - EnsureVisible(nNewItem,0); - SetCurSel(nNewItem); - } - return 1L; -} - -LRESULT CUIODListCtrl::OnAppRefreshKey(WPARAM wParam, LPARAM lParam) -{ - Refresh(); - return 1L; -} - -LRESULT CUIODListCtrl::OnAppEditKey(WPARAM wParam, LPARAM lParam) -{ - EditLabel(GetCurSel()); - return 1L; -} - -LRESULT CUIODListCtrl::OnAppContextMenuKey(WPARAM wParam, LPARAM lParam) -{ - CPoint pt; - if (GetCurSel() != -1) - GetItemPosition(GetCurSel(),&pt); - ClientToScreen(&pt); - ShowPopupMenu(GetCurSel(),0,pt); - return 1L; -} - -LRESULT CUIODListCtrl::OnAppBackspaceKey(WPARAM wParam, LPARAM lParam) -{ - GoBack(GetCurSel()); - return 1L; -} diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/WindowPlacement.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/WindowPlacement.cpp deleted file mode 100644 index 66a4cd56af3..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/WindowPlacement.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// MSJ -// It it works contact Paul DiLascia -// if not you're own your own - -#include "StdAfx.h" -#include "WindowPlacement.h" - -CWindowPlacement::CWindowPlacement() -{ - // Note: "length" is inherited from WINDOWPLACEMENT - length = sizeof(WINDOWPLACEMENT); - m_showCmd = -1; -} - -CWindowPlacement::~CWindowPlacement() -{ -} - -////////////////// -// Restore window placement from profile key -BOOL CWindowPlacement::Restore(LPCTSTR lpKeyName, CWnd* pWnd) -{ - if (!GetProfileWP(lpKeyName)) - return FALSE; - // Only restore if window intersets the screen. - // - CRect rcTemp; - CRect rcScreen(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)); - if (!::IntersectRect(&rcTemp, &rcNormalPosition, &rcScreen)) - return FALSE; - - pWnd->SetWindowPlacement(this); - return TRUE; -} - -////////////////// -// Get window placement from profile. -BOOL CWindowPlacement::GetProfileWP(LPCTSTR lpKeyName) -{ - CWinApp *pApp = AfxGetApp(); - ASSERT_VALID(pApp); - - m_showCmd = pApp->GetProfileInt(lpKeyName, _T("wp.showCmd"), -1); - if (m_showCmd == -1) - return FALSE; - showCmd = m_showCmd; - flags = pApp->GetProfileInt(lpKeyName, _T("wp.flags"), flags); - - ptMinPosition.x = pApp->GetProfileInt(lpKeyName, _T("wp.ptMinPosition.x"),ptMinPosition.x); - ptMinPosition.y = pApp->GetProfileInt(lpKeyName, _T("wp.ptMinPosition.y"),ptMinPosition.y); - ptMaxPosition.x = pApp->GetProfileInt(lpKeyName, _T("wp.ptMaxPosition.x"),ptMaxPosition.x); - ptMaxPosition.y = pApp->GetProfileInt(lpKeyName, _T("wp.ptMaxPosition.y"),ptMaxPosition.y); - - RECT& rc = rcNormalPosition; // because I hate typing - rc.left = pApp->GetProfileInt(lpKeyName, _T("wp.left"), rc.left); - rc.right = pApp->GetProfileInt(lpKeyName, _T("wp.right"), rc.right); - rc.top = pApp->GetProfileInt(lpKeyName, _T("wp.top"), rc.top); - rc.bottom= pApp->GetProfileInt(lpKeyName, _T("wp.bottom"), rc.bottom); - return TRUE; -} - -//////////////// -// Save window placement in app profile -void CWindowPlacement::Save(LPCTSTR lpKeyName, CWnd* pWnd) -{ - pWnd->GetWindowPlacement(this); - WriteProfileWP(lpKeyName); -} - -////////////////// -// Write window placement to app profile -void CWindowPlacement::WriteProfileWP(LPCTSTR lpKeyName) -{ - CWinApp *pApp = AfxGetApp(); - ASSERT_VALID(pApp); - pApp->WriteProfileInt(lpKeyName, _T("wp.showCmd"), showCmd); - pApp->WriteProfileInt(lpKeyName, _T("wp.flags"), flags); - pApp->WriteProfileInt(lpKeyName, _T("wp.ptMinPosition.x"), ptMinPosition.x); - pApp->WriteProfileInt(lpKeyName, _T("wp.ptMinPosition.y"), ptMinPosition.y); - pApp->WriteProfileInt(lpKeyName, _T("wp.ptMaxPosition.x"), ptMaxPosition.x); - pApp->WriteProfileInt(lpKeyName, _T("wp.ptMaxPosition.y"), ptMaxPosition.y); - pApp->WriteProfileInt(lpKeyName, _T("wp.left"), rcNormalPosition.left); - pApp->WriteProfileInt(lpKeyName, _T("wp.right"), rcNormalPosition.right); - pApp->WriteProfileInt(lpKeyName, _T("wp.top"), rcNormalPosition.top); - pApp->WriteProfileInt(lpKeyName, _T("wp.bottom"),rcNormalPosition.bottom); -} - -// The ugly casts are required to help the VC++ 3.0 compiler decide which -// operator<< or operator>> to use. If you're using VC++ 4.0 or later, you -// can delete this stuff. -// -#if (_MSC_VER < 1000) // 1000 = VC++ 4.0 -#define UINT_CAST (LONG) -#define UINT_CASTREF (LONG&) -#else -#define UINT_CAST -#define UINT_CASTREF -#endif - -////////////////// -// Write window placement to archive -// WARNING: archiving functions are untested. -CArchive& operator<<(CArchive& ar, const CWindowPlacement& wp) -{ - ar << UINT_CAST wp.length; - ar << UINT_CAST wp.flags; - ar << UINT_CAST wp.showCmd; - ar << wp.ptMinPosition; - ar << wp.ptMaxPosition; - ar << wp.rcNormalPosition; - return ar; -} - -////////////////// -// Read window placement from archive -// WARNING: archiving functions are untested. -CArchive& operator>>(CArchive& ar, CWindowPlacement& wp) -{ - ar >> UINT_CASTREF wp.length; - ar >> UINT_CASTREF wp.flags; - ar >> UINT_CASTREF wp.showCmd; - ar >> wp.ptMinPosition; - ar >> wp.ptMaxPosition; - ar >> wp.rcNormalPosition; - return ar; -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/cbformats.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/cbformats.cpp deleted file mode 100644 index 1e1a2e7d21c..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/cbformats.cpp +++ /dev/null @@ -1,667 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "cbformats.h" -#include "shlobj.h" -#include "ShellPidl.h" -#include - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -//static -CWDClipboardData *CWDClipboardData::Instance() -{ - static CWDClipboardData data; - return &data; -} - -CWDClipboardData::CWDClipboardData() -{ - m_aFormatIDs[e_cfString] = CF_TEXT; - m_aFormatIDs[e_cfHDROP] = CF_HDROP; - m_aFormatIDs[e_cfWebSiteURL] = ::RegisterClipboardFormat(CFSTR_SHELLURL); -#ifdef _UNICODE - m_aFormatIDs[e_cfFileGroupDesc] = ::RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW); -#else - m_aFormatIDs[e_cfFileGroupDesc] = ::RegisterClipboardFormat(CFSTR_FILEDESCRIPTORA); -#endif - m_aFormatIDs[e_cfHTMLFormat] = ::RegisterClipboardFormat(_T("HTML Format")); - m_aFormatIDs[e_cfWebSite] = ::RegisterClipboardFormat(_T("CF_WD_WEBSITE")); - m_aFormatIDs[e_cfRightMenu] = ::RegisterClipboardFormat(_T("CF_WD_RIGHTMENU")); - m_aFormatIDs[e_cfFolder] = ::RegisterClipboardFormat(_T("CF_WD_WEBSITE_CATEGORY")); - m_aFormatIDs[e_cfShellIDList] = ::RegisterClipboardFormat(CFSTR_SHELLIDLIST); -} - -CWDClipboardData::~CWDClipboardData() -{ -} - -bool CWDClipboardData::IsValidFormat(CLIPFORMAT cfFormat) -{ - for(int i=0;i < e_cfMax;i++) - { - if (m_aFormatIDs[i] == cfFormat) - break; - } - return(i != e_cfMax); -} - -bool CWDClipboardData::IsDataAvailable(COleDataObject *pDataObject) -{ - // Iterate through the clipboard formats - pDataObject->BeginEnumFormats(); - FORMATETC FormatEtc; - bool bFound=false; -#ifdef _DEBUG - TCHAR szBuf[128]; -#endif - while (pDataObject->GetNextFormat(&FormatEtc)) - { -#ifdef _DEBUG - szBuf[0] = 0; - if (FormatEtc.cfFormat > CF_MAX) - { - ::GetClipboardFormatName(FormatEtc.cfFormat,szBuf,sizeof(szBuf)-1); - } - else - { - lstrcpy(szBuf,_T("Predefined Format")); - } - TRACE(_T("Enum formats returned %u(%s) %d\n"),FormatEtc.cfFormat,szBuf,FormatEtc.tymed); -#endif - if (IsValidFormat(FormatEtc.cfFormat)) - { -#ifdef _DEBUG - TRACE(_T("Clipboard format found %u(%s) tymed(%d), Aspect(%d)\n"),FormatEtc.cfFormat,szBuf,FormatEtc.tymed,FormatEtc.dwAspect); -#endif - bFound=true; - } - } - return bFound; -} - -CLIPFORMAT CWDClipboardData::GetClipboardFormat(eCBFormats format) -{ - return m_aFormatIDs[format]; -} - -void CWDClipboardData::SetData(COleDataSource *pOleDataSource,CObject *pObj,eCBFormats format,LPFORMATETC lpFormatEtc) -{ - ASSERT(pOleDataSource); - ASSERT(pObj); - - // use serialization - CSharedFile file; - CArchive ar(&file,CArchive::store); - pObj->Serialize(ar); - ar.Close(); - - // cache into drag drop source - pOleDataSource->CacheGlobalData(CWDClipboardData::Instance()->GetClipboardFormat(format),file.Detach(),lpFormatEtc); -} - -bool CWDClipboardData::GetData(COleDataObject *pDataObject,CObject *pObj,eCBFormats format) -{ - ASSERT(pDataObject); - ASSERT(pObj); - if (pDataObject == NULL || pObj == NULL) - return false; - - if (m_aFormatIDs[format] == CF_HDROP) - { - FORMATETC fmte = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - STGMEDIUM medium; - if (pDataObject->GetData(CF_HDROP, &medium, &fmte)) - { - HDROP hDropInfo = (HDROP)medium.hGlobal; - UINT wNumFilesDropped = DragQueryFile(hDropInfo, 0XFFFFFFFF, NULL, 0); - TCHAR szFile[MAX_PATH]; - ASSERT_KINDOF(CCF_HDROP,pObj); - CCF_HDROP *pHDROP = (CCF_HDROP*)pObj; - UINT nLen; - for(UINT i=0; i < wNumFilesDropped;i++) - { - nLen = DragQueryFile(hDropInfo,i,szFile,sizeof(szFile)/sizeof(TCHAR)); - if (nLen) - { - pHDROP->AddFileName(szFile); - } - } - if (medium.pUnkForRelease) - medium.pUnkForRelease->Release(); - else - GlobalFree(medium.hGlobal); - } - } - else - { - CFile *pFile = pDataObject->GetFileData(CWDClipboardData::Instance()->GetClipboardFormat(format)); - if (pFile) - { - CArchive ar(pFile,CArchive::load); - pObj->Serialize(ar); - ar.Close(); - delete pFile; - } - } - return true; -} - -/////////////////////////////////////////// -// -// Clipboard objects -// -/////////////////////////////////////////// -IMPLEMENT_SERIAL(CCF_App, CObject, 0 ); -IMPLEMENT_SERIAL(CCF_WebSites,CObject,0); -IMPLEMENT_SERIAL(CCF_String, CObject, 0 ); -IMPLEMENT_SERIAL(CCF_WebSite, CObject, 0 ); -IMPLEMENT_SERIAL(CCF_FolderType, CObject, 0 ); -IMPLEMENT_SERIAL(CCF_DBFolderList,CObject,0); -IMPLEMENT_SERIAL(CCF_RightMenu, CObject, 0 ); -IMPLEMENT_SERIAL(CCF_FileGroupDescriptor,CObject,0); -IMPLEMENT_SERIAL(CCF_ShellIDList,CObject,0); -IMPLEMENT_SERIAL(CCF_HDROP,CObject,0); -/////////////////////////////////////////// -bool CCF_RightMenu::IsRightDrag() -{ - return m_bRightDrag; -} - -void CCF_RightMenu::SetRightDrag(bool bRightDrag) -{ - m_bRightDrag = bRightDrag; -} - -void CCF_RightMenu::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - int nRightDrag; - ar >> nRightDrag; - m_bRightDrag = nRightDrag == 1; - } - else - { - ar << m_bRightDrag; - } -} - -CCF_FileGroupDescriptor::CCF_FileGroupDescriptor() -{ - m_pFileDescrs = NULL; - m_nItems = 0; -} - -CCF_FileGroupDescriptor::~CCF_FileGroupDescriptor() -{ - delete []m_pFileDescrs; -} - -LPFILEDESCRIPTOR CCF_FileGroupDescriptor::GetFileDescriptor(UINT nItem) -{ - if (m_pFileDescrs == NULL) - return NULL; - if (nItem >= m_nItems) - { - ASSERT(FALSE); - return NULL; - } - return &m_pFileDescrs[nItem]; -} - -void CCF_FileGroupDescriptor::SetTitle(const CString &sTitle) -{ - m_sTitle = sTitle; -} - -CString CCF_FileGroupDescriptor::GetFileName(UINT nItem) -{ - if (nItem >= m_nItems || m_pFileDescrs == NULL) - { - ASSERT(FALSE); - return CString(); - } - return m_pFileDescrs[nItem].cFileName; -} - -CString CCF_FileGroupDescriptor::GetTitle(UINT nItem) -{ - if (nItem >= m_nItems || m_pFileDescrs == NULL) - { - ASSERT(FALSE); - return CString(); - } - CString strLink(m_pFileDescrs[nItem].cFileName); - int nPos = strLink.Find(_T(".URL")); - if (nPos < 0) - nPos = strLink.Find(_T(".url")); - if (nPos > 0) - { - return strLink.Left(nPos); - } - return strLink; -} - -void CCF_FileGroupDescriptor::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - ar.Read(&m_nItems,sizeof(UINT)); - if (m_nItems) - { - m_pFileDescrs = new FILEDESCRIPTOR[m_nItems]; - ar.Read(m_pFileDescrs,sizeof(FILEDESCRIPTOR)*m_nItems); - for(UINT i=0;i < m_nItems;i++) - TRACE3("(%u) - cFileName %s, Size=%u\n",i,m_pFileDescrs[i].cFileName,m_pFileDescrs[i].nFileSizeLow); - } - } - else - { - UINT cItems=1; - ar.Write(&cItems,sizeof(UINT)); - FILEDESCRIPTOR FileDesc; - ZeroMemory(&FileDesc,sizeof(FILEDESCRIPTOR)); - FileDesc.dwFlags = (FD_LINKUI | FD_FILESIZE); - if (!m_sTitle.IsEmpty()) - { - lstrcpy(FileDesc.cFileName,m_sTitle); - lstrcat(FileDesc.cFileName,_T(".url")); - FileDesc.nFileSizeLow = lstrlen(FileDesc.cFileName)+24; - ar.Write(&FileDesc,sizeof(FILEDESCRIPTOR)); - } - } -} - -//////////////////////////////////////////////// -// CCF_HDROP -//////////////////////////////////////////////// -CCF_HDROP::CCF_HDROP() -{ - m_nFiles = 0; - m_fNC = FALSE; -} - -CCF_HDROP::~CCF_HDROP() -{ -} - -CString CCF_HDROP::GetFileName(UINT nItem) -{ - if (m_sFileNames.GetSize() > 0) - return m_sFileNames[nItem]; - return _T(""); -} - -void CCF_HDROP::AddDropPoint(CPoint &pt,BOOL fNC) -{ - m_pt = pt; - m_fNC = fNC; -} - -void CCF_HDROP::AddFileName(LPCTSTR pszFileName) -{ - m_sFileNames.SetAtGrow(m_nFiles++,pszFileName); -} - -void CCF_HDROP::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - // handled in GetData - } - else - { - DROPFILES dropfiles; - dropfiles.pFiles = sizeof(dropfiles); - dropfiles.fNC = m_fNC; - dropfiles.pt = m_pt; -#ifdef _UNICODE - dropfiles.fWide = TRUE; -#else - dropfiles.fWide = FALSE; -#endif - ar.Write(&dropfiles,sizeof(DROPFILES)); - LPCTSTR pszFileName=NULL; - for(int i=0; i < m_nFiles;i++) - { - pszFileName=m_sFileNames[i]; - ar.Write(pszFileName,lstrlen(pszFileName)+sizeof(TCHAR)); - } - TCHAR rchar=0; - ar.Write(&rchar,sizeof(TCHAR)); - } -} - -//////////////////////////////////////////////// -// CCF_ShellIDList -//////////////////////////////////////////////// -CCF_ShellIDList::CCF_ShellIDList() -{ -} - -CCF_ShellIDList::~CCF_ShellIDList() -{ -} - -LPCITEMIDLIST CCF_ShellIDList::operator[](UINT nIndex) const -{ - return GetPidl(nIndex); -} - -LPCITEMIDLIST CCF_ShellIDList::GetPidl(UINT nIndex) const -{ - if (nIndex > (UINT)m_pidls.GetSize()) - { - return NULL; - } - return(m_pidls[nIndex]); -} - -UINT CCF_ShellIDList::GetCount() const -{ - return m_pidls.GetSize(); -} - -void CCF_ShellIDList::AddPidl(LPCITEMIDLIST pidl) -{ - m_pidls.Add(pidl); -} - -void CCF_ShellIDList::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - // read the header - CIDA cida; - ar.Read(&cida,sizeof(CIDA)); - LPCITEMIDLIST pidl=NULL; - UINT nOffset; - // read the ITEMIDLIST structures - for(UINT i=0;i < cida.cidl+1;i++) - { - nOffset = cida.aoffset[i]; - ar.GetFile()->Seek(CFile::begin,nOffset*sizeof(UINT)); - ar.Read((void*)pidl,sizeof(ITEMIDLIST)); - m_pidls.Add(pidl); - } - } - else - { - CShellPidl ShellPidl; - CIDA cida; - cida.cidl = m_pidls.GetSize(); - ASSERT(cida.cidl > 1); - if (cida.cidl <= 1) - return; - UINT pidls=cida.cidl-1; - ar.Write(&pidls,sizeof(pidls)); - const UINT nOffset=sizeof(UINT); - UINT nElemOffset; - UINT nPidlSize=0; - for(UINT i1=0;i1 < cida.cidl;i1++) - { - nElemOffset = sizeof(cida.cidl)+(cida.cidl*sizeof(nElemOffset))+nOffset+nPidlSize; - ar.Write(&nElemOffset,sizeof(nElemOffset)); - nPidlSize += ShellPidl.GetSize(m_pidls[i1]); - } - BYTE nZero=0; - for(int i=0;i < nOffset;i++) - ar.Write(&nZero,sizeof(nZero)); - TRACE1("Writing %u pidls\n",cida.cidl); - LPSHELLFOLDER pFolder=ShellPidl.GetFolder((LPITEMIDLIST)m_pidls[0]); - for(UINT i2=0;i2 < cida.cidl;i2++) - { -#ifdef _DEBUG - CString sPath; - ShellPidl.SHPidlToPathEx((LPITEMIDLIST)m_pidls[i2],sPath,pFolder); - TRACE3("Writing pidl %s (%u) size(%u)\n",sPath,i2,ShellPidl.GetSize(m_pidls[i2])); -#endif - ar.Write(m_pidls[i2],ShellPidl.GetSize(m_pidls[i2])); - } - if (pFolder) - pFolder->Release(); - } -} - -/////////////////////////////////////////////////////////////////// -// Private clipboard formats for drag and drop -/////////////////////////////////////////////////////////////////// -const CCF_WebSite &CCF_WebSite::operator=(const CCF_WebSite &rThat) -{ - if (this != &rThat) - { - m_strURL = rThat.m_strURL; - m_strTitle = rThat.m_strTitle; - } - return *this; -} - -CCF_WebSite::CCF_WebSite(const CCF_WebSite &WebSite) -{ - *this = WebSite; -} - -//////////////////////////////////////////// - -void CCF_App::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - long hWnd; - ar >> hWnd; - m_hWnd = (HWND)hWnd; - } - else - { - ar << (long)m_hWnd; - } -} -///////////////////////////////////////// - -void CCF_WebSites::Serialize(CArchive &ar) -{ - m_App.Serialize(ar); - m_listWebSites.Serialize(ar); -} - -///////////////////////////////////////// - -CCF_String::CCF_String(LPCTSTR pszText) : m_sText(pszText) -{ -} - -CCF_String::~CCF_String() -{ -} - -LPCTSTR CCF_String::GetString() -{ - return m_sText; -} - -void CCF_String::SetString(LPCTSTR pszText) -{ - m_sText = pszText; -} - -void CCF_String::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - TCHAR szText[MAX_PATH+1]; - m_sText.Empty(); - while (1) - { - ZeroMemory(szText,sizeof(szText)); - ar.Read(szText,MAX_PATH); - m_sText += szText; - if (lstrlen(szText) < MAX_PATH) - break; - } - } - else - { - ar.Write((LPCTSTR)m_sText, m_sText.GetLength()*sizeof(TCHAR)); - int null=0; - ar.Write(&null,sizeof(null)); - } -} - -// -// Private clipboard formats for drag and drop -// -CCF_WebSite::CCF_WebSite(LPCTSTR pszURL,LPCTSTR pszTitle) : - m_strURL(pszURL), - m_strTitle(pszTitle) -{ -} - -CCF_WebSite::~CCF_WebSite() -{ -} - -void CCF_WebSite::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - ar >> m_strURL; - ar >> m_strTitle; - } - else - { - ar << m_strURL; - ar << m_strTitle; - } -} - -// -////////////////////////////////////////////////////// - -CCF_FolderType::CCF_FolderType(LPCTSTR pszParentCategory,long nCategory,LPCTSTR pszCategory) : - m_strParentCategory(pszParentCategory), - m_nCategory(nCategory), - m_strCategory(pszCategory) -{ -} - -CCF_FolderType::~CCF_FolderType() -{ -} - -const CCF_FolderType &CCF_FolderType::operator=(const CCF_FolderType &rThat) -{ - if (this != &rThat) - { - m_nCategory = rThat.m_nCategory; - m_strCategory = rThat.m_strCategory; - m_strParentCategory = rThat.m_strParentCategory; - } - return *this; -} - -CCF_FolderType::CCF_FolderType(const CCF_FolderType &WebSiteCategory) -{ - *this = WebSiteCategory; -} - -void CCF_FolderType::Serialize(CArchive &ar) -{ - if (ar.IsLoading()) - { - ar >> m_nCategory; - ar >> m_strCategory; - ar >> m_strParentCategory; - } - else - { - ar << m_nCategory; - ar << m_strCategory; - ar << m_strParentCategory; - } -} - -///////////////////////////////////////////////// - -void CCF_DBFolderList::Serialize(CArchive &ar) -{ - m_App.Serialize(ar); - if (ar.IsLoading()) - { - ar >> m_strDatabase; - } - else - { - ar << m_strDatabase; - } - CList::Serialize(ar); -} - -template <> void AFXAPI SerializeElements (CArchive& ar, CCF_FolderType *pWebSite, int nCount ) -{ - for ( int i = 0; i < nCount; i++, pWebSite++ ) - { - pWebSite->Serialize(ar); - } -} - -template<> void AFXAPI DestructElements (CCF_FolderType *pElements, int nCount) -{ - for ( int n = 0; n < nCount; n++, pElements++ ) - { - pElements->CCF_FolderType::~CCF_FolderType(); - } -} - -template<> void AFXAPI ConstructElements (CCF_FolderType *pElements, int nCount) -{ - for ( int n = 0; n < nCount; n++, pElements++ ) - { - pElements->CCF_FolderType::CCF_FolderType(); - } -} - -/////////////////////////////////////////////////// -template <> void AFXAPI SerializeElements (CArchive& ar, CCF_WebSite *pWebSite, int nCount ) -{ - for ( int i = 0; i < nCount; i++, pWebSite++ ) - { - pWebSite->Serialize(ar); - } -} - -template<> void AFXAPI DestructElements (CCF_WebSite *pElements, int nCount) -{ - for ( int n = 0; n < nCount; n++, pElements++ ) - { - pElements->CCF_WebSite::~CCF_WebSite(); - } -} - -template<> void AFXAPI ConstructElements (CCF_WebSite *pElements, int nCount) -{ - for ( int n = 0; n < nCount; n++, pElements++ ) - { - pElements->CCF_WebSite::CCF_WebSite(); - } -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragdropctrl.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragdropctrl.cpp deleted file mode 100644 index 2a602ea9961..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragdropctrl.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UICtrl.h" -#include "UIDragDropCtrl.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CDragDropCtrl - -CDragDropCtrl::CDragDropCtrl() -{ - m_dwKeyboardState = 0; -} - -CDragDropCtrl::~CDragDropCtrl() -{ -} - -void CDragDropCtrl::OnDragLeave(CWnd* pWnd) -{ - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd()); - // was message handled? - if (pWnd->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info) == FALSE) - pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info); - COleDropTarget::OnDragLeave(pWnd); -} - -DROPEFFECT CDragDropCtrl::OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - m_dwEnterKeyboardState = dwKeyState; - Info.SetKeyboardState(dwKeyState); - // was message handled? - BOOL bRet = pWnd->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info); - if (bRet == FALSE) - bRet = pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info); - return Info.GetDropEffect(); -} - -DROPEFFECT CDragDropCtrl::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetKeyboardState(dwKeyState); - // was message handled? - m_dwKeyboardState = dwKeyState; - BOOL bRet = pWnd->SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)&Info); - if (bRet == FALSE) - bRet = pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_OVER,(WPARAM)&Info); - if (bRet == FALSE) - return DROPEFFECT_NONE; - return Info.GetDropEffect(); -} - -BOOL CDragDropCtrl::OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ) -{ - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetDropEffect(dropEffect); - if (m_dwEnterKeyboardState & MK_RBUTTON) - m_dwKeyboardState |= MK_RBUTTON; - if (m_dwEnterKeyboardState & MK_LBUTTON) - m_dwKeyboardState |= MK_LBUTTON; - Info.SetKeyboardState(m_dwKeyboardState); - BOOL bRet = pWnd->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - // try parent if no reply - if (bRet == FALSE) - bRet = pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - return bRet; -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragimage.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragimage.cpp deleted file mode 100644 index a5a39e718e2..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidragimage.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UIDragImage.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CDragDropImage - -IMPLEMENT_DYNCREATE(CDragDropImage, CCmdTarget) - -CDragDropImage::CDragDropImage() -{ -} - -CDragDropImage::CDragDropImage(int nSelected,int nType) : - m_nSelected(nSelected),m_nType(nType) -{ -} - -CDragDropImage::~CDragDropImage() -{ - while (!m_itemList.IsEmpty()) - { - CDragDropItem *pItem = m_itemList.RemoveHead(); - delete pItem; - } -} - -void CDragDropImage::AddItem(LPCRECT prcItem,LPCRECT prcIcon) -{ - CDragDropItem *pItem = new CDragDropItem(prcItem,prcIcon); - m_itemList.AddHead(pItem); -} - - -BEGIN_MESSAGE_MAP(CDragDropImage, CCmdTarget) - //{{AFX_MSG_MAP(CDragDropImage) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDragDropImage message handlers - -void CDragDropImage::DrawDragImage(CDC *pDC, POINT point, POINT ActionPoint) -{ - point.x -= ActionPoint.x; - point.y -= ActionPoint.y; - for(POSITION pos=m_itemList.GetTailPosition();pos != NULL;) - { - CDragDropItem *pItem = m_itemList.GetPrev(pos); - DrawItemImage(pDC,point,pItem->m_rcItem,pItem->m_rcIcon); - } -} - -// rcItem contains the bounding text -// of an item in thge list control -void CDragDropImage::DrawItemImage(CDC *pDC,POINT point,const CRect &rcItem,const CRect &rcIcon) -{ -// Make it the inverse of the screen color. - int nOldMode = pDC->SetROP2 (R2_NOT); -// just the outline - CBrush* pOldBrush = (CBrush*) pDC->SelectStockObject (NULL_BRUSH); -// draw it icon size - pDC->Rectangle (point.x+rcIcon.left, point.y+rcIcon.top, point.x+rcIcon.left + rcIcon.Width(),point.y+rcIcon.top + rcIcon.Height()); - pDC->SelectObject (pOldBrush); -// the outline of the text item - CPen pen(PS_DASH,1,GetSysColor(COLOR_BTNTEXT)); - CPen *pOldPen = pDC->SelectObject(&pen); -// only in report or list mode - if (m_nType != LVS_ICON && m_nType != LVS_SMALLICON) - { - // draw the line halfway down the icon rectangle - pDC->MoveTo(point.x+rcIcon.left+rcIcon.Width(), point.y+rcIcon.top+(rcIcon.Height()/2)); - pDC->LineTo(point.x+rcIcon.left+rcItem.Width(), point.y+rcIcon.top+(rcIcon.Height()/2)); - } - pDC->SelectObject (pOldPen); - pDC->SetROP2 (nOldMode); -} - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidroptarget.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidroptarget.cpp deleted file mode 100644 index a26704b0770..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellExt/uidroptarget.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//******************************************************************************* -// COPYRIGHT NOTES -// --------------- -// You may use this source code, compile or redistribute it as part of your application -// for free. You cannot redistribute it as a part of a software development -// library without the agreement of the author. If the sources are -// distributed along with the application, you should leave the original -// copyright notes in the source code without any changes. -// This code can be used WITHOUT ANY WARRANTIES at your own risk. -// -// For the latest updates to this code, check this site: -// http://www.masmex.com -// after Sept 2000 -// -// Copyright(C) 2000 Philip Oldaker -//******************************************************************************* - -#include "stdafx.h" -#include "UICtrl.h" -#include "UIDragImage.h" -#include "UIDropTarget.h" -#include "UIDragDropCtrl.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CDD_OleDropTargetInfo,CObject) - -void CListDropTarget::OnDragLeave(CWnd* pWnd) -{ - CUI_ImageDropTarget::OnDragLeave(pWnd); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd()); - if (!pWnd->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info)) - pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_LEAVE,(WPARAM)&Info); -} - -DROPEFFECT CListDropTarget::OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - // Should be starting in a CUIODListCtrl window - CUI_ImageDropTarget::OnDragEnter(pWnd,pDataObject,dwKeyState,point); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetKeyboardState(dwKeyState); - if (!pWnd->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info)) - pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_ENTER,(WPARAM)&Info); - return Info.GetDropEffect(); -} - -DROPEFFECT CListDropTarget::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) -{ - // check if any image to draw - if (GetDropImage() != NULL) - CUI_ImageDropTarget::OnDragOver(pWnd,pDataObject,dwKeyState,point); - m_dwKeyboardState = dwKeyState; - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetKeyboardState(dwKeyState); - // this will fill in info with item if mouse over one - CUIODListCtrl *pList = static_cast(pWnd); - return pList ? pList->SelectCurrentTarget(&Info) : DROPEFFECT_NONE; -} - -BOOL CListDropTarget::OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point ) -{ - CUI_ImageDropTarget::OnDrop(pWnd,pDataObject,dropEffect,point); - - TRACE0("CListDropTraget - OnDrop\n"); - // should be list control - CUIODListCtrl *pList = static_cast(pWnd); - if (pList != NULL) - { - UINT flags; - int iItem = pList->HitTest(point, &flags); - CDD_OleDropTargetInfo Info(pWnd->GetSafeHwnd(),point,pDataObject); - Info.SetDropEffect(dropEffect); - Info.SetItem(iItem); - Info.SetKeyboardState(m_dwKeyboardState); - // alert control first otherwise parent - if (!pWnd->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info)) - return pWnd->GetParent()->SendMessage(WM_APP_OLE_DD_DROP,(WPARAM)&Info); - } - return CUI_ImageDropTarget::OnDrop(pWnd,pDataObject,dropEffect,point); -} - - - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellView.cpp b/reactos/subsys/system/explorer/Seashell/SeaShellView.cpp deleted file mode 100644 index dd69a437c01..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellView.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// SeaShellView.cpp : implementation of the CSeaShellView class -// - -#include "stdafx.h" -#include "SeaShell.h" - -#include "SeaShellDoc.h" -#include "SeaShellView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellView - -IMPLEMENT_DYNCREATE(CSeaShellView, CIEShellListView) - -BEGIN_MESSAGE_MAP(CSeaShellView, CIEShellListView) - //{{AFX_MSG_MAP(CSeaShellView) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP - // Standard printing commands - ON_COMMAND(ID_FILE_PRINT, CIEShellListView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_DIRECT, CIEShellListView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_PREVIEW, CIEShellListView::OnFilePrintPreview) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellView construction/destruction - -CSeaShellView::CSeaShellView() -{ - // TODO: add construction code here - -} - -CSeaShellView::~CSeaShellView() -{ -} - -BOOL CSeaShellView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return CIEShellListView::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellView drawing - -void CSeaShellView::OnInitialUpdate() -{ - CIEShellListView::OnInitialUpdate(); - - - // TODO: You may populate your ListView with items by directly accessing - // its list control through a call to GetListCtrl(). -} - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellView printing - -BOOL CSeaShellView::OnPreparePrinting(CPrintInfo* pInfo) -{ - // default preparation - return DoPreparePrinting(pInfo); -} - -void CSeaShellView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) -{ - // TODO: add extra initialization before printing -} - -void CSeaShellView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) -{ - // TODO: add cleanup after printing -} - -///////////////////////////////////////////////////////////////////////////// -// CSeaShellView diagnostics - -#ifdef _DEBUG -void CSeaShellView::AssertValid() const -{ - CIEShellListView::AssertValid(); -} - -void CSeaShellView::Dump(CDumpContext& dc) const -{ - CIEShellListView::Dump(dc); -} - -CSeaShellDoc* CSeaShellView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSeaShellDoc))); - return (CSeaShellDoc*)m_pDocument; -} -#endif //_DEBUG - diff --git a/reactos/subsys/system/explorer/Seashell/SeaShellView.h b/reactos/subsys/system/explorer/Seashell/SeaShellView.h deleted file mode 100644 index 30ff746956e..00000000000 --- a/reactos/subsys/system/explorer/Seashell/SeaShellView.h +++ /dev/null @@ -1,68 +0,0 @@ -// SeaShellView.h : interface of the CSeaShellView class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_SEASHELLVIEW_H__0E1DCA0F_387A_4C9E_859F_F2C0C981E5A8__INCLUDED_) -#define AFX_SEASHELLVIEW_H__0E1DCA0F_387A_4C9E_859F_F2C0C981E5A8__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "IEShellListView.h" - -class CSeaShellView : public CIEShellListView -{ -protected: // create from serialization only - CSeaShellView(); - DECLARE_DYNCREATE(CSeaShellView) - -// Attributes -public: - CSeaShellDoc* GetDocument(); - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CSeaShellView) - public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - protected: - virtual void OnInitialUpdate(); // called first time after construct - virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); - virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); - virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CSeaShellView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CSeaShellView) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -#ifndef _DEBUG // debug version in SeaShellView.cpp -inline CSeaShellDoc* CSeaShellView::GetDocument() - { return (CSeaShellDoc*)m_pDocument; } -#endif - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SEASHELLVIEW_H__0E1DCA0F_387A_4C9E_859F_F2C0C981E5A8__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.cpp b/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.cpp deleted file mode 100644 index 60a7b5a4ad8..00000000000 --- a/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// ShellTreeDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "SeaShell.h" -#include "ShellTreeDlg.h" -#include "UIMessages.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CShellTreeDlg dialog - - -CShellTreeDlg::CShellTreeDlg(CWnd* pParent /*=NULL*/) - : CDialog(CShellTreeDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CShellTreeDlg) - m_stHelp = _T(""); - m_stPath = _T(""); - //}}AFX_DATA_INIT -} - - -void CShellTreeDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CShellTreeDlg) - DDX_Control(pDX, IDC_SHELL_TREE, m_ShellTree); - DDX_Text(pDX, IDC_ST_HELP, m_stHelp); - DDX_Text(pDX, IDC_ST_PATH, m_stPath); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CShellTreeDlg, CDialog) - //{{AFX_MSG_MAP(CShellTreeDlg) - ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring) - ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS,OnAppUpdateAllViews) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CShellTreeDlg message handlers - -BOOL CShellTreeDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // TODO: Add extra initialization here - m_ShellTree.LoadFolderItems(); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -LRESULT CShellTreeDlg::OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam) -{ - if (wParam == HINT_TREE_SEL_CHANGED) - { - const CRefreshShellFolder *pRefresh = reinterpret_cast(lParam); - m_stPath = m_ShellTree.GetPathName(pRefresh->GetItem()); - UpdateData(FALSE); - } - return 1; -} - -LRESULT CShellTreeDlg::OnSetmessagestring(WPARAM wParam, LPARAM lParam) -{ - if (lParam) - { - m_stHelp = (LPCTSTR)lParam; - UpdateData(FALSE); - } - return 1; -} diff --git a/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.h b/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.h deleted file mode 100644 index 483abbc1983..00000000000 --- a/reactos/subsys/system/explorer/Seashell/ShellTreeDlg.h +++ /dev/null @@ -1,50 +0,0 @@ -#if !defined(AFX_SHELLTREEDLG_H__383BF0CC_353A_49C7_AF0D_DB8FC40F81A9__INCLUDED_) -#define AFX_SHELLTREEDLG_H__383BF0CC_353A_49C7_AF0D_DB8FC40F81A9__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// ShellTreeDlg.h : header file -// -#include "IEShellTreeCtrl.h" -///////////////////////////////////////////////////////////////////////////// -// CShellTreeDlg dialog - -class CShellTreeDlg : public CDialog -{ -// Construction -public: - CShellTreeDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CShellTreeDlg) - enum { IDD = IDD_SHELL_TREE }; - CIEShellTreeCtrl m_ShellTree; - CString m_stHelp; - CString m_stPath; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CShellTreeDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CShellTreeDlg) - virtual BOOL OnInitDialog(); - afx_msg LRESULT OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam ); - afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam ); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SHELLTREEDLG_H__383BF0CC_353A_49C7_AF0D_DB8FC40F81A9__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/StdAfx.cpp b/reactos/subsys/system/explorer/Seashell/StdAfx.cpp deleted file mode 100644 index 69761f13cf7..00000000000 --- a/reactos/subsys/system/explorer/Seashell/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SeaShell.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - - diff --git a/reactos/subsys/system/explorer/Seashell/StdAfx.h b/reactos/subsys/system/explorer/Seashell/StdAfx.h deleted file mode 100644 index cc2c8a412e2..00000000000 --- a/reactos/subsys/system/explorer/Seashell/StdAfx.h +++ /dev/null @@ -1,29 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__94458E14_B12D_4CAF_A200_FD0873C0FF7C__INCLUDED_) -#define AFX_STDAFX_H__94458E14_B12D_4CAF_A200_FD0873C0FF7C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include -#include // MFC Automation classes -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include "SeaShellExt.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__94458E14_B12D_4CAF_A200_FD0873C0FF7C__INCLUDED_) diff --git a/reactos/subsys/system/explorer/Seashell/res/SeaShell.ico b/reactos/subsys/system/explorer/Seashell/res/SeaShell.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/reactos/subsys/system/explorer/Seashell/res/SeaShell.ico and /dev/null differ diff --git a/reactos/subsys/system/explorer/Seashell/res/SeaShell.rc2 b/reactos/subsys/system/explorer/Seashell/res/SeaShell.rc2 deleted file mode 100644 index 7c7175347ad..00000000000 --- a/reactos/subsys/system/explorer/Seashell/res/SeaShell.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// SEASHELL.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/reactos/subsys/system/explorer/Seashell/res/SeaShellDoc.ico b/reactos/subsys/system/explorer/Seashell/res/SeaShellDoc.ico deleted file mode 100644 index 2a1f1ae6ef1..00000000000 Binary files a/reactos/subsys/system/explorer/Seashell/res/SeaShellDoc.ico and /dev/null differ diff --git a/reactos/subsys/system/explorer/Seashell/res/Toolbar.bmp b/reactos/subsys/system/explorer/Seashell/res/Toolbar.bmp deleted file mode 100644 index 19aa154dd3a..00000000000 Binary files a/reactos/subsys/system/explorer/Seashell/res/Toolbar.bmp and /dev/null differ diff --git a/reactos/subsys/system/explorer/Seashell/res/coldtool.bmp b/reactos/subsys/system/explorer/Seashell/res/coldtool.bmp deleted file mode 100644 index 810374f7ba4..00000000000 Binary files a/reactos/subsys/system/explorer/Seashell/res/coldtool.bmp and /dev/null differ diff --git a/reactos/subsys/system/explorer/Seashell/res/hottoolb.bmp b/reactos/subsys/system/explorer/Seashell/res/hottoolb.bmp deleted file mode 100644 index 85ffd5c4f39..00000000000 Binary files a/reactos/subsys/system/explorer/Seashell/res/hottoolb.bmp and /dev/null differ