コード例 #1
0
ファイル: makedep.cpp プロジェクト: Akin-Net/mozilla-central
    void PrintIncludes(){
        int i = 0;
        while( i < m_includes.GetSize() ){
            CFileRecord *pRec = (CFileRecord*) m_includes[i];

            //  Don't write out files that don't exist or are not in the namespace
            //      of the programs using it (netscape_AppletMozillaContext.h doesn't
            //      mix well with 16 bits).
			// Also don't write out files that are in the noDependMap
			void*	lookupJunk;
            if( !pRec->m_bVisited && pRec->m_pathName.GetLength() != 0 && !noDependMap.Lookup(pRec->m_pathName, lookupJunk)) {

				// not supposed to have a file in the list that doesn't exist
				ASSERT(FileExists(pRec->m_pathName));

                CString csOutput;
                csOutput = pRec->m_pathName;
                FATName(csOutput);

				fprintf(pAltFile, "\\\n    %s ", (const char *) csOutput );

				// mark this one as done so we don't do it more than once
                pRec->m_bVisited = TRUE;

                pRec->PrintIncludes();
            }
            i++;
        }
    }
コード例 #2
0
ファイル: makedep.cpp プロジェクト: Akin-Net/mozilla-central
    static CFileRecord* FindFileRecord( const char *pName ){
		CFileRecord* pRec = NULL;
		CString name(pName);
		FixPathName(name);
		fileMap.Lookup(name, (void*&)pRec);
		return(pRec);
    }
コード例 #3
0
void CPPageExternalFilters::OnFilterSelectionChange()
{
    if (FilterOverride* f = GetCurFilter()) {
        if (m_pLastSelFilter == f) {
            return;
        }
        m_pLastSelFilter = f;

        m_iLoadType = f->iLoadType;
        UpdateData(FALSE);
        m_dwMerit = f->dwMerit;

        HTREEITEM dummy_item = m_tree.InsertItem(_T(""), 0, 0, nullptr, TVI_FIRST);
        if (dummy_item)
            for (HTREEITEM item = m_tree.GetNextVisibleItem(dummy_item); item; item = m_tree.GetNextVisibleItem(dummy_item)) {
                m_tree.DeleteItem(item);
            }

        CMapStringToPtr map;

        POSITION pos = f->guids.GetHeadPosition();
        while (pos) {
            POSITION tmp = pos;
            CString major = GetMediaTypeName(f->guids.GetNext(pos));
            CString sub = GetMediaTypeName(f->guids.GetNext(pos));

            HTREEITEM node = nullptr;

            void* val = nullptr;
            if (map.Lookup(major, val)) {
                node = (HTREEITEM)val;
            } else {
                map[major] = node = m_tree.InsertItem(major);
            }
            m_tree.SetItemData(node, 0);

            node = m_tree.InsertItem(sub, node);
            m_tree.SetItemData(node, (DWORD_PTR)tmp);
        }

        m_tree.DeleteItem(dummy_item);

        for (HTREEITEM item = m_tree.GetFirstVisibleItem(); item; item = m_tree.GetNextVisibleItem(item)) {
            m_tree.Expand(item, TVE_EXPAND);
        }

        m_tree.EnsureVisible(m_tree.GetRootItem());
    } else {
        m_pLastSelFilter = nullptr;

        m_iLoadType = FilterOverride::PREFERRED;
        UpdateData(FALSE);
        m_dwMerit = 0;

        m_tree.DeleteAllItems();
    }
}
コード例 #4
0
BOOL CMapInfo::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_nTotalBrushes = 0;
	m_nTotalEntities = 0;
	m_nNet = 0;

	for (brush_t *pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next) {
		m_nTotalBrushes++;

		if (pBrush->owner == world_entity)
			m_nNet++;
	}


	CMapStringToPtr mapEntity;

	int nValue = 0;

	for (entity_t *pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next) {
		m_nTotalEntities++;
		nValue = 0;
		mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void* &>(nValue));
		nValue++ ;
		mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void *>(nValue));
	}

	m_lstEntity.ResetContent();
	m_lstEntity.SetTabStops(96);
	CString strKey;
	POSITION pos = mapEntity.GetStartPosition();

	while (pos) {
		mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast<void* &>(nValue));
		CString strList;
		strList.Format("%s\t%i", strKey, nValue);
		m_lstEntity.AddString(strList);
	}

	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #5
0
ファイル: MyIENSHandle.cpp プロジェクト: vicentdsmin/myie
STDMETHODIMP CMyIENSHandle::Start(
        LPCWSTR szUrl,
        IInternetProtocolSink *pIProtSink,
        IInternetBindInfo *pIBindInfo,
        DWORD grfSTI,
        DWORD dwReserved)
{
	// Should we do the following or always fail? How can we continue if parsing failed?
	try{

	if(pMainFrame->m_bUseUrlFilter && !pMainFrame->m_bUrlFilterDirty)
	{
		CString strUrl(szUrl); void* tmp;
		strUrl.MakeLower();
		BOOL bFilter = FALSE;
		if(mapUrlFilter.Lookup(strUrl, tmp))
			bFilter = TRUE;
		else if(PatternFilter(strUrl))
			bFilter = TRUE;
		if(bFilter)
		{
			if(pIProtSink!=NULL)
			{
				m_pProtSink = pIProtSink;
				m_pProtSink->AddRef();
				m_pProtSink->ReportData(BSCF_FIRSTDATANOTIFICATION || BSCF_LASTDATANOTIFICATION || BSCF_DATAFULLYAVAILABLE, 42, 42);
				m_pProtSink->ReportResult(S_OK, 0, 0);
				m_pProtSink->Release();
				m_pProtSink = NULL;
			}
			return S_OK;
		}
	}

	}catch(...)
	{
	}

	return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
}
コード例 #6
0
ファイル: makedep.cpp プロジェクト: Akin-Net/mozilla-central
    static CFileRecord* AddFile( const char* pShortName, const char* pFullName, BOOL bSystem = FALSE, 
                BOOL bSource = FALSE ){

		char fullName[_MAX_PATH];
		BOOL bFound = FALSE;
		CString foundName;
		CString fixedShortName;
        CString s;

        // normalize the name
        fixedShortName = pShortName;
        FixPathName(fixedShortName);
        pShortName = fixedShortName;

        // if it is source, we might be getting an obj file.  If we do,
        //  convert it to a c or c++ file.
        if( bSource && (strcmp(GetExt(pShortName),".obj") == 0) ){
            char path_buffer[_MAX_PATH];
            char fname[_MAX_FNAME] = "";
            CString s;

            _splitpath( pShortName, NULL, NULL, fname, NULL );
            if( FileExists( s = CString(fname) + ".cpp") ){
                pShortName = s;
                pFullName = s;
            }
            else if( FileExists( s = CString(fname) + ".c" ) ){
                pShortName = s;
                pFullName = s;
            }
            else {
                return 0;
            }
        }

		// if pFullName was not constructed, construct it here based on the current directory
		if (!pFullName) {
			_AfxFullPath(fullName, pShortName);
			pFullName = fullName;
		}
		
		// first check to see if we already have this exact file
		CFileRecord *pRec = FindFileRecord(pFullName);

        // if not found and not a source file check the header list --
        // all files we've found in include directories are in the includeMap.
        // we can save gobs of time by getting it from there
        if (!pRec && !bSource)
            includeMap.Lookup(fixedShortName, (void*&)pRec);

        if (!pRec) {
            // not in one of our lists, start scrounging on disk

            // check the fullname first
            if (FileExists(pFullName)) {
                foundName = pFullName;
                bFound = TRUE;
            }
            else {
                // if still not found, search the include paths
                int i = 0;
                while( i < includeDirectories.GetSize() ){
                    if( FileExists( includeDirectories[i] + pShortName ) ){
                        foundName = includeDirectories[i] + pShortName;
                        bFound = TRUE;
                        break;
                    }
                    i++;
                }
            }
        }
        else {
            // we found it
            bFound = TRUE;
        }

		// source files are not allowed to be missing
		if (bSource && !pRec && !bFound) {
			fprintf(stderr, "Source file: %s doesn't exist\n", pFullName);
			mainReturn = -1;		// exit with an error, don't write out the results
		}

#ifdef _DEBUG
		if (!pRec && !bFound && !bSystem) {
			fprintf(stderr, "Header not found: %s (%s)\n", pShortName, pFullName);
		}
#endif

		// if none of the above logic found it already in the list, 
        // must be a new file, add it to the list
        if (bFound && (pRec == NULL)) {
            pRec = new CFileRecord( pShortName, foundName, bSystem, bSource);

			// if this one isn't a source file add it to the includeMap
			// for performance reasons (so we can find it there next time rather
			// than having to search the file system again)
			if (!bSource) {
				includeMap[pShortName] = pRec;
			}
        }
        return pRec;
    }
