-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a455cd0
commit 7b996df
Showing
29 changed files
with
11,326 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "stdafx.h" | ||
#include "ScintillaDemo.h" | ||
#include "ChildFrm.h" | ||
#include "ScintillaDemoDoc.h" | ||
#include "ScintillaDemoView.h" | ||
|
||
|
||
#ifdef _DEBUG | ||
#define new DEBUG_NEW | ||
#endif | ||
|
||
|
||
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) | ||
|
||
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) | ||
ON_WM_MOVE() | ||
ON_WM_SIZE() | ||
END_MESSAGE_MAP() | ||
|
||
|
||
CChildFrame::CChildFrame() | ||
{ | ||
} | ||
|
||
CChildFrame::~CChildFrame() | ||
{ | ||
} | ||
|
||
#ifdef _DEBUG | ||
void CChildFrame::AssertValid() const | ||
{ | ||
CMDIChildWnd::AssertValid(); | ||
} | ||
|
||
void CChildFrame::Dump(CDumpContext& dc) const | ||
{ | ||
CMDIChildWnd::Dump(dc); | ||
} | ||
#endif //_DEBUG | ||
|
||
void CChildFrame::OnMove(int x, int y) | ||
{ | ||
//Let the base class do its thing | ||
CMDIChildWnd::OnMove(x, y); | ||
|
||
CScintillaDemoView* pView = static_cast<CScintillaDemoView*>(GetActiveView()); | ||
if (pView) | ||
{ | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaDemoView))) | ||
{ | ||
CScintillaCtrl& rCtrl = pView->GetCtrl(); | ||
|
||
//Cancel any outstanding call tip | ||
if (rCtrl.CallTipActive()) | ||
rCtrl.CallTipCancel(); | ||
} | ||
} | ||
} | ||
|
||
void CChildFrame::OnSize(UINT nType, int cx, int cy) | ||
{ | ||
//Let the base class do its thing | ||
CMDIChildWnd::OnSize(nType, cx, cy); | ||
|
||
CScintillaDemoView* pView = static_cast<CScintillaDemoView*>(GetActiveView()); | ||
if (pView) | ||
{ | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaDemoView))) | ||
{ | ||
CScintillaCtrl& rCtrl = pView->GetCtrl(); | ||
|
||
//Cancel any outstanding call tip | ||
if (rCtrl.CallTipActive()) | ||
rCtrl.CallTipCancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
class CChildFrame : public CMDIChildWnd | ||
{ | ||
public: | ||
//Constructors / Destructors | ||
CChildFrame(); | ||
virtual ~CChildFrame(); | ||
|
||
//Methods | ||
#ifdef _DEBUG | ||
virtual void AssertValid() const; | ||
virtual void Dump(CDumpContext& dc) const; | ||
#endif | ||
|
||
protected: | ||
//Message Handlers | ||
afx_msg void OnMove(int x, int y); | ||
afx_msg void OnSize(UINT nType, int cx, int cy); | ||
|
||
DECLARE_DYNCREATE(CChildFrame) | ||
|
||
DECLARE_MESSAGE_MAP() | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
#include "stdafx.h" | ||
#include "ScintillaDemo.h" | ||
#include "ScintillaDocView.h" | ||
#include "MainFrm.h" | ||
|
||
|
||
#ifdef _DEBUG | ||
#define new DEBUG_NEW | ||
#endif | ||
|
||
|
||
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) | ||
|
||
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) | ||
ON_WM_CREATE() | ||
ON_WM_SETTINGCHANGE() | ||
ON_WM_SYSCOLORCHANGE() | ||
ON_WM_PALETTECHANGED() | ||
ON_WM_QUERYNEWPALETTE() | ||
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LINE, &CMainFrame::OnUpdateLine) | ||
ON_UPDATE_COMMAND_UI(ID_INDICATOR_STYLE, &CMainFrame::OnUpdateStyle) | ||
ON_UPDATE_COMMAND_UI(ID_INDICATOR_FOLD, &CMainFrame::OnUpdateFold) | ||
ON_UPDATE_COMMAND_UI(ID_INDICATOR_OVR, &CMainFrame::OnUpdateInsert) | ||
ON_WM_DROPFILES() | ||
END_MESSAGE_MAP() | ||
|
||
static UINT indicators[] = | ||
{ | ||
ID_SEPARATOR, //status line indicator | ||
ID_INDICATOR_FOLD, | ||
ID_INDICATOR_STYLE, | ||
ID_INDICATOR_LINE, | ||
ID_INDICATOR_OVR, | ||
ID_INDICATOR_CAPS, | ||
ID_INDICATOR_NUM, | ||
ID_INDICATOR_SCRL, | ||
}; | ||
|
||
CMainFrame::CMainFrame() | ||
{ | ||
} | ||
|
||
CMainFrame::~CMainFrame() | ||
{ | ||
} | ||
|
||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) | ||
{ | ||
//Let the base class do its thing | ||
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) | ||
return -1; | ||
|
||
//Create the toolbar | ||
if (!m_wndToolBar.Create(this) || | ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) | ||
{ | ||
TRACE(_T("Failed to create toolbar\n")); | ||
return -1; // fail to create | ||
} | ||
|
||
//Set the title of the toolbar. | ||
CString sTitle; | ||
VERIFY(sTitle.LoadString(IDS_TOOLBAR)); | ||
m_wndToolBar.SetWindowText(sTitle); | ||
|
||
//Create the status bar | ||
if (!m_wndStatusBar.Create(this) || | ||
!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) | ||
{ | ||
TRACE(_T("Failed to create status bar\n")); | ||
return -1; // fail to create | ||
} | ||
|
||
//Setup docing an tooltips for the toolbar | ||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); | ||
EnableDocking(CBRS_ALIGN_ANY); | ||
DockControlBar(&m_wndToolBar); | ||
|
||
return 0; | ||
} | ||
|
||
#ifdef _DEBUG | ||
void CMainFrame::AssertValid() const | ||
{ | ||
CMDIFrameWnd::AssertValid(); | ||
} | ||
|
||
void CMainFrame::Dump(CDumpContext& dc) const | ||
{ | ||
CMDIFrameWnd::Dump(dc); | ||
} | ||
#endif //#ifdef _DEBUG | ||
|
||
void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) | ||
{ | ||
//Validate our parameters | ||
CWinApp* pApp = AfxGetApp(); | ||
AFXASSUME(pApp != nullptr); | ||
|
||
//Pass the message on to all scintilla control | ||
POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); | ||
if (posTemplate != nullptr) | ||
{ | ||
CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); | ||
POSITION posDoc = pTemplate->GetFirstDocPosition(); | ||
if (posDoc != nullptr) | ||
{ | ||
CDocument* pDocument = pTemplate->GetNextDoc(posDoc); | ||
if (pDocument != nullptr) | ||
{ | ||
POSITION posView = pDocument->GetFirstViewPosition(); | ||
if (posView != nullptr) | ||
{ | ||
CScintillaView* pView = static_cast<CScintillaView*>(pDocument->GetNextView(posView)); | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaView))) | ||
{ | ||
const MSG* pMsg = GetCurrentMessage(); | ||
pView->GetCtrl().SendMessage(WM_SETTINGCHANGE, pMsg->wParam, pMsg->lParam); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//Let the base class do its thing | ||
CMDIFrameWnd::OnSettingChange(uFlags, lpszSection); | ||
} | ||
|
||
void CMainFrame::OnSysColorChange() | ||
{ | ||
CWinApp* pApp = AfxGetApp(); | ||
AFXASSUME(pApp != nullptr); | ||
|
||
//Pass the message on to all scintilla control | ||
POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); | ||
if (posTemplate != nullptr) | ||
{ | ||
CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); | ||
POSITION posDoc = pTemplate->GetFirstDocPosition(); | ||
if (posDoc != nullptr) | ||
{ | ||
CDocument* pDocument = pTemplate->GetNextDoc(posDoc); | ||
if (pDocument != nullptr) | ||
{ | ||
POSITION posView = pDocument->GetFirstViewPosition(); | ||
if (posView != nullptr) | ||
{ | ||
CScintillaView* pView = static_cast<CScintillaView*>(pDocument->GetNextView(posView)); | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaView))) | ||
{ | ||
const MSG* pMsg = GetCurrentMessage(); | ||
pView->GetCtrl().SendMessage(WM_SYSCOLORCHANGE, pMsg->wParam, pMsg->lParam); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//Let the base class do its thing | ||
CMDIFrameWnd::OnSysColorChange(); | ||
} | ||
|
||
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) | ||
{ | ||
CWinApp* pApp = AfxGetApp(); | ||
AFXASSUME(pApp != nullptr); | ||
|
||
//Pass the message on to all scintilla control | ||
POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); | ||
if (posTemplate != nullptr) | ||
{ | ||
CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); | ||
POSITION posDoc = pTemplate->GetFirstDocPosition(); | ||
if (posDoc != nullptr) | ||
{ | ||
CDocument* pDocument = pTemplate->GetNextDoc(posDoc); | ||
if (pDocument != nullptr) | ||
{ | ||
POSITION posView = pDocument->GetFirstViewPosition(); | ||
if (posView != nullptr) | ||
{ | ||
CScintillaView* pView = static_cast<CScintillaView*>(pDocument->GetNextView(posView)); | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaView))) | ||
{ | ||
const MSG* pMsg = GetCurrentMessage(); | ||
pView->GetCtrl().SendMessage(WM_PALETTECHANGED, pMsg->wParam, pMsg->lParam); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//Let the base class do its thing | ||
CMDIFrameWnd::OnPaletteChanged(pFocusWnd); | ||
} | ||
|
||
BOOL CMainFrame::OnQueryNewPalette() | ||
{ | ||
CWinApp* pApp = AfxGetApp(); | ||
AFXASSUME(pApp); | ||
|
||
//Pass the message on to all scintilla control | ||
POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); | ||
if (posTemplate != nullptr) | ||
{ | ||
CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); | ||
POSITION posDoc = pTemplate->GetFirstDocPosition(); | ||
if (posDoc != nullptr) | ||
{ | ||
CDocument* pDocument = pTemplate->GetNextDoc(posDoc); | ||
if (pDocument != nullptr) | ||
{ | ||
POSITION posView = pDocument->GetFirstViewPosition(); | ||
if (posView != nullptr) | ||
{ | ||
CScintillaView* pView = static_cast<CScintillaView*>(pDocument->GetNextView(posView)); | ||
if (pView->IsKindOf(RUNTIME_CLASS(CScintillaView))) | ||
{ | ||
const MSG* pMsg = GetCurrentMessage(); | ||
pView->GetCtrl().SendMessage(WM_QUERYNEWPALETTE, pMsg->wParam, pMsg->lParam); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//Let the base class do its thing | ||
return CMDIFrameWnd::OnQueryNewPalette(); | ||
} | ||
|
||
void CMainFrame::OnUpdateInsert(CCmdUI* pCmdUI) | ||
{ | ||
pCmdUI->SetText(_T("")); | ||
} | ||
|
||
void CMainFrame::OnUpdateStyle(CCmdUI* pCmdUI) | ||
{ | ||
pCmdUI->SetText(_T("")); | ||
} | ||
|
||
void CMainFrame::OnUpdateFold(CCmdUI* pCmdUI) | ||
{ | ||
pCmdUI->SetText(_T("")); | ||
} | ||
|
||
void CMainFrame::OnUpdateLine(CCmdUI* pCmdUI) | ||
{ | ||
pCmdUI->SetText(_T("")); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
class CMainFrame : public CMDIFrameWnd | ||
{ | ||
DECLARE_DYNAMIC(CMainFrame) | ||
public: | ||
//Constructors / Destructors | ||
CMainFrame(); | ||
virtual ~CMainFrame(); | ||
|
||
#ifdef _DEBUG | ||
virtual void AssertValid() const; | ||
virtual void Dump(CDumpContext& dc) const; | ||
#endif | ||
|
||
protected: | ||
//Member variables | ||
CStatusBar m_wndStatusBar; | ||
CToolBar m_wndToolBar; | ||
|
||
//Member variables | ||
CString GetLongPathName(LPCTSTR pszPathName); | ||
|
||
//Message handlers | ||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); | ||
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection); | ||
afx_msg void OnSysColorChange(); | ||
afx_msg void OnPaletteChanged(CWnd* pFocusWnd); | ||
afx_msg BOOL OnQueryNewPalette(); | ||
afx_msg void OnUpdateLine(CCmdUI* pCmdUI); | ||
afx_msg void OnUpdateStyle(CCmdUI* pCmdUI); | ||
afx_msg void OnUpdateFold(CCmdUI* pCmdUI); | ||
afx_msg void OnUpdateInsert(CCmdUI* pCmdUI); | ||
|
||
DECLARE_MESSAGE_MAP() | ||
}; |
Binary file not shown.
Oops, something went wrong.