3 * Read the file COPYING
7 * Full author contact details are available in file CREDITS
15 #pragma implementation
19 #include "FormTexinfo.h"
20 #include "forms/form_texinfo.h"
24 #include "xforms_helpers.h"
25 #include "support/LAssert.h"
26 #include FORMS_H_LOCATION
29 typedef FormCB<ControlTexinfo, FormDB<FD_texinfo> > base_class;
30 FormTexinfo::FormTexinfo()
31 : base_class(_("LaTeX Information")),
32 activeStyle(ControlTexinfo::cls)
36 void FormTexinfo::build() {
37 dialog_.reset(build_texinfo(this));
39 fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
40 // with Path is default
41 fl_set_button(dialog_->check_fullpath, 1);
42 updateStyles(ControlTexinfo::cls);
44 // set up the tooltips
45 string str = _("Runs the script \"TexFiles.sh\" to build new file lists.");
46 tooltips().init(dialog_->button_rescan, str);
48 str = _("Shows the contents of the marked file. Only possible in full path mode.");
49 tooltips().init(dialog_->button_view, str);
51 str = _("Runs the script \"texhash\" which builds the a new LaTeX tree. Needed if you install a new TeX class or style. To execute it, you need the write permissions for the tex-dirs, often /var/lib/texmf and other.");
52 tooltips().init(dialog_->button_texhash, str);
54 str = _("View full path or only file name. Full path is needed to view the contents of a file.");
55 tooltips().init(dialog_->check_fullpath, str);
57 str = _("Shows the installed LaTeX Document classes. Remember, that these classes are only available in LyX if a corresponding LyX layout file exists!");
58 tooltips().init(dialog_->radio_cls, str);
60 str = _("Shows the installed LaTeX style files, which are available in LyX by default, like \"babel\" or through \\usepackage{<the stylefile>} in LaTeX preamble.");
61 tooltips().init(dialog_->radio_sty, str);
63 str = _("Shows the installed style files for BibTeX. They can be loaded through insert->Lists&Toc->BibTeX Reference->Style.");
64 tooltips().init(dialog_->radio_bst, str);
68 ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
70 if (ob == dialog_->radio_cls) {
71 updateStyles(ControlTexinfo::cls);
73 } else if (ob == dialog_->radio_sty) {
74 updateStyles(ControlTexinfo::sty);
76 } else if (ob == dialog_->radio_bst) {
77 updateStyles(ControlTexinfo::bst);
79 } else if (ob == dialog_->button_rescan) {
80 // build new *Files.lst
81 controller().rescanStyles();
82 updateStyles(activeStyle);
84 } else if (ob == dialog_->check_fullpath) {
85 setEnabled(dialog_->button_view,
86 fl_get_button(dialog_->check_fullpath));
87 updateStyles(activeStyle);
89 } else if (ob == dialog_->button_texhash) {
90 // makes only sense if the rights are set well for
91 // users (/var/lib/texmf/ls-R)
92 controller().runTexhash();
93 // update files in fact of texhash
94 controller().rescanStyles();
96 } else if (ob == dialog_->button_view) {
97 unsigned int selection = fl_get_browser(dialog_->browser);
100 controller().viewFile(
101 fl_get_browser_line(dialog_->browser,
106 return ButtonPolicy::SMI_VALID;
109 void FormTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
111 fl_clear_browser(dialog_->browser);
113 bool const withFullPath = fl_get_button(dialog_->check_fullpath);
116 controller().getContents(whichStyle, withFullPath);
117 fl_add_browser_line(dialog_->browser, str.c_str());
119 activeStyle = whichStyle;