Develop and Download Open Source Software

Browse CVS Repository

Diff of /shiki/shiki/shiki.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.20 by aloha, Sun Nov 12 12:46:34 2006 UTC revision 1.21 by aloha, Mon Nov 13 04:48:40 2006 UTC
# Line 89  static gboolean not_yet_save_changes_rea Line 89  static gboolean not_yet_save_changes_rea
89  static gboolean delete_event_handler(GtkWidget *widget, GdkEvent *event, GtkWidget *buffer);  static gboolean delete_event_handler(GtkWidget *widget, GdkEvent *event, GtkWidget *buffer);
90  static void append_tabpage(GtkNotebook *notebook, gchar *filename);  static void append_tabpage(GtkNotebook *notebook, gchar *filename);
91  static GtkWidget *new_scrolled_text_buffer(ShikiTabInfo **tabinfo);  static GtkWidget *new_scrolled_text_buffer(ShikiTabInfo **tabinfo);
92    static void open_file(GtkNotebook *notebook, gchar *filename);
93  static void open_file_from_notebook(GtkNotebook *notebook);  static void open_file_from_notebook(GtkNotebook *notebook);
94  static void open_file_handler(GtkWidget *widget, GtkWidget *notebook);  static void open_file_handler(GtkWidget *widget, GtkWidget *notebook);
95  static gchar *eval_cstring_by_gauche(gchar *s);  static gchar *eval_cstring_by_gauche(gchar *s);
# Line 109  static void line_forward_current_buffer( Line 110  static void line_forward_current_buffer(
110  static void line_backward_current_buffer();  static void line_backward_current_buffer();
111  static gboolean signal_key_press_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid);  static gboolean signal_key_press_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid);
112  static gboolean signal_key_release_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid);  static gboolean signal_key_release_handler (GtkWidget *notebook, GdkEventKey *event, gpointer contextid);
113  static void shiki_editor_window_init();  static void shiki_editor_window_init(int argc, char **argv);
114    
115  /* バッファの内容を消去 */  /* バッファの内容を消去 */
116  static void clear_current_buffer() {  static void clear_current_buffer() {
# Line 394  static GtkWidget *new_scrolled_text_buff Line 395  static GtkWidget *new_scrolled_text_buff
395  }  }
396    
397  /* ファイルを開く */  /* ファイルを開く */
398  static void open_file_from_notebook(GtkNotebook *notebook) {  static void open_file(GtkNotebook *notebook, gchar *filename) {
399    gchar *contents, *text;    gchar *contents, *text;
400    gsize br, bw, len;    gsize br, bw, len;
401    GError *err = NULL;    GError *err = NULL;
402    gchar *filename = get_filename_from_dialog("File Selection");    
   
   if(!filename) return;  
   
403    if(g_file_get_contents(filename, &contents, &len, NULL)) {    if(g_file_get_contents(filename, &contents, &len, NULL)) {
404      GtkTextIter p;      GtkTextIter p;
405    
# Line 426  static void open_file_from_notebook(GtkN Line 424  static void open_file_from_notebook(GtkN
424      g_printerr("Get file contents error !\n");      g_printerr("Get file contents error !\n");
425  }  }
426    
427    /* ファイルをダイアログで指定して開く */
428    static void open_file_from_notebook(GtkNotebook *notebook) {
429      gchar *filename = get_filename_from_dialog("File Selection");
430    
431      if(!filename) return;
432      open_file(notebook, filename);
433    }
434    
435  /* ファイルを開くイベントハンドラ */  /* ファイルを開くイベントハンドラ */
436  static void open_file_handler(GtkWidget *widget,  GtkWidget *notebook) {  static void open_file_handler(GtkWidget *widget,  GtkWidget *notebook) {
437    open_file_from_notebook(GTK_NOTEBOOK(notebook));    open_file_from_notebook(GTK_NOTEBOOK(notebook));
# Line 768  static gboolean signal_key_release_handl Line 774  static gboolean signal_key_release_handl
774  }  }
775    
776  /* エディタの編集画面の初期化 */  /* エディタの編集画面の初期化 */
777  static void shiki_editor_window_init() {  static void shiki_editor_window_init(int argc, char **argv) {
778    GtkWidget *vbox, *toolbar, *notebook;    GtkWidget *vbox, *toolbar, *notebook;
779    GtkToolItem *icon;    GtkToolItem *icon;
780    GtkIconSize iconsize;    GtkIconSize iconsize;
# Line 890  static void shiki_editor_window_init() { Line 896  static void shiki_editor_window_init() {
896    g_signal_connect(G_OBJECT(notebook), "key-press-event", G_CALLBACK (signal_key_press_handler), GINT_TO_POINTER(contextid));    g_signal_connect(G_OBJECT(notebook), "key-press-event", G_CALLBACK (signal_key_press_handler), GINT_TO_POINTER(contextid));
897    g_signal_connect(G_OBJECT(notebook), "key-release-event", G_CALLBACK (signal_key_release_handler), GINT_TO_POINTER(contextid));    g_signal_connect(G_OBJECT(notebook), "key-release-event", G_CALLBACK (signal_key_release_handler), GINT_TO_POINTER(contextid));
898    
899    /* デフォルトのページを追加 */    /* 引数に指定されたファイルを開く */
900    append_tabpage(GTK_NOTEBOOK(notebook), g_strdup("*scratch*"));    if(argc >= 2) {
901        int i;
902        for(i = 1; i < argc; i++)
903          open_file(GTK_NOTEBOOK(notebook), g_strdup(argv[i]));
904      } else /* 指定されてなければ,デフォルトのページを追加 */
905        append_tabpage(GTK_NOTEBOOK(notebook), g_strdup("*scratch*"));
906    
907    gtk_widget_grab_focus(notebook);    gtk_widget_grab_focus(notebook);
908    gtk_widget_show_all(Shiki_EDITOR_WINDOW);    gtk_widget_show_all(Shiki_EDITOR_WINDOW);
# Line 902  int main(int argc, char *argv[]) { Line 913  int main(int argc, char *argv[]) {
913    gtk_set_locale();    gtk_set_locale();
914    gtk_init(&argc, &argv);    gtk_init(&argc, &argv);
915    GC_INIT(); Scm_Init(GAUCHE_SIGNATURE);    GC_INIT(); Scm_Init(GAUCHE_SIGNATURE);
916    shiki_editor_window_init();    shiki_editor_window_init(argc, argv);
917    gtk_main();    gtk_main();
918    Scm_Exit(0);    Scm_Exit(0);
919    return 0;    return 0;

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26