Corrected loading of images: we need the parent size to compute initial object size
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2252,7 +2252,7 @@ public:
|
|||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Do a split from @a pos, returning an object containing the second part, and setting
|
Do a split from @a pos, returning an object containing the second part, and setting
|
||||||
@@ -2793,7 +2793,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual void Dump(wxTextOutputStream& stream);
|
virtual void Dump(wxTextOutputStream& stream);
|
||||||
|
|
||||||
@@ -2910,7 +2910,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool DeleteRange(const wxRichTextRange& range);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -3598,7 +3598,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual wxString GetXMLNodeName() const { return wxT("field"); }
|
virtual wxString GetXMLNodeName() const { return wxT("field"); }
|
||||||
|
|
||||||
@@ -3696,7 +3696,7 @@ public:
|
|||||||
Returns the object size for the given range. Returns @false if the range
|
Returns the object size for the given range. Returns @false if the range
|
||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0;
|
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if we can edit the object's properties via a GUI.
|
Returns @true if we can edit the object's properties via a GUI.
|
||||||
@@ -3864,7 +3864,7 @@ public:
|
|||||||
Returns the object size for the given range. Returns @false if the range
|
Returns the object size for the given range. Returns @false if the range
|
||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the size of the field, given the label, font size, and so on.
|
Get the size of the field, given the label, font size, and so on.
|
||||||
@@ -4171,7 +4171,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
|
virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
|
||||||
|
|
||||||
@@ -4342,7 +4342,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
@@ -4616,6 +4616,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); }
|
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxRichTextImage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialisation.
|
Initialisation.
|
||||||
*/
|
*/
|
||||||
@@ -4627,7 +4632,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the 'natural' size for this object - the image size.
|
Returns the 'natural' size for this object - the image size.
|
||||||
@@ -4698,7 +4703,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Creates a cached image at the required size.
|
Creates a cached image at the required size.
|
||||||
*/
|
*/
|
||||||
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false);
|
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false, const wxSize& parentSize = wxDefaultSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the original image size.
|
Gets the original image size.
|
||||||
@@ -5601,7 +5606,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool DeleteRange(const wxRichTextRange& range);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
|
@@ -2127,7 +2127,7 @@ public:
|
|||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Do a split from @a pos, returning an object containing the second part, and setting
|
Do a split from @a pos, returning an object containing the second part, and setting
|
||||||
@@ -2667,7 +2667,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual void Dump(wxTextOutputStream& stream);
|
virtual void Dump(wxTextOutputStream& stream);
|
||||||
|
|
||||||
@@ -2784,7 +2784,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool DeleteRange(const wxRichTextRange& range);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -3473,7 +3473,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual wxString GetXMLNodeName() const { return wxT("field"); }
|
virtual wxString GetXMLNodeName() const { return wxT("field"); }
|
||||||
|
|
||||||
@@ -3569,7 +3569,7 @@ public:
|
|||||||
Returns the object size for the given range. Returns @false if the range
|
Returns the object size for the given range. Returns @false if the range
|
||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0;
|
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if we can edit the object's properties via a GUI.
|
Returns @true if we can edit the object's properties via a GUI.
|
||||||
@@ -3735,7 +3735,7 @@ public:
|
|||||||
Returns the object size for the given range. Returns @false if the range
|
Returns the object size for the given range. Returns @false if the range
|
||||||
is invalid for this object.
|
is invalid for this object.
|
||||||
*/
|
*/
|
||||||
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the size of the field, given the label, font size, and so on.
|
Get the size of the field, given the label, font size, and so on.
|
||||||
@@ -4042,7 +4042,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
|
virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
|
||||||
|
|
||||||
@@ -4213,7 +4213,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
@@ -4493,7 +4493,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the 'natural' size for this object - the image size.
|
Returns the 'natural' size for this object - the image size.
|
||||||
@@ -4574,7 +4574,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Creates a cached image at the required size.
|
Creates a cached image at the required size.
|
||||||
*/
|
*/
|
||||||
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false);
|
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false, const wxSize& parentSize = wxDefaultSize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRichTextImageBlock m_imageBlock;
|
wxRichTextImageBlock m_imageBlock;
|
||||||
@@ -5457,7 +5457,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
|
||||||
|
|
||||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
|
||||||
|
|
||||||
virtual bool DeleteRange(const wxRichTextRange& range);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
|
@@ -806,7 +806,7 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxTe
|
|||||||
if (attr.GetBottom().IsValid() && attr.GetBottom().GetStyle() != wxTEXT_BOX_ATTR_BORDER_NONE)
|
if (attr.GetBottom().IsValid() && attr.GetBottom().GetStyle() != wxTEXT_BOX_ATTR_BORDER_NONE)
|
||||||
{
|
{
|
||||||
borderBottom = converter.GetPixels(attr.GetBottom().GetWidth());
|
borderBottom = converter.GetPixels(attr.GetBottom().GetWidth());
|
||||||
wxColour col(attr.GetTop().GetColour());
|
wxColour col(attr.GetBottom().GetColour());
|
||||||
|
|
||||||
// If pen width is > 1, resorts to a solid rectangle.
|
// If pen width is > 1, resorts to a solid rectangle.
|
||||||
if (borderBottom == 1)
|
if (borderBottom == 1)
|
||||||
@@ -1533,7 +1533,7 @@ void wxRichTextCompositeObject::Dump(wxTextOutputStream& stream)
|
|||||||
|
|
||||||
/// Get/set the object size for the given range. Returns false if the range
|
/// Get/set the object size for the given range. Returns false if the range
|
||||||
/// is invalid for this object.
|
/// is invalid for this object.
|
||||||
bool wxRichTextCompositeObject::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextCompositeObject::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
if (!range.IsWithin(GetRange()))
|
if (!range.IsWithin(GetRange()))
|
||||||
return false;
|
return false;
|
||||||
@@ -1589,7 +1589,7 @@ bool wxRichTextCompositeObject::GetRangeSize(const wxRichTextRange& range, wxSiz
|
|||||||
sz.x += childSize.x;
|
sz.x += childSize.x;
|
||||||
descent = wxMax(descent, childDescent);
|
descent = wxMax(descent, childDescent);
|
||||||
}
|
}
|
||||||
else if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y), p))
|
else if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y), parentSize, p))
|
||||||
{
|
{
|
||||||
sz.y = wxMax(sz.y, childSize.y);
|
sz.y = wxMax(sz.y, childSize.y);
|
||||||
sz.x += childSize.x;
|
sz.x += childSize.x;
|
||||||
@@ -2183,7 +2183,7 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, wxRichTextDrawingContext& co
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get/set the size for the given range.
|
/// Get/set the size for the given range.
|
||||||
bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* WXUNUSED(partialExtents)) const
|
bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* WXUNUSED(partialExtents)) const
|
||||||
{
|
{
|
||||||
wxSize sz;
|
wxSize sz;
|
||||||
|
|
||||||
@@ -2242,7 +2242,7 @@ bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wx
|
|||||||
wxSize childSize;
|
wxSize childSize;
|
||||||
|
|
||||||
int childDescent = 0;
|
int childDescent = 0;
|
||||||
child->GetRangeSize(rangeToFind, childSize, childDescent, dc, context, flags, position);
|
child->GetRangeSize(rangeToFind, childSize, childDescent, dc, context, flags, position, parentSize);
|
||||||
|
|
||||||
descent = wxMax(childDescent, descent);
|
descent = wxMax(childDescent, descent);
|
||||||
|
|
||||||
@@ -4719,7 +4719,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
int paraDescent = 0;
|
int paraDescent = 0;
|
||||||
|
|
||||||
// This calculates the partial text extents
|
// This calculates the partial text extents
|
||||||
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, rect.GetPosition(), & partialExtents);
|
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, rect.GetPosition(), parentRect.GetSize(), & partialExtents);
|
||||||
#else
|
#else
|
||||||
node = m_children.GetFirst();
|
node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -4801,7 +4801,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
partialExtents.Clear();
|
partialExtents.Clear();
|
||||||
|
|
||||||
// Recalculate the partial text extents since the child object changed size
|
// Recalculate the partial text extents since the child object changed size
|
||||||
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, wxPoint(0,0), & partialExtents);
|
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, wxPoint(0,0), parentRect.GetSize(), & partialExtents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4818,10 +4818,10 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
{
|
{
|
||||||
#if wxRICHTEXT_USE_PARTIAL_TEXT_EXTENTS
|
#if wxRICHTEXT_USE_PARTIAL_TEXT_EXTENTS
|
||||||
// Get height only, then the width using the partial extents
|
// Get height only, then the width using the partial extents
|
||||||
GetRangeSize(wxRichTextRange(lastEndPos+1, lastPosToUse), childSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY);
|
GetRangeSize(wxRichTextRange(lastEndPos+1, lastPosToUse), childSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY, wxPoint(0,0), parentRect.GetSize());
|
||||||
childSize.x = wxRichTextGetRangeWidth(*this, wxRichTextRange(lastEndPos+1, lastPosToUse), partialExtents);
|
childSize.x = wxRichTextGetRangeWidth(*this, wxRichTextRange(lastEndPos+1, lastPosToUse), partialExtents);
|
||||||
#else
|
#else
|
||||||
GetRangeSize(wxRichTextRange(lastEndPos+1, lastPosToUse), childSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED, rect.GetPosition());
|
GetRangeSize(wxRichTextRange(lastEndPos+1, lastPosToUse), childSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED, rect.GetPosition(), parentRect.GetSize());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4890,7 +4890,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
// lays out the object again using the minimum size
|
// lays out the object again using the minimum size
|
||||||
child->Invalidate(wxRICHTEXT_ALL);
|
child->Invalidate(wxRICHTEXT_ALL);
|
||||||
child->LayoutToBestSize(dc, context, buffer,
|
child->LayoutToBestSize(dc, context, buffer,
|
||||||
attr, child->GetAttributes(), availableRect, parentRect, style);
|
attr, child->GetAttributes(), availableRect, parentRect.GetSize(), style);
|
||||||
childSize = child->GetCachedSize();
|
childSize = child->GetCachedSize();
|
||||||
childDescent = child->GetDescent();
|
childDescent = child->GetDescent();
|
||||||
|
|
||||||
@@ -4899,7 +4899,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
partialExtents.Clear();
|
partialExtents.Clear();
|
||||||
|
|
||||||
// Recalculate the partial text extents since the child object changed size
|
// Recalculate the partial text extents since the child object changed size
|
||||||
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, wxPoint(0,0), & partialExtents);
|
GetRangeSize(GetRange(), paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_CACHE_SIZE, wxPoint(0,0), parentRect.GetSize(), & partialExtents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go around the loop finding the available rect for the given floating objects
|
// Go around the loop finding the available rect for the given floating objects
|
||||||
@@ -4928,9 +4928,10 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
if ((lineBreakInThisObject && (childSize.x + currentWidth <= availableRect.width))
|
if ((lineBreakInThisObject && (childSize.x + currentWidth <= availableRect.width))
|
||||||
||
|
||
|
||||||
(childSize.x + currentWidth > availableRect.width)
|
(childSize.x + currentWidth > availableRect.width)
|
||||||
|
#if 0
|
||||||
||
|
||
|
||||||
((childSize.x + currentWidth <= availableRect.width) && !node->GetNext())
|
((childSize.x + currentWidth <= availableRect.width) && !node->GetNext())
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
long wrapPosition = 0;
|
long wrapPosition = 0;
|
||||||
@@ -4969,12 +4970,12 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
if (!child->IsEmpty())
|
if (!child->IsEmpty())
|
||||||
{
|
{
|
||||||
// Get height only, then the width using the partial extents
|
// Get height only, then the width using the partial extents
|
||||||
GetRangeSize(actualRange, actualSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY);
|
GetRangeSize(actualRange, actualSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY, wxPoint(0,0), parentRect.GetSize());
|
||||||
actualSize.x = wxRichTextGetRangeWidth(*this, actualRange, partialExtents);
|
actualSize.x = wxRichTextGetRangeWidth(*this, actualRange, partialExtents);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
GetRangeSize(actualRange, actualSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED);
|
GetRangeSize(actualRange, actualSize, childDescent, dc, context, wxRICHTEXT_UNFORMATTED, wxPoint(0,0), parentRect.GetSize());
|
||||||
|
|
||||||
currentWidth = actualSize.x;
|
currentWidth = actualSize.x;
|
||||||
|
|
||||||
@@ -5072,6 +5073,41 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
|
|
||||||
//wxASSERT(!(lastCompletedEndPos != -1 && lastCompletedEndPos < GetRange().GetEnd()-1));
|
//wxASSERT(!(lastCompletedEndPos != -1 && lastCompletedEndPos < GetRange().GetEnd()-1));
|
||||||
|
|
||||||
|
// Add the last line - it's the current pos -> last para pos
|
||||||
|
// Substract -1 because the last position is always the end-paragraph position.
|
||||||
|
if (lastCompletedEndPos <= GetRange().GetEnd()-1)
|
||||||
|
{
|
||||||
|
currentPosition.x = (lineCount == 0 ? startPositionFirstLine : startPositionSubsequentLines);
|
||||||
|
|
||||||
|
wxRichTextLine* line = AllocateLine(lineCount);
|
||||||
|
|
||||||
|
wxRichTextRange actualRange(lastCompletedEndPos+1, GetRange().GetEnd()-1);
|
||||||
|
|
||||||
|
// Set relative range so we won't have to change line ranges when paragraphs are moved
|
||||||
|
line->SetRange(wxRichTextRange(actualRange.GetStart() - GetRange().GetStart(), actualRange.GetEnd() - GetRange().GetStart()));
|
||||||
|
|
||||||
|
line->SetPosition(currentPosition);
|
||||||
|
|
||||||
|
if (lineHeight == 0 && buffer)
|
||||||
|
{
|
||||||
|
wxFont font(buffer->GetFontTable().FindFont(attr));
|
||||||
|
wxCheckSetFont(dc, font);
|
||||||
|
lineHeight = dc.GetCharHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxDescent == 0)
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
dc.GetTextExtent(wxT("X"), & w, &h, & maxDescent);
|
||||||
|
}
|
||||||
|
|
||||||
|
line->SetSize(wxSize(currentWidth, lineHeight));
|
||||||
|
line->SetDescent(maxDescent);
|
||||||
|
currentPosition.y += lineHeight;
|
||||||
|
currentPosition.y += lineSpacing;
|
||||||
|
lineCount ++;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove remaining unused line objects, if any
|
// Remove remaining unused line objects, if any
|
||||||
ClearUnusedLines(lineCount);
|
ClearUnusedLines(lineCount);
|
||||||
|
|
||||||
@@ -5290,7 +5326,7 @@ void wxRichTextParagraph::ClearLines()
|
|||||||
|
|
||||||
/// Get/set the object size for the given range. Returns false if the range
|
/// Get/set the object size for the given range. Returns false if the range
|
||||||
/// is invalid for this object.
|
/// is invalid for this object.
|
||||||
bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
if (!range.IsWithin(GetRange()))
|
if (!range.IsWithin(GetRange()))
|
||||||
return false;
|
return false;
|
||||||
@@ -5404,7 +5440,7 @@ bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
|||||||
partialExtents->Add(childSize.x + lastSize);
|
partialExtents->Add(childSize.x + lastSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y), p))
|
else if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y), parentSize, p))
|
||||||
{
|
{
|
||||||
if (childDescent == 0)
|
if (childDescent == 0)
|
||||||
{
|
{
|
||||||
@@ -5491,7 +5527,7 @@ bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
|||||||
|
|
||||||
wxSize childSize;
|
wxSize childSize;
|
||||||
int childDescent = 0;
|
int childDescent = 0;
|
||||||
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y)))
|
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, context, flags, wxPoint(position.x + sz.x, position.y), parentSize))
|
||||||
{
|
{
|
||||||
if (childDescent == 0)
|
if (childDescent == 0)
|
||||||
{
|
{
|
||||||
@@ -5697,7 +5733,7 @@ int wxRichTextParagraph::HitTest(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
int paraDescent;
|
int paraDescent;
|
||||||
|
|
||||||
// This calculates the partial text extents
|
// This calculates the partial text extents
|
||||||
GetRangeSize(lineRange, paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED, linePos, & partialExtents);
|
GetRangeSize(lineRange, paraSize, paraDescent, dc, context, wxRICHTEXT_UNFORMATTED, linePos, wxDefaultSize, & partialExtents);
|
||||||
|
|
||||||
int lastX = linePos.x;
|
int lastX = linePos.x;
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -6720,7 +6756,7 @@ void wxRichTextPlainText::Copy(const wxRichTextPlainText& obj)
|
|||||||
|
|
||||||
/// Get/set the object size for the given range. Returns false if the range
|
/// Get/set the object size for the given range. Returns false if the range
|
||||||
/// is invalid for this object.
|
/// is invalid for this object.
|
||||||
bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int WXUNUSED(flags), wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int WXUNUSED(flags), const wxPoint& position, const wxSize& WXUNUSED(parentSize), wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
if (!range.IsWithin(GetRange()))
|
if (!range.IsWithin(GetRange()))
|
||||||
return false;
|
return false;
|
||||||
@@ -8854,13 +8890,13 @@ bool wxRichTextField::Layout(wxDC& dc, wxRichTextDrawingContext& context, const
|
|||||||
return wxRichTextParagraphLayoutBox::Layout(dc, context, rect, parentRect, style);
|
return wxRichTextParagraphLayoutBox::Layout(dc, context, rect, parentRect, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRichTextField::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextField::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType());
|
wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType());
|
||||||
if (fieldType)
|
if (fieldType)
|
||||||
return fieldType->GetRangeSize((wxRichTextField*) this, range, size, descent, dc, context, flags, position, partialExtents);
|
return fieldType->GetRangeSize((wxRichTextField*) this, range, size, descent, dc, context, flags, position, parentSize, partialExtents);
|
||||||
|
|
||||||
return wxRichTextParagraphLayoutBox::GetRangeSize(range, size, descent, dc, context, flags, position, partialExtents);
|
return wxRichTextParagraphLayoutBox::GetRangeSize(range, size, descent, dc, context, flags, position, parentSize, partialExtents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculate range
|
/// Calculate range
|
||||||
@@ -9096,10 +9132,10 @@ bool wxRichTextFieldTypeStandard::Layout(wxRichTextField* obj, wxDC& dc, wxRichT
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRichTextFieldTypeStandard::GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextFieldTypeStandard::GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
if (IsTopLevel(obj))
|
if (IsTopLevel(obj))
|
||||||
return obj->wxRichTextParagraphLayoutBox::GetRangeSize(range, size, descent, dc, context, flags, position);
|
return obj->wxRichTextParagraphLayoutBox::GetRangeSize(range, size, descent, dc, context, flags, position, parentSize);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxSize sz = GetSize(obj, dc, context, 0);
|
wxSize sz = GetSize(obj, dc, context, 0);
|
||||||
@@ -9987,9 +10023,9 @@ void wxRichTextTable::CalculateRange(long start, long& end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets the range size.
|
// Gets the range size.
|
||||||
bool wxRichTextTable::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position, wxArrayInt* partialExtents) const
|
bool wxRichTextTable::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position, const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
return wxRichTextBox::GetRangeSize(range, size, descent, dc, context, flags, position, partialExtents);
|
return wxRichTextBox::GetRangeSize(range, size, descent, dc, context, flags, position, parentSize, partialExtents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes content in the given range.
|
// Deletes content in the given range.
|
||||||
@@ -11052,13 +11088,17 @@ wxRichTextImage::wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichT
|
|||||||
SetAttributes(*charStyle);
|
SetAttributes(*charStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRichTextImage::~wxRichTextImage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void wxRichTextImage::Init()
|
void wxRichTextImage::Init()
|
||||||
{
|
{
|
||||||
m_originalImageSize = wxSize(-1, -1);
|
m_originalImageSize = wxSize(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a cached image at the required size
|
/// Create a cached image at the required size
|
||||||
bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache)
|
bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache, const wxSize& parentSize)
|
||||||
{
|
{
|
||||||
if (!m_imageBlock.IsOk())
|
if (!m_imageBlock.IsOk())
|
||||||
return false;
|
return false;
|
||||||
@@ -11088,33 +11128,36 @@ bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache)
|
|||||||
int maxWidth = -1;
|
int maxWidth = -1;
|
||||||
int maxHeight = -1;
|
int maxHeight = -1;
|
||||||
|
|
||||||
wxRichTextBuffer* buffer = GetBuffer();
|
wxSize sz = parentSize;
|
||||||
if (buffer)
|
if (sz == wxDefaultSize)
|
||||||
{
|
{
|
||||||
wxSize sz;
|
if (GetParent() && GetParent()->GetParent())
|
||||||
if (buffer->GetRichTextCtrl())
|
sz = GetParent()->GetParent()->GetCachedSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sz != wxDefaultSize)
|
||||||
|
{
|
||||||
|
wxRichTextBuffer* buffer = GetBuffer();
|
||||||
|
if (buffer)
|
||||||
{
|
{
|
||||||
// Subtract borders
|
// Find the actual space available when margin is taken into account
|
||||||
sz = buffer->GetRichTextCtrl()->GetClientSize();
|
|
||||||
|
|
||||||
// Use a minimum size to stop images becoming very small
|
|
||||||
sz.x = wxMax(sz.x, 100);
|
|
||||||
sz.y = wxMax(sz.y, 100);
|
|
||||||
|
|
||||||
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
|
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
|
||||||
marginRect = wxRect(0, 0, sz.x, sz.y);
|
marginRect = wxRect(0, 0, sz.x, sz.y);
|
||||||
buffer->GetBoxRects(dc, buffer, buffer->GetAttributes(), marginRect, borderRect, contentRect, paddingRect, outlineRect);
|
if (GetParent() && GetParent()->GetParent())
|
||||||
|
{
|
||||||
|
buffer->GetBoxRects(dc, buffer, GetParent()->GetParent()->GetAttributes(), marginRect, borderRect, contentRect, paddingRect, outlineRect);
|
||||||
|
sz = contentRect.GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
sz = contentRect.GetSize();
|
// Use a minimum size to stop images becoming very small
|
||||||
|
parentWidth = wxMax(100, sz.GetWidth());
|
||||||
|
parentHeight = wxMax(100, sz.GetHeight());
|
||||||
|
|
||||||
// Start with a maximum width of the control size, even if not specified by the content,
|
if (buffer->GetRichTextCtrl())
|
||||||
// to minimize the amount of picture overlapping the right-hand side
|
// Start with a maximum width of the control size, even if not specified by the content,
|
||||||
maxWidth = sz.x;
|
// to minimize the amount of picture overlapping the right-hand side
|
||||||
|
maxWidth = parentWidth;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
sz = buffer->GetCachedSize();
|
|
||||||
parentWidth = sz.GetWidth();
|
|
||||||
parentHeight = sz.GetHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetAttributes().GetTextBoxAttr().GetWidth().IsValid() && GetAttributes().GetTextBoxAttr().GetWidth().GetValue() > 0)
|
if (GetAttributes().GetTextBoxAttr().GetWidth().IsValid() && GetAttributes().GetTextBoxAttr().GetWidth().GetValue() > 0)
|
||||||
@@ -11290,12 +11333,12 @@ bool wxRichTextImage::Layout(wxDC& dc, wxRichTextDrawingContext& context, const
|
|||||||
|
|
||||||
/// Get/set the object size for the given range. Returns false if the range
|
/// Get/set the object size for the given range. Returns false if the range
|
||||||
/// is invalid for this object.
|
/// is invalid for this object.
|
||||||
bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& WXUNUSED(descent), wxDC& dc, wxRichTextDrawingContext& context, int WXUNUSED(flags), wxPoint WXUNUSED(position), wxArrayInt* partialExtents) const
|
bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& WXUNUSED(descent), wxDC& dc, wxRichTextDrawingContext& context, int WXUNUSED(flags), const wxPoint& WXUNUSED(position), const wxSize& parentSize, wxArrayInt* partialExtents) const
|
||||||
{
|
{
|
||||||
if (!range.IsWithin(GetRange()))
|
if (!range.IsWithin(GetRange()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!((wxRichTextImage*)this)->LoadImageCache(dc))
|
if (!((wxRichTextImage*)this)->LoadImageCache(dc, false, parentSize))
|
||||||
{
|
{
|
||||||
size.x = 0; size.y = 0;
|
size.x = 0; size.y = 0;
|
||||||
if (partialExtents)
|
if (partialExtents)
|
||||||
|
@@ -438,9 +438,6 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
dc.SetFont(GetFont());
|
dc.SetFont(GetFont());
|
||||||
|
|
||||||
// Paint the background
|
|
||||||
PaintBackground(dc);
|
|
||||||
|
|
||||||
wxRect drawingArea(GetUpdateRegion().GetBox());
|
wxRect drawingArea(GetUpdateRegion().GetBox());
|
||||||
drawingArea.SetPosition(GetUnscaledPoint(GetLogicalPoint(drawingArea.GetPosition())));
|
drawingArea.SetPosition(GetUnscaledPoint(GetLogicalPoint(drawingArea.GetPosition())));
|
||||||
drawingArea.SetSize(GetUnscaledSize(drawingArea.GetSize()));
|
drawingArea.SetSize(GetUnscaledSize(drawingArea.GetSize()));
|
||||||
@@ -459,6 +456,9 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
SetupScrollbars();
|
SetupScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paint the background
|
||||||
|
PaintBackground(dc);
|
||||||
|
|
||||||
wxRect clipRect(availableSpace);
|
wxRect clipRect(availableSpace);
|
||||||
clipRect.x += GetBuffer().GetLeftMargin();
|
clipRect.x += GetBuffer().GetLeftMargin();
|
||||||
clipRect.y += GetBuffer().GetTopMargin();
|
clipRect.y += GetBuffer().GetTopMargin();
|
||||||
@@ -3262,7 +3262,7 @@ void wxRichTextCtrl::Replace(long from, long to,
|
|||||||
|
|
||||||
SetSelection(from, to);
|
SetSelection(from, to);
|
||||||
|
|
||||||
wxRichTextAttr attr = GetDefaultStyle();
|
wxRichTextAttr attr(GetDefaultStyle());
|
||||||
|
|
||||||
DeleteSelectedContent();
|
DeleteSelectedContent();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user