20 #ifndef __kate_jscript_h__
21 #define __kate_jscript_h__
23 #include "../interfaces/document.h"
24 #include "kateindentscriptabstracts.h"
71 KJS::ObjectImp *
wrapDocument (KJS::ExecState *exec, KateDocument *doc);
79 KJS::ObjectImp *
wrapView (KJS::ExecState *exec, KateView *view);
90 bool execute (KateView *view,
const TQString &script, TQString &errorMsg);
127 inline TQString desktopFilename () {
return filename.left(filename.length()-2).append (
"desktop"); }
143 bool desktopFileExists;
147 KateJScriptManager ();
148 ~KateJScriptManager ();
155 void collectScripts (
bool force =
false);
168 bool exec(
class Kate::View *view,
const TQString &cmd, TQString &errorMsg );
177 bool help(
class Kate::View *view,
const TQString &cmd, TQString &msg );
189 TQDict<KateJScriptManager::Script> m_scripts;
192 class KateIndentJScriptImpl:
public KateIndentScriptImplAbstract {
194 KateIndentJScriptImpl(
const TQString& internalName,
195 const TQString &filePath,
const TQString &niceName,
196 const TQString ©right,
double version);
197 ~KateIndentJScriptImpl();
199 virtual bool processChar(
class Kate::View *view, TQChar c, TQString &errorMsg );
201 virtual bool processNewline(
class Kate::View *view,
const KateDocCursor &begin,
bool needcontinue, TQString &errorMsg );
203 virtual void decRef();
205 KateJSView *m_viewWrapper;
206 KateJSDocument *m_docWrapper;
207 KJS::Object *m_indenter;
208 KJS::Interpreter *m_interpreter;
209 bool setupInterpreter(TQString &errorMsg);
210 void deleteInterpreter();
213 class KateIndentJScriptManager:
public KateIndentScriptManagerAbstract
217 KateIndentJScriptManager ();
218 virtual ~KateIndentJScriptManager ();
219 virtual KateIndentScript script(
const TQString &scriptname);
225 void collectScripts (
bool force =
false);
226 void parseScriptHeader(
const TQString &filePath,
227 TQString *niceName,TQString *copyright,
double *version);
228 TQDict<KateIndentJScriptImpl> m_scripts;
Cursor class with a pointer to its document.
KJS::ObjectImp * wrapDocument(KJS::ExecState *exec, KateDocument *doc)
creates a JS wrapper object for given KateDocument
KJS::Object * m_global
global object of interpreter
bool execute(KateView *view, const TQString &script, TQString &errorMsg)
execute given script the script will get the doc and view exposed via document and view object in glo...
virtual TQStringList cmds()=0
Pure text start part of the commands which can be handled by this object which means i...
The Kate::View text editor interface.
virtual bool exec(View *view, const TQString &cmd, TQString &msg)=0
Execute this command for the given view and cmd string, return a bool about success, msg for status.
KJS::Object * m_view
object for view
Whole Kate Part scripting in one classs Allow subclassing to allow specialized scripting engine for i...
KateJScript()
generate new global interpreter for part scripting
Cool, this is all we need here.
KJS::Interpreter * m_interpreter
js interpreter
virtual bool help(View *view, const TQString &cmd, TQString &msg)=0
Shows help for the given view and cmd string, return a bool about success, msg for status...
KJS::Object * m_document
object for document
KJS::ObjectImp * wrapView(KJS::ExecState *exec, KateView *view)
creates a JS wrapper object for given KateView
virtual ~KateJScript()
be destructive