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

📄 appsettings.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 3 页
字号:
//####COPYRIGHTBEGIN####//// ----------------------------------------------------------------------------// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.// Copyright (C) 2003 John Dallaway//// This program is part of the eCos host tools.//// This program is free software; you can redistribute it and/or modify it// under the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 of the License, or (at your option)// any later version.//// This program is distributed in the hope that it will be useful, but WITHOUT// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for// more details.//// You should have received a copy of the GNU General Public License along with// this program; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.//// ----------------------------------------------------------------------------////####COPYRIGHTEND####// appsettings.cpp :////===========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):   julians, jld// Contact(s):  julians// Date:        2000/08/29// Version:     $Id: appsettings.cpp,v 1.27 2001/12/14 17:34:03 julians Exp $// Purpose:// Description: Implementation file for the ecSettings// Requires:// Provides:// See also:// Known bugs:// Usage:////####DESCRIPTIONEND####////===========================================================================// ============================================================================// declarations// ============================================================================// ----------------------------------------------------------------------------// headers// ----------------------------------------------------------------------------#ifdef __GNUG__#pragma implementation "appsettings.h"#endif// Includes other headers for precompiled compilation#include "ecpch.h"#ifdef __BORLANDC__#pragma hdrstop#endif#include "wx/config.h"#include "wx/file.h"#include "appsettings.h"#include "configtree.h"#include "outputwin.h"#include "shortdescrwin.h"#include "mainwin.h"// For SystemInfo#ifdef __WXMSW__#include <windows.h>#include "wx/msw/winundef.h"#ifdef GetTempPath#undef GetTempPath#endif#endif/** User-changeable and other settings to be saved between sessions*/IMPLEMENT_DYNAMIC_CLASS(ecSettings, wxObject)ecSettings::ecSettings(){    m_showToolBar = TRUE;    m_frameSize = wxRect(0, 0, 600, 500);    m_appName = _("eCos Configuration Tool");    m_showSplashScreen = TRUE;    m_userName = wxEmptyString;    m_serialNumber = 0;    m_frameStatus = ecSHOW_STATUS_NORMAL;        m_treeSashSize = wxSize(400, 1000);    m_conflictsSashSize = wxSize(1000, 80);    m_propertiesSashSize = wxSize(1000, 80);    m_shortDescrSashSize = wxSize(1000, 80);    m_memorySashSize = wxSize(1000, 50);    m_outputSashSize = wxSize(1000, 50);    m_configPaneWidth = 200;        m_showConflictsWindow = FALSE;    m_showPropertiesWindow = TRUE;    m_showShortDescrWindow = TRUE;    m_showMemoryWindow = FALSE;    m_showOutputWindow = TRUE;    m_showMacroNames = FALSE;        m_bUseCustomViewer = FALSE;    m_bUseExternalBrowser = FALSE;    m_eUseCustomBrowser = ecAssociatedExternal;    m_bHex = FALSE;    m_nRuleChecking = Immediate|Deferred|SuggestFixes ;#ifdef __WXMSW__    m_strViewer = wxT("notepad");#endif    // Find dialog settings    m_findText = wxEmptyString;    m_findMatchWholeWord = FALSE;    m_findMatchCase = FALSE;    m_findDirection = TRUE; // Down is TRUE, Up is FALSE    m_findSearchWhat = _("Macro names"); // Macro names, item names etc.    m_findDialogPos = wxPoint(-1, -1);    m_editSaveFileOnly = FALSE;    // Packages dialog settings    m_omitHardwarePackages = FALSE;    m_matchPackageNamesExactly = FALSE;}// Copy constructorecSettings::ecSettings(const ecSettings& settings){    Copy(settings);}void ecSettings::Copy(const ecSettings& settings){    m_showToolBar = settings.m_showToolBar;    m_frameSize = settings.m_frameSize;    m_showSplashScreen = settings.m_showSplashScreen;    m_userName = settings.m_userName;    m_serialNumber = settings.m_serialNumber;        m_treeSashSize = settings.m_treeSashSize;    m_conflictsSashSize = settings.m_conflictsSashSize;    m_propertiesSashSize = settings.m_propertiesSashSize;    m_memorySashSize = settings.m_memorySashSize;    m_outputSashSize = settings.m_outputSashSize;    m_configPaneWidth = settings.m_configPaneWidth;        m_showMacroNames = settings.m_showMacroNames;        m_bUseCustomViewer = settings.m_bUseCustomViewer;    m_bUseExternalBrowser = settings.m_bUseExternalBrowser;    m_eUseCustomBrowser = settings.m_eUseCustomBrowser;    m_bHex = settings.m_bHex;    m_nRuleChecking = settings.m_nRuleChecking;    // Find dialog settings    m_findText = settings.m_findText;    m_findMatchWholeWord = settings.m_findMatchWholeWord;    m_findMatchCase = settings.m_findMatchCase;    m_findDirection = settings.m_findDirection; // Down is TRUE, Up is FALSE    m_findSearchWhat = settings.m_findSearchWhat;    m_findDialogPos = settings.m_findDialogPos;    // Run tests settings    m_runTestsSettings = settings.m_runTestsSettings;    m_userToolsDir = settings.m_userToolsDir;    m_buildToolsDir = settings.m_buildToolsDir;    m_editSaveFileOnly = settings.m_editSaveFileOnly;    // Packages dialog settings    m_omitHardwarePackages = settings.m_omitHardwarePackages;    m_matchPackageNamesExactly = settings.m_matchPackageNamesExactly;}ecSettings::~ecSettings(){}// Do some initialisation within ecApp::OnInitbool ecSettings::Init(){    return TRUE;}// Get a name suitable for the configuration file on all platforms:// e.g. eCos Configuration Tool on Windows, .eCosConfigTool on UnixwxString ecSettings::GetConfigAppName() const{#ifdef __WXGTK__    return wxString(wxT("eCosConfigTool"));#else    return GetAppName();#endif}// Create new filenamewxString ecSettings::GenerateFilename(const wxString& rootName){    wxString path;    if (!m_lastFilename.IsEmpty())        path = wxPathOnly(m_lastFilename);    else	//        path = wxGetApp().GetAppDir();        path = wxGetCwd();        wxString filename(path);    if (filename.Last() != wxFILE_SEP_PATH )        filename += wxFILE_SEP_PATH;    filename += rootName;        wxString fullFilename = filename + wxT(".ecc");    int i = 0;    wxString postfixStr;    while (wxFileExists(fullFilename))    {        i ++;        postfixStr.Printf("%d", i);        fullFilename = filename + postfixStr + wxT(".ecc");    }        m_lastFilename = fullFilename;    return fullFilename;}// Load config infobool ecSettings::LoadConfig(){    wxConfig config(wxGetApp().GetSettings().GetConfigAppName());        config.Read(_("/Window Status/FrameStatus"), & m_frameStatus);    config.Read(_("/Window Status/ShowToolBar"), (bool*) & m_showToolBar);    config.Read(_("/Window Status/ShowSplashScreen"), (bool*) & m_showSplashScreen);    config.Read(_("/Window Status/ShowConflictsWindow"), (bool*) & m_showConflictsWindow);    config.Read(_("/Window Status/ShowPropertiesWindow"), (bool*) & m_showPropertiesWindow);    config.Read(_("/Window Status/ShowShortDescrWindow"), (bool*) & m_showShortDescrWindow);    config.Read(_("/Window Status/ShowMemoryWindow"), (bool*) & m_showMemoryWindow);    config.Read(_("/Window Status/ShowOutputWindow"), (bool*) & m_showOutputWindow);        config.Read(_("/Files/LastFile"), & m_lastFilename);        config.Read(_("/Window Size/WindowX"), & m_frameSize.x);    config.Read(_("/Window Size/WindowY"), & m_frameSize.y);    config.Read(_("/Window Size/WindowWidth"), & m_frameSize.width);    config.Read(_("/Window Size/WindowHeight"), & m_frameSize.height);    config.Read(_("/Window Size/TreeSashWidth"), & m_treeSashSize.x);    config.Read(_("/Window Size/TreeSashHeight"), & m_treeSashSize.y);    config.Read(_("/Window Size/ConfigPaneWidth"), & m_configPaneWidth);    config.Read(_("/Window Size/ConflictsWidth"), & m_conflictsSashSize.x);    config.Read(_("/Window Size/ConflictsHeight"), & m_conflictsSashSize.y);    config.Read(_("/Window Size/PropertiesWidth"), & m_propertiesSashSize.x);    config.Read(_("/Window Size/PropertiesHeight"), & m_propertiesSashSize.y);    config.Read(_("/Window Size/ShortDescrWidth"), & m_shortDescrSashSize.x);    config.Read(_("/Window Size/ShortDescrHeight"), & m_shortDescrSashSize.y);    config.Read(_("/Window Size/OutputWidth"), & m_outputSashSize.x);    config.Read(_("/Window Size/OutputHeight"), & m_outputSashSize.y);    config.Read(_("/Window Size/MemoryWidth"), & m_memorySashSize.x);    config.Read(_("/Window Size/MemoryHeight"), & m_memorySashSize.y);    config.Read(_("/Options/ShowMacroNames"), (bool*) & m_showMacroNames);    config.Read(_("/Options/UseCustomViewer"), (bool*) & m_bUseCustomViewer);    config.Read(_("/Options/UseExternalBrowser"), (bool*) & m_bUseExternalBrowser);        int tmp = (int) m_eUseCustomBrowser;    config.Read(_("/Options/UseCustomBrowser"), & tmp);    m_eUseCustomBrowser = (ecBrowserType) tmp;        config.Read(_("/Options/Browser"), & m_strBrowser);    config.Read(_("/Options/Viewer"), & m_strViewer);    config.Read(_("/Options/HexDisplay"), (bool*) & m_bHex);    config.Read(_("/Options/UseDefaultFonts"), (bool*) & m_windowSettings.m_useDefaults);    config.Read(_("/Rule/Checking"), & m_nRuleChecking);    // Find dialog settings    config.Read(_("/Find/Text"), & m_findText);    config.Read(_("/Find/MatchWholeWord"), (bool*) & m_findMatchWholeWord);    config.Read(_("/Find/MatchCase"), & m_findMatchCase);    config.Read(_("/Find/Direction"), (bool*) & m_findDirection);    config.Read(_("/Find/SearchWhat"), & m_findSearchWhat);    config.Read(_("/Find/DialogX"), & m_findDialogPos.x);    config.Read(_("/Find/DialogY"), & m_findDialogPos.y);    // Package dialog settings    config.Read(_("/Packages/OmitHardwarePackages"), & m_omitHardwarePackages);    config.Read(_("/Packages/MatchPackageNamesExactly"), & m_matchPackageNamesExactly);    // Run tests settings    m_runTestsSettings.LoadConfig(config);    // Fonts    m_windowSettings.LoadConfig(config);           if (!config.Read(_("/Paths/UserToolsDir"), & m_userToolsDir))    {        // Use the default provided by the installer        config.Read(_("Default User Tools Path"), & m_userToolsDir);    }    // Only to be used if we fail to find the information installed    // with the Configuration Tool.    config.Read(_("/Paths/BuildToolsDir"), & m_buildToolsDir);    if (m_buildToolsDir.IsEmpty()) // first invocation by this user    {        // we have no clues as to the location of the build tools so        // test for ../../../gnutools relative to the configtool location        wxFileName gnutools = wxFileName (wxGetApp().GetAppDir(), wxEmptyString);        gnutools.Normalize(); // remove trailing "./" if present		if (2 < gnutools.GetDirCount())        {            gnutools.RemoveDir (gnutools.GetDirCount()-1);            gnutools.RemoveDir (gnutools.GetDirCount()-1);            gnutools.RemoveDir (gnutools.GetDirCount()-1);            gnutools.AppendDir (wxT("gnutools"));            if (gnutools.DirExists()) // we've found the gnutools

⌨️ 快捷键说明

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