Angus wrote :

>Alain Castera wrote:

>> To make it short, I reported the changes I've made to my copy of
>> 1.3.0pre1, changes that I would like to become persistent across the
>> versions :
>> - bad handling of "default alignment" (LYX_ALIGN_LAYOUT is changed
>> by the paragraph pop-up)
>> - default alignement is not always given by the LAYOUT
>> (tabular,...)
>> - tabular wysiwym

>I remember this. It was a good idea at the time and remains a ggod 
>idea.
>I think that you'll have to start from scratch anyway. That being the 
>case, I think it would be a good idea to submit separate patches.

Hi Angus.
Here is the first one. It introduces a new button in the paragraph form 
(thus, it has to be ported to qt too ...). You can now explicitely says 
that a paragraph follows its default alignment or is intentionnaly set as 
"BLOCK" (i.e., justified I presume). What is missing too is the handling 
of the latex output when you want a justified paragraph when the default 
is something else (parbox?), but this can be postponed (I need the proper 
handling of default alignment for the next steps, not the refined output, 
and nothing is lost compared to the actual situation).

Can you please have a look ? Can this be pushed under CVS ?

Thank's

Alain

-- 
 *******************************************************************
 *        Alain Castera                                            *
 * IPNL - UCB Lyon 1             | e-mail : [EMAIL PROTECTED] *
 * Bat. Paul Dirac               |      or        [EMAIL PROTECTED] *
 * Campus de la Doua             | Telephone :     (+33) 472448429 *
 * F69622 Villeurbanne CEDEX     | Fax :           (+33) 472448004 *
 *******************************************************************
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.1617
diff -u -r1.1617 ChangeLog
--- src/ChangeLog       2003/10/10 09:01:19     1.1617
+++ src/ChangeLog       2003/10/13 13:25:49
@@ -1,3 +1,9 @@
+2003_10-13  Alain Castera <[EMAIL PROTECTED]>
+
+       * ParagraphParameters.C
+       * ParagraphParameters.h
+       * ParameterStruct.h
+       * text2.C : makes difference between "default" and "block" alignment. fix a 
bug which forced the alignment to be "BLOCK" instead of "LAYOUT".
 
 2003-10-10  André Pönitz  <[EMAIL PROTECTED]>
 
Index: src/ParagraphParameters.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ParagraphParameters.C,v
retrieving revision 1.33
diff -u -r1.33 ParagraphParameters.C
--- src/ParagraphParameters.C   2003/10/06 15:42:03     1.33
+++ src/ParagraphParameters.C   2003/10/13 13:25:50
@@ -225,6 +225,12 @@
 }
 
 
