Added DoLoadFile, DoSaveFile to wxTextCtrlBase
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,21 +56,27 @@ Major changes in 2.7 release
|
|||||||
|
|
||||||
All:
|
All:
|
||||||
|
|
||||||
- Added wxDir::FindFirst() (Francesco Montorsi)
|
- Added wxDir::FindFirst() (Francesco Montorsi).
|
||||||
- Added wxPlatformInfo class (Francesco Montorsi)
|
- Added wxPlatformInfo class (Francesco Montorsi).
|
||||||
- Added wxLocale::IsAvailable() (Creighton)
|
- Added wxLocale::IsAvailable() (Creighton).
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
- Support for right-to-left text layout
|
- Support for right-to-left text layout (started by Diaa Sami during Google Summer of
|
||||||
(started by Diaa Sami during Google Summer of Code, with a lot of help from
|
Code, with a lot of help from Tim Kosse and others).
|
||||||
Tim Kosse and others)
|
- Added wxID_PAGE_SETUP standard id.
|
||||||
- Added wxID_PAGE_SETUP standard id
|
- Added wxSize::IncBy() and DecBy() methods.
|
||||||
- Added wxSize::IncBy() and DecBy() methods
|
- Added file type parameter to wxTextCtrl::LoadFile, wxTextCtrl::SaveFile for
|
||||||
|
consistency with wxRichTextCtrl.
|
||||||
|
- wxRichTextCtrl: fixed range out-by-one bug to be consistent with wxTextCtrl API,
|
||||||
|
fixed some attribute bugs and added wxRichTextStyleComboCtrl.
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
- Implemented wxComboBox::SetEditable()
|
- Implemented wxComboBox::SetEditable().
|
||||||
|
- Fixed a bug whereby static controls didn't use the correct text colour if the
|
||||||
|
parent's background colour had been set (most noticeable when switching to a
|
||||||
|
high-contrast theme).
|
||||||
|
|
||||||
wxMac:
|
wxMac:
|
||||||
|
|
||||||
@@ -79,8 +85,8 @@ wxMac:
|
|||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
- Automatically use stock items for the menu items with standard ids
|
- Automatically use stock items for menu items with standard ids.
|
||||||
- Setting cursor now works for all controls
|
- Setting cursor now works for all controls.
|
||||||
|
|
||||||
|
|
||||||
2.7.0
|
2.7.0
|
||||||
@@ -131,14 +137,14 @@ All:
|
|||||||
Previously, only the buffer would be returned, even if more data was requested.
|
Previously, only the buffer would be returned, even if more data was requested.
|
||||||
- Added wxPowerEvent (currently MSW-only).
|
- Added wxPowerEvent (currently MSW-only).
|
||||||
- Make wx-config compatible with Bourne shells.
|
- Make wx-config compatible with Bourne shells.
|
||||||
- Fixed wxDb::Open(wxDbConnectInf) when using connection string (Hellwolf Misty)
|
- Fixed wxDb::Open(wxDbConnectInf) when using connection string (Hellwolf Misty).
|
||||||
- Fixed crash in wxDb::Open() in Unicode build (Massimiliano Marretta)
|
- Fixed crash in wxDb::Open() in Unicode build (Massimiliano Marretta).
|
||||||
- Fixed wxTimeSpan::Format() for negative time spans
|
- Fixed wxTimeSpan::Format() for negative time spans.
|
||||||
- Optionally count repeating wxLog messages instead of logging all (Lauri Nurmi)
|
- Optionally count repeating wxLog messages instead of logging all (Lauri Nurmi).
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
- New AUI (Advanced User Interface) library for docking windows and much more
|
- New AUI (Advanced User Interface) library for docking windows and much more.
|
||||||
- Added wxComboCtrl and wxOwnerDrawnComboBox (Jaakko Salli).
|
- Added wxComboCtrl and wxOwnerDrawnComboBox (Jaakko Salli).
|
||||||
- Added wxTreebook (uses a wxTreeCtrl to control pages).
|
- Added wxTreebook (uses a wxTreeCtrl to control pages).
|
||||||
- Added wxColour/Dir/File/Font/PickerCtrls (Francesco Montorsi).
|
- Added wxColour/Dir/File/Font/PickerCtrls (Francesco Montorsi).
|
||||||
@@ -213,8 +219,8 @@ All (GUI):
|
|||||||
- wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.
|
- wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.
|
||||||
- Added wxTopLevelWindow::SetTransparent and CanSetTransparent, with
|
- Added wxTopLevelWindow::SetTransparent and CanSetTransparent, with
|
||||||
implementations (so far) for wxMSW and wxMac.
|
implementations (so far) for wxMSW and wxMac.
|
||||||
- Allow customizing individual grid lines appearance (S<>ren Lassen)
|
- Allow customizing individual grid lines appearance (S<>ren Lassen).
|
||||||
- Fixed middle click events generation in generic wxTreeCtrl (Olly Betts)
|
- Fixed middle click events generation in generic wxTreeCtrl (Olly Betts).
|
||||||
- Added wxEVT_MOUSE_CAPTURE_LOST event that must be handled by all windows
|
- Added wxEVT_MOUSE_CAPTURE_LOST event that must be handled by all windows
|
||||||
that CaptureMouse() is called on.
|
that CaptureMouse() is called on.
|
||||||
|
|
||||||
@@ -225,7 +231,7 @@ wxMSW:
|
|||||||
- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd).
|
- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd).
|
||||||
- Removed wxImageList *GetImageList(int) const.
|
- Removed wxImageList *GetImageList(int) const.
|
||||||
- Fixed MDI context menu problem.
|
- Fixed MDI context menu problem.
|
||||||
- Removed __WIN95__ define
|
- Removed __WIN95__ define.
|
||||||
- Create msw/rcdefs.h in setup.h's directory, which can be included by
|
- Create msw/rcdefs.h in setup.h's directory, which can be included by
|
||||||
resource files. It containts platform/compiler specific defines (such as
|
resource files. It containts platform/compiler specific defines (such as
|
||||||
target cpu) which can be used in #ifs in .rc files.
|
target cpu) which can be used in #ifs in .rc files.
|
||||||
|
@@ -652,7 +652,7 @@ otherwise.
|
|||||||
|
|
||||||
\membersection{wxTextCtrl::LoadFile}\label{wxtextctrlloadfile}
|
\membersection{wxTextCtrl::LoadFile}\label{wxtextctrlloadfile}
|
||||||
|
|
||||||
\func{bool}{LoadFile}{\param{const wxString\& }{ filename}}
|
\func{bool}{LoadFile}{\param{const wxString\& }{ filename}, \param{int }{fileType = wxTEXT\_TYPE\_ANY}}
|
||||||
|
|
||||||
Loads and displays the named file, if it exists.
|
Loads and displays the named file, if it exists.
|
||||||
|
|
||||||
@@ -660,6 +660,8 @@ Loads and displays the named file, if it exists.
|
|||||||
|
|
||||||
\docparam{filename}{The filename of the file to load.}
|
\docparam{filename}{The filename of the file to load.}
|
||||||
|
|
||||||
|
\docparam{fileType}{The type of file to load. This is currently ignored in wxTextCtrl.}
|
||||||
|
|
||||||
\wxheading{Return value}
|
\wxheading{Return value}
|
||||||
|
|
||||||
{\tt true} if successful, {\tt false} otherwise.
|
{\tt true} if successful, {\tt false} otherwise.
|
||||||
@@ -804,7 +806,7 @@ the character at the last position with the given text.
|
|||||||
|
|
||||||
\membersection{wxTextCtrl::SaveFile}\label{wxtextctrlsavefile}
|
\membersection{wxTextCtrl::SaveFile}\label{wxtextctrlsavefile}
|
||||||
|
|
||||||
\func{bool}{SaveFile}{\param{const wxString\& }{ filename}}
|
\func{bool}{SaveFile}{\param{const wxString\& }{ filename}, \param{int }{fileType = wxTEXT\_TYPE\_ANY}}
|
||||||
|
|
||||||
Saves the contents of the control in a text file.
|
Saves the contents of the control in a text file.
|
||||||
|
|
||||||
@@ -812,6 +814,8 @@ Saves the contents of the control in a text file.
|
|||||||
|
|
||||||
\docparam{filename}{The name of the file in which to save the text.}
|
\docparam{filename}{The name of the file in which to save the text.}
|
||||||
|
|
||||||
|
\docparam{fileType}{The type of file to save. This is currently ignored in wxTextCtrl.}
|
||||||
|
|
||||||
\wxheading{Return value}
|
\wxheading{Return value}
|
||||||
|
|
||||||
{\tt true} if the operation was successful, {\tt false} otherwise.
|
{\tt true} if the operation was successful, {\tt false} otherwise.
|
||||||
|
@@ -81,10 +81,6 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value);
|
virtual void Replace(long from, long to, const wxString& value);
|
||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
|
|
||||||
// load the controls contents from the file
|
|
||||||
virtual bool LoadFile(const wxString& file);
|
|
||||||
virtual bool LoadFile(const wxString& file, int WXUNUSED(fileType)) { return LoadFile(file); }
|
|
||||||
|
|
||||||
// sets/clears the dirty flag
|
// sets/clears the dirty flag
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
virtual void DiscardEdits();
|
virtual void DiscardEdits();
|
||||||
|
@@ -69,9 +69,6 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value);
|
virtual void Replace(long from, long to, const wxString& value);
|
||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
|
|
||||||
// load the controls contents from the file
|
|
||||||
virtual bool LoadFile(const wxString& file);
|
|
||||||
|
|
||||||
// sets/clears the dirty flag
|
// sets/clears the dirty flag
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
virtual void DiscardEdits();
|
virtual void DiscardEdits();
|
||||||
|
@@ -66,9 +66,8 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value);
|
virtual void Replace(long from, long to, const wxString& value);
|
||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
|
|
||||||
// load the controls contents from the file
|
// load the control's contents from the file
|
||||||
virtual bool LoadFile(const wxString& file);
|
virtual bool DoLoadFile(const wxString& file, int fileType);
|
||||||
virtual bool LoadFile(const wxString& file, int WXUNUSED(fileType)) { return LoadFile(file); }
|
|
||||||
|
|
||||||
// clears the dirty flag
|
// clears the dirty flag
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
,long lTo
|
,long lTo
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual bool LoadFile(const wxString& rsFile);
|
virtual bool DoLoadFile(const wxString& rsFile, int fileType);
|
||||||
|
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
virtual void DiscardEdits(void);
|
virtual void DiscardEdits(void);
|
||||||
|
@@ -64,8 +64,8 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value);
|
virtual void Replace(long from, long to, const wxString& value);
|
||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
|
|
||||||
// load the controls contents from the file
|
// load the control's contents from the file
|
||||||
virtual bool LoadFile(const wxString& file);
|
virtual bool DoLoadFile(const wxString& file, int fileType);
|
||||||
|
|
||||||
// clears the dirty flag
|
// clears the dirty flag
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
|
@@ -157,11 +157,14 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value);
|
virtual void Replace(long from, long to, const wxString& value);
|
||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
|
|
||||||
|
#if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
|
||||||
|
bool LoadFile(const wxString& file, int fileType = wxRICHTEXT_TYPE_ANY);
|
||||||
|
bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxRICHTEXT_TYPE_ANY);
|
||||||
|
#endif
|
||||||
|
|
||||||
// load/save the controls contents from/to the file
|
// load/save the controls contents from/to the file
|
||||||
virtual bool LoadFile(const wxString& file) { return LoadFile(file, wxRICHTEXT_TYPE_ANY); }
|
virtual bool DoLoadFile(const wxString& file, int fileType);
|
||||||
virtual bool LoadFile(const wxString& file, int type);
|
virtual bool DoSaveFile(const wxString& file = wxEmptyString, int fileType = wxRICHTEXT_TYPE_ANY);
|
||||||
virtual bool SaveFile(const wxString& file = wxEmptyString) { return SaveFile(file, wxRICHTEXT_TYPE_ANY); }
|
|
||||||
virtual bool SaveFile(const wxString& file, int type);
|
|
||||||
|
|
||||||
// sets/clears the dirty flag
|
// sets/clears the dirty flag
|
||||||
virtual void MarkDirty();
|
virtual void MarkDirty();
|
||||||
@@ -735,8 +738,10 @@ private:
|
|||||||
/// Text buffer
|
/// Text buffer
|
||||||
wxRichTextBuffer m_buffer;
|
wxRichTextBuffer m_buffer;
|
||||||
|
|
||||||
|
#if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
|
||||||
/// Filename
|
/// Filename
|
||||||
wxString m_filename;
|
wxString m_filename;
|
||||||
|
#endif
|
||||||
|
|
||||||
wxMenu* m_contextMenu;
|
wxMenu* m_contextMenu;
|
||||||
|
|
||||||
|
@@ -128,6 +128,12 @@ const wxTextCoord wxInvalidTextCoord = -2;
|
|||||||
#define wxTE_CAPITALIZE 0
|
#define wxTE_CAPITALIZE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxTextCtrl file types
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define wxTEXT_TYPE_ANY 0
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTextCtrl::HitTest return values
|
// wxTextCtrl::HitTest return values
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -320,11 +326,13 @@ public:
|
|||||||
virtual void Replace(long from, long to, const wxString& value) = 0;
|
virtual void Replace(long from, long to, const wxString& value) = 0;
|
||||||
virtual void Remove(long from, long to) = 0;
|
virtual void Remove(long from, long to) = 0;
|
||||||
|
|
||||||
// load/save the controls contents from/to the file
|
// load/save the control's contents from/to a file
|
||||||
virtual bool LoadFile(const wxString& file);
|
bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); }
|
||||||
virtual bool LoadFile(const wxString& file, int WXUNUSED(fileType)) { return LoadFile(file); }
|
bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY);
|
||||||
virtual bool SaveFile(const wxString& file = wxEmptyString);
|
|
||||||
virtual bool SaveFile(const wxString& file, int WXUNUSED(fileType)) { return SaveFile(file); }
|
// implementation for loading/saving
|
||||||
|
virtual bool DoLoadFile(const wxString& file, int fileType);
|
||||||
|
virtual bool DoSaveFile(const wxString& file, int fileType);
|
||||||
|
|
||||||
// sets/clears the dirty flag
|
// sets/clears the dirty flag
|
||||||
virtual void MarkDirty() = 0;
|
virtual void MarkDirty() = 0;
|
||||||
|
@@ -196,7 +196,7 @@ const wxTextAttr& wxTextCtrlBase::GetDefaultStyle() const
|
|||||||
// file IO functions
|
// file IO functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxTextCtrlBase::LoadFile(const wxString& filename)
|
bool wxTextCtrlBase::DoLoadFile(const wxString& filename, int WXUNUSED(fileType))
|
||||||
{
|
{
|
||||||
#if wxUSE_FFILE
|
#if wxUSE_FFILE
|
||||||
wxFFile file(filename);
|
wxFFile file(filename);
|
||||||
@@ -221,7 +221,7 @@ bool wxTextCtrlBase::LoadFile(const wxString& filename)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrlBase::SaveFile(const wxString& filename)
|
bool wxTextCtrlBase::SaveFile(const wxString& filename, int fileType)
|
||||||
{
|
{
|
||||||
wxString filenameToUse = filename.empty() ? m_filename : filename;
|
wxString filenameToUse = filename.empty() ? m_filename : filename;
|
||||||
if ( filenameToUse.empty() )
|
if ( filenameToUse.empty() )
|
||||||
@@ -232,16 +232,21 @@ bool wxTextCtrlBase::SaveFile(const wxString& filename)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DoSaveFile(filenameToUse, fileType);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxTextCtrlBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
|
||||||
|
{
|
||||||
#if wxUSE_FFILE
|
#if wxUSE_FFILE
|
||||||
wxFFile file(filenameToUse, _T("w"));
|
wxFFile file(filename, _T("w"));
|
||||||
if ( file.IsOpened() && file.Write(GetValue()) )
|
if ( file.IsOpened() && file.Write(GetValue()) )
|
||||||
{
|
{
|
||||||
|
// if it worked, save for future calls
|
||||||
|
m_filename = filename;
|
||||||
|
|
||||||
// it's not modified any longer
|
// it's not modified any longer
|
||||||
DiscardEdits();
|
DiscardEdits();
|
||||||
|
|
||||||
// if it worked, save for future calls
|
|
||||||
m_filename = filenameToUse;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_FFILE
|
#endif // wxUSE_FFILE
|
||||||
|
@@ -705,11 +705,6 @@ void wxTextCtrl::SetSelection(long from, long to)
|
|||||||
GetPeer()->SetSelection( from , to ) ;
|
GetPeer()->SetSelection( from , to ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile(const wxString& file)
|
|
||||||
{
|
|
||||||
return wxTextCtrlBase::LoadFile( file );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTextCtrl::WriteText(const wxString& str)
|
void wxTextCtrl::WriteText(const wxString& str)
|
||||||
{
|
{
|
||||||
// TODO: this MPRemoting will be moved into a remoting peer proxy for any command
|
// TODO: this MPRemoting will be moved into a remoting peer proxy for any command
|
||||||
|
@@ -1275,16 +1275,6 @@ void wxTextCtrl::SetSelection(long from, long to)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile(const wxString& file)
|
|
||||||
{
|
|
||||||
if ( wxTextCtrlBase::LoadFile(file) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTextCtrl::WriteText(const wxString& str)
|
void wxTextCtrl::WriteText(const wxString& str)
|
||||||
{
|
{
|
||||||
wxString st = str ;
|
wxString st = str ;
|
||||||
|
@@ -1405,9 +1405,9 @@ void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret)
|
|||||||
// Working with files
|
// Working with files
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile(const wxString& file)
|
bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType)
|
||||||
{
|
{
|
||||||
if ( wxTextCtrlBase::LoadFile(file) )
|
if ( wxTextCtrlBase::DoLoadFile(file, fileType) )
|
||||||
{
|
{
|
||||||
// update the size limit if needed
|
// update the size limit if needed
|
||||||
AdjustSpaceLimit();
|
AdjustSpaceLimit();
|
||||||
|
@@ -680,10 +680,11 @@ void wxTextCtrl::SetSelection(
|
|||||||
} // end of wxTextCtrl::SetSelection
|
} // end of wxTextCtrl::SetSelection
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile(
|
bool wxTextCtrl::LoadFile(
|
||||||
const wxString& rsFile
|
const wxString& rsFile,
|
||||||
|
int fileType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( wxTextCtrlBase::LoadFile(rsFile) )
|
if ( wxTextCtrlBase::DoLoadFile(rsFile, fileType) )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Update the size limit if needed
|
// Update the size limit if needed
|
||||||
@@ -692,7 +693,7 @@ bool wxTextCtrl::LoadFile(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} // end of wxTextCtrl::LoadFile
|
} // end of wxTextCtrl::DoLoadFile
|
||||||
|
|
||||||
bool wxTextCtrl::IsModified() const
|
bool wxTextCtrl::IsModified() const
|
||||||
{
|
{
|
||||||
|
@@ -390,7 +390,7 @@ void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret)
|
|||||||
// Working with files
|
// Working with files
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile(const wxString& file)
|
bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -1525,9 +1525,30 @@ bool wxRichTextCtrl::RecreateBuffer(const wxSize& size)
|
|||||||
// file IO functions
|
// file IO functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxRichTextCtrl::LoadFile(const wxString& filename, int type)
|
#if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
|
||||||
|
bool wxRichTextCtrl::LoadFile(const wxString& filename, int fileType)
|
||||||
{
|
{
|
||||||
bool success = GetBuffer().LoadFile(filename, type);
|
return DoLoadFile(filename, fileType);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRichTextCtrl::SaveFile(const wxString& filename, int fileType)
|
||||||
|
{
|
||||||
|
wxString filenameToUse = filename.empty() ? m_filename : filename;
|
||||||
|
if ( filenameToUse.empty() )
|
||||||
|
{
|
||||||
|
// what kind of message to give? is it an error or a program bug?
|
||||||
|
wxLogDebug(wxT("Can't save textctrl to file without filename."));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DoSaveFile(filenameToUse, fileType);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType)
|
||||||
|
{
|
||||||
|
bool success = GetBuffer().LoadFile(filename, fileType);
|
||||||
if (success)
|
if (success)
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
|
|
||||||
@@ -1549,25 +1570,15 @@ bool wxRichTextCtrl::LoadFile(const wxString& filename, int type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRichTextCtrl::SaveFile(const wxString& filename, int type)
|
bool wxRichTextCtrl::DoSaveFile(const wxString& filename, int fileType)
|
||||||
{
|
{
|
||||||
wxString filenameToUse = filename.empty() ? m_filename : filename;
|
if (GetBuffer().SaveFile(filename, fileType))
|
||||||
if ( filenameToUse.empty() )
|
|
||||||
{
|
{
|
||||||
// what kind of message to give? is it an error or a program bug?
|
m_filename = filename;
|
||||||
wxLogDebug(wxT("Can't save textctrl to file without filename."));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetBuffer().SaveFile(filenameToUse, type))
|
|
||||||
{
|
|
||||||
m_filename = filenameToUse;
|
|
||||||
|
|
||||||
DiscardEdits();
|
DiscardEdits();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogError(_("The text couldn't be saved."));
|
wxLogError(_("The text couldn't be saved."));
|
||||||
|
Reference in New Issue
Block a user