mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +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>
|
2000-07-26 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* src/buffer.h: added functions setUnnamed(bool) and isUnnamed().
|
* src/buffer.h: added functions setUnnamed(bool) and isUnnamed().
|
||||||
|
@ -16,6 +16,10 @@ Menuset
|
|||||||
Submenu "Help|H" "help"
|
Submenu "Help|H" "help"
|
||||||
End
|
End
|
||||||
|
|
||||||
|
MenuBar "main"
|
||||||
|
Submenu "File|F" "file"
|
||||||
|
End
|
||||||
|
|
||||||
Menubar "main_nobuffer"
|
Menubar "main_nobuffer"
|
||||||
Submenu "File|F" "file_nobuffer"
|
Submenu "File|F" "file_nobuffer"
|
||||||
Submenu "Options|O" "options"
|
Submenu "Options|O" "options"
|
||||||
@ -74,9 +78,7 @@ Menuset
|
|||||||
Item "as DVI|D" "buffer-export dvi"
|
Item "as DVI|D" "buffer-export dvi"
|
||||||
Item "as Postscript|P" "buffer-export postscript"
|
Item "as Postscript|P" "buffer-export postscript"
|
||||||
Item "as Ascii|A" "buffer-export ascii"
|
Item "as Ascii|A" "buffer-export ascii"
|
||||||
OptItem "as HTML|H" "buffer-export html"
|
Item "as HTML|H" "buffer-export html"
|
||||||
OptItem "as HTML|H" "buffer-export html-linuxdoc"
|
|
||||||
OptItem "as HTML|H" "buffer-export html-docbook"
|
|
||||||
OptItem "Custom...|C" "buffer-export custom"
|
OptItem "Custom...|C" "buffer-export custom"
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ Menu & Menu::add(MenuItem const & i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menu::read(LyXLex & lex)
|
Menu & Menu::read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
enum Menutags {
|
enum Menutags {
|
||||||
md_item = 1,
|
md_item = 1,
|
||||||
@ -140,6 +140,7 @@ void Menu::read(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lex.popTable();
|
lex.popTable();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,23 +169,29 @@ void MenuBackend::read(LyXLex & lex)
|
|||||||
lex.printTable(lyxerr);
|
lex.printTable(lyxerr);
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
|
bool menubar = false;
|
||||||
|
|
||||||
while (lex.IsOK() && !quit) {
|
while (lex.IsOK() && !quit) {
|
||||||
switch(lex.lex()) {
|
switch(lex.lex()) {
|
||||||
|
case md_menubar:
|
||||||
|
menubar = true;
|
||||||
|
// fallback to md_menu
|
||||||
case md_menu: {
|
case md_menu: {
|
||||||
lex.next();
|
lex.next();
|
||||||
string name = lex.GetString();
|
string name = lex.GetString();
|
||||||
Menu menu(name, false);
|
if (hasMenu(name)) {
|
||||||
menu.read(lex);
|
if (getMenu(name).menubar() == menubar) {
|
||||||
add(menu);
|
getMenu(name).read(lex);
|
||||||
break;
|
} else {
|
||||||
}
|
lex.printError("Cannot append to menu `$$Token' unless it is of the same type");
|
||||||
case md_menubar: {
|
return;
|
||||||
lex.next();
|
}
|
||||||
string name = lex.GetString();
|
} else {
|
||||||
Menu menubar(name, true);
|
Menu menu(name, menubar);
|
||||||
menubar.read(lex);
|
menu.read(lex);
|
||||||
add(menubar);
|
add(menu);
|
||||||
|
}
|
||||||
|
menubar = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case md_endmenuset:
|
case md_endmenuset:
|
||||||
@ -284,3 +291,16 @@ Menu const & MenuBackend::getMenu(string const & name) const
|
|||||||
Assert(false); // we actually require the name to exist.
|
Assert(false); // we actually require the name to exist.
|
||||||
return menulist_.front();
|
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 &);
|
Menu & add(MenuItem const &);
|
||||||
///
|
///
|
||||||
void read(LyXLex &);
|
Menu & read(LyXLex &);
|
||||||
///
|
///
|
||||||
bool menubar() const { return menubar_; }
|
bool menubar() const { return menubar_; }
|
||||||
///
|
///
|
||||||
@ -128,6 +128,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool hasMenu (string const &) const;
|
bool hasMenu (string const &) const;
|
||||||
///
|
///
|
||||||
|
Menu & getMenu (string const &);
|
||||||
|
///
|
||||||
Menu const & getMenu (string const &) const;
|
Menu const & getMenu (string const &) const;
|
||||||
//
|
//
|
||||||
bool empty() const { return menulist_.empty(); }
|
bool empty() const { return menulist_.empty(); }
|
||||||
|
@ -7,6 +7,7 @@ _("Options|O");
|
|||||||
_("Documents|D");
|
_("Documents|D");
|
||||||
_("Help|H");
|
_("Help|H");
|
||||||
_("File|F");
|
_("File|F");
|
||||||
|
_("File|F");
|
||||||
_("Options|O");
|
_("Options|O");
|
||||||
_("Help|H");
|
_("Help|H");
|
||||||
_("New...|N");
|
_("New...|N");
|
||||||
@ -42,8 +43,6 @@ _("as DVI|D");
|
|||||||
_("as Postscript|P");
|
_("as Postscript|P");
|
||||||
_("as Ascii|A");
|
_("as Ascii|A");
|
||||||
_("as HTML|H");
|
_("as HTML|H");
|
||||||
_("as HTML|H");
|
|
||||||
_("as HTML|H");
|
|
||||||
_("Custom...|C");
|
_("Custom...|C");
|
||||||
_("Undo|U");
|
_("Undo|U");
|
||||||
_("Redo|R");
|
_("Redo|R");
|
||||||
|
@ -158,7 +158,7 @@ void Menubar::Pimpl::set(string const & menu_name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
string label = i->label();
|
string label = i->label();
|
||||||
string shortcut = i->shortcut();
|
string shortcut = '#' + i->shortcut();
|
||||||
int width = string_width(label);
|
int width = string_width(label);
|
||||||
obj = fl_add_button(FL_TOUCH_BUTTON,
|
obj = fl_add_button(FL_TOUCH_BUTTON,
|
||||||
air + moffset, yloc,
|
air + moffset, yloc,
|
||||||
@ -175,6 +175,7 @@ void Menubar::Pimpl::set(string const & menu_name)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, shortcut.c_str(), 1);
|
fl_set_object_shortcut(obj, shortcut.c_str(), 1);
|
||||||
fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1);
|
fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1);
|
||||||
|
|
||||||
ItemInfo * iteminfo = new ItemInfo(this,
|
ItemInfo * iteminfo = new ItemInfo(this,
|
||||||
new MenuItem(*i), obj);
|
new MenuItem(*i), obj);
|
||||||
buttonlist_.push_back(iteminfo);
|
buttonlist_.push_back(iteminfo);
|
||||||
@ -191,6 +192,15 @@ void Menubar::Pimpl::set(string const & menu_name)
|
|||||||
if (!form_was_open)
|
if (!form_was_open)
|
||||||
fl_end_form();
|
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;
|
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
|
// HTML
|
||||||
else if (extyp == "html") {
|
else if (extyp == "html") {
|
||||||
MenuMakeHTML(buffer);
|
if (buffer->isLinuxDoc())
|
||||||
}
|
MenuMakeHTML_LinuxDoc(buffer);
|
||||||
// HTML from linuxdoc
|
else if (buffer->isDocBook())
|
||||||
else if (extyp == "html-linuxdoc") {
|
MenuMakeHTML_DocBook(buffer);
|
||||||
MenuMakeHTML_LinuxDoc(buffer);
|
else
|
||||||
}
|
MenuMakeHTML(buffer);
|
||||||
// HTML from docbook
|
|
||||||
else if (extyp == "html-docbook") {
|
|
||||||
MenuMakeHTML_DocBook(buffer);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ShowMessage(buffer, _("Unknown export type: ") + extyp);
|
ShowMessage(buffer, _("Unknown export type: ") + extyp);
|
||||||
|
@ -349,13 +349,13 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
// no
|
// no
|
||||||
setErrorMessage(N_("Document is read-only"));
|
setErrorMessage(N_("Document is read-only"));
|
||||||
flag |= LyXFunc::Disabled;
|
flag |= LyXFunc::Disabled;
|
||||||
return flag;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// no
|
// no
|
||||||
setErrorMessage(N_("Command not allowed with"
|
setErrorMessage(N_("Command not allowed with"
|
||||||
"out any document open"));
|
"out any document open"));
|
||||||
flag |= LyXFunc::Disabled;
|
flag |= LyXFunc::Disabled;
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,14 +396,12 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
else if (argument == "dvi" || argument == "postscript")
|
else if (argument == "dvi" || argument == "postscript")
|
||||||
disable = noLaTeX;
|
disable = noLaTeX;
|
||||||
else if (argument == "html")
|
else if (argument == "html")
|
||||||
disable = (! buf->isLatex()
|
disable = (buf->isLinuxDoc()
|
||||||
|| lyxrc.html_command == "none");
|
&& lyxrc.linuxdoc_to_html_command == "none")
|
||||||
else if (argument == "html-linuxdoc")
|
|| (buf->isDocBook()
|
||||||
disable = (! buf->isLinuxDoc()
|
&& lyxrc.docbook_to_html_command == "none")
|
||||||
|| lyxrc.linuxdoc_to_html_command == "none");
|
|| (! buf->isLinuxDoc() && ! buf->isDocBook()
|
||||||
else if (argument == "html-docbook")
|
&& lyxrc.html_command == "none");
|
||||||
disable = (! buf->isDocBook()
|
|
||||||
|| lyxrc.docbook_to_html_command == "none");
|
|
||||||
else if (argument == "custom")
|
else if (argument == "custom")
|
||||||
disable = ! buf->isLatex();
|
disable = ! buf->isLatex();
|
||||||
break;
|
break;
|
||||||
|
@ -725,13 +725,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
break;
|
break;
|
||||||
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
|
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
|
||||||
break;
|
break;
|
||||||
case 44:
|
case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
|
||||||
if (!LinuxDoc && !DocBook)
|
|
||||||
tmpfunc->Dispatch(LFUN_EXPORT, "html");
|
|
||||||
else if(LinuxDoc)
|
|
||||||
tmpfunc->Dispatch(LFUN_EXPORT, "html-linuxdoc");
|
|
||||||
else
|
|
||||||
tmpfunc->Dispatch(LFUN_EXPORT, "html-docbook");
|
|
||||||
break;
|
break;
|
||||||
case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
|
case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user