initial Mac port; bumped version to 1.2.1.5

* fixes C++11 bug #221; patch by Roger Leigh
This commit is contained in:
Gerald Schmidt 2018-09-20 09:21:05 +02:00
parent 61ebd9c313
commit 25ab7a3604
24 changed files with 499 additions and 300 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.DS_Store
*.dmg
*.app
*.bz2

2
README
View File

@ -1,2 +0,0 @@

4
README.md Normal file
View File

@ -0,0 +1,4 @@
XML Copy Editor
===============
Fast, free, validating XML editor. As of version 1.2.1.5 available for Linux, Windows and Mac.

BIN
mac/Applications.lnk Executable file

Binary file not shown.

30
mac/Info.plist Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>xmlcopyeditor</string>
<key>CFBundleIconFile</key>
<string>xmlcopyeditor.icns</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.xml-copy-editor</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>xmlc</string>
<key>CFBundleVersion</key>
<string>1.2.1.4</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleDisplayName</key>
<string>XML Copy Editor</string>
</dict>
</plist>

2
mac/InfoPlist.strings Normal file
View File

@ -0,0 +1,2 @@
"CFBundleDisplayName" = "XML Copy Editor";
"CFBundleName" = "XML Copy Editor";

35
mac/Makefile Normal file
View File

@ -0,0 +1,35 @@
build:
`wx-config --cxx --cxxflags --libs all` -I /usr/include -I /usr/local/include -I /usr/include/libxml2 -I ../src -lxml2 -lxslt -laspell.15 -lxerces-c -lpcre -o xmlcopyeditor ../src/*.cpp
bundle: Info.plist xmlcopyeditor version.plist InfoPlist.strings xmlcopyeditor.icns
SetFile -t APPL xmlcopyeditor
-mkdir xmlcopyeditor.app
-mkdir xmlcopyeditor.app/Contents
-mkdir xmlcopyeditor.app/Contents/MacOS
-mkdir xmlcopyeditor.app/Contents/Resources
-mkdir xmlcopyeditor.app/Contents/Resources/English.lproj
-mkdir xmlcopyeditor.app/Contents/SharedSupport
-mkdir xmlcopyeditor.app/Contents/Frameworks
cp Info.plist xmlcopyeditor.app/Contents/
cp version.plist xmlcopyeditor.app/Contents/
cp InfoPlist.strings xmlcopyeditor.app/Contents/Resources/English.lproj/
echo -n 'APPLxmlc' > xmlcopyeditor.app/Contents/PkgInfo
cp xmlcopyeditor xmlcopyeditor.app/Contents/MacOS/xmlcopyeditor
cp -R ../src/png xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/catalog xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/dtd xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/help xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/ico xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/rng xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/rulesets xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/templates xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/xpm xmlcopyeditor.app/Contents/SharedSupport/
cp -R ../src/xsl xmlcopyeditor.app/Contents/SharedSupport/
cp xmlcopyeditor.icns xmlcopyeditor.app/Contents/Resources/
for DYLIB in lib/libxml2.2 lib/libxslt.1 lib/libpcre.0 local/lib/libaspell.15 local/lib/libxerces-c-3.1; do BASENAME=`basename /usr/$${DYLIB}.dylib`; echo "relinking $${BASENAME}"; cp /usr/$${DYLIB}.dylib xmlcopyeditor.app/Contents/Frameworks/; install_name_tool -change /usr/$${DYLIB}.dylib @executable_path/../Frameworks/$${BASENAME} xmlcopyeditor.app/Contents/MacOS/xmlcopyeditor; done
dmg:
make -f Makefile.diskimage
clean:
rm -f xmlcopyeditor
rm -rf xmlcopyeditor.app/
make -f Makefile.diskimage clean
all: clean build bundle dmg

76
mac/Makefile.diskimage Normal file
View File

@ -0,0 +1,76 @@
#
# Build file for creating DMG files.
#
# The DMG packager looks for a template.dmg.bz2 for using as its
# DMG template. If it doesn't find one, it generates a clean one.
#
# If you create a DMG template, you should make one containing all
# the files listed in $(SOURCE_FILES) below, and arrange everything to suit
# your style. The contents of the files themselves does not matter, so
# they can be empty (they will be overwritten later).
#
# Remko Tronçon
# https://el-tramo.be
# Licensed under the MIT License. See COPYING for details.
################################################################################
# Customizable variables
################################################################################
NAME ?= xmlcopyeditor
VERSION ?= 1.2.1.5
SOURCE_DIR ?= .
SOURCE_FILES ?= xmlcopyeditor.app Applications.lnk
TEMPLATE_DMG ?= xmlcopyeditor.dmg
TEMPLATE_SIZE ?= 40m
################################################################################
# DMG building. No editing should be needed beyond this point.
################################################################################
MASTER_DMG=$(NAME)-$(VERSION).dmg
WC_DMG=wc.dmg
WC_DIR=wc
.PHONY: all
all: $(MASTER_DMG)
$(TEMPLATE_DMG): $(TEMPLATE_DMG).bz2
bunzip2 -k $<
$(TEMPLATE_DMG).bz2:
@echo
@echo --------------------- Generating empty template --------------------
mkdir template
hdiutil create -fs HFSX -layout SPUD -size $(TEMPLATE_SIZE) "$(TEMPLATE_DMG)" -srcfolder template -format UDRW -volname "$(NAME)" -quiet
rmdir template
bzip2 "$(TEMPLATE_DMG)"
@echo
$(WC_DMG): $(TEMPLATE_DMG)
cp $< $@
$(MASTER_DMG): $(WC_DMG) $(addprefix $(SOURCE_DIR)/,$(SOURCE_FILES))
@echo
@echo --------------------- Creating Disk Image --------------------
mkdir -p $(WC_DIR)
hdiutil attach "$(WC_DMG)" -noautoopen -quiet -mountpoint "$(WC_DIR)"
for i in $(SOURCE_FILES); do \
rm -rf "$(WC_DIR)/$$i"; \
ditto -rsrc "$(SOURCE_DIR)/$$i" "$(WC_DIR)/$$i"; \
done
#rm -f "$@"
#hdiutil create -srcfolder "$(WC_DIR)" -format UDZO -imagekey zlib-level=9 "$@" -volname "$(NAME) $(VERSION)" -scrub -quiet
WC_DEV=`hdiutil info | grep "$(WC_DIR)" | grep "Apple_HFS" | awk '{print $$1}'` && \
hdiutil detach $$WC_DEV -quiet -force
rm -f "$(MASTER_DMG)"
hdiutil convert "$(WC_DMG)" -quiet -format UDZO -imagekey zlib-level=9 -o "$@"
rm -rf $(WC_DIR)
@echo
.PHONY: clean
clean:
-rm -rf $(TEMPLATE_DMG) $(MASTER_DMG) $(WC_DMG) *.bz2 *.dmg

16
mac/version.plist Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>1</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>ProductBuildVersion</key>
<string>1.0</string>
<key>ProjectName</key>
<string>XML Copy Editor</string>
<key>SourceVersion</key>
<string>1000</string>
</dict>
</plist>

BIN
mac/xmlcopyeditor.icns Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -46,7 +46,7 @@ wxConnectionBase *MyServer::OnAcceptConnection ( const wxString& topic )
MyServerConnection::MyServerConnection()
: wxConnection()
, mFrameWnd ( ( wxIntPtr ) NULL )
, mFrameWnd ( 0 )
{
server_connection = this;
}

View File

@ -66,6 +66,7 @@
#include <wx/wupdlock.h>
#include "dtd2schema.h"
#include "myipc.h"
#include <wx/debug.h>
#ifdef NEWFINDREPLACE
#include "findreplacepanel.h"
@ -225,6 +226,8 @@ MyApp::MyApp()
, config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) )
#endif
{
wxDisableAsserts();
#if defined ( __WXGTK__ ) && !defined ( __WXDEBUG__ )
int fdnull = open ( "/dev/null", O_WRONLY, 0 );
dup2 ( fdnull, STDERR_FILENO );
@ -657,9 +660,11 @@ MyFrame::MyFrame (
wxEmptyString,
this ) ),
findDialog ( 0 ),
#ifndef __WXMSW__
helpController ( new wxHtmlHelpController() ),
helpController ( new wxHtmlHelpController (
#ifdef __WXOSX__
wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT
#endif
) ),
menuBar ( 0 ),
toolBar ( 0 ),
xmlMenu ( 0 ),
@ -881,7 +886,7 @@ MyFrame::MyFrame (
// Initialize Xerces-C++
WrapXerces::Init ( libxmlNetAccess );
#if _XERCES_VERSION >= 30100
#if _XERCES_VERSION >= 30100 && wxDEBUG_LEVEL > 0
if ( XMLPlatformUtils::fgSSE2ok
&& xercescSSE2Warning
&& wxTheApp->argc == 1 )
@ -940,7 +945,13 @@ MyFrame::MyFrame (
stylePosition = aboutPosition = wxDefaultPosition;
styleSize = wxSize ( 720, 540 );
showTopBars ( toolbarVisible );
showTopBars (
#ifndef __WXOSX__
toolbarVisible
#else
false
#endif
);
long style = wxAUI_NB_TOP |
wxAUI_NB_TAB_SPLIT |
@ -5073,9 +5084,11 @@ wxMenuBar *MyFrame::getMenuBar()
_ ( "S&how Current Element Pane" ),
_ ( "Show Current Element Pane" ) );
viewMenu->Check ( ID_LOCATION_PANE_VISIBLE, false );
#ifndef __WXOSX__
viewMenu->AppendCheckItem (
ID_TOOLBAR_VISIBLE, _ ( "Sh&ow Toolbar" ), _ ( "Show Toolbar" ) );
viewMenu->Check ( ID_TOOLBAR_VISIBLE, toolbarVisible );
#endif
viewMenu->Append ( ID_CLOSE_MESSAGE_PANE,
_ ( "C&lose Message Pane\tAlt+C" ), _ ( "Close Message Pane" ) );
viewMenu->Append ( ID_CLOSE_FIND_REPLACE_PANE,
@ -5429,6 +5442,7 @@ wxToolBar *MyFrame::getToolBar()
wxNullBitmap,
wxITEM_NORMAL,
_ ( "Save" ) );
#ifndef __WXOSX__
toolBar->AddTool (
ID_PRINT,
_ ( "Print" ),
@ -5464,7 +5478,6 @@ wxToolBar *MyFrame::getToolBar()
wxNullBitmap,
wxITEM_NORMAL,
_ ( "Spelling" ) );
toolBar->AddCheckTool (
ID_PROTECT_TAGS,
_ ( "Lock Tags" ),
@ -5473,6 +5486,7 @@ wxToolBar *MyFrame::getToolBar()
_ ( "Lock Tags" ) );
toolBar->ToggleTool (
ID_PROTECT_TAGS, protectTags );
#endif
toolBar->Realize();
return toolBar;
@ -5684,44 +5698,33 @@ void MyFrame::encodingMessage()
void MyFrame::updatePaths()
{
ruleSetDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "rulesets" );
filterDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "filters" );
templateDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "templates" ) +
wxFileName::GetPathSeparator();
binDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "bin" ) +
wxFileName::GetPathSeparator();
helpDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "help" ) +
wxFileName::GetPathSeparator();
rngDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "rng" ) +
wxFileName::GetPathSeparator();
htmlDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "html" ) +
wxFileName::GetPathSeparator();
pngDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "png" ) +
wxFileName::GetPathSeparator();
daisyDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "daisy" ) +
wxFileName::GetPathSeparator();
wxString sep = wxFileName::GetPathSeparator();
ruleSetDir = applicationDir + sep + _T ( "rulesets" );
filterDir = applicationDir + sep + _T ( "filters" );
templateDir = applicationDir + sep + _T ( "templates" ) + sep;
binDir = applicationDir + sep + _T ( "bin" ) + sep;
helpDir = applicationDir + sep + _T ( "help" ) + sep;
rngDir = applicationDir + sep + _T ( "rng" ) + sep;
htmlDir = applicationDir + sep + _T ( "html" ) + sep;
pngDir = applicationDir + sep + _T ( "png" ) + sep;
xpmDir = applicationDir + sep + _T ( "xpm" ) + sep;
daisyDir = applicationDir + sep + _T ( "daisy" ) + sep;
catalogPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "catalog" ) +
wxFileName::GetPathSeparator() + _T ( "catalog" );
applicationDir + sep + _T ( "catalog" ) + sep + _T ( "catalog" );
xslDtdPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
wxFileName::GetPathSeparator() + _T ( "xslt10.dtd" );
applicationDir + sep + _T ( "dtd" ) + sep + _T ( "xslt10.dtd" );
rssDtdPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
wxFileName::GetPathSeparator() + _T ( "rss2.dtd" );
applicationDir + sep + _T ( "dtd" ) + sep + _T ( "rss2.dtd" );
xtmDtdPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
wxFileName::GetPathSeparator() + _T ( "xtm1.dtd" );
applicationDir + sep + _T ( "dtd" ) + sep + _T ( "xtm1.dtd" );
lzxDtdPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
wxFileName::GetPathSeparator() + _T ( "lzx.dtd" );
applicationDir + sep + _T ( "dtd" ) + sep + _T ( "lzx.dtd" );
xliffDtdPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
wxFileName::GetPathSeparator() + _T ( "xliff.dtd" );
aspellDataPath = applicationDir + wxFileName::GetPathSeparator() +
_T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "data" );
aspellDictPath = applicationDir + wxFileName::GetPathSeparator() +
_T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "dict" );
applicationDir + sep + _T ( "dtd" ) + sep + _T ( "xliff.dtd" );
aspellDataPath = applicationDir + sep +
_T ( "aspell" ) + sep + _T ( "data" );
aspellDictPath = applicationDir + sep +
_T ( "aspell" ) + sep + _T ( "dict" );
}
void MyFrame::OnAssociate ( wxCommandEvent& event )
@ -5966,11 +5969,34 @@ void MyFrame::loadBitmaps()
findBitmap = wxBITMAP ( stock_search_16 );
spelling16Bitmap = wxBITMAP ( stock_spellcheck_16 );
helpBitmap = wxBITMAP ( stock_help_16 );
/*
#elif __WXOSX__
// toolbar icons
newBitmap.LoadFile ( xpmDir + _T ( "stock_new.xpm" ), wxBITMAP_TYPE_XPM );
openBitmap.LoadFile ( xpmDir + _T ( "stock_open.xpm" ), wxBITMAP_TYPE_XPM );
saveBitmap.LoadFile ( xpmDir + _T ( "stock_save.xpm" ), wxBITMAP_TYPE_XPM );
// menu icons
new16Bitmap = wxNullBitmap;
open16Bitmap = wxNullBitmap;
save16Bitmap = wxNullBitmap;
printPreviewBitmap = wxNullBitmap;
print16Bitmap = wxNullBitmap;
undo16Bitmap = wxNullBitmap;
redo16Bitmap = wxNullBitmap;
cutBitmap = wxNullBitmap;
copyBitmap = wxNullBitmap;
pasteBitmap = wxNullBitmap;
findBitmap = wxNullBitmap;
spelling16Bitmap = wxNullBitmap;
helpBitmap = wxNullBitmap;
*/
#else
// toolbar icons
newBitmap = wxArtProvider::GetBitmap ( wxART_NEW, wxART_TOOLBAR );
openBitmap = wxArtProvider::GetBitmap ( wxART_FILE_OPEN, wxART_TOOLBAR );
saveBitmap = wxArtProvider::GetBitmap ( wxART_FILE_SAVE, wxART_TOOLBAR );
#ifndef __WXOSX__
printBitmap = wxArtProvider::GetBitmap ( wxART_PRINT, wxART_TOOLBAR );
spellingBitmap = wxArtProvider::GetBitmap ( _T ( "gtk-spell-check" ), wxART_TOOLBAR );
@ -5979,6 +6005,7 @@ void MyFrame::loadBitmaps()
hyperlinkBitmap.LoadFile ( pngDir + _T ( "stock_hyperlink.png" ), wxBITMAP_TYPE_PNG );
checkWellformedBitmap.LoadFile ( pngDir + _T ( "stock_calc-accept.png" ), wxBITMAP_TYPE_PNG );
checkValidBitmap.LoadFile ( pngDir + _T ( "stock_calc-accept-green.png" ), wxBITMAP_TYPE_PNG );
#endif
// menu icons
new16Bitmap = wxNullBitmap;

