/** * \file FormTexinfo.C * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author Herbert Voss * * Full author contact details are available in file CREDITS * \date 2001-10-01 */ #include #include #ifdef __GNUG__ #pragma implementation #endif #include "xformsBC.h" #include "FormTexinfo.h" #include "forms/form_texinfo.h" #include "Tooltips.h" #include "gettext.h" #include "debug.h" #include "xforms_helpers.h" #include "support/LAssert.h" #include FORMS_H_LOCATION typedef FormCB > base_class; FormTexinfo::FormTexinfo() : base_class(_("LaTeX Information")), activeStyle(ControlTexinfo::cls) {} void FormTexinfo::build() { dialog_.reset(build_texinfo(this)); updateStyles(ControlTexinfo::cls); string const classes_List = _("LaTeX classes|LaTeX styles|BibTeX styles"); fl_addto_choice(dialog_->choice_classes, classes_List.c_str()); // set up the tooltips string str = _("Shows the installed classses and styles for LaTeX/BibTeX. These classes are only available in LyX if a corresponding LyX layout file exists."); tooltips().init(dialog_->choice_classes, str); str = _("View full path or only file name."); tooltips().init(dialog_->check_fullpath, str); str = _("Runs the script \"TexFiles.sh\" to build new file lists."); tooltips().init(dialog_->button_rescan, str); str = _("Shows the contents of the marked file. Only possible in full path mode."); tooltips().init(dialog_->button_view, str); str = _("Runs the script \"texhash\" which builds a new LaTeX tree. Needed if you install a new TeX class or style. You need write permissions for the TeX-dirs, often /var/lib/texmf and others."); tooltips().init(dialog_->button_texhash, str); } ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) { if (ob == dialog_->choice_classes) { switch (fl_get_choice(dialog_->choice_classes)) { case 1: updateStyles(ControlTexinfo::cls); break; case 2: updateStyles(ControlTexinfo::sty); break; case 3: default: updateStyles(ControlTexinfo::bst); } } else if (ob == dialog_->button_rescan) { // build new *Files.lst controller().rescanStyles(); updateStyles(activeStyle); } else if (ob == dialog_->check_fullpath) { setEnabled(dialog_->button_view, fl_get_button(dialog_->check_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; } void FormTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle) { fl_clear_browser(dialog_->browser); bool const withFullPath = fl_get_button(dialog_->check_fullpath); string const str = controller().getContents(whichStyle, withFullPath); fl_add_browser_line(dialog_->browser, str.c_str()); activeStyle = whichStyle; }