improved tag list updating, should be a bit faster on opening files

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@322 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-05-10 23:06:47 +00:00
parent 887f75bb18
commit 7a6efd0667
3 changed files with 13 additions and 10 deletions

View File

@ -996,7 +996,7 @@ on_editor_key_press_event (GtkWidget *widget,
case 'R': case 'R':
{ {
if (event->state & GDK_CONTROL_MASK) if (event->state & GDK_CONTROL_MASK)
document_update_tag_list(idx); document_update_tag_list(idx, TRUE);
else else
ret = FALSE; ret = FALSE;
break; break;

View File

@ -574,7 +574,7 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
(readonly) ? _(", read-only") : ""); (readonly) ? _(", read-only") : "");
} }
//utils_update_tag_list(idx, TRUE); //utils_update_tag_list(idx, TRUE);
document_update_tag_list(idx); document_update_tag_list(idx, FALSE);
document_set_text_changed(idx); document_set_text_changed(idx);
#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) && defined(HAVE_FCNTL_H) #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) && defined(HAVE_FCNTL_H)
@ -896,7 +896,7 @@ void document_set_font(ScintillaObject *sci, const gchar *font_name, gint size)
} }
void document_update_tag_list(gint idx) void document_update_tag_list(gint idx, gboolean update)
{ {
// if the filetype doesn't has a tag parser or it is a new file, leave // if the filetype doesn't has a tag parser or it is a new file, leave
if (idx == -1 || ! doc_list[idx].file_type->has_tags || ! doc_list[idx].file_name) return; if (idx == -1 || ! doc_list[idx].file_type->has_tags || ! doc_list[idx].file_name) return;
@ -908,10 +908,13 @@ void document_update_tag_list(gint idx)
g_free(locale_filename); g_free(locale_filename);
if (! doc_list[idx].tm_file) return; if (! doc_list[idx].tm_file) return;
tm_workspace_add_object(doc_list[idx].tm_file); tm_workspace_add_object(doc_list[idx].tm_file);
/// TODO seems to be useless, but I'm not sure if (update)
// parse the file after setting the filetype {
//TM_SOURCE_FILE(doc_list[idx].tm_file)->lang = getNamedLanguage((doc_list[idx].file_type)->name); // parse the file after setting the filetype
//tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE); // this is necessary to switch between filetypes
TM_SOURCE_FILE(doc_list[idx].tm_file)->lang = getNamedLanguage((doc_list[idx].file_type)->name);
tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
}
utils_update_tag_list(idx, TRUE); utils_update_tag_list(idx, TRUE);
} }
else else
@ -941,7 +944,7 @@ void document_set_filetype(gint idx, filetype *type)
if (type->id > GEANY_MAX_FILE_TYPES) return; if (type->id > GEANY_MAX_FILE_TYPES) return;
doc_list[idx].file_type = type; doc_list[idx].file_type = type;
document_update_tag_list(idx); document_update_tag_list(idx, TRUE);
type->style_func_ptr(doc_list[idx].sci); type->style_func_ptr(doc_list[idx].sci);
// For C/C++/Java files, get list of typedefs for colourising // For C/C++/Java files, get list of typedefs for colourising

View File

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* $Id$ * $Id$
*/ */
@ -100,7 +100,7 @@ void document_find_next(gint, const gchar*, gint, gboolean, gboolean);
void document_set_font(ScintillaObject*, const gchar*, gint); void document_set_font(ScintillaObject*, const gchar*, gint);
void document_update_tag_list(gint); void document_update_tag_list(gint, gboolean);
void document_set_filetype(gint, filetype*); void document_set_filetype(gint, filetype*);