initial Mac port; bumped version to 1.2.1.5
* fixes C++11 bug #221; patch by Roger Leigh
|
@ -0,0 +1,4 @@
|
|||
.DS_Store
|
||||
*.dmg
|
||||
*.app
|
||||
*.bz2
|
|
@ -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.
|
|
@ -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>
|
|
@ -0,0 +1,2 @@
|
|||
"CFBundleDisplayName" = "XML Copy Editor";
|
||||
"CFBundleName" = "XML Copy Editor";
|
|
@ -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
|
|
@ -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
|
|
@ -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>
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 47 KiB |
512
src/myipc.cpp
|
@ -1,256 +1,256 @@
|
|||
/*
|
||||
* Copyright 2005-2007 Gerald Schmidt.
|
||||
*
|
||||
* This file is part of Xml Copy Editor.
|
||||
*
|
||||
* Xml Copy Editor is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* Xml Copy Editor is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Xml Copy Editor; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "myipc.h"
|
||||
#include "xmlcopyeditor.h"
|
||||
#include "pathresolver.h"
|
||||
#ifdef HAVE_GTK2
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
guint32 XTimeNow()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime ( CLOCK_MONOTONIC, &ts );
|
||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
#endif // HAVE_GTK2
|
||||
|
||||
MyServerConnection *server_connection = 0;
|
||||
MyClientConnection *client_connection = 0;
|
||||
|
||||
wxConnectionBase *MyServer::OnAcceptConnection ( const wxString& topic )
|
||||
{
|
||||
if ( topic == IPC_TOPIC )
|
||||
return new MyServerConnection();
|
||||
|
||||
// unknown topic
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyServerConnection::MyServerConnection()
|
||||
: wxConnection()
|
||||
, mFrameWnd ( ( wxIntPtr ) NULL )
|
||||
{
|
||||
server_connection = this;
|
||||
}
|
||||
|
||||
MyServerConnection::~MyServerConnection()
|
||||
{
|
||||
if ( server_connection )
|
||||
{
|
||||
server_connection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool MyServerConnection::OnPoke (
|
||||
const wxString& WXUNUSED ( topic )
|
||||
, const wxString& item
|
||||
, IPCData *data
|
||||
, IPCSize_t size
|
||||
, wxIPCFormat WXUNUSED ( format )
|
||||
)
|
||||
{
|
||||
if ( !wxTheApp )
|
||||
return false;
|
||||
MyFrame *frame;
|
||||
frame = ( MyFrame * ) wxTheApp->GetTopWindow();
|
||||
if ( !frame )
|
||||
return false;
|
||||
if ( item == ( wxString ) IPC_NO_FILE )
|
||||
{
|
||||
;
|
||||
}
|
||||
else if ( frame->isOpen ( item ) )
|
||||
{
|
||||
if ( frame->activateTab ( item ) )
|
||||
frame->reloadTab();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
wxCommandEvent event ( wxEVT_MENU, wxID_OPEN );
|
||||
#else
|
||||
wxCommandEvent event ( wxEVT_COMMAND_MENU_SELECTED, wxID_OPEN );
|
||||
#endif
|
||||
event.SetString ( item );
|
||||
wxPostEvent ( frame->GetEventHandler(), event );
|
||||
//frame->addToFileQueue ( ( wxString& ) item ); // prevent event loop problems
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
#ifdef HAVE_GTK2
|
||||
// Processes mostly cannot raise their own windows.
|
||||
// http://osdir.com/ml/gnome.gaim.devel/2004-12/msg00077.html
|
||||
GtkWidget *widget = frame->GetHandle();
|
||||
GdkWindow *window = gtk_widget_get_window ( widget );
|
||||
gdk_x11_window_set_user_time ( window,
|
||||
//XTimeNow() ); // This works too.
|
||||
gdk_x11_get_server_time ( window ) );
|
||||
//gdk_window_show ( window );
|
||||
//gdk_window_raise ( window );
|
||||
//gtk_window_present ( GTK_WINDOW ( widget ) );
|
||||
#endif // HAVE_GTK2
|
||||
frame->Show();
|
||||
frame->Raise();
|
||||
#endif // __WXMSW__
|
||||
return true;
|
||||
}
|
||||
|
||||
IPCData *MyServerConnection::OnRequest
|
||||
( const wxString& WXUNUSED ( topic )
|
||||
, const wxString& item
|
||||
, IPCSize_t *size
|
||||
, wxIPCFormat WXUNUSED ( format ) /*= wxIPC_PRIVATE */
|
||||
)
|
||||
{
|
||||
if ( size == NULL )
|
||||
return NULL;
|
||||
|
||||
if ( item == IPC_FRAME_WND )
|
||||
{
|
||||
if ( !mFrameWnd )
|
||||
{
|
||||
wxWindow *window = wxTheApp->GetTopWindow();
|
||||
if ( window )
|
||||
{
|
||||
#ifdef HAVE_GTK2
|
||||
GtkWidget *wnd = window->GetHandle();
|
||||
if ( wnd )
|
||||
{
|
||||
GdkWindow *gwnd = gtk_widget_get_window ( wnd );
|
||||
if ( gwnd )
|
||||
mFrameWnd = GDK_WINDOW_XID ( gwnd );
|
||||
}
|
||||
#else
|
||||
mFrameWnd = window->GetHandle();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*size = sizeof mFrameWnd;
|
||||
return ( IPCData * ) &mFrameWnd;
|
||||
}
|
||||
|
||||
*size = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool MyServerConnection::OnStartAdvise ( const wxString& WXUNUSED ( topic ),
|
||||
const wxString& WXUNUSED ( item ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MyClientConnection::MyClientConnection()
|
||||
{
|
||||
}
|
||||
|
||||
wxConnectionBase *MyClient::OnMakeConnection()
|
||||
{
|
||||
return new MyClientConnection;
|
||||
}
|
||||
|
||||
bool MyClientConnection::OnAdvise (
|
||||
const wxString& WXUNUSED ( topic )
|
||||
, const wxString& WXUNUSED ( item )
|
||||
, IPCData * WXUNUSED ( data )
|
||||
, IPCSize_t WXUNUSED ( size )
|
||||
, wxIPCFormat WXUNUSED ( format )
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyClientConnection::OnDisconnect()
|
||||
{
|
||||
client_connection = NULL;
|
||||
return wxConnection::OnDisconnect();
|
||||
}
|
||||
|
||||
MyServer::MyServer()
|
||||
{
|
||||
}
|
||||
|
||||
MyClient::MyClient()
|
||||
{
|
||||
}
|
||||
|
||||
bool MyClient::talkToServer ( int argc, const wxChar * const *argv )
|
||||
{
|
||||
MyClientConnection *connection = ( MyClientConnection * )
|
||||
MakeConnection ( _T ( "localhost" ), IPC_SERVICE, IPC_TOPIC );
|
||||
if ( !connection || !connection->StartAdvise ( IPC_ADVISE_NAME ) )
|
||||
return false;
|
||||
|
||||
// Grab what we need before the server is too busy to response
|
||||
IPCSize_t size;
|
||||
const void *data = connection->Request ( IPC_FRAME_WND, &size );
|
||||
|
||||
wxString argument;
|
||||
// wxConnectionBase::Poke expects something other than NULL in debug
|
||||
// version
|
||||
static wxChar whatBuffer[] = _T ( "Data" );
|
||||
const static size_t bufSize = sizeof ( whatBuffer ) - sizeof ( wxChar );
|
||||
if ( argc <= 1 )
|
||||
{
|
||||
connection->Poke ( IPC_NO_FILE, whatBuffer, bufSize );
|
||||
}
|
||||
else for ( int i = 1; i < argc; i++ )
|
||||
{
|
||||
argument = argv[i];
|
||||
argument = PathResolver::run ( argument );
|
||||
if ( ! connection->Poke ( argument, whatBuffer, bufSize ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !data )
|
||||
return false;
|
||||
|
||||
// Bring the window to front
|
||||
#ifdef __WXMSW__
|
||||
if ( size == sizeof ( HWND ) )
|
||||
{
|
||||
HWND hwnd = * ( const HWND * )data;
|
||||
if ( ::IsIconic ( hwnd ) )
|
||||
::ShowWindow ( hwnd, SW_RESTORE );
|
||||
else
|
||||
::SetForegroundWindow ( hwnd );
|
||||
}
|
||||
#elif defined ( __WXGTK__x ) // It doesn't work
|
||||
if ( size == sizeof ( GdkNativeWindow ) )
|
||||
{
|
||||
GdkNativeWindow xWnd = * ( GdkNativeWindow * ) data;
|
||||
GdkWindow *window = gdk_window_foreign_new ( xWnd );
|
||||
if ( window )
|
||||
{
|
||||
gdk_x11_window_set_user_time ( window,
|
||||
XTimeNow() );
|
||||
//gdk_x11_get_server_time ( window ) );
|
||||
gdk_window_show ( window );
|
||||
gdk_window_raise ( window );
|
||||
gdk_window_unref ( window );
|
||||
//GtkWidget *widget;
|
||||
//gdk_window_get_user_data(window, (void**)&widget);
|
||||
//printf ("widget: %p\n",widget);
|
||||
//gtk_window_present ( GTK_WINDOW ( widget ) );
|
||||
}
|
||||
}
|
||||
#endif // __WXMSW__
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Copyright 2005-2007 Gerald Schmidt.
|
||||
*
|
||||
* This file is part of Xml Copy Editor.
|
||||
*
|
||||
* Xml Copy Editor is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* Xml Copy Editor is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Xml Copy Editor; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "myipc.h"
|
||||
#include "xmlcopyeditor.h"
|
||||
#include "pathresolver.h"
|
||||
#ifdef HAVE_GTK2
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
guint32 XTimeNow()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime ( CLOCK_MONOTONIC, &ts );
|
||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
#endif // HAVE_GTK2
|
||||
|
||||
MyServerConnection *server_connection = 0;
|
||||
MyClientConnection *client_connection = 0;
|
||||
|
||||
wxConnectionBase *MyServer::OnAcceptConnection ( const wxString& topic )
|
||||
{
|
||||
if ( topic == IPC_TOPIC )
|
||||
return new MyServerConnection();
|
||||
|
||||
// unknown topic
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyServerConnection::MyServerConnection()
|
||||
: wxConnection()
|
||||
, mFrameWnd ( 0 )
|
||||
{
|
||||
server_connection = this;
|
||||
}
|
||||
|
||||
MyServerConnection::~MyServerConnection()
|
||||
{
|
||||
if ( server_connection )
|
||||
{
|
||||
server_connection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool MyServerConnection::OnPoke (
|
||||
const wxString& WXUNUSED ( topic )
|
||||
, const wxString& item
|
||||
, IPCData *data
|
||||
, IPCSize_t size
|
||||
, wxIPCFormat WXUNUSED ( format )
|
||||
)
|
||||
{
|
||||
if ( !wxTheApp )
|
||||
return false;
|
||||
MyFrame *frame;
|
||||
frame = ( MyFrame * ) wxTheApp->GetTopWindow();
|
||||
if ( !frame )
|
||||
return false;
|
||||
if ( item == ( wxString ) IPC_NO_FILE )
|
||||
{
|
||||
;
|
||||
}
|
||||
else if ( frame->isOpen ( item ) )
|
||||
{
|
||||
if ( frame->activateTab ( item ) )
|
||||
frame->reloadTab();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
wxCommandEvent event ( wxEVT_MENU, wxID_OPEN );
|
||||
#else
|
||||
wxCommandEvent event ( wxEVT_COMMAND_MENU_SELECTED, wxID_OPEN );
|
||||
#endif
|
||||
event.SetString ( item );
|
||||
wxPostEvent ( frame->GetEventHandler(), event );
|
||||
//frame->addToFileQueue ( ( wxString& ) item ); // prevent event loop problems
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
#ifdef HAVE_GTK2
|
||||
// Processes mostly cannot raise their own windows.
|
||||
// http://osdir.com/ml/gnome.gaim.devel/2004-12/msg00077.html
|
||||
GtkWidget *widget = frame->GetHandle();
|
||||
GdkWindow *window = gtk_widget_get_window ( widget );
|
||||
gdk_x11_window_set_user_time ( window,
|
||||
//XTimeNow() ); // This works too.
|
||||
gdk_x11_get_server_time ( window ) );
|
||||
//gdk_window_show ( window );
|
||||
//gdk_window_raise ( window );
|
||||
//gtk_window_present ( GTK_WINDOW ( widget ) );
|
||||
#endif // HAVE_GTK2
|
||||
frame->Show();
|
||||
frame->Raise();
|
||||
#endif // __WXMSW__
|
||||
return true;
|
||||
}
|
||||
|
||||
IPCData *MyServerConnection::OnRequest
|
||||
( const wxString& WXUNUSED ( topic )
|
||||
, const wxString& item
|
||||
, IPCSize_t *size
|
||||
, wxIPCFormat WXUNUSED ( format ) /*= wxIPC_PRIVATE */
|
||||
)
|
||||
{
|
||||
if ( size == NULL )
|
||||
return NULL;
|
||||
|
||||
if ( item == IPC_FRAME_WND )
|
||||
{
|
||||
if ( !mFrameWnd )
|
||||
{
|
||||
wxWindow *window = wxTheApp->GetTopWindow();
|
||||
if ( window )
|
||||
{
|
||||
#ifdef HAVE_GTK2
|
||||
GtkWidget *wnd = window->GetHandle();
|
||||
if ( wnd )
|
||||
{
|
||||
GdkWindow *gwnd = gtk_widget_get_window ( wnd );
|
||||
if ( gwnd )
|
||||
mFrameWnd = GDK_WINDOW_XID ( gwnd );
|
||||
}
|
||||
#else
|
||||
mFrameWnd = window->GetHandle();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*size = sizeof mFrameWnd;
|
||||
return ( IPCData * ) &mFrameWnd;
|
||||
}
|
||||
|
||||
*size = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool MyServerConnection::OnStartAdvise ( const wxString& WXUNUSED ( topic ),
|
||||
const wxString& WXUNUSED ( item ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MyClientConnection::MyClientConnection()
|
||||
{
|
||||
}
|
||||
|
||||
wxConnectionBase *MyClient::OnMakeConnection()
|
||||
{
|
||||
return new MyClientConnection;
|
||||
}
|
||||
|
||||
bool MyClientConnection::OnAdvise (
|
||||
const wxString& WXUNUSED ( topic )
|
||||
, const wxString& WXUNUSED ( item )
|
||||
, IPCData * WXUNUSED ( data )
|
||||
, IPCSize_t WXUNUSED ( size )
|
||||
, wxIPCFormat WXUNUSED ( format )
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyClientConnection::OnDisconnect()
|
||||
{
|
||||
client_connection = NULL;
|
||||
return wxConnection::OnDisconnect();
|
||||
}
|
||||
|
||||
MyServer::MyServer()
|
||||
{
|
||||
}
|
||||
|
||||
MyClient::MyClient()
|
||||
{
|
||||
}
|
||||
|
||||
bool MyClient::talkToServer ( int argc, const wxChar * const *argv )
|
||||
{
|
||||
MyClientConnection *connection = ( MyClientConnection * )
|
||||
MakeConnection ( _T ( "localhost" ), IPC_SERVICE, IPC_TOPIC );
|
||||
if ( !connection || !connection->StartAdvise ( IPC_ADVISE_NAME ) )
|
||||
return false;
|
||||
|
||||
// Grab what we need before the server is too busy to response
|
||||
IPCSize_t size;
|
||||
const void *data = connection->Request ( IPC_FRAME_WND, &size );
|
||||
|
||||
wxString argument;
|
||||
// wxConnectionBase::Poke expects something other than NULL in debug
|
||||
// version
|
||||
static wxChar whatBuffer[] = _T ( "Data" );
|
||||
const static size_t bufSize = sizeof ( whatBuffer ) - sizeof ( wxChar );
|
||||
if ( argc <= 1 )
|
||||
{
|
||||
connection->Poke ( IPC_NO_FILE, whatBuffer, bufSize );
|
||||
}
|
||||
else for ( int i = 1; i < argc; i++ )
|
||||
{
|
||||
argument = argv[i];
|
||||
argument = PathResolver::run ( argument );
|
||||
if ( ! connection->Poke ( argument, whatBuffer, bufSize ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !data )
|
||||
return false;
|
||||
|
||||
// Bring the window to front
|
||||
#ifdef __WXMSW__
|
||||
if ( size == sizeof ( HWND ) )
|
||||
{
|
||||
HWND hwnd = * ( const HWND * )data;
|
||||
if ( ::IsIconic ( hwnd ) )
|
||||
::ShowWindow ( hwnd, SW_RESTORE );
|
||||
else
|
||||
::SetForegroundWindow ( hwnd );
|
||||
}
|
||||
#elif defined ( __WXGTK__x ) // It doesn't work
|
||||
if ( size == sizeof ( GdkNativeWindow ) )
|
||||
{
|
||||
GdkNativeWindow xWnd = * ( GdkNativeWindow * ) data;
|
||||
GdkWindow *window = gdk_window_foreign_new ( xWnd );
|
||||
if ( window )
|
||||
{
|
||||
gdk_x11_window_set_user_time ( window,
|
||||
XTimeNow() );
|
||||
//gdk_x11_get_server_time ( window ) );
|
||||
gdk_window_show ( window );
|
||||
gdk_window_raise ( window );
|
||||
gdk_window_unref ( window );
|
||||
//GtkWidget *widget;
|
||||
//gdk_window_get_user_data(window, (void**)&widget);
|
||||
//printf ("widget: %p\n",widget);
|
||||
//gtk_window_present ( GTK_WINDOW ( widget ) );
|
||||
}
|
||||
}
|
||||
#endif // __WXMSW__
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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", ""
|
||||
|
|
|
@ -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__
|
||||
|
|