> My suggestion is to remove this menu item for now (and only under
> windows), using the following patch. How to properly fix this issue is
> something for Jose/Jurgen to decide.

By the way, if you would also like to prevent the case of "open
compressed file generated under linux, save a corrupted version", you
can completely remove this feature using the attached patch. It will
always write in plain text format.

Bo
Index: src/LyXAction.cpp
===================================================================
--- src/LyXAction.cpp	(revision 19262)
+++ src/LyXAction.cpp	(working copy)
@@ -113,7 +113,6 @@
 		{ LFUN_BUFFER_BEGIN_SELECT, "buffer-begin-select", ReadOnly },
 		{ LFUN_BUFFER_CHILD_OPEN, "buffer-child-open", ReadOnly },
 		{ LFUN_BUFFER_CHKTEX, "buffer-chktex", ReadOnly },
-		{ LFUN_BUFFER_TOGGLE_COMPRESSION, "buffer-toggle-compression", Noop},
 		{ LFUN_BUFFER_CLOSE, "buffer-close", ReadOnly },
 		{ LFUN_BUFFER_END, "buffer-end", ReadOnly },
 		{ LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly },
Index: src/BufferView.cpp
===================================================================
--- src/BufferView.cpp	(revision 19262)
+++ src/BufferView.cpp	(working copy)
@@ -673,11 +673,6 @@
 		flag.enabled(buffer_);
 		break;
 
-	case LFUN_BUFFER_TOGGLE_COMPRESSION: {
-		flag.setOnOff(buffer_->params().compressed);
-		break;
-	}
-
 	default:
 		flag.enabled(false);
 	}
@@ -990,11 +985,6 @@
 	}
 		break;
 
-	case LFUN_BUFFER_TOGGLE_COMPRESSION:
-		// turn compression on/off
-		buffer_->params().compressed = !buffer_->params().compressed;
-		break;
-
 	case LFUN_NEXT_INSET_TOGGLE: {
 		// this is the real function we want to invoke
 		FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.origin);
Index: src/BufferParams.h
===================================================================
--- src/BufferParams.h	(revision 19262)
+++ src/BufferParams.h	(working copy)
@@ -238,8 +238,6 @@
 	bool outputChanges;
 	/// Time ago we agreed that this was a buffer property [ale990407]
 	std::string parentname;
-	///
-	bool compressed;
 
 	/// the author list for the document
 	AuthorList & authors();
Index: src/lfuns.h
===================================================================
--- src/lfuns.h	(revision 19262)
+++ src/lfuns.h	(working copy)
@@ -360,21 +360,20 @@
 	LFUN_OUTLINE_OUT,
 	LFUN_PARAGRAPH_MOVE_DOWN,                // Edwin 20060408
 	LFUN_PARAGRAPH_MOVE_UP,                  // Edwin 20060408
-	LFUN_BUFFER_TOGGLE_COMPRESSION,                 // bpeng 20060427
-	// 275
 	LFUN_MATH_BIGDELIM,
+	// 275
 	LFUN_CLIPBOARD_PASTE,
 	LFUN_INSET_DISSOLVE,                 // jspitzm 20060807
 	LFUN_CHANGE_NEXT,
 	LFUN_WINDOW_NEW,                 // Abdel 20061021
-	// 280
 	LFUN_WINDOW_CLOSE,               // Abdel 20061023
+	// 280
 	LFUN_UNICODE_INSERT,             // Lgb 20061022
 	LFUN_BOOKMARK_CLEAR,             // bpeng 20061031
 	LFUN_NOMENCL_INSERT,             // Ugras
 	LFUN_NOMENCL_PRINT,              // Ugras
-	// 285
 	LFUN_CLEARPAGE_INSERT,           // Ugras 20061125
+	// 285
 	LFUN_CLEARDOUBLEPAGE_INSERT,     // Ugras 20061125
 	LFUN_LISTING_INSERT,             // Herbert 20011110, bpeng 20070502
 	LFUN_TOOLBAR_TOGGLE,             // Edwin 20070521
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp	(revision 19262)
+++ src/Buffer.cpp	(working copy)
@@ -594,7 +594,6 @@
 
 bool Buffer::readString(std::string const & s)
 {
-	params().compressed = false;
 
 	// remove dummy empty par
 	paragraphs().clear();
@@ -622,12 +621,6 @@
 
 bool Buffer::readFile(FileName const & filename)
 {
-	// Check if the file is compressed.
-	string const format = getFormatFromContents(filename);
-	if (format == "gzip" || format == "zip" || format == "compress") {
-		params().compressed = true;
-	}
-
 	// remove dummy empty par
 	paragraphs().clear();
 	Lexer lex(0, 0);
@@ -810,23 +803,11 @@
 	if (pimpl_->read_only && fname == pimpl_->filename)
 		return false;
 
-	bool retval = false;
+	ofstream ofs(fname.toFilesystemEncoding().c_str(), ios::out|ios::trunc);
+	if (!ofs)
+		return false;
 
-	if (params().compressed) {
-		io::filtering_ostream ofs(io::gzip_compressor() | io::file_sink(fname.toFilesystemEncoding()));
-		if (!ofs)
-			return false;
-
-		retval = write(ofs);
-	} else {
-		ofstream ofs(fname.toFilesystemEncoding().c_str(), ios::out|ios::trunc);
-		if (!ofs)
-			return false;
-
-		retval = write(ofs);
-	}
-
-	return retval;
+	return write(ofs);
 }
 
 
Index: src/BufferParams.cpp
===================================================================
--- src/BufferParams.cpp	(revision 19262)
+++ src/BufferParams.cpp	(working copy)
@@ -354,7 +354,6 @@
 	columns = 1;
 	listings_params = string();
 	pagestyle = "default";
-	compressed = false;
 	for (int iter = 0; iter < 4; ++iter) {
 		user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
 		temp_bullet(iter) = ITEMIZE_DEFAULTS[iter];
Index: lib/ui/stdmenus.inc
===================================================================
--- lib/ui/stdmenus.inc	(revision 19262)
+++ lib/ui/stdmenus.inc	(working copy)
@@ -414,7 +414,6 @@
 		Item "Outline|O" "dialog-toggle toc"
 		Item "Start Appendix Here|A" "appendix"
 		Separator
-		Item "Compressed|m" "buffer-toggle-compression"
 		Item "Settings...|S" "dialog-show document"
 	End
 

Reply via email to