View File

@ -21,6 +21,12 @@
#ifndef XMLCOPYEDITOR_H
#define XMLCOPYEDITOR_H
#define wxDEBUG_LEVEL 0
#ifdef __WXOSX__
#define wxMAC_USE_NATIVE_TOOLBAR 1
#endif
#define NEWFINDREPLACE 1
#include <wx/wx.h>
@ -432,6 +438,7 @@ class MyFrame : public wxFrame
rngDir,
htmlDir,
pngDir,
xpmDir,
daisyDir,
xpathExpression,
lastDtdPublic,

View File

@ -175,8 +175,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,1,4
PRODUCTVERSION 1,2,1,4
FILEVERSION 1,2,1,5
PRODUCTVERSION 1,2,1,5
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -195,7 +195,7 @@ BEGIN
VALUE "FileDescription", "XML Copy Editor is a fast, free, validating XML editor"
VALUE "FileVersion", ""
VALUE "InternalName", "xmlcopyeditor.exe"
VALUE "LegalCopyright", "Copyright (c) 2014 Gerald Schmidt"
VALUE "LegalCopyright", "Copyright (c) 2018 Gerald Schmidt"
VALUE "OriginalFilename", "XmlCopyEditor.exe"
VALUE "ProductName", "XML Copy Editor"
VALUE "ProductVersion", ""

