Herbert's TeX Info extravaganza.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2850 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-10-09 15:20:10 +00:00
parent e403b5aa24
commit b31ab56c83
34 changed files with 1315 additions and 20 deletions

View File

@ -1,3 +1,8 @@
2001-10-09 Herbert Voss <voss@perce.de>
* default.ui: help-Texinfo
gives an info about the installed texfiles (cls,sty,bst)
2001-10-07 Adrien Rebollo <adrien.rebollo@gmx.fr>
* kbd/iso8859-4.cdef:

118
lib/TeXFiles.sh Executable file
View File

@ -0,0 +1,118 @@
#!/bin/sh
# file: ~/bin/TeXFiles.sh
# all files -> without option
# TeX class files -> option cls
# TeX style files -> option sty
# bibtex style files -> option bst
#
# with the help
# of kpsewhich and creates a
# bstFiles.lst, clsFiles.lst, styFiles.lst
# without any parameter all files are created.
#
# Herbert Voss <voss@perce.org>
#
CLS_STYLEFILE=clsFiles.lst
STY_STYLEFILE=styFiles.lst
BST_STYLEFILE=bstFiles.lst
version='$Id: TeXFiles.sh,v 0.1 2001-10-01'
progname=`echo $0 | sed 's%.*/%%'`
echo "$version"
usage="Usage: TeXFiles.sh [-version | cls | sty | bst]
Default is without any Parameters,
so that all files will be created"
#
# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
# directories in path lists whereas Unixes uses ':'.
# $SEP holds the right character to be used by the scripts.
#
#???????????????
# never used this one with windows and what happens with mac??
#???????????????
#
if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
#
# Add the location of the script to the PATH if necessary. This must
# be done before kpsewhich can be called, and thus cannot be put into
# mktex.opt
#
dirname=`echo $0 | sed 's%/*[^/][^/]*$%%'`
echo "Actual Dir: $dirname"
case $dirname in # $dirname correct?
"") # Do nothing
;;
/* | [A-z]:/*) # / -> Absolute name
PATH="$dirname$SEP$PATH" ;;
*) # other -> Relative name
PATH="`pwd`/$dirname$SEP$PATH" ;;
esac # end of case
#
# A copy of some stuff from mktex.opt, so we can run in the presence of
# terminally damaged ls-R files.
#
if test "x$1" = x--help || test "x$1" = x-help; then
echo "$usage"
exit 0
elif test "x$1" = x--version || test "x$1" = x-version; then
echo "`basename $0` $version"
kpsewhich --version
exit 0
fi
#
# find the directories with kpsewhich. TeX has files ls-R to hold
# the tex-tree
#
test $# = 0 && {
OIFS=$IFS; IFS=$SEP; set x `kpsewhich --show-path=ls-R 2>/dev/null`; shift; IFS=$OIFS
}
echo 'Delete old *files.lst, if present'
case "$1" in
"cls")
rm -f $CLS_STYLEFILE
touch $CLS_STYLEFILE # create new file
;;
"sty")
rm -f $STY_STYLEFILE
touch $STY_STYLEFILE # create new file
;;
"bst")
rm -f $BST_STYLEFILE
touch $BST_STYLEFILE # create new file
;;
*) # all other
rm -f $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
touch $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
;;
esac
echo "looking for all bst-style files in the latex tree";
for TEXMFLSR in "$@"; do # go through the dirs
case "$TEXMFLSR" in # Prepend cwd if the directory was relative.
"") continue ;; # it is an error if this case is taken.
/* | [A-z]:/*) ;; # leading /
*) TEXMFLSR="`pwd`/$TEXMFLS_R" # all other
esac
echo "Dir: <$TEXMFLSR>"
case "$1" in # list all files with suffix bst
"cls")
find $TEXMFLSR -name *.cls >> $CLS_STYLEFILE
;;
"sty")
find $TEXMFLSR -name *.sty >> $STY_STYLEFILE
;;
"bst")
find $TEXMFLSR -name *.bst >> $BST_STYLEFILE
;;
*)
find $TEXMFLSR -name *.cls >> $CLS_STYLEFILE
find $TEXMFLSR -name *.sty >> $STY_STYLEFILE
find $TEXMFLSR -name *.bst >> $BST_STYLEFILE
;;
esac
echo "done!"
done
#echo "list saved in $STYLEFILE"
#echo `wc -l $CLS_STYLEFILE` # only for information
#
# this is the end my friends ... Jim Morrison and the Doors in "The End"

32
lib/help/Bibtex.hlp Normal file
View File

@ -0,0 +1,32 @@
** This file is part of LyX, The Document Processor
** Copyright 2001 The LyX Team. Bibtex.hlp
---------------------------------------------------
Database:
Insert the Bibtex-database without the default extension
".bib". If you insert it with the browser, LyX strips
the extension. More than one databases must be separated
by a comma: natbib, books
Bibstyle:
Insert the Bibstyle without the default extension ".bst".
Most of the bibstyles are stored in $TEXMF/bibtex/bst.
$TEXMF is the root dir of the local TeX-tree.
In difference to the Databases there is only one
Bibstyle possible, for example "plainnat". Insert all
styles without any path!
With the Shell-Script bstFiles.sh you'll get a list of all
available styles on your local TeX-System. It's available
at http://www.perce.de/lyx/bstFiles.sh
Option bibtotoc:
By default the Bibliography doesn't appears in the table
of contents. Activate this option if you want an entry
like
Bibliography ........................17
LyX inserts for the name \refname, so that you get the
right name Bibliography/References, which depends to your
chosen document-class.
2001-08-27 / Herbert Voss <voss@perce.de>

35
lib/help/Texinfo.hlp Normal file
View File

@ -0,0 +1,35 @@
** This file is part of LyX, The Document Processor
** Copyright 2001 The LyX Team. Texinfo.hlp
---------------------------------------------------
Class Files: shows the installed TeX Document classes.
Remember, that these classes are only available
in LyX if a corresponding LyX-Layout file exists!
Style Files: shows the installed TeX Style files, which are
available in LyX by default, like "babel" or through
"\usepackage{<the stylefile>}
in LaTeX-preamble (Layout->preamble)
BibTeX Stylefiles: shows the installed stylefiles for BibTeX.
They can be load through
insert->Lists&Toc->BibTeX Reference->Style
Rescan: Runs the script TexFiles.sh to build new file lists.
Path yes/no: toggles view of the file lists
View: shows the contents of the marked file. Only
possible when the files are shown with path.
Run TeXhash: runs the script texhash which builds the a new LaTeX tree.
Needed if you install a new TeX class or style! It runs only
with user-rights! Therefore you need the right-permissions
for the tex-dirs, often /var/lib/texmf and other.
Help: shows this file
2001-10-01 / Herbert Voss <voss@perce.de>

View File

@ -328,6 +328,8 @@ Menuset
Item "LaTeX Configuration|L" "help-open LaTeXConfig"
Separator
Item "About LyX|X" "help-aboutlyx"
Separator
Item "TeX Infos" "help-Texinfo"
End
End

View File

@ -29,6 +29,7 @@ src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/controllers/biblio.C
src/frontends/controllers/character.C
@ -104,6 +105,7 @@ src/frontends/xforms/FormSearch.C
src/frontends/xforms/FormSpellchecker.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/FormTexinfo.C
src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormUrl.C
@ -140,6 +142,7 @@ src/frontends/xforms/form_search.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/form_texinfo.C
src/frontends/xforms/form_thesaurus.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/form_url.C

View File

@ -1,3 +1,13 @@
2001-10-09 Herbert Voss <voss@perce.de>
* commandtags.h (kb_action): added LFUN_HELP_TEXINFO.
* LyXAction.C (init): added LFUN_HELP_TEXINFO to items array.
* lyx_main.C: added global string help_lyxdir.
* lyxfunc.C (dispatch): added LFUN_HELP_TEXINFO to switch.
2001-10-07 Adrien Rebollo <adrien.rebollo@gmx.fr>
* lyxrc.C (set_font_norm_type): support iso8859-4

View File

@ -421,6 +421,8 @@ void LyXAction::init()
{ LFUN_ESCAPE, "escape", "", Noop },
{ LFUN_HELP_ABOUTLYX, "help-aboutlyx",
N_("Display information about LyX"), NoBuffer },
{ LFUN_HELP_TEXINFO, "help-Texinfo",
N_("Display information about the TeX installation"), NoBuffer },
{ LFUN_NOACTION, "", "", Noop }
};

View File

@ -294,6 +294,7 @@ enum kb_action {
LFUN_ESCAPE, // 260 // Lgb 20010517
LFUN_HELP_ABOUTLYX, // Edwin 20010712
LFUN_THESAURUS_ENTRY, // Levon 20010720
LFUN_HELP_TEXINFO, // Herbert 20011001
LFUN_LASTACTION /* this marks the end of the table */
};

