Пример #1
0
void CuDlgParameterInstallationExtra::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	UINT nState = ST_ADD;
	if (pNMListView->iItem >= 0 && pNMListView->uNewState > 0 && (pNMListView->uNewState&LVIS_SELECTED))
	{
		int iNameCol  = 0;
		int iValueCol = 1;
		int nSelected = pNMListView->iItem;
		CString strName  = m_cListCtrl.GetItemText (nSelected, iNameCol);
		CString strValue = m_cListCtrl.GetItemText (nSelected, iValueCol);

		strValue.TrimLeft();
		strValue.TrimRight();

		CaEnvironmentParameter* pParameter = (CaEnvironmentParameter*)m_cListCtrl.GetItemData(nSelected);
		if (pParameter)
		{
			nState |= ST_MODIFY;
			if (strValue.CompareNoCase (theApp.m_strVariableNotSet) != 0)
				nState |= ST_UNSET;
		}
		(GetParent()->GetParent())->SendMessage (WMUSRMSG_ENABLE_CONTROL, (WPARAM)nState, 0);
	}
	*pResult = 0;
}
Пример #2
0
CServerPath::CServerPath(CString path)
{
	m_nServerType = FZ_SERVERTYPE_FTP;
	path.TrimLeft( _T(" ") );
	path.TrimRight( _T(" ") );
	if (path == _MPT(""))
	{
		m_bEmpty = TRUE;
		return;
	}
	else
		m_bEmpty = FALSE;

	int pos1 = path.Find( _T(":[") );
	if (pos1 != -1 && path.Right(1) == _MPT("]") && pos1 != (path.GetLength()-1))
		m_nServerType |= FZ_SERVERTYPE_SUB_FTP_VMS;
	else if (path.GetLength() >= 3 && _istalpha(path[0]) && path[1] == _MPT(':') && (path[2] == _MPT('\\') || path[2] == _MPT('/')))
		m_nServerType |= FZ_SERVERTYPE_SUB_FTP_WINDOWS;
	else if (path[0] == FTP_MVS_DOUBLE_QUOTA && path[path.GetLength() - 1] == FTP_MVS_DOUBLE_QUOTA)
		m_nServerType |= FZ_SERVERTYPE_SUB_FTP_MVS;
	else if (path.GetLength() > 2 && path[0] == _MPT('\'') && path.Right(1) == _T("'") && path.Find(_MPT('/')) == -1 && path.Find(_MPT('\\')) == -1)
		m_nServerType |= FZ_SERVERTYPE_SUB_FTP_MVS;
	else if (path.GetLength() >= 2 && path[0] != _MPT('/') && path.Right(1) == _T("."))
		m_nServerType |= FZ_SERVERTYPE_SUB_FTP_UNKNOWN;

	*this = CServerPath(path, m_nServerType);
}
CString CProjectDBI::StripConfiguration (const CString &strPath, CString &strRemainder)
{
    int iPos;

    if (strPath[0] == _T ('{'))
    {
        iPos = strPath.Find (_T ('}'));
        if (iPos == -1)
        {
            strRemainder = strPath;
            return ("");
        };

        strRemainder = strPath.Mid (iPos + 1);
        strRemainder.TrimLeft(_T('.'));
        return (strPath.Left (iPos+1));
    };

    iPos = strPath.Find (_T ('.'));
    if (iPos == -1)
    {
        strRemainder = "";
        return (strPath);
    };

    strRemainder = strPath.Mid (iPos + 1);
    return (strPath.Left (iPos));
}
Пример #4
0
void CPolyDlg::SetItemNum( CString& str, const int num )
{
	//Inputs:
	//	str = contains depth & possibly groove number substrings
	//Outputs:
	//	str = contains depth & groove number substrings
	//Notes:
	//	02/13/02: revised to fix a bug excited with profiles of more than 99 points

	CString numstr, itemstr ;
	str.TrimLeft() ; str.TrimRight() ;
	int spcidx = str.Find( ' ' ) ; //02/13/02 bugfix
	FormatNumStr( numstr, num ) ;

	if( spcidx >= 0 )
	{
		itemstr = str.Right( str.GetLength() - spcidx - 1 ) ;
	}
	else
	{
		itemstr = str ;
	}

	itemstr.TrimLeft() ; itemstr.TrimRight() ;
	str = numstr + itemstr ;
}
Пример #5
0
CString ExtractTag(CString tag, CMapStringToString& attribs, bool& fClosing)
{
	tag.Trim();
	attribs.RemoveAll();

	fClosing = !tag.IsEmpty() ? tag[0] == '/' : false;
	tag.TrimLeft('/');

	int i = tag.Find(' ');
	if(i < 0) i = tag.GetLength();
	CString type = tag.Left(i).MakeLower();
	tag = tag.Mid(i).Trim();

	while((i = tag.Find('=')) > 0)
	{
		CString attrib = tag.Left(i).Trim().MakeLower();
		tag = tag.Mid(i+1);
		for(i = 0; i < tag.GetLength() && _istspace(tag[i]); i++);
		tag = i < tag.GetLength() ? tag.Mid(i) : _T("");
		if(!tag.IsEmpty() && tag[0] == '\"') {tag = tag.Mid(1); i = tag.Find('\"');}
		else i = tag.Find(' ');
		if(i < 0) i = tag.GetLength();
		CString param = tag.Left(i).Trim();
		if(!param.IsEmpty())
			attribs[attrib] = param;
		tag = i+1 < tag.GetLength() ? tag.Mid(i+1) : _T("");
	}

	return(type);
}
Пример #6
0
bool FindNodeContents (CXMLelement & parent,
                       const char * sName,
                       CString & strValue,
                       const bool bUseDefault,    
                       bool bTrim)
  {
CXMLelement * pNode = FindNode (parent, sName);

  if (!pNode)
    if (bUseDefault)
      return false;
    else
      {
      strValue = "";
      return false;
      }

  // see if they want spaces trimmed
  Get_XML_boolean (*pNode, "trim", bTrim, true);

  strValue = pNode->strContent;

  if (bTrim)
    {
    strValue.TrimLeft ("\n\r\t ");
    strValue.TrimRight ("\n\r\t ");
    }

  return true;

  } // end of FindNode  
