LRESULT CNewFolderDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	TRC(IDC_FOLDERNAMELABEL, "Название папки/альбома:");
	TRC(IDC_FOLDERDESCRLABEL, "Описание:");
	TRC(IDC_ACCESSTYPELABEL, "Доступ:");
	TRC(IDCANCEL, "Отмена");
	TRC(IDOK, "OK");
	
	
	DlgResize_Init();
	CenterWindow(GetParent());
	if(m_bCreateNewFolder)
		SetWindowText(TR("Новая папка (альбом)"));
	else
		SetWindowText(TR("Редактирование папки"));
	SetDlgItemText(IDC_FOLDERTITLEEDIT, Utf8ToWCstring(m_folder.title));
	CString text = Utf8ToWCstring(m_folder.summary);
	text.Replace(_T("\r"), _T(""));
	text.Replace(_T("\n"), _T("\r\n"));
	SetDlgItemText(IDC_FOLDERDESCREDIT, text);
	for(size_t i=0; i< m_accessTypeList.size(); i++)
	{
		SendDlgItemMessage(IDC_ACCESSTYPECOMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR)Utf8ToWCstring(m_accessTypeList[i].c_str()));
	}
	SendDlgItemMessage(IDC_ACCESSTYPECOMBO, CB_SETCURSEL, m_folder.accessType);
	
	::SetFocus(GetDlgItem(IDC_FOLDERTITLEEDIT));
	return 0;  // Let the system set the focus
}
void CEditPropExternalsValue::OnBnClickedBrowse()
{
    SVNRev rev = SVNRev::REV_HEAD;
    CAppUtils::BrowseRepository(m_URLCombo, this, rev, false, m_RepoRoot.GetSVNPathString(), m_URL.GetSVNPathString());

    // if possible, create a repository-root relative url
    CString strURLs;
    m_URLCombo.GetWindowText(strURLs);
    if (strURLs.IsEmpty())
        strURLs = m_URLCombo.GetString();
    strURLs.Replace('\\', '/');
    strURLs.Replace(L"%", L"%25");

    CString root = m_RepoRoot.GetSVNPathString();
    int rootlength = root.GetLength();
    if (strURLs.Left(rootlength).Compare(root)==0)
    {
        if ((strURLs.GetLength() > rootlength) && (strURLs.GetAt(rootlength) == '/'))
        {
            strURLs = L"^/" + strURLs.Mid(rootlength);
            strURLs.Replace(L"^//", L"^/");
            m_URLCombo.SetWindowText(strURLs);
        }
    }
}
Example #3
0
fsInternetResult fsMirrorURLsMgr::SearchForMirrors()
{
    fsInternetResult ir;

    CString strURL = m_strSearchURL;

    strURL.Replace ("%file%", m_strFile);

    if (m_uSize != _UI64_MAX)
    {
        CString strSize;
        strSize.Format ("%I64u", m_uSize);
        strURL.Replace ("%size%", strSize);
    }
    else
        strURL.Replace ("%size%", "");

    m_bAbort = FALSE;

    ir = m_dldr.Download (strURL);
    if (ir != IR_SUCCESS)
        return ir;

    return OnSearchScriptResultsReceived ();
}
CString CPdbHelper::GetImageID(HMODULE hModule)
{
	WCHAR wszFileName[MAX_PATH] = {0};
	GetModuleFileNameW( hModule, wszFileName, MAX_PATH);

	SYMSRV_INDEX_INFO tIndexInfo = {0};
	tIndexInfo.sizeofstruct = sizeof(tIndexInfo);
	BOOL bRet = s_pfnSymSrvGetFileIndexInfoW( wszFileName, &tIndexInfo, 0);

	CString strGuid;
	if( bRet )
	{
		LPOLESTR pGuid;
		HRESULT hr = StringFromCLSID( tIndexInfo.guid, &pGuid);
		if( SUCCEEDED(hr) )
		{
			USES_CONVERSION;
			strGuid.Format( _T("%s"), OLE2T(pGuid));
			CoTaskMemFree(pGuid);

			strGuid.Replace( _T("{"), _T(""));
			strGuid.Replace( _T("}"), _T(""));
			strGuid.Replace( _T("-"), _T(""));
			strGuid.AppendFormat(_T("%X"), tIndexInfo.age);
		}
	}

	return strGuid;
}
Example #5
0
// CLogWindow message handlers
void CLogWindow::onReceiveRemoteLog(std::string str)
{
	if(str.size() <= 0)
		return;
	
	CString s;
	wchar_t* wstr = KBEngine::strutil::char2wchar(str.c_str());
	s = wstr;
	free(wstr);
	s.Replace(L"\n", L"");
	s.Replace(L"\r\n", L"");
	s.Replace(L"\n\r", L"");
	s.Replace(L"\r", L"");

	if(s.Find(L"WARNING") >= 0)
		m_loglist.AddString(s, RGB(0, 0, 0), RGB(255, 165, 0));
	else if(s.Find(L"ERROR") >= 0)
		m_loglist.AddString(s, RGB(0, 0, 0), RGB(255, 0, 0));
	else if(s.Find(L"CRITICAL") >= 0)
		m_loglist.AddString(s, RGB(0, 0, 0), RGB(100, 149, 237));
	else if(s.Find(L"SCRIPT") >= 0)
		m_loglist.AddString(s, RGB(0, 0, 0), RGB(237, 237,237));
	else
		m_loglist.AddString(s, RGB(80, 80, 80), RGB(237, 237,237));

	::SendMessage(m_loglist.m_hWnd, WM_VSCROLL, SB_BOTTOM, 0);
}
Example #6
0
void CDataPool::OnSaveCommand(const CString& szName, BOOL bSaveRoot/* = FALSE*/)
{
	if( szName.GetLength() == 0 ) return;
	
	CString useName = szName;

	if (bSaveRoot)
	{
		useName = GetRootWindowName(szName);
	}
	CString testXML;
	CEGUI::Window* pWindow = WindowManager::getSingleton().getWindow(useName.GetString());

	//先刷新窗口定义
	GetRightEventList()->UpdateWindowEventDefine();

	WriteXMLHead(testXML, useName);
	WriteXMLContent(testXML,pWindow,"\t");
	WriteXMLEnd(testXML, useName);

	CFileDialog dlg(FALSE, useName, useName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Layout文件(*.layout.xml)|*.layout.xml||", AfxGetMainWnd());
	if(IDOK == dlg.DoModal())
	{
		//layout文件
		CString szFileName = dlg.GetFileName();
		CString szFullPath = dlg.GetPathName();
		//CString szLayoutXml = szFullPath + "\\" + useName;
		//szLayoutXml += ".layout.xml";
		FILE* pfileb =fopen(szFullPath.GetString() , "w");
		fwrite(testXML.GetString(), testXML.GetLength(),1, pfileb);
		fclose(pfileb);

		//lua文件
		testXML = "";
		szFullPath.Replace(szFileName,"");
		szFileName.Replace(".layout.xml","");
		CString szLua = szFullPath + "\\" + szFileName;
		szLua += ".lua";
		GenLuaText(testXML,useName,szFileName);

		//判断是否存在文件,提示用户
		pfileb = fopen(szLua, "r");
		if (pfileb)
		{
			CString szMsg = "脚本文件:\n";
			szMsg += szLua;
			szMsg += "\n已经存在,是否覆盖??";
			if( MessageBox(NULL, szMsg, "提示", MB_YESNO) == IDNO )
			{
				fclose(pfileb);
				return;
			}
		}
		pfileb = fopen(szLua, "w");
		fwrite(testXML.GetString(), testXML.GetLength(),1, pfileb);
		fclose(pfileb);
	}
	

}
void CCalendarDlg2::SetTextForDay(SYSTEMTIME* sysTime)
{
    static BOOL bFirst=1;
    static CString sDovesok;
    static COleDateTime dtCurrent;
    if(!bFirst && dtCurrent.GetStatus()!=COleDateTime::invalid) {
        CString sThisDayNKey=Format(sKey,dtCurrent.GetDay(),dtCurrent.GetMonth(),dtCurrent.GetYear());
        CString sCurDay;
        m_eText.GetWindowText(sCurDay);
        sCurDay.TrimLeft();
        sCurDay.TrimRight();
        if(sCurDay!="") {
            sCurDay.Replace("\r\n","\n");
            if(sDovesok!="") {
                sCurDay+=Format("[?CDATA{%s}?DATAC:)]",sDovesok);
            }
            if(!bINewLine) {
                sCurDay.Replace("\n","<br>");
            }
            CString sContent=CString("\n")+sCurDay+"\n";
            while(sContent!="") {
                CString sLine=sContent.SpanExcluding("\n");
                if(sLine!="") {
                    aItems.Add(sThisDayNKey+sLine);
                    if(sContent.GetLength()>sLine.GetLength()) {
                        sContent=sContent.Mid(sLine.GetLength()+1);
                    } else {
                        sContent="";
                    }
                }
                sContent.TrimLeft();
            }
        }
        sDovesok="";
    }
    bFirst=0;
    if(sysTime) {
        COleDateTime dtTime=COleDateTime(sysTime->wYear,sysTime->wMonth,sysTime->wDay,0,0,0);
        char szTmp[256]= {0};
        GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,sysTime,0,szTmp,sizeof(szTmp));
        GetDlgItem(IDC_STATIC3)->SetWindowText(Format("%s: %s",_l("Current date"),szTmp));
        CString sThisDayNKey=Format(sKey,dtTime.GetDay(),dtTime.GetMonth(),dtTime.GetYear());
        dtCurrent=dtTime;
        CString sDayNote;
        for(int i=aItems.GetSize()-1; i>=0; i--) {
            if(aItems[i].Find(sThisDayNKey)==0) {
                if(sDayNote!="") {
                    sDayNote+="\r\n";
                }
                sDayNote+=aItems[i].Mid(sThisDayNKey.GetLength());
                aItems.RemoveAt(i);
            }
        }
        sDovesok=CDataXMLSaver::GetInstringPart("[?CDATA{","}?DATAC:)]",sDayNote);
        sDayNote.Replace(Format("[?CDATA{%s}?DATAC:)]",sDovesok),"");
        sDayNote.Replace("<br>","\r\n");
        m_eText.SetWindowText(sDayNote);
    }
}
Example #8
0
CString XMLEntityEncode(CString str)
{
	str.Replace(_T("&"),_T("&amp;"));
	str.Replace(_T("<"),_T("&lt;"));
	str.Replace(_T(">"),_T("&gt;"));
	str.Replace(_T("\""),_T("&quot;"));
	return str;
}
BOOL CPathUtils::FileCopy(CString srcPath, CString destPath, BOOL force)
{
	srcPath.Replace('/', '\\');
	destPath.Replace('/', '\\');
	CString destFolder = destPath.Left(destPath.ReverseFind('\\'));
	MakeSureDirectoryPathExists(destFolder);
	return (CopyFile(srcPath, destPath, !force));
}
Example #10
0
//把Html编码转换为简体
int CWebBase::HtmlCodeToSimple( CString & strHtmlText )
{

	int             i = 0;
	char *          ptemp = NULL;
	char *          pEnd = NULL;
	unsigned short  usData = 0;
	char cbuffGbt[8] = {0};
	char cBuffGbs[8] = {0}; 

	if( strHtmlText.IsEmpty() ) 
	{
		return 0;
	}
	ptemp = strHtmlText.GetBuffer( 20 );
	ptemp = strstr( ptemp, "&#") ;
	if( ptemp == NULL ) 
	{
		return strHtmlText.GetLength();
	}
	for ( i = 0; i < 4000; i++ )//&#
	{
		ptemp = strstr( ptemp, "&#") ;
		if( ptemp == NULL ) 
		{
			break;
		}
		ptemp += 2;
		usData = (unsigned short)atoi(ptemp);
		if( usData > 255 )
		{                
			//转换Unicode码到Gb码繁体,使用API函数WideCharToMultiByte 
			WideCharToMultiByte ( 936, 0, (PWSTR)&usData, -1, 
				cbuffGbt,2, NULL, NULL) ; 
			//转换Gb码繁体到Gb码简体,使用API函数LCMapString 
			LCMapString( 0x0804,LCMAP_SIMPLIFIED_CHINESE, cbuffGbt, -1, 
				cBuffGbs , 2); 
			memcpy( ptemp, cBuffGbs, 2);
			memset( ptemp + 2, '^' , 3 );
			ptemp += 6;
		}
		else
		{
			//* ptemp = (char)usData ;
			pEnd = strstr( ptemp, ";") ;
			if( pEnd != NULL )
			{
				memset( ptemp , '^' , pEnd - ptemp );
				ptemp = pEnd;
			}
		}
	}
	strHtmlText.Replace("&#", "");
	strHtmlText.Replace("^^^;", "");
	//strHtmlText.Replace("^", "");
	return strHtmlText.GetLength();
}
Example #11
0
inline void CkCommon::FixSlash_FtpRemoteDirPath(CString& strFtpRemotePath)
{
    int nLength = strFtpRemotePath.GetLength();
    if (0 == nLength)
        return;
    strFtpRemotePath.Replace(_T('\\'), _T('/'));
    strFtpRemotePath += _T('/');
    while (0 != strFtpRemotePath.Replace(_T("//"), _T("/")));
}
Example #12
0
inline void CkCommon::FixBackSlash_DirPath(CString& strDirPath)
{
    int nLength = strDirPath.GetLength();
    if (0 == nLength)
        return;
    strDirPath.Replace(_T('/'), _T('\\'));
    strDirPath += _T('\\');
    while (0 != strDirPath.Replace(_T("\\\\"), _T("\\")));
}
void YouTubeWebPageView::LoadVideo(const VideoInfo& info)
{
   m_bLoaded = false;

   ATLTRACE(_T("%08x: LoadVideo: \"%s\" (%s)\n"),
      m_hWnd,
      info.Name(),
      info.Address());

   m_iLastError = 0;

   CString cszHtml = GetHtmlTemplate();

   cszHtml.Replace(_T("{..$address..}"), info.Address());
   cszHtml.Replace(_T("{..$name..}"), info.Name());
   cszHtml.Replace(_T("\r\n"), _T("\n"));

   // generate temp name
   CString cszTempFolder;
   GetTempPath(MAX_PATH, cszTempFolder.GetBuffer(MAX_PATH));
   cszTempFolder.ReleaseBuffer();

   CString cszFilename;
   GetTempFileName(cszTempFolder, _T("YTP"), 0, cszFilename.GetBuffer(MAX_PATH));
   cszFilename.ReleaseBuffer();

   // write to temporary file
   {
      FILE* fd = NULL;
	  errno_t err = _tfopen_s(&fd, cszFilename, _T("wt"));
	  ATLVERIFY(err == 0 && fd != NULL);

      USES_CONVERSION;
      fprintf(fd, T2CA(cszHtml));
      fclose(fd);
   }

   // navigate to page
   CComPtr<IWebBrowser2> spWebBrowser2;
   HRESULT hr = GetWebBrowser2(spWebBrowser2);
   if (SUCCEEDED(hr))
   {
      CString cszURL = _T("file:///") + cszFilename;
      cszURL.Replace(_T("\\"), _T("/"));

      CComBSTR bstrURL = cszURL;

      CComVariant varFlags(static_cast<int>(navNoHistory | navNoWriteToCache));

      hr = spWebBrowser2->Navigate(bstrURL, &varFlags, NULL, NULL, NULL);
   }

   if (!m_cszHtmlFilename.IsEmpty())
      DeleteFile(m_cszHtmlFilename);
   m_cszHtmlFilename = cszFilename;
}
Example #14
0
CString SU_ConvertNewLines(LPCTSTR lpText, LPCTSTR lpNewLineSeq)
{
	if(lpText == NULL) { ASSERT(FALSE); return CString(); }
	if(lpNewLineSeq == NULL) { ASSERT(FALSE); return CString(); }

	CString str = lpText;
	str.Replace(_T("\r"), _T(""));
	str.Replace(_T("\n"), lpNewLineSeq);
	return str;
}
Example #15
0
CString CToolTips::LoadTooltip( UINT nIDText )
{
    CString sTemp;
    sTemp.LoadString(nIDText);
    // tooltips can't handle \t and single \n, only spaces and \r\n
    sTemp.Replace('\t', ' ');
    sTemp.Replace(_T("\r\n"), _T("\n"));
    sTemp.Replace(_T("\n"), _T("\r\n"));
    return sTemp;
}
Example #16
0
int SLZCWndScreen::DoSingleColorMsg(CString msg,int address,char* buf)
{
	msg.Replace(_T("#0#"),_T(""));
	msg.Replace(_T("#1#"),_T(""));
	msg.Replace(_T("#2#"),_T(""));
	char h,l;
	int count = msg.GetLength();
	if (count==0)
	{
		return 0;
	}
	int h2 = address&0xc0;
	h2>>=2;
	buf[0]=0x80+address;
	buf[1]=0xc0+h2;
	buf[2]='D';
	int index = 3;
	for (int i=0;i<count;i++)
	{
		WCHAR w=msg.GetAt(i);
		if (w<=255)
		{
			char ch = w;
			buf[index] = ch;
			index++;
		}
		else
		{
			//第一个字节
			char c_w[2]={0};
			WideCharToMultiByte(CP_ACP,0,&w,-1,c_w,2,NULL,NULL);
			h=(c_w[0]&0xf0)>>4;if(h>9) h+=0x57;else h+=0x30;
			l=(c_w[0]&0x0f);if(l>9)  l+=0x57;else l+=0x30;

			char arr[2];
			arr[0]=h;
			arr[1]=l;

			StrToHexes(arr,2,&buf[index]);//数据


			//第二个字节
			h=(c_w[1]&0xf0)>>4;if(h>9) h+=0x57;else h+=0x30;
			l=(c_w[1]&0x0f);if(l>9)  l+=0x57;else l+=0x30;

			arr[0]=h;
			arr[1]=l;

			StrToHexes(arr,2,&buf[index+1]);//数据
			index+=2;
		}
	}
	buf[index]=0x1a;
	return index+1;
}
CString CPathUtils::PathPatternEscape(const CString& path)
{
	CString result = path;
	// first remove already escaped patterns to avoid having those
	// escaped twice
	result.Replace(_T("\\["), _T("["));
	result.Replace(_T("\\]"), _T("]"));
	// now escape the patterns (again)
	result.Replace(_T("["), _T("\\["));
	result.Replace(_T("]"), _T("\\]"));
	return result;
}
Example #18
0
int CHttpString::GetCharset(){
	CString strContentType = GetContentType();
	int nLeft = strContentType.Find("charset=");
	nLeft = nLeft + 8;
	CString strChatset = "";
	strChatset = strContentType.Mid(nLeft,strContentType.GetLength() - nLeft);
	strChatset.Replace(" ","");
	strChatset.Replace("\t","");
	strChatset.Replace("\r","");
	strChatset.Replace("\n","");
	if(strChatset == "ANSI") return 1;
	else if(strChatset == "UTF-8") return 2;
	else return -1;
}
Example #19
0
    CString ExpandReason() {
        CString sReason = m_sReason;
        if (sReason.empty()) sReason = SIMPLE_AWAY_DEFAULT_REASON;

        time_t iTime = time(nullptr);
        CString sTime = CUtils::CTime(iTime, GetUser()->GetTimezone());
        sReason.Replace("%awaytime%", sTime);
        sReason = ExpandString(sReason);
        sReason.Replace("%s", sTime);  // Backwards compatibility with previous
                                       // syntax, where %s was substituted with
                                       // sTime. ZNC <= 1.6.x

        return sReason;
    }
