Ejemplo n.º 1
0
void ProjectOptionsDlg::OnFileToggleMarkClick(wxCommandEvent& /*event*/)
{
    wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
    int targetIdx = lstTargets->GetSelection();
    ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);

    wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
    for (int i = 0; i < (int)list->GetCount(); ++i)
    {
        ProjectFile* pf = m_Project->GetFile(i);
        list->Check(i, !list->IsChecked(i));
        if (list->IsChecked(i))
            pf->AddBuildTarget(target->GetTitle());
        else
            pf->RemoveBuildTarget(target->GetTitle());
    }
}
Ejemplo n.º 2
0
void ProjectOptionsDlg::DoBeforeTargetChange(bool force)
{
    wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);

    // if no previously selected target, exit
    if (m_Current_Sel == -1)
        return;

    if (force || lstTargets->GetSelection() != m_Current_Sel)
    {
        // selected another build target
        // save changes to the previously selected target
        wxArrayString array;
        ProjectBuildTarget* target = m_Project->GetBuildTarget(m_Current_Sel);
        if (!target)
            return;

        target->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection()));
        wxFileName fname(XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->GetValue());
//        fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath());
//        fname.MakeRelativeTo(m_Project->GetBasePath());
        target->SetOutputFilename(fname.GetFullPath());

        fname.Assign(XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->GetValue());
//        fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath());
//        fname.MakeRelativeTo(m_Project->GetBasePath());
        target->SetObjectOutput(fname.GetFullPath());

        target->SetCreateHex(XRCCTRL(*this, "chkCreateHex", wxCheckBox)->GetValue());

        // files options
        wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
        int count = list->GetCount();
        for (int i = 0; i < count; ++i)
        {
            ProjectFile* pf = m_Project->GetFile(i);
            if (!pf)
                break;

            if (list->IsChecked(i))
                pf->AddBuildTarget(target->GetTitle());
            else
                pf->RemoveBuildTarget(target->GetTitle());
        }
    }
}
Ejemplo n.º 3
0
int ProjectManager::DoAddFileToProject(const wxString& filename, cbProject* project, wxArrayInt& targets)
{
    if (!project)
        return 0;

    // do we have to ask for target?
    if (targets.GetCount() == 0)
    {
        // if project has only one target, use this
        if (project->GetBuildTargetsCount() == 1)
            targets.Add(0);
        // else display multiple target selection dialog
        else
        {
            targets = m_ui->AskForMultiBuildTargetIndex(project);
            if (targets.GetCount() == 0)
                return 0;
        }
    }

    // make sure filename is relative to project path
    wxFileName fname(filename);
    fname.Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE, project->GetBasePath());
    fname.MakeRelativeTo(project->GetBasePath());

    // add the file to the first selected target
    ProjectFile* pf = project->AddFile(targets[0], fname.GetFullPath());
    if (pf)
    {
        // if the file was added successfully,
        // add to this file the rest of the selected targets...
        for (size_t i = 0; i < targets.GetCount(); ++i)
        {
            ProjectBuildTarget* target = project->GetBuildTarget(targets[i]);
            if (target)
                pf->AddBuildTarget(target->GetTitle());
        }
    }
    return targets.GetCount();
}
Ejemplo n.º 4
0
bool MSVC7Loader::DoImportFiles(TiXmlElement* root, int numConfigurations)
{
    if (!root)
        return false;

    TiXmlElement* files = root->FirstChildElement("Files");
    if (!files)
        files = root; // might not have "Files" section
    while (files)
    {
        TiXmlElement* file = files->FirstChildElement("File");
        while (file)
        {
            wxString fname = ReplaceMSVCMacros(cbC2U(file->Attribute("RelativePath")));

            TiXmlElement* conf = file->FirstChildElement("FileConfiguration");
            for (; conf; conf=conf->NextSiblingElement("FileConfiguration"))
            {
                // find the target to which it applies
                wxString sTargetName = cbC2U(conf->Attribute("Name"));
                sTargetName.Replace(_T("|"), _T(" "), true);
                ProjectBuildTarget* bt = m_pProject->GetBuildTarget(sTargetName);

                TiXmlElement* tool = conf->FirstChildElement("Tool");
                for (; tool; tool=tool->NextSiblingElement("Tool"))
                {
                    // get additional include directories
                    wxString sAdditionalInclude;
                    sAdditionalInclude = cbC2U(tool->Attribute("AdditionalIncludeDirectories"));

                    if (sAdditionalInclude.Len() > 0)
                    {
                        // we have to add the additionnal include directories.
                        // parse the different include directories (comma separated)
                        int iStart;
                        int iCommaPosition;
                        iStart = 0;
                        iCommaPosition = sAdditionalInclude.Find(_T(","));
                        do
                        {
                            int iEnd;
                            if (iCommaPosition != wxNOT_FOUND)
                            {
                                iEnd = iCommaPosition - 1;
                                if (iEnd < iStart) iEnd = iStart;
                            }
                            else
                                iEnd = sAdditionalInclude.Len() - 1;

                            wxString sInclude = sAdditionalInclude.Mid(iStart, iEnd - iStart + 1);
                            if (bt)
                                bt->AddIncludeDir(sInclude);

                            // remove the directory from the include list
                            sAdditionalInclude = sAdditionalInclude.Mid(iEnd + 2);
                            iCommaPosition = sAdditionalInclude.Find(_T(","));
                        }
                        while (sAdditionalInclude.Len() > 0);
                    }
                }
            }

            if ((!fname.IsEmpty()) && (fname != _T(".\\")))
            {
                if (fname.StartsWith(_T(".\\")))
                    fname.erase(0, 2);

                if (!platform::windows)
                    fname.Replace(_T("\\"), _T("/"), true);

                ProjectFile* pf = m_pProject->AddFile(0, fname);
                if (pf)
                {
                    // add it to all configurations, not just the first
                    for (int i = 1; i < numConfigurations; ++i)
                    {
                        pf->AddBuildTarget(m_pProject->GetBuildTarget(i)->GetTitle());
                        HandleFileConfiguration(file, pf); // We need to do this for all files
                    }
                }
            }
            file = file->NextSiblingElement("File");
        }

        // recurse for nested filters
        TiXmlElement* nested = files->FirstChildElement("Filter");
        while (nested)
        {
            DoImportFiles(nested, numConfigurations);
            nested = nested->NextSiblingElement("Filter");
        }

        files = files->NextSiblingElement("Files");
    }

    // recurse for nested filters
    TiXmlElement* nested = root->FirstChildElement("Filter");
    while (nested)
    {
        DoImportFiles(nested, numConfigurations);
        nested = nested->NextSiblingElement("Filter");
    }

    return true;
}