mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix two stupid bugs; fix stupidly a more subtile one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@927 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fcaee30687
commit
aa5aac89de
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
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().
|
||||
|
@ -16,6 +16,10 @@ Menuset
|
||||
Submenu "Help|H" "help"
|
||||
End
|
||||
|
||||
MenuBar "main"
|
||||
Submenu "File|F" "file"
|
||||
End
|
||||
|
||||
Menubar "main_nobuffer"
|
||||
Submenu "File|F" "file_nobuffer"
|
||||
Submenu "Options|O" "options"
|
||||
@ -74,9 +78,7 @@ Menuset
|
||||
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
|
||||
|
||||
|
@ -64,7 +64,7 @@ Menu & Menu::add(MenuItem const & i)
|
||||
}
|
||||
|
||||
|
||||
void Menu::read(LyXLex & lex)
|
||||
Menu & Menu::read(LyXLex & lex)
|
||||
{
|
||||
enum Menutags {
|
||||
md_item = 1,
|
||||
@ -140,6 +140,7 @@ void Menu::read(LyXLex & lex)
|
||||
}
|
||||
}
|
||||
lex.popTable();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -168,23 +169,29 @@ void MenuBackend::read(LyXLex & lex)
|
||||
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:
|
||||
@ -284,3 +291,16 @@ Menu const & MenuBackend::getMenu(string const & name) const
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
///
|
||||
Menu & add(MenuItem const &);
|
||||
///
|
||||
void read(LyXLex &);
|
||||
Menu & read(LyXLex &);
|
||||
///
|
||||
bool menubar() const { return menubar_; }
|
||||
///
|
||||
@ -128,6 +128,8 @@ public:
|
||||
///
|
||||
bool hasMenu (string const &) const;
|
||||
///
|
||||
Menu & getMenu (string const &);
|
||||
///
|
||||
Menu const & getMenu (string const &) const;
|
||||
//
|
||||
bool empty() const { return menulist_.empty(); }
|
||||
|
@ -7,6 +7,7 @@ _("Options|O");
|
||||
_("Documents|D");
|
||||
_("Help|H");
|
||||
_("File|F");
|
||||
_("File|F");
|
||||
_("Options|O");
|
||||
_("Help|H");
|
||||
_("New...|N");
|
||||
@ -42,8 +43,6 @@ _("as DVI|D");
|
||||
_("as Postscript|P");
|
||||
_("as Ascii|A");
|
||||
_("as HTML|H");
|
||||
_("as HTML|H");
|
||||
_("as HTML|H");
|
||||
_("Custom...|C");
|
||||
_("Undo|U");
|
||||
_("Redo|R");
|
||||
|
@ -158,7 +158,7 @@ void Menubar::Pimpl::set(string const & menu_name)
|
||||
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,
|
||||
@ -175,6 +175,7 @@ void Menubar::Pimpl::set(string const & menu_name)
|
||||
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);
|
||||
@ -191,6 +192,15 @@ void Menubar::Pimpl::set(string const & menu_name)
|
||||
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;
|
||||
}
|
||||
|
||||
|
15
src/lyx_cb.C
15
src/lyx_cb.C
@ -934,15 +934,12 @@ void MenuExport(Buffer * buffer, string const & extyp)
|
||||
}
|
||||
// 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);
|
||||
|
@ -349,13 +349,13 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,14 +396,12 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
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;
|
||||
|
@ -725,13 +725,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user