Commit d04ab1fe authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pl_Editor: fix minor issues in multi-lines texts

Others: fix very minor issues.
parent 87eb527d
Loading
Loading
Loading
Loading
+38 −0
Original line number Original line Diff line number Diff line
@@ -462,6 +462,43 @@ void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
        m_FullText << (wxChar) ( aIncr + lbchar );
        m_FullText << (wxChar) ( aIncr + lbchar );
}
}


// Replace the '\''n' sequence by EOL
// and the sequence  '\''\' by only one '\' in m_FullText
// if m_FullTextis a multiline text (i;e.contains '\n') return true
bool WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence()
{
    bool multiline = false;

    for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
    {
        if( m_FullText[ii] == '\n' )
            multiline = true;

        else if( m_FullText[ii] == '\\' )
        {
            if( ++ii >= m_FullText.Len() )
                break;

            if( m_FullText[ii] == '\\' )
            {
                // a double \\ sequence is replaced by a single \ char
                m_FullText.Remove(ii, 1);
                ii--;
            }
            else if( m_FullText[ii] == 'n' )
            {
                // Replace the "\n" sequence by a EOL char
                multiline = true;
                m_FullText[ii] = '\n';
                m_FullText.Remove(ii-1, 1);
                ii--;
            }
        }
    }

    return multiline;
}

void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
{
{
    m_ConstrainedTextSize = m_TextSize;
    m_ConstrainedTextSize = m_TextSize;
@@ -501,3 +538,4 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
            m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y;
            m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y;
    }
    }
}
}
+1 −2
Original line number Original line Diff line number Diff line
@@ -152,8 +152,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
            else
            else
            {
            {
                wsText->m_FullText = BuildFullText( wsText->m_TextBase );
                wsText->m_FullText = BuildFullText( wsText->m_TextBase );
                if( wsText->m_FullText.Replace( wxT("\\n" ), wxT("\n") ) > 0 )
                multilines = wsText->ReplaceAntiSlashSequence();
                    multilines = true;
            }
            }


            if( wsText->m_FullText.IsEmpty() )
            if( wsText->m_FullText.IsEmpty() )
+2 −2
Original line number Original line Diff line number Diff line
@@ -136,8 +136,8 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
            msg << aTextbase[ii];
            msg << aTextbase[ii];
            continue;
            continue;
        }
        }
        ii++;

        if( ii >= aTextbase.Len() )
        if( ++ii >= aTextbase.Len() )
            break;
            break;


        wxChar format = aTextbase[ii];
        wxChar format = aTextbase[ii];
+8 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,14 @@ public:
     */
     */
    void SetConstrainedTextSize();
    void SetConstrainedTextSize();



    /** Replace the '\''n' sequence by EOL
     * and the sequence  '\''\' by only one '\'
     * inside m_FullText
     * @return true if the EOL symbol is found or is inserted (multiline text)
     */
    bool ReplaceAntiSlashSequence();

    /**
    /**
     * @return true is a bold font should be selected
     * @return true is a bold font should be selected
     */
     */
+2 −2
Original line number Original line Diff line number Diff line
@@ -98,7 +98,7 @@ public:
        }
        }
        catch( IO_ERROR ioe )
        catch( IO_ERROR ioe )
        {
        {
            wxMessageBox( ioe.errorText, _("Write Page Layout Error" ) );
            wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
        }
        }
    }
    }


@@ -125,7 +125,7 @@ public:
        }
        }
        catch( IO_ERROR ioe )
        catch( IO_ERROR ioe )
        {
        {
            wxMessageBox( ioe.errorText, _("Write Page Layout Error" ) );
            wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
        }
        }
    }
    }


Loading