-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2000-2001 The LyX Team.
+/**
+ * \file FormParagraph.C
+ * Copyright 2000-2001 The LyX Team.
+ * See the file COPYING.
*
- * @author Jürgen Vigna
- *
- *======================================================*/
+ * \author Jürgen Vigna, jug@sad.it
+ */
#include <config.h>
#include "support/lstrings.h"
+#include <functional>
+
using Liason::setMinibuffer;
using SigC::slot;
+using std::vector;
+using std::bind2nd;
+using std::remove_if;
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
Paragraph const * const p = getCurrentParagraph();
if (p == 0 || p == par_)
return;
-#ifdef WITH_WARNINGS
-#warning Please someone of you GUII people have a look at this!
-#endif
+
+ // OBS FIX LOOK HERE
+
// shouldn't we chage the par_ pointer too?
// anyway for me the below function does just nothing!
// (Jug 20020108)
void FormParagraph::redraw()
{
- if( form() && form()->visible )
- fl_redraw_form( form() );
+ if (form() && form()->visible)
+ fl_redraw_form(form());
}
fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
+ setPrehandler(dialog_->input_space_above);
+ setPrehandler(dialog_->input_space_below);
+ setPrehandler(dialog_->input_labelwidth);
+ setPrehandler(dialog_->input_linespacing);
+
// Create the contents of the unit choices
// Don't include the "%" terms...
- std::vector<string> units_vec = getLatexUnits();
- for (std::vector<string>::iterator it = units_vec.begin();
+ vector<string> units_vec = getLatexUnits();
+#if 0
+ for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) {
if (contains(*it, "%"))
it = units_vec.erase(it, it+1) - 1;
}
+#else
+ // Something similar to this is a better way to erase
+ vector<string>::iterator del =
+ remove_if(units_vec.begin(), units_vec.end(),
+ bind2nd(contains_functor(), "%"));
+ units_vec.erase(del, units_vec.end());
+#endif
+
string units = getStringFromVector(units_vec, "|");
fl_addto_choice(dialog_->choice_value_space_above, units.c_str());
fl_set_button(dialog_->radio_align_center, 0);
fl_set_button(dialog_->radio_align_block, 0);
+ LyXTextClass const & tclass = textclasslist[buf->params.textclass];
+
int align = par_->getAlign();
if (align == LYX_ALIGN_LAYOUT)
- align = textclasslist.Style(buf->params.textclass,
- par_->getLayout()).align;
+ align = tclass[par_->layout()].align;
switch (align) {
case LYX_ALIGN_RIGHT:
break;
}
- LyXAlignment alignpos =
- textclasslist.Style(buf->params.textclass,
- par_->getLayout()).alignpossible;
+ LyXAlignment alignpos = tclass[par_->layout()].alignpossible;
setEnabled(dialog_->radio_align_block, bool(alignpos & LYX_ALIGN_BLOCK));
setEnabled(dialog_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
bool const metric = lyxrc.default_papersize > 3;
string const default_unit = metric ? "cm" : "in";
string const length = par_->params().spaceTop().length().asString();
- //check if there's a stretch or shrink factor
- if (!isValidLength(length) && !isStrDbl(length))
- fl_set_input(dialog_->input_space_above, length.c_str());
- else {
- updateWidgetsFromLengthString(dialog_->input_space_above,
+ updateWidgetsFromLengthString(dialog_->input_space_above,
dialog_->choice_value_space_above,
length, default_unit);
- }
break;
}
}
string const default_unit = metric ? "cm" : "in";
string const length =
par_->params().spaceBottom().length().asString();
- //check if there's a stretch or shrink factor
- if (!isValidLength(length) && !isStrDbl(length))
- fl_set_input(dialog_->input_space_below, length.c_str());
- else {
- updateWidgetsFromLengthString(dialog_->input_space_below,
+ updateWidgetsFromLengthString(dialog_->input_space_below,
dialog_->choice_value_space_below,
length, default_unit);
- }
break;
}
}