// Commands.h : header file
//
#if !defined(AFX_COMMANDS_H__65840FF6_9958_473A_9E61_4E9B94F75487__INCLUDED_)
#define AFX_COMMANDS_H__65840FF6_9958_473A_9E61_4E9B94F75487__INCLUDED_
#include "MoreFastTypes.h"
#include "TempDlg.h" // Added by ClassView
#ifndef BM
#define BM
struct BookMark
{
char title[50];
char fname[256];
long lno;
};
#endif
#define ID_USER WM_USER+1
#define MAX_BOOKMARK 20
class CCommands :
public CComDualImpl<ICommands, &IID_ICommands, &LIBID_MoreFast>,
public CComObjectRoot,
public CComCoClass<CCommands, &CLSID_Commands>
{
protected:
BOOL m_bAstyle;
BookMark m_curBM[MAX_BOOKMARK];
CString titles[40];
int m_noOfBM;
CComQIPtr<ITextDocument, &IID_ITextDocument> m_pDoc;
CComQIPtr<ITextSelection, &IID_ITextSelection> m_pSel;
public:
IApplication* m_pApplication;
CCommands();
~CCommands();
void SetApplicationObject(IApplication* m_pApplication);
IApplication* GetApplicationObject() { return m_pApplication; }
void UnadviseFromEvents();
BEGIN_COM_MAP(CCommands)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ICommands)
END_COM_MAP()
DECLARE_NOT_AGGREGATABLE(CCommands)
protected:
// This class template is used as the base class for the Application
// event handler object and the Debugger event handler object,
// which are declared below.
template <class IEvents, const IID* piidEvents, const GUID* plibid,
class XEvents, const CLSID* pClsidEvents>
class XEventHandler :
public CComDualImpl<IEvents, piidEvents, plibid>,
public CComObjectRoot,
public CComCoClass<XEvents, pClsidEvents>
{
public:
BEGIN_COM_MAP(XEvents)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IID(*piidEvents, IEvents)
END_COM_MAP()
DECLARE_NOT_AGGREGATABLE(XEvents)
void Connect(IUnknown* pUnk)
{ VERIFY(SUCCEEDED(AtlAdvise(pUnk, this, *piidEvents, &m_dwAdvise))); }
void Disconnect(IUnknown* pUnk)
{ AtlUnadvise(pUnk, *piidEvents, m_dwAdvise); }
CCommands* m_pCommands;
protected:
DWORD m_dwAdvise;
};
// This object handles events fired by the Application object
class XApplicationEvents : public XEventHandler<IApplicationEvents,
&IID_IApplicationEvents, &LIBID_MoreFast,
XApplicationEvents, &CLSID_ApplicationEvents>
{
public:
// IApplicationEvents methods
STDMETHOD(BeforeBuildStart)(THIS);
STDMETHOD(BuildFinish)(THIS_ long nNumErrors, long nNumWarnings);
STDMETHOD(BeforeApplicationShutDown)(THIS);
STDMETHOD(DocumentOpen)(THIS_ IDispatch * theDocument);
STDMETHOD(BeforeDocumentClose)(THIS_ IDispatch * theDocument);
STDMETHOD(DocumentSave)(THIS_ IDispatch * theDocument);
STDMETHOD(NewDocument)(THIS_ IDispatch * theDocument);
STDMETHOD(WindowActivate)(THIS_ IDispatch * theWindow);
STDMETHOD(WindowDeactivate)(THIS_ IDispatch * theWindow);
STDMETHOD(WorkspaceOpen)(THIS);
STDMETHOD(WorkspaceClose)(THIS);
STDMETHOD(NewWorkspace)(THIS);
};
typedef CComObject<XApplicationEvents> XApplicationEventsObj;
XApplicationEventsObj* m_pApplicationEventsObj;
// This object handles events fired by the Application object
class XDebuggerEvents : public XEventHandler<IDebuggerEvents,
&IID_IDebuggerEvents, &LIBID_MoreFast,
XDebuggerEvents, &CLSID_DebuggerEvents>
{
public:
// IDebuggerEvents method
STDMETHOD(BreakpointHit)(THIS_ IDispatch * pBreakpoint);
};
typedef CComObject<XDebuggerEvents> XDebuggerEventsObj;
XDebuggerEventsObj* m_pDebuggerEventsObj;
public:
BOOL m_bIntComments;
STDMETHOD(Templates) ();
STDMETHOD(GetFileOut) ();
STDMETHOD(PutFileIn) ();
STDMETHOD(SetOptions) ();
STDMETHOD(PasteCT) ();
STDMETHOD(AddCT) ();
STDMETHOD(SPVersion) ();
STDMETHOD(FormatCode) ();
STDMETHOD(BookMarkProc) ();
STDMETHOD(SwitchCase) ();
STDMETHOD(HToCPPToH) ();
STDMETHOD(OpenLineCountApp) ();
STDMETHOD(OpenProjectFolder) ();
STDMETHOD(RemoveBlockComment) ();
STDMETHOD(RemoveLineComment)();
STDMETHOD(AddBlockComment) ();
CString m_filepath;
CString GetSelText();
CString m_path;
CBitmap m_menubmp;
CBitmap m_UnCheckBitmap;
CString m_strSelFileName;
CString m_strOutFileName;
BOOL m_working;
BOOL m_open;
BOOL m_remainBottom;
BOOL m_selectedText;
int noOfCT;
void CTList();
CString m_dsnName;
CTempDlg m_tdlg;
CString m_lineComment;
CString m_blockStartComment;
CString m_blockEndComment;
CString m_sUserPMFKey;
CString m_sUserFullName;
CString m_sUserProject;
BOOL AddBookMark(CString title);
void AddRecord(CString title, CString ct);
BOOL CheckForTextType();
void CopyResultsBackToSelection(void);
void DefineResultsFileName(void);
bool ExecutePipedBatchProcess(const CString & sProcess);
int GetCursorPosition(CString & sText);
CString HeaderChangeLog(void);
CString HeaderClassFile(const CString & docName);
CString HeaderClassHFile(const CString & docName);
CString HeaderFunction(void);
CString HeaderFunctionBody(void);
CString HeaderSimpleFile(const CString & docName);
void ReadBMFromFile();
void ReplaceAll(CString & sText,
CString sFind,
CString sReplace);
void ReplaceAllKeepLength( CString & sText,
CString sFind,
CString sReplace);
void setComment(CString line, CString start, CString end1);
void SetFilePath(CString cs);
void WriteBMInFile(CString fname);
void WriteLineSelectionToTempFile(void);
void CleanUpTemporaryFiles(void);
CString TemplateDoWhile(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateFor(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIf(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIfDefined(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIfDefinedElse(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIfNotDefined(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIfNotDefinedElse(const CString & spaces,
CString & selText,
int & nCursorOffset);
CString TemplateIfElse(const CString & spaces,
CString & selText,
int & nCursorOffset);
void TemplateIncludeFile(CString & selText);
CString TemplateWhile(const CString & spaces,
CString & selText,
int & nCursorOffset);
bool VerifyTemplateVariables(void);
// ICommands methods
STDMETHOD(MoreFastCommandMethod)(THIS);
};
typedef CComObject<CCommands> CCommandsObj;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COMMANDS_H__65840FF6_9958_473A_9E61_4E9B94F75487__INCLUDED)