merged 2.4 branch into the trunk
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -676,26 +676,26 @@ wxDialUpManagerImpl::CheckIfconfig()
|
||||
wxASSERT_MSG( m_IfconfigPath.length(),
|
||||
_T("can't use ifconfig if it wasn't found") );
|
||||
|
||||
wxString tmpfile = wxGetTempFileName("_wxdialuptest");
|
||||
wxString cmd = "/bin/sh -c \'";
|
||||
wxString tmpfile = wxGetTempFileName( wxT("_wxdialuptest") );
|
||||
wxString cmd = wxT("/bin/sh -c \'");
|
||||
cmd << m_IfconfigPath;
|
||||
#if defined(__SOLARIS__) || defined (__SUNOS__)
|
||||
// need to add -a flag
|
||||
cmd << " -a";
|
||||
cmd << wxT(" -a");
|
||||
#elif defined(__LINUX__) || defined(__SGI__)
|
||||
// nothing to be added to ifconfig
|
||||
#elif defined(__FREEBSD__) || defined(__DARWIN__)
|
||||
// add -l flag
|
||||
cmd << " -l";
|
||||
cmd << wxT(" -l");
|
||||
#elif defined(__HPUX__)
|
||||
// VZ: a wild guess (but without it, ifconfig fails completely)
|
||||
cmd << _T(" ppp0");
|
||||
cmd << wxT(" ppp0");
|
||||
#else
|
||||
# pragma warning "No ifconfig information for this OS."
|
||||
m_CanUseIfconfig = 0;
|
||||
return -1;
|
||||
#endif
|
||||
cmd << " >" << tmpfile << '\'';
|
||||
cmd << wxT(" >") << tmpfile << wxT('\'');
|
||||
/* I tried to add an option to wxExecute() to not close stdout,
|
||||
so we could let ifconfig write directly to the tmpfile, but
|
||||
this does not work. That should be faster, as it doesn<73>t call
|
||||
@@ -754,41 +754,41 @@ wxDialUpManagerImpl::CheckIfconfig()
|
||||
|
||||
wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckPing()
|
||||
{
|
||||
// First time check for ping location. We only use the variant
|
||||
// which does not take arguments, a la GNU.
|
||||
if(m_CanUsePing == -1) // unknown
|
||||
{
|
||||
// First time check for ping location. We only use the variant
|
||||
// which does not take arguments, a la GNU.
|
||||
if(m_CanUsePing == -1) // unknown
|
||||
{
|
||||
#ifdef __VMS
|
||||
if(wxFileExists("SYS$SYSTEM:TCPIP$PING.EXE"))
|
||||
m_PingPath = "$SYS$SYSTEM:TCPIP$PING";
|
||||
if (wxFileExists( wxT("SYS$SYSTEM:TCPIP$PING.EXE") ))
|
||||
m_PingPath = wxT("$SYS$SYSTEM:TCPIP$PING");
|
||||
#else
|
||||
if(wxFileExists("/bin/ping"))
|
||||
m_PingPath = "/bin/ping";
|
||||
else if(wxFileExists("/usr/sbin/ping"))
|
||||
m_PingPath = "/usr/sbin/ping";
|
||||
if (wxFileExists( wxT("/bin/ping") ))
|
||||
m_PingPath = wxT("/bin/ping");
|
||||
else if (wxFileExists( wxT("/usr/sbin/ping") ))
|
||||
m_PingPath = wxT("/usr/sbin/ping");
|
||||
#endif
|
||||
if(! m_PingPath)
|
||||
{
|
||||
m_CanUsePing = 0;
|
||||
}
|
||||
}
|
||||
if (!m_PingPath)
|
||||
{
|
||||
m_CanUsePing = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(! m_CanUsePing)
|
||||
{
|
||||
if(! m_CanUsePing)
|
||||
{
|
||||
// we didn't find ping
|
||||
return Net_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
wxLogNull ln; // suppress all error messages
|
||||
wxASSERT(m_PingPath.length());
|
||||
wxString cmd;
|
||||
cmd << m_PingPath << ' ';
|
||||
cmd << m_PingPath << wxT(' ');
|
||||
#if defined(__SOLARIS__) || defined (__SUNOS__)
|
||||
// nothing to add to ping command
|
||||
#elif defined(__LINUX__) || defined ( __FREEBSD__) || defined(__DARWIN__) || defined( __VMS )
|
||||
cmd << "-c 1 "; // only ping once
|
||||
#elif defined(__LINUX__) || defined (__BSD__) || defined( __VMS )
|
||||
cmd << wxT("-c 1 "); // only ping once
|
||||
#elif defined(__HPUX__)
|
||||
cmd << "64 1 "; // only ping once (need also specify the packet size)
|
||||
cmd << wxT("64 1 "); // only ping once (need also specify the packet size)
|
||||
#else
|
||||
# pragma warning "No Ping information for this OS."
|
||||
m_CanUsePing = 0;
|
||||
|
@@ -172,13 +172,9 @@ bool wxDirData::Read(wxString *filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
matches = TRUE; // FIXME
|
||||
#else
|
||||
// test against the pattern
|
||||
matches = wxMatchWild(m_filespec, de_d_name,
|
||||
!(m_flags & wxDIR_HIDDEN));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,20 +26,23 @@
|
||||
#include "wx/string.h"
|
||||
#include "wx/regex.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
#include "wx/app.h"
|
||||
#include "wx/fontmap.h"
|
||||
#include "wx/fontenum.h"
|
||||
#include "wx/fontutil.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GTK 2.0
|
||||
// Pango
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_PANGO
|
||||
|
||||
#include "pango/pango.h"
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
extern GtkWidget *wxGetRootWindow();
|
||||
#endif
|
||||
|
||||
static int
|
||||
cmp_families (const void *a, const void *b)
|
||||
@@ -63,7 +66,11 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
PangoFontFamily **families = NULL;
|
||||
gint n_families = 0;
|
||||
pango_context_list_families (
|
||||
#ifdef __WXGTK20__
|
||||
gtk_widget_get_pango_context( wxGetRootWindow() ),
|
||||
#else
|
||||
wxTheApp->GetPangoContext(),
|
||||
#endif
|
||||
&families, &n_families );
|
||||
qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
|
||||
|
||||
@@ -86,7 +93,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
||||
|
||||
|
||||
#else
|
||||
// GTK 2.0
|
||||
// Pango
|
||||
|
||||
#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++
|
||||
// The resulting warnings are switched off here
|
||||
|
@@ -37,9 +37,15 @@
|
||||
#include "wx/hash.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
#if wxUSE_PANGO
|
||||
|
||||
#include "pango/pango.h"
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
#include "wx/gtk/private.h"
|
||||
#else
|
||||
#include "wx/x11/private.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNativeFontInfo
|
||||
@@ -71,7 +77,7 @@ wxFontStyle wxNativeFontInfo::GetStyle() const
|
||||
m_style = wxFONTSTYLE_SLANT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return m_style;
|
||||
}
|
||||
|
||||
@@ -100,7 +106,7 @@ wxFontWeight wxNativeFontInfo::GetWeight() const
|
||||
m_weight = wxFONTWEIGHT_BOLD;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return m_weight;
|
||||
}
|
||||
|
||||
@@ -112,7 +118,7 @@ bool wxNativeFontInfo::GetUnderlined() const
|
||||
wxString wxNativeFontInfo::GetFaceName() const
|
||||
{
|
||||
wxString tmp = wxGTK_CONV_BACK( pango_font_description_get_family( description ) );
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -178,8 +184,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#else
|
||||
// __WXGTK20__
|
||||
#else // GTK+ 1.x
|
||||
|
||||
#ifdef __X__
|
||||
#ifdef __VMS__
|
||||
@@ -452,6 +457,164 @@ void wxNativeFontInfo::SetXFontName(const wxString& xFontName_)
|
||||
m_isDefault = FALSE;
|
||||
}
|
||||
|
||||
int wxNativeFontInfo::GetPointSize() const
|
||||
{
|
||||
const wxString s = GetXFontComponent(wxXLFD_POINTSIZE);
|
||||
|
||||
// return -1 to indicate that the size is unknown
|
||||
long l;
|
||||
return s.ToLong(&l) ? l : -1;
|
||||
}
|
||||
|
||||
wxFontStyle wxNativeFontInfo::GetStyle() const
|
||||
{
|
||||
const wxString s = GetXFontComponent(wxXLFD_SLANT);
|
||||
|
||||
if ( s.length() != 1 )
|
||||
{
|
||||
// it is really unknown but we don't have any way to return it from
|
||||
// here
|
||||
return wxFONTSTYLE_NORMAL;
|
||||
}
|
||||
|
||||
switch ( s[0] )
|
||||
{
|
||||
default:
|
||||
// again, unknown but consider normal by default
|
||||
|
||||
case _T('r'):
|
||||
return wxFONTSTYLE_NORMAL;
|
||||
|
||||
case _T('i'):
|
||||
return wxFONTSTYLE_ITALIC;
|
||||
|
||||
case _T('o'):
|
||||
return wxFONTSTYLE_SLANT;
|
||||
}
|
||||
}
|
||||
|
||||
wxFontWeight wxNativeFontInfo::GetWeight() const
|
||||
{
|
||||
const wxString s = GetXFontComponent(wxXLFD_WEIGHT).MakeLower();
|
||||
if ( s.find(_T("bold")) != wxString::npos || s == _T("black") )
|
||||
return wxFONTWEIGHT_BOLD;
|
||||
else if ( s == _T("light") )
|
||||
return wxFONTWEIGHT_LIGHT;
|
||||
|
||||
return wxFONTWEIGHT_NORMAL;
|
||||
}
|
||||
|
||||
bool wxNativeFontInfo::GetUnderlined() const
|
||||
{
|
||||
// X fonts are never underlined
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxString wxNativeFontInfo::GetFaceName() const
|
||||
{
|
||||
// wxWindows facename probably more accurately corresponds to X family
|
||||
return GetXFontComponent(wxXLFD_FAMILY);
|
||||
}
|
||||
|
||||
wxFontFamily wxNativeFontInfo::GetFamily() const
|
||||
{
|
||||
// and wxWindows family -- to X foundry, but we have to translate it to
|
||||
// wxFontFamily somehow...
|
||||
wxFAIL_MSG(_T("not implemented")); // GetXFontComponent(wxXLFD_FOUNDRY);
|
||||
|
||||
return wxFONTFAMILY_DEFAULT;
|
||||
}
|
||||
|
||||
wxFontEncoding wxNativeFontInfo::GetEncoding() const
|
||||
{
|
||||
// we already have the code for this but need to refactor it first
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return wxFONTENCODING_MAX;
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetPointSize(int pointsize)
|
||||
{
|
||||
SetXFontComponent(wxXLFD_POINTSIZE, wxString::Format(_T("%d"), pointsize));
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetStyle(wxFontStyle style)
|
||||
{
|
||||
wxString s;
|
||||
switch ( style )
|
||||
{
|
||||
case wxFONTSTYLE_ITALIC:
|
||||
s = _T('i');
|
||||
break;
|
||||
|
||||
case wxFONTSTYLE_SLANT:
|
||||
s = _T('o');
|
||||
break;
|
||||
|
||||
case wxFONTSTYLE_NORMAL:
|
||||
s = _T('r');
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( _T("unknown wxFontStyle in wxNativeFontInfo::SetStyle") );
|
||||
return;
|
||||
}
|
||||
|
||||
SetXFontComponent(wxXLFD_SLANT, s);
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetWeight(wxFontWeight weight)
|
||||
{
|
||||
wxString s;
|
||||
switch ( weight )
|
||||
{
|
||||
case wxFONTWEIGHT_BOLD:
|
||||
s = _T("bold");
|
||||
break;
|
||||
|
||||
case wxFONTWEIGHT_LIGHT:
|
||||
s = _T("light");
|
||||
break;
|
||||
|
||||
case wxFONTWEIGHT_NORMAL:
|
||||
s = _T("medium");
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( _T("unknown wxFontWeight in wxNativeFontInfo::SetWeight") );
|
||||
return;
|
||||
}
|
||||
|
||||
SetXFontComponent(wxXLFD_WEIGHT, s);
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
|
||||
{
|
||||
// can't do this under X
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetFaceName(wxString facename)
|
||||
{
|
||||
SetXFontComponent(wxXLFD_FAMILY, facename);
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetFamily(wxFontFamily family)
|
||||
{
|
||||
// wxFontFamily -> X foundry, anyone?
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
// SetXFontComponent(wxXLFD_FOUNDRY, ...);
|
||||
}
|
||||
|
||||
void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
|
||||
{
|
||||
wxNativeEncodingInfo info;
|
||||
if ( wxGetNativeFontEncoding(encoding, &info) )
|
||||
{
|
||||
SetXFontComponent(wxXLFD_ENCODING, info.xencoding);
|
||||
SetXFontComponent(wxXLFD_REGISTRY, info.xregistry);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// common functions
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -495,6 +658,11 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
||||
info->xencoding = wxT("*");
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_GB2312:
|
||||
info->xregistry = wxT("GB2312"); // or the otherway round?
|
||||
info->xencoding = wxT("*");
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_KOI8:
|
||||
info->xregistry = wxT("koi8");
|
||||
|
||||
@@ -806,7 +974,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
|
||||
// An alternative: assume that the screen is 72 dpi.
|
||||
//int pixelHeight = (int) (((float)pointSize / 720.0) * 72.0) ;
|
||||
//int pixelHeight = (int) ((float)pointSize / 10.0) ;
|
||||
|
||||
|
||||
GR_LOGFONT logFont;
|
||||
logFont.lfHeight = pixelHeight;
|
||||
logFont.lfWidth = 0;
|
||||
@@ -833,7 +1001,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
|
||||
fontInfo->fid = GrCreateFont((GR_CHAR*) facename.c_str(), pixelHeight, & logFont);
|
||||
GrGetFontInfo(fontInfo->fid, & fontInfo->info);
|
||||
return (wxNativeFont) fontInfo;
|
||||
|
||||
|
||||
#else
|
||||
wxString fontSpec;
|
||||
if (!facename.IsEmpty())
|
||||
@@ -1044,5 +1212,5 @@ void wxFontModule::OnExit()
|
||||
g_fontHash = (wxHashTable *)NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
// not GTK 2.0
|
||||
#endif // GTK 2.0/1.x
|
||||
|
||||
|
@@ -364,21 +364,21 @@ bool wxMimeTypesManagerImpl::CheckGnomeDirsExist ()
|
||||
wxString gnomedir;
|
||||
wxGetHomeDir( &gnomedir );
|
||||
wxString sTmp = gnomedir;
|
||||
sTmp = sTmp + "/.gnome";
|
||||
sTmp = sTmp + wxT("/.gnome");
|
||||
if (! wxDir::Exists ( sTmp ) )
|
||||
{
|
||||
if (!wxMkdir ( sTmp ))
|
||||
{
|
||||
wxFAIL_MSG (wxString ("Failed to create directory\n.gnome in \nCheckGnomeDirsExist") + sTmp );
|
||||
wxLogError(_("Failed to create directory %s/.gnome."), sTmp.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
sTmp = sTmp + "/mime-info";
|
||||
sTmp = sTmp + wxT("/mime-info");
|
||||
if (! wxDir::Exists ( sTmp ) )
|
||||
{
|
||||
if (!wxMkdir ( sTmp ))
|
||||
{
|
||||
wxFAIL_MSG (wxString ("Failed to create directory\nmime-info in \nCheckGnomeDirsExist") + sTmp );
|
||||
wxLogError(_("Failed to create directory %s/mime-info."), sTmp.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -393,11 +393,15 @@ bool wxMimeTypesManagerImpl::WriteGnomeKeyFile(int index, bool delete_index)
|
||||
wxString gnomedir;
|
||||
wxGetHomeDir( &gnomedir );
|
||||
|
||||
wxMimeTextFile outfile ( gnomedir + "/.gnome/mime-info/user.keys");
|
||||
wxMimeTextFile outfile ( gnomedir + wxT("/.gnome/mime-info/user.keys"));
|
||||
// if this fails probably Gnome is not installed ??
|
||||
// create it anyway as a private mime store
|
||||
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if (! outfile.Open ( wxConvUTF8) )
|
||||
#else
|
||||
if (! outfile.Open () )
|
||||
#endif
|
||||
{
|
||||
if (delete_index) return FALSE;
|
||||
if (!CheckGnomeDirsExist() ) return FALSE;
|
||||
@@ -462,13 +466,13 @@ bool wxMimeTypesManagerImpl::WriteGnomeKeyFile(int index, bool delete_index)
|
||||
}
|
||||
//sOld should also contain the icon
|
||||
if ( !m_aIcons[index].empty() )
|
||||
sOld.AddOrReplaceVerb ( wxT( "icon-filename"), m_aIcons[index] );
|
||||
sOld.AddOrReplaceVerb ( wxT("icon-filename"), m_aIcons[index] );
|
||||
|
||||
for (i=0; i < sOld.GetCount(); i++)
|
||||
{
|
||||
sTmp = sOld.GetVerbCmd(i);
|
||||
sTmp.Replace( wxT("%s"), wxT("%f") );
|
||||
sTmp = wxT ( "\t") + sTmp;
|
||||
sTmp = wxT("\t") + sTmp;
|
||||
nIndex ++;
|
||||
outfile.InsertLine ( sTmp, nIndex );
|
||||
}
|
||||
@@ -484,7 +488,7 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
|
||||
wxString gnomedir;
|
||||
wxGetHomeDir( &gnomedir );
|
||||
|
||||
wxMimeTextFile outfile ( gnomedir + "/.gnome/mime-info/user.mime");
|
||||
wxMimeTextFile outfile ( gnomedir + wxT("/.gnome/mime-info/user.mime"));
|
||||
// if this fails probably Gnome is not installed ??
|
||||
// create it anyway as a private mime store
|
||||
if (! outfile.Open () )
|
||||
@@ -498,7 +502,7 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
|
||||
if ( nIndex == wxNOT_FOUND )
|
||||
{
|
||||
outfile.AddLine ( strType );
|
||||
outfile.AddLine ( wxT( "\text:") + m_aExtensions.Item(index) );
|
||||
outfile.AddLine ( wxT("\text:") + m_aExtensions.Item(index) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -510,13 +514,13 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
|
||||
else
|
||||
{// check for next line being the right one to replace ??
|
||||
wxString sOld = outfile.GetLine(nIndex+1);
|
||||
if (sOld.Contains(wxT("\text: ")))
|
||||
if (sOld.Contains( wxT("\text: ")))
|
||||
{
|
||||
outfile.GetLine(nIndex+1) = wxT( "\text: ") + m_aExtensions.Item(index);
|
||||
outfile.GetLine(nIndex+1) = wxT("\text: ") + m_aExtensions.Item(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
outfile.InsertLine(wxT( "\text: ") + m_aExtensions.Item(index), nIndex + 1 );
|
||||
outfile.InsertLine( wxT("\text: ") + m_aExtensions.Item(index), nIndex + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,7 +532,11 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
|
||||
void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename)
|
||||
{
|
||||
wxTextFile textfile(filename);
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( !textfile.Open( wxConvUTF8) )
|
||||
#else
|
||||
if ( !textfile.Open() )
|
||||
#endif
|
||||
return;
|
||||
wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"),
|
||||
filename.c_str());
|
||||
@@ -615,7 +623,11 @@ void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename)
|
||||
void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& filename)
|
||||
{
|
||||
wxTextFile textfile(filename);
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( !textfile.Open( wxConvUTF8) )
|
||||
#else
|
||||
if ( !textfile.Open() )
|
||||
#endif
|
||||
return;
|
||||
wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"),
|
||||
filename.c_str());
|
||||
@@ -630,7 +642,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
|
||||
if ( nLine < nLineCount )
|
||||
{
|
||||
pc = textfile[nLine].c_str();
|
||||
if ( *pc == _T('#') )
|
||||
if ( *pc == wxT('#') )
|
||||
{
|
||||
// skip comments
|
||||
continue;
|
||||
@@ -665,13 +677,13 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
|
||||
}
|
||||
|
||||
// what do we have here?
|
||||
if ( *pc == _T('\t') )
|
||||
if ( *pc == wxT('\t') )
|
||||
{
|
||||
// this is a field=value ling
|
||||
pc++; // skip leading TAB
|
||||
|
||||
static const int lenField = 4; // strlen("ext:")
|
||||
if ( wxStrncmp(pc, _T("ext:"), lenField) == 0 )
|
||||
if ( wxStrncmp(pc, wxT("ext:"), lenField) == 0 )
|
||||
{
|
||||
// skip ' ' which follows and take everything left until the end
|
||||
// of line
|
||||
@@ -690,7 +702,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
|
||||
|
||||
curMimeType.Empty();
|
||||
|
||||
while ( *pc != _T(':') && *pc != _T('\0') )
|
||||
while ( *pc != wxT(':') && *pc != wxT('\0') )
|
||||
{
|
||||
curMimeType += *pc++;
|
||||
}
|
||||
@@ -705,7 +717,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeFilesFromDir(const wxString& dirbase)
|
||||
_T("base directory shouldn't end with a slash") );
|
||||
|
||||
wxString dirname = dirbase;
|
||||
dirname << _T("/mime-info");
|
||||
dirname << wxT("/mime-info");
|
||||
|
||||
if ( !wxDir::Exists(dirname) )
|
||||
return;
|
||||
@@ -715,7 +727,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeFilesFromDir(const wxString& dirbase)
|
||||
return;
|
||||
|
||||
// we will concatenate it with filename to get the full path below
|
||||
dirname += _T('/');
|
||||
dirname += wxT('/');
|
||||
|
||||
wxString filename;
|
||||
bool cont = dir.GetFirst(&filename, _T("*.mime"), wxDIR_FILES);
|
||||
@@ -742,12 +754,12 @@ void wxMimeTypesManagerImpl::GetGnomeMimeInfo(const wxString& sExtraDir)
|
||||
{
|
||||
|
||||
wxArrayString dirs;
|
||||
dirs.Add(_T("/usr/share"));
|
||||
dirs.Add(_T("/usr/local/share"));
|
||||
dirs.Add(wxT("/usr/share"));
|
||||
dirs.Add(wxT("/usr/local/share"));
|
||||
|
||||
wxString gnomedir;
|
||||
wxGetHomeDir( &gnomedir );
|
||||
gnomedir += _T("/.gnome");
|
||||
gnomedir += wxT("/.gnome");
|
||||
dirs.Add( gnomedir );
|
||||
if (!sExtraDir.empty()) dirs.Add( sExtraDir );
|
||||
|
||||
@@ -913,12 +925,12 @@ void wxMimeTypesManagerImpl::LoadKDELinksForMimeSubtype(const wxString& dirbase,
|
||||
wxArrayString sExts;
|
||||
wxString mimetype, mime_desc, strIcon;
|
||||
|
||||
int nIndex = file.pIndexOf ("MimeType=");
|
||||
int nIndex = file.pIndexOf( wxT("MimeType=") );
|
||||
if (nIndex == wxNOT_FOUND)
|
||||
{
|
||||
// construct mimetype from the directory name and the basename of the
|
||||
// file (it always has .kdelnk extension)
|
||||
mimetype << subdir << _T('/') << filename.BeforeLast(_T('.'));
|
||||
mimetype << subdir << wxT('/') << filename.BeforeLast( wxT('.') );
|
||||
}
|
||||
else mimetype = file.GetCmd (nIndex);
|
||||
|
||||
@@ -1085,15 +1097,15 @@ void wxMimeTypesManagerImpl::GetKDEMimeInfo(const wxString& sExtraDir)
|
||||
wxArrayString icondirs;
|
||||
|
||||
// settings in ~/.kde have maximal priority
|
||||
dirs.Add(wxGetHomeDir() + _T("/.kde/share"));
|
||||
icondirs.Add(wxGetHomeDir() + _T("/.kde/share/icons/"));
|
||||
dirs.Add(wxGetHomeDir() + wxT("/.kde/share"));
|
||||
icondirs.Add(wxGetHomeDir() + wxT("/.kde/share/icons/"));
|
||||
|
||||
// the variable KDEDIR is set when KDE is running
|
||||
const char *kdedir = getenv("KDEDIR");
|
||||
const wxChar *kdedir = wxGetenv( wxT("KDEDIR") );
|
||||
if ( kdedir )
|
||||
{
|
||||
dirs.Add(wxString(kdedir) + _T("/share"));
|
||||
icondirs.Add(wxString(kdedir) + _T("/share/icons/"));
|
||||
dirs.Add( wxString(kdedir) + wxT("/share") );
|
||||
icondirs.Add( wxString(kdedir) + wxT("/share/icons/") );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1346,6 +1358,7 @@ void wxMimeTypesManagerImpl::ClearData()
|
||||
m_aExtensions.Clear ();
|
||||
m_aDescriptions.Clear ();
|
||||
|
||||
WX_CLEAR_ARRAY(m_aEntries);
|
||||
m_aEntries.Empty();
|
||||
|
||||
m_mailcapStylesInited = 0;
|
||||
@@ -1354,8 +1367,6 @@ void wxMimeTypesManagerImpl::ClearData()
|
||||
wxMimeTypesManagerImpl::~wxMimeTypesManagerImpl()
|
||||
{
|
||||
ClearData();
|
||||
|
||||
WX_CLEAR_ARRAY(m_aEntries);
|
||||
}
|
||||
|
||||
|
||||
@@ -2033,7 +2044,11 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
strFileName.c_str());
|
||||
|
||||
wxTextFile file(strFileName);
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( !file.Open( wxConvUTF8) )
|
||||
#else
|
||||
if ( !file.Open() )
|
||||
#endif
|
||||
return FALSE;
|
||||
|
||||
// the information we extract
|
||||
@@ -2041,7 +2056,8 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
|
||||
size_t nLineCount = file.GetLineCount();
|
||||
const wxChar *pc = NULL;
|
||||
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
|
||||
for ( size_t nLine = 0; nLine < nLineCount; nLine++ )
|
||||
{
|
||||
if ( pc == NULL ) {
|
||||
// now we're at the start of the line
|
||||
pc = file[nLine].c_str();
|
||||
@@ -2307,7 +2323,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
strFileName.c_str());
|
||||
|
||||
wxTextFile file(strFileName);
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( !file.Open( wxConvUTF8) )
|
||||
#else
|
||||
if ( !file.Open() )
|
||||
#endif
|
||||
return FALSE;
|
||||
|
||||
// indices of MIME types (in m_aTypes) we already found in this file
|
||||
@@ -2367,11 +2387,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
// something is wrong, bail out
|
||||
cont = FALSE;
|
||||
|
||||
wxLogDebug(wxT("Mailcap file %s, line %d: "
|
||||
wxLogDebug(wxT("Mailcap file %s, line %lu: "
|
||||
"'\\' on the end of the last line "
|
||||
"ignored."),
|
||||
strFileName.c_str(),
|
||||
nLine + 1);
|
||||
(unsigned long)nLine + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2433,11 +2453,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
// this might be useful for the programmer
|
||||
wxLogDebug
|
||||
(
|
||||
wxT("Mailcap file %s, line %d: "
|
||||
wxT("Mailcap file %s, line %lu: "
|
||||
"unknown field '%s' for the "
|
||||
"MIME type '%s' ignored."),
|
||||
strFileName.c_str(),
|
||||
nLine + 1,
|
||||
(unsigned long)nLine + 1,
|
||||
curField.c_str(),
|
||||
data.type.c_str()
|
||||
);
|
||||
@@ -2504,7 +2524,8 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
|
||||
if ( data.needsterminal )
|
||||
{
|
||||
data.cmdOpen.Printf(_T("xterm -e sh -c '%s'"), data.cmdOpen.c_str());
|
||||
data.cmdOpen = wxString::Format(_T("xterm -e sh -c '%s'"),
|
||||
data.cmdOpen.c_str());
|
||||
}
|
||||
|
||||
if ( !data.cmdOpen.empty() )
|
||||
|
@@ -495,8 +495,8 @@ wxSemaError wxSemaphoreInternal::Wait()
|
||||
return wxSEMA_MISC_ERROR;
|
||||
|
||||
wxLogTrace(TRACE_SEMA,
|
||||
"Thread %ld finished waiting for semaphore, count = %u",
|
||||
wxThread::GetCurrentId(), m_count);
|
||||
"Thread %ld finished waiting for semaphore, count = %lu",
|
||||
wxThread::GetCurrentId(), (unsigned long)m_count);
|
||||
}
|
||||
|
||||
m_count--;
|
||||
@@ -553,9 +553,9 @@ wxSemaError wxSemaphoreInternal::Post()
|
||||
m_count++;
|
||||
|
||||
wxLogTrace(TRACE_SEMA,
|
||||
"Thread %ld about to signal semaphore, count = %u",
|
||||
wxThread::GetCurrentId(), m_count);
|
||||
|
||||
"Thread %ld about to signal semaphore, count = %lu",
|
||||
wxThread::GetCurrentId(), (unsigned long)m_count);
|
||||
|
||||
return m_cond.Signal() == wxCOND_NO_ERROR ? wxSEMA_NO_ERROR
|
||||
: wxSEMA_MISC_ERROR;
|
||||
}
|
||||
@@ -620,7 +620,7 @@ public:
|
||||
};
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld: %s => %s."),
|
||||
GetId(), stateNames[m_state], stateNames[state]);
|
||||
(long)GetId(), stateNames[m_state], stateNames[state]);
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
m_state = state;
|
||||
@@ -696,8 +696,12 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
|
||||
{
|
||||
wxThreadInternal *pthread = thread->m_internal;
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), pthread->GetId());
|
||||
|
||||
#ifdef __VMS
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), (long long)pthread->GetId());
|
||||
#else
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), (long)pthread->GetId());
|
||||
#endif
|
||||
|
||||
// associate the thread pointer with the newly created thread so that
|
||||
// wxThread::This() will work
|
||||
int rc = pthread_setspecific(gs_keySelf, thread);
|
||||
@@ -734,13 +738,21 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
|
||||
{
|
||||
// call the main entry
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld about to enter its Entry()."),
|
||||
pthread->GetId());
|
||||
|
||||
#ifdef __VMS
|
||||
(long long)pthread->GetId());
|
||||
#else
|
||||
(long)pthread->GetId());
|
||||
#endif
|
||||
|
||||
pthread->m_exitcode = thread->Entry();
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld Entry() returned %lu."),
|
||||
pthread->GetId(), (unsigned long)pthread->m_exitcode);
|
||||
|
||||
#ifdef __VMS
|
||||
(long long)pthread->GetId(), (unsigned long)pthread->m_exitcode);
|
||||
#else
|
||||
(long)pthread->GetId(), (unsigned long)pthread->m_exitcode);
|
||||
#endif
|
||||
|
||||
{
|
||||
wxCriticalSectionLocker lock(thread->m_critsect);
|
||||
|
||||
@@ -849,8 +861,12 @@ void wxThreadInternal::Wait()
|
||||
wxMutexGuiLeave();
|
||||
|
||||
wxLogTrace(TRACE_THREADS,
|
||||
_T("Starting to wait for thread %ld to exit."), GetId());
|
||||
|
||||
#ifdef __VMS
|
||||
_T("Starting to wait for thread %ld to exit."), (long long)GetId());
|
||||
#else
|
||||
_T("Starting to wait for thread %ld to exit."), (long)GetId());
|
||||
#endif
|
||||
|
||||
// to avoid memory leaks we should call pthread_join(), but it must only be
|
||||
// done once so use a critical section to serialize the code below
|
||||
{
|
||||
@@ -862,7 +878,7 @@ void wxThreadInternal::Wait()
|
||||
// we're cancelled inside pthread_join(), things will almost
|
||||
// certainly break - but if we disable the cancellation, we
|
||||
// might deadlock
|
||||
if ( pthread_join((pthread_t)GetId(), &m_exitcode) != 0 )
|
||||
if ( pthread_join(GetId(), &m_exitcode) != 0 )
|
||||
{
|
||||
// this is a serious problem, so use wxLogError and not
|
||||
// wxLogDebug: it is possible to bring the system to its knees
|
||||
@@ -888,8 +904,12 @@ void wxThreadInternal::Pause()
|
||||
wxCHECK_RET( m_state == STATE_PAUSED,
|
||||
wxT("thread must first be paused with wxThread::Pause().") );
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), GetId());
|
||||
|
||||
#ifdef __VMS
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), (long long)GetId());
|
||||
#else
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), (long)GetId());
|
||||
#endif
|
||||
|
||||
// wait until the semaphore is Post()ed from Resume()
|
||||
m_semSuspend.Wait();
|
||||
}
|
||||
@@ -903,8 +923,12 @@ void wxThreadInternal::Resume()
|
||||
// TestDestroy() since the last call to Pause() for example
|
||||
if ( IsReallyPaused() )
|
||||
{
|
||||
wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), GetId());
|
||||
|
||||
#ifdef __VMS
|
||||
wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), (long long)GetId());
|
||||
#else
|
||||
wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), (long)GetId());
|
||||
#endif
|
||||
|
||||
// wake up Pause()
|
||||
m_semSuspend.Post();
|
||||
|
||||
@@ -914,7 +938,11 @@ void wxThreadInternal::Resume()
|
||||
else
|
||||
{
|
||||
wxLogTrace(TRACE_THREADS, _T("Thread %ld is not yet really paused"),
|
||||
GetId());
|
||||
#ifdef __VMS
|
||||
(long long)GetId());
|
||||
#else
|
||||
(long)GetId());
|
||||
#endif
|
||||
}
|
||||
|
||||
SetState(STATE_RUNNING);
|
||||
@@ -1598,8 +1626,9 @@ void wxThreadModule::OnExit()
|
||||
|
||||
if ( nThreadsBeingDeleted > 0 )
|
||||
{
|
||||
wxLogTrace(TRACE_THREADS, _T("Waiting for %u threads to disappear"),
|
||||
nThreadsBeingDeleted);
|
||||
wxLogTrace(TRACE_THREADS,
|
||||
_T("Waiting for %lu threads to disappear"),
|
||||
(unsigned long)nThreadsBeingDeleted);
|
||||
|
||||
// have to wait until all of them disappear
|
||||
gs_condAllDeleted->Wait();
|
||||
@@ -1610,8 +1639,8 @@ void wxThreadModule::OnExit()
|
||||
size_t count = gs_allThreads.GetCount();
|
||||
if ( count != 0u )
|
||||
{
|
||||
wxLogDebug(wxT("%u threads were not terminated by the application."),
|
||||
count);
|
||||
wxLogDebug(wxT("%lu threads were not terminated by the application."),
|
||||
(unsigned long)count);
|
||||
}
|
||||
|
||||
for ( size_t n = 0u; n < count; n++ )
|
||||
@@ -1645,8 +1674,8 @@ static void ScheduleThreadForDeletion()
|
||||
|
||||
gs_nThreadsBeingDeleted++;
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("%u thread%s waiting to be deleted"),
|
||||
gs_nThreadsBeingDeleted,
|
||||
wxLogTrace(TRACE_THREADS, _T("%lu thread%s waiting to be deleted"),
|
||||
(unsigned long)gs_nThreadsBeingDeleted,
|
||||
gs_nThreadsBeingDeleted == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
@@ -1663,8 +1692,8 @@ static void DeleteThread(wxThread *This)
|
||||
wxCHECK_RET( gs_nThreadsBeingDeleted > 0,
|
||||
_T("no threads scheduled for deletion, yet we delete one?") );
|
||||
|
||||
wxLogTrace(TRACE_THREADS, _T("%u scheduled for deletion threads left."),
|
||||
gs_nThreadsBeingDeleted - 1);
|
||||
wxLogTrace(TRACE_THREADS, _T("%lu scheduled for deletion threads left."),
|
||||
(unsigned long)gs_nThreadsBeingDeleted - 1);
|
||||
|
||||
if ( !--gs_nThreadsBeingDeleted )
|
||||
{
|
||||
|
@@ -44,7 +44,11 @@
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#define statfs statvfs
|
||||
# ifdef __HPUX__
|
||||
#define wxStatFs struct statvfs
|
||||
# else
|
||||
#define wxStatFs statvfs_t
|
||||
# endif
|
||||
#elif HAVE_STATFS
|
||||
#define wxStatFs struct statfs
|
||||
#endif // HAVE_STAT[V]FS
|
||||
@@ -362,10 +366,10 @@ public:
|
||||
bool IsOpened() const { return !Eof(); }
|
||||
|
||||
// return TRUE if we have anything to read, don't block
|
||||
bool IsAvailable() const;
|
||||
virtual bool CanRead() const;
|
||||
};
|
||||
|
||||
bool wxPipeInputStream::IsAvailable() const
|
||||
bool wxPipeInputStream::CanRead() const
|
||||
{
|
||||
if ( m_lasterror == wxSTREAM_EOF )
|
||||
return FALSE;
|
||||
@@ -800,7 +804,12 @@ char *wxGetUserHome( const wxString &user )
|
||||
|
||||
if ((ptr = wxGetenv(wxT("HOME"))) != NULL)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
wxWCharBuffer buffer( ptr );
|
||||
return buffer;
|
||||
#else
|
||||
return ptr;
|
||||
#endif
|
||||
}
|
||||
if ((ptr = wxGetenv(wxT("USER"))) != NULL || (ptr = wxGetenv(wxT("LOGNAME"))) != NULL)
|
||||
{
|
||||
@@ -947,7 +956,7 @@ wxString wxGetOsDescription()
|
||||
#ifndef WXWIN_OS_DESCRIPTION
|
||||
#error WXWIN_OS_DESCRIPTION should be defined in config.h by configure
|
||||
#else
|
||||
return WXWIN_OS_DESCRIPTION;
|
||||
return wxString::FromAscii( WXWIN_OS_DESCRIPTION );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user