mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
Make more use of the feedback controller routines.
Reduce the amount of repeated code in FormParagraph. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3790 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8eeed19540
commit
293a38272a
@ -3,6 +3,20 @@
|
|||||||
* xforms_helpers.C (setCursorColor):
|
* xforms_helpers.C (setCursorColor):
|
||||||
* Tooltips.C (set): remove XC_question_arrow code.
|
* Tooltips.C (set): remove XC_question_arrow code.
|
||||||
|
|
||||||
|
* FeedbackController.[Ch] (clearMessage): new method.
|
||||||
|
|
||||||
|
* FeedbackController.C (postMessage): the warning message is now
|
||||||
|
displayed in red!
|
||||||
|
|
||||||
|
* FormParagraph.C: define some helper functions to minimise the amount
|
||||||
|
of repeated code.
|
||||||
|
|
||||||
|
* FormDocument.C:
|
||||||
|
* FormGraphics.C:
|
||||||
|
* FormMinipage.C:
|
||||||
|
* FormTabular.C: use the FeedbackController to post the warning
|
||||||
|
messages.
|
||||||
|
|
||||||
2002-03-19 André Pönitz <poenitz@gmx.net>
|
2002-03-19 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* FormParagraph.C: whitespace changes
|
* FormParagraph.C: whitespace changes
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "xforms_helpers.h" // formatted
|
#include "xforms_helpers.h" // formatted
|
||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
|
|
||||||
FeedbackController::FeedbackController()
|
FeedbackController::FeedbackController()
|
||||||
: warning_posted_(false), message_widget_(0)
|
: warning_posted_(false), message_widget_(0)
|
||||||
{}
|
{}
|
||||||
@ -34,8 +35,9 @@ FeedbackController::~FeedbackController()
|
|||||||
|
|
||||||
void FeedbackController::setMessageWidget(FL_OBJECT * ob)
|
void FeedbackController::setMessageWidget(FL_OBJECT * ob)
|
||||||
{
|
{
|
||||||
lyx::Assert(ob && ob->objclass == FL_TEXT);
|
lyx::Assert(ob && ob->objclass == FL_TEXT);
|
||||||
message_widget_ = ob;
|
message_widget_ = ob;
|
||||||
|
fl_set_object_lsize(message_widget_, FL_SMALL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,13 +48,19 @@ void FeedbackController::MessageCB(FL_OBJECT * ob, int event)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case FL_ENTER:
|
case FL_ENTER:
|
||||||
|
{
|
||||||
|
string const feedback = getFeedback(ob);
|
||||||
|
if (feedback.empty() && warning_posted_)
|
||||||
|
break;
|
||||||
|
|
||||||
warning_posted_ = false;
|
warning_posted_ = false;
|
||||||
postMessage(getFeedback(ob));
|
postMessage(getFeedback(ob));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case FL_LEAVE:
|
case FL_LEAVE:
|
||||||
if (!warning_posted_)
|
if (!warning_posted_)
|
||||||
fl_set_object_label(message_widget_, "");
|
clearMessage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -86,6 +94,24 @@ void FeedbackController::postWarning(string const & warning)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FeedbackController::clearMessage()
|
||||||
|
{
|
||||||
|
lyx::Assert(message_widget_);
|
||||||
|
|
||||||
|
warning_posted_ = false;
|
||||||
|
|
||||||
|
string const existing = message_widget_->label
|
||||||
|
? message_widget_->label : string();
|
||||||
|
if (existing.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// This trick is needed to get xforms to clear the label...
|
||||||
|
fl_hide_object(message_widget_);
|
||||||
|
fl_set_object_label(message_widget_, "");
|
||||||
|
fl_show_object(message_widget_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FeedbackController::postMessage(string const & message)
|
void FeedbackController::postMessage(string const & message)
|
||||||
{
|
{
|
||||||
lyx::Assert(message_widget_);
|
lyx::Assert(message_widget_);
|
||||||
@ -94,5 +120,6 @@ void FeedbackController::postMessage(string const & message)
|
|||||||
message_widget_->w-10, FL_SMALL_SIZE);
|
message_widget_->w-10, FL_SMALL_SIZE);
|
||||||
|
|
||||||
fl_set_object_label(message_widget_, str.c_str());
|
fl_set_object_label(message_widget_, str.c_str());
|
||||||
fl_set_object_lsize(message_widget_, FL_SMALL_SIZE);
|
FL_COLOR const label_color = warning_posted_ ? FL_TOMATO : FL_BLACK;
|
||||||
|
fl_set_object_lcol(message_widget_, label_color);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,8 @@ protected:
|
|||||||
message_widget direct. The message will persist till the mouse
|
message_widget direct. The message will persist till the mouse
|
||||||
movesto a new object. */
|
movesto a new object. */
|
||||||
void postWarning(string const & warning);
|
void postWarning(string const & warning);
|
||||||
|
/// Reset the message_widget_
|
||||||
|
void clearMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Get the feedback message for ob.
|
/** Get the feedback message for ob.
|
||||||
|
@ -92,6 +92,9 @@ void FormDocument::build()
|
|||||||
// the tabbed folder
|
// the tabbed folder
|
||||||
dialog_.reset(build_tabbed_document());
|
dialog_.reset(build_tabbed_document());
|
||||||
|
|
||||||
|
// Allow the base class to control messages
|
||||||
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
// Manage the restore, ok, apply, restore and cancel/close buttons
|
// Manage the restore, ok, apply, restore and cancel/close buttons
|
||||||
bc().setOK(dialog_->button_ok);
|
bc().setOK(dialog_->button_ok);
|
||||||
bc().setApply(dialog_->button_apply);
|
bc().setApply(dialog_->button_apply);
|
||||||
@ -1224,14 +1227,12 @@ void FormDocument::checkReadOnly()
|
|||||||
if (bc().readOnly(lv_->buffer()->isReadonly())) {
|
if (bc().readOnly(lv_->buffer()->isReadonly())) {
|
||||||
combo_doc_class->deactivate();
|
combo_doc_class->deactivate();
|
||||||
combo_language->deactivate();
|
combo_language->deactivate();
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Document is read-only."
|
||||||
_("Document is read-only."
|
" No changes to layout permitted."));
|
||||||
" No changes to layout permitted."));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
} else {
|
} else {
|
||||||
combo_doc_class->activate();
|
combo_doc_class->activate();
|
||||||
combo_language->activate();
|
combo_language->activate();
|
||||||
fl_hide_object(dialog_->text_warning);
|
clearMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1278,12 +1279,10 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
|
|||||||
|| ob == paper_->input_head_sep
|
|| ob == paper_->input_head_sep
|
||||||
|| ob == paper_->input_foot_skip) {
|
|| ob == paper_->input_foot_skip) {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
fl_hide_object(dialog_->text_warning);
|
clearMessage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,9 @@ void FormGraphics::build()
|
|||||||
{
|
{
|
||||||
dialog_.reset(build_graphics());
|
dialog_.reset(build_graphics());
|
||||||
|
|
||||||
|
// Allow the base class to control messages
|
||||||
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
// Manage the ok, apply, restore and cancel/close buttons
|
// Manage the ok, apply, restore and cancel/close buttons
|
||||||
bc().setOK(dialog_->button_ok);
|
bc().setOK(dialog_->button_ok);
|
||||||
bc().setApply(dialog_->button_apply);
|
bc().setApply(dialog_->button_apply);
|
||||||
@ -642,12 +645,10 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
ob == size_->input_width || ob == size_->input_height ||
|
ob == size_->input_width || ob == size_->input_height ||
|
||||||
ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
|
ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
|
||||||
if (invalid) {
|
if (invalid) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Invalid Length!"));
|
||||||
_("Warning: Invalid Length!"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return ButtonPolicy::SMI_INVALID;
|
return ButtonPolicy::SMI_INVALID;
|
||||||
} else {
|
} else {
|
||||||
fl_hide_object(dialog_->text_warning);
|
clearMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ void FormMinipage::build()
|
|||||||
{
|
{
|
||||||
dialog_.reset(build_minipage());
|
dialog_.reset(build_minipage());
|
||||||
|
|
||||||
|
// Allow the base class to control messages
|
||||||
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
|
||||||
setPrehandler(dialog_->input_width);
|
setPrehandler(dialog_->input_width);
|
||||||
|
|
||||||
@ -56,7 +59,7 @@ void FormMinipage::apply()
|
|||||||
{
|
{
|
||||||
controller().params().pageWidth =
|
controller().params().pageWidth =
|
||||||
LyXLength(getLengthFromWidgets(dialog_->input_width,
|
LyXLength(getLengthFromWidgets(dialog_->input_width,
|
||||||
dialog_->choice_width_units));
|
dialog_->choice_width_units));
|
||||||
|
|
||||||
if (fl_get_button(dialog_->radio_top))
|
if (fl_get_button(dialog_->radio_top))
|
||||||
controller().params().pos = InsetMinipage::top;
|
controller().params().pos = InsetMinipage::top;
|
||||||
@ -69,31 +72,34 @@ void FormMinipage::apply()
|
|||||||
|
|
||||||
void FormMinipage::update()
|
void FormMinipage::update()
|
||||||
{
|
{
|
||||||
LyXLength len(controller().params().pageWidth);
|
LyXLength len(controller().params().pageWidth);
|
||||||
fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
|
fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
|
||||||
fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
|
fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
|
||||||
|
|
||||||
switch (controller().params().pos) {
|
switch (controller().params().pos) {
|
||||||
case InsetMinipage::top:
|
case InsetMinipage::top:
|
||||||
fl_set_button(dialog_->radio_top, 1);
|
fl_set_button(dialog_->radio_top, 1);
|
||||||
break;
|
break;
|
||||||
case InsetMinipage::center:
|
case InsetMinipage::center:
|
||||||
fl_set_button(dialog_->radio_middle, 1);
|
fl_set_button(dialog_->radio_middle, 1);
|
||||||
break;
|
break;
|
||||||
case InsetMinipage::bottom:
|
case InsetMinipage::bottom:
|
||||||
fl_set_button(dialog_->radio_bottom, 1);
|
fl_set_button(dialog_->radio_bottom, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ButtonPolicy::SMInput FormMinipage::input(FL_OBJECT * ob, long)
|
ButtonPolicy::SMInput FormMinipage::input(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
|
clearMessage();
|
||||||
|
|
||||||
ButtonPolicy::SMInput action = ButtonPolicy::SMI_NOOP;
|
ButtonPolicy::SMInput action = ButtonPolicy::SMI_NOOP;
|
||||||
|
|
||||||
if (ob == dialog_->radio_top ||
|
if (ob == dialog_->radio_top ||
|
||||||
ob == dialog_->radio_middle ||
|
ob == dialog_->radio_middle ||
|
||||||
ob == dialog_->radio_bottom ||
|
ob == dialog_->radio_bottom ||
|
||||||
ob == dialog_->choice_width_units)
|
ob == dialog_->choice_width_units)
|
||||||
return ButtonPolicy::SMI_VALID;
|
return ButtonPolicy::SMI_VALID;
|
||||||
|
|
||||||
// disallow senseless data
|
// disallow senseless data
|
||||||
@ -102,12 +108,9 @@ ButtonPolicy::SMInput FormMinipage::input(FL_OBJECT * ob, long)
|
|||||||
string const input = getStringFromInput(dialog_->input_width);
|
string const input = getStringFromInput(dialog_->input_width);
|
||||||
bool const invalid = !isValidLength(input) && !isStrDbl(input);
|
bool const invalid = !isValidLength(input) && !isStrDbl(input);
|
||||||
if (invalid) {
|
if (invalid) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Invalid Length!"));
|
||||||
_("Warning: Invalid Length!"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
action = ButtonPolicy::SMI_INVALID;
|
action = ButtonPolicy::SMI_INVALID;
|
||||||
} else {
|
} else {
|
||||||
fl_hide_object(dialog_->text_warning);
|
|
||||||
action = ButtonPolicy::SMI_VALID;
|
action = ButtonPolicy::SMI_VALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "helper_funcs.h"
|
#include "helper_funcs.h"
|
||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -44,10 +45,10 @@ using std::remove_if;
|
|||||||
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
|
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
|
||||||
: FormBaseBD(lv, d, _("Paragraph Layout")), par_(0)
|
: FormBaseBD(lv, d, _("Paragraph Layout")), par_(0)
|
||||||
{
|
{
|
||||||
// let the dialog be shown
|
// let the dialog be shown
|
||||||
// This is a permanent connection so we won't bother
|
// This is a permanent connection so we won't bother
|
||||||
// storing a copy because we won't be disconnecting.
|
// storing a copy because we won't be disconnecting.
|
||||||
d->showParagraph.connect(slot(this, &FormParagraph::show));
|
d->showParagraph.connect(slot(this, &FormParagraph::show));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,6 +112,9 @@ void FormParagraph::build()
|
|||||||
// the tabbed folder
|
// the tabbed folder
|
||||||
dialog_.reset(build_paragraph());
|
dialog_.reset(build_paragraph());
|
||||||
|
|
||||||
|
// Allow the base class to control messages
|
||||||
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
fl_addto_choice(dialog_->choice_space_above,
|
fl_addto_choice(dialog_->choice_space_above,
|
||||||
_(" None | Defskip | Smallskip "
|
_(" None | Defskip | Smallskip "
|
||||||
"| Medskip | Bigskip | VFill | Length "));
|
"| Medskip | Bigskip | VFill | Length "));
|
||||||
@ -123,7 +127,7 @@ void FormParagraph::build()
|
|||||||
|
|
||||||
fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return(dialog_->input_labelwidth, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_labelwidth, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
|
||||||
fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
|
fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
|
||||||
|
|
||||||
@ -151,7 +155,7 @@ void FormParagraph::build()
|
|||||||
|
|
||||||
string units = getStringFromVector(units_vec, "|");
|
string units = getStringFromVector(units_vec, "|");
|
||||||
|
|
||||||
fl_addto_choice(dialog_->choice_value_space_above, units.c_str());
|
fl_addto_choice(dialog_->choice_value_space_above, units.c_str());
|
||||||
fl_addto_choice(dialog_->choice_value_space_below, units.c_str());
|
fl_addto_choice(dialog_->choice_value_space_below, units.c_str());
|
||||||
|
|
||||||
// Manage the ok, apply, restore and cancel/close buttons
|
// Manage the ok, apply, restore and cancel/close buttons
|
||||||
@ -181,17 +185,63 @@ void FormParagraph::build()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
VSpace setVSpaceFromWidgets(FL_OBJECT * choice_type,
|
||||||
|
FL_OBJECT * input_length,
|
||||||
|
FL_OBJECT * choice_length,
|
||||||
|
FL_OBJECT * check_keep)
|
||||||
|
{
|
||||||
|
// Paranoia check!
|
||||||
|
lyx::Assert(choice_type && choice_type->objclass == FL_CHOICE &&
|
||||||
|
input_length && input_length->objclass == FL_INPUT &&
|
||||||
|
choice_length && choice_length->objclass == FL_CHOICE &&
|
||||||
|
check_keep && check_keep->objclass == FL_CHECKBUTTON);
|
||||||
|
|
||||||
|
VSpace space;
|
||||||
|
|
||||||
|
switch (fl_get_choice(choice_type)) {
|
||||||
|
case 1:
|
||||||
|
space = VSpace(VSpace::NONE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
space = VSpace(VSpace::DEFSKIP);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
space = VSpace(VSpace::SMALLSKIP);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
space = VSpace(VSpace::MEDSKIP);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
space = VSpace(VSpace::BIGSKIP);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
space = VSpace(VSpace::VFILL);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
|
string const length =
|
||||||
|
getLengthFromWidgets(input_length, choice_length);
|
||||||
|
space = VSpace(LyXGlueLength(length));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fl_get_button(check_keep))
|
||||||
|
space.setKeep(true);
|
||||||
|
|
||||||
|
return space;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
void FormParagraph::apply()
|
void FormParagraph::apply()
|
||||||
{
|
{
|
||||||
if (!lv_->view()->available() || !dialog_.get())
|
if (!lv_->view()->available() || !dialog_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VSpace space_top;
|
|
||||||
VSpace space_bottom;
|
|
||||||
LyXAlignment align;
|
|
||||||
string labelwidthstring;
|
|
||||||
bool noindent;
|
|
||||||
|
|
||||||
// If a vspace kind is "Length" but there's no text in
|
// If a vspace kind is "Length" but there's no text in
|
||||||
// the input field, reset the kind to "None".
|
// the input field, reset the kind to "None".
|
||||||
if ((fl_get_choice(dialog_->choice_space_above) == 7) &&
|
if ((fl_get_choice(dialog_->choice_space_above) == 7) &&
|
||||||
@ -206,70 +256,24 @@ void FormParagraph::apply()
|
|||||||
fl_set_choice(dialog_->choice_space_below, 1);
|
fl_set_choice(dialog_->choice_space_below, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool line_top = fl_get_button(dialog_->check_lines_top);
|
bool const line_top = fl_get_button(dialog_->check_lines_top);
|
||||||
bool line_bottom = fl_get_button(dialog_->check_lines_bottom);
|
bool const line_bottom = fl_get_button(dialog_->check_lines_bottom);
|
||||||
bool pagebreak_top = fl_get_button(dialog_->check_pagebreaks_top);
|
bool const pagebreak_top = fl_get_button(dialog_->check_pagebreaks_top);
|
||||||
bool pagebreak_bottom = fl_get_button(dialog_->check_pagebreaks_bottom);
|
bool const pagebreak_bottom = fl_get_button(dialog_->check_pagebreaks_bottom);
|
||||||
|
|
||||||
switch (fl_get_choice(dialog_->choice_space_above)) {
|
VSpace const space_top =
|
||||||
case 1:
|
setVSpaceFromWidgets(dialog_->choice_space_above,
|
||||||
space_top = VSpace(VSpace::NONE);
|
dialog_->input_space_above,
|
||||||
break;
|
dialog_->choice_value_space_above,
|
||||||
case 2:
|
dialog_->check_space_above);
|
||||||
space_top = VSpace(VSpace::DEFSKIP);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
space_top = VSpace(VSpace::SMALLSKIP);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
space_top = VSpace(VSpace::MEDSKIP);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
space_top = VSpace(VSpace::BIGSKIP);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
space_top = VSpace(VSpace::VFILL);
|
|
||||||
break;
|
|
||||||
case 7: {
|
|
||||||
string const length =
|
|
||||||
getLengthFromWidgets(dialog_->input_space_above,
|
|
||||||
dialog_->choice_value_space_above);
|
|
||||||
space_top = VSpace(LyXGlueLength(length));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fl_get_button(dialog_->check_space_above))
|
VSpace const space_bottom =
|
||||||
space_top.setKeep(true);
|
setVSpaceFromWidgets(dialog_->choice_space_below,
|
||||||
switch (fl_get_choice(dialog_->choice_space_below)) {
|
dialog_->input_space_below,
|
||||||
case 1:
|
dialog_->choice_value_space_below,
|
||||||
space_bottom = VSpace(VSpace::NONE);
|
dialog_->check_space_below);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
space_bottom = VSpace(VSpace::DEFSKIP);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
space_bottom = VSpace(VSpace::SMALLSKIP);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
space_bottom = VSpace(VSpace::MEDSKIP);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
space_bottom = VSpace(VSpace::BIGSKIP);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
space_bottom = VSpace(VSpace::VFILL);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
string const length =
|
|
||||||
getLengthFromWidgets(dialog_->input_space_below,
|
|
||||||
dialog_->choice_value_space_below);
|
|
||||||
space_bottom = VSpace(LyXGlueLength(length));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (fl_get_button (dialog_->check_space_below))
|
|
||||||
space_bottom.setKeep (true);
|
|
||||||
|
|
||||||
|
LyXAlignment align;
|
||||||
if (fl_get_button(dialog_->radio_align_left))
|
if (fl_get_button(dialog_->radio_align_left))
|
||||||
align = LYX_ALIGN_LEFT;
|
align = LYX_ALIGN_LEFT;
|
||||||
else if (fl_get_button(dialog_->radio_align_right))
|
else if (fl_get_button(dialog_->radio_align_right))
|
||||||
@ -279,8 +283,11 @@ void FormParagraph::apply()
|
|||||||
else
|
else
|
||||||
align = LYX_ALIGN_BLOCK;
|
align = LYX_ALIGN_BLOCK;
|
||||||
|
|
||||||
labelwidthstring = fl_get_input(dialog_->input_labelwidth);
|
string const labelwidthstring =
|
||||||
noindent = fl_get_button(dialog_->check_noindent);
|
getStringFromInput(dialog_->input_labelwidth);
|
||||||
|
|
||||||
|
bool const noindent = fl_get_button(dialog_->check_noindent);
|
||||||
|
|
||||||
Spacing::Space linespacing = Spacing::Default;
|
Spacing::Space linespacing = Spacing::Default;
|
||||||
string other_linespacing;
|
string other_linespacing;
|
||||||
switch (fl_get_choice(dialog_->choice_linespacing)) {
|
switch (fl_get_choice(dialog_->choice_linespacing)) {
|
||||||
@ -295,11 +302,11 @@ void FormParagraph::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Spacing const spacing(linespacing, other_linespacing);
|
Spacing const spacing(linespacing, other_linespacing);
|
||||||
|
|
||||||
LyXText * text(lv_->view()->getLyXText());
|
LyXText * text(lv_->view()->getLyXText());
|
||||||
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
|
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
|
||||||
pagebreak_bottom, space_top, space_bottom, spacing,
|
pagebreak_bottom, space_top, space_bottom, spacing,
|
||||||
align, labelwidthstring, noindent);
|
align, labelwidthstring, noindent);
|
||||||
|
|
||||||
|
|
||||||
// Actually apply these settings
|
// Actually apply these settings
|
||||||
lv_->view()->update(text,
|
lv_->view()->update(text,
|
||||||
@ -309,6 +316,66 @@ void FormParagraph::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void setWidgetsFromVSpace(VSpace const & space,
|
||||||
|
FL_OBJECT * choice_type,
|
||||||
|
FL_OBJECT * input_length,
|
||||||
|
FL_OBJECT * choice_length,
|
||||||
|
FL_OBJECT * check_keep)
|
||||||
|
{
|
||||||
|
// Paranoia check!
|
||||||
|
lyx::Assert(choice_type && choice_type->objclass == FL_CHOICE &&
|
||||||
|
input_length && input_length->objclass == FL_INPUT &&
|
||||||
|
choice_length && choice_length->objclass == FL_CHOICE &&
|
||||||
|
check_keep && check_keep->objclass == FL_CHECKBUTTON);
|
||||||
|
|
||||||
|
fl_set_input(input_length, "");
|
||||||
|
setEnabled(input_length, false);
|
||||||
|
setEnabled(choice_length, false);
|
||||||
|
|
||||||
|
switch (space.kind()) {
|
||||||
|
case VSpace::NONE:
|
||||||
|
fl_set_choice(choice_type, 1);
|
||||||
|
break;
|
||||||
|
case VSpace::DEFSKIP:
|
||||||
|
fl_set_choice(choice_type, 2);
|
||||||
|
break;
|
||||||
|
case VSpace::SMALLSKIP:
|
||||||
|
fl_set_choice(choice_type, 3);
|
||||||
|
break;
|
||||||
|
case VSpace::MEDSKIP:
|
||||||
|
fl_set_choice(choice_type, 4);
|
||||||
|
break;
|
||||||
|
case VSpace::BIGSKIP:
|
||||||
|
fl_set_choice(choice_type, 5);
|
||||||
|
break;
|
||||||
|
case VSpace::VFILL:
|
||||||
|
fl_set_choice(choice_type, 6);
|
||||||
|
break;
|
||||||
|
case VSpace::LENGTH:
|
||||||
|
{
|
||||||
|
fl_set_choice(choice_type, 7);
|
||||||
|
|
||||||
|
setEnabled(input_length, true);
|
||||||
|
setEnabled(choice_length, true);
|
||||||
|
|
||||||
|
bool const metric = lyxrc.default_papersize > 3;
|
||||||
|
string const default_unit = metric ? "cm" : "in";
|
||||||
|
string const length = space.length().asString();
|
||||||
|
|
||||||
|
updateWidgetsFromLengthString(input_length, choice_length,
|
||||||
|
length, default_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fl_set_button(check_keep, space.keep());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
void FormParagraph::update()
|
void FormParagraph::update()
|
||||||
{
|
{
|
||||||
if (!dialog_.get())
|
if (!dialog_.get())
|
||||||
@ -317,22 +384,21 @@ void FormParagraph::update()
|
|||||||
// Do this first; some objects may be de/activated subsequently.
|
// Do this first; some objects may be de/activated subsequently.
|
||||||
bc_.readOnly(lv_->buffer()->isReadonly());
|
bc_.readOnly(lv_->buffer()->isReadonly());
|
||||||
|
|
||||||
Buffer * buf = lv_->view()->buffer();
|
|
||||||
|
|
||||||
/// Record the paragraph
|
/// Record the paragraph
|
||||||
par_ = getCurrentParagraph();
|
par_ = getCurrentParagraph();
|
||||||
|
|
||||||
fl_set_input(dialog_->input_labelwidth,
|
fl_set_input(dialog_->input_labelwidth,
|
||||||
par_->getLabelWidthString().c_str());
|
par_->getLabelWidthString().c_str());
|
||||||
setEnabled(dialog_->input_labelwidth,
|
setEnabled(dialog_->input_labelwidth,
|
||||||
(par_->getLabelWidthString() != _("Senseless with this layout!")));
|
(par_->getLabelWidthString() != _("Senseless with this layout!")));
|
||||||
|
|
||||||
fl_set_button(dialog_->radio_align_right, 0);
|
fl_set_button(dialog_->radio_align_right, 0);
|
||||||
fl_set_button(dialog_->radio_align_left, 0);
|
fl_set_button(dialog_->radio_align_left, 0);
|
||||||
fl_set_button(dialog_->radio_align_center, 0);
|
fl_set_button(dialog_->radio_align_center, 0);
|
||||||
fl_set_button(dialog_->radio_align_block, 0);
|
fl_set_button(dialog_->radio_align_block, 0);
|
||||||
|
|
||||||
LyXTextClass const & tclass = textclasslist[buf->params.textclass];
|
LyXTextClass const & tclass =
|
||||||
|
textclasslist[lv_->view()->buffer()->params.textclass];
|
||||||
|
|
||||||
int align = par_->getAlign();
|
int align = par_->getAlign();
|
||||||
if (align == LYX_ALIGN_LAYOUT)
|
if (align == LYX_ALIGN_LAYOUT)
|
||||||
@ -365,15 +431,15 @@ void FormParagraph::update()
|
|||||||
setEnabled(dialog_->check_pagebreaks_bottom, !par_->inInset());
|
setEnabled(dialog_->check_pagebreaks_bottom, !par_->inInset());
|
||||||
|
|
||||||
fl_set_button(dialog_->check_lines_top,
|
fl_set_button(dialog_->check_lines_top,
|
||||||
par_->params().lineTop());
|
par_->params().lineTop());
|
||||||
fl_set_button(dialog_->check_lines_bottom,
|
fl_set_button(dialog_->check_lines_bottom,
|
||||||
par_->params().lineBottom());
|
par_->params().lineBottom());
|
||||||
fl_set_button(dialog_->check_pagebreaks_top,
|
fl_set_button(dialog_->check_pagebreaks_top,
|
||||||
par_->params().pagebreakTop());
|
par_->params().pagebreakTop());
|
||||||
fl_set_button(dialog_->check_pagebreaks_bottom,
|
fl_set_button(dialog_->check_pagebreaks_bottom,
|
||||||
par_->params().pagebreakBottom());
|
par_->params().pagebreakBottom());
|
||||||
fl_set_button(dialog_->check_noindent,
|
fl_set_button(dialog_->check_noindent,
|
||||||
par_->params().noindent());
|
par_->params().noindent());
|
||||||
|
|
||||||
int linespacing;
|
int linespacing;
|
||||||
Spacing const space = par_->params().spacing();
|
Spacing const space = par_->params().spacing();
|
||||||
@ -396,95 +462,76 @@ void FormParagraph::update()
|
|||||||
setEnabled(dialog_->input_linespacing, false);
|
setEnabled(dialog_->input_linespacing, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_set_input (dialog_->input_space_above, "");
|
setWidgetsFromVSpace(par_->params().spaceTop(),
|
||||||
|
dialog_->choice_space_above,
|
||||||
|
dialog_->input_space_above,
|
||||||
|
dialog_->choice_value_space_above,
|
||||||
|
dialog_->check_space_above);
|
||||||
|
|
||||||
setEnabled(dialog_->input_space_above, false);
|
setWidgetsFromVSpace(par_->params().spaceBottom(),
|
||||||
setEnabled(dialog_->choice_value_space_above, false);
|
dialog_->choice_space_below,
|
||||||
switch (par_->params().spaceTop().kind()) {
|
dialog_->input_space_below,
|
||||||
case VSpace::NONE:
|
dialog_->choice_value_space_below,
|
||||||
fl_set_choice (dialog_->choice_space_above, 1);
|
dialog_->check_space_below);
|
||||||
break;
|
|
||||||
case VSpace::DEFSKIP:
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 2);
|
|
||||||
break;
|
|
||||||
case VSpace::SMALLSKIP:
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 3);
|
|
||||||
break;
|
|
||||||
case VSpace::MEDSKIP:
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 4);
|
|
||||||
break;
|
|
||||||
case VSpace::BIGSKIP:
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 5);
|
|
||||||
break;
|
|
||||||
case VSpace::VFILL:
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 6);
|
|
||||||
break;
|
|
||||||
case VSpace::LENGTH: {
|
|
||||||
fl_set_choice (dialog_->choice_space_above, 7);
|
|
||||||
setEnabled(dialog_->input_space_above, true);
|
|
||||||
setEnabled(dialog_->choice_value_space_above, true);
|
|
||||||
bool const metric = lyxrc.default_papersize > 3;
|
|
||||||
string const default_unit = metric ? "cm" : "in";
|
|
||||||
string const length = par_->params().spaceTop().length().asString();
|
|
||||||
updateWidgetsFromLengthString(dialog_->input_space_above,
|
|
||||||
dialog_->choice_value_space_above,
|
|
||||||
length, default_unit);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fl_set_button (dialog_->check_space_above,
|
|
||||||
par_->params().spaceTop().keep());
|
|
||||||
fl_set_input (dialog_->input_space_below, "");
|
|
||||||
|
|
||||||
setEnabled(dialog_->input_space_below, false);
|
|
||||||
setEnabled(dialog_->choice_value_space_below, false);
|
|
||||||
switch (par_->params().spaceBottom().kind()) {
|
|
||||||
case VSpace::NONE:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 1);
|
|
||||||
break;
|
|
||||||
case VSpace::DEFSKIP:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 2);
|
|
||||||
break;
|
|
||||||
case VSpace::SMALLSKIP:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 3);
|
|
||||||
break;
|
|
||||||
case VSpace::MEDSKIP:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 4);
|
|
||||||
break;
|
|
||||||
case VSpace::BIGSKIP:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 5);
|
|
||||||
break;
|
|
||||||
case VSpace::VFILL:
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 6);
|
|
||||||
break;
|
|
||||||
case VSpace::LENGTH: {
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 7);
|
|
||||||
setEnabled(dialog_->input_space_below, true);
|
|
||||||
setEnabled(dialog_->choice_value_space_below, true);
|
|
||||||
bool const metric = lyxrc.default_papersize > 3;
|
|
||||||
string const default_unit = metric ? "cm" : "in";
|
|
||||||
string const length =
|
|
||||||
par_->params().spaceBottom().length().asString();
|
|
||||||
updateWidgetsFromLengthString(dialog_->input_space_below,
|
|
||||||
dialog_->choice_value_space_below,
|
|
||||||
length, default_unit);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fl_set_button(dialog_->check_space_below,
|
|
||||||
par_->params().spaceBottom().keep());
|
|
||||||
fl_set_button(dialog_->check_noindent,
|
fl_set_button(dialog_->check_noindent,
|
||||||
par_->params().noindent());
|
par_->params().noindent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void synchronizeSpaceWidgets(FL_OBJECT * choice_type,
|
||||||
|
FL_OBJECT * input_length,
|
||||||
|
FL_OBJECT * choice_length,
|
||||||
|
bool readonly)
|
||||||
|
{
|
||||||
|
// Paranoia check!
|
||||||
|
lyx::Assert(choice_type && choice_type->objclass == FL_CHOICE &&
|
||||||
|
input_length && input_length->objclass == FL_INPUT &&
|
||||||
|
choice_length && choice_length->objclass == FL_CHOICE);
|
||||||
|
|
||||||
|
if (fl_get_choice(choice_type) != 7) {
|
||||||
|
fl_set_input(input_length, "");
|
||||||
|
setEnabled(input_length, false);
|
||||||
|
setEnabled(choice_length, false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
setEnabled(input_length, !readonly);
|
||||||
|
setEnabled(choice_length, !readonly);
|
||||||
|
|
||||||
|
string const length = getStringFromInput(input_length);
|
||||||
|
|
||||||
|
if (strip(length).empty()) {
|
||||||
|
bool const metric = lyxrc.default_papersize > 3;
|
||||||
|
int const default_unit = metric ? 8 : 9;
|
||||||
|
|
||||||
|
fl_set_choice(choice_length, default_unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool validSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
|
||||||
|
{
|
||||||
|
// Paranoia check!
|
||||||
|
lyx::Assert(choice_type && choice_type->objclass == FL_CHOICE &&
|
||||||
|
input_length && input_length->objclass == FL_INPUT);
|
||||||
|
|
||||||
|
if (fl_get_choice(choice_type) != 7)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
string const input = getStringFromInput(input_length);
|
||||||
|
return (input.empty() ||
|
||||||
|
isValidGlueLength(input) ||
|
||||||
|
isStrDbl(input));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
bool FormParagraph::input(FL_OBJECT * ob, long)
|
bool FormParagraph::input(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
bool valid = true;
|
clearMessage();
|
||||||
|
|
||||||
fl_hide_object(dialog_->text_warning);
|
|
||||||
|
|
||||||
// First check the buttons which are exclusive and you have to
|
// First check the buttons which are exclusive and you have to
|
||||||
// check only the actuall de/activated button.
|
// check only the actuall de/activated button.
|
||||||
@ -493,77 +540,42 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
|
|||||||
// impossible to commit senseless data.
|
// impossible to commit senseless data.
|
||||||
|
|
||||||
if (ob == dialog_->choice_space_above) {
|
if (ob == dialog_->choice_space_above) {
|
||||||
if (fl_get_choice (dialog_->choice_space_above) != 7) {
|
synchronizeSpaceWidgets(dialog_->choice_space_above,
|
||||||
fl_set_input(dialog_->input_space_above, "");
|
dialog_->input_space_above,
|
||||||
setEnabled(dialog_->input_space_above, false);
|
dialog_->choice_value_space_above,
|
||||||
setEnabled(dialog_->choice_value_space_above, false);
|
lv_->buffer()->isReadonly());
|
||||||
} else {
|
|
||||||
setEnabled(dialog_->input_space_above,
|
|
||||||
!lv_->buffer()->isReadonly());
|
|
||||||
setEnabled(dialog_->choice_value_space_above,
|
|
||||||
!lv_->buffer()->isReadonly());
|
|
||||||
bool const metric = lyxrc.default_papersize > 3;
|
|
||||||
int const default_unit = metric ? 8 : 9;
|
|
||||||
if (strip(fl_get_input(dialog_->input_space_above)).empty())
|
|
||||||
fl_set_choice(dialog_->choice_value_space_above, default_unit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ob == dialog_->choice_space_below) {
|
if (ob == dialog_->choice_space_below) {
|
||||||
if (fl_get_choice (dialog_->choice_space_below) != 7) {
|
synchronizeSpaceWidgets(dialog_->choice_space_below,
|
||||||
fl_set_input(dialog_->input_space_below, "");
|
dialog_->input_space_below,
|
||||||
setEnabled(dialog_->input_space_below, false);
|
dialog_->choice_value_space_below,
|
||||||
setEnabled(dialog_->choice_value_space_below, false);
|
lv_->buffer()->isReadonly());
|
||||||
} else {
|
|
||||||
setEnabled(dialog_->input_space_below,
|
|
||||||
!lv_->buffer()->isReadonly());
|
|
||||||
setEnabled(dialog_->choice_value_space_below,
|
|
||||||
!lv_->buffer()->isReadonly());
|
|
||||||
bool const metric = lyxrc.default_papersize > 3;
|
|
||||||
int const default_unit = metric ? 8 : 9;
|
|
||||||
if (strip(fl_get_input(dialog_->input_space_below)).empty())
|
|
||||||
fl_set_choice(dialog_->choice_value_space_below, default_unit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Display a warning if the input is senseless
|
||||||
// warnings if input is senseless
|
bool valid = (validSpaceWidgets(dialog_->choice_space_above,
|
||||||
//
|
dialog_->input_space_above) &&
|
||||||
string input = fl_get_input(dialog_->input_space_above);
|
validSpaceWidgets(dialog_->choice_space_below,
|
||||||
bool invalid = false;
|
dialog_->input_space_below));
|
||||||
|
|
||||||
if (fl_get_choice(dialog_->choice_space_above) == 7)
|
if (!valid) {
|
||||||
invalid = !input.empty() &&
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
||||||
!isValidGlueLength(input) &&
|
|
||||||
!isStrDbl(input);
|
|
||||||
|
|
||||||
input = fl_get_input(dialog_->input_space_below);
|
|
||||||
|
|
||||||
if (fl_get_choice(dialog_->choice_space_below) == 7)
|
|
||||||
invalid = invalid ||
|
|
||||||
(!input.empty() && !isValidGlueLength(input) && !isStrDbl(input));
|
|
||||||
|
|
||||||
if (ob == dialog_->input_space_above || ob == dialog_->input_space_below) {
|
|
||||||
if (invalid) {
|
|
||||||
fl_set_object_label(dialog_->text_warning,
|
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
fl_hide_object(dialog_->text_warning);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fl_get_choice (dialog_->choice_linespacing) == 5)
|
int const choice_spacing = fl_get_choice(dialog_->choice_linespacing);
|
||||||
|
|
||||||
|
if (choice_spacing == 5)
|
||||||
setEnabled(dialog_->input_linespacing, true);
|
setEnabled(dialog_->input_linespacing, true);
|
||||||
else {
|
else {
|
||||||
|
fl_set_input(dialog_->input_linespacing, "");
|
||||||
setEnabled(dialog_->input_linespacing, false);
|
setEnabled(dialog_->input_linespacing, false);
|
||||||
fl_set_input (dialog_->input_linespacing, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double spacing(strToDbl(fl_get_input(dialog_->input_linespacing)));
|
double const spacing =
|
||||||
|
strToDbl(getStringFromInput(dialog_->input_linespacing));
|
||||||
|
|
||||||
if (fl_get_choice(dialog_->choice_linespacing) == 5 && int(spacing) == 0)
|
if (choice_spacing == 5 && int(spacing) == 0)
|
||||||
valid = false;
|
valid = false;
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
|
@ -111,6 +111,9 @@ void FormTabular::build()
|
|||||||
{
|
{
|
||||||
dialog_.reset(build_tabular());
|
dialog_.reset(build_tabular());
|
||||||
|
|
||||||
|
// Allow the base class to control messages
|
||||||
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
setPrehandler(dialog_->input_tabular_column);
|
setPrehandler(dialog_->input_tabular_column);
|
||||||
setPrehandler(dialog_->input_tabular_row);
|
setPrehandler(dialog_->input_tabular_row);
|
||||||
|
|
||||||
@ -187,7 +190,7 @@ void FormTabular::update()
|
|||||||
int cell = inset_->getActCell();
|
int cell = inset_->getActCell();
|
||||||
actCell_ = cell;
|
actCell_ = cell;
|
||||||
int column = tabular->column_of_cell(cell) + 1;
|
int column = tabular->column_of_cell(cell) + 1;
|
||||||
fl_set_object_label(dialog_->text_warning, "");
|
clearMessage();
|
||||||
fl_activate_object(column_options_->input_special_alignment);
|
fl_activate_object(column_options_->input_special_alignment);
|
||||||
fl_activate_object(cell_options_->input_special_multialign);
|
fl_activate_object(cell_options_->input_special_multialign);
|
||||||
fl_activate_object(column_options_->input_column_width);
|
fl_activate_object(column_options_->input_column_width);
|
||||||
@ -555,9 +558,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
|
|
||||||
if (actCell_ != cell) {
|
if (actCell_ != cell) {
|
||||||
update();
|
update();
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Wrong Cursor position, updated window"));
|
||||||
_("Warning: Wrong Cursor position, updated window"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// No point in processing directives that you can't do anything with
|
// No point in processing directives that you can't do anything with
|
||||||
@ -578,14 +579,14 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
string const input =
|
string const input =
|
||||||
fl_get_input(column_options_->input_column_width);
|
fl_get_input(column_options_->input_column_width);
|
||||||
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
update(); // update for alignment
|
|
||||||
return true;
|
update(); // update for alignment
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ob == cell_options_->input_mcolumn_width) ||
|
if ((ob == cell_options_->input_mcolumn_width) ||
|
||||||
(ob == cell_options_->choice_value_mcolumn_width))
|
(ob == cell_options_->choice_value_mcolumn_width))
|
||||||
{
|
{
|
||||||
@ -598,9 +599,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
string const input =
|
string const input =
|
||||||
fl_get_input(cell_options_->input_mcolumn_width);
|
fl_get_input(cell_options_->input_mcolumn_width);
|
||||||
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
|
||||||
fl_show_object(dialog_->text_warning);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
update(); // update for alignment
|
update(); // update for alignment
|
||||||
|
Loading…
Reference in New Issue
Block a user