This patch adds a "PassThru" boolean to layout, fixing my Literate
scrap layout problem in a general way.

The only thing I miss is the Evil Red Scraps now (they show up as typewriter,
but not red).

Please apply.
                        ---Kayvan
-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)
Index: lib/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/ChangeLog,v
retrieving revision 1.68
diff -u -r1.68 ChangeLog
--- lib/ChangeLog       2001/07/12 14:35:38     1.68
+++ lib/ChangeLog       2001/07/12 21:37:03
@@ -1,3 +1,17 @@
+2001-07-12  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+       * layouts/literate-scrap.inc: Added PassThru tag
+
+       * bind/sv_menus.bind: layout LaTeX to ert-insert
+       
+       * bind/pt_menus.bind: layout LaTeX to ert-insert
+       
+       * bind/menus.bind: layout LaTeX to ert-insert
+       
+       * bind/fi_menus.bind: layout LaTeX and tex-mode to ert-insert
+       
+       * bind/de_menus.bind: tex-mode to ert-insert
+
 2001-07-12  Juergen Vigna  <[EMAIL PROTECTED]>
 
        * bind/cua.bind: moved C-l from mode-tex to ert-insert
Index: lib/bind/de_menus.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/de_menus.bind,v
retrieving revision 1.8
diff -u -r1.8 de_menus.bind
--- lib/bind/de_menus.bind      2001/06/28 15:11:24     1.8
+++ lib/bind/de_menus.bind      2001/07/12 21:37:03
@@ -80,7 +80,7 @@
 \bind "M-a S-F"                        "layout Foilhead"       # Foils!!
 \bind "M-a i"                  "layout Itemize"        # bulleted list
 \bind "M-a l"                  "layout List"
-\bind "M-a S-L"                        "layout LaTeX"
+\bind "M-a S-L"                        "ert-insert"
 \bind "M-a n"                  "layout Enumerate"      # numbered list
 \bind "M-a q"                  "layout Quote"
 \bind "M-a S-Q"                        "layout Quotation"
@@ -88,7 +88,7 @@
 \bind "M-a S-R"                        "layout Rotatefoilhead" # Foils!!
 \bind "M-a s"                  "layout Standard"
 \bind "M-a t"                  "layout Title"
-\bind "M-a x"                  "layout LaTeX"
+\bind "M-a x"                  "ert-insert"
 \bind "M-a space"              "drop-layouts-choice"
 \bind "M-a S-at"               "layout Section*"       # M-a S-2
 \bind "M-a S-dollar"           "layout Subsubsection*" # M-a S-4
Index: lib/bind/fi_menus.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/fi_menus.bind,v
retrieving revision 1.8
diff -u -r1.8 fi_menus.bind
--- lib/bind/fi_menus.bind      2001/06/28 15:11:24     1.8
+++ lib/bind/fi_menus.bind      2001/07/12 21:37:03
@@ -105,7 +105,7 @@
 \bind "M-p a"                  "layout Quote"          # Lainaus
 \bind "M-p s"                  "layout Quotation"      # Sitaatti
 \bind "M-p S-S"                        "layout Verse"          # Säe
-\bind "M-p x"                  "layout LaTeX"          # LaTeX
+\bind "M-p x"                  "ert-insert"            # LaTeX
 
 \bind "M-p f"                  "layout ShortFoilhead"  # Foils!!
 \bind "M-p S-F"                        "layout Foilhead"       # Foils!!
@@ -136,7 +136,7 @@
 \bind "M-c p"                  "font-code"     # Kirjoituskone
 \bind "M-c r"                  "font-roman"    # Oletus
 \bind "M-c s"                  "font-sans"     # Sans serif
-\bind "M-c t"                  "tex-mode"      # LaTeX
+\bind "M-c t"                  "ert-insert"    # LaTeX
 \bind "M-c u"                  "font-underline" # Alleviivaus
 
 \bind "M-c Down"               "word-lowcase"  
