RE: RE: RE: RE: Re: No paragraph alignment options
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 @@ rect x0/x y0/y -width373/width -height203/height +width346/width +height226/height /rect /property property name=sizePolicy @@ -36,76 +36,14 @@ property name=spacing number6/number /property -
RE: RE: RE: RE: Re: No paragraph alignment options
> 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 - -