]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormShowFile.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / FormShowFile.C
1 /**
2  * \file FormShowFile.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Herbert Voß
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FormShowFile.h"
14 #include "ControlShowFile.h"
15 #include "forms/form_browser.h"
16
17 #include "xformsBC.h"
18
19 #include "lyx_forms.h"
20
21 using std::string;
22
23 namespace lyx {
24 namespace frontend {
25
26 FormShowFile::FormShowFile(Dialog & parent)
27         : FormController<ControlShowFile, FormBrowser>(parent, _("Show File"))
28 {}
29
30
31 void FormShowFile::update()
32 {
33         fl_hide_object(dialog_->button_update);
34         fl_clear_browser(dialog_->browser);
35
36         // courier medium
37         fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
38
39         string const title = controller().getFileName();
40         setTitle(title);
41
42         string const contents = controller().getFileContents();
43         if (contents.empty())
44                 fl_add_browser_line(dialog_->browser,
45                                     "Error -> Cannot load file!");
46         else
47                 fl_add_browser_line(dialog_->browser, contents.c_str());
48 }
49
50 } // namespace frontend
51 } // namespace lyx