From f2e1dfc16e93cc397e20e66c7f3f0553a1209d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 31 Aug 2000 15:11:15 +0000 Subject: [PATCH] Changed so one can specify a images without extension and so use pdflatex AND latex to process the file (add .eps automatically for inline preview). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@996 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 5 ++++ src/frontends/kde/lyxgui.kdevprj | 46 ++++++++++++++++---------------- src/insets/figinset.C | 20 ++++++++++---- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa29d0ff07..06ff456769 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-08-31 Juergen Vigna + + * src/insets/figinset.C: Various changes to look if the filename has + an extension and if not add it for inline previewing. + 2000-08-31 Lars Gullik Bjønnes * src/frontends/ButtonPolicies.h: add a Button AllButtons. diff --git a/src/frontends/kde/lyxgui.kdevprj b/src/frontends/kde/lyxgui.kdevprj index 147a51367a..0588d6cd6a 100644 --- a/src/frontends/kde/lyxgui.kdevprj +++ b/src/frontends/kde/lyxgui.kdevprj @@ -1,4 +1,9 @@ # KDE Config File +[formcopyright.C] +install_location= +dist=true +install=false +type=SOURCE [Workspace_1] openfiles=Untitled.h,Untitled.cpp, show_outputview=true @@ -6,20 +11,19 @@ show_treeview=true header_file=Untitled.h cpp_file=Untitled.cpp browser_file=file:/usr/doc/qt1x-devel-1.45/qlistbox.html -[formcopyright.C] -install_location= -dist=true -install=false -type=SOURCE [Config for BinMakefileAm] ldflags= -bin_program=lyxgui cxxflags=-O0 -g3 -Wall +bin_program=lyxgui [formcopyright.h] install_location= dist=true install=false type=HEADER +[dlg/Makefile.am] +files=dlg/formcopyrightdialog.kdevdlg,dlg/form_document.kdevdlg, +type=static_library +sub_dirs= [dlg/form_document.kdevdlg] widget_files= data_file= @@ -32,10 +36,6 @@ cpp_file= install=false is_toplevel_dialog=true type=KDEV_DIALOG -[dlg/Makefile.am] -files=dlg/formcopyrightdialog.kdevdlg,dlg/form_document.kdevdlg, -sub_dirs= -type=static_library [LFV Groups] Dialogs=*.kdevdlg, GNU= @@ -71,13 +71,13 @@ type=KDEV_DIALOG [General] makefiles=Makefile.am,dlg/Makefile.am, version_control=None -project_type=normal_empty author=Jürgen Vigna +project_type=normal_empty sub_dir=dlg/ lfv_open_groups=Headers,Sources,Dialogs, workspace=1 -project_name=LyxGUI version=0.1 +project_name=LyxGUI email=jug@sad.it kdevprj_version=1.0beta2 [formcopyrightdialog.C] @@ -90,24 +90,24 @@ install_location= dist=true install=false type=SOURCE +[Makefile.am] +files=lyxgui.kdevprj,FormCopyright.h,FormCopyright.C,formcopyrightdialog.h,formcopyrightdialog.C,formcopyrightdialogdata.C, +sub_dirs=dlg, +type=prog_main +sub_dirs=dlg<,dlg, +type=normal [lyxgui.kdevprj] install_location= dist=true install=false type=DATA -[Makefile.am] -files=lyxgui.kdevprj,FormCopyright.h,FormCopyright.C,formcopyrightdialog.h,formcopyrightdialog.C,formcopyrightdialogdata.C, -type=normal -sub_dirs=dlg<,dlg, -type=prog_main -sub_dirs=dlg, -[formcopyrightdialog.h] -install_location= -dist=true -install=false -type=HEADER [formcopyrightdialogdata.C] install_location= dist=true install=false type=SOURCE +[formcopyrightdialog.h] +install_location= +dist=true +install=false +type=HEADER diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 8b6d750126..f42b9a235a 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -1060,6 +1060,9 @@ void InsetFig::draw(BufferView * bv, LyXFont const & f, } else { char * msg = 0; + string lfname = fname; + if (GetExtension(fname).empty()) + lfname += ".eps"; // draw frame pain.rectangle(int(x), baseline - hgh - 1, wid + 1, hgh + 1); @@ -1069,7 +1072,7 @@ void InsetFig::draw(BufferView * bv, LyXFont const & f, } else if (fname.empty()) msg = _("[no file]"); - else if (!IsFileReadable(fname)) + else if (!IsFileReadable(lfname)) msg = _("[bad file name]"); else if ((flags & 3) == 0) msg = _("[not displayed]"); @@ -1483,10 +1486,14 @@ void InsetFig::Recompute() int frame_wid = int(ceil(fabs(cos_a * pswid) + fabs(sin_a * pshgh))); int frame_hgh= int(ceil(fabs(cos_a * pshgh) + fabs(sin_a * pswid))); + string lfname = fname; + if (GetExtension(fname).empty()) + lfname += ".eps"; + /* now recompute wid and hgh, and if that is changed, set changed */ /* this depends on chosen size of the picture and its bbox */ // This will be redone in 0.13 ... (hen) - if (!fname.empty() && IsFileReadable(fname)) { + if (!lfname.empty() && IsFileReadable(lfname)) { // say, total width is 595 pts, as A4 in TeX, thats in 1/72" */ newx = frame_wid; @@ -1565,11 +1572,11 @@ void InsetFig::Recompute() figdata * pf = figure->data; // get new data - if (!fname.empty() && IsFileReadable(fname) && (flags & 3) + if (!lfname.empty() && IsFileReadable(lfname) && (flags & 3) && !lyxrc.ps_command.empty()) { // do not display if there is "do not display" // chosen (Matthias 260696) - figure->data = getfigdata(wid, hgh, fname, + figure->data = getfigdata(wid, hgh, lfname, psx, psy, pswid, pshgh, raw_wid, raw_hgh, angle, flags & (3|8)); @@ -1963,8 +1970,11 @@ void InsetFig::Preview(char const * p) return; // parent process } + string tfname = p; + if (GetExtension(tfname).empty()) + tfname += ".eps"; string buf1 = OnlyPath(owner->fileName()); - string buf2 = MakeAbsPath(p, buf1); + string buf2 = MakeAbsPath(tfname, buf1); lyxerr << "Error during rendering " << execlp(lyxrc.view_pspic_command.c_str(),