⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appsettings.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    }    return strCygwinInstallPath;}#endif// Save config infobool ecSettings::SaveConfig(){    wxConfig config(wxGetApp().GetSettings().GetConfigAppName());        config.Write(_("/Files/LastFile"), m_lastFilename);        config.Write(_("/Window Status/FrameStatus"), (long) m_frameStatus);    config.Write(_("/Window Status/ShowToolBar"), m_showToolBar);    config.Write(_("/Window Status/ShowSplashScreen"), m_showSplashScreen);    config.Write(_("/Window Status/ShowConflictsWindow"), m_showConflictsWindow);    config.Write(_("/Window Status/ShowPropertiesWindow"), m_showPropertiesWindow);    config.Write(_("/Window Status/ShowShortDescrWindow"), m_showShortDescrWindow);    config.Write(_("/Window Status/ShowMemoryWindow"), m_showMemoryWindow);    config.Write(_("/Window Status/ShowOutputWindow"), m_showOutputWindow);        config.Write(_("/Window Size/WindowX"), (long) m_frameSize.x);    config.Write(_("/Window Size/WindowY"), (long) m_frameSize.y);    config.Write(_("/Window Size/WindowWidth"), (long) m_frameSize.width);    config.Write(_("/Window Size/WindowHeight"), (long) m_frameSize.height);    config.Write(_("/Window Size/TreeSashWidth"), (long) m_treeSashSize.x);    config.Write(_("/Window Size/TreeSashHeight"), (long) m_treeSashSize.y);    config.Write(_("/Window Size/ConfigPaneWidth"), (long) m_configPaneWidth);    config.Write(_("/Window Size/ConflictsWidth"), (long) m_conflictsSashSize.x);    config.Write(_("/Window Size/ConflictsHeight"), (long) m_conflictsSashSize.y);    config.Write(_("/Window Size/PropertiesWidth"), (long) m_propertiesSashSize.x);    config.Write(_("/Window Size/PropertiesHeight"), (long) m_propertiesSashSize.y);    config.Write(_("/Window Size/ShortDescrWidth"), (long) m_shortDescrSashSize.x);    config.Write(_("/Window Size/ShortDescrHeight"), (long) m_shortDescrSashSize.y);    config.Write(_("/Window Size/OutputWidth"), (long) m_outputSashSize.x);    config.Write(_("/Window Size/OutputHeight"), (long) m_outputSashSize.y);    config.Write(_("/Window Size/MemoryWidth"), (long) m_memorySashSize.x);    config.Write(_("/Window Size/MemoryHeight"), (long) m_memorySashSize.y);        config.Write(_("/Options/ShowMacroNames"), m_showMacroNames);    config.Write(_("/Options/UseCustomViewer"), m_bUseCustomViewer);    config.Write(_("/Options/UseExternalBrowser"), m_bUseExternalBrowser);    config.Write(_("/Options/UseCustomBrowser"), (long) m_eUseCustomBrowser);    config.Write(_("/Options/Browser"), m_strBrowser);    config.Write(_("/Options/Viewer"), m_strViewer);    config.Write(_("/Options/HexDisplay"), m_bHex);    config.Write(_("/Options/UseDefaultFonts"), m_windowSettings.m_useDefaults);    config.Write(_("/Rule/Checking"), (long) m_nRuleChecking);        config.Write(_("/Paths/UserToolsDir"), m_userToolsDir);    config.Write(_("/Paths/BuildToolsDir"), m_buildToolsDir);        config.Write(_("/Build/Make Options"), m_strMakeOptions);    // Find dialog settings    config.Write(_("/Find/Text"), m_findText);    config.Write(_("/Find/MatchWholeWord"), m_findMatchWholeWord);    config.Write(_("/Find/MatchCase"), m_findMatchCase);    config.Write(_("/Find/Direction"), m_findDirection);    config.Write(_("/Find/SearchWhat"), m_findSearchWhat);    config.Write(_("/Find/DialogX"), (long) m_findDialogPos.x);    config.Write(_("/Find/DialogY"), (long) m_findDialogPos.y);        // Package dialog settings    config.Write(_("/Packages/OmitHardwarePackages"), m_omitHardwarePackages);    config.Write(_("/Packages/MatchPackageNamesExactly"), m_matchPackageNamesExactly);    // Save current repository to eCos Configuration Tool/Paths/RepositoryDir    // UNLESS it was overridden by ECOS_REPOSITORY    {        wxString envVarValue = wxGetenv(wxT("ECOS_REPOSITORY"));        if (m_strRepository == envVarValue)        {            // Don't override the value in the local settings        }        else            config.Write(wxT("/Paths/RepositoryDir"), m_strRepository);    }        // Run tests settings    m_runTestsSettings.SaveConfig(config);    // Fonts    m_windowSettings.SaveConfig(config);        return TRUE;}void ecSettings::ShowSettingsDialog(const wxString& page){#if 0    ecSettingsDialog* dialog = new ecSettingsDialog(wxGetApp().GetTopWindow());    if (!page.IsEmpty())        dialog->GetNotebook()->SetSelection(ecFindNotebookPage(dialog->GetNotebook(), page));        int ret = dialog->ShowModal();    dialog->Destroy();#endif}#ifndef MAX_PATH#define MAX_PATH 1024#endif// TODO for non-Windows platformsconst ecFileName& ecSettings::DefaultExternalBrowser(){#ifdef __WXMSW__    static bool bFirstTime=TRUE;    if(bFirstTime){        const ecFileName strFile(ecFileName::GetTempPath()+wxT("index.html"));        wxFile f;        if(f.Create(strFile, TRUE))        {            f.Close();            bool rc=((int)  ::FindExecutable(strFile,wxT("."),m_strDefaultExternalBrowser.GetWriteBuf(MAX_PATH))>32);            m_strDefaultExternalBrowser.UngetWriteBuf();            if(!rc){                m_strDefaultExternalBrowser=wxT("");            }            wxRemoveFile(strFile);        }        bFirstTime=FALSE;    }#endif    return m_strDefaultExternalBrowser;}ecFileName ecSettings::m_strDefaultExternalBrowser;// Go looking for potential candidates in SOFTWARE\Microsoft\Windows\CurrentVersion\App Pathsint ecSettings::GetRepositoryRegistryClues(wxArrayString& arstr, const wxString& pszPrefix){    arstr.Clear();#ifdef __WXMSW__    wxConfig config(wxT("Windows"), wxT("Microsoft"), wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE);    config.SetPath(wxT("/CurrentVersion/App Paths"));    wxString key(wxT(""));    long index;    bool bMore = config.GetFirstGroup(key, index);    while (bMore)    {        if (key.Find(pszPrefix) == 0)        {            wxString value;            //wxString key2(wxString(wxT("/")) + key + wxString(wxT("/Path")));            wxString key2(key + wxString(wxT("/Path")));            if (config.Read(key2, & value))            {                arstr.Add(value);            }        }        bMore = config.GetNextGroup(key, index);    }    return arstr.GetCount();#else    return 0;#endif}// Finds the path of the latest installed eCoswxString ecSettings::FindLatestVersion(){#ifdef __WXGTK__    wxString ecosRoot(wxT("/opt/ecos"));    wxLogNull log;    wxDir dir(ecosRoot);        wxString latestDir;    wxString latestVersion;        if (dir.IsOpened())    {        wxString filename;        bool cont = dir.GetFirst(& filename, wxT("ecos-*"), wxDIR_DIRS);        while (cont)        {            wxString ver(filename.Mid(5));            if (latestVersion.IsEmpty() || latestVersion.CompareTo(ver) < 0)            {                latestVersion = ver;                latestDir = ecosRoot + wxT("/") + filename;            }                        cont = dir.GetNext(& filename);        }    }//    if (latestDir.IsEmpty())//        latestDir = wxGetCwd();    return latestDir;#else    wxMessageBox(wxT("FindLatestVersion() is only implemented for Unix."));    return wxEmptyString;#endif}wxString ecSettings::GetInstallVersionKey (){#ifdef __WXMSW__#ifndef MAX_PATH#define MAX_PATH 1024#endif    wxString strKey = wxT("SOFTWARE\\eCos");    wxString strVersionKey = wxT("");    wxString rc = wxT("");    wxChar pszBuffer [MAX_PATH + 1];    HKEY hKey;        // get the greatest eCos version subkey    if (ERROR_SUCCESS == RegOpenKeyEx (HKEY_LOCAL_MACHINE, strKey, 0L, KEY_READ, &hKey)) {        DWORD dwIndex = 0;        while (ERROR_SUCCESS == RegEnumKey (hKey, dwIndex++, (LPTSTR) pszBuffer, sizeof (pszBuffer))) {            if (strVersionKey.CompareTo (pszBuffer) < 0) {                strVersionKey = pszBuffer;            }        }        RegCloseKey (hKey);    }    return strVersionKey;#else    wxMessageBox(wxT("GetInstallVersionKey() is only implemented for Windows."));    return wxEmptyString;#endif}/* * ecRunTestSettings * Settings relating to running tests */IMPLEMENT_DYNAMIC_CLASS(ecRunTestsSettings, wxObject)ecRunTestsSettings::ecRunTestsSettings():    m_ep(CeCosTest::ExecutionParameters::RUN),    m_nTimeout(900),    m_nDownloadTimeout(120),    m_nTimeoutType(TIMEOUT_AUTOMATIC),    m_nDownloadTimeoutType(TIMEOUT_SPECIFIED),    m_bRemote(FALSE),    m_bSerial(TRUE),    m_strPort(wxT("COM1")),    m_nBaud(38400),    m_nLocalTCPIPPort(1),    m_nReset(RESET_MANUAL),    m_nResourcePort(1),    m_nRemotePort(1),    m_bFarmed(TRUE),    m_strRemoteHost(wxT("")),    m_strResourceHost(wxT("")),    m_strLocalTCPIPHost(wxT("")),    m_strReset(wxT("")){}ecRunTestsSettings::ecRunTestsSettings(const ecRunTestsSettings& settings){    Copy(settings);}void ecRunTestsSettings::Copy(const ecRunTestsSettings& settings){    m_nTimeoutType = settings.m_nTimeoutType;    m_nDownloadTimeoutType = settings.m_nDownloadTimeoutType;    m_bRemote = settings.m_bRemote;    m_bSerial = settings.m_bSerial;    m_strPort = settings.m_strPort;    m_nBaud = settings.m_nBaud;    m_nLocalTCPIPPort = settings.m_nLocalTCPIPPort;    m_nReset = settings.m_nReset;    m_nResourcePort = settings.m_nResourcePort;    m_nRemotePort = settings.m_nRemotePort;    m_bFarmed = settings.m_bFarmed;    m_strTarget = settings.m_strTarget;    m_strRemoteHost = settings.m_strRemoteHost;    m_strResourceHost = settings.m_strResourceHost;    m_strLocalTCPIPHost = settings.m_strLocalTCPIPHost;    m_strReset = settings.m_strReset;}bool ecRunTestsSettings::LoadConfig(wxConfig& config){    config.Read(_("/Run Tests/TimeoutType"), & m_nTimeoutType);    config.Read(_("/Run Tests/DownloadTimeoutType"), & m_nDownloadTimeoutType);    config.Read(_("/Run Tests/Remote"), (bool*) & m_bRemote);    config.Read(_("/Run Tests/Serial"), (bool*) & m_bSerial);    config.Read(_("/Run Tests/Port"), & m_strPort);    config.Read(_("/Run Tests/Baud"), & m_nBaud);    config.Read(_("/Run Tests/LocalTCPIPHost"), & m_strLocalTCPIPHost);    config.Read(_("/Run Tests/LocalTCPIPPort"), & m_nLocalTCPIPPort);//  Reset type is determined at run-time for standalone configtool//    config.Read(_("/Run Tests/ResetType"), & m_nReset);    config.Read(_("/Run Tests/ResetString"), & m_strReset);    config.Read(_("/Run Tests/ResourceHost"), & m_strResourceHost);    config.Read(_("/Run Tests/ResourcePort"), & m_nResourcePort);    config.Read(_("/Run Tests/RemoteHost"), & m_strRemoteHost);    config.Read(_("/Run Tests/RemotePort"), & m_nRemotePort);    config.Read(_("/Run Tests/Farmed"), (bool*) & m_bFarmed);    return TRUE;}bool ecRunTestsSettings::SaveConfig(wxConfig& config){    config.Write(_("/Run Tests/TimeoutType"), (long) m_nTimeoutType);    config.Write(_("/Run Tests/DownloadTimeoutType"), (long) m_nDownloadTimeoutType);    config.Write(_("/Run Tests/Remote"), m_bRemote);    config.Write(_("/Run Tests/Serial"), m_bSerial);    config.Write(_("/Run Tests/Port"), m_strPort);    config.Write(_("/Run Tests/Baud"), (long) m_nBaud);    config.Write(_("/Run Tests/LocalTCPIPHost"), m_strLocalTCPIPHost);    config.Write(_("/Run Tests/LocalTCPIPPort"), (long) m_nLocalTCPIPPort);    config.Write(_("/Run Tests/ResetType"), (long) m_nReset);    config.Write(_("/Run Tests/ResetString"), m_strReset);    config.Write(_("/Run Tests/ResourceHost"), m_strResourceHost);    config.Write(_("/Run Tests/ResourcePort"), (long) m_nResourcePort);    config.Write(_("/Run Tests/RemoteHost"), m_strRemoteHost);    config.Write(_("/Run Tests/RemotePort"), (long) m_nRemotePort);    config.Write(_("/Run Tests/Farmed"), m_bFarmed);    return TRUE;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -