Simplify PCH support. Minor source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-07-25 08:39:57 +00:00
parent 2cdcee612a
commit 613992479a
5 changed files with 60 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: richtext/richtextbuffer.cpp // Name: src/richtext/richtextbuffer.cpp
// Purpose: Buffer for wxRichTextCtrl // Purpose: Buffer for wxRichTextCtrl
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -13,7 +13,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_RICHTEXT #if wxUSE_RICHTEXT
@@ -21,7 +21,8 @@
#include "wx/richtext/richtextbuffer.h" #include "wx/richtext/richtextbuffer.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/dc.h"
#include "wx/intl.h"
#endif #endif
#include "wx/filename.h" #include "wx/filename.h"
@@ -3046,7 +3047,7 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
return true; return true;
} }
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected) bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected)
{ {
wxArrayInt tab_array = GetAttributes().GetTabs(); wxArrayInt tab_array = GetAttributes().GetTabs();
@@ -3059,7 +3060,7 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString&
dc.SetMapMode(wxMM_LOMETRIC ); dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount(); int num_tabs = tab_array.GetCount();
for( int i = 0; i < num_tabs; ++i){ 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 ); dc.SetMapMode(map_mode );
int next_tab_pos = -1; int next_tab_pos = -1;
@@ -3075,7 +3076,7 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString&
dc.SetTextForeground(GetAttributes().GetTextColour()); dc.SetTextForeground(GetAttributes().GetTextColour());
dc.SetBackgroundMode(wxTRANSPARENT); 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 // break up the string at the Tab
wxString stringChunk = str.BeforeFirst(wxT('\t')); wxString stringChunk = str.BeforeFirst(wxT('\t'));
str = str.AfterFirst(wxT('\t')); str = str.AfterFirst(wxT('\t'));
@@ -3089,18 +3090,18 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString&
if(selected){ if(selected){
w = next_tab_pos - x; w = next_tab_pos - x;
wxRect selRect(x, rect.y, w, rect.GetHeight()); wxRect selRect(x, rect.y, w, rect.GetHeight());
dc.DrawRectangle(selRect); dc.DrawRectangle(selRect);
} }
dc.DrawText(stringChunk, x, y); dc.DrawText(stringChunk, x, y);
x = next_tab_pos; x = next_tab_pos;
} }
} }
} }
dc.GetTextExtent(str, & w, & h); dc.GetTextExtent(str, & w, & h);
if(selected){ if(selected){
wxRect selRect(x, rect.y, w, rect.GetHeight()); wxRect selRect(x, rect.y, w, rect.GetHeight());
dc.DrawRectangle(selRect); dc.DrawRectangle(selRect);
} }
dc.DrawText(str, x, y); dc.DrawText(str, x, y);
x += w; x += w;
@@ -3147,23 +3148,27 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
wxString stringChunk = m_text.Mid(startPos, (size_t) len); wxString stringChunk = m_text.Mid(startPos, (size_t) len);
wxCoord w, h; wxCoord w, h;
int width = 0; 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. if(tab_array.IsEmpty())
for( int i = 0; i < 20; ++i){ {
// create a default tab list at 10 mm each.
for( int i = 0; i < 20; ++i)
{
tab_array.Add(i*100); tab_array.Add(i*100);
} }
} }
int map_mode = dc.GetMapMode(); int map_mode = dc.GetMapMode();
dc.SetMapMode(wxMM_LOMETRIC ); dc.SetMapMode(wxMM_LOMETRIC );
int num_tabs = tab_array.GetCount(); int num_tabs = tab_array.GetCount();
for( int i = 0; i < num_tabs; ++i){ 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 ); dc.SetMapMode(map_mode );
int next_tab_pos = -1; 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 // break up the string at the Tab
wxString stringFragment = stringChunk.BeforeFirst(wxT('\t')); wxString stringFragment = stringChunk.BeforeFirst(wxT('\t'));
stringChunk = stringChunk.AfterFirst(wxT('\t')); stringChunk = stringChunk.AfterFirst(wxT('\t'));
@@ -3174,7 +3179,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
for( int i = 0; i < num_tabs && not_found; ++i){ for( int i = 0; i < num_tabs && not_found; ++i){
next_tab_pos = tab_array.Item(i); next_tab_pos = tab_array.Item(i);
if( next_tab_pos > absolute_width){ if( next_tab_pos > absolute_width){
not_found = false; not_found = false;
width = next_tab_pos - position.x; width = next_tab_pos - position.x;
} }
} }
@@ -3183,7 +3188,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
dc.GetTextExtent(stringChunk, & w, & h, & descent); dc.GetTextExtent(stringChunk, & w, & h, & descent);
width += w; width += w;
size = wxSize(width, dc.GetCharHeight()); size = wxSize(width, dc.GetCharHeight());
return true; return true;
} }
@@ -4922,7 +4927,7 @@ bool wxRichTextAttr::GetFontAttributes(const wxFont& font)
wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr, wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr,
const wxRichTextAttr& attrDef, const wxRichTextAttr& attrDef,
const wxTextCtrlBase *text) const wxTextCtrlBase *text)
{ {
wxColour colFg = attr.GetTextColour(); wxColour colFg = attr.GetTextColour();
if ( !colFg.Ok() ) if ( !colFg.Ok() )
{ {
@@ -4945,19 +4950,19 @@ wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr,
if (attr.HasWeight()) if (attr.HasWeight())
newAttr.SetFontWeight(attr.GetFontWeight()); newAttr.SetFontWeight(attr.GetFontWeight());
if (attr.HasSize()) if (attr.HasSize())
newAttr.SetFontSize(attr.GetFontSize()); newAttr.SetFontSize(attr.GetFontSize());
if (attr.HasItalic()) if (attr.HasItalic())
newAttr.SetFontStyle(attr.GetFontStyle()); newAttr.SetFontStyle(attr.GetFontStyle());
if (attr.HasUnderlined()) if (attr.HasUnderlined())
newAttr.SetFontUnderlined(attr.GetFontUnderlined()); newAttr.SetFontUnderlined(attr.GetFontUnderlined());
if (attr.HasFaceName()) if (attr.HasFaceName())
newAttr.SetFontFaceName(attr.GetFontFaceName()); newAttr.SetFontFaceName(attr.GetFontFaceName());
if (attr.HasAlignment()) if (attr.HasAlignment())
newAttr.SetAlignment(attr.GetAlignment()); newAttr.SetAlignment(attr.GetAlignment());
else if (attrDef.HasAlignment()) else if (attrDef.HasAlignment())
@@ -4977,33 +4982,33 @@ wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr,
newAttr.SetRightIndent(attr.GetRightIndent()); newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent()) else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent()); newAttr.SetRightIndent(attrDef.GetRightIndent());
// NEW ATTRIBUTES // NEW ATTRIBUTES
if (attr.HasParagraphSpacingAfter()) if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter()); newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingBefore()) if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore()); newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing()) if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing()); newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasCharacterStyleName()) if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName()); newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasParagraphStyleName()) if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName()); newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasBulletStyle()) if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle()); newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber()) if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber()); newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletSymbol()) if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol()); newAttr.SetBulletSymbol(attr.GetBulletSymbol());
return newAttr; return newAttr;
} }
@@ -5059,7 +5064,7 @@ void wxTextAttrEx::operator= (const wxTextAttr& attr)
wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr, wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr,
const wxTextAttrEx& attrDef, const wxTextAttrEx& attrDef,
const wxTextCtrlBase *text) const wxTextCtrlBase *text)
{ {
wxTextAttrEx newAttr; wxTextAttrEx newAttr;
// If attr specifies the complete font, just use that font, overriding all // If attr specifies the complete font, just use that font, overriding all
@@ -5165,33 +5170,33 @@ wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr,
newAttr.SetRightIndent(attr.GetRightIndent()); newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent()) else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent()); newAttr.SetRightIndent(attrDef.GetRightIndent());
// NEW ATTRIBUTES // NEW ATTRIBUTES
if (attr.HasParagraphSpacingAfter()) if (attr.HasParagraphSpacingAfter())
newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter()); newAttr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter());
if (attr.HasParagraphSpacingBefore()) if (attr.HasParagraphSpacingBefore())
newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore()); newAttr.SetParagraphSpacingBefore(attr.GetParagraphSpacingBefore());
if (attr.HasLineSpacing()) if (attr.HasLineSpacing())
newAttr.SetLineSpacing(attr.GetLineSpacing()); newAttr.SetLineSpacing(attr.GetLineSpacing());
if (attr.HasCharacterStyleName()) if (attr.HasCharacterStyleName())
newAttr.SetCharacterStyleName(attr.GetCharacterStyleName()); newAttr.SetCharacterStyleName(attr.GetCharacterStyleName());
if (attr.HasParagraphStyleName()) if (attr.HasParagraphStyleName())
newAttr.SetParagraphStyleName(attr.GetParagraphStyleName()); newAttr.SetParagraphStyleName(attr.GetParagraphStyleName());
if (attr.HasBulletStyle()) if (attr.HasBulletStyle())
newAttr.SetBulletStyle(attr.GetBulletStyle()); newAttr.SetBulletStyle(attr.GetBulletStyle());
if (attr.HasBulletNumber()) if (attr.HasBulletNumber())
newAttr.SetBulletNumber(attr.GetBulletNumber()); newAttr.SetBulletNumber(attr.GetBulletNumber());
if (attr.HasBulletSymbol()) if (attr.HasBulletSymbol())
newAttr.SetBulletSymbol(attr.GetBulletSymbol()); newAttr.SetBulletSymbol(attr.GetBulletSymbol());
return newAttr; return newAttr;
} }

