mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
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:
parent
b1fcee4365
commit
c2d7777341
@ -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>
|
2003-12-01 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* Code_rules/Recommendations:
|
* Code_rules/Recommendations:
|
||||||
* Code_rules/Rules:
|
* Code_rules/Rules: updated
|
||||||
+ 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
|
|
||||||
|
|
||||||
|
|
||||||
2003-11-05 João Luis M. Assirati <assirati@fma.if.usp.br>
|
2003-11-05 João Luis M. Assirati <assirati@fma.if.usp.br>
|
||||||
|
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
LyX file-format changes
|
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
|
2003-11-28 André Pönitz
|
||||||
|
|
||||||
* Remove space_above/space_below from Paragraph.
|
* Remove space_above/space_below from Paragraph.
|
||||||
|
@ -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>
|
2003-12-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* CREDITS: add Felix Kurth
|
* CREDITS: add Felix Kurth
|
||||||
|
@ -40,7 +40,7 @@ opt.quiet = 0
|
|||||||
|
|
||||||
format = re.compile(r"(\d)[\.,]?(\d\d)")
|
format = re.compile(r"(\d)[\.,]?(\d\d)")
|
||||||
fileformat = re.compile(r"\\lyxformat\s*(\S*)")
|
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():
|
def usage():
|
||||||
print """Usage: lyx2lyx [options] [file]
|
print """Usage: lyx2lyx [options] [file]
|
||||||
|
36
lib/lyx2lyx/lyxconvert_225.py
Normal file
36
lib/lyx2lyx/lyxconvert_225.py
Normal 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
|
35
lib/lyx2lyx/lyxrevert_226.py
Normal file
35
lib/lyx2lyx/lyxrevert_226.py
Normal 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
|
@ -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>
|
2003-12-08 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* lyxtext.h, text2.C (setLayout): don't use cursor to iterate,
|
* lyxtext.h, text2.C (setLayout): don't use cursor to iterate,
|
||||||
|
@ -132,7 +132,7 @@ extern BufferList bufferlist;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const int LYX_FORMAT = 225;
|
const int LYX_FORMAT = 226;
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
@ -402,8 +402,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
|
|||||||
inset.reset(new InsetFormula);
|
inset.reset(new InsetFormula);
|
||||||
} else if (tmptok == "Graphics") {
|
} else if (tmptok == "Graphics") {
|
||||||
inset.reset(new InsetGraphics);
|
inset.reset(new InsetGraphics);
|
||||||
} else if (tmptok == "Note" || tmptok == "Comment"
|
} else if (tmptok == "Note") {
|
||||||
|| tmptok == "Greyedout") {
|
|
||||||
inset.reset(new InsetNote(buf.params(), tmptok));
|
inset.reset(new InsetNote(buf.params(), tmptok));
|
||||||
} else if (tmptok == "Boxed" || tmptok == "ovalbox"
|
} else if (tmptok == "Boxed" || tmptok == "ovalbox"
|
||||||
|| tmptok == "Shadowbox" || tmptok == "Doublebox"
|
|| tmptok == "Shadowbox" || tmptok == "Doublebox"
|
||||||
|
@ -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>
|
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* ControlBranch.C (dispatchParams): change to invocation of
|
* ControlBranch.C (dispatchParams): change to invocation of
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
@ -45,15 +44,3 @@ void ControlNote::dispatchParams()
|
|||||||
string const lfun = InsetNoteMailer::params2string(params());
|
string const lfun = InsetNoteMailer::params2string(params());
|
||||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
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"));
|
|
||||||
}
|
|
||||||
|
@ -40,7 +40,4 @@ private:
|
|||||||
boost::scoped_ptr<InsetNoteParams> params_;
|
boost::scoped_ptr<InsetNoteParams> params_;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
|
||||||
void note_gui_tokens(std::vector<std::string> &, std::vector<std::string> &);
|
|
||||||
|
|
||||||
#endif // CONTROLNOTE_H
|
#endif // CONTROLNOTE_H
|
||||||
|
@ -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>
|
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* lengthvalidator.[Ch]: make <qwidget.h> visible to the class.
|
* lengthvalidator.[Ch]: make <qwidget.h> visible to the class.
|
||||||
|
@ -44,14 +44,18 @@ void QNote::build_dialog()
|
|||||||
void QNote::update_contents()
|
void QNote::update_contents()
|
||||||
{
|
{
|
||||||
QRadioButton * rb = 0;
|
QRadioButton * rb = 0;
|
||||||
string type(controller().params().type);
|
|
||||||
|
|
||||||
if (type == "Note")
|
switch (controller().params().type) {
|
||||||
|
case InsetNoteParams::Note:
|
||||||
rb = dialog_->noteRB;
|
rb = dialog_->noteRB;
|
||||||
else if (type == "Comment")
|
break;
|
||||||
|
case InsetNoteParams::Comment:
|
||||||
rb = dialog_->commentRB;
|
rb = dialog_->commentRB;
|
||||||
else if (type == "Greyedout")
|
break;
|
||||||
|
case InsetNoteParams::Greyedout:
|
||||||
rb = dialog_->greyedoutRB;
|
rb = dialog_->greyedoutRB;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
rb->setChecked(true);
|
rb->setChecked(true);
|
||||||
}
|
}
|
||||||
@ -59,14 +63,14 @@ void QNote::update_contents()
|
|||||||
|
|
||||||
void QNote::apply()
|
void QNote::apply()
|
||||||
{
|
{
|
||||||
string type;
|
InsetNoteParams::Type type;
|
||||||
|
|
||||||
if (dialog_->greyedoutRB->isChecked())
|
if (dialog_->greyedoutRB->isChecked())
|
||||||
type = "Greyedout";
|
type = InsetNoteParams::Greyedout;
|
||||||
else if (dialog_->commentRB->isChecked())
|
else if (dialog_->commentRB->isChecked())
|
||||||
type = "Comment";
|
type = InsetNoteParams::Comment;
|
||||||
else
|
else
|
||||||
type = "Note";
|
type = InsetNoteParams::Note;
|
||||||
|
|
||||||
controller().params().type = type;
|
controller().params().type = type;
|
||||||
}
|
}
|
||||||
|
@ -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>
|
2003-12-05 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* FormVCLog.[Ch]: removed.
|
* FormVCLog.[Ch]: removed.
|
||||||
|
@ -28,7 +28,7 @@ using std::string;
|
|||||||
typedef FormController<ControlNote, FormView<FD_note> > base_class;
|
typedef FormController<ControlNote, FormView<FD_note> > base_class;
|
||||||
|
|
||||||
FormNote::FormNote(Dialog & parent)
|
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));
|
dialog_.reset(build_note(this));
|
||||||
|
|
||||||
note_gui_tokens(ids_, gui_names_);
|
|
||||||
|
|
||||||
for (string::size_type i = 0; i < gui_names_.size(); ++i) {
|
tooltips().init(dialog_->radio_note,
|
||||||
fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
|
_("LyX internal only"));
|
||||||
}
|
tooltips().init(dialog_->radio_comment,
|
||||||
|
_("Export to LaTeX/Docbook but don't print"));
|
||||||
string str = _("Lyx Note: LyX internal only\n"
|
tooltips().init(dialog_->radio_greyedout,
|
||||||
"Comment: Export to LaTeX but don't print\n"
|
_("Print as grey text"));
|
||||||
"Greyed Out: Print as grey text");
|
|
||||||
tooltips().init(dialog_->choice_type, str);
|
|
||||||
|
|
||||||
bcview().setOK(dialog_->button_ok);
|
bcview().setOK(dialog_->button_ok);
|
||||||
bcview().setApply(dialog_->button_apply);
|
|
||||||
bcview().setCancel(dialog_->button_cancel);
|
bcview().setCancel(dialog_->button_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormNote::update()
|
void FormNote::update()
|
||||||
{
|
{
|
||||||
string type(controller().params().type);
|
FL_OBJECT * rb = 0;
|
||||||
for (string::size_type i = 0; i < gui_names_.size(); ++i) {
|
|
||||||
if (type == ids_[i])
|
switch (controller().params().type) {
|
||||||
fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str());
|
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()
|
void FormNote::apply()
|
||||||
{
|
{
|
||||||
int i = fl_get_choice(dialog_->choice_type);
|
InsetNoteParams::Type type;
|
||||||
controller().params().type = ids_[i - 1];
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,6 @@ private:
|
|||||||
virtual void build();
|
virtual void build();
|
||||||
/// Update dialog before showing it
|
/// Update dialog before showing it
|
||||||
virtual void update();
|
virtual void update();
|
||||||
///
|
|
||||||
std::vector<std::string> ids_;
|
|
||||||
///
|
|
||||||
std::vector<std::string> gui_names_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORMNOTE_H
|
#endif // FORMNOTE_H
|
||||||
|
@ -9,14 +9,14 @@ SnapGrid: 7
|
|||||||
|
|
||||||
=============== FORM ===============
|
=============== FORM ===============
|
||||||
Name: form_note
|
Name: form_note
|
||||||
Width: 407
|
Width: 225
|
||||||
Height: 113
|
Height: 155
|
||||||
Number of Objects: 5
|
Number of Objects: 9
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
type: UP_BOX
|
type: UP_BOX
|
||||||
box: 0 0 407 113
|
box: 0 0 225 155
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -32,27 +32,117 @@ callback:
|
|||||||
argument:
|
argument:
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_CHOICE
|
class: FL_LABELFRAME
|
||||||
type: NORMAL_CHOICE
|
type: ENGRAVED_FRAME
|
||||||
box: 154 21 217 28
|
box: 10 10 205 105
|
||||||
boxtype: FL_FRAME_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_COL1 FL_BLACK
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
style: FL_NORMAL_STYLE
|
style: FL_NORMAL_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
label: Note Type|#T
|
label: Type
|
||||||
shortcut:
|
shortcut:
|
||||||
resize: FL_RESIZE_ALL
|
resize: FL_RESIZE_ALL
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
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
|
callback: C_FormDialogView_InputCB
|
||||||
argument: 0
|
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
|
class: FL_BUTTON
|
||||||
type: RETURN_BUTTON
|
type: RETURN_BUTTON
|
||||||
box: 49 70 84 28
|
box: 10 120 90 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -70,25 +160,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: RETURN_BUTTON
|
type: RETURN_BUTTON
|
||||||
box: 154 70 98 28
|
box: 125 120 90 25
|
||||||
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
|
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
|
@ -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>
|
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* insetbranch.[Ch]: changes to the InsetBranchMailer interface.
|
* insetbranch.[Ch]: changes to the InsetBranchMailer interface.
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "insetnote.h"
|
#include "insetnote.h"
|
||||||
|
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
|
#include "debug.h"
|
||||||
#include "dispatchresult.h"
|
#include "dispatchresult.h"
|
||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -24,7 +25,9 @@
|
|||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
|
|
||||||
|
#include "support/lyxalgo.h"
|
||||||
#include "support/std_sstream.h"
|
#include "support/std_sstream.h"
|
||||||
|
#include "support/translator.h"
|
||||||
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -34,6 +37,64 @@ using std::ostream;
|
|||||||
using std::ostringstream;
|
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()
|
void InsetNote::init()
|
||||||
{
|
{
|
||||||
setInsetName("Note");
|
setInsetName("Note");
|
||||||
@ -44,7 +105,7 @@ void InsetNote::init()
|
|||||||
InsetNote::InsetNote(BufferParams const & bp, string const & label)
|
InsetNote::InsetNote(BufferParams const & bp, string const & label)
|
||||||
: InsetCollapsable(bp)
|
: InsetCollapsable(bp)
|
||||||
{
|
{
|
||||||
params_.type = label;
|
params_.type = notetranslator().find(label);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +144,7 @@ void InsetNote::write(Buffer const & buf, ostream & os) const
|
|||||||
|
|
||||||
void InsetNote::read(Buffer const & buf, LyXLex & lex)
|
void InsetNote::read(Buffer const & buf, LyXLex & lex)
|
||||||
{
|
{
|
||||||
|
params_.read(lex);
|
||||||
InsetCollapsable::read(buf, lex);
|
InsetCollapsable::read(buf, lex);
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
}
|
}
|
||||||
@ -90,22 +152,26 @@ void InsetNote::read(Buffer const & buf, LyXLex & lex)
|
|||||||
|
|
||||||
void InsetNote::setButtonLabel()
|
void InsetNote::setButtonLabel()
|
||||||
{
|
{
|
||||||
|
string const label = notetranslator_loc().find(params_.type);
|
||||||
|
setLabel(label);
|
||||||
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
if (params_.type == "Note") {
|
switch (params_.type) {
|
||||||
setLabel(_("LyX Note"));
|
case InsetNoteParams::Note:
|
||||||
font.setColor(LColor::note);
|
font.setColor(LColor::note);
|
||||||
setBackgroundColor(LColor::notebg);
|
setBackgroundColor(LColor::notebg);
|
||||||
} else if (params_.type == "Comment") {
|
break;
|
||||||
setLabel(_("Comment"));
|
case InsetNoteParams::Comment:
|
||||||
font.setColor(LColor::comment);
|
font.setColor(LColor::comment);
|
||||||
setBackgroundColor(LColor::commentbg);
|
setBackgroundColor(LColor::commentbg);
|
||||||
} else {
|
break;
|
||||||
setLabel(_("Greyed Out"));
|
case InsetNoteParams::Greyedout:
|
||||||
font.setColor(LColor::greyedout);
|
font.setColor(LColor::greyedout);
|
||||||
setBackgroundColor(LColor::greyedoutbg);
|
setBackgroundColor(LColor::greyedoutbg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setLabelFont(font);
|
setLabelFont(font);
|
||||||
}
|
}
|
||||||
@ -153,89 +219,94 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
|
|||||||
int InsetNote::latex(Buffer const & buf, ostream & os,
|
int InsetNote::latex(Buffer const & buf, ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
string const pt = params_.type;
|
if (params_.type == InsetNoteParams::Note)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int i = 0;
|
string type;
|
||||||
if (pt == "Comment")
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
// verbatim
|
type = "comment";
|
||||||
os << "%\n\\begin{comment}\n";
|
else if (params_.type == InsetNoteParams::Greyedout)
|
||||||
else if (pt == "Greyedout")
|
type = "lyxgreyedout";
|
||||||
// we roll our own macro
|
|
||||||
os << "%\n\\begin{lyxgreyedout}\n";
|
|
||||||
|
|
||||||
if (pt != "Note")
|
ostringstream ss;
|
||||||
i = inset.latex(buf, os, runparams);
|
ss << "%\n\\begin{" << type << "}\n";
|
||||||
|
inset.latex(buf, ss, runparams);
|
||||||
|
ss << "%\n\\end{" << type << "}\n";
|
||||||
|
|
||||||
if (pt == "Comment") {
|
string const str = ss.str();
|
||||||
os << "%\n\\end{comment}\n";
|
os << str;
|
||||||
i += 4;
|
// Return how many newlines we issued.
|
||||||
} else if (pt == "Greyedout") {
|
return int(lyx::count(str.begin(), str.end(),'\n') + 1);
|
||||||
os << "%\n\\end{lyxgreyedout}\n";
|
|
||||||
i += 4;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os,
|
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
string const pt = params_.type;
|
if (params_.type == InsetNoteParams::Note)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int i = 0;
|
ostringstream ss;
|
||||||
if (pt == "Comment")
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
os << "<comment>\n";
|
ss << "<comment>\n";
|
||||||
|
|
||||||
if (pt != "Note")
|
inset.linuxdoc(buf, ss, runparams);
|
||||||
i = inset.linuxdoc(buf, os, runparams);
|
|
||||||
|
|
||||||
if (pt == "Comment") {
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
os << "\n</comment>\n";
|
ss << "\n</comment>\n";
|
||||||
i += 3;
|
|
||||||
}
|
string const str = ss.str();
|
||||||
return i;
|
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,
|
int InsetNote::docbook(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
string const pt = params_.type;
|
if (params_.type == InsetNoteParams::Note)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int i = 0;
|
ostringstream ss;
|
||||||
if (pt == "Comment")
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
os << "<remark>\n";
|
ss << "<remark>\n";
|
||||||
|
|
||||||
if (pt != "Note")
|
inset.docbook(buf, ss, runparams);
|
||||||
i = inset.docbook(buf, os, runparams);
|
|
||||||
|
|
||||||
if (pt == "Comment") {
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
os << "\n</remark>\n";
|
ss << "\n</remark>\n";
|
||||||
i += 3;
|
|
||||||
}
|
string const str = ss.str();
|
||||||
return i;
|
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,
|
int InsetNote::plaintext(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
int i = 0;
|
if (params_.type == InsetNoteParams::Note)
|
||||||
string const pt = params_.type;
|
return 0;
|
||||||
if (pt != "Note") {
|
|
||||||
os << "[";
|
ostringstream ss;
|
||||||
i = inset.plaintext(buf, os, runparams);
|
ss << "[";
|
||||||
os << "]";
|
inset.plaintext(buf, ss, runparams);
|
||||||
}
|
ss << "]";
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetNote::validate(LaTeXFeatures & features) const
|
void InsetNote::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
if (params_.type == "Comment")
|
if (params_.type == InsetNoteParams::Comment)
|
||||||
features.require("verbatim");
|
features.require("verbatim");
|
||||||
if (params_.type == "Greyedout") {
|
if (params_.type == InsetNoteParams::Greyedout) {
|
||||||
features.require("color");
|
features.require("color");
|
||||||
features.require("lyxgreyedout");
|
features.require("lyxgreyedout");
|
||||||
}
|
}
|
||||||
@ -277,25 +348,21 @@ void InsetNoteMailer::string2params(string const & in,
|
|||||||
istringstream data(in);
|
istringstream data(in);
|
||||||
LyXLex lex(0,0);
|
LyXLex lex(0,0);
|
||||||
lex.setStream(data);
|
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);
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -16,12 +16,19 @@
|
|||||||
|
|
||||||
|
|
||||||
struct InsetNoteParams {
|
struct InsetNoteParams {
|
||||||
|
enum Type {
|
||||||
|
Note,
|
||||||
|
Comment,
|
||||||
|
Greyedout
|
||||||
|
};
|
||||||
|
/// \c type defaults to Note
|
||||||
|
InsetNoteParams();
|
||||||
///
|
///
|
||||||
void write(std::ostream & os) const;
|
void write(std::ostream & os) const;
|
||||||
///
|
///
|
||||||
void read(LyXLex & lex);
|
void read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
std::string type;
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user