X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetlabel.C;h=590b50a65dd85f6a5218a630da96d86c7524a6c1;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=b13e406c2035d77f776be6f4b34954d237deeb1c;hpb=83acbbd5237373926c629855379e1df9a04209b2;p=lyx.git diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index b13e406c20..590b50a65d 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -16,11 +16,13 @@ #include "insetlabel.h" #include "support/LOstream.h" -#include "lyx_gui_misc.h" //askForText +#include "frontends/Alert.h" #include "support/lstrings.h" //frontStrip, strip #include "lyxtext.h" #include "buffer.h" #include "gettext.h" +#include "BufferView.h" +#include "support/lstrings.h" using std::ostream; using std::vector; @@ -29,7 +31,7 @@ using std::pair; /* Label. Used to insert a label automatically */ -InsetLabel::InsetLabel(InsetCommandParams const & p) +InsetLabel::InsetLabel(InsetCommandParams const & p, bool) : InsetCommand(p) {} @@ -40,14 +42,9 @@ vector const InsetLabel::getLabelList() const } -void InsetLabel::Edit(BufferView * bv, int, int, unsigned int) +void InsetLabel::edit(BufferView * bv, int, int, unsigned int) { - if (bv->buffer()->isReadonly()) { - WarnReadonly(bv->buffer()->fileName()); - return; - } - - pair result = askForText(_("Enter label:"), getContents()); + pair result = Alert::askForText(_("Enter label:"), getContents()); if (result.first) { string new_contents = frontStrip(strip(result.second)); if (!new_contents.empty() && @@ -56,10 +53,10 @@ void InsetLabel::Edit(BufferView * bv, int, int, unsigned int) bool flag = bv->ChangeRefsIfUnique(getContents(), new_contents); setContents(new_contents); - bv->text->RedoParagraph(bv); + bv->text->redoParagraph(bv); if (flag) { bv->redraw(); - bv->fitCursor(getLyXText(bv)); + bv->fitCursor(); } else bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -67,49 +64,35 @@ void InsetLabel::Edit(BufferView * bv, int, int, unsigned int) } -int InsetLabel::Latex(Buffer const *, ostream & os, +void InsetLabel::edit(BufferView * bv, bool) +{ + edit(bv, 0, 0, 0); +} + + +int InsetLabel::latex(Buffer const *, ostream & os, bool /*fragile*/, bool /*fs*/) const { os << escape(getCommand()); return 0; } -int InsetLabel::Ascii(Buffer const *, ostream & os, int) const +int InsetLabel::ascii(Buffer const *, ostream & os, int) const { os << "<" << getContents() << ">"; return 0; } -int InsetLabel::Linuxdoc(Buffer const *, ostream & os) const +int InsetLabel::linuxdoc(Buffer const *, ostream & os) const { os << "