From fec072f968210c9e135e0f9a990943c323b13d0d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 18 Dec 2002 14:24:32 +0000 Subject: [PATCH] remove preamble and tooltips menu entries on qt2; small compile fix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5855 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/POTFILES.in | 42 ++++++++++++++-------------- src/ChangeLog | 6 ++++ src/frontends/ChangeLog | 5 ++++ src/frontends/lyx_gui.h | 9 ++++++ src/frontends/qt2/Alert_pimpl.C | 4 +-- src/frontends/qt2/ChangeLog | 12 ++++++++ src/frontends/qt2/QLPopupMenu.C | 6 ++-- src/frontends/qt2/lyx_gui.C | 16 +++++++++++ src/frontends/xforms/ChangeLog | 6 ++++ src/frontends/xforms/Menubar_pimpl.C | 18 ++++++------ src/frontends/xforms/lyx_gui.C | 6 ++++ src/lyxfunc.C | 20 ++++++++----- 12 files changed, 110 insertions(+), 40 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index ff07cea59d..8929543485 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,17 +1,20 @@ -src/buffer.C -src/bufferlist.C src/BufferView.C -src/bufferview_funcs.C src/BufferView_pimpl.C src/Chktex.C -src/converter.C src/CutAndPaste.C +src/LColor.C +src/LaTeX.C +src/LyXAction.C +src/MenuBackend.C +src/buffer.C +src/bufferlist.C +src/bufferview_funcs.C +src/converter.C src/debug.C src/exporter.C src/ext_l10n.h -src/frontends/controllers/biblio.C +src/frontends/LyXView.C src/frontends/controllers/ButtonController.h -src/frontends/controllers/character.C src/frontends/controllers/ControlAboutlyx.C src/frontends/controllers/ControlBibtex.C src/frontends/controllers/ControlCharacter.C @@ -27,13 +30,13 @@ src/frontends/controllers/ControlSearch.C src/frontends/controllers/ControlSpellchecker.C src/frontends/controllers/ControlThesaurus.C src/frontends/controllers/ControlVCLog.C +src/frontends/controllers/biblio.C +src/frontends/controllers/character.C src/frontends/controllers/frnt_lang.C src/frontends/controllers/helper_funcs.C src/frontends/gnome/GLog.C -src/frontends/LyXView.C src/frontends/qt2/Alert_pimpl.C src/frontends/qt2/FileDialog.C -src/frontends/qt2/lengthcombo.C src/frontends/qt2/QAbout.C src/frontends/qt2/QBibitem.C src/frontends/qt2/QBibtex.C @@ -45,8 +48,8 @@ src/frontends/qt2/QCommandBuffer.C src/frontends/qt2/QDelimiterDialog.C src/frontends/qt2/QDocument.C src/frontends/qt2/QDocumentDialog.C -src/frontends/qt2/QError.C src/frontends/qt2/QERT.C +src/frontends/qt2/QError.C src/frontends/qt2/QExternal.C src/frontends/qt2/QExternalDialog.C src/frontends/qt2/QFloat.C @@ -54,8 +57,8 @@ src/frontends/qt2/QGraphics.C src/frontends/qt2/QGraphicsDialog.C src/frontends/qt2/QInclude.C src/frontends/qt2/QIndex.C -src/frontends/qt2/QLog.C src/frontends/qt2/QLPrintDialog.C +src/frontends/qt2/QLog.C src/frontends/qt2/QMathDialog.C src/frontends/qt2/QMathMatrixDialog.C src/frontends/qt2/QMinipage.C @@ -78,9 +81,9 @@ src/frontends/qt2/QToc.C src/frontends/qt2/QURL.C src/frontends/qt2/QVCLog.C src/frontends/qt2/QWrap.C +src/frontends/qt2/lengthcombo.C src/frontends/xforms/Alert_pimpl.C src/frontends/xforms/ColorHandler.C -src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C src/frontends/xforms/FormAboutlyx.C src/frontends/xforms/FormBase.C @@ -89,8 +92,8 @@ src/frontends/xforms/FormBibtex.C src/frontends/xforms/FormCharacter.C src/frontends/xforms/FormCitation.C src/frontends/xforms/FormDocument.C -src/frontends/xforms/FormError.C src/frontends/xforms/FormERT.C +src/frontends/xforms/FormError.C src/frontends/xforms/FormExternal.C src/frontends/xforms/FormFiledialog.C src/frontends/xforms/FormFloat.C @@ -123,14 +126,15 @@ src/frontends/xforms/FormToc.C src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/FormWrap.C -src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C -src/frontends/xforms/xforms_helpers.C src/frontends/xforms/XMiniBuffer.C +src/frontends/xforms/combox.C +src/frontends/xforms/input_validators.C +src/frontends/xforms/xforms_helpers.C src/gettext.h src/importer.C -src/insets/insetbib.C src/insets/inset.C +src/insets/insetbib.C src/insets/insetcaption.C src/insets/inseterror.C src/insets/insetert.C @@ -157,15 +161,12 @@ src/insets/inseturl.C src/insets/insetwrap.C src/kbsequence.C src/language.C -src/LaTeX.C -src/LColor.C src/lengthcommon.C -src/LyXAction.C src/lyx_cb.C +src/lyx_main.C src/lyxfind.C src/lyxfont.C src/lyxfunc.C -src/lyx_main.C src/lyxrc.C src/lyxtextclasslist.C src/lyxvc.C @@ -174,11 +175,10 @@ src/mathed/formulamacro.C src/mathed/math_hullinset.C src/mathed/math_parboxinset.C src/mathed/ref_inset.C -src/MenuBackend.C src/paragraph.C src/support/filetools.C src/tabular.C +src/text.C src/text2.C src/text3.C -src/text.C src/ext_l10n.h diff --git a/src/ChangeLog b/src/ChangeLog index 42214be57a..8252c420be 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2002-12-17 Jean-Marc Lasgouttes + + * lyxfunc.C (getStatus): query lyx_gui::getStatus() to catter for + unimplemented lfuns. Make LFUN_THESAURUS_ENTRY status unknown if + thesaurus is not compiled in + 2002-12-17 Alfredo Braunstein * lyxfunc.C: correct inversion of WORDFINDBACK/FORWARD diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 425adc7e7d..807b3203f6 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ +2002-12-17 Jean-Marc Lasgouttes + + * lyx_gui.h: add new function lyx_gui::getStatus, which can be + used by a frontend to indicate that some lfun is not implemented. + 2002-12-12 John Levon * LyXKeySym.h: add isText() diff --git a/src/frontends/lyx_gui.h b/src/frontends/lyx_gui.h index 5885a16ae1..10b300caad 100644 --- a/src/frontends/lyx_gui.h +++ b/src/frontends/lyx_gui.h @@ -14,12 +14,14 @@ #include "LColor.h" #include "LString.h" +#include "FuncStatus.h" #include class Dialogs; class LyXFont; class LyXComm; +class FuncRequest; /// GUI interaction namespace lyx_gui { @@ -44,6 +46,13 @@ void start(string const & batch, std::vector const & files); */ void exit(); + +/** + * return the status flag for a given action. This can be used to tell + * that a given lfun is not implemented by a frontend + */ +FuncStatus getStatus(FuncRequest const & ev); + /** Eg, passing LColor::black returns "000000", * passing LColor::white returns "ffffff". */ diff --git a/src/frontends/qt2/Alert_pimpl.C b/src/frontends/qt2/Alert_pimpl.C index 62d8b11b4d..4c4b933da8 100644 --- a/src/frontends/qt2/Alert_pimpl.C +++ b/src/frontends/qt2/Alert_pimpl.C @@ -26,7 +26,7 @@ #include "Alert_pimpl.h" #include "BoostFormat.h" - +#include "gettext.h" using std::pair; using std::make_pair; @@ -61,7 +61,7 @@ askForText_pimpl(string const & msg, string const & dflt) fmt % msg; string const title = fmt.str(); #else - string const title = qt_("LyX: ") + msg; + string const title = _("LyX: ") + msg; #endif QAskForTextDialog d(0, toqstr(title), true); // less than ideal ! diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 20ae02966b..df99ed8f0d 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,15 @@ +2002-12-18 Jean-Marc Lasgouttes + + * Alert_pimpl.C (askForText_pimpl): replace qt_() with _() + +2002-12-17 Jean-Marc Lasgouttes + + * QLPopupMenu.C (populate): ignore unknown lfuns; do not insert + separator as first item of a menu + + * lyx_gui.C (getStatus): indicate that LFUN_LAYOUT_PREAMBLE and + LFUN_TOOLTIPS_TOGGLE are not implemented + 2002-12-18 Edwin Leuven * BulletsModule.C: fix crash on custom bullet cancel diff --git a/src/frontends/qt2/QLPopupMenu.C b/src/frontends/qt2/QLPopupMenu.C index 4fde1f1554..2c1af18eb7 100644 --- a/src/frontends/qt2/QLPopupMenu.C +++ b/src/frontends/qt2/QLPopupMenu.C @@ -119,7 +119,8 @@ void QLPopupMenu::populate(Menu * menu) Menu::const_iterator end = menu->end(); for (; m != end; ++m) { if (m->kind() == MenuItem::Separator) { - insertSeparator(); + if (count() > 0) + insertSeparator(); } else if (m->kind() == MenuItem::Submenu) { pair res = createMenu(this, &(*m), owner_); setItemEnabled(res.first, !disabled(m->submenu())); @@ -127,7 +128,8 @@ void QLPopupMenu::populate(Menu * menu) } else { FuncStatus const status = owner_->view()->getLyXFunc().getStatus(m->action()); - if (status.disabled() && m->optional()) + if ((status.disabled() && m->optional()) + || status.unknown()) continue; insertItem(toqstr(getLabel(*m)), m->action()); setItemEnabled(m->action(), !status.disabled()); diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index 76e82f93fe..5a415f6240 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -26,6 +26,7 @@ #include "lyx_main.h" #include "lyxrc.h" #include "lyxfont.h" +#include "funcrequest.h" // FIXME: move this stuff out again #include "bufferlist.h" @@ -168,6 +169,21 @@ void lyx_gui::exit() } +FuncStatus lyx_gui::getStatus(FuncRequest const & ev) +{ + FuncStatus flag; + switch (ev.action) { + case LFUN_LAYOUT_PREAMBLE: + case LFUN_TOOLTIPS_TOGGLE: + flag.unknown(true); + break; + default: + break; + } + return flag; +} + + string const lyx_gui::hexname(LColor::color col) { QColor color(toqstr(lcolor.getX11Name(col))); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index f15505d929..e258a89430 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2002-12-17 Jean-Marc Lasgouttes + + * Menubar_pimpl.C (create_submenu): correctly ignore unknown lfuns + + * lyx_gui.C (getStatus): implement as a dummy action + 2002-12-16 Angus Leeming * XPainter.C: missed a #ifdef USE_XFORMS_IMAGE_LOADER. diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index 7acae94e10..cdc668d794 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -230,12 +230,14 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, vector extra_labels(menu.size()); vector::iterator it = extra_labels.begin(); vector::iterator last = it; - for (Menu::const_iterator i = menu.begin(); i != end; ++i, ++it) + for (Menu::const_iterator i = menu.begin(); i != end; ++i, ++it) { + FuncStatus flag = view->getLyXFunc().getStatus(i->action()); if (i->kind() == MenuItem::Separator) *last = "%l"; - else if (!i->optional() || - !(view->getLyXFunc().getStatus(i->action()).disabled())) + else if (!(i->optional() && flag.disabled()) + && ! flag.unknown()) last = it; + } it = extra_labels.begin(); size_type count = 0; @@ -263,11 +265,11 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, case MenuItem::Command: { FuncStatus const flag = view->getLyXFunc().getStatus(item.action()); - // handle optional entries. - if (item.optional() - && (flag.disabled())) { + // handle optional or unknown entries. + if (flag.unknown() + || (item.optional() && flag.disabled())) { lyxerr[Debug::GUI] - << "Skipping optional item " + << "Skipping item " << item.label() << endl; break; } @@ -296,7 +298,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, pupmode += "%B"; if (flag.onoff(false)) pupmode += "%b"; - if (flag.disabled() || flag.unknown()) + if (flag.disabled()) pupmode += "%i"; else all_disabled = false; diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index 7c80857880..38c92d7aa0 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -317,6 +317,12 @@ void lyx_gui::exit() } +FuncStatus lyx_gui::getStatus(FuncRequest const & /*ev*/) +{ + // Nothing interesting to do here + return FuncStatus(); +} + string const lyx_gui::hexname(LColor::color col) { string const name = lcolor.getX11Name(col); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index ff247f8859..f0467efc79 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -271,9 +271,20 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const return flag.disabled(true); } - if (ev.action == LFUN_UNKNOWN_ACTION) { + switch (ev.action) { + case LFUN_UNKNOWN_ACTION: +#ifndef HAVE_LIBAIKSAURUS + case LFUN_THESAURUS_ENTRY: +#endif + flag.unknown(true); + break; + default: + flag |= lyx_gui::getStatus(ev); + } + + if (flag.unknown()) { setStatusMessage(N_("Unknown action")); - return flag.unknown(true); + return flag; } // the default error message if we disable the command @@ -331,11 +342,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const } disable = !mathcursor && !view()->getLyXText()->selection.set(); break; -#ifndef HAVE_LIBAIKSAURUS - case LFUN_THESAURUS_ENTRY: - disable = true; - break; -#endif case LFUN_RUNCHKTEX: disable = lyxrc.chktex_command == "none"; break;