]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlTexinfo.C
fix tooltips in toolbar
[lyx.git] / src / frontends / controllers / ControlTexinfo.C
1 /* This file is part of
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file ControlTexinfo.C
11  * \author Herbert Voss <voss@lyx.org>
12  */
13
14 #include <config.h>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "ControlTexinfo.h"
21 #include "Dialogs.h"
22 #include "BufferView.h"
23 #include "gettext.h"
24 #include "helper_funcs.h"
25 #include "tex_helpers.h"
26
27 #include "frontends/LyXView.h"
28
29 #include "support/filetools.h" // FileSearch
30 #include "support/path.h"
31 #include "support/lstrings.h"
32
33 extern string user_lyxdir; // home of *Files.lst
34
35 namespace {
36
37 string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
38 {
39         switch (type) {
40             case ControlTexinfo::bst: 
41                 return getTexFileList("bstFiles.lst", withFullPath);
42                 break;
43             case ControlTexinfo::cls:
44                 return getTexFileList("clsFiles.lst", withFullPath);
45                 break;
46             case ControlTexinfo::sty:
47                 return getTexFileList("styFiles.lst", withFullPath);
48                 break;
49         }
50         return string();
51 }
52  
53 }
54
55 ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
56         : ControlDialogBI(lv, d)
57 {}
58
59
60 // build filelists of all availabe bst/cls/sty-files. done through
61 // kpsewhich and an external script, saved in *Files.lst
62 void ControlTexinfo::rescanStyles() const
63 {
64     rescanTexStyles();
65 }
66
67
68 void ControlTexinfo::runTexhash() const
69 {
70     texhash();
71 }
72
73
74 string const
75 ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const
76 {
77         string list(getFileList(type, withFullPath));
78
79         // initial scan
80         if (list.empty()) {
81                 rescanStyles();
82                 list = getFileList(type, withFullPath);
83         }
84         return list;
85 }
86
87
88 void ControlTexinfo::viewFile(string const filename) const
89 {
90         lv_.getDialogs()->showFile(filename);
91 }
92
93
94 string const ControlTexinfo::getClassOptions(string const & filename) const
95 {
96         return getListOfOptions(filename, "cls");
97 }