View File

@ -1,3 +1,7 @@
2001-10-09 Herbert Voss <voss@perce.de>
* Dialogs.h: added showFile and showTexinfo signals.
2001-09-27 Angus Leeming <a.leeming@ic.ac.uk>
* Dialogs.h (showSplash, destroySplash, splash_): removed.

View File

@ -107,6 +107,8 @@ public:
SigC::Signal1<void, InsetError *> showError;
/// show the external inset dialog
SigC::Signal1<void, InsetExternal *> showExternal;
/// show the contents of a file.
SigC::Signal1<void, string const &> showFile;
///
SigC::Signal1<void, InsetGraphics *> showGraphics;
/// show the details of a LyX file include inset
@ -157,6 +159,8 @@ public:
SigC::Signal1<void, InsetTabular *> updateTabular;
///
SigC::Signal0<void> showTabularCreate;
/// show the TexInfo
SigC::Signal0<void> showTexinfo;
/// show the thesaurus dialog
SigC::Signal1<void, string const &> showThesaurus;
///

View File

@ -1,3 +1,18 @@
2001-10-09 Angus Leeming <a.leeming@ic.ac.uk>
* ControlSpellchecker.C: commented out redundant includes.
2001-10-09 Herbert Voss <voss@perce.de>
* ControlTexinfo.[Ch]: new files. Display information about the
installed texfiles (cls,sty,bst).
* ControlShowFile.[Ch]: new files. Display the contents of a file.
* GUI.h: added classes GUIShowFile and GUITexinfo.
* Makefile.am: modified appropriately.
2001-10-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* ControlAboutlyx.C (getVersion): use lyx_version and

