[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kate
From: Christoph Cullmann <cullmann () kde ! org>
Date: 2005-03-12 22:15:59
Message-ID: 20050312221559.A1C0A17B90 () office ! kde ! org
[Download RAW message or body]
CVS commit by cullmann:
export little part of view
M +74 -3 part/katejscript.cpp 1.8
M +2 -1 scripts/test.js 1.3
--- kdelibs/kate/part/katejscript.cpp #1.7:1.8
@@ -56,4 +56,6 @@ QConstString UString::qconststring() con
}
+//BEGIN JS API STUFF
+
class KateJSGlobal : public KJS::ObjectImp {
public:
@@ -89,4 +91,25 @@ public:
};
+class KateJSView : public KJS::ObjectImp {
+public:
+ KateJSView (KJS::ExecState *exec, KateView *_view);
+
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+
+ static const KJS::ClassInfo info;
+
+ enum { CursorLine,
+ CursorColumn,
+ CursorColumnReal
+ };
+
+public:
+ KateView *view;
+};
+
+#include "katejscript.lut.h"
+
+//END
+
KateJScript::KateJScript ()
: m_global (new KJS::Object (new KateJSGlobal ()))
@@ -105,4 +128,5 @@ bool KateJScript::execute (KateDocument
// put some stuff into env.
m_interpreter->globalObject().put(m_interpreter->globalExec(), "document", \
KJS::Object(new KateJSDocument(m_interpreter->globalExec(), doc))); + \
m_interpreter->globalObject().put(m_interpreter->globalExec(), "view", \
KJS::Object(new KateJSView(m_interpreter->globalExec(), view)));
// run
@@ -138,9 +162,7 @@ bool KateJScript::execute (KateDocument
//BEGIN KateJSDocument
-#include "katejscript.lut.h"
-
// -------------------------------------------------------------------------
/* Source for KateJSDocumentProtoTable.
-@begin KateJSDocumentProtoTable 3
+@begin KateJSDocumentProtoTable 15
fullText KateJSDocument::FullText DontDelete|Function 0
text KateJSDocument::Text DontDelete|Function 4
@@ -233,3 +255,52 @@ KateJSDocument::KateJSDocument (KJS::Exe
//END
+//BEGIN KateJSView
+
+// -------------------------------------------------------------------------
+/* Source for KateJSViewProtoTable.
+@begin KateJSViewProtoTable 4
+ cursorLine KateJSView::CursorLine DontDelete|Function 0
+ cursorColumn KateJSView::CursorColumn DontDelete|Function 0
+ cursorColumnReal KateJSView::CursorColumnReal DontDelete|Function 0
+@end
+*/
+
+DEFINE_PROTOTYPE("KateJSView",KateJSViewProto)
+IMPLEMENT_PROTOFUNC(KateJSViewProtoFunc)
+IMPLEMENT_PROTOTYPE(KateJSViewProto,KateJSViewProtoFunc)
+
+const KJS::ClassInfo KateJSView::info = { "KateJSView", 0, 0, 0 };
+
+Value KateJSViewProtoFunc::call(KJS::ExecState *exec, KJS::Object &thisObj, const \
KJS::List &args) +{
+ KJS_CHECK_THIS( KateJSView, thisObj );
+
+ KateView *view = static_cast<KateJSView *>( thisObj.imp() )->view;
+
+ if (!view)
+ return KJS::Undefined();
+
+ switch (id)
+ {
+ case KateJSView::CursorLine:
+ return KJS::Number (view->cursorLine());
+
+ case KateJSView::CursorColumn:
+ return KJS::Number (view->cursorColumn());
+
+ case KateJSView::CursorColumnReal:
+ return KJS::Number (view->cursorColumnReal());
+ }
+
+ return KJS::Undefined();
+}
+
+KateJSView::KateJSView (KJS::ExecState *exec, KateView *_view)
+ : KJS::ObjectImp (KateJSViewProto::self(exec))
+ , view (_view)
+{
+}
+
+//END
+
// kate: space-indent on; indent-width 2; replace-tabs on;
--- kdelibs/kate/scripts/test.js #1.2:1.3
@@ -7,5 +7,6 @@
{
document.insertLine ($start+$t, document.lineLength(0));
- document.insertText ($start+$t, 1, "muh");
+ document.insertText ($start+$t, 0, " muh");
+ document.insertText ($start+$t, 0, view.cursorLine());
}
document.editEnd();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic