#include "wx/intl.h"
#include "wx/log.h"
#include "wx/dataobj.h"
+ #include "wx/module.h"
#endif
#include "wx/filename.h"
#include "wx/clipbrd.h"
#include "wx/wfstream.h"
-#include "wx/module.h"
#include "wx/mstream.h"
#include "wx/sstream.h"
}
/// Get the text attributes for this position.
-bool wxRichTextParagraphLayoutBox::GetStyle(long position, wxTextAttrEx& style) const
+bool wxRichTextParagraphLayoutBox::GetStyle(long position, wxTextAttrEx& style)
{
wxRichTextObject* obj wxDUMMY_INITIALIZE(NULL);
}
/// Get the text attributes for this position.
-bool wxRichTextParagraphLayoutBox::GetStyle(long position, wxRichTextAttr& style) const
+bool wxRichTextParagraphLayoutBox::GetStyle(long position, wxRichTextAttr& style)
{
wxRichTextObject* obj wxDUMMY_INITIALIZE(NULL);
// (a) All selected.
if (selectionRange.GetStart() <= range.GetStart() && selectionRange.GetEnd() >= range.GetEnd())
- {/*
- // Draw all selected
- dc.SetBrush(*wxBLACK_BRUSH);
- dc.SetPen(*wxBLACK_PEN);
- wxCoord w, h;
- dc.GetTextExtent(stringChunk, & w, & h);
- wxRect selRect(x, rect.y, w, rect.GetHeight());
- dc.DrawRectangle(selRect);
- dc.SetTextForeground(*wxWHITE);
- dc.SetBackgroundMode(wxTRANSPARENT);
- dc.DrawText(stringChunk, x, y);*/
+ {
DrawTabbedString(dc, rect,stringChunk, x, y, true);
}
// (b) None selected.
else if (selectionRange.GetEnd() < range.GetStart() || selectionRange.GetStart() > range.GetEnd())
{
// Draw all unselected
- /*
- dc.SetTextForeground(GetAttributes().GetTextColour());
- dc.SetBackgroundMode(wxTRANSPARENT);
- dc.DrawText(stringChunk, x, y);*/
DrawTabbedString(dc, rect,stringChunk, x, y, false);
}
else
if (fragmentLen < 0)
wxLogDebug(wxT("Mid(%d, %d"), (int)(r1 - offset), (int)fragmentLen);
wxString stringFragment = m_text.Mid(r1 - offset, fragmentLen);
-/*
- dc.SetTextForeground(GetAttributes().GetTextColour());
- dc.DrawText(stringFragment, x, y);
- wxCoord w, h;
- dc.GetTextExtent(stringFragment, & w, & h);
- x += w;*/
DrawTabbedString(dc, rect,stringFragment, x, y, false);
}
if (fragmentLen < 0)
wxLogDebug(wxT("Mid(%d, %d"), (int)(s1 - offset), (int)fragmentLen);
wxString stringFragment = m_text.Mid(s1 - offset, fragmentLen);
-/*
- wxCoord w, h;
- dc.GetTextExtent(stringFragment, & w, & h);
- wxRect selRect(x, rect.y, w, rect.GetHeight());
-
- dc.SetBrush(*wxBLACK_BRUSH);
- dc.SetPen(*wxBLACK_PEN);
- dc.DrawRectangle(selRect);
- dc.SetTextForeground(*wxWHITE);
- dc.DrawText(stringFragment, x, y);
- x += w;*/
DrawTabbedString(dc, rect,stringFragment, x, y, true);
}
if (fragmentLen < 0)
wxLogDebug(wxT("Mid(%d, %d"), (int)(s2 - offset), (int)fragmentLen);
wxString stringFragment = m_text.Mid(s2 - offset, fragmentLen);
-/*
- dc.SetTextForeground(GetAttributes().GetTextColour());
- dc.DrawText(stringFragment, x, y);*/
+
DrawTabbedString(dc, rect,stringFragment, x, y, false);
}
}
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected)
{
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();
- for( int i = 0; i < num_tabs; ++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;
int tab_pos = -1;
wxCoord w, h;
- if(selected){
+
+ if(selected)
+ {
dc.SetBrush(*wxBLACK_BRUSH);
dc.SetPen(*wxBLACK_PEN);
dc.SetTextForeground(*wxWHITE);
dc.SetBackgroundMode(wxTRANSPARENT);
}
- else{
+ else
+ {
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'));
dc.GetTextExtent(stringChunk, & w, & h);
tab_pos = x + w;
bool not_found = true;
- 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);
- if( next_tab_pos > tab_pos){
+ if (next_tab_pos > tab_pos)
+ {
not_found = false;
- if(selected){
+ if (selected)
+ {
w = next_tab_pos - x;
wxRect selRect(x, rect.y, w, rect.GetHeight());
dc.DrawRectangle(selRect);
}
dc.GetTextExtent(str, & w, & h);
- if(selected){
+ if (selected)
+ {
wxRect selRect(x, rect.y, w, rect.GetHeight());
dc.DrawRectangle(selRect);
}
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();
- if(tab_array.IsEmpty())
+ if (tab_array.IsEmpty())
{
// create a default tab list at 10 mm each.
- for( int i = 0; i < 20; ++i)
+ 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();
- for( int i = 0; i < num_tabs; ++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;
- 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'));
width += w;
int absolute_width = width + position.x;
bool not_found = true;
- 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);
- if( next_tab_pos > absolute_width){
+ if (next_tab_pos > absolute_width)
+ {
not_found = false;
width = next_tab_pos - position.x;
}