void CEditMultiLine::OnFunctionList() { int nStartChar, nEndChar; CString strSelection; // find the selection range m_ctlText.GetSel(nStartChar, nEndChar); // get window text m_ctlText.GetWindowText (strSelection); ShowFunctionslist (strSelection, nStartChar, nEndChar, m_bLua); }
void CMUSHclientDoc::Help(LPCTSTR Name) { map<string, string> lua_specials; // special Lua help lua_specials ["lua"] = "lua"; lua_specials ["lua b"] = "lua_base"; lua_specials ["lua c"] = "lua_coroutines"; lua_specials ["lua d"] = "lua_debug"; lua_specials ["lua i"] = "lua_io"; lua_specials ["lua m"] = "lua_math"; lua_specials ["lua o"] = "lua_os"; lua_specials ["lua p"] = "lua_package"; lua_specials ["lua r"] = "lua_rex"; lua_specials ["lua s"] = "lua_string"; lua_specials ["lua t"] = "lua_tables"; lua_specials ["lua u"] = "lua_utils"; CString m_strFilter = Name; m_strFilter.MakeLower (); m_strFilter.TrimLeft (); m_strFilter.TrimRight (); // a special case - b is used twice if (m_strFilter == "lua bc") { ShowHelp ("DOC_", "lua_bc"); return; } CString strFunction; string sFirst5 = m_strFilter.Left (5); map<string, string>::const_iterator it = lua_specials.find (sFirst5); if (it != lua_specials.end ()) { ShowHelp ("DOC_", it->second.c_str ()); return; } else if (!m_strFilter.IsEmpty ()) { // first find direct match on a Lua function if (LuaFunctionsSet.find ((LPCTSTR) m_strFilter) != LuaFunctionsSet.end ()) { ShowHelp ("LUA_", m_strFilter); return; } // then try a world function for (int i = 0; InternalFunctionsTable [i].sFunction [0]; i++) { strFunction = InternalFunctionsTable [i].sFunction; strFunction.MakeLower (); if (strFunction == m_strFilter) { ShowHelp ("FNC_", InternalFunctionsTable [i].sFunction); // back to proper capitalization return; } } } // end of non-empty name bool bLua = false; if (GetScriptEngine () && GetScriptEngine ()->L) bLua = true; // not exact match, show list matching filter ShowFunctionslist (m_strFilter, bLua); } // end of CMUSHclientDoc::Help
void CMainFrame::OnGameFunctionslist() { CString s; ShowFunctionslist (s, true); }