Пример #7
0
CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
{
	CString cs = GetProfileString("NetworkExtraPassword", "");

	if(bFillArray)
	{
		m_csNetworkPasswordArray.RemoveAll();

		TCHAR seps[]   = _T(",");
		TCHAR *token;

		TCHAR *pString = cs.GetBuffer(cs.GetLength());

		/* Establish string and get the first token: */
		token = STRTOK(pString, seps);
		while(token != NULL)
		{
			CString cs(token);
			cs.TrimLeft();
			cs.TrimRight();

			m_csNetworkPasswordArray.Add(cs);

			// Get next token
			token = STRTOK(NULL, seps);
		}

		cs.ReleaseBuffer();
	}

	return cs;
}
Пример #8
0
void CMainFrame::OnAskQuestion()
{
	CMFCToolBarComboBoxButton* pHelpCombo = m_wndMenuBar.GetHelpCombobox ();
	if (pHelpCombo == NULL)
	{
		return;
	}

	CString strQuestion = pHelpCombo->GetText ();
	strQuestion.TrimLeft ();
	strQuestion.TrimRight ();

	if (strQuestion.IsEmpty ())
	{
		return;
	}

	pHelpCombo->AddItem (strQuestion);

	CString str;
	str.Format (_T("The question is: %s"), (LPCTSTR)strQuestion);

	MessageBox (str);

	SetFocus ();
}
Пример #9
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	// TODO: Place code here.
	tools_addin vfc;
	if (vfc.m_fc.load(hInstance,&vfc))
	{
		if (lstrlen(lpCmdLine) != 0)
		{
			CString proj = lpCmdLine;
			proj.TrimLeft(_T('\"'));
			proj.TrimRight(_T('\"'));
			vfc.LoadVSProject(proj);
			vfc.ExecVFCWizard();
		}
		else
		{
			MessageBox(GetActiveWindow(),info,_T("VisualFC Tools"),MB_OK | MB_ICONINFORMATION);
				//_T("\r\nVisualFC for VS2005/VS2008/VCExpress Tools\r\n\r\nCommand:\tC:\\VisualFC\\bin\\VFCTools.exe\r\nArguments:\t$(ProjectDir)$(ProjectFileName)"),_T("VisualFC Tools"),MB_OK | MB_ICONINFORMATION);
		}
	}

	return 0;
}
Пример #10
0
//---------------------------------------------------------------------------
//
//	Parse one line from the method's section.  This should consist of a
//	parameter type (BSTR, long, etc), and a value ( example : BSTR="Hello" ).
//	For a property's return value it should have the word return.
//	(example : LONG=return).
//
//---------------------------------------------------------------------------
bool
CMethod::ParseParam(
	LPCTSTR	szParam )
{
	bool rc = false;

	CString strParam = szParam;
	int pos = strParam.Find( _T('=') );
	if ( pos != -1 )
	{
		CString strType = strParam.Left( pos );
		strType.TrimRight();
		VARIANT vt;
		vt.vt = StringToType( strType );
		if ( vt.vt != VT_EMPTY )
		{
			CString strVal = strParam.Right( strParam.GetLength() - (pos+1) );
			strVal.TrimLeft();
			if ( strVal.CompareNoCase( _T("return") ) != 0 )
			{
				if ( StringToVal( strVal, vt ) )
				{
					rc = true;
					m_params.push_back( vt );
				}
			
			}
			else
			{
				// this is the return value
			}
		}
	}
	return rc;
}
Пример #11
0
// Number can be: nnnnn[.nnnnnn][[+|-]{E|e}nnn]
CString
XMLRestriction::CheckDouble(CString p_value,bool p_specials)
{
  CString result;
  p_value.TrimLeft('-');
  p_value.TrimLeft('+');

  if(p_specials)
  {
    if(p_value == "INF" || p_value == "NaN")
    {
      return result;
    }
  }
  for(int ind = 0; ind < p_value.GetLength(); ++ind)
  {
    unsigned char ch = p_value.GetAt(ind);
    if(!isspace(ch) && !isdigit(ch) && ch != '.' && ch != '+' && ch != '-' && toupper(ch) != 'E')
    {
      result  = "Not a number: ";
      result += p_value;
      return result;
    }
  }
  return CheckRangeFloat(p_value);
}
Пример #12
0
void CBusEventHandlerDlg::OnBnClickedOk()
{
    CButton* pomButton       = nullptr;
    CString omStrHandlerName = "" ;
    CString omStrControl     = "" ;
    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 != nullptr )
        {
            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();
}
Пример #13
0
CString CToolbarHelper::GetTip(UINT nID)
{
	CString sTip;

	if (nID > 0 && sTip.LoadString(nID) && !sTip.IsEmpty())
	{
		// tip text starts at '\n'
		int nStartTip = sTip.Find('\n');

		if (nStartTip != -1)
		{
			sTip = sTip.Right(sTip.GetLength() - nStartTip - 1);
		}

		else // strip '...' if present
		{
			sTip.Replace(_T("."), _T(""));
		}

		sTip.TrimLeft();
		sTip.TrimRight();
	}

	return sTip;
}
Пример #14
0
LONG CuDlgParameterInstallationExtra::OnEnableControl(WPARAM w, LPARAM l)
{
	UINT nState = ST_ADD;
	int iNameCol  = 0;
	int iValueCol = 1;
	int nSelected = m_cListCtrl.GetNextItem (-1, LVNI_SELECTED);
	if (nSelected != -1)
	{
		CaEnvironmentParameter* pParameter = (CaEnvironmentParameter*)m_cListCtrl.GetItemData(nSelected);
		if (pParameter)
		{
			nState |= ST_MODIFY;
			CString strName  = m_cListCtrl.GetItemText (nSelected, iNameCol);
			CString strValue = m_cListCtrl.GetItemText (nSelected, iValueCol);

			strValue.TrimLeft();
			strValue.TrimRight();
		
			if (strValue.CompareNoCase (theApp.m_strVariableNotSet) != 0)
				nState |= ST_UNSET;
		}
	}

	(GetParent()->GetParent())->SendMessage (WMUSRMSG_ENABLE_CONTROL, (WPARAM)nState, 0);
	return 0;
}
Пример #15
0
void CErrHandlerDlg::OnCbtnErrorOk() 
{
    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<defERROR_HANDLER_NUMBER; j++)
    {
        pomButton = 
        (CButton*)GetDlgItem(IDC_CHKB_ERROR_ACTIVE_HANDLER + j);
        if(pomButton != NULL )
        {
            nCheck      = pomButton->GetCheck();
            bIsEnable   = pomButton->IsWindowEnabled();
            pomButton->GetWindowText(omStrControl);
            omStrControl.Replace(_T("Error"),_T(""));
            omStrControl.TrimLeft();
            omStrControl.TrimRight();
            omStrControl.Replace(' ','_');
            omStrHandlerName = omStrControl;
            if(nCheck == 1 && bIsEnable != 0 )
            {
                m_omStrArrayErrorHandler.Add(omStrHandlerName);
            }
       }
    }
    CDialog::OnOK();
}
void COptionTab7::EnsureIncluded(BOOL state, CString filter)  {
  /* wipe all selected filters */
  CString st;
  CString ftok=filter;
  GetDlgItemText(IDC_URL2,st);
  ftok+=" ";
  while(ftok.Find(' ')>=0) {
    CString token=ftok.Mid(0,ftok.Find(' '));
    ftok=ftok.Mid(ftok.Find(' ')+1);
    ftok.TrimLeft();
    st.Replace(token,"");
    st.Replace("\r"," ");
    st.Replace("\t"," ");
    st.Replace("  "," ");
    st.Replace(" \n","\n");
    st.Replace("\n ","\n");
    st.Replace("\n\n","\n");
  }
  st.TrimLeft();
  st.TrimRight();
  /* add ? */
  if (state) {
    st+="\n";
    st+=filter;
  }
  st.Replace("\n","\r\n");      // W32 compatible
  SetDlgItemTextCP(this, IDC_URL2,st);
}
Пример #17
0
bool Get_XML_string (CXMLelement & node,
                        const char * sName,
                        CString & strValue,
                        const bool bUseDefault,
                        const bool bTrimSpaces)
  {
CAttribute * pAttribute = GetAttribute (node, sName);

  if (!pAttribute)
    if (bUseDefault)
      return false;
    else
      {
      strValue.Empty ();
      return false;
      }

  strValue = pAttribute->strValue;

  if (bTrimSpaces)
    {
    strValue.TrimLeft ();
    strValue.TrimRight ();
    }

  return true;

  }  // end of Get_XML_string