Index: lib/bind/menus.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/menus.bind,v
retrieving revision 1.11
diff -u -r1.11 menus.bind
--- lib/bind/menus.bind 2001/07/08 12:52:14     1.11
+++ lib/bind/menus.bind 2001/07/12 21:37:03
@@ -89,7 +89,7 @@
 \bind "M-p S-F"                        "layout Foilhead"       # Foils!!
 \bind "M-p i"                  "layout Itemize"        # bulleted list
 \bind "M-p l"                  "layout List"
-\bind "M-p S-L"                        "layout LaTeX"
+\bind "M-p S-L"                        "ert-insert"
 \bind "M-p n"                  "layout Enumerate"      # numbered list
 \bind "M-p q"                  "layout Quote"
 \bind "M-p S-Q"                        "layout Quotation"
@@ -97,7 +97,7 @@
 \bind "M-p S-R"                        "layout Rotatefoilhead" # Foils!!
 \bind "M-p s"                  "layout Standard"
 \bind "M-p t"                  "layout Title"
-\bind "M-p x"                  "layout LaTeX"
+\bind "M-p x"                  "ert-insert"
 \bind "M-p space"              "drop-layouts-choice"
 \bind "M-p S-at"               "layout Section*"       # M-p S-2
 \bind "M-p S-dollar"           "layout Subsubsection*" # M-p S-4
Index: lib/bind/pt_menus.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/pt_menus.bind,v
retrieving revision 1.8
diff -u -r1.8 pt_menus.bind
--- lib/bind/pt_menus.bind      2001/06/28 15:11:24     1.8
+++ lib/bind/pt_menus.bind      2001/07/12 21:37:03
@@ -81,7 +81,7 @@
 \bind "M-p S-F"                        "layout Foilhead"       # Foils!!
 \bind "M-p i"                  "layout Itemize"        # bulleted list
 \bind "M-p l"                  "layout List"
-# \bind "M-p S-X"                      "layout LaTeX"
+\bind "M-p S-X"                        "ert-insert"
 \bind "M-p n"                  "layout Enumerate"      # numbered list
 \bind "M-p S-C"                        "layout Quote"          # Citação
 \bind "M-p c"                  "layout Quotation"
@@ -91,7 +91,7 @@
 
 \bind "M-p p"                  "layout Standard"       # Padrão
 \bind "M-p t"                  "layout Title"
-\bind "M-p x"                  "layout LaTeX"
+\bind "M-p x"                  "ert-insert"
 \bind "M-p space"              "drop-layouts-choice"
 \bind "M-p S-at"               "layout Section*"       # M-p S-2
 \bind "M-p S-numbersign"       "layout Subsection*"    # M-p S-3
Index: lib/bind/sv_menus.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/sv_menus.bind,v
retrieving revision 1.5
diff -u -r1.5 sv_menus.bind
--- lib/bind/sv_menus.bind      2001/03/07 14:25:26     1.5
+++ lib/bind/sv_menus.bind      2001/07/12 21:37:03
@@ -255,7 +255,7 @@
 \bind "M-p S-F"                        "layout Foilhead"       # Foils!!
 \bind "M-p i"                  "layout Itemize"        # bulleted list
 \bind "M-p l"                  "layout List"
-\bind "M-p S-L"                        "layout LaTeX"
+\bind "M-p S-L"                        "ert-insert"
 \bind "M-p n"                  "layout Enumerate"      # numbered list
 \bind "M-p q"                  "layout Quote"
 \bind "M-p S-Q"                        "layout Quotation"
@@ -263,7 +263,7 @@
 \bind "M-p S-R"                        "layout Rotatefoilhead" # Foils!!
 \bind "M-p s"                  "layout Standard"
 \bind "M-p t"                  "layout Title"
-\bind "M-p x"                  "layout LaTeX"
+\bind "M-p x"                  "ert-insert"
 \bind "M-p space"              "drop-layouts-choice"
 \bind "M-p S-at"               "layout Section*"       # M-p S-2
 \bind "M-p S-dollar"           "layout Subsubsection*" # M-p S-4
Index: lib/layouts/literate-scrap.inc
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/layouts/literate-scrap.inc,v
retrieving revision 1.2
diff -u -r1.2 literate-scrap.inc
--- lib/layouts/literate-scrap.inc      2000/03/09 03:36:45     1.2
+++ lib/layouts/literate-scrap.inc      2001/07/12 21:37:03
@@ -22,13 +22,13 @@
   Align                 Left
   AlignPossible         Block,Left
   FreeSpacing           1
