mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Fogot to "add" these files when I committed last time.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1741 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1df761e26d
commit
5e18870755
64
src/frontends/qt2/FileDialog.C
Normal file
64
src/frontends/qt2/FileDialog.C
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* \file FileDialog.C
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include <gettext.h>
|
||||
#include <utility>
|
||||
|
||||
#include "commandtags.h"
|
||||
#include "LString.h"
|
||||
#include "frontends/FileDialog.h"
|
||||
#include "FileDialog_private.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::make_pair;
|
||||
using std::pair;
|
||||
using std::endl;
|
||||
|
||||
FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
|
||||
: private_(0), lv_(lv), title_(t), success_(s)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
|
||||
FileDialog::~FileDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
|
||||
{
|
||||
string filter = mask;
|
||||
if (mask.empty())
|
||||
filter = _("*|All files");
|
||||
|
||||
LyXFileDialog * dlg = new LyXFileDialog(lv_, success_, path, filter, title_);
|
||||
lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
|
||||
|
||||
if (!suggested.empty())
|
||||
dlg->setSelection(suggested.c_str());
|
||||
|
||||
if (success_ == LFUN_SELECT_FILE_SYNC) {
|
||||
FileDialog::Result result;
|
||||
lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
|
||||
result.first = FileDialog::Chosen;
|
||||
int res = dlg->exec();
|
||||
lyxerr[Debug::GUI] << "result " << res << endl;
|
||||
if (res == QDialog::Accepted)
|
||||
result.second = string(dlg->selectedFile().data());
|
||||
delete dlg;
|
||||
return result;
|
||||
}
|
||||
dlg->show();
|
||||
return make_pair(FileDialog::Later, string());
|
||||
}
|
40
src/frontends/qt2/FileDialog_private.C
Normal file
40
src/frontends/qt2/FileDialog_private.C
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* \file FileDialog_private.C
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qfiledialog.h>
|
||||
|
||||
#include "QtLyXView.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "FileDialog_private.h"
|
||||
|
||||
LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a, string const & p, string const & m, string const & t)
|
||||
: QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(), a == LFUN_SELECT_FILE_SYNC),
|
||||
lv_(lv), action_(a)
|
||||
{
|
||||
setCaption(t.c_str());
|
||||
}
|
||||
|
||||
|
||||
void LyXFileDialog::done(int what)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "Done FileDialog, value " << what << endl;
|
||||
|
||||
if (action_ == LFUN_SELECT_FILE_SYNC) {
|
||||
QDialog::done(what);
|
||||
return;
|
||||
} else if (what == QDialog::Accepted)
|
||||
lv_->getLyXFunc()->Dispatch(action_, selectedFile().data());
|
||||
delete this;
|
||||
}
|
||||
|
40
src/frontends/qt2/FileDialog_private.h
Normal file
40
src/frontends/qt2/FileDialog_private.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* \file FileDialog_private.h
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#ifndef FILEDIALOG_PRIVATE_H
|
||||
#define FILEDIALOG_PRIVATE_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <qfiledialog.h>
|
||||
|
||||
#include "LString.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
#include "frontends/FileDialog.h"
|
||||
|
||||
class LyXView;
|
||||
|
||||
class LyXFileDialog : public QFileDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LyXFileDialog(LyXView * lv, kb_action a, string const & p, string const & m, string const & t);
|
||||
|
||||
friend class FileDialog;
|
||||
|
||||
public slots:
|
||||
void done(int);
|
||||
|
||||
private:
|
||||
LyXView * lv_;
|
||||
int action_;
|
||||
};
|
||||
|
||||
#endif // FILEDIALOG_PRIVATE_H
|
345
src/frontends/xforms/FormExternal.C
Normal file
345
src/frontends/xforms/FormExternal.C
Normal file
@ -0,0 +1,345 @@
|
||||
/**
|
||||
* \file FormExternal.C
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <utility>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "FormExternal.h"
|
||||
#include "frontends/FileDialog.h"
|
||||
#include "LString.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using std::endl;
|
||||
|
||||
FormExternal::FormExternal(LyXView * lv, Dialogs * d)
|
||||
: FormBaseBD(lv, d, _("Edit external file"), new OkCancelReadOnlyPolicy),
|
||||
inset_(0), ih_(0), dialog_(0)
|
||||
{
|
||||
d->showExternal.connect(slot(this, &FormExternal::showInset));
|
||||
}
|
||||
|
||||
|
||||
FormExternal::~FormExternal()
|
||||
{
|
||||
delete dialog_;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void ExternalTemplateCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormExternal::templateCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void ExternalBrowseCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormExternal::browseCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void ExternalEditCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormExternal::editCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void ExternalViewCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormExternal::viewCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void ExternalUpdateCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormExternal::updateCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * FormExternal::form() const
|
||||
{
|
||||
if (dialog_)
|
||||
return dialog_->form;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::connect()
|
||||
{
|
||||
u_ = d_->updateBufferDependent.
|
||||
connect(slot(this, &FormExternal::updateSlot));
|
||||
h_ = d_->hideBufferDependent.
|
||||
connect(slot(this, &FormExternal::hide));
|
||||
FormBase::connect();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::disconnect()
|
||||
{
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
FormBaseBD::disconnect();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::updateSlot(bool switched)
|
||||
{
|
||||
if (switched)
|
||||
hide();
|
||||
else
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::showInset(InsetExternal * inset)
|
||||
{
|
||||
Assert(inset);
|
||||
|
||||
// If connected to another inset, disconnect from it.
|
||||
if (inset_)
|
||||
ih_.disconnect();
|
||||
|
||||
inset_ = inset;
|
||||
params_ = inset_->params();
|
||||
|
||||
ih_ = inset->hideDialog.connect(slot(this, &FormExternal::hide));
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::build()
|
||||
{
|
||||
dialog_ = build_external();
|
||||
|
||||
fl_addto_choice(dialog_->choice_template,
|
||||
getTemplatesComboString().c_str());
|
||||
|
||||
// Workaround dumb xforms sizing bug
|
||||
minw_ = form()->w;
|
||||
minh_ = form()->h;
|
||||
|
||||
bc_.setOK(dialog_->button_ok);
|
||||
bc_.setCancel(dialog_->button_cancel);
|
||||
bc_.refresh();
|
||||
|
||||
bc_.addReadOnly(dialog_->input_filename);
|
||||
bc_.addReadOnly(dialog_->button_filenamebrowse);
|
||||
bc_.addReadOnly(dialog_->input_parameters);
|
||||
}
|
||||
|
||||
|
||||
string const FormExternal::getTemplatesComboString() const
|
||||
{
|
||||
string result;
|
||||
bool first = true;
|
||||
ExternalTemplateManager::Templates::const_iterator i1, i2;
|
||||
i1 = ExternalTemplateManager::get().getTemplates().begin();
|
||||
i2 = ExternalTemplateManager::get().getTemplates().end();
|
||||
for (; i1 != i2; ++i1) {
|
||||
if (!first)
|
||||
result += "|";
|
||||
else
|
||||
first = false;
|
||||
|
||||
result += (*i1).second.lyxName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int FormExternal::getTemplateComboNumber(string const & name) const
|
||||
{
|
||||
int i = 1;
|
||||
ExternalTemplateManager::Templates::const_iterator i1, i2;
|
||||
i1 = ExternalTemplateManager::get().getTemplates().begin();
|
||||
i2 = ExternalTemplateManager::get().getTemplates().end();
|
||||
for (; i1 != i2; ++i1) {
|
||||
if (i1->second.lyxName == name)
|
||||
return i;
|
||||
++i;
|
||||
}
|
||||
// we can get here if a LyX document has a template not installed
|
||||
// on this machine.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ExternalTemplate FormExternal::getTemplate(int i) const
|
||||
{
|
||||
ExternalTemplateManager::Templates::const_iterator i1;
|
||||
i1 = ExternalTemplateManager::get().getTemplates().begin();
|
||||
for (int n = 1; n < i; ++n)
|
||||
++i1;
|
||||
|
||||
return (*i1).second;
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::update()
|
||||
{
|
||||
fl_set_input(dialog_->input_filename, params_.filename.c_str());
|
||||
fl_set_input(dialog_->input_parameters, params_.parameters.c_str());
|
||||
|
||||
fl_set_choice(dialog_->choice_template, getTemplateComboNumber(params_.templ.lyxName));
|
||||
|
||||
updateComboChange();
|
||||
|
||||
bc_.valid();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::updateComboChange()
|
||||
{
|
||||
// Update the help text
|
||||
fl_clear_browser(dialog_->browser_helptext);
|
||||
fl_addto_browser(dialog_->browser_helptext, params_.templ.helpText.c_str());
|
||||
fl_set_browser_topline(dialog_->browser_helptext, 0);
|
||||
|
||||
if (params_.templ.automaticProduction) {
|
||||
fl_deactivate_object(dialog_->button_update);
|
||||
fl_set_object_lcol(dialog_->button_update, FL_INACTIVE);
|
||||
} else {
|
||||
fl_activate_object(dialog_->button_update);
|
||||
fl_set_object_lcol(dialog_->button_update, FL_BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FormExternal::input(FL_OBJECT *, long)
|
||||
{
|
||||
// FIXME: anything to do here ?
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::apply()
|
||||
{
|
||||
Assert(inset_);
|
||||
|
||||
if (lv_->buffer()->isReadonly())
|
||||
return;
|
||||
|
||||
params_.filename = fl_get_input(dialog_->input_filename);
|
||||
params_.parameters = fl_get_input(dialog_->input_parameters);
|
||||
params_.templ = getTemplate(fl_get_choice(dialog_->choice_template));
|
||||
|
||||
inset_->setFromParams(params_);
|
||||
lv_->view()->updateInset(inset_, true);
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::templateCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormExternal * form = static_cast<FormExternal*>(ob->form->u_vdata);
|
||||
|
||||
// set to the chosen template
|
||||
form->params_.templ = form->getTemplate(fl_get_choice(form->dialog_->choice_template));
|
||||
|
||||
form->updateComboChange();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::browseCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormExternal * form = static_cast<FormExternal*>(ob->form->u_vdata);
|
||||
|
||||
static string current_path;
|
||||
static int once = 0;
|
||||
|
||||
string p = fl_get_input(form->dialog_->input_filename);
|
||||
string buf = MakeAbsPath(form->lv_->buffer()->fileName());
|
||||
string buf2 = OnlyPath(buf);
|
||||
|
||||
if (!p.empty()) {
|
||||
buf = MakeAbsPath(p, buf2);
|
||||
buf = OnlyPath(buf);
|
||||
} else {
|
||||
buf = OnlyPath(form->lv_->buffer()->fileName());
|
||||
}
|
||||
|
||||
FileDialog fileDlg(form->lv_, _("Select external file"),
|
||||
LFUN_SELECT_FILE_SYNC,
|
||||
make_pair(string(_("Document")), string(buf)));
|
||||
|
||||
/// Determine the template file extension
|
||||
ExternalTemplate const & et = form->params_.templ;
|
||||
|
||||
string regexp = et.fileRegExp;
|
||||
if (regexp.empty())
|
||||
regexp = "*";
|
||||
|
||||
// FIXME: a temporary hack until the FileDialog interface is updated
|
||||
regexp += "|";
|
||||
|
||||
while (1) {
|
||||
string const path = (once) ? current_path : buf;
|
||||
FileDialog::Result result = fileDlg.Select(path, regexp, fl_get_input(form->dialog_->input_filename));
|
||||
|
||||
if (result.second.empty())
|
||||
return;
|
||||
|
||||
string p = result.second;
|
||||
|
||||
buf = MakeRelPath(p, buf2);
|
||||
current_path = OnlyPath(p);
|
||||
once = 1;
|
||||
|
||||
if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|
||||
|| contains(p, "%")) {
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("'#', '~', '$' or '%'."));
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
fl_set_input(form->dialog_->input_filename, buf.c_str());
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::editCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormExternal * form = static_cast<FormExternal*>(ob->form->u_vdata);
|
||||
|
||||
form->apply();
|
||||
form->inset_->editExternal();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::viewCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormExternal * form = static_cast<FormExternal*>(ob->form->u_vdata);
|
||||
|
||||
form->apply();
|
||||
form->inset_->viewExternal();
|
||||
}
|
||||
|
||||
|
||||
void FormExternal::updateCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormExternal * form = static_cast<FormExternal*>(ob->form->u_vdata);
|
||||
|
||||
form->apply();
|
||||
form->inset_->updateExternal();
|
||||
}
|
99
src/frontends/xforms/FormExternal.h
Normal file
99
src/frontends/xforms/FormExternal.h
Normal file
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* \file FormExternal.h
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#ifndef FORMEXTERNAL_H
|
||||
#define FORMEXTERNAL_H
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "insets/insetexternal.h"
|
||||
|
||||
#include "form_external.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/// The class for editing External insets via a dialog
|
||||
class FormExternal : public FormBaseBD {
|
||||
public:
|
||||
FormExternal(LyXView *, Dialogs *);
|
||||
|
||||
~FormExternal();
|
||||
|
||||
/// Connect signals. Also perform any necessary initialisation.
|
||||
virtual void connect();
|
||||
|
||||
/// Disconnect signals. Also perform any necessary housekeeping.
|
||||
virtual void disconnect();
|
||||
|
||||
/// Slot launching dialog to an existing inset
|
||||
void showInset(InsetExternal *);
|
||||
|
||||
/// bool indicates if a buffer switch took place
|
||||
virtual void updateSlot(bool);
|
||||
|
||||
/// Callback function for the template drop-down
|
||||
static void templateCB(FL_OBJECT *, long);
|
||||
|
||||
/// Callback function for the browse button
|
||||
static void browseCB(FL_OBJECT *, long);
|
||||
|
||||
/// Callback function for the edit button
|
||||
static void editCB(FL_OBJECT *, long);
|
||||
|
||||
/// Callback function for the view button
|
||||
static void viewCB(FL_OBJECT *, long);
|
||||
|
||||
/// Callback function for the update production button
|
||||
static void updateCB(FL_OBJECT *, long);
|
||||
|
||||
/// Pointer to the actual instantiation of the xform's form
|
||||
virtual FL_FORM * form() const;
|
||||
|
||||
private:
|
||||
/// calculate the string to set the combo box
|
||||
string const getTemplatesComboString() const;
|
||||
|
||||
/// get the position in the combo for a given name
|
||||
int getTemplateComboNumber(string const & name) const;
|
||||
|
||||
/// get a template given its combo position
|
||||
ExternalTemplate getTemplate(int i) const;
|
||||
|
||||
/// change widgets on change of chosen template
|
||||
void updateComboChange();
|
||||
|
||||
/// build the dialog
|
||||
void build();
|
||||
|
||||
/// the inset we're modifying
|
||||
InsetExternal * inset_;
|
||||
|
||||
/// the parameters
|
||||
InsetExternal::InsetExternalParams params_;
|
||||
|
||||
/// update the dialog
|
||||
void update();
|
||||
|
||||
/// apply changes
|
||||
void apply();
|
||||
|
||||
bool input(FL_OBJECT * obj, long data);
|
||||
|
||||
/// inset::hide connection.
|
||||
Connection ih_;
|
||||
|
||||
/// build the dialog
|
||||
FD_form_external * build_external();
|
||||
|
||||
/// the dialog implementation
|
||||
FD_form_external * dialog_;
|
||||
};
|
||||
|
||||
#endif // FORMEXTERNAL_H
|
110
src/frontends/xforms/form_external.C
Normal file
110
src/frontends/xforms/form_external.C
Normal file
@ -0,0 +1,110 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "form_external.h"
|
||||
#include "FormExternal.h"
|
||||
|
||||
FD_form_external::~FD_form_external()
|
||||
{
|
||||
if ( form->visible ) fl_hide_form( form );
|
||||
fl_free_form( form );
|
||||
}
|
||||
|
||||
|
||||
FD_form_external * FormExternal::build_external()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_external *fdui = new FD_form_external;
|
||||
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 560, 310);
|
||||
fdui->form->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 560, 310, "");
|
||||
{
|
||||
char const * const dummy = N_("Template|#t");
|
||||
fdui->choice_template = obj = fl_add_choice(FL_NORMAL_CHOICE, 130, 10, 300, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
||||
fl_set_object_callback(obj, ExternalTemplateCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("File|#F");
|
||||
fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 130, 190, 190, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Browse...|#B");
|
||||
fdui->button_filenamebrowse = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 190, 100, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, ExternalBrowseCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Parameters|#P");
|
||||
fdui->input_parameters = obj = fl_add_input(FL_NORMAL_INPUT, 130, 230, 300, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
||||
{
|
||||
char const * const dummy = N_("Edit file|#E");
|
||||
fdui->button_edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_color(obj, FL_COL1, FL_BLACK);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||
fl_set_object_callback(obj, ExternalEditCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("View result|#V");
|
||||
fdui->button_view = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 90, 110, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_color(obj, FL_COL1, FL_BLACK);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||
fl_set_object_callback(obj, ExternalViewCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Update result|#U");
|
||||
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 130, 110, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_color(obj, FL_COL1, FL_BLACK);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||
fl_set_object_callback(obj, ExternalUpdateCB, 0);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 315, 270, 110, 30, _("OK"));
|
||||
fl_set_object_color(obj, FL_COL1, FL_BLACK);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Cancel|#C^[");
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 270, 110, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
|
||||
fdui->browser_helptext = obj = fl_add_browser(FL_NORMAL_BROWSER, 130, 50, 300, 130, "");
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
35
src/frontends/xforms/form_external.h
Normal file
35
src/frontends/xforms/form_external.h
Normal file
@ -0,0 +1,35 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
/** Header file generated with fdesign **/
|
||||
|
||||
#ifndef FD_form_external_h_
|
||||
#define FD_form_external_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void ExternalTemplateCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
|
||||
extern "C" void ExternalBrowseCB(FL_OBJECT *, long);
|
||||
extern "C" void ExternalEditCB(FL_OBJECT *, long);
|
||||
extern "C" void ExternalViewCB(FL_OBJECT *, long);
|
||||
extern "C" void ExternalUpdateCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
struct FD_form_external {
|
||||
~FD_form_external();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *choice_template;
|
||||
FL_OBJECT *input_filename;
|
||||
FL_OBJECT *button_filenamebrowse;
|
||||
FL_OBJECT *input_parameters;
|
||||
FL_OBJECT *button_edit;
|
||||
FL_OBJECT *button_view;
|
||||
FL_OBJECT *button_update;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *browser_helptext;
|
||||
};
|
||||
|
||||
#endif /* FD_form_external_h_ */
|
214
src/frontends/xforms/forms/form_external.fd
Normal file
214
src/frontends/xforms/forms/form_external.fd
Normal file
@ -0,0 +1,214 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_external
|
||||
Width: 560
|
||||
Height: 310
|
||||
Number of Objects: 11
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 560 310
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 130 10 300 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Template|#t
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_template
|
||||
callback: ExternalTemplateCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 130 190 190 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: File|#F
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthWest FL_SouthEast
|
||||
name: input_filename
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 330 190 100 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Browse...|#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_filenamebrowse
|
||||
callback: ExternalBrowseCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 130 230 300 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Parameters|#P
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthWest FL_SouthEast
|
||||
name: input_parameters
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 435 50 110 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Edit file|#E
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: button_edit
|
||||
callback: ExternalEditCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 435 90 110 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: View result|#V
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: button_view
|
||||
callback: ExternalViewCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 435 130 110 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Update result|#U
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: button_update
|
||||
callback: ExternalUpdateCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 315 270 110 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: OK
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_ok
|
||||
callback: C_FormBaseOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 435 270 110 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Cancel|#C^[
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_cancel
|
||||
callback: C_FormBaseCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: NORMAL_BROWSER
|
||||
box: 130 50 300 130
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_SouthEast
|
||||
name: browser_helptext
|
||||
callback:
|
||||
argument:
|
||||
|
||||
==============================
|
||||
create_the_forms
|
Loading…
x
Reference in New Issue
Block a user