]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiExternal.cpp
Make string-widget combination more l7n friendly
[lyx.git] / src / frontends / qt / GuiExternal.cpp
index d850c2d8a5b8d9f1e4a3029086ca9b49be1740a1..70239f19e22c03fe9080be60a7f405ea95b44a71 100644 (file)
 #include "Buffer.h"
 #include "FuncRequest.h"
 #include "support/gettext.h"
-#include "Length.h"
 #include "LyXRC.h"
 
 #include "insets/ExternalSupport.h"
 #include "insets/ExternalTemplate.h"
-#include "insets/InsetExternal.h"
 
 #include "graphics/epstools.h"
 #include "graphics/GraphicsCache.h"
@@ -31,6 +29,7 @@
 
 #include "support/convert.h"
 #include "support/filetools.h"
+#include "support/Length.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
@@ -188,6 +187,8 @@ GuiExternal::GuiExternal(GuiView & lv)
        bc().addReadOnly(extraFormatCO);
        bc().addReadOnly(extraED);
 
+       // Add validated widgets to those that will be
+       // visually marked if invalid
        bc().addCheckedLineEdit(angleED, angleLA);
        bc().addCheckedLineEdit(displayscaleED, scaleLA);
        bc().addCheckedLineEdit(heightED, heightLA);
@@ -198,6 +199,18 @@ GuiExternal::GuiExternal(GuiView & lv)
        bc().addCheckedLineEdit(ytED, rtLA);
        bc().addCheckedLineEdit(fileED, fileLA);
 
+       // We also mark the tabs the widgets are in
+       int const tabindex = tab->indexOf(sizetab);
+       bc().addCheckedLineEdit(angleED, tab, tabindex);
+       bc().addCheckedLineEdit(heightED, tab, tabindex);
+       bc().addCheckedLineEdit(widthED, tab, tabindex);
+       bc().addCheckedLineEdit(xlED, tab, tabindex);
+       bc().addCheckedLineEdit(ybED, tab, tabindex);
+       bc().addCheckedLineEdit(xrED, tab, tabindex);
+       bc().addCheckedLineEdit(ytED, tab, tabindex);
+       bc().addCheckedLineEdit(displayscaleED, tab, tab->indexOf(lyxviewtab));
+       bc().addCheckedLineEdit(fileED, tab, tab->indexOf(filetab));
+
        external::TemplateManager::Templates::const_iterator i1, i2;
        i1 = external::TemplateManager::get().getTemplates().begin();
        i2 = external::TemplateManager::get().getTemplates().end();
@@ -445,7 +458,7 @@ static void getSize(external::ResizeData & data,
                data.scale = widgetToDoubleStr(&widthED);
                data.width = Length();
        } else {
-               data.width = Length(widgetsToLength(&widthED, &widthUnitCO));
+               data.width = widgetsToLength(&widthED, &widthUnitCO);
                data.scale = string();
        }
        data.height = Length(widgetsToLength(&heightED, &heightUnitCO));
@@ -645,6 +658,7 @@ void GuiExternal::dispatchParams()
 {
        string const lfun = InsetExternal::params2string(params_, buffer());
        dispatch(FuncRequest(getLfun(), lfun));
+       connectToNewInset();
 }
 
 
@@ -681,9 +695,6 @@ QString GuiExternal::browse(QString const & input,
 }
 
 
-Dialog * createGuiExternal(GuiView & lv) { return new GuiExternal(lv); }
-
-
 } // namespace frontend
 } // namespace lyx