bool App::OnInit() { ::fwWX::LoggerInitializer::initialize(); m_profile = ::fwRuntime::profile::getCurrentProfile(); SLM_ASSERT("Profile is not initialized", m_profile); #ifndef TDVPM_COMPLIANT m_locale = new wxLocale(); ::boost::filesystem::path pathLauncher; pathLauncher = ::boost::filesystem::current_path() / "share" / "launcher_0-1" / "locale" ; wxLocale::AddCatalogLookupPathPrefix( ::fwWX::std2wx( pathLauncher.string() )); m_locale->Init(GetUILanguage()); m_locale->AddCatalog(_T("launcher")); m_locale->AddCatalog(_T("runtime")); // Set the locale to C for all number of all application setlocale(LC_NUMERIC,"C"); #else setlocale(LC_ALL,"C"); #endif wxApp::OnInit(); std::string appName = m_profile->getName(); #ifndef TDVPM_COMPLIANT m_locale->AddCatalog(::fwWX::std2wx(appName), wxLANGUAGE_FRENCH, _T("utf-8")); #endif SetAppName( ::fwWX::std2wx(appName) ); std::string checkerPath = ::fwTools::os::getUserDataDir("IRCAD", appName, true); if (checkerPath.empty()) { checkerPath = ::fwTools::os::getUserDataDir("IRCAD", "", true); } if (checkerPath.empty()) { checkerPath = ::fwTools::os::getUserDataDir("", "", true); } SLM_ASSERT("Unable to find user's data dir.", !checkerPath.empty()); m_checker = new wxSingleInstanceChecker(); if (m_profile->getCheckSingleInstance()) { m_checker->Create( ::fwWX::std2wx(appName) + _(".pid"), ::fwWX::std2wx(checkerPath)); if ( m_checker->IsAnotherRunning() ) { wxLogError(_("Another " + ::fwWX::std2wx(appName) + _(" instance is already running, aborting."))); return false; } } // Initialize root object : root object, views, ... //::fwServices::RootManager::initializeRootObject(); return TRUE; }
void PoeditApp::SetupLanguage() { #if defined(__WXMSW__) wxLocale::AddCatalogLookupPathPrefix(wxStandardPaths::Get().GetResourcesDir() + "\\Translations"); #elif !defined(__WXMAC__) wxLocale::AddCatalogLookupPathPrefix(wxStandardPaths::Get().GetInstallPrefix() + "/share/locale"); #endif wxTranslations *trans = new wxTranslations(); wxTranslations::Set(trans); #if NEED_CHOOSELANG_UI trans->SetLanguage(GetUILanguage()); #endif trans->AddCatalog("poedit"); trans->AddStdCatalog(); }
void PoeditApp::SetupLanguage() { #if defined(__WXMSW__) wxLocale::AddCatalogLookupPathPrefix(wxStandardPaths::Get().GetResourcesDir() + "\\Translations"); #elif !defined(__WXMAC__) wxLocale::AddCatalogLookupPathPrefix(wxStandardPaths::Get().GetInstallPrefix() + "/share/locale"); #endif wxTranslations *trans = new wxTranslations(); wxTranslations::Set(trans); #if NEED_CHOOSELANG_UI trans->SetLanguage(GetUILanguage()); #endif trans->AddCatalog("poedit"); trans->AddStdCatalog(); Language uiLang = Language::TryParse(trans->GetBestTranslation("poedit")); UErrorCode err = U_ZERO_ERROR; icu::Locale::setDefault(uiLang.ToIcu(), err); }
bool HTMLButcherApp::OnInit() { if (!wxApp::OnInit()) return false; #if defined(__WXMSW__) || !defined(HTMLBUTCHER_DEMO) SetAppName(wxT("HTMLButcher")); #else SetAppName(wxT("HTMLButcher-Demo")); #endif #ifdef HTMLBUTCHER_DEBUG wxFileName kf(wxStandardPaths::Get().GetExecutablePath()); kf.SetFullName(wxT("default.po")); kf.AppendDir(wxT("..")); kf.AppendDir(wxT("..")); kf.AppendDir(wxT("locale")); kf.Normalize(); locale_.AddCatalogLookupPathPrefix(kf.GetPath()); #endif locale_.AddCatalogLookupPathPrefix(wxStandardPaths::Get().GetDataDir() + wxT("/share/locale")); locale_.Init(GetUILanguage()); locale_.AddCatalog(wxT("htmlbutcher")); #ifdef __WXGTK__ wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir(), 0777, wxPATH_MKDIR_FULL); // must create dir for wxConfig wxConfig::Set(new wxFileConfig(wxString::Format(wxT("%s/config"), wxTheApp->GetAppName().c_str()))); #endif extern void InitXmlResource(); // defined in htmlbutcher_resources.cpp wxXmlResource::Get()->InitAllHandlers(); InitXmlResource(); wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxArchiveFSHandler); //::wxHandleFatalExceptions(true); wxFreeImage::Initialize(); #ifdef BUTCHER_USE_HELP // help wxHelpControllerHelpProvider* provider = new wxHelpControllerHelpProvider; wxHelpProvider::Set(provider); provider->SetHelpController(&help_); #ifdef __WXMSW__ wxFileName fn(wxStandardPaths::Get().GetExecutablePath()); fn.SetFullName(wxT("htmlbutcher.chm")); #else #ifdef HTMLBUTCHER_DEBUG wxFileName fn(wxStandardPaths::Get().GetExecutablePath()); fn.SetFullName(wxT("htmlbutcher.htb")); #else wxFileName fn(wxStandardPaths::Get().GetResourcesDir().Lower(), wxEmptyString); fn.SetFullName(wxT("htmlbutcher.htb")); if (!fn.FileExists()) { fn.AssignDir(wxString::Format(wxT("/usr/share/%s"), wxTheApp->GetAppName().Lower().c_str())); fn.SetFullName(wxT("htmlbutcher.htb")); } #endif #endif if (!help_.Initialize(fn.GetFullPath())) { wxLogError(wxT("Cannot initialize the help system, aborting.")); return false; } #endif // main frame HTMLButcherFrame* frame = new HTMLButcherFrame(0L, wxT("HTMLButcher")); // splash screen { wxLogNull logNo; wxBitmap rbitmap(wxXmlResource::Get()->LoadBitmap(wxT("b_splash"))); wxImage simage(rbitmap.ConvertToImage()); simage.ConvertAlphaToMask(); wxBitmap bitmap(simage); HTMLButcherSplashScreen *splash = new HTMLButcherSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 4000, frame, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxSPLASH_CENTRE_ON_SCREEN|wxFRAME_SHAPED); splash->Update(); } //wxYield(); #ifdef __WXMSW__ frame->SetIcon(wxICON(HTMLBUTCHERICON)); // To Set App Icon #elif defined(__WXGTK__) frame->SetIcon(wxICON(htmlbutcher)); // To Set App Icon #endif //__WXMSW__ frame->Show(); SetTopWindow(frame); //#ifndef __WXMAC__ frame->Maximize(); //#endif #ifndef HTMLBUTCHER_DEMO if (!openfile_.IsEmpty()) frame->DoOpenProject(openfile_); #endif return true; }