| 1 |
aloha |
1.1 |
/* vim: set encoding=utf8: |
| 2 |
|
|
* |
| 3 |
|
|
* shiki.h |
| 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: shiki.h,v 1.9 2006/11/28 16:29:22 aloha Exp $ |
| 28 |
aloha |
1.1 |
*/ |
| 29 |
|
|
|
| 30 |
|
|
#ifndef SHIKI_H |
| 31 |
|
|
#define SHIKI_H |
| 32 |
|
|
|
| 33 |
|
|
#include<gauche.h> |
| 34 |
|
|
#include<gtk/gtk.h> |
| 35 |
|
|
#include<gdk/gdkkeysyms.h> |
| 36 |
|
|
|
| 37 |
aloha |
1.2 |
/* ��������������������������������������������� */ |
| 38 |
aloha |
1.1 |
typedef struct { |
| 39 |
aloha |
1.2 |
const gchar *locale; /* ��������������������������������� */ |
| 40 |
|
|
GtkScrolledWindow *tabpage; /* ������ */ |
| 41 |
|
|
gchar *tabpage_label; /* ��������������������� */ |
| 42 |
|
|
gchar *name; /* ��������� (���������������) ������ */ |
| 43 |
|
|
GtkTextView *text_view; /* ��������������� */ |
| 44 |
|
|
GtkTextBuffer *text_buffer; /* ��������������������������������� */ |
| 45 |
|
|
gchar *filename; /* ������������������������������ */ |
| 46 |
|
|
GList *undoInfoList; /* ��������������������������������������� */ |
| 47 |
|
|
ScmObj env; /* ��������������������������� Scheme ������ */ |
| 48 |
|
|
guint delete_handler_id; /* ��������������������������������������������� ID */ |
| 49 |
aloha |
1.1 |
} ShikiBuffer; |
| 50 |
|
|
|
| 51 |
|
|
typedef struct { |
| 52 |
|
|
const gchar *default_locale; |
| 53 |
|
|
GtkWidget *editor_window; |
| 54 |
|
|
GtkClipboard *clipboard; |
| 55 |
|
|
GtkNotebook *notebook; |
| 56 |
|
|
GtkWidget *statusbar; |
| 57 |
|
|
GtkWidget *modeline_label; |
| 58 |
aloha |
1.5 |
GList *bufferList; |
| 59 |
aloha |
1.1 |
gint current_tabpage_num; |
| 60 |
|
|
ShikiBuffer *current_tabpage_info; |
| 61 |
|
|
} ShikiEditorType; |
| 62 |
|
|
|
| 63 |
|
|
extern ShikiEditorType Shiki_editor; |
| 64 |
|
|
|
| 65 |
aloha |
1.2 |
/* ��������������������������������������������� */ |
| 66 |
aloha |
1.1 |
#define Shiki_EDITOR_DEFAULT_LOCALE Shiki_editor.default_locale |
| 67 |
|
|
#define Shiki_EDITOR_WINDOW Shiki_editor.editor_window |
| 68 |
|
|
#define Shiki_EDITOR_CLIPBOARD Shiki_editor.clipboard |
| 69 |
|
|
#define Shiki_EDITOR_NOTEBOOK Shiki_editor.notebook |
| 70 |
|
|
#define Shiki_EDITOR_STATUSBAR Shiki_editor.statusbar |
| 71 |
|
|
#define Shiki_EDITOR_MODELINE_LABEL Shiki_editor.modeline_label |
| 72 |
aloha |
1.5 |
#define Shiki_EDITOR_BUFFER_LIST Shiki_editor.bufferList |
| 73 |
aloha |
1.1 |
|
| 74 |
aloha |
1.2 |
/* ��������������������������������������������������������������������������������������� */ |
| 75 |
aloha |
1.1 |
#define Shiki_CURRENT_TAB_NUM Shiki_editor.current_tabpage_num |
| 76 |
|
|
#define Shiki_CURRENT_TAB_INFO Shiki_editor.current_tabpage_info |
| 77 |
|
|
#define Shiki_CURRENT_CES (Shiki_editor.current_tabpage_info)->locale |
| 78 |
|
|
#define Shiki_CURRENT_UNDO_INFO_LIST (Shiki_editor.current_tabpage_info)->undoInfoList |
| 79 |
|
|
#define Shiki_CURRENT_TAB (Shiki_editor.current_tabpage_info)->tabpage |
| 80 |
|
|
#define Shiki_CURRENT_TAB_TITLE (Shiki_editor.current_tabpage_info)->tabpage_label |
| 81 |
|
|
#define Shiki_CURRENT_TEXT_VIEW (Shiki_editor.current_tabpage_info)->text_view |
| 82 |
|
|
#define Shiki_CURRENT_TEXT_BUFFER (Shiki_editor.current_tabpage_info)->text_buffer |
| 83 |
|
|
#define Shiki_CURRENT_BASENAME (Shiki_editor.current_tabpage_info)->name |
| 84 |
|
|
#define Shiki_CURRENT_FILENAME (Shiki_editor.current_tabpage_info)->filename |
| 85 |
|
|
#define Shiki_CURRENT_BUFFER_ENV (Shiki_editor.current_tabpage_info)->env |
| 86 |
|
|
|
| 87 |
aloha |
1.2 |
/* Undo/Redo ������������������ */ |
| 88 |
aloha |
1.1 |
typedef enum {SHIKI_UNDO_INSERT, SHIKI_UNDO_DELETE} ShikiAction; |
| 89 |
|
|
|
| 90 |
|
|
typedef struct { |
| 91 |
|
|
ShikiAction action; |
| 92 |
|
|
gchar *str; |
| 93 |
|
|
gint strlen; |
| 94 |
|
|
gint start; |
| 95 |
|
|
gint end; |
| 96 |
|
|
} ShikiUndoInfo; |
| 97 |
|
|
|
| 98 |
aloha |
1.5 |
extern ScmClass *ShikiBufferClass; |
| 99 |
|
|
|
| 100 |
|
|
#define SHIKI_BUFFER_P(obj) SCM_XTYPEP(obj, ShikiBufferClass) |
| 101 |
|
|
#define SHIKI_BUFFER_UNBOX(obj) SCM_FOREIGN_POINTER_REF(GtkTextBuffer*, obj) |
| 102 |
|
|
#define SHIKI_BUFFER_BOX(ptr) Scm_MakeForeignPointer(ShikiBufferClass, ptr) |
| 103 |
|
|
|
| 104 |
aloha |
1.1 |
/* C API */ |
| 105 |
aloha |
1.8 |
GtkTextBuffer *Shiki_new_buffer_create(gchar *filename); |
| 106 |
aloha |
1.3 |
gchar *Shiki_buffer_substring(gint start, gint end); |
| 107 |
aloha |
1.4 |
void Shiki_delete_region(gint start, gint end); |
| 108 |
|
|
gint Shiki_point(); |
| 109 |
|
|
gint Shiki_point_max(); |
| 110 |
|
|
gint Shiki_point_min(); |
| 111 |
|
|
void Shiki_goto_char(gint offset); |
| 112 |
|
|
void Shiki_forward_char(); |
| 113 |
|
|
void Shiki_backward_char(); |
| 114 |
|
|
void Shiki_goto_line(gint line); |
| 115 |
|
|
void Shiki_goto_bol(); |
| 116 |
|
|
void Shiki_goto_eol(); |
| 117 |
aloha |
1.8 |
void Shiki_forward_line(gint count); |
| 118 |
aloha |
1.6 |
const gchar *Shiki_buffer_name(GtkTextBuffer *buffer); |
| 119 |
|
|
GtkTextBuffer *Shiki_get_next_buffer(GtkTextBuffer *buffer); |
| 120 |
|
|
GtkTextBuffer *Shiki_get_previous_buffer(GtkTextBuffer *buffer); |
| 121 |
|
|
ScmObj Shiki_buffer_list(); |
| 122 |
aloha |
1.7 |
gboolean Shiki_deleted_buffer_p(GtkTextBuffer *buffer); |
| 123 |
aloha |
1.8 |
void Shiki_erase_buffer(GtkTextBuffer *buffer); |
| 124 |
|
|
void Shiki_delete_buffer(GtkTextBuffer *buffer); |
| 125 |
|
|
GtkTextBuffer *Shiki_find_buffer(const gchar *name); |
| 126 |
|
|
const gchar *Shiki_file_name_dialog(const gchar *msg); |
| 127 |
|
|
gboolean Shiki_yes_or_no_p(const gchar *msg); |
| 128 |
aloha |
1.10 |
gboolean Shiki_no_or_yes_p(const gchar *msg); |
| 129 |
aloha |
1.9 |
gboolean Shiki_need_buffer_save_p(GtkTextBuffer *buffer); |
| 130 |
|
|
void Shiki_kill_buffer(GtkTextBuffer *buffer); |
| 131 |
aloha |
1.1 |
|
| 132 |
|
|
#endif |