Click here to Skip to main content
15,895,746 members
Articles / Programming Languages / C++

Windows Switcher Add-In

Rate me:
Please Sign up or sign in to vote.
3.50/5 (2 votes)
4 Jan 20042 min read 45.4K   388   11  
How to speed-up navigating in big workspace using keyboard
#if !defined(AFX_WINDOWSLISTDIALOG_H__2C32C1F8_41F1_4652_BF9A_B9514BDA4C4B__INCLUDED_)
#define AFX_WINDOWSLISTDIALOG_H__2C32C1F8_41F1_4652_BF9A_B9514BDA4C4B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WindowsListDialog.h : header file
//

#include <afxtempl.h>
#include "WindowDescription.h"
#include <Afxcmn.h>
#include "Project.h"

#import "devshl.dll"

/////////////////////////////////////////////////////////////////////////////
// CWindowsListDialog dialog
const CString oSettingsRegistryKey = "SOFTWARE\\WindowsSwitcher";
const CString oSettingsValNameColWndContent = "ColWidthContent";
const CString oSettingsValNameColWndProject = "ColWidthProject";
const CString oSettingsValNameColWndFullPath = "ColWidthFullPath";

class CWindowsListDialog : public CDialog
{
private:
	::DSSharedObjects::IApplicationPtr		m_pIApplication;
	::DSSharedObjects::IProjectsPtr			m_pIProjects;
	::DSSharedObjects::IWindowsPtr			m_pIWindows;	
	static CString							m_oActiveProjectNameString;
	CArray <CProject, CProject &>			m_aoProjectsArray;
	CArray <CWindowDescription *, CWindowDescription *>	m_aoWindowsDescriptionsArray;

	enum EFileTypes
	{
		eFileTypeOther = 0,
		eFileTypeCpp,
		eFileTypeHeader
	};

	enum EColumnsIndexes
	{
		eColumnIndexContent = 0,	
		eColumnIndexProject,
		eColumnIndexFullPath
	};

// Construction
public:
	CWindowsListDialog( IApplication* pIApplication, CWnd* pParent = NULL );   // standard constructor
	virtual ~CWindowsListDialog();

// Dialog Data
	//{{AFX_DATA(CWindowsListDialog)
	enum { IDD = IDD_WINDOWS_LIST_DIALOG };
	CEdit	m_oFilterEdit;
	CListCtrl	m_oWindowsListCtrl;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CWindowsListDialog)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CWindowsListDialog)
	virtual BOOL OnInitDialog();
	afx_msg void OnChangeEditFilter();
	afx_msg void OnButtonAcvitate();
	afx_msg void OnButtonCloseWnd();
	afx_msg void OnDblclkListWindows(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDestroy();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	bool IsItIdentifier( const CString &oString );
	void OnAbout();
	void OnKeyBindingsDialog();
	void CutToLastWord( CString *poString );
	void LoadDialogSettings();
	void SaveDialogSettings();
	EFileTypes GetFileExtensionType( const CString &oFileNameString );
	CString ReadWindowContent( const CString &oWindowFullPathString, const CString &oWindowCaptionString, ::DSSharedObjects::IGenericDocumentPtr pIDocument );
	CString GetProjectNameForWindow( const CString &oWindowFullPathString );
	void DeleteWindowsDescriptions();
	void GetWindowsDescriptions();
	void ReadProjectNames();
	CString RemovePathAndDecorationsFromCaption( const CString &oWindowCaption, ::DSSharedObjects::IGenericDocumentPtr pIDocument );
	bool FindFileContentInCppLine( const CString &oLineString, CString *poFileContentString );
	bool FindFileContentInHeaderLine( const CString &oLineString, CString *poFileContentString );
	void PopulateWindowsListCtrl();

	friend int __cdecl CompareWindows(const void *elem1, const void *elem2 );
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_WINDOWSLISTDIALOG_H__2C32C1F8_41F1_4652_BF9A_B9514BDA4C4B__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Poland Poland
Mariusz Wojtysiak started his career as coder on ZX-Spectrum demo-scene under nickname Maniu. He graduated Poznan University of Technology. His skills are: project/develop/maintenance of Oracle and MS SQL databases, programming in C++ (including MFC, ATL, Soap), Oracle Forms, and Assembler.
Currently works in IN-Software as developer. Live in Poznan/Poland.

Comments and Discussions