]> git.lyx.org Git - lyx.git/blobdiff - src/insets/figinset.C
fix compilation pb ; update eu.po
[lyx.git] / src / insets / figinset.C
index b55ff8f04e15b8c765e00a3d741fd40a899ed2de..a2c20d44cb42999a3e53319ce8524f88c9e00029 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
@@ -524,8 +521,10 @@ void runqueue()
                        t2 << "GHOSTVIEW=" << fl_get_canvas_id(figinset_canvas)
                           << ' ' << p->data->bitmap;
                        // now set up ghostview property on a window
+                       // #ifdef WITH_WARNINGS
                        // #warning BUG seems that the only bug here
                        // might be the hardcoded dpi.. Bummer!
+                       // #endif
                        ostringstream t1;
                        t1 << "0 0 0 0 " << p->data->wid << ' '
                           << p->data->hgh << " 72 72 0 0 0 0";
@@ -1257,12 +1256,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 +1557,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 !!!!