View File

@ -13,7 +13,7 @@
*
* ControlDialog is to be used as a parent class for dialogs that are not
* views onto parameters of insets. (An ugly description I know, but I hope
* the meaning is clear! * Can anyone do any better?) Examples would be the
* the meaning is clear! Can anyone do any better?) Examples would be the
* Document and Paragraph dialogs.
*/

View File

@ -0,0 +1,45 @@
/**
* \file ControlShowFile.C
* Copyright 2001 The LyX Team.
* See the file COPYING.
*
* \author Herbert Voss <voss@perce.de>
*/
#include <config.h>
#include <fstream>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlShowFile.h"
#include "Dialogs.h"
#include "LyXView.h"
#include "BufferView.h"
#include "gettext.h"
#include "support/filetools.h" // FileSearch
ControlShowFile::ControlShowFile(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBI>(lv, d)
{
d_.showFile.connect(SigC::slot(this, &ControlShowFile::showFile));
}
void ControlShowFile::showFile(string const & file)
{
filename_ = file;
show();
}
string ControlShowFile::getFileContents()
{
return GetFileContents(filename_);
}
string ControlShowFile::getFileName()
{
return OnlyFilename(filename_);
}

View File

@ -0,0 +1,38 @@
// -*- C++ -*-
/**
* Copyright 2001 The LyX Team.
* See the file COPYING.
*
* \file ControlShowFile.h
* \author Herbert Voss <voss@perce.de>
*/
#ifndef CONTROLSHOWFILE_H
#define CONTROLSHOWFILE_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlDialogs.h"
/** A controller for the ShowFile dialog. */
class ControlShowFile : public ControlDialog<ControlConnectBI> {
public:
///
ControlShowFile(LyXView &, Dialogs &);
///
virtual void showFile(string const &);
///
string getFileContents();
///
string getFileName();
private:
/// not needed.
virtual void apply() {}
///
string filename_;
};
#endif // CONTROLSHOWFILE_H

View File

@ -17,18 +17,17 @@
#pragma implementation
#endif
#include FORMS_H_LOCATION
#ifdef HAVE_SYS_SELECT_H
# ifdef HAVE_STRINGS_H
// <strings.h> is needed at least on AIX because FD_ZERO uses bzero().
// BUT we cannot include both string.h and strings.h on Irix 6.5 :(
# ifdef _AIX
# include <strings.h>
# endif
# endif
#include <sys/select.h>
#endif
// I think that this is no longer needed (Angus 9 October, 2001).
//#ifdef HAVE_SYS_SELECT_H
//# ifdef HAVE_STRINGS_H
// // <strings.h> is needed at least on AIX because FD_ZERO uses bzero().
// // BUT we cannot include both string.h and strings.h on Irix 6.5 :(
//# ifdef _AIX
//# include <strings.h>
//# endif
//# endif
//#include <sys/select.h>
//#endif
#include "buffer.h"
#include "lyxrc.h"

View File

@ -0,0 +1,79 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
*
* ======================================================
*
* \file ControlTexinfo.C
* \author Herbert Voss <voss@lyx.org>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlTexinfo.h"
#include "Dialogs.h"
#include "LyXView.h"
#include "Lsstream.h"
#include "BufferView.h"
#include "gettext.h"
#include "support/filetools.h" // FileSearch
#include "version.h"
#include "support/syscall.h"
#include "support/path.h"
#include "lyx_gui_misc.h"
extern string system_lyxdir;
extern string user_lyxdir;
extern string help_lyxdir;
using SigC::slot;
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBI>(lv, d)
{
d_.showTexinfo.connect(SigC::slot(this, &ControlTexinfo::show));
}
// build filelists of all availabe bst/cls/sty-files. done through
// kpsewhich and an external script, saved in *Files.lst
void ControlTexinfo::rescanStyles()
{
// Run rescan in user lyx directory
Path p(user_lyxdir);
Systemcalls one(Systemcalls::System,
AddName(system_lyxdir,"TeXFiles.sh"));
p.pop();
}
void ControlTexinfo::runTexhash()
{
// Run texhash in user lyx directory
Path p(user_lyxdir);
//path to texhash through system
Systemcalls one(Systemcalls::System,"texhash");
p.pop();
// WriteAlert(_("texhash run!"),
// _("rebuilding of the TeX-tree could only be successfull"),
// _("if you have had user-write-permissions to the tex-dir."));
}
void ControlTexinfo::viewFile(string const filename)
{
lv_.getDialogs()->showFile(filename);
}
void ControlTexinfo::help()
{
lv_.getDialogs()->showFile(help_lyxdir+"Texinfo.hlp");
}

View File

@ -0,0 +1,44 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
*
* ======================================================
*
* \file ControlTexinfo.h
* \author Herbert Voss <voss@perce.de>
*/
#ifndef CONTROLTEXINFO_H
#define CONTROLTEXINFO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlDialogs.h"
/** A controller for Texinfo dialogs. */
class ControlTexinfo : public ControlDialog<ControlConnectBI> {
public:
///
ControlTexinfo(LyXView &, Dialogs &);
///
void viewFile(string const filename);
///
void help();
///
void rescanStyles();
///
void runTexhash();
private:
///
virtual void apply() {}
};
#endif // CONTROLTEXINFO_H

View File

@ -289,6 +289,19 @@ public:
: GUI<ControlSearch, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for ShowFile dialog
*/
class ControlShowFile;
template <class GUIview, class GUIbc>
class GUIShowFile :
public GUI<ControlShowFile, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIShowFile(LyXView & lv, Dialogs & d)
: GUI<ControlShowFile, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Spellchecker dialog
*/
class ControlSpellchecker;
@ -332,6 +345,19 @@ public:
};
/** Specialization for Texinfo dialog
*/
class ControlTexinfo;
template <class GUIview, class GUIbc>
class GUITexinfo :
public GUI<ControlTexinfo, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUITexinfo(LyXView & lv, Dialogs & d)
: GUI<ControlTexinfo, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Thesaurus dialog
*/
class ControlThesaurus;

