kate Library API Documentation

katefactory.cpp

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #include "katefactory.h"
00020 
00021 #include "katedocument.h"
00022 #include "kateview.h"
00023 #include "katerenderer.h"
00024 #include "katecmds.h"
00025 #include "katefiletype.h"
00026 #include "kateschema.h"
00027 #include "kateconfig.h"
00028 
00029 #include "../interfaces/katecmd.h"
00030 
00031 #include <klocale.h>
00032 #include <kdirwatch.h>
00033 #include <kstaticdeleter.h>
00034 
00038 class KateFactoryPublic : public KParts::Factory
00039 {
00040   public:
00041     KateFactoryPublic ()
00042     {
00043     }
00044 
00045     ~KateFactoryPublic ()
00046     {
00047     }
00048 
00049     KParts::Part *createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *classname, const QStringList &args )
00050     {
00051       return KateFactory::self()->createPartObject (parentWidget, widgetName, parent, name, classname, args);
00052     }
00053 };
00054 
00055 extern "C"
00056 {
00057   void *init_libkatepart()
00058   {
00059     return new KateFactoryPublic ();
00060   }
00061 }
00062 
00063 KateFactory *KateFactory::s_self = 0;
00064 
00065 KateFactory::KateFactory ()
00066  : m_aboutData ("katepart", I18N_NOOP("Kate Part"), "2.2",
00067              I18N_NOOP( "Embeddable editor component" ), KAboutData::License_LGPL_V2,
00068              I18N_NOOP( "(c) 2000-2003 The Kate Authors" ), 0, "http://kate.kde.org")
00069  , m_instance (&m_aboutData)
00070  , m_plugins (KTrader::self()->query("KTextEditor/Plugin"))
00071 {
00072   // set s_self
00073   s_self = this;
00074 
00075   //
00076   // fill about data
00077   //
00078   m_aboutData.addAuthor ("Christoph Cullmann", I18N_NOOP("Maintainer"), "cullmann@kde.org", "http://www.babylon2k.de");
00079   m_aboutData.addAuthor ("Anders Lund", I18N_NOOP("Core Developer"), "anders@alweb.dk", "http://www.alweb.dk");
00080   m_aboutData.addAuthor ("Joseph Wenninger", I18N_NOOP("Core Developer"), "jowenn@kde.org","http://stud3.tuwien.ac.at/~e9925371");
00081   m_aboutData.addAuthor ("Hamish Rodda",I18N_NOOP("Core Developer"), "rodda@kde.org");
00082   m_aboutData.addAuthor ("Waldo Bastian", I18N_NOOP( "The cool buffersystem" ), "bastian@kde.org" );
00083   m_aboutData.addAuthor ("Charles Samuels", I18N_NOOP("The Editing Commands"), "charles@kde.org");
00084   m_aboutData.addAuthor ("Matt Newell", I18N_NOOP("Testing, ..."), "newellm@proaxis.com");
00085   m_aboutData.addAuthor ("Michael Bartl", I18N_NOOP("Former Core Developer"), "michael.bartl1@chello.at");
00086   m_aboutData.addAuthor ("Michael McCallum", I18N_NOOP("Core Developer"), "gholam@xtra.co.nz");
00087   m_aboutData.addAuthor ("Jochen Wilhemly", I18N_NOOP( "KWrite Author" ), "digisnap@cs.tu-berlin.de" );
00088   m_aboutData.addAuthor ("Michael Koch",I18N_NOOP("KWrite port to KParts"), "koch@kde.org");
00089   m_aboutData.addAuthor ("Christian Gebauer", 0, "gebauer@kde.org" );
00090   m_aboutData.addAuthor ("Simon Hausmann", 0, "hausmann@kde.org" );
00091   m_aboutData.addAuthor ("Glen Parker",I18N_NOOP("KWrite Undo History, Kspell integration"), "glenebob@nwlink.com");
00092   m_aboutData.addAuthor ("Scott Manson",I18N_NOOP("KWrite XML Syntax highlighting support"), "sdmanson@alltel.net");
00093   m_aboutData.addAuthor ("John Firebaugh",I18N_NOOP("Patches and more"), "jfirebaugh@kde.org");
00094 
00095   m_aboutData.addCredit ("Matteo Merli",I18N_NOOP("Highlighting for RPM Spec-Files, Perl, Diff and more"), "merlim@libero.it");
00096   m_aboutData.addCredit ("Rocky Scaletta",I18N_NOOP("Highlighting for VHDL"), "rocky@purdue.edu");
00097   m_aboutData.addCredit ("Yury Lebedev",I18N_NOOP("Highlighting for SQL"),"");
00098   m_aboutData.addCredit ("Chris Ross",I18N_NOOP("Highlighting for Ferite"),"");
00099   m_aboutData.addCredit ("Nick Roux",I18N_NOOP("Highlighting for ILERPG"),"");
00100   m_aboutData.addCredit ("Carsten Niehaus", I18N_NOOP("Highlighting for LaTeX"),"");
00101   m_aboutData.addCredit ("Per Wigren", I18N_NOOP("Highlighting for Makefiles, Python"),"");
00102   m_aboutData.addCredit ("Jan Fritz", I18N_NOOP("Highlighting for Python"),"");
00103   m_aboutData.addCredit ("Daniel Naber","","");
00104   m_aboutData.addCredit ("Roland Pabel",I18N_NOOP("Highlighting for Scheme"),"");
00105   m_aboutData.addCredit ("Cristi Dumitrescu",I18N_NOOP("PHP Keyword/Datatype list"),"");
00106   m_aboutData.addCredit ("Carsten Presser", I18N_NOOP("Betatest"), "mord-slime@gmx.de");
00107   m_aboutData.addCredit ("Jens Haupert", I18N_NOOP("Betatest"), "haupert@babylon2k.de");
00108   m_aboutData.addCredit ("Carsten Pfeiffer", I18N_NOOP("Very nice help"), "");
00109   m_aboutData.addCredit (I18N_NOOP("All people who have contributed and I have forgotten to mention"),"","");
00110 
00111   m_aboutData.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"), I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));
00112 
00113   //
00114   // dir watch
00115   //
00116   m_dirWatch = new KDirWatch ();
00117   
00118   //
00119   // filetype man
00120   //
00121   m_fileTypeManager = new KateFileTypeManager ();
00122 
00123   //
00124   // schema man
00125   //
00126   m_schemaManager = new KateSchemaManager ();
00127 
00128   // config objects
00129   m_documentConfig = new KateDocumentConfig ();
00130   m_viewConfig = new KateViewConfig ();
00131   m_rendererConfig = new KateRendererConfig ();
00132 
00133   //
00134   // init the cmds
00135   //
00136   KateCmd::self()->registerCommand (new KateCommands::CoreCommands());
00137   KateCmd::self()->registerCommand (new KateCommands::SedReplace ());
00138   KateCmd::self()->registerCommand (new KateCommands::Character ());
00139   KateCmd::self()->registerCommand (new KateCommands::Goto ());
00140   KateCmd::self()->registerCommand (new KateCommands::Date ());
00141 }
00142 
00143 KateFactory::~KateFactory()
00144 {
00145   delete m_documentConfig;
00146   delete m_viewConfig;
00147   delete m_rendererConfig;
00148 
00149   delete m_fileTypeManager;
00150   delete m_schemaManager;
00151 
00152   delete m_dirWatch;
00153 }
00154 
00155 static KStaticDeleter<KateFactory> sdFactory;
00156 
00157 KateFactory *KateFactory::self ()
00158 {
00159   if (!s_self)
00160     sdFactory.setObject(s_self, new KateFactory ());
00161 
00162   return s_self;
00163 }
00164 
00165 KParts::Part *KateFactory::createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *classname, const QStringList & )
00166 {
00167   bool bWantSingleView = !( classname == QString("KTextEditor::Document") );
00168   bool bWantBrowserView = ( classname == QString("Browser/View") );
00169   bool bWantReadOnly = (bWantBrowserView || ( classname == QString("KParts::ReadOnlyPart") ));
00170 
00171   KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, widgetName, parent, name);
00172   part->setReadWrite( !bWantReadOnly );
00173 
00174   return part;
00175 }
00176 
00177 void KateFactory::registerDocument ( KateDocument *doc )
00178 {
00179   m_documents.append( doc );
00180 }
00181 
00182 void KateFactory::deregisterDocument ( KateDocument *doc )
00183 {
00184   m_documents.removeRef( doc );
00185 }
00186 
00187 void KateFactory::registerView ( KateView *view )
00188 {
00189   m_views.append( view );
00190 }
00191 
00192 void KateFactory::deregisterView ( KateView *view )
00193 {
00194   m_views.removeRef( view );
00195 }
00196 
00197 void KateFactory::registerRenderer ( KateRenderer  *renderer )
00198 {
00199   m_renderers.append( renderer );
00200 }
00201 
00202 void KateFactory::deregisterRenderer ( KateRenderer  *renderer )
00203 {
00204   m_renderers.removeRef( renderer );
00205 }
00206 
00207 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 30 05:22:38 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003