+2002-03-13 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * FormBase.C (show):
+ * FormBaseDeprecated.C (show): set the initial state of the cursor.
+
+ * FormPreferences.C (Colors::apply()): use the helper function
+ setCursorColor.
+
+ * Tooltips.C (toggleTooltips): proper fix for those Bad Window messages.
+ Can only set the cursor if the dialog is visible.
+
+ * xforms_helpers.[Ch] (setCursorColor): new helper function to set the
+ color of all cursors used by LyX.
+ (XformsColor::read): use it.
+
2002-03-12 Angus Leeming <a.leeming@ic.ac.uk>
* forms/*.fd (except form_filedialog.fd which is v. scary :-():
(controller_.IconifyWithMain() ? FL_TRANSIENT : 0),
title_.c_str());
}
+
+ // Set the initial state of the cursor
+ if (form()->visible) {
+ int const cursor = Tooltips::enabled() ?
+ XC_question_arrow : FL_DEFAULT_CURSOR;
+ fl_set_cursor(form()->window, cursor);
+ }
}
(lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0),
title_.c_str());
}
+
+ // Set the initial state of the cursor
+ if (form()->visible) {
+ int const cursor = Tooltips::enabled() ?
+ XC_question_arrow : FL_DEFAULT_CURSOR;
+ fl_set_cursor(form()->window, cursor);
+ }
}
if (cit->colorID == GUI_COLOR_CURSOR) {
fl_mapcolor(GUI_COLOR_CURSOR,
cit->r, cit->g, cit->b);
- fl_set_cursor_color(FL_DEFAULT_CURSOR,
- GUI_COLOR_CURSOR, FL_WHITE);
- fl_set_cursor_color(XC_question_arrow,
- GUI_COLOR_CURSOR, FL_WHITE);
+ setCursorColor(GUI_COLOR_CURSOR);
}
}
Dialogs::redrawGUI();
fl_set_object_helper(ob, c_str);
}
- // Set the cursor to a question mark or back to the default.
FL_OBJECT * const ob = tooltipsMap.begin()->first;
+
+ // The dialog is not visible
+ if (!ob->form->window)
+ return;
+
+ // Set the cursor to a question mark or back to the default.
int const cursor = enabled_ ? XC_question_arrow : FL_DEFAULT_CURSOR;
- fl_set_cursor(FL_ObjWin(ob), cursor);
+ fl_set_cursor(ob->form->window, cursor);
}
void Tooltips::initTooltip(FL_OBJECT * ob, string const & tip)
{
- lyx::Assert(ob);
+ lyx::Assert(ob && ob->form);
// Paranoia check!
TooltipsMap::const_iterator it = tooltipsMap.find(ob);
// just go away. Don't change the cursor to a question mark.
return;
- // Set the cursor to a question mark or back to the default.
FL_OBJECT * const ob = tooltipsMap.begin()->first;
+
+ // The dialog is not visible
+ if (!ob->form->window)
+ return;
+
+ // Set the cursor to a question mark or back to the default.
int const cursor = enabled_ ? XC_question_arrow : FL_DEFAULT_CURSOR;
- fl_set_cursor(FL_ObjWin(ob), cursor);
+ fl_set_cursor(ob->form->window, cursor);
}
void Tooltips::initTooltip(FL_OBJECT * ob, string const & tip)
{
- lyx::Assert(ob);
+ lyx::Assert(ob && ob->form);
// Paranoia check!
TooltipsMap::const_iterator it = tooltipsMap.find(ob);
tooltipsMap[ob] = formatted(_(str), 400);
if (!tooltip_timer_) {
- lyx::Assert(ob->form);
if (fl_current_form && ob->form != fl_current_form)
fl_end_form();
#include "xforms_helpers.h"
#include "lyxlex.h"
-#include "support/FileInfo.h"
-#include "support/filetools.h"
-#include "support/lstrings.h" // frontStrip, strip
#include "gettext.h"
-#include "support/LAssert.h"
#include "lyxlength.h"
#include "lyxgluelength.h"
+#include "support/LAssert.h"
+#include "support/FileInfo.h"
+#include "support/filetools.h"
+#include "support/lstrings.h" // frontStrip, strip
using std::ofstream;
using std::pair;
}
+void setCursorColor(int color)
+{
+ fl_set_cursor_color(FL_DEFAULT_CURSOR, color, FL_WHITE);
+ fl_set_cursor_color(XC_question_arrow, color, FL_WHITE);
+ fl_set_cursor_color(XC_xterm, color, FL_WHITE);
+ fl_set_cursor_color(XC_watch, color, FL_WHITE);
+ fl_set_cursor_color(XC_sb_right_arrow, color, FL_WHITE);
+}
+
+
namespace {
// sorted by hand to prevent LyXLex from complaining on read().
fl_mapcolor(le, col.r, col.g, col.b);
if (tag == "\\gui_pointer") {
- fl_set_cursor_color(FL_DEFAULT_CURSOR,
- FL_FREE_COL16, FL_WHITE);
- fl_set_cursor_color(XC_question_arrow,
- FL_FREE_COL16, FL_WHITE);
+ setCursorColor(FL_FREE_COL16);
}
}
-
+
return true;
}
LyXLength const & len,
string const & default_unit);
+
+/// Called from Preferences when the cursor color is changed.
+void setCursorColor(int color);
+
+
/// struct holding xform-specific colors
struct XformsColor : public NamedColor {
int colorID;