+2002-02-06 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * FormBase.[Ch]: can now chose the verbosity of the tooltip through
+ a new method setTooltipLevel(). In turn this determines which of the
+ new virtual methods, getVerboseTooltip() or getMinimalTooltip() gets
+ called from getTooltip.
+ No need for a "message" widget at the bottom of every dialog, therefore.
+ If retained, this "message" widget can be used to display "warnings",
+ pure and simple.
+
+ * FormBibtex.[Ch]:
+ * FormCitation.[Ch]:
+ * FormTexinfo.[Ch]: altered appropriately. Still need to be reshaped,
+ to lose the "message" widget and to gain a "tooltip level" choice.
+
2002-02-05 Angus Leeming <a.leeming@ic.ac.uk>
* forms/form_graphics.fd: Tiny tweek to make the Restore, Ok, Apply,
#include "FormBase.h"
#include "xformsBC.h"
#include "support/LAssert.h"
+#include "xforms_helpers.h" // formatted
#if FL_REVISION < 89
FormBase::FormBase(ControlButtons & c, string const & t, bool allowResize)
: ViewBC<xformsBC>(c), minw_(0), minh_(0), allow_resize_(allowResize),
- title_(t), warning_posted_(false)
+ title_(t), warning_posted_(false), tooltip_level_(VERBOSE_TOOLTIP)
{
#if FL_REVISION < 89
}
-void FormBase::setPrehandler(FL_OBJECT * ob)
+string const FormBase::getTooltip(FL_OBJECT * ob) const
{
lyx::Assert(ob);
- fl_set_object_prehandler(ob, C_FormBasePrehandler);
-}
+ switch (tooltip_level_) {
+ case VERBOSE_TOOLTIP:
+ {
+ string str = getVerboseTooltip(ob);
+ if (!str.empty())
+ return formatted(_(str), 400);
+ // else, fall through
+ }
+
+ case MINIMAL_TOOLTIP:
+ return getMinimalTooltip(ob);
+
+ case NO_TOOLTIP:
+ default:
+ return string();
+ }
+
+}
+
-void FormBase::setWarningPosted(bool warning)
+void FormBase::setTooltipLevel(TooltipLevel level)
{
- warning_posted_ = warning;
+ tooltip_level_ = level;
}
-#if FL_REVISION < 89
-
-string const FormBase::getTooltipCB(FL_OBJECT * ob)
+void FormBase::setPrehandler(FL_OBJECT * ob)
{
- return getTooltip(ob);
+ lyx::Assert(ob);
+ fl_set_object_prehandler(ob, C_FormBasePrehandler);
}
-#endif // FL_REVISION < 89
+
+void FormBase::setWarningPosted(bool warning)
+{
+ warning_posted_ = warning;
+}
namespace {
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
lyx::Assert(ob && ob->form);
- string const help = GetForm(timer)->getTooltipCB(ob);
+ string const help = GetForm(timer)->getTooltip(ob);
if (help.empty())
return;
class FormBase : public ViewBC<xformsBC>
{
public:
+ ///
+ enum TooltipLevel {
+ NO_TOOLTIP,
+ MINIMAL_TOOLTIP,
+ VERBOSE_TOOLTIP
+ };
+
///
FormBase(ControlButtons &, string const &, bool allowResize);
///
/// feedback callback function, invoked only by C_FormBasePrehandler
void FeedbackCB(FL_OBJECT *, int event);
-#if FL_REVISION < 89
- /// invoked only by TooltipTimerCB
- string const getTooltipCB(FL_OBJECT *);
-#endif
+ /** Return the tooltip dependent on the value of tooltip_level_
+ Invoked only by setTooltipHandler and by TooltipTimerCB */
+ string const getTooltip(FL_OBJECT *) const;
protected:
/// Build the dialog
/// Create the dialog if necessary, update it and display it.
void show();
+ /// Set's how verbose the tooltips are going to be
+ void setTooltipLevel(TooltipLevel level);
+
/// Prepare the way to produce a tooltip when the mouse is over ob.
void setTooltipHandler(FL_OBJECT * ob);
that the xform colors have been re-mapped). */
virtual void redraw();
- ///
- virtual string const getTooltip(FL_OBJECT *) { return string(); }
+ /// These methods can be overridden in the daughter classes.
+ virtual string const getMinimalTooltip(FL_OBJECT *) const
+ { return string(); }
+ virtual string const getVerboseTooltip(FL_OBJECT *) const
+ { return string(); }
- /// post feedback for ob. Defaults to nothing
+ /// Post feedback for ob. Defaults to nothing
virtual void feedback(FL_OBJECT * /* ob */) {}
/// clear the feedback message
virtual void clear_feedback() {}
#if FL_REVISION < 89
FL_OBJECT * tooltip_timer_;
#endif
+ /// How verbose are the tooltips?
+ TooltipLevel tooltip_level_;
};
}
}
-void FormBibtex::clear_feedback()
-{
- fl_set_object_label(dialog_->text_info, "");
- fl_redraw_object(dialog_->text_info);
-}
-void FormBibtex::feedback(FL_OBJECT * ob)
+string const FormBibtex::getVerboseTooltip(FL_OBJECT * ob) const
{
- lyx::Assert(ob);
-
string str;
if (ob == dialog_->database) {
str = _("Activate this option if you want the bibliography to appear in the Table of Contents (which doesn't happen by default).");
}
- str = formatted(_(str), dialog_->text_info->w-10, FL_SMALL_SIZE);
-
- fl_set_object_label(dialog_->text_info, str.c_str());
- fl_set_object_lsize(dialog_->text_info, FL_SMALL_SIZE);
- fl_redraw_object(dialog_->text_info);
+ return str;
}
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// tooltips
- void feedback(FL_OBJECT *);
- ///
- void clear_feedback();
+ string const getVerboseTooltip(FL_OBJECT *) const;
/// Fdesign generated method
FD_form_bibtex * build_bibtex();
setEnabled(dialog_->button_down, activate_down);
}
-string const FormCitation::getTooltip(FL_OBJECT * ob)
+
+string const FormCitation::getMinimalTooltip(FL_OBJECT * ob) const
{
string str;
return str;
}
-void FormCitation::clear_feedback()
-{
- fl_set_object_label(dialog_->text_info, "");
- fl_redraw_object(dialog_->text_info);
-}
-void FormCitation::feedback(FL_OBJECT * ob)
+string const FormCitation::getVerboseTooltip(FL_OBJECT * ob) const
{
- lyx::Assert(ob);
-
string str;
if (ob == dialog_->button_add) {
str = N_("Activate if you want to enter Regular Expressions.");
}
- str = formatted(_(str), dialog_->text_info->w-10, FL_SMALL_SIZE);
-
- fl_set_object_label(dialog_->text_info, str.c_str());
- fl_set_object_lsize(dialog_->text_info, FL_SMALL_SIZE);
- fl_redraw_object(dialog_->text_info);
+ return str;
}
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// tooltips
- string const getTooltip(FL_OBJECT *);
+ string const getMinimalTooltip(FL_OBJECT *) const;
///
- void feedback(FL_OBJECT *);
- ///
- void clear_feedback();
+ string const getVerboseTooltip(FL_OBJECT *) const;
/// Fdesign generated method
FD_form_citation * build_citation();
}
-void FormTexinfo::clear_feedback()
-{
- fl_set_object_label(dialog_->message, "");
- fl_redraw_object(dialog_->message);
-}
-
-
-string const FormTexinfo::getTooltip(FL_OBJECT * ob)
+string const FormTexinfo::getMinimalTooltip(FL_OBJECT * ob) const
{
string str;
return str;
}
-void FormTexinfo::feedback(FL_OBJECT * ob)
-{
- lyx::Assert(ob);
+string const FormTexinfo::getVerboseTooltip(FL_OBJECT * ob) const
+{
string str;
if (ob == dialog_->radio_cls) {
}
- str = formatted(_(str), dialog_->message->w-10, FL_SMALL_SIZE);
-
- fl_set_object_label(dialog_->message, str.c_str());
- fl_set_object_lsize(dialog_->message, FL_SMALL_SIZE);
- fl_redraw_object(dialog_->message);
+ return str;
}
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
///
- string const getTooltip(FL_OBJECT *);
+ string const getMinimalTooltip(FL_OBJECT *) const;
///
- void feedback(FL_OBJECT *);
- ///
- void clear_feedback();
+ string const getVerboseTooltip(FL_OBJECT *) const;
///
void updateStyles(ControlTexinfo::texFileSuffix);
/// Fdesign generated method