SF.net SVN: geany-plugins:[329] trunk/geanylua
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Dec 5 13:34:42 UTC 2008
Revision: 329
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=329&view=rev
Author: ntrel
Date: 2008-12-05 13:34:41 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
Update to Geany API v115.
Modified Paths:
--------------
trunk/geanylua/ChangeLog
trunk/geanylua/geanylua.c
trunk/geanylua/glspi.h
trunk/geanylua/glspi_app.c
trunk/geanylua/glspi_doc.c
trunk/geanylua/glspi_init.c
trunk/geanylua/glspi_run.c
trunk/geanylua/glspi_sci.c
trunk/geanylua/glspi_ver.h
Modified: trunk/geanylua/ChangeLog
===================================================================
--- trunk/geanylua/ChangeLog 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/ChangeLog 2008-12-05 13:34:41 UTC (rev 329)
@@ -1,3 +1,6 @@
+December 5, 2008 (ntrel)
+ Update to Geany API v115.
+
September 17, 2008 (eht16)
Fix to work with Geany API v93.
Modified: trunk/geanylua/geanylua.c
===================================================================
--- trunk/geanylua/geanylua.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/geanylua.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -34,6 +34,7 @@
#include "geany.h"
#include "plugindata.h"
#include "keybindings.h"
+#include "geanyfunctions.h"
#include <glib/gi18n.h>
@@ -180,7 +181,7 @@
if (glspi_configure) {
glspi_configure(parent);
} else {
- geany_functions->p_dialogs->show_msgbox(GTK_MESSAGE_ERROR,
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR,
_("The "PLUGIN_NAME" plugin failed to load properly.\n"
"Please check your installation.") );
}
Modified: trunk/geanylua/glspi.h
===================================================================
--- trunk/geanylua/glspi.h 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi.h 2008-12-05 13:34:41 UTC (rev 329)
@@ -22,8 +22,10 @@
#include "sciwrappers.h"
#include "keybindings.h"
#include "ui_utils.h"
+#include "editor.h"
+#include "templates.h"
-#include "pluginmacros.h"
+#include "geanyfunctions.h"
#define main_widgets geany->main_widgets
#include "glspi_ver.h"
@@ -58,7 +60,7 @@
#define DOC_REQUIRED \
- GeanyDocument *doc = p_document->get_current();\
+ GeanyDocument *doc = document_get_current();\
if (!(doc && doc->is_valid)) {return 0;}
@@ -76,14 +78,8 @@
#define push_number(L,n) lua_pushnumber(L,(lua_Number)n)
-#define sci_send_message(s,m,w,l) \
- p_sci->send_message( s,\
- (unsigned int) (m), \
- (long unsigned int) (w), \
- (long int) (l) )
-
extern GeanyData *glspi_geany_data;
#define geany_data glspi_geany_data
Modified: trunk/geanylua/glspi_app.c
===================================================================
--- trunk/geanylua/glspi_app.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_app.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -12,11 +12,7 @@
#define NEED_FAIL_ARG_TYPE
#include "glspi.h"
-#include "editor.h"
-#include "templates.h"
-
-
static gint glspi_pluginver(lua_State* L)
{
lua_pushfstring(L, _(
@@ -150,7 +146,7 @@
if (!lua_isstring(L,1) ) { return FAIL_STRING_ARG(1); }
widname=lua_tostring(L,1);
signame=lua_tostring(L,2);
- w=p_support->lookup_widget(main_widgets->window, widname);
+ w=ui_lookup_widget(main_widgets->window, widname);
if (!w) {
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
"widget \"%s\" not found for argument #1.\n "),
@@ -406,7 +402,7 @@
lua_error(L);
return 0;
}
- p_keybindings->send_command(he->group, he->key_id);
+ keybindings_send_command(he->group, he->key_id);
return 0;
}
@@ -579,13 +575,13 @@
if (lua_gettop(L)>0) {
if (!lua_isstring(L,1)) {return FAIL_STRING_ARG(1); }
prompt=lua_tostring(L,1);
- doc=p_document->get_current();
+ doc=document_get_current();
}
if (prompt && doc && doc->is_valid ) {
- gint fvl=sci_send_message(doc->editor->sci,SCI_GETFIRSTVISIBLELINE, 0,0);
- gint pos=p_sci->get_position_from_line(doc->editor->sci, fvl+1);
- sci_send_message(doc->editor->sci,SCI_CALLTIPSHOW,pos+3, (gint)prompt);
+ gint fvl=scintilla_send_message(doc->editor->sci,SCI_GETFIRSTVISIBLELINE, 0,0);
+ gint pos=sci_get_position_from_line(doc->editor->sci, fvl+1);
+ scintilla_send_message(doc->editor->sci,SCI_CALLTIPSHOW,pos+3, (gint)prompt);
}
gdk_window_add_filter(main_widgets->window->window, keygrab_cb, &km);
do {
@@ -599,7 +595,7 @@
gdk_window_remove_filter(main_widgets->window->window, keygrab_cb, &km);
if (prompt && doc && doc->is_valid) {
- p_sci->send_command(doc->editor->sci, SCI_CALLTIPCANCEL);
+ sci_send_command(doc->editor->sci, SCI_CALLTIPCANCEL);
}
km.group=0; /* reset the hijacked flag before passing to GDK */
lua_pushstring(L, gdk_keyval_name(gdk_keymap_lookup_key(NULL, &km)));
Modified: trunk/geanylua/glspi_doc.c
===================================================================
--- trunk/geanylua/glspi_doc.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_doc.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -7,11 +7,8 @@
#define NEED_FAIL_ARG_TYPES
#include "glspi.h"
-#include "editor.h"
-
-
-#define DOCS ((GeanyDocument**)(documents_array->pdata))
+#define DOCS ((GeanyDocument**)(geany->documents_array->pdata))
#define NOTEBOOK GTK_NOTEBOOK(main_widgets->notebook)
@@ -41,21 +38,21 @@
fn=lua_tostring(L, 1);
if ( '\0' == fn[0] ) { fn = NULL; }
}
- p_document->new_file(fn, NULL, NULL);
+ document_new_file(fn, NULL, NULL);
return 0;
}
/*
- Try to find the documents_array index of the specified filename.
+ Try to find the geany->documents_array index of the specified filename.
Returns -1 if the filename doesn't match any open tabs.
*/
static gint filename_to_doc_idx(const gchar*fn)
{
if (fn && *fn) {
guint i;
- for(i = 0; i < documents_array->len; i++) {
+ for(i = 0; i < geany->documents_array->len; i++) {
if fncmp(fn,DOCS[i]->file_name) {return i; }
}
}
@@ -63,11 +60,11 @@
}
-/* Converts a documents_array index to a notebook tab index */
+/* Converts a geany->documents_array index to a notebook tab index */
static gint doc_idx_to_tab_idx(gint idx)
{
return (
- (idx>=0) && ((guint)idx<documents_array->len) && DOCS[idx]->is_valid
+ (idx>=0) && ((guint)idx<geany->documents_array->len) && DOCS[idx]->is_valid
) ? gtk_notebook_page_num(NOTEBOOK, GTK_WIDGET(DOCS[idx]->editor->sci)):-1;
}
@@ -75,8 +72,8 @@
/* Returns the filename of the specified document, or NULL on bad index */
static const gchar* doc_idx_to_filename(gint idx) {
- if ( (idx >= 0 ) && ( ((guint)idx) < documents_array->len ) ) {
- GeanyDocument *doc=g_ptr_array_index(documents_array, idx);
+ if ( (idx >= 0 ) && ( ((guint)idx) < geany->documents_array->len ) ) {
+ GeanyDocument *doc=g_ptr_array_index(geany->documents_array, idx);
if (doc) { return doc->file_name?doc->file_name:GEANY_STRING_UNTITLED; }
}
return NULL;
@@ -94,7 +91,7 @@
if (idx<0) { /* Negative number refers to (absolute) GtkNotebook index */
idx=(0-idx)-1;
if (idx>=gtk_notebook_get_n_pages(NOTEBOOK)) { idx=-1;}
- } else { /* A positive number refers to the documents_array index */
+ } else { /* A positive number refers to the geany->documents_array index */
idx=doc_idx_to_tab_idx(idx-1);
}
@@ -121,7 +118,7 @@
static gint documents_closure(lua_State *L)
{
gint idx=lua_tonumber(L, lua_upvalueindex(1));
- int max=documents_array->len;
+ int max=geany->documents_array->len;
do {
/* Find next valid index, skipping invalid (closed) files */
idx++;
@@ -176,7 +173,7 @@
static gint glspi_count(lua_State* L)
{
guint i, n=0;
- for (i=0; i<documents_array->len; i++) {
+ for (i=0; i<geany->documents_array->len; i++) {
if (DOCS[i]->is_valid){n++;}
}
push_number(L,n);
@@ -190,15 +187,15 @@
gboolean status=FALSE;
if (lua_gettop(L)==0){
DOC_REQUIRED
- status=p_document->save_file(p_document->get_current(), TRUE);
+ status=document_save_file(document_get_current(), TRUE);
} else {
if (lua_isnumber(L,1)) {
gint idx=(gint)lua_tonumber(L,1)-1;
- status=p_document->save_file(DOCS[idx], TRUE);
+ status=document_save_file(DOCS[idx], TRUE);
} else {
if (lua_isstring(L,1)) {
gint idx=filename_to_doc_idx(lua_tostring(L,1));
- status=p_document->save_file(DOCS[idx], TRUE);
+ status=document_save_file(DOCS[idx], TRUE);
} else { return FAIL_STR_OR_NUM_ARG(1); }
}
}
@@ -216,7 +213,7 @@
if (lua_gettop(L)==0) {
DOC_REQUIRED
- idx=p_document->get_current()->index;
+ idx=document_get_current()->index;
} else {
if (lua_isnumber(L,1)) {
idx=lua_tonumber(L,1)-1;
@@ -227,17 +224,17 @@
}
}
if (!fn) {
- status=p_document->reload_file(DOCS[idx],NULL) ? idx : -1;
+ status=document_reload_file(DOCS[idx],NULL) ? idx : -1;
} else {
- guint len=documents_array->len;
- GeanyDocument*doc=p_document->open_file(fn,FALSE,NULL,NULL);
+ guint len=geany->documents_array->len;
+ GeanyDocument*doc=document_open_file(fn,FALSE,NULL,NULL);
status=doc?doc->index:-1;
- if ( (status>=0) && (len==documents_array->len))
+ if ( (status>=0) && (len==geany->documents_array->len))
{
/* if len doesn't change, it means we are reloading an already open file */
/* ntrel: actually, len can stay the same when reusing invalid document slots. */
- idx=p_document->get_current()->index;
- status=p_document->reload_file(DOCS[idx],NULL) ? idx : -1;
+ idx=document_get_current()->index;
+ status=document_reload_file(DOCS[idx],NULL) ? idx : -1;
}
}
push_number(L,status+1);
@@ -251,15 +248,15 @@
gboolean status=FALSE;
if (lua_gettop(L)==0){
DOC_REQUIRED
- status=p_document->close(p_document->get_current());
+ status=document_close(document_get_current());
} else {
if (lua_isnumber(L,1)) {
guint idx=(guint)lua_tonumber(L,1)-1;
- status=p_document->close(DOCS[idx]);
+ status=document_close(DOCS[idx]);
} else {
if (lua_isstring(L,1)) {
guint idx=(guint)filename_to_doc_idx(lua_tostring(L,1));
- status=p_document->close(DOCS[idx]);
+ status=document_close(DOCS[idx]);
} else { return FAIL_STR_OR_NUM_ARG(1); }
}
}
Modified: trunk/geanylua/glspi_init.c
===================================================================
--- trunk/geanylua/glspi_init.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_init.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -173,7 +173,7 @@
key=0;
mod=0;
}
- p_keybindings->set_item(KG, i, kb_activate,
+ keybindings_set_item(KG, i, kb_activate,
key,mod,KG->keys[i].name,KG->keys[i].label,NULL);
}
} else {
Modified: trunk/geanylua/glspi_run.c
===================================================================
--- trunk/geanylua/glspi_run.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_run.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -7,10 +7,7 @@
#define NEED_FAIL_ARG_TYPE
#include "glspi.h"
-#include "editor.h"
-
-
typedef gint (*KeyfileAssignFunc) (lua_State *L, GKeyFile*kf);
@@ -46,7 +43,7 @@
*/
static void repaint_scintilla(void)
{
- GeanyDocument* doc=p_document->get_current();
+ GeanyDocument* doc=document_get_current();
if ( doc && doc->is_valid ) {
gdk_window_invalidate_rect(GTK_WIDGET(doc->editor->sci)->window, NULL, TRUE);
gdk_window_process_updates(GTK_WIDGET(doc->editor->sci)->window, TRUE);
@@ -81,13 +78,13 @@
static gboolean glspi_goto_error(gchar *fn, gint line)
{
- GeanyDocument *doc=p_document->open_file(fn, FALSE, NULL, NULL);
+ GeanyDocument *doc=document_open_file(fn, FALSE, NULL, NULL);
if (doc) {
if (doc->is_valid) {
ScintillaObject*sci=doc->editor->sci;
if (sci) {
- gint pos=p_sci->get_position_from_line(sci,line-1);
- p_sci->set_current_position(sci,pos,TRUE);
+ gint pos=sci_get_position_from_line(sci,line-1);
+ sci_set_current_position(sci,pos,TRUE);
return TRUE;
}
}
Modified: trunk/geanylua/glspi_sci.c
===================================================================
--- trunk/geanylua/glspi_sci.c 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_sci.c 2008-12-05 13:34:41 UTC (rev 329)
@@ -10,24 +10,20 @@
#include "glspi.h"
#include "glspi_sci.h"
-#include "editor.h"
-
-
-
/* Get or Set the entire text of the currently active Geany document */
static gint glspi_text(lua_State* L)
{
- GeanyDocument *doc = p_document->get_current();
+ GeanyDocument *doc = document_get_current();
if (!doc) { return 0; }
if (0 == lua_gettop(L)) { /* Called with no args, GET the current text */
- gint len = p_sci->get_length(doc->editor->sci);
+ gint len = sci_get_length(doc->editor->sci);
gchar *txt = NULL;
if (len>0) {
txt = g_malloc0((guint)len+2);
- p_sci->get_text(doc->editor->sci, len+1, txt);
+ sci_get_text(doc->editor->sci, len+1, txt);
lua_pushstring(L, (const gchar *) txt);
g_free(txt);
} else {
@@ -40,7 +36,7 @@
return FAIL_STRING_ARG(1);
}
txt = lua_tostring(L, 1);
- p_sci->set_text(doc->editor->sci, txt);
+ sci_set_text(doc->editor->sci, txt);
return 0;
}
}
@@ -52,11 +48,11 @@
DOC_REQUIRED
if (0 == lua_gettop(L)) { /* Called with no args, GET the selection */
- gint len = p_sci->get_selected_text_length(doc->editor->sci);
+ gint len = sci_get_selected_text_length(doc->editor->sci);
gchar *txt = NULL;
if (len>0) {
txt = g_malloc0((guint)(len+1));
- p_sci->get_selected_text(doc->editor->sci, txt);
+ sci_get_selected_text(doc->editor->sci, txt);
lua_pushstring(L, (const gchar *) txt);
g_free(txt);
} else {
@@ -67,7 +63,7 @@
const gchar*txt=NULL;
if (!lua_isstring(L, 1)) { return FAIL_STRING_ARG(1); }
txt = lua_tostring(L, 1);
- p_sci->replace_sel(doc->editor->sci, txt);
+ sci_replace_sel(doc->editor->sci, txt);
return 0;
}
}
@@ -82,7 +78,7 @@
gboolean rectsel=FALSE;
DOC_REQUIRED
if (0==argc) {
- rectsel=sci_send_message(doc->editor->sci, SCI_SELECTIONISRECTANGLE, 0, 0);
+ rectsel=scintilla_send_message(doc->editor->sci, SCI_SELECTIONISRECTANGLE, 0, 0);
}
lua_getglobal(L, LUA_MODULE_NAME);
@@ -99,8 +95,8 @@
}
}
if (0==argc) {
- sel_end=p_sci->get_current_position(doc->editor->sci);
- sel_start=sci_send_message(doc->editor->sci, SCI_GETANCHOR, 0, 0);
+ sel_end=sci_get_current_position(doc->editor->sci);
+ sel_start=scintilla_send_message(doc->editor->sci, SCI_GETANCHOR, 0, 0);
push_number(L, sel_start);
push_number(L, sel_end);
return 2;
@@ -113,14 +109,14 @@
if (!lua_isnumber(L, 2)) { return FAIL_NUMERIC_ARG(2); }
sel_end=lua_tonumber(L,2);
}
- sci_send_message(doc->editor->sci,
+ scintilla_send_message(doc->editor->sci,
SCI_SETSELECTIONMODE, rectsel?SC_SEL_RECTANGLE:SC_SEL_STREAM, 0);
- p_sci->set_current_position(doc->editor->sci, sel_end, FALSE);
- sci_send_message(doc->editor->sci, SCI_SETANCHOR, sel_start, 0);
- p_sci->ensure_line_is_visible(doc->editor->sci,
- p_sci->get_line_from_position(doc->editor->sci, sel_end));
- p_sci->scroll_caret(doc->editor->sci);
- sci_send_message(doc->editor->sci,
+ sci_set_current_position(doc->editor->sci, sel_end, FALSE);
+ scintilla_send_message(doc->editor->sci, SCI_SETANCHOR, sel_start, 0);
+ sci_ensure_line_is_visible(doc->editor->sci,
+ sci_get_line_from_position(doc->editor->sci, sel_end));
+ sci_scroll_caret(doc->editor->sci);
+ scintilla_send_message(doc->editor->sci,
SCI_SETSELECTIONMODE, rectsel?SC_SEL_RECTANGLE:SC_SEL_STREAM, 0);
return 0;
}
@@ -131,7 +127,7 @@
static gint glspi_height(lua_State* L)
{
DOC_REQUIRED
- push_number(L, p_sci->get_line_count(doc->editor->sci));
+ push_number(L, sci_get_line_count(doc->editor->sci));
return 1;
}
@@ -140,7 +136,7 @@
static gint glspi_length(lua_State* L)
{
DOC_REQUIRED
- push_number(L, p_sci->get_length(doc->editor->sci));
+ push_number(L, sci_get_length(doc->editor->sci));
return 1;
}
@@ -151,11 +147,11 @@
{
DOC_REQUIRED
if (lua_gettop(L)==0) {
- push_number(L,p_sci->get_current_position(doc->editor->sci));
+ push_number(L,sci_get_current_position(doc->editor->sci));
return 1;
} else {
if (!lua_isnumber(L,1)) { return FAIL_NUMERIC_ARG(1); }
- p_sci->set_current_position(doc->editor->sci,(gint)lua_tonumber(L,1),TRUE);
+ sci_set_current_position(doc->editor->sci,(gint)lua_tonumber(L,1),TRUE);
return 0;
}
}
@@ -173,19 +169,19 @@
case 0:
case 1:
if (argc==0) {
- pos=p_sci->get_current_position(doc->editor->sci);
+ pos=sci_get_current_position(doc->editor->sci);
} else {
if (!lua_isnumber(L,1)) { return FAIL_NUMERIC_ARG(1); }
pos=lua_tonumber(L,1);
if ( pos < 0 ) {
pos=0;
} else {
- len=p_sci->get_length(doc->editor->sci);
+ len=sci_get_length(doc->editor->sci);
if ( pos >= len ) { pos=len-1; }
}
}
- line=p_sci->get_line_from_position(doc->editor->sci,pos);
- col=p_sci->get_col_from_position(doc->editor->sci,pos);
+ line=sci_get_line_from_position(doc->editor->sci,pos);
+ col=sci_get_col_from_position(doc->editor->sci,pos);
push_number(L,line+1);
push_number(L,col);
return 2;
@@ -196,17 +192,17 @@
if ( line < 1 ) {
line=1;
} else {
- cnt=p_sci->get_line_count(doc->editor->sci);
+ cnt=sci_get_line_count(doc->editor->sci);
if ( line > cnt ) { line=cnt; }
}
col=lua_tonumber(L,2);
if ( col < 0 ) {
col=0;
} else {
- len=p_sci->get_line_length(doc->editor->sci,line);
+ len=sci_get_line_length(doc->editor->sci,line);
if (col>=len) {col=len-1;}
}
- pos=p_sci->get_position_from_line(doc->editor->sci,line-1)+col;
+ pos=sci_get_position_from_line(doc->editor->sci,line-1)+col;
push_number(L,pos);
return 1;
}
@@ -221,9 +217,9 @@
return FAIL_BOOL_ARG(1);
}
if (lua_toboolean(L,1)) {
- p_sci->start_undo_action(doc->editor->sci);
+ sci_start_undo_action(doc->editor->sci);
} else {
- p_sci->end_undo_action(doc->editor->sci);
+ sci_end_undo_action(doc->editor->sci);
}
return 0;
}
@@ -241,13 +237,13 @@
if (!lua_isnumber(L,1)) { return FAIL_NUMERIC_ARG(1); }
pos=lua_tonumber(L,1);
} else {
- pos = p_sci->get_current_position(doc->editor->sci);
+ pos = sci_get_current_position(doc->editor->sci);
}
- linenum = p_sci->get_line_from_position(doc->editor->sci, pos);
- bol = p_sci->get_position_from_line(doc->editor->sci, linenum);
+ linenum = sci_get_line_from_position(doc->editor->sci, pos);
+ bol = sci_get_position_from_line(doc->editor->sci, linenum);
bow = pos - bol;
eow = pos - bol;
- text=p_sci->get_line(doc->editor->sci, linenum);
+ text=sci_get_line(doc->editor->sci, linenum);
lua_getglobal(L, LUA_MODULE_NAME);
if ( lua_istable(L, -1) ) {
lua_pushstring(L,tokenWordChars);
@@ -278,9 +274,9 @@
*/
static gchar* get_line_text(GeanyDocument*doc,gint linenum)
{
- gint count=p_sci->get_line_count(doc->editor->sci);
+ gint count=sci_get_line_count(doc->editor->sci);
if ((linenum>0)&&(linenum<=count)) {
- gchar *text=p_sci->get_line(doc->editor->sci, linenum-1);
+ gchar *text=sci_get_line(doc->editor->sci, linenum-1);
return text?text:g_strdup("");
} else {
return FALSE;
@@ -435,7 +431,7 @@
} else {
gint n;
for (n=0; n<count; n++) {
- p_sci->send_command(doc->editor->sci,scicmd);
+ sci_send_command(doc->editor->sci,scicmd);
}
}
return 0;
@@ -461,17 +457,17 @@
switch (lua_gettop(L)) {
case 0:
- start=p_sci->get_selection_start(doc->editor->sci);
- stop=p_sci->get_selection_end(doc->editor->sci);
+ start=sci_get_selection_start(doc->editor->sci);
+ stop=sci_get_selection_end(doc->editor->sci);
if (start>stop) { swap(&start,&stop); }
- if (start!=stop) p_sci->send_command(doc->editor->sci, SCI_COPY);
+ if (start!=stop) sci_send_command(doc->editor->sci, SCI_COPY);
push_number(L, stop-start);
return 1;
case 1:
if (!lua_isstring(L,1)) {return FAIL_STRING_ARG(1);}
content=lua_tostring(L,1);
len=strlen(content);
- if (len) { sci_send_message(doc->editor->sci,SCI_COPYTEXT,len,(gint)content); }
+ if (len) { scintilla_send_message(doc->editor->sci,SCI_COPYTEXT,len,(gint)content); }
push_number(L, len);
return 1;
default:
@@ -482,7 +478,7 @@
if (start<0) { return FAIL_UNSIGNED_ARG(1); }
if (stop <0) { return FAIL_UNSIGNED_ARG(2); }
if (start>stop) { swap(&start,&stop); }
- if (start!=stop) sci_send_message(doc->editor->sci,SCI_COPYRANGE,start,stop);
+ if (start!=stop) scintilla_send_message(doc->editor->sci,SCI_COPYRANGE,start,stop);
push_number(L, stop-start);
return 1;
}
@@ -494,12 +490,12 @@
{
gint start,stop,len;
DOC_REQUIRED
- start=p_sci->get_selection_start(doc->editor->sci);
- stop=p_sci->get_selection_end(doc->editor->sci);
- len=p_sci->get_length(doc->editor->sci);
+ start=sci_get_selection_start(doc->editor->sci);
+ stop=sci_get_selection_end(doc->editor->sci);
+ len=sci_get_length(doc->editor->sci);
if (start>stop) {swap(&start,&stop); }
- if (start!=stop) {p_sci->send_command(doc->editor->sci, SCI_CUT); }
- push_number(L,len-p_sci->get_length(doc->editor->sci));
+ if (start!=stop) {sci_send_command(doc->editor->sci, SCI_CUT); }
+ push_number(L,len-sci_get_length(doc->editor->sci));
return 1;
}
@@ -510,10 +506,10 @@
static gint glspi_paste(lua_State* L)
{
DOC_REQUIRED
- if (sci_send_message(doc->editor->sci,SCI_CANPASTE,0,0)) {
- gint len=p_sci->get_length(doc->editor->sci);
- p_sci->send_command(doc->editor->sci,SCI_PASTE);
- push_number(L,p_sci->get_length(doc->editor->sci)-len);
+ if (scintilla_send_message(doc->editor->sci,SCI_CANPASTE,0,0)) {
+ gint len=sci_get_length(doc->editor->sci);
+ sci_send_command(doc->editor->sci,SCI_PASTE);
+ push_number(L,sci_get_length(doc->editor->sci)-len);
} else {
lua_pushnil(L);
}
@@ -527,12 +523,12 @@
gint pos;
DOC_REQUIRED
if (lua_gettop(L)==0) {
- pos=p_sci->get_current_position(doc->editor->sci);
+ pos=sci_get_current_position(doc->editor->sci);
} else {
if ( !lua_isnumber(L,1) ) {return FAIL_NUMERIC_ARG(1);}
pos=lua_tonumber(L,1);
}
- push_number(L,p_sci->find_matching_brace(doc->editor->sci,pos));
+ push_number(L,sci_find_matching_brace(doc->editor->sci,pos));
return 1;
}
@@ -544,12 +540,12 @@
gint pos;
DOC_REQUIRED
if (lua_gettop(L)==0) {
- pos=p_sci->get_current_position(doc->editor->sci);
+ pos=sci_get_current_position(doc->editor->sci);
} else {
if ( !lua_isnumber(L,1) ) {return FAIL_NUMERIC_ARG(1);}
pos=lua_tonumber(L,1);
}
- push_number(L,p_sci->get_char_at(doc->editor->sci,pos));
+ push_number(L,sci_get_char_at(doc->editor->sci,pos));
return 1;
}
@@ -709,19 +705,19 @@
case SLT_TEXTRANGE: return FAIL_API;
case SLT_STRINGRESULT:
if ((he->msgid==SCI_GETTEXT)&&(wparam==0)) {
- wparam=sci_send_message(doc->editor->sci, SCI_GETLENGTH, 0,0);
+ wparam=scintilla_send_message(doc->editor->sci, SCI_GETLENGTH, 0,0);
}
switch (he->msgid) {
case SCI_GETTEXT:
if (wparam==0){
- wparam=sci_send_message(doc->editor->sci, SCI_GETLENGTH, 0,0);
+ wparam=scintilla_send_message(doc->editor->sci, SCI_GETLENGTH, 0,0);
} else { wparam++; }
break;
case SCI_GETCURLINE:
if (wparam>0) { wparam++; }
break;
}
- bufsize=sci_send_message(doc->editor->sci, he->msgid, wparam, 0);
+ bufsize=scintilla_send_message(doc->editor->sci, he->msgid, wparam, 0);
if (bufsize) {
resultbuf=g_malloc0((guint)(bufsize+1));
lparam=GPOINTER_TO_INT(resultbuf);
@@ -736,20 +732,20 @@
}
switch (he->result) {
case SLT_VOID:
- sci_send_message(doc->editor->sci, he->msgid, wparam, lparam);
+ scintilla_send_message(doc->editor->sci, he->msgid, wparam, lparam);
lua_pushnil(L);
return 1;
case SLT_INT:
if (he->lparam==SLT_STRINGRESULT) {
- sci_send_message(doc->editor->sci, he->msgid, wparam, lparam);
+ scintilla_send_message(doc->editor->sci, he->msgid, wparam, lparam);
lua_pushstring(L,resultbuf);
g_free(resultbuf);
} else {
- push_number(L, sci_send_message(doc->editor->sci, he->msgid, wparam, lparam));
+ push_number(L, scintilla_send_message(doc->editor->sci, he->msgid, wparam, lparam));
}
return 1;
case SLT_BOOL:
- lua_pushboolean(L, sci_send_message(doc->editor->sci, he->msgid, wparam, lparam));
+ lua_pushboolean(L, scintilla_send_message(doc->editor->sci, he->msgid, wparam, lparam));
return 1;
default:return FAIL_API;
}
@@ -805,7 +801,7 @@
lua_pop(L, 1);
}
- if (sci_send_message(doc->editor->sci,SCI_FINDTEXT,flags,GPOINTER_TO_INT(&ttf))!=-1) {
+ if (scintilla_send_message(doc->editor->sci,SCI_FINDTEXT,flags,GPOINTER_TO_INT(&ttf))!=-1) {
push_number(L,ttf.chrgText.cpMin);
push_number(L,ttf.chrgText.cpMax);
g_free(ttf.lpstrText);
Modified: trunk/geanylua/glspi_ver.h
===================================================================
--- trunk/geanylua/glspi_ver.h 2008-12-05 09:42:56 UTC (rev 328)
+++ trunk/geanylua/glspi_ver.h 2008-12-05 13:34:41 UTC (rev 329)
@@ -14,7 +14,7 @@
#define PLUGIN_AUTHOR "Jeff Pohlmeyer"
-#define MY_GEANY_API_VER 86
+#define MY_GEANY_API_VER 115
#define LUA_MODULE_NAME "geany"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Plugins-Commits
mailing list