RE: RE: RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Leuven, E.
> I obviously did. Sorry. I'm still not entirely convinced.

i was thinking like the attached...
Index: src/frontends/qt4/QParagraph.cpp
===
--- src/frontends/qt4/QParagraph.cpp	(revision 18850)
+++ src/frontends/qt4/QParagraph.cpp	(working copy)
@@ -50,7 +50,6 @@
 	connect(applyPB, SIGNAL(clicked()), form_, SLOT(slotApply()));
 	connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
 	connect(restorePB, SIGNAL(clicked()), form_, SLOT(slotRestore()));
-	connect(alignDefaultCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
 	connect(alignJustRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
 	connect(alignLeftRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
 	connect(alignRightRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
@@ -77,9 +76,9 @@
 		" items is used."
 	));
 
-	radioMap[LYX_ALIGN_BLOCK] = alignJustRB;
-	radioMap[LYX_ALIGN_LEFT] = alignLeftRB;
-	radioMap[LYX_ALIGN_RIGHT] = alignRightRB;
+	radioMap[LYX_ALIGN_BLOCK]  = alignJustRB;
+	radioMap[LYX_ALIGN_LEFT]   = alignLeftRB;
+	radioMap[LYX_ALIGN_RIGHT]  = alignRightRB;
 	radioMap[LYX_ALIGN_CENTER] = alignCenterRB;
 }
 
@@ -105,35 +104,44 @@
 
 
 void QParagraphDialog::checkAlignmentRadioButtons() {
-	if (alignDefaultCB->isChecked()) {
-		QPRadioMap::const_iterator it = radioMap.begin();
-		for (; it != radioMap.end(); ++it)
-			it->second->setDisabled(true);
-	} else {
-		LyXAlignment alignPossible = form_->controller().alignPossible();
-		QPRadioMap::const_iterator it = radioMap.begin();
-		for (; it != radioMap.end(); ++it)
-			it->second->setEnabled(it->first & alignPossible);
+	LyXAlignment const alignPossible = form_->controller().alignPossible();
+	LyXAlignment const defaultAlignment = form_->controller().alignDefault();
+	QPRadioMap::iterator it = radioMap.begin();
+	for (; it != radioMap.end(); ++it) {
+		it->second->setEnabled((it->first & alignPossible) ||
+		   (it->first == LYX_ALIGN_LAYOUT));
+		string label;
+		switch (it->first) {
+			case LYX_ALIGN_BLOCK:
+label = "Justified";
+break;
+			case LYX_ALIGN_LEFT:
+label = "Left";
+break;
+			case LYX_ALIGN_CENTER:
+label = "Center";
+break;
+			case LYX_ALIGN_RIGHT:
+label = "Right";
+break;
+		}
+		
+		if (it->first == defaultAlignment)
+			label += " (Default)";
+	
+		it->second->setText(qt_(label));
 	}
 }
 
 
-void QParagraphDialog::on_alignDefaultCB_toggled(bool)
-{
-	checkAlignmentRadioButtons();
-	alignmentToRadioButtons();
-}
-
-
 void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
 {
-	if (align == LYX_ALIGN_LAYOUT)
-		align = form_->controller().alignDefault();
-
 	QPRadioMap::const_iterator it = radioMap.begin();
 	for (;it != radioMap.end(); ++it) {
 		if (align == it->first) {
+			it->second->blockSignals(true);
 			it->second->setChecked(true);
+			it->second->blockSignals(false);
 			return;
 		}
 	}
@@ -145,18 +153,18 @@
 
 LyXAlignment QParagraphDialog::getAlignmentFromDialog()
 {
-	if (alignDefaultCB->isChecked())
-		return LYX_ALIGN_LAYOUT;
+	LyXAlignment const defaultAlignment = form_->controller().alignDefault();
 	LyXAlignment alignment = LYX_ALIGN_NONE;
 	QPRadioMap::const_iterator it = radioMap.begin();
 	for (; it != radioMap.end(); ++it) {
 		if (it->second->isChecked()) {
-			alignment = it->first;
+			if (it->first == defaultAlignment)
+alignment = LYX_ALIGN_LAYOUT;
+			else
+alignment = it->first;
 			break;
 		}
 	}
-	if (alignment == form_->controller().alignDefault())
-		return LYX_ALIGN_LAYOUT;
 	return alignment;
 }
 
@@ -243,15 +251,8 @@
 	}
 
 	// alignment
-	LyXAlignment newAlignment = params.align();
-	LyXAlignment defaultAlignment = controller().alignDefault();
-	bool alignmentIsDefault =
-		newAlignment == LYX_ALIGN_LAYOUT || newAlignment == defaultAlignment;
-	dialog_->alignDefaultCB->blockSignals(true);
-	dialog_->alignDefaultCB->setChecked(alignmentIsDefault);
-	dialog_->alignDefaultCB->blockSignals(false);
 	dialog_->checkAlignmentRadioButtons();
-	dialog_->alignmentToRadioButtons(newAlignment);
+	dialog_->alignmentToRadioButtons(params.align());
 
 	//indentation
 	bool const canindent = controller().canIndent();
Index: src/frontends/qt4/QParagraph.h
===
--- src/frontends/qt4/QParagraph.h	(revision 18850)
+++ src/frontends/qt4/QParagraph.h	(working copy)
@@ -49,8 +49,6 @@
 	void change_adaptor();
 	///
 	void enableLinespacingValue(int);
-	///
-	void on_alignDefaultCB_toggled(bool);
 };
 
 
Index: src/frontends/qt4/ui/ParagraphUi.ui
===
--- src/frontends/qt4/ui/ParagraphUi.ui	(revision 18850)
+++ src/frontends/qt4/ui/ParagraphUi.ui	(working copy)
@@ -8,8 +8,8 @@

 0
 0
-373
-203
+346
+226

   
   
@@ -36,76 +36,14 @@

 6

-   
-
- 
-  0
+   
+
+ 
+  Indent &Paragraph
  
- 
-  

RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Alfredo Braunstein
Leuven, E. wrote:

> Alfredo Braunstein wrote:
>> Let me give you another case: I often write my titles first in Standard
>> Layout and *then* switch the layout to Title. With your approach I would
>> have to manually center it. Awful.
> 
> no.
> 
> reread what i wrote:

That implies I've read it in the first place...

> since default takes precedence things go fine in your example.

I see. 

WRT the current situation, your approach tends to make things default (on
layout switching) against user will, which is sort of lyx philosophy: don't
care what you want, no manual formatting allowed here! 

...

At the end, maybe it's not so terrible. Question: what do you do if the
selection consists in paragraphs with different layouts (with different
defaults)

>> In any case I prefer your other proposal with Default (Justified) and all
>> the rest.
> 
> i can live with that
> 
>> So I vote that or no change ;-)

