📄 mainfrm.cpp
字号:
curgotopro=(ProjectList *)projectinfo.GetAt(0);
//项目不存在
if(curgotopro==NULL||projectinfo.GetSize()==0||curgotopro->proinfstru.GetSize()==0)
return;
int n_filesize=curgotopro->proinfstru.GetSize();
if(n_selfile>=n_filesize)
return;
FileList * m_pgotofile=NULL;
m_pgotofile=new FileList;
//获得函数所在文件对应的文件信息指针
m_pgotofile=(FileList * )curgotopro->proinfstru.GetAt(n_selfile);
//获得函数所在文件对应的子窗口指针
m_pgotochildf=fileitemarray[n_selfile].m_pchildf;
//断点信息结构的指针变量
struct FuncStruct * m_ptestfunc;
m_ptestfunc=new FuncStruct;
int funcsize=m_pgotofile->funcinfstru.GetSize();
if(n_selfunc>=funcsize)
return;
//访问函数
m_ptestfunc=(FuncStruct *)m_pgotofile->funcinfstru.GetAt(n_selfunc);
int gotoline=m_ptestfunc->n_dingyi;
CC02IDEView* m_pView=(CC02IDEView*)m_pgotochildf->GetActiveView();
m_pView->GotoLine(gotoline);
}
void CMainFrame::OnViewFullScreen()
{
if(m_bFullScreenMode)
FullScreenModeOff();
else FullScreenModeOn();
}
void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_bFullScreenMode);
}
void CMainFrame::FullScreenModeOn()
{
CMDIChildWnd* pChild=MDIGetActive();
if(!pChild) return;
m_bToolBarWasVisible=(m_wndToolBar.IsWindowVisible()!=0);
// m_wndToolBar.ShowWindow(SW_HIDE);
// m_wndToolBarFastget.ShowWindow(SW_HIDE);
// m_wndToolBarBuild.ShowWindow(SW_HIDE);
m_wndReBar.ShowWindow(SW_HIDE);
m_wndOutput.ShowWindow(SW_HIDE);
// m_wndMemory.ShowWindow(SW_HIDE);
m_wndWorkspace.ShowWindow(SW_HIDE);
ShowControlBar(&m_dissemblybar, FALSE, FALSE);
ShowControlBar(&m_regbar, FALSE, FALSE);
ShowControlBar(&m_wndMemory, FALSE, FALSE);
ShowControlBar(&m_wndWatchBar, FALSE, FALSE);
ShowControlBar(&m_wndDebugBar, FALSE, FALSE);
/*
CCJToolBar m_wndToolBarBuild;
CCJToolBar m_wndToolBarFastget;
CCJToolBar m_wndWizardBar;
CCJReBar m_wndReBar;
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CCJTabCtrlBar m_wndWorkspace;
COutputBar m_wndOutput;
CMemoryBar m_wndMemory;
*/
// m_bFormatBarWasVisible=(m_wndFormatBar.IsWindowVisible()!=0);
//
// m_wndFormatBar.ShowWindow(SW_HIDE);
m_bStatusBarWasVisible=(m_wndStatusBar.IsWindowVisible()!=0);
m_wndStatusBar.ShowWindow(SW_HIDE);
m_pwndFullScreenBar=new CCJToolBar;
m_pwndFullScreenBar->Create(this);
m_pwndFullScreenBar->LoadToolBar(IDR_FULLSCREEN);
m_pwndFullScreenBar->SetBarStyle(m_pwndFullScreenBar->GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_pwndFullScreenBar->ModifyStyle(0, TBSTYLE_FLAT);
m_pwndFullScreenBar->EnableDocking(0);
CPoint pt(300,200);
FloatControlBar(m_pwndFullScreenBar,pt);
GetWindowRect(&m_mainRect);
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);
style&=~WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
int screenx=GetSystemMetrics(SM_CXSCREEN);
int screeny=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(NULL,-4,-4,screenx+8,screeny+8,SWP_NOZORDER);
style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);
m_bChildMax=(style & WS_MAXIMIZE)?true:false;
pChild->ShowWindow(SW_SHOWMAXIMIZED);
RecalcLayout();
m_bFullScreenMode=true;
}
void CMainFrame::FullScreenModeOff()
{
delete m_pwndFullScreenBar;
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);
style|=WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
if(m_bToolBarWasVisible)
m_wndToolBar.ShowWindow(SW_SHOW);
// if(m_bFormatBarWasVisible)
// m_wndFormatBar.ShowWindow(SW_SHOW);
if(m_bStatusBarWasVisible)
m_wndStatusBar.ShowWindow(SW_SHOW);
m_wndReBar.ShowWindow(SW_SHOW);
m_wndOutput.ShowWindow(SW_SHOW);
// m_wndMemory.ShowWindow(SW_SHOW);
m_wndWorkspace.ShowWindow(SW_SHOW);
MoveWindow(&m_mainRect);
RecalcLayout();
CMDIChildWnd* pChild=MDIGetActive();
if(pChild){
if(m_bChildMax)
MDIMaximize(pChild);
else MDIRestore(pChild);
}
m_bFullScreenMode=false;
}
BOOL CMainFrame::CreateStatusBar()
{
static UINT nIndicators[] = {
ID_SEPARATOR,
ID_INDICATOR_LINE,
ID_INDICATOR_ROW,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM
};
if (!m_wndStatusBar.Create (this))
return FALSE;
m_wndStatusBar.SetIndicators (nIndicators, 5);
return TRUE;
}
void CMainFrame::OnBuildGo()
{
CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *nowchild = nowframe->MDIGetActive();
CC02IDEView* myview=(CC02IDEView*)nowchild->GetActiveView();
CMenu* menu;
menu=AfxGetMainWnd()->GetMenu();///**** AfxGetMainWnd()
// CMenu* p_commenu;
// p_commenu = menu->GetSubMenu(5);
// pSubMenu->DeleteMenu(4,MF_BYPOSITION);
// pSubMenu->DeleteMenu(5,MF_BYPOSITION);
// menu->DeleteMenu(7,MF_BYPOSITION);
// AfxGetMainWnd()->DrawMenuBar();
// pSubMenu->InsertMenu(ID_BUILD_GO,MF_BYCOMMAND,ID_BUILD_STOPGO, "Stop go");
m_bAutoMenuEnable=FALSE;
// pSubMenu->ModifyMenu(ID_BUILD_GO,MF_BYCOMMAND,ID_BUILD_STOPGO, "Stop go");
// HMENU mn_debug;
// HINSTANCE hInst;
CMenu* pmenuFavorites=new CMenu;
// pmenuFavorites->CreateMenu();
pmenuFavorites->LoadMenu(IDR_MENUDEBUG);
/* mn_debug= ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENUDEBUG));
if(mn_debug != NULL)
{
return;
}*/
int i_menuno=5;
if (nowchild->IsZoomed())
i_menuno=6;
menu->ModifyMenu(i_menuno,MF_POPUP|MF_BYPOSITION ,(UINT)(pmenuFavorites->GetSafeHmenu()), "Debug");
// pSubMenu->EnableMenuItem (ID_BUILD_STOPGO,MF_BYCOMMAND | MF_ENABLED);(UINT)mn_debug
AfxGetMainWnd()->DrawMenuBar();
// myview->
b_buildgo=FALSE;
// myview->
b_buildstopgo=TRUE;
// ShowControlBar(&m_wndCallBar, TRUE, FALSE);
// ShowControlBar(&m_wndRegisterBar, TRUE, FALSE);
// ShowControlBar(&m_wndDisassemblyBar, TRUE, FALSE);
ShowControlBar(&m_dissemblybar, TRUE, FALSE);
ShowControlBar(&m_regbar, TRUE, FALSE);
ShowControlBar(&m_wndWatchBar, TRUE, FALSE);
ShowControlBar(&m_wndMemory, TRUE, FALSE);
ShowControlBar(&m_wndDebugBar, TRUE, FALSE);
ShowControlBar(&m_wndOutput,FALSE, FALSE);
// pSubMenu->ModifyMenu(ID_BUILD_GO,MF_BYCOMMAND,ID_BUILD_STOPGO, "Stop go");
// AfxGetMainWnd()->DrawMenuBar();
CDocument * p_activedoc=NULL;
p_activedoc=nowchild->GetActiveDocument();
if(p_activedoc==NULL)
return;
CString str_dir=_T("");
CString str_dirfull=_T("");
CString str_dircode=_T("");
CString str_dirvar=_T("");
CString str_direrror=_T("");
CString str_dirllm=_T("");
//当前目录名
// str_dir=GetCurrentDirectory();
str_dirfull=p_activedoc->GetPathName();
//获得当前文件名
CString str_file=_T("");
// childf->GetWindowText(str_file);
str_file=p_activedoc->GetTitle();
int i_dircuts=str_dirfull.ReverseFind('\\');
int i_dirlen=str_dirfull.GetLength();
int i_dircutlen=i_dirlen-i_dircuts;
str_dir=str_dirfull;
str_dir.Delete(i_dircuts,i_dircutlen);
//str_dirfull=str_dir+"\\"+str_file+".txt";
str_dircode=str_dir+"\\"+str_file+"code.txt";
str_dirvar=str_dir+"\\"+str_file+"var.txt";
str_direrror=str_dir+"\\"+str_file+"error.txt";
str_dirllm=str_dir+"\\"+str_file+"si02.txt";
i_usermode=3;
m_dissemblybar.UpdateText(str_dircode);
sim.FileInstruction.open(str_dircode);
sim.FVarInfor.open(str_dirvar);
// CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//活动子窗口指针
// CMDIChildWnd *nowchild = nowframe->MDIGetActive();
//获得当前项目信息的指针
/* struct ProjectList * curprobreak=NULL;
curprobreak=new ProjectList;
curprobreak=(ProjectList *)projectinfo.GetAt(0);
m_pfile=new FileList;
//项目中的文件数目
int n_filenumber=curprobreak->proinfstru.GetSize();
//声明文件节点
struct fileitem m_pcurnode;
for (int j=0;j<=n_filenumber-1;j++)
{
//取得文件节点信息的第j个项
m_pcurnode=fileitemarray[j];
//如果节点的窗口指针等于当前活动窗口指针
if(m_pcurnode.m_pchildf==nowchild)
break;
}
//获得活动窗口的文件信息
m_pfile=(FileList *)curprobreak->proinfstru.GetAt(j);
//声明断点信息结构指针
CompStruct * p_break;
p_break=new CompStruct;
int i_breaknum=m_pfile->compileinfstru.GetSize();
struct simulator::Breakpoint *p1,*p2;
p1=sim.BreakpointList;
for(int i=0;i<i_breaknum;i++)
{
p_break=(CompStruct*)m_pfile->compileinfstru.GetAt(i);
// sim.BreakpointList->value=p_break->n_breakline;
p2=new simulator::Breakpoint;
p2->value=p_break->n_breakline;
p2->next=NULL;
p1->next=p2;
p1=p2;
sim.BreakpointList->value++;
}*/
sim.get_instruction();
sim.get_varinfor();
// sim.Dsg();
// m_wndDebugBar.EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndDebugBar);
}
void CMainFrame::OnBuildStopGo()
{
CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *nowchild = nowframe->MDIGetActive();
CC02IDEView* myview=(CC02IDEView*)nowchild->GetActiveView();
// myview->
// m_wndToolBarBuild.EnableButton(ID_BUILD_STOPGO,TRUE);
m_wndDebugBar.ShowWindow(SW_HIDE);
CMenu* menu;
menu=AfxGetMainWnd()->GetMenu();///**** AfxGetMainWnd()
// CMenu* pSubMenu = menu->GetSubMenu(5);
// pSubMenu->DeleteMenu(4,MF_BYPOSITION);
// pSubMenu->DeleteMenu(5,MF_BYPOSITION);
// menu->DeleteMenu(7,MF_BYPOSITION);
// AfxGetMainWnd()->DrawMenuBar();
m_bAutoMenuEnable=FALSE;
CMenu* pmenuFavorites=new CMenu;
// pmenuFavorites->CreateMenu();
pmenuFavorites->LoadMenu(IDR_MENU_BUILD);
int i_menuno=5;
if (nowchild->IsZoomed())
i_menuno=6;
menu->ModifyMenu(i_menuno,MF_POPUP|MF_BYPOSITION |MF_STRING,(UINT)(pmenuFavorites->GetSafeHmenu()), "&Build ");
// pSubMenu->EnableMenuItem (ID_BUILD_GO,MF_BYCOMMAND | MF_ENABLED);
AfxGetMainWnd()->DrawMenuBar();
b_buildgo=TRUE;
// myview->
b_buildstopgo=FALSE;
// ShowControlBar(&m_wndCallBar, FALSE, FALSE);
// ShowControlBar(&m_wndRegisterBar, FALSE, FALSE);
// ShowControlBar(&m_wndDisassemblyBar, FALSE, FALSE);
ShowControlBar(&m_dissemblybar, FALSE, FALSE);
ShowControlBar(&m_regbar, FALSE, FALSE);
ShowControlBar(&m_wndWatchBar, FALSE, FALSE);
ShowControlBar(&m_wndMemory, FALSE, FALSE);
ShowControlBar(&m_wndDebugBar, FALSE, FALSE);
ShowControlBar(&m_wndOutput,TRUE, FALSE);
sim.FileInstruction.close();
sim.FVarInfor.close();
}
//规定编译工具条上ID_BUILD_GO按钮的初始状态
void CMainFrame::OnUpdateBuildGo(CCmdUI* pCmdUI)
{
pCmdUI->Enable(b_buildgo);
// TODO: Add your command update UI handler code here
}
void CMainFrame::OnUpdateBuildStop(CCmdUI* pCmdUI)
{
pCmdUI->Enable(b_buildstopgo);
// TODO: Add your command update UI handler code here
}
void CMainFrame::OnUpdateWizbarGotofunctiondeclaration(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(b_Gotofunctiondeclaration);
}
void CMainFrame::OnUpdateWizbarGotofunctiondefinition(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(b_Gotofunctiondefinition);
}
void CMainFrame::OnComboboxfunction()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnSimu()
{
// TODO: Add your command handler code here
// delete [] szDir;
// return (strCurrentPath);
//获得当前视图
CMDIFrameWnd* mdif=(CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd);
CMDIChildWnd* childf=mdif->MDIGetActive();
CCrystalTextView* m_pexpandview=NULL;
m_pexpandview=(CCrystalTextView*)childf->GetActiveView();
CDocument* childdoc=m_pexpandview->GetDocument();
CString str_path=childdoc->GetPathName();
// AfxMessageBox(str_path);
// p_Lmsimu=new LmSimu;
// p_Lmsimu->
// CMainFrm* mdif=(CMainFrm*)(AfxGetApp()->m_pMainWnd);
CLmAsmToBi LmAsmToBi;
LmAsmToBi.ChangeAsmToBi(str_path);
}
void CMainFrame::OnMenuNextbreak()
{
// TODO: Add your command handler code here
sim.Dsg(4);
}
void CMainFrame::OnUpdateMenuStepone(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnUpdateMenuNextbreak(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnMenuStepone()
{
/* // TODO: Add your command handler code here
CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//活动子窗口指针
CMDIChildWnd *nowchild = nowframe->MDIGetActive();
//获得当前项目信息的指针
struct ProjectList * curprobreak=NULL;
curprobreak=new ProjectList;
curprobreak=(ProjectList *)projectinfo.GetAt(0);
m_pfile=new FileList;
//项目中的文件数目
int n_filenumber=curprobreak->proinfstru.GetSize();
//声明文件节点
struct fileitem m_pcurnode;
for (int j=0;j<=n_filenumber-1;j++)
{
//取得文件节点信息的第j个项
m_pcurnode=fileitemarray[j];
//如果节点的窗口指针等于当前活动窗口指针
if(m_pcurnode.m_pchildf==nowchild)
break;
}
//获得活动窗口的文件信息
m_pfile=(FileList *)curprobreak->proinfstru.GetAt(j);
//声明断点信息结构指针
CompStruct * p_break;
p_break=new CompStruct;
int i_breaknum=m_pfile->compileinfstru.GetSize();
struct simulator::Breakpoint *p1,*p2;
p1=sim.BreakpointList;
for(int i=0;i<i_breaknum;i++)
{
p_break=(CompStruct*)m_pfile->compileinfstru.GetAt(i);
// sim.BreakpointList->value=p_break->n_breakline;
p2=new simulator::Breakpoint;
p2->value=p_break->n_breakline;
p2->next=NULL;
p1->next=p2;
sim.BreakpointList->value++;
}
*/
sim.Dsg(3);
}
void CMainFrame::OnMenuStepinto()
{
// TODO: Add your command handler code here
sim.Dsg(3);
}
void CMainFrame::OnUpdateMenuStepinto(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CMainFrame::OnMenuStepout()
{
// TODO: Add your command handler code here
sim.Dsg(3);
}
void CMainFrame::OnUpdateMenuStepout(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CMainFrame::OnMenuStepover()
{
sim.Dsg(3);
// TODO: Add your command handler code here
}
void CMainFrame::OnUpdateMenuStepover(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CMainFrame::OnMenuCursor()
{
// TODO: Add your command handler code here
sim.Dsg(1);
}
void CMainFrame::OnUpdateMenuCursor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnMenuRedibug()
{
// TODO: Add your command handler code here
// sim.FileInstruction.close();
// sim.FVarInfor.close();
// OnBuildStopGo();
// OnBuildGo();
sim.ReSimu();
}
void CMainFrame::OnUpdateMenuRedibug(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -