2001-07-30 11:56:00 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file FormFloat.C
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "xformsBC.h"
|
|
|
|
#include "ControlFloat.h"
|
|
|
|
#include "FormFloat.h"
|
|
|
|
#include "form_float.h"
|
|
|
|
#include "support/lstrings.h"
|
2002-01-03 13:31:12 +00:00
|
|
|
#include "xforms_helpers.h"
|
2001-07-30 11:56:00 +00:00
|
|
|
|
|
|
|
typedef FormCB<ControlFloat, FormDB<FD_form_float> > base_class;
|
|
|
|
|
|
|
|
FormFloat::FormFloat(ControlFloat & c)
|
|
|
|
: base_class(c, _("Float Options"))
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-09-09 22:02:19 +00:00
|
|
|
// FIX: Needs to be implemented. (Lgb)
|
2001-07-30 11:56:00 +00:00
|
|
|
// A way to set to float default is missing.
|
|
|
|
// A way to set "force[!]" is missing.
|
|
|
|
|
|
|
|
void FormFloat::build()
|
|
|
|
{
|
|
|
|
dialog_.reset(build_float());
|
|
|
|
|
|
|
|
// Manage the ok, apply and cancel/close buttons
|
|
|
|
bc().setOK(dialog_->button_ok);
|
|
|
|
bc().setApply(dialog_->button_apply);
|
|
|
|
bc().setCancel(dialog_->button_cancel);
|
|
|
|
bc().setRestore(dialog_->button_restore);
|
|
|
|
|
|
|
|
bc().addReadOnly(dialog_->radio_top);
|
|
|
|
bc().addReadOnly(dialog_->radio_bottom);
|
|
|
|
bc().addReadOnly(dialog_->radio_page);
|
|
|
|
bc().addReadOnly(dialog_->radio_here);
|
2001-09-11 17:27:28 +00:00
|
|
|
bc().addReadOnly(dialog_->button_here_definitely);
|
2001-07-30 11:56:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormFloat::apply()
|
|
|
|
{
|
|
|
|
string placement;
|
2001-09-11 17:27:28 +00:00
|
|
|
if (fl_get_button(dialog_->button_here_definitely)) {
|
2001-07-30 11:56:00 +00:00
|
|
|
placement += "H";
|
|
|
|
} else {
|
|
|
|
if (fl_get_button(dialog_->radio_top)) {
|
|
|
|
placement += "t";
|
|
|
|
}
|
|
|
|
if (fl_get_button(dialog_->radio_bottom)) {
|
|
|
|
placement += "b";
|
|
|
|
}
|
|
|
|
if (fl_get_button(dialog_->radio_page)) {
|
|
|
|
placement += "p";
|
|
|
|
}
|
|
|
|
if (fl_get_button(dialog_->radio_here)) {
|
|
|
|
placement += "h";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
controller().params().placement = placement;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormFloat::update()
|
|
|
|
{
|
|
|
|
bool top = false;
|
|
|
|
bool bottom = false;
|
|
|
|
bool page = false;
|
|
|
|
bool here = false;
|
2001-09-11 17:27:28 +00:00
|
|
|
bool here_definitely = false;
|
2001-07-30 11:56:00 +00:00
|
|
|
|
|
|
|
string placement(controller().params().placement);
|
|
|
|
|
|
|
|
if (contains(placement, "H")) {
|
2001-09-11 17:27:28 +00:00
|
|
|
here_definitely = true;
|
2001-07-30 11:56:00 +00:00
|
|
|
} else {
|
|
|
|
if (contains(placement, "t")) {
|
|
|
|
top = true;
|
|
|
|
}
|
|
|
|
if (contains(placement, "b")) {
|
|
|
|
bottom = true;
|
|
|
|
}
|
|
|
|
if (contains(placement, "p")) {
|
|
|
|
page = true;
|
|
|
|
}
|
|
|
|
if (contains(placement, "h")) {
|
|
|
|
here = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fl_set_button(dialog_->radio_top, top);
|
|
|
|
fl_set_button(dialog_->radio_bottom, bottom);
|
|
|
|
fl_set_button(dialog_->radio_page, page);
|
|
|
|
fl_set_button(dialog_->radio_here, here);
|
2001-09-11 17:27:28 +00:00
|
|
|
fl_set_button(dialog_->button_here_definitely, here_definitely);
|
2002-01-03 13:31:12 +00:00
|
|
|
setEnabled(dialog_->button_here_definitely, controller().params().allow_here_definitely);
|
2001-07-30 11:56:00 +00:00
|
|
|
}
|
|
|
|
|
2001-09-11 17:27:28 +00:00
|
|
|
|
|
|
|
ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
|
|
|
|
{
|
|
|
|
if (ob == dialog_->button_here_definitely) {
|
|
|
|
if (fl_get_button(dialog_->button_here_definitely)) {
|
|
|
|
fl_set_button(dialog_->radio_top, false);
|
|
|
|
fl_set_button(dialog_->radio_bottom, false);
|
|
|
|
fl_set_button(dialog_->radio_page, false);
|
|
|
|
fl_set_button(dialog_->radio_here, false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (fl_get_button(dialog_->button_here_definitely)) {
|
|
|
|
fl_set_button(dialog_->button_here_definitely, false);
|
|
|
|
}
|
|
|
|
}
|
2001-09-12 09:29:46 +00:00
|
|
|
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2001-09-11 17:27:28 +00:00
|
|
|
}
|