View File

@@ -21,8 +21,10 @@
#include "wx/richtext/richtextctrl.h" #include "wx/richtext/richtextctrl.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/menu.h"
#include "wx/intl.h"
#include "wx/stopwatch.h"
#endif #endif
#include "wx/textfile.h" #include "wx/textfile.h"
@@ -155,7 +157,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
RecreateBuffer(size); RecreateBuffer(size);
SetCursor(wxCursor(wxCURSOR_IBEAM)); SetCursor(wxCursor(wxCURSOR_IBEAM));
if (!value.IsEmpty()) if (!value.IsEmpty())
SetValue(value); SetValue(value);
@@ -1645,7 +1647,7 @@ wxRichTextCtrl::HitTest(const wxPoint& pt,
{ {
wxClientDC dc((wxRichTextCtrl*) this); wxClientDC dc((wxRichTextCtrl*) this);
((wxRichTextCtrl*)this)->PrepareDC(dc); ((wxRichTextCtrl*)this)->PrepareDC(dc);
// Buffer uses logical position (relative to start of buffer) // Buffer uses logical position (relative to start of buffer)
// so convert // so convert
wxPoint pt2 = GetLogicalPoint(pt); wxPoint pt2 = GetLogicalPoint(pt);
@@ -2222,7 +2224,7 @@ const wxTextAttrEx& wxRichTextCtrl::GetDefaultStyleEx() const
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

View File

@@ -21,7 +21,6 @@
#include "wx/richtext/richtexthtml.h" #include "wx/richtext/richtexthtml.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h"
#endif #endif
#include "wx/filename.h" #include "wx/filename.h"

View File

@@ -1,10 +1,10 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: richtextstyles.cpp // Name: src/richtext/richtextstyles.cpp
// Purpose: Style management for wxRichTextCtrl // Purpose: Style management for wxRichTextCtrl
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// Created: 2005-09-30 // Created: 2005-09-30
// RCS-ID: // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,7 +21,7 @@
#include "wx/richtext/richtextstyles.h" #include "wx/richtext/richtextstyles.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/dcclient.h"
#endif #endif
#include "wx/filename.h" #include "wx/filename.h"
@@ -79,7 +79,7 @@ wxRichTextStyleDefinition* wxRichTextStyleSheet::FindStyle(const wxList& list, c
if (def->GetName().Lower() == name.Lower()) if (def->GetName().Lower() == name.Lower())
return def; return def;
} }
return NULL; return NULL;
} }
/// Delete all styles /// Delete all styles
@@ -193,7 +193,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons
int size = 5; int size = 5;
// Standard size is 12, say // Standard size is 12, say
size += 12 - def->GetStyle().GetFontSize(); size += 12 - def->GetStyle().GetFontSize();
str += wxT("<font"); str += wxT("<font");
@@ -276,7 +276,7 @@ void wxRichTextStyleListBox::OnLeftDown(wxMouseEvent& event)
if (def && GetRichTextCtrl()) if (def && GetRichTextCtrl())
{ {
wxRichTextRange range(m_richTextCtrl->GetInsertionPoint(), m_richTextCtrl->GetInsertionPoint()); wxRichTextRange range(m_richTextCtrl->GetInsertionPoint(), m_richTextCtrl->GetInsertionPoint());
// Flags are defined within each definition, so only certain // Flags are defined within each definition, so only certain
// attributes are applied. // attributes are applied.
wxRichTextAttr attr(def->GetStyle()); wxRichTextAttr attr(def->GetStyle());
@@ -308,4 +308,3 @@ wxColour wxRichTextStyleListBox::GetSelectedTextBgColour(const wxColour& colBg)
#endif #endif
// wxUSE_RICHTEXT // wxUSE_RICHTEXT

View File

@@ -13,7 +13,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_RICHTEXT && wxUSE_XML #if wxUSE_RICHTEXT && wxUSE_XML
@@ -21,7 +21,6 @@
#include "wx/richtext/richtextxml.h" #include "wx/richtext/richtextxml.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/intl.h" #include "wx/intl.h"
#endif #endif