}
static void
-execute_syntax (const struct syntax_editor *se, GtkTextIter start,
+editor_execute_syntax (const struct syntax_editor *se, GtkTextIter start,
GtkTextIter stop)
{
- g_return_if_fail (proc_has_source (the_dataset));
-
- getl_append_source (the_source_stream,
- create_syntax_editor_source (se, start, stop));
- for (;;)
- {
- const struct dictionary *dict = dataset_dict (the_dataset);
- int result = cmd_parse (se->lexer, the_dataset,
- dict_get_var_cnt (dict) > 0 ?
- CMD_STATE_DATA : CMD_STATE_INITIAL);
- if (result == CMD_EOF || result == CMD_FINISH)
- break;
- }
+ execute_syntax (create_syntax_editor_source (se, start, stop));
}
/* Parse and execute all the text in the buffer */
GtkTextIter begin, end;
struct syntax_editor *se = user_data;
- gtk_text_buffer_get_iter_at_line (se->buffer, &begin, 0);
- gtk_text_buffer_get_iter_at_line (se->buffer, &end, -1);
-
+ gtk_text_buffer_get_iter_at_offset (se->buffer, &begin, 0);
+ gtk_text_buffer_get_iter_at_offset (se->buffer, &end, -1);
- execute_syntax (se, begin, end);
+ editor_execute_syntax (se, begin, end);
}
/* Parse and execute the currently selected text */
struct syntax_editor *se = user_data;
if ( gtk_text_buffer_get_selection_bounds (se->buffer, &begin, &end) )
- execute_syntax (se, begin, end);
+ editor_execute_syntax (se, begin, end);
}
gtk_text_buffer_get_iter_at_line (se->buffer, &begin, line);
gtk_text_buffer_get_iter_at_line (se->buffer, &end, line + 1);
- execute_syntax (se, begin, end);
+ editor_execute_syntax (se, begin, end);
}
gtk_text_buffer_get_iter_at_line (se->buffer, &begin, line);
gtk_text_buffer_get_iter_at_line (se->buffer, &end, -1);
- execute_syntax (se, begin, end);
+ editor_execute_syntax (se, begin, end);
}
struct syntax_editor *
new_syntax_editor (void)
{
- GladeXML *xml =
- glade_xml_new (PKGDATADIR "/syntax-editor.glade", NULL, NULL);
+ GladeXML *xml = XML_NEW ("syntax-editor.glade");
GtkWidget *text_view;
struct syntax_editor *se ;
G_CALLBACK (new_data_window),
e->window);
- g_signal_connect (get_widget_assert (xml,"file_open_data"),
- "activate",
- G_CALLBACK (open_data_window),
- e->window);
-
-
g_signal_connect (get_widget_assert (xml,"help_about"),
"activate",
G_CALLBACK (about_new),
/*
Loads the buffer from the file called FILENAME
*/
-static gboolean
+gboolean
load_editor_from_file (struct syntax_editor *se,
const gchar *filename,
GError **err)
gtk_text_buffer_insert (buffer, &iter, text, -1);
+
+
+
window_set_name_from_filename ((struct editor_window *)se, filename);
gtk_text_buffer_set_modified (buffer, FALSE);
window_create (WINDOW_SYNTAX, file_name);
load_editor_from_file (se, file_name, NULL);
+
+#if RECENT_LISTS_AVAILABLE
+ {
+ GtkRecentManager *manager = gtk_recent_manager_get_default();
+ gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
+
+ if ( ! gtk_recent_manager_add_item (manager, uri))
+ g_warning ("Could not add item %s to recent list\n",uri);
+
+ g_free (uri);
+ }
+#endif
+
}
gtk_widget_destroy (dialog);