View File

@ -62,10 +62,14 @@ libcontrollers_la_SOURCES=\
ControlRef.h \
ControlSearch.C \
ControlSearch.h \
ControlShowFile.C \
ControlShowFile.h \
ControlSpellchecker.C \
ControlSpellchecker.h \
ControlTabularCreate.C \
ControlTabularCreate.h \
ControlTexinfo.C \
ControlTexinfo.h \
ControlThesaurus.C \
ControlThesaurus.h \
ControlToc.C \

View File

@ -1,3 +1,14 @@
2001-10-09 Herbert Voss <voss@perce.de>
* FormTexinfo.[Ch]:
* forms/form_texinfo.fd: new files. Display information about the
installed texfiles (cls,sty,bst).
* FormShowFile.[Ch]: new files. Display the contents of a file.
* Dialog.C:
* Makefile.am: modified appropriately.
2001-10-09 Angus Leeming <a.leeming@ic.ac.uk>
* xforms_helpers.[Ch] (getLengthFromWidgets): new function.

View File

@ -39,8 +39,10 @@
#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlShowFile.h"
#include "ControlSpellchecker.h"
#include "ControlTabularCreate.h"
#include "ControlTexinfo.h"
#include "ControlThesaurus.h"
#include "ControlToc.h"
#include "ControlUrl.h"
@ -69,6 +71,7 @@
#include "form_search.h"
#include "form_spellchecker.h"
#include "form_tabular_create.h"
#include "form_texinfo.h"
#include "form_thesaurus.h"
#include "form_toc.h"
#include "form_url.h"
@ -91,8 +94,10 @@
#include "FormPrint.h"
#include "FormRef.h"
#include "FormSearch.h"
#include "FormShowFile.h"
#include "FormSpellchecker.h"
#include "FormTabularCreate.h"
#include "FormTexinfo.h"
#include "FormThesaurus.h"
#include "FormToc.h"
#include "FormUrl.h"
@ -128,11 +133,13 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIPrint<FormPrint, xformsBC>(*lv, *this));
add(new GUIRef<FormRef, xformsBC>(*lv, *this));
add(new GUISearch<FormSearch, xformsBC>(*lv, *this));
add(new GUIShowFile<FormShowFile, xformsBC>(*lv, *this));
add(new GUISpellchecker<FormSpellchecker, xformsBC>(*lv, *this));
add(new GUITabularCreate<FormTabularCreate, xformsBC>(*lv, *this));
#ifdef HAVE_LIBAIKSAURUS
add(new GUIThesaurus<FormThesaurus, xformsBC>(*lv, *this));
#endif
add(new GUITexinfo<FormTexinfo, xformsBC>(*lv, *this));
add(new GUIToc<FormToc, xformsBC>(*lv, *this));
add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));

