MyGUI
3.2.0
|
00001 00006 /* 00007 This file is part of MyGUI. 00008 00009 MyGUI is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 MyGUI is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 #ifndef __MYGUI_TEXT_CHANGE_HISTORY_H__ 00023 #define __MYGUI_TEXT_CHANGE_HISTORY_H__ 00024 00025 #include "MyGUI_Prerequest.h" 00026 #include "MyGUI_Macros.h" 00027 #include "MyGUI_UString.h" 00028 #include <deque> 00029 00030 namespace MyGUI 00031 { 00032 00033 // инфо об одной операции 00034 struct TextCommandInfo 00035 { 00036 // типы операций 00037 enum CommandType 00038 { 00039 COMMAND_POSITION, 00040 COMMAND_INSERT, 00041 COMMAND_ERASE 00042 }; 00043 00044 // для удаления и вставки текста 00045 TextCommandInfo(const UString& _text, size_t _start, CommandType _type) : 00046 text(_text), 00047 type(_type), 00048 start(_start), 00049 undo(ITEM_NONE), 00050 redo(ITEM_NONE), 00051 length(ITEM_NONE) 00052 { 00053 } 00054 00055 // для указания позиции 00056 TextCommandInfo(size_t _undo, size_t _redo, size_t _length) : 00057 type(COMMAND_POSITION), 00058 start(ITEM_NONE), 00059 undo(_undo), 00060 redo(_redo), 00061 length(_length) 00062 { 00063 } 00064 00065 // строка харрактиризуещая изменения 00066 UString text; 00067 // тип операции 00068 CommandType type; 00069 // инфа о начале позиции 00070 size_t start; 00071 // инфа о псевдо позиции 00072 size_t undo, redo, length; 00073 }; 00074 00075 typedef std::vector<TextCommandInfo> VectorChangeInfo; 00076 typedef std::deque<VectorChangeInfo> DequeUndoRedoInfo; 00077 00078 } // namespace MyGUI 00079 00080 #endif // __MYGUI_TEXT_CHANGE_HISTORY_H__