#include <algorithm>
#include <fstream>
#include <vector>
+
#include FORMS_H_LOCATION
using std::ofstream;
using std::pair;
using std::vector;
+bool isActive(FL_OBJECT * ob)
+{
+ return ob && ob->active > 0;
+}
+
+
// Set an FL_OBJECT to activated or deactivated
void setEnabled(FL_OBJECT * ob, bool enable)
{
if (enable) {
fl_activate_object(ob);
- fl_set_object_lcol(ob, FL_BLACK);
+ fl_set_object_lcol(ob, FL_LCOL);
} else {
fl_deactivate_object(ob);
fl_set_object_lcol(ob, FL_INACTIVE);
///
string const getString(FL_OBJECT * ob, int line)
{
- char const * tmp = 0;
+ // Negative line value does not make sense.
+ lyx::Assert(line >= 0);
+ char const * tmp = 0;
switch (ob->objclass) {
case FL_INPUT:
- lyx::Assert(line == -1);
tmp = fl_get_input(ob);
break;
+
case FL_BROWSER:
- if (line == -1)
+ if (line == 0)
line = fl_get_browser(ob);
if (line >= 1 && line <= fl_get_browser_maxline(ob))
break;
case FL_CHOICE:
- if (line == -1)
+ if (line == 0)
line = fl_get_choice(ob);
if (line >= 1 && line <= fl_get_choice_maxitems(ob))
lyx::Assert(0);
}
- return (tmp) ? trim(tmp) : string();
+ return tmp ? trim(tmp) : string();
}
string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
if (length.empty())
return string();
- //don't return unit-from-choice if the input(field) contains a unit
+ // don't return unit-from-choice if the input(field) contains a unit
if (isValidGlueLength(length))
return length;