]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormShowFile.C
Introduce LFUN_PRINT.
[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
22 using std::string;
23
24
25 FormShowFile::FormShowFile(Dialog & parent)
26         : FormController<ControlShowFile, FormBrowser>(parent, _("Show File"))
27 {}
28
29
30 void FormShowFile::update()
31 {
32         fl_hide_object(dialog_->button_update);
33         fl_clear_browser(dialog_->browser);
34
35         // courier medium
36         fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
37
38         string const title = controller().getFileName();
39         setTitle(title);
40
41         string const contents = controller().getFileContents();
42         if (contents.empty())
43                 fl_add_browser_line(dialog_->browser,
44                                     "Error -> Cannot load file!");
45         else
46                 fl_add_browser_line(dialog_->browser, contents.c_str());
47 }