View File

@ -0,0 +1,36 @@
/* FormHelp.C
* (C) 2001 LyX Team
* \author Herbert Voss <voss@perce.de>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "xformsBC.h"
#include "ControlShowFile.h"
#include "FormShowFile.h"
#include "form_browser.h"
#include "gettext.h"
FormShowFile::FormShowFile(ControlShowFile & c)
: FormCB<ControlShowFile, FormBrowser>(c, string())
{}
void FormShowFile::update()
{
fl_clear_browser(dialog_->browser);
// courier medium
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
fl_set_form_title(dialog_->form, controller().getFileName().c_str());
string const contents = controller().getFileContents();
if (contents.empty())
fl_add_browser_line(dialog_->browser,
"Error -> Cannot load file!");
else
fl_add_browser_line(dialog_->browser, contents.c_str());
}

View File

@ -0,0 +1,38 @@
// -*- C++ -*-
/*
* FormShowFile.h
*
* (C) 2001 LyX Team
* \author Herbert Voss <voss@perce.de>
*/
#ifndef FORMSHOWFILE_H
#define FORMSHOWFILE_H
#ifdef __GNUG__
#pragma interface
#endif
#include "FormBrowser.h"
class ControlShowFile;
/**
* This class provides an XForms implementation of a dialog to browse through a
* Help file.
*/
class FormShowFile : public FormCB<ControlShowFile, FormBrowser> {
public:
///
FormShowFile(ControlShowFile &);
// Functions accessible to the Controller.
/// Set the Params variable for the Controller.
virtual void apply() {}
/// Update dialog before/whilst showing it.
virtual void update();
};
#endif // FORMSHOWFILE_H

View File

