]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
Upgrading of my xforms libs showed that lots of files thought they depended
[lyx.git] / src / lyxfunc.C
index b626117250a5bf258e494ed85a3ef93db77d4f9c..5b8ea4cf835e07f4516797b6479e4cb7cd6671f1 100644 (file)
@@ -38,7 +38,6 @@
 #include "minibuffer.h"
 #include "vspace.h"
 #include "LyXView.h"
-#include "lyx_gui_misc.h"
 #include "FloatList.h"
 #include "converter.h"
 #include "exporter.h"
@@ -48,7 +47,6 @@
 #include "lyxfind.h"
 #include "undo_funcs.h"
 #include "ParagraphParameters.h"
-#include "figureForm.h"
 
 #include "insets/inseturl.h"
 #include "insets/insetlatexaccent.h"
 #include "frontends/Menubar.h"
 #include "frontends/Alert.h"
 
+#include "graphics/GraphicsCache.h"
+
 #include "support/lyxalgo.h"
 #include "support/LAssert.h"
 #include "support/filetools.h"
 #include "support/FileInfo.h"
-#include "support/syscall.h"
+#include "support/forkedcontr.h"
 #include "support/lstrings.h"
 #include "support/path.h"
 #include "support/lyxfunctional.h"
@@ -106,6 +106,9 @@ using std::pair;
 using std::make_pair; 
 using std::endl;
 using std::find_if;
+using std::vector;
+using std::transform;
+using std::back_inserter;
 
 extern BufferList bufferlist;
 extern LyXServer * lyxserver;
@@ -573,7 +576,6 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        case LFUN_INSET_ERT:
                code = Inset::ERT_CODE;         
                break;
-       case LFUN_FIGURE:
        case LFUN_INSET_GRAPHICS:
                code = Inset::GRAPHICS_CODE;
                break;
@@ -880,7 +882,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                                     (!keyseq.deleted())))
                {
                        if ((action == LFUN_UNKNOWN_ACTION)
-                           && argument.empty()){
+                           && argument.empty()) {
                                argument = keyseq.getiso();
                        }
                        // Undo/Redo is a bit tricky for insets.
@@ -966,7 +968,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
        }
 
        switch (action) {
-               
+
        case LFUN_ESCAPE:
        {
                if (!owner->view()->available()) break;
@@ -1024,10 +1026,10 @@ string const LyXFunc::dispatch(kb_action action, string argument)
        // --- Misc -------------------------------------------
        case LFUN_EXEC_COMMAND:
        {
-               std::vector<string> allCmds;
-               std::transform(lyxaction.func_begin(), lyxaction.func_end(),
-                              std::back_inserter(allCmds), lyx::firster());
-               static std::vector<string> hist;
+               vector<string> allCmds;
+               transform(lyxaction.func_begin(), lyxaction.func_end(),
+                         back_inserter(allCmds), lyx::firster());
+               static vector<string> hist;
                owner->getMiniBuffer()->getString(MiniBuffer::spaces,
                                                  allCmds, hist);
        }
@@ -1143,7 +1145,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
 #endif
                        p.setCmdName("tableofcontents");
 #if 0
-               else if (action == LFUN_LOAVIEW )
+               else if (action == LFUN_LOAVIEW)
                        p.setCmdName("listof{algorithm}{List of Algorithms}");
                else if (action == LFUN_LOFVIEW)
                        p.setCmdName("listoffigures");
@@ -1158,10 +1160,6 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                owner->getDialogs()->showTabularCreate();
                break;
                
-       case LFUN_FIGURE:
-               Figure();
-               break;
-
        case LFUN_AUTOSAVE:
                AutoSave(owner->view());
                break;
@@ -1412,7 +1410,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                Paragraph * par = owner->buffer()->getParFromID(id);
                if (par == 0) {
                        lyxerr[Debug::INFO] << "No matching paragraph found! ["
-                                           << id << "]" << std::endl;
+                                           << id << "]" << endl;
                        break;
                } else {
                        lyxerr << "Paragraph " << par->id()
@@ -1498,7 +1496,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
        
        case LFUN_CITATION_CREATE:
        {
-               InsetCommandParams p( "cite" );
+               InsetCommandParams p("cite");
                
                if (!argument.empty()) {
                        // This should be set at source, ie when typing
@@ -1506,14 +1504,14 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        // Question: would pybibliographer also need to be
                        // changed. Suspect so. Leave as-is therefore.
                        if (contains(argument, "|")) {
-                               p.setContents( token(argument, '|', 0) );
-                               p.setOptions(  token(argument, '|', 1) );
+                               p.setContents(token(argument, '|', 0));
+                               p.setOptions( token(argument, '|', 1));
                        } else {
-                               p.setContents( argument );
+                               p.setContents(argument);
                        }
                        dispatch(LFUN_CITATION_INSERT, p.getAsString());
                } else
-                       owner->getDialogs()->createCitation( p.getAsString() );
+                       owner->getDialogs()->createCitation(p.getAsString());
        }
        break;
                    
@@ -1601,6 +1599,10 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        break;
                        }
 
+               bool const graphicsbg_changed =
+                       (lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
+                        x11_name != lcolor.getX11Name(LColor::graphicsbg));
+
                if (!lcolor.setColor(lyx_name, x11_name)) {
                        static string const err1 (N_("Set-color \""));
                        static string const err2 (
@@ -1609,7 +1611,14 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        setErrorMessage(_(err1) + lyx_name + _(err2));
                        break;
                }
+
                lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
+
+               if (graphicsbg_changed) {
+                       grfx::GCache & gc = grfx::GCache::get();
+                       gc.changeDisplay(true);
+               }
+               
                owner->view()->redraw();
                break;
        }
@@ -1626,6 +1635,21 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                owner->messagePop();
                break;
 
+       case LFUN_FORKS_SHOW:
+               owner->getDialogs()->showForks();
+               break;
+
+       case LFUN_FORKS_KILL:
+       {
+               if (!isStrInt(argument))
+                       break;
+
+               pid_t const pid = strToInt(argument);
+               ForkedcallsController & fcc = ForkedcallsController::get();
+               fcc.kill(pid);
+               break;
+       }
+
        default:
                // Then if it was none of the above
                // Trying the BufferView::pimpl dispatch: