SF.net SVN: geany: [550] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jul 11 17:44:50 UTC 2006


Revision: 550
Author:   eht16
Date:     2006-07-11 10:44:42 -0700 (Tue, 11 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=550&view=rev

Log Message:
-----------
Added return value and tag name to the calltip.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c
    trunk/src/sci_cb.c
    trunk/src/sci_cb.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-11 14:18:35 UTC (rev 549)
+++ trunk/ChangeLog	2006-07-11 17:44:42 UTC (rev 550)
@@ -8,6 +8,8 @@
    Added new preferences tab for toolbar settings, several toolbar
    buttons can be hidden.
    Added Undo and Redo toolbar buttons (closes request #1519261).
+ * src/sci_cb.c, src/keybindings.c:
+   Added return value and tag name to the calltip.
 
 
 2006-07-11  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2006-07-11 14:18:35 UTC (rev 549)
+++ trunk/src/keybindings.c	2006-07-11 17:44:42 UTC (rev 550)
@@ -693,14 +693,14 @@
 {
 	gint idx = document_get_cur_idx();
 	if (idx == -1 || ! doc_list[idx].is_valid) return;
-	sci_cb_start_auto_complete(doc_list[idx].sci, sci_get_current_position(doc_list[idx].sci));
+	sci_cb_start_auto_complete(doc_list[idx].sci, sci_get_current_position(doc_list[idx].sci), idx);
 }
 
 static void cb_func_edit_calltip(void)
 {
 	gint idx = document_get_cur_idx();
 	if (idx == -1 || ! doc_list[idx].is_valid) return;
-	sci_cb_show_calltip(doc_list[idx].sci, -1);
+	sci_cb_show_calltip(doc_list[idx].sci, -1, idx);
 }
 
 static void cb_func_edit_macrolist(void)

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-07-11 14:18:35 UTC (rev 549)
+++ trunk/src/sci_cb.c	2006-07-11 17:44:42 UTC (rev 550)
@@ -162,7 +162,7 @@
 				}
 				case '(':
 				{	// show calltips
-					sci_cb_show_calltip(sci, pos);
+					sci_cb_show_calltip(sci, pos, idx);
 					break;
 				}
 				case ')':
@@ -182,7 +182,7 @@
 				case '{':
 				{	// Tex auto-closing
 					sci_cb_auto_close_bracket(sci, pos, nt->ch);	// Tex auto-closing
-					sci_cb_show_calltip(sci, pos);
+					sci_cb_show_calltip(sci, pos, idx);
 					break;
 				}
 				case '}':
@@ -190,7 +190,7 @@
 					if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1);
 					break;
 				}
-				default: sci_cb_start_auto_complete(sci, pos);
+				default: sci_cb_start_auto_complete(sci, pos, idx);
 			}
 			break;
 		}
@@ -348,18 +348,17 @@
 }
 
 
-gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos)
+gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx)
 {
 	gint lexer;
 	gint style;
 	gchar word[GEANY_MAX_WORD_LENGTH];
-	gint idx;
+	TMTag *tag;
 	const GPtrArray *tags;
 
 	if (sci == NULL) return FALSE;
 
 	lexer = SSM(sci, SCI_GETLEXER, 0, 0);
-	idx = document_find_by_sci(sci);
 	if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return FALSE;
 
 	word[0] = '\0';
@@ -389,14 +388,23 @@
 	tags = tm_workspace_find(word, tm_tag_max_t, NULL, FALSE, doc_list[idx].file_type->lang);
 	if (tags->len == 1 && TM_TAG(tags->pdata[0])->atts.entry.arglist)
 	{
-		SSM(sci, SCI_CALLTIPSHOW, pos, (sptr_t) TM_TAG(tags->pdata[0])->atts.entry.arglist);
+		tag = TM_TAG(tags->pdata[0]);
+		gchar *calltip;
+		if (tag->atts.entry.var_type)
+			calltip = g_strconcat(tag->atts.entry.var_type, " ", tag->name,
+										 " ", tag->atts.entry.arglist, NULL);
+		else
+			calltip = g_strconcat(tag->name, " ", tag->atts.entry.arglist, NULL);
+
+		SSM(sci, SCI_CALLTIPSHOW, pos, (sptr_t) calltip);
+		g_free(calltip);
 	}
 
 	return TRUE;
 }
 
 
-gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos)
+gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx)
 {
 	gint line, line_start, line_len, line_pos, current, rootlen, startword, lexer, style;
 	gchar *linebuf, *root;
@@ -449,7 +457,6 @@
 	else
 	{	// PHP, LaTeX, C and C++ tag autocompletion
 		gint i = 0;
-		gint idx = document_find_by_sci(sci);
 		TMTagAttrType attrs[] = { tm_tag_attr_name_t, 0 };
 
 		if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL)

Modified: trunk/src/sci_cb.h
===================================================================
--- trunk/src/sci_cb.h	2006-07-11 14:18:35 UTC (rev 549)
+++ trunk/src/sci_cb.h	2006-07-11 17:44:42 UTC (rev 550)
@@ -26,7 +26,7 @@
 // callback func called by all editors when a signals arises
 void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
 
-gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos);
+gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx);
 
 void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line);
 
@@ -40,7 +40,7 @@
 
 gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch);
 
-gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos);
+gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx);
 
 void sci_cb_do_comment(gint idx);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list