本文整理汇总了C++中CString::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Right方法的具体用法?C++ CString::Right怎么用?C++ CString::Right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::Right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
//.........这里部分代码省略.........
if (nIndex != -1 || bWithInComment)
{
if( nIndex == -1 )
{
nIndex = 0;
}
pomDC -> SetTextColor(DIALOG_COLOR);
// if comment is in betn the line,
// get uncommented chars
CString omStrTemp =
omStr.Left( nIndex );
// set uncommented char to blue
pomDC -> SetTextColor(BLUE_COLOR);
pomDC -> TextOut(DEFAULT_X_POS,
(m_nCharHeight * (lInt+INCR_LEN)),
acSourceLineNo);
pomDC -> TabbedTextOut(
( nMargin) * m_nCharWidth,
(m_nCharHeight * (lInt+INCR_LEN)),
omStrTemp,
TAB_POSITION,
&nTabStopPositions,
TAB_ORIGIN);
nMargin += nIndex;
// Get commented text and set different color
pomDC -> SetTextColor(DIALOG_COLOR);
omStrTemp =
omStr.Right( omStr.GetLength() - (nIndex));
nIndex = omStrTemp.Find( "*/" );
omStr = "";
if ( nIndex != -1 )
{
// Set the comment flag to true
bWithInComment = FALSE;
omStr = omStrTemp.Right(
omStrTemp.GetLength() - (nIndex+2));
omStrTemp = omStrTemp.Left( nIndex+2 );
}
else
{
// Reset the comment flag
bWithInComment = TRUE;
}
pomDC -> TextOut(DEFAULT_X_POS,
(m_nCharHeight * (lInt+INCR_LEN)),
acSourceLineNo);
pomDC -> TabbedTextOut(
( nMargin) * m_nCharWidth,
(m_nCharHeight * (lInt+INCR_LEN)),
omStrTemp,
TAB_POSITION,
&nTabStopPositions,
TAB_ORIGIN);
nMargin += nIndex+2;
pomDC -> SetTextColor(BLUE_COLOR);
}
//else
示例2: make_project
bool CWizard::make_project()
{
wizard.AddSymbol(info.ar_app[info.nAppType],true);
wizard.AddSymbol("WINX_USE_CPP_FILES",info.bCppFiles);
wizard.AddSymbol("WINX_USE_MENUBAR", info.bMenuBar);
wizard.AddSymbol("WINX_USE_REBAR",info.bReBar);
wizard.AddSymbol("WINX_USE_CMDBAR",info.bCmdBar);
wizard.AddSymbol("WINX_USE_TOOLBAR",info.bToolBar);
wizard.AddSymbol("WINX_USE_STATUSBAR",info.bStatusBar);
wizard.AddSymbol("WINX_ENABLE_AX",info.bEnableActiveX);
wizard.AddSymbol("WINX_USE_MANIFEST",info.bManifest);
wizard.AddSymbol("WINX_HOST_AX",info.bHostActiveX);
wizard.AddSymbol("WINX_USE_UNICODE",info.bUnicode);
wizard.AddSymbol("WINX_USE_VIEW",info.bUseView);
wizard.AddSymbol("PROJECT_LANG_"+info.ar_lang[info.nAppLang],true);
wizard.AddSymbol("WINX_USE_GDIPLUS",info.bGdiPlus);
wizard.AddSymbol("WINX_USE_ACCEL",info.bAccel);
wizard.AddSymbol("WINX_USE_DDX",info.bDDX);
wizard.AddSymbol("WINX_USE_DEFSDK",info.bDefSDK);
if (info.bFrameDialog == false)
{
wizard.AddSymbol("WINX_USE_LOOKNFEEL",info.bLookNFeel);
}
wizard.AddSymbol("WINX_APPTYPE_DLG_FRAME",info.bFrameDialog);
wizard.AddSymbol("WINX_USE_ADDVFCFILES",info.bAddVFCFiles);
wizard.AddSymbol("PROJECT_NAME",info.strProjectName);
wizard.AddSymbol("PROJECT_PATH",info.strProjectPath);
wizard.AddSymbol("PROJECT_ENCODE","Windows-1252");
wizard.AddSymbol("PROJECT_GUID",wizard.make_guid());
wizard.AddSymbol("WINX_MAINDLG_CLASS","CMainDlg");
wizard.AddSymbol("WINX_MAINDLG_FILE","MainDlg");
if (info.nViewType == 6)
{
info.bEnableActiveX = true;
}
if (info.nAppType == 0)
{
if (info.bEnableActiveX)
wizard.AddSymbol("WINX_MAINDLG_BASE_CLASS","winx::AxModelDialog");
else
wizard.AddSymbol("WINX_MAINDLG_BASE_CLASS","winx::ModelDialog");
}
else if (info.nAppType == 1)
{
if (info.bEnableActiveX)
wizard.AddSymbol("WINX_MAINDLG_BASE_CLASS","winx::AxModelessDialog");
else
wizard.AddSymbol("WINX_MAINDLG_BASE_CLASS","winx::ModelessDialog");
}
if (info.bVS60)
wizard.AddSymbol("PROJECT_VS60",true);
if (info.bVS2002)
wizard.AddSymbol("PROJECT_VS2002",true);
if (info.bVS2003)
wizard.AddSymbol("PROJECT_VS2003",true);
if (info.bVS2005)
wizard.AddSymbol("PROJECT_VS2005",true);
if (info.bVS2008)
wizard.AddSymbol("PROJECT_VS2008",true);
if ( (info.bVS2005 || info.bVS2008) && info.bManifest)
{
wizard.AddSymbol("WINX_USE_EMBEDDED_MANIFEST", true);
if (!info.bVS60 && !info.bVS2002 && !info.bVS2003)
wizard.AddSymbol("WINX_USE_MANIFEST", false);
}
if (info.bVCExpress)
{
wizard.AddSymbol("WTL_USE_SDK_ATL3", true);
}
// Create symbols based on the project name
CString strSafeProjectName = CreateSafeName(info.strProjectName);
wizard.AddSymbol("SAFE_PROJECT_NAME", strSafeProjectName);
CString tmp = strSafeProjectName.Left(1);
tmp.MakeUpper();
tmp += strSafeProjectName.Right(strSafeProjectName.GetLength()-1);
wizard.AddSymbol("NICE_SAFE_PROJECT_NAME", tmp);
tmp.MakeUpper();
wizard.AddSymbol("UPPERCASE_SAFE_PROJECT_NAME", tmp);
// Set current year symbol
SYSTEMTIME st = {0};
::GetLocalTime(&st);
if(st.wYear >= 2003)
{
tmp.Format(_T("%d"),st.wYear);
wizard.AddSymbol("WTL_CURRENT_YEAR", tmp);
}
// Set view symbols
if(wizard.FindSymbol("WINX_USE_VIEW"))
{
//.........这里部分代码省略.........
示例3: _tmain
int _tmain()
{
BOOL videoFindFlag;
CFileFind videoFileFind;
const bool b_recordVide = false; //Record the color, depth, skeleton or not.
CString label[18]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'};
for (int l=0; l<18; l++)
{
CString folderName;
folderName.Format("..\\output\\%02d", l);
mkdir(folderName);
CString fileFolderName;
fileFolderName.Format("E:\\handShapeData\\%s\\*.oni", label[l]);
videoFindFlag = TRUE;
videoFindFlag = videoFileFind.FindFile(fileFolderName);
int nSample = 0;
while(videoFindFlag)
{
// Find the sign video
videoFindFlag = videoFileFind.FindNextFile();
CString videoFileName = videoFileFind.GetFilePath();
Readvideo myReadVideo;
CString personID = videoFileName.Right(24).Left(2);
// Initial the video recording
VideoWriter writer_depth;
VideoWriter writer_skeleton;
if (b_recordVide)
{
CString addName = videoFileName.Right(25).Left(10);
string depthName = "..\\data\\" + addName + "_depth.avi";
string skeletonName = "..\\data\\" + addName + "_skeleton.avi";
CString colorName;
colorName.Format("..\\data\\%s_color.avi", addName);
writer_depth.open(depthName, CV_FOURCC('D', 'I', 'V', 'X'), 25.0, Size(r_width, r_heigth));
writer_skeleton.open(skeletonName, CV_FOURCC('D', 'I', 'V', 'X'), 25.0, Size(r_width, r_heigth));
CString colorOriName;
colorOriName.Format("%s\\color.avi",videoFileName);
CopyFile(colorOriName,colorName,TRUE);
}
// Read the sign video
string s = (LPCTSTR)videoFileName;
myReadVideo.readvideo(s);
int frameSize = myReadVideo.vColorData.size();
cvNamedWindow("color_skeleton",1);
cout<<"The total frame is: "<<frameSize<<endl;
// Process each frame
for (int i=0; i<frameSize; i++)
{
// File name of images to be saved.
CString fileName;
fileName.Format("..\\output\\%02d\\c%02d_p%s_%05d_color.jpg", l, l, personID, nSample);
CString fileName_depth;
fileName_depth.Format("..\\output\\%02d\\c%02d_p%s_%05d_depth.jpg", l, l, personID, nSample);
nSample++;
// color and depth images to be saved.
IplImage* showImage;
IplImage* showImage_depth;
// Make color frame as the showImage
showImage = myReadVideo.vColorData[i];
// Make depth frame as the showImage
Mat depthMat = myReadVideo.retrieveGrayDepth(myReadVideo.vDepthData[i]);
IplImage* depthImage = &(IplImage)depthMat;
showImage_depth = cvCreateImage(cvGetSize(depthImage), 8, 1);
for (int rows=0; rows<depthImage->height; rows++)
{
uchar* src_ptr = (uchar*)(depthImage->imageData + rows*depthImage->widthStep);
uchar* des_ptr = (uchar*)(showImage_depth->imageData + rows*showImage_depth->widthStep);
for (int cols=0; cols<depthImage->width; cols++)
{
if (src_ptr[3*cols] < 1)
{
des_ptr[cols] = 255;
}
else
{
des_ptr[cols] = src_ptr[3*cols];
}
}
}
//----------------------------------------
//Record the sign postures
CvRect hand_rect;
int len_box = 64;
hand_rect.x = myReadVideo.vSkeletonData[i]._2dPoint[11].x - len_box/2;
hand_rect.y = myReadVideo.vSkeletonData[i]._2dPoint[11].y - len_box/2;
hand_rect.height = len_box;
hand_rect.width = len_box;
cvSetImageROI(showImage, hand_rect);
cvSaveImage(fileName, showImage);
cvResetImageROI(showImage);
//.........这里部分代码省略.........
示例4: GetInput
char CMagneticView::GetInput(bool& done, bool trans)
{
static const int MAX_HISTORY = 20;
done = true;
CMagneticApp* pApp = (CMagneticApp*)AfxGetApp();
CMagneticView* pView = CMagneticView::GetView();
if (pView == NULL)
return 0;
int cInput = 0; // Input character
int iPosition = 0; // Current cursor position
int iHistory = -1; // Current history position
static CString strFullLine;
// Input line already obtained?
if (strFullLine.GetLength() > 0)
{
cInput = strFullLine[0];
strFullLine = strFullLine.Right(strFullLine.GetLength()-1);
if (cInput == (signed char)(CMagneticView::SPECIAL_KEYS + VK_SPACE))
cInput = ' ';
return (char)cInput;
}
if (pView->m_bMorePrompt)
pView->m_PageTable.RemoveAt(pView->m_PageTable.GetSize()-1);
else
pView->m_PageTable.RemoveAll();
// Refresh the view
pView->Invalidate();
pView->CaretOn();
pView->m_bInputActive = true;
while (cInput != 10 && cInput != 1)
{
pView = CMagneticView::GetView();
if (pView == NULL)
break;
// Wait for a character
CArray<int, int>& Input = pView->m_Input;
if (Input.GetSize() == 0)
{
pApp->PumpMessage();
pApp->CWinApp::OnIdle(0); // Call base class OnIdle();
pView = CMagneticView::GetView();
if (pView)
{
CMagneticApp::Redraw Status = pApp->GetRedrawStatus();
switch (Status)
{
case CMagneticApp::Redraw::EndPlayback:
done = false; // intentional fall-through
case CMagneticApp::Redraw::EndLine:
case CMagneticApp::Redraw::EndOpcode:
Input.RemoveAll();
strFullLine.Empty();
if (Status == CMagneticApp::Redraw::EndOpcode)
cInput = 1;
else
cInput = 10; // intentional fall-through
case CMagneticApp::Redraw::ThisLine:
pView->CaretOff();
pView->CaretOn();
pView->Invalidate();
break;
}
pView->SetCursorPos(pView->m_pTextDC,strFullLine.GetLength()-iPosition);
}
}
else
{
cInput = (pView->m_bMorePrompt) ? 10 : Input[0];
Input.RemoveAt(0);
int iInsertPos, iRemovePos;
switch (cInput)
{
case 10: // Return
strFullLine += (char)cInput;
break;
case CMagneticView::SPECIAL_KEYS + VK_LEFT: // Cursor left
if (iPosition > 0)
iPosition--;
break;
case CMagneticView::SPECIAL_KEYS + VK_RIGHT: // Cursor right
if (iPosition < strFullLine.GetLength())
iPosition++;
break;
case CMagneticView::SPECIAL_KEYS + VK_HOME: // Home
iPosition = 0;
break;
case CMagneticView::SPECIAL_KEYS + VK_END: // End
iPosition = strFullLine.GetLength();
break;
case CMagneticView::SPECIAL_KEYS + VK_DELETE: // Delete
if (iPosition < strFullLine.GetLength())
{
//.........这里部分代码省略.........
示例5: SelectTreeViewFolder
//------------------------------------------------
// 파일의 리스트 및 각 파일에 대한 자세한 정보를
// 함께 저장하게 됨
// data.h파일에 해당 구조체를 선언한다.
//--------------------------------------------------
void CMyExplorerDoc::SelectTreeViewFolder(CString strFullName)
{
LIST_VIEW* pListView;
CFileFind ff;
// 사용자가 폴더를 선택할 때마다 파일 리스트를
// 새로 업데이트 해야 함
// 따라서 기존 정보를 모두 삭제한다.
if (m_pFileList != NULL)
RemoveAllFileList();
m_pFileList = new CObList;
SetCurrentPath(strFullName);
strFullName += "*.*";
if (ff.FindFile(strFullName) == TRUE)
{
BOOL bFlag = TRUE;
while(bFlag == TRUE)
{
bFlag = ff.FindNextFile();
// 디렉토리 , 도트파일이면 다시 찾음
if (ff.IsDirectory() || ff.IsDots())
continue;
// 파일 정보를 알아내서LIST_VIEW 구조체에
// 저장한 후
// 그것을 모두 m_pFileList에 저장한다.
pListView = new LIST_VIEW;
InitListViewStruct(pListView);
pListView->strName = ff.GetFileName();
pListView->strPath = ff.GetFilePath();
CString strName = pListView->strName;
CString strExt = ff.GetFileTitle();
int nNum = strName.GetLength() - strExt.GetLength();
if (nNum == 0)
strExt = "";
else
strExt = strName.Right(nNum - 1);
pListView->strKind = strExt + " 파일";
pListView->dwFileSize = ff.GetLength();
CTime time;
if (ff.GetCreationTime(time) == TRUE)
pListView->tCreateTime = time;
if (ff.GetLastAccessTime(time) == TRUE)
pListView->tLastAccessTime = time;
if (ff.GetLastWriteTime(time) == TRUE)
pListView->tLastWriteTime = time;
if (ff.IsHidden() == TRUE)
pListView->bIsHidden = TRUE;
if (ff.IsReadOnly() == TRUE)
pListView->bIsReadOnly = TRUE;
if (ff.IsArchived() == TRUE)
pListView->bIsArchived = TRUE;
if (ff.IsSystem() == TRUE)
pListView->bIsSystem = TRUE;
m_pFileList->AddTail((CObject*)pListView);
}
}
ff.Close();
//------------------------------
m_pExpListView->SetFileList();
//-------------------------------------
}
示例6: SplitPath
void CTokenEx::SplitPath (BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext)
{
int nSecond;
// Look for a UNC Name!
if (Path.Left(2) == "\\\\") {
// find the first '\' after the first two '\\'
int nFirst = Path.Find("\\",3);
// find the second '\' after the first one found
nSecond = Path.Find("\\",nFirst + 1);
// if the second does NOT exist
if (nSecond == -1) {
// add the 'Path' var to the 'Drive' var
// because the passed var is just a UNC share
// i.e.: '\\Server\Share'
Drive = Path;
// set ALL others to empty
Dir = "";
FName = "";
Ext = "";
}
else if (nSecond > nFirst) {
// set the 'Drive' var with the correct info
// i.e.: '\\Server\Share'
Drive = Path.Left(nSecond);
}
}
else {
// Look for normal Drive Structure (C:\Dir\File.name)
nSecond = 2;
Drive = Path.Left(2);
}
// check if we are looking for directory or file
if (UsingDirsOnly) {
// load the correct information in the 'Dir' var
Dir = Path.Right((Path.GetLength() - nSecond) - 1);
// set ALL others to empty
FName = "";
Ext = "";
}
else { // this means we have a filename structure
// first find the the '\' (in reverse)
int nDirEnd = Path.ReverseFind('\\');
if (nDirEnd == Path.GetLength()) {
// if we are here, this means that
// 'C:\' was passed, so
// set ALL to empty
Dir = "";
FName = "";
Ext = "";
}
else {
// set the 'Dir' var with directory info
Dir = Path.Mid(nSecond + 1, (nDirEnd - nSecond) - 1);
// breakdown the filename
//
// look for a period '.'
int nFileEnd = Path.ReverseFind('.');
// if it doesn't exist
if (nFileEnd != -1) {
if (nDirEnd > nFileEnd) {
// this would also mean no file extension found
FName = Path.Right(Path.GetLength() - nDirEnd);
Ext = "";
}
else {
// fill vars with info
FName = Path.Mid(nDirEnd + 1, (nFileEnd - nDirEnd) - 1);
Ext = Path.Right((Path.GetLength() - nFileEnd) - 1);
}
}
else {
// this means filename w/o extention
FName = Path.Right((Path.GetLength() - nDirEnd) - 1);
Ext = "";
}
}
}
}
示例7: CreateShortcut
//---------------------------------------------------------------------------
// ◎함수명 : CreateShortcut
// ◎함수설명 : 바로가기를 만든다
// ◎인자
// strPathLink : 생성될 바로가기 파일의 경로와 이름
// strObjPath : 실행할 오브젝트
// strArgs : 실행시 인자
// strIcon : 사용될 아이콘 리소스 지정 (EXE, ICO 등)
// strDesc : 마우스가 올라갈때 나타나는 툴팁
// ◎반환값 : 성공시 TRUE, 실패시 FALSE
//---------------------------------------------------------------------------
BOOL COutputDialog::CreateShortcut(LPCTSTR strShortcutPath, LPCTSTR strObjPath, LPCTSTR strArgs, LPCTSTR strWorkingDir, LPCTSTR strIconPath, LPCTSTR strDesc)
{
BOOL bRetVal = FALSE;
HRESULT hres = 0;
IShellLink* psl = NULL;
IPersistFile* ppf = NULL;
//CString strMyPath = strPathLink;
try
{
CString strTmpDir = _T("");
if(NULL == strShortcutPath || NULL == strObjPath
|| _T('\0') == strShortcutPath[0] || _T('\0') == strObjPath[0]) throw _T("파일 위치 지정이 잘못되었습니다.");
if(NULL == strIconPath || _T('\0') == strIconPath) strIconPath = strObjPath;
if(NULL == strWorkingDir || _T('\0') == strWorkingDir)
{
strTmpDir = strObjPath;
int nIdx = strTmpDir.ReverseFind('\\');
if(nIdx > 0) strTmpDir = strTmpDir.Left(nIdx);
else strTmpDir = _T("");
}
else
{
strTmpDir = strWorkingDir;
}
::CoInitialize(NULL);
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl);
if (FAILED(hres)) throw _T("ShellLink 객체를 생성할 수 없습니다.");
psl->SetPath(strObjPath);
psl->SetIconLocation(strIconPath, 0);
psl->SetWorkingDirectory(strTmpDir);
if(strArgs && strArgs[0]) psl->SetArguments(strArgs);
if(strDesc && strDesc[0]) psl->SetDescription(strDesc);
hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf);
if (FAILED(hres)) throw _T("IPersistFile 인터페이스를 얻어올 수 없습니다.");
// 확장자를 검사하여 붙여줌
CString strMyPath = strShortcutPath;
if(strMyPath.Right(4).CompareNoCase(_T(".lnk"))) strMyPath += _T(".lnk");
#ifdef UNICODE
LPCWSTR wsz = (LPCWSTR)strMyPath;
#else
wchar_t wsz[MAX_PATH] = {0,};
MyMultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR)strMyPath, -1, wsz, MAX_PATH);
#endif
// 생성
DeleteFile(wsz);
hres = ppf->Save(wsz, TRUE);
if (hres != S_OK ) throw _T("IPersistFile->Save() 에러");
bRetVal = TRUE;
}
catch (LPCTSTR cszErr)
{
cszErr = cszErr;
bRetVal = FALSE;
}
if(ppf) ppf->Release();
if(psl) psl->Release();
return bRetVal;
}
示例8: AdjustLegend
void CLegendDisplay::AdjustLegend(LPCTSTR lpFilename)
{
CString strTmp;
int index;
char str2[255];
GetPrivateProfileString("ͼÀý","ÍÁ²ã±àºÅ","",str2,255,lpFilename);
strTmp = str2;
CString strLayerNo;
CString strSubLayerNo;
int j = strTmp.Find("^");
if (j>0)
{
strLayerNo = strTmp.Left(j);
strSubLayerNo = strTmp.Right(strTmp.GetLength()-j-1);
}
else
{
strLayerNo = strTmp;
strSubLayerNo = "";
}
if (strLayerNo !="")
{
index = -1;
for(int i=0;i<m_pGraphics->m_Blocks.GetSize();i++)
{
CADBlock* pBlock=(CADBlock*)m_pGraphics->m_Blocks.GetAt(i);
if(_stricmp("ÍÁ²ã±àºÅ",pBlock->m_Name)==0)
index = i;
}
if (index>-1)
{
int k = 1;
CADBlock* pBlock=(CADBlock*)m_pGraphics->m_Blocks.GetAt(index);
for(int j=0;j<pBlock->m_Entities.GetSize();j++)
{
CADEntity* pEntity=(CADEntity*)pBlock->m_Entities.GetAt(j);
if (pEntity->GetType()==AD_ENT_MTEXT)
{
CADMText* pText = (CADMText*)pEntity;
if (k==1)
pText->m_Text = strLayerNo;
else
pText->m_Text = strSubLayerNo;
k++;
}
}
}
}
///////
GetPrivateProfileString("ͼÀý","±ê×¼¹áÈë","",str2,255,lpFilename);
strTmp = str2;
if (strTmp !="")
{
index = -1;
for(int i=0;i<m_pGraphics->m_Blocks.GetSize();i++)
{
CADBlock* pBlock=(CADBlock*)m_pGraphics->m_Blocks.GetAt(i);
if(_stricmp("±ê×¼¹áÈë",pBlock->m_Name)==0)
index = i;
}
if (index>-1)
{
CADBlock* pBlock=(CADBlock*)m_pGraphics->m_Blocks.GetAt(index);
for(int j=0;j<pBlock->m_Entities.GetSize();j++)
{
CADEntity* pEntity=(CADEntity*)pBlock->m_Entities.GetAt(j);
if (pEntity->GetType()==AD_ENT_MTEXT)
{//::AfxMessageBox(strTmp);
CADMText* pText = (CADMText*)pEntity;
//if (pText->m_Text=="8")
pText->m_Text = strTmp;
}
}
}
}
/////////
GetPrivateProfileString("ͼÀý","¿×ºÅ±ê¸ß","",str2,255,lpFilename);
strTmp = str2;
CString strUp;
CString strDown;
j = strTmp.Find("^");
if (j>0)
{
strUp = strTmp.Left(j);
strDown = strTmp.Right(strTmp.GetLength()-j-1);
}
else
{
strUp = strTmp;
strDown = "";
}
if (strUp !="")
{
//.........这里部分代码省略.........
示例9: OnDbClick
void COutWnd::OnDbClick()
{
INT nSelectIndex;
CString omStrSelectedItem;
nSelectIndex = m_omListBox.GetCurSel();
if(nSelectIndex!=LB_ERR )
{
CString omStrLineNumber = "";
INT nIndex = 0;
UINT unLineNumber = 0;
char* pcStopStr = nullptr;
m_omListBox.GetText(nSelectIndex,omStrSelectedItem);
CString omStrFilePath;
CString omStrFileName;
omStrFilePath=omStrSelectedItem;
while(!(nSelectIndex==0||omStrFilePath==defSTR_BUILD_TRACE_LINE_MARK))
{
--nSelectIndex;
m_omListBox.GetText(nSelectIndex,omStrFilePath);
}
if(omStrFilePath==defSTR_BUILD_TRACE_LINE_MARK)
{
++nSelectIndex;
m_omListBox.GetText(nSelectIndex,omStrFilePath);
int nNameIndex = omStrFilePath.ReverseFind('\\');
if(nNameIndex != -1)
{
//pGetBusSpecificFunctionEditorDoc(omStrFilePath);
CFunctionEditorDoc* pDoc = m_pGlobalObj->pGetDocPtrOfFile(omStrFilePath);
if (pDoc != nullptr)
{
//If file is opened then get its frame and activate it
{
POSITION pos = pDoc->GetFirstViewPosition();
if (pos)
{
pDoc->GetNextView(pos)->GetParentFrame()->ActivateFrame();
}
}
}
else
{
//If file is not opened then open it
if ( !m_pGlobalObj->bOpenFunctioneditorfile(omStrFilePath) )
{
AfxMessageBox("Specified filename not found!",
MB_OK|MB_ICONINFORMATION);
}
}
// Find the ':' to get the number after second ':'
nIndex = omStrSelectedItem.Find(":");
if(nIndex!=-1)
{
omStrLineNumber = omStrSelectedItem.Right(
omStrSelectedItem.GetLength()-nIndex-1);
nIndex = omStrLineNumber.Find(":");
omStrLineNumber = omStrLineNumber.Right(
omStrLineNumber.GetLength()-nIndex-1);
omStrLineNumber.TrimLeft();
omStrLineNumber.TrimRight();
omStrLineNumber = omStrLineNumber.SpanExcluding(":");
unLineNumber = _tcstol((LPCTSTR)omStrLineNumber,
&pcStopStr,10);
// Call this function only if the line number is valid
if(unLineNumber!=0)
{
CFileView* pFileView = m_pGlobalObj->podGetFileViewPtr();
if(pFileView != nullptr)
{
pFileView->vDisplayWarningLineNumber(OUTWND,unLineNumber);
}
}
}
else
{
nIndex = omStrSelectedItem.Find(":");
if(nIndex!=-1)
{
nIndex = omStrSelectedItem.Find(":");
omStrLineNumber = omStrSelectedItem.Right(
omStrSelectedItem.GetLength()-nIndex-1);
omStrLineNumber.TrimLeft();
omStrLineNumber.TrimRight();
omStrLineNumber = omStrLineNumber.
SpanExcluding("\t ");
unLineNumber = _tcstol((LPCTSTR)omStrLineNumber,
&pcStopStr,
10);
if(unLineNumber!=0)
{
CFileView* pFileView = m_pGlobalObj->podGetFileViewPtr();
if(nullptr != pFileView)
{
pFileView->vDisplayWarningLineNumber(OUTWND,
//.........这里部分代码省略.........
示例10: OnCbnEditchangeUrlcombo
void CCloneDlg::OnCbnEditchangeUrlcombo()
{
// do not update member variables from UI while saving
if (m_bSaving || m_bExactPath)
return;
this->UpdateData();
CString url;
m_URLCombo.GetWindowText(url);
url.Trim();
if(m_OldURL == url )
return;
m_OldURL=url;
//if(url.IsEmpty())
// return;
CString old;
old=m_ModuleName;
url.Replace(_T('\\'),_T('/'));
// add compatibility for Google Code git urls
url.TrimRight(L"/");
int start=url.ReverseFind(_T('/'));
if(start<0)
{
start = url.ReverseFind(_T(':'));
if(start <0)
start = url.ReverseFind(_T('@'));
if(start<0)
start = 0;
}
CString temp;
temp=url.Mid(start+1);
temp=temp.MakeLower();
// we've to check whether the URL ends with .git (instead of using the first .git)
int end = temp.Right(4) == _T(".git") ? (temp.GetLength() - 4) : temp.GetLength();
//CString modulename;
m_ModuleName=url.Mid(start+1,end);
start = m_Directory.ReverseFind(_T('\\'));
if(start <0 )
start = m_Directory.ReverseFind(_T('/'));
if(start <0 )
start =0;
int dirstart=m_Directory.Find(old,start);
if(dirstart>=0 && (dirstart+old.GetLength() == m_Directory.GetLength()) )
m_Directory=m_Directory.Left(dirstart);
m_Directory.TrimRight(L"\\/");
m_Directory += _T('\\');
m_Directory += m_ModuleName;
// check if URL starts with http://, https:// or git:// in those cases loading putty keys is only
// asking for passwords for keys that are never used
if (url.Find(L"http://", 0) >= 0 || url.Find(L"https://", 0) >= 0 || url.Find(L"git://", 0) >= 0)
m_bAutoloadPuttyKeyFile = false;
else
m_bAutoloadPuttyKeyFile = m_regUseSSHKey && CAppUtils::IsSSHPutty();
this->UpdateData(FALSE);
}
示例11: CreateLegend
void CLegendDisplay::CreateLegend(const char* legendName,double legendLeft,double legendTop)
{
//check special legend---------------------
short curLayerIndex = m_pLayerGroup->indexOf("0");
CADPolyline* pPolyline;
ADPOINT* pPoint;
pPolyline=new CADPolyline();
m_pGraphics->m_Entities.Add((CObject*)pPolyline);
pPolyline->m_nLayer = curLayerIndex;
pPolyline->m_Closed=true;
pPolyline->m_nLineWidth=1;
pPoint=new ADPOINT();
pPoint->x = legendLeft;
pPoint->y = legendTop;
pPolyline->m_Point.Add((CObject*)pPoint);
pPoint=new ADPOINT();
pPoint->x = legendLeft+m_LegendWidth;
pPoint->y = legendTop;
pPolyline->m_Point.Add((CObject*)pPoint);
pPoint=new ADPOINT();
pPoint->x = legendLeft+m_LegendWidth;
pPoint->y = legendTop-m_LegendHeight;
pPolyline->m_Point.Add((CObject*)pPoint);
pPoint=new ADPOINT();
pPoint->x = legendLeft;
pPoint->y = legendTop-m_LegendHeight;
pPolyline->m_Point.Add((CObject*)pPoint);
CADHatch* pHatch=new CADHatch();
m_pGraphics->m_Entities.Add((CObject*)pHatch);
pHatch->m_Scale = 10.0;
pHatch->m_nLayer = curLayerIndex;
pHatch->m_pPolyline=pPolyline;
//update
//strcpy(pHatch->m_Name,legendName);
CString strTmp;
CString strCN,strEN;
strTmp = legendName;
int j = strTmp.Find(m_SplitChar);
if (j>0)
{
strCN = strTmp.Left(j);
strEN = strTmp.Right(strTmp.GetLength()-j-1);
}
else
{
strCN = strTmp;
}
strcpy(pHatch->m_Name,strCN);
//check special legend---------------------
short SpecialLegendCount = 5;
char SpecialLegendChar[] = {'f','x','z','c','l'};
int legendCharIndex = -1;
if (strcmp(strCN,"·ÛÉ°")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 0;
}
else if (strcmp(strCN,"·Ûϸɰ")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 0;
}
else if (strcmp(strCN,"·ÛÉ°¼Ðϸɰ")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 0;
}
//updated on 20070207
else if (strcmp(strCN,"·ÛÉ°¼Ð·ÛÍÁ")==0)
{
strcpy(pHatch->m_Name,"º¬Õ³ÐÔÍÁ·ÛÉ°");
legendCharIndex = 0;
}
//added on 20070207
else if (strcmp(strCN,"·ÛÉ°¼ÐÑÇÉ°ÍÁ")==0)
{
strcpy(pHatch->m_Name,"º¬Õ³ÐÔÍÁ·ÛÉ°");
legendCharIndex = 0;
}
else if (strcmp(strCN,"ϸɰ")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 1;
}
else if (strcmp(strCN,"ÖÐÉ°")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 2;
}
else if (strcmp(strCN,"ÖÐϸɰ")==0)
{
strcpy(pHatch->m_Name,"É°");
legendCharIndex = 2;
}
//.........这里部分代码省略.........
示例12: FileOpenSave
bool CCommonAppUtils::FileOpenSave(CString& path, int * filterindex, UINT title, UINT filter, bool bOpen, HWND hwndOwner, LPCTSTR defaultExt)
{
OPENFILENAME ofn = {0}; // common dialog box structure
TCHAR szFile[MAX_PATH] = {0}; // buffer for file name. Explorer can't handle paths longer than MAX_PATH.
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndOwner;
if (path.GetLength() >= MAX_PATH)
{
CString dir = path;
while (true)
{
int index = dir.ReverseFind(_T('\\'));
if (index < 0)
break;
dir = dir.Left(index);
if (PathFileExists(dir))
break;
}
GetShortPathName(dir, szFile, MAX_PATH);
CString remain = path.Right(path.GetLength() - dir.GetLength());
_tcscat_s(szFile, MAX_PATH, remain);
}
else
_tcscpy_s(szFile, MAX_PATH, (LPCTSTR)path);
ofn.lpstrFile = szFile;
ofn.nMaxFile = _countof(szFile);
CSelectFileFilter fileFilter;
if (filter)
{
fileFilter.Load(filter);
ofn.lpstrFilter = fileFilter;
}
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrDefExt = defaultExt;
CString temp;
if (title)
{
temp.LoadString(title);
CStringUtils::RemoveAccelerators(temp);
}
ofn.lpstrTitle = temp;
if (bOpen)
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
else
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER;
// Display the Open dialog box.
bool bRet = false;
if (bOpen)
{
bRet = !!GetOpenFileName(&ofn);
}
else
{
bRet = !!GetSaveFileName(&ofn);
}
SetCurrentDirectory(sOrigCWD.GetBuffer());
sOrigCWD.ReleaseBuffer();
if (bRet)
{
path = CString(ofn.lpstrFile);
if (filterindex)
*filterindex = ofn.nFilterIndex;
return true;
}
return false;
}
示例13: bFormatFunctionPrototype
BOOL CSelectFunctions::bFormatFunctionPrototype(CString &omStrFunctionPrototype)
{
BOOL bReturn = TRUE;
CStringArray omStrArrayParaType;
CString omStrReturnType = "";
CString omStrFuncName = "";
if(m_omStrSelectedText.IsEmpty() == 0 )
{
CString omStrTemp = m_omStrSelectedText;
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() -
omStrTemp.Find(" ") - 1 );
omStrTemp.TrimLeft();
omStrTemp.TrimRight();
omStrReturnType = m_omStrSelectedText;
omStrReturnType.Replace(omStrTemp, "");
INT nIndex = 0;
nIndex = omStrTemp.Find("(");
omStrFuncName = omStrTemp.Left(nIndex);
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() - nIndex - 1);
omStrTemp = omStrTemp.Left( omStrTemp.Find(")"));
while(omStrTemp.IsEmpty() == 0)
{
nIndex = omStrTemp.Find(",");
if(nIndex != -1)
{
omStrArrayParaType.Add(omStrTemp.Left(nIndex));
}
else
{
omStrArrayParaType.Add(omStrTemp);
omStrTemp = "";
}
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() - nIndex - 1 );
}
omStrReturnType.TrimLeft();
omStrReturnType.TrimRight();
omStrFuncName.TrimLeft();
omStrFuncName.TrimRight();
if(omStrReturnType.CompareNoCase(_T("void")) !=0)
{
omStrFunctionPrototype = defTODO_FUNCTION_INSERT;
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += _T("/* ");
omStrFunctionPrototype += omStrReturnType;
omStrFunctionPrototype += _T(" ");
omStrFunctionPrototype += defRETURN_TYPE_NAME;
omStrFunctionPrototype += _T(" ;*/");
}
UINT unCount = (COMMANUINT)omStrArrayParaType.GetSize();
omStrFuncName += _T("(");
for(UINT i = 0; i<unCount ;i++)
{
omStrTemp = omStrArrayParaType.GetAt(i);
omStrTemp.TrimLeft();
omStrTemp.TrimRight();
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += "/* ";
omStrFunctionPrototype += omStrTemp;
omStrTemp = "";
omStrTemp.Format(defPARAMETER_NAME,i+1);
omStrFunctionPrototype += " ";
omStrFunctionPrototype +=omStrTemp;
omStrFunctionPrototype += " ;*/";
omStrFuncName +=omStrTemp;
if(i != unCount - 1 )
{
omStrFuncName += _T(",");
}
}
omStrFuncName += _T(")");
if(omStrReturnType.CompareNoCase(_T("void")) !=0)
{
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += defRETURN_TYPE_NAME;
omStrFunctionPrototype += _T(" = ");
}
omStrFunctionPrototype += omStrFuncName;
omStrFunctionPrototype += _T(";");
omStrFunctionPrototype += defNEW_LINE;
}
return bReturn;
}
示例14: GetFileNameByPath
CString CPicapDoc::GetFileNameByPath(CString path) const
{
return path.Right(path.GetLength() - path.ReverseFind(_T('\\')) - 1);
}
示例15: EnumFiles
int CCachedDirectory::EnumFiles(const CTGitPath &path , bool IsFull)
{
CString sProjectRoot;
path.HasAdminDir(&sProjectRoot);
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": EnumFiles %s\n"), path.GetWinPath());
ATLASSERT( !m_directoryPath.IsEmpty() );
CString sSubPath;
CString s = path.GetWinPath();
if (s.GetLength() > sProjectRoot.GetLength())
{
// skip initial slash if necessary
if(s[sProjectRoot.GetLength()] == _T('\\'))
sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() -1);
else
sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() );
}
// strip "\" at the end, otherwise cache lookups for drives do not work correctly
sProjectRoot.TrimRight(_T("\\"));
GitStatus *pStatus = &CGitStatusCache::Instance().m_GitStatus;
UNREFERENCED_PARAMETER(pStatus);
git_wc_status_kind status = git_wc_status_none;
if (!path.IsDirectory())
{
bool assumeValid = false;
bool skipWorktree = false;
pStatus->GetFileStatus(sProjectRoot, sSubPath, &status, IsFull, false, true, GetStatusCallback, this, &assumeValid, &skipWorktree);
if (status < m_mostImportantFileStatus)
RefreshMostImportant();
}
else
{
bool isSelf = path == m_directoryPath;
if (isSelf)
{
AutoLocker lock(m_critSec);
// clear subdirectory status cache
m_childDirectories.clear();
// build new files status cache
m_entryCache_tmp.clear();
}
m_mostImportantFileStatus = git_wc_status_none;
pStatus->EnumDirStatus(sProjectRoot, sSubPath, &status, IsFull, false, true, GetStatusCallback,this);
m_mostImportantFileStatus = GitStatus::GetMoreImportant(m_mostImportantFileStatus, status);
if (isSelf)
{
AutoLocker lock(m_critSec);
// use a tmp files status cache so that we can still use the old cached values
// for deciding whether we have to issue a shell notify
m_entryCache = m_entryCache_tmp;
m_entryCache_tmp.clear();
}
// need to set/construct m_ownStatus (only unversioned and normal are valid values)
m_ownStatus = git_wc_status_unversioned;
m_ownStatus.SetKind(git_node_dir);
if (m_mostImportantFileStatus > git_wc_status_unversioned)
{
git_wc_status2_t status2;
status2.text_status = status2.prop_status = git_wc_status_normal;
m_ownStatus.SetStatus(&status2);
}
else
{
if (::PathFileExists(m_directoryPath.GetWinPathString() + _T("\\.git"))) {
git_wc_status2_t status2;
status2.text_status = status2.prop_status = git_wc_status_normal;
m_ownStatus.SetStatus(&status2);
}
else
{
git_wc_status2_t status2;
status2.text_status = status2.prop_status = CalculateRecursiveStatus();
m_ownStatus.SetStatus(&status2);
}
}
}
return 0;
}