[Libufo-commits] ufo-0.5/src/widgets ubutton.cpp,1.23,1.24
Status: Beta
Brought to you by:
schmidtjf
|
From: Johannes S. <sch...@us...> - 2005-09-02 13:25:57
|
Update of /cvsroot/libufo/ufo-0.5/src/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13357/src/widgets Modified Files: ubutton.cpp Log Message: Fixed mnemonic distinction in setAccelerator. Index: ubutton.cpp =================================================================== RCS file: /cvsroot/libufo/ufo-0.5/src/widgets/ubutton.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ubutton.cpp 6 Jul 2005 11:32:17 -0000 1.23 --- ubutton.cpp 2 Sep 2005 13:25:48 -0000 1.24 *************** *** 409,428 **** m_accelerator = stroke; ! // search for accel index (i.e. whether this is a mnemonic accelerator ! std::string text(getText()); ! unsigned int index; ! // try lower case first ! index = text.find(char(/*std::*/tolower(stroke.getKeyCode() + 32))); ! if (index < text.length()) { ! getCompoundModel()->acceleratorIndex = index; ! } else { ! index = text.find(char(stroke.getKeyCode())); ! if (index < text.length()) { ! getCompoundModel()->acceleratorIndex = index; } ! } ! grabShortcut(stroke); } --- 409,444 ---- m_accelerator = stroke; ! // check whether this is a mnemonic accelerator ! if (stroke.getModifiers() == UMod::Alt) { ! // release old mnemonic ! if (getCompoundModel()->acceleratorIndex != -1) { ! std::string accel("Alt+"); ! accel += '+'; ! accel += getText()[getCompoundModel()->acceleratorIndex]; ! releaseShortcut(accel); } ! // grab new mnemonic ! std::string text(getText()); ! // try lower case first ! m_acceleratorIndex = text.find(char(/*std::*/tolower(stroke.getKeyCode() + 32))); ! if (m_acceleratorIndex < text.length()) { ! getCompoundModel()->acceleratorIndex = m_acceleratorIndex; ! } else { ! // now normal ! m_acceleratorIndex = text.find(char(stroke.getKeyCode())); ! if (m_acceleratorIndex < text.length()) { ! getCompoundModel()->acceleratorIndex = m_acceleratorIndex; ! } else { ! //FIXME: oops, nothing ! m_acceleratorIndex = -1; ! } ! } ! updateMnemonic(); ! } else { ! // no mnemonic, grab it ourself ! grabShortcut(stroke); ! } } |