mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
small cleanups
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4963 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e8eb6cdb2d
commit
3332e1fbc8
@ -1,4 +1,9 @@
|
||||
|
||||
2002-08-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* LyXAction.[Ch]:
|
||||
* lyxfunc.C: further cleaning
|
||||
|
||||
2002-08-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* funcrequest.h: new constructor
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
@ -492,10 +490,10 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg)
|
||||
}
|
||||
|
||||
|
||||
pair<kb_action, string> LyXAction::retrieveActionArg(int pseudo) const
|
||||
FuncRequest LyXAction::retrieveActionArg(int pseudo) const
|
||||
{
|
||||
if (!isPseudoAction(pseudo))
|
||||
return make_pair(static_cast<kb_action>(pseudo), string());
|
||||
return FuncRequest(static_cast<kb_action>(pseudo));
|
||||
|
||||
pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo);
|
||||
|
||||
@ -503,11 +501,11 @@ pair<kb_action, string> LyXAction::retrieveActionArg(int pseudo) const
|
||||
lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
|
||||
<< pit->second.action << '|'
|
||||
<< pit->second.argument << "]\n";
|
||||
return make_pair(pit->second.action, pit->second.argument);
|
||||
return pit->second;
|
||||
} else {
|
||||
lyxerr << "Lyx Error: Unrecognized pseudo-action "
|
||||
<< pseudo << endl;
|
||||
return make_pair(LFUN_UNKNOWN_ACTION, string());
|
||||
return FuncRequest(LFUN_UNKNOWN_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,36 +535,28 @@ int LyXAction::LookupFunc(string const & func)
|
||||
|
||||
string const LyXAction::getActionName(int action) const
|
||||
{
|
||||
kb_action ac;
|
||||
string arg;
|
||||
boost::tie(ac, arg) = retrieveActionArg(action);
|
||||
|
||||
if (!arg.empty())
|
||||
arg.insert(0, " ");
|
||||
FuncRequest ev = retrieveActionArg(action);
|
||||
if (!ev.argument.empty())
|
||||
ev.argument.insert(0, " ");
|
||||
|
||||
info_map::const_iterator iit = lyx_info_map.find(ac);
|
||||
info_map::const_iterator iit = lyx_info_map.find(ev.action);
|
||||
|
||||
if (iit != lyx_info_map.end()) {
|
||||
string ret(iit->second.name);
|
||||
ret += arg;
|
||||
return ret;
|
||||
} else
|
||||
return string();
|
||||
if (iit != lyx_info_map.end())
|
||||
return iit->second.name + ev.argument;
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
string const LyXAction::helpText(int pseudoaction) const
|
||||
{
|
||||
kb_action action;
|
||||
string arg;
|
||||
boost::tie(action, arg) = retrieveActionArg(pseudoaction);
|
||||
FuncRequest ev = retrieveActionArg(pseudoaction);
|
||||
|
||||
string help;
|
||||
|
||||
info_map::const_iterator ici = lyx_info_map.find(action);
|
||||
info_map::const_iterator ici = lyx_info_map.find(ev.action);
|
||||
if (ici != lyx_info_map.end()) {
|
||||
if (lyxerr.debugging(Debug::ACTION)) {
|
||||
lyxerr << "Action: " << action << '\n';
|
||||
lyxerr << "Action: " << ev.action << '\n';
|
||||
lyxerr << " name: "
|
||||
<< ici->second.name << '\n';
|
||||
lyxerr << " attrib: "
|
||||
@ -581,9 +571,9 @@ string const LyXAction::helpText(int pseudoaction) const
|
||||
|
||||
if (help.empty()) {
|
||||
help = _("No description available!");
|
||||
} else if (!arg.empty()) {
|
||||
} else if (!ev.argument.empty()) {
|
||||
help += ' ';
|
||||
help += arg;
|
||||
help += ev.argument;
|
||||
}
|
||||
|
||||
return help;
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
* Given a pseudo-action, return the real action and
|
||||
* associated argument
|
||||
*/
|
||||
std::pair<kb_action, string> retrieveActionArg(int pseudo) const;
|
||||
FuncRequest retrieveActionArg(int pseudo) const;
|
||||
|
||||
/// Search for an existent pseudoaction, return -1 if it doesn't exist.
|
||||
int searchActionArg(kb_action action, string const & arg) const;
|
||||
|
@ -251,14 +251,11 @@ extern "C" {
|
||||
void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height)
|
||||
{
|
||||
string xpm_name;
|
||||
|
||||
kb_action act;
|
||||
string arg;
|
||||
boost::tie(act, arg) = lyxaction.retrieveActionArg(action);
|
||||
FuncRequest ev = lyxaction.retrieveActionArg(action);
|
||||
|
||||
string const name = lyxaction.getActionName(act);
|
||||
if (!arg.empty())
|
||||
xpm_name = subst(name + ' ' + arg, ' ','_');
|
||||
string const name = lyxaction.getActionName(ev.action);
|
||||
if (!ev.argument.empty())
|
||||
xpm_name = subst(name + ' ' + ev.argument, ' ','_');
|
||||
else
|
||||
xpm_name = name;
|
||||
|
||||
@ -271,8 +268,8 @@ void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height)
|
||||
return;
|
||||
}
|
||||
|
||||
if (act == LFUN_INSERT_MATH && !arg.empty()) {
|
||||
char const ** pixmap = get_pixmap_from_symbol(arg.c_str(),
|
||||
if (ev.action == LFUN_INSERT_MATH && !ev.argument.empty()) {
|
||||
char const ** pixmap = get_pixmap_from_symbol(ev.argument.c_str(),
|
||||
buttonwidth,
|
||||
height);
|
||||
if (pixmap) {
|
||||
|
@ -90,8 +90,6 @@
|
||||
#include "support/path.h"
|
||||
#include "support/lyxfunctional.h"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <ctime>
|
||||
#include <clocale>
|
||||
#include <cstdlib>
|
||||
@ -120,9 +118,6 @@ extern tex_accent_struct get_accent(kb_action action);
|
||||
extern void ShowLatexLog();
|
||||
|
||||
|
||||
/* === globals =========================================================== */
|
||||
|
||||
|
||||
LyXFunc::LyXFunc(LyXView * o)
|
||||
: owner(o),
|
||||
keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
|
||||
@ -274,10 +269,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
|
||||
|
||||
FuncStatus LyXFunc::getStatus(int ac) const
|
||||
{
|
||||
kb_action action;
|
||||
string arg;
|
||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
||||
return getStatus(FuncRequest(view(), action, arg));
|
||||
return getStatus(lyxaction.retrieveActionArg(ac));
|
||||
}
|
||||
|
||||
|
||||
@ -703,10 +695,7 @@ void LyXFunc::dispatch(string const & s, bool verbose)
|
||||
|
||||
void LyXFunc::dispatch(int ac, bool verbose)
|
||||
{
|
||||
kb_action action;
|
||||
string arg;
|
||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
||||
dispatch(FuncRequest(view(), action, arg), verbose);
|
||||
dispatch(lyxaction.retrieveActionArg(ac), verbose);
|
||||
}
|
||||
|
||||
|
||||
@ -1872,5 +1861,6 @@ string const LyXFunc::view_status_message()
|
||||
|
||||
BufferView * LyXFunc::view() const
|
||||
{
|
||||
lyx::Assert(owner);
|
||||
return owner->view().get();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user