Develop and Download Open Source Software

Browse CVS Repository

Annotation of /shiki/shiki/buffer.c

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


Revision 1.10 - (hide annotations) (download) (as text)
Wed Nov 29 05:08:46 2006 UTC (17 years, 4 months ago) by aloha
Branch: MAIN
Changes since 1.9: +57 -2 lines
File MIME type: text/x-csrc
add some API

1 aloha 1.1 /* vim: set encoding=utf8:
2     *
3     * buffer.c
4     *
5     * This file is part of Shiki.
6     *
7     * 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.10 * $Id: buffer.c,v 1.9 2006/11/29 04:37:23 aloha Exp $
28 aloha 1.1 */
29     #include"shiki.h"
30 aloha 1.2
31 aloha 1.9 ScmClass *ShikiBufferClass;
32     extern void Scm_Init_xyzzylisp(ScmModule *module);
33    
34 aloha 1.7 /* GtkTextBuffer ��������������������� ShikiBuffer ��������������������� */
35     static gint compBuffer(gconstpointer a, gconstpointer b) {
36     return ((ShikiBuffer *)a)->text_buffer == b ? 0 : b - a;
37     }
38 aloha 1.3
39 aloha 1.7 static GList *get_ShikiBufferListElement_By_GtkTextBuffer(GtkTextBuffer *b) {
40     return g_list_find_custom(Shiki_EDITOR_BUFFER_LIST, b, compBuffer);
41 aloha 1.3 }
42 aloha 1.4
43 aloha 1.9 static void buffer_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx) {
44     GtkTextBuffer *b = SHIKI_BUFFER_UNBOX(obj);
45     GList *l = g_list_find_custom(Shiki_EDITOR_BUFFER_LIST, b, compBuffer);
46     if(l)
47     Scm_Printf(out, "#<buffer: %s>", ((ShikiBuffer *)(l->data))->name);
48     else
49     Scm_Printf(out, "#<deleted buffer: %p>", b);
50     }
51    
52     static void buffer_cleanup(ScmObj obj)
53     {
54     g_object_unref(SHIKI_BUFFER_UNBOX(obj));
55     }
56    
57     /* ������������������������������������������������������������������������������������������ */
58     static gboolean delete_event_handler(GtkWidget *widget, GdkEvent *event, GtkTextBuffer *buffer){
59     /* delete-event ������������������������FALSE ��������������������������������������������� */
60     return Shiki_need_buffer_save_p(buffer) && !Shiki_yes_or_no_p("��������������������������������������������������������������������������� ?");
61     }
62    
63     /* ��������������������������������������������� */
64     static void insert_text_handler(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *str, gint len) {
65     /* Undo ��������������������������� */
66     ShikiUndoInfo *undoInfo = g_malloc(sizeof(ShikiUndoInfo));
67     g_return_if_fail(undoInfo != NULL);
68     undoInfo->action = SHIKI_UNDO_INSERT;
69     undoInfo->str = g_strdup(str);
70     undoInfo->strlen = len;
71     undoInfo->start = gtk_text_iter_get_offset(iter);
72     undoInfo->end = undoInfo->start + undoInfo->strlen;
73     Shiki_CURRENT_UNDO_INFO_LIST = g_list_prepend(Shiki_CURRENT_UNDO_INFO_LIST, undoInfo);
74     }
75    
76     /* ��������������������������������������������������������������� */
77     static void update_modeline_label() {
78     static gchar label[1024];
79     GtkTextIter p;
80     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER, &p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
81    
82     g_snprintf(label, 1024, "--%s- %-10s (Gauche Interaction) [%s] L%d:%d ",
83     gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER) ? "**" : "--",
84     Shiki_CURRENT_BASENAME,
85     Shiki_CURRENT_CES,
86     gtk_text_iter_get_line(&p) + 1,
87     gtk_text_iter_get_line_offset (&p) + 1);
88     gtk_label_set_text(GTK_LABEL(Shiki_EDITOR_MODELINE_LABEL), label);
89     }
90    
91     /* ������������������������������������������������ */
92     static void delete_range_handler(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end) {
93     /* Undo ��������������������������� */
94     ShikiUndoInfo *undoInfo = g_malloc(sizeof(ShikiUndoInfo));
95     g_return_if_fail(undoInfo != NULL);
96     undoInfo->action = SHIKI_UNDO_DELETE;
97     undoInfo->str = gtk_text_buffer_get_text(buffer, start, end, FALSE);
98     undoInfo->start = gtk_text_iter_get_offset(start);
99     undoInfo->end = gtk_text_iter_get_offset(end);
100     undoInfo->strlen = end - start;
101     Shiki_CURRENT_UNDO_INFO_LIST = g_list_prepend(Shiki_CURRENT_UNDO_INFO_LIST, undoInfo);
102     }
103    
104     /* ��������������������������������������� (������������) ��������� */
105     GtkTextBuffer *Shiki_new_buffer_create(gchar *filename) {
106     /*-------------------- ������������������������ ----------------------------------*/
107     /* ShikiBuffer ������������������������������������������������������������������ */
108     ShikiBuffer *tabinfo = g_malloc(sizeof(ShikiBuffer));
109     tabinfo->locale = "Gtk Default (utf8)";
110     tabinfo->undoInfoList = NULL;
111     tabinfo->filename = filename;
112     tabinfo->name = g_path_get_basename(filename);
113 aloha 1.10 tabinfo->tabpage_label = g_strndup(tabinfo->name, 10);
114 aloha 1.9 tabinfo->env = Scm_MakeModule(NULL, FALSE);
115    
116     ShikiBufferClass = Scm_MakeForeignPointerClass(SCM_MODULE(tabinfo->env),
117     "<buffer>", buffer_print, buffer_cleanup,
118     SCM_FOREIGN_POINTER_KEEP_IDENTITY
119     |
120     SCM_FOREIGN_POINTER_MAP_NULL);
121    
122     /* xyzzy lisp ��������������� */
123     Scm_Init_xyzzylisp(SCM_MODULE(tabinfo->env));
124    
125     /* ������������������������������ (������������������������) ��������� */
126     tabinfo->tabpage = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
127     gtk_scrolled_window_set_policy (tabinfo->tabpage, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
128    
129     /* ��������������������������������������������������������������������������������������� */
130     tabinfo->text_view = GTK_TEXT_VIEW(gtk_text_view_new());
131     gtk_text_view_set_wrap_mode(tabinfo->text_view, GTK_WRAP_WORD);
132     tabinfo->text_buffer = gtk_text_view_get_buffer(tabinfo->text_view);
133     gtk_widget_set_size_request(GTK_WIDGET(tabinfo->text_view), 680, 700);
134    
135     gtk_container_add(GTK_CONTAINER(tabinfo->tabpage), GTK_WIDGET(tabinfo->text_view));
136     g_signal_connect(tabinfo->text_buffer, "mark_set", G_CALLBACK(update_modeline_label), tabinfo->text_view);
137     g_signal_connect(tabinfo->text_buffer, "insert-text", G_CALLBACK(insert_text_handler), NULL);
138     g_signal_connect(tabinfo->text_buffer, "delete-range", G_CALLBACK(delete_range_handler), NULL);
139    
140     /* ������������������������������������������������������������������������������������������������������ */
141     tabinfo->delete_handler_id = g_signal_connect(Shiki_EDITOR_WINDOW, "delete_event", G_CALLBACK(delete_event_handler), tabinfo->text_buffer);
142    
143     /* ������������������������ */
144    
145     /* ������������������������������������������������ */
146     gtk_text_buffer_create_tag(tabinfo->text_buffer, "parent_emphasis_background", "background", "green", NULL);
147    
148     /* ������������������������������������������ */
149     gtk_text_buffer_create_tag(tabinfo->text_buffer, "keyword_highlighting", "foreground", "blue", NULL);
150     /* ������ */
151     gtk_text_buffer_create_tag(tabinfo->text_buffer, "function_highlighting", "foreground", "red", NULL);
152     /* ������������ */
153     gtk_text_buffer_create_tag (tabinfo->text_buffer, "comment_highlighting", "foreground", "purple", NULL);
154     /* ��������� */
155     gtk_text_buffer_create_tag (tabinfo->text_buffer, "string_highlighting", "foreground", "orange", NULL);
156     /* ������������������������������������������ */
157     gtk_notebook_append_page(Shiki_EDITOR_NOTEBOOK, GTK_WIDGET(tabinfo->tabpage), gtk_label_new(tabinfo->tabpage_label));
158     /* ������������������������������������������������������������������ */
159     Shiki_EDITOR_BUFFER_LIST = g_list_append(Shiki_EDITOR_BUFFER_LIST, tabinfo);
160    
161     gtk_widget_show_all(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK));
162     /* ��������������������������������� */
163     gtk_notebook_set_current_page(Shiki_EDITOR_NOTEBOOK, g_list_length(Shiki_EDITOR_BUFFER_LIST) - 1);
164     //Shiki_CURRENT_TAB_INFO = tabinfo;
165     return tabinfo->text_buffer;
166     }
167    
168 aloha 1.10 void Shiki_create_file_buffer(const gchar *filename) {
169     gchar *text;
170     gchar *utf8filename = g_locale_to_utf8(filename, -1, NULL, NULL, NULL);
171     GtkTextIter p;
172     ScmObj s;
173    
174     /* g_file_get_contents(filename, &contents, &len, NULL); */
175    
176     /* ������������������������������ */
177     Shiki_new_buffer_create(g_strdup(filename));
178     gtk_window_set_title (GTK_WINDOW (Shiki_EDITOR_WINDOW), filename);
179    
180     Scm_Define(SCM_MODULE(Shiki_CURRENT_BUFFER_ENV), SCM_SYMBOL(SCM_INTERN("*filename*")), SCM_MAKE_STR_COPYING(utf8filename));
181     g_free(utf8filename);
182    
183     Scm_EvalCString("(use gauche.charconv)", Shiki_CURRENT_BUFFER_ENV);
184    
185     /* ������������������������������������������������������������������������������ */
186     s = Scm_EvalCString("(port->string (open-input-conversion-port (open-input-file *filename*) \"*jp\" :owner? #t))", Shiki_CURRENT_BUFFER_ENV);
187     text = Scm_GetString(SCM_STRING(s));
188     if(text)
189     gtk_text_buffer_set_text(Shiki_CURRENT_TEXT_BUFFER, text, -1);
190     else {
191     /* open-input-conversion-port ������������������������������������������������������
192     * ��������������������������������������������������������������������������� UTF8
193     */
194     gchar *contents;
195     gsize br, bw, len;
196     GError *err = NULL;
197    
198     if(g_file_get_contents(filename, &contents, &len, NULL)) {
199     if(!(text = g_locale_to_utf8(contents, -1, &br, &bw, &err)))
200     gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, text, -1);
201     else
202     gtk_text_buffer_insert(Shiki_CURRENT_TEXT_BUFFER, &p, contents, -1);
203     g_free(contents);
204     }
205     }
206    
207     /* ������������������������ */
208     gtk_text_buffer_set_modified(Shiki_CURRENT_TEXT_BUFFER, FALSE);
209     /* ������������������������������ */
210     gtk_text_buffer_get_start_iter(Shiki_CURRENT_TEXT_BUFFER, &p);
211     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
212     update_modeline_label();
213     gtk_widget_show_all(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK));
214     }
215    
216     void Shiki_open_file_dialog() {
217     const gchar *filename = Shiki_file_name_dialog("���������������������");
218    
219     if(!filename) return;
220     Shiki_create_file_buffer(filename);
221     }
222    
223 aloha 1.7 void Shiki_delete_buffer(GtkTextBuffer *buffer) {
224     /* ��������������������������������������������������������������������������������������������������� */
225     /* ���������������������Scheme ������������������������ Gtk ������������������������������������������������ */
226     GList *bufListElem = get_ShikiBufferListElement_By_GtkTextBuffer(buffer);
227     ShikiBuffer *tabInfo = bufListElem->data;
228     gint bufNum = g_list_position(Shiki_EDITOR_BUFFER_LIST, bufListElem);
229    
230     /* ��������� 1 ��������������������������������������������������� */
231     if(g_list_length(Shiki_EDITOR_BUFFER_LIST) == 1)
232 aloha 1.4 return;
233 aloha 1.7 /* ��������������������������������������������������������������������������������������������� */
234     g_signal_handler_disconnect(Shiki_EDITOR_WINDOW, tabInfo->delete_handler_id);
235     Shiki_EDITOR_BUFFER_LIST = g_list_delete_link(Shiki_EDITOR_BUFFER_LIST, bufListElem);
236     gtk_widget_destroy(GTK_WIDGET(tabInfo->tabpage));
237     g_free(tabInfo->tabpage_label);
238     g_free(tabInfo->name);
239     g_free(tabInfo->filename);
240     g_free(tabInfo);
241     gtk_notebook_remove_page(Shiki_EDITOR_NOTEBOOK, bufNum);
242     /* ��������������� */
243     gtk_widget_queue_draw(GTK_WIDGET(Shiki_EDITOR_NOTEBOOK));
244     }
245    
246     GtkTextBuffer *Shiki_find_buffer(const gchar *name) {
247     GList *l;
248     for(l = Shiki_EDITOR_BUFFER_LIST; l != NULL; l = l->next)
249     if(strcmp(((ShikiBuffer *)l->data)->name, name) == 0)
250     return ((ShikiBuffer *)l->data)->text_buffer;
251     return NULL;
252     }
253    
254     gchar *Shiki_buffer_substring(gint start, gint end) {
255     if(start >= end)
256     return NULL;
257     else {
258     GtkTextIter s, e;
259     gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &s, start);
260     gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &e, end);
261    
262     return gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &s, &e, FALSE);
263     }
264     }
265    
266     void Shiki_delete_region(gint start, gint end) {
267     if(start >= end)
268     return;
269     else {
270     GtkTextIter s, e;
271     gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &s, start);
272     gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &e, end);
273 aloha 1.4
274 aloha 1.7 return gtk_text_buffer_delete(Shiki_CURRENT_TEXT_BUFFER, &s, &e);
275     }
276 aloha 1.4 }
277    
278     gint Shiki_point() {
279     GtkTextIter p;
280     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
281     return gtk_text_iter_get_offset(&p);
282     }
283    
284     gint Shiki_point_max() {
285     GtkTextIter p;
286     gtk_text_buffer_get_end_iter(Shiki_CURRENT_TEXT_BUFFER, &p);
287     return gtk_text_iter_get_offset(&p);
288     }
289    
290     gint Shiki_point_min() {
291     return 0;
292     }
293    
294     void Shiki_goto_char(gint offset) {
295     GtkTextIter p;
296     gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &p, offset);
297     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
298     }
299    
300     void Shiki_forward_char() {
301     GtkTextIter p;
302     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
303     gtk_text_iter_forward_char(&p);
304     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
305     }
306    
307     void Shiki_backward_char() {
308     GtkTextIter p;
309     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
310     gtk_text_iter_backward_char(&p);
311     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
312     }
313    
314     void Shiki_goto_line(gint line) {
315     GtkTextIter p;
316     gtk_text_buffer_get_iter_at_line(Shiki_CURRENT_TEXT_BUFFER, &p, line);
317     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
318     }
319    
320     void Shiki_goto_bol() {
321     GtkTextIter p;
322     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
323     gtk_text_buffer_get_iter_at_line_offset(Shiki_CURRENT_TEXT_BUFFER, &p, gtk_text_iter_get_line(&p), 0);
324     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
325     }
326    
327     void Shiki_goto_eol() {
328     GtkTextIter p;
329     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
330     gtk_text_iter_forward_to_line_end(&p);
331     gtk_text_iter_backward_char(&p);
332     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
333     }
334 aloha 1.5
335 aloha 1.7 void Shiki_forward_line(gint count) {
336     GtkTextIter p;
337     gint i;
338     gtk_text_buffer_get_iter_at_mark(Shiki_CURRENT_TEXT_BUFFER,&p, gtk_text_buffer_get_insert(Shiki_CURRENT_TEXT_BUFFER));
339    
340     if(count >= 0) {
341     for(i = count; i != 0; i--)
342     gtk_text_view_forward_display_line(Shiki_CURRENT_TEXT_VIEW, &p);
343     } else {
344     for(i = count; i != 0; i++)
345     gtk_text_view_backward_display_line(Shiki_CURRENT_TEXT_VIEW, &p);
346     }
347     gtk_text_buffer_place_cursor(Shiki_CURRENT_TEXT_BUFFER, &p);
348 aloha 1.5 }
349    
350     const char *Shiki_buffer_name(GtkTextBuffer *buffer) {
351     GList *l = get_ShikiBufferListElement_By_GtkTextBuffer(buffer);
352     if(l)
353     return ((ShikiBuffer *)(l->data))->name;
354     else
355     return NULL;
356     }
357    
358 aloha 1.6 gboolean Shiki_deleted_buffer_p(GtkTextBuffer *buffer) {
359     GList *l = get_ShikiBufferListElement_By_GtkTextBuffer(buffer);
360     if(l)
361     return FALSE;
362     else
363     return TRUE;
364     }
365    
366 aloha 1.5 GtkTextBuffer *Shiki_get_next_buffer(GtkTextBuffer *buffer) {
367     GList *l = get_ShikiBufferListElement_By_GtkTextBuffer(buffer);
368     if(l && l->next)
369     return ((ShikiBuffer *)(l->next->data))->text_buffer;
370     else
371     return NULL;
372     }
373    
374     GtkTextBuffer *Shiki_get_previous_buffer(GtkTextBuffer *buffer) {
375     GList *l = get_ShikiBufferListElement_By_GtkTextBuffer(buffer);
376     if(l && l->prev)
377     return ((ShikiBuffer *)(l->prev->data))->text_buffer;
378     else
379     return NULL;
380     }
381    
382     ScmObj Shiki_buffer_list() {
383     GList *l;
384     GtkTextBuffer *b;
385     ScmObj bl = SCM_NIL;
386    
387     for(l = Shiki_EDITOR_BUFFER_LIST; l != NULL; l = l->next) {
388     b= ((ShikiBuffer *)(l->data))->text_buffer;
389     bl = Scm_Cons(SHIKI_BUFFER_BOX(g_object_ref(b)), bl);
390     }
391     return bl;
392     }
393 aloha 1.7
394     void Shiki_erase_buffer(GtkTextBuffer *buffer) {
395     GtkTextIter start, end;
396     gtk_text_buffer_get_start_iter(buffer, &start);
397     gtk_text_buffer_get_end_iter(buffer, &end);
398     gtk_text_buffer_delete(buffer, &start, &end);
399     }
400    
401     const gchar *Shiki_file_name_dialog(const gchar *msg) {
402    
403     GtkWidget *dialog = gtk_file_selection_new(msg);
404     gint resp = gtk_dialog_run(GTK_DIALOG(dialog));
405     const gchar *filename = NULL;
406    
407     if(resp == GTK_RESPONSE_OK)
408     filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog));
409    
410     gtk_widget_destroy(dialog);
411     return filename;
412     }
413    
414     gboolean Shiki_yes_or_no_p(const gchar *msg) {
415     GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(Shiki_EDITOR_WINDOW),
416     GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
417     GTK_BUTTONS_YES_NO, msg);
418 aloha 1.9 gint resp;
419     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
420     resp = gtk_dialog_run(GTK_DIALOG(dialog));
421     gtk_widget_destroy(dialog);
422     if(GTK_RESPONSE_YES == resp)
423     return TRUE;
424     return FALSE;
425     }
426    
427     gboolean Shiki_no_or_yes_p(const gchar *msg) {
428     GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(Shiki_EDITOR_WINDOW),
429     GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
430     GTK_BUTTONS_YES_NO, msg);
431     gint resp;
432     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_NO);
433     resp = gtk_dialog_run(GTK_DIALOG(dialog));
434 aloha 1.7 gtk_widget_destroy(dialog);
435     if(GTK_RESPONSE_YES == resp)
436     return TRUE;
437     return FALSE;
438     }
439 aloha 1.8
440     gboolean Shiki_need_buffer_save_p(GtkTextBuffer *buffer) {
441     return gtk_text_buffer_get_modified(buffer);
442     }
443    
444     /* ������������ */
445     void Shiki_kill_buffer(GtkTextBuffer *buffer) {
446     if(!Shiki_need_buffer_save_p(buffer) || Shiki_yes_or_no_p("��������������������������������������������������������������������������� ?"))
447     Shiki_delete_buffer(buffer);
448     }

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