wxArrayString PHPEntityClass::GetInheritanceArray() const { wxArrayString arr, uniqueArr; arr.Add(GetExtends()); arr.insert(arr.end(), GetImplements().begin(), GetImplements().end()); arr.insert(arr.end(), GetTraits().begin(), GetTraits().end()); for(size_t i = 0; i < arr.GetCount(); ++i) { if(uniqueArr.Index(arr.Item(i)) == wxNOT_FOUND) { uniqueArr.Add(arr.Item(i)); } } arr.swap(uniqueArr); return arr; }
void wxAppConsole::OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg) { ShowAssertDialog(file, line, cond, msg, GetTraits()); }
bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) { #if wxUSE_INTL GetTraits()->SetLocale(); #endif // wxUSE_INTL return true; }
void EditorApplication::loadPlugins() { ScopedWXBusyCursor busy; wxString dir = GetTraits()->GetStandardPaths().GetPluginsDir(); int count = coca::getPluginManager().loadPlugins( dir.c_str() ); COCA_INFO( count << " plugins loaded from " << dir ); }
EditorApplication::EditorApplication() : _config( 0 ) { wxFileName path( GetTraits()->GetStandardPaths().GetExecutablePath() ); path.SetExt( "ini" ); _config = new wxFileConfig( "cocaEditor", "Harm Boschloo", path.GetFullPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); COCA_DEBUG_INFO( "Editor Created" ); }
int CamuleDaemonApp::OnRun() { if (!thePrefs::AcceptExternalConnections()) { AddLogLineCS(_("ERROR: aMule daemon cannot be used when external connections are disabled. To enable External Connections, use either a normal aMule, start amuled with the option --ec-config or set the key \"AcceptExternalConnections\" to 1 in the file ~/.aMule/amule.conf")); return 0; } else if (thePrefs::ECPassword().IsEmpty()) { AddLogLineCS(_("ERROR: A valid password is required to use external connections, and aMule daemon cannot be used without external connections. To run aMule deamon, you must set the \"ECPassword\" field in the file ~/.aMule/amule.conf with an appropriate value. Execute amuled with the flag --ec-config to set the password. More information can be found at http://wiki.amule.org")); return 0; } #ifndef __WXMSW__ // Process the return code of dead children so that we do not create // zombies. wxBase does not implement wxProcess callbacks, so no one // actualy calls wxHandleProcessTermination() in console applications. // We do our best here. int ret = 0; ret = sigaction(SIGCHLD, NULL, &m_oldSignalChildAction); m_newSignalChildAction = m_oldSignalChildAction; m_newSignalChildAction.sa_sigaction = OnSignalChildHandler; m_newSignalChildAction.sa_flags |= SA_SIGINFO; m_newSignalChildAction.sa_flags &= ~SA_RESETHAND; ret = sigaction(SIGCHLD, &m_newSignalChildAction, NULL); if (ret == -1) { AddDebugLogLineC(logStandard, CFormat(wxT("CamuleDaemonApp::OnRun(): Installation of SIGCHLD callback with sigaction() failed: %m."))); } else { AddDebugLogLineN(logGeneral, wxT("CamuleDaemonApp::OnRun(): Installation of SIGCHLD callback with sigaction() succeeded.")); } #endif // __WXMSW__ #ifdef AMULED28 while ( !m_Exit ) { m_table->RunSelect(); ProcessPendingEvents(); ((CDaemonAppTraits *)GetTraits())->DeletePending(); } // ShutDown is beeing called twice. Once here and again in OnExit(). ShutDown(); return 0; #else #ifdef AMULED_DUMMY return 0; #else return wxApp::OnRun(); #endif #endif }
void CamulewebApp::TextShell(const wxString &) { #ifdef AMULEWEB28 while (true) { m_table->RunSelect(); ProcessPendingEvents(); ((CWebserverAppTraits *)GetTraits())->DeletePending(); } #else #ifndef AMULEWEB_DUMMY wxApp::OnRun(); #endif #endif }
bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **argv) { #if wxUSE_INTL GetTraits()->SetLocale(); #endif // wxUSE_INTL #ifndef __WXPALMOS__ if ( m_appName.empty() && argv && argv[0] ) { // the application name is, by default, the name of its executable file wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); } #endif // !__WXPALMOS__ return true; }
MacUninstallApp::MacUninstallApp() { failed_files = failed_dirs = 0; m_bBatchMode = false; m_bTestMode = false; m_bCancelled = false; m_sSelfPath = wxFileName( GetTraits()->GetStandardPaths().GetExecutablePath()).GetFullPath(); m_nodelete.insert(wxT(".")); m_nodelete.insert(wxT("./Applications")); m_nodelete.insert(wxT("./Library")); m_nodelete.insert(wxT("./usr/share/man/man1")); m_nodelete.insert(wxT("./usr/share/man")); m_nodelete.insert(wxT("./usr/share")); m_nodelete.insert(wxT("./usr")); }
void wxAppConsoleBase::OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) { #if wxDEBUG_LEVEL ShowAssertDialog(file, line, func, cond, msg, GetTraits()); #else // this function is still present even in debug level 0 build for ABI // compatibility reasons but is never called there and so can simply do // nothing in it wxUnusedVar(file); wxUnusedVar(line); wxUnusedVar(func); wxUnusedVar(cond); wxUnusedVar(msg); #endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL }
wxEventLoopBase *wxAppConsoleBase::CreateMainLoop() { return GetTraits()->CreateEventLoop(); }
wxLog *wxAppConsole::CreateLogTarget() { wxAppTraits *traits = GetTraits(); return traits ? traits->CreateLogTarget() : NULL; }
bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, const wxString& GroupName, bool ForceUseLocalConfig ) { wxFileName fn = fileName; wxString defaultFileName; // Free old config file. if( m_projectSettings ) { delete m_projectSettings; m_projectSettings = NULL; } /* Check the file name does not a KiCad project extension. * This allows the user to enter a filename without extension * or use an existing name to create te project file */ if( fn.GetExt() != ProjectFileExtension ) { fn.SetExt( ProjectFileExtension ); } /* Update the library search path list if a new project file is loaded. */ if( m_projectFileName != fn ) { RemoveLibraryPath( m_projectFileName.GetPath() ); InsertLibraryPath( fn.GetPath(), 0 ); m_projectFileName = fn; } // Init local config filename if( ForceUseLocalConfig || fn.FileExists() ) { m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString, fn.GetFullPath(), wxEmptyString ); m_projectSettings->DontCreateOnDemand(); if( ForceUseLocalConfig ) return true; /* Check the application version against the version saved in the * project file. * * TODO: Push the version test up the stack so that when one of the * KiCad application version changes, the other applications * settings do not get updated. Practically, this can go away. * It isn't used anywhere as far as I know (WLS). */ int version = -1; int def_version = 0; m_projectSettings->SetPath( GroupName ); version = m_projectSettings->Read( wxT( "version" ), def_version ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); if( version > 0 ) { return true; } else { delete m_projectSettings; // Version incorrect } } defaultFileName = m_libSearchPaths.FindValidPath( wxT( "kicad.pro" ) ); if( !defaultFileName ) { wxLogDebug( wxT( "Template file <kicad.pro> not found." ) ); fn = wxFileName( GetTraits()->GetStandardPaths().GetDocumentsDir(), wxT( "kicad" ), ProjectFileExtension ); } else { fn = defaultFileName; } // Create new project file using the default name. m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString, wxEmptyString, fn.GetFullPath() ); m_projectSettings->DontCreateOnDemand(); return false; }
virtual bool Match(const Binary::Data& data) const { const ModuleTraits traits = GetTraits(data); return traits.Matched(); }
virtual std::size_t NextMatchOffset(const Binary::Data& data) const { const ModuleTraits traits = GetTraits(data); return traits.NextOffset(); }
void EDA_APP::SetDefaultSearchPaths( void ) { size_t i; wxString path = m_BinDir; wxPathList tmp; m_searchPaths.Clear(); #ifdef __WINDOWS__ /* m_BinDir path is in unix notation. * But wxFileName expect (to work fine) native notation * specifically when using a path including a server, like * \\myserver\local_path . */ path.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP ); #endif wxFileName fn( path, wxEmptyString ); /* User environment variable path is the first search path. Chances are * if the user is savvy enough to set an environment variable they know * what they are doing. */ if( ::wxGetEnv( wxT( "KICAD" ), NULL ) ) tmp.AddEnvList( wxT( "KICAD" ) ); // Add the user's home path. tmp.Add( GetTraits()->GetStandardPaths().GetUserDataDir() ); // Standard application data path if it is different from the binary path. if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() ) { tmp.Add( GetTraits()->GetStandardPaths().GetDataDir() ); } // Up one level relative to binary path with "share" appended for Windows. fn.RemoveLastDir(); tmp.Add( fn.GetPath() ); /* The normal OS program file install paths allow for binary to be * installed in a different path from the library files. This is * useful for development purposes so the library and documentation * files do not need to be installed separately. If someone can * figure out a way to implement this without #ifdef, please do. */ #ifdef __WXMSW__ tmp.AddEnvList( wxT( "PROGRAMFILES" ) ); #elif __WXMAC__ tmp.Add( wxT( "/Library/Application Support" ) ); tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) ); #else tmp.AddEnvList( wxT( "PATH" ) ); #endif // This is the equivalent of CMAKE_INSTALL_PREFIX. Useful when installed by `make install`. tmp.Add( wxT( DEFAULT_INSTALL_PATH ) ); // Add kicad, kicad/share, share, and share/kicad to each possible base path. for( i = 0; i < tmp.GetCount(); i++ ) { fn = wxFileName( tmp[i], wxEmptyString ); if( fn.GetPath().AfterLast( fn.GetPathSeparator() ) == wxT( "bin" ) ) fn.RemoveLastDir(); m_searchPaths.Add( fn.GetPath() ); fn.AppendDir( wxT( "kicad" ) ); m_searchPaths.Add( fn.GetPath() ); fn.AppendDir( wxT( "share" ) ); m_searchPaths.Add( fn.GetPath() ); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.AppendDir( wxT( "share" ) ); m_searchPaths.Add( fn.GetPath() ); fn.AppendDir( wxT( "kicad" ) ); m_searchPaths.Add( fn.GetPath() ); } // Remove all non-existent paths from the list. for( i = 0; i < m_searchPaths.GetCount(); i++ ) { if( !wxFileName::IsDirReadable( m_searchPaths[i] ) ) { m_searchPaths.RemoveAt( i ); i -= 1; } else { fn.Clear(); fn.SetPath( m_searchPaths[i] ); /* Add schematic library file path to search path list. * we must add <kicad path>/library and <kicad path>/library/doc */ if( m_Id == APP_EESCHEMA_T ) { fn.AppendDir( wxT( "library" ) ); if( fn.IsDirReadable() ) { m_libSearchPaths.Add( fn.GetPath() ); } // Add schematic doc file path (library/doc)to search path list. fn.AppendDir( wxT( "doc" ) ); if( fn.IsDirReadable() ) { m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); fn.RemoveLastDir(); // point to <kicad path> } // Add PCB library file path to search path list. if( ( m_Id == APP_PCBNEW_T ) || ( m_Id == APP_CVPCB_T ) ) { fn.AppendDir( wxT( "modules" ) ); if( fn.IsDirReadable() ) { m_libSearchPaths.Add( fn.GetPath() ); } // Add 3D module library file path to search path list. fn.AppendDir( wxT( "packages3d" ) ); if( fn.IsDirReadable() ) { m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); fn.RemoveLastDir(); // point to <kicad path> } // Add KiCad template file path to search path list. fn.AppendDir( wxT( "template" ) ); if( fn.IsDirReadable() ) { m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); } } #if 0 && defined( DEBUG ) wxLogDebug( wxT( "Library search paths:" ) ); for( unsigned i = 0; i < m_libSearchPaths.GetCount(); i++ ) wxLogDebug( wxT( " %s" ), GetChars( m_libSearchPaths[i] ) ); #endif }
wxMessageOutput *wxAppConsole::CreateMessageOutput() { wxAppTraits *traits = GetTraits(); return traits ? traits->CreateMessageOutput() : NULL; }