2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
2000-07-26 09:09:31 +00:00
|
|
|
#include <memory>
|
2000-07-25 10:46:18 +00:00
|
|
|
#include "support/LAssert.h"
|
2000-07-24 13:53:19 +00:00
|
|
|
#include "MenuBackend.h"
|
|
|
|
#include "lyxlex.h"
|
|
|
|
#include "LyXAction.h"
|
|
|
|
#include "debug.h"
|
2000-07-26 07:09:53 +00:00
|
|
|
#include "gettext.h"
|
2000-10-04 09:54:31 +00:00
|
|
|
#include "lastfiles.h"
|
|
|
|
#include "bufferlist.h"
|
2000-10-16 13:27:56 +00:00
|
|
|
#include "converter.h"
|
2000-10-04 09:54:31 +00:00
|
|
|
#include "exporter.h"
|
|
|
|
#include "support/filetools.h"
|
2000-10-11 21:06:43 +00:00
|
|
|
#include "support/lyxfunctional.h"
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
extern LyXAction lyxaction;
|
2000-10-04 09:54:31 +00:00
|
|
|
extern LastFiles * lastfiles;
|
|
|
|
extern BufferList bufferlist;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
using std::endl;
|
2000-10-04 09:54:31 +00:00
|
|
|
using std::vector;
|
|
|
|
using std::pair;
|
2000-10-12 15:17:42 +00:00
|
|
|
using std::find_if;
|
2000-10-16 13:27:56 +00:00
|
|
|
using std::sort;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
// This is the global menu definition
|
|
|
|
MenuBackend menubackend;
|
|
|
|
|
|
|
|
|
2000-07-25 10:46:18 +00:00
|
|
|
MenuItem::MenuItem(Kind kind, string const & label,
|
|
|
|
string const & command, bool optional)
|
|
|
|
: kind_(kind), label_(label), optional_(optional)
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
|
|
|
switch(kind) {
|
|
|
|
case Separator:
|
|
|
|
case Documents:
|
|
|
|
case Lastfiles:
|
2000-08-31 11:51:59 +00:00
|
|
|
case Toc:
|
|
|
|
case References:
|
2000-08-30 03:40:51 +00:00
|
|
|
case ViewFormats:
|
|
|
|
case UpdateFormats:
|
|
|
|
case ExportFormats:
|
2000-07-24 13:53:19 +00:00
|
|
|
break;
|
|
|
|
case Command:
|
|
|
|
action_ = lyxaction.LookupFunc(command);
|
|
|
|
|
|
|
|
if (action_ == LFUN_UNKNOWN_ACTION) {
|
|
|
|
lyxerr << "MenuItem(): LyX command `"
|
|
|
|
<< command << "' does not exist." << endl;
|
|
|
|
}
|
2000-07-25 10:46:18 +00:00
|
|
|
if (optional_)
|
|
|
|
lyxerr[Debug::GUI] << "Optional item "
|
|
|
|
<< command << endl;
|
2000-07-24 13:53:19 +00:00
|
|
|
break;
|
|
|
|
case Submenu:
|
|
|
|
submenu_ = command;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
|
|
|
Menu & Menu::add(MenuItem const & i)
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
|
|
|
items_.push_back(i);
|
2000-07-24 21:49:58 +00:00
|
|
|
return *this;
|
2000-07-24 13:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-26 14:08:09 +00:00
|
|
|
Menu & Menu::read(LyXLex & lex)
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
|
|
|
enum Menutags {
|
|
|
|
md_item = 1,
|
|
|
|
md_documents,
|
|
|
|
md_endmenu,
|
2000-08-30 03:40:51 +00:00
|
|
|
md_exportformats,
|
2000-07-24 13:53:19 +00:00
|
|
|
md_lastfiles,
|
2000-07-25 10:46:18 +00:00
|
|
|
md_optitem,
|
2000-08-31 11:51:59 +00:00
|
|
|
md_references,
|
2000-07-24 13:53:19 +00:00
|
|
|
md_separator,
|
2000-08-31 11:51:59 +00:00
|
|
|
md_submenu,
|
|
|
|
md_toc,
|
2000-08-30 03:40:51 +00:00
|
|
|
md_updateformats,
|
|
|
|
md_viewformats,
|
2000-07-24 13:53:19 +00:00
|
|
|
md_last
|
|
|
|
};
|
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
struct keyword_item menutags[md_last - 1] = {
|
2000-07-24 13:53:19 +00:00
|
|
|
{ "documents", md_documents },
|
|
|
|
{ "end", md_endmenu },
|
2000-08-30 03:40:51 +00:00
|
|
|
{ "exportformats", md_exportformats },
|
2000-07-24 13:53:19 +00:00
|
|
|
{ "item", md_item },
|
|
|
|
{ "lastfiles", md_lastfiles },
|
2000-07-25 10:46:18 +00:00
|
|
|
{ "optitem", md_optitem },
|
2000-08-31 11:51:59 +00:00
|
|
|
{ "references", md_references },
|
2000-07-24 13:53:19 +00:00
|
|
|
{ "separator", md_separator },
|
2000-08-30 03:40:51 +00:00
|
|
|
{ "submenu", md_submenu },
|
2000-08-31 11:51:59 +00:00
|
|
|
{ "toc", md_toc },
|
2000-08-30 03:40:51 +00:00
|
|
|
{ "updateformats", md_updateformats },
|
|
|
|
{ "viewformats", md_viewformats }
|
2000-07-24 13:53:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
lex.pushTable(menutags, md_last - 1);
|
|
|
|
if (lyxerr.debugging(Debug::PARSER))
|
|
|
|
lex.printTable(lyxerr);
|
|
|
|
|
|
|
|
bool quit = false;
|
2000-07-25 10:46:18 +00:00
|
|
|
bool optional = false;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
while (lex.IsOK() && !quit) {
|
|
|
|
switch(lex.lex()) {
|
2000-07-25 10:46:18 +00:00
|
|
|
case md_optitem:
|
|
|
|
optional = true;
|
|
|
|
// fallback to md_item
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_item: {
|
|
|
|
lex.next();
|
2000-10-11 21:06:43 +00:00
|
|
|
string name = _(lex.GetString());
|
2000-07-24 13:53:19 +00:00
|
|
|
lex.next();
|
2000-10-11 21:06:43 +00:00
|
|
|
string const command = lex.GetString();
|
2000-07-25 10:46:18 +00:00
|
|
|
add(MenuItem(MenuItem::Command, name,
|
|
|
|
command, optional));
|
|
|
|
optional = false;
|
2000-07-24 13:53:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_separator:
|
|
|
|
add(MenuItem(MenuItem::Separator));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_lastfiles:
|
|
|
|
add(MenuItem(MenuItem::Lastfiles));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_documents:
|
|
|
|
add(MenuItem(MenuItem::Documents));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
|
|
|
case md_toc:
|
|
|
|
add(MenuItem(MenuItem::Toc));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case md_references:
|
|
|
|
add(MenuItem(MenuItem::References));
|
|
|
|
break;
|
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
case md_viewformats:
|
|
|
|
add(MenuItem(MenuItem::ViewFormats));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
case md_updateformats:
|
|
|
|
add(MenuItem(MenuItem::UpdateFormats));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
case md_exportformats:
|
|
|
|
add(MenuItem(MenuItem::ExportFormats));
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_submenu: {
|
|
|
|
lex.next();
|
2000-10-11 21:06:43 +00:00
|
|
|
string mlabel = _(lex.GetString());
|
2000-07-24 13:53:19 +00:00
|
|
|
lex.next();
|
2000-07-24 21:49:58 +00:00
|
|
|
string mname = lex.GetString();
|
2000-07-24 13:53:19 +00:00
|
|
|
add(MenuItem(MenuItem::Submenu, mlabel, mname));
|
|
|
|
break;
|
|
|
|
}
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_endmenu:
|
|
|
|
quit = true;
|
|
|
|
break;
|
2000-08-31 11:51:59 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
default:
|
|
|
|
lex.printError("menubar::read: "
|
|
|
|
"Unknown menu tag: `$$Token'");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lex.popTable();
|
2000-07-26 14:08:09 +00:00
|
|
|
return *this;
|
2000-07-24 13:53:19 +00:00
|
|
|
}
|
|
|
|
|
2000-10-16 13:27:56 +00:00
|
|
|
struct compare_formatpair {
|
|
|
|
bool operator()(FormatPair const & a, FormatPair const & b) {
|
|
|
|
return a.format->prettyname < b.format->prettyname;
|
|
|
|
}
|
|
|
|
};
|
2000-10-11 21:06:43 +00:00
|
|
|
|
|
|
|
void Menu::expand(Menu & tomenu, Buffer * buf) const
|
2000-10-04 09:54:31 +00:00
|
|
|
{
|
|
|
|
for (const_iterator cit = begin();
|
|
|
|
cit != end() ; ++cit) {
|
|
|
|
switch ((*cit).kind()) {
|
|
|
|
case MenuItem::Lastfiles: {
|
|
|
|
int ii = 1;
|
|
|
|
for (LastFiles::const_iterator lfit = lastfiles->begin();
|
|
|
|
lfit != lastfiles->end() && ii < 10;
|
|
|
|
++lfit, ++ii) {
|
|
|
|
string label = tostr(ii) + ". "
|
|
|
|
+ MakeDisplayPath((*lfit), 30)
|
|
|
|
+ '|' + tostr(ii);
|
|
|
|
int action = lyxaction.
|
|
|
|
getPseudoAction(LFUN_FILE_OPEN,
|
|
|
|
(*lfit));
|
|
|
|
tomenu.add(MenuItem(MenuItem::Command,
|
|
|
|
label, action));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MenuItem::Documents: {
|
|
|
|
vector<string> names = bufferlist.getFileNames();
|
|
|
|
|
|
|
|
if (names.empty()) {
|
|
|
|
tomenu.add(MenuItem(MenuItem::Command,
|
|
|
|
_("No Documents Open!"),
|
|
|
|
LFUN_NOACTION));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (vector<string>::const_iterator docit = names.begin();
|
|
|
|
docit != names.end() ; ++docit) {
|
|
|
|
int action =
|
|
|
|
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit);
|
|
|
|
string label = MakeDisplayPath(*docit, 30);
|
|
|
|
tomenu.add(MenuItem(MenuItem::Command,
|
|
|
|
label, action));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MenuItem::ViewFormats:
|
|
|
|
case MenuItem::UpdateFormats:
|
|
|
|
case MenuItem::ExportFormats: {
|
2000-10-16 13:27:56 +00:00
|
|
|
vector<FormatPair> names;
|
2000-10-04 09:54:31 +00:00
|
|
|
kb_action action;
|
|
|
|
if ((*cit).kind() == MenuItem::ViewFormats) {
|
|
|
|
names = Exporter::GetViewableFormats(buf);
|
|
|
|
action = LFUN_PREVIEW;
|
|
|
|
} else if ((*cit).kind() == MenuItem::UpdateFormats) {
|
|
|
|
names = Exporter::GetViewableFormats(buf);
|
|
|
|
action = LFUN_UPDATE;
|
|
|
|
} else {
|
|
|
|
names = Exporter::GetExportableFormats(buf);
|
|
|
|
action = LFUN_EXPORT;
|
|
|
|
}
|
2000-10-16 13:27:56 +00:00
|
|
|
sort(names.begin(), names.end(), compare_formatpair());
|
2000-10-04 09:54:31 +00:00
|
|
|
|
2000-10-16 13:27:56 +00:00
|
|
|
for (vector<FormatPair>::const_iterator fit = names.begin();
|
2000-10-04 09:54:31 +00:00
|
|
|
fit != names.end() ; ++fit) {
|
2000-10-16 13:27:56 +00:00
|
|
|
string fmt = (*fit).format->name;
|
|
|
|
string label = (*fit).format->prettyname;
|
2000-10-23 12:16:05 +00:00
|
|
|
bool same_before =
|
|
|
|
fit != names.begin() &&
|
|
|
|
(*fit).format == (*(fit-1)).format;
|
|
|
|
bool same_after =
|
|
|
|
fit+1 != names.end() &&
|
|
|
|
(*fit).format == (*(fit+1)).format;
|
2000-10-16 13:27:56 +00:00
|
|
|
if ((*fit).from &&
|
2000-10-23 12:16:05 +00:00
|
|
|
(same_before || same_after)) {
|
2000-10-16 13:27:56 +00:00
|
|
|
fmt += ":" + (*fit).from->name;
|
|
|
|
string head;
|
|
|
|
split((*fit).command, head, ' ');
|
|
|
|
label += _(" (using ") + head + ")";
|
2000-10-23 12:16:05 +00:00
|
|
|
if (!(*fit).format->shortcut.empty() &&
|
|
|
|
!same_before)
|
|
|
|
label += "|" + (*fit).format->shortcut;
|
|
|
|
} else if (!(*fit).format->shortcut.empty())
|
|
|
|
label += "|" + (*fit).format->shortcut;
|
2000-10-16 13:27:56 +00:00
|
|
|
int action2 = lyxaction.getPseudoAction(action, fmt);
|
2000-10-04 09:54:31 +00:00
|
|
|
tomenu.add(MenuItem(MenuItem::Command,
|
|
|
|
label, action2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
tomenu.add(*cit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-07-24 13:53:19 +00:00
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
void MenuBackend::read(LyXLex & lex)
|
|
|
|
{
|
|
|
|
enum Menutags {
|
|
|
|
md_menu = 1,
|
|
|
|
md_menubar,
|
|
|
|
md_endmenuset,
|
|
|
|
md_last
|
|
|
|
};
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
struct keyword_item menutags[md_last - 1] = {
|
2000-07-24 13:53:19 +00:00
|
|
|
{ "end", md_endmenuset },
|
|
|
|
{ "menu", md_menu },
|
|
|
|
{ "menubar", md_menubar }
|
|
|
|
};
|
|
|
|
|
|
|
|
//consistency check
|
|
|
|
if (compare_no_case(lex.GetString(), "menuset"))
|
|
|
|
lyxerr << "Menubackend::read: ERROR wrong token:`"
|
|
|
|
<< lex.GetString() << '\'' << endl;
|
|
|
|
|
|
|
|
lex.pushTable(menutags, md_last - 1);
|
|
|
|
if (lyxerr.debugging(Debug::PARSER))
|
|
|
|
lex.printTable(lyxerr);
|
|
|
|
|
|
|
|
bool quit = false;
|
2000-07-26 14:08:09 +00:00
|
|
|
bool menubar = false;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
while (lex.IsOK() && !quit) {
|
|
|
|
switch(lex.lex()) {
|
2000-07-26 14:08:09 +00:00
|
|
|
case md_menubar:
|
|
|
|
menubar = true;
|
|
|
|
// fallback to md_menu
|
2000-07-24 13:53:19 +00:00
|
|
|
case md_menu: {
|
|
|
|
lex.next();
|
|
|
|
string name = lex.GetString();
|
2000-07-26 14:08:09 +00:00
|
|
|
if (hasMenu(name)) {
|
|
|
|
if (getMenu(name).menubar() == menubar) {
|
|
|
|
getMenu(name).read(lex);
|
|
|
|
} else {
|
|
|
|
lex.printError("Cannot append to menu `$$Token' unless it is of the same type");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Menu menu(name, menubar);
|
|
|
|
menu.read(lex);
|
|
|
|
add(menu);
|
|
|
|
}
|
|
|
|
menubar = false;
|
2000-07-24 13:53:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case md_endmenuset:
|
|
|
|
quit = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lex.printError("menubackend::read: "
|
|
|
|
"Unknown menu tag: `$$Token'");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lex.popTable();
|
|
|
|
}
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
void MenuBackend::defaults()
|
|
|
|
{
|
2000-07-24 21:49:58 +00:00
|
|
|
menulist_.clear();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
lyxerr[Debug::GUI] << "MenuBackend::defaults: using default values"
|
|
|
|
<< endl;
|
|
|
|
|
|
|
|
Menu file("file");
|
2000-07-24 21:49:58 +00:00
|
|
|
file
|
2000-07-26 09:09:31 +00:00
|
|
|
.add(MenuItem(MenuItem::Command, _("New...|N"), "buffer-new"))
|
|
|
|
.add(MenuItem(MenuItem::Command, _("Open...|O"), "buffer-open"))
|
|
|
|
.add(MenuItem(MenuItem::Submenu, _("Import|I"), "import"))
|
|
|
|
.add(MenuItem(MenuItem::Command, _("Quit|Q"), "lyx-quit"))
|
2000-07-24 21:49:58 +00:00
|
|
|
.add(MenuItem(MenuItem::Separator))
|
|
|
|
.add(MenuItem(MenuItem::Lastfiles));
|
2000-07-24 13:53:19 +00:00
|
|
|
add(file);
|
|
|
|
|
|
|
|
Menu import("import");
|
2000-07-24 21:49:58 +00:00
|
|
|
import
|
|
|
|
.add(MenuItem(MenuItem::Command,
|
2000-07-26 09:09:31 +00:00
|
|
|
_("LaTeX...|L"), "buffer-import latex"))
|
2000-07-24 21:49:58 +00:00
|
|
|
.add(MenuItem(MenuItem::Command,
|
2000-07-26 09:09:31 +00:00
|
|
|
_("LinuxDoc...|L"), "buffer-import linuxdoc"));
|
2000-07-24 13:53:19 +00:00
|
|
|
add(import);
|
|
|
|
|
|
|
|
Menu edit("edit");
|
2000-07-24 21:49:58 +00:00
|
|
|
edit
|
2000-07-26 09:09:31 +00:00
|
|
|
.add(MenuItem(MenuItem::Command, _("Cut"), "cut"))
|
|
|
|
.add(MenuItem(MenuItem::Command, _("Copy"), "copy"))
|
|
|
|
.add(MenuItem(MenuItem::Command, _("Paste"), "paste"))
|
|
|
|
.add(MenuItem(MenuItem::Command, _("Emphasize"), "font-emph"));
|
2000-07-24 13:53:19 +00:00
|
|
|
add(edit);
|
|
|
|
|
|
|
|
Menu documents("documents");
|
|
|
|
documents.add(MenuItem(MenuItem::Documents));
|
|
|
|
add(documents);
|
|
|
|
|
|
|
|
Menu main("main", true);
|
2000-07-24 21:49:58 +00:00
|
|
|
main
|
2000-07-26 09:09:31 +00:00
|
|
|
.add(MenuItem(MenuItem::Submenu, _("File|F"), "file"))
|
|
|
|
.add(MenuItem(MenuItem::Submenu, _("Edit|E"), "edit"))
|
2000-07-26 07:09:53 +00:00
|
|
|
.add(MenuItem(MenuItem::Submenu,
|
2000-07-26 09:09:31 +00:00
|
|
|
_("Documents|D"), "documents"));
|
2000-07-24 13:53:19 +00:00
|
|
|
add(main);
|
|
|
|
|
|
|
|
Menu main_nobuffer("main_nobuffer", true);
|
2000-07-26 09:09:31 +00:00
|
|
|
main_nobuffer.add(MenuItem(MenuItem::Submenu, _("File|F"), "file"));
|
2000-07-24 13:53:19 +00:00
|
|
|
add(main_nobuffer);
|
|
|
|
|
|
|
|
if (lyxerr.debugging(Debug::GUI)) {
|
|
|
|
for(const_iterator cit = begin();
|
|
|
|
cit != end() ; ++cit)
|
|
|
|
lyxerr << "Menu name: " << cit->name()
|
|
|
|
<< ", Menubar: " << cit->menubar()
|
|
|
|
<< endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
|
|
|
void MenuBackend::add(Menu const & menu)
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
|
|
|
menulist_.push_back(menu);
|
|
|
|
}
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
|
|
|
bool MenuBackend::hasMenu(string const & name) const
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
2000-10-11 21:06:43 +00:00
|
|
|
return find_if(begin(), end(),
|
|
|
|
compare_memfun(&Menu::name, name)) != end();
|
2000-07-24 13:53:19 +00:00
|
|
|
}
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
|
|
|
Menu const & MenuBackend::getMenu(string const & name) const
|
2000-07-24 13:53:19 +00:00
|
|
|
{
|
2000-10-11 21:06:43 +00:00
|
|
|
const_iterator cit = find_if(begin(), end(),
|
|
|
|
compare_memfun(&Menu::name, name));
|
|
|
|
Assert(cit != end());
|
|
|
|
return (*cit);
|
2000-07-24 13:53:19 +00:00
|
|
|
}
|
2000-07-26 14:08:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
Menu & MenuBackend::getMenu(string const & name)
|
|
|
|
{
|
2000-10-11 21:06:43 +00:00
|
|
|
MenuList::iterator it = find_if(menulist_.begin(), menulist_.end(),
|
|
|
|
compare_memfun(&Menu::name, name));
|
|
|
|
Assert(it != menulist_.end());
|
|
|
|
return (*it);
|
2000-07-26 14:08:09 +00:00
|
|
|
}
|