BOOL AboutDialog::OnInitDialog()
{
  BaseDialog::OnInitDialog();

  // Subclass the rich edit text control
  if (m_info.SubclassDlgItem(IDC_INFO,this) == FALSE)
    return FALSE;

  CRect dlgRect;
  GetWindowRect(dlgRect);

  // Load the bitmap and center it in the dialog
  m_logo.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_FROTZ)));
  CRect logoRect;
  m_logo.GetWindowRect(logoRect);
  ScreenToClient(logoRect);
  int w = logoRect.Width();
  logoRect.left = (dlgRect.Width()-w)/2;
  logoRect.right = logoRect.left+w;
  m_logo.MoveWindow(logoRect,FALSE);

  // Move the controls down to make room for the bitmap
  CRect rect;
  m_border.GetWindowRect(rect);
  ScreenToClient(rect);
  rect.OffsetRect(0,logoRect.Height());
  m_border.MoveWindow(rect,FALSE);
  m_info.GetWindowRect(rect);
  ScreenToClient(rect);
  rect.OffsetRect(0,logoRect.Height());
  m_info.MoveWindow(rect,FALSE);
  m_ok.GetWindowRect(rect);
  ScreenToClient(rect);
  rect.OffsetRect(0,logoRect.Height());
  m_ok.MoveWindow(rect,FALSE);

  // Resize the dialog
  dlgRect.bottom += logoRect.Height();
  MoveWindow(dlgRect,FALSE);

  // Load the text into the rich edit text control
  CString aboutText;
  aboutText.LoadString(IDS_ABOUT_INFO);
  aboutText.Replace("%ver%","1.21");
  aboutText.Replace("%year%","2019");
  m_info.SetText(SF_RTF,aboutText);
  return TRUE;
}
Example #21
0
CString GitAdminDir::ReadGitLink(const CString& topDir, const CString& dotGitPath)
{
	CAutoFILE pFile = _wfsopen(dotGitPath, L"r", SH_DENYWR);

	if (!pFile)
		return L"";

	int size = 65536;
	auto buffer = std::make_unique<char[]>(size);
	int length = (int)fread(buffer.get(), sizeof(char), size, pFile);
	CStringA gitPathA(buffer.get(), length);
	if (length < 8 || !CStringUtils::StartsWith(gitPathA, "gitdir: "))
		return L"";
	CString gitPath = CUnicodeUtils::GetUnicode(gitPathA);
	// trim after converting to UTF-16, because CStringA trim does not work when having UTF-8 chars
	gitPath = gitPath.Trim().Mid((int)wcslen(L"gitdir: "));
	gitPath.Replace('/', '\\');
	if (!gitPath.IsEmpty() && gitPath[0] == L'.')
	{
		gitPath = CPathUtils::BuildPathWithPathDelimiter(topDir) + gitPath;
		CString adminDir;
		PathCanonicalize(CStrBuf(adminDir, MAX_PATH), gitPath);
		return adminDir;
	}
	CPathUtils::TrimTrailingPathDelimiter(gitPath);
	return gitPath;
}
Example #22
0
CStringArray* CCopiagenda::ParseLine(CString csLine)
{
	CStringArray* psaContact = new CStringArray();

	csLine.Replace("\r","");
	csLine.Replace("\n","");

	int nPos=0;
	int nPosTab=csLine.Find("\t");
	while(nPosTab!=-1)
	{
		CString csDatum;
		if(nPosTab!=-1)
			csDatum=csLine.Mid(nPos,nPosTab-nPos+1);
		else
			csDatum=csLine.Mid(nPos);

		csDatum.Replace("\t","");
		csDatum.Replace("\"","");

		psaContact->Add(csDatum);

		nPos=nPosTab+1;
		nPosTab=csLine.Find("\t",nPos);
	}

	return psaContact;
}
Example #23
0
/**
 * Returns the .git-path (if .git is a file, read the repository path and return it)
 * adminDir always ends with "\"
 */
