+2000-07-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/frontends/xforms/Menubar_pimpl.C (set): fix the disappearing
+ shortcuts syndrom by redrawing them explicitely (a better solution
+ would be appreciated).
+
+ * src/lyxfunc.C (getStatus): fix crash when functions are disabled.
+
+ * src/frontends/xforms/Menubar_pimpl.C (set): fix the shortcut of
+ the button.
+
+ * src/lyx_cb.C (MenuExport): change html export to do the right
+ thing depending of the document type (instead of having
+ html-linuxdoc and html-docbook).
+ * src/lyxfunc.C (getStatus): update for html
+ * lib/ui/default.ui: simplify due to the above change.
+ * src/menus.C (ShowFileMenu): update too (in case we need it).
+
+ * src/MenuBackend.C (read): if a menu is defined twice, add the
+ new entries to the exiting one.
+
2000-07-26 Juergen Vigna <jug@sad.it>
* src/buffer.h: added functions setUnnamed(bool) and isUnnamed().
Submenu "Help|H" "help"
End
+MenuBar "main"
+ Submenu "File|F" "file"
+End
+
Menubar "main_nobuffer"
Submenu "File|F" "file_nobuffer"
Submenu "Options|O" "options"
Item "as DVI|D" "buffer-export dvi"
Item "as Postscript|P" "buffer-export postscript"
Item "as Ascii|A" "buffer-export ascii"
- OptItem "as HTML|H" "buffer-export html"
- OptItem "as HTML|H" "buffer-export html-linuxdoc"
- OptItem "as HTML|H" "buffer-export html-docbook"
+ Item "as HTML|H" "buffer-export html"
OptItem "Custom...|C" "buffer-export custom"
End
}
-void Menu::read(LyXLex & lex)
+Menu & Menu::read(LyXLex & lex)
{
enum Menutags {
md_item = 1,
}
}
lex.popTable();
+ return *this;
}
lex.printTable(lyxerr);
bool quit = false;
+ bool menubar = false;
while (lex.IsOK() && !quit) {
switch(lex.lex()) {
+ case md_menubar:
+ menubar = true;
+ // fallback to md_menu
case md_menu: {
lex.next();
string name = lex.GetString();
- Menu menu(name, false);
- menu.read(lex);
- add(menu);
- break;
- }
- case md_menubar: {
- lex.next();
- string name = lex.GetString();
- Menu menubar(name, true);
- menubar.read(lex);
- add(menubar);
+ 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;
break;
}
case md_endmenuset:
Assert(false); // we actually require the name to exist.
return menulist_.front();
}
+
+
+Menu & MenuBackend::getMenu(string const & name)
+{
+ for (MenuList::iterator cit = menulist_.begin();
+ cit != menulist_.end(); ++cit) {
+ if ((*cit).name() == name)
+ return (*cit);
+ }
+ Assert(false); // we actually require the name to exist.
+ return menulist_.front();
+}
+
///
Menu & add(MenuItem const &);
///
- void read(LyXLex &);
+ Menu & read(LyXLex &);
///
bool menubar() const { return menubar_; }
///
///
bool hasMenu (string const &) const;
///
+ Menu & getMenu (string const &);
+ ///
Menu const & getMenu (string const &) const;
//
bool empty() const { return menulist_.empty(); }
_("Documents|D");
_("Help|H");
_("File|F");
+_("File|F");
_("Options|O");
_("Help|H");
_("New...|N");
_("as Postscript|P");
_("as Ascii|A");
_("as HTML|H");
-_("as HTML|H");
-_("as HTML|H");
_("Custom...|C");
_("Undo|U");
_("Redo|R");
break;
}
string label = i->label();
- string shortcut = i->shortcut();
+ string shortcut = '#' + i->shortcut();
int width = string_width(label);
obj = fl_add_button(FL_TOUCH_BUTTON,
air + moffset, yloc,
moffset += obj->w + air;
fl_set_object_shortcut(obj, shortcut.c_str(), 1);
fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1);
+
ItemInfo * iteminfo = new ItemInfo(this,
new MenuItem(*i), obj);
buttonlist_.push_back(iteminfo);
if (!form_was_open)
fl_end_form();
+ // Force the redraw of the buttons (probably not the best
+ // method, but...)
+ for(ButtonList::const_iterator cit = buttonlist_.begin();
+ cit != buttonlist_.end(); ++cit) {
+ if ((*cit)->obj_) {
+ fl_redraw_object((*cit)->obj_);
+ }
+ }
+
lyxerr[Debug::GUI] << "Menubar set." << endl;
}
}
// HTML
else if (extyp == "html") {
- MenuMakeHTML(buffer);
- }
- // HTML from linuxdoc
- else if (extyp == "html-linuxdoc") {
- MenuMakeHTML_LinuxDoc(buffer);
- }
- // HTML from docbook
- else if (extyp == "html-docbook") {
- MenuMakeHTML_DocBook(buffer);
+ if (buffer->isLinuxDoc())
+ MenuMakeHTML_LinuxDoc(buffer);
+ else if (buffer->isDocBook())
+ MenuMakeHTML_DocBook(buffer);
+ else
+ MenuMakeHTML(buffer);
}
else {
ShowMessage(buffer, _("Unknown export type: ") + extyp);
// no
setErrorMessage(N_("Document is read-only"));
flag |= LyXFunc::Disabled;
- return flag;
}
} else {
// no
setErrorMessage(N_("Command not allowed with"
"out any document open"));
flag |= LyXFunc::Disabled;
+ return flag;
}
}
else if (argument == "dvi" || argument == "postscript")
disable = noLaTeX;
else if (argument == "html")
- disable = (! buf->isLatex()
- || lyxrc.html_command == "none");
- else if (argument == "html-linuxdoc")
- disable = (! buf->isLinuxDoc()
- || lyxrc.linuxdoc_to_html_command == "none");
- else if (argument == "html-docbook")
- disable = (! buf->isDocBook()
- || lyxrc.docbook_to_html_command == "none");
+ disable = (buf->isLinuxDoc()
+ && lyxrc.linuxdoc_to_html_command == "none")
+ || (buf->isDocBook()
+ && lyxrc.docbook_to_html_command == "none")
+ || (! buf->isLinuxDoc() && ! buf->isDocBook()
+ && lyxrc.html_command == "none");
else if (argument == "custom")
disable = ! buf->isLatex();
break;
break;
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
break;
- case 44:
- if (!LinuxDoc && !DocBook)
- tmpfunc->Dispatch(LFUN_EXPORT, "html");
- else if(LinuxDoc)
- tmpfunc->Dispatch(LFUN_EXPORT, "html-linuxdoc");
- else
- tmpfunc->Dispatch(LFUN_EXPORT, "html-docbook");
+ case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
break;
case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
break;