Clean-up of Herbert's Texinfo dialog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2859 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-10-10 16:45:05 +00:00
parent fbbf8bded3
commit ba61c3aa4c
16 changed files with 140 additions and 129 deletions

View File

@ -1,3 +1,7 @@
2001-10-10 Herbert Voss <voss@perce.de>
* scripts/TeXFiles.sh: new script for [cls,sty,bst]Files.lst
2001-10-09 Herbert Voss <voss@perce.de> 2001-10-09 Herbert Voss <voss@perce.de>
* default.ui: help-Texinfo * default.ui: help-Texinfo

View File

@ -13,6 +13,7 @@ CLIPART = clipart/*.eps
DOCDIST = doc/LyXConfig.lyx* DOCDIST = doc/LyXConfig.lyx*
DOCINST = doc/*.lyx doc/*.eps doc/*.lyx.in DOCINST = doc/*.lyx doc/*.eps doc/*.lyx.in
EXAMPLES = examples/*.lyx EXAMPLES = examples/*.lyx
HELP = help/*.hlp
IMAGES = images/*.xpm IMAGES = images/*.xpm
KBD = kbd/*.kmap kbd/*.cdef KBD = kbd/*.kmap kbd/*.cdef
LAYOUT = layouts/*.layout layouts/*.inc LAYOUT = layouts/*.layout layouts/*.inc
@ -25,17 +26,17 @@ configure: configure.m4
$(M4) $< > $@ $(M4) $< > $@
$(CHMOD) 755 $@ $(CHMOD) 755 $@
LIBINSTFILES = $(BIND) $(CLIPART) $(DOCINST) $(EXAMPLES) $(IMAGES) $(KBD) \ LIBINSTFILES = $(BIND) $(CLIPART) $(DOCINST) $(EXAMPLES) $(HELP) $(IMAGES) \
$(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(UI) $(KBD) $(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(UI)
LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(IMAGES) $(KBD) \ LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(HELP) $(IMAGES) \
$(LAYOUT) $(TEMPL) $(UI) $(TEXSUPPORT) $(LYXSCRIPTS) $(KBD) $(LAYOUT) $(TEMPL) $(UI) $(TEXSUPPORT) $(LYXSCRIPTS)
pkgdata_DATA = lyxrc.example CREDITS chkconfig.ltx lyxrc.defaults \ pkgdata_DATA = lyxrc.example CREDITS chkconfig.ltx lyxrc.defaults \
textclass.lst packages.lst external_templates \ textclass.lst packages.lst external_templates \
encodings languages symbols encodings languages symbols
LYXLIBDIRS = bind clipart doc examples images kbd layouts scripts \ LYXLIBDIRS = bind clipart doc examples help images kbd layouts scripts \
templates tex ui templates tex ui
EXTRA_DIST = CREDITS chkconfig.ltx configure.cmd lyxrc.example \ EXTRA_DIST = CREDITS chkconfig.ltx configure.cmd lyxrc.example \

2
lib/configure vendored
View File

@ -80,7 +80,7 @@ if test "x$OSTYPE" = xcygwin; then
fi fi
#### Create the build directories if necessary #### Create the build directories if necessary
for dir in bind clipart doc examples images kbd layouts reLyX \ for dir in bind clipart doc examples help images kbd layouts reLyX \
scripts templates ui ; do scripts templates ui ; do
test ! -d $dir && mkdir $dir test ! -d $dir && mkdir $dir
done done

View File

@ -156,7 +156,7 @@ if test "x$OSTYPE" = xcygwin; then
fi fi
#### Create the build directories if necessary #### Create the build directories if necessary
for dir in bind clipart doc examples images kbd layouts reLyX \ for dir in bind clipart doc examples help images kbd layouts reLyX \
scripts templates ui ; do scripts templates ui ; do
test ! -d $dir && mkdir $dir test ! -d $dir && mkdir $dir
done done

View File

@ -1,14 +1,12 @@
** This file is part of LyX, The Document Processor Bibtex.hlp
** Copyright 2001 The LyX Team. Bibtex.hlp
---------------------------------------------------
Database: @bDatabase:
Insert the Bibtex-database without the default extension Insert the Bibtex-database without the default extension
".bib". If you insert it with the browser, LyX strips ".bib". If you insert it with the browser, LyX strips
the extension. More than one databases must be separated the extension. More than one databases must be separated
by a comma: natbib, books by a comma: natbib, books
Bibstyle: @bBibstyle:
Insert the Bibstyle without the default extension ".bst". Insert the Bibstyle without the default extension ".bst".
Most of the bibstyles are stored in $TEXMF/bibtex/bst. Most of the bibstyles are stored in $TEXMF/bibtex/bst.
$TEXMF is the root dir of the local TeX-tree. $TEXMF is the root dir of the local TeX-tree.
@ -19,7 +17,7 @@ Bibstyle:
available styles on your local TeX-System. It's available available styles on your local TeX-System. It's available
at http://www.perce.de/lyx/bstFiles.sh at http://www.perce.de/lyx/bstFiles.sh
Option bibtotoc: @bOption bibtotoc:
By default the Bibliography doesn't appears in the table By default the Bibliography doesn't appears in the table
of contents. Activate this option if you want an entry of contents. Activate this option if you want an entry
like like

View File

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

View File

@ -2,6 +2,10 @@
* lyxfunc.C: removed greek_kb_flag. * lyxfunc.C: removed greek_kb_flag.
2001-10-10 Herbert Voss <voss@perce.de>
* lyx_main.C: delete global string help_lyxdir.
2001-10-09 Herbert Voss <voss@perce.de> 2001-10-09 Herbert Voss <voss@perce.de>
* commandtags.h (kb_action): added LFUN_HELP_TEXINFO. * commandtags.h (kb_action): added LFUN_HELP_TEXINFO.

View File

@ -1,3 +1,10 @@
2001-10-10 Herbert Voss <voss@perce.de>
* ControlTexinfo.C: new path for the shellscript TeXFiles.sh
and some more stuff from FormTexinfo.C
* ControlShowFile.C: hiding the update-button
2001-10-09 Herbert Voss <voss@perce.de> 2001-10-09 Herbert Voss <voss@perce.de>
* ControlTexinfo.[Ch]: new files. Display information about the * ControlTexinfo.[Ch]: new files. Display information about the

View File

@ -22,20 +22,15 @@
#include "ControlTexinfo.h" #include "ControlTexinfo.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "LyXView.h" #include "LyXView.h"
#include "Lsstream.h"
#include "BufferView.h" #include "BufferView.h"
#include "gettext.h" #include "gettext.h"
#include "support/filetools.h" // FileSearch #include "support/filetools.h" // FileSearch
#include "version.h"
#include "support/syscall.h" #include "support/syscall.h"
#include "support/path.h" #include "support/path.h"
#include "lyx_gui_misc.h" #include "helper_funcs.h"
#include "support/lstrings.h"
extern string system_lyxdir; extern string user_lyxdir; // home of *Files.lst
extern string user_lyxdir;
extern string help_lyxdir;
using SigC::slot;
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d) ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBI>(lv, d) : ControlDialog<ControlConnectBI>(lv, d)
@ -45,16 +40,17 @@ ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
// build filelists of all availabe bst/cls/sty-files. done through // build filelists of all availabe bst/cls/sty-files. done through
// kpsewhich and an external script, saved in *Files.lst // kpsewhich and an external script, saved in *Files.lst
void ControlTexinfo::rescanStyles() void ControlTexinfo::rescanStyles() const
{ {
// Run rescan in user lyx directory // Run rescan in user lyx directory
Path p(user_lyxdir); Path p(user_lyxdir);
Systemcalls one(Systemcalls::System, Systemcalls one(Systemcalls::System,
AddName(system_lyxdir,"TeXFiles.sh")); LibFileSearch("scripts", "TeXFiles.sh"));
p.pop(); p.pop();
} }
void ControlTexinfo::runTexhash()
void ControlTexinfo::runTexhash() const
{ {
// Run texhash in user lyx directory // Run texhash in user lyx directory
Path p(user_lyxdir); Path p(user_lyxdir);
@ -68,12 +64,64 @@ void ControlTexinfo::runTexhash()
} }
void ControlTexinfo::viewFile(string const filename) 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");
}
} //namespace anon
string const
ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const
{
static string const bstFilename("bstFiles.lst");
static string const clsFilename("clsFiles.lst");
static string const styFilename("styFiles.lst");
string filename;
switch (type) {
case bst:
filename = bstFilename;
break;
case cls:
filename = clsFilename;
break;
case sty:
filename = clsFilename;
break;
}
string fileContents = GetFileContents(LibFileSearch(string(),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 _("Missing filelist. try Rescan");
}
void ControlTexinfo::viewFile(string const filename) const
{ {
lv_.getDialogs()->showFile(filename); lv_.getDialogs()->showFile(filename);
} }
void ControlTexinfo::help()
void ControlTexinfo::help() const
{ {
lv_.getDialogs()->showFile(help_lyxdir+"Texinfo.hlp"); lv_.getDialogs()->showFile(i18nLibFileSearch("help","Texinfo.hlp"));
} }

View File

@ -25,16 +25,21 @@
class ControlTexinfo : public ControlDialog<ControlConnectBI> { class ControlTexinfo : public ControlDialog<ControlConnectBI> {
public: public:
/// the file extensions
enum texFileSuffix {cls, sty, bst};
/// ///
ControlTexinfo(LyXView &, Dialogs &); ControlTexinfo(LyXView &, Dialogs &);
/// ///
void viewFile(string const filename); void viewFile(string const filename) const;
/// ///
void help(); void help() const;
/// ///
void rescanStyles(); void rescanStyles() const;
/// ///
void runTexhash(); void runTexhash() const;
///
string const getContents(texFileSuffix type, bool withPath) const;
private: private:
/// ///

View File

@ -1,3 +1,7 @@
2001-10-10 Herbert Voss <voss@perce.de>
* FormTexinfo.[Ch]: some changes to the code
2001-10-10 André Pönitz <poenitz@htwm.de> 2001-10-10 André Pönitz <poenitz@htwm.de>
* FormsMathMatrix.C: add missing space between v- and h-alignment * FormsMathMatrix.C: add missing space between v- and h-alignment

View File

@ -22,6 +22,7 @@ FormShowFile::FormShowFile(ControlShowFile & c)
void FormShowFile::update() void FormShowFile::update()
{ {
fl_hide_object(dialog_->button_update);
fl_clear_browser(dialog_->browser); fl_clear_browser(dialog_->browser);
// courier medium // courier medium
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE); fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);

View File

@ -15,26 +15,15 @@
#endif #endif
#include "xformsBC.h" #include "xformsBC.h"
#include "ControlTexinfo.h"
#include "FormTexinfo.h" #include "FormTexinfo.h"
#include "form_texinfo.h" #include "form_texinfo.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "helper_funcs.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#include "support/lstrings.h"
#include "support/filetools.h"
#include "support/LAssert.h" #include "support/LAssert.h"
extern string user_lyxdir; // home of *Files.lst
namespace { 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. // C function wrapper, required by xforms.
extern "C" extern "C"
int C_FormTexinfoFeedbackCB(FL_OBJECT * ob, int event, int C_FormTexinfoFeedbackCB(FL_OBJECT * ob, int event,
@ -67,7 +56,7 @@ void setPreHandler(FL_OBJECT * ob)
typedef FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > base_class; typedef FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > base_class;
FormTexinfo::FormTexinfo(ControlTexinfo & c) FormTexinfo::FormTexinfo(ControlTexinfo & c)
: base_class(c, _("TeX Infos")), : base_class(c, _("TeX Infos")),
warningPosted(false), activeStyle(FormTexinfo::cls) warningPosted(false), activeStyle(ControlTexinfo::cls)
{} {}
@ -77,7 +66,7 @@ void FormTexinfo::build() {
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE); fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
// with Path is default // with Path is default
fl_set_button(dialog_->button_fullPath, 1); fl_set_button(dialog_->button_fullPath, 1);
updateStyles(FormTexinfo::cls); updateStyles(ControlTexinfo::cls);
setPreHandler(dialog_->button_rescan); setPreHandler(dialog_->button_rescan);
setPreHandler(dialog_->button_view); setPreHandler(dialog_->button_view);
@ -97,13 +86,13 @@ ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
controller().help(); controller().help();
} else if (ob == dialog_->radio_cls) { } else if (ob == dialog_->radio_cls) {
updateStyles(FormTexinfo::cls); updateStyles(ControlTexinfo::cls);
} else if (ob == dialog_->radio_sty) { } else if (ob == dialog_->radio_sty) {
updateStyles(FormTexinfo::sty); updateStyles(ControlTexinfo::sty);
} else if (ob == dialog_->radio_bst) { } else if (ob == dialog_->radio_bst) {
updateStyles(FormTexinfo::bst); updateStyles(ControlTexinfo::bst);
} else if (ob == dialog_->button_rescan) { } else if (ob == dialog_->button_rescan) {
// build new *Files.lst // build new *Files.lst
@ -135,67 +124,15 @@ ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
return ButtonPolicy::SMI_VALID; return ButtonPolicy::SMI_VALID;
} }
void FormTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
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); fl_clear_browser(dialog_->browser);
bool const withFullPath = fl_get_button(dialog_->button_fullPath); bool const withFullPath = fl_get_button(dialog_->button_fullPath);
switch (whichStyle) { string const str =
case FormTexinfo::bst: controller().getContents(whichStyle, withFullPath);
{ fl_add_browser_line(dialog_->browser, str.c_str());
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; activeStyle = whichStyle;
} }
@ -232,16 +169,16 @@ void FormTexinfo::feedback(FL_OBJECT * ob)
string str; string str;
if (ob == dialog_->button_rescan) { if (ob == dialog_->button_rescan) {
str = _("run rescan ..."); str = _("starts rescan ...");
} else if (ob == dialog_->button_fullPath) { } else if (ob == dialog_->button_fullPath) {
str = _("View full path or only file name"); str = _("View full path or only file name");
} else if (ob == dialog_->button_texhash) { } else if (ob == dialog_->button_texhash) {
str = _("run texhash and rescan..."); str = _("starts texhash and rescan...");
} else if (ob == dialog_->button_view) { } else if (ob == dialog_->button_view) {
str = _("select a file to view"); str = _("views a selected file");
} }

View File

@ -15,16 +15,14 @@
#endif #endif
#include "FormBase.h" #include "FormBase.h"
#include "ControlTexinfo.h"
class ControlTexinfo;
struct FD_form_texinfo; struct FD_form_texinfo;
class FormTexinfo : public FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > { class FormTexinfo : public FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > {
public: public:
/// ///
FormTexinfo(ControlTexinfo &); FormTexinfo(ControlTexinfo &);
/// the file extensions
enum texFileSuffix {cls, sty, bst};
/// preemptive handler for feedback messages /// preemptive handler for feedback messages
void feedbackCB(FL_OBJECT *, int); void feedbackCB(FL_OBJECT *, int);
@ -41,13 +39,13 @@ private:
/// ///
void feedback(FL_OBJECT *); void feedback(FL_OBJECT *);
/// ///
void updateStyles(texFileSuffix); void updateStyles(ControlTexinfo::texFileSuffix);
/// Fdesign generated method /// Fdesign generated method
FD_form_texinfo * build_texinfo(); FD_form_texinfo * build_texinfo();
/// ///
bool warningPosted; bool warningPosted;
/// ///
texFileSuffix activeStyle; ControlTexinfo::texFileSuffix activeStyle;
}; };
#endif // FORMTEXINFO_H #endif // FORMTEXINFO_H

View File

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