]> git.saurik.com Git - wxWidgets.git/blob - user/wxLayout/wxllist.cpp
latest sources from M
[wxWidgets.git] / user / wxLayout / wxllist.cpp
1 /*-*- c++ -*-********************************************************
2 * wxFTCanvas: a canvas for editing formatted text *
3 * *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * *
6 * $Id$ *
7 *******************************************************************/
8
9 /*
10 - each Object knows its size and how to draw itself
11 - the list is responsible for calculating positions
12 - the draw coordinates for each object are the top left corner
13 - coordinates only get calculated when things get redrawn
14 - during redraw each line gets iterated over twice, first just
15 calculating baselines and positions, second to actually draw it
16 - the cursor position is the position before an object, i.e. if the
17 buffer starts with a text-object, cursor 0,0 is just before the
18 first character
19 */
20
21 #ifdef __GNUG__
22 #pragma implementation "wxllist.h"
23 #endif
24
25 #include "wxllist.h"
26 #include "iostream"
27
28 #define BASELINESTRETCH 12
29
30 #define VAR(x) cerr << #x"=" << x << endl;
31 #define DBG_POINT(p) cerr << #p << ": " << p.x << ',' << p.y << endl
32 #define TRACE(f) cerr << #f":" << endl;
33
34 #ifdef WXLAYOUT_DEBUG
35 static const char *_t[] = { "invalid", "text", "cmd", "icon",
36 "linebreak"};
37
38 void
39 wxLayoutObjectBase::Debug(void)
40 {
41 CoordType bl = 0;
42 cerr << _t[GetType()] << ": size=" << GetSize(&bl).x << ","
43 << GetSize(&bl).y << " bl=" << bl;
44 }
45 #endif
46
47 //-------------------------- wxLayoutObjectText
48
49 wxLayoutObjectText::wxLayoutObjectText(const String &txt)
50 {
51 m_Text = txt;
52 m_Width = 0;
53 m_Height = 0;
54 }
55
56
57 wxPoint
58 wxLayoutObjectText::GetSize(CoordType *baseLine) const
59 {
60 if(baseLine) *baseLine = m_BaseLine;
61 return wxPoint(m_Width, m_Height);
62 }
63
64 void
65 wxLayoutObjectText::Draw(wxDC &dc, wxPoint position, CoordType baseLine,
66 bool draw)
67 {
68 long descent = 0l;
69 dc.GetTextExtent(Str(m_Text),&m_Width, &m_Height, &descent);
70 //FIXME: wxGTK does not set descent to a descent value yet.
71 if(descent == 0)
72 descent = (2*m_Height)/10; // crude fix
73 m_BaseLine = m_Height - descent;
74 position.y += baseLine-m_BaseLine;
75 if(draw)
76 dc.DrawText(Str(m_Text),position.x,position.y);
77 # ifdef WXLAYOUT_DEBUG
78 // dc.DrawRectangle(position.x, position.y, m_Width, m_Height);
79 # endif
80 }
81
82 #ifdef WXLAYOUT_DEBUG
83 void
84 wxLayoutObjectText::Debug(void)
85 {
86 wxLayoutObjectBase::Debug();
87 cerr << " `" << m_Text << '\'';
88 }
89 #endif
90
91 //-------------------------- wxLayoutObjectIcon
92
93 wxLayoutObjectIcon::wxLayoutObjectIcon(wxIcon *icon)
94 {
95 m_Icon = icon;
96 }
97
98 void
99 wxLayoutObjectIcon::Draw(wxDC &dc, wxPoint position, CoordType baseLine,
100 bool draw)
101 {
102 position.y += baseLine - m_Icon->GetHeight();
103 if(draw)
104 dc.DrawIcon(m_Icon,position.x,position.y);
105 }
106
107 wxPoint
108 wxLayoutObjectIcon::GetSize(CoordType *baseLine) const
109 {
110 wxASSERT(baseLine);
111 *baseLine = m_Icon->GetHeight();
112 return wxPoint(m_Icon->GetWidth(), m_Icon->GetHeight());
113 }
114
115 //-------------------------- wxLayoutObjectCmd
116
117
118 wxLayoutObjectCmd::wxLayoutObjectCmd(int size, int family, int style, int
119 weight, bool underline,
120 wxColour const *fg, wxColour const *bg)
121
122 {
123 m_font = new wxFont(size,family,style,weight,underline);
124 m_ColourFG = fg;
125 m_ColourBG = bg;
126 }
127
128 wxLayoutObjectCmd::~wxLayoutObjectCmd()
129 {
130 delete m_font;
131 }
132
133 wxLayoutStyleInfo *
134 wxLayoutObjectCmd::GetStyle(void) const
135 {
136 wxLayoutStyleInfo *si = new wxLayoutStyleInfo();
137
138
139 si->size = m_font->GetPointSize();
140 si->family = m_font->GetFamily();
141 si->style = m_font->GetStyle();
142 si->underline = m_font->GetUnderlined();
143 si->weight = m_font->GetWeight();
144
145 si->fg_red = m_ColourFG->Red();
146 si->fg_green = m_ColourFG->Green();
147 si->fg_blue = m_ColourFG->Blue();
148 si->bg_red = m_ColourBG->Red();
149 si->bg_green = m_ColourBG->Green();
150 si->bg_blue = m_ColourBG->Blue();
151
152 return si;
153 }
154
155 void
156 wxLayoutObjectCmd::Draw(wxDC &dc, wxPoint position, CoordType lineHeight,
157 bool draw)
158 {
159 wxASSERT(m_font);
160 // this get called even when draw==false, so that recalculation
161 // uses right font sizes
162 dc.SetFont(m_font);
163 if(m_ColourFG)
164 dc.SetTextForeground(*m_ColourFG);
165 if(m_ColourBG)
166 dc.SetTextBackground(*m_ColourBG);
167 }
168
169 //-------------------------- wxwxLayoutList
170
171 wxLayoutList::wxLayoutList()
172 {
173 m_DefaultSetting = NULL;
174 Clear();
175 }
176
177 wxLayoutList::~wxLayoutList()
178 {
179 if(m_DefaultSetting)
180 delete m_DefaultSetting;
181 }
182
183
184 void
185 wxLayoutList::LineBreak(void)
186 {
187 Insert(new wxLayoutObjectLineBreak);
188 m_CursorPosition.x = 0; m_CursorPosition.y++;
189 }
190
191 void
192 wxLayoutList::SetFont(int family, int size, int style, int weight,
193 int underline, wxColour const *fg,
194 wxColour const *bg)
195 {
196 if(family != -1) m_FontFamily = family;
197 if(size != -1) m_FontPtSize = size;
198 if(style != -1) m_FontStyle = style;
199 if(weight != -1) m_FontWeight = weight;
200 if(underline != -1) m_FontUnderline = underline;
201
202 if(fg != NULL) m_ColourFG = fg;
203 if(bg != NULL) m_ColourBG = bg;
204
205 Insert(
206 new wxLayoutObjectCmd(m_FontPtSize,m_FontFamily,m_FontStyle,m_FontWeight,m_FontUnderline,
207 m_ColourFG, m_ColourBG));
208 }
209
210 void
211 wxLayoutList::SetFont(int family, int size, int style, int weight,
212 int underline, char const *fg, char const *bg)
213 {
214 wxColour const
215 * cfg = NULL,
216 * cbg = NULL;
217
218 if( fg )
219 cfg = wxTheColourDatabase->FindColour(fg);
220 if( bg )
221 cbg = wxTheColourDatabase->FindColour(bg);
222
223 SetFont(family,size,style,weight,underline,cfg,cbg);
224 }
225
226
227 /// for access by wxLayoutWindow:
228 void
229 wxLayoutList::GetSize(CoordType *max_x, CoordType *max_y,
230 CoordType *lineHeight)
231 {
232 wxASSERT(max_x); wxASSERT(max_y); wxASSERT(lineHeight);
233 *max_x = m_MaxX;
234 *max_y = m_MaxY;
235 *lineHeight = m_LineHeight;
236 }
237
238 wxLayoutObjectBase *
239 wxLayoutList::Draw(wxDC &dc, bool findObject, wxPoint const &findCoords)
240 {
241 wxLayoutObjectList::iterator i;
242
243 // in case we need to look for an object
244 wxLayoutObjectBase *foundObject = NULL;
245
246 // first object in current line
247 wxLayoutObjectList::iterator headOfLine;
248
249 // do we need to recalculate current line?
250 bool recalculate = false;
251
252 // do we calculate or draw? Either true or false.
253 bool draw = false;
254 // drawing parameters:
255 wxPoint position = wxPoint(0,0);
256 wxPoint position_HeadOfLine;
257 CoordType baseLine = m_FontPtSize;
258 CoordType baseLineSkip = (BASELINESTRETCH * baseLine)/10;
259
260 // we trace the objects' cursor positions so we can draw the cursor
261 wxPoint cursor = wxPoint(0,0);
262 // the cursor position inside the object
263 CoordType cursorOffset = 0;
264 // object under cursor
265 wxLayoutObjectList::iterator cursorObject = FindCurrentObject(&cursorOffset);
266
267 // queried from each object:
268 wxPoint size = wxPoint(0,0);
269 CoordType objBaseLine = baseLine;
270 wxLayoutObjectType type;
271
272 // used temporarily
273 wxLayoutObjectText *tobj = NULL;
274
275 VAR(findObject); VAR(findCoords.x); VAR(findCoords.y);
276 // if the cursorobject is a cmd, we need to find the first
277 // printable object:
278 while(cursorObject != end()
279 && (*cursorObject)->GetType() == WXLO_TYPE_CMD)
280 cursorObject++;
281
282 headOfLine = begin();
283 position_HeadOfLine = position;
284
285 // setting up the default:
286 dc.SetTextForeground( *wxBLACK );
287 dc.SetFont( *wxNORMAL_FONT );
288
289 if(m_DefaultSetting)
290 m_DefaultSetting->Draw(dc,wxPoint(0,0),0,true);
291
292 // we calculate everything for drawing a line, then rewind to the
293 // begin of line and actually draw it
294 i = begin();
295 for(;;)
296 {
297 recalculate = false;
298
299 if(i == end())
300 break;
301 type = (*i)->GetType();
302
303 // to initialise sizes of objects, we need to call Draw
304 (*i)->Draw(dc, position, baseLine, draw);
305
306 // update coordinates for next object:
307 size = (*i)->GetSize(&objBaseLine);
308 if(findObject && draw) // we need to look for an object
309 {
310 if(findCoords.y >= position.y
311 && findCoords.y <= position.y+size.y
312 && findCoords.x >= position.x
313 && findCoords.x <= position.x+size.x)
314 {
315 foundObject = *i;
316 findObject = false; // speeds things up
317 }
318 }
319 // draw the cursor
320 if(m_Editable && draw && i == cursorObject)
321 {
322 if(type == WXLO_TYPE_TEXT) // special treatment
323 {
324 long descent = 0l; long width, height;
325 tobj = (wxLayoutObjectText *)*i;
326 String str = tobj->GetText();
327 VAR(m_CursorPosition.x); VAR(cursor.x);
328 str = str.substr(0, cursorOffset);
329 VAR(str);
330 dc.GetTextExtent(Str(str), &width,&height, &descent);
331 VAR(height);
332 VAR(width); VAR(descent);
333 dc.DrawLine(position.x+width,
334 position.y+(baseLineSkip-height),
335 position.x+width, position.y+baseLineSkip);
336 }
337 else
338 {
339 if(type == WXLO_TYPE_LINEBREAK)
340 dc.DrawLine(0, position.y+baseLineSkip, 0, position.y+2*baseLineSkip);
341 else
342 {
343 if(size.x == 0)
344 {
345 if(size.y == 0)
346 dc.DrawLine(position.x, position.y, position.x, position.y+baseLineSkip);
347 else
348 dc.DrawLine(position.x, position.y, position.x, position.y+size.y);
349 }
350 else
351 dc.DrawRectangle(position.x, position.y, size.x, size.y);
352 }
353 }
354 }
355
356 // calculate next object's position:
357 position.x += size.x;
358
359 // do we need to increase the line's height?
360 if(size.y > baseLineSkip)
361 {
362 baseLineSkip = size.y;
363 recalculate = true;
364 }
365 if(objBaseLine > baseLine)
366 {
367 baseLine = objBaseLine;
368 recalculate = true;
369 }
370
371 // now check whether we have finished handling this line:
372 if(type == WXLO_TYPE_LINEBREAK || i == tail())
373 {
374 if(recalculate) // do this line again
375 {
376 position.x = position_HeadOfLine.x;
377 i = headOfLine;
378 continue;
379 }
380
381 if(! draw) // finished calculating sizes
382 { // do this line again, this time drawing it
383 position = position_HeadOfLine;
384 draw = true;
385 i = headOfLine;
386 continue;
387 }
388 else // we have drawn a line, so continue calculating next one
389 draw = false;
390 }
391
392 if(position.x+size.x > m_MaxX)
393 m_MaxX = position.x+size.x;
394 // is it a linebreak?
395 if(type == WXLO_TYPE_LINEBREAK || i == tail())
396 {
397 position.x = 0;
398 position.y += baseLineSkip;
399 baseLine = m_FontPtSize;
400 objBaseLine = baseLine; // not all objects set it
401 baseLineSkip = (BASELINESTRETCH * baseLine)/10;
402 headOfLine = i;
403 headOfLine++;
404 position_HeadOfLine = position;
405 }
406 i++;
407 }
408 m_MaxY = position.y;
409 return foundObject;
410 }
411
412 #ifdef WXLAYOUT_DEBUG
413 void
414 wxLayoutList::Debug(void)
415 {
416 CoordType offs;
417 wxLayoutObjectList::iterator i;
418
419 cerr <<
420 "------------------------debug start-------------------------" << endl;
421 for(i = begin(); i != end(); i++)
422 {
423 (*i)->Debug();
424 cerr << endl;
425 }
426 cerr <<
427 "-----------------------debug end----------------------------"
428 << endl;
429 // show current object:
430 cerr << "Cursor: "
431 << m_CursorPosition.x << ','
432 << m_CursorPosition.y;
433
434 i = FindCurrentObject(&offs);
435 cerr << " line length: " << GetLineLength(i) << " ";
436 if(i == end())
437 {
438 cerr << "<<no object found>>" << endl;
439 return; // FIXME we should set cursor position to maximum allowed
440 // value then
441 }
442 if((*i)->GetType() == WXLO_TYPE_TEXT)
443 {
444 cerr << " \"" << ((wxLayoutObjectText *)(*i))->GetText() << "\", offs: "
445 << offs << endl;
446 }
447 else
448 cerr << ' ' << _t[(*i)->GetType()] << endl;
449
450 }
451 #endif
452
453 /******************** editing stuff ********************/
454
455 wxLayoutObjectList::iterator
456 wxLayoutList::FindObjectCursor(wxPoint const &cpos, CoordType *offset)
457 {
458 wxPoint cursor = wxPoint(0,0); // runs along the objects
459 CoordType width;
460 wxLayoutObjectList::iterator i;
461
462 #ifdef WXLAYOUT_DEBUG
463 cerr << "Looking for object at " << cpos.x << ',' << cpos.y <<
464 endl;
465 #endif
466 for(i = begin(); i != end() && cursor.y <= cpos.y; i++)
467 {
468 width = 0;
469 if((*i)->GetType() == WXLO_TYPE_LINEBREAK)
470 {
471 if(cpos.y == cursor.y)
472 {
473 --i;
474 if(offset)
475 *offset = (*i)->CountPositions();
476 return i;
477 }
478 cursor.x = 0; cursor.y ++;
479 }
480 else
481 cursor.x += (width = (*i)->CountPositions());
482 if(cursor.y == cpos.y && (cursor.x > cpos.x ||
483 ((*i)->GetType() != WXLO_TYPE_CMD && cursor.x == cpos.x))
484 ) // found it ?
485 {
486 if(offset)
487 *offset = cpos.x-(cursor.x-width); // 0==cursor before
488 // the object
489 #ifdef WXLAYOUT_DEBUG
490 cerr << " found object at " << cursor.x-width << ',' <<
491 cursor.y << ", type:" << _t[(*i)->GetType()] <<endl;
492 #endif
493 return i;
494 }
495 }
496 #ifdef WXLAYOUT_DEBUG
497 cerr << " not found" << endl;
498 #endif
499 return end(); // not found
500 }
501
502 wxLayoutObjectList::iterator
503 wxLayoutList::FindCurrentObject(CoordType *offset)
504 {
505 wxLayoutObjectList::iterator obj = end();
506
507 obj = FindObjectCursor(m_CursorPosition, offset);
508 if(obj == end()) // not ideal yet
509 {
510 obj = tail();
511 if(obj != end()) // tail really exists
512 *offset = (*obj)->CountPositions(); // at the end of it
513 }
514 return obj;
515 }
516
517 void
518 wxLayoutList::MoveCursor(int dx, int dy)
519 {
520 CoordType offs, lineLength;
521 wxLayoutObjectList::iterator i;
522
523
524 if(dy > 0 && m_CursorPosition.y < m_MaxLine)
525 m_CursorPosition.y += dy;
526 else if(dy < 0 && m_CursorPosition.y > 0)
527 m_CursorPosition.y += dy; // dy is negative
528 if(m_CursorPosition.y < 0)
529 m_CursorPosition.y = 0;
530 else if (m_CursorPosition.y > m_MaxLine)
531 m_CursorPosition.y = m_MaxLine;
532
533 while(dx > 0)
534 {
535 i = FindCurrentObject(&offs);
536 lineLength = GetLineLength(i);
537 if(m_CursorPosition.x < lineLength)
538 {
539 m_CursorPosition.x ++;
540 dx--;
541 continue;
542 }
543 else
544 {
545 if(m_CursorPosition.y < m_MaxLine)
546 {
547 m_CursorPosition.y++;
548 m_CursorPosition.x = 0;
549 dx--;
550 }
551 else
552 break; // cannot move there
553 }
554 }
555 while(dx < 0)
556 {
557 if(m_CursorPosition.x > 0)
558 {
559 m_CursorPosition.x --;
560 dx++;
561 }
562 else
563 {
564 if(m_CursorPosition.y > 0)
565 {
566 m_CursorPosition.y --;
567 m_CursorPosition.x = 0;
568 i = FindCurrentObject(&offs);
569 lineLength = GetLineLength(i);
570 m_CursorPosition.x = lineLength;
571 dx++;
572 continue;
573 }
574 else
575 break; // cannot move left any more
576 }
577 }
578 // final adjustment:
579 i = FindCurrentObject(&offs);
580 lineLength = GetLineLength(i);
581 if(m_CursorPosition.x > lineLength)
582 m_CursorPosition.x = lineLength;
583
584 #ifdef WXLAYOUT_DEBUG
585 i = FindCurrentObject(&offs);
586 cerr << "Cursor: "
587 << m_CursorPosition.x << ','
588 << m_CursorPosition.y;
589
590 if(i == end())
591 {
592 cerr << "<<no object found>>" << endl;
593 return; // FIXME we should set cursor position to maximum allowed
594 // value then
595 }
596 if((*i)->GetType() == WXLO_TYPE_TEXT)
597 {
598 cerr << " \"" << ((wxLayoutObjectText *)(*i))->GetText() << "\", offs: "
599 << offs << endl;
600 }
601 else
602 cerr << ' ' << _t[(*i)->GetType()] << endl;
603 #endif
604 }
605
606 void
607 wxLayoutList::Delete(CoordType count)
608 {
609 TRACE(Delete);
610
611 if(!m_Editable)
612 return;
613
614 VAR(count);
615
616 CoordType offs, len;
617 wxLayoutObjectList::iterator i;
618
619 do
620 {
621 i = FindCurrentObject(&offs);
622 if(i == end())
623 return;
624 #ifdef WXLAYOUT_DEBUG
625 cerr << "trying to delete: " << _t[(*i)->GetType()] << endl;
626 #endif
627 if((*i)->GetType() == WXLO_TYPE_LINEBREAK)
628 m_MaxLine--;
629 if((*i)->GetType() == WXLO_TYPE_TEXT)
630 {
631 wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i;
632 len = tobj->CountPositions();
633 // If we find the end of a text object, this means that we
634 // have to delete from the object following it.
635 if(offs == len)
636 {
637 i++;
638 if((*i)->GetType() == WXLO_TYPE_TEXT)
639 {
640 offs = 0; // delete from begin of next string
641 tobj = (wxLayoutObjectText *)*i;
642 len = tobj->CountPositions();
643 }
644 else
645 {
646 erase(i);
647 return;
648 }
649 }
650 if(len <= count) // delete this object
651 {
652 count -= len;
653 erase(i);
654 }
655 else
656 {
657 len = count;
658 VAR(offs); VAR(len);
659 tobj->GetText().erase(offs,len);
660 return; // we are done
661 }
662 }
663 else // delete the object
664 {
665 len = (*i)->CountPositions();
666 erase(i); // after this, i is the iterator for the following object
667 if(count > len)
668 count -= len;
669 else
670 count = 0;
671 }
672 }
673 while(count && i != end());
674 }
675
676 void
677 wxLayoutList::Insert(wxLayoutObjectBase *obj)
678 {
679 wxASSERT(obj);
680 CoordType offs;
681 wxLayoutObjectList::iterator i = FindCurrentObject(&offs);
682
683 TRACE(Insert(obj));
684
685 if(i == end())
686 push_back(obj);
687 else
688 {
689 // do we have to split a text object?
690 if((*i)->GetType() == WXLO_TYPE_TEXT && offs != 0 && offs != (*i)->CountPositions())
691 {
692 wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i;
693 #ifdef WXLAYOUT_DEBUG
694 cerr << "text: '" << tobj->GetText() << "'" << endl;
695 VAR(offs);
696 #endif
697 String left = tobj->GetText().substr(0,offs); // get part before cursor
698 VAR(left);
699 tobj->GetText() = tobj->GetText().substr(offs,(*i)->CountPositions()-offs); // keeps the right half
700 VAR(tobj->GetText());
701 insert(i,obj);
702 insert(i,new wxLayoutObjectText(left)); // inserts before
703 }
704 else
705 {
706 wxLayoutObjectList::iterator j = i; // we want to apend after this object
707 j++;
708 if(j != end())
709 insert(j, obj);
710 else
711 push_back(obj);
712 }
713 }
714 m_CursorPosition.x += obj->CountPositions();
715 if(obj->GetType() == WXLO_TYPE_LINEBREAK)
716 m_MaxLine++;
717 }
718
719 void
720 wxLayoutList::Insert(String const &text)
721 {
722 wxLayoutObjectText *tobj = NULL;
723 TRACE(Insert(text));
724
725 if(! m_Editable)
726 return;
727
728 CoordType offs;
729 wxLayoutObjectList::iterator i = FindCurrentObject(&offs);
730
731 if(i != end() && (*i)->GetType() == WXLO_TYPE_TEXT)
732 { // insert into an existing text object:
733 TRACE(inserting into existing object);
734 tobj = (wxLayoutObjectText *)*i ;
735 wxASSERT(tobj);
736 tobj->GetText().insert(offs,text);
737 }
738 else // check whether the previous object is text:
739 {
740 wxLayoutObjectList::iterator j = i;
741 j--;
742 TRACE(checking previous object);
743 if(0 && j != end() && (*j)->GetType() == WXLO_TYPE_TEXT)
744 {
745 tobj = (wxLayoutObjectText *)*i;
746 wxASSERT(tobj);
747 tobj->GetText()+=text;
748 }
749 else // insert a new text object
750 {
751 TRACE(creating new object);
752 Insert(new wxLayoutObjectText(text)); //FIXME not too optimal, slow
753 return; // position gets incremented in Insert(obj)
754 }
755 }
756 m_CursorPosition.x += strlen(text.c_str());
757 }
758
759 CoordType
760 wxLayoutList::GetLineLength(wxLayoutObjectList::iterator i)
761 {
762 if(i == end())
763 return 0;
764
765 CoordType len = 0;
766
767 // search backwards for beginning of line:
768 while(i != begin() && (*i)->GetType() != WXLO_TYPE_LINEBREAK)
769 i--;
770 if((*i)->GetType() == WXLO_TYPE_LINEBREAK)
771 i++;
772 // now we can start counting:
773 while(i != end() && (*i)->GetType() != WXLO_TYPE_LINEBREAK)
774 {
775 len += (*i)->CountPositions();
776 i++;
777 }
778 return len;
779 }
780
781 void
782 wxLayoutList::Clear(int family, int size, int style, int weight,
783 int underline, char const *fg, char const *bg)
784 {
785 wxLayoutObjectList::iterator i = begin();
786
787 while(i != end()) // == while valid
788 erase(i);
789
790 // set defaults
791 m_FontPtSize = size;
792 m_FontUnderline = false;
793 m_FontFamily = family;
794 m_FontStyle = style;
795 m_FontWeight = weight;
796 m_ColourFG = wxTheColourDatabase->FindColour(fg);
797 m_ColourBG = wxTheColourDatabase->FindColour(bg);
798
799 m_Position = wxPoint(0,0);
800 m_CursorPosition = wxPoint(0,0);
801 m_MaxLine = 0;
802 m_LineHeight = (BASELINESTRETCH*m_FontPtSize)/10;
803 m_MaxX = 0; m_MaxY = 0;
804
805 if(m_DefaultSetting)
806 delete m_DefaultSetting;
807 m_DefaultSetting = new
808 wxLayoutObjectCmd(m_FontPtSize,m_FontFamily,m_FontStyle,
809 m_FontWeight,m_FontUnderline,
810 m_ColourFG, m_ColourBG);
811 }