00001 /* 00002 * Copyright 2009 Alexandros Frantzis, Michael Iatrou 00003 * 00004 * This file is part of libbls. 00005 * 00006 * libbls is free software: you can redistribute it and/or modify it under the 00007 * terms of the GNU Lesser General Public License as published by the Free 00008 * Software Foundation, either version 3 of the License, or (at your option) 00009 * any later version. 00010 * 00011 * libbls is distributed in the hope that it will be useful, but WITHOUT ANY 00012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00014 * details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with 00017 * libbls. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 /** 00021 * @file buffer_event.h 00022 * 00023 * Buffer events 00024 */ 00025 #ifndef _BLESS_BUFFER_EVENT_H 00026 #define _BLESS_BUFFER_EVENT_H 00027 00028 /** 00029 * Buffer events. 00030 */ 00031 enum { 00032 BLESS_BUFFER_EVENT_NONE = 0, 00033 BLESS_BUFFER_EVENT_EDIT, /**< The buffer was edited */ 00034 BLESS_BUFFER_EVENT_UNDO, /**< The last buffer action was undone */ 00035 BLESS_BUFFER_EVENT_REDO, /**< The last undone action was redone */ 00036 BLESS_BUFFER_EVENT_SAVE, /**< The buffer was saved */ 00037 BLESS_BUFFER_EVENT_DESTROY, /**< The buffer is about to be destroyed */ 00038 }; 00039 00040 /** 00041 * Buffer actions. 00042 * 00043 * These actions further specify BLESS_BUFFER_EVENT_EDIT, 00044 * BLESS_BUFFER_EVENT_UNDO, BLESS_BUFFER_EVENT_REDO events. 00045 */ 00046 enum { 00047 BLESS_BUFFER_ACTION_NONE = 0, 00048 BLESS_BUFFER_ACTION_APPEND, /**< Append action */ 00049 BLESS_BUFFER_ACTION_INSERT, /**< Insert action */ 00050 BLESS_BUFFER_ACTION_DELETE, /**< Delete action */ 00051 BLESS_BUFFER_ACTION_MULTI, /**< Multi action */ 00052 }; 00053 00054 /** 00055 * Information about a buffer event. 00056 */ 00057 struct bless_buffer_event_info { 00058 int event_type; /**< The event type (BLESS_BUFFER_EVENT_*) */ 00059 int action_type; /**< The action type (BLESS_BUFFER_ACTION_*) */ 00060 off_t range_start; /**< The start of the range of the buffer that 00061 was affected by an event */ 00062 off_t range_length; /**< The length of the range of the buffer that 00063 was affected by an event */ 00064 int save_fd; /**< The descriptor of the file the buffer was 00065 saved to */ 00066 }; 00067 00068 #endif /* _BLESS_BUFFER_EVENT_H */