Commit 04e2cbea authored by Michael Reeves's avatar Michael Reeves

sync with master remove unintended formatting differences

*missing set in CMakeLists.txt
parent cbd5411f
......@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(kdiff3)
set(CMAKE_CXX_EXTENSIONS OFF ) #don't use non-standard extentions
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ECM_MIN_VERSION "1.7.0")
set(QT_MIN_VERSION "5.4.2")
......
......@@ -806,72 +806,70 @@ public:
}
};
void DiffTextWindowData::prepareTextLayout( QTextLayout& textLayout, bool /*bFirstLine*/, int visibleTextWidth )
void DiffTextWindowData::prepareTextLayout(QTextLayout& textLayout, bool /*bFirstLine*/, int visibleTextWidth)
{
QTextOption textOption;
textOption.setTabStop( QFontMetricsF(m_pDiffTextWindow->font()).width(' ') * m_pOptions->m_tabSize );
if ( m_pOptions->m_bShowWhiteSpaceCharacters )
textOption.setFlags( QTextOption::ShowTabsAndSpaces );
if ( m_pOptions->m_bRightToLeftLanguage )
textOption.setAlignment(Qt::AlignRight); // only relevant for multi line text layout
if ( visibleTextWidth>=0 )
textOption.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );
QTextOption textOption;
textOption.setTabStop(QFontMetricsF(m_pDiffTextWindow->font()).width(' ') * m_pOptions->m_tabSize);
if(m_pOptions->m_bShowWhiteSpaceCharacters)
textOption.setFlags(QTextOption::ShowTabsAndSpaces);
if(m_pOptions->m_bRightToLeftLanguage)
textOption.setAlignment(Qt::AlignRight); // only relevant for multi line text layout
if(visibleTextWidth >= 0)
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
textLayout.setTextOption( textOption );
if ( m_pOptions->m_bShowWhiteSpaceCharacters )
{
// This additional format is only necessary for the tab arrow
QList<QTextLayout::FormatRange> formats;
QTextLayout::FormatRange formatRange;
formatRange.start = 0;
formatRange.length = textLayout.text().length();
formatRange.format.setFont( m_pDiffTextWindow->font() );
formats.append( formatRange );
textLayout.setAdditionalFormats(formats);
}
textLayout.beginLayout();
int leading = m_pDiffTextWindow->fontMetrics().leading();
int height = 0;
textLayout.setTextOption(textOption);
if(m_pOptions->m_bShowWhiteSpaceCharacters)
{
// This additional format is only necessary for the tab arrow
QList<QTextLayout::FormatRange> formats;
QTextLayout::FormatRange formatRange;
formatRange.start = 0;
formatRange.length = textLayout.text().length();
formatRange.format.setFont(m_pDiffTextWindow->font());
formats.append(formatRange);
textLayout.setAdditionalFormats(formats);
}
textLayout.beginLayout();
int fontWidth = m_pDiffTextWindow->fontMetrics().width('0');
int xOffset = leftInfoWidth() * fontWidth - m_horizScrollOffset;
int textWidth = visibleTextWidth;
if ( textWidth<0 )
textWidth = m_pDiffTextWindow->width() - xOffset;
int leading = m_pDiffTextWindow->fontMetrics().leading();
int height = 0;
int indentation = 0;
while (1)
{
QTextLine line = textLayout.createLine();
if (!line.isValid())
break;
int fontWidth = m_pDiffTextWindow->fontMetrics().width('0');
int xOffset = leftInfoWidth() * fontWidth - m_horizScrollOffset;
int textWidth = visibleTextWidth;
if(textWidth < 0)
textWidth = m_pDiffTextWindow->width() - xOffset;
height += leading;
//if ( !bFirstLine )
// indentation = m_pDiffTextWindow->fontMetrics().width(' ') * m_pOptions->m_tabSize;
if ( visibleTextWidth>=0 )
{
line.setLineWidth( visibleTextWidth -indentation );
line.setPosition(QPointF(indentation, height));
height += line.height();
//bFirstLine = false;
}
else // only one line
{
line.setPosition( QPointF(indentation, height));
break;
}
}
int indentation = 0;
while(1)
{
QTextLine line = textLayout.createLine();
if(!line.isValid())
break;
textLayout.endLayout();
if ( m_pOptions->m_bRightToLeftLanguage )
textLayout.setPosition( QPointF( textWidth - textLayout.maximumWidth(),0) );
else
textLayout.setPosition( QPointF( xOffset,0) );
height += leading;
//if ( !bFirstLine )
// indentation = m_pDiffTextWindow->fontMetrics().width(' ') * m_pOptions->m_tabSize;
if(visibleTextWidth >= 0)
{
line.setLineWidth(visibleTextWidth - indentation);
line.setPosition(QPointF(indentation, height));
height += line.height();
//bFirstLine = false;
}
else // only one line
{
line.setPosition(QPointF(indentation, height));
break;
}
}
textLayout.endLayout();
if(m_pOptions->m_bRightToLeftLanguage)
textLayout.setPosition(QPointF(textWidth - textLayout.maximumWidth(), 0));
else
textLayout.setPosition(QPointF(xOffset, 0));
}
void DiffTextWindowData::writeLine(
......
......@@ -1681,54 +1681,54 @@ int convertToPosOnScreen( const QString& /*p*/, int posInText, int /*tabSize*/ )
// return posOnScreen;
//}
QVector<QTextLayout::FormatRange> MergeResultWindow::getTextLayoutForLine(int line, const QString& str, QTextLayout& textLayout )
{
// tabs
QTextOption textOption;
textOption.setTabStop( QFontMetricsF(font()).width(' ') * m_pOptions->m_tabSize );
if ( m_pOptions->m_bShowWhiteSpaceCharacters )
{
textOption.setFlags( QTextOption::ShowTabsAndSpaces );
}
textLayout.setTextOption( textOption );
if ( m_pOptions->m_bShowWhiteSpaceCharacters )
{
// This additional format is only necessary for the tab arrow
QList<QTextLayout::FormatRange> formats;
QTextLayout::FormatRange formatRange;
formatRange.start = 0;
formatRange.length = str.length();
formatRange.format.setFont( font() );
formats.append( formatRange );
textLayout.setAdditionalFormats(formats);
}
QVector<QTextLayout::FormatRange> selectionFormat;
textLayout.beginLayout();
if ( m_selection.lineWithin( line ) )
{
int firstPosInText = convertToPosInText( str, m_selection.firstPosInLine(line), m_pOptions->m_tabSize );
int lastPosInText = convertToPosInText( str, m_selection.lastPosInLine(line), m_pOptions->m_tabSize );
int lengthInText = max2(0,lastPosInText - firstPosInText);
if (lengthInText>0)
m_selection.bSelectionContainsData = true;
QTextLayout::FormatRange selection;
selection.start = firstPosInText;
selection.length = lengthInText;
selection.format.setBackground( palette().highlight() );
selection.format.setForeground( palette().highlightedText().color() );
selectionFormat.push_back( selection );
}
QTextLine textLine = textLayout.createLine();
textLine.setPosition(QPointF(0, fontMetrics().leading()));
textLayout.endLayout();
int cursorWidth = 5;
if ( m_pOptions->m_bRightToLeftLanguage )
textLayout.setPosition( QPointF(width()-textLayout.maximumWidth()-getTextXOffset()+m_horizScrollOffset-cursorWidth, 0) );
else
textLayout.setPosition( QPointF(getTextXOffset() - m_horizScrollOffset, 0) );
return selectionFormat;
QVector<QTextLayout::FormatRange> MergeResultWindow::getTextLayoutForLine( int line, const QString& str, QTextLayout& textLayout )
{
// tabs
QTextOption textOption;
textOption.setTabStop( QFontMetricsF(font()).width(' ') * m_pOptions->m_tabSize );
if( m_pOptions->m_bShowWhiteSpaceCharacters )
{
textOption.setFlags( QTextOption::ShowTabsAndSpaces );
}
textLayout.setTextOption( textOption );
if( m_pOptions->m_bShowWhiteSpaceCharacters )
{
// This additional format is only necessary for the tab arrow
QList<QTextLayout::FormatRange> formats;
QTextLayout::FormatRange formatRange;
formatRange.start = 0;
formatRange.length = str.length();
formatRange.format.setFont( font() );
formats.append( formatRange );
textLayout.setAdditionalFormats( formats );
}
QVector<QTextLayout::FormatRange> selectionFormat;
textLayout.beginLayout();
if( m_selection.lineWithin( line ) )
{
int firstPosInText = convertToPosInText( str, m_selection.firstPosInLine(line), m_pOptions->m_tabSize );
int lastPosInText = convertToPosInText( str, m_selection.lastPosInLine(line), m_pOptions->m_tabSize );
int lengthInText = max2( 0, lastPosInText - firstPosInText );
if( lengthInText>0 )
m_selection.bSelectionContainsData = true;
QTextLayout::FormatRange selection;
selection.start = firstPosInText;
selection.length = lengthInText;
selection.format.setBackground( palette().highlight() );
selection.format.setForeground( palette().highlightedText().color() );
selectionFormat.push_back( selection );
}
QTextLine textLine = textLayout.createLine();
textLine.setPosition( QPointF(0, fontMetrics().leading()) );
textLayout.endLayout();
int cursorWidth = 5;
if( m_pOptions->m_bRightToLeftLanguage )
textLayout.setPosition( QPointF(width()-textLayout.maximumWidth()-getTextXOffset()+m_horizScrollOffset-cursorWidth, 0) );
else
textLayout.setPosition( QPointF(getTextXOffset() - m_horizScrollOffset, 0) );
return selectionFormat;
}
void MergeResultWindow::writeLine(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment