4 #include FORMS_H_LOCATION
6 #include "latexoptions.h"
9 #include "support/FileInfo.h"
10 #include "support/filetools.h"
11 #include "support/path.h"
13 #include "BufferView.h"
16 extern FD_LaTeXLog *fd_latex_log;
17 extern BufferView *current_view;
21 string filename, fname, bname, path;
22 bool use_build = false;
23 static int ow = -1, oh;
25 filename = current_view->buffer()->getLatexName();
26 if (!filename.empty()) {
27 fname = ChangeExtension(filename, ".log", true);
28 bname = ChangeExtension(filename,
29 lyxrc->literate_extension + ".out",
31 path = OnlyPath(filename);
32 if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
33 path = current_view->buffer()->tmppath;
35 FileInfo f_fi(path + fname), b_fi(path + bname);
38 || f_fi.getModificationTime() < b_fi.getModificationTime())
39 use_build = true; // If no Latex log or Build log is newer, show Build log
40 Path p(path); // path to LaTeX file
41 if (!fl_load_browser(fd_latex_log->browser_latexlog,
42 use_build ? bname.c_str() : fname.c_str()))
43 fl_add_browser_line(fd_latex_log->browser_latexlog,
44 _("Unable to show log file!"));
46 fl_add_browser_line(fd_latex_log->browser_latexlog,
47 _("NO LATEX LOG FILE!"));
49 if (fd_latex_log->LaTeXLog->visible) {
50 fl_raise_form(fd_latex_log->LaTeXLog);
52 fl_show_form(fd_latex_log->LaTeXLog,
53 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
54 use_build ? _("Build Program Log") : _("LaTeX Log"));
56 ow = fd_latex_log->LaTeXLog->w;
57 oh = fd_latex_log->LaTeXLog->h;
59 fl_set_form_minsize(fd_latex_log->LaTeXLog, ow, oh);
63 void LatexLogClose(FL_OBJECT *, long)
65 fl_hide_form(fd_latex_log->LaTeXLog);
68 void LatexLogUpdate(FL_OBJECT *, long)