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 K_EXPORT_COMPONENT_FACTORY( libkatepart, KateFactoryPublic )
00057
00058 KateFactory *KateFactory::s_self = 0;
00059
00060 KateFactory::KateFactory ()
00061 : m_aboutData ("katepart", I18N_NOOP("Kate Part"), KATEPART_VERSION,
00062 I18N_NOOP( "Embeddable editor component" ), KAboutData::License_LGPL_V2,
00063 I18N_NOOP( "(c) 2000-2004 The Kate Authors" ), 0, "http:
00064 , m_instance (&m_aboutData)
00065 , m_plugins (KTrader::self()->query("KTextEditor/Plugin"))
00066 {
00067
00068 s_self = this;
00069
00070
00071
00072
00073 m_aboutData.addAuthor ("Christoph Cullmann", I18N_NOOP("Maintainer"), "cullmann@kde.org", "http://www.babylon2k.de");
00074 m_aboutData.addAuthor ("Anders Lund", I18N_NOOP("Core Developer"), "anders@alweb.dk", "http://www.alweb.dk");
00075 m_aboutData.addAuthor ("Joseph Wenninger", I18N_NOOP("Core Developer"), "jowenn@kde.org","http://stud3.tuwien.ac.at/~e9925371");
00076 m_aboutData.addAuthor ("Hamish Rodda",I18N_NOOP("Core Developer"), "rodda@kde.org");
00077 m_aboutData.addAuthor ("Waldo Bastian", I18N_NOOP( "The cool buffersystem" ), "bastian@kde.org" );
00078 m_aboutData.addAuthor ("Charles Samuels", I18N_NOOP("The Editing Commands"), "charles@kde.org");
00079 m_aboutData.addAuthor ("Matt Newell", I18N_NOOP("Testing, ..."), "newellm@proaxis.com");
00080 m_aboutData.addAuthor ("Michael Bartl", I18N_NOOP("Former Core Developer"), "michael.bartl1@chello.at");
00081 m_aboutData.addAuthor ("Michael McCallum", I18N_NOOP("Core Developer"), "gholam@xtra.co.nz");
00082 m_aboutData.addAuthor ("Jochen Wilhemly", I18N_NOOP( "KWrite Author" ), "digisnap@cs.tu-berlin.de" );
00083 m_aboutData.addAuthor ("Michael Koch",I18N_NOOP("KWrite port to KParts"), "koch@kde.org");
00084 m_aboutData.addAuthor ("Christian Gebauer", 0, "gebauer@kde.org" );
00085 m_aboutData.addAuthor ("Simon Hausmann", 0, "hausmann@kde.org" );
00086 m_aboutData.addAuthor ("Glen Parker",I18N_NOOP("KWrite Undo History, Kspell integration"), "glenebob@nwlink.com");
00087 m_aboutData.addAuthor ("Scott Manson",I18N_NOOP("KWrite XML Syntax highlighting support"), "sdmanson@alltel.net");
00088 m_aboutData.addAuthor ("John Firebaugh",I18N_NOOP("Patches and more"), "jfirebaugh@kde.org");
00089 m_aboutData.addAuthor ("Dominik Haumann", I18N_NOOP("Developer & Highlight wizard"), "dhdev@gmx.de");
00090
00091 m_aboutData.addCredit ("Matteo Merli",I18N_NOOP("Highlighting for RPM Spec-Files, Perl, Diff and more"), "merlim@libero.it");
00092 m_aboutData.addCredit ("Rocky Scaletta",I18N_NOOP("Highlighting for VHDL"), "rocky@purdue.edu");
00093 m_aboutData.addCredit ("Yury Lebedev",I18N_NOOP("Highlighting for SQL"),"");
00094 m_aboutData.addCredit ("Chris Ross",I18N_NOOP("Highlighting for Ferite"),"");
00095 m_aboutData.addCredit ("Nick Roux",I18N_NOOP("Highlighting for ILERPG"),"");
00096 m_aboutData.addCredit ("Carsten Niehaus", I18N_NOOP("Highlighting for LaTeX"),"");
00097 m_aboutData.addCredit ("Per Wigren", I18N_NOOP("Highlighting for Makefiles, Python"),"");
00098 m_aboutData.addCredit ("Jan Fritz", I18N_NOOP("Highlighting for Python"),"");
00099 m_aboutData.addCredit ("Daniel Naber","","");
00100 m_aboutData.addCredit ("Roland Pabel",I18N_NOOP("Highlighting for Scheme"),"");
00101 m_aboutData.addCredit ("Cristi Dumitrescu",I18N_NOOP("PHP Keyword/Datatype list"),"");
00102 m_aboutData.addCredit ("Carsten Pfeiffer", I18N_NOOP("Very nice help"), "");
00103 m_aboutData.addCredit (I18N_NOOP("All people who have contributed and I have forgotten to mention"),"","");
00104
00105 m_aboutData.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"), I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));
00106
00107
00108
00109
00110 m_dirWatch = new KDirWatch ();
00111
00112
00113
00114
00115 m_fileTypeManager = new KateFileTypeManager ();
00116
00117
00118
00119
00120 m_schemaManager = new KateSchemaManager ();
00121
00122
00123 m_documentConfig = new KateDocumentConfig ();
00124 m_viewConfig = new KateViewConfig ();
00125 m_rendererConfig = new KateRendererConfig ();
00126
00127
00128
00129
00130
00131 KateCmd::self()->registerCommand (new KateCommands::CoreCommands());
00132 KateCmd::self()->registerCommand (new KateCommands::SedReplace ());
00133 KateCmd::self()->registerCommand (new KateCommands::Character ());
00134 KateCmd::self()->registerCommand (new KateCommands::Goto ());
00135 KateCmd::self()->registerCommand (new KateCommands::Date ());
00136 }
00137
00138 KateFactory::~KateFactory()
00139 {
00140 delete m_documentConfig;
00141 delete m_viewConfig;
00142 delete m_rendererConfig;
00143
00144 delete m_fileTypeManager;
00145 delete m_schemaManager;
00146
00147 delete m_dirWatch;
00148
00149 }
00150
00151 static KStaticDeleter<KateFactory> sdFactory;
00152
00153 KateFactory *KateFactory::self ()
00154 {
00155 if (!s_self)
00156 sdFactory.setObject(s_self, new KateFactory ());
00157
00158 return s_self;
00159 }
00160
00161 KParts::Part *KateFactory::createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *_classname, const QStringList & )
00162 {
00163 QCString classname( _classname );
00164 bool bWantSingleView = ( classname != "KTextEditor::Document" && classname != "Kate::Document" );
00165 bool bWantBrowserView = ( classname == "Browser/View" );
00166 bool bWantReadOnly = (bWantBrowserView || ( classname == "KParts::ReadOnlyPart" ));
00167
00168 KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, widgetName, parent, name);
00169 part->setReadWrite( !bWantReadOnly );
00170
00171 return part;
00172 }
00173
00174 void KateFactory::registerDocument ( KateDocument *doc )
00175 {
00176 m_documents.append( doc );
00177 }
00178
00179 void KateFactory::deregisterDocument ( KateDocument *doc )
00180 {
00181 m_documents.removeRef( doc );
00182 }
00183
00184 void KateFactory::registerView ( KateView *view )
00185 {
00186 m_views.append( view );
00187 }
00188
00189 void KateFactory::deregisterView ( KateView *view )
00190 {
00191 m_views.removeRef( view );
00192 }
00193
00194 void KateFactory::registerRenderer ( KateRenderer *renderer )
00195 {
00196 m_renderers.append( renderer );
00197 }
00198
00199 void KateFactory::deregisterRenderer ( KateRenderer *renderer )
00200 {
00201 m_renderers.removeRef( renderer );
00202 }
00203
00204