X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e77fd8bca165aab9709649d79a7cbc6a172d4e1..c37b0f0907b07878551a00165b0ad323bd2ccdaf:/src/richtext/richtextbuffer.cpp?ds=sidebyside diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index b15c5c5f49..cc52bc9a10 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -8317,6 +8316,7 @@ wxString wxRichTextBuffer::GetExtWildcard(bool combine, bool save, wxArrayInt* t return wildcard; } +#if wxUSE_FFILE && wxUSE_STREAMS /// Load a file bool wxRichTextBuffer::LoadFile(const wxString& filename, wxRichTextFileType type) { @@ -8345,7 +8345,9 @@ bool wxRichTextBuffer::SaveFile(const wxString& filename, wxRichTextFileType typ else return false; } +#endif // wxUSE_FFILE && wxUSE_STREAMS +#if wxUSE_STREAMS /// Load from a stream bool wxRichTextBuffer::LoadFile(wxInputStream& stream, wxRichTextFileType type) { @@ -8374,6 +8376,7 @@ bool wxRichTextBuffer::SaveFile(wxOutputStream& stream, wxRichTextFileType type) else return false; } +#endif // wxUSE_STREAMS /// Copy the range to the clipboard bool wxRichTextBuffer::CopyToClipboard(const wxRichTextRange& range) @@ -9397,7 +9400,8 @@ void ExpandCellsWithRowspan(const wxRichTextTable* table, int paddingY, int& bot const int colCount = table->GetColumnCount(); wxArrayInt rowTops; rowTops.Add(0, rowCount+1); - for (int row = 0; row < rowCount; ++row) + int row; + for (row = 0; row < rowCount; ++row) { for (int column = 0; column < colCount; ++column) { @@ -9413,10 +9417,9 @@ void ExpandCellsWithRowspan(const wxRichTextTable* table, int paddingY, int& bot bool needsRelay = false; - int row, col; for (row = 0; row < rowCount-1; ++row) // -1 as the bottom row can't rowspan { - for (col = 0; col < colCount; ++col) + for (int col = 0; col < colCount; ++col) { wxRichTextCell* cell = table->GetCell(row, col); if (cell && cell->IsShown()) @@ -9473,7 +9476,7 @@ void ExpandCellsWithRowspan(const wxRichTextTable* table, int paddingY, int& bot // There were overflowing rowspanning cells, so layout yet again to make the increased row depths show for (row = 0; row < rowCount; ++row) { - for (col = 0; col < colCount; ++col) + for (int col = 0; col < colCount; ++col) { wxRichTextCell* cell = table->GetCell(row, col); if (cell && cell->IsShown()) @@ -9517,12 +9520,13 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextAttr attr(GetAttributes()); context.ApplyVirtualAttributes(attr, this); + bool tableHasPercentWidth = (attr.GetTextBoxAttr().GetWidth().GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE); // If we have no fixed table size, and assuming we're not pushed for // space, then we don't have to try to stretch the table to fit the contents. - bool stretchToFitTableWidth = false; - + bool stretchToFitTableWidth = tableHasPercentWidth; + int tableWidth = rect.width; - if (attr.GetTextBoxAttr().GetWidth().IsValid()) + if (attr.GetTextBoxAttr().GetWidth().IsValid() && !tableHasPercentWidth) { tableWidth = converter.GetPixels(attr.GetTextBoxAttr().GetWidth());