コード例 #1
0
ModuleInterface *ModuleManager::LoadModule(const wxString & path)
{
   wxDynamicLibrary *lib = new wxDynamicLibrary();

   if (lib->Load(path, wxDL_NOW))
   {
      bool success = false;
      ModuleMain audacityMain = (ModuleMain) lib->GetSymbol(wxSTRINGIZE_T(MODULE_ENTRY),
                                                            &success);
      if (success && audacityMain)
      {
         ModuleInterface *module = audacityMain(this, &path);
         if (module)
         {
            if (module->Initialize())
            {

               mDynModules[PluginManager::GetID(module)] = module;
               mLibs[module] = lib;

               return module;
            }
            module->Terminate();
            delete module;
         }
      }

      lib->Unload();
   }

   delete lib;

   return NULL;
}
コード例 #2
0
ModuleInterface *ModuleManager::LoadModule(const wxString & path)
{
   auto lib = make_movable<wxDynamicLibrary>();

   if (lib->Load(path, wxDL_NOW))
   {
      bool success = false;
      ModuleMain audacityMain = (ModuleMain) lib->GetSymbol(wxSTRINGIZE_T(MODULE_ENTRY),
                                                            &success);
      if (success && audacityMain)
      {
         ModuleInterfaceHandle handle {
            audacityMain(this, &path), ModuleInterfaceDeleter{}
         };
         if (handle)
         {
            if (handle->Initialize())
            {

               auto module = handle.get();
               mDynModules[PluginManager::GetID(module)] = std::move(handle);
               mLibs[module] = std::move(lib);

               return module;
            }
         }
      }

      lib->Unload();
   }

   return NULL;
}
コード例 #3
0
ファイル: theme.cpp プロジェクト: chromylei/third_party
/* static */ bool wxTheme::CreateDefault()
{
    if ( ms_theme )
    {
        // we already have a theme
        return true;
    }

    wxString nameDefTheme;

    // use the environment variable first
    const wxChar *p = wxGetenv(wxT("WXTHEME"));
    if ( p )
    {
        nameDefTheme = p;
    }
#ifdef wxUNIV_DEFAULT_THEME
    else // use native theme by default
    {
        nameDefTheme = wxSTRINGIZE_T(wxUNIV_DEFAULT_THEME);
    }
#endif // wxUNIV_DEFAULT_THEME

    wxTheme *theme = Create(nameDefTheme);

    // fallback to the first one in the list
    if ( !theme && ms_allThemes )
    {
        theme = ms_allThemes->ctor();
    }

    // abort if still nothing
    if ( !theme )
    {
        wxLogError(_("Failed to initialize GUI: no built-in themes found."));

        return false;
    }

    // Set the theme as current.
    wxTheme::Set(theme);

    return true;
}