On Tue, Jul 01, 2003 at 08:11:19PM +0200, Juergen Spitzmueller spake thusly:
 
> Martin Vermeer wrote:
> > Here it is... working and all -- for me at least.
> 
> Can you send an updated patch, please? It does not apply cleanly anymore.
> 
> Thanks,
> Juergen

OK Jürgen, here is the updated patch (I do not include the earlier
posted new files). This patch is against yesterday's CVS and includes
also some new work (validate, ascii, linuxdoc) and a routine in
InsetList to be used to open all branch insets of a certain type. This
work is unfinished and "dangling", i.e., you can leave it out without
affecting the rest of the patch.

Martin

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
:wq

Index: InsetList.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/InsetList.C,v
retrieving revision 1.5
diff -u -p -r1.5 InsetList.C
--- InsetList.C 2003/05/29 01:13:15     1.5
+++ InsetList.C 2003/07/02 09:34:25
@@ -2,8 +2,11 @@
 
 #include "InsetList.h"
 #include "debug.h"
+#include "BufferView.h"
+#include "buffer.h"
 
 #include "insets/updatableinset.h"
+#include "insets/insetnote.h"
 
 #include <algorithm>
 
@@ -187,6 +190,28 @@ void InsetList::resizeInsetsLyXText(Buff
                        if (it->inset->isTextInset()) {
                                static_cast<UpdatableInset*>
                                        (it->inset)->resizeLyXText(bv, true);
+                       }
+               }
+       }
+}
+
+void InsetList::insetsOpenCloseBranch(BufferView * bv)
+{
+       BufferParams bp = bv->buffer()->params;
+       List::iterator it = list.begin();
+       List::iterator end = list.end();
+       for (; it != end; ++it) {
+               if (it->inset) {
+                       if (static_cast<InsetNote*>
+                                                       (it->inset)->lyxCode() == 
Inset::NOTE_CODE) {
+                               if (static_cast<InsetNote*>
+                                                       (it->inset)->params().type == 
"branch") {
+                                       if (bp.branch_sel.find(static_cast<InsetNote*>
+                                                       (it->inset)->params().branch, 
0) != string::npos) {
+                                               
static_cast<InsetNote*>(it->inset)->open(bv); 
+                                       } else
+                                               
static_cast<InsetNote*>(it->inset)->close(bv); 
+                               }
                        }
                }
        }
Index: InsetList.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/InsetList.h,v
retrieving revision 1.2
diff -u -p -r1.2 InsetList.h
--- InsetList.h 2003/05/29 01:13:15     1.2
+++ InsetList.h 2003/07/02 09:34:25
@@ -8,7 +8,6 @@
 class Inset;
 class BufferView;
 
-
 ///
 class InsetList {
 public:
@@ -56,6 +55,8 @@ public:
        void deleteInsetsLyXText(BufferView * bv);
        ///
        void resizeInsetsLyXText(BufferView * bv);
+       /// 
+       void insetsOpenCloseBranch(BufferView * bv);
 private:
        ///
        List list;
Index: bufferparams.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/bufferparams.C,v
retrieving revision 1.56
diff -u -p -r1.56 bufferparams.C
--- bufferparams.C      2003/06/30 23:55:51     1.56
+++ bufferparams.C      2003/07/02 09:34:26
@@ -67,6 +67,7 @@ BufferParams::BufferParams()
        secnumdepth = 3;
        tocdepth = 3;
        language = default_language;
+       branch_sel = "";
        fonts = "default";
        inputenc = "auto";
        graphicsDriver = "default";
Index: bufferparams.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/bufferparams.h,v
retrieving revision 1.33
diff -u -p -r1.33 bufferparams.h
--- bufferparams.h      2003/06/10 14:39:42     1.33
+++ bufferparams.h      2003/07/02 09:34:26
@@ -195,6 +195,8 @@ public:
        int tocdepth;
        ///
        Language const * language;
+       /// Branch selection string:
+       string branch_sel;
        ///
        string inputenc;
        ///
Index: factory.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/factory.C,v
retrieving revision 1.34
diff -u -p -r1.34 factory.C
--- factory.C   2003/06/30 23:55:52     1.34
+++ factory.C   2003/07/02 09:34:26
@@ -71,7 +71,7 @@ Inset * createInset(FuncRequest const & 
                return new InsetMinipage(params);
 
        case LFUN_INSERT_NOTE:
-               return new InsetNote(params);
+               return new InsetNote(params, "Note");
 
        case LFUN_INSET_ERT:
                return new InsetERT(params);
@@ -348,8 +348,12 @@ Inset * readInset(LyXLex & lex, Buffer c
                        inset = new InsetFormula;
                } else if (tmptok == "Graphics") {
                        inset = new InsetGraphics;
-               } else if (tmptok == "Note") {
-                       inset = new InsetNote(buf.params);
+               } else if ((tmptok == "Note")          || (tmptok == "comment")
+                                       || (tmptok =="blind")      || (tmptok == 
"foot")
+                                       || (tmptok == "margin")    || (tmptok == 
"petite")
+                                       || (tmptok == "greyedout") || (tmptok == 
"branch")
+                                       ) {
+                       inset = new InsetNote(buf.params, tmptok); 
                } else if (tmptok == "Include") {
                        InsetCommandParams p("Include");
                        inset = new InsetInclude(p, buf);
Index: frontends/controllers/Dialog.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/controllers/Dialog.C,v
retrieving revision 1.5
diff -u -p -r1.5 Dialog.C
--- frontends/controllers/Dialog.C      2003/06/30 23:56:10     1.5
+++ frontends/controllers/Dialog.C      2003/07/02 09:34:27
@@ -66,8 +66,9 @@ void Dialog::RestoreButton()
 
 void Dialog::show(string const & data)
 {
-       if (controller().isBufferDependent() && !kernel().isBufferAvailable())
+       if (controller().isBufferDependent() && !kernel().isBufferAvailable()) {
                return;
+       }
 
        if (!controller().initialiseParams(data)) {
                lyxerr << "Dialog \"" << name_
Index: frontends/controllers/Makefile.am
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/controllers/Makefile.am,v
retrieving revision 1.58
diff -u -p -r1.58 Makefile.am
--- frontends/controllers/Makefile.am   2003/06/21 08:50:05     1.58
+++ frontends/controllers/Makefile.am   2003/07/02 09:34:27
@@ -68,6 +68,8 @@ libcontrollers_la_SOURCES= \
        ControlMath.h \
        ControlMinipage.C \
        ControlMinipage.h \
+       ControlNote.C \
+       ControlNote.h \
        ControlParagraph.C \
        ControlParagraph.h \
        ControlPreamble.C \
Index: frontends/xforms/Dialogs.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/Dialogs.C,v
retrieving revision 1.112
diff -u -p -r1.112 Dialogs.C
--- frontends/xforms/Dialogs.C  2003/06/21 08:50:06     1.112
+++ frontends/xforms/Dialogs.C  2003/07/02 09:34:28
@@ -30,6 +30,7 @@
 #include "ControlLog.h"
 #include "ControlMath.h"
 #include "ControlMinipage.h"
+#include "ControlNote.h"
 #include "ControlParagraph.h"
 #include "ControlRef.h"
 #include "ControlShowFile.h"
@@ -60,6 +61,7 @@
 #include "FormMathsSpace.h"
 #include "FormMathsStyle.h"
 #include "FormMinipage.h"
+#include "FormNote.h"
 #include "FormParagraph.h"
 #include "FormRef.h"
 #include "FormTabular.h"
@@ -115,7 +117,7 @@ char const * const dialognames[] = { "ab
 "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
 "mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators",
 "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
-"minipage", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
+"minipage", "note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
 
 #ifdef HAVE_LIBAIKSAURUS
 "thesaurus",
@@ -405,6 +407,10 @@ Dialog * Dialogs::build(string const & n
                dialog->setController(new ControlMinipage(*dialog));
                dialog->setView(new FormMinipage(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "note") {
+               dialog->setController(new ControlNote(*dialog));
+               dialog->setView(new FormNote(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
        } else if (name == "paragraph") {
                dialog->setController(new ControlParagraph(*dialog));
                dialog->setView(new FormParagraph(*dialog));
Index: frontends/xforms/FormDocument.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.145
diff -u -p -r1.145 FormDocument.C
--- frontends/xforms/FormDocument.C     2003/06/30 23:56:13     1.145
+++ frontends/xforms/FormDocument.C     2003/07/02 09:34:29
@@ -22,6 +22,7 @@
 #include "input_validators.h" // fl_unsigned_float_filter
 #include "xforms_helpers.h"
 
+#include "bufferparams.h"
 #include "CutAndPaste.h"
 #include "debug.h"
 #include "language.h"
@@ -291,6 +292,7 @@ void FormDocument::build()
        bcview().addReadOnly(options_->choice_citation_format);
        bcview().addReadOnly(options_->input_float_placement);
        bcview().addReadOnly(options_->choice_postscript_driver);
+       bcview().addReadOnly(options_->input_branch);
 
        // trigger an input event for cut&paste with middle mouse button.
        setPrehandler(options_->input_float_placement);
@@ -307,6 +309,9 @@ void FormDocument::build()
        fl_addto_choice(options_->choice_citation_format,
                        _(" Author-year | Numerical ").c_str());
 
+       setPrehandler(options_->input_branch);
+       fl_set_input_return(options_->input_branch, FL_RETURN_CHANGED);
+       
        // the document bullets form
        bullets_.reset(build_document_bullet(this));
 
@@ -814,6 +819,9 @@ bool FormDocument::options_apply(BufferP
        params.float_placement =
                getString(options_->input_float_placement);
 
+       params.branch_sel =
+               getString(options_->input_branch);
+       
        return redo;
 }
 
@@ -978,6 +986,10 @@ void FormDocument::options_update(Buffer
                             params.float_placement.c_str());
        else
                fl_set_input(options_->input_float_placement, "");
+       if (!params.branch_sel.empty())
+               fl_set_input(options_->input_branch, params.branch_sel.c_str());
+       else
+               fl_set_input(options_->input_branch, "");
 }
 
 
Index: frontends/xforms/Makefile.am
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/Makefile.am,v
retrieving revision 1.99
diff -u -p -r1.99 Makefile.am
--- frontends/xforms/Makefile.am        2003/06/21 08:50:06     1.99
+++ frontends/xforms/Makefile.am        2003/07/02 09:34:29
@@ -109,6 +109,8 @@ libxforms_la_SOURCES = \
        FormMathsStyle.h \
        FormMinipage.C \
        FormMinipage.h \
+       FormNote.C \
+       FormNote.h \
        FormParagraph.C \
        FormParagraph.h \
        FormPreamble.C \
Index: frontends/xforms/forms/form_document.fd
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/forms/form_document.fd,v
retrieving revision 1.35
diff -u -p -r1.35 form_document.fd
--- frontends/xforms/forms/form_document.fd     2003/04/02 18:57:58     1.35
+++ frontends/xforms/forms/form_document.fd     2003/07/02 09:34:30
@@ -178,13 +178,13 @@ argument: 0
 =============== FORM ===============
 Name: form_document_paper
 Width: 395
-Height: 310
+Height: 321
 Number of Objects: 29
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 310
+box: 0 0 395 321
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -247,7 +247,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Width:|#W
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_custom_width
 callback: C_FormBaseInputCB
@@ -265,7 +265,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_custom_width_units
 callback: C_FormBaseInputCB
@@ -283,7 +283,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Height:|#H
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_custom_height
 callback: C_FormBaseInputCB
@@ -301,7 +301,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_custom_height_units
 callback: C_FormBaseInputCB
@@ -328,7 +328,7 @@ argument: 
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -400,7 +400,7 @@ argument: 
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 5 130 385 175
+box: 5 130 385 185
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
@@ -463,7 +463,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Top:|#T
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_top_margin
 callback: C_FormBaseInputCB
@@ -481,7 +481,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_top_margin_units
 callback: C_FormBaseInputCB
@@ -499,7 +499,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Bottom:|#B
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_bottom_margin
 callback: C_FormBaseInputCB
@@ -517,7 +517,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_bottom_margin_units
 callback: C_FormBaseInputCB
@@ -526,7 +526,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 75 240 50 25
+box: 75 250 50 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -535,7 +535,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Inner:|#I
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_inner_margin
 callback: C_FormBaseInputCB
@@ -544,7 +544,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 125 240 50 25
+box: 125 250 50 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -553,7 +553,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_inner_margin_units
 callback: C_FormBaseInputCB
@@ -562,7 +562,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 75 270 50 25
+box: 75 280 50 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -571,7 +571,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Outer:|#u
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_outer_margin
 callback: C_FormBaseInputCB
@@ -580,7 +580,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 125 270 50 25
+box: 125 280 50 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -589,7 +589,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_outer_margin_units
 callback: C_FormBaseInputCB
@@ -607,7 +607,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Headheight:|#H
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_head_height
 callback: C_FormBaseInputCB
@@ -625,7 +625,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_head_height_units
 callback: C_FormBaseInputCB
@@ -643,7 +643,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Headsep:|#d
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_head_sep
 callback: C_FormBaseInputCB
@@ -661,7 +661,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_head_sep_units
 callback: C_FormBaseInputCB
@@ -679,7 +679,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Footskip:|#F
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_foot_skip
 callback: C_FormBaseInputCB
@@ -697,7 +697,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_foot_skip_units
 callback: C_FormBaseInputCB
@@ -865,7 +865,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Spacing:|#g
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_spacing
 callback: C_FormBaseInputCB
@@ -883,7 +883,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Extra Options:|#X
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_extra
 callback: C_FormBaseInputCB
@@ -901,7 +901,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_skip
 callback: C_FormBaseInputCB
@@ -919,7 +919,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Default Skip:|#u
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_skip
 callback: C_FormBaseInputCB
@@ -928,7 +928,7 @@ argument: 0
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1000,7 +1000,7 @@ argument: 
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1072,7 +1072,7 @@ argument: 
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1154,7 +1154,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_spacing
 callback: C_FormBaseInputCB
@@ -1172,7 +1172,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: choice_skip_units
 callback: C_FormBaseInputCB
@@ -1259,7 +1259,7 @@ argument: 0
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1349,13 +1349,13 @@ argument: 0
 =============== FORM ===============
 Name: form_document_options
 Width: 395
-Height: 310
-Number of Objects: 8
+Height: 326
+Number of Objects: 9
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 310
+box: 0 0 395 326
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -1382,7 +1382,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Float Placement:|#L
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_float_placement
 callback: C_FormBaseInputCB
@@ -1453,7 +1453,7 @@ argument: 0
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 185 225 25 25
+box: 185 215 25 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_LEFT
@@ -1471,7 +1471,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 185 265 140 25
+box: 185 245 140 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1489,7 +1489,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 185 185 140 25
+box: 185 180 140 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1504,6 +1504,24 @@ name: choice_ams_math
 callback: C_FormBaseInputCB
 argument: 0
 
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 185 285 180 25
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Branch Selection:|#B
+shortcut: 
+resize: FL_RESIZE_X
+gravity: FL_NoGravity FL_NoGravity
+name: input_branch
+callback: C_FormBaseInputCB
+argument: 0
+
 =============== FORM ===============
 Name: form_document_bullet
 Width: 395
@@ -1594,7 +1612,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: LaTeX:|#L
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_latex
 callback: C_FormBaseInputCB
@@ -1603,7 +1621,7 @@ argument: 0
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1712,7 +1730,7 @@ argument: 
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
Index: insets/insetnote.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/insetnote.C,v
retrieving revision 1.26
diff -u -p -r1.26 insetnote.C
--- insets/insetnote.C  2003/06/16 11:49:32     1.26
+++ insets/insetnote.C  2003/07/02 09:34:30
@@ -10,6 +10,7 @@
 
 #include <config.h>
 
+#include "Lsstream.h"
 
 #include "insetnote.h"
 #include "gettext.h"
@@ -17,42 +18,47 @@
 #include "language.h"
 #include "buffer.h"
 #include "BufferView.h"
+#include "LaTeXFeatures.h"
+#include "latexrunparams.h"
+#include "lyxlex.h"
 #include "lyxtext.h"
 #include "insets/insettext.h"
 #include "support/LOstream.h"
 #include "support/lstrings.h"
-#include "debug.h"
 
 using std::ostream;
 
 
 void InsetNote::init()
 {
-       LyXFont font(LyXFont::ALL_SANE);
-       font.decSize();
-       font.decSize();
-       font.setColor(LColor::note);
-       setLabelFont(font);
-       setBackgroundColor(LColor::notebg);
-       setLabel(_("note"));
        setInsetName("Note");
+       setButtonLabel();
 }
 
 
-InsetNote::InsetNote(BufferParams const & bp)
+InsetNote::InsetNote(BufferParams const & bp, string const & label)
        : InsetCollapsable(bp)
 {
+       params_.type = label;
        init();
+       setLabel(label);
 }
 
 
 InsetNote::InsetNote(InsetNote const & in)
-       : InsetCollapsable(in)
+       : InsetCollapsable(in), params_(in.params_)
 {
        init();
 }
 
 
+InsetNote::~InsetNote() // MV
+{
+       InsetNoteMailer mailer("note", *this);
+       mailer.hideDialog();
+}
+
+
 InsetBase * InsetNote::clone() const
 {
        return new InsetNote(*this);
@@ -67,6 +73,246 @@ string const InsetNote::editMessage() co
 
 void InsetNote::write(Buffer const * buf, ostream & os) const
 {
-       os << getInsetName() << "\n";
+       params_.write(os);
        InsetCollapsable::write(buf, os);
+
+}  
+
+
+void InsetNote::read(Buffer const * buf, LyXLex & lex)
+{
+       //params_.read(lex);
+    if (params_.type == "branch") {
+               if (lex.isOK()) {
+                       lex.next();
+                       params_.branch = lex.getString();
+               }
+       }
+       InsetCollapsable::read(buf, lex);
+       setButtonLabel();
+}
+
+
+void InsetNote::setButtonLabel()
+{
+       LyXFont font(LyXFont::ALL_SANE);
+       font.decSize();
+       font.decSize();
+
+       if (params_.type == "branch") {
+               setLabel(params_.branch);
+       } else {
+               setLabel(params_.type);
+       }
+       if (params_.type == "blind") {
+               font.setColor(LColor::note);
+               setBackgroundColor(LColor::notebg);
+       } else {
+               if (params_.type == "branch")
+                       font.setColor(LColor::foreground);
+               else
+                       font.setColor(LColor::red);
+               setBackgroundColor(LColor::background);
+       }
+       setLabelFont(font);
+}
+
+
+dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
+{
+       BufferView * bv = cmd.view();
+
+       switch (cmd.action) {
+       case LFUN_INSET_MODIFY: {
+               InsetNoteParams params;
+               InsetNoteMailer::string2params(cmd.argument, params);
+               params_.type = params.type;
+               params_.branch = params.branch;
+               setButtonLabel();
+               bv->updateInset(this);
+               return DISPATCHED;
+               }
+               
+       case LFUN_INSET_EDIT:
+               if (cmd.button() == mouse_button::button3)
+                       break;
+               return InsetCollapsable::localDispatch(cmd);
+
+       case LFUN_INSET_DIALOG_UPDATE:
+                       InsetNoteMailer("note", *this).updateDialog(bv);
+                       return DISPATCHED;
+               
+       case LFUN_MOUSE_RELEASE:
+               if (cmd.button() == mouse_button::button3) {
+                   InsetNoteMailer("note", *this).showDialog(bv);
+                       return DISPATCHED;
+               }
+                       
+       default:
+               return InsetCollapsable::localDispatch(cmd);
+       }
+
+       return UNDISPATCHED; // suppresses warning
+}
+
+
+int InsetNote::latex(Buffer const * buf, ostream & os,
+                                               LatexRunParams const & runparams_in) 
const
+{
+       string const pt = params_.type;
+
+       LatexRunParams runparams = runparams_in;
+       if (pt == "foot") { // Is this for "thanks" handling? - MV
+               if (buf && parOwner()) {
+                       LyXLayout_ptr const & layout = parOwner()->layout();
+                       runparams.moving_arg |= layout->intitle;
+               }
+       }
+
+       int i = 0;
+       if (pt == "comment") os << "%\n\\begin{comment}{"; // remember to validate
+       if (pt == "foot") os << "%\n\\footnote{";
+       if (pt == "margin") os << "%\n\\marginpar{";
+       if (pt == "greyedout") os << "%\n\\color{grey}{";
+       if ((pt != "blind") && (pt != "branch")) {
+               i = inset.latex(buf, os, runparams);
+       }
+       if ((pt == "branch") 
+                && (buf->params.branch_sel.find(params_.branch, 0) != string::npos)) {
+               i = inset.latex(buf, os, runparams);
+       }
+       if (pt == "comment") {
+               os << "%\n\\end{comment}\n";
+               i += 3;
+       }
+       if ((pt == "foot") || (pt == "margin") || (pt == "greyedout")) { 
+               os << "%\n}";
+               i += 2;
+       }
+       return i;
+}
+
+
+int InsetNote::linuxdoc(Buffer const *, std::ostream &) const
+{ 
+       return 0; 
+}
+
+
+int InsetNote::docbook(Buffer const * buf, std::ostream & os, bool mixcont) const
+{
+       int i = 0;
+       string const pt = params_.type;
+       // incomplete, untested - MV
+       if (pt == "foot") os << "<footnote>";
+       if ((pt != "blind") && (pt != "branch")) {
+               i = inset.docbook(buf, os, mixcont);
+       }
+
+    if ((pt == "branch")
+               && (buf->params.branch_sel.find(params_.branch, 0) != string::npos)) {
+               i = inset.docbook(buf, os, mixcont);
+       }
+       
+       if (pt == "foot") {
+               os << "</footnote>";
+               i += 2;
+       }
+
+       return i; 
+}
+
+
+int InsetNote::ascii(Buffer const * buf, std::ostream & os, int ll) const
+{
+       int i = 0;
+       string const pt = params_.type;
+       if ((pt != "blind") && (pt != "branch")) {
+               os << "[";
+               i = inset.ascii(buf, os, ll);
+               os << "]";
+       }
+       if ((pt == "branch")
+               && (buf->params.branch_sel.find(params_.branch, 0) != string::npos)) {
+               i = inset.ascii(buf, os, ll);
+       }
+       return i;
+}
+
+
+void InsetNote::validate(LaTeXFeatures & features) const
+{
+       if (params_.type == "comment") features.require("verbatim");
+       inset.validate(features);
+}
+
+
+
+InsetNoteMailer::InsetNoteMailer(string const & name,
+                                               InsetNote & inset)
+       : name_(name), inset_(inset)
+{
+}
+
+
+string const InsetNoteMailer::inset2string() const
+{
+       return params2string(name_, inset_.params());
 }
+
+
+string const InsetNoteMailer::params2string(string const & name,
+                               InsetNoteParams const & params)
+{
+       ostringstream data;
+       data << name << ' ';
+       params.write(data);
+       return STRCONV(data.str());
+
+}
+
+
+void InsetNoteMailer::string2params(string const & in,
+                                    InsetNoteParams & params)
+{
+       params = InsetNoteParams();
+
+       if (in.empty())
+               return;
+
+       istringstream data(STRCONV(in));
+       LyXLex lex(0,0);
+       lex.setStream(data);
+       params.read(lex);
+
+}
+
+
+void InsetNoteParams::write(ostream & os) const
+{
+       os << type << " ";
+       if (type == "branch") {
+               os << branch << "\n";
+       }
+}
+
+
+void InsetNoteParams::read(LyXLex & lex)
+{
+       if (lex.isOK()) {
+               lex.next();
+               string token = lex.getString();
+       }
+
+       if (lex.isOK()) {
+               lex.next();
+               type = lex.getString();
+       }
+       if (type == "branch") {
+       if (lex.isOK()) {
+               lex.next();
+               branch = lex.getString();
+               }
+       }
+}
+
Index: insets/insetnote.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/insetnote.h,v
retrieving revision 1.22
diff -u -p -r1.22 insetnote.h
--- insets/insetnote.h  2003/06/16 11:49:32     1.22
+++ insets/insetnote.h  2003/07/02 09:34:30
@@ -15,16 +15,33 @@
 
 #include "insetcollapsable.h"
 
-/** The PostIt note inset
+  
+ struct InsetNoteParams {
+       ///
+       void write(std::ostream & os) const;
+       ///
+       void read(LyXLex & lex);
+       ///
+       string type;
+       ///
+       string branch;
+};
+ 
+ 
+/** The PostIt note inset, and other annotations
 
 */
 class InsetNote : public InsetCollapsable {
 public:
-       ///
-       InsetNote(BufferParams const &);
-       ///
-       InsetNote(InsetNote const &);
        ///
+
+       
+       InsetNote(BufferParams const &, string const &);
+       /// Copy constructor
+       InsetNote(InsetNote const &);
+       ///
+       ~InsetNote();
+       ///
        InsetBase * clone() const;
        ///
        string const editMessage() const;
@@ -32,25 +49,58 @@ public:
        Inset::Code lyxCode() const { return Inset::NOTE_CODE; }
        ///
        void write(Buffer const *, std::ostream &) const;
+       ///
+       void read(Buffer const * buf, LyXLex & lex);
+       ///
+       void setButtonLabel();
        ///
-       int latex(Buffer const *, std::ostream &,
-                 LatexRunParams const &) const
-               { return 0; }
+       dispatch_result InsetNote::localDispatch(FuncRequest const &);
+       ///
+       int latex(Buffer const *, std::ostream &,
+                       LatexRunParams const &) const;
        ///
-       int linuxdoc(Buffer const *, std::ostream &) const
-               { return 0; }
+       int linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       int docbook(Buffer const *, std::ostream &, bool) const
-               { return 0; }
+       int docbook(Buffer const *, std::ostream &, bool) const;
        ///
-       int ascii(Buffer const *, std::ostream &, int) const
-               { return 0; }
+       int ascii(Buffer const *, std::ostream &, int) const;
        ///
-       void validate(LaTeXFeatures &) const {}
+       void validate(LaTeXFeatures &) const;
+       ///
+       InsetNoteParams const & params() const { return params_; }
+
 private:
+       friend class InsetNoteParams;
+
        /// used by the constructors
        void init();
+       ///
+    InsetNoteParams params_;
+};
+
+#include "mailinset.h"
 
+class InsetNoteMailer : public MailInset {
+public:
+       ///
+       InsetNoteMailer(string const & name, InsetNote & inset);
+       ///
+       virtual InsetBase & inset() const { return inset_; }
+       ///
+       virtual string const & name() const { return name_; }
+       ///
+       virtual string const inset2string() const;
+       ///
+       static string const params2string(string const &, InsetNoteParams const &);
+       ///
+       static void string2params(string const &, InsetNoteParams &);
+private:
+       ///
+       string const name_;
+       ///
+       InsetNote & inset_;
 };
+
+
 
 #endif

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to