diff --git a/CMakeLists.txt b/CMakeLists.txt index dabdfc0..b1d72a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,105 +1,105 @@ #cmake < 3.1 has no sane way of checking C++11 features and needed flags cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(kdiff3) set(CMAKE_CXX_EXTENSIONS OFF ) #don't use non-standard extensions set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(ECM_MIN_VERSION "5.10.0") set(QT_MIN_VERSION "5.6.0") set(KF5_MIN_VERSION "5.23.0") find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED) set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings NO_POLICY_SCOPE) include(FeatureSummary) include(ECMInstallIcons) include(ECMAddAppIcon) include(ECMSetupVersion) -ecm_setup_version(1.7.90 VARIABLE_PREFIX KDIFF3 VERSION_HEADER ${CMAKE_BINARY_DIR}/src/version.h) +ecm_setup_version(1.7.95 VARIABLE_PREFIX KDIFF3 VERSION_HEADER ${CMAKE_BINARY_DIR}/src/version.h) find_package( Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets PrintSupport ) find_package( KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n CoreAddons Crash DocTools IconThemes ) set(KDiff3_LIBRARIES ${Qt5PrintSupport_LIBRARIES} KF5::I18n KF5::CoreAddons KF5::Crash KF5::IconThemes ) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") #Adjust clang specific warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow") set(CLANG_WARNING_FLAGS "-Wno-invalid-pp-token -Wno-comment -Wshorten-64-to-32 -Wstring-conversion -Wc++11-narrowing -fstack-protector-all") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_WARNING_FLAGS}") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") add_definitions(-DNOMINMAX) #Suppress MSVCs min/max macros elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-check") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wduplicated-cond -Wduplicated-branches -Wshadow") endif() endif() #new in cmake 3.6+ integrate clang-tidy if(NOT ${CMAKE_VERSION} VERSION_LESS "3.6.0") find_program(CLANG_TIDY_EXE NAMES "clang-tidy" "clang-tidy-7" "clang-tidy-6.0" "clang-tidy-6" DOC "Path to clang-tidy executable") if(NOT CLANG_TIDY_EXE) message(STATUS "clang-tidy not found disabling integration.") else() message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}") set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" "-header-filter=.*") endif() endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") set( needed_features cxx_nullptr cxx_override cxx_nonstatic_member_init cxx_inheriting_constructors ) add_definitions( -DQT_DEPRECATED_WARNINGS #Get warnings from QT about deprecated functions. -DQT_NO_URL_CAST_FROM_STRING #implict casting from string to url does not always behave as you might think -DQT_RESTRICTED_CAST_FROM_ASCII #casting from char*/QByteArray to QString can produce unexpected results for non-latin characters. ) add_subdirectory(src) add_subdirectory(doc) add_subdirectory(kdiff3fileitemactionplugin) ki18n_install(po) kdoctools_install(po) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/diff.h b/src/diff.h index 7b147d2..e5708a0 100644 --- a/src/diff.h +++ b/src/diff.h @@ -1,449 +1,449 @@ /*************************************************************************** diff.h - description ------------------- begin : Mon Mar 18 2002 copyright : (C) 2002-2007 by Joachim Eibl email : joachim.eibl at gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef DIFF_H #define DIFF_H #include #include #include #include #include "common.h" #include "fileaccess.h" #include "options.h" #include "gnudiff_diff.h" // Each range with matching elements is followed by a range with differences on either side. // Then again range of matching elements should follow. struct Diff { LineRef nofEquals; qint64 diff1; qint64 diff2; Diff(LineRef eq, qint64 d1, qint64 d2){nofEquals=eq; diff1=d1; diff2=d2; } }; typedef std::list DiffList; struct LineData { const QChar* pLine; const QChar* pFirstNonWhiteChar; int size; LineData(){ pLine=nullptr; pFirstNonWhiteChar=nullptr; size=0; /*occurrences=0;*/ bContainsPureComment=false; } int width(int tabSize) const; // Calcs width considering tabs. //int occurrences; bool whiteLine() const { return pFirstNonWhiteChar-pLine == size; } bool bContainsPureComment; }; class Diff3LineList; class Diff3LineVector; struct DiffBufferInfo { const LineData* m_pLineDataA; const LineData* m_pLineDataB; const LineData* m_pLineDataC; LineRef m_sizeA; LineRef m_sizeB; LineRef m_sizeC; const Diff3LineList* m_pDiff3LineList; const Diff3LineVector* m_pDiff3LineVector; void init( Diff3LineList* d3ll, const Diff3LineVector* d3lv, const LineData* pldA, LineRef sizeA, const LineData* pldB, LineRef sizeB, const LineData* pldC, LineRef sizeC ); }; struct Diff3Line { - LineRef lineA; - LineRef lineB; - LineRef lineC; + LineRef lineA = -1; + LineRef lineB = -1; + LineRef lineC = -1; bool bAEqC : 1; // These are true if equal or only white-space changes exist. bool bBEqC : 1; bool bAEqB : 1; bool bWhiteLineA : 1; bool bWhiteLineB : 1; bool bWhiteLineC : 1; DiffList* pFineAB; // These are 0 only if completely equal or if either source doesn't exist. DiffList* pFineBC; DiffList* pFineCA; int linesNeededForDisplay; // Due to wordwrap int sumLinesNeededForDisplay; // For fast conversion to m_diff3WrapLineVector DiffBufferInfo* m_pDiffBufferInfo; // For convenience Diff3Line() { lineA=-1; lineB=-1; lineC=-1; bAEqC=false; bAEqB=false; bBEqC=false; pFineAB=nullptr; pFineBC=nullptr; pFineCA=nullptr; linesNeededForDisplay=1; sumLinesNeededForDisplay=0; bWhiteLineA=false; bWhiteLineB=false; bWhiteLineC=false; m_pDiffBufferInfo=nullptr; } ~Diff3Line() { if (pFineAB!=nullptr) delete pFineAB; if (pFineBC!=nullptr) delete pFineBC; if (pFineCA!=nullptr) delete pFineCA; pFineAB=nullptr; pFineBC=nullptr; pFineCA=nullptr; } bool operator==( const Diff3Line& d3l ) const { return lineA == d3l.lineA && lineB == d3l.lineB && lineC == d3l.lineC && bAEqB == d3l.bAEqB && bAEqC == d3l.bAEqC && bBEqC == d3l.bBEqC; } const LineData* getLineData( int src ) const { Q_ASSERT( m_pDiffBufferInfo!=nullptr ); if ( src == 1 && lineA >= 0 ) return &m_pDiffBufferInfo->m_pLineDataA[lineA]; if ( src == 2 && lineB >= 0 ) return &m_pDiffBufferInfo->m_pLineDataB[lineB]; if ( src == 3 && lineC >= 0 ) return &m_pDiffBufferInfo->m_pLineDataC[lineC]; return nullptr; } QString getString( int src ) const { const LineData* pld = getLineData(src); if ( pld ) return QString( pld->pLine, pld->size); else return QString(); } LineRef getLineInFile( int src ) const { if ( src == 1 ) return lineA; if ( src == 2 ) return lineB; if ( src == 3 ) return lineC; return -1; } }; class Diff3LineList : public QLinkedList { }; class Diff3LineVector : public QVector { }; class Diff3WrapLine { public: Diff3Line* pD3L; int diff3LineIndex; int wrapLineOffset; int wrapLineLength; }; typedef QVector Diff3WrapLineVector; class TotalDiffStatus { public: TotalDiffStatus(){ reset(); } inline void reset() {bBinaryAEqC=false; bBinaryBEqC=false; bBinaryAEqB=false; bTextAEqC=false; bTextBEqC=false; bTextAEqB=false; nofUnsolvedConflicts=0; nofSolvedConflicts=0; nofWhitespaceConflicts=0; } inline int getUnsolvedConflicts() const { return nofUnsolvedConflicts; } inline void setUnsolvedConflicts(const int unsolved) { nofUnsolvedConflicts = unsolved; } inline int getSolvedConflicts() const { return nofSolvedConflicts; } inline void setSolvedConflicts(const int solved) { nofSolvedConflicts = solved; } inline int getWhitespaceConflicts() const { return nofWhitespaceConflicts; } inline void setWhitespaceConflicts(const int wintespace) { nofWhitespaceConflicts = wintespace; } bool isBinaryEqualAC() const { return bBinaryAEqC; } bool isBinaryEqualBC() const { return bBinaryBEqC; } bool isBinaryEqualAB() const { return bBinaryAEqB; } bool bBinaryAEqC = false; bool bBinaryBEqC = false; bool bBinaryAEqB = false; bool bTextAEqC = false; bool bTextBEqC = false; bool bTextAEqB = false; private: int nofUnsolvedConflicts; int nofSolvedConflicts; int nofWhitespaceConflicts; }; // Three corresponding ranges. (Minimum size of a valid range is one line.) class ManualDiffHelpEntry { public: ManualDiffHelpEntry() { lineA1=-1; lineA2=-1; lineB1=-1; lineB2=-1; lineC1=-1; lineC2=-1; } LineRef lineA1; LineRef lineA2; LineRef lineB1; LineRef lineB2; LineRef lineC1; LineRef lineC2; LineRef& firstLine( int winIdx ) { return winIdx==1 ? lineA1 : (winIdx==2 ? lineB1 : lineC1 ); } LineRef& lastLine( int winIdx ) { return winIdx==1 ? lineA2 : (winIdx==2 ? lineB2 : lineC2 ); } bool isLineInRange( LineRef line, int winIdx ) { return line>=0 && line>=firstLine(winIdx) && line<=lastLine(winIdx); } bool operator==(const ManualDiffHelpEntry& r) const { return lineA1 == r.lineA1 && lineB1 == r.lineB1 && lineC1 == r.lineC1 && lineA2 == r.lineA2 && lineB2 == r.lineB2 && lineC2 == r.lineC2; } }; // A list of corresponding ranges typedef std::list ManualDiffHelpList; void calcDiff3LineListUsingAB( const DiffList* pDiffListAB, Diff3LineList& d3ll ); void calcDiff3LineListUsingAC( const DiffList* pDiffListAC, Diff3LineList& d3ll ); void calcDiff3LineListUsingBC( const DiffList* pDiffListBC, Diff3LineList& d3ll ); void correctManualDiffAlignment( Diff3LineList& d3ll, ManualDiffHelpList* pManualDiffHelpList ); class SourceData { public: SourceData(); ~SourceData(); void setOptions( Options* pOptions ); LineRef getSizeLines() const; qint64 getSizeBytes() const; const char* getBuf() const; const QString& getText() const; const LineData* getLineDataForDisplay() const; const LineData* getLineDataForDiff() const; void setFilename(const QString& filename); void setFileAccess( const FileAccess& fileAccess ); void setEncoding(QTextCodec* pEncoding); //FileAccess& getFileAccess(); QString getFilename(); void setAliasName(const QString& name); QString getAliasName(); bool isEmpty(); // File was set bool hasData(); // Data was readable bool isText(); // is it pure text (vs. binary data) bool isIncompleteConversion(); // true if some replacement characters were found bool isFromBuffer(); // was it set via setData() (vs. setFileAccess() or setFilename()) QStringList setData( const QString& data ); bool isValid(); // Either no file is specified or reading was successful // Returns a list of error messages if anything went wrong QStringList readAndPreprocess(QTextCodec* pEncoding, bool bAutoDetectUnicode ); bool saveNormalDataAs( const QString& fileName ); bool isBinaryEqualWith( const SourceData& other ) const; void reset(); QTextCodec* getEncoding() const { return m_pEncoding; } e_LineEndStyle getLineEndStyle() const { return m_normalData.m_eLineEndStyle; } private: QTextCodec* detectEncoding( const QString& fileName, QTextCodec* pFallbackCodec ); QString m_aliasName; FileAccess m_fileAccess; Options* m_pOptions; QString m_tempInputFileName; QTemporaryFile m_tempFile;//Created from clipboard content. struct FileData { FileData(){ m_pBuf=nullptr; m_size=0; m_vSize=0; m_bIsText=false; m_eLineEndStyle=eLineEndStyleUndefined; m_bIncompleteConversion=false;} ~FileData(){ reset(); } const char* m_pBuf; qint64 m_size; qint64 m_vSize; // Nr of lines in m_pBuf1 and size of m_v1, m_dv12 and m_dv13 QString m_unicodeBuf; QVector m_v; bool m_bIsText; bool m_bIncompleteConversion; e_LineEndStyle m_eLineEndStyle; bool readFile( const QString& filename ); bool writeFile( const QString& filename ); bool preprocess(bool bPreserveCR, QTextCodec* pEncoding ); void reset(); void removeComments(); void copyBufFrom( const FileData& src ); void checkLineForComments( const QChar* p, // pointer to start of buffer int& i, // index of current position (in, out) int size, // size of buffer bool& bWhite, // false if this line contains nonwhite characters (in, out) bool& bCommentInLine, // true if any comment is within this line (in, out) bool& bStartsOpenComment // true if the line ends within an comment (out) ); }; FileData m_normalData; FileData m_lmppData; QTextCodec* m_pEncoding; }; void calcDiff3LineListTrim( Diff3LineList& d3ll, const LineData* pldA, const LineData* pldB, const LineData* pldC, ManualDiffHelpList* pManualDiffHelpList ); void calcWhiteDiff3Lines( Diff3LineList& d3ll, const LineData* pldA, const LineData* pldB, const LineData* pldC ); void calcDiff3LineVector( Diff3LineList& d3ll, Diff3LineVector& d3lv ); // Helper class that swaps left and right for some commands. class MyPainter : public QPainter { int m_factor; int m_xOffset; int m_fontWidth; public: MyPainter(QPaintDevice* pd, bool bRTL, int width, int fontWidth) : QPainter(pd) { if (bRTL) { m_fontWidth = fontWidth; m_factor = -1; m_xOffset = width-1; } else { m_fontWidth = 0; m_factor = 1; m_xOffset = 0; } } void fillRect( int x, int y, int w, int h, const QBrush& b ) { if (m_factor==1) QPainter::fillRect( m_xOffset + x , y, w, h, b ); else QPainter::fillRect( m_xOffset - x - w, y, w, h, b ); } void drawText( int x, int y, const QString& s, bool bAdapt=false ) { Qt::LayoutDirection ld = (m_factor==1 || !bAdapt) ? Qt::LeftToRight : Qt::RightToLeft; //QPainter::setLayoutDirection( ld ); if ( ld==Qt::RightToLeft ) // Reverse the text { QString s2; for( int i=s.length()-1; i>=0; --i ) { s2 += s[i]; } QPainter::drawText( m_xOffset-m_fontWidth*s.length() + m_factor*x, y, s2 ); return; } QPainter::drawText( m_xOffset-m_fontWidth*s.length() + m_factor*x, y, s ); } void drawLine( int x1, int y1, int x2, int y2 ) { QPainter::drawLine( m_xOffset + m_factor*x1, y1, m_xOffset + m_factor*x2, y2 ); } }; bool runDiff( const LineData* p1, LineRef size1, const LineData* p2, LineRef size2, DiffList& diffList, int winIdx1, int winIdx2, ManualDiffHelpList *pManualDiffHelpList, Options *pOptions); bool fineDiff( Diff3LineList& diff3LineList, int selector, const LineData* v1, const LineData* v2 ); bool equal( const LineData& l1, const LineData& l2, bool bStrict ); inline bool isWhite( QChar c ) { return c==' ' || c=='\t' || c=='\r'; } /** Returns the number of equivalent spaces at position outPos. */ inline int tabber( int outPos, int tabSize ) { return tabSize - ( outPos % tabSize ); } /** Returns a line number where the linerange [line, line+nofLines] can be displayed best. If it fits into the currently visible range then the returned value is the current firstLine. */ int getBestFirstLine( int line, int nofLines, int firstLine, int visibleLines ); extern bool g_bIgnoreWhiteSpace; extern bool g_bIgnoreTrivialMatches; extern int g_bAutoSolve; // Cursor conversions that consider g_tabSize. int convertToPosInText( const QString& s, int posOnScreen, int tabSize ); int convertToPosOnScreen( const QString& s, int posInText, int tabSize ); enum e_CoordType { eFileCoords, eD3LLineCoords, eWrapCoords }; void calcTokenPos( const QString&, int posOnScreen, int& pos1, int& pos2, int tabSize ); QString calcHistorySortKey( const QString& keyOrder, QRegExp& matchedRegExpr, const QStringList& parenthesesGroupList ); bool findParenthesesGroups( const QString& s, QStringList& sl ); #endif diff --git a/windows_installer/kdiff3.nsi b/windows_installer/kdiff3.nsi index 248f08d..bf7b74b 100644 --- a/windows_installer/kdiff3.nsi +++ b/windows_installer/kdiff3.nsi @@ -1,515 +1,515 @@ ;KDiff3-NSIS configuration ;Based on Modern User Interface example files ;Apdapted for KDiff3 by Sebastien Fricker and Joachim Eibl ;Requires nsis_v2.19 -!define KDIFF3_VERSION "1.07.90" +!define KDIFF3_VERSION "1.07.95" !define DIFF_EXT32_CLSID "{9F8528E4-AB20-456E-84E5-3CE69D8720F3}" !define DIFF_EXT64_CLSID "{34471FFB-4002-438b-8952-E4588D0C0FE9}" !ifdef KDIFF3_64BIT !define BITS 64 !else !define BITS 32 !endif !define SetupFileName "KDiff3-${BITS}bit-Setup_${KDIFF3_VERSION}.exe" ;-------------------------------- ;Include Modern UI !include "MUI.nsh" !include "x64.nsh" ;-------------------------------- ;General ;Name and file Name "KDiff3" OutFile ${SetupFileName} ;Default installation folder !ifdef KDIFF3_64BIT ;SetRegView 64 InstallDir "$PROGRAMFILES64\KDiff3" !else InstallDir "$PROGRAMFILES\KDiff3" !endif ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\KDiff3" "" !addplugindir ".\nsisplugins" ;-------------------------------- ;Variables Var MUI_TEMP Var STARTMENU_FOLDER Var DIFF_EXT_CLSID Var DIFF_EXT_ID Var DIFF_EXT_DLL Var DIFF_EXT_OLD_DLL ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "kdiff3.bmp" ; optional ;-------------------------------- ;Language Selection Dialog Settings ;Remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" !define MUI_LANGDLL_REGISTRY_KEY "Software\KDiff3" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" ;-------------------------------- ;Pages ;!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE $(MUILicense) !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY Page custom CustomPageC ;Start Menu Folder Page Configuration !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\KDiff3" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_RUN KDiff3.exe !define MUI_FINISHPAGE_RUN_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME README_WIN.txt !define MUI_FINISHPAGE_SHOWREADME_CHECKED !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" # first language is the default language !insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "SimpChinese" !insertmacro MUI_LANGUAGE "TradChinese" !insertmacro MUI_LANGUAGE "Japanese" !insertmacro MUI_LANGUAGE "Korean" !insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "Danish" !insertmacro MUI_LANGUAGE "Swedish" !insertmacro MUI_LANGUAGE "Norwegian" !insertmacro MUI_LANGUAGE "Finnish" !insertmacro MUI_LANGUAGE "Greek" !insertmacro MUI_LANGUAGE "Russian" !insertmacro MUI_LANGUAGE "Portuguese" !insertmacro MUI_LANGUAGE "PortugueseBR" !insertmacro MUI_LANGUAGE "Polish" !insertmacro MUI_LANGUAGE "Ukrainian" !insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "Slovak" !insertmacro MUI_LANGUAGE "Croatian" !insertmacro MUI_LANGUAGE "Bulgarian" !insertmacro MUI_LANGUAGE "Hungarian" !insertmacro MUI_LANGUAGE "Thai" !insertmacro MUI_LANGUAGE "Romanian" !insertmacro MUI_LANGUAGE "Latvian" !insertmacro MUI_LANGUAGE "Macedonian" !insertmacro MUI_LANGUAGE "Estonian" !insertmacro MUI_LANGUAGE "Turkish" !insertmacro MUI_LANGUAGE "Lithuanian" !insertmacro MUI_LANGUAGE "Catalan" !insertmacro MUI_LANGUAGE "Slovenian" !insertmacro MUI_LANGUAGE "Serbian" !insertmacro MUI_LANGUAGE "SerbianLatin" !insertmacro MUI_LANGUAGE "Arabic" !insertmacro MUI_LANGUAGE "Farsi" !insertmacro MUI_LANGUAGE "Hebrew" !insertmacro MUI_LANGUAGE "Indonesian" !insertmacro MUI_LANGUAGE "Mongolian" !insertmacro MUI_LANGUAGE "Luxembourgish" !insertmacro MUI_LANGUAGE "Albanian" !insertmacro MUI_LANGUAGE "Breton" !insertmacro MUI_LANGUAGE "Belarusian" !insertmacro MUI_LANGUAGE "Icelandic" !insertmacro MUI_LANGUAGE "Malay" !insertmacro MUI_LANGUAGE "Bosnian" !insertmacro MUI_LANGUAGE "Kurdish" ;-------------------------------- ;License Language String LicenseLangString MUILicense ${LANG_ENGLISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_FRENCH} "COPYING.txt" LicenseLangString MUILicense ${LANG_GERMAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_SPANISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_SIMPCHINESE} "COPYING.txt" LicenseLangString MUILicense ${LANG_TRADCHINESE} "COPYING.txt" LicenseLangString MUILicense ${LANG_JAPANESE} "COPYING.txt" LicenseLangString MUILicense ${LANG_KOREAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_ITALIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_DUTCH} "COPYING.txt" LicenseLangString MUILicense ${LANG_DANISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_SWEDISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_NORWEGIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_FINNISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_GREEK} "COPYING.txt" LicenseLangString MUILicense ${LANG_RUSSIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_PORTUGUESE} "COPYING.txt" LicenseLangString MUILicense ${LANG_PORTUGUESEBR} "COPYING.txt" LicenseLangString MUILicense ${LANG_POLISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_UKRAINIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_CZECH} "COPYING.txt" LicenseLangString MUILicense ${LANG_SLOVAK} "COPYING.txt" LicenseLangString MUILicense ${LANG_CROATIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_BULGARIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_HUNGARIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_THAI} "COPYING.txt" LicenseLangString MUILicense ${LANG_ROMANIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_LATVIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_MACEDONIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_ESTONIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_TURKISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_LITHUANIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_CATALAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_SLOVENIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_SERBIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_SERBIANLATIN} "COPYING.txt" LicenseLangString MUILicense ${LANG_ARABIC} "COPYING.txt" LicenseLangString MUILicense ${LANG_FARSI} "COPYING.txt" LicenseLangString MUILicense ${LANG_HEBREW} "COPYING.txt" LicenseLangString MUILicense ${LANG_INDONESIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_MONGOLIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_LUXEMBOURGISH} "COPYING.txt" LicenseLangString MUILicense ${LANG_ALBANIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_BRETON} "COPYING.txt" LicenseLangString MUILicense ${LANG_BELARUSIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_ICELANDIC} "COPYING.txt" LicenseLangString MUILicense ${LANG_MALAY} "COPYING.txt" LicenseLangString MUILicense ${LANG_BOSNIAN} "COPYING.txt" LicenseLangString MUILicense ${LANG_KURDISH} "COPYING.txt" ;-------------------------------- ;Reserve Files ;These files should be inserted before other files in the data block ;Keep these lines before any File command ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) !insertmacro MUI_RESERVEFILE_LANGDLL ReserveFile "installForAllUsersPage.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;-------------------------------- ;Variables Var INSTALL_FOR_ALL_USERS ;-------------------------------- ;Installer Sections Section "Software" SecSoftware SectionIn RO ;Read a value from an InstallOptions INI file !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_FOR_ALL_USERS "installForAllUsersPage.ini" "Field 2" "State" ;Set ShellVarContext: Defines if SHCTX points to HKLM or HKCU StrCmp $INSTALL_FOR_ALL_USERS "0" "" +3 SetShellVarContext current Goto +2 SetShellVarContext all WriteRegStr HKCU "Software\KDiff3" "InstalledForAllUsers" "$INSTALL_FOR_ALL_USERS" ; Make the KDiff3 uninstaller visible via "System Settings: Add or Remove Programs", (Systemsteuerung/Software) WriteRegStr SHCTX "Software\KDiff3" "" "$INSTDIR" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\KDiff3" "DisplayName" "KDiff3 (remove only)" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\KDiff3" "UninstallString" '"$INSTDIR\Uninstall.exe"' SetOutPath "$INSTDIR" ;ADD YOUR OWN FILES HERE... DetailPrint "Writing files" File "${BITS}bit\kdiff3.exe" File "${BITS}bit\kdiff3.exe.manifest" File "${BITS}bit\qt.conf" File "COPYING.txt" File "Readme_Win.txt" File "ChangeLog.txt" SetOutPath "$INSTDIR\bin" File /r "${BITS}bit\bin\*.*" SetOutPath "$INSTDIR" Delete "$INSTDIR\kdiff3-QT4.exe" ;Store installation folder WriteRegStr HKCU "Software\KDiff3" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Create shortcuts CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\KDiff3.lnk" "$INSTDIR\kdiff3.exe" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Readme.lnk" "$INSTDIR\Readme_Win.txt" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GPL.lnk" "$INSTDIR\Copying.txt" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$QUICKLAUNCH\KDiff3.lnk" "$INSTDIR\kdiff3.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Section "Documentation" SecDocumentation DetailPrint "Writing the documentation" SetOutPath "$INSTDIR" File /r doc CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Documentation.lnk" "$INSTDIR\doc\index.html" SectionEnd Section "Translations" SecTranslations DetailPrint "Writing the translation messages" SetOutPath "$INSTDIR" File /r translations SectionEnd Section "Utilities" SecUtilities DetailPrint "Writing the command line utilities (GNU sed, diff, diff3, etc.)" SetOutPath "$INSTDIR\bin" File /r "bin\*.*" SectionEnd SubSection "Integration" SecIntegration Section "Explorer" SecIntegrationExplorer DetailPrint "Integration to Explorer" ; WriteRegStr HKCR "Directory\shell\KDiff3" "" '&KDiff3' ; WriteRegStr HKCR "Directory\shell\KDiff3\command" "" '"$INSTDIR\kdiff3.exe" "%1"' CreateShortCut "$SENDTO\KDiff3.lnk" '"$INSTDIR\kdiff3.exe"' SectionEnd Section "Diff-Ext" SecIntegrationDiffExtForKDiff3 DetailPrint "Diff-Ext for KDiff3" SetOutPath "$INSTDIR" ${If} ${RunningX64} StrCpy $DIFF_EXT_CLSID ${DIFF_EXT64_CLSID} StrCpy $DIFF_EXT_DLL "diff_ext_for_kdiff3_64.dll" StrCpy $DIFF_EXT_OLD_DLL "diff_ext_for_kdiff3_64_old.dll" StrCpy $DIFF_EXT_ID "diff-ext-for-kdiff3-64" IfFileExists "$INSTDIR\$DIFF_EXT_OLD_DLL" 0 +2 Delete "$INSTDIR\$DIFF_EXT_OLD_DLL" IfFileExists "$INSTDIR\$DIFF_EXT_DLL" 0 +2 Rename "$INSTDIR\$DIFF_EXT_DLL" "$INSTDIR\$DIFF_EXT_OLD_DLL" File "64bit\diff_ext_for_kdiff3_64.dll" SetRegView 64 WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID" "" "$DIFF_EXT_ID" WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" "" "$INSTDIR\$DIFF_EXT_DLL" WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" "ThreadingModel" "Apartment" WriteRegStr SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID" "$DIFF_EXT_ID" WriteRegStr SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" WriteRegStr SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" SetRegView 32 ${EndIf} StrCpy $DIFF_EXT_CLSID ${DIFF_EXT32_CLSID} StrCpy $DIFF_EXT_DLL "diff_ext_for_kdiff3.dll" StrCpy $DIFF_EXT_OLD_DLL "diff_ext_for_kdiff3_old.dll" StrCpy $DIFF_EXT_ID "diff-ext-for-kdiff3" IfFileExists "$INSTDIR\$DIFF_EXT_OLD_DLL" 0 +2 Delete "$INSTDIR\$DIFF_EXT_OLD_DLL" IfFileExists "$INSTDIR\$DIFF_EXT_DLL" 0 +2 Rename "$INSTDIR\$DIFF_EXT_DLL" "$INSTDIR\$DIFF_EXT_OLD_DLL" File "32bit\diff_ext_for_kdiff3.dll" SetRegView 64 WriteRegStr HKCU "Software\KDiff3\diff-ext" "" "" WriteRegStr SHCTX "Software\KDiff3\diff-ext" "InstallDir" "$INSTDIR" WriteRegStr SHCTX "Software\KDiff3\diff-ext" "diffcommand" "$INSTDIR\kdiff3.exe" SetRegView 32 WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID" "" "$DIFF_EXT_ID" WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" "" "$INSTDIR\$DIFF_EXT_DLL" WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" "ThreadingModel" "Apartment" WriteRegStr SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID" "$DIFF_EXT_ID" WriteRegStr SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" WriteRegStr SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\$DIFF_EXT_ID" "" "$DIFF_EXT_CLSID" File "DIFF-EXT-LICENSE.txt" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Diff-Ext License.lnk" "$INSTDIR\DIFF-EXT-LICENSE.txt" SectionEnd Section "WinCVS" SecIntegrationWinCVS DetailPrint "Integration to WinCVS" #MessageBox MB_OK "If WinCVS is running, please close it before proceeding." WriteRegStr HKCU "Software\WinCvs\wincvs\CVS settings" "P_Extdiff" '$INSTDIR\kdiff3.exe' WriteRegBin HKCU "Software\WinCvs\wincvs\CVS settings" "P_DiffUseExtDiff" 01 SectionEnd Section "TortoiseSVN" SecIntegrationTortoiseSVN DetailPrint "Integration to TortoiseSVN" WriteRegStr HKCU "Software\TortoiseSVN\" "Diff" '$INSTDIR\kdiff3.exe %base %mine --L1 Base --L2 Mine' WriteRegStr HKCU "Software\TortoiseSVN\" "Merge" '$INSTDIR\kdiff3.exe %base %mine %theirs -o %merged --L1 Base --L2 Mine --L3 Theirs' SectionEnd Section /o "SVN Merge tool" SecIntegrationSubversionDiff3Cmd DetailPrint "Integrate diff3_cmd.bat for Subversion" File "diff3_cmd.bat" CreateDirectory '$APPDATA\Subversion' CopyFiles '$INSTDIR\diff3_cmd.bat' '$APPDATA\Subversion' SectionEnd SubSectionEnd ;-------------------------------- ;Installer Functions Function .onInit !insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installForAllUsersPage.ini" FunctionEnd Function CustomPageC !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "installForAllUsersPage.ini" FunctionEnd ;-------------------------------- ;Descriptions ;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGUAGE SPECIFIC ;Assign descriptions to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecSoftware} "Main program." !insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} "English documentation in HTML-format (Docs for other languages are available on the homepage.)" !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} "Translations for visible strings in many languages. Not needed for US-English." !insertmacro MUI_DESCRIPTION_TEXT ${SecUtilities} "Command Line Utilities: GNU sed, diff, diff3, etc. precompiled for Windows" !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegration} "Integrate KDiff3 with certain programs. (See also the Readme for details.)" !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationExplorer} "Integrate KDiff3 with Explorer. Adds an entry for KDiff3 in the Send-To context menu." !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationDiffExtForKDiff3} "Installs Diff-Ext by Sergey Zorin. Adds entries for KDiff3 in Explorer context menu." !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationWinCVS} "Integrate KDiff3 with WinCVS. (Please close WinCVS before proceeding.)" !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationTortoiseSVN} "Integrate KDiff3 with TortoiseSVN." !insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationSubversionDiff3Cmd} "Install diff3_cmd.bat for Subversion merge" !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" ReadRegStr $INSTALL_FOR_ALL_USERS HKCU "Software\KDiff3" "InstalledForAllUsers" ;Set ShellVarContext: Defines if SHCTX points to HKLM or HKCU StrCmp $INSTALL_FOR_ALL_USERS "0" "" +3 SetShellVarContext current Goto +2 SetShellVarContext all Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\kdiff3.exe" Delete "$INSTDIR\kdiff3.exe.manifest" Delete "$INSTDIR\qt.conf" Delete "$INSTDIR\COPYING.txt" Delete "$INSTDIR\Readme_Win.txt" Delete "$INSTDIR\ChangeLog.txt" Delete "$INSTDIR\diff_ext_for_kdiff3.dll" Delete "$INSTDIR\diff_ext_for_kdiff3_old.dll" Delete "$INSTDIR\diff_ext_for_kdiff3_64.dll" Delete "$INSTDIR\diff_ext_for_kdiff3_64_old.dll" Delete "$INSTDIR\DIFF-EXT-LICENSE.txt" RMDir /r "$INSTDIR\doc" RMDir /r "$INSTDIR\translations" RMDir /r "$INSTDIR\bin" RMDir "$INSTDIR" # without /r the dir is only removed if completely empty !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\KDiff3.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\KDiff3-Qt4.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\Readme.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\GPL.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\Diff-Ext License.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\Documentation.lnk" Delete "$QUICKLAUNCH\KDiff3.lnk" Delete "$SENDTO\KDiff3.lnk" ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" startMenuDeleteLoop: ClearErrors RMDir $MUI_TEMP GetFullPathName $MUI_TEMP "$MUI_TEMP\.." IfErrors startMenuDeleteLoopDone StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: DeleteRegKey HKCU "Software\KDiff3" DeleteRegKey SHCTX "Software\KDiff3" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\KDiff3" ; diff_ext_for_kdiff3 ${If} ${RunningX64} StrCpy $DIFF_EXT_CLSID ${DIFF_EXT64_CLSID} StrCpy $DIFF_EXT_ID "diff-ext-for-kdiff3-64" SetRegView 64 DeleteRegKey SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID" DeleteRegKey SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegKey SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegKey SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID" SetRegView 32 ${EndIf} StrCpy $DIFF_EXT_CLSID ${DIFF_EXT32_CLSID} StrCpy $DIFF_EXT_ID "diff-ext-for-kdiff3" DeleteRegKey SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID" DeleteRegKey SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegKey SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegKey SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\$DIFF_EXT_ID" DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID" SectionEnd ;-------------------------------- ;Uninstaller Functions Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd