mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Move LaTeX and VC logs to GUI-I on xforms
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1451 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e7b0972c44
commit
8a766b722d
@ -0,0 +1,3 @@
|
||||
2001-02-06 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* log_form.fd: deleted
|
@ -63,6 +63,7 @@ src/frontends/kde/tocdlg.C
|
||||
src/frontends/kde/urldlg.C
|
||||
src/frontends/qt2/FormCopyright.C
|
||||
src/frontends/xforms/FormBase.h
|
||||
src/frontends/xforms/form_browser.C
|
||||
src/frontends/xforms/FormCitation.C
|
||||
src/frontends/xforms/form_citation.C
|
||||
src/frontends/xforms/FormCopyright.C
|
||||
@ -76,6 +77,7 @@ src/frontends/xforms/form_graphics.C
|
||||
src/frontends/xforms/FormIndex.C
|
||||
src/frontends/xforms/form_index.C
|
||||
src/frontends/xforms/FormInset.h
|
||||
src/frontends/xforms/FormLog.C
|
||||
src/frontends/xforms/FormParagraph.C
|
||||
src/frontends/xforms/form_paragraph.C
|
||||
src/frontends/xforms/FormPreferences.C
|
||||
@ -92,6 +94,7 @@ src/frontends/xforms/FormToc.C
|
||||
src/frontends/xforms/form_toc.C
|
||||
src/frontends/xforms/FormUrl.C
|
||||
src/frontends/xforms/form_url.C
|
||||
src/frontends/xforms/FormVCLog.C
|
||||
src/frontends/xforms/input_validators.C
|
||||
src/frontends/xforms/Menubar_pimpl.C
|
||||
src/frontends/xforms/xform_helpers.C
|
||||
@ -124,11 +127,9 @@ src/intl.C
|
||||
src/kbsequence.C
|
||||
src/language.C
|
||||
src/LaTeX.C
|
||||
src/LaTeXLog.C
|
||||
src/layout.C
|
||||
src/layout_forms.C
|
||||
src/LColor.C
|
||||
src/log_form.C
|
||||
src/LyXAction.C
|
||||
src/lyx.C
|
||||
src/lyx_cb.C
|
||||
|
@ -1,3 +1,18 @@
|
||||
2001-02-06 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Makefile.am: remove LaTeXLog.C, log_form.[Ch]
|
||||
|
||||
* LaTeXLog.C: deleted, useful code moved to Buffer
|
||||
|
||||
* buffer.h:
|
||||
* buffer.C: new function getLatexLogName()
|
||||
|
||||
* lyx_gui_misc.C:
|
||||
* lyx_gui.C:
|
||||
* lyxvc.C:
|
||||
* lyxvc.h:
|
||||
* lyxfunc.C: use frontends for LaTeX and VC logs
|
||||
|
||||
2001-02-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* LaTeX.h: yet another std:: that Allan forgot.
|
||||
|
@ -1,71 +0,0 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include FORMS_H_LOCATION
|
||||
#include "buffer.h"
|
||||
#include "log_form.h"
|
||||
#include "lyx_main.h"
|
||||
#include "LString.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/path.h"
|
||||
#include "lyxrc.h"
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
#include "converter.h"
|
||||
|
||||
extern FD_LaTeXLog *fd_latex_log;
|
||||
extern BufferView *current_view;
|
||||
|
||||
void ShowLatexLog()
|
||||
{
|
||||
string filename, fname, bname, path;
|
||||
bool use_build = false;
|
||||
static int ow = -1, oh;
|
||||
|
||||
filename = current_view->buffer()->getLatexName();
|
||||
if (!filename.empty()) {
|
||||
fname = OnlyFilename(ChangeExtension(filename, ".log"));
|
||||
bname = OnlyFilename(ChangeExtension(filename,
|
||||
formats.Extension("literate") + ".out"));
|
||||
path = OnlyPath(filename);
|
||||
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
|
||||
path = current_view->buffer()->tmppath;
|
||||
}
|
||||
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,
|
||||
_("No LaTeX log file found"));
|
||||
} else {
|
||||
fl_add_browser_line(fd_latex_log->browser_latexlog,
|
||||
_("No LaTeX log file found"));
|
||||
}
|
||||
if (fd_latex_log->LaTeXLog->visible) {
|
||||
fl_raise_form(fd_latex_log->LaTeXLog);
|
||||
} else {
|
||||
fl_show_form(fd_latex_log->LaTeXLog,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
use_build ? _("Build Program Log") : _("LaTeX Log"));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void LatexLogClose(FL_OBJECT *, long)
|
||||
{
|
||||
fl_hide_form(fd_latex_log->LaTeXLog);
|
||||
}
|
||||
|
||||
void LatexLogUpdate(FL_OBJECT *, long)
|
||||
{
|
||||
ShowLatexLog();
|
||||
}
|
@ -53,7 +53,6 @@ lyx_SOURCES = \
|
||||
LaTeX.h \
|
||||
LaTeXFeatures.C \
|
||||
LaTeXFeatures.h \
|
||||
LaTeXLog.C \
|
||||
Lsstream.h \
|
||||
LyXAction.C \
|
||||
LyXAction.h \
|
||||
@ -143,8 +142,6 @@ lyx_SOURCES = \
|
||||
layout.h \
|
||||
layout_forms.C \
|
||||
layout_forms.h \
|
||||
log_form.C \
|
||||
log_form.h \
|
||||
lyx.C \
|
||||
lyx.h \
|
||||
lyx_cb.C \
|
||||
|
28
src/buffer.C
28
src/buffer.C
@ -94,6 +94,7 @@
|
||||
#include "encoding.h"
|
||||
#include "exporter.h"
|
||||
#include "Lsstream.h"
|
||||
#include "converter.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::ofstream;
|
||||
@ -177,6 +178,33 @@ string const Buffer::getLatexName(bool no_path) const
|
||||
".tex");
|
||||
}
|
||||
|
||||
string const Buffer::getLatexLogName(void) const
|
||||
{
|
||||
string filename, fname, bname, path;
|
||||
|
||||
filename = getLatexName(false);
|
||||
|
||||
if (filename.empty())
|
||||
return string();
|
||||
|
||||
fname = OnlyFilename(ChangeExtension(filename, ".log"));
|
||||
bname = OnlyFilename(ChangeExtension(filename,
|
||||
formats.Extension("literate") + ".out"));
|
||||
path = OnlyPath(filename);
|
||||
|
||||
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1))
|
||||
path = tmppath + "/";
|
||||
|
||||
lyxerr[Debug::FILES] << "LaTeX Log calculated as : " << path + fname << endl;
|
||||
|
||||
// If no Latex log or Build log is newer, show Build log
|
||||
FileInfo f_fi(path + fname), b_fi(path + bname);
|
||||
if (b_fi.exist() &&
|
||||
(!f_fi.exist() || f_fi.getModificationTime() < b_fi.getModificationTime()))
|
||||
return path + bname;
|
||||
else
|
||||
return path + fname;
|
||||
}
|
||||
|
||||
void Buffer::setReadonly(bool flag)
|
||||
{
|
||||
|
@ -240,6 +240,11 @@ public:
|
||||
*/
|
||||
string const getLatexName(bool no_path = true) const;
|
||||
|
||||
/**
|
||||
* get the name of the LaTeX log
|
||||
*/
|
||||
string const getLatexLogName(void) const;
|
||||
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void setFileName(string const & newfile);
|
||||
|
||||
|
@ -118,6 +118,25 @@ void PreferencesPolicy::input(SMInput input)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------OkViewPolicy------------------------------*/
|
||||
|
||||
|
||||
OkViewPolicy::OkViewPolicy()
|
||||
: state_(INITIAL),
|
||||
outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
|
||||
state_machine_(INVALID + 1,
|
||||
StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OkViewPolicy::input(SMInput)
|
||||
{
|
||||
state_ = VALID;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------OkCancelPolicy------------------------------*/
|
||||
|
||||
|
||||
|
@ -216,6 +216,31 @@ private:
|
||||
StateMachine state_machine_;
|
||||
};
|
||||
|
||||
/** OK button policy for dialogs that can't mutate the document,
|
||||
and are always valid
|
||||
*/
|
||||
class OkViewPolicy : public ButtonPolicy {
|
||||
public:
|
||||
///
|
||||
OkViewPolicy();
|
||||
/// Trigger a transition with this input
|
||||
virtual void input(SMInput);
|
||||
/// activation status
|
||||
virtual bool buttonStatus(Button button) const {
|
||||
return button & outputs_[state_];
|
||||
}
|
||||
/// are we in a read-only state ?
|
||||
virtual bool isReadOnly() const {
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
/// current state
|
||||
State state_;
|
||||
/// which buttons are active
|
||||
StateOutputs outputs_;
|
||||
///
|
||||
StateMachine state_machine_;
|
||||
};
|
||||
|
||||
/** Ok and Cancel buttons for dialogs where read-only operation is blocked.
|
||||
The state machine design for this policy allows changes to occur within
|
||||
|
@ -1,3 +1,10 @@
|
||||
2001-02-06 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* ButtonPolicies.C:
|
||||
* ButtonPolicies.h: add OkViewPolicy
|
||||
|
||||
* src/frontends/Dialogs.h: add showVCLogFile signal
|
||||
|
||||
2001-01-24 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Makefile.am: add qt2 frontend
|
||||
|
@ -114,7 +114,9 @@ public:
|
||||
Signal0<void> showLayoutDocument;
|
||||
///
|
||||
Signal0<void> showLayoutParagraph;
|
||||
///
|
||||
/// show the version control log
|
||||
Signal0<void> showVCLogFile;
|
||||
/// show the LaTeX log or build file
|
||||
Signal0<void> showLogFile;
|
||||
///
|
||||
Signal0<void> showPreamble;
|
||||
|
@ -1,3 +1,20 @@
|
||||
2001-02-06 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* form_browser.h:
|
||||
* form_browser.C:
|
||||
* forms/form_browser.fd:
|
||||
* forms/makefile:
|
||||
* FormBrowser.C:
|
||||
* FormBrowser.h: readonly browser form
|
||||
|
||||
* FormLog.C:
|
||||
* FormLog.h:
|
||||
* FormVCLog.C:
|
||||
* FormVCLog.h:
|
||||
* Dialogs.C: add Log and VCLog
|
||||
|
||||
* Makefile.am: add Log and VCLog, add updatesrc target
|
||||
|
||||
2001-01-31 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* Menubar_pimpl.C (add_toc2): Add shortcut to the TOC menu.
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "FormError.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "FormIndex.h"
|
||||
#include "FormLog.h"
|
||||
#include "FormParagraph.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "FormPrint.h"
|
||||
@ -26,7 +27,7 @@
|
||||
#include "FormTabularCreate.h"
|
||||
#include "FormToc.h"
|
||||
#include "FormUrl.h"
|
||||
//#include "debug.h"
|
||||
#include "FormVCLog.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
@ -51,6 +52,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
dialogs_.push_back(new FormError(lv, this));
|
||||
dialogs_.push_back(new FormGraphics(lv, this));
|
||||
dialogs_.push_back(new FormIndex(lv, this));
|
||||
dialogs_.push_back(new FormLog(lv, this));
|
||||
dialogs_.push_back(new FormParagraph(lv, this));
|
||||
dialogs_.push_back(new FormPreferences(lv, this));
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
@ -59,6 +61,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
dialogs_.push_back(new FormTabularCreate(lv, this));
|
||||
dialogs_.push_back(new FormToc(lv, this));
|
||||
dialogs_.push_back(new FormUrl(lv, this));
|
||||
dialogs_.push_back(new FormVCLog(lv, this));
|
||||
|
||||
showCredits.connect(slot(ShowCredits));
|
||||
|
||||
@ -73,7 +76,6 @@ Dialogs::~Dialogs()
|
||||
for (vector<DialogBase *>::iterator iter = dialogs_.begin();
|
||||
iter != dialogs_.end();
|
||||
++iter) {
|
||||
//lyxerr << "delete *iter" << endl;
|
||||
delete *iter;
|
||||
}
|
||||
}
|
||||
|
65
src/frontends/xforms/FormBrowser.C
Normal file
65
src/frontends/xforms/FormBrowser.C
Normal file
@ -0,0 +1,65 @@
|
||||
/* FormBrowser.C
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "FormBrowser.h"
|
||||
#include "form_browser.h"
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
FormBrowser::FormBrowser(LyXView * lv, Dialogs * d, const string & name)
|
||||
: FormBaseBD(lv, d, name, new OkViewPolicy),
|
||||
dialog_(0)
|
||||
{
|
||||
}
|
||||
|
||||
FormBrowser::~FormBrowser()
|
||||
{
|
||||
delete dialog_;
|
||||
}
|
||||
|
||||
void FormBrowser::build()
|
||||
{
|
||||
dialog_ = build_browser();
|
||||
|
||||
// Workaround dumb xforms sizing bug
|
||||
minw_ = form()->w;
|
||||
minh_ = form()->h;
|
||||
|
||||
// Manage the close button
|
||||
bc_.setOK(dialog_->button_close);
|
||||
bc_.refresh();
|
||||
}
|
||||
|
||||
FL_FORM * FormBrowser::form() const
|
||||
{
|
||||
if (dialog_)
|
||||
return dialog_->form;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FormBrowser::update()
|
||||
{
|
||||
}
|
||||
|
||||
bool FormBrowser::input(FL_OBJECT *, long)
|
||||
{
|
||||
update();
|
||||
return true;
|
||||
}
|
50
src/frontends/xforms/FormBrowser.h
Normal file
50
src/frontends/xforms/FormBrowser.h
Normal file
@ -0,0 +1,50 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
* FormBrowser.h
|
||||
*
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#ifndef FORMBROWSER_H
|
||||
#define FORMBROWSER_H
|
||||
|
||||
#include "FormBase.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
struct FD_form_browser;
|
||||
|
||||
/**
|
||||
* This class provides an XForms implementation of a read only
|
||||
* text browser.
|
||||
*/
|
||||
class FormBrowser : public FormBaseBD {
|
||||
public:
|
||||
FormBrowser(LyXView *, Dialogs *, const string &);
|
||||
~FormBrowser();
|
||||
|
||||
protected:
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
|
||||
/// Real GUI implementation.
|
||||
FD_form_browser * dialog_;
|
||||
|
||||
private:
|
||||
/// Pointer to the actual instantiation of the xform's form
|
||||
virtual FL_FORM * form() const;
|
||||
/// Filter the inputs on callback from xforms
|
||||
virtual bool input(FL_OBJECT *, long);
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
|
||||
/// generated build function
|
||||
FD_form_browser * build_browser();
|
||||
};
|
||||
|
||||
#endif
|
50
src/frontends/xforms/FormLog.C
Normal file
50
src/frontends/xforms/FormLog.C
Normal file
@ -0,0 +1,50 @@
|
||||
/* FormLog.C
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "FormLog.h"
|
||||
#include "form_browser.h"
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
FormLog::FormLog(LyXView * lv, Dialogs * d)
|
||||
: FormBrowser(lv, d, _("LaTeX Log"))
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showLogFile.connect(slot(this, &FormLog::show));
|
||||
}
|
||||
|
||||
FormLog::~FormLog()
|
||||
{
|
||||
}
|
||||
|
||||
void FormLog::update()
|
||||
{
|
||||
if (!dialog_ || !lv_->view()->available())
|
||||
return;
|
||||
|
||||
string const logfile = lv_->view()->buffer()->getLatexLogName();
|
||||
|
||||
fl_clear_browser(dialog_->browser);
|
||||
|
||||
if (!fl_load_browser(dialog_->browser, logfile.c_str()))
|
||||
fl_add_browser_line(dialog_->browser, _("No LaTeX log file found"));
|
||||
}
|
36
src/frontends/xforms/FormLog.h
Normal file
36
src/frontends/xforms/FormLog.h
Normal file
@ -0,0 +1,36 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
* FormLog.h
|
||||
*
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#ifndef FORMLOG_H
|
||||
#define FORMLOG_H
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormBrowser.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
|
||||
/**
|
||||
* This class provides an XForms implementation of the LaTeX log dialog
|
||||
* for viewing the last LaTeX log file.
|
||||
*/
|
||||
class FormLog : public FormBrowser {
|
||||
public:
|
||||
FormLog(LyXView *, Dialogs *);
|
||||
~FormLog();
|
||||
|
||||
private:
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
};
|
||||
|
||||
#endif
|
52
src/frontends/xforms/FormVCLog.C
Normal file
52
src/frontends/xforms/FormVCLog.C
Normal file
@ -0,0 +1,52 @@
|
||||
/* FormVCLog.C
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "FormVCLog.h"
|
||||
#include "form_browser.h"
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
FormVCLog::FormVCLog(LyXView * lv, Dialogs * d)
|
||||
: FormBrowser(lv, d, _("Version Control Log"))
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showVCLogFile.connect(slot(this, &FormVCLog::show));
|
||||
}
|
||||
|
||||
FormVCLog::~FormVCLog()
|
||||
{
|
||||
}
|
||||
|
||||
void FormVCLog::update()
|
||||
{
|
||||
if (!dialog_ || !lv_->view()->available())
|
||||
return;
|
||||
|
||||
const string logfile = lv_->view()->buffer()->lyxvc.getLogFile();
|
||||
|
||||
fl_clear_browser(dialog_->browser);
|
||||
|
||||
if (logfile=="" || !fl_load_browser(dialog_->browser, logfile.c_str()))
|
||||
fl_add_browser_line(dialog_->browser, _("No version control log file available"));
|
||||
|
||||
lyx::unlink(logfile);
|
||||
}
|
36
src/frontends/xforms/FormVCLog.h
Normal file
36
src/frontends/xforms/FormVCLog.h
Normal file
@ -0,0 +1,36 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
* FormVCLog.h
|
||||
*
|
||||
* (C) 2001 LyX Team
|
||||
* John Levon, moz@compsoc.man.ac.uk
|
||||
*/
|
||||
|
||||
#ifndef FORMVCLOG_H
|
||||
#define FORMVCLOG_H
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormBrowser.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
|
||||
/**
|
||||
* This class provides an XForms implementation of the Version Control
|
||||
* log viewer
|
||||
*/
|
||||
class FormVCLog : public FormBrowser {
|
||||
public:
|
||||
FormVCLog(LyXView *, Dialogs *);
|
||||
~FormVCLog();
|
||||
|
||||
private:
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
};
|
||||
|
||||
#endif
|
@ -20,6 +20,10 @@ libxforms_la_SOURCES = \
|
||||
GUIRunTime.C \
|
||||
FormBase.C \
|
||||
FormBase.h \
|
||||
FormBrowser.C \
|
||||
FormBrowser.h \
|
||||
form_browser.C \
|
||||
form_browser.h \
|
||||
FormCitation.C \
|
||||
FormCitation.h \
|
||||
form_citation.C \
|
||||
@ -46,6 +50,8 @@ libxforms_la_SOURCES = \
|
||||
form_index.h \
|
||||
FormInset.C \
|
||||
FormInset.h \
|
||||
FormLog.C \
|
||||
FormLog.h \
|
||||
FormParagraph.C \
|
||||
FormParagraph.h \
|
||||
form_paragraph.C \
|
||||
@ -78,6 +84,8 @@ libxforms_la_SOURCES = \
|
||||
FormUrl.h \
|
||||
form_url.C \
|
||||
form_url.h \
|
||||
FormVCLog.C \
|
||||
FormVCLog.h \
|
||||
input_validators.h \
|
||||
input_validators.C \
|
||||
Menubar_pimpl.C \
|
||||
@ -96,6 +104,10 @@ libxforms_la_SOURCES = \
|
||||
# GUI_runtime.C \
|
||||
# GUI_applymenu.C
|
||||
|
||||
# for convenience only
|
||||
updatesrc:
|
||||
$(MAKE) -C forms updatesrc
|
||||
|
||||
# just copied from old lyx repository
|
||||
dist-hook:
|
||||
for subdir in $(LYXDATADIRS) ; do \
|
||||
|
49
src/frontends/xforms/form_browser.C
Normal file
49
src/frontends/xforms/form_browser.C
Normal file
@ -0,0 +1,49 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "form_browser.h"
|
||||
#include "FormBrowser.h"
|
||||
|
||||
FD_form_browser::~FD_form_browser()
|
||||
{
|
||||
if ( form->visible ) fl_hide_form( form );
|
||||
fl_free_form( form );
|
||||
}
|
||||
|
||||
|
||||
FD_form_browser * FormBrowser::build_browser()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_browser *fdui = new FD_form_browser;
|
||||
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 470, 380);
|
||||
fdui->form->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
|
||||
fdui->browser = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
|
||||
fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 370, 340, 90, 30, _("Close"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Update|#Uu");
|
||||
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 340, 90, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
22
src/frontends/xforms/form_browser.h
Normal file
22
src/frontends/xforms/form_browser.h
Normal file
@ -0,0 +1,22 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
/** Header file generated with fdesign **/
|
||||
|
||||
#ifndef FD_form_browser_h_
|
||||
#define FD_form_browser_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
struct FD_form_browser {
|
||||
~FD_form_browser();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *browser;
|
||||
FL_OBJECT *button_close;
|
||||
FL_OBJECT *button_update;
|
||||
};
|
||||
|
||||
#endif /* FD_form_browser_h_ */
|
@ -7,7 +7,7 @@ Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: LaTeXLog
|
||||
Name: form_browser
|
||||
Width: 470
|
||||
Height: 380
|
||||
Number of Objects: 4
|
||||
@ -44,14 +44,14 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_SouthEast
|
||||
name: browser_latexlog
|
||||
name: browser
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 270 340 90 30
|
||||
box: 370 340 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -62,14 +62,14 @@ label: Close
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name:
|
||||
callback: LatexLogClose
|
||||
name: button_close
|
||||
callback: C_FormBaseOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 370 340 90 30
|
||||
box: 270 340 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -80,8 +80,8 @@ label: Update|#Uu
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name:
|
||||
callback: LatexLogUpdate
|
||||
name: button_update
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
@ -23,6 +23,7 @@ SRCS := form_citation.fd \
|
||||
form_error.fd \
|
||||
form_graphics.fd \
|
||||
form_index.fd \
|
||||
form_browser.fd \
|
||||
form_paragraph.fd \
|
||||
form_preferences.fd \
|
||||
form_print.fd \
|
||||
|
@ -1,36 +0,0 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <cstdlib>
|
||||
#include "log_form.h"
|
||||
|
||||
FD_LaTeXLog *create_form_LaTeXLog(void)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_LaTeXLog *fdui = (FD_LaTeXLog *) fl_calloc(1, sizeof(FD_LaTeXLog));
|
||||
|
||||
fdui->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
|
||||
fdui->browser_latexlog = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
|
||||
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, LatexLogClose, 0);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30, idex(_("Update|#Uu")));fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, LatexLogUpdate, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->LaTeXLog->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
@ -1,22 +0,0 @@
|
||||
/** Header file generated with fdesign **/
|
||||
|
||||
#ifndef FD_LaTeXLog_h_
|
||||
#define FD_LaTeXLog_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void LatexLogClose(FL_OBJECT *, long);
|
||||
extern "C" void LatexLogUpdate(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *LaTeXLog;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *browser_latexlog;
|
||||
} FD_LaTeXLog;
|
||||
|
||||
extern FD_LaTeXLog * create_form_LaTeXLog(void);
|
||||
|
||||
#endif /* FD_LaTeXLog_h_ */
|
@ -27,7 +27,6 @@
|
||||
#include "print_form.h"
|
||||
#include "tex-strings.h"
|
||||
#include "lyx_main.h"
|
||||
#include "log_form.h"
|
||||
#include "debug.h"
|
||||
#include "version.h"
|
||||
#include "LyXView.h"
|
||||
@ -52,7 +51,6 @@ FD_form_character * fd_form_character;
|
||||
FD_form_preamble * fd_form_preamble;
|
||||
FD_form_sendto * fd_form_sendto;
|
||||
FD_form_figure * fd_form_figure;
|
||||
FD_LaTeXLog * fd_latex_log; // from log_form.h
|
||||
Combox * combo_language;
|
||||
Combox * combo_language2;
|
||||
|
||||
@ -369,11 +367,6 @@ void LyXGUI::create_forms()
|
||||
CancelCloseBoxCB, 0);
|
||||
fl_set_button(fd_form_figure->radio_postscript, 1);
|
||||
|
||||
// the latex log form
|
||||
fd_latex_log = create_form_LaTeXLog();
|
||||
fl_set_form_atclose(fd_latex_log->LaTeXLog,
|
||||
CancelCloseBoxCB, 0);
|
||||
|
||||
// This is probably as good a time as any to map the xform colours,
|
||||
// should a mapping exist.
|
||||
{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "form1.h"
|
||||
#include "gettext.h"
|
||||
#include "include_form.h"
|
||||
#include "log_form.h"
|
||||
#include "layout_forms.h"
|
||||
#include "lyx.h"
|
||||
#include "lyx_cb.h"
|
||||
@ -51,7 +50,6 @@ extern FD_form_preamble * fd_form_preamble;
|
||||
extern FD_form_sendto * fd_form_sendto;
|
||||
extern FD_form_spell_check * fd_form_spell_check;
|
||||
extern FD_form_spell_options * fd_form_spell_options;
|
||||
extern FD_LaTeXLog * fd_latex_log;
|
||||
extern FD_panel * fd_panel;
|
||||
extern FD_delim * fd_delim;
|
||||
extern FD_deco * fd_deco;
|
||||
@ -103,9 +101,6 @@ void RedrawAllBufferRelatedDialogs()
|
||||
fd_form_spell_options->form_spell_options->visible) {
|
||||
fl_redraw_form(fd_form_spell_options->form_spell_options);
|
||||
}
|
||||
if (fd_latex_log->LaTeXLog->visible) {
|
||||
fl_redraw_form(fd_latex_log->LaTeXLog);
|
||||
}
|
||||
if (fd_matrix && fd_matrix->matrix->visible) {
|
||||
fl_redraw_form(fd_matrix->matrix);
|
||||
}
|
||||
@ -142,9 +137,6 @@ void CloseAllBufferRelatedDialogs()
|
||||
if (fd_form_sendto->form_sendto->visible) {
|
||||
fl_hide_form(fd_form_sendto->form_sendto);
|
||||
}
|
||||
if (fd_latex_log->LaTeXLog->visible) {
|
||||
fl_hide_form(fd_latex_log->LaTeXLog);
|
||||
}
|
||||
if (fd_form_spell_check) {
|
||||
if (fd_form_spell_check->form_spell_check->visible) {
|
||||
fl_trigger_object(fd_form_spell_check->done);
|
||||
@ -195,9 +187,6 @@ void updateAllVisibleBufferRelatedDialogs(bool)
|
||||
if (fd_form_preamble->form_preamble->visible) {
|
||||
UpdateLayoutPreamble(current_view);
|
||||
}
|
||||
if (fd_latex_log->LaTeXLog->visible) {
|
||||
LatexLogUpdate(0,0);
|
||||
}
|
||||
if (current_view->buffer() && current_view->buffer()->isReadonly()) {
|
||||
// a little crude perhaps but it works. ARRae
|
||||
if (fd_form_character->form_character->visible) {
|
||||
|
@ -1178,7 +1178,7 @@ string const LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_VC_HISTORY:
|
||||
{
|
||||
owner->buffer()->lyxvc.showLog();
|
||||
owner->getDialogs()->showVCLogFile();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1216,7 +1216,7 @@ string const LyXFunc::Dispatch(int ac,
|
||||
break;
|
||||
|
||||
case LFUN_LATEX_LOG:
|
||||
ShowLatexLog();
|
||||
owner->getDialogs()->showLogFile();
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUTNO:
|
||||
|
86
src/lyxvc.C
86
src/lyxvc.C
@ -24,18 +24,12 @@ using std::pair;
|
||||
LyXVC::LyXVC()
|
||||
{
|
||||
vcs = 0;
|
||||
browser = 0;
|
||||
owner_ = 0;
|
||||
}
|
||||
|
||||
|
||||
LyXVC::~LyXVC()
|
||||
{
|
||||
if (browser) {
|
||||
if (browser->LaTeXLog->visible)
|
||||
fl_hide_form(browser->LaTeXLog);
|
||||
fl_free_form(browser->LaTeXLog);
|
||||
}
|
||||
delete vcs;
|
||||
}
|
||||
|
||||
@ -218,83 +212,13 @@ string const & LyXVC::locker() const
|
||||
}
|
||||
|
||||
|
||||
// This is a hack anyway so I'll put it here in the mean time.
|
||||
void LyXVC::logClose(FL_OBJECT * obj, long)
|
||||
const string LyXVC::getLogFile() const
|
||||
{
|
||||
LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
|
||||
fl_hide_form(This->browser->LaTeXLog);
|
||||
}
|
||||
if (!vcs)
|
||||
return string();
|
||||
|
||||
|
||||
// and, hack over hack, here is a C wrapper :)
|
||||
extern "C" void C_LyXVC_logClose(FL_OBJECT * ob, long data)
|
||||
{
|
||||
LyXVC::logClose(ob, data);
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::logUpdate(FL_OBJECT * obj, long)
|
||||
{
|
||||
LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
|
||||
This->showLog();
|
||||
}
|
||||
|
||||
extern "C" void C_LyXVC_logUpdate(FL_OBJECT *ob, long data)
|
||||
{
|
||||
LyXVC::logUpdate(ob, data);
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::viewLog(string const & fil)
|
||||
{
|
||||
static int ow = -1, oh;
|
||||
|
||||
if (!browser) {
|
||||
FL_OBJECT * obj;
|
||||
browser = (FD_LaTeXLog *) fl_calloc(1, sizeof(*browser));
|
||||
|
||||
browser->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
|
||||
browser->LaTeXLog->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
|
||||
browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER,
|
||||
10, 10,
|
||||
450, 320, "");
|
||||
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30,
|
||||
_("Close"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_LyXVC_logClose, 0);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30,
|
||||
idex(_("Update|#Uu")));
|
||||
fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_LyXVC_logUpdate, 0);
|
||||
fl_end_form();
|
||||
fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0);
|
||||
}
|
||||
|
||||
if (!fl_load_browser(browser->browser_latexlog, fil.c_str()))
|
||||
fl_add_browser_line(browser->browser_latexlog,
|
||||
_("No VC History!"));
|
||||
|
||||
if (browser->LaTeXLog->visible) {
|
||||
fl_raise_form(browser->LaTeXLog);
|
||||
} else {
|
||||
fl_show_form(browser->LaTeXLog,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
_("VC History"));
|
||||
if (ow < 0) {
|
||||
ow = browser->LaTeXLog->w;
|
||||
oh = browser->LaTeXLog->h;
|
||||
}
|
||||
fl_set_form_minsize(browser->LaTeXLog, ow, oh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::showLog()
|
||||
{
|
||||
string tmpf = lyx::tempName(string(), "lyxvclog");
|
||||
lyxerr[Debug::LYXVC] << "Generating logfile " << tmpf << endl;
|
||||
vcs->getLog(tmpf);
|
||||
viewLog(tmpf);
|
||||
lyx::unlink(tmpf);
|
||||
return tmpf;
|
||||
}
|
||||
|
16
src/lyxvc.h
16
src/lyxvc.h
@ -8,7 +8,6 @@
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
#include "log_form.h"
|
||||
|
||||
class VCS;
|
||||
class Buffer;
|
||||
@ -69,11 +68,8 @@ public:
|
||||
/// Undo last check-in.
|
||||
void undoLast();
|
||||
|
||||
///
|
||||
void viewLog(string const &);
|
||||
|
||||
///
|
||||
void showLog();
|
||||
/// generate a log file and return the filename
|
||||
const string getLogFile() const;
|
||||
|
||||
///
|
||||
void toggleReadOnly();
|
||||
@ -87,20 +83,12 @@ public:
|
||||
/// Returns the userid of the person who has locked the doc.
|
||||
string const & locker() const;
|
||||
|
||||
///
|
||||
static void logClose(FL_OBJECT *, long);
|
||||
///
|
||||
static void logUpdate(FL_OBJECT *, long);
|
||||
private:
|
||||
///
|
||||
Buffer * owner_;
|
||||
|
||||
///
|
||||
VCS * vcs;
|
||||
|
||||
///
|
||||
FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
|
||||
// close button. Unfortunately we can not use the standard callbacks.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user