Revision: 105
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=105&view=rev
Author: ntrel
Date: 2008-07-10 09:57:20 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
Convert doc_array usage to documents_array.
Modified Paths:
--------------
trunk/geanylua/ChangeLog
trunk/geanylua/glspi_doc.c
Modified: trunk/geanylua/ChangeLog
===================================================================
--- trunk/geanylua/ChangeLog 2008-07-05 09:40:09 UTC (rev 104)
+++ trunk/geanylua/ChangeLog 2008-07-10 16:57:20 UTC (rev 105)
@@ -1,3 +1,6 @@
+July 10, 2008 (ntrel)
+ Convert doc_array usage to documents_array.
+
July 2, 2008 (ntrel)
Update to use document pointers.
Update MY_GEANY_API_VER now we use p_document->close().
Modified: trunk/geanylua/glspi_doc.c
===================================================================
--- trunk/geanylua/glspi_doc.c 2008-07-05 09:40:09 UTC (rev 104)
+++ trunk/geanylua/glspi_doc.c 2008-07-10 16:57:20 UTC (rev 105)
@@ -46,14 +46,14 @@
/*
- Try to find the doc_array index of the specified filename.
+ Try to find the 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 < doc_array->len; i++) {
+ for(i = 0; i < documents_array->len; i++) {
if fncmp(fn,DOCS[i]->file_name) {return i; }
}
}
@@ -61,11 +61,11 @@
}
-/* Converts a doc_array index to a notebook tab index */
+/* Converts a documents_array index to a notebook tab index */
static gint doc_idx_to_tab_idx(gint idx)
{
return (
- (idx>=0) && ((guint)idx<doc_array->len) && DOCS[idx]->is_valid
+ (idx>=0) && ((guint)idx<documents_array->len) && DOCS[idx]->is_valid
) ? gtk_notebook_page_num(NOTEBOOK, GTK_WIDGET(DOCS[idx]->sci)):-1;
}
@@ -73,8 +73,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) < doc_array->len ) ) {
- GeanyDocument *doc=g_ptr_array_index(doc_array, idx);
+ if ( (idx >= 0 ) && ( ((guint)idx) < documents_array->len ) ) {
+ GeanyDocument *doc=g_ptr_array_index(documents_array, idx);
if (doc) { return doc->file_name?doc->file_name:GEANY_STRING_UNTITLED; }
}
return NULL;
@@ -92,7 +92,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 doc_array index */
+ } else { /* A positive number refers to the documents_array index */
idx=doc_idx_to_tab_idx(idx-1);
}
@@ -119,7 +119,7 @@
static gint documents_closure(lua_State *L)
{
gint idx=lua_tonumber(L, lua_upvalueindex(1));
- int max=doc_array->len;
+ int max=documents_array->len;
do {
/* Find next valid index, skipping invalid (closed) files */
idx++;
@@ -174,7 +174,7 @@
static gint glspi_count(lua_State* L)
{
guint i, n=0;
- for (i=0; i<doc_array->len; i++) {
+ for (i=0; i<documents_array->len; i++) {
if (DOCS[i]->is_valid){n++;}
}
push_number(L,n);
@@ -227,10 +227,10 @@
if (!fn) {
status=p_document->reload_file(DOCS[idx],NULL) ? idx : -1;
} else {
- guint len=doc_array->len;
+ guint len=documents_array->len;
GeanyDocument*doc=p_document->open_file(fn,FALSE,NULL,NULL);
status=doc?doc->index:-1;
- if ( (status>=0) && (len==doc_array->len))
+ if ( (status>=0) && (len==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. */
@@ -312,7 +312,7 @@
SetTableStr("linker", BuildCmdStr(linker));
SetTableStr("exec", BuildCmdStr(run_cmd));
SetTableStr("exec2", BuildCmdStr(run_cmd2));
- SetTableNum("ftid", GPOINTER_TO_INT(doc->file_type?doc->file_type->id:GEANY_FILETYPES_ALL));
+ SetTableNum("ftid", GPOINTER_TO_INT(doc->file_type?doc->file_type->id:GEANY_FILETYPES_NONE));
SetTableStr("encoding", StrField(doc,encoding));
SetTableBool("bom",doc->has_bom);
SetTableBool("changed",doc->changed);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 102
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=102&view=rev
Author: eht16
Date: 2008-07-03 06:26:21 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Create a new dict object when the default language in the preferences dialog was changed to actually use the new language.
Modified Paths:
--------------
trunk/spellcheck/ChangeLog
trunk/spellcheck/src/spellcheck.c
Modified: trunk/spellcheck/ChangeLog
===================================================================
--- trunk/spellcheck/ChangeLog 2008-07-02 17:05:48 UTC (rev 101)
+++ trunk/spellcheck/ChangeLog 2008-07-03 13:26:21 UTC (rev 102)
@@ -1,3 +1,10 @@
+2008-07-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/spellcheck.c:
+ Create a new dict object when the default language in the preferences
+ dialog was changed to actually use the new language.
+
+
2008-06-28 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/spellcheck.c:
@@ -24,7 +31,7 @@
* src/spellcheck.c:
Compilation fixes.
* Makefile.am:
- Add html target.
+ Add HTML target.
2008-05-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/spellcheck/src/spellcheck.c
===================================================================
--- trunk/spellcheck/src/spellcheck.c 2008-07-02 17:05:48 UTC (rev 101)
+++ trunk/spellcheck/src/spellcheck.c 2008-07-03 13:26:21 UTC (rev 102)
@@ -74,12 +74,15 @@
} SpellCheck;
static SpellCheck *sc;
+
#define MAX_MENU_SUGGESTIONS 10
typedef struct
{
gint pos;
GeanyDocument *doc;
+ /* static array to keep suggestions for use as callback user data for the editing menu items */
gchar *suggs[MAX_MENU_SUGGESTIONS];
+ /* static storage for the misspelled word under the cursor when using the editing menu */
gchar *word;
} SpellClickInfo;
static SpellClickInfo clickinfo;
@@ -229,7 +232,7 @@
/* TODO do we need more than 10 suggestions? gtkspell offers additional suggestions
* in another sub menu, should we too? */
- for (i = 0; i < MIN(n_suggs, 10); i++)
+ for (i = 0; i < MIN(n_suggs, MAX_MENU_SUGGESTIONS); i++)
{
/* keep the suggestions in a static array for the callback function */
g_free(clickinfo.suggs[i]);
@@ -451,23 +454,31 @@
}
-static void on_menu_item_activate(GtkMenuItem *menuitem, gpointer gdata)
+static void init_enchant_dict()
{
- GeanyDocument *doc = p_document->get_current();
+ /* Request new dict object */
+ if (sc->dict != NULL)
+ enchant_broker_free_dict(sc->broker, sc->dict);
- /* Another language was chosen from the menu item, so make it default for this session. */
- if (gdata != NULL)
- setptr(sc->default_language, g_strdup(gdata));
-
- /* Request new dict object */
- enchant_broker_free_dict(sc->broker, sc->dict);
sc->dict = enchant_broker_request_dict(sc->broker, sc->default_language);
if (sc->dict == NULL)
{
broker_init_failed();
return;
}
+}
+
+static void on_menu_item_activate(GtkMenuItem *menuitem, gpointer gdata)
+{
+ GeanyDocument *doc = p_document->get_current();
+
+ /* Another language was chosen from the menu item, so make it default for this session. */
+ if (gdata != NULL)
+ setptr(sc->default_language, g_strdup(gdata));
+
+ init_enchant_dict();
+
perform_check(doc);
}
@@ -557,6 +568,7 @@
setptr(sc->default_language, gtk_combo_box_get_active_text(GTK_COMBO_BOX(
g_object_get_data(G_OBJECT(dialog), "combo"))));
+ init_enchant_dict();
sc->check_while_typing = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
g_object_get_data(G_OBJECT(dialog), "check"))));
@@ -666,12 +678,7 @@
locale_init();
sc->broker = enchant_broker_init();
- sc->dict = enchant_broker_request_dict(sc->broker, sc->default_language);
- if (sc->dict == NULL)
- {
- broker_init_failed();
- return;
- }
+ init_enchant_dict();
for (i = 0; i < MAX_MENU_SUGGESTIONS; i++)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.