summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
11bf9fe)
Add the missing "#if wxUSE_FFILE" checks and add fallbacks to wxFile if it's
available.
Closes #15353.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74596
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
3.0: (released 2013-09-??)
--------------------------
3.0: (released 2013-09-??)
--------------------------
+All:
+
+- Fix build with wxUSE_FFILE==0 (jroemmler).
+
All (GUI):
- Fix crash in wxHTML on mal-formed <area> elements (LukasK).
All (GUI):
- Fix crash in wxHTML on mal-formed <area> elements (LukasK).
*/
virtual void ResetAndClearCommands();
*/
virtual void ResetAndClearCommands();
+#if wxUSE_FFILE && wxUSE_STREAMS
- Loads content from a stream or file.
+ Loads content from a file.
Not all handlers will implement file loading.
*/
virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
Not all handlers will implement file loading.
*/
virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
- virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
- Saves content to a stream or file.
+ Saves content to a file.
Not all handlers will implement file saving.
*/
virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
Not all handlers will implement file saving.
*/
virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+#endif // wxUSE_FFILE
+
+#if wxUSE_STREAMS
+ //@{
+ /**
+ Loads content from a stream.
+ Not all handlers will implement loading from a stream.
+ */
+ virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+
+ //@{
+ /**
+ Saves content to a stream.
+ Not all handlers will implement saving to a stream.
+ */
virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
//@}
virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
//@}
/**
Sets the handler flags, controlling loading and saving.
/**
Sets the handler flags, controlling loading and saving.
int type = wxRICHTEXT_TYPE_ANY);
#endif
int type = wxRICHTEXT_TYPE_ANY);
#endif
+#if wxUSE_FFILE && wxUSE_STREAMS
/**
Helper function for LoadFile(). Loads content into the control's buffer using the given type.
/**
Helper function for LoadFile(). Loads content into the control's buffer using the given type.
This function looks for a suitable wxRichTextFileHandler object.
*/
virtual bool DoLoadFile(const wxString& file, int fileType);
This function looks for a suitable wxRichTextFileHandler object.
*/
virtual bool DoLoadFile(const wxString& file, int fileType);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
int type = wxRICHTEXT_TYPE_ANY);
#endif
int type = wxRICHTEXT_TYPE_ANY);
#endif
+#if wxUSE_FFILE && wxUSE_STREAMS
/**
Helper function for SaveFile(). Saves the buffer content using the given type.
/**
Helper function for SaveFile(). Saves the buffer content using the given type.
*/
virtual bool DoSaveFile(const wxString& file = wxEmptyString,
int fileType = wxRICHTEXT_TYPE_ANY);
*/
virtual bool DoSaveFile(const wxString& file = wxEmptyString,
int fileType = wxRICHTEXT_TYPE_ANY);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
/**
Sets flags that change the behaviour of loading or saving.
/**
Sets flags that change the behaviour of loading or saving.
virtual ~wxRichTextPrinting();
/// Preview the file or buffer
virtual ~wxRichTextPrinting();
/// Preview the file or buffer
+#if wxUSE_FFILE && wxUSE_STREAMS
bool PreviewFile(const wxString& richTextFile);
bool PreviewFile(const wxString& richTextFile);
bool PreviewBuffer(const wxRichTextBuffer& buffer);
/// Print the file or buffer
bool PreviewBuffer(const wxRichTextBuffer& buffer);
/// Print the file or buffer
+#if wxUSE_FFILE && wxUSE_STREAMS
bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
/// Shows page setup dialog
bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
/// Shows page setup dialog
#if wxUSE_DEBUGREPORT && wxUSE_XML
#include "wx/debugrpt.h"
#if wxUSE_DEBUGREPORT && wxUSE_XML
#include "wx/debugrpt.h"
+#if wxUSE_FFILE
+ #include "wx/ffile.h"
+#elif wxUSE_FILE
+ #include "wx/file.h"
+#endif
#include "wx/filename.h"
#include "wx/dir.h"
#include "wx/dynlib.h"
#include "wx/filename.h"
#include "wx/dir.h"
#include "wx/dynlib.h"
const wxString& text,
const wxString& description)
{
const wxString& text,
const wxString& description)
{
+#if wxUSE_FFILE || wxUSE_FILE
wxASSERT_MSG( !wxFileName(filename).IsAbsolute(),
wxT("filename should be relative to debug report directory") );
wxASSERT_MSG( !wxFileName(filename).IsAbsolute(),
wxT("filename should be relative to debug report directory") );
- wxFileName fn(GetDirectory(), filename);
- wxFFile file(fn.GetFullPath(), wxT("w"));
- if ( !file.IsOpened() || !file.Write(text) )
+ const wxString fullPath = wxFileName(GetDirectory(), filename).GetFullPath();
+#if wxUSE_FFILE
+ wxFFile file(fullPath, wxT("w"));
+#elif wxUSE_FILE
+ wxFile file(fullPath, wxFile::write);
+#endif
+ if ( !file.IsOpened() || !file.Write(text, wxConvAuto()) )
return false;
AddFile(filename, description);
return true;
return false;
AddFile(filename, description);
return true;
+#else // !wxUSE_FFILE && !wxUSE_FILE
+ return false;
+#endif
}
void wxDebugReport::RemoveFile(const wxString& name)
}
void wxDebugReport::RemoveFile(const wxString& name)
bool wxDebugReportCompress::DoProcess()
{
bool wxDebugReportCompress::DoProcess()
{
+#define HAS_FILE_STREAMS (wxUSE_STREAMS && (wxUSE_FILE || wxUSE_FFILE))
+#if HAS_FILE_STREAMS
const size_t count = GetFilesCount();
if ( !count )
return false;
const size_t count = GetFilesCount();
if ( !count )
return false;
fn.SetExt("zip");
// create the streams
fn.SetExt("zip");
// create the streams
- wxFFileOutputStream os(fn.GetFullPath(), wxT("wb"));
+ const wxString ofullPath = fn.GetFullPath();
+#if wxUSE_FFILE
+ wxFFileOutputStream os(ofullPath, wxT("wb"));
+#elif wxUSE_FILE
+ wxFileOutputStream os(ofullPath);
+#endif
+ if ( !os.IsOk() )
+ return false;
wxZipOutputStream zos(os, 9);
// add all files to the ZIP one
wxZipOutputStream zos(os, 9);
// add all files to the ZIP one
if ( !zos.PutNextEntry(ze) )
return false;
if ( !zos.PutNextEntry(ze) )
return false;
- const wxFileName filename(GetDirectory(), name);
- wxFFileInputStream is(filename.GetFullPath());
+ const wxString ifullPath = wxFileName(GetDirectory(), name).GetFullPath();
+#if wxUSE_FFILE
+ wxFFileInputStream is(ifullPath);
+#elif wxUSE_FILE
+ wxFileInputStream is(ifullPath);
+#endif
if ( !is.IsOk() || !zos.Write(is).IsOk() )
return false;
}
if ( !is.IsOk() || !zos.Write(is).IsOk() )
return false;
}
if ( !zos.Close() )
return false;
if ( !zos.Close() )
return false;
- m_zipfile = fn.GetFullPath();
+#else
+ return false;
+#endif // HAS_FILE_STREAMS
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
+#else
+ (void)filename; // avoid compiler warning about unreferenced parameter
#endif // wxUSE_FFILE
wxLogError(_("File couldn't be loaded."));
#endif // wxUSE_FFILE
wxLogError(_("File couldn't be loaded."));
+#else
+ (void)filename; // avoid compiler warning about unreferenced parameter
#endif // wxUSE_FFILE
return false;
#endif // wxUSE_FFILE
return false;
#endif // WX_PRECOMP
#include "wx/filename.h"
#endif // WX_PRECOMP
#include "wx/filename.h"
+#ifdef wxUSE_FFILE
+ #include "wx/ffile.h"
+#else
+ #include "wx/file.h"
+#endif
#include "wx/mimetype.h"
#include "wx/statline.h"
#include "wx/mimetype.h"
#include "wx/statline.h"
wxFileName fn(m_dbgrpt.GetDirectory(), m_files[sel]);
wxString str;
wxFileName fn(m_dbgrpt.GetDirectory(), m_files[sel]);
wxString str;
- wxFFile file(fn.GetFullPath());
+ const wxString& fullPath = fn.GetFullPath();
+#if wxUSE_FFILE
+ wxFFile file(fullPath);
+#elif wxUSE_FILE
+ wxFile file(fullPath);
+#endif
if ( file.IsOpened() && file.ReadAll(&str) )
{
wxDumpPreviewDlg dlg(this, m_files[sel], str);
if ( file.IsOpened() && file.ReadAll(&str) )
{
wxDumpPreviewDlg dlg(this, m_files[sel], str);
+#if wxUSE_FFILE && wxUSE_STREAMS
/// Load a file
bool wxRichTextBuffer::LoadFile(const wxString& filename, wxRichTextFileType type)
{
/// Load a file
bool wxRichTextBuffer::LoadFile(const wxString& filename, wxRichTextFileType type)
{
+#endif // wxUSE_FFILE && wxUSE_STREAMS
/// Load from a stream
bool wxRichTextBuffer::LoadFile(wxInputStream& stream, wxRichTextFileType type)
{
/// Load from a stream
bool wxRichTextBuffer::LoadFile(wxInputStream& stream, wxRichTextFileType type)
{
/// Copy the range to the clipboard
bool wxRichTextBuffer::CopyToClipboard(const wxRichTextRange& range)
/// Copy the range to the clipboard
bool wxRichTextBuffer::CopyToClipboard(const wxRichTextRange& range)
// ----------------------------------------------------------------------------
// file IO functions
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// file IO functions
// ----------------------------------------------------------------------------
+#if wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType)
{
SetFocusObject(& GetBuffer(), true);
bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType)
{
SetFocusObject(& GetBuffer(), true);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
// ----------------------------------------------------------------------------
// wxRichTextCtrl specific functionality
// ----------------------------------------------------------------------------
// wxRichTextCtrl specific functionality
m_richTextBufferPreview = buf;
}
m_richTextBufferPreview = buf;
}
+#if wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextPrinting::PreviewFile(const wxString& richTextFile)
{
SetRichTextBufferPreview(new wxRichTextBuffer);
bool wxRichTextPrinting::PreviewFile(const wxString& richTextFile)
{
SetRichTextBufferPreview(new wxRichTextBuffer);
p2->SetRichTextBuffer(m_richTextBufferPrinting);
return DoPreview(p1, p2);
}
p2->SetRichTextBuffer(m_richTextBufferPrinting);
return DoPreview(p1, p2);
}
+#endif // wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextPrinting::PreviewBuffer(const wxRichTextBuffer& buffer)
{
bool wxRichTextPrinting::PreviewBuffer(const wxRichTextBuffer& buffer)
{
return DoPreview(p1, p2);
}
return DoPreview(p1, p2);
}
+#if wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextPrinting::PrintFile(const wxString& richTextFile, bool showPrintDialog)
{
SetRichTextBufferPrinting(new wxRichTextBuffer);
bool wxRichTextPrinting::PrintFile(const wxString& richTextFile, bool showPrintDialog)
{
SetRichTextBufferPrinting(new wxRichTextBuffer);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog)
{
bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog)
{
#if wxUSE_FFILE
#include "wx/ffile.h"
#elif wxUSE_FILE
#if wxUSE_FFILE
#include "wx/ffile.h"
#elif wxUSE_FILE