git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40312
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Name: richtext/richtextbuffer.cpp
+// Name: src/richtext/richtextbuffer.cpp
// Purpose: Buffer for wxRichTextCtrl
// Author: Julian Smart
// Modified by:
// Purpose: Buffer for wxRichTextCtrl
// Author: Julian Smart
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#endif
#if wxUSE_RICHTEXT
#endif
#if wxUSE_RICHTEXT
#include "wx/richtext/richtextbuffer.h"
#ifndef WX_PRECOMP
#include "wx/richtext/richtextbuffer.h"
#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+ #include "wx/intl.h"
#endif
#include "wx/filename.h"
#endif
#include "wx/filename.h"
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected)
{
wxArrayInt tab_array = GetAttributes().GetTabs();
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected)
{
wxArrayInt tab_array = GetAttributes().GetTabs();
dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount();
for( int i = 0; i < num_tabs; ++i){
dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount();
for( int i = 0; i < num_tabs; ++i){
- tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
+ tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
}
dc.SetMapMode(map_mode );
int next_tab_pos = -1;
}
dc.SetMapMode(map_mode );
int next_tab_pos = -1;
dc.SetTextForeground(GetAttributes().GetTextColour());
dc.SetBackgroundMode(wxTRANSPARENT);
}
dc.SetTextForeground(GetAttributes().GetTextColour());
dc.SetBackgroundMode(wxTRANSPARENT);
}
- while(str.Find(wxT('\t')) >= 0){// the string has a tab
+ while(str.Find(wxT('\t')) >= 0){// the string has a tab
// break up the string at the Tab
wxString stringChunk = str.BeforeFirst(wxT('\t'));
str = str.AfterFirst(wxT('\t'));
// break up the string at the Tab
wxString stringChunk = str.BeforeFirst(wxT('\t'));
str = str.AfterFirst(wxT('\t'));
if(selected){
w = next_tab_pos - x;
wxRect selRect(x, rect.y, w, rect.GetHeight());
if(selected){
w = next_tab_pos - x;
wxRect selRect(x, rect.y, w, rect.GetHeight());
- dc.DrawRectangle(selRect);
+ dc.DrawRectangle(selRect);
}
dc.DrawText(stringChunk, x, y);
x = next_tab_pos;
}
}
}
}
dc.DrawText(stringChunk, x, y);
x = next_tab_pos;
}
}
}
dc.GetTextExtent(str, & w, & h);
if(selected){
wxRect selRect(x, rect.y, w, rect.GetHeight());
dc.GetTextExtent(str, & w, & h);
if(selected){
wxRect selRect(x, rect.y, w, rect.GetHeight());
- dc.DrawRectangle(selRect);
+ dc.DrawRectangle(selRect);
}
dc.DrawText(str, x, y);
x += w;
}
dc.DrawText(str, x, y);
x += w;
wxString stringChunk = m_text.Mid(startPos, (size_t) len);
wxCoord w, h;
int width = 0;
wxString stringChunk = m_text.Mid(startPos, (size_t) len);
wxCoord w, h;
int width = 0;
- if(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
+ if(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
wxArrayInt tab_array = GetAttributes().GetTabs();
wxArrayInt tab_array = GetAttributes().GetTabs();
- if(tab_array.IsEmpty()){// create a default tab list at 10 mm each.
- for( int i = 0; i < 20; ++i){
+ if(tab_array.IsEmpty())
+ {
+ // create a default tab list at 10 mm each.
+ for( int i = 0; i < 20; ++i)
+ {
tab_array.Add(i*100);
}
}
int map_mode = dc.GetMapMode();
dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount();
tab_array.Add(i*100);
}
}
int map_mode = dc.GetMapMode();
dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount();
- for( int i = 0; i < num_tabs; ++i){
- tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
+ for( int i = 0; i < num_tabs; ++i)
+ {
+ tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
}
dc.SetMapMode(map_mode );
int next_tab_pos = -1;
}
dc.SetMapMode(map_mode );
int next_tab_pos = -1;
-
- while(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
+
+ while(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
// break up the string at the Tab
wxString stringFragment = stringChunk.BeforeFirst(wxT('\t'));
stringChunk = stringChunk.AfterFirst(wxT('\t'));
// break up the string at the Tab
wxString stringFragment = stringChunk.BeforeFirst(wxT('\t'));
stringChunk = stringChunk.AfterFirst(wxT('\t'));
for( int i = 0; i < num_tabs && not_found; ++i){
next_tab_pos = tab_array.Item(i);
if( next_tab_pos > absolute_width){
for( int i = 0; i < num_tabs && not_found; ++i){
next_tab_pos = tab_array.Item(i);
if( next_tab_pos > absolute_width){
width = next_tab_pos - position.x;
}
}
width = next_tab_pos - position.x;
}
}
dc.GetTextExtent(stringChunk, & w, & h, & descent);
width += w;
size = wxSize(width, dc.GetCharHeight());
dc.GetTextExtent(stringChunk, & w, & h, & descent);
width += w;
size = wxSize(width, dc.GetCharHeight());
wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr,
const wxRichTextAttr& attrDef,
const wxTextCtrlBase *text)
wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr,
const wxRichTextAttr& attrDef,
const wxTextCtrlBase *text)
wxColour colFg = attr.GetTextColour();
if ( !colFg.Ok() )
{
wxColour colFg = attr.GetTextColour();
if ( !colFg.Ok() )
{
if (attr.HasWeight())
newAttr.SetFontWeight(attr.GetFontWeight());
if (attr.HasWeight())
newAttr.SetFontWeight(attr.GetFontWeight());
if (attr.HasSize())
newAttr.SetFontSize(attr.GetFontSize());
if (attr.HasSize())
newAttr.SetFontSize(attr.GetFontSize());
if (attr.HasItalic())
newAttr.SetFontStyle(attr.GetFontStyle());
if (attr.HasItalic())
newAttr.SetFontStyle(attr.GetFontStyle());
if (attr.HasUnderlined())
newAttr.SetFontUnderlined(attr.GetFontUnderlined());
if (attr.HasUnderlined())
newAttr.SetFontUnderlined(attr.GetFontUnderlined());
if (attr.HasFaceName())
newAttr.SetFontFaceName(attr.GetFontFaceName());
if (attr.HasFaceName())
newAttr.SetFontFaceName(attr.GetFontFaceName());
if (attr.HasAlignment())
newAttr.SetAlignment(attr.GetAlignment());
else if (attrDef.HasAlignment())
if (attr.HasAlignment())
newAttr.SetAlignment(attr.GetAlignment());
else if (attrDef.HasAlignment())
newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent());
newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent());
if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol());
if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol());
wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr,
const wxTextAttrEx& attrDef,
const wxTextCtrlBase *text)
wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr,
const wxTextAttrEx& attrDef,
const wxTextCtrlBase *text)
wxTextAttrEx newAttr;
// If attr specifies the complete font, just use that font, overriding all
wxTextAttrEx newAttr;
// If attr specifies the complete font, just use that font, overriding all
newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent());
newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent());
if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol());
if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol());
#include "wx/richtext/richtextctrl.h"
#ifndef WX_PRECOMP
#include "wx/richtext/richtextctrl.h"
#ifndef WX_PRECOMP
+ #include "wx/menu.h"
+ #include "wx/intl.h"
+ #include "wx/stopwatch.h"
#endif
#include "wx/textfile.h"
#endif
#include "wx/textfile.h"
RecreateBuffer(size);
SetCursor(wxCursor(wxCURSOR_IBEAM));
RecreateBuffer(size);
SetCursor(wxCursor(wxCURSOR_IBEAM));
if (!value.IsEmpty())
SetValue(value);
if (!value.IsEmpty())
SetValue(value);
{
wxClientDC dc((wxRichTextCtrl*) this);
((wxRichTextCtrl*)this)->PrepareDC(dc);
{
wxClientDC dc((wxRichTextCtrl*) this);
((wxRichTextCtrl*)this)->PrepareDC(dc);
// Buffer uses logical position (relative to start of buffer)
// so convert
wxPoint pt2 = GetLogicalPoint(pt);
// Buffer uses logical position (relative to start of buffer)
// so convert
wxPoint pt2 = GetLogicalPoint(pt);
const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const
{
const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const
{
- return GetBuffer().GetDefaultStyle();
+ return GetBuffer().GetDefaultStyle();
}
bool wxRichTextCtrl::GetStyle(long position, wxTextAttr& style) const
}
bool wxRichTextCtrl::GetStyle(long position, wxTextAttr& style) const
#include "wx/richtext/richtexthtml.h"
#ifndef WX_PRECOMP
#include "wx/richtext/richtexthtml.h"
#ifndef WX_PRECOMP
#endif
#include "wx/filename.h"
#endif
#include "wx/filename.h"
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Name: richtextstyles.cpp
+// Name: src/richtext/richtextstyles.cpp
// Purpose: Style management for wxRichTextCtrl
// Author: Julian Smart
// Purpose: Style management for wxRichTextCtrl
// Author: Julian Smart
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/richtext/richtextstyles.h"
#ifndef WX_PRECOMP
#include "wx/richtext/richtextstyles.h"
#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
#endif
#include "wx/filename.h"
#endif
#include "wx/filename.h"
if (def->GetName().Lower() == name.Lower())
return def;
}
if (def->GetName().Lower() == name.Lower())
return def;
}
int size = 5;
// Standard size is 12, say
int size = 5;
// Standard size is 12, say
- size += 12 - def->GetStyle().GetFontSize();
+ size += 12 - def->GetStyle().GetFontSize();
if (def && GetRichTextCtrl())
{
wxRichTextRange range(m_richTextCtrl->GetInsertionPoint(), m_richTextCtrl->GetInsertionPoint());
if (def && GetRichTextCtrl())
{
wxRichTextRange range(m_richTextCtrl->GetInsertionPoint(), m_richTextCtrl->GetInsertionPoint());
// Flags are defined within each definition, so only certain
// attributes are applied.
wxRichTextAttr attr(def->GetStyle());
// Flags are defined within each definition, so only certain
// attributes are applied.
wxRichTextAttr attr(def->GetStyle());
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#endif
#if wxUSE_RICHTEXT && wxUSE_XML
#endif
#if wxUSE_RICHTEXT && wxUSE_XML
#include "wx/richtext/richtextxml.h"
#ifndef WX_PRECOMP
#include "wx/richtext/richtextxml.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#endif
#include "wx/intl.h"
#endif