1 /*-*- c++ -*-********************************************************
2 * wxFTCanvas: a canvas for editing formatted text *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
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
22 #pragma implementation "wxllist.h"
25 // these two lines are for use in M:
27 //#include "gui/wxllist.h"
32 # include "iostream.h"
35 # include <wx/postscrp.h>
36 # include <wx/print.h>
40 #define BASELINESTRETCH 12
43 static const char *g_aTypeStrings
[] =
45 "invalid", "text", "cmd", "icon", "linebreak"
48 # define wxLayoutDebug wxLogDebug
49 # define WXL_VAR(x) wxLogDebug(#x " = ", x)
50 # define WXL_DBG_POINT(p) wxLogDebug(#p ": (%d, %d)", p.x, p.y)
51 # define WXL_TRACE(f) wxLogDebug(#f ": ")
52 # define TypeString(t) g_aTypeStrings[t]
55 wxLayoutObjectBase::Debug(void)
58 wxLogDebug("%s: size = %dx%d, bl = %d",
59 TypeString(GetType()), GetSize(&bl
).x
, GetSize(&bl
).y
, bl
);
64 # define WXL_DBG_POINT(p)
66 # define ShowCurrentObject()
67 # define TypeString(t) ""
68 inline void wxLayoutDebug(const char *, ...) { }
72 //-------------------------- wxLayoutObjectText
74 wxLayoutObjectText::wxLayoutObjectText(const String
&txt
)
83 wxLayoutObjectText::GetSize(CoordType
*baseLine
) const
85 if(baseLine
) *baseLine
= m_BaseLine
;
86 return wxPoint(m_Width
, m_Height
);
90 wxLayoutObjectText::Draw(wxDC
&dc
, wxPoint position
, CoordType baseLine
,
94 dc
.GetTextExtent(Str(m_Text
),&m_Width
, &m_Height
, &descent
);
95 //FIXME: wxGTK does not set descent to a descent value yet.
97 descent
= (2*m_Height
)/10; // crude fix
98 m_BaseLine
= m_Height
- descent
;
99 position
.y
+= baseLine
-m_BaseLine
;
101 dc
.DrawText(Str(m_Text
),position
.x
,position
.y
);
102 // Don't remove this, important help for debugging layout.
103 # ifdef WXLAYOUT_DEBUG
104 // dc.DrawRectangle(position.x, position.y, m_Width, m_Height);
108 #ifdef WXLAYOUT_DEBUG
110 wxLayoutObjectText::Debug(void)
112 wxLayoutObjectBase::Debug();
113 wxLogDebug(" `%s`", m_Text
.c_str());
117 //-------------------------- wxLayoutObjectIcon
119 wxLayoutObjectIcon::wxLayoutObjectIcon(wxIcon
*icon
)
125 wxLayoutObjectIcon::Draw(wxDC
&dc
, wxPoint position
, CoordType baseLine
,
128 position
.y
+= baseLine
- m_Icon
->GetHeight();
130 dc
.DrawIcon(m_Icon
,position
.x
,position
.y
);
134 wxLayoutObjectIcon::GetSize(CoordType
*baseLine
) const
137 *baseLine
= m_Icon
->GetHeight();
138 return wxPoint(m_Icon
->GetWidth(), m_Icon
->GetHeight());
141 //-------------------------- wxLayoutObjectCmd
144 wxLayoutObjectCmd::wxLayoutObjectCmd(int size
, int family
, int style
, int
145 weight
, bool underline
,
146 wxColour
const *fg
, wxColour
const *bg
)
149 m_font
= new wxFont(size
,family
,style
,weight
,underline
);
154 wxLayoutObjectCmd::~wxLayoutObjectCmd()
160 wxLayoutObjectCmd::GetStyle(void) const
162 wxLayoutStyleInfo
*si
= new wxLayoutStyleInfo();
165 si
->size
= m_font
->GetPointSize();
166 si
->family
= m_font
->GetFamily();
167 si
->style
= m_font
->GetStyle();
168 si
->underline
= m_font
->GetUnderlined();
169 si
->weight
= m_font
->GetWeight();
171 si
->fg_red
= m_ColourFG
->Red();
172 si
->fg_green
= m_ColourFG
->Green();
173 si
->fg_blue
= m_ColourFG
->Blue();
174 si
->bg_red
= m_ColourBG
->Red();
175 si
->bg_green
= m_ColourBG
->Green();
176 si
->bg_blue
= m_ColourBG
->Blue();
182 wxLayoutObjectCmd::Draw(wxDC
&dc
, wxPoint position
, CoordType lineHeight
,
186 // this get called even when draw==false, so that recalculation
187 // uses right font sizes
190 dc
.SetTextForeground(*m_ColourFG
);
192 dc
.SetTextBackground(*m_ColourBG
);
195 //-------------------------- wxwxLayoutList
197 wxLayoutList::wxLayoutList()
199 m_DefaultSetting
= NULL
;
203 wxLayoutList::~wxLayoutList()
206 delete m_DefaultSetting
;
207 // no deletion of objects, they are owned by the list
211 wxLayoutList::LineBreak(void)
213 Insert(new wxLayoutObjectLineBreak
);
214 m_CursorPosition
.x
= 0; m_CursorPosition
.y
++;
218 wxLayoutList::SetFont(int family
, int size
, int style
, int weight
,
219 int underline
, wxColour
const *fg
,
222 if(family
!= -1) m_FontFamily
= family
;
223 if(size
!= -1) m_FontPtSize
= size
;
224 if(style
!= -1) m_FontStyle
= style
;
225 if(weight
!= -1) m_FontWeight
= weight
;
226 if(underline
!= -1) m_FontUnderline
= underline
!= 0;
228 if(fg
!= NULL
) m_ColourFG
= fg
;
229 if(bg
!= NULL
) m_ColourBG
= bg
;
232 new wxLayoutObjectCmd(m_FontPtSize
,m_FontFamily
,m_FontStyle
,m_FontWeight
,m_FontUnderline
,
233 m_ColourFG
, m_ColourBG
));
237 wxLayoutList::SetFont(int family
, int size
, int style
, int weight
,
238 int underline
, char const *fg
, char const *bg
)
245 cfg
= wxTheColourDatabase
->FindColour(fg
);
247 cbg
= wxTheColourDatabase
->FindColour(bg
);
249 SetFont(family
,size
,style
,weight
,underline
,cfg
,cbg
);
253 /// for access by wxLayoutWindow:
255 wxLayoutList::GetSize(CoordType
*max_x
, CoordType
*max_y
,
256 CoordType
*lineHeight
)
258 wxASSERT(max_x
); wxASSERT(max_y
); wxASSERT(lineHeight
);
261 *lineHeight
= m_LineHeight
;
265 wxLayoutList::Draw(wxDC
&dc
, bool findObject
, wxPoint
const &findCoords
)
267 wxLayoutObjectList::iterator i
;
269 // in case we need to look for an object
270 wxLayoutObjectBase
*foundObject
= NULL
;
272 // first object in current line
273 wxLayoutObjectList::iterator headOfLine
;
275 // do we need to recalculate current line?
276 bool recalculate
= false;
278 // do we calculate or draw? Either true or false.
280 // drawing parameters:
281 wxPoint position
= wxPoint(0,0);
282 wxPoint position_HeadOfLine
;
283 CoordType baseLine
= m_FontPtSize
;
284 CoordType baseLineSkip
= (BASELINESTRETCH
* baseLine
)/10;
286 // where to draw the cursor
288 cursorPosition
= wxPoint(0,0),
289 cursorSize
= wxPoint(1,baseLineSkip
);
291 // the cursor position inside the object
292 CoordType cursorOffset
= 0;
293 // object under cursor
294 wxLayoutObjectList::iterator cursorObject
= FindCurrentObject(&cursorOffset
);
296 // queried from each object:
297 wxPoint size
= wxPoint(0,0);
298 CoordType objBaseLine
= baseLine
;
299 wxLayoutObjectType type
;
302 wxLayoutObjectText
*tobj
= NULL
;
305 // this is needed for printing to a printer:
306 // only interesting for printer/PS output
307 int pageWidth
, pageHeight
; //GetSize() still needs int at the moment
310 int top
, bottom
, left
, right
;
315 dc
.IsKindOf(CLASSINFO(wxPrinterDC
)) ||
317 dc
.IsKindOf(CLASSINFO(wxPostScriptDC
)))
319 dc
.GetSize(&pageWidth
, &pageHeight
);
320 dc
.StartDoc(_("Printing..."));
322 margins
.top
= (1*pageHeight
)/10; // 10%
323 margins
.bottom
= (9*pageHeight
)/10; // 90%
324 margins
.left
= (1*pageWidth
)/10;
325 margins
.right
= (9*pageWidth
)/10;
329 margins
.top
= 0; margins
.left
= 0;
333 position
.y
= margins
.right
;
334 position
.x
= margins
.left
;
336 // if the cursorobject is a cmd, we need to find the first
338 while(cursorObject
!= end()
339 && (*cursorObject
)->GetType() == WXLO_TYPE_CMD
)
342 headOfLine
= begin();
343 position_HeadOfLine
= position
;
345 // setting up the default:
346 dc
.SetTextForeground( *wxBLACK
);
347 dc
.SetTextBackground( *wxWHITE
);
348 dc
.SetBackgroundMode( wxSOLID
); // to enable setting of text background
349 dc
.SetFont( *wxNORMAL_FONT
);
352 //FIXME: who frees the brush, how long does it need to exist?
354 m_DefaultSetting
->Draw(dc
,wxPoint(0,0),0,true);
356 // we calculate everything for drawing a line, then rewind to the
357 // begin of line and actually draw it
365 type
= (*i
)->GetType();
367 // to initialise sizes of objects, we need to call Draw
368 (*i
)->Draw(dc
, position
, baseLine
, draw
);
370 // update coordinates for next object:
371 size
= (*i
)->GetSize(&objBaseLine
);
372 if(findObject
&& draw
) // we need to look for an object
374 if(findCoords
.y
>= position
.y
375 && findCoords
.y
<= position
.y
+size
.y
376 && findCoords
.x
>= position
.x
377 && findCoords
.x
<= position
.x
+size
.x
)
380 findObject
= false; // speeds things up
384 if(m_Editable
&& draw
&& i
== cursorObject
)
386 WXL_VAR((**cursorObject
).GetType());
387 WXL_VAR(m_CursorPosition
.x
); WXL_VAR(m_CursorPosition
.y
);
388 if(type
== WXLO_TYPE_TEXT
) // special treatment
390 long descent
= 0l; long width
, height
;
391 tobj
= (wxLayoutObjectText
*)*i
;
392 String str
= tobj
->GetText();
393 WXL_VAR(m_CursorPosition
.x
);
394 str
= str
.substr(0, cursorOffset
);
395 dc
.GetTextExtent(Str(str
), &width
,&height
, &descent
);
396 cursorPosition
= wxPoint(position
.x
+width
,
397 position
.y
+(baseLineSkip
-height
));
398 cursorSize
= wxPoint(1, height
);
400 else if(type
== WXLO_TYPE_LINEBREAK
)
402 WXL_VAR(cursorOffset
);
404 cursorPosition
= wxPoint(0, position
.y
+baseLineSkip
);
406 cursorPosition
= wxPoint(0, position
.y
);
407 cursorSize
= wxPoint(1,baseLineSkip
);
412 // this is not necessarily the most "beautiful" solution:
413 //cursorPosition = wxPoint(position.x, position.y);
414 //cursorSize = wxPoint(size.x > 0 ? size.x : 1,size.y > 0 ? size.y : baseLineSkip);
415 cursorPosition
= wxPoint(position
.x
+size
.x
, position
.y
+(size
.y
-baseLineSkip
));
416 cursorSize
= wxPoint(1, baseLineSkip
);
420 // calculate next object's position:
421 position
.x
+= size
.x
;
422 if(position
.x
> m_MaxX
)
425 // do we need to increase the line's height?
426 if(size
.y
> baseLineSkip
)
428 baseLineSkip
= size
.y
;
431 if(objBaseLine
> baseLine
)
433 baseLine
= objBaseLine
;
437 // now check whether we have finished handling this line:
438 if(type
== WXLO_TYPE_LINEBREAK
|| i
== tail())
440 if(recalculate
) // do this line again
442 position
.x
= position_HeadOfLine
.x
;
447 if(! draw
) // finished calculating sizes
449 // if the this line needs to go onto a new page, we need
450 // to change pages before drawing it:
451 if(margins
.bottom
!= -1 && position
.y
> margins
.bottom
)
454 position_HeadOfLine
.y
= margins
.top
;
457 // do this line again, this time drawing it
458 position
= position_HeadOfLine
;
463 else // we have drawn a line, so continue calculating next one
467 // is it a linebreak?
468 if(type
== WXLO_TYPE_LINEBREAK
|| i
== tail())
470 position
.x
= margins
.left
;
471 position
.y
+= baseLineSkip
;
472 baseLine
= m_FontPtSize
;
473 objBaseLine
= baseLine
; // not all objects set it
474 baseLineSkip
= (BASELINESTRETCH
* baseLine
)/10;
477 position_HeadOfLine
= position
;
485 dc
.DrawRectangle(cursorPosition
.x
, cursorPosition
.y
,
486 cursorSize
.x
, cursorSize
.y
);
492 #ifdef WXLAYOUT_DEBUG
494 wxLayoutList::Debug(void)
497 wxLayoutObjectList::iterator i
;
499 wxLogDebug("------------------------debug start-------------------------");
500 for(i
= begin(); i
!= end(); i
++)
502 wxLogDebug("-----------------------debug end----------------------------");
504 // show current object:
506 i
= FindCurrentObject(&offs
);
507 wxLogDebug(" line length: %l", (long int) GetLineLength(i
,offs
));
510 wxLogDebug("<<no object found>>");
511 return; // FIXME we should set cursor position to maximum allowed
514 if((*i
)->GetType() == WXLO_TYPE_TEXT
)
515 wxLogDebug(" \"%s\", offs=%d",((wxLayoutObjectText
*)(*i
))->GetText().c_str(), (int) offs
);
517 wxLogDebug(g_aTypeStrings
[(*i
)->GetType()]);
522 wxLayoutList::ShowCurrentObject()
525 wxLayoutObjectList::iterator i
= FindCurrentObject(&offs
);
527 wxLayoutDebug("Cursor is at (%d, %d)",
528 m_CursorPosition
.x
, m_CursorPosition
.y
);
530 i
= FindCurrentObject(&offs
);
531 wxLogDebug(" Line length: %d", GetLineLength(i
));
535 wxLogDebug("<<no object found>>");
536 return; // FIXME we should set cursor position to maximum allowed
539 if((*i
)->GetType() == WXLO_TYPE_TEXT
)
540 wxLogDebug(" \"%s\", offs: %d",
541 ((wxLayoutObjectText
*)(*i
))->GetText().c_str(), offs
);
543 wxLogDebug(" %s", TypeString((*i
)->GetType()));
548 /******************** editing stuff ********************/
550 // don't change this, I know how to optimise this and will do it real
555 * Finds the object belonging to a given cursor position cpos and
556 * returns an iterator to that object and stores the relative cursor
557 * position in offset.
559 * For linebreaks, the offset can be 0=before or 1=after.
561 * If the cpos coordinates don't exist, they are modified.
564 wxLayoutObjectList::iterator
565 wxLayoutList::FindObjectCursor(wxPoint
*cpos
, CoordType
*offset
)
567 wxPoint object
= wxPoint(0,0); // runs along the objects
569 wxLayoutObjectList::iterator i
;
571 #ifdef WXLAYOUT_DEBUG
572 wxLayoutDebug("Looking for object at (%d, %d)", cpos
->x
, cpos
->y
);
574 for(i
= begin(); i
!= end() && object
.y
<= cpos
->y
; i
++)
576 width
= (**i
).CountPositions();
577 if(cpos
->y
== object
.y
) // a possible candidate
579 if((**i
).GetType() ==WXLO_TYPE_LINEBREAK
)
581 if(cpos
->x
== object
.x
)
583 if(offset
) *offset
= 0;
586 if(offset
) *offset
=1;
590 if(cpos
->x
>= object
.x
&& cpos
->x
<= object
.x
+width
) // overlap
592 if(offset
) *offset
= cpos
->x
-object
.x
;
593 #ifdef WXLAYOUT_DEBUG
594 wxLayoutDebug(" found object at (%d, %d), type: %s",
595 object
.x
, object
.y
, TypeString((*i
)->GetType()));
600 // no overlap, increment coordinates
602 if((**i
).GetType() == WXLO_TYPE_LINEBREAK
)
608 #ifdef WXLAYOUT_DEBUG
609 wxLayoutDebug(" not found");
611 // return last object, coordinates of that one:
615 if((**i
).GetType()==WXLO_TYPE_LINEBREAK
)
621 cpos
->x
= object
.x
; // would be the coordinate of next object
623 cpos
->x
+= width
; // last object's width
624 if(*offset
) *offset
= cpos
->x
-object
.x
;
625 return i
; // not found
628 wxLayoutObjectList::iterator
629 wxLayoutList::FindCurrentObject(CoordType
*offset
)
631 wxLayoutObjectList::iterator obj
= end();
633 obj
= FindObjectCursor(&m_CursorPosition
, offset
);
634 if(obj
== end()) // not ideal yet
637 if(obj
!= end()) // tail really exists
638 *offset
= (*obj
)->CountPositions(); // at the end of it
644 wxLayoutList::MoveCursor(int dx
, int dy
)
646 CoordType offs
, lineLength
;
647 wxLayoutObjectList::iterator i
;
649 bool rc
= true; // have we moved?
651 if(dy
> 0 && m_CursorPosition
.y
< m_MaxLine
)
652 m_CursorPosition
.y
+= dy
;
653 else if(dy
< 0 && m_CursorPosition
.y
> 0)
654 m_CursorPosition
.y
+= dy
; // dy is negative
655 if(m_CursorPosition
.y
< 0)
657 m_CursorPosition
.y
= 0;
660 else if (m_CursorPosition
.y
> m_MaxLine
)
662 m_CursorPosition
.y
= m_MaxLine
;
668 i
= FindCurrentObject(&offs
);
669 lineLength
= GetLineLength(i
,offs
);
670 if(m_CursorPosition
.x
< lineLength
)
672 m_CursorPosition
.x
++;
678 if(m_CursorPosition
.y
< m_MaxLine
)
680 m_CursorPosition
.y
++;
681 m_CursorPosition
.x
= 0;
687 break; // cannot move there
693 if(m_CursorPosition
.x
> 0)
695 m_CursorPosition
.x
--;
700 if(m_CursorPosition
.y
> 0)
702 m_CursorPosition
.y
--;
703 m_CursorPosition
.x
= 0;
704 i
= FindCurrentObject(&offs
);
705 lineLength
= GetLineLength(i
,offs
);
706 m_CursorPosition
.x
= lineLength
;
713 break; // cannot move left any more
718 i
= FindCurrentObject(&offs
);
719 lineLength
= GetLineLength(i
,offs
);
720 if(m_CursorPosition
.x
> lineLength
)
722 m_CursorPosition
.x
= lineLength
;
725 #ifdef WXLAYOUT_DEBUG
732 wxLayoutList::Delete(CoordType count
)
742 wxLayoutObjectList::iterator i
;
746 i
= FindCurrentObject(&offs
);
747 startover
: // ugly, but easiest way to do it
749 return; // we cannot delete anything more
751 /* Here we need to treat linebreaks differently.
752 If offs==0 we are before the linebreak, otherwise behind. */
753 if((*i
)->GetType() == WXLO_TYPE_LINEBREAK
)
760 continue; // we're done
762 else // delete the object behind the linebreak
764 i
++; // we increment and continue as normal
769 else if((*i
)->GetType() == WXLO_TYPE_TEXT
)
771 wxLayoutObjectText
*tobj
= (wxLayoutObjectText
*)*i
;
772 CoordType len
= tobj
->CountPositions();
773 // If we find the end of a text object, this means that we
774 // have to delete from the object following it.
781 else if(len
<= count
) // delete this object
790 tobj
->GetText().erase(offs
,len
);
791 return; // we are done
794 else// all other objects: delete the object
795 // this only works as expected if the non-text object has 0/1
796 // as offset values. Not tested with "longer" objects.
798 CoordType len
= (*i
)->CountPositions();
801 count
= count
> len
? count
-= len
: 0;
802 erase(i
); // after this, i is the iterator for the following object
805 else // delete the following object
807 i
++; // we increment and continue as normal
813 while(count
&& i
!= end());
817 wxLayoutList::Insert(wxLayoutObjectBase
*obj
)
821 wxLayoutObjectList::iterator i
= FindCurrentObject(&offs
);
823 WXL_TRACE(Insert(obj
));
829 // do we have to split a text object?
830 else if((*i
)->GetType() == WXLO_TYPE_TEXT
&& offs
!= (*i
)->CountPositions())
832 wxLayoutObjectText
*tobj
= (wxLayoutObjectText
*) *i
;
833 #ifdef WXLAYOUT_DEBUG
834 wxLayoutDebug("text: %s", tobj
->GetText().c_str());
837 String left
= tobj
->GetText().substr(0,offs
); // get part before cursor
838 WXL_VAR(left
.c_str());
839 tobj
->GetText() = tobj
->GetText().substr(offs
,(*i
)->CountPositions()-offs
); // keeps the right half
840 WXL_VAR(tobj
->GetText().c_str());
842 insert(i
,new wxLayoutObjectText(left
)); // inserts before
846 // all other cases, append after object:
847 wxLayoutObjectList::iterator j
= i
; // we want to apend after this object
855 m_CursorPosition
.x
+= obj
->CountPositions();
856 if(obj
->GetType() == WXLO_TYPE_LINEBREAK
)
861 wxLayoutList::Insert(String
const &text
)
863 wxLayoutObjectText
*tobj
= NULL
;
864 wxLayoutObjectList::iterator j
;
866 WXL_TRACE(Insert(text
));
872 wxLayoutObjectList::iterator i
= FindCurrentObject(&offs
);
876 Insert(new wxLayoutObjectText(text
));
880 switch((**i
).GetType())
883 // insert into an existing text object:
884 WXL_TRACE(inserting into existing object
);
885 tobj
= (wxLayoutObjectText
*)*i
;
887 tobj
->GetText().insert(offs
,text
);
889 case WXLO_TYPE_LINEBREAK
:
892 if(offs
== 0) // try to append to previous object
895 if(j
!= end() && (**j
).GetType() == WXLO_TYPE_TEXT
)
897 tobj
= (wxLayoutObjectText
*)*j
;
898 tobj
->GetText()+=text
;
901 insert(i
,new wxLayoutObjectText(text
));
903 else // cursor after linebreak
906 if(j
!= end() && (**j
).GetType() == WXLO_TYPE_TEXT
)
908 tobj
= (wxLayoutObjectText
*)*j
;
909 tobj
->GetText()=text
+tobj
->GetText();
914 push_back(new wxLayoutObjectText(text
));
916 insert(j
,new wxLayoutObjectText(text
));
923 WXL_TRACE(checking previous object
);
924 if(j
!= end() && (**j
).GetType() == WXLO_TYPE_TEXT
)
926 tobj
= (wxLayoutObjectText
*)*j
;
927 tobj
->GetText()+=text
;
929 else // insert a new text object
931 WXL_TRACE(creating
new object
);
932 Insert(new wxLayoutObjectText(text
)); //FIXME not too optimal, slow
933 return; // position gets incremented in Insert(obj)
937 m_CursorPosition
.x
+= strlen(text
.c_str());
941 wxLayoutList::GetLineLength(wxLayoutObjectList::iterator i
, CoordType offs
)
948 if(offs
== 0 && (**i
).GetType() == WXLO_TYPE_LINEBREAK
)
949 // we are before a linebrak
951 // search backwards for beginning of line:
952 while(i
!= begin() && (*i
)->GetType() != WXLO_TYPE_LINEBREAK
)
954 if((*i
)->GetType() == WXLO_TYPE_LINEBREAK
)
956 // now we can start counting:
957 while(i
!= end() && (*i
)->GetType() != WXLO_TYPE_LINEBREAK
)
959 len
+= (*i
)->CountPositions();
966 wxLayoutList::Clear(int family
, int size
, int style
, int weight
,
967 int underline
, char const *fg
, char const *bg
)
969 wxLayoutObjectList::iterator i
= begin();
971 while(i
!= end()) // == while valid
976 m_FontUnderline
= false;
977 m_FontFamily
= family
;
979 m_FontWeight
= weight
;
980 m_ColourFG
= wxTheColourDatabase
->FindColour(fg
);
981 m_ColourBG
= wxTheColourDatabase
->FindColour(bg
);
983 if(! m_ColourFG
) m_ColourFG
= wxBLACK
;
984 if(! m_ColourBG
) m_ColourBG
= wxWHITE
;
986 m_Position
= wxPoint(0,0);
987 m_CursorPosition
= wxPoint(0,0);
989 m_LineHeight
= (BASELINESTRETCH
*m_FontPtSize
)/10;
990 m_MaxX
= 0; m_MaxY
= 0;
994 delete m_DefaultSetting
;
995 m_DefaultSetting
= new
996 wxLayoutObjectCmd(m_FontPtSize
,m_FontFamily
,m_FontStyle
,
997 m_FontWeight
,m_FontUnderline
,
998 m_ColourFG
, m_ColourBG
);