]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Typo.
[lyx.git] / src / LyXFunc.cpp
index ffc723f01099f54a5b300b77c3b56d9c30f2f97d..6a3db5bb8559c086dcc1db2b4096cd755988c9f9 100644 (file)
@@ -62,9 +62,9 @@
 #include "insets/InsetERT.h"
 #include "insets/InsetExternal.h"
 #include "insets/InsetFloat.h"
-#include "insets/InsetListings.h"
 #include "insets/InsetGraphics.h"
 #include "insets/InsetInclude.h"
+#include "insets/InsetListings.h"
 #include "insets/InsetNote.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetTabular.h"
@@ -389,7 +389,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        if (cmd.action == LFUN_NOACTION) {
                flag.message(from_utf8(N_("Nothing to do")));
-               flag.enabled(false);
+               flag.setEnabled(false);
                return flag;
        }
 
@@ -399,7 +399,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_THESAURUS_ENTRY:
 #endif
                flag.unknown(true);
-               flag.enabled(false);
+               flag.setEnabled(false);
                break;
 
        default:
@@ -422,7 +422,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                // no, exit directly
                flag.message(from_utf8(N_("Command not allowed with"
                                    "out any document open")));
-               flag.enabled(false);
+               flag.setEnabled(false);
                return flag;
        }
 
@@ -433,20 +433,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        bool enable = true;
        switch (cmd.action) {
 
-       // FIXME optimally this should be in Text::getStatus. In such a case the flags
-       // are not passed when using context menu. This way it works.
-       case LFUN_SET_GRAPHICS_GROUP: {
-               if (!view())
-                       break;
-               InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(view()->cursor());
-               if (!ins)
-                       break;
-               if (!cmd.argument().empty())
-                       flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
-               enable = true;
-               break;
-       }
-
        case LFUN_BUFFER_TOGGLE_READ_ONLY:
                flag.setOnOff(buf->isReadonly());
                break;
@@ -595,8 +581,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_PREFERENCES_SAVE:
        case LFUN_MESSAGE:
        case LFUN_INSET_EDIT:
-       case LFUN_ALL_INSETS_TOGGLE:
-       case LFUN_GRAPHICS_GROUPS_UNIFY:
        case LFUN_BUFFER_LANGUAGE:
        case LFUN_TEXTCLASS_APPLY:
        case LFUN_TEXTCLASS_LOAD:
@@ -638,14 +622,14 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        }
 
        if (!enable)
-               flag.enabled(false);
+               flag.setEnabled(false);
 
        // Can we use a readonly buffer?
        if (buf && buf->isReadonly()
            && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
            && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
                flag.message(from_utf8(N_("Document is read-only")));
-               flag.enabled(false);
+               flag.setEnabled(false);
        }
 
        // Are we in a DELETED change-tracking region?
@@ -654,7 +638,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
            && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
            && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
                flag.message(from_utf8(N_("This portion of the document is deleted.")));
-               flag.enabled(false);
+               flag.setEnabled(false);
        }
 
        // the default error message if we disable the command
@@ -1393,43 +1377,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        lyx_view_->message(from_utf8(argument));
                        break;
 
-
-               case LFUN_ALL_INSETS_TOGGLE: {
-                       LASSERT(lyx_view_, /**/);
-                       string action;
-                       string const name = split(argument, action, ' ');
-                       InsetCode const inset_code = insetCode(name);
-
-                       Cursor & cur = view()->cursor();
-                       FuncRequest fr(LFUN_INSET_TOGGLE, action);
-
-                       Inset & inset = lyx_view_->buffer()->inset();
-                       InsetIterator it  = inset_iterator_begin(inset);
-                       InsetIterator const end = inset_iterator_end(inset);
-                       for (; it != end; ++it) {
-                               if (!it->asInsetMath()
-                                   && (inset_code == NO_CODE
-                                   || inset_code == it->lyxCode())) {
-                                       Cursor tmpcur = cur;
-                                       tmpcur.pushBackward(*it);
-                                       it->dispatch(tmpcur, fr);
-                               }
-                       }
-                       updateFlags = Update::Force | Update::FitCursor;
-                       break;
-               }
-
-               case LFUN_GRAPHICS_GROUPS_UNIFY: {
-                       LASSERT(lyx_view_, /**/);
-                       if (argument.empty() || !lyx_view_->buffer())
-                               break;
-                       //view()->cursor().recordUndoFullDocument(); let inset-apply do that job
-                       InsetGraphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
-                       lyx_view_->buffer()->markDirty();
-                       updateFlags = Update::Force | Update::FitCursor;
-                       break;
-               }
-
                case LFUN_BUFFER_LANGUAGE: {
                        LASSERT(lyx_view_, /**/);
                        Buffer & buffer = *lyx_view_->buffer();
@@ -1582,6 +1529,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                        actOnUpdatedPrefs(lyxrc_orig, lyxrc);
 
+                       // Set the language defined by the user.
+                       LyX::ref().setRcGuiLanguage();
+
                        theApp()->resetGui();
 
                        /// We force the redraw in any case because there might be
@@ -1861,6 +1811,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
        case LyXRC::RC_DATE_INSERT_FORMAT:
        case LyXRC::RC_DEFAULT_LANGUAGE:
+       case LyXRC::RC_GUI_LANGUAGE:
        case LyXRC::RC_DEFAULT_PAPERSIZE:
        case LyXRC::RC_DEFFILE:
        case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN: