]> git.lyx.org Git - features.git/commitdiff
Clean-up of Herbert's Texinfo dialog.
authorAngus Leeming <leeming@lyx.org>
Wed, 10 Oct 2001 16:45:05 +0000 (16:45 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 10 Oct 2001 16:45:05 +0000 (16:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2859 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
lib/ChangeLog
lib/Makefile.am
lib/TeXFiles.sh [deleted file]
lib/configure
lib/configure.m4
lib/help/Bibtex.hlp
lib/help/Texinfo.hlp
lib/scripts/TeXFiles.sh [new file with mode: 0755]
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/ControlTexinfo.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormShowFile.C
src/frontends/xforms/FormTexinfo.C
src/frontends/xforms/FormTexinfo.h
src/lyx_main.C

index 4f30cdabc90b3c64f887d06a327f838e8f851aaf..fd70bc9d656cf8f6d001da809cf33753062d8f6e 100644 (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>
 
        * default.ui: help-Texinfo
index 899af1b926a223a12e5ed85edbfc7739fb935886..a92389139e9a3faa0d2dad2a72b22ebe7a182305 100644 (file)
@@ -13,6 +13,7 @@ CLIPART = clipart/*.eps
 DOCDIST = doc/LyXConfig.lyx*
 DOCINST = doc/*.lyx doc/*.eps doc/*.lyx.in
 EXAMPLES = examples/*.lyx
+HELP = help/*.hlp
 IMAGES = images/*.xpm
 KBD = kbd/*.kmap kbd/*.cdef
 LAYOUT = layouts/*.layout layouts/*.inc 
@@ -25,17 +26,17 @@ configure: configure.m4
        $(M4) $< > $@
        $(CHMOD) 755 $@
  
-LIBINSTFILES = $(BIND) $(CLIPART) $(DOCINST) $(EXAMPLES) $(IMAGES) $(KBD) \
-       $(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(UI)
+LIBINSTFILES = $(BIND) $(CLIPART) $(DOCINST) $(EXAMPLES) $(HELP) $(IMAGES) \
+       $(KBD) $(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(UI)
 
-LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(IMAGES) $(KBD) \
-       $(LAYOUT) $(TEMPL) $(UI) $(TEXSUPPORT) $(LYXSCRIPTS)
+LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(HELP) $(IMAGES) \
+       $(KBD) $(LAYOUT) $(TEMPL) $(UI) $(TEXSUPPORT) $(LYXSCRIPTS)
 
 pkgdata_DATA = lyxrc.example CREDITS chkconfig.ltx lyxrc.defaults \
                textclass.lst packages.lst external_templates \
                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
 
 EXTRA_DIST = CREDITS chkconfig.ltx configure.cmd lyxrc.example \
diff --git a/lib/TeXFiles.sh b/lib/TeXFiles.sh
deleted file mode 100755 (executable)
index 75ec6c1..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/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"
index 1c3155f9a749a1450a6ac027b868dbd6d952c582..9d404ef20ef6174888f645d667e9231897539f81 100755 (executable)
@@ -80,7 +80,7 @@ if test "x$OSTYPE" = xcygwin; then
 fi
 
 #### 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
   test ! -d $dir && mkdir $dir
 done
index 4ea80cde0a678f61d079e3b67c59d94f3e4ebe5a..d167639af4098c72a6f217149dbe6d1f829d1806 100644 (file)
@@ -156,7 +156,7 @@ if test "x$OSTYPE" = xcygwin; then
 fi
 
 #### 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
   test ! -d $dir && mkdir $dir
 done
index c15278eb600e3f00918e2d50b5aa1914eda7ee17..827557ea03162e2ca3410240933f0fb4209a2ad5 100644 (file)
@@ -1,14 +1,12 @@
-** This file is part of LyX, The Document Processor
-** Copyright 2001 The LyX Team.          Bibtex.hlp
----------------------------------------------------
+                                       Bibtex.hlp
 
-Database:
+@bDatabase:
     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:
+@bBibstyle:
     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. 
@@ -19,7 +17,7 @@ Bibstyle:
     available styles on your local TeX-System. It's available
     at http://www.perce.de/lyx/bstFiles.sh 
     
-Option bibtotoc:
+@bOption bibtotoc:
     By default the Bibliography doesn't appears in the table
     of contents. Activate this option if you want an entry
     like
@@ -29,4 +27,4 @@ Option bibtotoc:
     right name Bibliography/References, which depends to your
     chosen document-class.
     
-2001-08-27 / Herbert Voss <voss@perce.de>
\ No newline at end of file
+2001-08-27 / Herbert Voss <voss@perce.de>
index 82049e6c328b2317a3251051f4ea3acb90e5502c..7c74f8e7745b383ffbb4ebdcf15453cf33fdc8a6 100644 (file)
@@ -1,35 +1,41 @@
-** This file is part of LyX, The Document Processor
-** Copyright 2001 The LyX Team.         Texinfo.hlp
----------------------------------------------------
+                                       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
        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 
 
-       "\usepackage{<the stylefile>}
+@i     \usepackage{<the stylefile>}
 
        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 
-       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.
 
-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
-       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.
 
-Help: shows this file
+@bHelp: 
+       shows this file
 
 
-2001-10-01 / Herbert Voss <voss@perce.de>
\ No newline at end of file
+2001-10-01 / Herbert Voss <voss@perce.de>
diff --git a/lib/scripts/TeXFiles.sh b/lib/scripts/TeXFiles.sh
new file mode 100755 (executable)
index 0000000..75ec6c1
--- /dev/null
@@ -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"
index ab6223b509871fe59cf720a4f010167c0a1108cf..adbe12a68732e5221339d2f6d66b9a33894c7299 100644 (file)
@@ -2,6 +2,10 @@
 
        * 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>
 
        * commandtags.h (kb_action): added LFUN_HELP_TEXINFO.
index dc34ae4326a4c5ddc944eb3e24872369808c045d..d2bbf49391f4403f42b13f0959887b92ba5e33a6 100644 (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>
 
        * ControlTexinfo.[Ch]: new files. Display information about the
index 959b874c362f6708c96a316e1da34add8ffd1483..7ebdbb4b71d41a7263f65c9a45cf33f262f01267 100644 (file)
 #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"
+#include "helper_funcs.h"
+#include "support/lstrings.h"
 
-extern string system_lyxdir;
-extern string user_lyxdir;
-extern string help_lyxdir;
-
-using SigC::slot;
+extern string user_lyxdir; // home of *Files.lst
 
 ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & 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
 // kpsewhich and an external script, saved in *Files.lst
-void ControlTexinfo::rescanStyles()
+void ControlTexinfo::rescanStyles() const
 {
        // Run rescan in user lyx directory
        Path p(user_lyxdir);
        Systemcalls one(Systemcalls::System,
-                       AddName(system_lyxdir,"TeXFiles.sh"));
+                       LibFileSearch("scripts", "TeXFiles.sh"));
        p.pop();
 }
 
-void ControlTexinfo::runTexhash()
+
+void ControlTexinfo::runTexhash() const
 {
        // Run texhash in user lyx directory
        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);
 }
 
-void ControlTexinfo::help()
+
+void ControlTexinfo::help() const
 {
-       lv_.getDialogs()->showFile(help_lyxdir+"Texinfo.hlp");
+       lv_.getDialogs()->showFile(i18nLibFileSearch("help","Texinfo.hlp"));
 }
index ef2cf9033686a808e5776fca6c372e691b61e05a..24bd539fdfce29ec5f4d9598fa66ce5734904266 100644 (file)
 
 class ControlTexinfo : public ControlDialog<ControlConnectBI> {
 public:
+       /// the file extensions
+       enum texFileSuffix {cls, sty, bst};
        ///
        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:
        ///
index 8f201d82934cc328875fa2f7fa6742fbfa7bb5fa..6799d95726c2e373b95d9875f9c7f6ab3a593322 100644 (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>
        
        * FormsMathMatrix.C: add missing space between v- and h-alignment
index c45f263e4b0fb4480c1eb8bc404204cf12cd2179..5e2d1b5a5761868fc83cc9a495df25c65c0a9e2a 100644 (file)
@@ -22,6 +22,7 @@ FormShowFile::FormShowFile(ControlShowFile & c)
 
 void FormShowFile::update()
 {
+       fl_hide_object(dialog_->button_update);
        fl_clear_browser(dialog_->browser);
        // courier medium
        fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
index a8357cd64da7e27ba92538ca861f750a17f278ce..8a3abec274e6a5189908d6152d0718e1fea71bab 100644 (file)
 #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,
@@ -67,7 +56,7 @@ void setPreHandler(FL_OBJECT * ob)
 typedef FormCB<ControlTexinfo, FormDB<FD_form_texinfo> > base_class;
 FormTexinfo::FormTexinfo(ControlTexinfo & c)
        : 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);
        // with Path is default
        fl_set_button(dialog_->button_fullPath, 1);
-       updateStyles(FormTexinfo::cls);
+       updateStyles(ControlTexinfo::cls);
 
        setPreHandler(dialog_->button_rescan);
        setPreHandler(dialog_->button_view);
@@ -97,13 +86,13 @@ ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
                controller().help();
 
        } else if (ob == dialog_->radio_cls) {
-               updateStyles(FormTexinfo::cls); 
+               updateStyles(ControlTexinfo::cls); 
 
        } else if (ob == dialog_->radio_sty) {
-               updateStyles(FormTexinfo::sty); 
+               updateStyles(ControlTexinfo::sty); 
 
        } else if (ob == dialog_->radio_bst) {
-               updateStyles(FormTexinfo::bst); 
+               updateStyles(ControlTexinfo::bst); 
 
        } else if (ob == dialog_->button_rescan) {
                // build new *Files.lst
@@ -135,67 +124,15 @@ ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
        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)
+void FormTexinfo::updateStyles(ControlTexinfo::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;
-       }
-       }
+       string const str = 
+               controller().getContents(whichStyle, withFullPath);
+       fl_add_browser_line(dialog_->browser, str.c_str());
 
        activeStyle = whichStyle;
 }
@@ -232,16 +169,16 @@ void FormTexinfo::feedback(FL_OBJECT * ob)
        string str;
 
        if (ob == dialog_->button_rescan) {
-               str = _("run rescan ...");
+               str = _("starts 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...");
+               str = _("starts texhash and rescan...");
 
        } else if (ob == dialog_->button_view) {
-               str = _("select a file to view");
+               str = _("views a selected file");
 
        }
        
index e956b9a9640fb2957739422a156ff1b6f343b6aa..0dc809069463f5039a6c9c6e63ec5565c50d2d10 100644 (file)
 #endif
 
 #include "FormBase.h"
+#include "ControlTexinfo.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);
@@ -41,13 +39,13 @@ private:
        ///
        void feedback(FL_OBJECT *);
        ///
-       void updateStyles(texFileSuffix);
+       void updateStyles(ControlTexinfo::texFileSuffix);
        /// Fdesign generated method
        FD_form_texinfo * build_texinfo();
        ///
        bool warningPosted;
        ///
-       texFileSuffix activeStyle;
+       ControlTexinfo::texFileSuffix activeStyle;
 };
 
 #endif // FORMTEXINFO_H
index a4bbe16e6b18205c90acd96c3371a4bd0ee5a1b3..c07c19c06439336368cb1aa448546c8bb47bf492 100644 (file)
@@ -57,7 +57,6 @@ 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;
@@ -375,7 +374,6 @@ 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: '"