Fixed problems in ubuntu

This commit is contained in:
Zane U. Ji 2012-08-20 20:12:32 +08:00
parent 807a96c1a0
commit 743ebcd7d7
37 changed files with 29818 additions and 29801 deletions

2
configure vendored
View File

@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64.
#

View File

View File

@ -41,7 +41,7 @@ MyPropertySheet::MyPropertySheet (
bool expandInternalEntitiesParameter,
bool showFullPathOnFrameParameter,
int lang,
const wxArrayString &translations,
const std::set<const wxLanguageInfo *> &translations,
wxWindowID id,
wxString title,
const wxPoint& position,
@ -165,17 +165,18 @@ MyPropertySheet::MyPropertySheet (
languageBox = new wxChoice (
generalPanel,
wxID_ANY );
languageBox->SetExtraStyle ( languageBox->GetExtraStyle() | wxCB_SORT );
languageBox->Append ( _ ( "Default" ), ( void* ) wxLANGUAGE_ENGLISH_US );
languageBox->SetSelection ( 0 );
int index;
const wxLanguageInfo *info;
wxArrayString::const_iterator trans = translations.begin();
for ( ; trans != translations.end(); trans++ )
std::set<const wxLanguageInfo *>::const_iterator t = translations.begin();
for ( ; t != translations.end(); t++ )
{
info = wxLocale::FindLanguageInfo ( *trans );
if ( info == NULL ) continue;
index = languageBox->Append ( info->Description, (void*)info->Language );
if (lang == info->Language)
index = languageBox->Append ( wxGetTranslation ( ( **t ).Description ),
( void* )( **t ).Language );
if (lang == ( **t ).Language)
languageBox->SetSelection ( index );
}

View File

@ -47,7 +47,7 @@ class MyPropertySheet : public wxPropertySheetDialog
bool expandInternalEntities,
bool showFullPathOnFrame,
int lang,
const wxArrayString &translations,
const std::set<const wxLanguageInfo *> &translations,
wxWindowID id = wxID_ANY,
wxString title = _T ( "" ),
const wxPoint& position = wxDefaultPosition,

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -212,7 +212,17 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
int fdnull = open ( "/dev/null", O_WRONLY, 0 );
dup2 ( fdnull, STDERR_FILENO );
#endif
//myLocale.Init();
}
MyApp::~MyApp()
{
delete checker;
delete server;
delete connection;
}
bool MyApp::OnInit()
{
int systemLocale = myLocale.GetSystemLanguage();
switch ( systemLocale )
{
@ -302,43 +312,6 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
#endif
}
myLocale.Init ( lang, wxLOCALE_LOAD_DEFAULT );
wxArrayString prefixes;
#ifdef __WXGTK__
prefixes.Add ( wxT ( "/usr/share/locale" ) );
prefixes.Add ( wxT ( "/usr/local/share/locale" ) );
#endif
wxString poDir = wxStandardPaths::Get().GetDataDir() +
wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
prefixes.Add ( poDir );
wxArrayString::const_iterator itr;
for ( itr = prefixes.begin(); itr != prefixes.end(); itr++ )
wxLocale::AddCatalogLookupPathPrefix ( *itr );
wxString catalog = _T ( "messages" );
getAvailableTranslations ( &prefixes, &catalog );
if ( !myLocale.AddCatalog ( catalog ) )
;
#ifndef __WXMSW__
{
wxLogNull noLog;
myLocale.AddCatalog ( _T ( "fileutils" ) );
}
#endif
}
MyApp::~MyApp()
{
delete checker;
delete server;
delete connection;
}
bool MyApp::OnInit()
{
wxString name, service, hostName;
name.Printf ( _T ( "xmlcopyeditor-%s" ), wxGetUserId().c_str() );
service = IPC_SERVICE;
@ -382,6 +355,38 @@ bool MyApp::OnInit()
server = new MyServer;
server->Create ( service );
myLocale.Init ( lang, wxLOCALE_LOAD_DEFAULT );
wxArrayString prefixes;
#ifdef __WXGTK__
prefixes.Add ( _T ( "/usr/share/locale" ) );
prefixes.Add ( _T ( "/usr/share/locale-langpack" ) );
prefixes.Add ( _T ( "/usr/local/share/locale" ) );
#endif
wxString poDir = wxStandardPaths::Get().GetDataDir() +
wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
prefixes.Add ( poDir );
for ( size_t i = 0; i < prefixes.Count(); )
{
if ( wxDirExists ( prefixes[i] ) )
wxLocale::AddCatalogLookupPathPrefix ( prefixes[i++] );
else
prefixes.RemoveAt ( i );
}
wxString catalog = _T ( "messages" );
getAvailableTranslations ( &prefixes, &catalog );
if ( !myLocale.AddCatalog ( catalog ) )
;
#ifndef __WXMSW__
{
wxLogNull noLog;
myLocale.AddCatalog ( _T ( "coreutils" ) );
}
#endif
MyFrame *frame;
try
{
@ -572,7 +577,7 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent&
}
#endif
const wxArrayString &MyApp::getAvailableTranslations (
const std::set<const wxLanguageInfo *> &MyApp::getAvailableTranslations (
const wxArrayString *catalogLookupPathPrefixes /*= NULL*/,
const wxString *catalog /*= NULL*/ )
{
@ -587,10 +592,20 @@ const wxArrayString &MyApp::getAvailableTranslations (
if ( catalog == NULL )
throw std::invalid_argument ( "catelog" );
const wxLanguageInfo *info;
#if wxCHECK_VERSION(2,9,0)
wxTranslations *t = wxTranslations::Get();
if ( t != NULL )
{
translations = t->GetAvailableTranslations ( *catalog );
wxArrayString::const_iterator trans = translations.begin();
for ( ; trans != translations.end(); trans++ )
{
info = wxLocale::FindLanguageInfo ( *trans );
if ( info != NULL )
translations.insert ( info );
}
}
#else
wxArrayString::const_iterator i = catalogLookupPathPrefixes->begin();
for ( i = catalogLookupPathPrefixes->begin();
@ -613,7 +628,9 @@ const wxArrayString &MyApp::getAvailableTranslations (
if ( lang.EndsWith(".lproj", &rest) )
lang = rest;
#endif // __WXOSX__
translations.push_back(lang);
info = wxLocale::FindLanguageInfo ( lang );
if ( info != NULL )
translations.insert ( info );
}
}
}
@ -624,9 +641,9 @@ const wxArrayString &MyApp::getAvailableTranslations (
return wxFileName ( dir, catelog, _T ( "mo" ) ).FileExists()
|| wxFileName ( dir + wxFILE_SEP_PATH + _T ( "LC_MESSAGES" ), catelog, _T ( "mo" ) ).FileExists();
}
const wxArrayString &operator()() { return translations; }
const std::set<const wxLanguageInfo *> &operator()() { return translations; }
protected:
wxArrayString translations;
std::set<const wxLanguageInfo *> translations;
} translations ( catalogLookupPathPrefixes, catalog );
return translations();
@ -2573,7 +2590,6 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
#else
( _ ( "Preferences" ) );
#endif
MyApp *app = ( MyApp * ) wxTheApp;
std::auto_ptr<MyPropertySheet> mpsd ( new MyPropertySheet (
this,
properties,
@ -2587,7 +2603,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
expandInternalEntities,
showFullPathOnFrame,
lang,
app->getAvailableTranslations(),
wxGetApp().getAvailableTranslations(),
wxID_ANY,
title ) );
if ( mpsd->ShowModal() == wxID_OK )

View File

@ -176,7 +176,7 @@ class MyApp : public wxApp
#ifndef __WXMSW__
virtual void HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& event ) const;
#endif
const wxArrayString &getAvailableTranslations (
const std::set<const wxLanguageInfo *> &getAvailableTranslations (
const wxArrayString *catalogLookupPathPrefixes = NULL,
const wxString *catelog = NULL );
protected: