2002-03-11 17:00:41 +00:00
|
|
|
/**
|
|
|
|
* \file FormShowFile.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-11 17:00:41 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Herbert Voss
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-10-09 15:20:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "xformsBC.h"
|
|
|
|
#include "ControlShowFile.h"
|
|
|
|
#include "FormShowFile.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms/form_browser.h"
|
2001-10-09 15:20:10 +00:00
|
|
|
#include "gettext.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include FORMS_H_LOCATION
|
2001-10-09 15:20:10 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
FormShowFile::FormShowFile()
|
2002-10-24 12:56:44 +00:00
|
|
|
: FormCB<ControlShowFile, FormBrowser>(_("Show File"))
|
2001-10-09 15:20:10 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void FormShowFile::update()
|
|
|
|
{
|
2001-10-10 16:45:05 +00:00
|
|
|
fl_hide_object(dialog_->button_update);
|
2001-10-09 15:20:10 +00:00
|
|
|
fl_clear_browser(dialog_->browser);
|
2002-10-24 12:56:44 +00:00
|
|
|
|
2001-10-09 15:20:10 +00:00
|
|
|
// courier medium
|
|
|
|
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
|
2002-10-24 12:56:44 +00:00
|
|
|
|
|
|
|
string const title = "LyX: " + controller().getFileName();
|
|
|
|
fl_set_form_title(dialog_->form, title.c_str());
|
2001-10-09 15:20:10 +00:00
|
|
|
|
|
|
|
string const contents = controller().getFileContents();
|
|
|
|
if (contents.empty())
|
|
|
|
fl_add_browser_line(dialog_->browser,
|
|
|
|
"Error -> Cannot load file!");
|
|
|
|
else
|
|
|
|
fl_add_browser_line(dialog_->browser, contents.c_str());
|
|
|
|
}
|