InsetNote clean-up.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8226 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-12-10 17:28:14 +00:00
parent b1fcee4365
commit c2d7777341
21 changed files with 424 additions and 208 deletions

View File

@ -1,55 +1,11 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* FORMAT: document format 226.
2003-12-01 André Pönitz <poenitz@gmx.net>
* Code_rules/Recommendations:
* Code_rules/Rules:
+ try to implement your class in a way that the automatically generated
+ copy constructor and copy assignment work out-of-the box.
Index: Rules
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/Code_rules/Rules,v
retrieving revision 1.14
diff -u -p -r1.14 Rules
--- Rules 25 Sep 2002 14:26:09 -0000 1.14
+++ Rules 1 Dec 2003 13:48:53 -0000
@@ -247,20 +247,6 @@ Formatting
-NOT-
void mangle () // wrong
-* Use of braces
-
- We use braces a lot, even if this lowers the density of the code in
- some cases. In particular we use braces for one-liners in relation
- to if, while, etc.
-
- if (true) {
- do_that();
- }
- -NOT-
- if (true)
- do_that();
-
-
* Enumerators
enum {
one = 1,
@@ -293,12 +279,9 @@ Formatting
* Formatting
- - Please adapt the formatting of your code to the setting in LyX in that
- particular file. Lars and Asger are slowly, but surely moving the source
- towards Linux kernel style formatting, aka K&R style. We suggest that you
- also do this, but this is NOT something that has been decided generally.
- (a pity - jbl)
-
+ - Adapt the formatting of your code to the one used in the
+ other parts of LyX. In case there is different formatting for
+ the same construct, use the one used more often.
* Use existing structures
* Code_rules/Rules: updated
2003-11-05 João Luis M. Assirati <assirati@fma.if.usp.br>

View File

@ -1,5 +1,13 @@
LyX file-format changes
-----------------------
2003-12-10 Angus Leeming <leeming@lyx.org>
* Change the output of InsetNote:
\begin_inset Note -> \begin_inset Note Note
\begin_inset Comment -> \begin_inset Note Comment
\begin_inset Greyedout -> \begin_inset Note Greyedout
2003-11-28 André Pönitz
* Remove space_above/space_below from Paragraph.

View File

@ -1,3 +1,10 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* lyx2lyx: up the format to 226.
* lyxconvert_225.py:
* lyxrevert_226.py: convert the Note inset between formats 225 and 226.
2003-12-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* CREDITS: add Felix Kurth

View File

@ -40,7 +40,7 @@ opt.quiet = 0
format = re.compile(r"(\d)[\.,]?(\d\d)")
fileformat = re.compile(r"\\lyxformat\s*(\S*)")
lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225]
lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226]
def usage():
print """Usage: lyx2lyx [options] [file]

View File

@ -0,0 +1,36 @@
# This file is part of lyx2lyx
# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from parser_tools import find_tokens
def convert_note(lines):
i = 0
while 1:
i = find_tokens(lines, ["\\begin_inset Note",
"\\begin_inset Comment",
"\\begin_inset Greyedout"], i)
if i == -1:
break
lines[i] = lines[i][0:13] + 'Note ' + lines[i][13:]
i = i + 1
def convert(header, body):
convert_note(body)
if __name__ == "__main__":
pass

View File

@ -0,0 +1,35 @@
# This file is part of lyx2lyx
# Copyright (C) 2003 Jos<6F>é Matos <jamatos@fep.up.pt>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from parser_tools import find_token
def convert_note(lines):
note_header = "\\begin_inset Note "
i = 0
while 1:
i = find_token(lines, note_header, i)
if i == -1:
break
lines[i] = "\\begin_inset " + lines[i][len(note_header):]
i = i + 1
def convert(header, body):
convert_note(body)
if __name__ == "__main__":
pass

View File

@ -1,3 +1,9 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* buffer.C: up the format to 226.
* factory.C: the note inset is now identified simply by 'Note'.
2003-12-08 Alfredo Braunstein <abraunst@libero.it>
* lyxtext.h, text2.C (setLayout): don't use cursor to iterate,

View File

@ -132,7 +132,7 @@ extern BufferList bufferlist;
namespace {
const int LYX_FORMAT = 225;
const int LYX_FORMAT = 226;
} // namespace anon

View File

@ -402,8 +402,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
inset.reset(new InsetFormula);
} else if (tmptok == "Graphics") {
inset.reset(new InsetGraphics);
} else if (tmptok == "Note" || tmptok == "Comment"
|| tmptok == "Greyedout") {
} else if (tmptok == "Note") {
inset.reset(new InsetNote(buf.params(), tmptok));
} else if (tmptok == "Boxed" || tmptok == "ovalbox"
|| tmptok == "Shadowbox" || tmptok == "Doublebox"

View File

@ -1,3 +1,7 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* ControlNote.[Ch] (note_gui_tokens): removed; no longer needed.
2003-12-10 Angus Leeming <leeming@lyx.org>
* ControlBranch.C (dispatchParams): change to invocation of

View File

@ -16,7 +16,6 @@
#include "gettext.h"
using std::vector;
using std::string;
@ -45,15 +44,3 @@ void ControlNote::dispatchParams()
string const lfun = InsetNoteMailer::params2string(params());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
void note_gui_tokens(vector<string> & ids, vector<string> & gui_names)
{
char const * const ids_[] = {"Note", "Comment", "Greyedout"};
size_t const ids_size = sizeof(ids_) / sizeof(char *);
ids = vector<string>(ids_, ids_ + ids_size);
gui_names.clear();
gui_names.push_back(_("LyX Note"));
gui_names.push_back(_("Comment"));
gui_names.push_back(_("Greyed Out"));
}

View File

@ -40,7 +40,4 @@ private:
boost::scoped_ptr<InsetNoteParams> params_;
};
///
void note_gui_tokens(std::vector<std::string> &, std::vector<std::string> &);
#endif // CONTROLNOTE_H

View File

@ -1,3 +1,8 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* QNote.C: changes due to the change of type of InsetNoteParams::type
from string to an enum.
2003-12-10 Angus Leeming <leeming@lyx.org>
* lengthvalidator.[Ch]: make <qwidget.h> visible to the class.

View File

@ -44,14 +44,18 @@ void QNote::build_dialog()
void QNote::update_contents()
{
QRadioButton * rb = 0;
string type(controller().params().type);
if (type == "Note")
switch (controller().params().type) {
case InsetNoteParams::Note:
rb = dialog_->noteRB;
else if (type == "Comment")
break;
case InsetNoteParams::Comment:
rb = dialog_->commentRB;
else if (type == "Greyedout")
break;
case InsetNoteParams::Greyedout:
rb = dialog_->greyedoutRB;
break;
}
rb->setChecked(true);
}
@ -59,14 +63,14 @@ void QNote::update_contents()
void QNote::apply()
{
string type;
InsetNoteParams::Type type;
if (dialog_->greyedoutRB->isChecked())
type = "Greyedout";
type = InsetNoteParams::Greyedout;
else if (dialog_->commentRB->isChecked())
type = "Comment";
type = InsetNoteParams::Comment;
else
type = "Note";
type = InsetNoteParams::Note;
controller().params().type = type;
}

View File

@ -1,3 +1,12 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* FormNote.C: changes due to the change of type of InsetNoteParams::type
from string to an enum.
* FormNote.[Ch]:
* forms/form_note.fd: re-work so that it has a similar appearance to
that of the Qt frontend.
2003-12-05 Angus Leeming <leeming@lyx.org>
* FormVCLog.[Ch]: removed.

View File

@ -28,7 +28,7 @@ using std::string;
typedef FormController<ControlNote, FormView<FD_note> > base_class;
FormNote::FormNote(Dialog & parent)
: base_class(parent, _("Note"))
: base_class(parent, _("LyX: Note Settings"))
{}
@ -36,35 +36,49 @@ void FormNote::build()
{
dialog_.reset(build_note(this));
note_gui_tokens(ids_, gui_names_);
for (string::size_type i = 0; i < gui_names_.size(); ++i) {
fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
}
string str = _("Lyx Note: LyX internal only\n"
"Comment: Export to LaTeX but don't print\n"
"Greyed Out: Print as grey text");
tooltips().init(dialog_->choice_type, str);
tooltips().init(dialog_->radio_note,
_("LyX internal only"));
tooltips().init(dialog_->radio_comment,
_("Export to LaTeX/Docbook but don't print"));
tooltips().init(dialog_->radio_greyedout,
_("Print as grey text"));
bcview().setOK(dialog_->button_ok);
bcview().setApply(dialog_->button_apply);
bcview().setCancel(dialog_->button_cancel);
}
void FormNote::update()
{
string type(controller().params().type);
for (string::size_type i = 0; i < gui_names_.size(); ++i) {
if (type == ids_[i])
fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str());
}
FL_OBJECT * rb = 0;
switch (controller().params().type) {
case InsetNoteParams::Note:
rb = dialog_->radio_note;
break;
case InsetNoteParams::Comment:
rb = dialog_->radio_comment;
break;
case InsetNoteParams::Greyedout:
rb = dialog_->radio_greyedout;
break;
}
fl_set_button(rb, 1);
}
void FormNote::apply()
{
int i = fl_get_choice(dialog_->choice_type);
controller().params().type = ids_[i - 1];
InsetNoteParams::Type type;
if (fl_get_button(dialog_->radio_greyedout))
type = InsetNoteParams::Greyedout;
else if (fl_get_button(dialog_->radio_comment))
type = InsetNoteParams::Comment;
else
type = InsetNoteParams::Note;
controller().params().type = type;
}

View File

@ -32,10 +32,6 @@ private:
virtual void build();
/// Update dialog before showing it
virtual void update();
///
std::vector<std::string> ids_;
///
std::vector<std::string> gui_names_;
};
#endif // FORMNOTE_H

View File

@ -9,14 +9,14 @@ SnapGrid: 7
=============== FORM ===============
Name: form_note
Width: 407
Height: 113
Number of Objects: 5
Width: 225
Height: 155
Number of Objects: 9
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 407 113
box: 0 0 225 155
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -32,27 +32,117 @@ callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 154 21 217 28
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 10 10 205 105
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Note Type|#T
label: Type
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_type
name:
callback:
argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: group_types
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 25 185 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: LyX Note|#N
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_note
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 50 185 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Comment|#o
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_comment
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 75 185 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Greyed out|#G
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_greyedout
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_END_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 49 70 84 28
box: 10 120 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -70,25 +160,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 154 70 98 28
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Apply|#A
shortcut: ^M
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_apply
callback: C_FormDialogView_ApplyCB
argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 266 70 105 28
box: 125 120 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER

View File

@ -1,3 +1,10 @@
2003-12-10 Angus Leeming <leeming@lyx.org>
* insetnote.[Ch]: change the storage type of InsetNoteParams::type
to an enum. Ensuing clean-ups through out the class.
(read, write): now prepend the inset contents with 'Note' to identify
the inset as a note inset.
2003-12-10 Angus Leeming <leeming@lyx.org>
* insetbranch.[Ch]: changes to the InsetBranchMailer interface.

View File

@ -15,6 +15,7 @@
#include "insetnote.h"
#include "BufferView.h"
#include "debug.h"
#include "dispatchresult.h"
#include "funcrequest.h"
#include "gettext.h"
@ -24,7 +25,9 @@
#include "metricsinfo.h"
#include "paragraph.h"
#include "support/lyxalgo.h"
#include "support/std_sstream.h"
#include "support/translator.h"
using std::string;
@ -34,6 +37,64 @@ using std::ostream;
using std::ostringstream;
namespace {
typedef Translator<std::string, InsetNoteParams::Type> NoteTranslator;
NoteTranslator const init_notetranslator() {
NoteTranslator translator("Note", InsetNoteParams::Note);
translator.addPair("Comment", InsetNoteParams::Comment);
translator.addPair("Greyedout", InsetNoteParams::Greyedout);
return translator;
}
NoteTranslator const init_notetranslator_loc() {
NoteTranslator translator(_("Note"), InsetNoteParams::Note);
translator.addPair(_("Comment"), InsetNoteParams::Comment);
translator.addPair(_("Greyed out"), InsetNoteParams::Greyedout);
return translator;
}
NoteTranslator const & notetranslator() {
static NoteTranslator translator = init_notetranslator();
return translator;
}
NoteTranslator const & notetranslator_loc() {
static NoteTranslator translator = init_notetranslator_loc();
return translator;
}
} // anon
InsetNoteParams::InsetNoteParams()
: type(Note)
{}
void InsetNoteParams::write(ostream & os) const
{
string const label = notetranslator().find(type);
os << "Note " << label << "\n";
os << label << "\n";
}
void InsetNoteParams::read(LyXLex & lex)
{
string label;
lex >> label;
if (lex)
type = notetranslator().find(label);
}
void InsetNote::init()
{
setInsetName("Note");
@ -44,7 +105,7 @@ void InsetNote::init()
InsetNote::InsetNote(BufferParams const & bp, string const & label)
: InsetCollapsable(bp)
{
params_.type = label;
params_.type = notetranslator().find(label);
init();
}
@ -83,6 +144,7 @@ void InsetNote::write(Buffer const & buf, ostream & os) const
void InsetNote::read(Buffer const & buf, LyXLex & lex)
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
setButtonLabel();
}
@ -90,22 +152,26 @@ void InsetNote::read(Buffer const & buf, LyXLex & lex)
void InsetNote::setButtonLabel()
{
string const label = notetranslator_loc().find(params_.type);
setLabel(label);
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
if (params_.type == "Note") {
setLabel(_("LyX Note"));
switch (params_.type) {
case InsetNoteParams::Note:
font.setColor(LColor::note);
setBackgroundColor(LColor::notebg);
} else if (params_.type == "Comment") {
setLabel(_("Comment"));
break;
case InsetNoteParams::Comment:
font.setColor(LColor::comment);
setBackgroundColor(LColor::commentbg);
} else {
setLabel(_("Greyed Out"));
break;
case InsetNoteParams::Greyedout:
font.setColor(LColor::greyedout);
setBackgroundColor(LColor::greyedoutbg);
break;
}
setLabelFont(font);
}
@ -153,89 +219,94 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
int InsetNote::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
string const pt = params_.type;
if (params_.type == InsetNoteParams::Note)
return 0;
int i = 0;
if (pt == "Comment")
// verbatim
os << "%\n\\begin{comment}\n";
else if (pt == "Greyedout")
// we roll our own macro
os << "%\n\\begin{lyxgreyedout}\n";
string type;
if (params_.type == InsetNoteParams::Comment)
type = "comment";
else if (params_.type == InsetNoteParams::Greyedout)
type = "lyxgreyedout";
if (pt != "Note")
i = inset.latex(buf, os, runparams);
ostringstream ss;
ss << "%\n\\begin{" << type << "}\n";
inset.latex(buf, ss, runparams);
ss << "%\n\\end{" << type << "}\n";
if (pt == "Comment") {
os << "%\n\\end{comment}\n";
i += 4;
} else if (pt == "Greyedout") {
os << "%\n\\end{lyxgreyedout}\n";
i += 4;
}
return i;
string const str = ss.str();
os << str;
// Return how many newlines we issued.
return int(lyx::count(str.begin(), str.end(),'\n') + 1);
}
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os,
OutputParams const & runparams) const
{
string const pt = params_.type;
if (params_.type == InsetNoteParams::Note)
return 0;
int i = 0;
if (pt == "Comment")
os << "<comment>\n";
ostringstream ss;
if (params_.type == InsetNoteParams::Comment)
ss << "<comment>\n";
if (pt != "Note")
i = inset.linuxdoc(buf, os, runparams);
inset.linuxdoc(buf, ss, runparams);
if (pt == "Comment") {
os << "\n</comment>\n";
i += 3;
}
return i;
if (params_.type == InsetNoteParams::Comment)
ss << "\n</comment>\n";
string const str = ss.str();
os << str;
// Return how many newlines we issued.
return int(lyx::count(str.begin(), str.end(),'\n') + 1);
}
int InsetNote::docbook(Buffer const & buf, std::ostream & os,
OutputParams const & runparams) const
{
string const pt = params_.type;
if (params_.type == InsetNoteParams::Note)
return 0;
int i = 0;
if (pt == "Comment")
os << "<remark>\n";
ostringstream ss;
if (params_.type == InsetNoteParams::Comment)
ss << "<remark>\n";
if (pt != "Note")
i = inset.docbook(buf, os, runparams);
inset.docbook(buf, ss, runparams);
if (pt == "Comment") {
os << "\n</remark>\n";
i += 3;
}
return i;
if (params_.type == InsetNoteParams::Comment)
ss << "\n</remark>\n";
string const str = ss.str();
os << str;
// Return how many newlines we issued.
return int(lyx::count(str.begin(), str.end(),'\n') + 1);
}
int InsetNote::plaintext(Buffer const & buf, std::ostream & os,
OutputParams const & runparams) const
{
int i = 0;
string const pt = params_.type;
if (pt != "Note") {
os << "[";
i = inset.plaintext(buf, os, runparams);
os << "]";
}
return i;
if (params_.type == InsetNoteParams::Note)
return 0;
ostringstream ss;
ss << "[";
inset.plaintext(buf, ss, runparams);
ss << "]";
string const str = ss.str();
os << str;
// Return how many newlines we issued.
return int(lyx::count(str.begin(), str.end(),'\n') + 1);
}
void InsetNote::validate(LaTeXFeatures & features) const
{
if (params_.type == "Comment")
if (params_.type == InsetNoteParams::Comment)
features.require("verbatim");
if (params_.type == "Greyedout") {
if (params_.type == InsetNoteParams::Greyedout) {
features.require("color");
features.require("lyxgreyedout");
}
@ -277,25 +348,21 @@ void InsetNoteMailer::string2params(string const & in,
istringstream data(in);
LyXLex lex(0,0);
lex.setStream(data);
string name;
lex >> name;
if (!lex || name != name_) {
lyxerr << "InsetNoteMailer::string2params(" << in << ")\n"
<< "Missing identifier \"" << name_ << '"' << std::endl;
return;
}
// This is part of the inset proper that is usually swallowed
// by LyXText::readInset
string inset_id;
lex >> inset_id;
if (!lex || inset_id != "Note")
return;
params.read(lex);
}
void InsetNoteParams::write(ostream & os) const
{
os << type << "\n";
}
void InsetNoteParams::read(LyXLex & lex)
{
if (lex.isOK()) {
lex.next();
string token = lex.getString();
}
if (lex.isOK()) {
lex.next();
type = lex.getString();
}
}

View File

@ -16,12 +16,19 @@
struct InsetNoteParams {
enum Type {
Note,
Comment,
Greyedout
};
/// \c type defaults to Note
InsetNoteParams();
///
void write(std::ostream & os) const;
///
void read(LyXLex & lex);
///
std::string type;
Type type;
};