bool GitAdminDir::GetAdminDirPath(const CString& projectTopDir, CString& adminDir, bool* isWorktree)
{
	CString wtAdminDir;
	if (!GetWorktreeAdminDirPath(projectTopDir, wtAdminDir))
		return false;

	CString pathToCommonDir = wtAdminDir + L"commondir";
	if (!PathFileExists(pathToCommonDir))
	{
		adminDir = wtAdminDir;
		if (isWorktree)
			*isWorktree = false;
		return true;
	}

	CAutoFILE pFile = _wfsopen(pathToCommonDir, L"rb", SH_DENYWR);
	if (!pFile)
		return false;

	int size = 65536;
	CStringA commonDirA;
	int length = (int)fread(commonDirA.GetBufferSetLength(size), sizeof(char), size, pFile);
	commonDirA.ReleaseBuffer(length);
	CString commonDir = CUnicodeUtils::GetUnicode(commonDirA);
	commonDir.TrimRight(L"\r\n");
	commonDir.Replace(L'/', L'\\');
	if (PathIsRelative(commonDir))
		adminDir = CPathUtils::BuildPathWithPathDelimiter(wtAdminDir + commonDir);
	else
		adminDir = CPathUtils::BuildPathWithPathDelimiter(commonDir);
	if (isWorktree)
		*isWorktree = true;
	return true;
}
void CBusEventHandlerDlg::OnBnClickedOk()
{
    CButton* pomButton       = NULL;
    CString omStrHandlerName = STR_EMPTY ;
    CString omStrControl     = STR_EMPTY ;
    INT nCheck               = 0;
    BOOL bIsEnable           = TRUE;
    // Get the selected handlers either for deleteting or adding and
    // add the name in the array
    for(int j=0; j<defBUSEV_HANDLER_NUMBER; j++)
    {
        pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER + j);
        if(pomButton != NULL )
        {
            nCheck      = pomButton->GetCheck();
            bIsEnable   = pomButton->IsWindowEnabled();
            pomButton->GetWindowText(omStrControl);
            omStrControl.TrimLeft();
            omStrControl.TrimRight();
            omStrControl.Replace(' ','_');
            omStrControl.Replace('-','_');
            omStrHandlerName = omStrControl;
            if(nCheck == 1 && bIsEnable != 0 )
            {
                m_omStrArrayBusEventHandler.Add(omStrHandlerName);
            }
        }
    }
    OnOK();
}
Example #25
0
BOOL CHistoryDlg::OnInitDialog()
{
	CResizableStandAloneDialog::OnInitDialog();

	// calculate and set listbox width
	CDC* pDC=m_List.GetDC();
	CSize itemExtent;
	int horizExtent = 1;
	for (size_t i = 0; i < m_history->GetCount(); ++i)
	{
		CString sEntry = m_history->GetEntry(i);
		sEntry.Remove('\r');
		sEntry.Replace('\n', ' ');
		m_List.AddString(sEntry);
		itemExtent = pDC->GetTextExtent(sEntry);
		horizExtent = max(horizExtent, itemExtent.cx+5);
	}
	m_List.SetHorizontalExtent(horizExtent);
	ReleaseDC(pDC);

	AddAnchor(IDC_HISTORYLIST, TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDOK, BOTTOM_RIGHT);
	AddAnchor(IDCANCEL, BOTTOM_RIGHT);
	EnableSaveRestore(_T("HistoryDlg"));
	m_List.SetFocus();
	return FALSE;
}
Example #26
0
CString MainWnd::winLoadFilter(UINT id)
{
    CString res = winResLoadString(id);
    res.Replace('_','|');

    return res;
}
Example #27
0
void COpenHoldemDoc::ReadFormula(CArchive& ar) 
{
	// Clear everything
	p_formula->ClearFormula();

	// There are two types of formulas
	//   * ohf 
	//   * whf and optional whx
	// In the latter case we have to read both files. 
	p_formula->ReadFormulaFile(ar, true);

	CFile *cf_whf = ar.GetFile();  
	CString CSpath = cf_whf->GetFilePath(); 

	if (IsWinHoldemFormat(CSpath))
		{
			CFile *cf_whf = ar.GetFile();
			CFile cf_whx; 
			CString CSpath = cf_whf->GetFilePath();
			CSpath.Replace(".whf", ".whx");

			if (cf_whx.Open(CSpath, CFile::modeNoTruncate | CFile::modeRead| CFile::shareDenyWrite)) 
			{ 
				CArchive ar_whx(&cf_whx, CArchive::load);   
				// Read whx file, too. //???	
				p_formula->ReadFormulaFile(ar_whx, false);	
			}
	}

	// Check and add missing...
	p_formula->CheckForDefaultFormulaEntries();
}
Example #28
0
void CTGitPath::SetFwdslashPath(const CString& sPath) const
{
	CString path = sPath;
	path.Replace('\\', '/');

	// We don't leave a trailing /
	path.TrimRight('/');
	path.Replace(L"//?/", L"");

	SanitizeRootPath(path, true);

	path.Replace(_T("file:////"), _T("file://"));
	m_sFwdslashPath = path;

	m_sUTF8FwdslashPath.Empty();
}
Example #29
0
void CScriptDlg::InitPythonForObjects()
{
	if(pApp == NULL)
		return;


	POSITION pos = pApp->object_types.GetStartPosition();
	CObjType* oT;
	long nKey = 0;
	int objectnumber = 0;
	while (pos != NULL) 
	{	
		pApp->object_types.GetNextAssoc(pos, nKey, oT);
		if(oT && !oT->m_bIsGroupType)
		{
			CString name = oT->GetName();
			name.Replace("&", "");
			PyInfoClass* pClass = &m_Intell.classes[name];
			InitPythonForObject(oT, pClass);

			PyInfoMapItem& item = m_IntellMap[name];
			item[&m_Intell] = PY_CLASS;
		}
	}

	// System
	oT = &pApp->m_System;
	PyInfoClass* pClass = &m_Intell.classes[oT->GetName()];
	InitPythonForObject(oT, pClass);

	PyInfoMapItem& item = m_IntellMap[oT->GetName()];
	item[&m_Intell] = PY_CLASS;
}
void ModelDisplayState::PrepareStaticModels(ModelManager& modelManager, const ModelBlueprint& blueprint)
{
   const std::vector<CompositeModel3d::StaticModelData>& vecStaticModels =
      m_spModel->StaticList();

   // blueprint must contain same number of statics as composite models
   ATLASSERT(blueprint.m_vecStaticBlueprints.size() == vecStaticModels.size());

   m_vecStaticModelTextures.resize(vecStaticModels.size());

   for (size_t i=0, iMax=vecStaticModels.size(); i<iMax; i++)
   {
      // static model must contain only one material; get texture name of it
      CString cszTexture = vecStaticModels[i].m_spStatic->SingleMaterialTextureName();
      cszTexture.Replace(_T(".\\"), _T(""));

      // add texture name prefix, if any
      const ModelBlueprint::StaticModelBlueprint& staticBlueprint =
         blueprint.m_vecStaticBlueprints[i];

      if (!staticBlueprint.m_cszStaticTexturePrefix.IsEmpty())
         cszTexture = staticBlueprint.m_cszStaticTexturePrefix + cszTexture;

      m_vecStaticModelTextures[i] = modelManager.LoadTexture(cszTexture);
   }
}