@ -0,0 +1,250 @@
/**
* \file FormTexinfo.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author Herbert Voss <voss@lyx.org>
* \date 2001-10-01
*/
#include <config.h>
#include <fstream>
#ifdef __GNUG__
#pragma implementation
#endif
#include "xformsBC.h"
#include "ControlTexinfo.h"
#include "FormTexinfo.h"
#include "form_texinfo.h"
#include "gettext.h"
#include "debug.h"
#include "helper_funcs.h"
#include "xforms_helpers.h"
#include "support/lstrings.h"
#include "support/filetools.h"
#include "support/LAssert.h"
extern string user_lyxdir; // home of *Files.lst
namespace {
string const bstFilename("bstFiles.lst");
string const clsFilename("clsFiles.lst");
string const styFilename("styFiles.lst");
string const errorMessage =_("Missing filelist. try Rescan");
// C function wrapper, required by xforms.
extern "C"
int C_FormTexinfoFeedbackCB(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord, int, void *)
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
lyx::Assert(ob);
// Don't Assert this one, as it can happen quite reasonably when things
// are being deleted in the d-tor.
//Assert(ob->form);
if (!ob->form) return 0;
FormTexinfo * pre =
static_cast<FormTexinfo*>(ob->form->u_vdata);
pre->feedbackCB(ob, event);
return 0;
}
void setPreHandler(FL_OBJECT * ob)
{
lyx::Assert(ob);
fl_set_object_prehandler(ob, C_FormTexinfoFeedbackCB);
}
} // namespace anon
typedef FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > base_class;
FormTexinfo::FormTexinfo(ControlTexinfo & c)
: base_class(c, _("TeX Infos")),
warningPosted(false), activeStyle(FormTexinfo::cls)
{}
void FormTexinfo::build() {
dialog_.reset(build_texinfo());
// courier medium
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
// with Path is default
fl_set_button(dialog_->button_fullPath, 1);
updateStyles(FormTexinfo::cls);
setPreHandler(dialog_->button_rescan);
setPreHandler(dialog_->button_view);
setPreHandler(dialog_->button_texhash);
setPreHandler(dialog_->button_fullPath);
setPreHandler(dialog_->browser);
setPreHandler(dialog_->radio_cls);
setPreHandler(dialog_->radio_sty);
setPreHandler(dialog_->radio_bst);
setPreHandler(dialog_->message);
setPreHandler(dialog_->help);
}
ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
if (ob == dialog_->help) {
controller().help();
} else if (ob == dialog_->radio_cls) {
updateStyles(FormTexinfo::cls);
} else if (ob == dialog_->radio_sty) {
updateStyles(FormTexinfo::sty);
} else if (ob == dialog_->radio_bst) {
updateStyles(FormTexinfo::bst);
} else if (ob == dialog_->button_rescan) {
// build new *Files.lst
controller().rescanStyles();
updateStyles(activeStyle);
} else if (ob == dialog_->button_fullPath) {
setEnabled(dialog_->button_view,
fl_get_button(dialog_->button_fullPath));
updateStyles(activeStyle);
} else if (ob == dialog_->button_texhash) {
// makes only sense if the rights are set well for
// users (/var/lib/texmf/ls-R)
controller().runTexhash();
// update files in fact of texhash
controller().rescanStyles();
} else if (ob == dialog_->button_view) {
unsigned int selection = fl_get_browser(dialog_->browser);
// a valid entry?
if (selection > 0) {
controller().viewFile(
fl_get_browser_line(dialog_->browser,
selection));
}
}
return ButtonPolicy::SMI_VALID;
}
namespace {
string const sortEntries(string & str_in)
{
std::vector<string> dbase = getVectorFromString(str_in,"\n");
std::sort(dbase.begin(), dbase.end()); // sort entries
return getStringFromVector(dbase,"\n");
}
string const getContents(string const filename, bool withFullPath)
{
string fileContents = GetFileContents(AddName(user_lyxdir,filename));
// everything ok?
if (!fileContents.empty()) {
if (withFullPath)
return(sortEntries(fileContents));
else {
int Entries = 1;
string dummy = OnlyFilename(token(fileContents,'\n',1));
string contents = dummy;
do {
dummy = OnlyFilename(token(fileContents,'\n',++Entries));
contents += ("\n"+dummy);
} while (!dummy.empty());
return(sortEntries(contents));
}
} else
return errorMessage;
}
} // namespace anon
void FormTexinfo::updateStyles(FormTexinfo::texFileSuffix whichStyle)
{
fl_clear_browser(dialog_->browser);
bool const withFullPath = fl_get_button(dialog_->button_fullPath);
switch (whichStyle) {
case FormTexinfo::bst:
{
string const str = getContents(bstFilename, withFullPath);
fl_add_browser_line(dialog_->browser, str.c_str());
break;
}
case FormTexinfo::cls:
{
string const str = getContents(clsFilename, withFullPath);
fl_add_browser_line(dialog_->browser, str.c_str());
break;
}
case FormTexinfo::sty:
{
string const str = getContents(styFilename, withFullPath);
fl_add_browser_line(dialog_->browser, str.c_str());
break;
}
}
activeStyle = whichStyle;
}
// preemptive handler for feedback messages
void FormTexinfo::feedbackCB(FL_OBJECT * ob, int event)
{
lyx::Assert(ob);
switch (event) {
case FL_ENTER:
warningPosted = false;
feedback(ob);
break;
case FL_LEAVE:
if (!warningPosted) {
fl_set_object_label(dialog_->message, "");
fl_redraw_object(dialog_->message);
}
break;
default:
break;
}
}
void FormTexinfo::feedback(FL_OBJECT * ob)
{
lyx::Assert(ob);
string str;
if (ob == dialog_->button_rescan) {
str = _("run rescan ...");
} else if (ob == dialog_->button_fullPath) {
str = _("View full path or only file name");
} else if (ob == dialog_->button_texhash) {
str = _("run texhash and rescan...");
} else if (ob == dialog_->button_view) {
str = _("select a file to view");
}
fl_set_object_label(dialog_->message, str.c_str());
fl_redraw_object(dialog_->message);
}

