? .math_cursor.h.swp
? .math_hullinset.C.swp
Index: math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.257
diff -u -p -r1.257 math_cursor.C
--- math_cursor.C	22 Apr 2002 16:31:14 -0000	1.257
+++ math_cursor.C	8 May 2002 08:13:05 -0000
@@ -16,6 +16,7 @@
  */
 
 #include <config.h>
+#include <lyxrc.h>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -436,6 +437,7 @@ void MathCursor::plainInsert(MathAtom co
 void MathCursor::insert(char c, MathTextCodes t)
 {
 	//lyxerr << "inserting '" << c << "'\n";
+	selClearOrDel();	
 	plainInsert(MathAtom(new MathCharInset(c, t)));
 }
 
@@ -454,7 +456,7 @@ void MathCursor::insert(MathAtom const &
 		if (t->nargs())
 			selCut();
 		else
-			selDel();
+			selClearOrDel();
 	}
 
 	plainInsert(t);
@@ -653,7 +655,7 @@ void MathCursor::selCopy()
 	dump("selCopy");
 	if (selection_) {
 		theSelection.grab(*this);
-		selClear();
+		//selClear();
 	}
 }
 
@@ -686,6 +688,7 @@ void MathCursor::selDel()
 void MathCursor::selPaste()
 {
 	dump("selPaste");
+	selClearOrDel();
 	theSelection.paste(*this);
 	//theSelection.grab(*this);
 	//selClear();
@@ -720,6 +723,15 @@ void MathCursor::selClear()
 }
 
 
+void MathCursor::selClearOrDel()
+{
+	if (lyxrc.auto_region_delete)
+		selDel();
+	else
+		selClear();
+}
+
+
 void MathCursor::selGet(MathArray & ar)
 {
 	dump("selGet");
@@ -1475,12 +1487,13 @@ bool MathCursor::interpret(char c)
 		return true;
 	}
 
