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;
24 filename = current_view->currentBuffer()->getFileName();
25 if (!filename.empty()) {
26 fname = SpaceLess(ChangeExtension(filename, ".log", true));
27 bname = SpaceLess(ChangeExtension(filename,
28 lyxrc->literate_extension + ".out", true));
29 path = OnlyPath(filename);
30 if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
31 path = current_view->currentBuffer()->tmppath;
33 FileInfo f_fi(path + fname), b_fi(path + bname);
36 || f_fi.getModificationTime() < b_fi.getModificationTime())
37 use_build = true; // If no Latex log or Build log is newer, show Build log
38 Path p(path); // path to LaTeX file
39 if (!fl_load_browser(fd_latex_log->browser_latexlog,
40 use_build ? bname.c_str() : fname.c_str()))
41 fl_add_browser_line(fd_latex_log->browser_latexlog,
42 _("Unable to show log file!"));
44 fl_add_browser_line(fd_latex_log->browser_latexlog,
45 _("NO LATEX LOG FILE!"));
47 if (fd_latex_log->LaTeXLog->visible) {
48 fl_raise_form(fd_latex_log->LaTeXLog);
50 fl_show_form(fd_latex_log->LaTeXLog,
51 FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER,
52 use_build ? _("Build Program Log") : _("LaTeX Log"));
56 void LatexLogClose(FL_OBJECT *, long)
58 fl_hide_form(fd_latex_log->LaTeXLog);
61 void LatexLogUpdate(FL_OBJECT *, long)