X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfunc.C;h=5c6eece450d21a820e797518a324d35a5c30c503;hb=0031da054f072922ed081bc8a877ffd8eb280210;hp=0d9c79a790cac6bfcfaf3d0a23d836edaba50668;hpb=e1cd322547158c885f3fa3543331a98f70800ba0;p=features.git diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 0d9c79a790..5c6eece450 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -10,12 +10,7 @@ #include -#ifdef HAVE_SSTREAM -#include -using std::istringstream; -#else -#include -#endif +#include "Lsstream.h" #include #include @@ -86,11 +81,7 @@ using std::istringstream; #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" @@ -102,7 +93,7 @@ using std::endl; 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; @@ -113,9 +104,7 @@ extern kb_keymap * toplevel_keymap; 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 @@ -139,7 +128,7 @@ extern void AutoSave(BufferView *); 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(); @@ -309,7 +298,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state) bool tmp_sc = show_sc; show_sc = false; - Dispatch(action, argument.c_str()); + Dispatch(action, argument); show_sc = tmp_sc; return 0; @@ -443,7 +432,7 @@ int LyXFunc::processKeyEvent(XEvent * ev) bool tmp_sc = show_sc; show_sc = false; - Dispatch(action, argument.c_str()); + Dispatch(action, argument); show_sc = tmp_sc; return 0; @@ -658,18 +647,19 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const } -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; @@ -687,7 +677,7 @@ string LyXFunc::Dispatch(int ac, argument = tmparg; } else { action = static_cast(ac); - if (do_not_use_this_arg) + if (!do_not_use_this_arg.empty()) argument = do_not_use_this_arg; // except here } @@ -1399,7 +1389,7 @@ string LyXFunc::Dispatch(int ac, Dispatch(int(LFUN_LAYOUT), textclasslist.NameOfLayout(owner->view() ->buffer()->params.textclass, - sel).c_str()); + sel)); return string(); } @@ -1630,11 +1620,7 @@ string LyXFunc::Dispatch(int ac, 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: @@ -2232,11 +2218,8 @@ string LyXFunc::Dispatch(int ac, 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; @@ -2534,11 +2517,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_GOTO_PARAGRAPH: { -#ifdef HAVE_SSTREAM istringstream istr(argument); -#else - istrstream istr(argument.c_str()); -#endif int id; istr >> id; @@ -3228,12 +3207,13 @@ void LyXFunc::MenuNew(bool fromTemplate) } } } 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); } }