View File

@ -0,0 +1,53 @@
// -*- C++ -*-
/**
* \file FormTexinfo.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author Herbert Voss <voss@perce.de>
*/
#ifndef FORMTEXINFO_H
#define FORMTEXINFO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "FormBase.h"
class ControlTexinfo;
struct FD_form_texinfo;
class FormTexinfo : public FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > {
public:
///
FormTexinfo(ControlTexinfo &);
/// the file extensions
enum texFileSuffix {cls, sty, bst};
/// preemptive handler for feedback messages
void feedbackCB(FL_OBJECT *, int);
private:
/// not needed
virtual void apply() {}
/// Build the dialog.
virtual void build();
/// not needed
virtual void update() {}
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
///
void feedback(FL_OBJECT *);
///
void updateStyles(texFileSuffix);
/// Fdesign generated method
FD_form_texinfo * build_texinfo();
///
bool warningPosted;
///
texFileSuffix activeStyle;
};
#endif // FORMTEXINFO_H

View File

@ -140,6 +140,8 @@ libxforms_la_SOURCES = \
FormSearch.h \
form_search.C \
form_search.h \
FormShowFile.C \
FormShowFile.h \
FormSpellchecker.C \
FormSpellchecker.h \
form_spellchecker.C \
@ -152,6 +154,10 @@ libxforms_la_SOURCES = \
FormTabularCreate.h \
form_tabular_create.C \
form_tabular_create.h \
FormTexinfo.C \
FormTexinfo.h \
form_texinfo.C \
form_texinfo.h \
FormThesaurus.C \
FormThesaurus.h \
form_thesaurus.C \

View File