-	if (selection_) {
+	// just clear selection on pressing the space par
+	if (selection_ && c == ' ') {
 		selClear();
-		if (c == ' ')
-			return true;
-		// fall through in the other cases
+		return true;
 	}
+
+	selClearOrDel();
 
 	if (lastcode_ == LM_TC_TEXTRM || par()->asBoxInset()) {
 		// suppress direct insertion of two spaces in a row
Index: math_cursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.h,v
retrieving revision 1.104
diff -u -p -r1.104 math_cursor.h
--- math_cursor.h	26 Mar 2002 12:38:59 -0000	1.104
+++ math_cursor.h	8 May 2002 08:13:05 -0000
@@ -148,6 +148,8 @@ public:
 	void selStart();
 	///
 	void selClear();
+	/// clears or deletes selection depending on lyxrc setting
+	void selClearOrDel();
 	///
 	void selGet(MathArray & ar);
 	///

Attachment: bug338patch.gz
Description: GNU Zip compressed data

Attachment: bug394patch.gz
Description: GNU Zip compressed data

Attachment: bug394patch2.gz
Description: GNU Zip compressed data

Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.334
diff -u -p -r1.334 buffer.C
--- src/buffer.C	8 May 2002 12:58:14 -0000	1.334
+++ src/buffer.C	10 May 2002 07:49:28 -0000
@@ -284,10 +284,11 @@ string last_inset_read;
 #ifndef NO_COMPABILITY
 struct ErtComp
 {
-	ErtComp() : active(false), in_tabular(false) {
+	ErtComp() : active(false), fromlayout(false), in_tabular(false) {
 	}
 	string contents;
 	bool active;
+	bool fromlayout;
 	bool in_tabular;
 	LyXFont font;
 };
@@ -320,6 +321,7 @@ bool Buffer::readLyXformat2(LyXLex & lex
 #ifndef NO_COMPABILITY
 	ert_comp.contents.erase();
 	ert_comp.active = false;
+	ert_comp.fromlayout = false;
 	ert_comp.in_tabular = false;
 #endif
 	int pos = 0;
@@ -401,16 +403,55 @@ bool Buffer::readLyXformat2(LyXLex & lex
 
 
 #ifndef NO_COMPABILITY
+
+Inset * Buffer::isErtInset(Paragraph * par, int pos) const
+{
+	Inset * inset;
+	if ((par->getChar(pos) == Paragraph::META_INSET) &&
+		(inset = par->getInset(pos)) &&
+		(inset->lyxCode() == Inset::ERT_CODE))
+	{
+		return inset;
+	}
+	return 0;
+}
+
 void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive)
 {
-	if (!ert_comp.contents.empty()) {
+	string str = frontStrip(strip(ert_comp.contents, ' '), ' ');
+	if (!str.empty()) {
 		lyxerr[Debug::INSETS] << "ERT contents:\n'"
-				      << ert_comp.contents << "'" << endl;
-		Inset * inset = new InsetERT(params, params.language,
-					     ert_comp.contents, true);
-		par->insertInset(pos++, inset, ert_comp.font);
-		ert_comp.contents.erase();
+			<< str << "'" << endl;
+		// check if we have already an ert inset a position earlier
+		// if this is the case then we should insert the contents
+		// inside the other ertinset as it is stupid to have various
+		// ert in a row.
+		Inset * inset;
+		if ((pos > 0) && (inset=isErtInset(par, pos-1))) {
+			// get the last paragraph from the inset before
+			Paragraph * last = inset->firstParagraph();
+			while(last->next())
+				last = last->next();
+			// create the new paragraph after the last one
+			Paragraph * par = new Paragraph(last);
+			par->layout(textclasslist[params.textclass].defaultLayoutName());
+			par->setInsetOwner(last->inInset());
+			// set the contents
+			LyXFont font(LyXFont::ALL_INHERIT, params.language);
+			string::const_iterator cit = str.begin();
+			string::const_iterator end = str.end();
+			pos_type pos = 0;
+			for (; cit != end; ++cit) {
+				par->insertChar(pos++, *cit, font);
+			}
+		} else {
+			Inset * inset =
+				new InsetERT(params, params.language, str, true);
+			par->insertInset(pos++, inset, ert_comp.font);
+		}
 	}
+	ert_comp.contents.erase();
+	ert_comp.fromlayout = false;
 	if (set_inactive) {
 		ert_comp.active = false;
 	}
@@ -459,9 +500,20 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 		++pos;
 	} else if (token == "\\layout") {
 #ifndef NO_COMPABILITY
+		bool old_fromlayout = ert_comp.fromlayout;
+		bool create_new_par = true;
 		ert_comp.in_tabular = false;
 		// Do the insetert.
-		insertErtContents(par, pos);
+		if (!par->size() && par->previous() &&
+			(par->previous()->size() == 1) &&
+			isErtInset(par->previous(), par->previous()->size()-1))
+		{
+			int p = par->previous()->size();
+			insertErtContents(par->previous(), p);
+			create_new_par = false;
+		} else {
+			insertErtContents(par, pos);
+		}
 #endif
 		// reset the font as we start a new layout and if the font is
 		// not ALL_INHERIT,document_language then it will be set to the
@@ -481,7 +533,10 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 #ifndef NO_COMPABILITY
 		if (compare_no_case(layoutname, "latex") == 0) {
 			ert_comp.active = true;
+			ert_comp.fromlayout = true;
 			ert_comp.font = font;
+			if (old_fromlayout)
+				create_new_par = false;
 		}
 #endif
 		bool hasLayout = tclass.hasLayout(layoutname);
@@ -547,6 +602,9 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 			++pos;
 		} else {
 #endif
+#ifndef NO_COMPABILITY
+		if (create_new_par) {
+#endif
 			if (!first_par)
 				first_par = par;
 			else {
@@ -561,6 +619,19 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 			if (!layout.obsoleted_by().empty())
 				par->layout(layout.obsoleted_by());
 			par->params().depth(depth);
+#ifndef NO_COMPABILITY
+		} else {
+			// we duplicate code here because it's easier to remove
+			// the code then of NO_COMPATIBILITY
+			par->layout(layoutname);
+			// Test whether the layout is obsolete.
+			LyXLayout const & layout =
+				textclasslist[params.textclass][par->layout()];
+			if (!layout.obsoleted_by().empty())
+				par->layout(layout.obsoleted_by());
+			par->params().depth(depth);
+		}
+#endif
 #if USE_CAPTION
 		}
 #endif
@@ -1002,6 +1073,14 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 			font.setLanguage(params.language);
 			lex.printError("Unknown language `$$Token'");
 		}
+#ifndef NO_COMPABILITY
+		// if the contents is still empty we're just behind the
+		// latex font change and so this inset should also be
+		// inserted with that language tag!
+		if (ert_comp.active && ert_comp.contents.empty()) {
+			ert_comp.font.setLanguage(font.language());
+		}
+#endif			
 	} else if (token == "\\numeric") {
 		lex.next();
 		font.setNumber(font.setLyXMisc(lex.getString()));
@@ -1091,7 +1170,9 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 #ifndef NO_COMPABILITY
 		ert_comp = ert_stack.top();
 		ert_stack.pop();
+#if 0
 		insertErtContents(par, pos);
+#endif
 #endif
 	} else if (token == "\\SpecialChar") {
 		LyXLayout const & layout =
Index: src/buffer.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v
retrieving revision 1.94
diff -u -p -r1.94 buffer.h
--- src/buffer.h	16 Apr 2002 09:12:36 -0000	1.94
+++ src/buffer.h	10 May 2002 07:49:28 -0000
@@ -127,6 +127,8 @@ public:
 				 LyXFont const &, string const &) const;
 #ifndef NO_COMPABILITY
 	///
+	Inset * isErtInset(Paragraph * par, int pos) const;
+	///
 	void insertErtContents(Paragraph * par, int & pos,
 			       bool set_inactive = true);
 #endif
Index: src/insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.291
diff -u -p -r1.291 insettext.C
--- src/insets/insettext.C	1 May 2002 22:17:08 -0000	1.291
+++ src/insets/insettext.C	9 May 2002 13:22:05 -0000
@@ -695,7 +695,10 @@ void InsetText::edit(BufferView * bv, in
 		lt = getLyXText(bv);
 		clear = true;
 	}
-	if (!checkAndActivateInset(bv, x, tmp_y, button)) {
+	// we put here -1 and not button as now the button in the
+	// edit call should not be needed we will fix this in 1.3.x
+	// cycle hopefully (Jug 20020509)
+	if (!checkAndActivateInset(bv, x, tmp_y, -1)) {
 		lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
 					    y + insetAscent);
 		lt->cursor.x_fix(lt->cursor.x());
@@ -2067,7 +2070,12 @@ bool InsetText::checkAndActivateInset(Bu
 	int dummyx = x;
 	int dummyy = y + insetAscent;
 	Inset * inset = bv->checkInsetHit(getLyXText(bv), dummyx, dummyy);
-
+	// we only do the edit() call if the inset was hit by the mouse
+	// or if it is a highly editable inset. So we should call this
+	// function from our own edit with button < 0.
+	if (button < 0 && !isHighlyEditableInset(inset))
+		return false;
+	
 	if (inset) {
 		if (x < 0)
 			x = insetWidth;
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.247
diff -u -p -r1.247 text.C
--- src/text.C	8 May 2002 12:58:16 -0000	1.247
+++ src/text.C	9 May 2002 14:58:59 -0000
@@ -1755,6 +1755,12 @@ void LyXText::breakParagraph(BufferView 
      keep_layout = 2;
    else
      keep_layout = layout.isEnvironment();
+
+   // we need to set this before we insert the paragraph. IMO the
+   // breakParagraph call should return a bool if it inserts the
+   // paragraph before or behind and we should react on that one
+   // but we can fix this in 1.3.0 (Jug 20020509)
+   bool const isempty = (layout.keepempty && !cursor.par()->size());
    cursor.par()->breakParagraph(bview->buffer()->params, cursor.pos(),
 				keep_layout);
 
@@ -1807,7 +1813,7 @@ void LyXText::breakParagraph(BufferView 
 
    /* This check is necessary. Otherwise the new empty paragraph will
     * be deleted automatically. And it is more friendly for the user! */
-   if (cursor.pos() || layout.keepempty)
+   if (cursor.pos() || isempty)
 	   setCursor(bview, cursor.par()->next(), 0);
    else
 	   setCursor(bview, cursor.par(), 0);
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.204
diff -u -p -r1.204 paragraph.C
--- src/paragraph.C	8 May 2002 12:58:16 -0000	1.204
+++ src/paragraph.C	9 May 2002 14:59:03 -0000
@@ -891,7 +891,8 @@ void Paragraph::breakParagraph(BufferPar
 		tmp->setLabelWidthString(params().labelWidthString());
 	}
 
-	bool isempty = textclasslist[bparams.textclass][layout()].keepempty;
+	bool isempty = (textclasslist[bparams.textclass][layout()].keepempty &&
+	                !size());
 	if (!isempty && (size() > pos || !size() || flag == 2)) {
 		tmp->layout(layout());
 		tmp->params().align(params().align());
X-From-Line: [EMAIL PROTECTED]  Tue Apr 30 22:56:15 2002
Return-Path: <[EMAIL PROTECTED]>
Received: from localhost (IDENT:[EMAIL PROTECTED] [127.0.0.1])
	by trylle.birdstep.com (8.11.6/8.11.6) with ESMTP id g3UKuFG19149
	for <larsbj@localhost>; Tue, 30 Apr 2002 22:56:15 +0200
Received: from ketchup.birdstep.com [194.143.101.3]
	by localhost with POP3 (fetchmail-5.9.5)
	for larsbj@localhost (single-drop); Tue, 30 Apr 2002 22:56:15 +0200 (CEST)
Received: from wierdlmpc.msci.memphis.edu (wierdlmpc.msci.memphis.edu [141.225.11.87])
	by ketchup.birdstep.org (8.9.3/8.9.3) with SMTP id SAA00192
	for <[EMAIL PROTECTED]>; Tue, 30 Apr 2002 18:00:05 +0200 (CEST)
	(envelope-from [EMAIL PROTECTED])
Received: (qmail 19479 invoked by uid 514); 30 Apr 2002 16:00:30 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 19470 invoked from network); 30 Apr 2002 16:00:29 -0000
X-Gnus-Mail-Source: file:/var/mail/larsbj
Message-ID: <[EMAIL PROTECTED]>
Date: Tue, 30 Apr 2002 17:58:45 +0200
From: Herbert Voss <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1
X-Accept-Language: en-us
MIME-Version: 1.0
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: [PATCH] keep option of vertical length
Content-Type: multipart/mixed;
 boundary="------------080409080405070205000603"
X-UIDL: 31d7beb5f7615940d0d22156948f3eca
Lines: 74
Xref: trylle.birdstep.com mail.lyx-devel:25256

This is a multi-part message in MIME format.
--------------080409080405070205000603
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I send this one the second time. it fixes a bug,
seen with Tuukkas testfile. long time ago ...

Herbert



-- 
http://www.lyx.org/help/

--------------080409080405070205000603
Content-Type: text/plain;
 name="keep.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="keep.diff"

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.697
diff -u -r1.697 ChangeLog
--- src/ChangeLog	30 Apr 2002 10:58:10 -0000	1.697
+++ src/ChangeLog	30 Apr 2002 15:52:02 -0000
@@ -1,3 +1,8 @@
+2002-04-30  Herbert Voss  <[EMAIL PROTECTED]>
+
+	* buffer.C (parseSingleLyXformat2Token): fix bug with ignored
+	"keep" option
+
 2002-04-30  Juergen Vigna  <[EMAIL PROTECTED]>
 
 	* buffer.C (parseSingleLyXformat2Token): reset the font before the
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.330
diff -u -r1.330 buffer.C
--- src/buffer.C	30 Apr 2002 10:58:10 -0000	1.330
+++ src/buffer.C	30 Apr 2002 15:52:03 -0000
@@ -1035,15 +1035,21 @@
 	} else if (token == "\\added_space_top") {
 		lex.nextToken();
 		VSpace value = VSpace(lex.getString());
+		// only add the length when value > 0 or
+		// with option keep
 		if ((value.length().len().value() != 0) ||
+		    value.keep() ||
 		    (value.kind() != VSpace::LENGTH))
-		    par->params().spaceTop(value);
+			par->params().spaceTop(value);
 	} else if (token == "\\added_space_bottom") {
 		lex.nextToken();
 		VSpace value = VSpace(lex.getString());
+		// only add the length when value > 0 or
+		// with option keep
 		if ((value.length().len().value() != 0) ||
+		    value.keep() ||
 		    (value.kind() != VSpace::LENGTH))
-		    par->params().spaceBottom(value);
+			par->params().spaceBottom(value);
 #ifndef NO_COMPABILITY
 #ifndef NO_PEXTRA_REALLY
 	} else if (token == "\\pextra_type") {

--------------080409080405070205000603--




Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.380
diff -u -p -r1.380 ChangeLog
--- ChangeLog	9 May 2002 13:43:44 -0000	1.380
+++ ChangeLog	10 May 2002 13:08:25 -0000
@@ -1,3 +1,7 @@
+2002-05-10  Dekel Tsur  <[EMAIL PROTECTED]>
+
+	* FormDocument.C (language_apply): Fix language changing.
+
 2002-05-09  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Tooltips.C: enable tooltips by default.
Index: FormDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.100
diff -u -p -r1.100 FormDocument.C
--- FormDocument.C	1 May 2002 09:46:36 -0000	1.100
+++ FormDocument.C	10 May 2002 13:08:25 -0000
@@ -901,9 +901,9 @@ bool FormDocument::language_apply(Buffer
 		new_language = default_language;
 
 	if (old_language != new_language
-	    && old_language->RightToLeft() == params.language->RightToLeft()
+	    && old_language->RightToLeft() == new_language->RightToLeft()
 	    && !lv_->buffer()->isMultiLingual())
-		lv_->buffer()->changeLanguage(old_language, params.language);
+		lv_->buffer()->changeLanguage(old_language, new_language);
 
 	if (old_language != new_language) {
 		redo = true;
Index: math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.258
diff -u -p -r1.258 math_cursor.C
--- math_cursor.C	8 May 2002 16:17:57 -0000	1.258
+++ math_cursor.C	13 May 2002 08:34:45 -0000
@@ -130,7 +130,7 @@ struct Selection
 	{
 		if (data_.nargs() == 1) {
 			// single cell/part of cell
-			cursor.insert(data_.cell(0));
+			cursor.paste(data_.cell(0));
 		} else {
 			// mulitple cells
 			idx_type idx; // index of upper left cell
Index: src/LaTeXFeatures.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LaTeXFeatures.C,v
retrieving revision 1.61
diff -u -p -r1.61 LaTeXFeatures.C
--- src/LaTeXFeatures.C	23 Apr 2002 22:34:24 -0000	1.61
+++ src/LaTeXFeatures.C	7 May 2002 12:51:26 -0000
@@ -303,8 +303,8 @@ string const LaTeXFeatures::getMacros() 
 	// other
 	if (isRequired("NeedLyXMinipageIndent"))
 		macros << minipageindent_def;
-	if (isRequired("ParagraphIndent"))
-		macros << paragraphindent_def;
+	if (isRequired("ParagraphLeftIndent"))
+		macros << paragraphleftindent_def;
 	if (isRequired("NeedLyXFootnoteCode"))
 		macros << floatingfootnote_def;
 
Index: src/ParagraphParameters.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphParameters.C,v
retrieving revision 1.8
diff -u -p -r1.8 ParagraphParameters.C
--- src/ParagraphParameters.C	21 Mar 2002 17:25:09 -0000	1.8
+++ src/ParagraphParameters.C	7 May 2002 12:51:26 -0000
@@ -268,6 +268,21 @@ void ParagraphParameters::labelWidthStri
 	set_from_struct(tmp);
 }
 
+
+
+LyXLength const & ParagraphParameters::leftIndent() const
+{
+	return param->leftindent;
+}
+
+
+void ParagraphParameters::leftIndent(LyXLength const & li)
+{
+	ParameterStruct tmp(*param);
+	tmp.leftindent = li;
+	set_from_struct(tmp);
+}
+
 #ifndef NO_PEXTRA_REALLY
 int ParagraphParameters::pextraType() const
 {
Index: src/ParagraphParameters.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphParameters.h,v
retrieving revision 1.7
diff -u -p -r1.7 ParagraphParameters.h
--- src/ParagraphParameters.h	3 Aug 2001 18:28:03 -0000	1.7
+++ src/ParagraphParameters.h	7 May 2002 12:51:26 -0000
@@ -87,6 +87,11 @@ public:
 	string const & labelWidthString() const;
 	///
 	void labelWidthString(string const &);
+	///
+	LyXLength const & leftIndent() const;
+	///
+	void leftIndent(LyXLength const &);
+	///
 #ifndef NO_PEXTRA_REALLY
 	///
 	int pextraType() const;
Index: src/ParameterStruct.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParameterStruct.h,v
retrieving revision 1.5
diff -u -p -r1.5 ParameterStruct.h
--- src/ParameterStruct.h	21 Mar 2002 17:25:09 -0000	1.5
+++ src/ParameterStruct.h	7 May 2002 12:51:26 -0000
@@ -6,6 +6,7 @@
 #include "vspace.h"
 #include "Spacing.h"
 #include "layout.h"
+#include "lyxlength.h"
 
 #ifdef __GNUG__
 #pragma interface
@@ -45,6 +46,9 @@ struct ParameterStruct {
 	string labelstring;
 	///
 	string labelwidthstring;
+	///
+	LyXLength leftindent;
+	///
 #ifndef NO_PEXTRA_REALLY
 	///
 	int pextra_type;
@@ -93,6 +97,7 @@ bool operator==(ParameterStruct const & 
 		&& ps1.appendix == ps2.appendix
 		&& ps1.labelstring == ps2.labelstring
 		&& ps1.labelwidthstring == ps2.labelwidthstring
+		&& ps1.leftindent == ps2.leftindent
 #ifndef NO_PEXTRA_REALLY
 		&& ps1.pextra_type == ps2.pextra_type
 		&& ps1.pextra_width == ps2.pextra_width
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.333
diff -u -p -r1.333 buffer.C
--- src/buffer.C	3 May 2002 11:56:47 -0000	1.333
+++ src/buffer.C	7 May 2002 12:51:36 -0000
@@ -718,6 +718,10 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 		params.fonts = lex.getString();
 	} else if (token == "\\noindent") {
 		par->params().noindent(true);
+	} else if (token == "\\leftindent") {
+		lex.nextToken();
+		LyXLength value(lex.getString());
+		par->params().leftIndent(value);
 	} else if (token == "\\fill_top") {
 		par->params().spaceTop(VSpace(VSpace::VFILL));
 	} else if (token == "\\fill_bottom") {
@@ -1385,6 +1389,11 @@ Buffer::parseSingleLyXformat2Token(LyXLe
 			}
 			parBeforeMinipage->insertInset
 				(parBeforeMinipage->size(), mini, font);
+		} else if (par->params().pextraType() == Paragraph::PEXTRA_INDENT) {
+			par->params().leftIndent(LyXLength(par->params().pextraWidth()));
+			if (!par->params().pextraWidthp().empty()) {
+				par->params().leftIndent(LyXLength((par->params().pextraWidthp())+"col%"));
+			}
 		}
 	}
 	// End of pextra_minipage compability
@@ -2587,7 +2596,9 @@ void Buffer::latexParagraphs(ostream & o
 				was_title = false;
 			}
 
-			if (layout.isEnvironment()) {
+			if (layout.isEnvironment() ||
+				!par->params().leftIndent().zero())
+			{
 				par = par->TeXEnvironment(this, params, ofs, texrow);
 			} else {
 				par = par->TeXOnePar(this, params, ofs, texrow, false);
Index: src/lyx_sty.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_sty.C,v
retrieving revision 1.8
diff -u -p -r1.8 lyx_sty.C
--- src/lyx_sty.C	21 Mar 2002 17:25:12 -0000	1.8
+++ src/lyx_sty.C	7 May 2002 12:51:36 -0000
@@ -75,8 +75,8 @@ string const guilsinglright_def =
 	"  {\\usefont{U}{lasy}{m}{n}\\char'51}%\n"
 	"}";
 
-string const paragraphindent_def =
-	"\\newenvironment{LyXParagraphIndent}[1]%\n"
+string const paragraphleftindent_def =
+	"\\newenvironment{LyXParagraphLeftIndent}[1]%\n"
 	"{\n"
 	"  \\begin{list}{}{%\n"
 	"    \\setlength\\topsep{0pt}%\n"
Index: src/lyx_sty.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_sty.h,v
retrieving revision 1.9
diff -u -p -r1.9 lyx_sty.h
--- src/lyx_sty.h	21 Mar 2002 17:25:12 -0000	1.9
+++ src/lyx_sty.h	7 May 2002 12:51:36 -0000
@@ -53,7 +53,7 @@ extern string const guilsinglleft_def;
 ///
 extern string const guilsinglright_def;
 ///
-extern string const paragraphindent_def;
+extern string const paragraphleftindent_def;
 ///
 extern string const floatingfootnote_def;
 ///
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.203
diff -u -p -r1.203 paragraph.C
--- src/paragraph.C	5 May 2002 16:33:16 -0000	1.203
+++ src/paragraph.C	7 May 2002 12:51:39 -0000
@@ -231,7 +231,11 @@ void Paragraph::writeFile(Buffer const *
 	// Noindent?
 	if (params().noindent())
 		os << "\\noindent ";
-
+	
+	// Do we have a manual left indent?
+	if (!params().leftIndent().zero())
+		os << "\\leftindent " << params().leftIndent().asString() << " ";
+	
 	// Alignment?
 	if (params().align() != LYX_ALIGN_LAYOUT) {
 		int h = 0;
@@ -389,6 +393,9 @@ void Paragraph::validate(LaTeXFeatures &
 		}
 	}
 
+	if (!params().leftIndent().zero())
+		features.require("ParagraphLeftIndent");
+
 	// then the insets
 	LyXLayout const & lout = textclasslist[bparams.textclass][layout()];
 
@@ -1843,6 +1850,14 @@ Paragraph * Paragraph::TeXEnvironment(Bu
 			texrow.newline();
 		}
 	}
+	
+	bool leftindent_open = false;
+	if (!params().leftIndent().zero()) {
+		os << "\\begin{LyXParagraphLeftIndent}{" <<
+			params().leftIndent().asLatexString() << "}\n";
+		texrow.newline();
+		leftindent_open = true;
+	}
 
 	if (style.isEnvironment()) {
 		if (style.latextype == LATEX_LIST_ENVIRONMENT) {
@@ -1888,13 +1903,19 @@ Paragraph * Paragraph::TeXEnvironment(Bu
 		}
 	} while (par
 		 && par->layout() == layout()
-		 && par->params().depth() == params().depth());
+		 && par->params().depth() == params().depth()
+		 && par->params().leftIndent() == params().leftIndent());
 
 	if (style.isEnvironment()) {
 		os << "\\end{" << style.latexname() << "}\n";
 		texrow.newline();
 	}
 
+	if (leftindent_open) {
+		os << "\\end{LyXParagraphLeftIndent}\n";
+		texrow.newline();
+	}
+	
 	lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
 	return par;  // ale970302
 }
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.246
diff -u -p -r1.246 text.C
--- src/text.C	5 May 2002 16:33:18 -0000	1.246
+++ src/text.C	7 May 2002 12:51:45 -0000
@@ -849,6 +849,15 @@ int LyXText::leftMargin(BufferView * bvi
 	break;
 	}
 
+	if ((workWidth(bview) > 0) &&
+		!row->par()->params().leftIndent().zero())
+	{
+		LyXLength const len = row->par()->params().leftIndent();
+		int const tw = inset_owner ?
+			inset_owner->latexTextWidth(bview) : workWidth(bview);
+		x += len.inPixels(tw, bview->text->defaultHeight());
+	}
+
 	LyXAlignment align; // wrong type
 
 	if (row->par()->params().align() == LYX_ALIGN_LAYOUT)
Index: LaTeXFeatures.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LaTeXFeatures.C,v
retrieving revision 1.62
diff -u -p -r1.62 LaTeXFeatures.C
--- LaTeXFeatures.C	8 May 2002 12:58:14 -0000	1.62
+++ LaTeXFeatures.C	9 May 2002 10:15:08 -0000
@@ -311,14 +311,22 @@ string const LaTeXFeatures::getMacros() 
 	// floats
 	getFloatDefinitions(macros);
 
+	return macros.str().c_str();
+}
+
+
+string const LaTeXFeatures::getBabelOptions() const
+{
+	ostringstream tmp;
+
 	for (LanguageList::const_iterator cit = UsedLanguages.begin();
 	     cit != UsedLanguages.end(); ++cit)
 		if (!(*cit)->latex_options().empty())
-			macros << (*cit)->latex_options() << '\n';
+			tmp << (*cit)->latex_options() << '\n';
 	if (!params.language->latex_options().empty())
-		macros << params.language->latex_options() << '\n';
+		tmp << params.language->latex_options() << '\n';
 
-	return macros.str().c_str();
+	return tmp.str().c_str();
 }
 
 
Index: LaTeXFeatures.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LaTeXFeatures.h,v
retrieving revision 1.40
diff -u -p -r1.40 LaTeXFeatures.h
--- LaTeXFeatures.h	21 Mar 2002 17:25:08 -0000	1.40
+++ LaTeXFeatures.h	9 May 2002 10:15:08 -0000
@@ -50,6 +50,8 @@ public:
 	string const getPackages() const;
 	/// The macros definitions needed by the document
 	string const getMacros() const;
+	///
+	string const getBabelOptions() const;
 	/// The definitions needed by the document's textclass
 	string const getTClassPreamble() const;
 	/// The sgml definitions needed by the document (dobook/linuxdoc)
Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.334
diff -u -p -r1.334 buffer.C
--- buffer.C	8 May 2002 12:58:14 -0000	1.334
+++ buffer.C	9 May 2002 10:15:10 -0000
@@ -2446,8 +2446,6 @@ void Buffer::makeLaTeXFile(string const 
 				+ params.preamble + '\n';
 		}
 
-		preamble += "\\makeatother\n";
-
 		// Itemize bullet settings need to be last in case the user
 		// defines their own bullets that use a package included
 		// in the user-defined preamble -- ARRae
@@ -2489,8 +2487,6 @@ void Buffer::makeLaTeXFile(string const 
 			texrow.newline();
 		}
 
-		ofs << preamble;
-
 		// We try to load babel late, in case it interferes
 		// with other packages.
 		if (use_babel) {
@@ -2500,9 +2496,13 @@ void Buffer::makeLaTeXFile(string const 
 				tmp = string("\\usepackage[") +
 					language_options.str().c_str() +
 					"]{babel}";
-			ofs << tmp << "\n";
-			texrow.newline();
+			preamble += tmp + "\n";
+			preamble += features.getBabelOptions();
 		}
+
+		preamble += "\\makeatother\n";
+
+		ofs << preamble;
 
 		// make the body.
 		ofs << "\\begin{document}\n";
X-From-Line: [EMAIL PROTECTED]  Sat May  4 17:27:28 2002
Return-Path: <[EMAIL PROTECTED]>
Received: from localhost (IDENT:[EMAIL PROTECTED] [127.0.0.1])
	by trylle.birdstep.com (8.11.6/8.11.6) with ESMTP id g44FRSG22388
	for <larsbj@localhost>; Sat, 4 May 2002 17:27:28 +0200
Received: from ketchup.birdstep.com [194.143.101.3]
	by localhost with POP3 (fetchmail-5.9.5)
	for larsbj@localhost (single-drop); Sat, 04 May 2002 17:27:28 +0200 (CEST)
Received: from wierdlmpc.msci.memphis.edu (wierdlmpc.msci.memphis.edu [141.225.11.87])
	by ketchup.birdstep.org (8.9.3/8.9.3) with SMTP id RAA84894
	for <[EMAIL PROTECTED]>; Sat, 4 May 2002 17:26:26 +0200 (CEST)
	(envelope-from [EMAIL PROTECTED])
Received: (qmail 28442 invoked by uid 514); 4 May 2002 15:26:37 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 28429 invoked from network); 4 May 2002 15:26:36 -0000
X-Gnus-Mail-Source: file:/var/mail/larsbj
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 04 May 2002 17:25:32 +0200
From: Herbert Voss <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1
X-Accept-Language: en-us
MIME-Version: 1.0
CC: "Garst R. Reese" <[EMAIL PROTECTED]>,
   Lyx Mailing List <[EMAIL PROTECTED]>
Subject: Re: [PATCH]Re: BUG pre5, maybe old
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Content-Type: multipart/mixed;
 boundary="------------030508080908020504080409"
X-UIDL: fb2ff7eac028ced7825de645904823b1
Lines: 79
Xref: trylle.birdstep.com mail.lyx-devel:25603

--------------030508080908020504080409
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Herbert Voss wrote:

> Garst R. Reese wrote:
> 
>> Set Latex size in a graphic as Custom Width 100 %page
>> Change to Scale 60%
>> So far so good, update postscript sees the change.
>> Save file and exit.
>> Reload. It is reset to Custom Width 100 %page unless you clear the
>> numeric field (100).
> 
> 
> patch attached       


next try

Herbert



-- 
http://www.lyx.org/help/

--------------030508080908020504080409
Content-Type: text/plain;
 name="size.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="size.diff"

Index: src/insets/ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.411
diff -u -r1.411 ChangeLog
--- src/insets/ChangeLog	3 May 2002 11:56:49 -0000	1.411
+++ src/insets/ChangeLog	4 May 2002 15:18:17 -0000
@@ -1,3 +1,7 @@
+2002-05-04  Herbert Voss  <[EMAIL PROTECTED]>
+
+	* InsetgraphicsParams.C (read): fix bug with WH
+
 2002-05-02  Jos=E9 Matos  <[EMAIL PROTECTED]>
=20
 	* insetgraphics.C (validate): acess params as everyone else.
Index: src/insets/insetgraphicsParams.C
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphicsParams=
=2EC,v
retrieving revision 1.35
diff -u -r1.35 insetgraphicsParams.C
--- src/insets/insetgraphicsParams.C	1 May 2002 10:23:51 -0000	1.35
+++ src/insets/insetgraphicsParams.C	4 May 2002 15:18:17 -0000
@@ -256,11 +256,9 @@
 	} else if (token =3D=3D "width") {
 		lex.next();
 		width =3D LyXLength(lex.getString());
-		size_type =3D WH;
 	} else if (token =3D=3D "height") {
 		lex.next();
 		height =3D LyXLength(lex.getString());
-		size_type =3D WH;
 	} else if (token =3D=3D "keepAspectRatio") {
 		keepAspectRatio =3D true;
 	} else if (token =3D=3D "scale") {

--------------030508080908020504080409--








Which of these patches do we _not_ need now for 1.2.0 and can rather
wait for 1.2.1.

Also which of these are really important?

-- 
	Lgb

Reply via email to