KVIrc  4.9.2
DeveloperAPIs
KviIrcView_private.h
Go to the documentation of this file.
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
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
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 typedef 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!!!)
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 } /*_KVI_PACKED*/ KviIrcViewLineChunk;
95 
96 //
97 // The wrapped paintable data block
98 //
99 
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
107 
108 typedef 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 instert time the szData text is splitted 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-splitted 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-splitted paintable blocks
128 
129  // next and previous line
133 
135 {
144 
145 #ifdef COMPILE_ON_WINDOWS
146 #pragma pack(pop, old_packing)
147 #else
148 #undef _KVI_PACKED
149 #endif
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
unsigned int uLineWraps
Definition: KviIrcView_private.h:124
Definition: KviIrcView_private.h:108
QString szText
Definition: KviIrcView_private.h:112
unsigned char back
Definition: KviIrcView_private.h:89
KviIrcViewWrappedBlock * pBlocks
Definition: KviIrcView_private.h:127
Definition: KviIrcView_private.h:134
int part_3_width
Definition: KviIrcView_private.h:142
unsigned char type
Definition: KviIrcView_private.h:82
int part_2_length
Definition: KviIrcView_private.h:139
kvi_u16_t kvi_wchar_t
Definition: KviCString.h:87
int selection_type
Definition: KviIrcView_private.h:136
kvi_wchar_t * szSmileId
Definition: KviIrcView_private.h:86
Definition: KviIrcView_private.h:100
struct _KviIrcViewLineChunk::@2 colors
QColor customFore
Definition: KviIrcView_private.h:93
kvi_wchar_t * szPayload
Definition: KviIrcView_private.h:85
int part_3_length
Definition: KviIrcView_private.h:141
int part_1_length
Definition: KviIrcView_private.h:137
int iMaxLineWidth
Definition: KviIrcView_private.h:125
int iTextLen
Definition: KviIrcView_private.h:84
int block_start
Definition: KviIrcView_private.h:103
unsigned int uChunkCount
Definition: KviIrcView_private.h:117
unsigned int uIndex
Definition: KviIrcView_private.h:111
struct _KviIrcViewWrappedBlockSelectionInfoTag KviIrcViewWrappedBlockSelectionInfo
int block_len
Definition: KviIrcView_private.h:104
int block_width
Definition: KviIrcView_private.h:105
int iTextStart
Definition: KviIrcView_private.h:83
struct _KviIrcViewLineChunk KviIrcViewLineChunk
int iMsgType
Definition: KviIrcView_private.h:113
#define _KVI_PACKED
COMPILE_ON_WIDNOWS.
Definition: KviIrcView_private.h:44
struct _KviIrcViewLine KviIrcViewLine
KviIrcViewLineChunk * pChunk
Definition: KviIrcView_private.h:102
Definition: KviIrcView_private.h:80
unsigned char fore
Definition: KviIrcView_private.h:90
This file contains compile time settings.
int iBlockCount
Definition: KviIrcView_private.h:126
int part_2_width
Definition: KviIrcView_private.h:140
int part_1_width
Definition: KviIrcView_private.h:138
struct _KviIrcViewLine * pPrev
Definition: KviIrcView_private.h:130
struct _KviIrcViewWrappedBlock KviIrcViewWrappedBlock
struct _KviIrcViewLine * pNext
Definition: KviIrcView_private.h:131
KviIrcViewLineChunk * pChunks
Definition: KviIrcView_private.h:118