@ -0,0 +1,124 @@
// 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_texinfo.h"
#include "FormTexinfo.h"
FD_form_texinfo::~FD_form_texinfo()
{
if ( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_texinfo * FormTexinfo::build_texinfo()
{
FL_OBJECT *obj;
FD_form_texinfo *fdui = new FD_form_texinfo;
fdui->form = fl_bgn_form(FL_NO_BOX, 513, 394);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 513, 394, "");
fl_set_object_lstyle(obj, FL_FIXED_STYLE);
fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 15, 12, 324, 290, "");
fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_lstyle(obj, FL_FIXED_STYLE);
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 345, 15, 155, 100, "");
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
{
char const * const dummy = N_("LaTeX Classes|#C");
fdui->radio_cls = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 350, 20, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
{
char const * const dummy = N_("LaTeX Styles|#S");
fdui->radio_sty = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 350, 50, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("BibTeX Styles|#B");
fdui->radio_bst = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 350, 80, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 345, 122, 155, 128, "");
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
{
char const * const dummy = N_("Rescan|#R");
fdui->button_rescan = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 138, 135, 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_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 2);
{
char const * const dummy = N_("View|#V");
fdui->button_view = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 173, 135, 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_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 2);
{
char const * const dummy = N_("Show Path|#P");
fdui->button_fullPath = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 350, 209, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 2);
fdui->message = obj = fl_add_text(FL_NORMAL_TEXT, 15, 313, 481, 31, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
fdui->help = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 353, 90, 30, _("Help"));
fl_set_button_shortcut(obj, _("H"), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Run Texhash|#T");
fdui->button_texhash = obj = fl_add_button(FL_NORMAL_BUTTON, 188, 353, 135, 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_SouthWest, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Close|^[^M");
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 410, 353, 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_FormBaseCancelCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
return fdui;
}
/*---------------------------------------*/

View File

@ -0,0 +1,30 @@
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
/** Header file generated with fdesign **/
#ifndef FD_form_texinfo_h_
#define FD_form_texinfo_h_
/** Callbacks, globals and object handlers **/
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
struct FD_form_texinfo {
~FD_form_texinfo();
FL_FORM *form;
FL_OBJECT *browser;
FL_OBJECT *radio_cls;
FL_OBJECT *radio_sty;
FL_OBJECT *radio_bst;
FL_OBJECT *button_rescan;
FL_OBJECT *button_view;
FL_OBJECT *button_fullPath;
FL_OBJECT *message;
FL_OBJECT *help;
FL_OBJECT *button_texhash;
FL_OBJECT *button_close;
};
#endif /* FD_form_texinfo_h_ */

View File

@ -0,0 +1,270 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
SnapGrid: 1
=============== FORM ===============
Name: form_texinfo
Width: 513
Height: 394
Number of Objects: 14
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 513 394
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_FIXED_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 15 12 324 290
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP
style: FL_FIXED_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthWest FL_SouthEast
name: browser
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 345 15 155 100
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name:
callback:
argument:
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 350 20 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: LaTeX Classes|#C
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: radio_cls
callback: C_FormBaseInputCB
argument: 0
value: 1
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 350 50 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: LaTeX Styles|#S
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: radio_sty
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 350 80 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: BibTeX Styles|#B
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: radio_bst
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 345 122 155 128
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthEast FL_NorthEast
name:
callback:
argument:
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 355 138 135 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Rescan|#R
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: button_rescan
callback: C_FormBaseInputCB
argument: 2
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 355 173 135 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: View|#V
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: button_view
callback: C_FormBaseInputCB
argument: 2
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 350 209 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Show Path|#P
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
name: button_fullPath
callback: C_FormBaseInputCB
argument: 2
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 15 313 481 31
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast
name: message
callback:
argument:
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 353 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Help
shortcut: H
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthWest
name: help
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 188 353 135 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Run Texhash|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast
name: button_texhash
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 410 353 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Close|^[^M
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
callback: C_FormBaseCancelCB
argument: 0
==============================
create_the_form

View File

@ -48,6 +48,7 @@ SRCS = form_aboutlyx.fd \
form_spellchecker.fd \
form_tabular.fd \
form_tabular_create.fd \
form_texinfo.fd \
form_thesaurus.fd \
form_toc.fd \
form_url.fd

View File

@ -75,15 +75,13 @@ string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
lyx::Assert(input && input->objclass == FL_INPUT &&
choice && choice->objclass == FL_CHOICE);
string length;
string len = strip(frontStrip(fl_get_input(input)));
if (len.empty())
len = "0";
string length = strip(frontStrip(fl_get_input(input)));
if (length.empty())
length = "0";
string const units = strip(frontStrip(fl_get_choice_text(choice)));
return len + units;
return length + units;
}

View File

@ -57,6 +57,7 @@ string system_lyxdir;
string build_lyxdir;
string system_tempdir;
string user_lyxdir; // Default $HOME/.lyx
string help_lyxdir; // Default system_lyxdir/help
// Should this be kept global? Asger says Yes.
DebugStream lyxerr;
@ -374,7 +375,7 @@ void LyX::init(bool gui)
system_lyxdir = LYX_DIR;
path_shown = true;
}
help_lyxdir = system_lyxdir+"help/";
// Report the system directory if debugging is on
if (!path_shown)
lyxerr[Debug::INIT] << "System directory: '"

View File

@ -1202,6 +1202,10 @@ string const LyXFunc::dispatch(int ac,
owner->getDialogs()->showAboutlyx();
break;
case LFUN_HELP_TEXINFO:
owner->getDialogs()->showTexinfo();
break;
case LFUN_HELP_OPEN:
{
string const arg = argument;