+2000-11-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/MenuBackend.h (fulllabel): new method.
+
+ * src/MenuBackend.C (checkShortcuts): new method. Checks whether
+ the menu shortcuts of a menu are unique and whether they
+ correspond to a letter of the label.
+ (expand): call checkShortcuts when debugging.
+
+2000-11-03 Andre Poenitz <poenitz@HTWM.De>
+
+ * src/insets/insettext.C (InsetButtonPress): shut off warning.
+
2000-11-02 Lior Silberman <lior@Princeton.EDU>
* lib/examples/*.lyx : '\language default' => '\language english'
}
};
+void Menu::checkShortcuts() const
+{
+ // This is a quadratic algorithm, but we do not care because
+ // it is used for debugging only.
+ for (const_iterator it1 = begin(); it1 != end(); ++it1) {
+ string shortcut = it1->shortcut();
+ if (shortcut.empty())
+ continue;
+ if (!contains(it1->label(), shortcut))
+ lyxerr << "Menu warning: menu entry \""
+ << it1->label()
+ << "\" does not contain shortcut `"
+ << shortcut << '\'' << endl;
+ for (const_iterator it2 = begin(); it2 != it1 ; ++it2) {
+ if (!compare_no_case(it2->shortcut(), shortcut)) {
+ lyxerr << "Menu warning: menu entries "
+ << '"' << it1->fulllabel()
+ << "\" and \"" << it2->fulllabel()
+ << "\" share the same shortcut."
+ << endl;
+ }
+ }
+ }
+}
+
void Menu::expand(Menu & tomenu, Buffer * buf) const
{
for (const_iterator cit = begin();
tomenu.add(*cit);
}
}
+
+ // Check whether the shortcuts are unique
+ if (lyxerr.debugging(Debug::GUI))
+ checkShortcuts();
}
/// The label of a given menuitem
string const label() const { return token(label_, '|', 0); }
- ///
+ /// The keyboard shortcut (usually underlined in the entry)
string const shortcut() const { return token(label_, '|', 1); }
+ /// The complete label, with label and shortcut separated by a '|'
+ string const fulllabel() const { return label_;}
/// The kind of entry
Kind kind() const { return kind_; }
/// the action (if relevant)
///
Menu & read(LyXLex &);
/// Expands some special entries of the menu
- /** The entries with the following kind are exanded to a
+ /** The entries with the following kind are expanded to a
sequence of Command MenuItems: Lastfiles, Documents,
ViewFormats, ExportFormats, UpdateFormats
*/
const_iterator end() const {
return items_.end();
}
+
+ // Check whether the menu shortcuts are unique
+ void checkShortcuts() const;
+
private:
///
ItemList items_;
no_selection = false;
int tmp_x = x - drawTextXOffset;
- int tmp_y = y + insetAscent;
- Inset * inset = bv->checkInsetHit(TEXT(bv), tmp_x, tmp_y-TEXT(bv)->first,
- button);
+ int tmp_y = y + insetAscent - TEXT(bv)->first;
+ Inset * inset = bv->checkInsetHit(TEXT(bv), tmp_x, tmp_y, button);
HideInsetCursor(bv);
if (the_locking_inset) {