Am Donnerstag, 15. Juni 2006 12:39 schrieb Abdelrazak Younes:
> Hello,
> 
> Minus potential compilation problems with gtk and/or xforms I think I am 
> ready to merge my branch with trunk. Please find attached the complete 
> patch. I will wait for some green lights before applying.

I scanned the patch and found some formatting issues: umlauts and 
whitespace. Some are fixed by the attached patch. I also noticed that 
there is only one line between methods in some files in qt4, we use 2 
(but this is like that in trunk, too).

The patch also fixes the line ending functions. I removed the #ifdefs in  
internalLineEnding() so that it could also be sued to e.g. read a windows 
file on linux.
I'd like to put it in your branch. OK?

The rest is fine with me but in this case you should wait for more 
comments.


Georg
Index: src/frontends/qt3/QWorkArea.C
===================================================================
--- src/frontends/qt3/QWorkArea.C	(Revision 14125)
+++ src/frontends/qt3/QWorkArea.C	(Arbeitskopie)
@@ -38,11 +38,10 @@
 #include <Carbon/Carbon.h>
 #endif
 
-#ifdef Q_OS_MAC
 #include <support/lstrings.h>
 
-using lyx::support::subst;
-#endif
+using lyx::support::internalLineEnding;
+using lyx::support::externalLineEnding;
 using std::endl;
 using std::string;
 
@@ -217,24 +216,14 @@ string const QWorkArea::getClipboard() c
 	QString str = QApplication::clipboard()->text();
 	if (str.isNull())
 		return string();
-#ifdef Q_OS_MAC
-	// The MAC clipboard uses \r for lineendings, and we use \n
-	return subst(fromqstr(str), '\r', '\n');
-#else
-	return fromqstr(str);
-#endif
+	return internalLineEnding(fromqstr(str));
 }
 
 
 void QWorkArea::putClipboard(string const & str)
 {
 	QApplication::clipboard()->setSelectionMode(true);
-#ifdef Q_OS_MAC
-	// The MAC clipboard uses \r for lineendings, and we use \n
-	QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')));
-#else
-	QApplication::clipboard()->setText(toqstr(str));
-#endif
+	QApplication::clipboard()->setText(toqstr(externalLineEnding(str)));
 }
 
 
Index: src/frontends/qt4/Application.C
===================================================================
--- src/frontends/qt4/Application.C	(Revision 14125)
+++ src/frontends/qt4/Application.C	(Arbeitskopie)
@@ -111,7 +111,7 @@ OSErr checkAppleEventForMissingParams(co
 } // namespace
 
 OSErr Application::handleOpenDocuments(const AppleEvent* inEvent,
-											  AppleEvent* /*reply*/, long /*refCon*/)
+                                       AppleEvent* /*reply*/, long /*refCon*/)
 {
 	QString s_arg;
 	AEDescList documentList;
Index: src/frontends/qt4/GuiClipboard.C
===================================================================
--- src/frontends/qt4/GuiClipboard.C	(Revision 14120)
+++ src/frontends/qt4/GuiClipboard.C	(Arbeitskopie)
@@ -22,7 +22,6 @@
 #include <string>
 
 #include "support/lstrings.h"
-using lyx::support::subst;
 using lyx::support::internalLineEnding;
 using lyx::support::externalLineEnding;
 
Index: src/frontends/qt4/QRef.C
===================================================================
--- src/frontends/qt4/QRef.C	(Revision 14120)
+++ src/frontends/qt4/QRef.C	(Arbeitskopie)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
- * \author Jurgen Spitzmuller
+ * \author Jürgen Spitzmüller
  *
  * Full author contact details are available in file CREDITS.
  */
Index: src/frontends/xforms/Makefile.am
===================================================================
--- src/frontends/xforms/Makefile.am	(Revision 14120)
+++ src/frontends/xforms/Makefile.am	(Arbeitskopie)
@@ -180,7 +180,7 @@ libxforms_la_SOURCES = \
 	XPainter.h \
 	XWorkArea.h \
 	XWorkArea.C
-	
+
 lyx_forms.h: stamp-forms
 	@:
 
Index: src/support/lstrings.C
===================================================================
--- src/support/lstrings.C	(Revision 14120)
+++ src/support/lstrings.C	(Arbeitskopie)
@@ -548,35 +548,22 @@ int findToken(char const * const str[], 
 
 string const externalLineEnding(string const & str)
 {
-#ifdef Q_WS_MACX
+#if defined(__APPLE__)
 	// The MAC clipboard uses \r for lineendings, and we use \n
 	return subst(str, '\n', '\r');
-#endif
-
-	return str;
-/*
-#ifdef Q_WS_WIN
+#elif defined(_WIN32)
 	// Windows clipboard uses \r\n for lineendings, and we use \n
-	return subst(str, '\n', '\r\n');
+	return subst(str, "\n", "\r\n");
+#else
+	return str;
 #endif
-*/
 }
 
 
 string const internalLineEnding(string const & str)
 {
-#ifdef Q_WS_MACX
-	// The MAC clipboard uses \r for lineendings, and we use \n
-	return subst(str, '\r', '\n');
-#endif
-
-	return str;
-/*
-#ifdef Q_WS_WIN
-	// Windows clipboard uses \r\n for lineendings, and we use \n
-	return subst(str, '\r\n', '\n');
-#endif
-*/
+	string s = subst(str, "\r\n", "\n");
+	return subst(s, '\r', '\n');
 }
 
 
Index: src/support/lstrings.h
===================================================================
--- src/support/lstrings.h	(Revision 14120)
+++ src/support/lstrings.h	(Arbeitskopie)
@@ -180,10 +180,10 @@ std::string const getStringFromVector(st
 /// found, else -1. The last item in \p str must be "".
 int findToken(char const * const str[], std::string const & search_token);
 
-///
+/// Convert internal line endings to line endings as expected by the OS
 std::string const externalLineEnding(std::string const & str);
 
-///
+/// Convert line endings in any formnat to internal line endings
 std::string const internalLineEnding(std::string const & str);
 
 

Reply via email to