📄 childfrm.cpp
字号:
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "C02IDE.h"
//#include "SynEditView.h"
#include "ChildFrm.h"
#include "Mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CCJMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CCJMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_COMMAND(ID_WRAPMODE, OnWrapmode)
ON_UPDATE_COMMAND_UI(ID_WRAPMODE, OnUpdateWrapmode)
ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
ON_WM_CLOSE()
ON_WM_CREATE()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
m_pStyledWnd = NULL;
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CCJMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CCJMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CCJMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::OnFileSaveAs()
{
CString Filter;
Filter = "All Source files (*.c, *.cpp, *.h *.hpp, "
" *.rc)|*.c;*.cpp;*.h;*.hpp;*.rc|";
Filter += "Header Files (*.h;*.hpp)|*.h;*.hpp|";
Filter += "Source Files (*.c;*.cpp)|*.c;*.cpp|";
Filter += "Resource Files (*.rc)|*.rc|";
Filter += "Text Files (*.txt)|*.txt|";
// Filter += "All Files (*.*)|*.*||";
CFileDialog cfd(false, NULL, NULL, OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT, Filter);
if (cfd.DoModal () == IDCANCEL)
return;
// GetDocument()->OnSaveDocument (cfd.m_ofn.lpstrFile);
// GetDocument()->SetPathName(cfd.m_ofn.lpstrFile, TRUE);
}
void CChildFrame::OnWrapmode()
{
}
void CChildFrame::OnUpdateWrapmode(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_bAutoReturn);
}
//当关闭一个子窗口时,需要更新相关的项目文件信息
void CChildFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
//m_pdoc->OnFileClose();
//主窗口指针
CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//活动子窗口指针
CMDIChildWnd *nowchild = nowframe->MDIGetActive();
//获得当前项目信息指针
struct ProjectList * curpro=NULL;
curpro=new ProjectList;
curpro=(ProjectList *)projectinfo.GetAt(0);
//项目中的文件数目
int nfile=curpro->proinfstru.GetSize();
//文件节点结构变量
struct fileitem m_pcurnode;
for (int j=0;j<=nfile-1;j++)
{
//取第j个节点
m_pcurnode=fileitemarray[j];
//如果节点的窗口指针等于当前活动指针,退出循环
if(m_pcurnode.m_pchildf==nowchild)
break;
}
//删除目录树里的文件节点
for(int jj=j;jj<=nfile-2;jj++)
fileitemarray[jj]= fileitemarray[jj+1];
//获得当前项目信息中的文件信息指针
struct FileList * m_pcurfile=NULL;
m_pcurfile=new FileList;
CString str_curfilename=_T("");
m_pcurfile=(FileList *)curpro->proinfstru.GetAt(j);
//删除索引为j 的文件
curpro->proinfstru.RemoveAt(j);
// curpro->proinfstru.SetSize(nfile-1);
//删除主窗口快速查看文件函数工具条中的文件下拉框中的对应文件
CMainFrame *nowmainframe=(CMainFrame *) nowframe;
//删除主窗口快速查看文件函数工具条中的文件下拉框中的对应文件
nowmainframe->delcomfile();
m_mappro.RemoveKey(nowchild->GetSafeHwnd());
//关闭子窗口
CCJMDIChildWnd::OnClose();
//更新文件函数树
m_pDocFile->UpdateAllFNode();
//更新断点树
m_pDocClass->ExpandAllBreak();
// m_tip.OnDestroy();
return;
}
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CCJMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CPoint m_rect(220,220);
// m_tip.Create("asdfadf",WS_POPUP,m_rect,this);
// m_tip=new CTipDlg;
CRect mrc(0,0,0,0);
m_tip.Create(NULL,NULL,NULL,mrc,this,IDD_DIALOG_TIP,NULL);
m_tip.SetDelayTime(TTDT_INITIAL,300);
m_tip.SetDelayTime(TTDT_AUTOPOP,3000);
m_tip.SetTipBkColor(RGB(0xff,0,0));
m_tip.SetTipTextColor(RGB(0,0,0xff));
CRect rc(1,1,1,1);
m_tip.SetMargin(&rc);
// m_tipdlg->ShowWindow(SW_SHOW);
//Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
CRichEditCtrl * m_edit=(CRichEditCtrl*)m_tip.GetDlgItem(IDC_RICHEDIT);
m_edit->SetWindowText(_T(""));
m_tip_struct.Create(NULL,NULL,NULL,mrc,this,IDD_DIALOG_TIP,NULL);
m_tip_struct.SetDelayTime(TTDT_INITIAL,300);
m_tip_struct.SetDelayTime(TTDT_AUTOPOP,2000);
m_tip_struct.SetTipBkColor(RGB(0xff,0,0));
m_tip_struct.SetTipTextColor(RGB(0,0,0xff));
// rc(1,1,1,1);
m_tip_struct.SetMargin(&rc);
// m_tip.Hide();
// \n\n\n\n\n\n\n\nliu\nkll\niii\nlimi\ningdddddddddddddddddfdfdfdf");
// m_tipdlg->Show();
return 1;
// TODO: Add your specialized creation code here
/*
ProjectList *curpro;
curpro=new ProjectList;
curpro=(ProjectList*)(projectinfo.GetAt(0));
gotoline=0;
findstring="";
findstringcurhang=0;
findstringcurlie=-1;
// strreplacewith="";
// CCJMDIFrameWnd *m_pFrame = (CCJMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// CCJMDIChildWnd *m_pChild = (CCJMDIChildWnd *) m_pFrame->GetActiveFrame();
FileList * m_pnewfile;
m_pnewfile=new FileList;
char* ch_wndtitle=NULL;
CString str_newfilename=_T("");
this->GetWindowText(str_newfilename);
//(ch_wndtitle;
m_pnewfile->m_pChildWnd= this;
// m_pnewfile->funcinfstru=NULL;
int n_file=curpro->proinfstru.GetSize();
if(str_newfilename!="")
m_pnewfile->str_filename=str_newfilename;
else
{
str_newfilename.Format("%d",n_file);
str_newfilename="no title file"+str_newfilename;
m_pnewfile->str_filename=str_newfilename;
// pChild->SetWindowText(str_newfilename);
}
curpro->proinfstru.Add((CObject *)m_pnewfile);
projectinfo.RemoveAll();
projectinfo.InsertAt(0,(CObject *)curpro);
// projectfile.InsertAt(0,(CObject*)curpro);
m_pDocClass->UpdateTabView();
m_pDocFile->UpdateTabView();
CMainFrame *m_pmainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
// CWorkspaceView* m_ptab=(CWorkspaceView*)m_pmainFrame->m_wndWorkspace;
m_pfile=m_pnewfile;
m_pmainFrame->updatecomfile();
return 0;
*/
}
BOOL CChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// TODO: Add your specialized code here and/or call the base class
return CCJMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
void CChildFrame::EnableToolTip()
{
CPoint m_rect(220,220);
// m_tip.Create("asdfadf",WS_POPUP,m_rect,this);
// CWnd*pWnd=GetDlgItem(IDOK);
// m_tip.AddTool(this,"mytip");
// pWnd=GetDlgItem(IDCANCEL);
// m_tip.AddTool(pWnd,"欢迎去晓风残月\nhttp://xiaoyueer.top263.net\n你的鼠标在取消键上\n是吗");
m_tip.SetDelayTime(TTDT_INITIAL,800);
m_tip.SetDelayTime(TTDT_AUTOPOP,5000);
m_tip.SetTipBkColor(RGB(0xff,0,0));
m_tip.SetTipTextColor(RGB(0,0,0xff));
CRect rc(10,10,10,10);
m_tip.SetMargin(&rc);
}
BOOL CChildFrame::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
// m_tip
m_tip.RelayEvent(pMsg);
return CCJMDIChildWnd::PreTranslateMessage(pMsg);
}
BOOL CChildFrame::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
return CCJMDIChildWnd::OnNotify(wParam, lParam, pResult);
}
void CChildFrame::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
/*
CRect rect;
GetWindowRect(rect);
ScreenToClient(rect);
// rect.top= rect.top+30;
if (rect.PtInRect(point))
{
CString str;
GetWindowText(str);
str=str+"df\nddf\ndf\ndaf\ndf\n\n\n\n\n";
m_TitleTip.Show(rect, str, 0, 80);
}
*/
CCJMDIChildWnd::OnMouseMove(nFlags, point);
}
int CChildFrame::OnShowTip(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
//{
// CreateEx(NULL, "ppp", NULL, WS_POPUP, 0, 0, 0, 0,
// pParentWnd->GetSafeHwnd(), NULL, NULL );
// RECT& rect={0,0,0,0};
// m_TipWnd.Show();
return 1;//WS_POPUP|
//Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
// const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext
// CCJMDIChildWnd::OnLButtonDblClk(nFlags, point);
}
int CChildFrame::SetTipText(CString str_tip)
{
CRichEditCtrl * m_edit=(CRichEditCtrl*)m_tip.GetDlgItem(IDC_RICHEDIT);
m_edit->SetWindowText(str_tip);
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -