📄 win uwpflowview.cpp
字号:
string[strlen(string)]='\0';
strcpy(Options,&string[1]);
//set the textbox to the last commandline
m_wndToolBar->m_wndEdit.SetWindowText(Options);
m_wndToolBar->UpdateWindow();
OnExecuteRunuwpflow();
}
#ifdef WIN95
else if((string=strstr(Buffer,"tomatlab"))!=NULL ||
(string=strstr(Buffer,"Tomatlab"))!=NULL ||
(string=strstr(Buffer,"TOMATLAB"))!=NULL )
{
CustomPrint("%s",string);
string=strchr(string,' ');
string[strlen(string)-1]='\0';
strcpy(Options,&string[1]);
GetArguments(Options,"tomatlab");
if (spawnvp(P_NOWAIT,"tomatlab.bat",Argv)==-1) {
m_wndStatusBar->SetPaneText(0,"Problems with Tomatlab",true);
}
}
else if((string=strstr(Buffer,"maxim"))!=NULL ||
(string=strstr(Buffer,"Maxim"))!=NULL ||
(string=strstr(Buffer,"MAXIM"))!=NULL )
{
CustomPrint("%s",string);
string=strchr(string,' ');
string[strlen(string)-1]='\0';
strcpy(Options,&string[1]);
GetArguments(Options,"maxim");
if (spawnvp(P_NOWAIT,"maxim.exe",Argv)==-1) {
m_wndStatusBar->SetText(0,"Problems with Maxim",true);
}
}
else if((string=strstr(Buffer,"awk"))!=NULL ||
(string=strstr(Buffer,"Awk"))!=NULL ||
(string=strstr(Buffer,"AWK"))!=NULL )
{
CustomPrint("%s",string);
string=strchr(string,' ');
string[strlen(string)-1]='\0';
strcpy(Options,&string[1]);
GetArguments(Options,"awk");
if (spawnvp(P_WAIT,"awk.exe",Argv)==-1) {
m_wndStatusBar->->SetPaneText(0,"Problems with Awk",true);
}
}
else if((string=strstr(Buffer,".bat"))!=NULL ||
(string=strstr(Buffer,".Bat"))!=NULL ||
(string=strstr(Buffer,".BAT"))!=NULL )
{
CustomPrint("%s",Buffer);
string=strchr(string,' ');
string[strlen(string)-1]='\0';
strcpy(Options,&string[1]);
GetArguments(Options,"BATCH");
for (i=0; i<strlen(Buffer); i++) {
if (Buffer[i]!='.') string[i]=Buffer[i];
else { string[i]='\0'; break; }
}
if (spawnvp(P_WAIT,string,Argv)==-1) {
m_wndStatusBar->SetPaneText(0,"Problems with Batch file",true);
}
}
#endif
else CustomPrint("%s",Buffer);
}
}
CustomPrint("\nEND of batch/script file\n");
UpdateWindow();
ResetScroll();
Invalidate();
fclose(InputFile);
m_wndStatusBar->SetPaneText(0,"Ready", true);
}
}
//save file when right mouse button is pressed
void CWinUWPflowView::OnRButtonDown(UINT nFlags, CPoint point)
{
myDoc->mouseSave();
}
//overwrite default right button click event with nothing
//(otherwise a pop up menu will appear)
void CWinUWPflowView::OnRButtonDblClk(UINT nFlags, CPoint point)
{
//nothing
}
//keyboard events
void CWinUWPflowView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
//run commandline when enter is pressed
if (nChar == VK_RETURN)
OnExecuteRunuwpflow();
CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}
//open a file with notepad notepad
void CWinUWPflowView::OnFileEdit()
{
CString filename;
CFileDialog OpenFileDlg (TRUE, "wsc", "*.wsc",
OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, "WSCC Files (*.wsc)|*.wsc|IEEE Files (*.cf)|*.cf|All Files (*.*)|*.*||", this);
//set it to the correct default directory
OpenFileDlg.m_ofn.lpstrInitialDir=dir.GetBuffer(dir.GetLength());
if(OpenFileDlg.DoModal() == IDOK)
{
//get the file name
filename = OpenFileDlg.GetPathName();
//open that file with notepad
filename.Insert(0,"notepad.exe ");
if (WinExec(filename,SW_NORMAL)==(0|ERROR_BAD_FORMAT|ERROR_FILE_NOT_FOUND|ERROR_PATH_NOT_FOUND))
m_wndStatusBar->SetPaneText(0,"Problems with opening the file", true);
}
}
//Size changes
void CWinUWPflowView::OnViewSize10()
{
wordHeight=10;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize12()
{
wordHeight=12;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize13()
{
wordHeight=13;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize14()
{
wordHeight=14;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize15()
{
wordHeight=15;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize16()
{
wordHeight=16;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize17()
{
wordHeight=17;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize18()
{
wordHeight=18;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//OnDraw(
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize19()
{
wordHeight=19;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize20()
{
wordHeight=20;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
void CWinUWPflowView::OnViewSize11()
{
wordHeight=11;
//update font
MyFont.DeleteObject();
MyFont.CreateFont(wordHeight,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
FIXED_PITCH|FF_DONTCARE,0);
//update screen
OnPaint();
UpdateWindow();
ResetScroll();
Invalidate();
}
//whether or not to show the graph
void CWinUWPflowView::OnOptionsShowgraph()
{
GraphDlg->ShowWindow(SW_SHOW);
}
//checks if escap key is pressed (indicating that the program should stop)
BOOL CWinUWPflowView::Stop()
{
MSG msg;
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
if (msg.wParam==VK_ESCAPE) {
CustomPrint("\nWARNING: Case interrupted by user. Some files might\n");
CustomPrint(" still be open; this could cause some problems.\n");
Invalidate();
UpdateWindow();
return TRUE;
} else return FALSE;
}
return FALSE;
}
//change the current directory
void CWinUWPflowView::OnFileChangedirectory()
{
CString strDirectory;
LPMALLOC pMalloc;
//set up BROWSEINFO struct for the ShBrowseForFolder dialog box
BROWSEINFO bi;
//Gets the Shell's default allocator (260)
char buf[MAX_PATH];
LPITEMIDLIST pidl;
// Get help on BROWSEINFO struct - it's got all the bit settings.
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = NULL;
bi.lpszTitle = _T("Change Directory");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if (::SHGetMalloc(&pMalloc) == NOERROR)
{
if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if (::SHGetPathFromIDList(pidl, buf))
{
dir.Empty();
dir.Insert(0,buf);
if (dir.Right(1) != "\\")
dir.Insert(dir.GetLength(),"\\");
}
pMalloc->Free(pidl);
}
pMalloc->Release();
}
}
void CWinUWPflowView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
{
// TODO: Add your specialized code here and/or call the base class
CScrollView::OnActivateView(bActivate, pActivateView, pDeactiveView);
UpdateWindow();
ResetScroll();
Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -