1 #ifndef _KVI_IRCVIEWPRIVATE_H_ 2 #define _KVI_IRCVIEWPRIVATE_H_ 3 //============================================================================= 4 // 5 // File : KviIrcView_private.h 6 // Creation date : Sat Oct 9 2004 16:29:01 by Szymon Stefanek 7 // 8 // This file is part of the KVIrc IRC client distribution 9 // Copyright (C) 2004-2010 Szymon Stefanek (pragma at kvirc dot net) 10 // 11 // This program is FREE software. You can redistribute it and/or 12 // modify it under the terms of the GNU General Public License 13 // as published by the Free Software Foundation; either version 2 14 // of the License, or (at your option) any later version. 15 // 16 // This program is distributed in the HOPE that it will be USEFUL, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 // See the GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program. If not, write to the Free Software Foundation, 23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 // 25 //============================================================================= 26 27 #include "kvi_settings.h" 28 29 #include <QString> 30 31 // 32 // Internal data structures 33 // 34 35 // Force the structs to be packed... 36 #ifdef COMPILE_ON_WINDOWS 37 #pragma pack(push, old_packing, 1) 38 #define _KVI_PACKED 39 #else //!COMPILE_ON_WIDNOWS 40 // this works only on gcc 41 #ifdef __GNUC__ 42 #define _KVI_PACKED __attribute__((__packed__)) 43 #else 44 #define _KVI_PACKED 45 #endif 46 #endif //!COMPILE_ON_WINDOWS 47 48 // Borders...just do not set it to 0 49 #define KVI_IRCVIEW_HORIZONTAL_BORDER 4 50 #define KVI_IRCVIEW_VERTICAL_BORDER 4 51 52 // 53 // The LineChunk structure contains information about 54 // an attribute change, an icon or a link 55 // 56 // type can be one of: 57 // 58 // KVI_TEXT_ICON: 59 // the uIconId member is the icon to be shown 60 // szPayload contains the text that triggered this icon was triggered by 61 // KVI_TEXT_UNICON: 62 // the text block after an icon 63 // KVI_TEXT_ESCAPE: 64 // szPayload contains the encoded escape command 65 // colors.fore contains the new text color 66 // KVI_TEXT_UNESCAPE: 67 // the text block after an escape 68 // KVI_TEXT_COLOR: 69 // the colors.back and colors.fore members indicate the color change 70 // KVI_TEXT_BOLD: 71 // toggles the bold flag 72 // KVI_TEXT_UNDERLINE: 73 // toggles the underline flag 74 // KVI_TEXT_REVERSE: 75 // inverts the current fore and back colors 76 // KVI_TEXT_RESET: 77 // resets the color, bold and underline flags 78 // 79 80 struct KviIrcViewLineChunk 81 { 82 unsigned char type; // chunk type 83 int iTextStart; // index in the szText string of the beginning of the block 84 int iTextLen; // length in chars of the block (excluding the terminator) 85 kvi_wchar_t * szPayload; // KVI_TEXT_ESCAPE attribute command buffer and KVI_TEXT_ICON icon name (non zeroed for other attributes!!!) 86 kvi_wchar_t * szSmileId; 87 struct 88 { 89 unsigned char back; // optional background color for KVI_TEXT_COLOR attribute 90 unsigned char fore; // optional foreground color for KVI_TEXT_COLOR attribute (used also for KVI_TEXT_ESCAPE!!!) 91 } _KVI_PACKED colors; // anonymous 92 // QColor customBack; 93 QColor customFore; 94 }; 95 96 // 97 // The wrapped paintable data block 98 // 99 100 struct KviIrcViewWrappedBlock 101 { 102 KviIrcViewLineChunk * pChunk; // pointer to real line chunk or 0 for word wraps 103 int block_start; // this is generally different than pAttribute->block_idx! 104 int block_len; // length if the block in characters 105 int block_width; // width of the block in pixels 106 } _KVI_PACKED; 107 108 struct KviIrcViewLine 109 { 110 // this is a text line in the IrcView's memory 111 unsigned int uIndex; // index of the text line (needed for find and splitting) 112 QString szText; // data string without color codes nor escapes... 113 int iMsgType; // type of the line (defines icon and colors) 114 115 // At line insert time the szData text is split in parts which 116 // signal attribute changes (or icons) 117 unsigned int uChunkCount; // number of allocated chunks 118 KviIrcViewLineChunk * pChunks; // pointer to the allocated structures 119 120 // At paint time the data is re-split in drawable chunks which 121 // are either real data chunks or line wraps. 122 // The algorightm that does this is lazy and computes it 123 // only once for a given widget width (iMaxLineWidth) 124 unsigned int uLineWraps; // number of line wraps (lines - 1) 125 int iMaxLineWidth; // width that the blocks were calculated for (lazy calculation) 126 int iBlockCount; // number of allocated paintable blocks 127 KviIrcViewWrappedBlock * pBlocks; // pointer to the re-split paintable blocks 128 129 // next and previous line 130 KviIrcViewLine * pPrev; 131 KviIrcViewLine * pNext; 132 }; 133 134 struct KviIrcViewWrappedBlockSelectionInfo 135 { 136 int selection_type; 137 int part_1_length; 138 int part_1_width; 139 int part_2_length; 140 int part_2_width; 141 int part_3_length; 142 int part_3_width; 143 }; 144 145 #ifdef COMPILE_ON_WINDOWS 146 #pragma pack(pop, old_packing) 147 #else //!COMPILE_ON_WINDOWS 148 #undef _KVI_PACKED 149 #endif //!COMPILE_ON_WINDOWS 150 151 // 152 // Screen layout 153 // 154 155 //FIRST LINE (prev_line = 0) <---m_pFirstLine 156 //LINE 157 //--------------------SCREEN-- 158 //LINE 159 //LINE 160 //LINE 161 //LINE <-------------------------m_pCurLine 162 //--------------------SCREEN-- 163 //LAST LINE (next_line = 0) <----m_pLastLine 164 165 #endif //!_KVI_IRCVIEWPRIVATE_H_ 166