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

Moved HTML entities from sci_cb.h to data/html_entities.tags.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@571 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 77ef6652
......@@ -8,6 +8,9 @@
* src/utils.c: Simplified locale detection and little speed up.
* src/main.c, src/document.c, src/geany.h:
Removed code for alternative scrolling(it was not better).
* src/sci_cb.c, src/callbacks.c, src/utils.c, src/highlighting.c,
src/main.c, data/html_entities.tags, Makefile.am:
Moved HTML entities from sci_cb.h to data/html_entities.tags.
2006-07-16 Nick Treleaven <nick.treleaven@btinternet.com>
......
......@@ -11,6 +11,7 @@ EXTRA_DIST = \
data/global.tags \
data/php.tags \
data/latex.tags \
data/html_entities.tags \
data/filetypes.*
uninstall-local:
......@@ -31,6 +32,7 @@ install-data-local:
$(INSTALL_DATA) data/global.tags $(DESTDIR)$(pkgdatadir); \
$(INSTALL_DATA) data/php.tags $(DESTDIR)$(pkgdatadir); \
$(INSTALL_DATA) data/latex.tags $(DESTDIR)$(pkgdatadir); \
$(INSTALL_DATA) data/html_entities.tags $(DESTDIR)$(pkgdatadir); \
$(INSTALL_DATA) COPYING $(DESTDIR)$(pkgdatadir)/GPL-2; \
for file in $(srcdir)/data/*; do \
if test -f $$file; then \
......
# each of the following lines represent a html entity
# used in HTML and PHP files when typing &...
&Aacute;
&Acirc;
&aelig;
&AElig;
&Agrave;
&alpha;
&amp;
&aring;
&Aring;
&Atilde;
&auml;
&Auml;
&bull;
&ccedil;
&Ccedil;
&cent;
&copy;
&curren;
&deg;
&divide;
&Eacute;
&ecirc;
&Ecirc;
&egrave;
&Egrave;
&empty;
&euml;
&Euml;
&euro;
&frac12;
&frac14;
&frac34;
&gt;
&Iacute;
&icirc;
&Icirc;
&igrave;
&Igrave;
&infin;
&isin;
&iuml;
&Iuml;
&lowast;
&lt;
&micro;
&minus;
&nbsp;
&ntilde;
&Ntilde;
&oacute;
&Oacute;
&ocirc;
&Ocirc;
&ograve;
&Ograve;
&omega;
&Omega;
&ordf;
&ordm;
&oslash;
&Oslash;
&otilde;
&Otilde;
&ouml;
&Ouml;
&para;
&pi;
&plusmn;
&pound;
&prod;
&prop;
&quot;
&reg;
&sect;
&sum;
&sup1;
&sup2;
&sup3;
&szlig;
&times;
&trade;
&uacute;
&Uacute;
&ucirc;
&Ucirc;
&ugrave;
&Ugrave;
&uml;
&uuml;
&Uuml;
&yacute;
&yen;
&yuml;
......@@ -123,6 +123,7 @@ gint destroyapp(GtkWidget *widget, gpointer gdata)
styleset_free_styles();
templates_free_templates();
tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));
g_strfreev(html_entities);
g_free(app->configdir);
g_free(app->search_text);
g_free(app->editor_font);
......
......@@ -25,12 +25,14 @@
#include "SciLexer.h"
#include "geany.h"
#include "highlighting.h"
#include "sci_cb.h"
#include "utils.h"
static style_set *types[GEANY_MAX_FILE_TYPES] = { NULL };
static gboolean global_c_tags_loaded = FALSE;
static gboolean global_php_tags_loaded = FALSE;
static gboolean global_html_tags_loaded = FALSE;
static gboolean global_latex_tags_loaded = FALSE;
......@@ -785,6 +787,12 @@ static void styleset_php_init(void)
tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "php.tags", 6);
global_php_tags_loaded = TRUE;
}
// load global tags file for HTML entities autocompletion
if (! app->ignore_global_tags && ! global_html_tags_loaded)
{
html_entities = utils_read_file_in_array(GEANY_DATA_DIR G_DIR_SEPARATOR_S "html_entities.tags");
global_html_tags_loaded = TRUE;
}
g_key_file_free(config);
g_key_file_free(config_home);
......
......@@ -48,6 +48,7 @@
#include "treeviews.h"
#include "notebook.h"
#include "keybindings.h"
#include "sci_cb.h"
#ifdef HAVE_VTE
# include "vte.h"
......@@ -225,10 +226,11 @@ static void main_init(void)
#ifdef HAVE_VTE
app->lib_vte = lib_vte;
#endif
app->ignore_global_tags = ignore_global_tags;
app->tm_workspace = tm_get_workspace();
app->recent_queue = g_queue_new();
app->opening_session_files = FALSE;
app->ignore_global_tags = ignore_global_tags;
app->tm_workspace = tm_get_workspace();
app->recent_queue = g_queue_new();
app->opening_session_files = FALSE;
html_entities = NULL;
app->window = create_window1();
app->new_file_menu = gtk_menu_new();
......
......@@ -438,21 +438,25 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx, gb
if (*root == '&' && lexer == SCLEX_HTML)
{ // HTML entities auto completion
gchar **ents = g_strsplit(sci_cb_html_entities, " ", 0);
guint i, j = 0, ents_len = g_strv_length(ents);
GString *words = g_string_sized_new(60);
guint i, j = 0;
GString *words;
for (i = 0; i < ents_len; i++)
if (html_entities == NULL) return FALSE;
words = g_string_sized_new(500);
for (i = 0; ; i++)
{
if (! strncmp(ents[i], root, rootlen))
if (html_entities[i] == NULL) break;
else if (html_entities[i][0] == '#') continue;
if (! strncmp(html_entities[i], root, rootlen))
{
if (j++ > 0) g_string_append_c(words, ' ');
g_string_append(words, ents[i]);
g_string_append(words, html_entities[i]);
}
}
SSM(sci, SCI_AUTOCSHOW, rootlen, (sptr_t) words->str);
if (words->len > 0) SSM(sci, SCI_AUTOCSHOW, rootlen, (sptr_t) words->str);
g_string_free(words, TRUE);
g_strfreev(ents);
}
else
{ // PHP, LaTeX, C and C++ tag autocompletion
......
......@@ -23,6 +23,9 @@
#define GEANY_SCI_CB_H 1
gchar **html_entities;
// callback func called by all editors when a signals arises
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
......@@ -52,14 +55,4 @@ void sci_cb_auto_table(ScintillaObject *sci, gint pos);
void sci_cb_auto_close_bracket(ScintillaObject *sci, gint pos, gchar c);
#define sci_cb_html_entities "&nbsp; &quot; &amp; &lt; &gt; &Uuml;&trade; &euro; &bull; &infin; &prop; &lowast;\
&minus; &sum; &prod; &isin; &empty; &pi; &Omega; &omega; &alpha; &yuml; &yacute;\
&divide; &oslash; &ugrave; &uacute; &ucirc; &uuml; &auml; &aring; &aelig; &ccedil;\
&egrave; &ecirc; &euml; &igrave; &icirc; &iuml; &ntilde; &ograve; &oacute; &ocirc;\
&otilde; &ouml; &cent; &pound; &curren; &yen; &sect; &uml; &copy; &ordf; &reg; &deg;\
&plusmn; &sup2; &sup3; &frac34; &Agrave; &Aacute; &Acirc; &Atilde; &Auml; &Aring;\
&AElig; &Ccedil; &Egrave; &Eacute; &Ecirc; &frac12; &frac14; &ordm; &sup1; &para;\
&micro; &Euml; &Igrave; &Iacute; &Icirc; &Iuml; &Ntilde; &Ograve; &Oacute; &Ocirc;\
&Otilde; &Ouml; &times; &Oslash; &Ugrave; &Uacute; &Ucirc;"
#endif
......@@ -2517,3 +2517,21 @@ void utils_update_toolbar_items(void)
utils_widget_show_hide(lookup_widget(app->window, "separatortoolitem9"), app->pref_toolbar_show_undo);
}
gchar **utils_read_file_in_array(const gchar *filename)
{
gchar **result = NULL;
gchar *data;
if (filename == NULL) return NULL;
g_file_get_contents(filename, &data, NULL, NULL);
if (data != NULL)
{
result = g_strsplit_set(data, "\r\n", -1);
}
return result;
}
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