+bool ParagraphParameters::alignDefault() const
+{
+  return (param->align == LYX_ALIGN_LAYOUT);
+}
+
+
 void ParagraphParameters::depth(depth_type d)
 {
        ParameterStruct tmp(*param);
@@ -431,7 +437,7 @@
                   << ' ';
 
        // Alignment?
-       if (align() != LYX_ALIGN_LAYOUT) {
+       if (!alignDefault()) {
                int h = 0;
                switch (align()) {
                case LYX_ALIGN_LEFT: h = 1; break;
@@ -481,8 +487,9 @@
 
        // Alignment
        LyXLayout_ptr const & layout = par.layout();
-       if (params.align() == LYX_ALIGN_LAYOUT)
-               params.align(layout->align);
+       // AC TO BE DONE : where is this !!#* needed ?
+       //      if (params.align() == LYX_ALIGN_LAYOUT)
+       //      params.align(layout->align);
 
        ostringstream os;
        params.write(os);
Index: src/ParagraphParameters.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ParagraphParameters.h,v
retrieving revision 1.20
diff -u -r1.20 ParagraphParameters.h
--- src/ParagraphParameters.h   2003/10/07 06:45:24     1.20
+++ src/ParagraphParameters.h   2003/10/13 13:25:50
@@ -76,7 +76,9 @@
        ///
        void align(LyXAlignment);
        ///
-       typedef lyx::depth_type depth_type;
+        bool alignDefault() const;
+        ///
+       typedef lyx::depth_type depth_type;
        ///
        depth_type depth() const;
        ///
Index: src/ParameterStruct.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ParameterStruct.h,v
retrieving revision 1.12
diff -u -r1.12 ParameterStruct.h
--- src/ParameterStruct.h       2003/10/06 15:42:03     1.12
+++ src/ParameterStruct.h       2003/10/13 13:25:50
@@ -63,7 +63,7 @@
 ParameterStruct::ParameterStruct()
        : noindent(false), line_top(false), line_bottom(false),
          pagebreak_top(false), pagebreak_bottom(false),
-         align(LYX_ALIGN_BLOCK), depth(0), start_of_appendix(false),
+         align(LYX_ALIGN_LAYOUT), depth(0), start_of_appendix(false),
          appendix(false)
 {}
 
Index: src/text2.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text2.C,v
retrieving revision 1.474
diff -u -r1.474 text2.C
--- src/text2.C 2003/10/10 09:01:20     1.474
+++ src/text2.C 2003/10/13 13:25:51
@@ -809,14 +809,10 @@
                // does the layout allow the new alignment?
                LyXLayout_ptr const & layout = pit->layout();
 
-               if (align == LYX_ALIGN_LAYOUT)
-                       align = layout->align;
-               if (align & layout->alignpossible) {
-                       if (align == layout->align)
-                               params.align(LYX_ALIGN_LAYOUT);
-                       else
-                               params.align(align);
-               }
+               if ((align == LYX_ALIGN_LAYOUT) ||
+                   (align & layout->alignpossible))
+                  params.align(align);
+
                pit->setLabelWidthString(labelwidthstring);
                params.noindent(noindent);
                --tmppit;
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.837
diff -u -r1.837 ChangeLog
--- src/frontends/xforms/ChangeLog      2003/10/07 22:59:57     1.837
+++ src/frontends/xforms/ChangeLog      2003/10/13 13:25:57
@@ -1,3 +1,8 @@
+2003-10-13  Alain Castera <[EMAIL PROTECTED]>
+
+       * FormParagraph.C
+       * forms/form_paragraph.fd : make difference between default alignment and 
block alignment.
+
 2003-10-07  Angus Leeming  <[EMAIL PROTECTED]>
 
        * FormExternal.[Ch]:
Index: src/frontends/xforms/FormParagraph.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormParagraph.C,v
retrieving revision 1.98
diff -u -r1.98 FormParagraph.C
--- src/frontends/xforms/FormParagraph.C        2003/10/06 15:42:55     1.98
+++ src/frontends/xforms/FormParagraph.C        2003/10/13 13:25:57
@@ -231,9 +231,27 @@
 
 
        // alignment
-       LyXAlignment const alignment =
-               static_cast<LyXAlignment>(alignment_.get());
+       bool forceDefaultAlignment = fl_get_button(dialog_->radio_align_default);
+       LyXAlignment const alignment = forceDefaultAlignment ?
+                                  LYX_ALIGN_LAYOUT :
+                                  static_cast<LyXAlignment>(alignment_.get());
+       LyXAlignment alignpos = controller().alignPossible();
+       setEnabled(dialog_->radio_align_block,
+                  bool(alignpos & LYX_ALIGN_BLOCK) && 
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_center,
+                  bool(alignpos & LYX_ALIGN_CENTER) &&
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_left,
+                  bool(alignpos & LYX_ALIGN_LEFT) &&
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_right,
+                  bool(alignpos & LYX_ALIGN_RIGHT) &&
+                  !forceDefaultAlignment );
+
        controller().params().align(alignment);
+       if (forceDefaultAlignment)
+         alignment_.set(controller().alignDefault());
 
        // label width
        string const labelwidthstring =
@@ -288,7 +306,8 @@
                   labelwidth != _("Senseless with this layout!"));
 
        // alignment
-       alignment_.set(controller().params().align());
+       bool forceDefaultAlignment = controller().params().alignDefault();
+       fl_set_button(dialog_->radio_align_default,forceDefaultAlignment);
 
        // mark default alignment
        LyXAlignment const default_alignment = controller().alignDefault();
@@ -316,7 +335,7 @@
 
        label = _("Right");
        if (default_alignment == LYX_ALIGN_RIGHT) {
-               label = _(" (default)");
+               label += _(" (default)");
        }
        fl_set_object_label(dialog_->radio_align_right, label.c_str());
        fl_set_button_shortcut(dialog_->radio_align_right, "#R", 1);
@@ -325,16 +344,26 @@
        // of labels.
        fl_redraw_form(form());
 
+       if (!forceDefaultAlignment)
+         alignment_.set(controller().params().align());
+       else
+         alignment_.set(default_alignment);
+
        LyXAlignment alignpos = controller().alignPossible();
        setEnabled(dialog_->radio_align_block,
-                  bool(alignpos & LYX_ALIGN_BLOCK));
+                  bool(alignpos & LYX_ALIGN_BLOCK) && 
+                  !forceDefaultAlignment );
        setEnabled(dialog_->radio_align_center,
-                  bool(alignpos & LYX_ALIGN_CENTER));
+                  bool(alignpos & LYX_ALIGN_CENTER) &&
+                  !forceDefaultAlignment );
        setEnabled(dialog_->radio_align_left,
-                  bool(alignpos & LYX_ALIGN_LEFT));
+                  bool(alignpos & LYX_ALIGN_LEFT) &&
+                  !forceDefaultAlignment );
        setEnabled(dialog_->radio_align_right,
-                  bool(alignpos & LYX_ALIGN_RIGHT));
+                  bool(alignpos & LYX_ALIGN_RIGHT) &&
+                  !forceDefaultAlignment );
 