+  PassThru              1
   LabelType             Static
 
   LabelFont
     Color               magenta
   EndFont
   TextFont
-    Latex               Latex
     Family              Typewriter
   EndFont
 
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.228
diff -u -r1.228 ChangeLog
--- src/ChangeLog       2001/07/12 11:11:06     1.228
+++ src/ChangeLog       2001/07/12 21:37:03
@@ -1,3 +1,18 @@
+2001-07-12  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+       * paragraph_pimpl.C (simpleTeXBlanks): Simply return if pass_thru
+       is set.
+       (simpleTeXSpecialChars): Simply print the input character without
+       any special translation if pass_thru is set.
+
+       * layout.h: Adde bool pass_thru to layout class for being able to
+       implement pass through of a paragraph for Literate Programming.
+       
+       * layout.C: add LT_PASS_THRU to LayoutTags enum.
+       * layout.C (LyXLayout): set pass_thru to flase in constructor.
+       * layout.C (Read): add "passthru" to list of layout tags and add
+       code to set the pass_thru boolean when it is read.
+
 2001-07-12  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * trans_decl.h: remove allowed from KmodInfo
Index: src/layout.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/layout.C,v
retrieving revision 1.36
diff -u -r1.36 layout.C
--- src/layout.C        2001/06/04 23:57:28     1.36
+++ src/layout.C        2001/07/12 21:37:03
@@ -70,6 +70,7 @@
        //LT_FIRST_COUNTER,
        LT_FONT, 
        LT_FREE_SPACING, 
+       LT_PASS_THRU,
        //LT_HEADINGS,
        LT_ITEMSEP, 
        LT_KEEPEMPTY, 
@@ -133,6 +134,7 @@
        fill_bottom = false;
        newline_allowed = true;
        free_spacing = false;
+       pass_thru = false;
 }
 
 
@@ -174,6 +176,7 @@
                { "parindent",                  LT_PARINDENT },
                { "parsep",                     LT_PARSEP },
                { "parskip",                    LT_PARSKIP },
+               { "passthru",                   LT_PASS_THRU },
                { "preamble",                   LT_PREAMBLE },
                { "rightmargin",                LT_RIGHTMARGIN },
                { "spacing",                    LT_SPACING },
@@ -390,6 +393,11 @@
                case LT_FREE_SPACING:   // Allow for free spacing.
                        if (lexrc.next())
                                free_spacing = lexrc.GetInteger();
+                       break;
+
+               case LT_PASS_THRU:      // Allow for pass thru.
+                       if (lexrc.next())
+                               pass_thru = lexrc.GetInteger();
                        break;
 
                case LT_SPACING: // setspace.sty
Index: src/layout.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/layout.h,v
retrieving revision 1.31
diff -u -r1.31 layout.h
--- src/layout.h        2001/05/30 13:53:29     1.31
+++ src/layout.h        2001/07/12 21:37:03
@@ -321,6 +321,10 @@
 
        ///
        bool free_spacing;
+
+       ///
+       bool pass_thru;
+
        /** true when the fragile commands in the paragraph need to be
            \protect'ed. */
        bool needprotect;
Index: src/paragraph_pimpl.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/paragraph_pimpl.C,v
retrieving revision 1.10
diff -u -r1.10 paragraph_pimpl.C
--- src/paragraph_pimpl.C       2001/07/12 11:11:09     1.10
+++ src/paragraph_pimpl.C       2001/07/12 21:37:03
@@ -208,6 +208,7 @@
                                       int & column, LyXFont const & font,
                                       LyXLayout const & style)
 {
+       if (style.pass_thru) return;
        if (column > tex_code_break_column
            && i 
            && getChar(i - 1) != ' '
@@ -266,6 +267,10 @@
                                             int & column,
                                             Paragraph::value_type const c)
 {
+       if (style.pass_thru) {
+               if (c != '\0') os << c;
+               return;
+       }
        // Two major modes:  LaTeX or plain
        // Handle here those cases common to both modes
        // and then split to handle the two modes separately.

Reply via email to