Пример #18
0
void
ProgramFolderPage::OnChangeFolder ()
{
  try
    {
      CWnd * pWnd = GetDlgItem(IDC_FOLDER);
      if (pWnd == 0)
	{
	  UNEXPECTED_CONDITION ("ProgramFolderPage::OnChangeFolder");
	}
      CString str;
      pWnd->GetWindowText (str);
      str.TrimLeft ();
      str.TrimRight ();
      pSheet->SetWizardButtons (PSWIZB_BACK
				| (str.GetLength() > 0 ? PSWIZB_NEXT : 0));
    }
  catch (const MiKTeXException & e)
    {
      pSheet->ReportError (e);
    }
  catch (const exception & e)
    {
      pSheet->ReportError (e);
    }
}
Пример #19
0
void CSelectStk::OnChangeEditcode() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CNDDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	CString	strText;
	m_editCode.GetWindowText( strText );
	strText.TrimLeft();
	strText.TrimLeft();
	if( strText.GetLength() > 0 )
	{
		int	nSel	=	m_comboGroupSrc.GetCurSel();
		if( CB_ERR == nSel ||
			CStockContainer::typeAll != (int)(m_comboGroupSrc.GetItemData( nSel )) )
		{
			m_comboGroupSrc.SelectGroupAll( );
			OnSelchangeComboGroupsrc();
		}
	}
	if( !m_listStockSrc.SelectCode( 0, strText ) )
		m_listStockSrc.SelectShortname( 0, strText );
}
Пример #20
0
	virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
		sTarget.TrimLeft("\244");

		if (sMessage.Left(2) == "``") {
			sMessage.LeftChomp(2);
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			CChan* pChan = m_pUser->FindChan(sTarget);
			if (pChan) {
				if (pChan->KeepBuffer())
					pChan->AddBuffer(":\244" + m_pUser->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage);
				m_pUser->PutUser(":\244" + m_pUser->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
			}

			CString sMsg = MakeIvec() + sMessage;
			sMsg.Encrypt(it->second);
			sMsg.Base64Encode();
			sMsg = "+OK *" + sMsg;

			PutIRC("PRIVMSG " + sTarget + " :" + sMsg);
			return HALTCORE;
		}

		return CONTINUE;
	}