+
        // no inset-text-owned paragraph may have pagebreaks
        bool ininset = controller().inInset();
        setEnabled(dialog_->check_pagebreak_above, !ininset);
@@ -433,6 +462,23 @@
                bool const custom_spacing =
                        fl_get_choice(dialog_->choice_linespacing) == 5;
                setEnabled(dialog_->input_linespacing, custom_spacing);
+       
+       } else if (ob == dialog_->radio_align_default) {
+       bool forceDefaultAlignment = fl_get_button(dialog_->radio_align_default);
+       LyXAlignment alignpos = controller().alignPossible();
+       setEnabled(dialog_->radio_align_block,
+                  bool(alignpos & LYX_ALIGN_BLOCK) && 
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_center,
+                  bool(alignpos & LYX_ALIGN_CENTER) &&
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_left,
+                  bool(alignpos & LYX_ALIGN_LEFT) &&
+                  !forceDefaultAlignment );
+       setEnabled(dialog_->radio_align_right,
+                  bool(alignpos & LYX_ALIGN_RIGHT) &&
+                  !forceDefaultAlignment );
+
        }
 
        return ButtonPolicy::SMI_VALID;
Index: src/frontends/xforms/forms/form_paragraph.fd
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/forms/form_paragraph.fd,v
retrieving revision 1.20
diff -u -r1.20 form_paragraph.fd
--- src/frontends/xforms/forms/form_paragraph.fd        2003/08/14 15:45:07     1.20
+++ src/frontends/xforms/forms/form_paragraph.fd        2003/10/13 13:25:58
@@ -9,14 +9,14 @@
 
 =============== FORM ===============
 Name: form_paragraph
-Width: 395
+Width: 445
 Height: 405
-Number of Objects: 31
+Number of Objects: 32
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 405
+box: 0 0 445 405
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -466,7 +466,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -484,7 +484,7 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 170 170 25
+box: 215 170 85 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -502,7 +502,7 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 145 170 25
+box: 215 145 100 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -520,7 +520,7 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 120 170 25
+box: 215 120 85 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -538,7 +538,7 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 215 195 170 25
+box: 215 195 85 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -570,6 +570,24 @@
 name: 
 callback: 
 argument: 
+
+--------------------
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 310 155 75 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Default|#D
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: radio_align_default
+callback: C_FormDialogView_InputCB
+argument: 0
 
 ==============================
 create_the_forms

Reply via email to