00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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:
00050 KParts::Part *createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *classname, const QStringList &args )
00051 {
00052 return KateFactory::self()->createPartObject (parentWidget, widgetName, parent, name, classname, args);
00053 }
00054 };
00055
00056 extern "C"
00057 {
00058 void *init_libkatepart()
00059 {
00060 return new KateFactoryPublic ();
00061 }
00062 }
00063
00064 KateFactory *KateFactory::s_self = 0;
00065
00066 KateFactory::KateFactory ()
00067 : m_aboutData ("katepart", I18N_NOOP("Kate Part"), "2.3",
00068 I18N_NOOP( "Embeddable editor component" ), KAboutData::License_LGPL_V2,
00069 I18N_NOOP( "(c) 2000-2004 The Kate Authors" ), 0, "http://kate.kde.org")
00070 , m_instance (&m_aboutData)
00071 , m_plugins (KTrader::self()->query("KTextEditor/Plugin"))
00072 {
00073
00074 s_self = this;
00075
00076
00077
00078
00079 m_aboutData.addAuthor ("Christoph Cullmann", I18N_NOOP("Maintainer"), "cullmann@kde.org", "http://www.babylon2k.de");
00080 m_aboutData.addAuthor ("Anders Lund", I18N_NOOP("Core Developer"), "anders@alweb.dk", "http://www.alweb.dk");
00081 m_aboutData.addAuthor ("Joseph Wenninger", I18N_NOOP("Core Developer"), "jowenn@kde.org","http://stud3.tuwien.ac.at/~e9925371");
00082 m_aboutData.addAuthor ("Hamish Rodda",I18N_NOOP("Core Developer"), "rodda@kde.org");
00083 m_aboutData.addAuthor ("Waldo Bastian", I18N_NOOP( "The cool buffersystem" ), "bastian@kde.org" );
00084 m_aboutData.addAuthor ("Charles Samuels", I18N_NOOP("The Editing Commands"), "charles@kde.org");
00085 m_aboutData.addAuthor ("Matt Newell", I18N_NOOP("Testing, ..."), "newellm@proaxis.com");
00086 m_aboutData.addAuthor ("Michael Bartl", I18N_NOOP("Former Core Developer"), "michael.bartl1@chello.at");
00087 m_aboutData.addAuthor ("Michael McCallum", I18N_NOOP("Core Developer"), "gholam@xtra.co.nz");
00088 m_aboutData.addAuthor ("Jochen Wilhemly", I18N_NOOP( "KWrite Author" ), "digisnap@cs.tu-berlin.de" );
00089 m_aboutData.addAuthor ("Michael Koch",I18N_NOOP("KWrite port to KParts"), "koch@kde.org");
00090 m_aboutData.addAuthor ("Christian Gebauer", 0, "gebauer@kde.org" );
00091 m_aboutData.addAuthor ("Simon Hausmann", 0, "hausmann@kde.org" );
00092 m_aboutData.addAuthor ("Glen Parker",I18N_NOOP("KWrite Undo History, Kspell integration"), "glenebob@nwlink.com");
00093 m_aboutData.addAuthor ("Scott Manson",I18N_NOOP("KWrite XML Syntax highlighting support"), "sdmanson@alltel.net");
00094 m_aboutData.addAuthor ("John Firebaugh",I18N_NOOP("Patches and more"), "jfirebaugh@kde.org");
00095 m_aboutData.addAuthor ("Dominik Haumann", I18N_NOOP("Developer & Highlight wizard"), "dhdev@gmx.de");
00096
00097 m_aboutData.addCredit ("Matteo Merli",I18N_NOOP("Highlighting for RPM Spec-Files, Perl, Diff and more"), "merlim@libero.it");
00098 m_aboutData.addCredit ("Rocky Scaletta",I18N_NOOP("Highlighting for VHDL"), "rocky@purdue.edu");
00099 m_aboutData.addCredit ("Yury Lebedev",I18N_NOOP("Highlighting for SQL"),"");
00100 m_aboutData.addCredit ("Chris Ross",I18N_NOOP("Highlighting for Ferite"),"");
00101 m_aboutData.addCredit ("Nick Roux",I18N_NOOP("Highlighting for ILERPG"),"");
00102 m_aboutData.addCredit ("Carsten Niehaus", I18N_NOOP("Highlighting for LaTeX"),"");
00103 m_aboutData.addCredit ("Per Wigren", I18N_NOOP("Highlighting for Makefiles, Python"),"");
00104 m_aboutData.addCredit ("Jan Fritz", I18N_NOOP("Highlighting for Python"),"");
00105 m_aboutData.addCredit ("Daniel Naber","","");
00106 m_aboutData.addCredit ("Roland Pabel",I18N_NOOP("Highlighting for Scheme"),"");
00107 m_aboutData.addCredit ("Cristi Dumitrescu",I18N_NOOP("PHP Keyword/Datatype list"),"");
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
00115
00116 m_dirWatch = new KDirWatch ();
00117
00118
00119
00120
00121 m_fileTypeManager = new KateFileTypeManager ();
00122
00123
00124
00125
00126 m_schemaManager = new KateSchemaManager ();
00127
00128
00129 m_documentConfig = new KateDocumentConfig ();
00130 m_viewConfig = new KateViewConfig ();
00131 m_rendererConfig = new KateRendererConfig ();
00132
00133
00134
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 QCString classname( _classname );
00168 bool bWantSingleView = ( classname != "KTextEditor::Document" && classname != "Kate::Document" );
00169 bool bWantBrowserView = ( classname == "Browser/View" );
00170 bool bWantReadOnly = (bWantBrowserView || ( classname == "KParts::ReadOnlyPart" ));
00171
00172 KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, widgetName, parent, name);
00173 part->setReadWrite( !bWantReadOnly );
00174
00175 return part;
00176 }
00177
00178 void KateFactory::registerDocument ( KateDocument *doc )
00179 {
00180 m_documents.append( doc );
00181 }
00182
00183 void KateFactory::deregisterDocument ( KateDocument *doc )
00184 {
00185 m_documents.removeRef( doc );
00186 }
00187
00188 void KateFactory::registerView ( KateView *view )
00189 {
00190 m_views.append( view );
00191 }
00192
00193 void KateFactory::deregisterView ( KateView *view )
00194 {
00195 m_views.removeRef( view );
00196 }
00197
00198 void KateFactory::registerRenderer ( KateRenderer *renderer )
00199 {
00200 m_renderers.append( renderer );
00201 }
00202
00203 void KateFactory::deregisterRenderer ( KateRenderer *renderer )
00204 {
00205 m_renderers.removeRef( renderer );
00206 }
00207
00208