Kaydet (Commit) a1da3923 authored tarafından Enrico Tröger's avatar Enrico Tröger

Added return value and tag name to the calltip.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@550 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst a35f5c41
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
Added new preferences tab for toolbar settings, several toolbar Added new preferences tab for toolbar settings, several toolbar
buttons can be hidden. buttons can be hidden.
Added Undo and Redo toolbar buttons (closes request #1519261). 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@btinternet.com> 2006-07-11 Nick Treleaven <nick.treleaven@btinternet.com>
......
...@@ -693,14 +693,14 @@ static void cb_func_edit_autocomplete(void) ...@@ -693,14 +693,14 @@ static void cb_func_edit_autocomplete(void)
{ {
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return; 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) static void cb_func_edit_calltip(void)
{ {
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return; 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) static void cb_func_edit_macrolist(void)
......
...@@ -162,7 +162,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer ...@@ -162,7 +162,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
} }
case '(': case '(':
{ // show calltips { // show calltips
sci_cb_show_calltip(sci, pos); sci_cb_show_calltip(sci, pos, idx);
break; break;
} }
case ')': case ')':
...@@ -182,7 +182,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer ...@@ -182,7 +182,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
case '{': case '{':
{ // Tex auto-closing { // Tex auto-closing
sci_cb_auto_close_bracket(sci, pos, nt->ch); // 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; break;
} }
case '}': case '}':
...@@ -190,7 +190,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer ...@@ -190,7 +190,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1); if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1);
break; break;
} }
default: sci_cb_start_auto_complete(sci, pos); default: sci_cb_start_auto_complete(sci, pos, idx);
} }
break; break;
} }
...@@ -348,18 +348,17 @@ void sci_cb_close_block(ScintillaObject *sci, gint pos) ...@@ -348,18 +348,17 @@ void sci_cb_close_block(ScintillaObject *sci, gint pos)
} }
gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos) gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx)
{ {
gint lexer; gint lexer;
gint style; gint style;
gchar word[GEANY_MAX_WORD_LENGTH]; gchar word[GEANY_MAX_WORD_LENGTH];
gint idx; TMTag *tag;
const GPtrArray *tags; const GPtrArray *tags;
if (sci == NULL) return FALSE; if (sci == NULL) return FALSE;
lexer = SSM(sci, SCI_GETLEXER, 0, 0); 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; if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return FALSE;
word[0] = '\0'; word[0] = '\0';
...@@ -389,14 +388,23 @@ gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos) ...@@ -389,14 +388,23 @@ gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos)
tags = tm_workspace_find(word, tm_tag_max_t, NULL, FALSE, doc_list[idx].file_type->lang); 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) 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; 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; gint line, line_start, line_len, line_pos, current, rootlen, startword, lexer, style;
gchar *linebuf, *root; gchar *linebuf, *root;
...@@ -449,7 +457,6 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos) ...@@ -449,7 +457,6 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos)
else else
{ // PHP, LaTeX, C and C++ tag autocompletion { // PHP, LaTeX, C and C++ tag autocompletion
gint i = 0; gint i = 0;
gint idx = document_find_by_sci(sci);
TMTagAttrType attrs[] = { tm_tag_attr_name_t, 0 }; TMTagAttrType attrs[] = { tm_tag_attr_name_t, 0 };
if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// callback func called by all editors when a signals arises // callback func called by all editors when a signals arises
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data); 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); void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line);
...@@ -40,7 +40,7 @@ void sci_cb_show_macro_list(ScintillaObject *sci); ...@@ -40,7 +40,7 @@ void sci_cb_show_macro_list(ScintillaObject *sci);
gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch); 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); void sci_cb_do_comment(gint idx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment