1999-09-27 18:44:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
#include <cstdlib>
|
1999-09-27 18:44:28 +00:00
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#include "buffer.h"
|
2000-07-18 11:06:04 +00:00
|
|
|
#include "log_form.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "lyx_main.h"
|
|
|
|
#include "LString.h"
|
1999-10-02 16:21:10 +00:00
|
|
|
#include "support/FileInfo.h"
|
|
|
|
#include "support/filetools.h"
|
1999-10-13 17:32:46 +00:00
|
|
|
#include "support/path.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "gettext.h"
|
2000-10-23 12:16:05 +00:00
|
|
|
#include "converter.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
extern FD_LaTeXLog *fd_latex_log;
|
|
|
|
extern BufferView *current_view;
|
|
|
|
|
|
|
|
void ShowLatexLog()
|
|
|
|
{
|
1999-10-13 17:32:46 +00:00
|
|
|
string filename, fname, bname, path;
|
|
|
|
bool use_build = false;
|
1999-10-25 14:50:26 +00:00
|
|
|
static int ow = -1, oh;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-12-03 13:51:01 +00:00
|
|
|
filename = current_view->buffer()->getLatexName();
|
1999-10-13 17:32:46 +00:00
|
|
|
if (!filename.empty()) {
|
2000-05-11 16:12:46 +00:00
|
|
|
fname = OnlyFilename(ChangeExtension(filename, ".log"));
|
|
|
|
bname = OnlyFilename(ChangeExtension(filename,
|
2000-11-06 11:20:22 +00:00
|
|
|
formats.Extension("literate") + ".out"));
|
1999-10-13 17:32:46 +00:00
|
|
|
path = OnlyPath(filename);
|
2000-03-12 10:35:05 +00:00
|
|
|
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
|
1999-11-09 23:52:04 +00:00
|
|
|
path = current_view->buffer()->tmppath;
|
1999-10-13 17:32:46 +00:00
|
|
|
}
|
|
|
|
FileInfo f_fi(path + fname), b_fi(path + bname);
|
|
|
|
if (b_fi.exist())
|
|
|
|
if (!f_fi.exist()
|
|
|
|
|| f_fi.getModificationTime() < b_fi.getModificationTime())
|
|
|
|
use_build = true; // If no Latex log or Build log is newer, show Build log
|
|
|
|
Path p(path); // path to LaTeX file
|
|
|
|
if (!fl_load_browser(fd_latex_log->browser_latexlog,
|
|
|
|
use_build ? bname.c_str() : fname.c_str()))
|
|
|
|
fl_add_browser_line(fd_latex_log->browser_latexlog,
|
2000-11-28 06:46:06 +00:00
|
|
|
_("No LaTeX log file found"));
|
1999-10-13 17:32:46 +00:00
|
|
|
} else {
|
|
|
|
fl_add_browser_line(fd_latex_log->browser_latexlog,
|
2000-11-28 06:46:06 +00:00
|
|
|
_("No LaTeX log file found"));
|
1999-10-13 17:32:46 +00:00
|
|
|
}
|
|
|
|
if (fd_latex_log->LaTeXLog->visible) {
|
|
|
|
fl_raise_form(fd_latex_log->LaTeXLog);
|
|
|
|
} else {
|
|
|
|
fl_show_form(fd_latex_log->LaTeXLog,
|
2000-11-08 09:39:46 +00:00
|
|
|
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
1999-10-13 17:32:46 +00:00
|
|
|
use_build ? _("Build Program Log") : _("LaTeX Log"));
|
1999-10-25 14:50:26 +00:00
|
|
|
if (ow < 0) {
|
|
|
|
ow = fd_latex_log->LaTeXLog->w;
|
|
|
|
oh = fd_latex_log->LaTeXLog->h;
|
|
|
|
}
|
|
|
|
fl_set_form_minsize(fd_latex_log->LaTeXLog, ow, oh);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LatexLogClose(FL_OBJECT *, long)
|
|
|
|
{
|
|
|
|
fl_hide_form(fd_latex_log->LaTeXLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LatexLogUpdate(FL_OBJECT *, long)
|
|
|
|
{
|
|
|
|
ShowLatexLog();
|
|
|
|
}
|