backported wxFileSystem fixes to 2.4 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -89,6 +89,16 @@ f = fs -> OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
|
|||||||
|
|
||||||
Returns actual path (set by \helpref{ChangePathTo}{wxfilesystemchangepathto}).
|
Returns actual path (set by \helpref{ChangePathTo}{wxfilesystemchangepathto}).
|
||||||
|
|
||||||
|
\membersection{wxFileSystem::FileNameToURL}\label{wxfilesystemfilenametourl}
|
||||||
|
|
||||||
|
\func{static wxString}{FileNameToURL}{\param{wxFileName }{filename}}
|
||||||
|
|
||||||
|
Converts filename into URL.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxFileSystem::URLToFileName}{wxfilesystemurltofilename},
|
||||||
|
\helpref{wxFileName}{wxfilename}
|
||||||
|
|
||||||
\membersection{wxFileSystem::FindFirst}\label{wxfilesystemfindfirst}
|
\membersection{wxFileSystem::FindFirst}\label{wxfilesystemfindfirst}
|
||||||
|
|
||||||
@@ -114,3 +124,14 @@ or NULL if failed. It first tries to open the file in relative scope
|
|||||||
(based on value passed to ChangePathTo() method) and then as an
|
(based on value passed to ChangePathTo() method) and then as an
|
||||||
absolute path.
|
absolute path.
|
||||||
|
|
||||||
|
\membersection{wxFileSystem::URLToFileName}\label{wxfilesystemurltofilename}
|
||||||
|
|
||||||
|
\func{static wxFileName}{URLToFileName}{\param{const wxString& }{url}}
|
||||||
|
|
||||||
|
Converts URL into well-formed filename. The URL must use {\tt file}
|
||||||
|
protocol.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxFileSystem::FileNameToURL}{wxfilesystemfilenametourl},
|
||||||
|
\helpref{wxFileName}{wxfilename}
|
||||||
|
@@ -52,14 +52,14 @@ a wxEVT\_HELP event if the user clicked on an application window. {\it Note} tha
|
|||||||
style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).
|
style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).
|
||||||
You cannot use this style together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so
|
You cannot use this style together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so
|
||||||
you should use
|
you should use
|
||||||
{\tt wxDEFAULT\_FRAME\_STYLE \& \verb$~$ (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
|
{\tt wxDEFAULT\_FRAME\_STYLE \& (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
|
||||||
frames having this style (the dialogs don't have minimize nor maximize box by
|
frames having this style (the dialogs don't have minimize nor maximize box by
|
||||||
default)}
|
default)}
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
|
|
||||||
The default frame style is for normal, resizeable frames. To create a frame
|
The default frame style is for normal, resizeable frames. To create a frame
|
||||||
which can not be resized by user, you may use the following combination of
|
which can not be resized by user, you may use the following combination of
|
||||||
styles: {\tt wxDEFAULT\_FRAME\_STYLE \& \verb$~$ (wxRESIZE\_BORDER \pipe wxRESIZE\_BOX \pipe wxMAXIMIZE\_BOX)}.
|
styles: {\tt wxDEFAULT\_FRAME\_STYLE \& (wxRESIZE\_BORDER \pipe wxRESIZE\_BOX \pipe wxMAXIMIZE\_BOX)}.
|
||||||
% Note: the space after the tilde is necessary or Tex2RTF complains.
|
% Note: the space after the tilde is necessary or Tex2RTF complains.
|
||||||
|
|
||||||
See also \helpref{window styles overview}{windowstyles}.
|
See also \helpref{window styles overview}{windowstyles}.
|
||||||
|
@@ -47,8 +47,8 @@ protocols - for example you may want to access files in a ZIP archive:
|
|||||||
|
|
||||||
file:archives/cpp\_doc.zip\#zip:reference/fopen.htm\#syntax
|
file:archives/cpp\_doc.zip\#zip:reference/fopen.htm\#syntax
|
||||||
|
|
||||||
In this example, the protocol is "zip", the left location is
|
In this example, the protocol is "zip", right location is
|
||||||
"reference/fopen.htm", the anchor is "syntax" and the right location
|
"reference/fopen.htm", anchor is "syntax" and left location
|
||||||
is "file:archives/cpp\_doc.zip".
|
is "file:archives/cpp\_doc.zip".
|
||||||
|
|
||||||
There are {\bf two} protocols used in this example: "zip" and "file".
|
There are {\bf two} protocols used in this example: "zip" and "file".
|
||||||
|
@@ -81,17 +81,27 @@ all other sections (sections, subsections, ...) have a folder icon.}
|
|||||||
|
|
||||||
\membersection{wxHtmlHelpController::AddBook}\label{wxhtmlhelpcontrolleraddbook}
|
\membersection{wxHtmlHelpController::AddBook}\label{wxhtmlhelpcontrolleraddbook}
|
||||||
|
|
||||||
\func{bool}{AddBook}{\param{const wxString\& }{book}, \param{bool }{show\_wait\_msg}}
|
\func{bool}{AddBook}{\param{const wxFileName\& }{book\_file}, \param{bool }{show\_wait\_msg}}
|
||||||
|
|
||||||
|
\func{bool}{AddBook}{\param{const wxString\& }{book\_url}, \param{bool }{show\_wait\_msg}}
|
||||||
|
|
||||||
Adds book (\helpref{.hhp file}{helpformat} - HTML Help Workshop project file) into the list of loaded books.
|
Adds book (\helpref{.hhp file}{helpformat} - HTML Help Workshop project file) into the list of loaded books.
|
||||||
This must be called at least once before displaying any help.
|
This must be called at least once before displaying any help.
|
||||||
|
|
||||||
{\it book} may be either .hhp file or ZIP archive that contains arbitrary number of .hhp files in
|
{\it book\_file} or {\it book\_url} may be either .hhp file or ZIP archive
|
||||||
|
that contains arbitrary number of .hhp files in
|
||||||
top-level directory. This ZIP archive must have .zip or .htb extension
|
top-level directory. This ZIP archive must have .zip or .htb extension
|
||||||
(the latter stands for "HTML book"). In other words, {\tt AddBook("help.zip")} is possible and, in fact,
|
(the latter stands for "HTML book"). In other words,
|
||||||
recommended way.
|
{\tt AddBook(wxFileName("help.zip"))}
|
||||||
|
is possible and, in fact, recommended way.
|
||||||
|
|
||||||
If {\it show\_wait\_msg} is TRUE then a decoration-less window with progress message is displayed.
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{show\_wait\_msg}{If TRUE then a decoration-less window with progress message is displayed.}
|
||||||
|
\docparam{book\_file}{Help book filename. It is recommended to use this prototype
|
||||||
|
instead of the one taking URL, because it is less error-prone.}
|
||||||
|
\docparam{book\_url}{Help book URL (note that syntax of filename and URL is
|
||||||
|
different on most platforms)}
|
||||||
|
|
||||||
\wxheading{Note}
|
\wxheading{Note}
|
||||||
|
|
||||||
|
@@ -28,11 +28,11 @@ Constructor.
|
|||||||
|
|
||||||
\membersection{wxHtmlHelpData::AddBook}\label{wxhtmlhelpdataaddbook}
|
\membersection{wxHtmlHelpData::AddBook}\label{wxhtmlhelpdataaddbook}
|
||||||
|
|
||||||
\func{bool}{AddBook}{\param{const wxString\& }{book}}
|
\func{bool}{AddBook}{\param{const wxString\& }{book\_url}}
|
||||||
|
|
||||||
Adds new book. 'book' is location of HTML help project (hhp) or ZIP file
|
Adds new book. {\it book} is URL (not filename!) of HTML help project (hhp)
|
||||||
that contains arbitrary number of .hhp projects (this zip file can have
|
or ZIP file that contains arbitrary number of .hhp projects (this zip
|
||||||
either .zip or .htb extension, htb stands for "html book").
|
file can have either .zip or .htb extension, htb stands for "html book").
|
||||||
Returns success.
|
Returns success.
|
||||||
|
|
||||||
\membersection{wxHtmlHelpData::FindPageById}\label{wxhtmlhelpdatafindpagebyid}
|
\membersection{wxHtmlHelpData::FindPageById}\label{wxhtmlhelpdatafindpagebyid}
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "wx/stream.h"
|
#include "wx/stream.h"
|
||||||
#include "wx/url.h"
|
#include "wx/url.h"
|
||||||
#include "wx/datetime.h"
|
#include "wx/datetime.h"
|
||||||
|
#include "wx/filename.h"
|
||||||
|
|
||||||
class wxFSFile;
|
class wxFSFile;
|
||||||
class wxFileSystemHandler;
|
class wxFileSystemHandler;
|
||||||
@@ -181,10 +182,10 @@ public:
|
|||||||
static void CleanUpHandlers();
|
static void CleanUpHandlers();
|
||||||
|
|
||||||
// Returns the native path for a file URL
|
// Returns the native path for a file URL
|
||||||
static wxString URLToNativePath( const wxString& url );
|
static wxFileName URLToFileName(const wxString& url);
|
||||||
|
|
||||||
// Returns the file URL for a native path
|
// Returns the file URL for a native path
|
||||||
static wxString NativePathToURL( const wxString& path );
|
static wxString FileNameToURL(const wxFileName& filename);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -35,7 +35,8 @@ public:
|
|||||||
|
|
||||||
void SetTitleFormat(const wxString& format);
|
void SetTitleFormat(const wxString& format);
|
||||||
void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
|
void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
|
||||||
bool AddBook(const wxString& book, bool show_wait_msg = FALSE);
|
bool AddBook(const wxString& book_url, bool show_wait_msg = FALSE);
|
||||||
|
bool AddBook(const wxFileName& book_file, bool show_wait_msg = FALSE);
|
||||||
|
|
||||||
bool Display(const wxString& x);
|
bool Display(const wxString& x);
|
||||||
bool Display(int id);
|
bool Display(int id);
|
||||||
|
@@ -155,19 +155,11 @@
|
|||||||
|
|
||||||
help.UseConfig(wxConfig::Get());
|
help.UseConfig(wxConfig::Get());
|
||||||
bool ret;
|
bool ret;
|
||||||
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
|
||||||
ret = help.AddBook(wxT(":helpfiles:testing.hhp"));
|
|
||||||
#else
|
|
||||||
help.SetTempDir(wxT("."));
|
help.SetTempDir(wxT("."));
|
||||||
ret = help.AddBook(wxT("helpfiles/testing.hhp"));
|
ret = help.AddBook(wxFileName(wxT("helpfiles/testing.hhp"), wxPATH_UNIX));
|
||||||
#endif
|
|
||||||
if (! ret)
|
if (! ret)
|
||||||
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
|
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
|
||||||
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
ret = help.AddBook(wxFileName(wxT("helpfiles/another.hhp"), wxPATH_UNIX));
|
||||||
ret = help.AddBook(wxT(":helpfiles:another.hhp"));
|
|
||||||
#else
|
|
||||||
ret = help.AddBook(wxT("helpfiles/another.hhp"));
|
|
||||||
#endif
|
|
||||||
if (! ret)
|
if (! ret)
|
||||||
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
|
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ bool MyApp::OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
help -> AddBook(argv[i]);
|
help->AddBook(wxFileName(argv[i]));
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
delete wxLog::SetActiveTarget(new wxLogGui);
|
delete wxLog::SetActiveTarget(new wxLogGui);
|
||||||
|
@@ -89,9 +89,9 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l
|
|||||||
|
|
||||||
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
||||||
|
|
||||||
wxString leftFilename = wxFileSystem::URLToNativePath(left);
|
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
|
||||||
|
|
||||||
s = new wxZipInputStream(leftFilename, right);
|
s = new wxZipInputStream(leftFilename.GetFullPath(), right);
|
||||||
if (s && s->IsOk() )
|
if (s && s->IsOk() )
|
||||||
{
|
{
|
||||||
return new wxFSFile(s,
|
return new wxFSFile(s,
|
||||||
@@ -137,7 +137,8 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ZipFile = left;
|
m_ZipFile = left;
|
||||||
m_Archive = (void*) unzOpen(m_ZipFile.mb_str());
|
wxString nativename = wxFileSystem::URLToFileName(m_ZipFile).GetFullPath();
|
||||||
|
m_Archive = (void*) unzOpen(nativename.mb_str());
|
||||||
m_Pattern = right.AfterLast(wxT('/'));
|
m_Pattern = right.AfterLast(wxT('/'));
|
||||||
m_BaseDir = right.BeforeLast(wxT('/'));
|
m_BaseDir = right.BeforeLast(wxT('/'));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user