From 56eb1dbdb18f34c912a0aa325128212c3955f96f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 20 Jul 2005 06:51:24 +0000 Subject: [PATCH] remove the paperpackage widgets from the qt and xforms frontend (bug 1929). John S., could you please do this in the gtk document dialog, too? git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10342 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 6 + src/frontends/qt2/QDocument.C | 14 +- src/frontends/qt2/QDocumentDialog.C | 70 +- src/frontends/qt2/QDocumentDialog.h | 4 +- src/frontends/qt2/ui/MarginsModuleBase.ui | 687 +++++++++++--------- src/frontends/xforms/ChangeLog | 6 + src/frontends/xforms/FormDocument.C | 52 -- src/frontends/xforms/forms/form_document.fd | 32 +- 8 files changed, 420 insertions(+), 451 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 8adf3e9fbb..eef17293ac 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,9 @@ +2005-07-20 Jürgen Spitzmüller + + * QDocument.C: + * QDocumentDialog.[Ch]: + * ui/MarginsModuleBase.ui: remove the paperpackage widgets (bug 1929) + 2005-07-18 Jean-Marc Lasgouttes * QPrefsDialog.C (switch_copierLB, switch_copierCO): remove debug diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 658860e0c3..cf6134338e 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -167,8 +167,6 @@ void QDocument::build_dialog() dialog_->textLayoutModule->lspacingCO->insertItem( qt_("Custom"), Spacing::Other); - // margins - dialog_->setMargins(0); // Manage the restore, ok, apply, restore and cancel/close buttons bcview().setOK(dialog_->okPB); @@ -387,13 +385,9 @@ void QDocument::apply() // margins params.use_geometry = - (dialog_->marginsModule->marginCO->currentItem() == 1 + (!dialog_->marginsModule->marginCB->isChecked() || geom_papersize); - int margin = dialog_->marginsModule->marginCO->currentItem(); - if (margin > 0) { - margin = margin - 1; - } MarginsModuleBase const * m(dialog_->marginsModule); params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit); @@ -555,7 +549,6 @@ void QDocument::update_contents() case Spacing::Default: case Spacing::Single: nitem = 0; break; } - // layout dialog_->latexModule->classCO->setCurrentItem(params.textclass); @@ -628,7 +621,6 @@ void QDocument::update_contents() // paper int const psize = params.papersize; dialog_->pageLayoutModule->papersizeCO->setCurrentItem(psize); - dialog_->setMargins(psize); dialog_->setCustomPapersize(psize); bool const landscape = @@ -648,11 +640,9 @@ void QDocument::update_contents() dialog_->pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit); // margins - MarginsModuleBase * m = dialog_->marginsModule; - m->marginCO->setCurrentItem(0); - dialog_->setCustomMargins(0); + dialog_->setMargins(!params.use_geometry); lengthToWidgets(m->topLE, m->topUnit, params.topmargin, defaultUnit); diff --git a/src/frontends/qt2/QDocumentDialog.C b/src/frontends/qt2/QDocumentDialog.C index b787008f45..fb0bba6a3e 100644 --- a/src/frontends/qt2/QDocumentDialog.C +++ b/src/frontends/qt2/QDocumentDialog.C @@ -132,8 +132,8 @@ QDocumentDialog::QDocumentDialog(QDocument * form) connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); // margins - connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(setCustomMargins(int))); - connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); + connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(setCustomMargins(bool))); + connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(marginsModule->topUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); @@ -150,7 +150,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form) connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor())); // page layout - connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setMargins(int))); connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int))); connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int))); connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged())); @@ -266,23 +265,10 @@ void QDocumentDialog::portraitChanged() setMargins(pageLayoutModule->papersizeCO->currentItem()); } -void QDocumentDialog::setMargins(int papersize) +void QDocumentDialog::setMargins(bool custom) { - int olditem = marginsModule->marginCO->currentItem(); - marginsModule->marginCO->clear(); - marginsModule->marginCO->insertItem(qt_("Default")); - marginsModule->marginCO->insertItem(qt_("Custom")); - bool a4size = (papersize == 6 || papersize == 0 - && lyxrc.default_papersize == PAPER_A4); - if (a4size && pageLayoutModule->portraitRB->isChecked()) { - marginsModule->marginCO->insertItem(qt_("Small margins")); - marginsModule->marginCO->insertItem(qt_("Very small margins")); - marginsModule->marginCO->insertItem(qt_("Very wide margins")); - } else if (olditem > 1) { - olditem = 0; - } - marginsModule->marginCO->setCurrentItem(olditem); - setCustomMargins(olditem); + marginsModule->marginCB->setChecked(custom); + setCustomMargins(custom); } @@ -300,37 +286,35 @@ void QDocumentDialog::setCustomPapersize(int papersize) } -void QDocumentDialog::setCustomMargins(int margin) +void QDocumentDialog::setCustomMargins(bool custom) { - bool const custom = (margin == 1); - - marginsModule->topL->setEnabled(custom); - marginsModule->topLE->setEnabled(custom); - marginsModule->topUnit->setEnabled(custom); + marginsModule->topL->setEnabled(!custom); + marginsModule->topLE->setEnabled(!custom); + marginsModule->topUnit->setEnabled(!custom); - marginsModule->bottomL->setEnabled(custom); - marginsModule->bottomLE->setEnabled(custom); - marginsModule->bottomUnit->setEnabled(custom); + marginsModule->bottomL->setEnabled(!custom); + marginsModule->bottomLE->setEnabled(!custom); + marginsModule->bottomUnit->setEnabled(!custom); - marginsModule->innerL->setEnabled(custom); - marginsModule->innerLE->setEnabled(custom); - marginsModule->innerUnit->setEnabled(custom); + marginsModule->innerL->setEnabled(!custom); + marginsModule->innerLE->setEnabled(!custom); + marginsModule->innerUnit->setEnabled(!custom); - marginsModule->outerL->setEnabled(custom); - marginsModule->outerLE->setEnabled(custom); - marginsModule->outerUnit->setEnabled(custom); + marginsModule->outerL->setEnabled(!custom); + marginsModule->outerLE->setEnabled(!custom); + marginsModule->outerUnit->setEnabled(!custom); - marginsModule->headheightL->setEnabled(custom); - marginsModule->headheightLE->setEnabled(custom); - marginsModule->headheightUnit->setEnabled(custom); + marginsModule->headheightL->setEnabled(!custom); + marginsModule->headheightLE->setEnabled(!custom); + marginsModule->headheightUnit->setEnabled(!custom); - marginsModule->headsepL->setEnabled(custom); - marginsModule->headsepLE->setEnabled(custom); - marginsModule->headsepUnit->setEnabled(custom); + marginsModule->headsepL->setEnabled(!custom); + marginsModule->headsepLE->setEnabled(!custom); + marginsModule->headsepUnit->setEnabled(!custom); - marginsModule->footskipL->setEnabled(custom); - marginsModule->footskipLE->setEnabled(custom); - marginsModule->footskipUnit->setEnabled(custom); + marginsModule->footskipL->setEnabled(!custom); + marginsModule->footskipLE->setEnabled(!custom); + marginsModule->footskipUnit->setEnabled(!custom); } diff --git a/src/frontends/qt2/QDocumentDialog.h b/src/frontends/qt2/QDocumentDialog.h index bea8ef735b..387de450c2 100644 --- a/src/frontends/qt2/QDocumentDialog.h +++ b/src/frontends/qt2/QDocumentDialog.h @@ -57,9 +57,9 @@ public slots: protected slots: void setLSpacing(int); - void setMargins(int); + void setMargins(bool); void setCustomPapersize(int); - void setCustomMargins(int); + void setCustomMargins(bool); void setSkip(int); void enableSkip(bool); void portraitChanged(); diff --git a/src/frontends/qt2/ui/MarginsModuleBase.ui b/src/frontends/qt2/ui/MarginsModuleBase.ui index a8923e465c..a41773d036 100644 --- a/src/frontends/qt2/ui/MarginsModuleBase.ui +++ b/src/frontends/qt2/ui/MarginsModuleBase.ui @@ -13,13 +13,13 @@ 0 0 - 337 - 370 + 329 + 373 caption - + MarginsModuleBase @@ -30,232 +30,29 @@ spacing 6 - - QLabel - - name - topL - - - enabled - false - - - text - &Top: - - - buddy - topLE - - - - QLabel - - name - bottomL - - - enabled - false - - - text - &Bottom: - - - buddy - bottomLE - - - - QLabel - - name - innerL - - - enabled - false - - - text - &Inner: - - - buddy - innerLE - - - - QLabel - - name - outerL - - - enabled - false - - - text - O&uter: - - - buddy - outerLE - - - QLabel + QCheckBox name - marginL + marginCB text - &Margins: + &Default Margins - buddy - marginCO + toolTip + Use the margin settings provided by the document class - - QLineEdit - - name - topLE - - - enabled - false - - - - QLineEdit - - name - bottomLE - - - enabled - false - - - text - - - - - QLineEdit - - name - outerLE - - - enabled - false - - - - QLabel - - name - footskipL - - - enabled - false - - - text - &Foot skip: - - - buddy - footskipLE - - - - QLabel - - name - headsepL - - - enabled - false - - - text - Head &sep: - + - buddy - headsepLE - - - - QLineEdit - name - headsepLE - - - enabled - false - - - - QLineEdit - - name - headheightLE - - - enabled - false - - - - QLabel - - name - headheightL - - - enabled - false - - - text - Head &height: - - - buddy - headheightLE - - - - QLineEdit - - name - footskipLE - - - enabled - false - - - - - name - Spacer21 + Spacer22 orientation - Vertical + Horizontal sizeType @@ -269,14 +66,14 @@ - + name - Spacer22 + Spacer21 orientation - Horizontal + Vertical sizeType @@ -290,107 +87,364 @@ - - LengthCombo - - name - topUnit - - - enabled - false - - - - LengthCombo - - name - bottomUnit - - - enabled - false - - - - LengthCombo - - name - innerUnit - - - enabled - false - - - - QLineEdit - - name - innerLE - - - enabled - false - - - - LengthCombo - - name - outerUnit - - - enabled - false - - - - LengthCombo - - name - headsepUnit - - - enabled - false - - - - LengthCombo - - name - headheightUnit - - - enabled - false - - - - LengthCombo - - name - footskipUnit - - - enabled - false - - - - QComboBox + + QLayoutWidget name - marginCO - - - sizePolicy - - 5 - 0 - - + Layout5 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout4 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + topL + + + enabled + false + + + text + &Top: + + + buddy + topLE + + + + QLabel + + name + bottomL + + + enabled + false + + + text + &Bottom: + + + buddy + bottomLE + + + + QLabel + + name + innerL + + + enabled + false + + + text + &Inner: + + + buddy + innerLE + + + + QLabel + + name + outerL + + + enabled + false + + + text + O&uter: + + + buddy + outerLE + + + + QLabel + + name + headsepL + + + enabled + false + + + text + Head &sep: + + + buddy + headsepLE + + + + QLabel + + name + headheightL + + + enabled + false + + + text + Head &height: + + + buddy + headheightLE + + + + QLabel + + name + footskipL + + + enabled + false + + + text + &Foot skip: + + + buddy + footskipLE + + + + + + QLayoutWidget + + name + Layout3 + + + + margin + 0 + + + spacing + 6 + + + QLineEdit + + name + topLE + + + enabled + false + + + + QLineEdit + + name + bottomLE + + + enabled + false + + + text + + + + + QLineEdit + + name + innerLE + + + enabled + false + + + + QLineEdit + + name + outerLE + + + enabled + false + + + + QLineEdit + + name + headsepLE + + + enabled + false + + + + QLineEdit + + name + headheightLE + + + enabled + false + + + + QLineEdit + + name + footskipLE + + + enabled + false + + + + + + QLayoutWidget + + name + Layout2 + + + + margin + 0 + + + spacing + 6 + + + LengthCombo + + name + topUnit + + + enabled + false + + + + LengthCombo + + name + bottomUnit + + + enabled + false + + + + LengthCombo + + name + innerUnit + + + enabled + false + + + + LengthCombo + + name + outerUnit + + + enabled + false + + + + LengthCombo + + name + headsepUnit + + + enabled + false + + + + LengthCombo + + name + headheightUnit + + + enabled + false + + + + LengthCombo + + name + footskipUnit + + + enabled + false + + + + + @@ -418,7 +472,6 @@ - marginCO topLE bottomLE innerLE diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 427264cf5b..c927ce69a6 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2005-07-20 Jürgen Spitzmüller + + * FormDocument.C: + * forms/form_document.fd: remove the paperpackage widgets + (bug 1929). + 2005-07-18 Jean-Marc Lasgouttes * FontInfo.C (query): revert earlier undocumented change. diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index cdda234711..6dee5c771d 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -209,7 +209,6 @@ void FormDocument::build() paper_.reset(build_document_paper(this)); // disable for read-only documents - bcview().addReadOnly(paper_->choice_paperpackage); bcview().addReadOnly(paper_->radio_portrait); bcview().addReadOnly(paper_->radio_landscape); bcview().addReadOnly(paper_->choice_papersize); @@ -260,11 +259,6 @@ void FormDocument::build() _(" Default | Custom | US letter | US legal " "| US executive | A3 | A4 | A5 " "| B3 | B4 | B5 ").c_str()); - fl_addto_choice(paper_->choice_paperpackage, - _(" None " - "| Small Margins " - "| Very small Margins " - "| Very wide Margins ").c_str()); fl_addto_choice(paper_->choice_custom_width_units, units.c_str()); fl_addto_choice(paper_->choice_custom_height_units, units.c_str()); @@ -547,10 +541,6 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) params.useClassDefaults(); UpdateLayoutDocument(params); - } else if (ob == paper_->radio_landscape) { - fl_set_choice(paper_->choice_paperpackage, - PACKAGE_NONE + 1); - } else if (ob == paper_->choice_papersize) { int const paperchoice = fl_get_choice(paper_->choice_papersize); bool const defsize = paperchoice == 1; @@ -623,25 +613,6 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) fl_set_choice_text(paper_->choice_foot_skip_units, default_unit.c_str()); - } else if (ob == paper_->choice_paperpackage && - fl_get_choice(paper_->choice_paperpackage) != 1) { - - fl_set_button(paper_->check_use_geometry, 0); - setEnabled(paper_->input_top_margin, false); - setEnabled(paper_->input_bottom_margin, false); - setEnabled(paper_->input_inner_margin, false); - setEnabled(paper_->input_outer_margin, false); - setEnabled(paper_->input_head_height, false); - setEnabled(paper_->input_head_sep, false); - setEnabled(paper_->input_foot_skip, false); - setEnabled(paper_->choice_top_margin_units, false); - setEnabled(paper_->choice_bottom_margin_units, false); - setEnabled(paper_->choice_inner_margin_units, false); - setEnabled(paper_->choice_outer_margin_units, false); - setEnabled(paper_->choice_head_height_units, false); - setEnabled(paper_->choice_head_sep_units, false); - setEnabled(paper_->choice_foot_skip_units, false); - } else if (ob == paper_->check_use_geometry) { // don't allow switching geometry off in custom papersize // mode nor in A3, B3, and B4 @@ -649,9 +620,6 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) if (choice == 2 || choice == 6 || choice == 9 || choice == 10) fl_set_button(paper_->check_use_geometry, 1); - fl_set_choice(paper_->choice_paperpackage, - PACKAGE_NONE + 1); - bool const use_geom = fl_get_button(paper_->check_use_geometry); setEnabled(paper_->input_top_margin, use_geom); setEnabled(paper_->input_bottom_margin, use_geom); @@ -669,20 +637,6 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) setEnabled(paper_->choice_foot_skip_units, use_geom); } - if (ob == paper_->choice_papersize || ob == paper_->radio_portrait - || ob == paper_->radio_landscape) { - // either default papersize (preferences) or document - // papersize has to be A4 - bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1 - && lyxrc.default_papersize == PAPER_A4) - || fl_get_choice(paper_->choice_papersize) == 7; - if (!enable) - fl_set_choice(paper_->choice_paperpackage, - PACKAGE_NONE + 1); - setEnabled(paper_->choice_paperpackage, - enable && fl_get_button(paper_->radio_portrait)); - } - return ButtonPolicy::SMI_VALID; } @@ -1243,12 +1197,6 @@ void FormDocument::paper_update(BufferParams const & params) fl_set_button(paper_->radio_landscape, 1); else fl_set_button(paper_->radio_portrait, 1); - setEnabled(paper_->choice_paperpackage, - //either default papersize (preferences) - //or document papersize has to be A4 - (paperchoice == 7 - || paperchoice == 1 && lyxrc.default_papersize == PAPER_A4) - && fl_get_button(paper_->radio_portrait)); // Default unit choice is cm if metric, inches if US paper. bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE) diff --git a/src/frontends/xforms/forms/form_document.fd b/src/frontends/xforms/forms/form_document.fd index 1dfa4988c1..bda20bf91e 100644 --- a/src/frontends/xforms/forms/form_document.fd +++ b/src/frontends/xforms/forms/form_document.fd @@ -179,7 +179,7 @@ argument: 0 Name: form_document_paper Width: 395 Height: 320 -Number of Objects: 29 +Number of Objects: 28 -------------------- class: FL_BOX @@ -433,24 +433,6 @@ name: check_use_geometry callback: C_FormDialogView_InputCB argument: 0 --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 210 175 160 25 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Special (A4 portrait only):|#S -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: choice_paperpackage -callback: C_FormDialogView_InputCB -argument: 0 - -------------------- class: FL_INPUT type: NORMAL_INPUT @@ -598,7 +580,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 280 210 50 25 +box: 280 180 50 25 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -616,7 +598,7 @@ argument: 0 -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 330 210 50 25 +box: 330 180 50 25 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -634,7 +616,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 280 240 50 25 +box: 280 210 50 25 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -652,7 +634,7 @@ argument: 0 -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 330 240 50 25 +box: 330 210 50 25 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -670,7 +652,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 280 270 50 25 +box: 280 250 50 25 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -688,7 +670,7 @@ argument: 0 -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 330 270 50 25 +box: 330 250 50 25 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT -- 2.39.5