Commit a03df411 authored by Michael Reeves's avatar Michael Reeves

reformat

parent 29c895c9
......@@ -27,131 +27,132 @@ class RLPainter;
class DiffTextWindow : public QWidget
{
Q_OBJECT
public:
DiffTextWindow(DiffTextWindowFrame* pParent, QStatusBar* pStatusBar, Options* pOptions, e_SrcSelector winIdx);
~DiffTextWindow() override;
void init(
const QString& fileName,
QTextCodec* pTextCodec,
e_LineEndStyle eLineEndStyle,
const QVector<LineData>* pLineData,
int size,
const Diff3LineVector* pDiff3LineVector,
const ManualDiffHelpList* pManualDiffHelpList,
bool bTriple
);
void reset();
void convertToLinePos( int x, int y, LineRef& line, int& pos );
QString getSelection();
int getFirstLine();
int calcTopLineInFile( int firstLine );
int getMaxTextWidth();
LineCount getNofLines();
int getNofVisibleLines();
int getVisibleTextAreaWidth();
int convertLineToDiff3LineIdx( LineRef line );
LineRef convertDiff3LineIdxToLine( int d3lIdx );
void convertD3LCoordsToLineCoords( int d3LIdx, int d3LPos, int& line, int& pos );
void convertLineCoordsToD3LCoords( int line, int pos, int& d3LIdx, int& d3LPos );
void convertSelectionToD3LCoords();
bool findString( const QString& s, LineRef& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive );
void setSelection( LineRef firstLine, int startPos, LineRef lastLine, int endPos, LineRef& l, int& p );
void getSelectionRange( LineRef* firstLine, LineRef* lastLine, e_CoordType coordType );
void setPaintingAllowed( bool bAllowPainting );
void recalcWordWrap( bool bWordWrap, int wrapLineVectorSize, int visibleTextWidth);
void recalcWordWrapHelper( int wrapLineVectorSize, int visibleTextWidth, int cacheListIdx);
void print( RLPainter& painter, const QRect& r, int firstLine, int nofLinesPerPage );
Q_SIGNALS:
void resizeHeightChangedSignal(int nofVisibleLines);
void resizeWidthChangedSignal(int nofVisibleColumns);
void scrollDiffTextWindow( int deltaX, int deltaY );
void newSelection();
void selectionEnd();
void setFastSelectorLine( LineIndex line );
void gotFocus();
void lineClicked( e_SrcSelector winIdx, int line );
public Q_SLOTS:
void setFirstLine( int line );
void setHorizScrollOffset( int horizScrollOffset );
void resetSelection();
void setFastSelectorRange( int line1, int nofLines );
protected:
void mousePressEvent ( QMouseEvent * ) override;
void mouseReleaseEvent ( QMouseEvent * ) override;
void mouseMoveEvent ( QMouseEvent * ) override;
void mouseDoubleClickEvent ( QMouseEvent * e ) override;
void paintEvent( QPaintEvent* ) override;
void dragEnterEvent( QDragEnterEvent* e ) override;
void focusInEvent( QFocusEvent* e ) override;
void resizeEvent( QResizeEvent* ) override;
void timerEvent(QTimerEvent*) override;
private:
DiffTextWindowData* d;
void showStatusLine( int line );
friend class DiffTextWindowFrame;
Q_OBJECT
public:
DiffTextWindow(DiffTextWindowFrame* pParent, QStatusBar* pStatusBar, Options* pOptions, e_SrcSelector winIdx);
~DiffTextWindow() override;
void init(
const QString& fileName,
QTextCodec* pTextCodec,
e_LineEndStyle eLineEndStyle,
const QVector<LineData>* pLineData,
int size,
const Diff3LineVector* pDiff3LineVector,
const ManualDiffHelpList* pManualDiffHelpList,
bool bTriple
);
void reset();
void convertToLinePos(int x, int y, LineRef& line, int& pos);
QString getSelection();
int getFirstLine();
int calcTopLineInFile(int firstLine);
int getMaxTextWidth();
LineCount getNofLines();
int getNofVisibleLines();
int getVisibleTextAreaWidth();
int convertLineToDiff3LineIdx(LineRef line);
LineRef convertDiff3LineIdxToLine(int d3lIdx);
void convertD3LCoordsToLineCoords(int d3LIdx, int d3LPos, int& line, int& pos);
void convertLineCoordsToD3LCoords(int line, int pos, int& d3LIdx, int& d3LPos);
void convertSelectionToD3LCoords();
bool findString(const QString& s, LineRef& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive);
void setSelection(LineRef firstLine, int startPos, LineRef lastLine, int endPos, LineRef& l, int& p);
void getSelectionRange(LineRef* firstLine, LineRef* lastLine, e_CoordType coordType);
void setPaintingAllowed(bool bAllowPainting);
void recalcWordWrap(bool bWordWrap, int wrapLineVectorSize, int visibleTextWidth);
void recalcWordWrapHelper(int wrapLineVectorSize, int visibleTextWidth, int cacheListIdx);
void print(RLPainter& painter, const QRect& r, int firstLine, int nofLinesPerPage);
Q_SIGNALS:
void resizeHeightChangedSignal(int nofVisibleLines);
void resizeWidthChangedSignal(int nofVisibleColumns);
void scrollDiffTextWindow(int deltaX, int deltaY);
void newSelection();
void selectionEnd();
void setFastSelectorLine(LineIndex line);
void gotFocus();
void lineClicked(e_SrcSelector winIdx, int line);
public Q_SLOTS:
void setFirstLine(int line);
void setHorizScrollOffset(int horizScrollOffset);
void resetSelection();
void setFastSelectorRange(int line1, int nofLines);
protected:
void mousePressEvent(QMouseEvent*) override;
void mouseReleaseEvent(QMouseEvent*) override;
void mouseMoveEvent(QMouseEvent*) override;
void mouseDoubleClickEvent(QMouseEvent* e) override;
void paintEvent(QPaintEvent*) override;
void dragEnterEvent(QDragEnterEvent* e) override;
void focusInEvent(QFocusEvent* e) override;
void resizeEvent(QResizeEvent*) override;
void timerEvent(QTimerEvent*) override;
private:
DiffTextWindowData* d;
void showStatusLine(int line);
friend class DiffTextWindowFrame;
};
class DiffTextWindowFrameData;
class DiffTextWindowFrame : public QWidget
{
Q_OBJECT
public:
DiffTextWindowFrame( QWidget* pParent, QStatusBar* pStatusBar, Options* pOptions, e_SrcSelector winIdx, SourceData* psd);
~DiffTextWindowFrame() override;
DiffTextWindow* getDiffTextWindow();
void init();
void setFirstLine(int firstLine);
void sendEncodingChangedSignal(QTextCodec* c);
Q_SIGNALS:
void fileNameChanged(const QString&, e_SrcSelector);
void encodingChanged(QTextCodec*);
protected:
bool eventFilter( QObject*, QEvent* ) override;
//void paintEvent(QPaintEvent*);
private Q_SLOTS:
void slotReturnPressed();
void slotBrowseButtonClicked();
private:
DiffTextWindowFrameData* d;
Q_OBJECT
public:
DiffTextWindowFrame(QWidget* pParent, QStatusBar* pStatusBar, Options* pOptions, e_SrcSelector winIdx, SourceData* psd);
~DiffTextWindowFrame() override;
DiffTextWindow* getDiffTextWindow();
void init();
void setFirstLine(int firstLine);
void sendEncodingChangedSignal(QTextCodec* c);
Q_SIGNALS:
void fileNameChanged(const QString&, e_SrcSelector);
void encodingChanged(QTextCodec*);
protected:
bool eventFilter(QObject*, QEvent*) override;
//void paintEvent(QPaintEvent*);
private Q_SLOTS:
void slotReturnPressed();
void slotBrowseButtonClicked();
private:
DiffTextWindowFrameData* d;
};
class EncodingLabel : public QLabel
{
Q_OBJECT
public:
EncodingLabel( const QString & text, DiffTextWindowFrame* pDiffTextWindowFrame, SourceData* psd, Options* pOptions);
protected:
void mouseMoveEvent(QMouseEvent *ev) override;
void mousePressEvent(QMouseEvent *ev) override;
private Q_SLOTS:
void slotEncodingChanged();
private:
DiffTextWindowFrame* m_pDiffTextWindowFrame; //To send "EncodingChanged" signal
QMenu* m_pContextEncodingMenu;
SourceData* m_pSourceData; //SourceData to get access to "isEmpty()" and "isFromBuffer()" functions
static const int m_maxRecentEncodings = 5;
Options* m_pOptions;
void insertCodec( const QString& visibleCodecName, QTextCodec* pCodec, QList<int> &CodecEnumList, QMenu* pMenu, int currentTextCodecEnum);
Q_OBJECT
public:
EncodingLabel(const QString& text, DiffTextWindowFrame* pDiffTextWindowFrame, SourceData* psd, Options* pOptions);
protected:
void mouseMoveEvent(QMouseEvent* ev) override;
void mousePressEvent(QMouseEvent* ev) override;
private Q_SLOTS:
void slotEncodingChanged();
private:
DiffTextWindowFrame* m_pDiffTextWindowFrame; //To send "EncodingChanged" signal
QMenu* m_pContextEncodingMenu;
SourceData* m_pSourceData; //SourceData to get access to "isEmpty()" and "isFromBuffer()" functions
static const int m_maxRecentEncodings = 5;
Options* m_pOptions;
void insertCodec(const QString& visibleCodecName, QTextCodec* pCodec, QList<int>& CodecEnumList, QMenu* pMenu, int currentTextCodecEnum);
};
bool startRunnables();
#endif
......@@ -13,16 +13,17 @@
#define MERGERESULTWINDOW_H
#include "diff.h"
#include "selection.h"
#include "Overview.h"
#include "FileNameLineEdit.h"
#include "MergeEditLine.h"
#include "Overview.h"
#include <QWidget>
#include <QTimer>
#include "selection.h"
#include <QLineEdit>
#include <QStatusBar>
#include <QTextLayout>
#include <QLineEdit>
#include <QTimer>
#include <QWidget>
class QPainter;
class RLPainter;
......@@ -52,12 +53,12 @@ public:
void connectActions();
void reset();
bool saveDocument( const QString& fileName, QTextCodec* pEncoding, e_LineEndStyle eLineEndStyle );
int getNrOfUnsolvedConflicts(int* pNrOfWhiteSpaceConflicts=nullptr);
bool saveDocument(const QString& fileName, QTextCodec* pEncoding, e_LineEndStyle eLineEndStyle);
int getNrOfUnsolvedConflicts(int* pNrOfWhiteSpaceConflicts = nullptr);
void choose(e_SrcSelector selector);
void chooseGlobal(e_SrcSelector selector, bool bConflictsOnly, bool bWhiteSpaceOnly );
void chooseGlobal(e_SrcSelector selector, bool bConflictsOnly, bool bWhiteSpaceOnly);
int getMaxTextWidth(); // width of longest text line
int getMaxTextWidth(); // width of longest text line
int getNofLines();
int getVisibleTextAreaWidth(); // text area width without the border
int getNofVisibleLines();
......@@ -71,9 +72,9 @@ public:
bool isUnsolvedConflictAtCurrent();
bool isUnsolvedConflictAboveCurrent();
bool isUnsolvedConflictBelowCurrent();
bool findString( const QString& s, LineRef& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive );
void setSelection( int firstLine, int startPos, int lastLine, int endPos );
void setOverviewMode( Overview::e_OverviewMode eOverviewMode );
bool findString(const QString& s, LineRef& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive);
void setSelection(int firstLine, int startPos, int lastLine, int endPos);
void setOverviewMode(Overview::e_OverviewMode eOverviewMode);
Overview::e_OverviewMode getOverviewMode();
void slotUpdateAvailabilities(const bool bMergeEditorVisible, const bool m_bTripleDiff);
......@@ -95,12 +96,12 @@ public Q_SLOTS:
void slotUnsolve();
void slotMergeHistory();
void slotRegExpAutoMerge();
void slotSplitDiff( LineIndex firstD3lLineIdx, LineIndex lastD3lLineIdx );
void slotJoinDiffs( LineIndex firstD3lLineIdx, LineIndex lastD3lLineIdx );
void slotSplitDiff(LineIndex firstD3lLineIdx, LineIndex lastD3lLineIdx);
void slotJoinDiffs(LineIndex firstD3lLineIdx, LineIndex lastD3lLineIdx);
void slotSetFastSelectorLine(LineIndex);
void setPaintingAllowed(bool);
void updateSourceMask();
void slotStatusMessageChanged( const QString& );
void slotStatusMessageChanged(const QString&);
void slotChooseAEverywhere() { chooseGlobal(A, false, false); }
void slotChooseBEverywhere() { chooseGlobal(B, false, false); }
......@@ -113,20 +114,20 @@ public Q_SLOTS:
void slotChooseCForUnsolvedWhiteSpaceConflicts() { chooseGlobal(C, true, true); }
Q_SIGNALS:
void scrollMergeResultWindow( int deltaX, int deltaY );
void scrollMergeResultWindow(int deltaX, int deltaY);
void modifiedChanged(bool bModified);
void setFastSelectorRange( LineRef line1, LineCount nofLines );
void sourceMask( int srcMask, int enabledMask );
void setFastSelectorRange(LineRef line1, LineCount nofLines);
void sourceMask(int srcMask, int enabledMask);
void resizeSignal();
void selectionEnd();
void newSelection();
void updateAvailabilities();
void showPopupMenu( const QPoint& point );
void showPopupMenu(const QPoint& point);
void noRelevantChangesDetected();
private:
void merge(bool bAutoSolve, e_SrcSelector defaultSelector, bool bConflictsOnly=false, bool bWhiteSpaceOnly=false );
QString getString( int lineIdx );
void merge(bool bAutoSolve, e_SrcSelector defaultSelector, bool bConflictsOnly = false, bool bWhiteSpaceOnly = false);
QString getString(int lineIdx);
static QAction* chooseAEverywhere;
static QAction* chooseBEverywhere;
......@@ -161,54 +162,56 @@ private:
MergeEditLineList mellA;
MergeEditLineList mellB;
MergeEditLineList mellC;
MergeEditLineList& choice( bool bThreeInputs );
bool staysInPlace( bool bThreeInputs, Diff3LineList::const_iterator& iHistoryEnd );
MergeEditLineList& choice(bool bThreeInputs);
bool staysInPlace(bool bThreeInputs, Diff3LineList::const_iterator& iHistoryEnd);
};
typedef std::map<QString,HistoryMapEntry> HistoryMap;
void collectHistoryInformation( e_SrcSelector src, Diff3LineList::const_iterator &iHistoryBegin, Diff3LineList::const_iterator &iHistoryEnd, HistoryMap& historyMap, std::list< HistoryMap::iterator >& hitList );
typedef std::map<QString, HistoryMapEntry> HistoryMap;
void collectHistoryInformation(e_SrcSelector src, Diff3LineList::const_iterator& iHistoryBegin, Diff3LineList::const_iterator& iHistoryEnd, HistoryMap& historyMap, std::list<HistoryMap::iterator>& hitList);
MergeLineList m_mergeLineList;
MergeLineList::iterator m_currentMergeLineIt;
bool isItAtEnd( bool bIncrement, MergeLineList::iterator i )
bool isItAtEnd(bool bIncrement, MergeLineList::iterator i)
{
if ( bIncrement ) return i!=m_mergeLineList.end();
else return i!=m_mergeLineList.begin();
if(bIncrement)
return i != m_mergeLineList.end();
else
return i != m_mergeLineList.begin();
}
int m_currentPos;
bool checkOverviewIgnore(MergeLineList::iterator &i);
bool checkOverviewIgnore(MergeLineList::iterator& i);
enum e_Direction { eUp, eDown };
enum e_EndPoint { eDelta, eConflict, eUnsolvedConflict, eLine, eEnd };
void go( e_Direction eDir, e_EndPoint eEndPoint );
void go(e_Direction eDir, e_EndPoint eEndPoint);
void calcIteratorFromLineNr(
int line,
MergeLineList::iterator& mlIt,
MergeEditLineList::iterator& melIt
);
MergeLineList::iterator splitAtDiff3LineIdx( int d3lLineIdx );
MergeLineList::iterator splitAtDiff3LineIdx(int d3lLineIdx);
void paintEvent( QPaintEvent* e ) override;
void paintEvent(QPaintEvent* e) override;
int getTextXOffset();
QVector<QTextLayout::FormatRange> getTextLayoutForLine(int line, const QString& s, QTextLayout& textLayout );
QVector<QTextLayout::FormatRange> getTextLayoutForLine(int line, const QString& s, QTextLayout& textLayout);
void myUpdate(int afterMilliSecs);
void timerEvent(QTimerEvent*) override;
void writeLine(
RLPainter& p, int line, const QString& str,
int srcSelect, e_MergeDetails mergeDetails, int rangeMark, bool bUserModified, bool bLineRemoved, bool bWhiteSpaceConflict
);
int srcSelect, e_MergeDetails mergeDetails, int rangeMark, bool bUserModified, bool bLineRemoved, bool bWhiteSpaceConflict
);
void setFastSelector(MergeLineList::iterator i);
LineRef convertToLine( QtNumberType y );
LineRef convertToLine(QtNumberType y);
bool event(QEvent*) override;
void mousePressEvent ( QMouseEvent* e ) override;
void mouseDoubleClickEvent ( QMouseEvent* e ) override;
void mouseReleaseEvent ( QMouseEvent * ) override;
void mouseMoveEvent ( QMouseEvent * ) override;
void resizeEvent( QResizeEvent* e ) override;
void keyPressEvent( QKeyEvent* e ) override;
void wheelEvent( QWheelEvent* e ) override;
void focusInEvent( QFocusEvent* e ) override;
void mousePressEvent(QMouseEvent* e) override;
void mouseDoubleClickEvent(QMouseEvent* e) override;
void mouseReleaseEvent(QMouseEvent*) override;
void mouseMoveEvent(QMouseEvent*) override;
void resizeEvent(QResizeEvent* e) override;
void keyPressEvent(QKeyEvent* e) override;
void wheelEvent(QWheelEvent* e) override;
void focusInEvent(QFocusEvent* e) override;
QPixmap m_pixmap;
LineRef m_firstLine;
......@@ -218,7 +221,7 @@ private:
bool m_bMyUpdate;
bool m_bInsertMode;
bool m_bModified;
void setModified(bool bModified=true);
void setModified(bool bModified = true);
int m_scrollDeltaX;
int m_scrollDeltaY;
......@@ -233,8 +236,8 @@ private:
Selection m_selection;
bool deleteSelection2( QString& str, int& x, int& y,
MergeLineList::iterator& mlIt, MergeEditLineList::iterator& melIt );
bool deleteSelection2(QString& str, int& x, int& y,
MergeLineList::iterator& mlIt, MergeEditLineList::iterator& melIt);
bool doRelevantChangesExist();
public Q_SLOTS:
void deleteSelection();
......@@ -264,19 +267,18 @@ private:
public:
explicit WindowTitleWidget(Options* pOptions);
QTextCodec* getEncoding();
void setFileName(const QString& fileName );
QString getFileName();
void setEncodings( QTextCodec* pCodecForA, QTextCodec* pCodecForB, QTextCodec* pCodecForC );
void setEncoding( QTextCodec* pEncoding );
void setLineEndStyles( e_LineEndStyle eLineEndStyleA, e_LineEndStyle eLineEndStyleB, e_LineEndStyle eLineEndStyleC);
void setFileName(const QString& fileName);
QString getFileName();
void setEncodings(QTextCodec* pCodecForA, QTextCodec* pCodecForB, QTextCodec* pCodecForC);
void setEncoding(QTextCodec* pEncoding);
void setLineEndStyles(e_LineEndStyle eLineEndStyleA, e_LineEndStyle eLineEndStyleB, e_LineEndStyle eLineEndStyleC);
e_LineEndStyle getLineEndStyle();
bool eventFilter( QObject* o, QEvent* e ) override;
bool eventFilter(QObject* o, QEvent* e) override;
public Q_SLOTS:
void slotSetModified( bool bModified );
void slotSetModified(bool bModified);
//private Q_SLOTS:
// void slotBrowseButtonClicked();
};
#endif
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