*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1998 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
*
* ==================================================
*/
#include "lyx_main.h"
#include "lyxfunc.h"
#include "spellchecker.h"
-#include "filetools.h"
+#include "support/filetools.h"
#include "LyXView.h"
#include "lastfiles.h"
#include "bufferlist.h"
#include "minibuffer.h"
#include "lyxscreen.h"
#include "intl.h"
-#include "error.h"
+#include "debug.h"
#include "lyxrc.h"
#include "lyxtext.h"
#include "gettext.h"
-// $Id: menus.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: menus.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
-#endif /* lint */
-
extern FD_form_screen *fd_form_screen;
extern BufferList bufferlist;
extern void AllFloats(char flag, char figmar);
extern void LaTeXOptions();
+// A bunch of wrappers
+
+extern "C" void C_Menus_ShowFileMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowFileMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowFileMenu2(FL_OBJECT *ob, long data)
+{
+ Menus::ShowFileMenu2(ob, data);
+}
+
+extern "C" void C_Menus_ShowEditMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowEditMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowLayoutMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowLayoutMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowInsertMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowInsertMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowMathMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowMathMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowOptionsMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowOptionsMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowBufferMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowBufferMenu(ob, data);
+}
+
+extern "C" void C_Menus_ShowHelpMenu(FL_OBJECT *ob, long data)
+{
+ Menus::ShowHelpMenu(ob, data);
+}
+
+
Menus::Menus(LyXView *view,int air)
: _view(view)
{
}
-void Menus::openByName(LString const &menuName)
+void Menus::openByName(string const &menuName)
/* Opens the visible menu of given name, or simply does nothing
when the name is not known. NOTE THE EXTREMELY STUPID
IMPLEMENTATION! :-) There are probably hundred ways to do
else if (menuName == _("Options")) ShowOptionsMenu(menu_options, 0);
else if (menuName == _("Documents")) ShowBufferMenu(menu_buffer, 0);
else if (menuName == _("Help")) ShowHelpMenu(menu_help, 0);
- else lyxerr.print("The menu '" + menuName + "' is not available.");
+ else lyxerr << "The menu '" << menuName
+ << "' is not available." << endl;
} else {
if (menuName == _("File")) ShowFileMenu2(menu_file2, 0);
else if (menuName == _("Options")) ShowOptionsMenu(menu_options2, 0);
else if (menuName == _("Help")) ShowHelpMenu(menu_help2, 0);
- else lyxerr.print("The menu '" + menuName + "' is not available.");
+ else lyxerr << "The menu '" << menuName
+ << "' is not available." << endl;
}
}
mbheight,_("File"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
- fl_set_object_callback(obj,ShowFileMenu, 0);
+ fl_set_object_callback(obj,C_Menus_ShowFileMenu, 0);
obj->u_ldata = (long)this;
// Edit menu button
mbheight,_("Edit"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#E")),1);
- fl_set_object_callback(obj,ShowEditMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowEditMenu,0);
obj->u_ldata = (long) this;
// Layout menu button
mbheight,_("Layout"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
- fl_set_object_callback(obj,ShowLayoutMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowLayoutMenu,0);
obj->u_ldata = (long) this;
// Insert menu button button
mbheight,_("Insert"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#I")), 1);
- fl_set_object_callback(obj,ShowInsertMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowInsertMenu,0);
obj->u_ldata = (long) this;
// Math menu button
mbheight,_("Math"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#M")), 1);
- fl_set_object_callback(obj,ShowMathMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowMathMenu,0);
obj->u_ldata = (long) this;
// Options menu button
mbheight,_("Options"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
- fl_set_object_callback(obj,ShowOptionsMenu, 0);
+ fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
obj->u_ldata = (long) this;
// Documents menu button
mbheight,_("Documents"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#D")), 1);
- fl_set_object_callback(obj,ShowBufferMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowBufferMenu,0);
obj->u_ldata = (long) this;
// Help menu button
mbheight,_("Help"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
- fl_set_object_callback(obj,ShowHelpMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
obj->u_ldata = (long) this;
fl_end_group();
mbheight,_("File"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
- fl_set_object_callback(obj,ShowFileMenu2, 0);
+ fl_set_object_callback(obj,C_Menus_ShowFileMenu2, 0);
obj->u_ldata = (long)this;
// Options menu button
mbheight,_("Options"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
- fl_set_object_callback(obj,ShowOptionsMenu, 0);
+ fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
obj->u_ldata = (long) this;
// Help menu button
mbheight,_("Help"));
moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
- fl_set_object_callback(obj,ShowHelpMenu,0);
+ fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
obj->u_ldata = (long) this;
fl_end_group();
void Menus::ScreenOptions()
{
+ static int ow = -1, oh;
+
// this is not very nice....
fl_set_input(fd_form_screen->input_roman,
lyxrc->roman_font_name.c_str());
fl_show_form(fd_form_screen->form_screen,
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
_("Screen Options"));
+ if (ow < 0) {
+ ow = fd_form_screen->form_screen->w;
+ oh = fd_form_screen->form_screen->h;
+ }
+ fl_set_form_minsize(fd_form_screen->form_screen, ow, oh);
}
}
// remember to make this handle linuxdoc too.
// and now docbook also.
- int SubFileExport;
+ int SubFileExport = 0;
if (!LinuxDoc && !DocBook)
SubFileExport=fl_defpup(FL_ObjWin(ob),
_("Export%t"
"|as DVI...%x41"
"|as PostScript...%x42"
"|as Ascii Text...%x43"
- "|Custom...%x44"));
+ "|as HTML...%x44"
+ "|Custom...%x45"));
else if(LinuxDoc)
SubFileExport=fl_defpup(FL_ObjWin(ob),
_("Export%t"
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
fl_setpup_shortcut(SubFileExport, 42, scex(_("FEX|Pp#p#P")));
fl_setpup_shortcut(SubFileExport, 43, scex(_("FEX|Tt#t#T")));
- fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|mM#m#M")));
+ if (!LinuxDoc && !DocBook) {
+ fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|Hh#h#H")));
+ fl_setpup_shortcut(SubFileExport, 45, scex(_("FEX|mM#m#M")));
+ }
int FileMenu = fl_defpup(FL_ObjWin(ob),
_("New..."
// make the lastfiles menu
LastFiles_Iter liter(*lastfiles); // :-)
- LString filname;
+ string filname;
int ii = 1;
while( ii < 10 && !(filname = liter()).empty() ) {
- LString tmp;
- LString tmp2;
- LString relbuf = MakeDisplayPath(filname,30);
- tmp += ii;
+ string tmp;
+ string tmp2;
+ string relbuf = MakeDisplayPath(filname,30);
+ tmp += tostr(ii);
tmp2 = tmp;
tmp += ". " + relbuf;
- tmp2 += LString('#') + ii;
+ tmp2 += string("#") + tostr(ii);
fl_addtopup(FileMenu, tmp.c_str());
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
ii++;
break;
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
break;
- case 44: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
+ case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
+ break;
+ case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
break;
case 17: tmpfunc->Dispatch(LFUN_QUIT); break;
// Lastfiles:
// make the lastfiles menu
LastFiles_Iter liter(*lastfiles); // :-)
- LString filname;
+ string filname;
int ii = 1;
while( ii < 10 && !(filname = liter()).empty() ) {
- LString tmp;
- LString tmp2;
- LString relbuf = MakeDisplayPath(filname,30);
- tmp += ii;
+ string tmp;
+ string tmp2;
+ string relbuf = MakeDisplayPath(filname,30);
+ tmp += tostr(ii);
tmp2 = tmp;
tmp += ". " + relbuf;
- tmp2 += LString('#') + ii;
+ tmp2 += string("#") + tostr(ii);
fl_addtopup(FileMenu, tmp.c_str());
fl_setpup_shortcut(FileMenu, 6 - 1 + ii, tmp2.c_str());
ii++;
fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
// disable unavailable entries.
- if(tmpbuffer->undostack.Top() == NULL)
+ if(tmpbuffer->undostack.Top() == 0)
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
- if(tmpbuffer->redostack.Top() == NULL)
+ if(tmpbuffer->redostack.Top() == 0)
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
if(lyxrc->isp_command == "none")
fl_setpup_mode(EditMenu, 11, FL_PUP_GREY);
case 10: ShowCredits(); break;
case 11:
ProhibitInput();
- fl_show_message((LString(_("LyX Version ")) + LYX_VERSION
+ fl_show_message((string(_("LyX Version ")) + LYX_VERSION
+ _(" of ") + LYX_RELEASE).c_str(),
(_("Library directory: ")
+ MakeDisplayPath(system_lyxdir)).c_str(),
}
-void Menus::MenuDocu(LString const &docname)
+void Menus::MenuDocu(string const &docname)
{
- LString fname = i18nLibFileSearch("doc", docname, "lyx");
+ string fname = i18nLibFileSearch("doc", docname, "lyx");
_view->getMiniBuffer()->Set(_("Opening help file"),
MakeDisplayPath(fname),"...");
currentView()->setBuffer(bufferlist.loadLyXFile(fname,false));