From 63803dd8d9f1c64d0d54babde2197acc9976bce9 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Fri, 5 Feb 2016 21:49:08 +0100 Subject: [PATCH] Fix MSVS 2015 warnings about hiding variables in wxRichText code These warnings were apparently harmless, but really annoying, so get rid of them by renaming the variables instead of reusing the same name in the nested scope. Closes #17351. --- src/richtext/richtextbuffer.cpp | 114 ++++++++++++++--------------- src/richtext/richtextctrl.cpp | 18 ++--- src/richtext/richtextformatdlg.cpp | 44 +++++------ src/richtext/richtextstyles.cpp | 8 +- src/richtext/richtextxml.cpp | 14 ++-- 5 files changed, 95 insertions(+), 103 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 4c2e702f07..af6b6a5283 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -737,8 +737,8 @@ bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, con dc.SetBrush(wxBrush(shadowColour)); if (attr.GetTextBoxAttr().HasCornerRadius() && attr.GetTextBoxAttr().GetCornerRadius().GetValue() > 0) { - wxTextAttrDimensionConverter converter(dc, buffer ? buffer->GetScale() : 1.0); - int cornerRadius = converter.GetPixels(attr.GetTextBoxAttr().GetCornerRadius()); + wxTextAttrDimensionConverter radConverter(dc, buffer ? buffer->GetScale() : 1.0); + int cornerRadius = radConverter.GetPixels(attr.GetTextBoxAttr().GetCornerRadius()); if (cornerRadius > 0) { dc.DrawRoundedRectangle(shadowRect, cornerRadius); @@ -2353,29 +2353,29 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, wxRichTextDrawingContext& co while (node) { - wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - if (child) + wxRichTextParagraph* nodeChild = wxDynamicCast(node->GetData(), wxRichTextParagraph); + if (nodeChild) { - if (child->GetLines().GetCount() == 0) + if (nodeChild->GetLines().GetCount() == 0) { - child->SetImpactedByFloatingObjects(-1); + nodeChild->SetImpactedByFloatingObjects(-1); // Lays out the object first with a given amount of space, and then if no width was specified in attr, // lays out the object again using the minimum size - child->LayoutToBestSize(dc, context, GetBuffer(), - attr, child->GetAttributes(), availableSpace, rect, style&~wxRICHTEXT_LAYOUT_SPECIFIED_RECT); + nodeChild->LayoutToBestSize(dc, context, GetBuffer(), + attr, nodeChild->GetAttributes(), availableSpace, rect, style&~wxRICHTEXT_LAYOUT_SPECIFIED_RECT); } else { if (wxRichTextBuffer::GetFloatingLayoutMode() && GetFloatCollector()) - GetFloatCollector()->CollectFloat(child); - child->Move(wxPoint(child->GetPosition().x, child->GetPosition().y + inc)); + GetFloatCollector()->CollectFloat(nodeChild); + nodeChild->Move(wxPoint(nodeChild->GetPosition().x, nodeChild->GetPosition().y + inc)); } - availableSpace.y += child->GetCachedSize().y; - maxWidth = wxMax(maxWidth, child->GetCachedSize().x); - maxMinWidth = wxMax(maxMinWidth, child->GetMinSize().x); - maxMaxWidth = wxMax(maxMaxWidth, child->GetMaxSize().x); + availableSpace.y += nodeChild->GetCachedSize().y; + maxWidth = wxMax(maxWidth, nodeChild->GetCachedSize().x); + maxMinWidth = wxMax(maxMinWidth, nodeChild->GetMinSize().x); + maxMaxWidth = wxMax(maxMaxWidth, nodeChild->GetMaxSize().x); } node = node->GetNext(); @@ -2480,14 +2480,14 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, wxRichTextDrawingContext& co // This doesn't take into account floating objects, unfortunately. if (yOffset != 0) { - wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); - while (node) + wxRichTextObjectList::compatibility_iterator childNode = m_children.GetFirst(); + while (childNode) { - wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); + wxRichTextParagraph* child = wxDynamicCast(childNode->GetData(), wxRichTextParagraph); if (child) child->Move(wxPoint(child->GetPosition().x, child->GetPosition().y + yOffset)); - node = node->GetNext(); + childNode = childNode->GetNext(); } } } @@ -2990,10 +2990,10 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag // If there was only one paragraph, we need to insert a new one. while (i) { - wxRichTextParagraph* para = wxDynamicCast(i->GetData(), wxRichTextParagraph); - wxASSERT( para != NULL ); + wxRichTextParagraph* searchPara = wxDynamicCast(i->GetData(), wxRichTextParagraph); + wxASSERT( searchPara != NULL ); - finalPara = (wxRichTextParagraph*) para->Clone(); + finalPara = (wxRichTextParagraph*) searchPara->Clone(); if (nextParagraph) InsertChild(finalPara, nextParagraph); @@ -3051,10 +3051,10 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag wxRichTextObjectList::compatibility_iterator i = fragment.GetChildren().GetFirst(); while (i) { - wxRichTextParagraph* para = wxDynamicCast(i->GetData(), wxRichTextParagraph); - wxASSERT( para != NULL ); + wxRichTextParagraph* searchPara = wxDynamicCast(i->GetData(), wxRichTextParagraph); + wxASSERT( searchPara != NULL ); - AppendChild(para->Clone()); + AppendChild(searchPara->Clone()); i = i->GetNext(); } @@ -3127,8 +3127,8 @@ bool wxRichTextParagraphLayoutBox::CopyFragment(const wxRichTextRange& range, wx lastPara->DeleteRange(topTailRange); // Make sure the numbering is correct - long end; - fragment.CalculateRange(0, end); + long unusedEnd; + fragment.CalculateRange(0, unusedEnd); // We only have part of a paragraph at the end fragment.SetPartialParagraph(true); @@ -4431,10 +4431,10 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx if (styleSheet && !newPara->GetAttributes().GetParagraphStyleName().IsEmpty()) { - wxRichTextParagraphStyleDefinition* def = styleSheet->FindParagraphStyle(newPara->GetAttributes().GetParagraphStyleName()); - if (def) + wxRichTextParagraphStyleDefinition* newParaDef = styleSheet->FindParagraphStyle(newPara->GetAttributes().GetParagraphStyleName()); + if (newParaDef) { - newPara->GetAttributes() = def->GetStyleMergedWithBase(styleSheet); + newPara->GetAttributes() = newParaDef->GetStyleMergedWithBase(styleSheet); } } } @@ -5657,14 +5657,14 @@ bool wxRichTextParagraph::InsertText(long pos, const wxString& text) // Increment the end range of subsequent fragments in this paragraph. // We'll set the paragraph range itself at a higher level. - wxRichTextObjectList::compatibility_iterator node = nodeToUse->GetNext(); - while (node) + wxRichTextObjectList::compatibility_iterator childNode = nodeToUse->GetNext(); + while (childNode) { - wxRichTextObject* child = node->GetData(); + wxRichTextObject* child = childNode->GetData(); child->SetRange(wxRichTextRange(textObject->GetRange().GetStart() + textLength, textObject->GetRange().GetEnd() + textLength)); - node = node->GetNext(); + childNode = childNode->GetNext(); } return true; @@ -7192,13 +7192,13 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz wxFont textFont = font; if (textFont.IsUsingSizeInPixels()) { - double size = static_cast(textFont.GetPixelSize().y) / wxSCRIPT_MUL_FACTOR; - textFont.SetPixelSize(wxSize(0, static_cast(size))); + double textSize = static_cast(textFont.GetPixelSize().y) / wxSCRIPT_MUL_FACTOR; + textFont.SetPixelSize(wxSize(0, static_cast(textSize))); } else { - double size = static_cast(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR; - textFont.SetPointSize(static_cast(size)); + double textSize = static_cast(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR; + textFont.SetPointSize(static_cast(textSize)); } wxCheckSetFont(dc, textFont); bScript = true; @@ -10459,7 +10459,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const // Cell width percentages are for the overall cell width, so ignore margins and // only take into account table margins and inter-cell padding. int availableWidthForPercentageCellWidths = internalTableWidth - ((visibleCellCount-1) * paddingX); - wxTextAttrDimensionConverter converter(dc, scale, wxSize(availableWidthForPercentageCellWidths, 0)); + wxTextAttrDimensionConverter cellConverter(dc, scale, wxSize(availableWidthForPercentageCellWidths, 0)); for (i = 0; i < m_colCount; i++) { @@ -10479,7 +10479,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const if (cell->GetAttributes().GetTextBoxAttr().GetWidth().IsValid()) { - int w = converter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetWidth(), wxHORIZONTAL); + int w = cellConverter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetWidth(), wxHORIZONTAL); if (cell->GetAttributes().GetTextBoxAttr().GetWidth().GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE) { percentageCellWidth = w; @@ -10557,7 +10557,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const // Cell width percentages are for the overall cell width, so ignore margins and // only take into account table margins and inter-cell padding. int availableWidthForPercentageCellWidths = internalTableWidth - ((visibleCellCount-1) * paddingX); - wxTextAttrDimensionConverter converter(dc, scale, wxSize(availableWidthForPercentageCellWidths, 0)); + wxTextAttrDimensionConverter cellConverter(dc, scale, wxSize(availableWidthForPercentageCellWidths, 0)); for (i = 0; i < m_colCount; i++) { @@ -10573,7 +10573,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const { if (cell->GetAttributes().GetTextBoxAttr().GetWidth().IsValid()) { - cellWidth = converter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetWidth(), wxHORIZONTAL); + cellWidth = cellConverter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetWidth(), wxHORIZONTAL); // Override absolute width with minimum width if necessary if (cell->GetMinSize().x > 0 && cellWidth != -1 && cell->GetMinSize().x > cellWidth) cellWidth = cell->GetMinSize().x; @@ -10819,7 +10819,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxArrayInt actualWidths; actualWidths.Add(0, m_colCount); - wxTextAttrDimensionConverter converter(dc, scale); + wxTextAttrDimensionConverter cellConverter(dc, scale); for (i = 0; i < m_colCount; i++) { wxRichTextCell* cell = GetCell(j, i); @@ -10829,7 +10829,7 @@ bool wxRichTextTable::Layout(wxDC& dc, wxRichTextDrawingContext& context, const // Don't handle percentages for height if (cell->GetAttributes().GetTextBoxAttr().GetHeight().IsValid() && cell->GetAttributes().GetTextBoxAttr().GetHeight().GetUnits() != wxTEXT_ATTR_UNITS_PERCENTAGE) { - int h = converter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetHeight()); + int h = cellConverter.GetPixels(cell->GetAttributes().GetTextBoxAttr().GetHeight()); if (h > maxSpecifiedCellHeight) maxSpecifiedCellHeight = h; } @@ -11819,10 +11819,10 @@ void wxRichTextAction::CalculateRefreshOptimizations(wxArrayInt& optimizationLin // We will use a simple criterion - if any of the paragraphs following the // modification point are affected by floats in other paragraphs, // then we will simply update the rest of the screen. - wxRichTextObjectList::compatibility_iterator node = firstNode; - while (node) + wxRichTextObjectList::compatibility_iterator childNode = firstNode; + while (childNode) { - wxRichTextParagraph* child = (wxRichTextParagraph*) node->GetData(); + wxRichTextParagraph* child = (wxRichTextParagraph*) childNode->GetData(); if (child->GetRect().GetTop() > lastY) break; else if (child->GetImpactedByFloatingObjects() == 1) @@ -11830,7 +11830,7 @@ void wxRichTextAction::CalculateRefreshOptimizations(wxArrayInt& optimizationLin oldFloatRect = wxRect(0, 0, clientSize.x, lastY); break; } - node = node->GetNext(); + childNode = childNode->GetNext(); } } } @@ -12035,9 +12035,9 @@ bool wxRichTextAction::Do() wxRichTextObjectList::compatibility_iterator node = parent->GetChildren().Find(obj); if (node) { - wxRichTextObject* obj = node->GetData(); + wxRichTextObject* nodeObj = node->GetData(); node->SetData(m_object); - m_object = obj; + m_object = nodeObj; } } } @@ -12341,10 +12341,10 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent // which means the reformatting stopped at this point. if (lastNode && (container->GetFloatingObjectCount() > 0) && (lastY < lastPossibleY)) { - wxRichTextObjectList::compatibility_iterator node = lastNode; - while (node) + wxRichTextObjectList::compatibility_iterator childNode = lastNode; + while (childNode) { - wxRichTextParagraph* child = (wxRichTextParagraph*) node->GetData(); + wxRichTextParagraph* child = (wxRichTextParagraph*) childNode->GetData(); if (child->GetImpactedByFloatingObjects() == 0) { wxRect childRect = child->GetRect(); @@ -12353,7 +12353,7 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent break; } - node = node->GetNext(); + childNode = childNode->GetNext(); } } } @@ -12556,10 +12556,10 @@ bool wxRichTextImage::LoadImageCache(wxDC& dc, wxRichTextDrawingContext& context // Take away space used by the image's margins { // Find the actual space available when margin is taken into account - wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect; - marginRect = wxRect(0, 0, 100, 100); // To force GetBoxRects to return content rect - GetBoxRects(dc, buffer, GetAttributes(), marginRect, borderRect, contentRect, paddingRect, outlineRect); - sz += (contentRect.GetSize() - wxSize(100, 100)); + wxRect imgMarginRect, imgBorderRect, imgContentRect, imgPaddingRect, imgOutlineRect; + imgMarginRect = wxRect(0, 0, 100, 100); // To force GetBoxRects to return content rect + GetBoxRects(dc, buffer, GetAttributes(), imgMarginRect, imgBorderRect, imgContentRect, imgPaddingRect, imgOutlineRect); + sz += (imgContentRect.GetSize() - wxSize(100, 100)); } // Use a minimum size to stop images becoming very small diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index c22845f4f2..0534d0945f 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -705,12 +705,12 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event) m_preDrag = false; // Tell DnD not to happen now: we are processing Left Up ourselves. // Do the actions that would have been done in OnLeftClick if we hadn't tried to drag - long position = 0; - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; - int hit = GetBuffer().HitTest(dc, context, GetUnscaledPoint(event.GetLogicalPosition(dc)), position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); + long prePosition = 0; + wxRichTextObject* preHitObj = NULL; + wxRichTextObject* preContextObj = NULL; + int preHit = GetBuffer().HitTest(dc, context, GetUnscaledPoint(event.GetLogicalPosition(dc)), prePosition, & preHitObj, & preContextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); wxRichTextParagraphLayoutBox* oldFocusObject = GetFocusObject(); - wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox); + wxRichTextParagraphLayoutBox* container = wxDynamicCast(preContextObj, wxRichTextParagraphLayoutBox); bool needsCaretSet = false; if (container && container != GetFocusObject() && container->AcceptsFocus()) { @@ -718,7 +718,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event) needsCaretSet = true; } - if (wxRichTextBuffer::GetFloatingLayoutMode() && hitObj && hitObj->IsFloating() && !hitObj->AcceptsFocus()) + if (wxRichTextBuffer::GetFloatingLayoutMode() && preHitObj && preHitObj->IsFloating() && !preHitObj->AcceptsFocus()) { if (needsCaretSet) SetInsertionPoint(0); @@ -727,7 +727,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event) { long oldCaretPos = m_caretPosition; - SetCaretPositionAfterClick(container, position, hit); + SetCaretPositionAfterClick(container, prePosition, preHit); // For now, don't handle shift-click when we're selecting multiple objects. if (event.ShiftDown() && GetFocusObject() == oldFocusObject && m_selectionState == wxRichTextCtrlSelectionState_Normal) @@ -5502,8 +5502,8 @@ int wxRichTextContextMenuPropertiesInfo::AddMenuItems(wxMenu* menu, int startCmd // Find the position of the first properties item for (i = 0; i < (int) menu->GetMenuItemCount(); i++) { - wxMenuItem* item = menu->FindItemByPosition(i); - if (item && item->GetId() == startCmd) + wxMenuItem* searchItem = menu->FindItemByPosition(i); + if (searchItem && searchItem->GetId() == startCmd) { pos = i; break; diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index 30376f2796..b6733d6d34 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -331,68 +331,60 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat /// Create a page, given a page identifier wxPanel* wxRichTextFormattingDialogFactory::CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog) { + wxPanel* panel = NULL; + if (page == wxRICHTEXT_FORMAT_STYLE_EDITOR) { - wxRichTextStylePage* page = new wxRichTextStylePage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextStylePage(dialog->GetBookCtrl(), wxID_ANY); title = _("Style"); - return page; } else if (page == wxRICHTEXT_FORMAT_FONT) { - wxRichTextFontPage* page = new wxRichTextFontPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextFontPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Font"); - return page; } else if (page == wxRICHTEXT_FORMAT_INDENTS_SPACING) { - wxRichTextIndentsSpacingPage* page = new wxRichTextIndentsSpacingPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextIndentsSpacingPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Indents && Spacing"); - return page; } else if (page == wxRICHTEXT_FORMAT_TABS) { - wxRichTextTabsPage* page = new wxRichTextTabsPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextTabsPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Tabs"); - return page; } else if (page == wxRICHTEXT_FORMAT_BULLETS) { - wxRichTextBulletsPage* page = new wxRichTextBulletsPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextBulletsPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Bullets"); - return page; } else if (page == wxRICHTEXT_FORMAT_LIST_STYLE) { - wxRichTextListStylePage* page = new wxRichTextListStylePage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextListStylePage(dialog->GetBookCtrl(), wxID_ANY); title = _("List Style"); - return page; } else if (page == wxRICHTEXT_FORMAT_SIZE) { - wxRichTextSizePage* page = new wxRichTextSizePage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextSizePage(dialog->GetBookCtrl(), wxID_ANY); title = _("Size"); - return page; } else if (page == wxRICHTEXT_FORMAT_MARGINS) { - wxRichTextMarginsPage* page = new wxRichTextMarginsPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextMarginsPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Margins"); - return page; } else if (page == wxRICHTEXT_FORMAT_BORDERS) { - wxRichTextBordersPage* page = new wxRichTextBordersPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextBordersPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Borders"); - return page; } else if (page == wxRICHTEXT_FORMAT_BACKGROUND) { - wxRichTextBackgroundPage* page = new wxRichTextBackgroundPage(dialog->GetBookCtrl(), wxID_ANY); + panel = new wxRichTextBackgroundPage(dialog->GetBookCtrl(), wxID_ANY); title = _("Background"); - return page; } - else - return NULL; + + return panel; } /// Enumerate all available page identifiers @@ -524,8 +516,8 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) if ((GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) || (GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT)) { - double size = static_cast(font.GetPointSize()) / wxSCRIPT_MUL_FACTOR; - font.SetPointSize( static_cast(size) ); + double fontSize = static_cast(font.GetPointSize()) / wxSCRIPT_MUL_FACTOR; + font.SetPointSize( static_cast(fontSize) ); } if ( font.IsOk() ) @@ -795,8 +787,8 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) #endif // wxUSE_COLOURDLG Refresh(); - wxCommandEvent event(wxEVT_BUTTON, GetId()); - GetEventHandler()->ProcessEvent(event); + wxCommandEvent btnEvent(wxEVT_BUTTON, GetId()); + GetEventHandler()->ProcessEvent(btnEvent); } } diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index 50dc49c393..8e8c2a6fc5 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -96,8 +96,8 @@ wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTex wxList::compatibility_iterator node = styles.GetFirst(); while (node) { - wxRichTextStyleDefinition* def = (wxRichTextStyleDefinition*) node->GetData(); - attr.Apply(def->GetStyle(), NULL); + wxRichTextStyleDefinition* nodeDef = (wxRichTextStyleDefinition*) node->GetData(); + attr.Apply(nodeDef->GetStyle(), NULL); node = node->GetNext(); } @@ -327,10 +327,10 @@ bool wxRichTextStyleSheet::RemoveStyle(wxList& list, wxRichTextStyleDefinition* wxList::compatibility_iterator node = list.Find(def); if (node) { - wxRichTextStyleDefinition* def = (wxRichTextStyleDefinition*) node->GetData(); + wxRichTextStyleDefinition* nodeDef = (wxRichTextStyleDefinition*) node->GetData(); list.Erase(node); if (deleteStyle) - delete def; + delete nodeDef; return true; } else diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 03995ef9f2..d470d693e6 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -437,12 +437,12 @@ bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* nod // Skip past the whitespace after the properties while (textChild && (textChild->GetType() == wxXML_TEXT_NODE)) { - wxString text = textChild->GetContent(); - text.Trim(true); - text.Trim(false); - if (!text.IsEmpty()) + wxString cText = textChild->GetContent(); + cText.Trim(true); + cText.Trim(false); + if (!cText.IsEmpty()) { - textChild->SetContent(text); + textChild->SetContent(cText); break; } else @@ -2387,11 +2387,11 @@ bool wxRichTextXMLHelper::ExportStyleDefinition(wxOutputStream& stream, wxRichTe wxRichTextAttr* levelAttr = listDef->GetLevelAttributes(i); if (levelAttr) { - wxString style = AddAttributes(def->GetStyle(), true); + wxString levelStyle = AddAttributes(def->GetStyle(), true); wxString levelStr = wxString::Format(wxT(" level=\"%d\" "), (i+1)); OutputIndentation(stream, level); - OutputString(stream, wxT(""));