wxGetWorkingDirectory() deprecated. Fixed #1338966.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f3e874756b
commit
ce045aed58
@ -8,6 +8,7 @@ wxWidgets Change Log - For more verbose changes, see the manual
|
||||
All:
|
||||
|
||||
- wxLaunchDefaultBrowser() now supports wxBROWSER_NEW_WINDOW flag
|
||||
- wxGetWorkingDirectory() deprecated. Use wxGetCwd() instead.
|
||||
|
||||
All (GUI):
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Name: function.tex
|
||||
%% Purpose: Functions and macros
|
||||
%% Author: wxWidgets Team
|
||||
%% Modified by:
|
||||
%% Created:
|
||||
%% RCS-ID: $Id$
|
||||
%% Copyright: (c) wxWidgets Team
|
||||
%% License: wxWindows license
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\chapter{Functions}\label{functions}
|
||||
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
@ -1122,7 +1133,7 @@ Returns a string containing the current (or working) directory.
|
||||
|
||||
\func{wxString}{wxGetWorkingDirectory}{\param{char *}{buf=NULL}, \param{int }{sz=1000}}
|
||||
|
||||
{\bf NB:} This function is obsolete: use \helpref{wxGetCwd}{wxgetcwd} instead.
|
||||
{\bf NB:} This function is deprecated: use \helpref{wxGetCwd}{wxgetcwd} instead.
|
||||
|
||||
Copies the current working directory into the buffer if supplied, or
|
||||
copies the working directory into new storage (which you {\emph must} delete
|
||||
@ -1514,24 +1525,24 @@ as wxGetTranslation.
|
||||
|
||||
The second form is used when retrieving translation of string that has
|
||||
different singular and plural form in English or different plural forms in some
|
||||
other language. It takes two extra arguments: as above, \arg{str}
|
||||
other language. It takes two extra arguments: as above, \arg{str}
|
||||
parameter must contain the singular form of the string to be converted and
|
||||
is used as the key for the search in the catalog. The \arg{strPlural} parameter
|
||||
is the plural form (in English). The parameter \arg{n} is used to determine the
|
||||
plural form. If no message catalog is found \arg{str} is returned if `n == 1',
|
||||
otherwise \arg{strPlural}.
|
||||
|
||||
See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150}
|
||||
See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150}
|
||||
for additional information on plural forms handling. For a shorter alternative
|
||||
see the \helpref{wxPLURAL()}{wxplural} macro.
|
||||
|
||||
Both versions call \helpref{wxLocale::GetString}{wxlocalegetstring}.
|
||||
|
||||
Note that this function is not suitable for literal strings in Unicode
|
||||
builds, since the literal strings must be enclosed into
|
||||
builds, since the literal strings must be enclosed into
|
||||
\helpref{\_T()}{underscoret} or \helpref{wxT}{wxt} macro which makes them
|
||||
unrecognised by \texttt{xgettext}, and so they are not extracted to the message
|
||||
catalog. Instead, use the \helpref{\_()}{underscore} and
|
||||
catalog. Instead, use the \helpref{\_()}{underscore} and
|
||||
\helpref{wxPLURAL}{wxplural} macro for all literal strings.
|
||||
|
||||
|
||||
@ -1596,12 +1607,12 @@ no substring matching is done.
|
||||
\param{const wxString\& }{delims = wxDEFAULT\_DELIMITERS},\\
|
||||
\param{wxStringTokenizerMode }{mode = wxTOKEN\_DEFAULT}}
|
||||
|
||||
This is a convenience function wrapping
|
||||
This is a convenience function wrapping
|
||||
\helpref{wxStringTokenizer}{wxstringtokenizer} which simply returns all tokens
|
||||
found in the given \arg{str} in an array.
|
||||
|
||||
Please see
|
||||
\helpref{wxStringTokenizer::wxStringTokenizer}{wxstringtokenizerwxstringtokenizer}
|
||||
Please see
|
||||
\helpref{wxStringTokenizer::wxStringTokenizer}{wxstringtokenizerwxstringtokenizer}
|
||||
for the description of the other parameters.
|
||||
|
||||
|
||||
@ -2805,7 +2816,7 @@ details.
|
||||
\func{}{wxON\_BLOCK\_EXIT\_OBJ1}{\param{}{obj}, \param{}{method}, \param{}{p1}}
|
||||
\func{}{wxON\_BLOCK\_EXIT\_OBJ2}{\param{}{obj}, \param{}{method}, \param{}{p1}, \param{}{p2}}
|
||||
|
||||
This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}
|
||||
This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}
|
||||
but calls a method of the given object instead of a free function.
|
||||
|
||||
\wxheading{Include files}
|
||||
@ -3066,7 +3077,7 @@ frame or dialog containing it, or {\tt NULL}.
|
||||
|
||||
\func{bool}{wxLaunchDefaultBrowser}{\param{const wxString\& }{url}, \param{int }{flags = $0$}}
|
||||
|
||||
Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
|
||||
Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
|
||||
\texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL
|
||||
(currently this is only supported under Windows).
|
||||
|
||||
@ -3392,7 +3403,7 @@ dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
|
||||
Used inside a class declaration to make the class known to wxWidgets RTTI
|
||||
system and also declare that the objects of this class should be dynamically
|
||||
creatable from run-time type information. Notice that this implies that the
|
||||
class should have a default constructor, if this is not the case consider using
|
||||
class should have a default constructor, if this is not the case consider using
|
||||
\helpref{DECLARE\_CLASS}{declareclass}.
|
||||
|
||||
Example:
|
||||
@ -4472,4 +4483,3 @@ Removes the variable {\it var} from the environment.
|
||||
function.
|
||||
|
||||
Returns \true on success.
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Name: image.tex
|
||||
%% Purpose: wxImage documentation
|
||||
%% Author: wxWidgets Team
|
||||
%% Modified by:
|
||||
%% Created:
|
||||
%% RCS-ID: $Id$
|
||||
%% Copyright: (c) wxWidgets Team
|
||||
%% License: wxWindows license
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{\class{wxImage}}\label{wximage}
|
||||
|
||||
This class encapsulates a platform-independent image. An image can be created
|
||||
@ -6,9 +17,9 @@ can be loaded from a file in a variety of formats, and is extensible to new form
|
||||
via image format handlers. Functions are available to set and get image bits, so
|
||||
it can be used for basic image manipulation.
|
||||
|
||||
A wxImage cannot (currently) be drawn directly to a \helpref{wxDC}{wxdc}. Instead,
|
||||
A wxImage cannot (currently) be drawn directly to a \helpref{wxDC}{wxdc}. Instead,
|
||||
a platform-specific \helpref{wxBitmap}{wxbitmap} object must be created from it using
|
||||
the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapctor} constructor.
|
||||
the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapctor} constructor.
|
||||
This bitmap can then
|
||||
be drawn in a device context, using \helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}.
|
||||
|
||||
@ -23,7 +34,7 @@ it also stores a byte representing the pixel opacity. An alpha value of $0$
|
||||
corresponds to a transparent pixel (null opacity) while a value of $255$
|
||||
means that the pixel is 100\% opaque.
|
||||
|
||||
Unlike RGB data, not all images have an alpha channel and before using
|
||||
Unlike RGB data, not all images have an alpha channel and before using
|
||||
\helpref{GetAlpha}{wximagegetalpha} you should check if this image contains
|
||||
an alpha channel with \helpref{HasAlpha}{wximagehasalpha}. Note that currently only
|
||||
images loaded from PNG files with transparency information will have an alpha
|
||||
@ -34,7 +45,7 @@ as support for saving images with alpha channel which also isn't implemented).
|
||||
|
||||
The following image handlers are available. {\bf wxBMPHandler} is always
|
||||
installed by default. To use other image formats, install the appropriate
|
||||
handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
|
||||
|
||||
\twocolwidtha{5cm}%
|
||||
@ -70,7 +81,7 @@ PNM format, {\bf wxPNMHandler} will always save as raw RGB.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxBitmap}{wxbitmap},
|
||||
\helpref{wxBitmap}{wxbitmap},
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
@ -100,7 +111,7 @@ Otherwise, the image data will be uninitialized.
|
||||
|
||||
\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static\_data = \false}}
|
||||
|
||||
Creates an image from given data with the given width and height. If
|
||||
Creates an image from given data with the given width and height. If
|
||||
{\it static\_data} is true, then wxImage will not delete the actual
|
||||
image data in its destructor, otherwise it will free it by calling
|
||||
{\it free()}.
|
||||
@ -152,8 +163,8 @@ Creates an image from XPM data.
|
||||
\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
|
||||
|
||||
\docparam{index}{Index of the image to load in the case that the image file contains multiple images.
|
||||
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
|
||||
"choose the default image" and is interpreted as the first image (index=0) by
|
||||
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
|
||||
"choose the default image" and is interpreted as the first image (index=0) by
|
||||
the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
|
||||
|
||||
\docparam{xpmData}{A pointer to XPM image data.}
|
||||
@ -163,10 +174,10 @@ the GIF and TIFF handler and as the largest and most colourful one by the ICO ha
|
||||
Depending on how wxWidgets has been configured, not all formats may be available.
|
||||
|
||||
Note: any handler other than BMP must be previously
|
||||
initialized with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
initialized with \helpref{wxImage::AddHandler}{wximageaddhandler} or
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
|
||||
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
|
||||
hotspot for loaded cursor file:
|
||||
\begin{verbatim}
|
||||
int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
|
||||
@ -245,8 +256,8 @@ This function is called by wxWidgets on exit.
|
||||
|
||||
\constfunc{unsigned long}{ComputeHistogram}{\param{wxImageHistogram\& }{histogram}}
|
||||
|
||||
Computes the histogram of the image. {\it histogram} is a reference to
|
||||
wxImageHistogram object. wxImageHistogram is a specialization of
|
||||
Computes the histogram of the image. {\it histogram} is a reference to
|
||||
wxImageHistogram object. wxImageHistogram is a specialization of
|
||||
\helpref{wxHashMap}{wxhashmap} "template" and is defined as follows:
|
||||
|
||||
\begin{verbatim}
|
||||
@ -282,7 +293,7 @@ ConvertAlphaToMask does nothing.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
\false if FindFirstUnusedColour returns \false, \true otherwise.
|
||||
\false if FindFirstUnusedColour returns \false, \true otherwise.
|
||||
|
||||
|
||||
\membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap}
|
||||
@ -298,7 +309,7 @@ Deprecated, use equivalent \helpref{wxBitmap constructor}{wxbitmapctor}
|
||||
\constfunc{wxImage}{ConvertToMono}{\param{unsigned char}{ r}, \param{unsigned char}{ g}, \param{unsigned char}{ b}}
|
||||
|
||||
Returns monochromatic version of the image. The returned image has white
|
||||
colour where the original has {\it (r,g,b)} colour and black colour
|
||||
colour where the original has {\it (r,g,b)} colour and black colour
|
||||
everywhere else.
|
||||
|
||||
|
||||
@ -410,7 +421,7 @@ It is usually a good idea to prepend a description before passing the result to
|
||||
Example:
|
||||
|
||||
\begin{verbatim}
|
||||
wxFileDialog FileDlg( this, "Choose Image", ::wxGetWorkingDirectory(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
|
||||
wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{See also}
|
||||
@ -474,7 +485,7 @@ Returns the green intensity at the given coordinate.
|
||||
|
||||
\func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
|
||||
|
||||
If the image file contains more than one image and the image handler is capable
|
||||
If the image file contains more than one image and the image handler is capable
|
||||
of retrieving these individually, this function will return the number of
|
||||
available images.
|
||||
|
||||
@ -549,7 +560,7 @@ Gets the red value of the mask colour.
|
||||
|
||||
\constfunc{bool}{GetOrFindMaskColour}{\param{unsigned char}{ *r}, \param{unsigned char}{ *g}, \param{unsigned char}{ *b}}
|
||||
|
||||
Get the current mask colour or find a suitable unused colour that could be
|
||||
Get the current mask colour or find a suitable unused colour that could be
|
||||
used as a mask colour. Returns {\tt true} if the image currently has a mask.
|
||||
|
||||
|
||||
@ -574,7 +585,7 @@ Returns the red intensity at the given coordinate.
|
||||
|
||||
\constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
|
||||
|
||||
Returns a sub image of the current one as long as the rect belongs entirely to
|
||||
Returns a sub image of the current one as long as the rect belongs entirely to
|
||||
the image.
|
||||
|
||||
|
||||
@ -649,7 +660,7 @@ used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
|
||||
|
||||
Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
|
||||
|
||||
If the given option is not present, the function returns $0$. Use
|
||||
If the given option is not present, the function returns $0$. Use
|
||||
\helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
|
||||
for the option.
|
||||
|
||||
@ -710,7 +721,7 @@ the user.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxImageHandler}{wximagehandler},
|
||||
\helpref{wxImageHandler}{wximagehandler},
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
|
||||
|
||||
|
||||
@ -779,15 +790,15 @@ Loads an image from an input stream.
|
||||
\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
|
||||
|
||||
\docparam{index}{Index of the image to load in the case that the image file contains multiple images.
|
||||
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
|
||||
"choose the default image" and is interpreted as the first image (index=0) by
|
||||
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
|
||||
"choose the default image" and is interpreted as the first image (index=0) by
|
||||
the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
Depending on how wxWidgets has been configured, not all formats may be available.
|
||||
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
|
||||
hotspot for loaded cursor file:
|
||||
\begin{verbatim}
|
||||
int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
|
||||
@ -887,7 +898,7 @@ Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}.
|
||||
|
||||
\func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
|
||||
|
||||
Changes the size of the image in-place by scaling it: after a call to this function,
|
||||
Changes the size of the image in-place by scaling it: after a call to this function,
|
||||
the image will have the given width and height.
|
||||
|
||||
Returns the (modified) image itself.
|
||||
@ -901,11 +912,11 @@ Returns the (modified) image itself.
|
||||
|
||||
\func{wxImage \&}{Resize}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
|
||||
|
||||
Changes the size of the image in-place without scaling it by adding either a border
|
||||
with the given colour or cropping as necessary. The image is pasted into a new
|
||||
image with the given {\it size} and background colour at the position {\it pos}
|
||||
relative to the upper left of the new image. If {\it red = green = blue = -1}
|
||||
then use either the current mask colour if set or find, use, and set a
|
||||
Changes the size of the image in-place without scaling it by adding either a border
|
||||
with the given colour or cropping as necessary. The image is pasted into a new
|
||||
image with the given {\it size} and background colour at the position {\it pos}
|
||||
relative to the upper left of the new image. If {\it red = green = blue = -1}
|
||||
then use either the current mask colour if set or find, use, and set a
|
||||
suitable mask colour for any newly exposed areas.
|
||||
|
||||
Returns the (modified) image itself.
|
||||
@ -996,8 +1007,8 @@ true if the operation succeeded, false otherwise.
|
||||
|
||||
Depending on how wxWidgets has been configured, not all formats may be available.
|
||||
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
|
||||
hotspot before saving an image into a cursor file (default hotspot is in
|
||||
Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
|
||||
hotspot before saving an image into a cursor file (default hotspot is in
|
||||
the centre of the image):
|
||||
\begin{verbatim}
|
||||
image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
|
||||
@ -1036,7 +1047,7 @@ scaling bitmaps in general as the only other way to scale bitmaps
|
||||
is to blit a wxMemoryDC into another wxMemoryDC.
|
||||
|
||||
It may be mentioned that the GTK port uses this function internally
|
||||
to scale bitmaps when using mapping modes in wxDC.
|
||||
to scale bitmaps when using mapping modes in wxDC.
|
||||
|
||||
Example:
|
||||
|
||||
@ -1066,11 +1077,11 @@ Example:
|
||||
|
||||
\constfunc{wxImage}{Size}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
|
||||
|
||||
Returns a resized version of this image without scaling it by adding either a border
|
||||
with the given colour or cropping as necessary. The image is pasted into a new
|
||||
image with the given {\it size} and background colour at the position {\it pos}
|
||||
relative to the upper left of the new image. If {\it red = green = blue = -1}
|
||||
then use either the current mask colour if set or find, use, and set a
|
||||
Returns a resized version of this image without scaling it by adding either a border
|
||||
with the given colour or cropping as necessary. The image is pasted into a new
|
||||
image with the given {\it size} and background colour at the position {\it pos}
|
||||
relative to the upper left of the new image. If {\it red = green = blue = -1}
|
||||
then use either the current mask colour if set or find, use, and set a
|
||||
suitable mask colour for any newly exposed areas.
|
||||
|
||||
\wxheading{See also}
|
||||
@ -1085,8 +1096,8 @@ suitable mask colour for any newly exposed areas.
|
||||
This function is similar to \helpref{SetData}{wximagesetdata} and has similar
|
||||
restrictions. The pointer passed to it may however be {\tt NULL} in which case
|
||||
the function will allocate the alpha array internally -- this is useful to add
|
||||
alpha channel data to an image which doesn't have any. If the pointer is not
|
||||
{\tt NULL}, it must have one byte for each image pixel and be allocated with
|
||||
alpha channel data to an image which doesn't have any. If the pointer is not
|
||||
{\tt NULL}, it must have one byte for each image pixel and be allocated with
|
||||
{\tt malloc()}. wxImage takes ownership of the pointer and will free it unless
|
||||
\arg{static\_data} parameter is set.to \true -- in this case the caller should
|
||||
do it.
|
||||
@ -1142,13 +1153,13 @@ Sets the mask colour for this image (and tells the image to use the mask).
|
||||
Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
|
||||
in {\it mask} will be masked in the image. This is done by first finding an
|
||||
unused colour in the image, setting this colour as the mask colour and then
|
||||
using this colour to draw all pixels in the image who corresponding pixel
|
||||
using this colour to draw all pixels in the image who corresponding pixel
|
||||
in {\it mask} has given RGB value.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
Returns false if {\it mask} does not have same dimensions as the image or if
|
||||
there is no unused colour left. Returns true if the mask was successfully
|
||||
there is no unused colour left. Returns true if the mask was successfully
|
||||
applied.
|
||||
|
||||
\wxheading{Notes}
|
||||
@ -1190,7 +1201,7 @@ wxImage to wxBitmap (MSW only at present) or in file save operations (none as ye
|
||||
Sets the pixel at the given coordinate. This routine performs bounds-checks
|
||||
for the coordinate so it can be considered a safe way to manipulate the
|
||||
data, but in some cases this might be too slow so that the data will have to
|
||||
be set directly. In that case you will have to get access to the image data
|
||||
be set directly. In that case you will have to get access to the image data
|
||||
using the \helpref{GetData}{wximagegetdata} method.
|
||||
|
||||
|
||||
@ -1277,7 +1288,7 @@ created by IJG.)
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxImage}{wximage},
|
||||
\helpref{wxImage}{wximage},
|
||||
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
@ -1316,7 +1327,7 @@ Gets the file extension associated with this handler.
|
||||
|
||||
\func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
|
||||
|
||||
If the image file contains more than one image and the image handler is capable
|
||||
If the image file contains more than one image and the image handler is capable
|
||||
of retrieving these individually, this function will return the number of
|
||||
available images.
|
||||
|
||||
@ -1366,8 +1377,8 @@ true if the operation succeeded, false otherwise.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxImage::LoadFile}{wximageloadfile},
|
||||
\helpref{wxImage::SaveFile}{wximagesavefile},
|
||||
\helpref{wxImage::LoadFile}{wximageloadfile},
|
||||
\helpref{wxImage::SaveFile}{wximagesavefile},
|
||||
\helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
|
||||
|
||||
|
||||
@ -1389,8 +1400,8 @@ true if the operation succeeded, false otherwise.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxImage::LoadFile}{wximageloadfile},
|
||||
\helpref{wxImage::SaveFile}{wximagesavefile},
|
||||
\helpref{wxImage::LoadFile}{wximageloadfile},
|
||||
\helpref{wxImage::SaveFile}{wximagesavefile},
|
||||
\helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
|
||||
|
||||
|
||||
@ -1436,4 +1447,3 @@ Sets the handler type.
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{name}{Handler type.}
|
||||
|
||||
|
@ -438,13 +438,15 @@ WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file);
|
||||
WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2);
|
||||
|
||||
// Get current working directory.
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
// If buf is NULL, allocates space using new, else
|
||||
// copies into buf.
|
||||
// IMPORTANT NOTE getcwd is know not to work under some releases
|
||||
// of Win32s 1.3, according to MS release notes!
|
||||
WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000);
|
||||
wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) );
|
||||
// new and preferred version of wxGetWorkingDirectory
|
||||
// NB: can't have the same name because of overloading ambiguity
|
||||
#endif // WXWIN_COMPATIBILITY_2_6
|
||||
WXDLLIMPEXP_BASE wxString wxGetCwd();
|
||||
|
||||
// Set working directory
|
||||
|
@ -276,8 +276,7 @@ wxString wxPathList::FindAbsoluteValidPath (const wxString& file)
|
||||
if ( f.empty() || wxIsAbsolutePath(f) )
|
||||
return f;
|
||||
|
||||
wxString buf;
|
||||
wxGetWorkingDirectory(wxStringBuffer(buf, _MAXPATHLEN), _MAXPATHLEN);
|
||||
wxString buf = ::wxGetCwd();
|
||||
|
||||
if ( !wxEndsWithPathSeparator(buf) )
|
||||
{
|
||||
@ -365,8 +364,8 @@ void wxStripExtension(wxChar *buffer)
|
||||
void wxStripExtension(wxString& buffer)
|
||||
{
|
||||
//RN: Be careful about the handling the case where
|
||||
//buffer.Length() == 0
|
||||
for(size_t i = buffer.Length() - 1; i != wxString::npos; --i)
|
||||
//buffer.length() == 0
|
||||
for(size_t i = buffer.length() - 1; i != wxString::npos; --i)
|
||||
{
|
||||
if (buffer.GetChar(i) == wxT('.'))
|
||||
{
|
||||
@ -432,28 +431,38 @@ wxChar *wxRealPath (wxChar *path)
|
||||
return path;
|
||||
}
|
||||
|
||||
wxString wxRealPath(const wxString& path)
|
||||
{
|
||||
wxChar *buf1=MYcopystring(path);
|
||||
wxChar *buf2=wxRealPath(buf1);
|
||||
wxString buf(buf2);
|
||||
delete [] buf1;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
// Must be destroyed
|
||||
wxChar *wxCopyAbsolutePath(const wxString& filename)
|
||||
{
|
||||
if (filename.empty())
|
||||
return (wxChar *) NULL;
|
||||
if (filename.empty())
|
||||
return (wxChar *) NULL;
|
||||
|
||||
if (! wxIsAbsolutePath(wxExpandPath(wxFileFunctionsBuffer, filename))) {
|
||||
wxChar buf[_MAXPATHLEN];
|
||||
buf[0] = wxT('\0');
|
||||
wxGetWorkingDirectory(buf, WXSIZEOF(buf));
|
||||
wxChar ch = buf[wxStrlen(buf) - 1];
|
||||
if (! wxIsAbsolutePath(wxExpandPath(wxFileFunctionsBuffer, filename)))
|
||||
{
|
||||
wxString buf = ::wxGetCwd();
|
||||
wxChar ch = buf.Last();
|
||||
#ifdef __WXMSW__
|
||||
if (ch != wxT('\\') && ch != wxT('/'))
|
||||
wxStrcat(buf, wxT("\\"));
|
||||
if (ch != wxT('\\') && ch != wxT('/'))
|
||||
buf << wxT("\\");
|
||||
#else
|
||||
if (ch != wxT('/'))
|
||||
wxStrcat(buf, wxT("/"));
|
||||
if (ch != wxT('/'))
|
||||
buf << wxT("/");
|
||||
#endif
|
||||
wxStrcat(buf, wxFileFunctionsBuffer);
|
||||
return MYcopystring( wxRealPath(buf) );
|
||||
}
|
||||
return MYcopystring( wxFileFunctionsBuffer );
|
||||
buf << wxFileFunctionsBuffer;
|
||||
buf = wxRealPath( buf );
|
||||
return MYcopystring( buf );
|
||||
}
|
||||
return MYcopystring( wxFileFunctionsBuffer );
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -790,7 +799,7 @@ wxString wxPathOnly (const wxString& path)
|
||||
// Local copy
|
||||
wxStrcpy (buf, WXSTRINGCAST path);
|
||||
|
||||
int l = path.Length();
|
||||
int l = path.length();
|
||||
int i = l - 1;
|
||||
|
||||
// Search backward for a backward or forward slash
|
||||
@ -1331,17 +1340,21 @@ wxString wxFindNextFile()
|
||||
|
||||
|
||||
// Get current working directory.
|
||||
// If buf is NULL, allocates space using new, else
|
||||
// copies into buf.
|
||||
wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
||||
// If buf is NULL, allocates space using new, else copies into buf.
|
||||
// wxGetWorkingDirectory() is obsolete, use wxGetCwd()
|
||||
// wxDoGetCwd() is their common core to be moved
|
||||
// to wxGetCwd() once wxGetWorkingDirectory() will be removed.
|
||||
// Do not expose wxDoGetCwd in headers!
|
||||
|
||||
wxChar *wxDoGetCwd(wxChar *buf, int sz)
|
||||
{
|
||||
#if defined(__WXPALMOS__)
|
||||
// TODO ?
|
||||
// TODO
|
||||
if(buf && sz>0) buf[0] = _T('\0');
|
||||
return NULL;
|
||||
#elif defined(__WXWINCE__)
|
||||
// TODO
|
||||
wxUnusedVar(buf);
|
||||
wxUnusedVar(sz);
|
||||
if(buf && sz>0) buf[0] = _T('\0');
|
||||
return NULL;
|
||||
#else
|
||||
if ( !buf )
|
||||
@ -1464,13 +1477,17 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
||||
// __WXWINCE__
|
||||
}
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
||||
{
|
||||
return wxDoGetCwd(buf,sz);
|
||||
}
|
||||
#endif // WXWIN_COMPATIBILITY_2_6
|
||||
|
||||
wxString wxGetCwd()
|
||||
{
|
||||
wxChar *buffer = new wxChar[_MAXPATHLEN];
|
||||
wxGetWorkingDirectory(buffer, _MAXPATHLEN);
|
||||
wxString str( buffer );
|
||||
delete [] buffer;
|
||||
|
||||
wxString str;
|
||||
wxDoGetCwd(wxStringBuffer(str, _MAXPATHLEN), _MAXPATHLEN);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -238,9 +238,7 @@ bool wxExtHelpController::LoadFile(const wxString& ifile)
|
||||
file = ifile;
|
||||
if(! wxIsAbsolutePath(file))
|
||||
{
|
||||
wxChar* f = wxGetWorkingDirectory();
|
||||
file = f;
|
||||
delete[] f; // wxGetWorkingDirectory returns new memory
|
||||
file = wxGetCwd();
|
||||
#ifdef __WXMAC__
|
||||
file << ifile;
|
||||
#else
|
||||
@ -348,7 +346,7 @@ wxExtHelpController::DisplayContents()
|
||||
file << m_MapFile << WXEXTHELP_SEPARATOR << contents;
|
||||
if(file.Contains(wxT('#')))
|
||||
file = file.BeforeLast(wxT('#'));
|
||||
if(contents.Length() && wxFileExists(file))
|
||||
if(contents.length() && wxFileExists(file))
|
||||
rc = DisplaySection(CONTENTS_ID);
|
||||
|
||||
// if not found, open homemade toc:
|
||||
@ -466,4 +464,3 @@ void wxExtHelpController::OnQuit()
|
||||
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
|
||||
|
@ -5146,200 +5146,197 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
|
||||
|
||||
bool RTFGo(void)
|
||||
{
|
||||
if (stopRunning)
|
||||
return false;
|
||||
|
||||
// Reset variables
|
||||
indentLevel = 0;
|
||||
forbidParindent = 0;
|
||||
contentsLineSection = NULL;
|
||||
contentsLineValue = NULL;
|
||||
descriptionItemArg = NULL;
|
||||
inTabular = false;
|
||||
inTable = false;
|
||||
inFigure = false;
|
||||
startRows = false;
|
||||
tableVerticalLineLeft = false;
|
||||
tableVerticalLineRight = false;
|
||||
noColumns = 0;
|
||||
startedSections = false;
|
||||
inVerbatim = false;
|
||||
browseId = 0;
|
||||
|
||||
if (!InputFile.empty() && !OutputFile.empty())
|
||||
{
|
||||
// Do some RTF-specific transformations on all the strings,
|
||||
// recursively
|
||||
Text2RTF(GetTopLevelChunk());
|
||||
|
||||
Contents = wxFopen(TmpContentsName, _T("w"));
|
||||
Chapters = wxFopen(_T("chapters.rtf"), _T("w"));
|
||||
if (winHelp)
|
||||
{
|
||||
Sections = wxFopen(_T("sections.rtf"), _T("w"));
|
||||
Subsections = wxFopen(_T("subsections.rtf"), _T("w"));
|
||||
Subsubsections = wxFopen(_T("subsubsections.rtf"), _T("w"));
|
||||
Popups = wxFopen(_T("popups.rtf"), _T("w"));
|
||||
if (winHelpContents)
|
||||
{
|
||||
WinHelpContentsFile = wxFopen(WinHelpContentsFileName, _T("w"));
|
||||
if (WinHelpContentsFile)
|
||||
wxFprintf(WinHelpContentsFile, _T(":Base %s.hlp\n"), wxFileNameFromPath(FileRoot));
|
||||
}
|
||||
|
||||
if (!Sections || !Subsections || !Subsubsections || !Popups || (winHelpContents && !WinHelpContentsFile))
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file(s) for writing."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Contents || !Chapters)
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file(s) for writing."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxFprintf(Chapters, _T("\n#{\\footnote Contents}\n"));
|
||||
wxFprintf(Chapters, _T("${\\footnote Contents}\n"));
|
||||
wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
|
||||
wxFprintf(Chapters, _T("K{\\footnote {K} %s}\n"), ContentsNameString);
|
||||
wxFprintf(Chapters, _T("!{\\footnote DisableButton(\"Up\")}\n"));
|
||||
}
|
||||
if (!winHelp)
|
||||
{
|
||||
wxFprintf(Chapters, _T("\\titlepg\n"));
|
||||
wxFprintf(Contents, _T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
|
||||
}
|
||||
|
||||
// In WinHelp, Contents title takes font of title.
|
||||
// In linear RTF, same as chapter headings.
|
||||
wxFprintf(Contents, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"),
|
||||
(winHelp ? titleFont : chapterFont)*2, ContentsNameString);
|
||||
|
||||
// By default, Swiss, 11 point.
|
||||
wxFprintf(Chapters, _T("\\f2\\fs22\n"));
|
||||
|
||||
PushEnvironmentStyle(_T("\\f2\\fs22\\sa200"));
|
||||
|
||||
SetCurrentOutput(Chapters);
|
||||
|
||||
if (stopRunning)
|
||||
return false;
|
||||
|
||||
OnInform(_T("Converting..."));
|
||||
// Reset variables
|
||||
indentLevel = 0;
|
||||
forbidParindent = 0;
|
||||
contentsLineSection = NULL;
|
||||
contentsLineValue = NULL;
|
||||
descriptionItemArg = NULL;
|
||||
inTabular = false;
|
||||
inTable = false;
|
||||
inFigure = false;
|
||||
startRows = false;
|
||||
tableVerticalLineLeft = false;
|
||||
tableVerticalLineRight = false;
|
||||
noColumns = 0;
|
||||
startedSections = false;
|
||||
inVerbatim = false;
|
||||
browseId = 0;
|
||||
|
||||
TraverseDocument();
|
||||
|
||||
FILE *Header = wxFopen(_T("header.rtf"), _T("w"));
|
||||
if (!Header)
|
||||
if (!InputFile.empty() && !OutputFile.empty())
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file header.rtf for writing."));
|
||||
return false;
|
||||
// Do some RTF-specific transformations on all the strings,
|
||||
// recursively
|
||||
Text2RTF(GetTopLevelChunk());
|
||||
|
||||
Contents = wxFopen(TmpContentsName, _T("w"));
|
||||
Chapters = wxFopen(_T("chapters.rtf"), _T("w"));
|
||||
if (winHelp)
|
||||
{
|
||||
Sections = wxFopen(_T("sections.rtf"), _T("w"));
|
||||
Subsections = wxFopen(_T("subsections.rtf"), _T("w"));
|
||||
Subsubsections = wxFopen(_T("subsubsections.rtf"), _T("w"));
|
||||
Popups = wxFopen(_T("popups.rtf"), _T("w"));
|
||||
if (winHelpContents)
|
||||
{
|
||||
WinHelpContentsFile = wxFopen(WinHelpContentsFileName, _T("w"));
|
||||
if (WinHelpContentsFile)
|
||||
wxFprintf(WinHelpContentsFile, _T(":Base %s.hlp\n"), wxFileNameFromPath(FileRoot));
|
||||
}
|
||||
|
||||
if (!Sections || !Subsections || !Subsubsections || !Popups || (winHelpContents && !WinHelpContentsFile))
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file(s) for writing."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Contents || !Chapters)
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file(s) for writing."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxFprintf(Chapters, _T("\n#{\\footnote Contents}\n"));
|
||||
wxFprintf(Chapters, _T("${\\footnote Contents}\n"));
|
||||
wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
|
||||
wxFprintf(Chapters, _T("K{\\footnote {K} %s}\n"), ContentsNameString);
|
||||
wxFprintf(Chapters, _T("!{\\footnote DisableButton(\"Up\")}\n"));
|
||||
}
|
||||
if (!winHelp)
|
||||
{
|
||||
wxFprintf(Chapters, _T("\\titlepg\n"));
|
||||
wxFprintf(Contents, _T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
|
||||
}
|
||||
|
||||
// In WinHelp, Contents title takes font of title.
|
||||
// In linear RTF, same as chapter headings.
|
||||
wxFprintf(Contents, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"),
|
||||
(winHelp ? titleFont : chapterFont)*2, ContentsNameString);
|
||||
|
||||
// By default, Swiss, 11 point.
|
||||
wxFprintf(Chapters, _T("\\f2\\fs22\n"));
|
||||
|
||||
PushEnvironmentStyle(_T("\\f2\\fs22\\sa200"));
|
||||
|
||||
SetCurrentOutput(Chapters);
|
||||
|
||||
if (stopRunning)
|
||||
return false;
|
||||
|
||||
OnInform(_T("Converting..."));
|
||||
|
||||
TraverseDocument();
|
||||
|
||||
FILE *Header = wxFopen(_T("header.rtf"), _T("w"));
|
||||
if (!Header)
|
||||
{
|
||||
OnError(_T("Ouch! Could not open temporary file header.rtf for writing."));
|
||||
return false;
|
||||
}
|
||||
WriteRTFHeader(Header);
|
||||
fclose(Header);
|
||||
|
||||
PopEnvironmentStyle();
|
||||
|
||||
Tex2RTFYield(true);
|
||||
if (winHelp)
|
||||
{
|
||||
// wxFprintf(Contents, _T("\\page\n"));
|
||||
wxFprintf(Chapters, _T("\\page\n"));
|
||||
wxFprintf(Sections, _T("\\page\n"));
|
||||
wxFprintf(Subsections, _T("\\page\n"));
|
||||
wxFprintf(Subsubsections, _T("\\page\n\n"));
|
||||
wxFprintf(Popups, _T("\\page\n}\n"));
|
||||
}
|
||||
|
||||
// TexOutput(_T("\n\\info{\\doccomm Document created by Julian Smart's Tex2RTF.}\n"));
|
||||
if (!winHelp)
|
||||
TexOutput(_T("}\n"));
|
||||
fclose(Contents); Contents = NULL;
|
||||
fclose(Chapters); Chapters = NULL;
|
||||
if (winHelp)
|
||||
{
|
||||
fclose(Sections); Sections = NULL;
|
||||
fclose(Subsections); Subsections = NULL;
|
||||
fclose(Subsubsections); Subsubsections = NULL;
|
||||
fclose(Popups); Popups = NULL;
|
||||
if (winHelpContents)
|
||||
{
|
||||
fclose(WinHelpContentsFile); WinHelpContentsFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp1.rtf"), _T("sections.rtf"), _T("tmp2.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp2.rtf"), _T("subsections.rtf"), _T("tmp3.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp3.rtf"), _T("subsubsections.rtf"), _T("tmp4.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp4.rtf"), _T("popups.rtf"), OutputFile);
|
||||
Tex2RTFYield(true);
|
||||
|
||||
wxRemoveFile(_T("tmp1.rtf"));
|
||||
wxRemoveFile(_T("tmp2.rtf"));
|
||||
wxRemoveFile(_T("tmp3.rtf"));
|
||||
wxRemoveFile(_T("tmp4.rtf"));
|
||||
}
|
||||
else
|
||||
{
|
||||
wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
if (wxFileExists(OutputFile))
|
||||
wxRemoveFile(OutputFile);
|
||||
|
||||
wxString cwdStr = wxGetCwd();
|
||||
|
||||
wxString outputDirStr = wxPathOnly(OutputFile);
|
||||
|
||||
// Determine if the temp file and the output file are in the same directory,
|
||||
// and if they are, then just rename the temp file rather than copying
|
||||
// it, as this is much faster when working with large (multi-megabyte files)
|
||||
if ((outputDirStr.empty()) || // no path specified on output file
|
||||
(cwdStr != outputDirStr)) // paths do not match
|
||||
{
|
||||
wxRenameFile(_T("tmp1.rtf"), OutputFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCopyFile(_T("tmp1.rtf"), OutputFile);
|
||||
}
|
||||
Tex2RTFYield(true);
|
||||
wxRemoveFile(_T("tmp1.rtf"));
|
||||
}
|
||||
|
||||
if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
|
||||
|
||||
if (!wxRenameFile(TmpContentsName, ContentsName))
|
||||
{
|
||||
wxCopyFile(TmpContentsName, ContentsName);
|
||||
wxRemoveFile(TmpContentsName);
|
||||
}
|
||||
|
||||
wxRemoveFile(_T("chapters.rtf"));
|
||||
wxRemoveFile(_T("header.rtf"));
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxRemoveFile(_T("sections.rtf"));
|
||||
wxRemoveFile(_T("subsections.rtf"));
|
||||
wxRemoveFile(_T("subsubsections.rtf"));
|
||||
wxRemoveFile(_T("popups.rtf"));
|
||||
}
|
||||
if (winHelp && generateHPJ)
|
||||
WriteHPJ(OutputFile);
|
||||
return true;
|
||||
}
|
||||
WriteRTFHeader(Header);
|
||||
fclose(Header);
|
||||
|
||||
PopEnvironmentStyle();
|
||||
|
||||
Tex2RTFYield(true);
|
||||
if (winHelp)
|
||||
{
|
||||
// wxFprintf(Contents, _T("\\page\n"));
|
||||
wxFprintf(Chapters, _T("\\page\n"));
|
||||
wxFprintf(Sections, _T("\\page\n"));
|
||||
wxFprintf(Subsections, _T("\\page\n"));
|
||||
wxFprintf(Subsubsections, _T("\\page\n\n"));
|
||||
wxFprintf(Popups, _T("\\page\n}\n"));
|
||||
}
|
||||
|
||||
// TexOutput(_T("\n\\info{\\doccomm Document created by Julian Smart's Tex2RTF.}\n"));
|
||||
if (!winHelp)
|
||||
TexOutput(_T("}\n"));
|
||||
fclose(Contents); Contents = NULL;
|
||||
fclose(Chapters); Chapters = NULL;
|
||||
if (winHelp)
|
||||
{
|
||||
fclose(Sections); Sections = NULL;
|
||||
fclose(Subsections); Subsections = NULL;
|
||||
fclose(Subsubsections); Subsubsections = NULL;
|
||||
fclose(Popups); Popups = NULL;
|
||||
if (winHelpContents)
|
||||
{
|
||||
fclose(WinHelpContentsFile); WinHelpContentsFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp1.rtf"), _T("sections.rtf"), _T("tmp2.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp2.rtf"), _T("subsections.rtf"), _T("tmp3.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp3.rtf"), _T("subsubsections.rtf"), _T("tmp4.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
wxConcatFiles(_T("tmp4.rtf"), _T("popups.rtf"), OutputFile);
|
||||
Tex2RTFYield(true);
|
||||
|
||||
wxRemoveFile(_T("tmp1.rtf"));
|
||||
wxRemoveFile(_T("tmp2.rtf"));
|
||||
wxRemoveFile(_T("tmp3.rtf"));
|
||||
wxRemoveFile(_T("tmp4.rtf"));
|
||||
}
|
||||
else
|
||||
{
|
||||
wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
|
||||
Tex2RTFYield(true);
|
||||
if (wxFileExists(OutputFile))
|
||||
wxRemoveFile(OutputFile);
|
||||
|
||||
wxChar *cwdStr;
|
||||
cwdStr = wxGetWorkingDirectory();
|
||||
|
||||
wxString outputDirStr;
|
||||
outputDirStr = wxPathOnly(OutputFile);
|
||||
|
||||
// Determine if the temp file and the output file are in the same directory,
|
||||
// and if they are, then just rename the temp file rather than copying
|
||||
// it, as this is much faster when working with large (multi-megabyte files)
|
||||
if ((wxStrcmp(outputDirStr.c_str(),_T("")) == 0) || // no path specified on output file
|
||||
(wxStrcmp(cwdStr,outputDirStr.c_str()) == 0)) // paths do not match
|
||||
{
|
||||
wxRenameFile(_T("tmp1.rtf"), OutputFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCopyFile(_T("tmp1.rtf"), OutputFile);
|
||||
}
|
||||
delete [] cwdStr;
|
||||
Tex2RTFYield(true);
|
||||
wxRemoveFile(_T("tmp1.rtf"));
|
||||
}
|
||||
|
||||
if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
|
||||
|
||||
if (!wxRenameFile(TmpContentsName, ContentsName))
|
||||
{
|
||||
wxCopyFile(TmpContentsName, ContentsName);
|
||||
wxRemoveFile(TmpContentsName);
|
||||
}
|
||||
|
||||
wxRemoveFile(_T("chapters.rtf"));
|
||||
wxRemoveFile(_T("header.rtf"));
|
||||
|
||||
if (winHelp)
|
||||
{
|
||||
wxRemoveFile(_T("sections.rtf"));
|
||||
wxRemoveFile(_T("subsections.rtf"));
|
||||
wxRemoveFile(_T("subsubsections.rtf"));
|
||||
wxRemoveFile(_T("popups.rtf"));
|
||||
}
|
||||
if (winHelp && generateHPJ)
|
||||
WriteHPJ(OutputFile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user