| 1 |
aloha |
1.1 |
/* vim: set encoding=utf8: |
| 2 |
|
|
* |
| 3 |
|
|
* shiki.c |
| 4 |
|
|
* |
| 5 |
aloha |
1.54 |
* This file is main file of Shiki. |
| 6 |
|
|
* |
| 7 |
aloha |
1.1 |
* Copyright(C)2006 WAKATSUKI toshihiro |
| 8 |
|
|
* |
| 9 |
|
|
* Permission is hereby granted, free of charge, to any person obtaining a |
| 10 |
|
|
* copy of this software and associated documentation files (the "Software"), |
| 11 |
|
|
* to deal in the Software without restriction, including without limitation |
| 12 |
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 13 |
|
|
* and/or sell copies of the Software, and to permit persons to whom the |
| 14 |
|
|
* Software is furnished to do so, subject to the following conditions: |
| 15 |
|
|
* |
| 16 |
|
|
* The above copyright notice and this permission notice shall be included in |
| 17 |
|
|
* all copies or substantial portions of the Software. |
| 18 |
|
|
* |
| 19 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 22 |
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 |
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 24 |
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 25 |
|
|
* SOFTWARE. |
| 26 |
|
|
* |
| 27 |
aloha |
1.55 |
* $Id: shiki.c,v 1.54 2006/11/24 19:31:04 aloha Exp $ |
| 28 |
aloha |
1.1 |
*/ |
| 29 |
|
|
|
| 30 |
aloha |
1.54 |
#include"shiki.h" |
| 31 |
aloha |
1.1 |
|
| 32 |
aloha |
1.6 |
static gint editor_indent_width = 2; |
| 33 |
aloha |
1.7 |
|
| 34 |
aloha |
1.17 |
/* ������������������������������������������������������������������������������������������������������������������������������ */ |
| 35 |
aloha |
1.54 |
ShikiEditorType Shiki_editor; |
| 36 |
aloha |
1.10 |
|
| 37 |
aloha |
1.35 |
static gchar *R5RS_keywords[] = {"and", "begin", "case", "cond-expand", "cond", "define-accessor", "define-class", "defined?", "define-generic", "define", "define-macro", "define-method", "define-module", "define-private", "define-public", "define-reader-ctor", "define-syntax", "define-syntax-macro", "defmacro", "defmacro*-public", "delay", "do", "else", "fluid-let", "if", "lambda", "let", "let*", "letrec", "letrec-syntax", "let-syntax", "or", "quasiquote", "quote", "set!", "syntax-rules", "unquote", NULL}; |
| 38 |
|
|
|
| 39 |
aloha |
1.36 |
static gchar *R5RS_functions[] = {"*", "+", "-", "/", "<", ">", "<=", ">=", "?", "`", "=", "abs", "acos", "angle", "append", "apply", "asin", "assoc", "assq", "assv", "atan", "boolean?", "caaar", "caadr", "caar", "cadar", "caddr", "cadr", "call/cc", "call-with-current-continuation", "call-with-input-file", "call-with-output-file", "call-with-values", "car", "catch", "cdaar", "cdadr", "cdar", "cddar", "cdddr", "cddr", "cdr", "ceiling", "char-alphabetic?", "char-ci>=?", "char-ci>?", "char-ci=?", "char-ci<=?", "char-ci<?", "char-downcase", "char->integer", "char>=?", "char>?", "char=?", "char?", "char-lower-case?", "char<=?", "char<?", "char-numeric?", "char-ready?", "char-upcase", "char-upper-case?", "char-whitespace?", "close-input-port", "close-output-port", "complex?", "cons", "cos", "current-input-port", "current-output-port", "delete-file", "display", "dynamic-wind", "eof-object?", "eq?", "equal?", "eqv?", "eval", "even?", "exact->inexact", "exact?", "exit", "exp", "expt", "file-exists?", "file-or-directory-modify-seconds", "floor", "force", "for-each", "gcd", "gensym", "getenv", "get-output-string", "imag-part", "inexact?", "input-port?", "integer->char", "integer?", "lcm", "length", "list->string", "list->vector", "list", "list?", "list-ref", "list-tail", "load", "log", "magnitude", "make-polar", "make-rectangular", "make-string", "make-vector", "map", "max", "member", "memq", "memv", "min", "modulo", "negative?", "newline", "nil", "not", "null?", "number->string", "number?", "odd?", "open-input-file", "open-input-string", "open-output-file", "open-output-string", "output-port?", "pair?", "peek-char", "port?", "positive?", "procedure?", "quotient", "rational?", "read-char", "read", "read-line", "real?", "real-part", "remainder", "reverse", "reverse!", "round", "set-car!", "set-cdr!", "sin", "sqrt", "string-append", "string-ci>=?", "string-ci>?", "string-ci=?", "string-ci<=?", "string-ci<?", "string-copy", "string-fill!", "string>=?", "string>?", "string->list", "string->number", "string->symbol", "string", "string=?", "string?", "string-length", "string<=?", "string<?", "string-ref", "string-set!", "substring", "symbol->string", "symbol?", "system", "tan", "truncate", "values", "vector-fill!", "vector->list", "vector", "vector?", "vector-length", "vector-ref", "vector-set!", "with-input-from-file", "with-output-to-file", "write-char", "write", "zero", NULL}; |
| 40 |
aloha |
1.35 |
|
| 41 |
|
|
static GHashTable *keywords_hash = NULL; |
| 42 |
|
|
|
| 43 |
|
|
typedef enum { |
| 44 |
|
|
R5RS_KEYWORD_COLOR = 1, |
| 45 |
|
|
R5RS_FUNCTION_COLOR, |
| 46 |
|
|
GAUCHE_KEYWORD_COLOR, |
| 47 |
|
|
GAUCHE_FUNCTION_COLOR |
| 48 |
|
|
} HIGHILIGHT_COLOR; |
| 49 |
|
|
|
| 50 |
aloha |
1.39 |
GdkColor COLOR_BLACK; |
| 51 |
|
|
GdkColor COLOR_GREEN; |
| 52 |
|
|
|
| 53 |
aloha |
1.17 |
/* ������������������ */ |
| 54 |
aloha |
1.25 |
|
| 55 |
aloha |
1.54 |
/* ������������������������ : ���������������ShikiBuffer ������������������������������������������������������������������ 2 ������������������������������������������ (������������������) */ |
| 56 |
|
|
extern void Scm_Init_xyzzylisp(ScmModule *module); |
| 57 |
aloha |
1.51 |
static void get_buffer_create(gchar *filename); |
| 58 |
aloha |
1.27 |
static void remove_tabpage(); |
| 59 |
|
|
|
| 60 |
aloha |
1.33 |
/* foo_bar_handler() ������������������������������������������������������ */ |
| 61 |
|
|
static void append_default_tabpage_handler(); |
| 62 |
|
|
|
| 63 |
aloha |
1.25 |
/* ������������������ */ |
| 64 |
aloha |
1.27 |
static void open_file(gchar *filename); |
| 65 |
|
|
static void open_file_handler(); |
| 66 |
|
|
static void save_file(); |
| 67 |
|
|
static void save_file_as(); |
| 68 |
aloha |
1.25 |
static gchar *get_filename_from_dialog(const gchar *msg); |
| 69 |
|
|
|
| 70 |
|
|
/* ������������������������������ */ |
| 71 |
|
|
static gchar* get_all_buffer_contents(GtkTextBuffer *buffer); |
| 72 |
|
|
static gboolean save_text_buffer(const gchar *filename, GtkTextBuffer *buffer); |
| 73 |
aloha |
1.17 |
static void clear_current_buffer(); |
| 74 |
aloha |
1.33 |
static void undo(); |
| 75 |
aloha |
1.46 |
static void search_current_buffer(); |
| 76 |
aloha |
1.32 |
static void insert_text_handler(GtkTextBuffer *buffer, GtkTextIter *p, gchar *str, gint len); |
| 77 |
|
|
static void delete_range_handler(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end); |
| 78 |
|
|
|
| 79 |
aloha |
1.25 |
/* ������������������ */ |
| 80 |
aloha |
1.17 |
static void update_modeline_label(); |
| 81 |
|
|
static void text_buffer_cursor_moved_handler(); |
| 82 |
aloha |
1.25 |
|
| 83 |
|
|
/* ������ */ |
| 84 |
aloha |
1.17 |
static gboolean not_yet_save_changes_really_quit(GtkTextBuffer *buffer); |
| 85 |
aloha |
1.27 |
static gboolean delete_event_handler(GtkWidget *widget, GdkEvent *event, GtkTextBuffer *buffer); |
| 86 |
aloha |
1.25 |
|
| 87 |
aloha |
1.46 |
/* Gauche ��� S ��������������������������������������������������������������������������� */ |
| 88 |
aloha |
1.17 |
static gchar *eval_cstring_by_gauche(gchar *s); |
| 89 |
aloha |
1.25 |
static gchar *load_cstring_by_gauche(gchar *s); |
| 90 |
|
|
static void load_buffer_by_gauche(); |
| 91 |
aloha |
1.27 |
static void load_region_by_gauche(); |
| 92 |
|
|
static void load_scheme_file_by_gauche(); |
| 93 |
aloha |
1.17 |
static gboolean is_kakko_or_kokka(gunichar ch, gpointer); |
| 94 |
aloha |
1.29 |
static gboolean is_kakko(gunichar ch, gpointer); |
| 95 |
aloha |
1.17 |
static gboolean is_kokka(gunichar ch, gpointer); |
| 96 |
aloha |
1.30 |
static gboolean search_sexp(GtkTextIter *start, GtkTextIter *end); |
| 97 |
|
|
static gboolean search_sexp_kokka(GtkTextIter *end); |
| 98 |
|
|
static gboolean search_last_sexp(GtkTextIter *start, GtkTextIter *end); |
| 99 |
aloha |
1.29 |
static gboolean search_last_sexp_kakko(GtkTextIter *start); |
| 100 |
aloha |
1.17 |
static gint get_parent_nest_level_at_cursor(GtkTextBuffer *buffer); |
| 101 |
aloha |
1.46 |
static gboolean is_not_scheme_delimita_p(gunichar ch, gpointer user_data); |
| 102 |
|
|
static gboolean is_double_quote(gunichar ch, gpointer user_data); |
| 103 |
|
|
static gboolean is_scheme_delimita_p(gunichar ch, gpointer user_data); |
| 104 |
|
|
static void scheme_keyword_highlighting_current_buffer(); |
| 105 |
aloha |
1.25 |
|
| 106 |
|
|
/* ������ */ |
| 107 |
|
|
static void select_font(); |
| 108 |
|
|
static void font_selection_ok(GtkWidget *button, GtkWidget *font_dialog); |
| 109 |
aloha |
1.18 |
static void switch_tabpage_handler(GtkNotebook *notebook, GtkNotebookPage *page, guint pagenum) ; |
| 110 |
aloha |
1.17 |
static void tabsborder_on_off(GtkButton *button, GtkNotebook *notebook); |
| 111 |
aloha |
1.27 |
static void rotate_tab_position(GtkButton *button, GtkNotebook *notebook); |
| 112 |
aloha |
1.25 |
|
| 113 |
|
|
/* ��������������� ������������ ������ */ |
| 114 |
aloha |
1.17 |
static void forward_current_buffer(); |
| 115 |
|
|
static void backward_current_buffer(); |
| 116 |
|
|
static void line_forward_current_buffer(); |
| 117 |
|
|
static void line_backward_current_buffer(); |
| 118 |
aloha |
1.25 |
|
| 119 |
|
|
/* ������������������������ */ |
| 120 |
aloha |
1.22 |
static gboolean signal_key_press_handler(GtkWidget *notebook, GdkEventKey *event, gpointer contextid); |
| 121 |
|
|
static gboolean signal_key_release_handler(GtkWidget *notebook, GdkEventKey *event, gpointer contextid); |
| 122 |
aloha |
1.25 |
|
| 123 |
|
|
/* ������������������ */ |
| 124 |
aloha |
1.27 |
static void open_online_help(); |
| 125 |
aloha |
1.25 |
static void about_this_application(); |
| 126 |
|
|
|
| 127 |
aloha |
1.27 |
/* ������������������������ */ |
| 128 |
aloha |
1.54 |
static void Shiki_editor_window_init(int argc, char **argv); |
| 129 |
aloha |
1.52 |
|
| 130 |
aloha |
1.51 |
/* ������������������������������ */ |
| 131 |
|
|
static void clear_current_buffer() { |
| 132 |
|
|
GtkTextIter start, end; |
| 133 |
|
|
gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &start); |
| 134 |
|
|
gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &end); |
| 135 |
|
|
gtk_text_buffer_delete(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
| 136 |
|
|
} |
| 137 |
|
|
|
| 138 |
aloha |
1.46 |
static void destroy_handler(GtkWidget *button, GtkWidget *widget) {gtk_widget_destroy(widget);} |
| 139 |
|
|
|
| 140 |
aloha |
1.48 |
static void toggled_handler(GtkToggleButton *togglebutton, gboolean *flag) { |
| 141 |
|
|
*flag = !*flag; |
| 142 |
|
|
} |
| 143 |
|
|
|
| 144 |
aloha |
1.47 |
static void replace_current_buffer() { |
| 145 |
|
|
GtkWidget *dialog = gtk_dialog_new_with_buttons ("������������������", GTK_WINDOW(Shiki_EDITOR_WINDOW), GTK_DIALOG_DESTROY_WITH_PARENT, NULL); |
| 146 |
aloha |
1.48 |
GtkWidget *table = gtk_table_new(7, 3, FALSE); |
| 147 |
aloha |
1.47 |
GtkWidget *find_label = gtk_label_new("������ : "); |
| 148 |
|
|
GtkWidget *find = gtk_entry_new(); |
| 149 |
aloha |
1.48 |
GtkWidget *rep_label = gtk_label_new("������ : "); |
| 150 |
|
|
GtkWidget *replace = gtk_entry_new(); |
| 151 |
|
|
GtkWidget *check1 = gtk_check_button_new_with_label("���������������������������������"); |
| 152 |
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check1), TRUE); |
| 153 |
aloha |
1.47 |
GtkWidget *check2 = gtk_check_button_new_with_label("���������������������������"); |
| 154 |
|
|
GtkWidget *check3 = gtk_check_button_new_with_label("������������"); |
| 155 |
|
|
GtkWidget *check4 = gtk_check_button_new_with_label("���������������������������������������������"); |
| 156 |
|
|
GtkWidget *check5 = gtk_check_button_new_with_label("���������������������������"); |
| 157 |
|
|
GtkWidget *interactive = gtk_button_new_with_label ("������������"); |
| 158 |
|
|
GtkWidget *all = gtk_button_new_with_label ("������������"); |
| 159 |
|
|
GtkWidget *cancel = gtk_button_new_with_label ("���������������"); |
| 160 |
aloha |
1.48 |
gboolean f1 = TRUE, f2, f3, f4, f5; |
| 161 |
|
|
f2 = f3 = f4 = f5 = FALSE; |
| 162 |
|
|
g_signal_connect (check1, "toggled", G_CALLBACK (toggled_handler), &f1); |
| 163 |
|
|
g_signal_connect (check2, "toggled", G_CALLBACK (toggled_handler), &f2); |
| 164 |
|
|
g_signal_connect (check3, "toggled", G_CALLBACK (toggled_handler), &f3); |
| 165 |
|
|
g_signal_connect (check4, "toggled", G_CALLBACK (toggled_handler), &f4); |
| 166 |
|
|
g_signal_connect (check5, "toggled", G_CALLBACK (toggled_handler), &f5); |
| 167 |
aloha |
1.47 |
|
| 168 |
|
|
g_signal_connect (G_OBJECT(dialog), "delete_event", G_CALLBACK(gtk_widget_destroy), NULL); |
| 169 |
|
|
g_signal_connect (G_OBJECT(cancel), "clicked", G_CALLBACK(destroy_handler), dialog); |
| 170 |
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
| 171 |
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 10); |
| 172 |
|
|
gtk_container_border_width (GTK_CONTAINER (dialog), 10); |
| 173 |
|
|
|
| 174 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), find_label, 0, 1, 0, 1); |
| 175 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), find, 1, 2, 0, 1); |
| 176 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), interactive, 2, 3, 0, 1); |
| 177 |
|
|
|
| 178 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), rep_label, 0, 1, 1, 2); |
| 179 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), replace, 1, 2, 1, 2); |
| 180 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), all, 2, 3, 1, 2); |
| 181 |
|
|
|
| 182 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check1, 1, 2, 2, 3); |
| 183 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), cancel, 2, 3, 2, 3); |
| 184 |
|
|
|
| 185 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check2, 1, 2, 3, 4); |
| 186 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check3, 1, 2, 4, 5); |
| 187 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check4, 1, 2, 5, 6); |
| 188 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check5, 1, 2, 6, 7); |
| 189 |
|
|
|
| 190 |
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table); |
| 191 |
|
|
gtk_widget_show_all(table); |
| 192 |
|
|
gtk_dialog_run(GTK_DIALOG(dialog)); |
| 193 |
|
|
} |
| 194 |
|
|
|
| 195 |
aloha |
1.46 |
static void search_current_buffer() { |
| 196 |
|
|
GtkWidget *dialog = gtk_dialog_new_with_buttons ("������������������", GTK_WINDOW(Shiki_EDITOR_WINDOW), GTK_DIALOG_DESTROY_WITH_PARENT, NULL); |
| 197 |
|
|
GtkWidget *table = gtk_table_new(6, 3, FALSE); |
| 198 |
|
|
GtkWidget *label = gtk_label_new("������ : "); |
| 199 |
|
|
GtkWidget *input = gtk_entry_new(); |
| 200 |
|
|
GtkWidget *check1 = gtk_check_button_new_with_label("���������������������������������"); |
| 201 |
aloha |
1.48 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check1), TRUE); |
| 202 |
aloha |
1.46 |
GtkWidget *check2 = gtk_check_button_new_with_label("���������������������������"); |
| 203 |
|
|
GtkWidget *check3 = gtk_check_button_new_with_label("������������"); |
| 204 |
|
|
GtkWidget *check4 = gtk_check_button_new_with_label("���������������������������������������������"); |
| 205 |
|
|
GtkWidget *check5 = gtk_check_button_new_with_label("���������������������������������"); |
| 206 |
|
|
GtkWidget *prev = gtk_button_new_with_label ("���������"); |
| 207 |
|
|
GtkWidget *next = gtk_button_new_with_label ("���������"); |
| 208 |
|
|
GtkWidget *cancel = gtk_button_new_with_label ("���������������"); |
| 209 |
aloha |
1.48 |
gboolean f1 = TRUE, f2, f3, f4, f5; |
| 210 |
|
|
f2 = f3 = f4 = f5 = FALSE; |
| 211 |
|
|
g_signal_connect (check1, "toggled", G_CALLBACK (toggled_handler), &f1); |
| 212 |
|
|
g_signal_connect (check2, "toggled", G_CALLBACK (toggled_handler), &f2); |
| 213 |
|
|
g_signal_connect (check3, "toggled", G_CALLBACK (toggled_handler), &f3); |
| 214 |
|
|
g_signal_connect (check4, "toggled", G_CALLBACK (toggled_handler), &f4); |
| 215 |
|
|
g_signal_connect (check5, "toggled", G_CALLBACK (toggled_handler), &f5); |
| 216 |
aloha |
1.46 |
|
| 217 |
|
|
g_signal_connect (G_OBJECT(dialog), "delete_event", G_CALLBACK(gtk_widget_destroy), NULL); |
| 218 |
|
|
g_signal_connect (G_OBJECT(cancel), "clicked", G_CALLBACK(destroy_handler), dialog); |
| 219 |
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
| 220 |
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 10); |
| 221 |
|
|
gtk_container_border_width (GTK_CONTAINER (dialog), 10); |
| 222 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), label, 0, 1, 0, 1); |
| 223 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), input, 1, 2, 0, 1); |
| 224 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), prev, 2, 3, 0, 1); |
| 225 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check1, 1, 2, 1, 2); |
| 226 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check2, 1, 2, 2, 3); |
| 227 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check3, 1, 2, 3, 4); |
| 228 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check4, 1, 2, 4, 5); |
| 229 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), check5, 1, 2, 5, 6); |
| 230 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), next, 2, 3, 1, 2); |
| 231 |
|
|
gtk_table_attach_defaults (GTK_TABLE(table), cancel, 2, 3, 2, 3); |
| 232 |
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table); |
| 233 |
|
|
gtk_widget_show_all(table); |
| 234 |
|
|
gtk_dialog_run(GTK_DIALOG(dialog)); |
| 235 |
|
|
} |
| 236 |
|
|
|
| 237 |
aloha |
1.35 |
static gboolean is_not_scheme_delimita_p(gunichar ch, gpointer user_data) { |
| 238 |
aloha |
1.36 |
return ch != '(' && ch != ')' && !g_unichar_isspace(ch); |
| 239 |
|
|
} |
| 240 |
|
|
|
| 241 |
|
|
static gboolean is_double_quote(gunichar ch, gpointer user_data) { |
| 242 |
|
|
return ch == '\"'; |
| 243 |
aloha |
1.35 |
} |
| 244 |
|
|
|
| 245 |
|
|
static gboolean is_scheme_delimita_p(gunichar ch, gpointer user_data) { |
| 246 |
aloha |
1.36 |
return ch == ' ' || ch == '(' || ch == ')' || ch == '\"' || g_unichar_isspace(ch); |
| 247 |
aloha |
1.35 |
} |
| 248 |
|
|
|
| 249 |
|
|
/* ������������������������������ */ |
| 250 |
|
|
static void scheme_keyword_highlighting_current_buffer() { |
| 251 |
|
|
GtkTextIter s, e; |
| 252 |
|
|
HIGHILIGHT_COLOR c; |
| 253 |
|
|
gchar *word; |
| 254 |
aloha |
1.36 |
gboolean is_comment, is_string; |
| 255 |
|
|
gunichar ch; |
| 256 |
aloha |
1.35 |
|
| 257 |
|
|
gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &s); |
| 258 |
|
|
|
| 259 |
|
|
/* ��������� Scheme ������������������������������ */ |
| 260 |
|
|
while(TRUE) { |
| 261 |
aloha |
1.36 |
is_comment = FALSE; |
| 262 |
|
|
is_string = FALSE; |
| 263 |
|
|
if((ch = gtk_text_iter_get_char(&s)) != ';' && ch != '\"') |
| 264 |
aloha |
1.35 |
gtk_text_iter_forward_find_char(&s, is_not_scheme_delimita_p, NULL, NULL); |
| 265 |
|
|
e = s; |
| 266 |
|
|
if(gtk_text_iter_get_char(&s) == ';') { |
| 267 |
|
|
gtk_text_iter_forward_line(&e); |
| 268 |
|
|
gtk_text_iter_backward_char(&e); |
| 269 |
|
|
is_comment = TRUE; |
| 270 |
aloha |
1.36 |
} else if(gtk_text_iter_get_char(&s) == '\"') { |
| 271 |
|
|
while(TRUE) { |
| 272 |
|
|
gtk_text_iter_forward_find_char(&e, is_double_quote, NULL, NULL); |
| 273 |
|
|
gtk_text_iter_backward_char(&e); |
| 274 |
|
|
if(gtk_text_iter_get_char(&e) != '\\') { |
| 275 |
|
|
is_string = TRUE; |
| 276 |
|
|
gtk_text_iter_forward_char(&e); |
| 277 |
|
|
gtk_text_iter_forward_char(&e); |
| 278 |
|
|
break; |
| 279 |
|
|
} |
| 280 |
|
|
gtk_text_iter_forward_char(&e); |
| 281 |
|
|
gtk_text_iter_forward_char(&e); |
| 282 |
|
|
} |
| 283 |
|
|
|
| 284 |
aloha |
1.35 |
} else |
| 285 |
|
|
gtk_text_iter_forward_find_char(&e, is_scheme_delimita_p, NULL, NULL); |
| 286 |
|
|
|
| 287 |
|
|
word = gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &s, &e, FALSE); |
| 288 |
aloha |
1.36 |
|
| 289 |
|
|
/* ������������������������������������������������������������ */ |
| 290 |
|
|
if(is_comment) /* ������������ */ |
| 291 |
aloha |
1.35 |
gtk_text_buffer_apply_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "comment_highlighting", &s, &e); |
| 292 |
aloha |
1.36 |
else if(is_string) /* ��������� */ |
| 293 |
|
|
gtk_text_buffer_apply_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "string_highlighting", &s, &e); |
| 294 |
|
|
else if(R5RS_KEYWORD_COLOR == (c = GPOINTER_TO_INT(g_hash_table_lookup(keywords_hash, word)))) /* R5RS ��������������� */ |
| 295 |
aloha |
1.35 |
gtk_text_buffer_apply_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "keyword_highlighting", &s, &e); |
| 296 |
aloha |
1.36 |
else if(R5RS_FUNCTION_COLOR == c) /* R5RS ������ */ |
| 297 |
aloha |
1.35 |
gtk_text_buffer_apply_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "function_highlighting", &s, &e); |
| 298 |
|
|
|
| 299 |
aloha |
1.36 |
/* XXX : get_text() ������������������������������������������������������������������������������������������������������ GtkTextBuffer ������ const gchar * ������������������������������ */ |
| 300 |
|
|
g_free(word); |
| 301 |
aloha |
1.35 |
|
| 302 |
|
|
if(gtk_text_iter_is_end(&e)) break; |
| 303 |
|
|
s = e; |
| 304 |
|
|
} |
| 305 |
|
|
} |
| 306 |
|
|
|
| 307 |
aloha |
1.32 |
/* ��������������������������������������������� */ |
| 308 |
|
|
static void insert_text_handler(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *str, gint len) { |
| 309 |
|
|
/* Undo ��������������������������� */ |
| 310 |
|
|
ShikiUndoInfo *undoInfo = g_malloc(sizeof(ShikiUndoInfo)); |
| 311 |
|
|
g_return_if_fail(undoInfo != NULL); |
| 312 |
|
|
undoInfo->action = SHIKI_UNDO_INSERT; |
| 313 |
|
|
undoInfo->str = g_strdup(str); |
| 314 |
|
|
undoInfo->strlen = len; |
| 315 |
|
|
undoInfo->start = gtk_text_iter_get_offset(iter); |
| 316 |
|
|
undoInfo->end = undoInfo->start + undoInfo->strlen; |
| 317 |
|
|
Shiki_CURRENT_UNDO_INFO_LIST = g_list_prepend(Shiki_CURRENT_UNDO_INFO_LIST, undoInfo); |
| 318 |
aloha |
1.35 |
/* g_print("insert : %s, len : %d, start : %d, end : %d\n", undoInfo->str, undoInfo->strlen, undoInfo->start, undoInfo->end); */ |
| 319 |
aloha |
1.32 |
} |
| 320 |
|
|
|
| 321 |
|
|
/* ������������������������������������������������ */ |
| 322 |
|
|
static void delete_range_handler(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end) { |
| 323 |
|
|
/* Undo ��������������������������� */ |
| 324 |
|
|
ShikiUndoInfo *undoInfo = g_malloc(sizeof(ShikiUndoInfo)); |
| 325 |
|
|
g_return_if_fail(undoInfo != NULL); |
| 326 |
|
|
undoInfo->action = SHIKI_UNDO_DELETE; |
| 327 |
|
|
undoInfo->str = gtk_text_buffer_get_text(buffer, start, end, FALSE); |
| 328 |
|
|
undoInfo->start = gtk_text_iter_get_offset(start); |
| 329 |
|
|
undoInfo->end = gtk_text_iter_get_offset(end); |
| 330 |
|
|
undoInfo->strlen = end - start; |
| 331 |
|
|
Shiki_CURRENT_UNDO_INFO_LIST = g_list_prepend(Shiki_CURRENT_UNDO_INFO_LIST, undoInfo); |
| 332 |
aloha |
1.35 |
/* g_print("delete : %s %d\n", undoInfo->str, undoInfo->strlen); */ |
| 333 |
aloha |
1.32 |
} |
| 334 |
|
|
|
| 335 |
|
|
/* ������������������������������������������������������������ */ |
| 336 |
|
|
static void switch_tabpage_handler(GtkNotebook *notebook, GtkNotebookPage *page, guint pagenum) { |
| 337 |
|
|
/* ��������������������������������������������������������������������� */ |
| 338 |
aloha |
1.55 |
Shiki_CURRENT_TAB_INFO = (ShikiBuffer *)g_list_nth_data(Shiki_EDITOR_BUFFER_LIST, pagenum); |
| 339 |
aloha |
1.32 |
|
| 340 |
|
|
/* ������������������������������������ */ |
| 341 |
|
|
Shiki_CURRENT_TAB_NUM = pagenum; |
| 342 |
|
|
|
| 343 |
|
|
/* ������������������������������������������������������ */ |
| 344 |
|
|
if(!Shiki_CURRENT_TAB_INFO) return; |
| 345 |
|
|
gtk_window_set_title (GTK_WINDOW(Shiki_EDITOR_WINDOW), Shiki_CURRENT_FILENAME); |
| 346 |
|
|
|
| 347 |
|
|
update_modeline_label(); |
| 348 |
|
|
} |
| 349 |
|
|
|
| 350 |
aloha |
1.33 |
static void undo() { |
| 351 |
|
|
g_print("Undo\n"); |
| 352 |
|
|
GtkTextIter start, end; |
| 353 |
|
|
ShikiUndoInfo *undoInfo = g_list_nth_data(Shiki_CURRENT_UNDO_INFO_LIST, 0); |
| 354 |
|
|
if(!undoInfo) { |
| 355 |
|
|
g_print("������������ Undo ���������������\n"); |
| 356 |
|
|
return; |
| 357 |
|
|
} |
| 358 |
|
|
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &start, undoInfo->start); |
| 359 |
|
|
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &end, undoInfo->end); |
| 360 |
|
|
|
| 361 |
|
|
if(undoInfo->action == SHIKI_UNDO_INSERT) { |
| 362 |
|
|
Shiki_CURRENT_UNDO_INFO_LIST = g_list_delete_link(Shiki_CURRENT_UNDO_INFO_LIST, g_list_first(Shiki_CURRENT_UNDO_INFO_LIST)); |
| 363 |
|
|
gtk_text_buffer_delete(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
| 364 |
|
|
g_free(undoInfo->str); |
| 365 |
|
|
g_free(undoInfo); |
| 366 |
|
|
} else if(undoInfo->action == SHIKI_UNDO_DELETE) { |
| 367 |
|
|
Shiki_CURRENT_UNDO_INFO_LIST = g_list_delete_link(Shiki_CURRENT_UNDO_INFO_LIST, g_list_first(Shiki_CURRENT_UNDO_INFO_LIST)); |
| 368 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &start, undoInfo->str, -1); |
| 369 |
|
|
g_free(undoInfo->str); |
| 370 |
|
|
g_free(undoInfo); |
| 371 |
|
|
} |
| 372 |
|
|
|
| 373 |
|
|
} |
| 374 |
|
|
|
| 375 |
aloha |
1.32 |
/* ��������������������� */ |
| 376 |
|
|
static gboolean signal_key_press_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid) { |
| 377 |
|
|
GtkTextIter start, end; |
| 378 |
|
|
|
| 379 |
|
|
/* ������������������������������������ */ |
| 380 |
|
|
gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &start); |
| 381 |
|
|
gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &end); |
| 382 |
|
|
gtk_text_buffer_remove_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "parent_emphasis_background", &start, &end); |
| 383 |
|
|
|
| 384 |
|
|
if(event->state & GDK_CONTROL_MASK && event->state & GDK_MOD1_MASK) { |
| 385 |
|
|
switch(event->keyval) { |
| 386 |
|
|
case GDK_at : /* C-M-SPC */ |
| 387 |
|
|
{ GtkTextIter start, end; |
| 388 |
|
|
if(!search_sexp(&start, &end)) return FALSE; |
| 389 |
|
|
gtk_text_buffer_select_range(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
| 390 |
|
|
} |
| 391 |
|
|
break; |
| 392 |
|
|
case GDK_space : /* C-M-SPC */ |
| 393 |
|
|
{ GtkTextIter start, end; |
| 394 |
|
|
if(!search_last_sexp(&start, &end)) return FALSE; |
| 395 |
|
|
gtk_text_buffer_select_range(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
| 396 |
|
|
} |
| 397 |
|
|
break; |
| 398 |
|
|
} |
| 399 |
|
|
} else if(event->state & GDK_CONTROL_MASK) { |
| 400 |
|
|
switch(event->keyval) { |
| 401 |
|
|
case GDK_f : /* Ctrl + f : forward */ |
| 402 |
|
|
forward_current_buffer(); |
| 403 |
|
|
break; |
| 404 |
|
|
case GDK_b : /* Ctrl + b : backward */ |
| 405 |
|
|
backward_current_buffer(); |
| 406 |
|
|
break; |
| 407 |
|
|
case GDK_n : /* Ctrl + n : next line */ |
| 408 |
|
|
line_forward_current_buffer(); |
| 409 |
|
|
break; |
| 410 |
|
|
case GDK_p : /* Ctrl + p : previous line */ |
| 411 |
|
|
line_backward_current_buffer(); |
| 412 |
|
|
break; |
| 413 |
|
|
case GDK_h : |
| 414 |
|
|
{ GtkTextIter p; |
| 415 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 416 |
|
|
gtk_text_buffer_backspace(Shiki_CURRENT_TEXT_BUFFER, &p, FALSE, TRUE); |
| 417 |
|
|
} |
| 418 |
|
|
break; |
| 419 |
|
|
|
| 420 |
|
|
case GDK_e : /* Ctrl + e : eval-expression */ |
| 421 |
|
|
{ |
| 422 |
aloha |
1.51 |
gchar *code, *result; |
| 423 |
aloha |
1.32 |
GtkTextIter start, end; |
| 424 |
|
|
|
| 425 |
|
|
if(!search_sexp(&start, &end)) return FALSE; |
| 426 |
|
|
|
| 427 |
|
|
code = gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &start, &end, FALSE); |
| 428 |
aloha |
1.51 |
result = eval_cstring_by_gauche(code); |
| 429 |
|
|
g_free(code); |
| 430 |
|
|
|
| 431 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &end, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 432 |
|
|
|
| 433 |
aloha |
1.52 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, "\n", -1); |
| 434 |
aloha |
1.51 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, result, -1); |
| 435 |
aloha |
1.52 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, "\n", -1); |
| 436 |
aloha |
1.32 |
} |
| 437 |
|
|
break; |
| 438 |
|
|
|
| 439 |
|
|
case GDK_j : /* Ctrl + j : eval-last-sexp */ |
| 440 |
|
|
{ |
| 441 |
aloha |
1.51 |
gchar *code, *result; |
| 442 |
aloha |
1.32 |
GtkTextIter start, end; |
| 443 |
|
|
|
| 444 |
|
|
if(!search_last_sexp(&start, &end)) return FALSE; |
| 445 |
|
|
|
| 446 |
|
|
code = gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &start, &end, FALSE); |
| 447 |
aloha |
1.51 |
result = eval_cstring_by_gauche(code); |
| 448 |
|
|
g_free(code); |
| 449 |
|
|
|
| 450 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &end, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 451 |
|
|
|
| 452 |
aloha |
1.52 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, "\n", -1); |
| 453 |
aloha |
1.51 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, result, -1); |
| 454 |
aloha |
1.52 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &end, "\n", -1); |
| 455 |
aloha |
1.32 |
} |
| 456 |
|
|
break; |
| 457 |
|
|
|
| 458 |
|
|
case GDK_underscore : /* Ctrl + _ : Undo */ |
| 459 |
aloha |
1.33 |
undo(); |
| 460 |
aloha |
1.32 |
break; |
| 461 |
|
|
|
| 462 |
|
|
case GDK_t : /* Ctrl + t : ��������������� */ |
| 463 |
aloha |
1.33 |
append_default_tabpage_handler(); |
| 464 |
aloha |
1.32 |
break; |
| 465 |
|
|
|
| 466 |
|
|
case GDK_k : /* Ctrl + k : ������������������ */ |
| 467 |
|
|
remove_tabpage(); |
| 468 |
|
|
break; |
| 469 |
|
|
|
| 470 |
|
|
case GDK_w : /* Ctrl + w : ��������� */ |
| 471 |
|
|
gtk_text_buffer_cut_clipboard(Shiki_CURRENT_TEXT_BUFFER, Shiki_EDITOR_CLIPBOARD, TRUE); |
| 472 |
|
|
break; |
| 473 |
|
|
|
| 474 |
|
|
case GDK_y : /* Ctrl + y : ��������� */ |
| 475 |
|
|
{GtkTextIter p; |
| 476 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 477 |
|
|
gtk_text_buffer_paste_clipboard(Shiki_CURRENT_TEXT_BUFFER, Shiki_EDITOR_CLIPBOARD, &p, TRUE); |
| 478 |
|
|
} |
| 479 |
|
|
break; |
| 480 |
|
|
} |
| 481 |
|
|
} |
| 482 |
|
|
return FALSE; |
| 483 |
|
|
} |
| 484 |
|
|
|
| 485 |
aloha |
1.55 |
ScmClass *ShikiBufferClass; |
| 486 |
|
|
static gint compBuffer(gconstpointer a, gconstpointer b) { |
| 487 |
|
|
return ((ShikiBuffer *)a)->text_buffer == b ? 0 : 1; |
| 488 |
|
|
} |
| 489 |
|
|
|
| 490 |
|
|
static void buffer_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx) { |
| 491 |
|
|
GtkTextBuffer *b = SHIKI_BUFFER_UNBOX(obj); |
| 492 |
|
|
GList *l = g_list_find_custom(Shiki_EDITOR_BUFFER_LIST, b, compBuffer); |
| 493 |
|
|
if(l) |
| 494 |
|
|
Scm_Printf(out, "#<buffer: %s>", ((ShikiBuffer *)(l->data))->name); |
| 495 |
|
|
else |
| 496 |
|
|
Scm_Printf(out, "#<deleted buffer: %p>", b); |
| 497 |
|
|
} |
| 498 |
|
|
|
| 499 |
|
|
static void buffer_cleanup(ScmObj obj) |
| 500 |
|
|
{ |
| 501 |
|
|
g_object_unref(SHIKI_BUFFER_UNBOX(obj)); |
| 502 |
|
|
} |
| 503 |
|
|
|
| 504 |
aloha |
1.23 |
/* ��������������������������������������� (������������) ��������� */ |
| 505 |
aloha |
1.51 |
static void get_buffer_create(gchar *filename) { |
| 506 |
aloha |
1.24 |
/*-------------------- ������������������������ ----------------------------------*/ |
| 507 |
aloha |
1.54 |
/* ShikiBuffer ������������������������������������������������������������������ */ |
| 508 |
|
|
ShikiBuffer *tabinfo = g_malloc(sizeof(ShikiBuffer)); |
| 509 |
aloha |
1.39 |
tabinfo->locale = "Gtk Default (utf8)"; |
| 510 |
aloha |
1.34 |
tabinfo->undoInfoList = NULL; |
| 511 |
|
|
tabinfo->filename = filename; |
| 512 |
aloha |
1.54 |
tabinfo->name = g_path_get_basename(filename); |
| 513 |
|
|
tabinfo->tabpage_label = g_strndup(tabinfo->name, 7); |
| 514 |
aloha |
1.34 |
tabinfo->env = Scm_MakeModule(NULL, FALSE); |
| 515 |
aloha |
1.55 |
|
| 516 |
|
|
ShikiBufferClass = Scm_MakeForeignPointerClass(SCM_MODULE(tabinfo->env), |
| 517 |
|
|
"<buffer>", buffer_print, buffer_cleanup, |
| 518 |
|
|
SCM_FOREIGN_POINTER_KEEP_IDENTITY |
| 519 |
|
|
| |
| 520 |
|
|
SCM_FOREIGN_POINTER_MAP_NULL); |
| 521 |
aloha |
1.35 |
|
| 522 |
aloha |
1.53 |
/* xyzzy lisp ��������������� */ |
| 523 |
|
|
Scm_Init_xyzzylisp(SCM_MODULE(tabinfo->env)); |
| 524 |
aloha |
1.51 |
|
| 525 |
aloha |
1.34 |
g_return_if_fail(tabinfo->env != SCM_FALSE); |
| 526 |
aloha |
1.24 |
|
| 527 |
|
|
/* ������������������������������ (������������������������) ��������� */ |
| 528 |
|
|
tabinfo->tabpage = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL)); |
| 529 |
|
|
gtk_scrolled_window_set_policy (tabinfo->tabpage, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
| 530 |
|
|
|
| 531 |
|
|
/* ��������������������������������������������������������������������������������������� */ |
| 532 |
|
|
tabinfo->text_view = GTK_TEXT_VIEW(gtk_text_view_new()); |
| 533 |
aloha |
1.41 |
gtk_text_view_set_wrap_mode(tabinfo->text_view, GTK_WRAP_WORD); |
| 534 |
aloha |
1.24 |
tabinfo->text_buffer = gtk_text_view_get_buffer(tabinfo->text_view); |
| 535 |
aloha |
1.33 |
|
| 536 |
aloha |
1.24 |
gtk_container_add(GTK_CONTAINER(tabinfo->tabpage), GTK_WIDGET(tabinfo->text_view)); |
| 537 |
aloha |
1.47 |
gtk_widget_set_size_request(GTK_WIDGET(tabinfo->text_view), 680, 700); |
| 538 |
aloha |
1.24 |
g_signal_connect(tabinfo->text_buffer, "mark_set", G_CALLBACK(text_buffer_cursor_moved_handler), tabinfo->text_view); |
| 539 |
aloha |
1.32 |
g_signal_connect(tabinfo->text_buffer, "insert-text", G_CALLBACK(insert_text_handler), NULL); |
| 540 |
|
|
g_signal_connect(tabinfo->text_buffer, "delete-range", G_CALLBACK(delete_range_handler), NULL); |
| 541 |
|
|
|
| 542 |
aloha |
1.24 |
/* ������������������������������������������������������������������������������������������������������ */ |
| 543 |
|
|
tabinfo->delete_handler_id = g_signal_connect(Shiki_EDITOR_WINDOW, "delete_event", G_CALLBACK(delete_event_handler), tabinfo->text_buffer); |
| 544 |
aloha |
1.33 |
|
| 545 |
aloha |
1.24 |
/* ������������������������ */ |
| 546 |
aloha |
1.36 |
|
| 547 |
aloha |
1.24 |
/* ������������������������������������������������ */ |
| 548 |
aloha |
1.39 |
gtk_text_buffer_create_tag(tabinfo->text_buffer, "parent_emphasis_background", "background", "green", NULL); |
| 549 |
aloha |
1.35 |
|
| 550 |
|
|
/* ��������������������������������������� */ |
| 551 |
|
|
gtk_text_buffer_create_tag(tabinfo->text_buffer, "keyword_highlighting", "foreground", "blue", NULL); |
| 552 |
|
|
/* ������ */ |
| 553 |
|
|
gtk_text_buffer_create_tag(tabinfo->text_buffer, "function_highlighting", "foreground", "red", NULL); |
| 554 |
|
|
/* ������������ */ |
| 555 |
aloha |
1.36 |
gtk_text_buffer_create_tag (tabinfo->text_buffer, "comment_highlighting", "foreground", "purple", NULL); |
| 556 |
|
|
/* ��������� */ |
| 557 |
|
|
gtk_text_buffer_create_tag (tabinfo->text_buffer, "string_highlighting", "foreground", "orange", NULL); |
| 558 |
aloha |
1.24 |
/* ������������������������������������������ */ |
| 559 |
aloha |
1.27 |
gtk_notebook_append_page(Shiki_EDITOR_NOTEBOOK, GTK_WIDGET(tabinfo->tabpage), gtk_label_new(tabinfo->tabpage_label)); |
| 560 |
aloha |
1.24 |
/* ������������������������������������������������������������������ */ |
| 561 |
aloha |
1.55 |
Shiki_EDITOR_BUFFER_LIST = g_list_append(Shiki_EDITOR_BUFFER_LIST, tabinfo); |
| 562 |
aloha |
1.32 |
|
| 563 |
aloha |
1.27 |
gtk_widget_show_all(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK)); |
| 564 |
aloha |
1.24 |
/* ��������������������������������� */ |
| 565 |
aloha |
1.55 |
gtk_notebook_set_current_page(Shiki_EDITOR_NOTEBOOK, g_list_length(Shiki_EDITOR_BUFFER_LIST) - 1); |
| 566 |
aloha |
1.23 |
} |
| 567 |
|
|
|
| 568 |
aloha |
1.33 |
static void append_default_tabpage_handler() { |
| 569 |
aloha |
1.51 |
get_buffer_create(g_strdup("*scratch*")); |
| 570 |
aloha |
1.33 |
} |
| 571 |
|
|
|
| 572 |
aloha |
1.23 |
/* ������������������������������������������ (������������) ��������� */ |
| 573 |
aloha |
1.27 |
static void remove_tabpage() { |
| 574 |
aloha |
1.23 |
/* ��������� 1 ��������������������������������������������������� */ |
| 575 |
aloha |
1.55 |
if(g_list_length(Shiki_EDITOR_BUFFER_LIST) == 1) |
| 576 |
aloha |
1.23 |
return; |
| 577 |
|
|
if(!not_yet_save_changes_really_quit(Shiki_CURRENT_TEXT_BUFFER)) { |
| 578 |
|
|
/* ��������������������������������������������������������������������������������������������� */ |
| 579 |
|
|
g_signal_handler_disconnect(Shiki_EDITOR_WINDOW, (Shiki_CURRENT_TAB_INFO)->delete_handler_id); |
| 580 |
|
|
/* ������������������������ */ |
| 581 |
|
|
gtk_widget_destroy(GTK_WIDGET(Shiki_CURRENT_TEXT_VIEW)); |
| 582 |
|
|
/* ������������������������������������������ */ |
| 583 |
|
|
g_free(Shiki_CURRENT_TAB_TITLE); |
| 584 |
aloha |
1.40 |
g_free(Shiki_CURRENT_BASENAME); |
| 585 |
aloha |
1.23 |
g_free(Shiki_CURRENT_FILENAME); |
| 586 |
aloha |
1.55 |
Shiki_EDITOR_BUFFER_LIST = g_list_delete_link(Shiki_EDITOR_BUFFER_LIST, g_list_nth(Shiki_EDITOR_BUFFER_LIST, Shiki_CURRENT_TAB_NUM)); |
| 587 |
aloha |
1.23 |
g_free(Shiki_CURRENT_TAB_INFO); |
| 588 |
|
|
|
| 589 |
|
|
/* ������������������������������������ */ |
| 590 |
aloha |
1.55 |
Shiki_CURRENT_TAB_INFO = g_list_nth_data(Shiki_EDITOR_BUFFER_LIST, Shiki_CURRENT_TAB_NUM); |
| 591 |
aloha |
1.27 |
gtk_notebook_remove_page(Shiki_EDITOR_NOTEBOOK, Shiki_CURRENT_TAB_NUM); |
| 592 |
aloha |
1.23 |
/* ��������������������������������������� */ |
| 593 |
aloha |
1.27 |
gtk_widget_queue_draw(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK)); |
| 594 |
aloha |
1.23 |
} |
| 595 |
|
|
} |
| 596 |
|
|
|
| 597 |
aloha |
1.14 |
/* ������������������������������������ */ |
| 598 |
|
|
static void load_buffer_by_gauche() { |
| 599 |
|
|
GtkTextIter p; |
| 600 |
aloha |
1.16 |
gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 601 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, "\n\n", -1); |
| 602 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, load_cstring_by_gauche(get_all_buffer_contents(Shiki_CURRENT_TEXT_BUFFER)), -1); |
| 603 |
aloha |
1.14 |
} |
| 604 |
|
|
|
| 605 |
|
|
/* ������������������������ */ |
| 606 |
aloha |
1.27 |
static void load_scheme_file_by_gauche() { |
| 607 |
aloha |
1.14 |
gchar *contents, *text; |
| 608 |
|
|
gsize br, bw, len; |
| 609 |
|
|
GError *err = NULL; |
| 610 |
|
|
gchar *filename = get_filename_from_dialog("File Selection"); |
| 611 |
|
|
GtkTextIter p; |
| 612 |
|
|
|
| 613 |
|
|
if(!filename) return; |
| 614 |
aloha |
1.33 |
|
| 615 |
aloha |
1.16 |
gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 616 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, "\n\n", -1); |
| 617 |
aloha |
1.14 |
|
| 618 |
|
|
if(g_file_get_contents(filename, &contents, &len, NULL)) { |
| 619 |
|
|
if(!(text = g_locale_to_utf8(contents, -1, &br, &bw, &err))) |
| 620 |
aloha |
1.16 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, load_cstring_by_gauche(text), -1); |
| 621 |
aloha |
1.14 |
else |
| 622 |
aloha |
1.16 |
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, load_cstring_by_gauche(contents), -1); |
| 623 |
aloha |
1.14 |
} |
| 624 |
|
|
g_free(text); g_free(contents); g_free(filename); |
| 625 |
|
|
} |
| 626 |
|
|
|
| 627 |
aloha |
1.13 |
/* gauche ������������������������������������ */ |
| 628 |
|
|
static gchar *load_cstring_by_gauche(gchar *s) { |
| 629 |
|
|
gchar *msg; |
| 630 |
|
|
|
| 631 |
|
|
ScmObj result, error; |
| 632 |
|
|
/* ��������������������������������� */ |
| 633 |
aloha |
1.50 |
ScmObj is = Scm_MakeInputStringPort(SCM_STRING(SCM_MAKE_STR_COPYING(s)), TRUE); |
| 634 |
aloha |
1.13 |
/* ������������������������������ */ |
| 635 |
|
|
ScmObj os = Scm_MakeOutputStringPort(TRUE); |
| 636 |
|
|
|
| 637 |
aloha |
1.34 |
Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*input*")), is); |
| 638 |
|
|
Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*error*")), SCM_FALSE); |
| 639 |
aloha |
1.13 |
/* Scheme ��������������������������������������������������������������������������������� S ��������������������������������������������������������������������������� *error* ������������������ */ |
| 640 |
aloha |
1.34 |
result = Scm_EvalCString("(guard (e (else (set! *error* e) #f)) (eval (load-from-port *input*) (current-module)))", SCM_OBJ(Shiki_CURRENT_BUFFER_ENV)); |
| 641 |
aloha |
1.13 |
|
| 642 |
aloha |
1.34 |
error = Scm_GlobalVariableRef(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*error*")), 0); |
| 643 |
aloha |
1.13 |
|
| 644 |
|
|
/* ��������������������������������������������������������� */ |
| 645 |
|
|
if (!SCM_FALSEP(error)) |
| 646 |
|
|
Scm_Write(error, os, SCM_WRITE_DISPLAY); |
| 647 |
|
|
else |
| 648 |
|
|
Scm_Write(result, os, SCM_WRITE_DISPLAY); |
| 649 |
|
|
|
| 650 |
|
|
msg = Scm_GetString(SCM_STRING(Scm_GetOutputString(SCM_PORT(os)))); |
| 651 |
|
|
/* ������������������ */ |
| 652 |
|
|
Scm_ClosePort(SCM_PORT(is)); |
| 653 |
|
|
Scm_ClosePort(SCM_PORT(os)); |
| 654 |
|
|
|
| 655 |
|
|
return msg; |
| 656 |
|
|
} |
| 657 |
|
|
|
| 658 |
aloha |
1.12 |
static void font_selection_ok(GtkWidget *button, GtkWidget *font_dialog) { |
| 659 |
|
|
gchar *font_name = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (font_dialog)); |
| 660 |
|
|
if(font_name) { |
| 661 |
|
|
GtkRcStyle *style = gtk_rc_style_new (); |
| 662 |
|
|
pango_font_description_free(style->font_desc); |
| 663 |
|
|
style->font_desc = pango_font_description_from_string(font_name); |
| 664 |
aloha |
1.16 |
gtk_widget_modify_style (GTK_WIDGET(Shiki_CURRENT_TEXT_VIEW), style); |
| 665 |
aloha |
1.44 |
gtk_rc_style_unref (style); |
| 666 |
aloha |
1.12 |
g_free (font_name); |
| 667 |
|
|
} |
| 668 |
|
|
} |
| 669 |
|
|
|
| 670 |
aloha |
1.14 |
/* ������������������������������������������������������ */ |
| 671 |
aloha |
1.12 |
static void select_font(){ |
| 672 |
|
|
GtkWidget *font_dialog = gtk_font_selection_dialog_new("Font Selection Dialog"); |
| 673 |
|
|
g_signal_connect (GTK_FONT_SELECTION_DIALOG (font_dialog)->ok_button, "clicked", G_CALLBACK(font_selection_ok), font_dialog); |
| 674 |
|
|
gtk_dialog_run(GTK_DIALOG(font_dialog)); |
| 675 |
|
|
gtk_widget_destroy(font_dialog); |
| 676 |
|
|
} |
| 677 |
|
|
|
| 678 |
aloha |
1.11 |
/* ������������������������������������������ */ |
| 679 |
|
|
static void about_this_application() { |
| 680 |
|
|
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
| 681 |
|
|
const gchar *authors[] = { |
| 682 |
aloha |
1.23 |
"������������ (���������) <alohakun@gmail.com>\n", |
| 683 |
|
|
"Contribute : tkng ������", |
| 684 |
|
|
"(http://d.hatena.ne.jp/tkng/20061113)", NULL |
| 685 |
aloha |
1.11 |
}; |
| 686 |
|
|
gtk_about_dialog_set_authors(about, authors); |
| 687 |
|
|
gtk_about_dialog_set_copyright(about, "Copyright(C)2006 WAKATSUKI Toshihiro"); |
| 688 |
|
|
gtk_about_dialog_set_name(about, "��� (SHIKI)"); |
| 689 |
|
|
gtk_about_dialog_set_website_label(about, "���������30������������������������������������������������������������Blog"); |
| 690 |
|
|
gtk_about_dialog_set_website(about, "http://alohakun.blog7.fc2.com/blog-category-29.html"); |
| 691 |
|
|
gtk_dialog_run(GTK_DIALOG(about)); |
| 692 |
|
|
gtk_widget_destroy(GTK_WIDGET(about)); |
| 693 |
|
|
} |
| 694 |
|
|
|
| 695 |
aloha |
1.37 |
/* ��������� */ |
| 696 |
|
|
static void dummy_handler() { |
| 697 |
aloha |
1.42 |
GtkWidget *dummy = gtk_message_dialog_new(GTK_WINDOW(Shiki_EDITOR_WINDOW), |
| 698 |
|
|
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, |
| 699 |
|
|
"Sorry... This Button is Dummy."); |
| 700 |
|
|
gtk_dialog_run(GTK_DIALOG(dummy)); |
| 701 |
|
|
gtk_widget_destroy(dummy); |
| 702 |
aloha |
1.37 |
} |
| 703 |
|
|
|
| 704 |
aloha |
1.39 |
/* ��������������������������������������������������������������� */ |
| 705 |
|
|
static void update_modeline_label() { |
| 706 |
|
|
static gchar label[1024]; |
| 707 |
aloha |
1.10 |
GtkTextIter p; |
| 708 |
aloha |
1.39 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 709 |
aloha |
1.10 |
|
| 710 |
aloha |
1.39 |
g_snprintf(label, 1024, "--%s- %-10s (Gauche Interaction) [%s] L%d:%d ", |
| 711 |
aloha |
1.16 |
gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER) ? "**" : "--", |
| 712 |
aloha |
1.40 |
Shiki_CURRENT_BASENAME, |
| 713 |
aloha |
1.49 |
Shiki_CURRENT_CES, |
| 714 |
aloha |
1.39 |
gtk_text_iter_get_line(&p) + 1, |
| 715 |
|
|
gtk_text_iter_get_line_offset (&p) + 1); |
| 716 |
|
|
gtk_label_set_text(GTK_LABEL(Shiki_EDITOR_MODELINE_LABEL), label); |
| 717 |
aloha |
1.10 |
} |
| 718 |
|
|
|
| 719 |
|
|
static void text_buffer_cursor_moved_handler(){ |
| 720 |
|
|
update_modeline_label(); |
| 721 |
|
|
} |
| 722 |
aloha |
1.1 |
|
| 723 |
|
|
/* ��������������������������������������������������������������� */ |
| 724 |
|
|
static gchar* get_all_buffer_contents(GtkTextBuffer *buffer) { |
| 725 |
|
|
GtkTextIter start, end; |
| 726 |
|
|
gtk_text_buffer_get_start_iter(buffer, &start); |
| 727 |
|
|
gtk_text_buffer_get_end_iter(buffer, &end); |
| 728 |
|
|
return gtk_text_buffer_get_text(buffer, &start, &end, FALSE); |
| 729 |
|
|
} |
| 730 |
|
|
|
| 731 |
|
|
/* buffer ������������������������ filename ��������� */ |
| 732 |
|
|
static gboolean save_text_buffer(const gchar *filename, GtkTextBuffer *buffer) { |
| 733 |
|
|
gchar *contents, *text; |
| 734 |
|
|
gsize br, bw; |
| 735 |
|
|
GError *err = NULL; |
| 736 |
|
|
|
| 737 |
|
|
if(!filename) return FALSE; |
| 738 |
|
|
contents = get_all_buffer_contents(buffer); |
| 739 |
|
|
text = g_locale_from_utf8(contents, -1, &br, &bw, &err); |
| 740 |
|
|
/* ��������������������������������� */ |
| 741 |
|
|
g_file_set_contents(filename, text, -1, NULL); |
| 742 |
|
|
gtk_text_buffer_set_modified(buffer, FALSE); |
| 743 |
aloha |
1.10 |
update_modeline_label(); |
| 744 |
aloha |
1.1 |
g_free(contents); g_free(text); |
| 745 |
|
|
return TRUE; |
| 746 |
|
|
} |
| 747 |
|
|
|
| 748 |
|
|
/* ������������������������������������������������������msg ������������������������������������ */ |
| 749 |
|
|
static gchar *get_filename_from_dialog(const gchar *msg) { |
| 750 |
|
|
|
| 751 |
|
|
GtkWidget *dialog = gtk_file_selection_new(msg); |
| 752 |
aloha |
1.43 |
gint resp = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 753 |
aloha |
1.1 |
gchar *filename = NULL; |
| 754 |
|
|
|
| 755 |
|
|
/* gtk_file_selection_get_filename ������������������������������������������������������������������������������������������������������������������������������ */ |
| 756 |
|
|
if(resp == GTK_RESPONSE_OK) |
| 757 |
|
|
filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog))); |
| 758 |
|
|
|
| 759 |
|
|
gtk_widget_destroy(dialog); |
| 760 |
|
|
return filename; |
| 761 |
|
|
} |
| 762 |
|
|
|
| 763 |
|
|
/* ��������������������������������������������������������������������� */ |
| 764 |
aloha |
1.27 |
static void save_file() { |
| 765 |
aloha |
1.1 |
|
| 766 |
aloha |
1.22 |
/* ��������������������������������������� */ |
| 767 |
|
|
if(g_ascii_strcasecmp("*help*", Shiki_CURRENT_TAB_TITLE) == 0) return; |
| 768 |
aloha |
1.33 |
|
| 769 |
aloha |
1.1 |
/* ������������������������������������ */ |
| 770 |
aloha |
1.16 |
if(!gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER)) return; |
| 771 |
aloha |
1.1 |
|
| 772 |
|
|
/* ������������������������������������������������������������������������������������������������������ */ |
| 773 |
aloha |
1.16 |
if(g_ascii_strcasecmp("*scratch*", Shiki_CURRENT_TAB_TITLE) == 0) { |
| 774 |
aloha |
1.7 |
gchar *filename = get_filename_from_dialog("Save File As ..."); |
| 775 |
|
|
if(!filename) return; |
| 776 |
aloha |
1.16 |
if(!save_text_buffer(filename, Shiki_CURRENT_TEXT_BUFFER)) return; |
| 777 |
aloha |
1.27 |
gtk_notebook_set_tab_label_text(Shiki_EDITOR_NOTEBOOK, GTK_WIDGET(Shiki_CURRENT_TAB), filename); |
| 778 |
aloha |
1.16 |
gtk_window_set_title (GTK_WINDOW(Shiki_EDITOR_WINDOW), filename); |
| 779 |
aloha |
1.1 |
g_free(filename); |
| 780 |
|
|
} else |
| 781 |
aloha |
1.16 |
save_text_buffer(Shiki_CURRENT_TAB_TITLE, Shiki_CURRENT_TEXT_BUFFER); |
| 782 |
aloha |
1.1 |
} |
| 783 |
|
|
|
| 784 |
|
|
/* ��������������������������������������������������������������������������� */ |
| 785 |
aloha |
1.27 |
static void save_file_as() { |
| 786 |
aloha |
1.1 |
gchar *filename = get_filename_from_dialog("Save File As ..."); |
| 787 |
|
|
|
| 788 |
aloha |
1.7 |
if(!filename) return; |
| 789 |
aloha |
1.16 |
if(!save_text_buffer(filename, Shiki_CURRENT_TEXT_BUFFER)) return; |
| 790 |
aloha |
1.1 |
|
| 791 |
aloha |
1.27 |
gtk_notebook_set_tab_label_text(Shiki_EDITOR_NOTEBOOK, GTK_WIDGET(Shiki_CURRENT_TAB), filename); |
| 792 |
aloha |
1.16 |
gtk_window_set_title (GTK_WINDOW (Shiki_EDITOR_WINDOW), filename); |
| 793 |
aloha |
1.1 |
|
| 794 |
|
|
g_free(filename); |
| 795 |
|
|
} |
| 796 |
|
|
|
| 797 |
|
|
/* ��������������������������������������������� ? */ |
| 798 |
aloha |
1.17 |
static gboolean not_yet_save_changes_really_quit(GtkTextBuffer *buffer) { |
| 799 |
aloha |
1.43 |
GtkWidget *dialog; |
| 800 |
|
|
gint resp; |
| 801 |
aloha |
1.1 |
|
| 802 |
|
|
/* ��������������������������������������� */ |
| 803 |
|
|
if(!gtk_text_buffer_get_modified(buffer)) return FALSE; |
| 804 |
|
|
|
| 805 |
aloha |
1.43 |
dialog = gtk_message_dialog_new(GTK_WINDOW(Shiki_EDITOR_WINDOW), |
| 806 |
|
|
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, |
| 807 |
aloha |
1.46 |
GTK_BUTTONS_YES_NO, "������������������������������������������\n��������������������������������������� ?"); |
| 808 |
aloha |
1.43 |
|
| 809 |
|
|
resp = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 810 |
|
|
gtk_widget_destroy(dialog); |
| 811 |
|
|
/* "delete_event" ��������������� FALSE ���������"destory" ������������������window ������������������ */ |
| 812 |
|
|
if(GTK_RESPONSE_YES == resp) |
| 813 |
|
|
return FALSE; |
| 814 |
aloha |
1.1 |
return TRUE; |
| 815 |
|
|
} |
| 816 |
aloha |
1.43 |
|
| 817 |
aloha |
1.1 |
/* ������������������������������������������������������������������������������������������ */ |
| 818 |
aloha |
1.27 |
static gboolean delete_event_handler(GtkWidget *widget, GdkEvent *event, GtkTextBuffer *buffer){ |
| 819 |
|
|
return not_yet_save_changes_really_quit(buffer); |
| 820 |
aloha |
1.1 |
} |
| 821 |
|
|
|
| 822 |
|
|
/* ��������������������� */ |
| 823 |
aloha |
1.27 |
static void open_file(gchar *filename) { |
| 824 |
aloha |
1.49 |
gchar *text; |
| 825 |
|
|
gchar *utf8filename = g_locale_to_utf8(filename, -1, NULL, NULL, NULL); |
| 826 |
|
|
GtkTextIter p; |
| 827 |
aloha |
1.50 |
ScmObj s; |
| 828 |
|
|
|
| 829 |
|
|
/* g_file_get_contents(filename, &contents, &len, NULL); */ |
| 830 |
|
|
|
| 831 |
aloha |
1.49 |
/* ������������������������������ */ |
| 832 |
aloha |
1.51 |
get_buffer_create(g_strdup(filename)); |
| 833 |
aloha |
1.50 |
gtk_window_set_title (GTK_WINDOW (Shiki_EDITOR_WINDOW), filename); |
| 834 |
|
|
g_free(filename); |
| 835 |
|
|
|
| 836 |
|
|
Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*filename*")), SCM_MAKE_STR_COPYING(utf8filename)); |
| 837 |
|
|
g_free(utf8filename); |
| 838 |
aloha |
1.33 |
|
| 839 |
aloha |
1.49 |
Scm_EvalCString("(use gauche.charconv)", Shiki_CURRENT_BUFFER_ENV); |
| 840 |
aloha |
1.50 |
/* |
| 841 |
aloha |
1.49 |
Scm_EvalCString("(define contents (call-with-input-file *filename* port->string))", Shiki_CURRENT_BUFFER_ENV); |
| 842 |
|
|
Scm_EvalCString("(define ces (ces-guess-from-string contents \"*JP\"))", Shiki_CURRENT_BUFFER_ENV); |
| 843 |
|
|
ces = Scm_EvalCString("ces", Shiki_CURRENT_BUFFER_ENV); |
| 844 |
|
|
Shiki_CURRENT_CES = Scm_GetString(SCM_STRING(ces)); |
| 845 |
aloha |
1.50 |
//s = Scm_EvalCString("(ces-convert contents ces)", Shiki_CURRENT_BUFFER_ENV); |
| 846 |
|
|
s = Scm_EvalCString("(ces-convert contents `utf8)", Shiki_CURRENT_BUFFER_ENV); |
| 847 |
|
|
*/ |
| 848 |
|
|
|
| 849 |
|
|
/* ������������������������������������������������������������������������������ */ |
| 850 |
|
|
s = Scm_EvalCString("(port->string (open-input-conversion-port (open-input-file *filename*) \"*jp\" :owner? #t))", Shiki_CURRENT_BUFFER_ENV); |
| 851 |
aloha |
1.49 |
text = Scm_GetString(SCM_STRING(s)); |
| 852 |
|
|
gtk_text_buffer_set_text(Shiki_CURRENT_TEXT_BUFFER, text, -1); |
| 853 |
aloha |
1.50 |
|
| 854 |
aloha |
1.49 |
/* ������������������������ */ |
| 855 |
|
|
gtk_text_buffer_set_modified(Shiki_CURRENT_TEXT_BUFFER, FALSE); |
| 856 |
|
|
/* ������������������������������ */ |
| 857 |
|
|
gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 858 |
|
|
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 859 |
|
|
update_modeline_label(); |
| 860 |
|
|
/* ��������������������������������� */ |
| 861 |
|
|
scheme_keyword_highlighting_current_buffer(); |
| 862 |
aloha |
1.50 |
gtk_widget_show_all(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK)); |
| 863 |
aloha |
1.1 |
} |
| 864 |
|
|
|
| 865 |
aloha |
1.21 |
/* ��������������������������������������������������� */ |
| 866 |
aloha |
1.27 |
static void open_file_handler() { |
| 867 |
aloha |
1.21 |
gchar *filename = get_filename_from_dialog("File Selection"); |
| 868 |
|
|
|
| 869 |
|
|
if(!filename) return; |
| 870 |
aloha |
1.27 |
open_file(filename); |
| 871 |
aloha |
1.1 |
} |
| 872 |
|
|
|
| 873 |
|
|
/* gauche ��������������������������������� */ |
| 874 |
|
|
static gchar *eval_cstring_by_gauche(gchar *s) { |
| 875 |
|
|
gchar *msg; |
| 876 |
|
|
|
| 877 |
|
|
ScmObj result, error; |
| 878 |
|
|
/* ������������������������������ */ |
| 879 |
|
|
ScmObj os = Scm_MakeOutputStringPort(TRUE); |
| 880 |
|
|
|
| 881 |
|
|
/* Scheme ��������������������������������������� */ |
| 882 |
|
|
/* http://alohakun.blog7.fc2.com/blog-entry-517.html */ |
| 883 |
aloha |
1.50 |
Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*input*")), SCM_MAKE_STR_COPYING(s)); |
| 884 |
aloha |
1.34 |
Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*error*")), SCM_FALSE); |
| 885 |
aloha |
1.1 |
|
| 886 |
aloha |
1.34 |
result = Scm_EvalCString("(guard (e (else (set! *error* e) #f)) (eval (read-from-string *input*) (current-module)))", SCM_OBJ(Shiki_CURRENT_BUFFER_ENV)); |
| 887 |
aloha |
1.1 |
|
| 888 |
aloha |
1.34 |
error = Scm_GlobalVariableRef(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*error*")), 0); |
| 889 |
aloha |
1.1 |
|
| 890 |
|
|
/* ��������������������������������������������������������� */ |
| 891 |
|
|
if (!SCM_FALSEP(error)) |
| 892 |
|
|
Scm_Write(error, os, SCM_WRITE_DISPLAY); |
| 893 |
|
|
else |
| 894 |
|
|
Scm_Write(result, os, SCM_WRITE_DISPLAY); |
| 895 |
|
|
|
| 896 |
|
|
msg = Scm_GetString(SCM_STRING(Scm_GetOutputString(SCM_PORT(os)))); |
| 897 |
|
|
/* ������������������ */ |
| 898 |
|
|
Scm_ClosePort(SCM_PORT(os)); |
| 899 |
|
|
|
| 900 |
|
|
return msg; |
| 901 |
|
|
} |
| 902 |
|
|
|
| 903 |
aloha |
1.13 |
/* ������������������������������������������������������������������ S ��������������� (������������) */ |
| 904 |
aloha |
1.27 |
static void load_region_by_gauche() { |
| 905 |
aloha |
1.1 |
|
| 906 |
|
|
GtkTextIter start, end, p; |
| 907 |
|
|
gchar *code; |
| 908 |
aloha |
1.16 |
gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 909 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, "\n\n", -1); |
| 910 |
aloha |
1.1 |
|
| 911 |
|
|
/* ������������������������������������������������������������ */ |
| 912 |
aloha |
1.16 |
if(gtk_text_buffer_get_selection_bounds(Shiki_CURRENT_TEXT_BUFFER, &start, &end)) { |
| 913 |
|
|
code = gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &start, &end, FALSE); |
| 914 |
|
|
gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, load_cstring_by_gauche(code), -1); |
| 915 |
aloha |
1.1 |
g_free(code); |
| 916 |
|
|
} |
| 917 |
|
|
} |
| 918 |
|
|
|
| 919 |
|
|
// GtkTextCharPredicate |
| 920 |
|
|
static gboolean is_kakko_or_kokka(gunichar ch, gpointer p) { |
| 921 |
|
|
return ch == '(' || ch == ')'; |
| 922 |
|
|
} |
| 923 |
aloha |
1.29 |
static gboolean is_kakko(gunichar ch, gpointer p) {return ch == '(';} |
| 924 |
aloha |
1.1 |
static gboolean is_kokka(gunichar ch, gpointer p) {return ch == ')';} |
| 925 |
|
|
|
| 926 |
aloha |
1.30 |
/* ��������������������� '(' ��������������� ')' ������������������ (S ���) ��������������� */ |
| 927 |
|
|
static gboolean search_sexp(GtkTextIter *start, GtkTextIter *end) { |
| 928 |
aloha |
1.33 |
|
| 929 |
aloha |
1.30 |
/* ������������������������������ */ |
| 930 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, start, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 931 |
|
|
|
| 932 |
|
|
if(gtk_text_iter_get_char(start) != '(') |
| 933 |
|
|
gtk_text_iter_forward_find_char(start, is_kakko, NULL, NULL); |
| 934 |
|
|
|
| 935 |
|
|
*end = *start; |
| 936 |
|
|
|
| 937 |
|
|
/* ��������������������������������� S ������������������ */ |
| 938 |
|
|
if(!search_sexp_kokka(end)) return FALSE; |
| 939 |
|
|
gtk_text_iter_forward_char(end); |
| 940 |
|
|
return TRUE; |
| 941 |
|
|
} |
| 942 |
|
|
|
| 943 |
|
|
static gboolean search_sexp_kokka(GtkTextIter *end) { |
| 944 |
aloha |
1.29 |
gint nest_level = 0; |
| 945 |
aloha |
1.33 |
|
| 946 |
aloha |
1.30 |
/* ������������ ')' ��������� */ |
| 947 |
aloha |
1.29 |
while(1) { |
| 948 |
aloha |
1.30 |
if(!gtk_text_iter_forward_find_char(end, is_kakko_or_kokka, NULL, NULL)) |
| 949 |
aloha |
1.29 |
return FALSE; |
| 950 |
|
|
|
| 951 |
aloha |
1.30 |
if(gtk_text_iter_get_char(end) == '(') |
| 952 |
aloha |
1.29 |
nest_level++; |
| 953 |
|
|
else { |
| 954 |
|
|
if(!nest_level) |
| 955 |
|
|
break; |
| 956 |
|
|
else |
| 957 |
|
|
nest_level--; |
| 958 |
|
|
} |
| 959 |
|
|
} |
| 960 |
|
|
return TRUE; |
| 961 |
|
|
} |
| 962 |
aloha |
1.1 |
|
| 963 |
aloha |
1.30 |
/* ��������������������� ')' ��������������� '(' ������������������ (S ���) ��������������� */ |
| 964 |
|
|
static gboolean search_last_sexp(GtkTextIter *start, GtkTextIter *end) { |
| 965 |
|
|
|
| 966 |
|
|
/* ������������������������������ */ |
| 967 |
|
|
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, end, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 968 |
|
|
|
| 969 |
|
|
gtk_text_iter_backward_char(end); |
| 970 |
aloha |
1.33 |
|
| 971 |
aloha |
1.30 |
if(gtk_text_iter_get_char(end) != ')') |
| 972 |
|
|
gtk_text_iter_backward_find_char(end, is_kokka, NULL, NULL); |
| 973 |
|
|
*start = *end; |
| 974 |
|
|
gtk_text_iter_forward_char(end); |
| 975 |
|
|
|
| 976 |
|
|
/* ��������������������������������� S ������������������ */ |
| 977 |
|
|
if(!search_last_sexp_kakko(start)) return FALSE; |
| 978 |
|
|
|
| 979 |
|
|
return TRUE; |
| 980 |
|
|
} |
| 981 |
|
|
|
| 982 |
aloha |
1.1 |
/* ')' ��������������� '(' ������������������ (S ���) ��������������� */ |
| 983 |
aloha |
1.29 |
static gboolean search_last_sexp_kakko(GtkTextIter *start) { |
| 984 |
aloha |
1.1 |
gint nest_level = 0; |
| 985 |
aloha |
1.30 |
/* ��������������������������������������� ')' ��������� */ |
| 986 |
aloha |
1.1 |
while(1) { |
| 987 |
|
|
if(!gtk_text_iter_backward_find_char(start, is_kakko_or_kokka, NULL, NULL)) |
| 988 |
|
|
return FALSE; |
| 989 |
|
|
|
| 990 |
|
|
if(gtk_text_iter_get_char(start) == ')') |
| 991 |
|
|
nest_level++; |
| 992 |
|
|
else { |
| 993 |
|
|
if(!nest_level) |
| 994 |
|
|
break; |
| 995 |
|
|
else |
| 996 |
|
|
nest_level--; |
| 997 |
|
|
} |
| 998 |
|
|
} |
| 999 |
|
|
return TRUE; |
| 1000 |
|
|
} |
| 1001 |
|
|
|
| 1002 |
|
|
/* ������������������������������������������������ */ |
| 1003 |
|
|
static gint get_parent_nest_level_at_cursor(GtkTextBuffer *buffer) { |
| 1004 |
|
|
gint nest_level = 0; |
| 1005 |
|
|
GtkTextIter start, end; |
| 1006 |
|
|
gtk_text_buffer_get_start_iter(buffer, &start); |
| 1007 |
|
|
if(gtk_text_iter_get_char(&start) == '(') nest_level++; |
| 1008 |
|
|
|
| 1009 |
|
|
/* ��������������������� (= end) ��������� */ |
| 1010 |
|
|
gtk_text_buffer_get_iter_at_mark(buffer,&end, gtk_text_buffer_get_insert(buffer)); |
| 1011 |
|
|
|
| 1012 |
|
|
while(1) { |
| 1013 |
|
|
/* end ������ '(' ��� ')' ��������������������������������������������� */ |
| 1014 |
|
|
if(!gtk_text_iter_forward_find_char(&start, is_kakko_or_kokka, NULL, &end)) |
| 1015 |
|
|
return nest_level; |
| 1016 |
|
|
|
| 1017 |
|
|
if(gtk_text_iter_get_char(&start) == '(') |
| 1018 |
|
|
nest_level++; |
| 1019 |
|
|
else |
| 1020 |
|
|
nest_level--; |
| 1021 |
|
|
} |
| 1022 |
|
|
} |
| 1023 |
|
|
|
| 1024 |
|
|
/* ��������������������������������� on/off */ |
| 1025 |
|
|
static void tabsborder_on_off(GtkButton *button, GtkNotebook *notebook) { |
| 1026 |
|
|
gint tval = FALSE; |
| 1027 |
|
|
gint bval = FALSE; |
| 1028 |
|
|
if(notebook->show_tabs == FALSE) |
| 1029 |
|
|
tval = TRUE; |
| 1030 |
|
|
if(notebook->show_border == FALSE) |
| 1031 |
|
|
bval = TRUE; |
| 1032 |
|
|
|
| 1033 |
|
|
gtk_notebook_set_show_tabs(notebook, tval); |
| 1034 |
|
|
gtk_notebook_set_show_border(notebook, bval); |
| 1035 |
|
|
} |
| 1036 |
|
|
|
| 1037 |
|
|
/* ������������������������ */ |
| 1038 |
aloha |
1.17 |
static void rotate_tab_position(GtkButton *button, GtkNotebook *notebook ) { |
| 1039 |
aloha |
1.1 |
gtk_notebook_set_tab_pos(notebook, (notebook->tab_pos + 1) % 4); |
| 1040 |
|
|
} |
| 1041 |
|
|
|
| 1042 |
|
|
/* ������������������������������������������ */ |
| 1043 |
|
|
|
| 1044 |
aloha |
1.3 |
/* ��������������������� ^npfb */ |
| 1045 |
aloha |
1.7 |
static void forward_current_buffer() { |
| 1046 |
aloha |
1.3 |
GtkTextIter p; |
| 1047 |
aloha |
1.16 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 1048 |
aloha |
1.3 |
gtk_text_iter_forward_char(&p); |
| 1049 |
aloha |
1.16 |
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1050 |
aloha |
1.3 |
} |
| 1051 |
aloha |
1.7 |
static void backward_current_buffer() { |
| 1052 |
aloha |
1.3 |
GtkTextIter p; |
| 1053 |
aloha |
1.16 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 1054 |
aloha |
1.3 |
gtk_text_iter_backward_char(&p); |
| 1055 |
aloha |
1.16 |
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1056 |
aloha |
1.3 |
} |
| 1057 |
aloha |
1.7 |
static void line_forward_current_buffer() { |
| 1058 |
aloha |
1.3 |
GtkTextIter p; |
| 1059 |
aloha |
1.16 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 1060 |
|
|
gtk_text_view_forward_display_line(Shiki_CURRENT_TEXT_VIEW, &p); |
| 1061 |
|
|
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1062 |
aloha |
1.7 |
} |
| 1063 |
|
|
static void line_backward_current_buffer() { |
| 1064 |
aloha |
1.3 |
GtkTextIter p; |
| 1065 |
aloha |
1.16 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 1066 |
|
|
gtk_text_view_backward_display_line(Shiki_CURRENT_TEXT_VIEW, &p); |
| 1067 |
|
|
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1068 |
aloha |
1.3 |
} |
| 1069 |
|
|
|
| 1070 |
aloha |
1.1 |
/* ��������������������� */ |
| 1071 |
aloha |
1.8 |
static gboolean signal_key_release_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid) { |
| 1072 |
|
|
static gint metakey_pressed = 0; |
| 1073 |
aloha |
1.6 |
static gint controlx_pressed = 0; |
| 1074 |
aloha |
1.1 |
|
| 1075 |
|
|
if(event->keyval == GDK_parenright && event->state & GDK_SHIFT_MASK) { |
| 1076 |
|
|
GtkTextIter start, end; |
| 1077 |
|
|
|
| 1078 |
|
|
/* ������������������������������ */ |
| 1079 |
aloha |
1.16 |
gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &end, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER)); |
| 1080 |
aloha |
1.1 |
|
| 1081 |
|
|
start = end; |
| 1082 |
|
|
gtk_text_iter_backward_char(&start); |
| 1083 |
|
|
|
| 1084 |
|
|
/* ��������������������������������� S ������������������ */ |
| 1085 |
aloha |
1.29 |
if(!search_last_sexp_kakko(&start)) return FALSE; |
| 1086 |
aloha |
1.1 |
|
| 1087 |
aloha |
1.16 |
gtk_text_buffer_apply_tag_by_name(Shiki_CURRENT_TEXT_BUFFER, "parent_emphasis_background", &start, &end); |
| 1088 |
aloha |
1.1 |
} |
| 1089 |
|
|
|
| 1090 |
|
|
/* ������������������������������������������������������������������������������������������������ (���������������) ������������������ */ |
| 1091 |
|
|
if(event->keyval == GDK_Return) { |
| 1092 |
aloha |
1.16 |
gint indentWidth = get_parent_nest_level_at_cursor(Shiki_CURRENT_TEXT_BUFFER) * editor_indent_width; |
| 1093 |
aloha |
1.1 |
gchar *indent = g_strnfill(indentWidth, ' '); |
| 1094 |
aloha |
1.16 |
gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, indent, -1); |
| 1095 |
aloha |
1.1 |
g_free(indent); |
| 1096 |
|
|
} |
| 1097 |
|
|
|
| 1098 |
aloha |
1.6 |
/* C-x */ |
| 1099 |
|
|
if(event->keyval == GDK_x && event->state & GDK_CONTROL_MASK) { |
| 1100 |
|
|
controlx_pressed++; |
| 1101 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "C-x -"); |
| 1102 |
aloha |
1.6 |
} else if(event->state & GDK_CONTROL_MASK) { |
| 1103 |
aloha |
1.8 |
|
| 1104 |
aloha |
1.6 |
if(controlx_pressed > 0) { |
| 1105 |
|
|
switch(event->keyval) { |
| 1106 |
|
|
case GDK_c :/* C-x C-c : ������ */ |
| 1107 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "C-c"); |
| 1108 |
aloha |
1.6 |
{/* "delete-event" ��������������������������������������� �� ������������������������������������ */ |
| 1109 |
|
|
GdkEvent ev; |
| 1110 |
|
|
|
| 1111 |
|
|
ev.any.type = GDK_DELETE; |
| 1112 |
aloha |
1.16 |
ev.any.window = Shiki_EDITOR_WINDOW->window; |
| 1113 |
aloha |
1.6 |
ev.any.send_event = FALSE; |
| 1114 |
|
|
gdk_event_put (&ev); |
| 1115 |
|
|
} |
| 1116 |
|
|
break; |
| 1117 |
|
|
|
| 1118 |
|
|
case GDK_f : /* C-x C-f : ������������������ */ |
| 1119 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "C-f"); |
| 1120 |
aloha |
1.27 |
open_file_handler(); |
| 1121 |
aloha |
1.6 |
break; |
| 1122 |
|
|
|
| 1123 |
|
|
case GDK_s : /* C-x C-s : ������������������ */ |
| 1124 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "C-s"); |
| 1125 |
aloha |
1.27 |
save_file(); |
| 1126 |
aloha |
1.6 |
break; |
| 1127 |
|
|
|
| 1128 |
|
|
case GDK_w : /* C-x C-w : ������������������������ */ |
| 1129 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "C-w"); |
| 1130 |
aloha |
1.27 |
save_file_as(); |
| 1131 |
aloha |
1.6 |
break; |
| 1132 |
|
|
} |
| 1133 |
|
|
controlx_pressed = 0; |
| 1134 |
|
|
} |
| 1135 |
aloha |
1.8 |
|
| 1136 |
|
|
switch(event->keyval) { |
| 1137 |
|
|
case GDK_g :/* C-g : ��������������� */ |
| 1138 |
|
|
metakey_pressed = 0; |
| 1139 |
|
|
controlx_pressed = 0; |
| 1140 |
|
|
|
| 1141 |
aloha |
1.16 |
gtk_statusbar_push(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), GPOINTER_TO_INT(contextid), "Quit"); |
| 1142 |
aloha |
1.8 |
break; |
| 1143 |
|
|
} |
| 1144 |
|
|
|
| 1145 |
aloha |
1.6 |
} |
| 1146 |
aloha |
1.1 |
return FALSE; |
| 1147 |
|
|
} |
| 1148 |
aloha |
1.27 |
static void open_online_help() { |
| 1149 |
aloha |
1.22 |
GtkTextIter p; |
| 1150 |
aloha |
1.51 |
get_buffer_create(g_strdup("*help*")); |
| 1151 |
aloha |
1.22 |
gtk_text_buffer_set_text(Shiki_CURRENT_TEXT_BUFFER, |
| 1152 |
aloha |
1.37 |
"������������������������������������������\n" |
| 1153 |
aloha |
1.30 |
"$ ./shiki [file1 file2 ....]\n\n" |
| 1154 |
|
|
"[���������������������������] ��������������������� (C-x C-f)\n" |
| 1155 |
|
|
"[������������������������������������������] ��������������������� (C-x C-s)\n" |
| 1156 |
|
|
"[���������������������������������������������] ��������������������������� (C-x C-w)\n" |
| 1157 |
aloha |
1.37 |
"[���������������������] ��������������� gauche ������������\n" |
| 1158 |
aloha |
1.30 |
"[��������������� (���������) ���������������] ��������� on/off\n" |
| 1159 |
|
|
"[������ (���������) ���������������] ������������������������\n" |
| 1160 |
aloha |
1.37 |
"[������������������] ��������������������������� (C-t)\n" |
| 1161 |
aloha |
1.33 |
"[���������������������������] ������������ (C-_)\n" |
| 1162 |
aloha |
1.30 |
"[���������������������] ������������������������\n" |
| 1163 |
aloha |
1.44 |
"\n" |
| 1164 |
|
|
"(��� : ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ Undo ������������������)\n" |
| 1165 |
|
|
"\n" |
| 1166 |
aloha |
1.37 |
"[�� ������������] ������������������������ (C-k)\n" |
| 1167 |
aloha |
1.30 |
"[A ������������] ���������������������\n" |
| 1168 |
|
|
"[���������������������������] Scheme ������������������������\n" |
| 1169 |
|
|
"[���������������������������������] ���������������������������������������\n" |
| 1170 |
|
|
"[��������� (?) ������������] ���������������������������������������\n" |
| 1171 |
aloha |
1.33 |
"[info ������������] ���������������������������������������������������\n" |
| 1172 |
|
|
"\n" |
| 1173 |
aloha |
1.30 |
"C-f : ��� ��������� (forward)\n" |
| 1174 |
|
|
"C-b : ��� ��������� (backward)\n" |
| 1175 |
|
|
"C-n : ��� ��������� (next line)\n" |
| 1176 |
aloha |
1.33 |
"C-p : ��� ��������� (previous line)\n" |
| 1177 |
|
|
"\n" |
| 1178 |
|
|
"C-h : ���������������������\n" |
| 1179 |
aloha |
1.31 |
"C-w : ���������\n" |
| 1180 |
aloha |
1.33 |
"C-y : ��������� (������������)\n" |
| 1181 |
|
|
"\n" |
| 1182 |
aloha |
1.30 |
"C-e : ��������������������� S ������������ (eval-expression)\n" |
| 1183 |
|
|
"C-j : ��������������������� S ������������ (eval-last-sexp)\n" |
| 1184 |
aloha |
1.33 |
"(emacs/xyzzy ��� *scratch* ���������������������)\n" |
| 1185 |
|
|
"\n" |
| 1186 |
aloha |
1.31 |
"C-M-@ : ��������������������� S ������������ (mark-sexp)\n" |
| 1187 |
|
|
"C-M-SPC : ��������������������� S ������������ (mark-last-sexp)\n" |
| 1188 |
aloha |
1.33 |
"C-x C-c : ��������������������������� �� ���������������������������������\n" |
| 1189 |
aloha |
1.51 |
"\n" |
| 1190 |
|
|
"������������ API\n" |
| 1191 |
|
|
"(clear-current-buffer) : ��������������������������������� (������������)\n" |
| 1192 |
aloha |
1.44 |
, -1); |
| 1193 |
aloha |
1.30 |
gtk_text_buffer_set_modified(Shiki_CURRENT_TEXT_BUFFER, FALSE); |
| 1194 |
|
|
/* ������������������������������ */ |
| 1195 |
|
|
gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1196 |
|
|
gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p); |
| 1197 |
aloha |
1.22 |
} |
| 1198 |
|
|
|
| 1199 |
aloha |
1.1 |
/* ��������������������������������������� */ |
| 1200 |
aloha |
1.54 |
static void Shiki_editor_window_init(int argc, char **argv) { |
| 1201 |
aloha |
1.39 |
GtkWidget *vbox, *toolbar, *modeline_bg = gtk_event_box_new(); |
| 1202 |
aloha |
1.1 |
GtkToolItem *icon; |
| 1203 |
|
|
GtkIconSize iconsize; |
| 1204 |
aloha |
1.2 |
GtkTooltips *toolbar_tips = gtk_tooltips_new(); |
| 1205 |
aloha |
1.1 |
/* ��������������������������������������������������������������������������������� */ |
| 1206 |
|
|
GtkToolItem *oicon, *sicon, *saicon, *eicon; |
| 1207 |
|
|
|
| 1208 |
aloha |
1.36 |
gint contextid, i; |
| 1209 |
|
|
|
| 1210 |
|
|
/* ������������������������������������������������������������������������������ */ |
| 1211 |
|
|
keywords_hash = g_hash_table_new(g_str_hash, g_str_equal); |
| 1212 |
|
|
i = 0; |
| 1213 |
|
|
while(R5RS_keywords[i] != NULL) |
| 1214 |
|
|
g_hash_table_insert(keywords_hash, R5RS_keywords[i++], GINT_TO_POINTER(R5RS_KEYWORD_COLOR)); |
| 1215 |
|
|
i = 0; |
| 1216 |
|
|
while(R5RS_functions[i] != NULL) |
| 1217 |
|
|
g_hash_table_insert(keywords_hash, R5RS_functions[i++], GINT_TO_POINTER(R5RS_FUNCTION_COLOR)); |
| 1218 |
aloha |
1.8 |
|
| 1219 |
aloha |
1.1 |
/* ������������ */ |
| 1220 |
aloha |
1.16 |
Shiki_EDITOR_WINDOW = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 1221 |
|
|
g_signal_connect(G_OBJECT(Shiki_EDITOR_WINDOW), "destroy", G_CALLBACK(gtk_main_quit), NULL); |
| 1222 |
aloha |
1.1 |
|
| 1223 |
aloha |
1.31 |
/* ������������������������������������������������������������ */ |
| 1224 |
|
|
Shiki_EDITOR_CLIPBOARD = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
| 1225 |
|
|
|
| 1226 |
aloha |
1.1 |
/* ������������������������������������ */ |
| 1227 |
|
|
vbox = gtk_vbox_new(FALSE, 0); |
| 1228 |
|
|
/* ��������������������� */ |
| 1229 |
|
|
toolbar = gtk_toolbar_new(); |
| 1230 |
|
|
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
| 1231 |
|
|
|
| 1232 |
aloha |
1.26 |
Shiki_EDITOR_NOTEBOOK = GTK_NOTEBOOK(gtk_notebook_new()); |
| 1233 |
|
|
g_signal_connect(G_OBJECT(Shiki_EDITOR_NOTEBOOK), "switch-page", GTK_SIGNAL_FUNC(switch_tabpage_handler), NULL); |
| 1234 |
aloha |
1.1 |
|
| 1235 |
|
|
/* ������������������������������������������������ */ |
| 1236 |
|
|
gtk_toolbar_set_style(GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); |
| 1237 |
|
|
iconsize = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar)); |
| 1238 |
|
|
|
| 1239 |
|
|
/* ������������������ */ |
| 1240 |
|
|
|
| 1241 |
|
|
/* ������������������ */ |
| 1242 |
aloha |
1.45 |
oicon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_OPEN, iconsize), ""); |
| 1243 |
aloha |
1.1 |
/* ������������������������������������������������������������������������������������ */ |
| 1244 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(oicon), "clicked", G_CALLBACK(open_file_handler), NULL); |
| 1245 |
aloha |
1.1 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(oicon)); |
| 1246 |
aloha |
1.2 |
gtk_tool_item_set_tooltip(oicon, toolbar_tips, "���������������������������", |
| 1247 |
|
|
"���������������������������������������������������������������������������������������"); |
| 1248 |
aloha |
1.1 |
|
| 1249 |
|
|
/* ������������������ */ |
| 1250 |
aloha |
1.45 |
sicon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_SAVE, iconsize), ""); |
| 1251 |
aloha |
1.1 |
/* ������������������������������������������������������������������������������������ */ |
| 1252 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(sicon), "clicked", G_CALLBACK(save_file), NULL); |
| 1253 |
aloha |
1.1 |
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET(sicon)); |
| 1254 |
aloha |
1.2 |
gtk_tool_item_set_tooltip(sicon, toolbar_tips, "������������������������������", |
| 1255 |
|
|
"������������������������������������������������������������������������������������������������������������������������������������"); |
| 1256 |
aloha |
1.1 |
|
| 1257 |
|
|
/* ��������������������������� */ |
| 1258 |
aloha |
1.45 |
saicon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, iconsize), ""); |
| 1259 |
aloha |
1.1 |
/* ������������������������������������������������������������������������������������������������������������������ */ |
| 1260 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(saicon), "clicked", G_CALLBACK(save_file_as), NULL); |
| 1261 |
aloha |
1.2 |
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET(saicon)); |
| 1262 |
|
|
gtk_tool_item_set_tooltip(saicon, toolbar_tips, "������������������������������������", |
| 1263 |
|
|
""); |
| 1264 |
aloha |
1.1 |
|
| 1265 |
|
|
/* ������������������ */ |
| 1266 |
aloha |
1.45 |
eicon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_EXECUTE, iconsize), ""); |
| 1267 |
aloha |
1.14 |
/* ������������������������������������������ libgauche ������������������ */ |
| 1268 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(eicon), "clicked", G_CALLBACK(load_region_by_gauche), NULL); |
| 1269 |
aloha |
1.1 |
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET(eicon)); |
| 1270 |
aloha |
1.14 |
gtk_tool_item_set_tooltip(eicon, toolbar_tips, "��������������� S ������������������������ (load-region-lisp)", |
| 1271 |
aloha |
1.2 |
"Scheme (gauche) ������������������ S ������������������������"); |
| 1272 |
aloha |
1.1 |
|
| 1273 |
aloha |
1.16 |
gtk_container_add(GTK_CONTAINER(Shiki_EDITOR_WINDOW), vbox); |
| 1274 |
aloha |
1.26 |
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(Shiki_EDITOR_NOTEBOOK)); |
| 1275 |
aloha |
1.1 |
|
| 1276 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_NEW, iconsize), ""); |
| 1277 |
aloha |
1.33 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(append_default_tabpage_handler), NULL); |
| 1278 |
aloha |
1.1 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1279 |
aloha |
1.6 |
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������������������������������", ""); |
| 1280 |
aloha |
1.1 |
|
| 1281 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_UNDO, iconsize), ""); |
| 1282 |
aloha |
1.33 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(undo), G_OBJECT(Shiki_EDITOR_NOTEBOOK)); |
| 1283 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1284 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "Undo",""); |
| 1285 |
|
|
|
| 1286 |
aloha |
1.37 |
/* XXX : TODO */ |
| 1287 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_REDO, iconsize), ""); |
| 1288 |
aloha |
1.38 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(dummy_handler), NULL); |
| 1289 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1290 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "Redo", ""); |
| 1291 |
aloha |
1.37 |
|
| 1292 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_FIND, iconsize), ""); |
| 1293 |
aloha |
1.46 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(search_current_buffer), NULL); |
| 1294 |
aloha |
1.37 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1295 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������", ""); |
| 1296 |
|
|
|
| 1297 |
|
|
|
| 1298 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_FIND_AND_REPLACE, iconsize), ""); |
| 1299 |
aloha |
1.47 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(replace_current_buffer), NULL); |
| 1300 |
aloha |
1.37 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1301 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������", ""); |
| 1302 |
|
|
|
| 1303 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_REFRESH, iconsize), ""); |
| 1304 |
aloha |
1.37 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(dummy_handler), NULL); |
| 1305 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1306 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������������", ""); |
| 1307 |
|
|
|
| 1308 |
|
|
/* TODO ������������ */ |
| 1309 |
|
|
|
| 1310 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_DELETE, iconsize), ""); |
| 1311 |
aloha |
1.26 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(clear_current_buffer), G_OBJECT(Shiki_EDITOR_NOTEBOOK)); |
| 1312 |
aloha |
1.15 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1313 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������������������������������", |
| 1314 |
|
|
"���������������������������������������������������������������������"); |
| 1315 |
|
|
|
| 1316 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_CLOSE, iconsize), ""); |
| 1317 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(remove_tabpage), NULL); |
| 1318 |
aloha |
1.1 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1319 |
aloha |
1.2 |
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������������������������", |
| 1320 |
|
|
"���������������������������������������������������������������"); |
| 1321 |
aloha |
1.15 |
|
| 1322 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_CONNECT, iconsize), ""); |
| 1323 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(load_scheme_file_by_gauche), NULL); |
| 1324 |
aloha |
1.14 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1325 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "Scheme ������������������������", ""); |
| 1326 |
|
|
|
| 1327 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_CONVERT, iconsize), ""); |
| 1328 |
aloha |
1.26 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(load_buffer_by_gauche), G_OBJECT(Shiki_EDITOR_NOTEBOOK)); |
| 1329 |
aloha |
1.14 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1330 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������������������������", ""); |
| 1331 |
|
|
|
| 1332 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_SPELL_CHECK, iconsize), ""); |
| 1333 |
aloha |
1.37 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(scheme_keyword_highlighting_current_buffer), NULL); |
| 1334 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1335 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������������������������������������������", ""); |
| 1336 |
|
|
|
| 1337 |
|
|
|
| 1338 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, iconsize), ""); |
| 1339 |
aloha |
1.27 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(open_online_help), NULL); |
| 1340 |
aloha |
1.22 |
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1341 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������", ""); |
| 1342 |
aloha |
1.49 |
|
| 1343 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_BOLD, iconsize), ""); |
| 1344 |
aloha |
1.38 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(select_font), NULL); |
| 1345 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1346 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������������������", ""); |
| 1347 |
|
|
|
| 1348 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_APPLY, iconsize), ""); |
| 1349 |
aloha |
1.38 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(tabsborder_on_off), G_OBJECT(Shiki_EDITOR_NOTEBOOK)); |
| 1350 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1351 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "��������� on/off", ""); |
| 1352 |
|
|
|
| 1353 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, iconsize), ""); |
| 1354 |
aloha |
1.38 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(rotate_tab_position), G_OBJECT(Shiki_EDITOR_NOTEBOOK)); |
| 1355 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1356 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "���������������������", ""); |
| 1357 |
aloha |
1.22 |
|
| 1358 |
aloha |
1.45 |
icon = gtk_tool_button_new(gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, iconsize), ""); |
| 1359 |
aloha |
1.11 |
g_signal_connect(G_OBJECT(icon), "clicked", G_CALLBACK(about_this_application), NULL); |
| 1360 |
|
|
gtk_container_add(GTK_CONTAINER (toolbar), GTK_WIDGET(icon)); |
| 1361 |
|
|
gtk_tool_item_set_tooltip(icon, toolbar_tips, "������������������������������������������", ""); |
| 1362 |
|
|
|
| 1363 |
aloha |
1.39 |
/* ������������������������ */ |
| 1364 |
|
|
Shiki_EDITOR_MODELINE_LABEL = gtk_label_new(NULL); |
| 1365 |
|
|
gtk_container_add(GTK_CONTAINER (modeline_bg), Shiki_EDITOR_MODELINE_LABEL); |
| 1366 |
aloha |
1.49 |
|
| 1367 |
aloha |
1.39 |
gdk_color_parse("black", &COLOR_BLACK); |
| 1368 |
|
|
gdk_color_parse("green", &COLOR_GREEN); |
| 1369 |
aloha |
1.49 |
|
| 1370 |
aloha |
1.39 |
gtk_widget_modify_fg(Shiki_EDITOR_MODELINE_LABEL, GTK_STATE_NORMAL, &COLOR_GREEN); |
| 1371 |
|
|
gtk_widget_modify_bg(modeline_bg, GTK_STATE_NORMAL, &COLOR_BLACK); |
| 1372 |
|
|
|
| 1373 |
|
|
gtk_box_pack_start(GTK_BOX(vbox), modeline_bg, TRUE, TRUE, 0); |
| 1374 |
aloha |
1.12 |
|
| 1375 |
aloha |
1.8 |
/* C-x C-s ��������������������������������������������������������������������������������������� */ |
| 1376 |
aloha |
1.16 |
Shiki_EDITOR_STATUSBAR = gtk_statusbar_new(); |
| 1377 |
|
|
gtk_box_pack_start(GTK_BOX(vbox), Shiki_EDITOR_STATUSBAR, TRUE, TRUE, 0); |
| 1378 |
|
|
contextid = gtk_statusbar_get_context_id(GTK_STATUSBAR(Shiki_EDITOR_STATUSBAR), ""); |
| 1379 |
aloha |
1.8 |
|
| 1380 |
|
|
/* ������������������������������������������������ */ |
| 1381 |
aloha |
1.26 |
g_signal_connect(G_OBJECT(Shiki_EDITOR_NOTEBOOK), "key-press-event", G_CALLBACK (signal_key_press_handler), GINT_TO_POINTER(contextid)); |
| 1382 |
|
|
g_signal_connect(G_OBJECT(Shiki_EDITOR_NOTEBOOK), "key-release-event", G_CALLBACK (signal_key_release_handler), GINT_TO_POINTER(contextid)); |
| 1383 |
aloha |
1.12 |
|
| 1384 |
aloha |
1.21 |
/* ��������������������������������������������� */ |
| 1385 |
|
|
if(argc >= 2) { |
| 1386 |
|
|
int i; |
| 1387 |
|
|
for(i = 1; i < argc; i++) |
| 1388 |
aloha |
1.27 |
open_file(g_strdup(argv[i])); |
| 1389 |
aloha |
1.21 |
} else /* ������������������������������������������������������������������ */ |
| 1390 |
aloha |
1.26 |
open_online_help(Shiki_EDITOR_NOTEBOOK); |
| 1391 |
aloha |
1.8 |
|
| 1392 |
aloha |
1.26 |
gtk_widget_grab_focus(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK)); |
| 1393 |
aloha |
1.16 |
gtk_widget_show_all(Shiki_EDITOR_WINDOW); |
| 1394 |
aloha |
1.1 |
} |
| 1395 |
|
|
|
| 1396 |
|
|
int main(int argc, char *argv[]) { |
| 1397 |
|
|
/* ������������������������������������ */ |
| 1398 |
aloha |
1.39 |
Shiki_EDITOR_DEFAULT_LOCALE = g_locale_to_utf8(gtk_set_locale(), -1, NULL, NULL, NULL); |
| 1399 |
aloha |
1.1 |
gtk_init(&argc, &argv); |
| 1400 |
|
|
GC_INIT(); Scm_Init(GAUCHE_SIGNATURE); |
| 1401 |
aloha |
1.50 |
Scm_Load("gauche-init.scm", 0); |
| 1402 |
aloha |
1.54 |
Shiki_editor_window_init(argc, argv); |
| 1403 |
aloha |
1.1 |
gtk_main(); |
| 1404 |
|
|
Scm_Exit(0); |
| 1405 |
|
|
return 0; |
| 1406 |
|
|
} |