View File

@ -24,7 +24,7 @@
#else
#define FILE_FILTER _("All files (*)|*|XML (*.xml)|*.xml|XHTML (*.html)|*.html|DTD (*.dtd)|*.dtd|XML Schema (*.xsd)|*.xsd|RELAX NG grammar (*.rng)|*.rng|XSL (*.xsl)|*.xsl")
#endif
#define ABOUT_COPYRIGHT _("Copyright © 2005-2009 Gerald Schmidt <gnschmidt@users.sourceforge.net>")
#define ABOUT_COPYRIGHT _("Copyright © 2005-2018 Gerald Schmidt <gnschmidt@users.sourceforge.net>")
#define ABOUT_DESCRIPTION _("\nXML Copy Editor is free software released under the GNU\nGeneral Public License.\n\nMany thanks are due to ")
#define ABOUT_CONTRIBUTORS _T(\
"Tim van Niekerk, Matt Smigielski,\n"\
@ -52,7 +52,7 @@
"License along with this program; if not, write to the Free\n"\
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
"Boston, MA 02111-1307 USA.")
#define ABOUT_VERSION _T("1.2.1.4")
#define ABOUT_VERSION _T("1.2.1.5")
#define XMLCE_VAR _T("XMLCE_VAR")
#ifdef __WXMSW__