]> git.lyx.org Git - lyx.git/blobdiff - src/insets/figinset.C
reformatting and remove using delc
[lyx.git] / src / insets / figinset.C
index b55ff8f04e15b8c765e00a3d741fd40a899ed2de..d80165688c7c6cfe32821a65b88c70f0dac623b1 100644 (file)
@@ -45,7 +45,6 @@
 #include <cmath>
 
 #include "figinset.h"
-#include "lyx.h"
 #include "lyx_main.h"
 #include "buffer.h"
 #include "frontends/FileDialog.h"
@@ -85,6 +84,10 @@ extern FL_OBJECT * figinset_canvas;
 
 extern char ** environ; // is this only redundtant on linux systems? Lgb.
 
+// xforms doesn't define this (but it should be in <forms.h>).
+extern "C"
+FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
+
 namespace {
 
 float const DEG2PI = 57.295779513;
@@ -374,12 +377,6 @@ void AllocGrays(int num)
        gs_color = true;
 }
 
-
-// xforms doesn't define this
-extern "C"
-FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
-
-
 void InitFigures()
 {
        // if bitmaps and figures are not empty we will leak mem
@@ -1257,12 +1254,15 @@ Inset * InsetFig::Clone(Buffer const & buffer) const
        tmp->pswid = pswid;
        tmp->pshgh = pshgh;
        tmp->fname = fname;
-       if (!fname.empty() && IsFileReadable(fname) 
+       string lfname = fname;
+       if (!fname.empty() && GetExtension(fname).empty())
+               lfname += ".eps";
+       if (!fname.empty() && IsFileReadable(lfname) 
            && (flags & 3) && !lyxrc.ps_command.empty()
            && lyxrc.use_gui) { 
                // do not display if there is
                // "do not display" chosen (Matthias 260696)
-               tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy,
+               tmp->figure->data = getfigdata(wid, hgh, lfname, psx, psy,
                                               pswid, pshgh, raw_wid, raw_hgh,
                                               angle, flags & (3|8));
        } else tmp->figure->data = 0;
@@ -1555,7 +1555,10 @@ void InsetFig::GetPSSizes()
 
        if (fname.empty()) return;
        string p;
-       ifstream ifs(fname.c_str());
+       string lfname = fname;
+       if (GetExtension(fname).empty())
+               lfname += ".eps";
+       ifstream ifs(lfname.c_str());
 
        if (!ifs) return;       // file not found !!!!