mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +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>
|
2002-08-13 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* funcrequest.h: new constructor
|
* funcrequest.h: new constructor
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::pair;
|
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))
|
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);
|
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: ["
|
lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
|
||||||
<< pit->second.action << '|'
|
<< pit->second.action << '|'
|
||||||
<< pit->second.argument << "]\n";
|
<< pit->second.argument << "]\n";
|
||||||
return make_pair(pit->second.action, pit->second.argument);
|
return pit->second;
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "Lyx Error: Unrecognized pseudo-action "
|
lyxerr << "Lyx Error: Unrecognized pseudo-action "
|
||||||
<< pseudo << endl;
|
<< 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
|
string const LyXAction::getActionName(int action) const
|
||||||
{
|
{
|
||||||
kb_action ac;
|
FuncRequest ev = retrieveActionArg(action);
|
||||||
string arg;
|
if (!ev.argument.empty())
|
||||||
boost::tie(ac, arg) = retrieveActionArg(action);
|
ev.argument.insert(0, " ");
|
||||||
|
|
||||||
if (!arg.empty())
|
info_map::const_iterator iit = lyx_info_map.find(ev.action);
|
||||||
arg.insert(0, " ");
|
|
||||||
|
|
||||||
info_map::const_iterator iit = lyx_info_map.find(ac);
|
if (iit != lyx_info_map.end())
|
||||||
|
return iit->second.name + ev.argument;
|
||||||
if (iit != lyx_info_map.end()) {
|
|
||||||
string ret(iit->second.name);
|
|
||||||
ret += arg;
|
|
||||||
return ret;
|
|
||||||
} else
|
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LyXAction::helpText(int pseudoaction) const
|
string const LyXAction::helpText(int pseudoaction) const
|
||||||
{
|
{
|
||||||
kb_action action;
|
FuncRequest ev = retrieveActionArg(pseudoaction);
|
||||||
string arg;
|
|
||||||
boost::tie(action, arg) = retrieveActionArg(pseudoaction);
|
|
||||||
|
|
||||||
string help;
|
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 (ici != lyx_info_map.end()) {
|
||||||
if (lyxerr.debugging(Debug::ACTION)) {
|
if (lyxerr.debugging(Debug::ACTION)) {
|
||||||
lyxerr << "Action: " << action << '\n';
|
lyxerr << "Action: " << ev.action << '\n';
|
||||||
lyxerr << " name: "
|
lyxerr << " name: "
|
||||||
<< ici->second.name << '\n';
|
<< ici->second.name << '\n';
|
||||||
lyxerr << " attrib: "
|
lyxerr << " attrib: "
|
||||||
@ -581,9 +571,9 @@ string const LyXAction::helpText(int pseudoaction) const
|
|||||||
|
|
||||||
if (help.empty()) {
|
if (help.empty()) {
|
||||||
help = _("No description available!");
|
help = _("No description available!");
|
||||||
} else if (!arg.empty()) {
|
} else if (!ev.argument.empty()) {
|
||||||
help += ' ';
|
help += ' ';
|
||||||
help += arg;
|
help += ev.argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
return help;
|
return help;
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
* Given a pseudo-action, return the real action and
|
* Given a pseudo-action, return the real action and
|
||||||
* associated argument
|
* 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.
|
/// Search for an existent pseudoaction, return -1 if it doesn't exist.
|
||||||
int searchActionArg(kb_action action, string const & arg) const;
|
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)
|
void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height)
|
||||||
{
|
{
|
||||||
string xpm_name;
|
string xpm_name;
|
||||||
|
FuncRequest ev = lyxaction.retrieveActionArg(action);
|
||||||
|
|
||||||
kb_action act;
|
string const name = lyxaction.getActionName(ev.action);
|
||||||
string arg;
|
if (!ev.argument.empty())
|
||||||
boost::tie(act, arg) = lyxaction.retrieveActionArg(action);
|
xpm_name = subst(name + ' ' + ev.argument, ' ','_');
|
||||||
|
|
||||||
string const name = lyxaction.getActionName(act);
|
|
||||||
if (!arg.empty())
|
|
||||||
xpm_name = subst(name + ' ' + arg, ' ','_');
|
|
||||||
else
|
else
|
||||||
xpm_name = name;
|
xpm_name = name;
|
||||||
|
|
||||||
@ -271,8 +268,8 @@ void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (act == LFUN_INSERT_MATH && !arg.empty()) {
|
if (ev.action == LFUN_INSERT_MATH && !ev.argument.empty()) {
|
||||||
char const ** pixmap = get_pixmap_from_symbol(arg.c_str(),
|
char const ** pixmap = get_pixmap_from_symbol(ev.argument.c_str(),
|
||||||
buttonwidth,
|
buttonwidth,
|
||||||
height);
|
height);
|
||||||
if (pixmap) {
|
if (pixmap) {
|
||||||
|
@ -90,8 +90,6 @@
|
|||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
#include "support/lyxfunctional.h"
|
#include "support/lyxfunctional.h"
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -120,9 +118,6 @@ extern tex_accent_struct get_accent(kb_action action);
|
|||||||
extern void ShowLatexLog();
|
extern void ShowLatexLog();
|
||||||
|
|
||||||
|
|
||||||
/* === globals =========================================================== */
|
|
||||||
|
|
||||||
|
|
||||||
LyXFunc::LyXFunc(LyXView * o)
|
LyXFunc::LyXFunc(LyXView * o)
|
||||||
: owner(o),
|
: owner(o),
|
||||||
keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
|
keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
|
||||||
@ -274,10 +269,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
|
|||||||
|
|
||||||
FuncStatus LyXFunc::getStatus(int ac) const
|
FuncStatus LyXFunc::getStatus(int ac) const
|
||||||
{
|
{
|
||||||
kb_action action;
|
return getStatus(lyxaction.retrieveActionArg(ac));
|
||||||
string arg;
|
|
||||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
|
||||||
return getStatus(FuncRequest(view(), action, arg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -703,10 +695,7 @@ void LyXFunc::dispatch(string const & s, bool verbose)
|
|||||||
|
|
||||||
void LyXFunc::dispatch(int ac, bool verbose)
|
void LyXFunc::dispatch(int ac, bool verbose)
|
||||||
{
|
{
|
||||||
kb_action action;
|
dispatch(lyxaction.retrieveActionArg(ac), verbose);
|
||||||
string arg;
|
|
||||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
|
||||||
dispatch(FuncRequest(view(), action, arg), verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1872,5 +1861,6 @@ string const LyXFunc::view_status_message()
|
|||||||
|
|
||||||
BufferView * LyXFunc::view() const
|
BufferView * LyXFunc::view() const
|
||||||
{
|
{
|
||||||
|
lyx::Assert(owner);
|
||||||
return owner->view().get();
|
return owner->view().get();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user