Пример #21
0
void CSelectAdapter::Update(LineCollection &lc)
{
        m_ListCtrl.DeleteAllItems();
	    int n=lc.getLineCount();
		CString t;
        for(n--;n>=0;n--)
         {
			t=lc.line(n);
			t.TrimLeft();
			t.TrimRight();
			if (strlen(t)>0)
	        AddItem(0,0,t,3);
         }
		m_ListCtrl.UpdateWindow();
		n=m_ListCtrl.GetItemCount();
		for (n--;n>=0;n--)
		{
			if (m_Adapter.CompareNoCase(m_ListCtrl.GetItemText(n,0))==0)
				{
					SelectItem(n);
					return;
				}
		}
		m_Adapter=m_ListCtrl.GetItemText(0,0);
}
Пример #22
0
BOOL CListCtrlEx::OnToolTipText(UINT /*uID*/, NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/)
{
    BOOL bRet = TRUE;
#ifdef _TOOL_TIP_ENABLE
	TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
    TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
    UINT nID = pNMHDR->idFrom;
    if(!nID)
    	bRet = FALSE;

	if(bRet)
	{
		int nRow = ((nID-1) >> 10) & 0x3fffff ;
		int nCol = (nID-1) & 0x3ff;
		CString strTipText = GetItemText(nRow, nCol);
		strTipText.TrimRight();
		strTipText.TrimLeft();
#ifndef _UNICODE
		if (pNMHDR->code == TTN_NEEDTEXTA)
			lstrcpyn(pTTTA->szText, strTipText, 80);
		else
			_mbstowcsz(pTTTW->szText, strTipText, 80);
#else
		if(pNMHDR->code == TTN_NEEDTEXTA)
			_wcstombsz(pTTTA->szText, strTipText, 80);
		else
			lstrcpyn(pTTTW->szText, strTipText, 80);
#endif
	}
    
	*pResult = 0;
#endif

    return bRet;
}
Пример #23
0
CString GetCPUInfo()
{
	HKEY	hKey;
	if ( ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE, CPU_KEY, 0, KEY_READ, &hKey ) )
		return "Not Detected\n";

	TCHAR	szBuf[512];
	ZeroMemory( szBuf, sizeof( szBuf ) );

	DWORD	dwType	= REG_SZ,
			dwSize	= sizeof( szBuf );

	if ( ERROR_SUCCESS != RegQueryValueEx( hKey, CPU_VAL, NULL, &dwType, (LPBYTE)szBuf, &dwSize ) )
	{
		if ( ERROR_SUCCESS != RegQueryValueEx( hKey, CPU_VAL2, NULL, &dwType, (LPBYTE)szBuf, &dwSize ) )
		{
            RegCloseKey( hKey );
			return "\nProcessor:\n Not Detected\n";
		}
	} 
	RegCloseKey( hKey );

	CString strCPUInfo = szBuf;
	strCPUInfo.TrimLeft();
	strCPUInfo.TrimRight();

	return "\nProcessor:\n" + strCPUInfo + "\n";
}
Пример #24
0
UINT CString_2_ByteArray(CString omByteStr, BYTE abByteArr[], UINT ByteArrLen)
{
    memset(abByteArr, 0, ByteArrLen);
    omByteStr.TrimLeft(); // Get rid of whitespace if there is any
    omByteStr.TrimRight(); // Get rid of whitespace if there is any

    UINT LengthStr = omByteStr.GetLength();

    if ((2 * ByteArrLen) < LengthStr) // If storage capacity of of the target
    {
        // byte buffer is lesser than the string,
        omByteStr = omByteStr.Left(2 * ByteArrLen); // then chop off the extra
    }                                   // characters from right side of string

    CString omTempByte;
    // If number of characters is an odd number, then number of bytes needed
    UINT Result = LengthStr / 2 + LengthStr % 2; // is set accordingly
    int i = (int) Result - 1;
    while (omByteStr.GetLength())
    {
        omTempByte = omByteStr.Right(NO_OF_CHAR_IN_BYTE);
        abByteArr[i--] = (BYTE)_tcstol(omTempByte, L'\0', 16);
        omByteStr = omByteStr.Left(omByteStr.GetLength() - NO_OF_CHAR_IN_BYTE);
    }

    return Result;
}
Пример #25
0
static void outputAccumulated(ostream& fout, CString &sAccumulate)
{
	if(!sAccumulate.IsEmpty())
	{
		// strip extra whitespace

		sAccumulate.TrimLeft();// remove leading whitespace
		const char* b = LPCTSTR(sAccumulate);
		char* buff = new char[sAccumulate.GetLength()+1];
		char* c = buff;
		while(*b)
		{
			if(*b == '_') // inserted by joincomp
				*(c++) = ' ';

			else if(! (::iswspace(*b) && ::iswspace(*(b+1))))
			{
				*c = *b;
				++c;
			}
			++b;
		}
		*c='\0';

		// replace with preceding marker (i.e. \v )
		//fout <<'\\'<<lpszPrecedingMarker<<' '<<buff<<'\n';
		fout <<' '<<buff<<'\n';
	}
	sAccumulate="";
}
Пример #26
0
void CXMLDlg::Separate(const CString& szItemType, CString& szTitle, CString& szValue)
{
	szTitle = szItemType.SpanExcluding(_T("="));
	szTitle.TrimLeft();
	szTitle.TrimRight();
	szValue = szItemType.Mid(szItemType.Find('=')+1);
}
Пример #27
0
BOOL CServerPath::AddSubdir(CString subdir)
{
	subdir.TrimLeft( _T(" ") );
	subdir.TrimRight( _T(" ") );
	if (subdir == _MPT(""))
		return FALSE;

	if (m_nServerType & (FZ_SERVERTYPE_SUB_FTP_MVS | FZ_SERVERTYPE_SUB_FTP_BS2000) && m_Prefix != _T("."))
		return FALSE;

	m_Segments.push_back(subdir);

	if (m_nServerType & (FZ_SERVERTYPE_SUB_FTP_MVS | FZ_SERVERTYPE_SUB_FTP_BS2000) && !m_Segments.empty())
	{
		if (m_Segments.back().Right(1) == _T("."))
		{
			m_Segments.back().TrimRight(_MPT('.'));
			m_Prefix = _T(".");
		}
		else
			m_Prefix = _T("");
	}

	m_bEmpty = FALSE;
	
	return TRUE;
}
Пример #28
0
int  vsnet_addin::get_line_column(const char * file, int line)
{
	EnvDTE::DocumentPtr	pDoc;
	HRESULT hr = GetOpenFileDocument(pDoc,file);
	if (hr == S_FALSE)
		return false;
	EnvDTE::TextDocumentPtr pTextDocument;
	pDoc->Object(CComBSTR("TextDocument"),(IDispatch**)&pTextDocument);

	if (pTextDocument == NULL)
		return false;

	EnvDTE::TextSelectionPtr pSelection;
	hr = pTextDocument->get_Selection(&pSelection);
	if (pSelection == NULL)
	{
		return false;
	}	

	hr = pSelection->GotoLine(line,_variant_t(long(0)));
	hr = pSelection->SelectLine();
	CComBSTR bstr;
	pSelection->get_Text(&bstr);
	CString text = (LPCTSTR)(_bstr_t)bstr;
	CString right = text;
	right.TrimLeft();
	return text.GetLength()-right.GetLength();
}
Пример #29
0
void CPreStylePag::QueryAcadTextStyleCombo()
{
    //查询ACAD中已有的可用的文字样式
    CMObject obj, sobj;
    CString  strStyleName;
    CComboBox *lpStyle;
    long i, nCount;
	try
	{
        lpStyle = (CComboBox *)GetDlgItem(IDC_COMBO_STYLE);
        obj = EDIBAcad::objAcadDoc.GetPropertyByName(_T("TextStyles"));
		nCount =(long)obj.GetPropertyByName(_T("Count"));

		for(i = 0; i < nCount; i++)
		{
			sobj = obj.Invoke(_T("Item"), 1, &_variant_t(i));
			strStyleName = vtos(sobj.GetPropertyByName(_T("Name")));
			strStyleName.TrimLeft();
            strStyleName.TrimRight();
            if(strStyleName.GetLength() <= 0) continue;

            lpStyle->AddString(strStyleName);
		}
	}
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
	}
	catch(...)
	{
	}
}
Пример #30
0
	void BootStrap(T *pTarget, const CString& sContent)
	{
		if (!pTarget->GetBuffer().IsEmpty())
			return; // in this case the module was probably reloaded

		VCString vsLines;
		VCString::iterator it;

		sContent.Split("\n", vsLines);

		for (it = vsLines.begin(); it != vsLines.end(); ++it) {
			CString sLine(*it);
			sLine.Trim();
			if (sLine[0] == '@' && it+1 != vsLines.end())
			{
				CString sTimestamp = sLine.Token(0);
				sTimestamp.TrimLeft("@");
				timeval ts;
				ts.tv_sec = sTimestamp.Token(0, false, ",").ToLongLong();
				ts.tv_usec = sTimestamp.Token(1, false, ",").ToLong();

				CString sFormat = sLine.Token(1, true);

				CString sText(*++it);
				sText.Trim();

				pTarget->AddBuffer(sFormat, sText, &ts);
			} else
			{
				// Old format, escape the line and use as is.
				pTarget->AddBuffer(_NAMEDFMT(sLine));
			}
		}
	}