Re: uwog - r22102 - in abiword-plugins/trunk/tools/abicollab: . backends/tcp/xp core/session/xp

From: J.M. Maurer <uwog_at_uwog.net>
Date: Wed Oct 17 2007 - 21:21:20 CEST

On Tue, 2007-10-16 at 18:54 -0500, Ryan Pavlik wrote:
> Dear Sir/Madam:
>
> Windows AbiCollab is now broken again due to Unix includes in XP code.
> :( I almost had a working one though! (Missed a narrow window of
> opportunity...)

Sorry, this as an unfinished commit so I could let martin look at the
code I was having a problem with; will be fixed soon.

Marc

> In other news, the Nighty Builder at www.cleardefinition.com is
> correctly producing Abiword Trunk main and imp/exp installers. :D
>
> Ryan
>
> cvs@abisource.com wrote:
> > Author: uwog
> > Date: 2007-10-16 14:26:55 +0200 (Tue, 16 Oct 2007)
> > New Revision: 22102
> >
> > Added:
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.cpp
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.h
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.cpp
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.h
> > Removed:
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.cpp
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.h
> > Modified:
> > abiword-plugins/trunk/tools/abicollab/Makefile
> > abiword-plugins/trunk/tools/abicollab/backends/tcp/xp/Session.h
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab.cpp
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Plugin.cpp
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/GNUmakefile.am
> > abiword-plugins/trunk/tools/abicollab/core/session/xp/Makefile
> > Log:
> > Start of reviving the abicollab command line class for use in regression testing
> >
> >
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/Makefile
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/Makefile 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/Makefile 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -45,10 +45,12 @@
> > $(OBJDIR)/ap_Win32Dialog_CollaborationJoin.$(OBJ_SUFFIX) \
> > $(OBJDIR)/AccountEvent.$(OBJ_SUFFIX) \
> > $(OBJDIR)/SessionEvent.$(OBJ_SUFFIX) \
> > + $(OBJDIR)/AbiCollab_Regression.$(OBJ_SUFFIX) \
> > $(OBJDIR)/DiskSessionViewer.$(OBJ_SUFFIX) \
> > $(OBJDIR)/Buddy.$(OBJ_SUFFIX) \
> > $(OBJDIR)/Packets.$(OBJ_SUFFIX) \
> > $(OBJDIR)/Serialization.$(OBJ_SUFFIX) \
> > + $(OBJDIR)/AbiCollab_Command.$(OBJ_SUFFIX) \
> > $(OBJDIR)/TCPAccountHandler.$(OBJ_SUFFIX) \
> > $(OBJDIR)/TCPWin32AccountHandler.$(OBJ_SUFFIX)\
> > $(OBJDIR)/Synchronizer.$(OBJ_SUFFIX)\
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/backends/tcp/xp/Session.h
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/backends/tcp/xp/Session.h 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/backends/tcp/xp/Session.h 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -174,6 +174,10 @@
> >
> > void asyncWriteHeaderHandler(const asio::error_code& ec)
> > {
> > + UT_DEBUGMSG(("Delaying packet sending...\n"));
> > + usleep(6*1000*1000);
> > + UT_DEBUGMSG(("sending\n"));
> > +
> > UT_DEBUGMSG(("Session::asyncWriteHeaderHandler()\n"));
> > if (!ec)
> > {
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab.cpp
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab.cpp 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab.cpp 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -32,7 +32,6 @@
> > #include "xav_Listener.h"
> > #include "fl_BlockLayout.h"
> > #include "pd_Document.h"
> > -#include "CommandLine.h"
> > #include "ie_types.h"
> > #include "ev_Mouse.h"
> > #include "ut_types.h"
> > @@ -41,66 +40,27 @@
> > #include "ap_Strings.h"
> > #include "xap_Prefs.h"
> > #include "ap_Frame.h"
> > +#include "ut_path.h"
> >
> > #ifdef WIN32
> > #include <windows.h>
> > #endif
> >
> > -#include "AbiCollab_Export.h"
> > -#include "AbiCollab_Import.h"
> > -#include "AbiCollab.h"
> > -#include "AbiCollabSessionManager.h"
> > #include <backends/xp/AccountHandler.h>
> > #include <backends/xp/Buddy.h>
> > +#include <backends/xp/SessionEvent.h>
> >
> > +#include <xp/AbiCollab_Export.h>
> > +#include <xp/AbiCollab_Import.h>
> > +#include <xp/AbiCollab.h>
> > +#include <xp/AbiCollabSessionManager.h>
> > #include <xp/AbiCollab_Packet.h>
> > -#include <backends/xp/SessionEvent.h>
> > -#include "ut_path.h"
> > +#include <xp/AbiCollab_Command.h>
> >
> > #ifdef ABICOLLAB_RECORD_ALWAYS
> > #include <xp/DiskSessionRecorder.h>
> > #endif
> >
> > -/*
> > -bool AbiCollabFactoryContainer::extractParams(UT_UTF8String & sCommandLine,
> > - UT_UTF8String & sServer,
> > - UT_UTF8String & sPort,
> > - UT_UTF8String & sUsername,
> > - UT_UTF8String & sPassword,
> > - UT_UTF8String ** psRemoteUser,
> > - UT_UTF8String ** psRemoteServer,
> > - UT_UTF8String ** psPathName)
> > -{
> > - int _argc = 0;
> > - char **_argv = NULL;
> > -
> > - if (g_shell_parse_argv (sCommandLine.utf8_str(), &_argc, &_argv, NULL))
> > - {
> > - if(_argc < 4)
> > - {
> > - return false;
> > - }
> > - sServer = _argv[0];
> > - sPort = _argv[1];
> > - sUsername = _argv[2];
> > - sPassword = _argv[3];
> > - if (_argc > 4)
> > - {
> > - *psRemoteUser = new UT_UTF8String(_argv[4]);
> > - }
> > - if (_argc > 5)
> > - {
> > - *psRemoteServer = new UT_UTF8String(_argv[5]);
> > - }
> > - if (_argc > 6)
> > - {
> > - *psPathName = new UT_UTF8String(_argv[6]);
> > - }
> > - }
> > -}
> > -
> > -*/
> > -
> > ChangeAdjust::ChangeAdjust(const AbstractChangeRecordSessionPacket& packet, PT_DocPosition iRemoteDocPos, const UT_UTF8String& sRemoteDocUUID)
> > : m_pPacket(static_cast<const AbstractChangeRecordSessionPacket*>(packet.clone())),
> > m_iLocalPos( m_pPacket->getPos() ),
> > @@ -114,44 +74,6 @@
> > DELETEP(m_pPacket);
> > }
> >
> > -/*AbiCollab::AbiCollab(AbiCollabFactoryContainer* pFactory, PD_Document * pDoc, UT_UTF8String sID, bool bAsCommandLine, UT_UTF8String * pPathName)
> > - : m_pFactory(pFactory),
> > - m_pDoc(pDoc),
> > - m_pImport(NULL),
> > - m_pExport(NULL),
> > - m_sID(sID),
> > - m_iDocListenerId(0),
> > - m_bOffering(false),
> > - m_pCommandLine(NULL),
> > - m_bCloseNow(false),
> > - m_bExportMasked(false),
> > - m_pRemoteListener(NULL),
> > - m_bIsMaster(false),
> > - m_iServiceID(0),
> > - m_pServiceExport(NULL)
> > -{
> > - // TODO: we should lazy-create these; ie. only if there are remote clients
> > - bool bLoadOK = false;
> > - if (bAsCommandLine)
> > - {
> > - m_pCommandLine = new CommandLine();
> > - if (pPathName != NULL)
> > - {
> > - bLoadOK = m_pCommandLine->loadDocument(*pPathName);
> > - if (!bLoadOK)
> > - {
> > - m_pCommandLine->newDocument();
> > - }
> > - }
> > - else
> > - {
> > - m_pCommandLine->newDocument();
> > - }
> > - UT_ASSERT(m_pCommandLine->getCurrentDocument());
> > - setDocument(m_pCommandLine->getCurrentDocument());
> > - }
> > -}*/
> > -
> > // Use this constructor to host a collaboration session
> > AbiCollab::AbiCollab(PD_Document* pDoc)
> > : EV_MouseListener(),
> >
> > Copied: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.cpp (from rev 22101, abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.cpp)
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.cpp (rev 0)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.cpp 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -0,0 +1,195 @@
> > +/*
> > + * AbiCommand - Abiword plugin for a command line interface
> > + * Copyright (C) 2002 by Martin Sevior
> > + * Copyright (C) 2005 by Dom Lachowicz
> > + *
> > + * This program 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.
> > + *
> > + * This program 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 this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > + * 02111-1307, USA.
> > + */
> > +
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include <stdlib.h>
> > +#include <sys/types.h>
> > +#include <errno.h>
> > +
> > +#include <glib.h>
> > +
> > +#include "xap_Module.h"
> > +#include "xap_App.h"
> > +#include "xap_Frame.h"
> > +#include "fv_View.h"
> > +#include "ev_EditMethod.h"
> > +#include "ie_imp.h"
> > +#include "ie_exp.h"
> > +#include "ie_types.h"
> > +#include "ap_Convert.h"
> > +#include "ap_UnixApp.h"
> > +#include "gr_UnixNullGraphics.h"
> > +#include "ap_UnixFrame.h"
> > +#include "gr_DrawArgs.h"
> > +
> > +#include <xp/AbiCollab_Command.h>
> > +
> > +AbiCollab_Command::AbiCollab_Command()
> > + : m_pCurDoc (NULL),
> > + m_pCurFile (new UT_UTF8String),
> > + m_pCurFrame (NULL),
> > + m_pCurView (NULL),
> > + m_pG (NULL),
> > + m_pLayout (NULL),
> > + m_bViewDoc (false),
> > + m_bRunAsServer (false),
> > + m_iPID (0),
> > + m_sErrorFile ("")
> > +{
> > + m_pApp = XAP_App::getApp ();
> > + m_pApp->getGraphicsFactory()->registerAsDefault(GRID_UNIX_NULL,true);
> > +}
> > +
> > +
> > +AbiCollab_Command::~AbiCollab_Command()
> > +{
> > + deleteCurrentDoc ();
> > + DELETEP (m_pCurFile);
> > +}
> > +
> > +void
> > +AbiCollab_Command::deleteCurrentDoc (void)
> > +{
> > + //
> > + // Delete the current view, frame and document.
> > + //
> > + bool bUnref = (m_pCurFrame == NULL);
> > +
> > + if (m_pCurFrame != NULL)
> > + m_pApp->forgetFrame (m_pCurFrame);
> > +
> > + //
> > + // Deleting the frame also deletes the layout, view and graphics classes
> > + //
> > + DELETEP (m_pCurFrame);
> > + if (bUnref)
> > + {
> > + UNREFP (m_pCurDoc);
> > + }
> > +
> > + m_pCurView = NULL;
> > + m_pG = NULL;
> > + m_pLayout = NULL;
> > + m_pCurView = NULL;
> > +}
> > +
> > +PD_Document * AbiCollab_Command::getCurrentDocument(void)
> > +{
> > + return m_pCurDoc;
> > +}
> > +
> > +/*!
> > + * Load the document identified by the path sPathToDoc into Abiword
> > + */
> > +bool AbiCollab_Command::loadDocument(UT_UTF8String & sPathToDoc)
> > +{
> > + //
> > + // Load in a document
> > + //
> > +
> > + PD_Document *pDoc = new PD_Document (m_pApp);
> > +
> > + UT_Error error = pDoc->readFromFile (sPathToDoc.utf8_str (), IEFT_Unknown);
> > +
> > + if (error != UT_OK)
> > + {
> > + UNREFP (pDoc);
> > + printf ("Error loading %s error %d \n", sPathToDoc.utf8_str (),error);
> > + return false;
> > + }
> > + replaceDocument (pDoc);
> > + m_pCurFile->assign (sPathToDoc.utf8_str ());
> > + return true;
> > +}
> > +
> > +/*!
> > + * Create a new Document
> > + */
> > +bool AbiCollab_Command::newDocument(void)
> > +{
> > + //
> > + // New document
> > + //
> > +
> > + PD_Document *pDoc = new PD_Document (m_pApp);
> > +
> > + UT_Error error = pDoc->newDocument ();
> > +
> > + if (error != UT_OK)
> > + {
> > + UNREFP (pDoc);
> > + printf ("Error creating new document error %d \n", error);
> > + return false;;
> > + }
> > +
> > + replaceDocument (pDoc);
> > + m_pCurFile->assign ("");
> > +
> > + return true;
> > +}
> > +
> > +
> > +void AbiCollab_Command::nullUpdate (void)
> > +{
> > + if (m_bViewDoc)
> > + {
> > + UT_uint32 i = 0;
> > +
> > + for (i = 0; i < 5; i++)
> > + gtk_main_iteration ();
> > + }
> > +}
> > +
> > +//
> > +// Doc loaded OK, delete the old stuff, put in the new stuff
> > +//
> > +bool AbiCollab_Command::replaceDocument (PD_Document * pDoc)
> > +{
> > + //
> > + // Delete the current document.
> > + //
> > + deleteCurrentDoc ();
> > +
> > + //
> > + // Put the new document in place.
> > + //
> > + m_pCurDoc = pDoc;
> > + XAP_UnixApp *pUnixApp = static_cast < XAP_UnixApp * >(m_pApp);
> > +
> > + m_pCurFrame = new AP_UnixFrame();
> > + UT_UTF8String extension (".bak~");
> > +
> > + m_pCurFrame->setAutoSaveFileExt (extension.utf8_str ());
> > +
> > +
> > + GR_UnixNullGraphicsAllocInfo ai;
> > + m_pG = (UnixNull_Graphics *) m_pApp->newGraphics (ai);
> > +
> > + m_pLayout = new FL_DocLayout (m_pCurDoc, static_cast < GR_Graphics * >(m_pG));
> > + m_pCurView = new FV_View (m_pApp, m_pCurFrame, m_pLayout);
> > + m_pCurFrame->setView (static_cast < AV_View * >(m_pCurView));
> > + m_pCurFrame->setDoc (static_cast < AD_Document * >(m_pCurDoc));
> > + m_pLayout->fillLayouts ();
> > + static_cast < FV_View * >(m_pCurView)->setPoint (2);
> > +
> > + return true;
> > +}
> >
> > Copied: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.h (from rev 22101, abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.h)
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.h (rev 0)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Command.h 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -0,0 +1,62 @@
> > +/*
> > + * AbiCommand - Abiword plugin for a command line interface
> > + * Copyright (C) 2002 by Martin Sevior
> > + *
> > + * This program 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.
> > + *
> > + * This program 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 this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > + * 02111-1307, USA.
> > + */
> > +
> > +#ifndef ABI_COLLAB_COMMAND_H
> > +#define ABI_COLLAB_COMMAND_H
> > +
> > +#include "ut_string_class.h"
> > +class PD_Document;
> > +class AP_UnixFrame;
> > +class AV_View;
> > +class UnixNull_Graphics;
> > +class FL_DocLayout;
> > +class XAP_App;
> > +class UT_UTF8String;
> > +
> > +class ABI_EXPORT AbiCollab_Command
> > +{
> > +public:
> > + AbiCollab_Command(void);
> > + ~AbiCollab_Command(void);
> > +
> > + bool replaceDocument(PD_Document * pDoc);
> > + bool loadDocument(UT_UTF8String & sPathToDoc);
> > + bool newDocument(void);
> > + PD_Document * getCurrentDocument();
> > + void nullUpdate();
> > + bool removeGraphicalView(void);
> > + void deleteCurrentDoc(void);
> > + bool viewDoc(void);
> > +
> > +private:
> > + PD_Document * m_pCurDoc;
> > + UT_UTF8String * m_pCurFile;
> > + AP_UnixFrame * m_pCurFrame;
> > + AV_View * m_pCurView;
> > + UnixNull_Graphics * m_pG;
> > + FL_DocLayout * m_pLayout;
> > + XAP_App * m_pApp;
> > + bool m_bViewDoc;
> > + bool m_bRunAsServer;
> > + UT_uint32 m_iPID;
> > + UT_UTF8String m_sErrorFile;
> > +};
> > +
> > +#endif /* ABI_COLLAB_COMMAND_H */
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Plugin.cpp
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Plugin.cpp 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Plugin.cpp 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -50,9 +50,9 @@
> > #include "xap_Dlg_FileOpenSaveAs.h"
> >
> > // forward declarations
> > -void s_abicollab_add_menus();
> > -void s_abicollab_remove_menus();
> > -void cleanupOldSessions();
> > +static void s_abicollab_add_menus();
> > +static void s_abicollab_remove_menus();
> > +static void s_cleanup_old_sessions();
> >
> > // -----------------------------------------------------------------------
> > //
> > @@ -69,7 +69,7 @@
> > mi->desc = "This plugin allows real-time collaborative document editing";
> > mi->version = ABI_VERSION_STRING;
> > mi->author = "Martin Sevior <msevior@physics.unimelb.edu.au>\nMarc Maurer <uwog@uwog.net>\nMarc Oude Kotte <foddex@foddex.net>";
> > - mi->usage = "";
> > + mi->usage = "com.abisource.abiword.abicollab.command";
> >
> > s_abicollab_add_menus();
> >
> > @@ -89,7 +89,7 @@
> >
> > // remove old sessions
> > #if defined(ABICOLLAB_RECORD_ALWAYS) && defined(DEBUG)
> > - cleanupOldSessions();
> > + s_cleanup_old_sessions();
> > #endif
> >
> > return 1;
> > @@ -151,22 +151,23 @@
> >
> > #if defined(DEBUG)
> > #if !defined(ABICOLLAB_RECORD_ALWAYS)
> > -static const char * szCollaborationRecord = "Record this session";
> > +static const char * szCollaborationRecord = "Record this Session";
> > static const char * szCollaborationRecordTip = "Record a session to disk, for debugging purposes";
> > #endif
> > -static const char * szCollaborationViewRecord = "View session";
> > -static const char * szCollaborationViewRecordTip = "Load a recorded session from disk and show the packets.";
> > +static const char * szCollaborationViewRecord = "View Session";
> > +static const char * szCollaborationViewRecordTip = "Load a recorded session from disk and show the packets";
> > #endif
> >
> > static const char * szEndCollaboration = "EndCollaboration";
> >
> >
> > // some function prototypes
> > -bool s_abicollab_offer(AV_View* v, EV_EditMethodCallData *d);
> > -bool s_abicollab_join(AV_View* v, EV_EditMethodCallData *d);
> > -bool s_abicollab_accounts(AV_View* v, EV_EditMethodCallData *d);
> > -bool s_abicollab_record(AV_View* v, EV_EditMethodCallData *d);
> > -bool s_abicollab_viewrecord(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_offer(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_join(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_accounts(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_record(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_viewrecord(AV_View* v, EV_EditMethodCallData *d);
> > +static bool s_abicollab_command_invoke(AV_View* v, EV_EditMethodCallData *d);
> >
> > #define ABIWORD_VIEW FV_View * pView = static_cast<FV_View *>(pAV_View)
> >
> > @@ -428,7 +429,9 @@
> > );
> > pActionSet->addAction(myEndCollaborationAction);
> >
> > -
> > + EV_EditMethod* myCommandEM = new EV_EditMethod ("com.abisource.abiword.abicollab.command", s_abicollab_command_invoke, 0, "" );
> > + pEMC->addEditMethod (myCommandEM);
> > +
> > // We need to go through and add the menu element to each "frame"
> > // of the application. We can iterate through the frames by doing
> > // XAP_App::getFrameCount() to tell us how many frames there are,
> > @@ -475,8 +478,16 @@
> > pEM = ev_EditMethod_lookup ( "s_abicollab_viewrecord" ) ;
> > pEMC->removeEditMethod ( pEM ) ;
> > DELETEP( pEM ) ;
> > +
> > + pEM = ev_EditMethod_lookup ( "s_abicollab_regression" ) ;
> > + pEMC->removeEditMethod ( pEM ) ;
> > + DELETEP( pEM ) ;
> > #endif
> >
> > + pEM = ev_EditMethod_lookup ( "com.abisource.abiword.abicollab.command" ) ;
> > + pEMC->removeEditMethod ( pEM ) ;
> > + DELETEP( pEM ) ;
> > +
> > // now remove crap from the menus
> > int frameCount = pApp->getFrameCount();
> > XAP_Menu_Factory * pFact = pApp->getMenuFactory();
> > @@ -489,7 +500,7 @@
> > pFact->removeMenuItem("Main", NULL, szCollaborationRecord);
> > #endif
> > #if defined(DEBUG)
> > - pFact->removeMenuItem("Main", NULL, szCollaborationViewRecord);
> > + pFact->removeMenuItem("Main", NULL, szCollaborationViewRecord);
> > #endif
> > pFact->removeMenuItem("Main", NULL, szEndCollaboration);
> >
> > @@ -589,7 +600,7 @@
> >
> > bool s_abicollab_viewrecord(AV_View* v, EV_EditMethodCallData *d)
> > {
> > - UT_DEBUGMSG(("s_abicollab_record"));
> > + UT_DEBUGMSG(("s_abicollab_record\n"));
> >
> > // ask user what file to open
> > XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
> > @@ -623,6 +634,16 @@
> > return true;
> > }
> >
> > +bool s_abicollab_command_invoke(AV_View* v, EV_EditMethodCallData *d)
> > +{
> > + UT_DEBUGMSG(("s_abicollab_command_invoke()\n"));
> > +
> > + UT_UTF8String argv(d->m_pData, d->m_dataLength);
> > + UT_DEBUGMSG(("command line arguments: \n", argv.utf8_str()));
> > +
> > + // TODO: implement me
> > +}
> > +
> > #if defined(ABICOLLAB_RECORD_ALWAYS) && defined(DEBUG)
> >
> > #ifndef WIN32
> > @@ -689,9 +710,9 @@
> > /*!
> > * removes all sessions that are older than 24-hours
> > */
> > -void cleanupOldSessions()
> > +void s_cleanup_old_sessions()
> > {
> > - UT_DEBUGMSG(("cleanupOldSessions\n"));
> > + UT_DEBUGMSG(("s_cleanup_old_sessions()\n"));
> >
> > // get all files we need to delete
> > std::vector<std::string> files;
> >
> > Added: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.cpp
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.cpp (rev 0)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.cpp 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -0,0 +1,94 @@
> > +/*
> > + * AbiCollab - Code to enable the modification of remote documents.
> > + * Copyright (C) 2007 by One Laptop Per Child
> > + *
> > + * This program 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.
> > + *
> > + * This program 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 this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > + * 02111-1307, USA.
> > + */
> > +
> > +#include <string>
> > +
> > +#include "ut_debugmsg.h"
> > +#include <xp/AbiCollab_Regression.h>
> > +
> > +bool AbiCollab_Regression::execute()
> > +{
> > + std::vector<std::string> files;
> > + _findRegressionFiles(files);
> > +
> > + for (std::vector<std::string>::const_iterator cit = files.begin(); cit != files.end(); cit++)
> > + {
> > + }
> > +}
> > +
> > +#ifndef WIN32
> > +
> > +#include <dirent.h>
> > +#include <sys/types.h>
> > +#include <sys/stat.h>
> > +#include <unistd.h>
> > +
> > +/*!
> > + * returns all found regression test files
> > + */
> > +void AbiCollab_Regression::_findRegressionFiles(std::vector<std::string>& files)
> > +{
> > + UT_DEBUGMSG(("AbiCollab_Regression::_findRegressionFiles()\n"));
> > + const char* targetDir = "/home/uwog/t";
> > +
> > + const char* prefix = "AbiCollabRegressionTest-";
> > + size_t prefixLen = strlen(prefix);
> > +
> > + struct dirent** namelist;
> > + int n = scandir( targetDir, &namelist, NULL, alphasort );
> > + UT_DEBUGMSG(("got %d files in %s\n", n, targetDir));
> > + for (int i=0; i<n; ++i)
> > + {
> > + UT_DEBUGMSG(("considering %s\n", namelist[i]->d_name));
> > +
> > + // construct full name so we can stat this node
> > + std::string fullname = targetDir;
> > + fullname += '/';
> > + fullname += namelist[i]->d_name;
> > +
> > + // stat node
> > + struct stat details;
> > + if (stat( fullname.c_str(), &details ) == 0)
> > + {
> > + // check if it is a file
> > + if (!(S_ISDIR(details.st_mode)))
> > + {
> > + // if it is a session file
> > + if (strncmp( namelist[i]->d_name, prefix, prefixLen ) == 0)
> > + {
> > + files.push_back( fullname );
> > + }
> > + }
> > + }
> > +
> > + // cleanup
> > + free(namelist[i]);
> > + }
> > + // cleanup
> > + free(namelist);
> > +}
> > +# else
> > +
> > +// TODO: needs win32 implementation using FindFirstFile
> > +void AbiCollab_Regression::_findRegressionFiles(std::vector<std::string>& files)
> > +{
> > +}
> > +
> > +#endif
> >
> > Added: abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.h
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.h (rev 0)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/AbiCollab_Regression.h 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -0,0 +1,37 @@
> > +/*
> > + * AbiCollab - Code to enable the modification of remote documents.
> > + * Copyright (C) 2007 by One Laptop Per Child
> > + *
> > + * This program 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.
> > + *
> > + * This program 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 this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > + * 02111-1307, USA.
> > + */
> > +
> > +#ifndef ABI_COLLAB_REGRESSION_H
> > +#define ABI_COLLAB_REGRESSION_H
> > +
> > +#include <vector>
> > +
> > +#include "ut_types.h"
> > +
> > +class ABI_EXPORT AbiCollab_Regression
> > +{
> > +public:
> > + bool execute();
> > +
> > +private:
> > + void _findRegressionFiles(std::vector<std::string>& files);
> > +};
> > +
> > +#endif /* ABI_COLLAB_REGRESSION_H */
> >
> > Deleted: abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.cpp
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.cpp 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.cpp 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -1,209 +0,0 @@
> > -/*
> > - * AbiCommand - Abiword plugin for a command line interface
> > - * Copyright (C) 2002 by Martin Sevior
> > - * Copyright (C) 2005 by Dom Lachowicz
> > - *
> > - * This program 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.
> > - *
> > - * This program 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 this program; if not, write to the Free Software
> > - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > - * 02111-1307, USA.
> > - */
> > -
> > -#ifdef ABI_PLUGIN_BUILTIN
> > -#define abi_plugin_register abipgn_abicommand_register
> > -#define abi_plugin_unregister abipgn_abicommand_unregister
> > -#define abi_plugin_supports_version abipgn_abicommand_supports_version
> > -#endif
> > -
> > -#include <stdio.h>
> > -#include <string.h>
> > -#include <stdlib.h>
> > -#include <readline/readline.h>
> > -#include <readline/history.h>
> > -#include <sys/types.h>
> > -#include <errno.h>
> > -
> > -#include <glib.h>
> > -
> > -#include "xap_Module.h"
> > -#include "xap_App.h"
> > -#include "xap_Frame.h"
> > -#include "fv_View.h"
> > -#include "ev_EditMethod.h"
> > -#include "ie_imp.h"
> > -#include "ie_exp.h"
> > -#include "ie_types.h"
> > -#include "ap_Convert.h"
> > -#include "ap_UnixApp.h"
> > -#include "gr_UnixNullGraphics.h"
> > -#include "ap_UnixFrame.h"
> > -#include "gr_DrawArgs.h"
> > -
> > -#include "CommandLine.h"
> > -
> > -/*!
> > - * Code liberally copied and pasted from AbiCommand
> > - */
> > -CommandLine::CommandLine (void) :
> > - m_pCurDoc (NULL),
> > - m_pCurFile (new UT_UTF8String),
> > - m_pCurFrame (NULL),
> > - m_pCurView (NULL),
> > - m_pG (NULL),
> > - m_pLayout (NULL),
> > - m_bViewDoc (false),
> > - m_bRunAsServer (false),
> > - m_iPID (0),
> > - m_sErrorFile ("")
> > -{
> > - m_pApp = XAP_App::getApp ();
> > - m_pApp->getGraphicsFactory()->registerAsDefault(GRID_UNIX_NULL,true);
> > -}
> > -
> > -
> > -CommandLine::~CommandLine (void)
> > -{
> > - deleteCurrentDoc ();
> > - DELETEP (m_pCurFile);
> > -}
> > -
> > -void
> > -CommandLine::deleteCurrentDoc (void)
> > -{
> > - //
> > - // Delete the current view, frame and document.
> > - //
> > - bool bUnref = (m_pCurFrame == NULL);
> > -
> > - if (m_pCurFrame != NULL)
> > - m_pApp->forgetFrame (m_pCurFrame);
> > -
> > - //
> > - // Deleting the frame also deletes the layout, view and graphics classes
> > - //
> > - DELETEP (m_pCurFrame);
> > - if (bUnref)
> > - {
> > - UNREFP (m_pCurDoc);
> > - }
> > -
> > - m_pCurView = NULL;
> > - m_pG = NULL;
> > - m_pLayout = NULL;
> > - m_pCurView = NULL;
> > -}
> > -
> > -PD_Document * CommandLine::getCurrentDocument(void)
> > -{
> > - return m_pCurDoc;
> > -}
> > -
> > -/*!
> > - * Load the document identified by the path sPathToDoc into Abiword
> > - */
> > -bool CommandLine::loadDocument(UT_UTF8String & sPathToDoc)
> > -{
> > - //
> > - // Load in a document
> > - //
> > -
> > - PD_Document *pDoc = new PD_Document (m_pApp);
> > -
> > - UT_Error error = pDoc->readFromFile (sPathToDoc.utf8_str (), IEFT_Unknown);
> > -
> > - if (error != UT_OK)
> > - {
> > - UNREFP (pDoc);
> > - printf ("Error loading %s error %d \n", sPathToDoc.utf8_str (),error);
> > - return false;
> > - }
> > - replaceDocument (pDoc);
> > - m_pCurFile->assign (sPathToDoc.utf8_str ());
> > - return true;
> > -}
> > -
> > -/*!
> > - * Create a new Document
> > - */
> > -bool CommandLine::newDocument(void)
> > -{
> > - //
> > - // New document
> > - //
> > -
> > - PD_Document *pDoc = new PD_Document (m_pApp);
> > -
> > - UT_Error error = pDoc->newDocument ();
> > -
> > - if (error != UT_OK)
> > - {
> > - UNREFP (pDoc);
> > - printf ("Error creating new document error %d \n", error);
> > - return false;;
> > - }
> > -
> > - replaceDocument (pDoc);
> > - m_pCurFile->assign ("");
> > -
> > - return true;
> > -}
> > -
> > -
> > -void
> > -CommandLine::nullUpdate (void)
> > -{
> > - if (m_bViewDoc)
> > - {
> > - UT_uint32 i = 0;
> > -
> > - for (i = 0; i < 5; i++)
> > - gtk_main_iteration ();
> > - }
> > -}
> > -
> > -//
> > -// Doc loaded OK, delete the old stuff, put in the new stuff
> > -//
> > -bool
> > -CommandLine::replaceDocument (PD_Document * pDoc)
> > -{
> > - //
> > - // Delete the current document.
> > - //
> > - deleteCurrentDoc ();
> > -
> > - //
> > - // Put the new document in place.
> > - //
> > - m_pCurDoc = pDoc;
> > - XAP_UnixApp *pUnixApp = static_cast < XAP_UnixApp * >(m_pApp);
> > -
> > - m_pCurFrame = new AP_UnixFrame();
> > - UT_UTF8String extension (".bak~");
> > -
> > - m_pCurFrame->setAutoSaveFileExt (extension.utf8_str ());
> > - UT_DEBUGMSG(("Font Manager = %x \n",pUnixApp->getFontManager()));
> > - GR_UnixNullGraphicsAllocInfo ai ();
> > -
> > - m_pG = (UnixNull_Graphics *) m_pApp->newGraphics (ai);
> > -
> > - m_pLayout = new FL_DocLayout (m_pCurDoc, static_cast < GR_Graphics * >(m_pG));
> > - m_pCurView = new FV_View (m_pApp, m_pCurFrame, m_pLayout);
> > - m_pCurFrame->setView (static_cast < AV_View * >(m_pCurView));
> > - m_pCurFrame->setDoc (static_cast < AD_Document * >(m_pCurDoc));
> > - m_pLayout->fillLayouts ();
> > - static_cast < FV_View * >(m_pCurView)->setPoint (2);
> > -
> > - return true;
> > -}
> > -
> >
> > Deleted: abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.h
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.h 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/CommandLine.h 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -1,72 +0,0 @@
> > -/*
> > - * AbiCommand - Abiword plugin for a command line interface
> > - * Copyright (C) 2002 by Martin Sevior
> > - *
> > - * This program 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.
> > - *
> > - * This program 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 this program; if not, write to the Free Software
> > - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> > - * 02111-1307, USA.
> > - */
> > -
> > -#ifndef PLUGIN_COMMANDLINE_H
> > -#define PLUGIN_COMMANDLINE_H
> > -#include "ut_string_class.h"
> > -class PD_Document;
> > -class AP_UnixFrame;
> > -class AV_View;
> > -class UnixNull_Graphics;
> > -class FL_DocLayout;
> > -class XAP_App;
> > -class UT_UTF8String;
> > -
> > -class ABI_EXPORT CommandLine
> > -{
> > -public:
> > - CommandLine(void);
> > - ~CommandLine(void);
> > - bool replaceDocument(PD_Document * pDoc);
> > - bool loadDocument(UT_UTF8String & sPathToDoc);
> > - bool newDocument(void);
> > - PD_Document * getCurrentDocument();
> > - void nullUpdate();
> > - bool removeGraphicalView(void);
> > - void deleteCurrentDoc(void);
> > - bool viewDoc(void);
> > -private:
> > - PD_Document * m_pCurDoc;
> > - UT_UTF8String * m_pCurFile;
> > - AP_UnixFrame * m_pCurFrame;
> > - AV_View * m_pCurView;
> > - UnixNull_Graphics * m_pG;
> > - FL_DocLayout * m_pLayout;
> > - XAP_App * m_pApp;
> > - bool m_bViewDoc;
> > - bool m_bRunAsServer;
> > - UT_uint32 m_iPID;
> > - UT_UTF8String m_sErrorFile;
> > -
> > -};
> > -
> > -#endif /* PLUGIN_COMMANDLINE_H */
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> > -
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/core/session/xp/GNUmakefile.am
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/GNUmakefile.am 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/GNUmakefile.am 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -45,7 +45,9 @@
> > AbiCollab_ImportRuleSet.cpp \
> > AbiCollab_Export.cpp \
> > AbiCollab_Export.h \
> > + AbiCollab_Regression.cpp \
> > DiskSessionViewer.cpp \
> > + AbiCollab_Command.cpp \
> > AbiCollab.h \
> > AbiCollab_Import.h \
> > AbiCollab_ImportRuleSet.h \
> > @@ -53,7 +55,8 @@
> > AbiCollab_Plugin.h \
> > AbiCollabSessionManager.h \
> > DiskSessionRecorder.h \
> > - CommandLine.h
> > + AbiCollab_Regression.h \
> > + AbiCollab_Command.h
> >
> > libAbiCollab_la_LIBADD = \
> > ../../../backends/xp/libAbiCollabBackends.la \
> >
> > Modified: abiword-plugins/trunk/tools/abicollab/core/session/xp/Makefile
> > ===================================================================
> > --- abiword-plugins/trunk/tools/abicollab/core/session/xp/Makefile 2007-10-16 11:40:51 UTC (rev 22101)
> > +++ abiword-plugins/trunk/tools/abicollab/core/session/xp/Makefile 2007-10-16 12:26:55 UTC (rev 22102)
> > @@ -28,8 +28,9 @@
> > AbiCollab_ImportRuleSet.cpp \
> > AbiCollab_Plugin.cpp \
> > AbiCollabSessionManager.cpp \
> > - DiskSessionViewer.cpp
> > -# CommandLine.cpp
> > + AbiCollab_Regression.cpp \
> > + DiskSessionViewer.cpp \
> > + AbiCollab_Command.cpp
> >
> >
> > INCLUDES+= -I$(shell pwd) \
> >
> > -----------------------------------------------
> > To unsubscribe from this list, send a message to
> > abisource-cvs-commit-request@abisource.com with the word
> > unsubscribe in the message body.
> >
> >
>
>
Received on Wed Oct 17 21:29:07 2007

This archive was generated by hypermail 2.1.8 : Wed Oct 17 2007 - 21:29:07 CEST