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
|
|
|
|
*
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author Herbert Vo<EFBFBD>
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-10-09 15:20:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "FormShowFile.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "ControlShowFile.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
|
#include "forms/form_browser.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
|
|
|
|
|
#include "xformsBC.h"
|
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
|
#include "lyx_forms.h"
|
2001-10-09 15:20:10 +00:00
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
2003-03-25 18:13:46 +00:00
|
|
|
|
FormShowFile::FormShowFile(Dialog & parent)
|
|
|
|
|
: FormController<ControlShowFile, FormBrowser>(parent, _("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
|
|
|
|
|
2003-08-23 09:55:37 +00:00
|
|
|
|
string const title = controller().getFileName();
|
2003-05-22 15:42:50 +00:00
|
|
|
|
setTitle(title);
|
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());
|
|
|
|
|
}
|