#include <config.h>
-#ifdef HAVE_SSTREAM
-#include <sstream>
-using std::istringstream;
-#else
-#include <strstream>
-#endif
+#include "Lsstream.h"
#include <time.h>
#include <locale.h>
#include "bufferview_funcs.h"
#include "frontends/Dialogs.h"
#include "frontends/Toolbar.h"
-#ifdef NEW_MENUBAR
#include "frontends/Menubar.h"
-#else
-#include "menus.h"
-#endif
#include "FloatList.h"
#include "exporter.h"
#include "FontLoader.h"
extern bool cursor_follows_scrollbar;
extern void InsertAsciiFile(BufferView *, string const &, bool);
-extern void math_insert_symbol(char const *);
+extern void math_insert_symbol(string const &);
extern bool math_insert_greek(char);
extern BufferList bufferlist;
extern LyXServer * lyxserver;
extern bool MenuWrite(Buffer *);
extern bool MenuWriteAs(Buffer *);
-#ifdef NEW_MENUBAR
extern int MenuRunLaTeX(Buffer *);
-#endif
extern int MenuBuildProg(Buffer *);
extern int MenuRunChktex(Buffer *);
#ifndef NEW_EXPORT
extern bool PreviewDVI(Buffer *);
extern bool PreviewPostscript(Buffer *);
#endif
-extern void MenuInsertLabel(char const *);
+extern void MenuInsertLabel(string const &);
extern void MenuLayoutCharacter();
extern void MenuLayoutParagraph();
extern void MenuLayoutDocument();
bool tmp_sc = show_sc;
show_sc = false;
- Dispatch(action, argument.c_str());
+ Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
bool tmp_sc = show_sc;
show_sc = false;
- Dispatch(action, argument.c_str());
+ Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
}
-string LyXFunc::Dispatch(string const & s)
+string const LyXFunc::Dispatch(string const & s)
{
// Split command string into command and argument
- string cmd, line = frontStrip(s);
+ string cmd;
+ string line = frontStrip(s);
string arg = strip(frontStrip(split(line, cmd, ' ')));
- return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
+ return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg);
}
-string LyXFunc::Dispatch(int ac,
- char const * do_not_use_this_arg)
+string const LyXFunc::Dispatch(int ac,
+ string const & do_not_use_this_arg)
{
string argument;
kb_action action;
argument = tmparg;
} else {
action = static_cast<kb_action>(ac);
- if (do_not_use_this_arg)
+ if (!do_not_use_this_arg.empty())
argument = do_not_use_this_arg; // except here
}
Dispatch(int(LFUN_LAYOUT),
textclasslist.NameOfLayout(owner->view()
->buffer()->params.textclass,
- sel).c_str());
+ sel));
return string();
}
break;
case LFUN_MENU_OPEN_BY_NAME:
-#ifdef NEW_MENUBAR
owner->getMenubar()->openByName(argument);
-#else
- owner->getMenus()->openByName(argument);
-#endif
break; // RVDK_PATCH_5
case LFUN_SPELLCHECK:
cur_value = par->spacing.getValue();
}
-#ifdef HAVE_SSTREAM
istringstream istr(argument);
-#else
- istrstream istr(argument.c_str());
-#endif
+
string tmp;
istr >> tmp;
Spacing::Space new_spacing = cur_spacing;
case LFUN_GOTO_PARAGRAPH:
{
-#ifdef HAVE_SSTREAM
istringstream istr(argument);
-#else
- istrstream istr(argument.c_str());
-#endif
int id;
istr >> id;
}
}
} else {
- s = lyxrc.document_path + "newfile" + tostr(++newfile_number);
+ s = AddPath(lyxrc.document_path,
+ "newfile" + tostr(++newfile_number));
FileInfo fi(s);
while (bufferlist.exists(s) || fi.readable()) {
++newfile_number;
- s = lyxrc.document_path + "newfile" +
- tostr(newfile_number);
+ s = AddPath(lyxrc.document_path,
+ "newfile" + tostr(newfile_number));
fi.newFile(s);
}
}