Mercurial > hg > easyhg-kdiff3
changeset 53:32d5cbf9db71
Corrections for 0.9.81:
- Fix for configure --enable-final
- Bugfixes
- First steps towards internationalisation
line wrap: on
line diff
--- a/kdiff3/ChangeLog Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/ChangeLog Tue Jan 20 20:19:59 2004 +0000 @@ -1,3 +1,15 @@ +Version 0.9.81 - 2004/01/08 +=========================== +- Allow to compile with --enable-final +- Bugfix for 3 file-compare (and A or B don't exist, crashed) +- Bugfix for crash when second directory is merged +- Some keyboard-shortcuts for selection of merge-operation didn't work correctly. +- Shortcuts Ctrl-1/2/3 are possible in textmergewindow and in dirmergewindow, + depending on the focus. +- First steps towards internationalisation +- Manpage doc/en/kdiff3.1 by Eike Sauer (for Debian) +- Directory rescan shortcut SHIFT-F5 + Version 0.9.80 - 2003/12/08 =========================== New Text Diff/Merge Features:
--- a/kdiff3/README Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/README Tue Jan 20 20:19:59 2004 +0000 @@ -3,16 +3,19 @@ Author: Joachim Eibl (joachim.eibl@gmx.de) Copyright: (C) 2002-2003 by Joachim Eibl -KDiff3-Version: 0.9.80 +KDiff3-Version: 0.9.81 KDiff3 is a program that -- compares two or three input files, +- compares and merges two or three input files or directories, - shows the differences line by line and character by character (!), - provides an automatic merge-facility and - an integrated editor for comfortable solving of merge-conflicts -- and has an intuitive graphical user interface, -- and allows directory comparison and merge. +- has support for KDE-KIO (ftp, sftp, http, fish, smb) +- and has an intuitive graphical user interface. + + +Do you want help translating? Read the README in the po-subdirectory! Licence: @@ -42,19 +45,19 @@ Requirements & Installation: - Version 0.9.80 provides special support for KDE3, but it can also be + Version 0.9.81 provides special support for KDE3, but it can also be built without KDE3 if the Qt-libraries are available. (I also tested the program under Windows.) You always need - - kdiff3-0.9.80.tar.gz + - kdiff3-0.9.81.tar.gz For building the KDE3-version - KDE>=3.1 and QT>=3.1-libraries. - gcc, g++ with version >=3.2 For building the Qt-only-version - - QT-libraries (version 2.3.0 or >=3.1.0). + - QT-libraries (version >=3.1.0). (www.trolltech.com) - for Un*x: gcc, g++ with version >=3.2 - for Windows: VC6 @@ -64,7 +67,7 @@ - Make sure your shell-variable QTDIR is correct. (echo $QTDIR). If it doesn't contain the correct path, type export QTDIR=your_path_to_qt (e.g. /usr/lib/qt3) - - cd into the directory kdiff3-0.9.80 and type + - cd into the directory kdiff3-0.9.81 and type - ./configure --prefix=/opt/kde3 (your KDE3 directory here) - (make clean) (Required if you already compiled once.) - make (Run compilation) @@ -87,13 +90,22 @@ executable. To avoid confusion, better remove the local version then. (rm -R `find $KDEHOME -name "*kdiff3*" -not -name "kdiff3*rc"`) +Upgrading KDiff3 for KDE: + If you already installed an older version or KDiff3 and you have the + impression, that the new version doesn't work as described, you should try to + remove all files belonging to KDiff3 before reinstalling. + Try this search command to locate KDiff3-related files: + find $HOME/.kde /usr /opt -iname "*kdiff3*" + (Will take a few minutes.) + + Installation for the Qt-only-platforms for Un*x: (for Qt >=3.1.0) - Make sure your shell-variable QTDIR is correct. (echo $QTDIR). If it doesn't contain the correct path, type export QTDIR=your_path_to_qt (e.g. /usr/lib/qt) - - cd into the directory kdiff3-0.9.80/src and type + - cd into the directory kdiff3-0.9.81/src and type - make -f Makefile.qt - make -f Makefile.qt install (You must have root-rights for this step.) (copies the files into /usr/local/bin and /usr/local/share/doc/kdiff3) @@ -103,17 +115,7 @@ Build for Windows: - (Qt 2.3-non commercial) - - Start some console. - - Make sure your shell-variable QTDIR is correct. (echo %QTDIR%). - If it doesn't contain the correct path, type - set QTDIR=your_path_to_qt (e.g. c:\qt) - - Make sure your VC6 environment variables are set. Run VCVARS32.BAT. - (Typically located in "c:\programs\Microsoft Visual Studio\VC98\bin") - - cd into the directory kdiff3-0.9.80\src and type - - nmake /f Makefile.win_qt230 - - For execution the Qt-DLL must be in the path or in the same directory. - For newer versions of Qt, use qmake and kdiff3.pro to generate + Use qmake and kdiff3.pro to generate an appropriate Makefile. qmake kdiff3.pro -o Makefile @@ -124,7 +126,7 @@ - qmake kdiff3.pro -o Makefile - If you succeed, I'd like to know how so I can document it here. - + Start from commandline: - Comparing 2 files: kdiff3 file1 file2 - Merging 2 files: kdiff3 file1 file2 -o outputfile
--- a/kdiff3/doc/Makefile.am Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/doc/Makefile.am Tue Jan 20 20:19:59 2004 +0000 @@ -1,6 +1,6 @@ -####### kdevelop will overwrite this part!!! (begin)########## +# the SUBDIRS is filled automatically by am_edit. If files are +# in this directory they are installed into the english dir -SUBDIRS = en - -####### kdevelop will overwrite this part!!! (end)############ - +KDE_LANG = en +KDE_DOCS = kdiff3 +SUBDIRS = $(AUTODIRS)
--- a/kdiff3/doc/en/Makefile.am Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/doc/en/Makefile.am Tue Jan 20 20:19:59 2004 +0000 @@ -1,2 +1,5 @@ KDE_DOCS = kdiff3 KDE_LANG = en +man1_MANS=kdiff3.1 + +
--- a/kdiff3/po/Makefile.am Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/po/Makefile.am Tue Jan 20 20:19:59 2004 +0000 @@ -1,6 +1,1 @@ -####### kdevelop will overwrite this part!!! (begin)########## - - -####### kdevelop will overwrite this part!!! (end)############ POFILES = AUTO -
--- a/kdiff3/src/Makefile.qt Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/Makefile.qt Tue Jan 20 20:19:59 2004 +0000 @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: kdiff3 -# Generated by qmake (1.06c) (Qt 3.2.1) on: Mon Dec 8 20:06:47 2003 +# Generated by qmake (1.06c) (Qt 3.2.1) on: Sun Jan 4 12:48:04 2004 # Project: kdiff3.pro # Template: app # Command: $(QMAKE) -o Makefile kdiff3.pro @@ -255,14 +255,13 @@ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kreplacements.o kreplacements/kreplacements.cpp gnudiff_analyze.o: gnudiff_analyze.cpp gnudiff_diff.h \ - gnudiff_xalloc.h \ gnudiff_system.h gnudiff_io.o: gnudiff_io.cpp gnudiff_diff.h \ - gnudiff_xalloc.h \ gnudiff_system.h -gnudiff_xmalloc.o: gnudiff_xmalloc.cpp gnudiff_xalloc.h +gnudiff_xmalloc.o: gnudiff_xmalloc.cpp gnudiff_diff.h \ + gnudiff_system.h moc_diff.o: moc_diff.cpp diff.h common.h \ fileaccess.h
--- a/kdiff3/src/diff.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/diff.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -1078,13 +1078,11 @@ void debugLineCheck( Diff3LineList& d3ll, int size, int idx ) { Diff3LineList::iterator it = d3ll.begin(); - - int i=0; for ( it = d3ll.begin(); it!= d3ll.end(); ++it ) { - int l; + int l=0; if (idx==1) l=(*it).lineA; else if (idx==2) l=(*it).lineB; else if (idx==3) l=(*it).lineC;
--- a/kdiff3/src/difftextwindow.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/difftextwindow.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -30,6 +30,7 @@ #include <qdragobject.h> #include <klocale.h> +#undef leftInfoWidth #define leftInfoWidth (4+m_lineNumberWidth) // Nr of information columns on left side
--- a/kdiff3/src/directorymergewindow.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/directorymergewindow.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -365,6 +365,7 @@ clear(); + m_mergeItemList.clear(); m_currentItemForOperation = m_mergeItemList.end(); m_dirA = dirA; @@ -396,7 +397,7 @@ (m_dirDest.prettyAbsPath() == m_dirA.prettyAbsPath() || m_dirDest.prettyAbsPath()==m_dirB.prettyAbsPath() ) ) { KMessageBox::error(this, - i18n( "The destination directory must not be the same as A or B when" + i18n( "The destination directory must not be the same as A or B when " "three directories are merged.\nCheck again before continuing."), i18n("Parameter Warning")); return false; @@ -610,8 +611,8 @@ // Merge current item (merge mode) void DirectoryMergeWindow::slotCurrentDoNothing() { setMergeOperation(currentItem(), eNoOperation ); } -void DirectoryMergeWindow::slotCurrentChooseA() { setMergeOperation(currentItem(), eCopyAToDest ); } -void DirectoryMergeWindow::slotCurrentChooseB() { setMergeOperation(currentItem(), eCopyBToDest ); } +void DirectoryMergeWindow::slotCurrentChooseA() { setMergeOperation(currentItem(), m_bSyncMode ? eCopyAToB : eCopyAToDest ); } +void DirectoryMergeWindow::slotCurrentChooseB() { setMergeOperation(currentItem(), m_bSyncMode ? eCopyBToA : eCopyBToDest ); } void DirectoryMergeWindow::slotCurrentChooseC() { setMergeOperation(currentItem(), eCopyCToDest ); } void DirectoryMergeWindow::slotCurrentMerge() { @@ -677,6 +678,14 @@ QListView::keyPressEvent(e); } +void DirectoryMergeWindow::focusInEvent(QFocusEvent*) +{ + updateAvailabilities(); +} +void DirectoryMergeWindow::focusOutEvent(QFocusEvent*) +{ + updateAvailabilities(); +} void DirectoryMergeWindow::setAllMergeOperations( e_MergeOperation eDefaultOperation ) { @@ -1600,8 +1609,15 @@ if ( m_mergeItemList.empty() ) { QListViewItem* pBegin = currentItem(); + QListViewItem* pEnd = pBegin; + while ( pEnd!=0 && pEnd->nextSibling()==0 ) + { + pEnd = pEnd->parent(); + } + if ( pEnd!=0 ) + pEnd=pEnd->nextSibling(); - prepareMergeStart( pBegin, pBegin->nextSibling(), bVerbose ); + prepareMergeStart( pBegin, pEnd, bVerbose ); mergeContinue(true, bVerbose); } else @@ -1671,7 +1687,7 @@ // Count the number of completed items (for the progress bar). for( MergeItemList::iterator i = m_mergeItemList.begin(); i!=m_mergeItemList.end(); ++i ) { - DirMergeItem* pDMI = static_cast<DirMergeItem*>(*i); + DirMergeItem* pDMI = *i; ++nrOfItems; if ( pDMI->m_pMFI->m_bOperationComplete ) ++nrOfCompletedItems; @@ -2117,15 +2133,11 @@ } - - - DirectoryMergeInfo::DirectoryMergeInfo( QWidget* pParent ) : QFrame(pParent) { QVBoxLayout *topLayout = new QVBoxLayout( this ); - QGridLayout *grid = new QGridLayout( topLayout ); grid->setColStretch(1,10); @@ -2261,7 +2273,7 @@ dirMergeCurrent = new KAction(i18n("Merge Current File"), QIconSet(QPixmap(startmerge)), 0, pKDiff3App, SLOT(slotMergeCurrentFile()), ac, "merge_current"); dirFoldAll = new KAction(i18n("Fold All Subdirs"), 0, p, SLOT(slotFoldAllSubdirs()), ac, "dir_fold_all"); dirUnfoldAll = new KAction(i18n("Unfold All Subdirs"), 0, p, SLOT(slotUnfoldAllSubdirs()), ac, "dir_unfold_all"); - dirRescan = new KAction(i18n("Rescan"), 0, p, SLOT(reload()), ac, "dir_rescan"); + dirRescan = new KAction(i18n("Rescan"), SHIFT+Key_F5, p, SLOT(reload()), ac, "dir_rescan"); dirChooseAEverywhere = new KAction(i18n("Choose A for All Items"), 0, p, SLOT(slotChooseAEverywhere()), ac, "dir_choose_a_everywhere"); dirChooseBEverywhere = new KAction(i18n("Choose B for All Items"), 0, p, SLOT(slotChooseBEverywhere()), ac, "dir_choose_b_everywhere"); dirChooseCEverywhere = new KAction(i18n("Choose C for All Items"), 0, p, SLOT(slotChooseCEverywhere()), ac, "dir_choose_c_everywhere"); @@ -2287,7 +2299,8 @@ } -void DirectoryMergeWindow::updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible ) +void DirectoryMergeWindow::updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible, + KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC ) { dirStartOperation->setEnabled( bDirCompare ); dirRunOperationForCurrentItem->setEnabled( bDirCompare ); @@ -2317,13 +2330,24 @@ bool bMergeMode = bThreeDirs || !m_bSyncMode; bool bFTConflict = pMFI==0 ? false : conflictingFileTypes(*pMFI); + bool bDirWindowHasFocus = isVisible() && hasFocus(); + dirCurrentDoNothing->setEnabled( bItemActive && bMergeMode ); dirCurrentChooseA->setEnabled( bItemActive && bMergeMode && pMFI->m_bExistsInA ); dirCurrentChooseB->setEnabled( bItemActive && bMergeMode && pMFI->m_bExistsInB ); dirCurrentChooseC->setEnabled( bItemActive && bMergeMode && pMFI->m_bExistsInC ); dirCurrentMerge->setEnabled( bItemActive && bMergeMode && !bFTConflict ); dirCurrentDelete->setEnabled( bItemActive && bMergeMode ); - + if ( bDirWindowHasFocus ) + { + chooseA->setEnabled( bItemActive && pMFI->m_bExistsInA ); + chooseB->setEnabled( bItemActive && pMFI->m_bExistsInB ); + chooseC->setEnabled( bItemActive && pMFI->m_bExistsInC ); + chooseA->setChecked( false ); + chooseB->setChecked( false ); + chooseC->setChecked( false ); + } + dirCurrentSyncDoNothing->setEnabled( bItemActive && !bMergeMode ); dirCurrentSyncCopyAToB->setEnabled( bItemActive && !bMergeMode && pMFI->m_bExistsInA ); dirCurrentSyncCopyBToA->setEnabled( bItemActive && !bMergeMode && pMFI->m_bExistsInB );
--- a/kdiff3/src/directorymergewindow.h Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/directorymergewindow.h Tue Jan 20 20:19:59 2004 +0000 @@ -140,9 +140,12 @@ int totalColumnWidth(); bool isSyncMode() { return m_bSyncMode; } void initDirectoryMergeActions( QObject* pKDiff3App, KActionCollection* ac ); - void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible ); + void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible, + KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC ); virtual void keyPressEvent( QKeyEvent* e ); + virtual void focusInEvent( QFocusEvent* e ); + virtual void focusOutEvent( QFocusEvent* e ); public slots: void reload(); @@ -278,6 +281,7 @@ class DirectoryMergeInfo : public QFrame { + Q_OBJECT public: DirectoryMergeInfo( QWidget* pParent ); void setInfo(
--- a/kdiff3/src/fileaccess.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/fileaccess.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -844,10 +844,10 @@ std::vector<char> buffer(100000); Q_LONG bufSize = buffer.size(); Q_LONG srcSize = srcFile.size(); - while ( srcSize > 0 ) + while ( srcSize > 0 && !g_pProgressDialog->wasCancelled() ) { Q_LONG readSize = srcFile.readBlock( &buffer[0], min2( srcSize, bufSize ) ); - if ( readSize==-1 ) + if ( readSize==-1 || readSize==0 ) { m_pFileAccess->m_statusText = i18n("Error during file copy operation: Reading failed. Filename: %1").arg(srcName); return false; @@ -856,7 +856,7 @@ while ( readSize > 0 ) { Q_LONG writeSize = destFile.writeBlock( &buffer[0], readSize ); - if ( writeSize==-1 ) + if ( writeSize==-1 || writeSize==0 ) { m_pFileAccess->m_statusText = i18n("Error during file copy operation: Writing failed. Filename: %1").arg(destName); return false; @@ -864,6 +864,7 @@ readSize -= writeSize; } destFile.flush(); + g_pProgressDialog->setSubCurrent( (double)(srcFile.size()-srcSize)/srcFile.size(), false ); } srcFile.close(); destFile.close();
--- a/kdiff3/src/gnudiff_analyze.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/gnudiff_analyze.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -1,12 +1,11 @@ /* Analyze file differences for GNU DIFF. Modified for KDiff3 by Joachim Eibl 2003. + The original file was part of GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. - This file is part of GNU DIFF. - GNU DIFF 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, or (at your option) @@ -40,7 +39,6 @@ #include "gnudiff_diff.h" //#include <error.h> #include <stdlib.h> -#include "gnudiff_xalloc.h" static lin *xvec, *yvec; /* Vectors being compared. */ static lin *fdiag; /* Vector, indexed by diagonal, containing @@ -55,7 +53,7 @@ expensive to compute. */ #define SNAKE_LIMIT 20 /* Snakes bigger than this are considered `big'. */ -namespace GnuDiff { + struct partition { @@ -95,8 +93,8 @@ the worst this can do is cause suboptimal diff output. It cannot cause incorrect diff output. */ -static lin -diag (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal, +lin +GnuDiff::diag (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal, struct partition *part) { lin *const fd = fdiag; /* Give the compiler a chance. */ @@ -334,8 +332,7 @@ If FIND_MINIMAL, find a minimal difference no matter how expensive it is. */ -static void -compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal) +void GnuDiff::compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal) { lin * const xv = xvec; /* Help the compiler. */ lin * const yv = yvec; @@ -400,8 +397,7 @@ When we discard a line, we also mark it as a deletion or insertion so that it will be printed in the output. */ -static void -discard_confusing_lines (struct file_data filevec[]) +void GnuDiff::discard_confusing_lines (struct file_data filevec[]) { int f; lin i; @@ -609,8 +605,7 @@ but usually it is cleaner to consider the following identical line to be the "change". */ -static void -shift_boundaries (struct file_data filevec[]) +void GnuDiff::shift_boundaries (struct file_data filevec[]) { int f; @@ -714,9 +709,7 @@ If DELETED is 0 then LINE0 is the number of the line before which the insertion was done; vice versa for INSERTED and LINE1. */ -static struct change * -add_change (lin line0, lin line1, lin deleted, lin inserted, - struct change *old) +GnuDiff::change* GnuDiff::add_change (lin line0, lin line1, lin deleted, lin inserted, struct change *old) { struct change *newChange = (change*) xmalloc (sizeof *newChange); @@ -731,8 +724,7 @@ /* Scan the tables of which lines are inserted and deleted, producing an edit script in reverse order. */ -static struct change * -build_reverse_script (struct file_data const filevec[]) +GnuDiff::change* GnuDiff::build_reverse_script (struct file_data const filevec[]) { struct change *script = 0; bool *changed0 = filevec[0].changed; @@ -768,8 +760,7 @@ /* Scan the tables of which lines are inserted and deleted, producing an edit script in forward order. */ -static struct change * -build_script (struct file_data const filevec[]) +GnuDiff::change* GnuDiff::build_script (struct file_data const filevec[]) { struct change *script = 0; bool *changed0 = filevec[0].changed; @@ -801,7 +792,7 @@ /* Report the differences of two files. */ -struct change* diff_2_files (struct comparison *cmp) +GnuDiff::change* GnuDiff::diff_2_files (struct comparison *cmp) { lin diags; int f; @@ -884,11 +875,6 @@ return script; } -inline bool isWhite( char c ) -{ - return c==' ' || c=='\t' || c=='\r'; -} - /* Compare two lines (typically one from each input file) according to the command line options. For efficiency, this is invoked only when the lines do not match exactly @@ -896,7 +882,7 @@ Return nonzero if the lines differ. */ bool -lines_differ (char const *s1, char const *s2) +GnuDiff::lines_differ (char const *s1, char const *s2) { register unsigned char const *t1 = (unsigned char const *) s1; register unsigned char const *t2 = (unsigned char const *) s2; @@ -1034,4 +1020,4 @@ return 1; } -} // namespace GnuDiff +
--- a/kdiff3/src/gnudiff_diff.h Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/gnudiff_diff.h Tue Jan 20 20:19:59 2004 +0000 @@ -1,12 +1,11 @@ /* Shared definitions for GNU DIFF Modified for KDiff3 by Joachim Eibl 2003. + The original file was part of GNU DIFF. Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. - This file is part of GNU DIFF. - GNU DIFF 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, or (at your option) @@ -22,15 +21,18 @@ If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef GNUDIFF_DIFF_H +#define GNUDIFF_DIFF_H + #include "gnudiff_system.h" #include <stdio.h> #define TAB_WIDTH 8 -namespace GnuDiff +class GnuDiff { - +public: /* What kind of changes a hunk contains. */ enum changes { @@ -49,12 +51,6 @@ /* Variables for command line options */ -#ifndef GDIFF_MAIN -# define XTERN extern -#else -# define XTERN -#endif - enum output_style { /* No output style specified. */ @@ -89,24 +85,24 @@ i.e. can handle a file that ends in a non-newline. */ #define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED) -XTERN enum output_style output_style; +enum output_style output_style; /* Nonzero if output cannot be generated for identical files. */ -XTERN bool no_diff_means_no_output; +bool no_diff_means_no_output; /* Number of lines of context to show in each set of diffs. This is zero when context is not to be shown. */ -XTERN lin context; +lin context; /* Consider all files as text files (-a). Don't interpret codes over 0177 as implying a "binary file". */ -XTERN bool text; +bool text; /* Number of lines to keep in identical prefix and suffix. */ -XTERN lin horizon_lines; +lin horizon_lines; /* The significance of white space during comparisons. */ -XTERN enum +enum { /* All white space is significant (the default). */ IGNORE_NO_WHITE_SPACE, @@ -122,94 +118,94 @@ } ignore_white_space; /* Ignore changes that affect only blank lines (-B). */ -XTERN bool ignore_blank_lines; +bool ignore_blank_lines; /* Ignore changes that affect only numbers. (J. Eibl) */ -XTERN bool bIgnoreNumbers; -XTERN bool bIgnoreWhiteSpace; +bool bIgnoreNumbers; +bool bIgnoreWhiteSpace; /* Files can be compared byte-by-byte, as if they were binary. This depends on various options. */ -XTERN bool files_can_be_treated_as_binary; +bool files_can_be_treated_as_binary; /* Ignore differences in case of letters (-i). */ -XTERN bool ignore_case; +bool ignore_case; /* Ignore differences in case of letters in file names. */ -XTERN bool ignore_file_name_case; +bool ignore_file_name_case; /* File labels for `-c' output headers (--label). */ -XTERN char *file_label[2]; +char *file_label[2]; /* Regexp to identify function-header lines (-F). */ -//XTERN struct re_pattern_buffer function_regexp; +//struct re_pattern_buffer function_regexp; /* Ignore changes that affect only lines matching this regexp (-I). */ -//XTERN struct re_pattern_buffer ignore_regexp; +//struct re_pattern_buffer ignore_regexp; /* Say only whether files differ, not how (-q). */ -XTERN bool brief; +bool brief; /* Expand tabs in the output so the text lines up properly despite the characters added to the front of each line (-t). */ -XTERN bool expand_tabs; +bool expand_tabs; /* Use a tab in the output, rather than a space, before the text of an input line, so as to keep the proper alignment in the input line without changing the characters in it (-T). */ -XTERN bool initial_tab; +bool initial_tab; /* Remove trailing carriage returns from input. */ -XTERN bool strip_trailing_cr; +bool strip_trailing_cr; /* In directory comparison, specify file to start with (-S). This is used for resuming an aborted comparison. All file names less than this name are ignored. */ -XTERN char const *starting_file; +char const *starting_file; /* Pipe each file's output through pr (-l). */ -XTERN bool paginate; +bool paginate; /* Line group formats for unchanged, old, new, and changed groups. */ -XTERN char const *group_format[CHANGED + 1]; +char const *group_format[CHANGED + 1]; /* Line formats for unchanged, old, and new lines. */ -XTERN char const *line_format[NEW + 1]; +char const *line_format[NEW + 1]; /* If using OUTPUT_SDIFF print extra information to help the sdiff filter. */ -XTERN bool sdiff_merge_assist; +bool sdiff_merge_assist; /* Tell OUTPUT_SDIFF to show only the left version of common lines. */ -XTERN bool left_column; +bool left_column; /* Tell OUTPUT_SDIFF to not show common lines. */ -XTERN bool suppress_common_lines; +bool suppress_common_lines; /* The half line width and column 2 offset for OUTPUT_SDIFF. */ -XTERN unsigned int sdiff_half_width; -XTERN unsigned int sdiff_column2_offset; +unsigned int sdiff_half_width; +unsigned int sdiff_column2_offset; /* String containing all the command options diff received, with spaces between and at the beginning but none at the end. If there were no options given, this string is empty. */ -XTERN char *switch_string; +char *switch_string; /* Use heuristics for better speed with large files with a small density of changes. */ -XTERN bool speed_large_files; +bool speed_large_files; /* Patterns that match file names to be excluded. */ -XTERN struct exclude *excluded; +struct exclude *excluded; /* Don't discard lines. This makes things slower (sometimes much slower) but will find a guaranteed minimal set of changes. */ -XTERN bool minimal; +bool minimal; /* Name of program the user invoked (for error messages). */ -XTERN char *program_name; +char *program_name; /* The strftime format to use for time strings. */ -XTERN char const *time_format; +char const *time_format; /* The result of comparison is an "edit script": a chain of `struct change'. Each `struct change' represents one place where some lines are deleted @@ -317,11 +313,11 @@ /* Describe the two files currently being compared. */ -XTERN struct file_data files[2]; +struct file_data files[2]; /* Stdio stream to output diffs to. */ -XTERN FILE *outfile; +FILE *outfile; /* Declare various functions. */ @@ -356,8 +352,8 @@ void print_sdiff_script (struct change *); /* util.c */ -extern char const change_letter[4]; -extern char const pr_program[]; +//extern char const change_letter[4]; +//extern char const pr_program[]; char *concat (char const *, char const *, char const *); char *dir_file_pathname (char const *, char const *); bool lines_differ (char const *, char const *); @@ -383,5 +379,56 @@ void translate_range (struct file_data const *, lin, lin, long *, long *); /* version.c */ -extern char const version_string[]; -} // namespace GnuDiff +//extern char const version_string[]; + +private: + // gnudiff_analyze.cpp + lin diag (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal, struct partition *part); + void compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal); + void discard_confusing_lines (struct file_data filevec[]); + void shift_boundaries (struct file_data filevec[]); + struct change * add_change (lin line0, lin line1, lin deleted, lin inserted, struct change *old); + struct change * build_reverse_script (struct file_data const filevec[]); + struct change* build_script (struct file_data const filevec[]); + + // gnudiff_io.cpp + void find_and_hash_each_line (struct file_data *current); + void prepare_text (struct file_data *current); + void find_identical_ends (struct file_data filevec[]); + + // gnudiff_xmalloc.cpp + void *xmalloc (size_t n); + void *xcalloc (size_t n, size_t s); + void *xrealloc(void *p, size_t n); + char *xstrdup (const char *str); + void xalloc_die (void); + + inline bool isWhite( char c ) + { + return c==' ' || c=='\t' || c=='\r'; + } +}; // class GnuDiff + +# define XMALLOC(Type, N_items) ((Type *) xmalloc (sizeof (Type) * (N_items))) +# define XCALLOC(Type, N_items) ((Type *) xcalloc (sizeof (Type), (N_items))) +# define XREALLOC(Ptr, Type, N_items) \ + ((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_items))) + +/* Declare and alloc memory for VAR of type TYPE. */ +# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1) + +/* Free VAR only if non NULL. */ +# define XFREE(Var) \ + do { \ + if (Var) \ + free (Var); \ + } while (0) + +/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */ +# define CCLONE(Src, Num) \ + (memcpy (xmalloc (sizeof (*Src) * (Num)), (Src), sizeof (*Src) * (Num))) + +/* Return a malloc'ed copy of SRC. */ +# define CLONE(Src) CCLONE (Src, 1) + +#endif
--- a/kdiff3/src/gnudiff_io.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/gnudiff_io.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -1,12 +1,11 @@ /* File I/O for GNU DIFF. Modified for KDiff3 by Joachim Eibl 2003. + The original file was part of GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. - This file is part of GNU DIFF. - GNU DIFF 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, or (at your option) @@ -24,10 +23,6 @@ #include "gnudiff_diff.h" #include <stdlib.h> -#include "gnudiff_xalloc.h" - -namespace GnuDiff -{ /* Rotate an unsigned value to the left. */ #define ROL(v, n) ((v) << (n) | (v) >> (sizeof (v) * CHAR_BIT - (n))) @@ -81,8 +76,7 @@ /* Split the file into lines, simultaneously computing the equivalence class for each line. */ -static void -find_and_hash_each_line (struct file_data *current) +void GnuDiff::find_and_hash_each_line (struct file_data *current) { hash_value h; unsigned char const *p = (unsigned char const *) current->prefix_end; @@ -379,8 +373,7 @@ but remember that we had to add one. Strip trailing CRs, if that was requested. */ -static void -prepare_text (struct file_data *current) +void GnuDiff::prepare_text (struct file_data *current) { size_t buffered = current->buffered; char *p = FILE_BUFFER (current); @@ -430,8 +423,7 @@ /* Given a vector of two file_data objects, find the identical prefixes and suffixes of each object. */ -static void -find_identical_ends (struct file_data filevec[]) +void GnuDiff::find_identical_ends (struct file_data filevec[]) { word *w0, *w1; char *p0, *p1, *buffer0, *buffer1; @@ -657,7 +649,7 @@ If PRETEND_BINARY is nonzero, pretend they are binary regardless. */ bool -read_files (struct file_data filevec[], bool /*pretend_binary*/) +GnuDiff::read_files (struct file_data filevec[], bool /*pretend_binary*/) { int i; @@ -692,5 +684,3 @@ return 0; } - -} // namespace GnuDiff
--- a/kdiff3/src/gnudiff_system.h Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/gnudiff_system.h Tue Jan 20 20:19:59 2004 +0000 @@ -1,12 +1,11 @@ /* System dependent declarations. Modified for KDiff3 by Joachim Eibl 2003. + The original file was part of GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. - This file is part of GNU DIFF. - GNU DIFF 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, or (at your option) @@ -22,8 +21,13 @@ If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef GNUDIFF_SYSTEM_H +#define GNUDIFF_SYSTEM_H + //#include <config.h> + + /* Don't bother to support K&R C compilers any more; it's not worth the trouble. These macros prevent some library modules from being compiled in K&R C mode. */ @@ -131,3 +135,5 @@ verify (lin_is_signed, TYPE_SIGNED (lin)); verify (lin_is_wide_enough, sizeof (ptrdiff_t) <= sizeof (lin)); verify (lin_is_printable_as_long, sizeof (lin) <= sizeof (long)); + +#endif
--- a/kdiff3/src/gnudiff_xmalloc.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/gnudiff_xmalloc.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -1,6 +1,7 @@ /* xmalloc.c -- malloc with out of memory checking Modified for KDiff3 by Joachim Eibl 2003. + The original file was part of GNU DIFF. Copyright (C) 1990-1999, 2000, 2002 Free Software Foundation, Inc. @@ -29,23 +30,17 @@ #include <string.h> -//#include "error.h" -#include "gnudiff_xalloc.h" - #ifndef EXIT_FAILURE # define EXIT_FAILURE 1 #endif -namespace GnuDiff -{ - +#include "gnudiff_diff.h" /* If non NULL, call this function when memory is exhausted. */ //void (*xalloc_fail_func) PARAMS ((void)) = 0; void (*xalloc_fail_func)(void) = 0; -void -xalloc_die (void) +void GnuDiff::xalloc_die (void) { if (xalloc_fail_func) (*xalloc_fail_func) (); @@ -59,7 +54,7 @@ /* Allocate N bytes of memory dynamically, with error checking. */ void * -xmalloc (size_t n) +GnuDiff::xmalloc (size_t n) { void *p; @@ -73,7 +68,7 @@ with error checking. */ void * -xrealloc (void *p, size_t n) +GnuDiff::xrealloc (void *p, size_t n) { p = realloc (p, n); if (p == 0) @@ -84,7 +79,7 @@ /* Allocate memory for N elements of S bytes, with error checking. */ void * -xcalloc (size_t n, size_t s) +GnuDiff::xcalloc (size_t n, size_t s) { void *p; @@ -97,11 +92,9 @@ /* Yield a new block of SIZE bytes, initialized to zero. */ void * -zalloc (size_t size) +GnuDiff::zalloc (size_t size) { void *p = xmalloc (size); memset (p, 0, size); return p; } - -} // namespace GnuDiff
--- a/kdiff3/src/kdiff3.desktop Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kdiff3.desktop Tue Jan 20 20:19:59 2004 +0000 @@ -2,9 +2,34 @@ [Desktop Entry] Encoding=UTF-8 Name=KDiff3 +Name[sv]=Kdiff3 +Name[xx]=xxKDiff3xx +GenericName=Diff/Patch Frontend +GenericName[da]=Forende for diff/patch +GenericName[es]=Interfaz Diff/Patch +GenericName[hu]=grafikus diff/patch-felület +GenericName[it]=Interfaccia per diff/patch +GenericName[pt]=Interface para o Diff/Patch +GenericName[pt_BR]=Interface para o Diff/Patch +GenericName[sr]=Ð˜Ð½Ñ‚ÐµÑ€Ñ„ÐµÑ˜Ñ Ð·Ð° Diff и Patch +GenericName[sv]=Jämförelse- och programfixgränssnitt +GenericName[zu]=Diff/PatchIsiqalo sokugcina Exec=kdiff3 %i %m -caption "%c" Icon=kdiff3 Type=Application DocPath=kdiff3/kdiff3.html Comment=A File And Directory Comparison And Merge Tool +Comment[ca]=Una eina per a comparar i fusionar fitxers o directoris +Comment[da]=Et indfletningsværktøj for filer og mapper +Comment[de]=Programm zum Vergleichen und Zusammenführen von Dateien und Verzeichnissen +Comment[es]=Una herramienta para mezclar y comparar archivos y directorios +Comment[et]=Failide ja kataloogide võrdlemise ja liitmise vahend +Comment[hu]=Segédprogram fájlok, könyvtárak összehasonlÃtásához +Comment[it]=Uno strumento di confronto e unione di file e directory +Comment[nl]=Hulpmiddel voor het vergelijken en samenvoegen van bestanden en mappen +Comment[pt]=Uma Ferramenta de Comparação e Junção de Ficheiros e Pastas +Comment[pt_BR]=Uma Comparação de Arquivos e Pastas e uma Ferramenta para Mesclar Diferenças +Comment[sr]=Ðлат за поређење и Ñтапање фајлова и директоријума +Comment[sv]=Ett jämförelseverktyg för fil- och katalogjämförelser +Comment[xx]=xxA File And Directory Comparison And Merge Toolxx Terminal=0
--- a/kdiff3/src/kdiff3.h Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kdiff3.h Tue Jan 20 20:19:59 2004 +0000 @@ -253,6 +253,7 @@ bool runDiff( LineData* p1, int size1, LineData* p2, int size2, DiffList& diffList ); bool canContinue(); + void choose(int choice); KActionCollection* actionCollection(); KStatusBar* statusBar();
--- a/kdiff3/src/kdiff3_part.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kdiff3_part.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -273,6 +273,6 @@ { return new KDiff3PartFactory; } -}; +} #include "kdiff3_part.moc"
--- a/kdiff3/src/kdiff3part.desktop Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kdiff3part.desktop Tue Jan 20 20:19:59 2004 +0000 @@ -1,6 +1,9 @@ [Desktop Entry] Encoding=UTF-8 Name=KDiff3Part +Name[pt_BR]=Componente KDiff3 +Name[sv]=Kdiff3-del +Name[xx]=xxKDiff3Partxx MimeType=text/x-diff ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart X-KDE-Library=libkdiff3part
--- a/kdiff3/src/kreplacements/kreplacements.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kreplacements/kreplacements.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -101,6 +101,20 @@ #endif } +QString getTranslationDir() +{ + #ifdef _WIN32 + char buf[200]; + int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 ); + + QString exePath; + if (r!=0) { exePath = buf; } + else { exePath = "."; } + return exePath; + #else + return "."; + #endif +} // static void KMessageBox::error( QWidget* parent, const QString& text, const QString& caption ) @@ -134,7 +148,7 @@ const QString& button1, const QString& button2 ) { int val = QMessageBox::warning( parent, caption, text, - button1, button2, "Cancel" ); + button1, button2, i18n("Cancel") ); if ( val==0 ) return Yes; if ( val==1 ) return No; else return Cancel; @@ -278,23 +292,23 @@ : QMainWindow( parent, name ), m_actionCollection(this) { fileMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&File"), fileMenu); + menuBar()->insertItem(i18n("&File"), fileMenu); editMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Edit"), editMenu); + menuBar()->insertItem(i18n("&Edit"), editMenu); directoryMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Directory"), directoryMenu); + menuBar()->insertItem(i18n("&Directory"), directoryMenu); dirCurrentItemMenu = 0; dirCurrentSyncItemMenu = 0; movementMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Movement"), movementMenu); + menuBar()->insertItem(i18n("&Movement"), movementMenu); mergeMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Merge"), mergeMenu); + menuBar()->insertItem(i18n("&Merge"), mergeMenu); windowsMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Windows"), windowsMenu); + menuBar()->insertItem(i18n("&Window"), windowsMenu); settingsMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Settings"), settingsMenu); + menuBar()->insertItem(i18n("&Settings"), settingsMenu); helpMenu = new QPopupMenu(); - menuBar()->insertItem(tr("&Help"), helpMenu); + menuBar()->insertItem(i18n("&Help"), helpMenu); m_pToolBar = new KToolBar(this); @@ -632,27 +646,27 @@ { if( name[0]=='g') addTo( p->movementMenu ); else if( name.left(16)=="dir_current_sync") - { - if ( p->dirCurrentItemMenu==0 ) - { - p->dirCurrentItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); + { + if ( p->dirCurrentItemMenu==0 ) + { + p->dirCurrentItemMenu = new QPopupMenu(); + p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu); p->dirCurrentSyncItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); - } - addTo( p->dirCurrentItemMenu ); - } + p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); + } + addTo( p->dirCurrentItemMenu ); + } else if( name.left(11)=="dir_current") - { - if ( p->dirCurrentItemMenu==0 ) - { - p->dirCurrentItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); + { + if ( p->dirCurrentItemMenu==0 ) + { + p->dirCurrentItemMenu = new QPopupMenu(); + p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu); p->dirCurrentSyncItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); - } - addTo( p->dirCurrentSyncItemMenu ); - } + p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); + } + addTo( p->dirCurrentSyncItemMenu ); + } else if( name[0]=='d') addTo( p->directoryMenu ); else if( name[0]=='f') addTo( p->fileMenu ); else if( name[0]=='w') addTo( p->windowsMenu ); @@ -680,27 +694,27 @@ { if( name[0]=='g') addTo( p->movementMenu ); else if( name.left(16)=="dir_current_sync") - { - if ( p->dirCurrentItemMenu==0 ) - { - p->dirCurrentItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); + { + if ( p->dirCurrentItemMenu==0 ) + { + p->dirCurrentItemMenu = new QPopupMenu(); + p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu); p->dirCurrentSyncItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); - } - addTo( p->dirCurrentItemMenu ); - } + p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); + } + addTo( p->dirCurrentItemMenu ); + } else if( name.left(11)=="dir_current") - { - if ( p->dirCurrentItemMenu==0 ) - { - p->dirCurrentItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); + { + if ( p->dirCurrentItemMenu==0 ) + { + p->dirCurrentItemMenu = new QPopupMenu(); + p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu); p->dirCurrentSyncItemMenu = new QPopupMenu(); - p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); - } - addTo( p->dirCurrentSyncItemMenu ); - } + p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); + } + addTo( p->dirCurrentSyncItemMenu ); + } else if( name[0]=='d') addTo( p->directoryMenu ); else if( name[0]=='f') addTo( p->fileMenu ); else if( name[0]=='w') addTo( p->windowsMenu ); @@ -752,7 +766,7 @@ { #include "../xpm/fileopen.xpm" KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Open", QIconSet(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false); + KAction* a = new KAction( i18n("Open"), QIconSet(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false); if(p){ a->addTo( p->fileMenu ); } return a; } @@ -761,7 +775,7 @@ { #include "../xpm/filesave.xpm" KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Save", QIconSet(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false); + KAction* a = new KAction( i18n("Save"), QIconSet(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false); if(p){ a->addTo( p->fileMenu ); } return a; } @@ -769,7 +783,7 @@ KAction* KStdAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "SaveAs", 0, parent, slot, actionCollection, "saveas", false, false); + KAction* a = new KAction( i18n("Save As..."), 0, parent, slot, actionCollection, "saveas", false, false); if(p) a->addTo( p->fileMenu ); return a; } @@ -777,7 +791,7 @@ KAction* KStdAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Quit", Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false); + KAction* a = new KAction( i18n("Quit"), Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false); if(p) a->addTo( p->fileMenu ); return a; } @@ -785,7 +799,7 @@ KAction* KStdAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Cut", Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false ); + KAction* a = new KAction( i18n("Cut"), Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false ); if(p) a->addTo( p->editMenu ); return a; } @@ -793,7 +807,7 @@ KAction* KStdAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Copy", Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false ); + KAction* a = new KAction( i18n("Copy"), Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false ); if(p) a->addTo( p->editMenu ); return a; } @@ -801,7 +815,7 @@ KAction* KStdAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Paste", Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false ); + KAction* a = new KAction( i18n("Paste"), Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false ); if(p) a->addTo( p->editMenu ); return a; } @@ -809,7 +823,7 @@ KToggleAction* KStdAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KToggleAction* a = new KToggleAction( "ShowToolBar", 0, parent, slot, actionCollection, "showtoolbar", false ); + KToggleAction* a = new KToggleAction( i18n("Show Toolbar"), 0, parent, slot, actionCollection, "showtoolbar", false ); if(p) a->addTo( p->settingsMenu ); return a; } @@ -817,7 +831,7 @@ KToggleAction* KStdAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KToggleAction* a = new KToggleAction( "ShowStatusBar", 0, parent, slot, actionCollection, "showstatusbar", false ); + KToggleAction* a = new KToggleAction( i18n("Show &Statusbar"), 0, parent, slot, actionCollection, "showstatusbar", false ); if(p) a->addTo( p->settingsMenu ); return a; } @@ -825,7 +839,7 @@ KAction* KStdAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Settings ...", 0, parent, slot, actionCollection, "settings", false, false ); + KAction* a = new KAction( i18n("&Configure %1...").arg("KDiff3"), 0, parent, slot, actionCollection, "settings", false, false ); if(p) a->addTo( p->settingsMenu ); return a; } @@ -837,7 +851,7 @@ KAction* KStdAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "About", 0, parent, slot, actionCollection, "about", false, false ); + KAction* a = new KAction( i18n("About"), 0, parent, slot, actionCollection, "about", false, false ); if(p) a->addTo( p->helpMenu ); return a; } @@ -845,14 +859,14 @@ KAction* KStdAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Help", Qt::Key_F1, parent, slot, actionCollection, "help", false, false ); + KAction* a = new KAction( i18n("Help"), Qt::Key_F1, parent, slot, actionCollection, "help", false, false ); if(p) a->addTo( p->helpMenu ); return a; } KAction* KStdAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Find", Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "find", false, false ); + KAction* a = new KAction( i18n("Find"), Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "find", false, false ); if(p) a->addTo( p->editMenu ); return a; } @@ -860,7 +874,7 @@ KAction* KStdAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection) { KMainWindow* p = actionCollection->m_pMainWindow; - KAction* a = new KAction( "Find Next", Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false ); + KAction* a = new KAction( i18n("Find Next"), Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false ); if(p) a->addTo( p->editMenu ); return a; } @@ -873,7 +887,7 @@ { m_pParent = pParent; QVBoxLayout* pLayout = new QVBoxLayout( this ); - m_pSelectFont = new QPushButton("Select Font", this ); + m_pSelectFont = new QPushButton(i18n("Select Font"), this ); connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont())); pLayout->addWidget(m_pSelectFont);
--- a/kdiff3/src/kreplacements/kreplacements.h Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/kreplacements/kreplacements.h Tue Jan 20 20:19:59 2004 +0000 @@ -15,13 +15,6 @@ * * ***************************************************************************/ -/*************************************************************************** - * $Log$ - * Revision 1.2 2003/12/09 20:26:39 joachim99 - * 0.9.80 - * - ***************************************************************************/ - #ifndef KREPLACEMENTS_H #define KREPLACEMENTS_H @@ -41,6 +34,8 @@ #include <map> +QString getTranslationDir(); + class KMainWindow; class KURL @@ -232,6 +227,7 @@ class KAction : public QAction { + Q_OBJECT public: KAction(const QString& text, const QIconSet& icon, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const QString& name, bool bToggle=false, bool bMenu=true); KAction(const QString& text, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const QString& name, bool bToggle=false, bool bMenu=true);
--- a/kdiff3/src/main.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/main.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -20,6 +20,7 @@ #include <klocale.h> #include "kdiff3_shell.h" #include "version.h" +#include <qtextcodec.h> static const char *description = @@ -97,12 +98,22 @@ KAboutData aboutData( "kdiff3", I18N_NOOP("KDiff3"), VERSION, description, KAboutData::License_GPL, - "(c) 2002-2003 Joachim Eibl", 0, "http://kdiff3.sourceforge.net/", "joachim.eibl@gmx.de"); + "(c) 2002-2004 Joachim Eibl", 0, "http://kdiff3.sourceforge.net/", "joachim.eibl@gmx.de"); aboutData.addAuthor("Joachim Eibl",0, "joachim.eibl@gmx.de"); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. - KApplication app; + KApplication app; +#ifdef KREPLACEMENTS_H + QString translationDir = getTranslationDir(); + QTranslator kdiff3Translator( 0 ); + kdiff3Translator.load( QString("kdiff3_")+QTextCodec::locale(), translationDir ); + app.installTranslator( &kdiff3Translator ); + + QTranslator qtTranslator( 0 ); + qtTranslator.load( QString("qt_")+QTextCodec::locale(), translationDir ); + app.installTranslator( &qtTranslator ); +#endif if (app.isRestored()) { @@ -115,3 +126,6 @@ return app.exec(); } + +// Suppress warning with --enable-final +#undef VERSION
--- a/kdiff3/src/mergeresultwindow.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/mergeresultwindow.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -30,6 +30,7 @@ int g_bAutoSolve = true; +#undef leftInfoWidth #define leftInfoWidth 3 MergeResultWindow::MergeResultWindow( @@ -500,6 +501,9 @@ } setFastSelector( i ); + + if ( isVisible() ) + setFocus(); } bool MergeResultWindow::isDeltaAboveCurrent() @@ -1165,8 +1169,11 @@ if ( mel.isModified() || !mel.isEditableText() ) bModified = true; } - if ( ml.mergeDetails == eNoChange ) emit sourceMask( 0, bModified ? 1 : 0 ); - else emit sourceMask( srcMask, enabledMask ); + if (hasFocus()) + { + if ( ml.mergeDetails == eNoChange ) emit sourceMask( 0, bModified ? 1 : 0 ); + else emit sourceMask( srcMask, enabledMask ); + } } p.end(); }
--- a/kdiff3/src/pdiff.cpp Tue Dec 09 20:34:32 2003 +0000 +++ b/kdiff3/src/pdiff.cpp Tue Jan 20 20:19:59 2004 +0000 @@ -101,6 +101,8 @@ bool KDiff3App::runDiff( LineData* p1, int size1, LineData* p2, int size2, DiffList& diffList ) { + static GnuDiff gnuDiff; + g_pProgressDialog->setSubCurrent(0); diffList.clear(); @@ -109,74 +111,78 @@ Diff d( 0,0,0); if ( p1[0].pLine==0 && p2[0].pLine==0 && size1 == size2 ) d.nofEquals = size1; - else if (p1[0].pLine!=0) d.diff1=size1; - else if (p2[0].pLine!=0) d.diff2=size2; + else + { + d.diff1=size1; + d.diff2=size2; + } diffList.push_back(d); - return true; } - - GnuDiff::comparison comparisonInput; - memset( &comparisonInput, 0, sizeof(comparisonInput) ); - comparisonInput.parent = 0; - comparisonInput.file[0].buffer = (word*)p1[0].pLine;//ptr to buffer - comparisonInput.file[0].buffered = p1[size1-1].pLine-p1[0].pLine+p1[size1-1].size; // size of buffer - comparisonInput.file[1].buffer = (word*)p2[0].pLine;//ptr to buffer - comparisonInput.file[1].buffered = p2[size2-1].pLine-p2[0].pLine+p2[size2-1].size; // size of buffer - - GnuDiff::ignore_white_space = GnuDiff::IGNORE_ALL_SPACE; // I think nobody needs anything else ... - GnuDiff::bIgnoreWhiteSpace = true; - GnuDiff::bIgnoreNumbers = m_pOptionDialog->m_bIgnoreNumbers; - GnuDiff::minimal = m_pOptionDialog->m_bTryHard; - GnuDiff::ignore_case = false; // m_pOptionDialog->m_bUpCase is applied while reading. - GnuDiff::change* script = GnuDiff::diff_2_files( &comparisonInput ); - - int equalLinesAtStart = comparisonInput.file[0].prefix_lines; - int currentLine1 = 0; - int currentLine2 = 0; - GnuDiff::change* p=0; - for (GnuDiff::change* e = script; e; e = p) - { - Diff d(0,0,0); - d.nofEquals = e->line0 - currentLine1; - assert( d.nofEquals == e->line1 - currentLine2 ); - d.diff1 = e->deleted; - d.diff2 = e->inserted; - currentLine1 += d.nofEquals + d.diff1; - currentLine2 += d.nofEquals + d.diff2; - diffList.push_back(d); - - p = e->link; - free (e); - } - - if ( !diffList.empty() ) - { - diffList.front().nofEquals += equalLinesAtStart; - currentLine1 += equalLinesAtStart; - currentLine2 += equalLinesAtStart; - } - - if (size1-currentLine1==size2-currentLine2 ) - { - Diff d( size1-currentLine1,0,0); - diffList.push_back(d); - } - else if ( !diffList.empty() ) - { // Only necessary for a files that end with a newline - int nofEquals = min2(size1-currentLine1,size2-currentLine2); - if ( nofEquals==0 ) + else + { + GnuDiff::comparison comparisonInput; + memset( &comparisonInput, 0, sizeof(comparisonInput) ); + comparisonInput.parent = 0; + comparisonInput.file[0].buffer = (word*)p1[0].pLine;//ptr to buffer + comparisonInput.file[0].buffered = p1[size1-1].pLine-p1[0].pLine+p1[size1-1].size; // size of buffer + comparisonInput.file[1].buffer = (word*)p2[0].pLine;//ptr to buffer + comparisonInput.file[1].buffered = p2[size2-1].pLine-p2[0].pLine+p2[size2-1].size; // size of buffer + + gnuDiff.ignore_white_space = GnuDiff::IGNORE_ALL_SPACE; // I think nobody needs anything else ... + gnuDiff.bIgnoreWhiteSpace = true; + gnuDiff.bIgnoreNumbers = m_pOptionDialog->m_bIgnoreNumbers; + gnuDiff.minimal = m_pOptionDialog->m_bTryHard; + gnuDiff.ignore_case = false; // m_pOptionDialog->m_bUpCase is applied while reading. + GnuDiff::change* script = gnuDiff.diff_2_files( &comparisonInput ); + + int equalLinesAtStart = comparisonInput.file[0].prefix_lines; + int currentLine1 = 0; + int currentLine2 = 0; + GnuDiff::change* p=0; + for (GnuDiff::change* e = script; e; e = p) { - diffList.back().diff1 += size1-currentLine1; - diffList.back().diff2 += size2-currentLine2; + Diff d(0,0,0); + d.nofEquals = e->line0 - currentLine1; + assert( d.nofEquals == e->line1 - currentLine2 ); + d.diff1 = e->deleted; + d.diff2 = e->inserted; + currentLine1 += d.nofEquals + d.diff1; + currentLine2 += d.nofEquals + d.diff2; + diffList.push_back(d); + + p = e->link; + free (e); } - else + + if ( !diffList.empty() ) { - Diff d( nofEquals,size1-currentLine1-nofEquals,size2-currentLine2-nofEquals); + diffList.front().nofEquals += equalLinesAtStart; + currentLine1 += equalLinesAtStart; + currentLine2 += equalLinesAtStart; + } + + if (size1-currentLine1==size2-currentLine2 ) + { + Diff d( size1-currentLine1,0,0); diffList.push_back(d); } + else if ( !diffList.empty() ) + { // Only necessary for a files that end with a newline + int nofEquals = min2(size1-currentLine1,size2-currentLine2); + if ( nofEquals==0 ) + { + diffList.back().diff1 += size1-currentLine1; + diffList.back().diff2 += size2-currentLine2; + } + else + { + Diff d( nofEquals,size1-currentLine1-nofEquals,size2-currentLine2-nofEquals); + diffList.push_back(d); + } + } } - + #ifndef NDEBUG // Verify difflist { @@ -630,6 +636,15 @@ } QTimer::singleShot( 10, this, SLOT(slotAfterFirstPaint()) ); + + if ( bVisibleMergeResultWindow && m_pMergeResultWindow ) + { + m_pMergeResultWindow->setFocus(); + } + else if(m_pDiffTextWindow1) + { + m_pDiffTextWindow1->setFocus(); + } } @@ -1433,43 +1448,35 @@ if (m_pMergeResultWindow) m_pMergeResultWindow->slotGoNextDelta(); } - -void KDiff3App::slotChooseA() +void KDiff3App::choose( int choice ) { - if (m_pMergeResultWindow && ! m_bTimerBlock ) + if (!m_bTimerBlock ) { - m_pMergeResultWindow->choose(A); - if ( autoAdvance->isChecked() ) + if ( m_pDirectoryMergeWindow && m_pDirectoryMergeWindow->hasFocus() ) { - m_bTimerBlock = true; - QTimer::singleShot( m_pOptionDialog->m_autoAdvanceDelay, this, SLOT( slotGoNextUnsolvedConflict() ) ); + if (choice==A) m_pDirectoryMergeWindow->slotCurrentChooseA(); + if (choice==B) m_pDirectoryMergeWindow->slotCurrentChooseB(); + if (choice==C) m_pDirectoryMergeWindow->slotCurrentChooseC(); + + chooseA->setChecked(false); + chooseB->setChecked(false); + chooseC->setChecked(false); + } + else if ( m_pMergeResultWindow ) + { + m_pMergeResultWindow->choose( choice ); + if ( autoAdvance->isChecked() ) + { + m_bTimerBlock = true; + QTimer::singleShot( m_pOptionDialog->m_autoAdvanceDelay, this, SLOT( slotGoNextUnsolvedConflict() ) ); + } } } } -void KDiff3App::slotChooseB() -{ - if ( m_pMergeResultWindow && ! m_bTimerBlock ) - { - m_pMergeResultWindow->choose(B); - if ( autoAdvance->isChecked() ) - { - m_bTimerBlock = true; - QTimer::singleShot( m_pOptionDialog->m_autoAdvanceDelay, this, SLOT( slotGoNextUnsolvedConflict() ) ); - } - } -} -void KDiff3App::slotChooseC() -{ - if ( m_pMergeResultWindow && ! m_bTimerBlock ) - { - m_pMergeResultWindow->choose(C); - if ( autoAdvance->isChecked() ) - { - m_bTimerBlock = true; - QTimer::singleShot( m_pOptionDialog->m_autoAdvanceDelay, this, SLOT( slotGoNextUnsolvedConflict() ) ); - } - } -} + +void KDiff3App::slotChooseA() { choose( A ); } +void KDiff3App::slotChooseB() { choose( B ); } +void KDiff3App::slotChooseC() { choose( C ); } // bConflictsOnly automatically choose for conflicts only (true) or for everywhere static void mergeChooseGlobal( KDiff3App* pThis, MergeResultWindow* pMRW, int selector, bool bConflictsOnly, bool bWhiteSpaceOnly ) @@ -2026,7 +2033,7 @@ bool bDiffWindowVisible = m_pMainWidget != 0 && m_pMainWidget->isVisible(); bool bMergeEditorVisible = m_pMergeWindowFrame !=0 && m_pMergeWindowFrame->isVisible(); - m_pDirectoryMergeWindow->updateAvailabilities( m_bDirCompare, bDiffWindowVisible ); + m_pDirectoryMergeWindow->updateAvailabilities( m_bDirCompare, bDiffWindowVisible, chooseA, chooseB, chooseC ); dirShowBoth->setEnabled( m_bDirCompare ); dirViewToggle->setEnabled( @@ -2034,14 +2041,19 @@ (!m_pDirectoryMergeSplitter->isVisible() && m_pMainWidget!=0 && m_pMainWidget->isVisible() || m_pDirectoryMergeSplitter->isVisible() && m_pMainWidget!=0 && !m_pMainWidget->isVisible() && bTextDataAvailable ) ); + + bool bDirWindowHasFocus = m_pDirectoryMergeSplitter->isVisible() && m_pDirectoryMergeWindow->hasFocus(); showWhiteSpaceCharacters->setEnabled( bDiffWindowVisible ); autoAdvance->setEnabled( bMergeEditorVisible ); autoSolve->setEnabled( bMergeEditorVisible && m_bTripleDiff ); unsolve->setEnabled( bMergeEditorVisible ); - chooseA->setEnabled( bMergeEditorVisible ); - chooseB->setEnabled( bMergeEditorVisible ); - chooseC->setEnabled( bMergeEditorVisible && m_bTripleDiff ); + if ( !bDirWindowHasFocus ) + { + chooseA->setEnabled( bMergeEditorVisible ); + chooseB->setEnabled( bMergeEditorVisible ); + chooseC->setEnabled( bMergeEditorVisible && m_bTripleDiff ); + } chooseAEverywhere->setEnabled( bMergeEditorVisible ); chooseBEverywhere->setEnabled( bMergeEditorVisible ); chooseCEverywhere->setEnabled( bMergeEditorVisible && m_bTripleDiff );