コード例 #7
0
ファイル: PropertiesList.cpp プロジェクト: Robertysc/ecos
void CPropertiesList::Fill(CConfigItem *pti)
{
  if(NULL==pti){
    DeleteAllItems();
    m_nFirstProperty=0;
    m_pti=NULL;
  } else if(pti!=m_pti){
    m_pti=pti;
    m_nMaxValueWidth=0;
    CConfigItem::TreeItemType type=m_pti->Type();
    int i;  

    // Initially flag all items as unnecessary - calls of SetItem or SetProperty will change this
    for(i=GetItemCount()-1;i>=0;--i){
      SetItemData(i,0);
    }
	  if (m_pti->HasBool () || (CConfigItem::None!=type)){
      SetItem(Macro, m_pti->Macro ());
    }
  
    if (m_pti->HasBool ()){
      SetItem(Enabled,m_pti->IsEnabled() ? _T("True") : _T("False"));
    }
    
    if(!m_pti->FileName().IsEmpty()){
      SetItem(File,m_pti->FileName());
    }
    SetItem(URL,m_pti->GetURL());

    if(CConfigItem::None!=type){
      switch(type){
        case CConfigItem::String:
          SetItem(Value,m_pti->StringValue());
          SetItem(DefaultValue,m_pti->StringDefaultValue());
          break;
        case CConfigItem::Integer:
          SetItem(Value,CUtils::IntToStr(m_pti->Value(),CConfigTool::GetConfigToolDoc()->m_bHex));
          SetItem(DefaultValue,CUtils::IntToStr(m_pti->DefaultValue(),CConfigTool::GetConfigToolDoc()->m_bHex));
          break;
        case CConfigItem::Double:
          SetItem(Value,CUtils::DoubleToStr(m_pti->DoubleValue()));
          SetItem(DefaultValue,CUtils::DoubleToStr(m_pti->DoubleDefaultValue()));
          break;
        case CConfigItem::Enum:
          SetItem(Value,m_pti->StringValue());
          SetItem(DefaultValue,m_pti->StringDefaultValue());
          break;
        default:
          ASSERT(FALSE);
          break;
      }
      SetItem(Type,CConfigItem::TreeItemTypeImage[type]);
    }
    
    // List all the properties applicable to me
    const std::string name = CUtils::UnicodeToStdStr (m_pti->Macro ());
    if (name.size () > 0)
    {
      const CdlConfiguration config = CConfigTool::GetConfigToolDoc ()->GetCdlConfig ();
      const CdlNode node = config->find_node (name, true);
      ASSERT (node);
      const std::vector<CdlProperty> & properties = node->get_properties ();
      std::vector<CdlProperty>::const_iterator property_i;
      CMapStringToPtr map; // count of each property name
      for (property_i = properties.begin (); property_i != properties.end (); property_i++) {// for each property
        // get the property name
        const CdlProperty &prop=*property_i;
        const CString strName(prop->get_property_name ().c_str());
        enum {VISIBLE_PROPERTIES_COUNT=sizeof visible_properties/sizeof visible_properties[0]};
        if (std::find (visible_properties, visible_properties + VISIBLE_PROPERTIES_COUNT, CUtils::UnicodeToStdStr(strName)) != visible_properties + VISIBLE_PROPERTIES_COUNT) {// if the property should be displayed
          // set the property arguments
          CString strPropertyArgs;
          const std::vector<std::string> & argv = prop->get_argv ();
          void *p;
          if(!map.Lookup(strName,p)){
            p=0;
          }

          p=(void *)((int)p+1);
          map.SetAt(strName,p);
          
          std::vector<std::string>::const_iterator argv_i;
          for (argv_i = argv.begin (); argv_i != argv.end (); argv_i++){ // for each property argument...
            if (argv_i != argv.begin ()){                              // ...except the first (the property name)
              CString strArg(CUtils::StripExtraWhitespace (CString(argv_i->c_str())));
              if (strPropertyArgs.GetLength () + strArg.GetLength() + 1 > 256) {// if the string is too long for the list control
                break; // no need to add any further arguments
              }
              strPropertyArgs += strArg; // add the argument to the string
              strPropertyArgs += _T (" "); // separate arguments by a space character
            }
          }
          // the list control appears to display a maximum of 256 characters
          int nIndex=SetItem(strName,strPropertyArgs,GetItemCount(),(int)p);
          SetItemData(nIndex,(DWORD)prop);
          
          // display the exclamation icon if the property is in a conflicts list
          bool bConflictItem =
            //					PropertyInConflictsList (* property_i, config->get_structural_conflicts ()) || ignore for now
            PropertyInConflictsList (prop, config->get_all_conflicts ());
          CListCtrl::SetItem (nIndex, 0, LVIF_IMAGE, NULL, bConflictItem ? 1 : 0, 0, 0, 0 );
        }
      }
    }
    
    for(i=GetItemCount()-1;i>=0;--i){
      if(0==GetItemData(i)){
        DeleteItem(i);
        if(i<m_nFirstProperty){
          m_nFirstProperty--;
        }
      }
    }
    CRect rect;
    GetClientRect(rect);
    int nAvailWidth=rect.Width()-GetColumnWidth(0);
    int w=max(m_nMaxValueWidth,nAvailWidth);
    m_f[1]=double(w)/double(rect.Width());
    SetColumnWidth(1,w); 
  }
}
コード例 #8
0
void CFontComboBox::EnumFontFamiliesEx(CDC& dc, BYTE nCharSet)
{
	CMapStringToPtr map;
	CString str;
	GetTheText(str);

	EmptyContents();
	ResetContent();
	LOGFONT lf;
	memset(&lf, 0, sizeof(LOGFONT));
	lf.lfCharSet = nCharSet;

	if (dc.m_hDC != NULL)
	{
		if (theApp.m_bWin4)
		{
			::EnumFontFamiliesEx(dc.m_hDC, &lf,
				(FONTENUMPROC) EnumFamPrinterCallBackEx, (LPARAM) this, NULL);
		}
		else
		{
			::EnumFontFamilies(dc.m_hDC, NULL,
				(FONTENUMPROC) EnumFamPrinterCallBack, (LPARAM) this);
		}
	}
	else
	{
		HDC hDC = theApp.m_dcScreen.m_hDC;
		ASSERT(hDC != NULL);
		if (theApp.m_bWin4)
		{
			::EnumFontFamiliesEx(hDC, &lf,
				(FONTENUMPROC) EnumFamScreenCallBackEx, (LPARAM) this, NULL);
		}
		else
		{
			::EnumFontFamilies(hDC, NULL,
				(FONTENUMPROC) EnumFamScreenCallBack, (LPARAM) this);
		}
	}
	// now walk through the fonts and remove (charset) from fonts with only one

	int nCount = m_arrayFontDesc.GetSize();
	// walk through fonts adding names to string map
	// first time add value 0, after that add value 1
	for (int i = 0; i<nCount;i++)
	{
		CFontDesc* pDesc = (CFontDesc*)m_arrayFontDesc[i];
		void* pv = NULL;
		if (map.Lookup(pDesc->m_strName, pv)) // found it
		{
			if (pv == NULL) // only one entry so far
			{
				map.RemoveKey(pDesc->m_strName);
				map.SetAt(pDesc->m_strName, (void*)1);
			}
		}
		else // not found
			map.SetAt(pDesc->m_strName, (void*)0);
	}

	for (i = 0; i<nCount;i++)
	{
		CFontDesc* pDesc = (CFontDesc*)m_arrayFontDesc[i];
		CString str = pDesc->m_strName;
		void* pv = NULL;
		VERIFY(map.Lookup(str, pv));
		if (pv != NULL && !pDesc->m_strScript.IsEmpty())
		{
			str += " (";
			str += pDesc->m_strScript;
			str += ")";
		}

		int nIndex = AddString(str);
		ASSERT(nIndex >=0);
		if (nIndex >=0) //no error
			SetItemData(nIndex, (DWORD)pDesc);
	}

	SetTheText(str);
	m_arrayFontDesc.RemoveAll();
}