diff --git a/src/ChangeLog b/src/ChangeLog index 6ce644e56b..128e508289 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-04-27 John Levon + + * bufferlist.C: + * lyx_cb.C: + * lyxfunc.C: + * lyxvc.C: specify cancel button in Alert::prompt + 2003-04-26 John Levon * text3.C: diff --git a/src/bufferlist.C b/src/bufferlist.C index e735c5ba8e..2ad51ee5d8 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -78,7 +78,7 @@ bool BufferList::quitWriteBuffer(Buffer * buf) text += file + _(" has unsaved changes.\n\nWhat do you want to do with it?"); #endif int const ret = Alert::prompt(_("Save changed document?"), - text, 0, _("&Save"), _("&Discard"), _("&Cancel")); + text, 0, 2, _("&Save"), _("&Discard"), _("&Cancel")); if (ret == 0) { // FIXME: WriteAs can be asynch ! @@ -187,7 +187,7 @@ bool BufferList::close(Buffer * buf, bool ask) text += fname + _(" has unsaved changes.\n\nWhat do you want to do with it?"); #endif int const ret = Alert::prompt(_("Save changed document?"), - text, 0, _("&Save"), _("&Discard"), _("&Cancel")); + text, 0, 2, _("&Save"), _("&Discard"), _("&Cancel")); if (ret == 0) { if (buf->isUnnamed()) { @@ -368,7 +368,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly) text += file + _(" exists.\n\nRecover emergency save?"); #endif int const ret = Alert::prompt(_("Load emergency save?"), - text, 0, _("&Recover"), _("&Load Original")); + text, 0, 1, _("&Recover"), _("&Load Original")); if (ret == 0) { ts = e; @@ -402,7 +402,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly) text += file + _(" is newer.\n\nLoad the backup instead?"); #endif int const ret = Alert::prompt(_("Load backup?"), - text, 0, _("&Load backup"), _("Load &original")); + text, 0, 1, _("&Load backup"), _("Load &original")); if (ret == 0) { ts = a; @@ -525,7 +525,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) text += file + _(" is already loaded.\n\nDo you want to revert to the saved version?"); #endif int const ret = Alert::prompt(_("Revert to saved document?"), - text, 1, _("&Revert"), _("&Switch to document")); + text, 0, 1, _("&Revert"), _("&Switch to document")); if (ret == 0) { // FIXME: should be LFUN_REVERT @@ -565,7 +565,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) text += file + _(" from version control?"); #endif int const ret = Alert::prompt(_("Retrieve from version control?"), - text, 0, _("&Retrieve"), _("&Cancel")); + text, 0, 1, _("&Retrieve"), _("&Cancel")); if (ret == 0) { // How can we know _how_ to do the checkout? @@ -585,7 +585,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) text += file + _(" does not yet exist.\n\nDo you want to create a new document?"); #endif int const ret = Alert::prompt(_("Create new document?"), - text, 0, _("&Create"), _("Cancel")); + text, 0, 1, _("&Create"), _("Cancel")); if (ret == 0) b = newFile(s, string(), true); diff --git a/src/frontends/Alert.C b/src/frontends/Alert.C index a230557c8f..f11661a8aa 100644 --- a/src/frontends/Alert.C +++ b/src/frontends/Alert.C @@ -22,11 +22,12 @@ using std::pair; using std::make_pair; int Alert::prompt(string const & title, string const & question, - int default_button, + int default_button, int escape_button, string const & b1, string const & b2, string const & b3) { if (lyx_gui::use_gui) - return prompt_pimpl(title, question, default_button, b1, b2, b3); + return prompt_pimpl(title, question, + default_button, escape_button, b1, b2, b3); lyxerr << title << endl; lyxerr << "----------------------------------------" << endl; diff --git a/src/frontends/Alert.h b/src/frontends/Alert.h index f49d1d587c..12847b2dc1 100644 --- a/src/frontends/Alert.h +++ b/src/frontends/Alert.h @@ -20,16 +20,17 @@ namespace Alert { /** * Prompt for a question. Returns 0-2 for the chosen button. - * Set default_button to a reasonable value. b1-b3 should have - * accelerators marked with an '&'. title should be a short summary. - * Strings should be gettextised. Please think about the poor user. + * Set default_button and cancel_button to reasonable values. b1-b3 + * should have accelerators marked with an '&'. title should be + * a short summary. Strings should be gettextised. + * Please think about the poor user. * * Remember to use boost::format. If you make any of these buttons * "Yes" or "No", I will personally come around to your house and * slap you with fish, and not in an enjoyable way either. */ int prompt(string const & title, string const & question, - int default_button, + int default_button, int cancel_button, string const & b1, string const & b2, string const & b3 = string()); /** diff --git a/src/frontends/Alert_pimpl.h b/src/frontends/Alert_pimpl.h index 88becb95d6..7c500f2e12 100644 --- a/src/frontends/Alert_pimpl.h +++ b/src/frontends/Alert_pimpl.h @@ -13,7 +13,7 @@ // GUI-specific implementations int prompt_pimpl(string const & title, string const & question, - int default_button, + int default_button, int escape_button, string const & b1, string const & b2, string const & b3); void warning_pimpl(string const & title, string const & warning); diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index ffd517a5ec..b8f3e1c6ed 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,9 @@ +2003-04-27 John Levon + + * Alert.h: + * Alert.C: + * Alert_pimpl.h: ::prompt() takes cancel_button + 2003-04-16 Alfredo Braunstein * screen.C (redraw): added a missing call to updateRowPositions diff --git a/src/frontends/qt2/Alert_pimpl.C b/src/frontends/qt2/Alert_pimpl.C index 0cebcd0fdc..9e4b3a3880 100644 --- a/src/frontends/qt2/Alert_pimpl.C +++ b/src/frontends/qt2/Alert_pimpl.C @@ -30,7 +30,7 @@ using std::pair; using std::make_pair; int prompt_pimpl(string const & tit, string const & question, - int default_button, + int default_button, int cancel_button, string const & b1, string const & b2, string const & b3) { #if USE_BOOST_FORMAT @@ -41,9 +41,14 @@ int prompt_pimpl(string const & tit, string const & question, string const title = _("LyX: ") + tit; #endif - return QMessageBox::information(0, toqstr(title), toqstr(formatted(question)), + int res = QMessageBox::information(0, toqstr(title), toqstr(formatted(question)), toqstr(b1), toqstr(b2), b3.empty() ? QString::null : toqstr(b3), - default_button); + default_button, cancel_button); + + // Qt bug: can return -1 on cancel or WM close, despite the docs. + if (res == -1) + res = cancel_button; + return res; } diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index dab7e66e59..ded3ee2a40 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,12 @@ +2003-04-27 John Levon + + * Alert_pimpl.C: handle cancel_button + + * QTabular.C: + * QTabularDialog.C: + * QTabularDialog.h: + * ui/QTabularDialogBase.ui: ui fixes + 2003-04-23 John Levon * QCitationDialog.C: close dialog on return in listbox diff --git a/src/frontends/qt2/QTabular.C b/src/frontends/qt2/QTabular.C index b151db08ca..b158b984ed 100644 --- a/src/frontends/qt2/QTabular.C +++ b/src/frontends/qt2/QTabular.C @@ -53,10 +53,6 @@ void QTabular::build_dialog() bcview().addReadOnly(dialog_->widthUnit); bcview().addReadOnly(dialog_->hAlignCB); bcview().addReadOnly(dialog_->vAlignCB); - bcview().addReadOnly(dialog_->columnAddPB); - bcview().addReadOnly(dialog_->columnDeletePB); - bcview().addReadOnly(dialog_->rowAddPB); - bcview().addReadOnly(dialog_->rowDeletePB); bcview().addReadOnly(dialog_->borderSetPB); bcview().addReadOnly(dialog_->borderUnsetPB); bcview().addReadOnly(dialog_->borders); diff --git a/src/frontends/qt2/QTabularDialog.C b/src/frontends/qt2/QTabularDialog.C index f3e15092bb..864c297bc5 100644 --- a/src/frontends/qt2/QTabularDialog.C +++ b/src/frontends/qt2/QTabularDialog.C @@ -50,34 +50,12 @@ void QTabularDialog::closeEvent(QCloseEvent * e) e->accept(); } + void QTabularDialog::close_clicked() { form_->closeGUI(); } -void QTabularDialog::columnAppend_clicked() -{ - form_->controller().set(LyXTabular::APPEND_COLUMN); -} - - -void QTabularDialog::rowAppend_clicked() -{ - form_->controller().set(LyXTabular::APPEND_ROW); -} - - -void QTabularDialog::columnDelete_clicked() -{ - form_->controller().set(LyXTabular::DELETE_COLUMN); -} - - -void QTabularDialog::rowDelete_clicked() -{ - form_->controller().set(LyXTabular::DELETE_ROW); -} - void QTabularDialog::borderSet_clicked() { @@ -86,6 +64,7 @@ void QTabularDialog::borderSet_clicked() form_->changed(); } + void QTabularDialog::borderUnset_clicked() { form_->controller().set(LyXTabular::UNSET_ALL_LINES); diff --git a/src/frontends/qt2/QTabularDialog.h b/src/frontends/qt2/QTabularDialog.h index e9e7b64840..4a6fcb37ef 100644 --- a/src/frontends/qt2/QTabularDialog.h +++ b/src/frontends/qt2/QTabularDialog.h @@ -28,10 +28,6 @@ protected slots: virtual void change_adaptor(); virtual void close_clicked(); - virtual void columnAppend_clicked(); - virtual void rowAppend_clicked(); - virtual void columnDelete_clicked(); - virtual void rowDelete_clicked(); virtual void borderSet_clicked(); virtual void borderUnset_clicked(); virtual void leftBorder_changed(); diff --git a/src/frontends/qt2/ui/QTabularDialogBase.ui b/src/frontends/qt2/ui/QTabularDialogBase.ui index 0b6c4e128d..a8724f59bf 100644 --- a/src/frontends/qt2/ui/QTabularDialogBase.ui +++ b/src/frontends/qt2/ui/QTabularDialogBase.ui @@ -13,8 +13,8 @@ 0 0 - 480 - 383 + 463 + 408 @@ -71,7 +71,7 @@ spacing 6 - + QLabel name @@ -86,22 +86,7 @@ hAlignCB - - QCheckBox - - name - multicolumnCB - - - text - &Multicolumn - - - toolTip - Merge cells - - - + QComboBox @@ -136,7 +121,88 @@ Horizontal alignment in column - + + QCheckBox + + name + rotateTabularCB + + + enabled + true + + + text + &Rotate table 90 degrees + + + toolTip + Rotate the table by 90 degrees + + + + QCheckBox + + name + rotateCellCB + + + text + Rotate &cell 90 degrees + + + toolTip + Rotate this cell by 90 degrees + + + + QLabel + + name + specialAlignmentLA + + + text + LaTe&X argument: + + + buddy + specialAlignmentED + + + + QLineEdit + + name + specialAlignmentED + + + toolTip + Custom column format (LaTeX) + + + + + name + Spacer5 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + name Spacer75 @@ -157,125 +223,22 @@ - - QGroupBox + + QCheckBox name - GroupBox38 + multicolumnCB - title - Column + text + &Multicolumn + + + toolTip + Merge cells - - - margin - 11 - - - spacing - 6 - - - QPushButton - - name - columnAddPB - - - text - A&dd - - - autoDefault - false - - - toolTip - Append column (right) - - - - QPushButton - - name - columnDeletePB - - - text - De&lete - - - autoDefault - false - - - toolTip - Delete current column - - - - - QGroupBox - - name - GroupBox39 - - - title - Row - - - - margin - 11 - - - spacing - 6 - - - QPushButton - - name - rowAddPB - - - text - &Add - - - autoDefault - false - - - toolTip - Append row (below) - - - - QPushButton - - name - rowDeletePB - - - text - Delete - - - autoDefault - false - - - toolTip - Delete this row - - - - - + QGroupBox name @@ -400,87 +363,6 @@ - - QGroupBox - - name - GroupBox21 - - - title - Rotate 90 degrees - - - - margin - 11 - - - spacing - 6 - - - QCheckBox - - name - rotateTabularCB - - - enabled - true - - - text - &Rotate Table - - - toolTip - Rotate the table by 90 degrees - - - - QCheckBox - - name - rotateCellCB - - - text - Rotate &Cell - - - toolTip - Rotate this cell by 90 degrees - - - - - - QLineEdit - - name - specialAlignmentED - - - toolTip - Custom column format (LaTeX) - - - - QLabel - - name - specialAlignmentLA - - - text - LaTe&X argument: - - - buddy - specialAlignmentED - - @@ -1389,24 +1271,6 @@ - - columnAddPB - clicked() - QTabularDialogBase - columnAppend_clicked() - - - rowAddPB - clicked() - QTabularDialogBase - rowAppend_clicked() - - - columnDeletePB - clicked() - QTabularDialogBase - columnDelete_clicked() - borderSetPB clicked() @@ -1431,12 +1295,6 @@ newpageCB setEnabled(bool) - - rowDeletePB - clicked() - QTabularDialogBase - rowDelete_clicked() - hAlignCB activated(int) @@ -1613,14 +1471,11 @@ borderSet_clicked() borderUnset_clicked() - border_toggled() bottomBorder_changed() - change_adaptor() close_clicked() - columnAppend_clicked() - columnDelete_clicked() hAlign_changed(int) leftBorder_changed() + longTabular() ltFirstHeaderBorderAbove_clicked() ltFirstHeaderBorderBelow_clicked() ltFirstHeaderEmpty_clicked() @@ -1637,12 +1492,9 @@ ltLastFooterStatus_clicked() ltNewpage_clicked() multicolumn_clicked() - longTabular() rightBorder_changed() rotateCell() rotateTabular() - rowAppend_clicked() - rowDelete_clicked() setEnabled(bool) specialAlignment_changed() topBorder_changed() @@ -1651,36 +1503,32 @@ TabWidget - specialAlignmentED - columnAddPB - columnDeletePB - rowAddPB - rowDeletePB hAlignCB - multicolumnCB widthED widthUnit vAlignCB + multicolumnCB rotateTabularCB rotateCellCB - closePB + specialAlignmentED borderSetPB borderUnsetPB longTabularCB headerStatusCB - firstheaderStatusCB - footerStatusCB - lastfooterStatusCB headerBorderAboveCB + headerBorderBelowCB + firstheaderStatusCB firstheaderBorderAboveCB + firstheaderBorderBelowCB + firstheaderNoContentsCB + footerStatusCB footerBorderAboveCB + footerBorderBelowCB + lastfooterStatusCB lastfooterBorderAboveCB lastfooterBorderBelowCB - footerBorderBelowCB - firstheaderBorderBelowCB - headerBorderBelowCB lastfooterNoContentsCB - firstheaderNoContentsCB newpageCB + closePB diff --git a/src/frontends/xforms/Alert_pimpl.C b/src/frontends/xforms/Alert_pimpl.C index 79d5b28a15..f7f58045ff 100644 --- a/src/frontends/xforms/Alert_pimpl.C +++ b/src/frontends/xforms/Alert_pimpl.C @@ -44,7 +44,7 @@ void information_pimpl(string const &, string const & message) int prompt_pimpl(string const &, string const & question, - int default_button, + int default_button, int /*escape_button*/, string const & b1, string const & b2, string const & b3) { string b1label, b1sc; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 6ce4c244e5..c3001d0207 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2003-04-27 John Levon + + * Alert_pimpl.C: ignore cancel_button (for now) + 2003-04-15 John Levon * Toolbar_pimpl.C: ignore Minibuffer diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 3caa2689a6..2481bd6c89 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -96,7 +96,7 @@ bool MenuWrite(BufferView * bv, Buffer * buffer) text += file + _(" could not be saved.\n\nDo you want to rename the document and try again?"); #endif int const ret = Alert::prompt(_("Rename and save?"), - text, 0, _("&Rename"), _("&Cancel")); + text, 0, 1, _("&Rename"), _("&Cancel")); if (ret == 0) return WriteAs(bv, buffer); @@ -155,7 +155,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename) text += file + _(" already exists.\n\nDo you want to over-write that document?"); #endif int const ret = Alert::prompt(_("Over-write document?"), - text, 1, _("&Over-write"), _("&Cancel")); + text, 0, 1, _("&Over-write"), _("&Cancel")); if (ret == 1) return false; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 849ff72571..98c919c923 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1085,7 +1085,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) text += file + _("?"); #endif int const ret = Alert::prompt(_("Revert to saved document?"), - text, 1, _("&Revert"), _("&Cancel")); + text, 0, 1, _("&Revert"), _("&Cancel")); if (ret == 0) view()->reload(); @@ -1935,7 +1935,7 @@ void LyXFunc::doImport(string const & argument) text += file + _(" already exists.\n\nDo you want to over-write that document?"); #endif int const ret = Alert::prompt(_("Over-write document?"), - text, 1, _("&Over-write"), _("&Cancel")); + text, 0, 1, _("&Over-write"), _("&Cancel")); if (ret == 1) { owner->message(_("Canceled.")); diff --git a/src/lyxvc.C b/src/lyxvc.C index 3def73dfec..e798317e61 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -89,7 +89,7 @@ bool LyXVC::ensureClean() text += file + _(" has unsaved changes.\n\nDo you want to save the document?"); #endif int const ret = Alert::prompt(_("Save changed document?"), - text, 0, _("&Save"), _("&Cancel")); + text, 0, 1, _("&Save"), _("&Cancel")); if (ret == 0) { vcs->owner()->getUser()->owner()->dispatch(FuncRequest(LFUN_MENUWRITE)); @@ -203,7 +203,7 @@ void LyXVC::revert() text += file + _(" will lose all current changes.\n\nDo you want to revert to the saved version?"); #endif int const ret = Alert::prompt(_("Revert to stored version of document?"), - text, 1, _("&Revert"), _("&Cancel")); + text, 0, 1, _("&Revert"), _("&Cancel")); if (ret == 0) vcs->revert();