2000-09-25 15:59:27 +00:00
|
|
|
|
/* This file is part of
|
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
|
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
2000-09-25 15:59:27 +00:00
|
|
|
|
*
|
|
|
|
|
* @author J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
|
|
|
|
*======================================================*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG_
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
|
|
|
|
|
#include "FormParagraph.h"
|
|
|
|
|
#include "form_paragraph.h"
|
|
|
|
|
#include "Dialogs.h"
|
2001-08-16 10:14:48 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2000-09-25 15:59:27 +00:00
|
|
|
|
#include "Liason.h"
|
|
|
|
|
#include "LyXView.h"
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "lyxtext.h"
|
2001-03-05 19:02:40 +00:00
|
|
|
|
#include "xforms_helpers.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "BufferView.h"
|
2001-08-16 10:14:48 +00:00
|
|
|
|
#include "Spacing.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "ParagraphParameters.h"
|
2001-08-16 10:14:48 +00:00
|
|
|
|
#include "input_validators.h"
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
|
|
|
|
using Liason::setMinibuffer;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
using SigC::slot;
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-05-03 14:31:33 +00:00
|
|
|
|
|
2000-09-25 15:59:27 +00:00
|
|
|
|
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
|
2001-06-15 16:18:43 +00:00
|
|
|
|
: FormBaseBD(lv, d, _("Paragraph Layout")), par_(0)
|
2000-09-25 15:59:27 +00:00
|
|
|
|
{
|
2001-04-03 14:30:58 +00:00
|
|
|
|
// let the dialog be shown
|
2000-09-25 15:59:27 +00:00
|
|
|
|
// This is a permanent connection so we won't bother
|
|
|
|
|
// storing a copy because we won't be disconnecting.
|
2001-06-15 16:18:43 +00:00
|
|
|
|
d->showParagraph.connect(slot(this, &FormParagraph::show));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormParagraph::connect()
|
|
|
|
|
{
|
|
|
|
|
cp_ = d_->updateParagraph
|
|
|
|
|
.connect(slot(this, &FormParagraph::changedParagraph));
|
|
|
|
|
FormBaseBD::connect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormParagraph::disconnect()
|
|
|
|
|
{
|
|
|
|
|
cp_.disconnect();
|
|
|
|
|
FormBaseBD::disconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
Paragraph const * FormParagraph::getCurrentParagraph() const
|
2001-06-15 16:18:43 +00:00
|
|
|
|
{
|
|
|
|
|
LyXText * text = 0;
|
|
|
|
|
|
|
|
|
|
if (lv_->view()->theLockingInset())
|
|
|
|
|
text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
|
|
|
|
|
if (!text)
|
|
|
|
|
text = lv_->view()->text;
|
|
|
|
|
return text->cursor.par();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormParagraph::changedParagraph()
|
|
|
|
|
{
|
|
|
|
|
/// Record the paragraph
|
2001-06-25 00:06:33 +00:00
|
|
|
|
Paragraph const * const p = getCurrentParagraph();
|
2001-06-15 16:18:43 +00:00
|
|
|
|
if (p == 0 || p == par_)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// For now don't bother checking if the params are different,
|
|
|
|
|
// just activate the Apply button
|
|
|
|
|
bc().valid();
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
|
void FormParagraph::redraw()
|
|
|
|
|
{
|
|
|
|
|
if( form() && form()->visible )
|
|
|
|
|
fl_redraw_form( form() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-10 01:33:42 +00:00
|
|
|
|
FL_FORM * FormParagraph::form() const
|
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
|
if (dialog_.get()) return dialog_->form;
|
2000-10-10 01:33:42 +00:00
|
|
|
|
return 0;
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormParagraph::build()
|
|
|
|
|
{
|
|
|
|
|
// the tabbed folder
|
2001-08-29 12:52:41 +00:00
|
|
|
|
dialog_.reset(build_paragraph());
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_addto_choice(dialog_->choice_space_above,
|
2000-09-25 15:59:27 +00:00
|
|
|
|
_(" None | Defskip | Smallskip "
|
|
|
|
|
"| Medskip | Bigskip | VFill | Length "));
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_addto_choice(dialog_->choice_space_below,
|
2000-09-25 15:59:27 +00:00
|
|
|
|
_(" None | Defskip | Smallskip "
|
|
|
|
|
"| Medskip | Bigskip | VFill | Length "));
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_addto_choice(dialog_->choice_linespacing,
|
2001-08-20 19:08:46 +00:00
|
|
|
|
_(" Default | Single | OneHalf | Double | Other "));
|
2001-08-16 10:14:48 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
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_labelwidth, FL_RETURN_CHANGED);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
// Manage the ok, apply, restore and cancel/close buttons
|
|
|
|
|
bc_.setOK(dialog_->button_ok);
|
|
|
|
|
bc_.setApply(dialog_->button_apply);
|
|
|
|
|
bc_.setCancel(dialog_->button_cancel);
|
|
|
|
|
bc_.setRestore(dialog_->button_restore);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
bc_.addReadOnly (dialog_->group_radio_alignment);
|
|
|
|
|
// bc_.addReadOnly (dialog_->radio_align_right);
|
|
|
|
|
// bc_.addReadOnly (dialog_->radio_align_left);
|
|
|
|
|
// bc_.addReadOnly (dialog_->radio_align_block);
|
|
|
|
|
// bc_.addReadOnly (dialog_->radio_align_center);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_lines_top);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_lines_bottom);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_pagebreaks_top);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_pagebreaks_bottom);
|
|
|
|
|
bc_.addReadOnly (dialog_->choice_space_above);
|
|
|
|
|
bc_.addReadOnly (dialog_->input_space_above);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_space_above);
|
|
|
|
|
bc_.addReadOnly (dialog_->choice_space_below);
|
|
|
|
|
bc_.addReadOnly (dialog_->input_space_below);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_space_below);
|
|
|
|
|
bc_.addReadOnly (dialog_->choice_linespacing);
|
|
|
|
|
bc_.addReadOnly (dialog_->input_linespacing);
|
|
|
|
|
bc_.addReadOnly (dialog_->check_noindent);
|
|
|
|
|
bc_.addReadOnly (dialog_->input_labelwidth);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
void FormParagraph::apply()
|
2000-10-10 01:33:42 +00:00
|
|
|
|
{
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (!lv_->view()->available() || !dialog_.get())
|
|
|
|
|
return;
|
2000-10-10 01:33:42 +00:00
|
|
|
|
|
2000-09-25 15:59:27 +00:00
|
|
|
|
VSpace space_top, space_bottom;
|
|
|
|
|
LyXAlignment align;
|
|
|
|
|
string labelwidthstring;
|
|
|
|
|
bool noindent;
|
|
|
|
|
|
|
|
|
|
// If a vspace kind is "Length" but there's no text in
|
|
|
|
|
// the input field, reset the kind to "None".
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if ((fl_get_choice (dialog_->choice_space_above) == 7) &&
|
|
|
|
|
!*(fl_get_input (dialog_->input_space_above)))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
{
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if ((fl_get_choice (dialog_->choice_space_below) == 7) &&
|
|
|
|
|
!*(fl_get_input (dialog_->input_space_below)))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
{
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
bool line_top = fl_get_button(dialog_->check_lines_top);
|
|
|
|
|
bool line_bottom = fl_get_button(dialog_->check_lines_bottom);
|
|
|
|
|
bool pagebreak_top = fl_get_button(dialog_->check_pagebreaks_top);
|
|
|
|
|
bool pagebreak_bottom = fl_get_button(dialog_->check_pagebreaks_bottom);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
switch (fl_get_choice (dialog_->choice_space_above)) {
|
2000-09-25 15:59:27 +00:00
|
|
|
|
case 1:
|
|
|
|
|
space_top = VSpace(VSpace::NONE);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
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:
|
2000-10-13 05:57:05 +00:00
|
|
|
|
space_top =
|
2001-08-29 12:52:41 +00:00
|
|
|
|
VSpace(LyXGlueLength(fl_get_input(dialog_->input_space_above)));
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_button (dialog_->check_space_above))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
space_top.setKeep (true);
|
2001-08-29 12:52:41 +00:00
|
|
|
|
switch (fl_get_choice (dialog_->choice_space_below)) {
|
2000-09-25 15:59:27 +00:00
|
|
|
|
case 1:
|
|
|
|
|
space_bottom = VSpace(VSpace::NONE);
|
|
|
|
|
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:
|
2000-10-13 05:57:05 +00:00
|
|
|
|
space_bottom =
|
2001-08-29 12:52:41 +00:00
|
|
|
|
VSpace(LyXGlueLength(fl_get_input(dialog_->input_space_below)));
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_button (dialog_->check_space_below))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
space_bottom.setKeep (true);
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_button(dialog_->radio_align_left))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
align = LYX_ALIGN_LEFT;
|
2001-08-29 12:52:41 +00:00
|
|
|
|
else if (fl_get_button(dialog_->radio_align_right))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
align = LYX_ALIGN_RIGHT;
|
2001-08-29 12:52:41 +00:00
|
|
|
|
else if (fl_get_button(dialog_->radio_align_center))
|
2000-09-25 15:59:27 +00:00
|
|
|
|
align = LYX_ALIGN_CENTER;
|
|
|
|
|
else
|
|
|
|
|
align = LYX_ALIGN_BLOCK;
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
labelwidthstring = fl_get_input(dialog_->input_labelwidth);
|
|
|
|
|
noindent = fl_get_button(dialog_->check_noindent);
|
2001-08-20 19:08:46 +00:00
|
|
|
|
Spacing::Space linespacing;
|
|
|
|
|
string other_linespacing;
|
2001-08-29 12:52:41 +00:00
|
|
|
|
switch (fl_get_choice(dialog_->choice_linespacing)) {
|
2001-08-20 19:08:46 +00:00
|
|
|
|
case 1: linespacing = Spacing::Default; break;
|
|
|
|
|
case 2: linespacing = Spacing::Single; break;
|
|
|
|
|
case 3: linespacing = Spacing::Onehalf; break;
|
|
|
|
|
case 4: linespacing = Spacing::Double; break;
|
|
|
|
|
case 5:
|
2001-08-16 10:14:48 +00:00
|
|
|
|
linespacing = Spacing::Other;
|
2001-08-29 12:52:41 +00:00
|
|
|
|
other_linespacing = fl_get_input(dialog_->input_linespacing);
|
2001-08-16 10:14:48 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-16 10:14:48 +00:00
|
|
|
|
Spacing const spacing(linespacing, other_linespacing);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
LyXText * text = 0;
|
2000-10-03 13:55:48 +00:00
|
|
|
|
if (lv_->view()->theLockingInset())
|
|
|
|
|
text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
|
2000-09-25 15:59:27 +00:00
|
|
|
|
if (!text)
|
|
|
|
|
text = lv_->view()->text;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
|
2001-08-16 10:14:48 +00:00
|
|
|
|
pagebreak_bottom, space_top, space_bottom, spacing,
|
|
|
|
|
align, labelwidthstring, noindent);
|
2001-08-29 12:52:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Actually apply these settings
|
|
|
|
|
lv_->view()->update(lv_->view()->text,
|
|
|
|
|
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
|
|
|
|
lv_->buffer()->markDirty();
|
|
|
|
|
setMinibuffer(lv_, _("Paragraph layout set"));
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
void FormParagraph::update()
|
2000-09-25 15:59:27 +00:00
|
|
|
|
{
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (!dialog_.get())
|
2000-09-25 15:59:27 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
// Do this first; some objects may be de/activated subsequently.
|
|
|
|
|
bc_.readOnly(lv_->buffer()->isReadonly());
|
|
|
|
|
|
2000-09-25 15:59:27 +00:00
|
|
|
|
Buffer * buf = lv_->view()->buffer();
|
|
|
|
|
|
2001-06-15 16:18:43 +00:00
|
|
|
|
/// Record the paragraph
|
|
|
|
|
par_ = getCurrentParagraph();
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input(dialog_->input_labelwidth,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->getLabelWidthString().c_str());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->radio_align_right, 0);
|
|
|
|
|
fl_set_button(dialog_->radio_align_left, 0);
|
|
|
|
|
fl_set_button(dialog_->radio_align_center, 0);
|
|
|
|
|
fl_set_button(dialog_->radio_align_block, 0);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
int align = par_->getAlign();
|
2000-09-25 15:59:27 +00:00
|
|
|
|
if (align == LYX_ALIGN_LAYOUT)
|
|
|
|
|
align = textclasslist.Style(buf->params.textclass,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->getLayout()).align;
|
2001-06-02 14:53:35 +00:00
|
|
|
|
|
2000-09-25 15:59:27 +00:00
|
|
|
|
switch (align) {
|
|
|
|
|
case LYX_ALIGN_RIGHT:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->radio_align_right, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case LYX_ALIGN_LEFT:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->radio_align_left, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case LYX_ALIGN_CENTER:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->radio_align_center, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->radio_align_block, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-02 14:53:35 +00:00
|
|
|
|
LyXAlignment alignpos =
|
|
|
|
|
textclasslist.Style(buf->params.textclass,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->getLayout()).alignpossible;
|
2001-06-02 14:53:35 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
setEnabled(dialog_->radio_align_block, bool(alignpos & LYX_ALIGN_BLOCK));
|
|
|
|
|
setEnabled(dialog_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
|
|
|
|
|
setEnabled(dialog_->radio_align_left, bool(alignpos & LYX_ALIGN_LEFT));
|
|
|
|
|
setEnabled(dialog_->radio_align_right, bool(alignpos & LYX_ALIGN_RIGHT));
|
2001-06-02 14:53:35 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_lines_top,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().lineTop());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_lines_bottom,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().lineBottom());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_pagebreaks_top,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().pagebreakTop());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_pagebreaks_bottom,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().pagebreakBottom());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_noindent,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().noindent());
|
2001-05-03 14:31:33 +00:00
|
|
|
|
|
2001-08-16 10:14:48 +00:00
|
|
|
|
int linespacing;
|
|
|
|
|
Spacing space = par_->params().spacing();
|
2001-08-20 19:08:46 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2001-08-16 10:14:48 +00:00
|
|
|
|
switch (lv_->buffer()->params.spacing.getSpace()) {
|
2001-08-20 19:08:46 +00:00
|
|
|
|
case Spacing::Default: linespacing = 1; break;
|
|
|
|
|
case Spacing::Single: linespacing = 2; break;
|
|
|
|
|
case Spacing::Onehalf: linespacing = 3; break;
|
|
|
|
|
case Spacing::Double: linespacing = 4; break;
|
|
|
|
|
case Spacing::Other: linespacing = 5; break;
|
2001-08-16 10:14:48 +00:00
|
|
|
|
}
|
2001-08-20 19:08:46 +00:00
|
|
|
|
*/
|
2001-08-16 10:14:48 +00:00
|
|
|
|
|
|
|
|
|
switch (space.getSpace()) {
|
2001-08-20 19:08:46 +00:00
|
|
|
|
case Spacing::Default: linespacing = 1; break;
|
|
|
|
|
case Spacing::Single: linespacing = 2; break;
|
|
|
|
|
case Spacing::Onehalf: linespacing = 3; break;
|
|
|
|
|
case Spacing::Double: linespacing = 4; break;
|
|
|
|
|
case Spacing::Other: linespacing = 5; break;
|
2001-08-16 10:14:48 +00:00
|
|
|
|
}
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice(dialog_->choice_linespacing, linespacing);
|
2001-08-16 10:14:48 +00:00
|
|
|
|
if (space.getSpace() == Spacing::Other) {
|
|
|
|
|
string sp;
|
|
|
|
|
|
|
|
|
|
if (space.getSpace() == Spacing::Default)
|
|
|
|
|
sp = tostr(lv_->buffer()->params.spacing.getValue());
|
|
|
|
|
else
|
|
|
|
|
sp = tostr(space.getValue());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input(dialog_->input_linespacing, sp.c_str());
|
|
|
|
|
setEnabled(dialog_->input_linespacing, true);
|
2001-08-16 10:14:48 +00:00
|
|
|
|
} else {
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input(dialog_->input_linespacing, "");
|
|
|
|
|
setEnabled(dialog_->input_linespacing, false);
|
2001-08-16 10:14:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input (dialog_->input_space_above, "");
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
switch (par_->params().spaceTop().kind()) {
|
2000-09-25 15:59:27 +00:00
|
|
|
|
case VSpace::NONE:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::DEFSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 2);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::SMALLSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 3);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 4);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 5);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::VFILL:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 6);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::LENGTH:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_above, 7);
|
|
|
|
|
fl_set_input(dialog_->input_space_above, par_->
|
2001-06-25 00:06:33 +00:00
|
|
|
|
params().spaceTop().length().asString().c_str());
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-05-03 14:31:33 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button (dialog_->check_space_above,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().spaceTop().keep());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_input (dialog_->input_space_below, "");
|
2001-05-03 14:31:33 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
switch (par_->params().spaceBottom().kind()) {
|
2000-09-25 15:59:27 +00:00
|
|
|
|
case VSpace::NONE:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 1);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::DEFSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 2);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::SMALLSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 3);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 4);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 5);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::VFILL:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 6);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::LENGTH:
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_choice (dialog_->choice_space_below, 7);
|
|
|
|
|
fl_set_input(dialog_->input_space_below, par_->
|
2001-06-25 00:06:33 +00:00
|
|
|
|
params().spaceBottom().length().asString().c_str());
|
2000-09-25 15:59:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_space_below,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().spaceBottom().keep());
|
2001-08-29 12:52:41 +00:00
|
|
|
|
fl_set_button(dialog_->check_noindent,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
par_->params().noindent());
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-10 01:33:42 +00:00
|
|
|
|
bool FormParagraph::input(FL_OBJECT * ob, long)
|
2000-09-25 15:59:27 +00:00
|
|
|
|
{
|
|
|
|
|
bool ret = true;
|
|
|
|
|
|
2000-09-26 10:25:49 +00:00
|
|
|
|
fl_hide_object(dialog_->text_warning);
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2000-09-26 10:25:49 +00:00
|
|
|
|
// First check the buttons which are exclusive and you have to
|
|
|
|
|
// check only the actuall de/activated button.
|
2000-09-25 15:59:27 +00:00
|
|
|
|
//
|
2000-09-26 10:25:49 +00:00
|
|
|
|
// general form first
|
2000-09-25 15:59:27 +00:00
|
|
|
|
//
|
|
|
|
|
// "Synchronize" the choices and input fields, making it
|
|
|
|
|
// impossible to commit senseless data.
|
2000-10-18 12:00:53 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_choice (dialog_->choice_space_above) != 7)
|
|
|
|
|
fl_set_input (dialog_->input_space_above, "");
|
2000-10-18 12:00:53 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_choice (dialog_->choice_space_below) != 7)
|
|
|
|
|
fl_set_input (dialog_->input_space_below, "");
|
2000-10-18 12:00:53 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_choice (dialog_->choice_linespacing) == 4)
|
|
|
|
|
setEnabled (dialog_->input_linespacing, true);
|
2001-08-16 10:14:48 +00:00
|
|
|
|
else {
|
2001-08-29 12:52:41 +00:00
|
|
|
|
setEnabled (dialog_->input_linespacing, false);
|
|
|
|
|
fl_set_input (dialog_->input_linespacing, "");
|
2001-08-16 10:14:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-26 10:25:49 +00:00
|
|
|
|
//
|
|
|
|
|
// first the general form
|
|
|
|
|
//
|
2001-08-29 12:52:41 +00:00
|
|
|
|
string input = fl_get_input (dialog_->input_space_above);
|
2000-10-18 12:00:53 +00:00
|
|
|
|
bool invalid = false;
|
2000-09-25 15:59:27 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_choice(dialog_->choice_space_above)==7)
|
2000-10-18 12:00:53 +00:00
|
|
|
|
invalid = !input.empty() && !isValidGlueLength(input);
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
input = fl_get_input (dialog_->input_space_below);
|
2000-10-18 12:00:53 +00:00
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (fl_get_choice(dialog_->choice_space_below)==7)
|
2000-10-18 12:00:53 +00:00
|
|
|
|
invalid = invalid || (!input.empty() && !isValidGlueLength(input));
|
|
|
|
|
|
2001-08-29 12:52:41 +00:00
|
|
|
|
if (ob == dialog_->input_space_above || ob == dialog_->input_space_below) {
|
2000-10-18 12:00:53 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2000-09-25 15:59:27 +00:00
|
|
|
|
}
|
2000-10-18 12:00:53 +00:00
|
|
|
|
|
2000-09-25 15:59:27 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2000-10-10 01:33:42 +00:00
|
|
|
|
|