Applied BMP patch.
Applied deferred wxBitmapButton patch. Added error checking to wxFileStream and wxFFileStream. Corrected activate event things. All these patches work in the stable branch, the dev-branch does not currently compile. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,19 +48,6 @@
|
|||||||
#include "wx/msw/winundef.h"
|
#include "wx/msw/winundef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// at least some of these are required for file mod time
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#ifndef __VMS
|
|
||||||
# include <grp.h>
|
|
||||||
#endif
|
|
||||||
# include <time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -167,24 +154,8 @@ bool wxFileName::DirExists( const wxString &dir )
|
|||||||
|
|
||||||
wxDateTime wxFileName::GetModificationTime()
|
wxDateTime wxFileName::GetModificationTime()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK__
|
wxDateTime ret( wxFileModificationTime( GetFullPath() ) );
|
||||||
struct stat buff;
|
|
||||||
stat( GetFullName().fn_str(), &buff );
|
|
||||||
|
|
||||||
#if !defined( __EMX__ ) && !defined(__VMS)
|
|
||||||
struct stat lbuff;
|
|
||||||
lstat( GetFullName().fn_str(), &lbuff );
|
|
||||||
struct tm *t = localtime( &lbuff.st_mtime );
|
|
||||||
#else
|
|
||||||
struct tm *t = localtime( &buff.st_mtime );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxDateTime ret( t->tm_mday, (wxDateTime::Month)t->tm_mon, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec );
|
|
||||||
#else
|
|
||||||
|
|
||||||
wxDateTime ret = wxDateTime::Now();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,7 +578,7 @@ wxString wxFileName::GetLongPath() const
|
|||||||
s_triedToLoad = TRUE;
|
s_triedToLoad = TRUE;
|
||||||
|
|
||||||
wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
|
wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
|
||||||
short avoidCompilerWarning = 0;
|
short avoidCompilerWarning = 0;
|
||||||
if ( avoidCompilerWarning ) // dllKernel )
|
if ( avoidCompilerWarning ) // dllKernel )
|
||||||
{
|
{
|
||||||
// may succeed or fail depending on the Windows version
|
// may succeed or fail depending on the Windows version
|
||||||
|
@@ -383,7 +383,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
if (bpp == 1)
|
if (bpp == 1)
|
||||||
{
|
{
|
||||||
int bit = 0;
|
int bit = 0;
|
||||||
for (bit = 0; bit < 8; bit++)
|
for (bit = 0; bit < 8 && column < width; bit++)
|
||||||
{
|
{
|
||||||
index = ((aByte & (0x80 >> bit)) ? 1 : 0);
|
index = ((aByte & (0x80 >> bit)) ? 1 : 0);
|
||||||
ptr[poffset] = cmap[index].r;
|
ptr[poffset] = cmap[index].r;
|
||||||
@@ -405,7 +405,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int nibble = 0;
|
int nibble = 0;
|
||||||
for (nibble = 0; nibble < 2; nibble++)
|
for (nibble = 0; nibble < 2 && column < width; nibble++)
|
||||||
{
|
{
|
||||||
index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4));
|
index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4));
|
||||||
if (index >= 16)
|
if (index >= 16)
|
||||||
@@ -461,7 +461,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int l = 0; l < first; l++)
|
for (int l = 0; l < first && column < width; l++)
|
||||||
{
|
{
|
||||||
ptr[poffset ] = cmap[aByte].r;
|
ptr[poffset ] = cmap[aByte].r;
|
||||||
ptr[poffset + 1] = cmap[aByte].g;
|
ptr[poffset + 1] = cmap[aByte].g;
|
||||||
|
@@ -103,6 +103,16 @@ wxFileOutputStream::wxFileOutputStream(const wxString& fileName)
|
|||||||
{
|
{
|
||||||
m_file = new wxFile(fileName, wxFile::write);
|
m_file = new wxFile(fileName, wxFile::write);
|
||||||
m_file_destroy = TRUE;
|
m_file_destroy = TRUE;
|
||||||
|
|
||||||
|
if (!m_file->IsOpened())
|
||||||
|
{
|
||||||
|
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_file->Error())
|
||||||
|
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileOutputStream::wxFileOutputStream(wxFile& file)
|
wxFileOutputStream::wxFileOutputStream(wxFile& file)
|
||||||
@@ -250,6 +260,16 @@ wxFFileOutputStream::wxFFileOutputStream(const wxString& fileName)
|
|||||||
{
|
{
|
||||||
m_file = new wxFFile(fileName, "w+b");
|
m_file = new wxFFile(fileName, "w+b");
|
||||||
m_file_destroy = TRUE;
|
m_file_destroy = TRUE;
|
||||||
|
|
||||||
|
if (!m_file->IsOpened())
|
||||||
|
{
|
||||||
|
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_file->Error())
|
||||||
|
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFFileOutputStream::wxFFileOutputStream(wxFFile& file)
|
wxFFileOutputStream::wxFFileOutputStream(wxFFile& file)
|
||||||
|
@@ -1600,14 +1600,29 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
if (win->IsTopLevel())
|
||||||
event.SetEventObject( win );
|
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
|
||||||
return TRUE;
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1658,13 +1673,27 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
if (win->IsTopLevel())
|
||||||
event.SetEventObject( win );
|
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
|
||||||
return TRUE;
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2647,7 +2676,7 @@ void wxWindow::OnInternalIdle()
|
|||||||
// do it only once
|
// do it only once
|
||||||
g_sendActivateEvent = -1;
|
g_sendActivateEvent = -1;
|
||||||
|
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, activate, GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
|
@@ -1600,14 +1600,29 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
if (win->IsTopLevel())
|
||||||
event.SetEventObject( win );
|
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
|
||||||
return TRUE;
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1658,13 +1673,27 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
if (win->IsTopLevel())
|
||||||
event.SetEventObject( win );
|
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
|
||||||
return TRUE;
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2647,7 +2676,7 @@ void wxWindow::OnInternalIdle()
|
|||||||
// do it only once
|
// do it only once
|
||||||
g_sendActivateEvent = -1;
|
g_sendActivateEvent = -1;
|
||||||
|
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, activate, GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
|
Reference in New Issue
Block a user