2002-03-11 17:00:41 +00:00
|
|
|
/**
|
|
|
|
* \file FormShowFile.C
|
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
* See the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Herbert Voss, voss@perce.de
|
2001-10-09 15:20:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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
|
|
|
|
2001-10-09 15:20:10 +00:00
|
|
|
FormShowFile::FormShowFile(ControlShowFile & c)
|
|
|
|
: FormCB<ControlShowFile, FormBrowser>(c, string())
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
// courier medium
|
|
|
|
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
|
|
|
|
fl_set_form_title(dialog_->form, controller().getFileName().c_str());
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|