Still prefer this I think.

> i should remind you that it is friday

I've written that smile yesterday. I keep one or two around for precaution.

A/




RE: RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Juergen Spitzmueller
Leuven, E. wrote:

> you are misunderstanding me. the inset/layout should tell us what the
> default is (and i think it does at the moment). so sometimes this will be
> justified, in other cases center, etc.

I obviously did. Sorry. I'm still not entirely convinced.

Jürgen



RE: RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Leuven, E.
Juergen Spitzmueller wrote:
> Where do you get your stats from?

from a very reliable source

> I just think it's wrong to assume that justified is the de facto "standard"
> alignment.

? 

you are misunderstanding me. the inset/layout should tell us what the default 
is (and i think it does at the moment). so sometimes this will be justified, in 
other cases center, etc.

> I often redefine the alignment of several paragraph styles in the preamble
> (or of certain classes) due to the guidelines of the publishers. The
> approach you are proposing results in dataloss/wrong output,

i don't think so





RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Leuven, E.
Alfredo Braunstein wrote:
> Let me give you another case: I often write my titles first in Standard
> Layout and *then* switch the layout to Title. With your approach I would
> have to manually center it. Awful.

no.

reread what i wrote:

"i would be fine with having the default take precedence in both cases and have 
this in the interface:

o Justified (default)
o Left
o Center
o Right "

...

since default takes precedence things go fine in your example.

>> i really don't see the point of cluttering the user interface for these
>> very small contingencies.
> 
> Clutter is a big word...

CLUTTER is even bigger

> What happends if the user moves the cursor when the dialog is open, does it
> get updated?

it should be (until we get rid of these modeless dialogs)

> In any case I prefer your other proposal with Default (Justified) and all
> the rest.

i can live with that

> So I vote that or no change ;-)

i should remind you that it is friday



RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Juergen Spitzmueller
Leuven, E. wrote:

>> No, they're not.
> 
> where do you get your stats from?

Where do you get your stats from?

I just think it's wrong to assume that justified is the de facto "standard"
alignment. This might be true for standard paragraphs in most book and
article classes, for others it is not. 
I often redefine the alignment of several paragraph styles in the preamble
(or of certain classes) due to the guidelines of the publishers. The
approach you are proposing results in dataloss/wrong output, and this is a
no-opt IMHO.

Jürgen



RE: Re: No paragraph alignment options

2007-06-22 Thread Alfredo Braunstein
Leuven, E. wrote:

> so given that:
> 
> - people don't switch document classes often (i for example never do)
> - switching document layouts often involve information loss because they
> do not define similar environments - case 1 & 2 are rare

Let me give you another case: I often write my titles first in Standard
Layout and *then* switch the layout to Title. With your approach I would
have to manually center it. Awful.

> i really don't see the point of cluttering the user interface for these
> very small contingencies.

Clutter is a big word...

> i also think that
> 
> o Justified (Default)
> o Left
> o Center
> o Right
> 
> will be more understandable to users who don't know latex while at the
> same time it makes default explicit which is think was the starting point

Is not about latex imo, is about document layouts.

> imo of course...

What happends if the user moves the cursor when the dialog is open, does it
get updated?

In any case I prefer your other proposal with Default (Justified) and all
the rest. So I vote that or no change ;-)

A/





RE: RE: Re: No paragraph alignment options

2007-06-22 Thread Leuven, E.
>> - case 1 & 2 are rare
> 
> No, they're not.

where do you get your stats from?





RE: Re: No paragraph alignment options

2007-06-22 Thread Juergen Spitzmueller
Leuven, E. wrote:

> - case 1 & 2 are rare

No, they're not.

Jürgen



RE: Re: No paragraph alignment options

2007-06-22 Thread Leuven, E.
Alfredo Braunstein wrote:
> Specially with new document classes I normally don't know what the layouts
> really are so I switch back and forth several times...

i agree that the only situation where this might reasonably occur is when 
switching document classes.

so given that:

- people don't switch document classes often (i for example never do)
- switching document layouts often involve information loss because they do not 
define similar environments
- case 1 & 2 are rare

i really don't see the point of cluttering the user interface for these very 
small contingencies.

i also think that

o Justified (Default)
o Left
o Center
o Right

will be more understandable to users who don't know latex while at the same 
time it makes default explicit which is think was the starting point

imo of course...