Esempio n. 1
0
void AddIncludeFileDlg::UpdateLineToAdd()
{
    wxString line;
    wxFileName fn(m_fullpath);
    m_textCtrlFullPath->ChangeValue(fn.GetFullPath());

    //try to get a match in the include path for this file
    wxString pp = fn.GetFullPath();
    pp.Replace(wxT("\\"), wxT("/"));

    wxString rest;
    for(size_t i=0; i< m_includePath.GetCount(); i++) {
        if(pp.StartsWith( m_includePath.Item(i) , &rest )) {
            break;
        }
    }

    if(rest.IsEmpty()) {
        rest = fn.GetFullName();
    }

    wxString errMsg;
    wxString projectName = clMainFrame::Get()->GetMainBook()->GetActiveEditor()->GetProject();
    ProjectPtr proj = WorkspaceST::Get()->FindProjectByName(projectName, errMsg);
    if(proj) {
        wxArrayString incls = proj->GetIncludePaths();
        std::sort(incls.begin(), incls.end(), SAscendingSort());

        for(size_t i=0; i<incls.GetCount(); i++) {
            wxString path = incls.Item(i);
#ifdef __WXMSW__
            path.MakeLower();
#endif
            if(m_fullpath.StartsWith(path, &rest) ) {
                break;
            }
        }
    }

    rest.Replace(wxT("\\"), wxT("/"));
    if(rest.StartsWith(wxT("/"))) {
        rest.Remove(0, 1);
    }

    if(!ManagerST::Get()->IsFileInWorkspace(m_fullpath)) {
        line << wxT("#include <") << rest << wxT(">");

    } else {
        line << wxT("#include \"") << rest << wxT("\"");

    }
    m_textCtrlLineToAdd->ChangeValue(line);
}
Esempio n. 2
0
// read in addresses from old pingplug
void import_ping_addresses() {
	int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	EnterCriticalSection(&list_cs);
	list_items.clear();
	for(int index = 0; index < count; index++) {
		import_ping_address(index, pa);
		list_items.push_back(pa);
	}
	std::sort(list_items.begin(), list_items.end(), SAscendingSort());
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
}
Esempio n. 3
0
// call with list_cs locked
void read_ping_addresses() {
	HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
	PINGADDRESS pa;

	list_items.clear();
	while ( hContact != NULL ) {
		char *proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
		if ( proto && lstrcmp( PROTO, proto) == 0) {
			pa.hContact = hContact;
			read_ping_address(pa);
			list_items.push_back(pa);
		}

		hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
	}	
	std::sort(list_items.begin(), list_items.end(), SAscendingSort());
}