]> git.lyx.org Git - features.git/commitdiff
remove bogus backslashed from iso-8859-1, try to fix insert and encodeString, fixes...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 16 Dec 1999 06:43:25 +0000 (06:43 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 16 Dec 1999 06:43:25 +0000 (06:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@383 a592a061-630c-0410-9148-cb99ea01b6c8

41 files changed:
ChangeLog
configure.in
lib/kbd/iso8859-1.cdef
po/lyx.pot
src/BufferView.C
src/BufferView.h
src/FontInfo.C
src/LyXAction.C
src/LyXView.C
src/Makefile.am
src/ParagraphExtra.C
src/TableLayout.C
src/buffer.C
src/buffer.h
src/bufferlist.C
src/chset.C
src/chset.h
src/insets/figinset.C
src/insets/insetbib.C
src/insets/insetlatexaccent.C
src/intl.C
src/kbmap.C
src/kbmap.h
src/layout.h
src/lyx_cb.C
src/lyxdraw.C
src/lyxfont.h
src/lyxfr1.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxrc.C
src/lyxscreen.h
src/menus.C
src/paragraph.C
src/screen.C
src/support/lyxstring.C
src/table.C
src/toolbar.C
src/trans.C
src/trans_mgr.C
src/vspace.C

index c73eef1fcac363308b73a8ef9bc04386361d062f..278c6ca60cd7ea10b07b748e09549d5db7474d32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+1999-12-16  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/kbmap.C: commented out the use of the hash map in kb_map,
+       beginning of movement to a stl::container. 
+
+       * several files: removed code that was not in effect when
+       MOVE_TEXT was defined.
+       
+       * lib/kbd/iso8859-1.cdef: removed bogus backslashes. Backslashes
+       for escaping should not be used. We can discuss if the string
+       should be enclosed in f.ex. [] instead of "".
+
+       * src/trans_mgr.C (insert): use the new returned value from
+       encodeString to get deadkeys and keymaps done correctly.
+
+       * src/chset.C (encodeString): changed to return a pair, to tell
+       what to use if we know the string.
+
+       * src/lyxscreen.h (fillArc): new function.
+
+       * src/FontInfo.C (resize): rewritten to use more std::string like
+       structore, especially string::replace.
+
+       * src/insets/insetlatexaccent.C (Draw): use fillArc for the
+       approp. accents.
+
+       * configure.in (chmod +x some scripts): remove config/gcc-hack 
+
 1999-12-15  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/buffer.C (writeFile): change once again the top comment in a
index d00c8165136e33390eb8bb88e809e5561d4bdf2d..a7162e572258a7da848e13954d1f7b86c48d2ef0 100644 (file)
@@ -24,8 +24,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
 ### Set the execute permissions of the various scripts correctly
-for file in config/install-sh config/mkinstalldirs config/hack-gcc \
-            lib/configure ; do
+for file in config/install-sh config/mkinstalldirs lib/configure ; do
   chmod 755 ${srcdir}/${file}
 done
 
index b064f05c7e516d6ce3d5ef927305c0c294adca4f..39225540d857d84ea2c03d3b20a7d39730832fd6 100644 (file)
 
 161    "!`"            # mirrored !
 #162   Cent sign?
-163    "\\pounds{}"    # pound sign
+163    "\pounds{}"     # pound sign
 #164   String sign?
 #165   Yen sign?
 #166   What's this?
-167    "\\S{}"         # paragraph
-168    "\\\"{}"        # umlaut
-169    "\\copyright{}"
-170    "\\b{a}"                # a macron
-171    "\\guillemotleft{}"
+167    "\S{}"          # paragraph
+168    "\"{}"  # umlaut
+169    "\copyright{}"
+170    "\b{a}"         # a macron
+171    "\guillemotleft{}"
 #172   What's this?
 #173   horiz. line?
 #174   Registered?
 #175   horiz. line at the top?
-176    "\\b{}" # circle
+176    "\b{}"  # circle
 #177   Plusminus?
 #178   ^2?
 #179   ^3?
-180    "\\'{}" # acute
-181    "$\\mu$"        # micro
+180    "\'{}"  # acute
+181    "$\mu$" # micro
 #182   Paragraph?
-183    "$\\cdot$"
-184    "\\c{}" # cedilla
+183    "$\cdot$"
+184    "\c{}"  # cedilla
 185    "${^1}$"
-186    "\\b{o}"                # o macron
-187    "\\guillemotright{}"
-188    "\\ensuremath{\frac14}"
-189    "\\ensuremath{\frac12}"
-190    "\\ensuremath{\frac34}"            # "0BE
+186    "\b{o}"         # o macron
+187    "\guillemotright{}"
+188    "\ensuremath{\frac14}"
+189    "\ensuremath{\frac12}"
+190    "\ensuremath{\frac34}"            # "0BE
 191    "?`"            # mirrored ?
-192    "\\`{A}"
-193    "\\'{A}"
-194    "\\^{A}"
-195    "\\~{A}"
-196    "\\\"{A}"
-197    "\\AA{}"                # A with circle
-198    "\\AE{}"                # AE cat'ed together
-199    "\\c{C}"                # C cedilla
-200    "\\`{E}"
-201    "\\'{E}"
-202    "\\^{E}"
-203    "\\\"{E}"
-204    "\\`{I}"
-205    "\\'{I}"
-206    "\\^{I}"
-207    "\\\"{I}"
-208    "\\DH{}"
-209    "\\~{N}"
-210    "\\`{O}"
-211    "\\'{O}"
-212    "\\^{O}"
-213    "\\~{O}"
-214    "\\\"{O}"
-215    "$\\times$"
-216    "\\O{}"
-217    "\\`{U}"
-218    "\\'{U}"
-219    "\\^{U}"
-220    "\\\"{U}"
-221    "\\'{Y}"
-222    "\\TH{}"
-223    "\\ss{}"                # German sharp S
-224    "\\`{a}"
-225    "\\'{a}"
-226    "\\^{a}"
-227    "\\~{a}"
-228    "\\\"{a}"
-229    "\\aa{}"                # a with circle
-230    "\\ae{}"
-231    "\\c{c}"                # c cedilla
-232    "\\`{e}"
-233    "\\'{e}"
-234    "\\^{e}"
-235    "\\\"{e}"
-236    "\\`{\\i}"
-237    "\\'{\\i}"
-238    "\\^{\\i}"
-239    "\\\"{\\i}"
-240    "\\dh{}" 
-241    "\\~{n}"
-242    "\\`{o}"
-243    "\\'{o}"
-244    "\\^{o}"
-245    "\\~{o}"
-246    "\\\"{o}"
-247    "$\\div$"
-248    "\\o{}"
-249    "\\`{u}"
-250    "\\'{u}"
-251    "\\^{u}"
-252    "\\\"{u}"
-253    "\\'{y}"
-254    "\\th{}"
-255    "\\\"{y}"
-
-
-
-
-
-
-
+192    "\`{A}"
+193    "\'{A}"
+194    "\^{A}"
+195    "\~{A}"
+196    "\"{A}"
+197    "\AA{}"         # A with circle
+198    "\AE{}"         # AE cat'ed together
+199    "\c{C}"         # C cedilla
+200    "\`{E}"
+201    "\'{E}"
+202    "\^{E}"
+203    "\"{E}"
+204    "\`{I}"
+205    "\'{I}"
+206    "\^{I}"
+207    "\"{I}"
+208    "\DH{}"
+209    "\~{N}"
+210    "\`{O}"
+211    "\'{O}"
+212    "\^{O}"
+213    "\~{O}"
+214    "\"{O}"
+215    "$\times$"
+216    "\O{}"
+217    "\`{U}"
+218    "\'{U}"
+219    "\^{U}"
+220    "\"{U}"
+221    "\'{Y}"
+222    "\TH{}"
+223    "\ss{}"         # German sharp S
+224    "\`{a}"
+225    "\'{a}"
+226    "\^{a}"
+227    "\~{a}"
+228    "\"{a}"
+229    "\aa{}"         # a with circle
+230    "\ae{}"
+231    "\c{c}"         # c cedilla
+232    "\`{e}"
+233    "\'{e}"
+234    "\^{e}"
+235    "\\"{e}"
+236    "\`{\i}"
+237    "\'{\i}"
+238    "\^{\i}"
+239    "\"{\i}"
+240    "\dh{}" 
+241    "\~{n}"
+242    "\`{o}"
+243    "\'{o}"
+244    "\^{o}"
+245    "\~{o}"
+246    "\"{o}"
+247    "$\div$"
+248    "\o{}"
+249    "\`{u}"
+250    "\'{u}"
+251    "\^{u}"
+252    "\"{u}"
+253    "\'{y}"
+254    "\th{}"
+255    "\"{y}"
index f0fd3cfde97ee1477fecb715064161990de03cdf..67147d62562208b30836091969f3ddeb9cf1c8a6 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-12-15 12:31+0100\n"
+"POT-Creation-Date: 1999-12-16 07:10+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,17 +15,17 @@ msgstr ""
 "Content-Transfer-Encoding: ENCODING\n"
 
 #. sgml2lyx failed
-#: src/buffer.C:254 src/buffer.C:264 src/buffer.C:3685 src/bufferlist.C:520
-#: src/bufferlist.C:550 src/lyx_cb.C:537 src/lyx_cb.C:904 src/lyx_cb.C:940
+#: src/buffer.C:239 src/buffer.C:249 src/buffer.C:3588 src/bufferlist.C:519
+#: src/bufferlist.C:549 src/lyx_cb.C:520 src/lyx_cb.C:854 src/lyx_cb.C:886
 #: src/lyx_sendfax_main.C:262
 msgid "Error!"
 msgstr ""
 
-#: src/buffer.C:255
+#: src/buffer.C:240
 msgid "Specified file is unreadable: "
 msgstr ""
 
-#: src/buffer.C:265
+#: src/buffer.C:250
 msgid "Cannot open specified file: "
 msgstr ""
 
@@ -34,287 +34,285 @@ msgstr ""
 #. or stop loading the file.
 #. I can substitute but I don't see how I can
 #. stop loading... ideas??  ARRae980418
-#: src/buffer.C:456
+#: src/buffer.C:427
 msgid "Textclass Loading Error!"
 msgstr ""
 
-#: src/buffer.C:457
+#: src/buffer.C:428
 msgid "Can't load textclass "
 msgstr ""
 
-#: src/buffer.C:459
+#: src/buffer.C:430
 msgid "-- substituting default"
 msgstr ""
 
-#: src/buffer.C:1079
+#: src/buffer.C:1050
 msgid "Warning: Ignoring Old Inset"
 msgstr ""
 
-#: src/buffer.C:1160
+#: src/buffer.C:1131
 #, c-format
 msgid "Warning: need lyxformat %.2f but found %.2f\n"
 msgstr ""
 
-#: src/buffer.C:1164
+#: src/buffer.C:1135
 #, c-format
 msgid "ERROR: need lyxformat %.2f but found %.2f\n"
 msgstr ""
 
-#: src/buffer.C:1182
+#: src/buffer.C:1153
 msgid "Warning!"
 msgstr ""
 
-#: src/buffer.C:1183
+#: src/buffer.C:1154
 msgid "Reading of document is not complete"
 msgstr ""
 
-#: src/buffer.C:1184
+#: src/buffer.C:1155
 msgid "Maybe the document is truncated"
 msgstr ""
 
 #. "\\lyxformat" not found
-#: src/buffer.C:1190 src/buffer.C:1197 src/buffer.C:1200
+#: src/buffer.C:1161 src/buffer.C:1168 src/buffer.C:1171
 msgid "ERROR!"
 msgstr ""
 
-#: src/buffer.C:1191
+#: src/buffer.C:1162
 msgid "Old LyX file format found. Use LyX 0.10.x to read this!"
 msgstr ""
 
-#: src/buffer.C:1197
+#: src/buffer.C:1168
 msgid "Not a LyX file!"
 msgstr ""
 
-#: src/buffer.C:1200
+#: src/buffer.C:1171
 msgid "Unable to read file!"
 msgstr ""
 
-#: src/buffer.C:1216 src/buffer.C:1219
+#: src/buffer.C:1187 src/buffer.C:1190
 msgid "Error! Document is read-only: "
 msgstr ""
 
-#: src/buffer.C:1229 src/buffer.C:1232
+#: src/buffer.C:1200 src/buffer.C:1203
 msgid "Error! Cannot write file: "
 msgstr ""
 
-#: src/buffer.C:1240 src/buffer.C:1243
+#: src/buffer.C:1211 src/buffer.C:1214
 msgid "Error! Cannot open file: "
 msgstr ""
 
-#: src/buffer.C:1291
+#: src/buffer.C:1260
 msgid "Error: Cannot write file:"
 msgstr ""
 
-#: src/buffer.C:1397
+#: src/buffer.C:1366
 msgid "Error: Cannot open temporary file:"
 msgstr ""
 
-#: src/buffer.C:1614
+#: src/buffer.C:1583
 msgid "Error: Cannot open file: "
 msgstr ""
 
-#: src/buffer.C:2187 src/buffer.C:2777 src/buffer.C:3604 src/buffer.C:3626
-#: src/paragraph.C:3577
+#: src/buffer.C:2156 src/buffer.C:2746 src/buffer.C:3507 src/buffer.C:3529
+#: src/paragraph.C:3590
 msgid "LYX_ERROR:"
 msgstr ""
 
-#: src/buffer.C:2187 src/buffer.C:2777
+#: src/buffer.C:2156 src/buffer.C:2746
 msgid "Cannot write file"
 msgstr ""
 
-#: src/buffer.C:2259 src/buffer.C:2858
+#: src/buffer.C:2228 src/buffer.C:2826
 msgid "Error : Wrong depth for LatexType Command.\n"
 msgstr ""
 
 #. path to LaTeX file
-#: src/buffer.C:3238
+#: src/buffer.C:3186
 msgid "Running LaTeX..."
 msgstr ""
 
-#: src/buffer.C:3255
+#: src/buffer.C:3203
 msgid "LaTeX did not work!"
 msgstr ""
 
-#: src/buffer.C:3256 src/buffer.C:3329 src/buffer.C:3402
+#: src/buffer.C:3204 src/buffer.C:3273 src/buffer.C:3342
 msgid "Missing log file:"
 msgstr ""
 
 #. no errors or any other things to think about so:
-#: src/buffer.C:3258 src/buffer.C:3267 src/buffer.C:3331 src/buffer.C:3340
-#: src/buffer.C:3404 src/buffer.C:3412 src/combox.C:465
+#: src/buffer.C:3206 src/buffer.C:3215 src/buffer.C:3275 src/buffer.C:3284
+#: src/buffer.C:3344 src/buffer.C:3352 src/combox.C:465
 msgid "Done"
 msgstr ""
 
 #. path to Literate file
-#: src/buffer.C:3308
+#: src/buffer.C:3252
 msgid "Running Literate..."
 msgstr ""
 
-#: src/buffer.C:3328
+#: src/buffer.C:3272
 msgid "Literate command did not work!"
 msgstr ""
 
 #. path to Literate file
-#: src/buffer.C:3381
+#: src/buffer.C:3321
 msgid "Building Program..."
 msgstr ""
 
-#: src/buffer.C:3401
+#: src/buffer.C:3341
 msgid "Build did not work!"
 msgstr ""
 
 #. path to LaTeX file
-#: src/buffer.C:3452
+#: src/buffer.C:3388
 msgid "Running chktex..."
 msgstr ""
 
-#: src/buffer.C:3468
+#: src/buffer.C:3404
 msgid "chktex did not work!"
 msgstr ""
 
-#: src/buffer.C:3469
+#: src/buffer.C:3405
 msgid "Could not run with file:"
 msgstr ""
 
-#: src/buffer.C:3605 src/buffer.C:3627 src/paragraph.C:3578
+#: src/buffer.C:3508 src/buffer.C:3530 src/paragraph.C:3591
 msgid "Cannot open temporary file:"
 msgstr ""
 
-#: src/buffer.C:3678
+#: src/buffer.C:3581
 msgid "Error! Can't open temporary file:"
 msgstr ""
 
-#: src/buffer.C:3686
+#: src/buffer.C:3589
 msgid "Error executing *roff command on table"
 msgstr ""
 
-#: src/buffer.C:3886 src/buffer.C:3938 src/lyx_cb.C:3627 src/lyx_cb.C:3705
-#: src/text.C:1847
+#: src/buffer.C:3758 src/lyx_cb.C:3268 src/text.C:1847
 msgid "Impossible Operation!"
 msgstr ""
 
-#: src/buffer.C:3887 src/buffer.C:3939
+#: src/buffer.C:3759
 msgid "Cannot insert table/list in table."
 msgstr ""
 
-#: src/buffer.C:3888 src/buffer.C:3940 src/lyx_cb.C:3629 src/lyx_cb.C:3707
-#: src/text.C:1849 src/text.C:3888 src/text.C:3896 src/text.C:3911
-#: src/text.C:3928 src/text2.C:2102 src/text2.C:2112
+#: src/buffer.C:3760 src/lyx_cb.C:3270 src/text.C:1849 src/text.C:3888
+#: src/text.C:3896 src/text.C:3911 src/text.C:3928 src/text2.C:2102
+#: src/text2.C:2112
 msgid "Sorry."
 msgstr ""
 
-#: src/bufferlist.C:98 src/bufferlist.C:255 src/lyxvc.C:87 src/lyxvc.C:117
+#: src/bufferlist.C:98 src/bufferlist.C:258 src/lyxvc.C:87 src/lyxvc.C:117
 #: src/lyxvc.C:143
 msgid "Changes in document:"
 msgstr ""
 
-#: src/bufferlist.C:101 src/bufferlist.C:257
+#: src/bufferlist.C:101 src/bufferlist.C:260
 msgid "Save document?"
 msgstr ""
 
-#: src/bufferlist.C:117
+#: src/bufferlist.C:118
 msgid "Some documents were not saved:"
 msgstr ""
 
-#: src/bufferlist.C:118
+#: src/bufferlist.C:119
 msgid "Exit anyway?"
 msgstr ""
 
-#: src/bufferlist.C:129
+#: src/bufferlist.C:130
 msgid "Saving document"
 msgstr ""
 
-#: src/bufferlist.C:201
+#: src/bufferlist.C:204
 msgid "Document saved as"
 msgstr ""
 
-#: src/bufferlist.C:212
+#: src/bufferlist.C:215
 msgid "Could not delete auto-save file!"
 msgstr ""
 
-#: src/bufferlist.C:222
+#: src/bufferlist.C:225
 msgid "Save failed!"
 msgstr ""
 
-#: src/bufferlist.C:290
+#: src/bufferlist.C:293
 msgid "No Documents Open!%t"
 msgstr ""
 
-#: src/bufferlist.C:368
+#: src/bufferlist.C:363
 msgid "lyx: Attempting to save document "
 msgstr ""
 
-#: src/bufferlist.C:371
+#: src/bufferlist.C:366
 msgid " as..."
 msgstr ""
 
-#: src/bufferlist.C:395
+#: src/bufferlist.C:392
 msgid "  Save seems successful. Phew."
 msgstr ""
 
-#: src/bufferlist.C:399
+#: src/bufferlist.C:396
 msgid "  Save failed! Trying..."
 msgstr ""
 
-#: src/bufferlist.C:402
+#: src/bufferlist.C:399
 msgid "  Save failed! Bummer. Document is lost."
 msgstr ""
 
-#: src/bufferlist.C:429
+#: src/bufferlist.C:428
 msgid "An emergency save of this document exists!"
 msgstr ""
 
-#: src/bufferlist.C:431
+#: src/bufferlist.C:430
 msgid "Try to load that instead?"
 msgstr ""
 
-#: src/bufferlist.C:453
+#: src/bufferlist.C:452
 msgid "Autosave file is newer."
 msgstr ""
 
-#: src/bufferlist.C:455
+#: src/bufferlist.C:454
 msgid "Load that one instead?"
 msgstr ""
 
-#: src/bufferlist.C:520
+#: src/bufferlist.C:519
 msgid "Unable to open template"
 msgstr ""
 
-#: src/bufferlist.C:551
+#: src/bufferlist.C:550
 msgid "Could not convert file"
 msgstr ""
 
-#: src/bufferlist.C:564 src/lyxfunc.C:4675 src/lyxfunc.C:4814
-#: src/lyxfunc.C:4893
+#: src/bufferlist.C:563 src/lyxfunc.C:2485 src/lyxfunc.C:2624
+#: src/lyxfunc.C:2703
 msgid "Document is already open:"
 msgstr ""
 
-#: src/bufferlist.C:566
+#: src/bufferlist.C:565
 msgid "Do you want to reload that document?"
 msgstr ""
 
-#: src/bufferlist.C:582
+#: src/bufferlist.C:581
 msgid "File `"
 msgstr ""
 
-#: src/bufferlist.C:583
+#: src/bufferlist.C:582
 msgid "' is read-only."
 msgstr ""
 
-#: src/bufferlist.C:599
+#: src/bufferlist.C:598
 msgid "Cannot open specified file:"
 msgstr ""
 
-#: src/bufferlist.C:601
+#: src/bufferlist.C:600
 msgid "Create new document with this name?"
 msgstr ""
 
-#: src/BufferView.C:323
+#: src/BufferView.C:284
 msgid "Formatting document..."
 msgstr ""
 
-#: src/BufferView.C:437 src/BufferView.C:441 src/BufferView.C:458
-#: src/BufferView.C:462
+#: src/BufferView.C:353 src/BufferView.C:357
 msgid "No more errors"
 msgstr ""
 
@@ -324,7 +322,7 @@ msgstr ""
 
 #: src/bullet_forms.C:51 src/credits_form.C:19 src/credits_form.C:59
 #: src/form1.C:43 src/form1.C:117 src/form1.C:261 src/form1.C:284
-#: src/insets/insetbib.C:95 src/insets/insetbib.C:123
+#: src/insets/insetbib.C:89 src/insets/insetbib.C:117
 #: src/insets/insetinclude.C:47 src/insets/insetindex.C:56
 #: src/latexoptions.C:21 src/layout_forms.C:72 src/layout_forms.C:277
 #: src/layout_forms.C:413 src/layout_forms.C:477 src/layout_forms.C:697
@@ -344,8 +342,8 @@ msgid "Apply|#A"
 msgstr ""
 
 #: src/bullet_forms.C:57 src/form1.C:120 src/form1.C:264 src/form1.C:290
-#: src/insets/insetbib.C:98 src/insets/insetbib.C:99 src/insets/insetbib.C:126
-#: src/insets/insetbib.C:127 src/insets/insetinclude.C:50
+#: src/insets/insetbib.C:92 src/insets/insetbib.C:93 src/insets/insetbib.C:120
+#: src/insets/insetbib.C:121 src/insets/insetinclude.C:50
 #: src/insets/insetinclude.C:51 src/insets/insetindex.C:60
 #: src/insets/insetindex.C:61 src/latexoptions.C:27 src/layout_forms.C:64
 #: src/layout_forms.C:285 src/layout_forms.C:391 src/layout_forms.C:419
@@ -733,56 +731,56 @@ msgstr ""
 msgid "Replace All|#A#a"
 msgstr ""
 
-#: src/insets/figinset.C:1085
+#: src/insets/figinset.C:1099
 msgid "[render error]"
 msgstr ""
 
-#: src/insets/figinset.C:1086
+#: src/insets/figinset.C:1100
 msgid "[rendering ... ]"
 msgstr ""
 
-#: src/insets/figinset.C:1088
+#: src/insets/figinset.C:1102
 msgid "[no file]"
 msgstr ""
 
-#: src/insets/figinset.C:1089
+#: src/insets/figinset.C:1103
 msgid "[not displayed]"
 msgstr ""
 
-#: src/insets/figinset.C:1090
+#: src/insets/figinset.C:1104
 msgid "[no ghostscript]"
 msgstr ""
 
-#: src/insets/figinset.C:1092
+#: src/insets/figinset.C:1106
 msgid "[unknown error]"
 msgstr ""
 
-#: src/insets/figinset.C:1289
+#: src/insets/figinset.C:1303
 msgid "Figure"
 msgstr ""
 
-#: src/insets/figinset.C:1350 src/insets/figinset.C:1483
+#: src/insets/figinset.C:1365 src/insets/figinset.C:1498
 msgid "empty figure path"
 msgstr ""
 
-#: src/insets/figinset.C:2137
+#: src/insets/figinset.C:2154
 msgid "Clipart"
 msgstr ""
 
-#: src/insets/figinset.C:2138 src/lyxfunc.C:4707 src/lyxfunc.C:4770
-#: src/lyxfunc.C:4993
+#: src/insets/figinset.C:2155 src/lyxfunc.C:2517 src/lyxfunc.C:2580
+#: src/lyxfunc.C:2803
 msgid "Document"
 msgstr ""
 
-#: src/insets/figinset.C:2144 src/insets/figinset.C:2147
+#: src/insets/figinset.C:2161 src/insets/figinset.C:2165
 msgid "EPS Figure"
 msgstr ""
 
-#: src/insets/figinset.C:2161
+#: src/insets/figinset.C:2179
 msgid "Filename can't contain any of these characters:"
 msgstr ""
 
-#: src/insets/figinset.C:2162
+#: src/insets/figinset.C:2182
 #, no-c-format
 msgid "space, '#', '~', '$' or '%'."
 msgstr ""
@@ -816,57 +814,57 @@ msgstr ""
 msgid "HTML type|#H"
 msgstr ""
 
-#: src/LyXAction.C:114 src/insets/form_url.C:31 src/insets/inseterror.C:167
+#: src/LyXAction.C:116 src/insets/form_url.C:31 src/insets/inseterror.C:167
 #: src/latexoptions.C:47 src/layout_forms.C:240 src/layout_forms.C:562
 #: src/layout_forms.C:790 src/lyx.C:125 src/lyx_sendfax.C:109 src/lyxvc.C:251
 #: src/mathed/math_forms.C:179
 msgid "Close"
 msgstr ""
 
-#: src/insets/insetbib.C:88
+#: src/insets/insetbib.C:82
 msgid "Key:"
 msgstr ""
 
-#: src/insets/insetbib.C:102 src/insets/insetbib.C:103
+#: src/insets/insetbib.C:96 src/insets/insetbib.C:97
 msgid "Remark:|#R"
 msgstr ""
 
 #. InsetBibtex uses the same form, with different labels
-#: src/insets/insetbib.C:120 src/insets/insetbib.C:121
-#: src/insets/insetbib.C:274 src/insets/insetbib.C:275
+#: src/insets/insetbib.C:114 src/insets/insetbib.C:115
+#: src/insets/insetbib.C:269 src/insets/insetbib.C:270
 msgid "Key:|#K"
 msgstr ""
 
-#: src/insets/insetbib.C:130 src/insets/insetbib.C:131
-#: src/insets/insetbib.C:276 src/insets/insetbib.C:277
+#: src/insets/insetbib.C:124 src/insets/insetbib.C:125
+#: src/insets/insetbib.C:271 src/insets/insetbib.C:272
 msgid "Label:|#L"
 msgstr ""
 
-#: src/insets/insetbib.C:179
+#: src/insets/insetbib.C:174
 msgid "Citation"
 msgstr ""
 
-#: src/insets/insetbib.C:285
+#: src/insets/insetbib.C:280
 msgid "Bibliography item"
 msgstr ""
 
-#: src/insets/insetbib.C:300
+#: src/insets/insetbib.C:295
 msgid "BibTeX Generated References"
 msgstr ""
 
-#: src/insets/insetbib.C:415
+#: src/insets/insetbib.C:410
 msgid "Database:"
 msgstr ""
 
-#: src/insets/insetbib.C:416
+#: src/insets/insetbib.C:411
 msgid "Style:  "
 msgstr ""
 
-#: src/insets/insetbib.C:424
+#: src/insets/insetbib.C:419
 msgid "BibTeX"
 msgstr ""
 
-#: src/insets/inseterror.C:67 src/insets/inseterror.C:86 src/lyx_cb.C:4357
+#: src/insets/inseterror.C:67 src/insets/inseterror.C:86 src/lyx_cb.C:3804
 msgid "Error"
 msgstr ""
 
@@ -912,8 +910,8 @@ msgid "Use include|#U"
 msgstr ""
 
 #. launches dialog
-#: src/insets/insetinclude.C:111 src/lyx_cb.C:386 src/lyxfunc.C:4655
-#: src/lyxfunc.C:4745 src/lyxfunc.C:4794 src/lyxfunc.C:4867 src/lyxfunc.C:4968
+#: src/insets/insetinclude.C:111 src/lyx_cb.C:369 src/lyxfunc.C:2465
+#: src/lyxfunc.C:2555 src/lyxfunc.C:2604 src/lyxfunc.C:2677 src/lyxfunc.C:2778
 #: src/menus.C:177 src/menus.C:309 src/menus.C:310 src/menus.C:311
 msgid "Documents"
 msgstr ""
@@ -993,7 +991,7 @@ msgid "Ref: "
 msgstr ""
 
 #. /
-#: src/insets/insettoc.h:35 src/lyxfunc.C:889 src/lyxfunc.C:2972
+#: src/insets/insettoc.h:35 src/lyxfunc.C:784
 msgid "Table of Contents"
 msgstr ""
 
@@ -1027,7 +1025,7 @@ msgstr ""
 msgid "Key Mappings"
 msgstr ""
 
-#: src/kbmap.C:298
+#: src/kbmap.C:250
 msgid "   options: "
 msgstr ""
 
@@ -1567,407 +1565,407 @@ msgstr ""
 msgid "Describe command"
 msgstr ""
 
-#: src/LyXAction.C:95
+#: src/LyXAction.C:96
 msgid "Select previous char"
 msgstr ""
 
-#: src/LyXAction.C:98
+#: src/LyXAction.C:99
 msgid "Insert bibtex"
 msgstr ""
 
-#: src/LyXAction.C:105
+#: src/LyXAction.C:107
 msgid "Build program"
 msgstr ""
 
-#: src/LyXAction.C:106
+#: src/LyXAction.C:108
 msgid "Autosave"
 msgstr ""
 
-#: src/LyXAction.C:108
+#: src/LyXAction.C:110
 msgid "Go to beginning of document"
 msgstr ""
 
-#: src/LyXAction.C:110
+#: src/LyXAction.C:112
 msgid "Select to beginning of document"
 msgstr ""
 
-#: src/LyXAction.C:113
+#: src/LyXAction.C:115
 msgid "Check TeX"
 msgstr ""
 
-#: src/LyXAction.C:116
+#: src/LyXAction.C:118
 msgid "Go to end of document"
 msgstr ""
 
-#: src/LyXAction.C:118
+#: src/LyXAction.C:120
 msgid "Select to end of document"
 msgstr ""
 
-#: src/LyXAction.C:119
+#: src/LyXAction.C:121
 msgid "Export to"
 msgstr ""
 
-#: src/LyXAction.C:120
+#: src/LyXAction.C:122
 msgid "Fax"
 msgstr ""
 
-#: src/LyXAction.C:123
+#: src/LyXAction.C:125
 msgid "Import document"
 msgstr ""
 
-#: src/LyXAction.C:126
+#: src/LyXAction.C:128
 msgid "New document"
 msgstr ""
 
-#: src/LyXAction.C:128
+#: src/LyXAction.C:130
 msgid "New document from template"
 msgstr ""
 
-#: src/LyXAction.C:129
+#: src/LyXAction.C:131
 msgid "Open"
 msgstr ""
 
-#: src/LyXAction.C:131
+#: src/LyXAction.C:133
 msgid "Switch to previous document"
 msgstr ""
 
-#: src/LyXAction.C:132 src/lyx_cb.C:1015 src/print_form.C:72
+#: src/LyXAction.C:134 src/lyx_cb.C:953 src/print_form.C:72
 msgid "Print"
 msgstr ""
 
-#: src/LyXAction.C:134
+#: src/LyXAction.C:136
 msgid "Revert to saved"
 msgstr ""
 
-#: src/LyXAction.C:136
+#: src/LyXAction.C:138
 msgid "Toggle read-only"
 msgstr ""
 
-#: src/LyXAction.C:137
+#: src/LyXAction.C:139
 msgid "Update DVI"
 msgstr ""
 
-#: src/LyXAction.C:139
+#: src/LyXAction.C:142
 msgid "Update PostScript"
 msgstr ""
 
-#: src/LyXAction.C:140
+#: src/LyXAction.C:143
 msgid "View DVI"
 msgstr ""
 
-#: src/LyXAction.C:142
+#: src/LyXAction.C:145
 msgid "View PostScript"
 msgstr ""
 
-#: src/LyXAction.C:143 src/lyx_sendfax_main.C:278
+#: src/LyXAction.C:146 src/lyx_sendfax_main.C:278
 msgid "Save"
 msgstr ""
 
-#: src/LyXAction.C:144
+#: src/LyXAction.C:147
 msgid "Save As"
 msgstr ""
 
-#: src/LyXAction.C:145 src/lyxfunc.C:665 src/lyxfunc.C:2748
+#: src/LyXAction.C:149 src/lyxfunc.C:638
 msgid "Cancel"
 msgstr ""
 
-#: src/LyXAction.C:146
+#: src/LyXAction.C:150
 msgid "Go one char back"
 msgstr ""
 
-#: src/LyXAction.C:147
+#: src/LyXAction.C:152
 msgid "Go one char forward"
 msgstr ""
 
-#: src/LyXAction.C:149
+#: src/LyXAction.C:155
 msgid "Insert citation"
 msgstr ""
 
-#: src/LyXAction.C:152
+#: src/LyXAction.C:158
 msgid "Execute command"
 msgstr ""
 
-#: src/LyXAction.C:154 src/lyx_cb.C:2742 src/lyx_cb.C:2749
+#: src/LyXAction.C:160 src/lyx_cb.C:2493
 msgid "Copy"
 msgstr ""
 
-#: src/LyXAction.C:155 src/lyx_cb.C:2769
+#: src/LyXAction.C:161 src/lyx_cb.C:2506
 msgid "Cut"
 msgstr ""
 
-#: src/LyXAction.C:161
+#: src/LyXAction.C:167
 msgid "Decrement environment depth"
 msgstr ""
 
-#: src/LyXAction.C:163
+#: src/LyXAction.C:169
 msgid "Increment environment depth"
 msgstr ""
 
-#: src/LyXAction.C:165
+#: src/LyXAction.C:171
 msgid "Change environment depth"
 msgstr ""
 
-#: src/LyXAction.C:166
+#: src/LyXAction.C:172
 msgid "Insert ... dots"
 msgstr ""
 
-#: src/LyXAction.C:167
+#: src/LyXAction.C:173
 msgid "Go down"
 msgstr ""
 
-#: src/LyXAction.C:169
+#: src/LyXAction.C:175
 msgid "Select next line"
 msgstr ""
 
-#: src/LyXAction.C:171
+#: src/LyXAction.C:177
 msgid "Choose Paragraph Environment"
 msgstr ""
 
-#: src/LyXAction.C:173
+#: src/LyXAction.C:179
 msgid "Insert end of sentence period"
 msgstr ""
 
-#: src/LyXAction.C:174
+#: src/LyXAction.C:180
 msgid "Go to next error"
 msgstr ""
 
-#: src/LyXAction.C:176
+#: src/LyXAction.C:182
 msgid "Remove all error boxes"
 msgstr ""
 
-#: src/LyXAction.C:177 src/lyx_cb.C:2675
+#: src/LyXAction.C:183 src/lyx_cb.C:2442
 msgid "Insert Figure"
 msgstr ""
 
-#: src/LyXAction.C:182 src/lyxfr0.C:97
+#: src/LyXAction.C:188 src/lyxfr0.C:97
 msgid "Find & Replace"
 msgstr ""
 
-#: src/LyXAction.C:183
+#: src/LyXAction.C:190
 msgid "Toggle bold"
 msgstr ""
 
-#: src/LyXAction.C:184
+#: src/LyXAction.C:191
 msgid "Toggle code style"
 msgstr ""
 
-#: src/LyXAction.C:185
+#: src/LyXAction.C:192
 msgid "Default font style"
 msgstr ""
 
-#: src/LyXAction.C:186
+#: src/LyXAction.C:194
 msgid "Toggle emphasize"
 msgstr ""
 
-#: src/LyXAction.C:187
+#: src/LyXAction.C:195
 msgid "Toggle user defined style"
 msgstr ""
 
-#: src/LyXAction.C:188
+#: src/LyXAction.C:197
 msgid "Toggle noun style"
 msgstr ""
 
-#: src/LyXAction.C:189
+#: src/LyXAction.C:198
 msgid "Toggle roman font style"
 msgstr ""
 
-#: src/LyXAction.C:190
+#: src/LyXAction.C:200
 msgid "Toggle sans font style"
 msgstr ""
 
-#: src/LyXAction.C:191
+#: src/LyXAction.C:201
 msgid "Set font size"
 msgstr ""
 
-#: src/LyXAction.C:192
+#: src/LyXAction.C:202
 msgid "Show font state"
 msgstr ""
 
-#: src/LyXAction.C:194
+#: src/LyXAction.C:205
 msgid "Toggle font underline"
 msgstr ""
 
-#: src/LyXAction.C:195
+#: src/LyXAction.C:206
 msgid "Insert Footnote"
 msgstr ""
 
-#: src/LyXAction.C:196
+#: src/LyXAction.C:208
 msgid "Select next char"
 msgstr ""
 
-#: src/LyXAction.C:198
+#: src/LyXAction.C:211
 msgid "Insert horizontal fill"
 msgstr ""
 
-#: src/LyXAction.C:201
+#: src/LyXAction.C:214
 msgid "Insert hyphenation point"
 msgstr ""
 
-#: src/LyXAction.C:203
+#: src/LyXAction.C:216
 msgid "Insert index item"
 msgstr ""
 
-#: src/LyXAction.C:205
+#: src/LyXAction.C:218
 msgid "Insert last index item"
 msgstr ""
 
-#: src/LyXAction.C:206
+#: src/LyXAction.C:219
 msgid "Insert index list"
 msgstr ""
 
-#: src/LyXAction.C:207
+#: src/LyXAction.C:221
 msgid "Turn off keymap"
 msgstr ""
 
-#: src/LyXAction.C:209
+#: src/LyXAction.C:224
 msgid "Use primary keymap"
 msgstr ""
 
-#: src/LyXAction.C:211
+#: src/LyXAction.C:226
 msgid "Use secondary keymap"
 msgstr ""
 
-#: src/LyXAction.C:212
+#: src/LyXAction.C:227
 msgid "Toggle keymap"
 msgstr ""
 
-#: src/LyXAction.C:213
+#: src/LyXAction.C:229
 msgid "Insert Label"
 msgstr ""
 
-#: src/LyXAction.C:214
+#: src/LyXAction.C:231
 msgid "View LaTeX log"
 msgstr ""
 
-#: src/LyXAction.C:218
+#: src/LyXAction.C:236
 msgid "Copy paragraph environment type"
 msgstr ""
 
-#: src/LyXAction.C:224
+#: src/LyXAction.C:242
 msgid "Paste paragraph environment type"
 msgstr ""
 
-#: src/LyXAction.C:230
+#: src/LyXAction.C:249
 msgid "Go to beginning of line"
 msgstr ""
 
-#: src/LyXAction.C:232
+#: src/LyXAction.C:251
 msgid "Select to beginning of line"
 msgstr ""
 
-#: src/LyXAction.C:234
+#: src/LyXAction.C:253
 msgid "Go to end of line"
 msgstr ""
 
-#: src/LyXAction.C:236
+#: src/LyXAction.C:255
 msgid "Select to end of line"
 msgstr ""
 
-#: src/LyXAction.C:238
+#: src/LyXAction.C:257
 msgid "Insert list of algorithms"
 msgstr ""
 
-#: src/LyXAction.C:240
+#: src/LyXAction.C:259
 msgid "Insert list of figures"
 msgstr ""
 
-#: src/LyXAction.C:242
+#: src/LyXAction.C:261
 msgid "Insert list of tables"
 msgstr ""
 
-#: src/LyXAction.C:243
+#: src/LyXAction.C:262
 msgid "Exit"
 msgstr ""
 
-#: src/LyXAction.C:245
+#: src/LyXAction.C:264
 msgid "Insert Margin note"
 msgstr ""
 
-#: src/LyXAction.C:251
+#: src/LyXAction.C:270
 msgid "Math Greek"
 msgstr ""
 
-#: src/LyXAction.C:254
+#: src/LyXAction.C:273
 msgid "Insert math symbol"
 msgstr ""
 
-#: src/LyXAction.C:259
+#: src/LyXAction.C:278
 msgid "Math mode"
 msgstr ""
 
-#: src/LyXAction.C:263 src/lyx_cb.C:2817
+#: src/LyXAction.C:282 src/lyx_cb.C:2539
 msgid "Melt"
 msgstr ""
 
-#: src/LyXAction.C:271
+#: src/LyXAction.C:290
 msgid "Go one paragraph down"
 msgstr ""
 
-#: src/LyXAction.C:273
+#: src/LyXAction.C:292
 msgid "Select next paragraph"
 msgstr ""
 
-#: src/LyXAction.C:275
+#: src/LyXAction.C:294
 msgid "Go one paragraph up"
 msgstr ""
 
-#: src/LyXAction.C:277
+#: src/LyXAction.C:296
 msgid "Select previous paragraph"
 msgstr ""
 
-#: src/LyXAction.C:279 src/lyx_cb.C:2779
+#: src/LyXAction.C:298 src/lyx_cb.C:2516
 msgid "Paste"
 msgstr ""
 
-#: src/LyXAction.C:284
+#: src/LyXAction.C:303
 msgid "Insert protected space"
 msgstr ""
 
-#: src/LyXAction.C:285
+#: src/LyXAction.C:304
 msgid "Insert quote"
 msgstr ""
 
-#: src/LyXAction.C:287
+#: src/LyXAction.C:306
 msgid "Reconfigure"
 msgstr ""
 
-#: src/LyXAction.C:288 src/lyx_cb.C:2349
+#: src/LyXAction.C:307 src/lyx_cb.C:2191
 msgid "Redo"
 msgstr ""
 
-#: src/LyXAction.C:292
+#: src/LyXAction.C:311
 msgid "Insert cross reference"
 msgstr ""
 
-#: src/LyXAction.C:314 src/lyx_cb.C:2687
+#: src/LyXAction.C:333 src/lyx_cb.C:2454
 msgid "Insert Table"
 msgstr ""
 
-#: src/LyXAction.C:315
+#: src/LyXAction.C:334
 msgid "Toggle TeX style"
 msgstr ""
 
-#: src/LyXAction.C:317
+#: src/LyXAction.C:336
 msgid "Insert table of contents"
 msgstr ""
 
-#: src/LyXAction.C:319
+#: src/LyXAction.C:338
 msgid "View table of contents"
 msgstr ""
 
-#: src/LyXAction.C:321
+#: src/LyXAction.C:340
 msgid "Toggle cursor does/doesn't follow the scrollbar"
 msgstr ""
 
-#: src/LyXAction.C:325 src/lyx_cb.C:2320
+#: src/LyXAction.C:344 src/lyx_cb.C:2170
 msgid "Undo"
 msgstr ""
 
-#: src/LyXAction.C:333
+#: src/LyXAction.C:352
 msgid "Register document under version control"
 msgstr ""
 
-#: src/LyXAction.C:555
+#: src/LyXAction.C:576
 msgid "No description available!"
 msgstr ""
 
@@ -2023,447 +2021,459 @@ msgstr ""
 msgid "Go to Reference|#G"
 msgstr ""
 
-#: src/lyx_cb.C:361
+#: src/lyx_cb.C:348
 msgid "Save failed. Rename and try again?"
 msgstr ""
 
-#: src/lyx_cb.C:363
+#: src/lyx_cb.C:350
 msgid "(If not, document is not saved.)"
 msgstr ""
 
-#: src/lyx_cb.C:387 src/lyxfunc.C:4656
+#: src/lyx_cb.C:370 src/lyxfunc.C:2466
 msgid "Templates"
 msgstr ""
 
-#: src/lyx_cb.C:392
+#: src/lyx_cb.C:375
 msgid "Enter Filename to Save Document as"
 msgstr ""
 
 #. Cancel: Do nothing
-#: src/lyx_cb.C:399 src/lyxfunc.C:4662 src/lyxfunc.C:4689 src/lyxfunc.C:4754
-#: src/lyxfunc.C:4803 src/lyxfunc.C:4828 src/lyxfunc.C:4838 src/lyxfunc.C:4883
-#: src/lyxfunc.C:4908 src/lyxfunc.C:4918 src/lyxfunc.C:4977
+#: src/lyx_cb.C:382 src/lyxfunc.C:2472 src/lyxfunc.C:2499 src/lyxfunc.C:2564
+#: src/lyxfunc.C:2613 src/lyxfunc.C:2638 src/lyxfunc.C:2648 src/lyxfunc.C:2693
+#: src/lyxfunc.C:2718 src/lyxfunc.C:2728 src/lyxfunc.C:2787
 msgid "Canceled."
 msgstr ""
 
-#: src/lyx_cb.C:410
+#: src/lyx_cb.C:393
 msgid "Same name as document already has:"
 msgstr ""
 
-#: src/lyx_cb.C:412
+#: src/lyx_cb.C:395
 msgid "Save anyway?"
 msgstr ""
 
-#: src/lyx_cb.C:418
+#: src/lyx_cb.C:401
 msgid "Another document with same name open!"
 msgstr ""
 
-#: src/lyx_cb.C:420
+#: src/lyx_cb.C:403
 msgid "Replace with current document?"
 msgstr ""
 
-#: src/lyx_cb.C:428
+#: src/lyx_cb.C:411
 msgid "Document renamed to '"
 msgstr ""
 
-#: src/lyx_cb.C:430
+#: src/lyx_cb.C:413
 msgid "', but not saved..."
 msgstr ""
 
-#: src/lyx_cb.C:436
+#: src/lyx_cb.C:419
 msgid "Document already exists:"
 msgstr ""
 
-#: src/lyx_cb.C:438
+#: src/lyx_cb.C:421
 msgid "Replace file?"
 msgstr ""
 
-#: src/lyx_cb.C:469 src/lyx_cb.C:499
+#: src/lyx_cb.C:452 src/lyx_cb.C:482
 msgid "One error detected"
 msgstr ""
 
-#: src/lyx_cb.C:470 src/lyx_cb.C:500
+#: src/lyx_cb.C:453 src/lyx_cb.C:483
 msgid "You should try to fix it."
 msgstr ""
 
-#: src/lyx_cb.C:473 src/lyx_cb.C:503
+#: src/lyx_cb.C:456 src/lyx_cb.C:486
 msgid " errors detected."
 msgstr ""
 
-#: src/lyx_cb.C:474 src/lyx_cb.C:504
+#: src/lyx_cb.C:457 src/lyx_cb.C:487
 msgid "You should try to fix them."
 msgstr ""
 
-#: src/lyx_cb.C:476
+#: src/lyx_cb.C:459
 msgid "There were errors during the LaTeX run."
 msgstr ""
 
-#: src/lyx_cb.C:489
+#: src/lyx_cb.C:472
 msgid "Wrong type of document"
 msgstr ""
 
-#: src/lyx_cb.C:490
+#: src/lyx_cb.C:473
 msgid "The Build operation is not allowed in this document"
 msgstr ""
 
-#: src/lyx_cb.C:491 src/lyx_cb.C:506
+#: src/lyx_cb.C:474 src/lyx_cb.C:489
 msgid "There were errors during the Build process."
 msgstr ""
 
-#: src/lyx_cb.C:517
+#: src/lyx_cb.C:500
 msgid "Chktex does not work with SGML derived documents."
 msgstr ""
 
-#: src/lyx_cb.C:526
+#: src/lyx_cb.C:509
 msgid "No warnings found."
 msgstr ""
 
-#: src/lyx_cb.C:528
+#: src/lyx_cb.C:511
 msgid "One warning found."
 msgstr ""
 
-#: src/lyx_cb.C:529
+#: src/lyx_cb.C:512
 msgid "Use 'Edit->Go to Error' to find it."
 msgstr ""
 
-#: src/lyx_cb.C:532
+#: src/lyx_cb.C:515
 msgid " warnings found."
 msgstr ""
 
-#: src/lyx_cb.C:533
+#: src/lyx_cb.C:516
 msgid "Use 'Edit->Go to Error' to find them."
 msgstr ""
 
-#: src/lyx_cb.C:535
+#: src/lyx_cb.C:518
 msgid "Chktex run successfully"
 msgstr ""
 
-#: src/lyx_cb.C:537
+#: src/lyx_cb.C:520
 msgid "It seems chktex does not work."
 msgstr ""
 
-#: src/lyx_cb.C:628 src/lyx_cb.C:631
+#: src/lyx_cb.C:606 src/lyx_cb.C:609
 msgid "Executing command:"
 msgstr ""
 
-#: src/lyx_cb.C:874 src/lyx_cb.C:914 src/lyx_cb.C:951 src/lyx_cb.C:982
-#: src/lyxfunc.C:4698
+#: src/lyx_cb.C:828 src/lyx_cb.C:864 src/lyx_cb.C:897 src/lyx_cb.C:924
+#: src/lyxfunc.C:2508
 msgid "File already exists:"
 msgstr ""
 
-#: src/lyx_cb.C:876 src/lyx_cb.C:916 src/lyx_cb.C:953 src/lyx_cb.C:984
+#: src/lyx_cb.C:830 src/lyx_cb.C:866 src/lyx_cb.C:899 src/lyx_cb.C:926
 msgid "Do you want to overwrite the file?"
 msgstr ""
 
-#: src/lyx_cb.C:877 src/lyx_cb.C:917 src/lyx_cb.C:954 src/lyx_cb.C:985
+#: src/lyx_cb.C:831 src/lyx_cb.C:867 src/lyx_cb.C:900 src/lyx_cb.C:927
 msgid "Canceled"
 msgstr ""
 
-#: src/lyx_cb.C:882
+#: src/lyx_cb.C:836
 msgid "DocBook does not have a latex backend"
 msgstr ""
 
-#: src/lyx_cb.C:888
+#: src/lyx_cb.C:842
 msgid "Nice LaTeX file saved as"
 msgstr ""
 
-#: src/lyx_cb.C:904
+#: src/lyx_cb.C:854
 msgid "Document class must be linuxdoc."
 msgstr ""
 
-#: src/lyx_cb.C:921
+#: src/lyx_cb.C:871
 msgid "Building LinuxDoc SGML file `"
 msgstr ""
 
-#: src/lyx_cb.C:926
+#: src/lyx_cb.C:876
 msgid "LinuxDoc SGML file save as"
 msgstr ""
 
-#: src/lyx_cb.C:941
+#: src/lyx_cb.C:887
 msgid "Document class must be docbook."
 msgstr ""
 
-#: src/lyx_cb.C:958
+#: src/lyx_cb.C:904
 msgid "Building DocBook SGML file `"
 msgstr ""
 
-#: src/lyx_cb.C:963
+#: src/lyx_cb.C:909
 msgid "DocBook SGML file save as"
 msgstr ""
 
-#: src/lyx_cb.C:991
+#: src/lyx_cb.C:933
 msgid "Ascii file saved as"
 msgstr ""
 
-#: src/lyx_cb.C:1060
+#: src/lyx_cb.C:976
+msgid "Document exported as HTML to file `"
+msgstr ""
+
+#: src/lyx_cb.C:979
+msgid "Unable to convert to HTML the file `"
+msgstr ""
+
+#: src/lyx_cb.C:1035
+msgid "Unknown export type: "
+msgstr ""
+
+#: src/lyx_cb.C:1080
 msgid "Autosaving current document..."
 msgstr ""
 
-#: src/lyx_cb.C:1100
+#: src/lyx_cb.C:1120
 msgid "Autosave Failed!"
 msgstr ""
 
-#: src/lyx_cb.C:1156
+#: src/lyx_cb.C:1176
 msgid "File to Insert"
 msgstr ""
 
-#: src/lyx_cb.C:1166
+#: src/lyx_cb.C:1186
 msgid "Error! Specified file is unreadable: "
 msgstr ""
 
-#: src/lyx_cb.C:1173
+#: src/lyx_cb.C:1193
 msgid "Error! Cannot open specified file: "
 msgstr ""
 
-#: src/lyx_cb.C:1220
+#: src/lyx_cb.C:1231
 msgid "Table Of Contents"
 msgstr ""
 
-#: src/lyx_cb.C:1236 src/mathed/formula.C:1050
+#: src/lyx_cb.C:1247 src/mathed/formula.C:1050
 msgid "Enter new label to insert:"
 msgstr ""
 
-#: src/lyx_cb.C:1256
+#: src/lyx_cb.C:1267
 msgid "Insert Reference"
 msgstr ""
 
-#: src/lyx_cb.C:1291
+#: src/lyx_cb.C:1302
 msgid "Inserting Footnote..."
 msgstr ""
 
 #. Import file
-#: src/lyx_cb.C:1361
+#: src/lyx_cb.C:1366
 msgid "Importing LinuxDoc SGML file `"
 msgstr ""
 
 #. TeX output asked
-#: src/lyx_cb.C:1369
+#: src/lyx_cb.C:1374
 msgid "Converting LinuxDoc SGML to TeX file..."
 msgstr ""
 
 #. dvi output asked
-#: src/lyx_cb.C:1376
+#: src/lyx_cb.C:1381
 msgid "Converting LinuxDoc SGML to dvi file..."
 msgstr ""
 
-#: src/lyx_cb.C:1429
+#: src/lyx_cb.C:1434
 msgid "Converting DocBook SGML to dvi file..."
 msgstr ""
 
-#: src/lyx_cb.C:1567
+#: src/lyx_cb.C:1553
 msgid "Character Style"
 msgstr ""
 
-#: src/lyx_cb.C:1897
+#: src/lyx_cb.C:1759
 msgid "Paragraph Environment"
 msgstr ""
 
-#: src/lyx_cb.C:2152
+#: src/lyx_cb.C:2014
 msgid "Document Layout"
 msgstr ""
 
-#: src/lyx_cb.C:2191
+#: src/lyx_cb.C:2053
 msgid "Quotes"
 msgstr ""
 
-#: src/lyx_cb.C:2238
+#: src/lyx_cb.C:2100
 msgid "LaTeX Preamble"
 msgstr ""
 
-#: src/lyx_cb.C:2255
+#: src/lyx_cb.C:2117
 msgid "Do you want to save the current settings"
 msgstr ""
 
-#: src/lyx_cb.C:2256
+#: src/lyx_cb.C:2118
 msgid "for Character, Document, Paper and Quotes"
 msgstr ""
 
-#: src/lyx_cb.C:2257
+#: src/lyx_cb.C:2119
 msgid "as default for new documents?"
 msgstr ""
 
-#: src/lyx_cb.C:2275 src/lyx_cb.C:2295
+#: src/lyx_cb.C:2137 src/lyx_cb.C:2151
 msgid "Open/Close..."
 msgstr ""
 
-#: src/lyx_cb.C:2326 src/lyx_cb.C:2332
+#: src/lyx_cb.C:2175
 msgid "No further undo information"
 msgstr ""
 
-#: src/lyx_cb.C:2344
+#: src/lyx_cb.C:2186
 msgid "Redo not yet supported in math mode"
 msgstr ""
 
-#: src/lyx_cb.C:2355 src/lyx_cb.C:2361
+#: src/lyx_cb.C:2196
 msgid "No further redo information"
 msgstr ""
 
-#: src/lyx_cb.C:2593 src/lyx_cb.C:2613
+#: src/lyx_cb.C:2392
 msgid "Font: "
 msgstr ""
 
-#: src/lyx_cb.C:2597 src/lyx_cb.C:2617
+#: src/lyx_cb.C:2396
 msgid ", Depth: "
 msgstr ""
 
-#: src/lyx_cb.C:2653
+#: src/lyx_cb.C:2426
 msgid "Inserting margin note..."
 msgstr ""
 
-#: src/lyx_cb.C:2702 src/lyx_cb.C:2709
+#: src/lyx_cb.C:2468
 msgid "Paragraph environment type copied"
 msgstr ""
 
-#: src/lyx_cb.C:2721 src/lyx_cb.C:2725
+#: src/lyx_cb.C:2478
 msgid "Paragraph environment type set"
 msgstr ""
 
-#: src/lyx_cb.C:2867
+#: src/lyx_cb.C:2574
 msgid "Changed environment depth (in possible range, maybe not)"
 msgstr ""
 
-#: src/lyx_cb.C:3117
+#: src/lyx_cb.C:2811
 msgid "Paragraph layout set"
 msgstr ""
 
-#: src/lyx_cb.C:3187
+#: src/lyx_cb.C:2881
 msgid "Should I set some parameters to"
 msgstr ""
 
-#: src/lyx_cb.C:3189
+#: src/lyx_cb.C:2883
 msgid "the defaults of this document class?"
 msgstr ""
 
 #. unable to load new style
-#: src/lyx_cb.C:3198 src/lyx_cb.C:3326 src/lyx_cb.C:3333
+#: src/lyx_cb.C:2892 src/lyx_cb.C:3010 src/lyx_cb.C:3017
 msgid "Conversion Errors!"
 msgstr ""
 
-#: src/lyx_cb.C:3199 src/lyx_cb.C:3334
+#: src/lyx_cb.C:2893 src/lyx_cb.C:3018
 msgid "Unable to switch to new document class."
 msgstr ""
 
-#: src/lyx_cb.C:3200 src/lyx_cb.C:3335
+#: src/lyx_cb.C:2894 src/lyx_cb.C:3019
 msgid "Reverting to original document class."
 msgstr ""
 
-#: src/lyx_cb.C:3300
+#: src/lyx_cb.C:2994
 msgid "Converting document to new document class..."
 msgstr ""
 
-#: src/lyx_cb.C:3321
+#: src/lyx_cb.C:3005
 msgid "One paragraph couldn't be converted"
 msgstr ""
 
-#: src/lyx_cb.C:3324
+#: src/lyx_cb.C:3008
 msgid " paragraphs couldn't be converted"
 msgstr ""
 
-#: src/lyx_cb.C:3327
+#: src/lyx_cb.C:3011
 msgid "into chosen document class"
 msgstr ""
 
-#: src/lyx_cb.C:3413
+#: src/lyx_cb.C:3097
 msgid "Document layout set"
 msgstr ""
 
-#: src/lyx_cb.C:3465 src/lyx_cb.C:3469 src/lyx_cb.C:3499 src/lyx_cb.C:3503
+#: src/lyx_cb.C:3148 src/lyx_cb.C:3152
 msgid "No more notes"
 msgstr ""
 
-#: src/lyx_cb.C:3542
+#: src/lyx_cb.C:3184
 msgid "Quotes type set"
 msgstr ""
 
-#: src/lyx_cb.C:3606
+#: src/lyx_cb.C:3248
 msgid "LaTeX preamble set"
 msgstr ""
 
-#: src/lyx_cb.C:3628 src/lyx_cb.C:3706
+#: src/lyx_cb.C:3269
 msgid "Cannot insert table in table."
 msgstr ""
 
-#: src/lyx_cb.C:3633 src/lyx_cb.C:3711
+#: src/lyx_cb.C:3274
 msgid "Inserting table..."
 msgstr ""
 
-#: src/lyx_cb.C:3695 src/lyx_cb.C:3773
+#: src/lyx_cb.C:3336
 msgid "Table inserted"
 msgstr ""
 
-#: src/lyx_cb.C:3829 src/lyx_cb.C:3847
+#: src/lyx_cb.C:3392 src/lyx_cb.C:3410
 msgid "ERROR!  Unable to print!"
 msgstr ""
 
-#: src/lyx_cb.C:3830
+#: src/lyx_cb.C:3393
 msgid "Check 'range of pages'!"
 msgstr ""
 
-#: src/lyx_cb.C:3848
+#: src/lyx_cb.C:3411
 msgid "Check 'number of copies'!"
 msgstr ""
 
-#: src/lyx_cb.C:3957
+#: src/lyx_cb.C:3520
 msgid "Error:"
 msgstr ""
 
-#: src/lyx_cb.C:3958
+#: src/lyx_cb.C:3521
 msgid "Unable to print"
 msgstr ""
 
-#: src/lyx_cb.C:3959
+#: src/lyx_cb.C:3522
 msgid "Check that your parameters are correct"
 msgstr ""
 
-#: src/lyx_cb.C:3981 src/lyx_cb.C:4050
+#: src/lyx_cb.C:3543
 msgid "Inserting figure..."
 msgstr ""
 
-#: src/lyx_cb.C:3986 src/lyx_cb.C:4037 src/lyx_cb.C:4055 src/lyx_cb.C:4106
+#: src/lyx_cb.C:3548 src/lyx_cb.C:3599
 msgid "Figure inserted"
 msgstr ""
 
-#: src/lyx_cb.C:4136
+#: src/lyx_cb.C:3629
 msgid "Screen options set"
 msgstr ""
 
-#: src/lyx_cb.C:4166
+#: src/lyx_cb.C:3659
 msgid "LaTeX Options"
 msgstr ""
 
-#: src/lyx_cb.C:4175
+#: src/lyx_cb.C:3668
 msgid "Running configure..."
 msgstr ""
 
-#: src/lyx_cb.C:4182
+#: src/lyx_cb.C:3675
 msgid "Reloading configuration..."
 msgstr ""
 
-#: src/lyx_cb.C:4184
+#: src/lyx_cb.C:3677
 msgid "The system has been reconfigured."
 msgstr ""
 
-#: src/lyx_cb.C:4185
+#: src/lyx_cb.C:3678
 msgid "You need to restart LyX to make use of any"
 msgstr ""
 
-#: src/lyx_cb.C:4186
+#: src/lyx_cb.C:3679
 msgid "updated document class specifications."
 msgstr ""
 
-#: src/lyx_cb.C:4358
+#: src/lyx_cb.C:3805
 msgid "Couldn't find this label"
 msgstr ""
 
-#: src/lyx_cb.C:4359
+#: src/lyx_cb.C:3806
 msgid "in current document."
 msgstr ""
 
-#: src/lyx_cb.C:4391
+#: src/lyx_cb.C:3838
 msgid "*** No Document ***"
 msgstr ""
 
-#: src/lyx_cb.C:4556
+#: src/lyx_cb.C:4003
 msgid "*** No labels found in document ***"
 msgstr ""
 
@@ -2698,254 +2708,242 @@ msgstr ""
 msgid "Default"
 msgstr ""
 
-#: src/lyxfr1.C:157 src/lyxfr1.C:213
+#: src/lyxfr1.C:150 src/lyxfr1.C:187
 msgid "Sorry!"
 msgstr ""
 
-#: src/lyxfr1.C:157 src/lyxfr1.C:213
+#: src/lyxfr1.C:150 src/lyxfr1.C:187
 msgid "You cannot replace a single space, nor an empty character."
 msgstr ""
 
-#: src/lyxfr1.C:263 src/lyxfr1.C:328
+#: src/lyxfr1.C:217 src/lyxfr1.C:264
 msgid "String not found!"
 msgstr ""
 
-#: src/lyxfr1.C:266
+#: src/lyxfr1.C:220
 msgid "1 string has been replaced."
 msgstr ""
 
-#: src/lyxfr1.C:269
+#: src/lyxfr1.C:223
 msgid " strings have been replaced."
 msgstr ""
 
-#: src/lyxfr1.C:324
+#: src/lyxfr1.C:260
 msgid "Found."
 msgstr ""
 
-#: src/lyxfunc.C:295
+#: src/lyxfunc.C:276
 msgid "Unknown sequence:"
 msgstr ""
 
-#: src/lyxfunc.C:338 src/lyxfunc.C:2521 src/lyxfunc.C:4605
+#: src/lyxfunc.C:319 src/lyxfunc.C:2415
 msgid "Unknown action"
 msgstr ""
 
 #. no
-#: src/lyxfunc.C:352
+#: src/lyxfunc.C:333
 msgid "Document is read-only"
 msgstr ""
 
 #. no
-#: src/lyxfunc.C:357
+#: src/lyxfunc.C:338
 msgid "Command not allowed without any document open"
 msgstr ""
 
-#: src/lyxfunc.C:586 src/lyxfunc.C:2669
+#: src/lyxfunc.C:559
 msgid "Text mode"
 msgstr ""
 
-#: src/lyxfunc.C:837 src/lyxfunc.C:2920
-msgid "Document exported as HTML to file `"
-msgstr ""
-
-#: src/lyxfunc.C:840 src/lyxfunc.C:2923
-msgid "Unable to convert to HTML the file `"
-msgstr ""
-
-#: src/lyxfunc.C:846 src/lyxfunc.C:2929
-msgid "Unknown export type: "
-msgstr ""
-
-#: src/lyxfunc.C:870 src/lyxfunc.C:2953
+#: src/lyxfunc.C:765
 msgid "Unknown import type: "
 msgstr ""
 
-#: src/lyxfunc.C:1199 src/lyxfunc.C:3282
+#: src/lyxfunc.C:1093
 msgid "Layout "
 msgstr ""
 
-#: src/lyxfunc.C:1200 src/lyxfunc.C:3283
+#: src/lyxfunc.C:1094
 msgid " not known"
 msgstr ""
 
-#: src/lyxfunc.C:1342 src/lyxfunc.C:3425
+#: src/lyxfunc.C:1236
 msgid "No cross-reference to toggle"
 msgstr ""
 
-#: src/lyxfunc.C:1693 src/lyxfunc.C:3777
+#: src/lyxfunc.C:1587
 msgid "Mark removed"
 msgstr ""
 
-#: src/lyxfunc.C:1698 src/lyxfunc.C:3782
+#: src/lyxfunc.C:1592
 msgid "Mark set"
 msgstr ""
 
-#: src/lyxfunc.C:1801 src/lyxfunc.C:3885
+#: src/lyxfunc.C:1695
 msgid "Mark off"
 msgstr ""
 
-#: src/lyxfunc.C:1811 src/lyxfunc.C:3895
+#: src/lyxfunc.C:1705
 msgid "Mark on"
 msgstr ""
 
-#: src/lyxfunc.C:2112 src/lyxfunc.C:4196
+#: src/lyxfunc.C:2006
 msgid "Push-toolbar needs argument > 0"
 msgstr ""
 
-#: src/lyxfunc.C:2130 src/lyxfunc.C:4214
+#: src/lyxfunc.C:2024
 msgid "Usage: toolbar-add-to <LyX command>"
 msgstr ""
 
-#: src/lyxfunc.C:2154 src/lyxfunc.C:4238 src/mathed/formula.C:874
+#: src/lyxfunc.C:2048 src/mathed/formula.C:874
 msgid "Math greek mode on"
 msgstr ""
 
-#: src/lyxfunc.C:2165 src/lyxfunc.C:4249 src/mathed/formula.C:885
+#: src/lyxfunc.C:2059 src/mathed/formula.C:885
 msgid "Math greek keyboard on"
 msgstr ""
 
-#: src/lyxfunc.C:2167 src/lyxfunc.C:4251 src/mathed/formula.C:887
+#: src/lyxfunc.C:2061 src/mathed/formula.C:887
 msgid "Math greek keyboard off"
 msgstr ""
 
-#: src/lyxfunc.C:2202 src/lyxfunc.C:4286
+#: src/lyxfunc.C:2096
 msgid "Missing argument"
 msgstr ""
 
 #. / what appears in the minibuffer when opening
-#: src/lyxfunc.C:2218 src/lyxfunc.C:4302 src/mathed/formula.h:73
+#: src/lyxfunc.C:2112 src/mathed/formula.h:73
 msgid "Math editor mode"
 msgstr ""
 
-#: src/lyxfunc.C:2225 src/lyxfunc.C:4309
+#: src/lyxfunc.C:2119
 msgid "This is only allowed in math mode!"
 msgstr ""
 
-#: src/lyxfunc.C:2379 src/lyxfunc.C:4463
+#: src/lyxfunc.C:2273
 msgid "Opening child document "
 msgstr ""
 
-#: src/lyxfunc.C:2411 src/lyxfunc.C:4495
+#: src/lyxfunc.C:2305
 msgid "Unknown kind of footnote"
 msgstr ""
 
-#: src/lyxfunc.C:2480 src/lyxfunc.C:4564
+#: src/lyxfunc.C:2374
 msgid "Document is read only"
 msgstr ""
 
-#: src/lyxfunc.C:4657
+#: src/lyxfunc.C:2467
 msgid "Enter Filename for new document"
 msgstr ""
 
-#: src/lyxfunc.C:4658
+#: src/lyxfunc.C:2468
 msgid "newfile"
 msgstr ""
 
-#: src/lyxfunc.C:4677 src/lyxfunc.C:4816 src/lyxfunc.C:4895
+#: src/lyxfunc.C:2487 src/lyxfunc.C:2626 src/lyxfunc.C:2705
 msgid ""
 "Do you want to close that document now?\n"
 "('No' will just switch to the open version)"
 msgstr ""
 
-#: src/lyxfunc.C:4700
+#: src/lyxfunc.C:2510
 msgid "Do you want to open the document?"
 msgstr ""
 
 #. loads document
-#: src/lyxfunc.C:4702 src/lyxfunc.C:4765
+#: src/lyxfunc.C:2512 src/lyxfunc.C:2575
 msgid "Opening document"
 msgstr ""
 
-#: src/lyxfunc.C:4709 src/lyxfunc.C:4772
+#: src/lyxfunc.C:2519 src/lyxfunc.C:2582
 msgid "opened."
 msgstr ""
 
-#: src/lyxfunc.C:4718
+#: src/lyxfunc.C:2528
 msgid "Choose template"
 msgstr ""
 
-#: src/lyxfunc.C:4746 src/lyxfunc.C:4795 src/lyxfunc.C:4868 src/lyxfunc.C:4969
+#: src/lyxfunc.C:2556 src/lyxfunc.C:2605 src/lyxfunc.C:2678 src/lyxfunc.C:2779
 msgid "Examples"
 msgstr ""
 
-#: src/lyxfunc.C:4748
+#: src/lyxfunc.C:2558
 msgid "Select Document to Open"
 msgstr ""
 
-#: src/lyxfunc.C:4774
+#: src/lyxfunc.C:2584
 msgid "Could not open document"
 msgstr ""
 
-#: src/lyxfunc.C:4797
+#: src/lyxfunc.C:2607
 msgid "Select ASCII file to Import"
 msgstr ""
 
-#: src/lyxfunc.C:4835 src/lyxfunc.C:4915
+#: src/lyxfunc.C:2645 src/lyxfunc.C:2725
 msgid "A document by the name"
 msgstr ""
 
-#: src/lyxfunc.C:4837 src/lyxfunc.C:4917
+#: src/lyxfunc.C:2647 src/lyxfunc.C:2727
 msgid "already exists. Overwrite?"
 msgstr ""
 
-#: src/lyxfunc.C:4843
+#: src/lyxfunc.C:2653
 msgid "Importing ASCII file"
 msgstr ""
 
-#: src/lyxfunc.C:4847
+#: src/lyxfunc.C:2657
 msgid "ASCII file "
 msgstr ""
 
-#: src/lyxfunc.C:4849 src/lyxfunc.C:4940
+#: src/lyxfunc.C:2659 src/lyxfunc.C:2750
 msgid "imported."
 msgstr ""
 
-#: src/lyxfunc.C:4872
+#: src/lyxfunc.C:2682
 msgid "Select Noweb file to Import"
 msgstr ""
 
-#: src/lyxfunc.C:4875
+#: src/lyxfunc.C:2685
 msgid "Select LaTeX file to Import"
 msgstr ""
 
-#: src/lyxfunc.C:4925
+#: src/lyxfunc.C:2735
 msgid "Importing LaTeX file"
 msgstr ""
 
-#: src/lyxfunc.C:4930
+#: src/lyxfunc.C:2740
 msgid "Importing Noweb file"
 msgstr ""
 
-#: src/lyxfunc.C:4938
+#: src/lyxfunc.C:2748
 msgid "Noweb file "
 msgstr ""
 
-#: src/lyxfunc.C:4938
+#: src/lyxfunc.C:2748
 msgid "LateX file "
 msgstr ""
 
-#: src/lyxfunc.C:4943
+#: src/lyxfunc.C:2753
 msgid "Could not import Noweb file"
 msgstr ""
 
-#: src/lyxfunc.C:4944
+#: src/lyxfunc.C:2754
 msgid "Could not import LaTeX file"
 msgstr ""
 
-#: src/lyxfunc.C:4971
+#: src/lyxfunc.C:2781
 msgid "Select Document to Insert"
 msgstr ""
 
 #. Inserts document
-#: src/lyxfunc.C:4989
+#: src/lyxfunc.C:2799
 msgid "Inserting document"
 msgstr ""
 
-#: src/lyxfunc.C:4995
+#: src/lyxfunc.C:2805
 msgid "inserted."
 msgstr ""
 
-#: src/lyxfunc.C:4997
+#: src/lyxfunc.C:2807
 msgid "Could not insert document"
 msgstr ""
 
@@ -3309,11 +3307,11 @@ msgstr ""
 msgid "VC History"
 msgstr ""
 
-#: src/LyXView.C:379 src/minibuffer.C:218
+#: src/LyXView.C:380 src/minibuffer.C:218
 msgid " (Changed)"
 msgstr ""
 
-#: src/LyXView.C:381
+#: src/LyXView.C:382
 msgid " (read only)"
 msgstr ""
 
@@ -3668,272 +3666,272 @@ msgstr ""
 msgid "New...|New from template...|Open...%l|Import%m%l|Exit%l"
 msgstr ""
 
-#: src/menus.C:818 src/menus.C:1139
+#: src/menus.C:818
 msgid ""
 "Floats & Insets%t|Open/Close%x21|Melt%x22|Open All Footnotes/Margin "
 "Notes%x23|Close All Footnotes/Margin Notes%x24|Open All "
 "Figures/Tables%x25|Close All Figures/Tables%x26%l|Remove all Error Boxes%x27"
 msgstr ""
 
-#: src/menus.C:827 src/menus.C:1148
+#: src/menus.C:827
 msgid "EMF|Oo#o#O"
 msgstr ""
 
-#: src/menus.C:828 src/menus.C:1149
+#: src/menus.C:828
 msgid "EMF|Mm#m#M"
 msgstr ""
 
-#: src/menus.C:829 src/menus.C:1150
+#: src/menus.C:829
 msgid "EMF|Aa#a#A"
 msgstr ""
 
-#: src/menus.C:830 src/menus.C:1151
+#: src/menus.C:830
 msgid "EMF|Cc#c#C"
 msgstr ""
 
-#: src/menus.C:831 src/menus.C:1152
+#: src/menus.C:831
 msgid "EMF|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:832 src/menus.C:1153
+#: src/menus.C:832
 msgid "EMF|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:833 src/menus.C:1154
+#: src/menus.C:833
 msgid "EMF|Rr#r#R"
 msgstr ""
 
-#: src/menus.C:841 src/menus.C:939 src/menus.C:1162 src/menus.C:1260
+#: src/menus.C:841 src/menus.C:939
 msgid "Table%t"
 msgstr ""
 
-#: src/menus.C:849 src/menus.C:1170
+#: src/menus.C:849
 msgid "|Multicolumn%B%x44%l"
 msgstr ""
 
-#: src/menus.C:851 src/menus.C:1172
+#: src/menus.C:851
 msgid "|Multicolumn%b%x44%l"
 msgstr ""
 
-#: src/menus.C:852 src/menus.C:1173
+#: src/menus.C:852
 msgid "EMT|Mm#m#M"
 msgstr ""
 
-#: src/menus.C:860 src/menus.C:1181
+#: src/menus.C:860
 msgid "|Line Top%B%x36"
 msgstr ""
 
-#: src/menus.C:862 src/menus.C:1183
+#: src/menus.C:862
 msgid "|Line Top%b%x36"
 msgstr ""
 
-#: src/menus.C:863 src/menus.C:1184
+#: src/menus.C:863
 msgid "EMT|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:871 src/menus.C:1192
+#: src/menus.C:871
 msgid "|Line Bottom%B%x37"
 msgstr ""
 
-#: src/menus.C:873 src/menus.C:1194
+#: src/menus.C:873
 msgid "|Line Bottom%b%x37"
 msgstr ""
 
-#: src/menus.C:874 src/menus.C:1195
+#: src/menus.C:874
 msgid "EMT|Bb#b#B"
 msgstr ""
 
-#: src/menus.C:882 src/menus.C:1203
+#: src/menus.C:882
 msgid "|Line Left%B%x38"
 msgstr ""
 
-#: src/menus.C:884 src/menus.C:1205
+#: src/menus.C:884
 msgid "|Line Left%b%x38"
 msgstr ""
 
-#: src/menus.C:885 src/menus.C:1206
+#: src/menus.C:885
 msgid "EMT|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:893 src/menus.C:1214
+#: src/menus.C:893
 msgid "|Line Right%B%x39%l"
 msgstr ""
 
-#: src/menus.C:895 src/menus.C:1216
+#: src/menus.C:895
 msgid "|Line Right%b%x39%l"
 msgstr ""
 
-#: src/menus.C:896 src/menus.C:1217
+#: src/menus.C:896
 msgid "EMT|Rr#r#R"
 msgstr ""
 
-#: src/menus.C:905 src/menus.C:1226
+#: src/menus.C:905
 msgid "|Align Left%R%x40"
 msgstr ""
 
-#: src/menus.C:907 src/menus.C:1228
+#: src/menus.C:907
 msgid "|Align Left%r%x40"
 msgstr ""
 
-#: src/menus.C:908 src/menus.C:1229
+#: src/menus.C:908
 msgid "EMT|eE#e#E"
 msgstr ""
 
-#: src/menus.C:911 src/menus.C:1232
+#: src/menus.C:911
 msgid "|Align Right%R%x41"
 msgstr ""
 
-#: src/menus.C:913 src/menus.C:1234
+#: src/menus.C:913
 msgid "|Align Right%r%x41"
 msgstr ""
 
-#: src/menus.C:914 src/menus.C:1235
+#: src/menus.C:914
 msgid "EMT|iI#i#I"
 msgstr ""
 
-#: src/menus.C:917 src/menus.C:1238
+#: src/menus.C:917
 msgid "|Align Center%R%x42%l"
 msgstr ""
 
-#: src/menus.C:919 src/menus.C:1240
+#: src/menus.C:919
 msgid "|Align Center%r%x42%l"
 msgstr ""
 
-#: src/menus.C:920 src/menus.C:1241
+#: src/menus.C:920
 msgid "EMT|Cc#c#C"
 msgstr ""
 
-#: src/menus.C:923 src/menus.C:1244
+#: src/menus.C:923
 #, no-c-format
 msgid "|Append Row%x32"
 msgstr ""
 
-#: src/menus.C:924 src/menus.C:1245
+#: src/menus.C:924
 msgid "EMT|oO#o#O"
 msgstr ""
 
-#: src/menus.C:926 src/menus.C:1247
+#: src/menus.C:926
 #, no-c-format
 msgid "|Append Column%x33%l"
 msgstr ""
 
-#: src/menus.C:927 src/menus.C:1248
+#: src/menus.C:927
 msgid "EMT|uU#u#U"
 msgstr ""
 
-#: src/menus.C:929 src/menus.C:1250
+#: src/menus.C:929
 #, no-c-format
 msgid "|Delete Row%x34"
 msgstr ""
 
-#: src/menus.C:930 src/menus.C:1251
+#: src/menus.C:930
 msgid "EMT|wW#w#W"
 msgstr ""
 
-#: src/menus.C:932 src/menus.C:1253
+#: src/menus.C:932
 #, no-c-format
 msgid "|Delete Column%x35%l"
 msgstr ""
 
-#: src/menus.C:933 src/menus.C:1254
+#: src/menus.C:933
 msgid "EMT|nN#n#N"
 msgstr ""
 
-#: src/menus.C:935 src/menus.C:1256
+#: src/menus.C:935
 #, no-c-format
 msgid "|Delete Table%x43"
 msgstr ""
 
-#: src/menus.C:936 src/menus.C:1257
+#: src/menus.C:936
 msgid "EMT|Dd#d#D"
 msgstr ""
 
-#: src/menus.C:941 src/menus.C:1262
+#: src/menus.C:941
 #, no-c-format
 msgid "|Insert table%x31"
 msgstr ""
 
-#: src/menus.C:942 src/menus.C:1263
+#: src/menus.C:942
 msgid "EMT|Ii#i#I"
 msgstr ""
 
-#: src/menus.C:946 src/menus.C:1267
+#: src/menus.C:946
 msgid "Version Control%t"
 msgstr ""
 
-#: src/menus.C:949 src/menus.C:1270
+#: src/menus.C:949
 #, no-c-format
 msgid "|Register%d%x51"
 msgstr ""
 
 #. signifies that the file is not checked out
-#: src/menus.C:953 src/menus.C:1274
+#: src/menus.C:953
 #, no-c-format
 msgid "|Check In Changes%d%x52"
 msgstr ""
 
-#: src/menus.C:955 src/menus.C:1276
+#: src/menus.C:955
 #, no-c-format
 msgid "|Check Out for Edit%x53"
 msgstr ""
 
 #. signifies that the file is checked out
-#: src/menus.C:959 src/menus.C:1280
+#: src/menus.C:959
 #, no-c-format
 msgid "|Check In Changes%x52"
 msgstr ""
 
-#: src/menus.C:961 src/menus.C:1282
+#: src/menus.C:961
 #, no-c-format
 msgid "|Check Out for Edit%d%x53"
 msgstr ""
 
-#: src/menus.C:964 src/menus.C:1285
+#: src/menus.C:964
 #, no-c-format
 msgid "|Revert to last version%x54"
 msgstr ""
 
-#: src/menus.C:966 src/menus.C:1287
+#: src/menus.C:966
 #, no-c-format
 msgid "|Undo last check in%x55"
 msgstr ""
 
-#: src/menus.C:968 src/menus.C:1289
+#: src/menus.C:968
 #, no-c-format
 msgid "|Show History%x56"
 msgstr ""
 
-#: src/menus.C:971 src/menus.C:1292
+#: src/menus.C:971
 #, no-c-format
 msgid "|Register%x51"
 msgstr ""
 
 #. the shortcuts are not good.
-#: src/menus.C:974 src/menus.C:1295
+#: src/menus.C:974
 msgid "EMV|Rr#r#R"
 msgstr ""
 
-#: src/menus.C:975 src/menus.C:1296
+#: src/menus.C:975
 msgid "EMV|Ii#i#I"
 msgstr ""
 
-#: src/menus.C:976 src/menus.C:1297
+#: src/menus.C:976
 msgid "EMV|Oo#o#O"
 msgstr ""
 
-#: src/menus.C:977 src/menus.C:1298
+#: src/menus.C:977
 msgid "EMV|lL#l#l"
 msgstr ""
 
-#: src/menus.C:978 src/menus.C:1299
+#: src/menus.C:978
 msgid "EMV|Uu#u#U"
 msgstr ""
 
-#: src/menus.C:979 src/menus.C:1300
+#: src/menus.C:979
 msgid "EMV|Hh#h#H"
 msgstr ""
 
-#: src/menus.C:982 src/menus.C:1303
+#: src/menus.C:982
 msgid ""
 "Undo|Redo %l|Cut|Copy|Paste%l|Find & Replace...|Go to Error|Go to "
 "Note|Floats & Insets%m|Table%m|Spellchecker....|Check TeX|Table of "
@@ -3941,241 +3939,241 @@ msgid ""
 "Selection as Lines|Paste Primary Selection as Paragraphs"
 msgstr ""
 
-#: src/menus.C:1001 src/menus.C:1322
+#: src/menus.C:1001
 msgid "EM|Uu#u#U"
 msgstr ""
 
-#: src/menus.C:1002 src/menus.C:1323
+#: src/menus.C:1002
 msgid "EM|Rr#r#R"
 msgstr ""
 
-#: src/menus.C:1003 src/menus.C:1324
+#: src/menus.C:1003
 msgid "EM|Cc#c#C"
 msgstr ""
 
-#: src/menus.C:1004 src/menus.C:1325
+#: src/menus.C:1004
 msgid "EM|oO#o#O"
 msgstr ""
 
-#: src/menus.C:1005 src/menus.C:1326
+#: src/menus.C:1005
 msgid "EM|Pp#p#P"
 msgstr ""
 
-#: src/menus.C:1006 src/menus.C:1327
+#: src/menus.C:1006
 msgid "EM|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:1007 src/menus.C:1328
+#: src/menus.C:1007
 msgid "EM|Ee#e#E"
 msgstr ""
 
-#: src/menus.C:1008 src/menus.C:1329
+#: src/menus.C:1008
 msgid "EM|Nn#n#N"
 msgstr ""
 
-#: src/menus.C:1009 src/menus.C:1330
+#: src/menus.C:1009
 msgid "EM|Ii#i#I"
 msgstr ""
 
-#: src/menus.C:1010 src/menus.C:1331
+#: src/menus.C:1010
 msgid "EM|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:1011 src/menus.C:1332
+#: src/menus.C:1011
 msgid "EM|Ss#s#S"
 msgstr ""
 
-#: src/menus.C:1012 src/menus.C:1333
+#: src/menus.C:1012
 msgid "EM|hH#h#H"
 msgstr ""
 
-#: src/menus.C:1013 src/menus.C:1334
+#: src/menus.C:1013
 msgid "EM|aA#a#A"
 msgstr ""
 
-#: src/menus.C:1014 src/menus.C:1335
+#: src/menus.C:1014
 msgid "EM|Vv#v#V"
 msgstr ""
 
-#: src/menus.C:1015 src/menus.C:1336
+#: src/menus.C:1015
 msgid "EM|wW#w#W"
 msgstr ""
 
-#: src/menus.C:1016 src/menus.C:1337
+#: src/menus.C:1016
 msgid "EM|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1017 src/menus.C:1338
+#: src/menus.C:1017
 msgid "EM|gG#g#G"
 msgstr ""
 
-#: src/menus.C:1464
+#: src/menus.C:1142
 msgid ""
 "Character...|Paragraph...|Document...|Paper...|Table...|Quotes...%l|Emphasize"
 " Style%b|Noun Style%b|Bold Style%b|TeX Style%b|Change Environment "
 "Depth|LaTeX Preamble...%l|Save layout as default"
 msgstr ""
 
-#: src/menus.C:1477
+#: src/menus.C:1155
 msgid "LM|Cc#c#C"
 msgstr ""
 
-#: src/menus.C:1478
+#: src/menus.C:1156
 msgid "LM|Pp#p#P"
 msgstr ""
 
-#: src/menus.C:1479
+#: src/menus.C:1157
 msgid "LM|Dd#d#D"
 msgstr ""
 
-#: src/menus.C:1480
+#: src/menus.C:1158
 msgid "LM|aA#a#A"
 msgstr ""
 
-#: src/menus.C:1481
+#: src/menus.C:1159
 msgid "LM|eE#e#E"
 msgstr ""
 
-#: src/menus.C:1482
+#: src/menus.C:1160
 msgid "LM|Qq#q#Q"
 msgstr ""
 
-#: src/menus.C:1483
+#: src/menus.C:1161
 msgid "LM|mM#m#M"
 msgstr ""
 
-#: src/menus.C:1484
+#: src/menus.C:1162
 msgid "LM|Nn#n#N"
 msgstr ""
 
-#: src/menus.C:1485
+#: src/menus.C:1163
 msgid "LM|Bb#b#B"
 msgstr ""
 
-#: src/menus.C:1486
+#: src/menus.C:1164
 msgid "LM|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:1487
+#: src/menus.C:1165
 msgid "LM|vV#v#V"
 msgstr ""
 
-#: src/menus.C:1488
+#: src/menus.C:1166
 msgid "LM|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1489
+#: src/menus.C:1167
 msgid "LM|Ss#s#S"
 msgstr ""
 
-#: src/menus.C:1563
+#: src/menus.C:1232
 msgid "Import ASCII file%t|As Lines%x41|As Paragraphs%x42"
 msgstr ""
 
-#: src/menus.C:1567
+#: src/menus.C:1236
 msgid "IMA|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1568
+#: src/menus.C:1237
 msgid "IMA|Pp#p#P"
 msgstr ""
 
-#: src/menus.C:1571
+#: src/menus.C:1240
 msgid ""
 "Lists & TOC%t|Table of Contents%x21|List of Figures%x22|List of "
 "Tables%x23|List of Algorithms%x24|Index List%x25|BibTeX Reference%x26"
 msgstr ""
 
-#: src/menus.C:1579
+#: src/menus.C:1248
 msgid "IMT|Cc#c#C"
 msgstr ""
 
-#: src/menus.C:1580
+#: src/menus.C:1249
 msgid "IMT|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:1581
+#: src/menus.C:1250
 msgid "IMT|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:1582
+#: src/menus.C:1251
 msgid "IMT|Aa#a#A"
 msgstr ""
 
-#: src/menus.C:1583
+#: src/menus.C:1252
 msgid "IMT|Ii#i#I"
 msgstr ""
 
-#: src/menus.C:1584
+#: src/menus.C:1253
 msgid "IMT|Bb#b#B"
 msgstr ""
 
-#: src/menus.C:1587
+#: src/menus.C:1256
 msgid ""
 "Floats%t|Figure Float%x71|Table Float%x72|Wide Figure Float%x73|Wide Table "
 "Float%l%x74|Algorithm Float%x75"
 msgstr ""
 
-#: src/menus.C:1594
+#: src/menus.C:1263
 msgid "IMF|gG#g#G"
 msgstr ""
 
-#: src/menus.C:1595
+#: src/menus.C:1264
 msgid "IMF|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:1596
+#: src/menus.C:1265
 msgid "IMF|Ww#w#W"
 msgstr ""
 
-#: src/menus.C:1597
+#: src/menus.C:1266
 msgid "IMF|iI#i#I"
 msgstr ""
 
-#: src/menus.C:1598
+#: src/menus.C:1267
 msgid "IMF|Aa#a#A"
 msgstr ""
 
-#: src/menus.C:1601
+#: src/menus.C:1270
 msgid ""
 "Special Character%t|HFill%x31|Hyphenation Point%x32|Protected "
 "Blank%x33|Linebreak%x34|Ellipsis (...)%x35|End of sentence "
 "period%x36|Ordinary Quote (\")%x37|Menu Separator %x38"
 msgstr ""
 
-#: src/menus.C:1611
+#: src/menus.C:1280
 msgid "IMS|Hh#h#H"
 msgstr ""
 
-#: src/menus.C:1612
+#: src/menus.C:1281
 msgid "IMS|Pp#p#P"
 msgstr ""
 
-#: src/menus.C:1613
+#: src/menus.C:1282
 msgid "IMS|Bb#b#B"
 msgstr ""
 
-#: src/menus.C:1614
+#: src/menus.C:1283
 msgid "IMS|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1615
+#: src/menus.C:1284
 msgid "IMS|iI#i#I"
 msgstr ""
 
-#: src/menus.C:1616
+#: src/menus.C:1285
 msgid "IMS|Ee#e#E"
 msgstr ""
 
-#: src/menus.C:1617
+#: src/menus.C:1286
 msgid "IMS|Qq#q#Q"
 msgstr ""
 
-#: src/menus.C:1618
+#: src/menus.C:1287
 msgid "IMS|Mm#m#M"
 msgstr ""
 
-#: src/menus.C:1621
+#: src/menus.C:1290
 msgid ""
 "Figure...|Table...%l|Include File...|Import ASCII File%m|Insert LyX "
 "File...%l|Footnote|Margin Note|Floats%m%l|Lists & TOC%m%l|Special "
@@ -4183,213 +4181,213 @@ msgid ""
 "Reference...|Index entry...|Index entry of last word"
 msgstr ""
 
-#: src/menus.C:1642
+#: src/menus.C:1311
 msgid "IM|gG#g#G"
 msgstr ""
 
-#: src/menus.C:1643
+#: src/menus.C:1312
 msgid "IM|bB#b#B"
 msgstr ""
 
-#: src/menus.C:1644
+#: src/menus.C:1313
 msgid "IM|cC#c#C"
 msgstr ""
 
-#: src/menus.C:1645
+#: src/menus.C:1314
 msgid "IM|Aa#a#A"
 msgstr ""
 
-#: src/menus.C:1646
+#: src/menus.C:1315
 msgid "IM|Xx#x#X"
 msgstr ""
 
-#: src/menus.C:1647
+#: src/menus.C:1316
 msgid "IM|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:1648
+#: src/menus.C:1317
 msgid "IM|Mm#m#M"
 msgstr ""
 
-#: src/menus.C:1649
+#: src/menus.C:1318
 msgid "IM|oO#o#O"
 msgstr ""
 
-#: src/menus.C:1650
+#: src/menus.C:1319
 msgid "IM|Tt#t#T"
 msgstr ""
 
-#: src/menus.C:1651
+#: src/menus.C:1320
 msgid "IM|Ss#s#S"
 msgstr ""
 
-#: src/menus.C:1652
+#: src/menus.C:1321
 msgid "IM|Nn#n#N"
 msgstr ""
 
-#: src/menus.C:1653
+#: src/menus.C:1322
 msgid "IM|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1654
+#: src/menus.C:1323
 msgid "IM|rR#r#R"
 msgstr ""
 
-#: src/menus.C:1655
+#: src/menus.C:1324
 msgid "IM|iI#i#I"
 msgstr ""
 
-#: src/menus.C:1656
+#: src/menus.C:1325
 msgid "IM|dD#d#D"
 msgstr ""
 
-#: src/menus.C:1657
+#: src/menus.C:1326
 msgid "IM|wW#w#W"
 msgstr ""
 
-#: src/menus.C:1659
+#: src/menus.C:1328
 msgid "|URL..."
 msgstr ""
 
-#: src/menus.C:1660
+#: src/menus.C:1329
 msgid "IM|Uu#u#U"
 msgstr ""
 
-#: src/menus.C:1766
+#: src/menus.C:1435
 msgid ""
 "Fraction|Square root|Exponent|Index|Sum|Integral%l|Math mode|Display%l|Math "
 "Panel..."
 msgstr ""
 
-#: src/menus.C:1776
+#: src/menus.C:1445
 msgid "MM|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:1777
+#: src/menus.C:1446
 msgid "MM|Ss#s#S"
 msgstr ""
 
-#: src/menus.C:1778
+#: src/menus.C:1447
 msgid "MM|Ee#e#E"
 msgstr ""
 
-#: src/menus.C:1779
+#: src/menus.C:1448
 msgid "MM|xX#x#X"
 msgstr ""
 
-#: src/menus.C:1780
+#: src/menus.C:1449
 msgid "MM|uU#u#U"
 msgstr ""
 
-#: src/menus.C:1781
+#: src/menus.C:1450
 msgid "MM|Ii#i#I"
 msgstr ""
 
-#: src/menus.C:1782
+#: src/menus.C:1451
 msgid "MM|Mm#m#M"
 msgstr ""
 
-#: src/menus.C:1783
+#: src/menus.C:1452
 msgid "MM|Dd#d#D"
 msgstr ""
 
-#: src/menus.C:1784
+#: src/menus.C:1453
 msgid "MM|Pp#p#P"
 msgstr ""
 
-#: src/menus.C:1850
+#: src/menus.C:1519
 msgid ""
 "Screen Fonts...|Spellchecker Options...|Keyboard...|LaTeX...%l|Reconfigure"
 msgstr ""
 
-#: src/menus.C:1856
+#: src/menus.C:1525
 msgid "OM|Ff#f#F"
 msgstr ""
 
-#: src/menus.C:1857
+#: src/menus.C:1526
 msgid "OM|Ss#s#S"
 msgstr ""
 
-#: src/menus.C:1858
+#: src/menus.C:1527
 msgid "OM|Kk#k#K"
 msgstr ""
 
-#: src/menus.C:1859
+#: src/menus.C:1528
 msgid "OM|Ll#l#L"
 msgstr ""
 
-#: src/menus.C:1860
+#: src/menus.C:1529
 msgid "OM|Rr#r#R"
 msgstr ""
 
-#: src/menus.C:1929
+#: src/menus.C:1598
 msgid ""
 "Introduction|Tutorial|User's Guide|Extended Features|Customization|Reference "
 "Manual|Known Bugs|LaTeX Configuration%l|Copyright and "
 "Warranty...|Credits...|Version..."
 msgstr ""
 
-#: src/menus.C:1941
+#: src/menus.C:1610
 msgid "HM|Ii#I#i"
 msgstr ""
 
-#: src/menus.C:1942
+#: src/menus.C:1611
 msgid "HM|Tt#T#t"
 msgstr ""
 
-#: src/menus.C:1943
+#: src/menus.C:1612
 msgid "HM|Uu#U#u"
 msgstr ""
 
-#: src/menus.C:1944
+#: src/menus.C:1613
 msgid "HM|xX#x#X"
 msgstr ""
 
-#: src/menus.C:1945
+#: src/menus.C:1614
 msgid "HM|Cc#C#c"
 msgstr ""
 
-#: src/menus.C:1946
+#: src/menus.C:1615
 msgid "HM|Rr#R#r"
 msgstr ""
 
-#: src/menus.C:1947
+#: src/menus.C:1616
 msgid "HM|Kk#K#k"
 msgstr ""
 
-#: src/menus.C:1948
+#: src/menus.C:1617
 msgid "HM|Ll#L#l"
 msgstr ""
 
-#: src/menus.C:1949
+#: src/menus.C:1618
 msgid "HM|oO#o#O"
 msgstr ""
 
-#: src/menus.C:1950
+#: src/menus.C:1619
 msgid "HM|eE#e#E"
 msgstr ""
 
-#: src/menus.C:1951
+#: src/menus.C:1620
 msgid "HM|Vv#v#V"
 msgstr ""
 
-#: src/menus.C:1974
+#: src/menus.C:1643
 msgid "LyX Version "
 msgstr ""
 
-#: src/menus.C:1975
+#: src/menus.C:1644
 msgid " of "
 msgstr ""
 
-#: src/menus.C:1976
+#: src/menus.C:1645
 msgid "Library directory: "
 msgstr ""
 
-#: src/menus.C:1978
+#: src/menus.C:1647
 msgid "User directory: "
 msgstr ""
 
-#: src/menus.C:1990
+#: src/menus.C:1659
 msgid "Opening help file"
 msgstr ""
 
@@ -4418,8 +4416,8 @@ msgstr ""
 msgid "Paper layout set"
 msgstr ""
 
-#: src/PaperLayout.C:269 src/ParagraphExtra.C:309 src/TableLayout.C:500
-#: src/TableLayout.C:686
+#: src/PaperLayout.C:269 src/ParagraphExtra.C:297 src/TableLayout.C:298
+#: src/TableLayout.C:470
 msgid "Warning: Invalid Length (valid example: 10mm)"
 msgstr ""
 
@@ -4427,19 +4425,19 @@ msgstr ""
 msgid "Senseless with this layout!"
 msgstr ""
 
-#: src/ParagraphExtra.C:147
+#: src/ParagraphExtra.C:143
 msgid "Document is read-only. No changes to layout permitted."
 msgstr ""
 
-#: src/ParagraphExtra.C:166
+#: src/ParagraphExtra.C:162
 msgid "ParagraphExtra Layout"
 msgstr ""
 
-#: src/ParagraphExtra.C:213
+#: src/ParagraphExtra.C:201
 msgid "ParagraphExtra layout set"
 msgstr ""
 
-#: src/ParagraphExtra.C:319
+#: src/ParagraphExtra.C:307
 msgid "Warning: Invalid percent value (0-100)"
 msgstr ""
 
@@ -4697,19 +4695,19 @@ msgstr ""
 msgid "Error: Dir already popped: "
 msgstr ""
 
-#: src/TableLayout.C:416
+#: src/TableLayout.C:234
 msgid "Table Extra Form"
 msgstr ""
 
-#: src/TableLayout.C:436
+#: src/TableLayout.C:254
 msgid "Table Layout"
 msgstr ""
 
-#: src/TableLayout.C:460 src/TableLayout.C:479
+#: src/TableLayout.C:277
 msgid "Warning: Wrong Cursor position, updated window"
 msgstr ""
 
-#: src/TableLayout.C:535
+#: src/TableLayout.C:333
 msgid "Confirm: press Delete-Button again"
 msgstr ""
 
index 5c913c7c7fb70473072b9231188a9c19ca51c4a3..02da89151f695de55fb727428ff8d2491d1d5c10 100644 (file)
@@ -65,9 +65,7 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos,
        : owner_(o)
 {
        buffer_ = 0;
-#ifdef MOVE_TEXT
        text = 0;
-#endif
        screen = 0;
        work_area = 0;
        figinset_canvas = 0;
@@ -87,9 +85,7 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos,
 
 BufferView::~BufferView()
 {
-#ifdef MOVE_TEXT
        delete text;
-#endif
 }
 
 
@@ -99,10 +95,8 @@ void BufferView::buffer(Buffer * b)
        if (buffer_) {
                buffer_->InsetSleep();
                buffer_->delUser(this);
-#ifdef MOVE_TEXT
                delete text;
                text = 0;
-#endif
        }
 
        // Set current buffer
@@ -111,6 +105,7 @@ void BufferView::buffer(Buffer * b)
        if (bufferlist.getState() == BufferList::CLOSING) return;
        
        // Nuke old image
+       // screen is always deleted when the buffer is changed.
        if (screen)
                delete screen;
        screen = 0;
@@ -125,21 +120,12 @@ void BufferView::buffer(Buffer * b)
                buffer_->addUser(this);
                owner_->getMenus()->showMenus();
                // If we don't have a text object for this, we make one
-#ifdef MOVE_TEXT
                if (text == 0)
                        resizeCurrentBuffer();
                else {
                        updateScreen();
                        updateScrollbar();
                }
-#else
-               if (buffer_->text == 0)
-                       resizeCurrentBuffer();
-               else {
-                       updateScreen();
-                       updateScrollbar();
-               }
-#endif
                screen->first = screen->TopCursorVisible();
                redraw();
                updateAllVisibleBufferRelatedPopups();
@@ -162,21 +148,12 @@ void BufferView::updateScreen()
        // Regenerate the screen.
        if (screen)
                delete screen;
-#ifdef MOVE_TEXT
        screen = new LyXScreen(FL_ObjWin(work_area),
                               work_area->w,
                               work_area->h,
                               work_area->x,
                               work_area->y,
                               text);
-#else
-       screen = new LyXScreen(FL_ObjWin(work_area),
-                              work_area->w,
-                              work_area->h,
-                              work_area->x,
-                              work_area->y,
-                              buffer_->text);
-#endif
 }
 
 
@@ -232,13 +209,8 @@ void BufferView::updateScrollbar()
        long cbth = 0;
        long cbsf = 0;
 
-#ifdef MOVE_TEXT
        if (text)
                cbth = text->height;
-#else
-       if (buffer_->text)
-               cbth = buffer_->text->height;
-#endif
        if (screen)
                cbsf = screen->first;
 
@@ -257,7 +229,7 @@ void BufferView::updateScrollbar()
                return;
        }
        
-       long maximum_height = work_area->h * 3/4 + cbth;
+       long maximum_height = work_area->h * 3 / 4 + cbth;
        long value = cbsf;
 
        // set the scrollbar
@@ -268,11 +240,7 @@ void BufferView::updateScrollbar()
        fl_set_slider_bounds(scrollbar, 0,
                             maximum_height - work_area->h);
 #if FL_REVISION > 85
-#ifdef MOVE_TEXT
        double lineh = text->DefaultHeight();
-#else
-       double lineh = buffer_->text->DefaultHeight();
-#endif
        fl_set_slider_increment(scrollbar, work_area->h-lineh, lineh);
 #endif
        if (maxfloat > 0){
@@ -291,17 +259,10 @@ void BufferView::updateScrollbar()
 void BufferView::redoCurrentBuffer()
 {
        lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
-#ifdef MOVE_TEXT
        if (buffer_ && text) {
                resize();
                owner_->updateLayoutChoice();
        }
-#else
-       if (buffer_ && buffer_->text) {
-               resize();
-               owner_->updateLayoutChoice();
-       }
-#endif
 }
 
 
@@ -322,7 +283,6 @@ int BufferView::resizeCurrentBuffer()
 
        owner_->getMiniBuffer()->Set(_("Formatting document..."));   
 
-#ifdef MOVE_TEXT
        if (text) {
                par = text->cursor.par;
                pos = text->cursor.pos;
@@ -335,31 +295,13 @@ int BufferView::resizeCurrentBuffer()
                delete text;
        }
        text = new LyXText(work_area->w, buffer_);
-#else
-       if (buffer_->text) {
-               par = buffer_->text->cursor.par;
-               pos = buffer_->text->cursor.pos;
-               selstartpar = buffer_->text->sel_start_cursor.par;
-               selstartpos = buffer_->text->sel_start_cursor.pos;
-               selendpar = buffer_->text->sel_end_cursor.par;
-               selendpos = buffer_->text->sel_end_cursor.pos;
-               selection = buffer_->text->selection;
-               mark_set = buffer_->text->mark_set;
-               delete buffer_->text;
-       }
-       buffer_->text = new LyXText(work_area->w, buffer_);
-#endif
 
        updateScreen();
 
-#ifdef MOVE_TEXT
        if (par) {
                text->selection = true;
-               /* at this point just
-                * to avoid the Delete-
-                * Empty-Paragraph
-                * Mechanism when
-                * setting the cursor */
+               /* at this point just to avoid the Delete-Empty-Paragraph
+                * Mechanism when setting the cursor */
                text->mark_set = mark_set;
                if (selection) {
                        text->SetCursor(selstartpar, selstartpos);
@@ -368,33 +310,11 @@ int BufferView::resizeCurrentBuffer()
                        text->SetSelection();
                        text->SetCursor(par, pos);
                } else {
-                      text->SetCursor(par, pos);
+                       text->SetCursor(par, pos);
                        text->sel_cursor = text->cursor;
                        text->selection = false;
                }
        }
-#else
-       if (par) {
-               buffer_->text->selection = true;
-               /* at this point just
-                * to avoid the Delete-
-                * Empty-Paragraph
-                * Mechanism when
-                * setting the cursor */
-               buffer_->text->mark_set = mark_set;
-               if (selection) {
-                       buffer_->text->SetCursor(selstartpar, selstartpos);
-                       buffer_->text->sel_cursor = buffer_->text->cursor;
-                       buffer_->text->SetCursor(selendpar, selendpos);
-                       buffer_->text->SetSelection();
-                       buffer_->text->SetCursor(par, pos);
-               } else {
-                       buffer_->text->SetCursor(par, pos);
-                       buffer_->text->sel_cursor = buffer_->text->cursor;
-                       buffer_->text->selection = false;
-               }
-       }
-#endif
        screen->first = screen->TopCursorVisible(); /* this will scroll the
                                                     * screen such that the
                                                     * cursor becomes
@@ -418,14 +338,9 @@ void BufferView::gotoError()
    
        screen->HideCursor();
        BeforeChange();
-#ifdef MOVE_TEXT
        update(-2);
-#else
-       buffer_->update(-2);
-#endif
        LyXCursor tmp;
 
-#ifdef MOVE_TEXT
        if (!text->GotoNextError()) {
                if (text->cursor.pos 
                    || text->cursor.par != text->FirstParagraph()) {
@@ -434,7 +349,8 @@ void BufferView::gotoError()
                        text->cursor.pos = 0;
                        if (!text->GotoNextError()) {
                                text->cursor = tmp;
-                               owner_->getMiniBuffer()->Set(_("No more errors"));
+                               owner_->getMiniBuffer()
+                                       ->Set(_("No more errors"));
                                LyXBell();
                        }
                } else {
@@ -444,29 +360,6 @@ void BufferView::gotoError()
        }
        update(0);
        text->sel_cursor = text->cursor;
-#else
-       if (!buffer_->text->GotoNextError()) {
-               if (buffer_->text->cursor.pos 
-                   || buffer_->text->cursor.par != 
-                   buffer_->text->FirstParagraph()) {
-                       tmp = buffer_->text->cursor;
-                       buffer_->text->cursor.par = 
-                               buffer_->text->FirstParagraph();
-                       buffer_->text->cursor.pos = 0;
-                       if (!buffer_->text->GotoNextError()) {
-                               buffer_->text->cursor = tmp;
-                               owner_->getMiniBuffer()->Set(_("No more errors"));
-                               LyXBell();
-                       }
-               } else {
-                       owner_->getMiniBuffer()->Set(_("No more errors"));
-                       LyXBell();
-               }
-       }
-       buffer_->update(0);
-       buffer_->text->sel_cursor = 
-               buffer_->text->cursor;
-#endif
 }
 
 
@@ -514,9 +407,9 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
        // a hack for the figinsets (Matthias)
        // This one first, then it will probably be invisible. (Lgb)
        ::figinset_canvas = figinset_canvas = obj = 
-               fl_add_canvas(FL_NORMAL_CANVAS,
-                             xpos + 1,
-                             ypos + 1, 1, 1, "");
+                 fl_add_canvas(FL_NORMAL_CANVAS,
+                               xpos + 1,
+                               ypos + 1, 1, 1, "");
        fl_set_object_boxtype(obj, FL_NO_BOX);
        fl_set_object_resize(obj, FL_RESIZE_ALL);
        fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
@@ -536,7 +429,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
                                      C_BufferView_work_area_handler);
        obj->wantkey = FL_KEY_TAB;
        obj->u_vdata = this; /* This is how we pass the BufferView
-                                      to the work_area_handler. */
+                               to the work_area_handler. */
        fl_set_object_boxtype(obj, FL_DOWN_BOX);
        fl_set_object_resize(obj, FL_RESIZE_ALL);
        fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
@@ -661,7 +554,8 @@ void waitForX()
        }
        static XEvent ev;
        XChangeProperty(fl_display, w, a, a, 8,
-                       PropModeAppend, reinterpret_cast<unsigned char*>(""), 0);
+                       PropModeAppend,
+                       reinterpret_cast<unsigned char*>(""), 0);
        XWindowEvent(fl_display, w, PropertyChangeMask, &ev);
 #endif
        XSync(fl_get_display(), 0);
@@ -686,11 +580,7 @@ void BufferView::ScrollCB(FL_OBJECT * ob, long)
        view->screen->Draw(view->current_scrollbar_value);
 
        if (cursor_follows_scrollbar) {
-#ifdef MOVE_TEXT
                LyXText * vbt = view->text;
-#else
-               LyXText * vbt = view->buffer_->text;
-#endif
                int height = vbt->DefaultHeight();
                
                if (vbt->cursor.y < view->screen->first + height) {
@@ -737,29 +627,18 @@ void BufferView::DownCB(FL_OBJECT * ob, long)
 int BufferView::ScrollUp(long time)
 {
        if (buffer_ == 0) return 0;
-       if (!screen)
-               return 0;
+       if (!screen) return 0;
    
-       double value= fl_get_slider_value(scrollbar);
+       double value = fl_get_slider_value(scrollbar);
    
-       if (value == 0)
-               return 0;
+       if (value == 0) return 0;
 
-#ifdef MOVE_TEXT
        float add_value =  (text->DefaultHeight()
                            + float(time) * float(time) * 0.125);
    
        if (add_value > work_area->h)
                add_value = float(work_area->h -
                                  text->DefaultHeight());
-#else
-       float add_value =  (buffer_->text->DefaultHeight()
-                           + float(time) * float(time) * 0.125);
-   
-       if (add_value > work_area->h)
-               add_value = float(work_area->h -
-                                 buffer_->text->DefaultHeight());
-#endif
    
        value -= add_value;
 
@@ -776,31 +655,20 @@ int BufferView::ScrollUp(long time)
 int BufferView::ScrollDown(long time)
 {
        if (buffer_ == 0) return 0;
-       if (!screen)
-               return 0;
+       if (!screen) return 0;
    
        double value= fl_get_slider_value(scrollbar);
        double min, max;
        fl_get_slider_bounds(scrollbar, &min, &max);
 
-       if (value == max)
-               return 0;
+       if (value == max) return 0;
 
-#ifdef MOVE_TEXT
        float add_value =  (text->DefaultHeight()
                            + float(time) * float(time) * 0.125);
    
        if (add_value > work_area->h)
                add_value = float(work_area->h -
                                  text->DefaultHeight());
-#else
-       float add_value =  (buffer_->text->DefaultHeight()
-                           + float(time) * float(time) * 0.125);
-   
-       if (add_value > work_area->h)
-               add_value = float(work_area->h -
-                                 buffer_->text->DefaultHeight());
-#endif
    
        value += add_value;
    
@@ -817,17 +685,14 @@ int BufferView::ScrollDown(long time)
 void BufferView::ScrollUpOnePage(long /*time*/)
 {
        if (buffer_ == 0) return;
-       if (!screen)
-               return;
+       if (!screen) return;
    
        long y = screen->first;
 
        if (!y) return;
-#ifdef MOVE_TEXT
+
        Row * row = text->GetRowNearY(y);
-#else
-       Row * row = buffer_->text->GetRowNearY(y);
-#endif
+
        y = y - work_area->h + row->height;
        
        fl_set_slider_value(scrollbar, y);
@@ -839,26 +704,18 @@ void BufferView::ScrollUpOnePage(long /*time*/)
 void BufferView::ScrollDownOnePage(long /*time*/)
 {
        if (buffer_ == 0) return;
-       if (!screen)
-               return;
+       if (!screen) return;
    
        double min, max;
        fl_get_slider_bounds(scrollbar, &min, &max);
        long y = screen->first;
 
-#ifdef MOVE_TEXT
        if (y > text->height - work_area->h)
                return;
    
        y += work_area->h;
        text->GetRowNearY(y);
-#else
-       if (y > buffer_->text->height - work_area->h)
-               return;
-   
-       y += work_area->h;
-       buffer_->text->GetRowNearY(y);
-#endif
+
        fl_set_slider_value(scrollbar, y);
    
        ScrollCB(scrollbar, 0); 
@@ -867,7 +724,7 @@ void BufferView::ScrollDownOnePage(long /*time*/)
 
 int BufferView::work_area_handler(FL_OBJECT * ob, int event,
                                  FL_Coord, FL_Coord ,
-                                 int /*key*/, void *xev)
+                                 int /*key*/, void * xev)
 {
        static int x_old = -1;
        static int y_old = -1;
@@ -899,8 +756,9 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
                        view->WorkAreaMotionNotify(ob, 0, 0, 0, ev, 0);
                }
                break;
-       // Done by the raw callback:
-       //  case FL_KEYBOARD: WorkAreaKeyPress(ob, 0, 0, 0, ev, 0); break;
+               // Done by the raw callback:
+               //  case FL_KEYBOARD:
+               //  WorkAreaKeyPress(ob, 0, 0, 0, ev, 0); break;
        case FL_FOCUS:
                if (!view->owner_->getMiniBuffer()->shows_no_match)
                        view->owner_->getMiniBuffer()->Init();
@@ -934,19 +792,11 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
                        if (view->screen && ev->xbutton.button == 1) {
                                view->screen->HideCursor();
                                view->screen->ToggleSelection();
-#ifdef MOVE_TEXT
                                view->text->SelectWord();
-#else
-                               view->buffer_->text->SelectWord();
-#endif
                                view->screen->ToggleSelection(false);
                                /* This will fit the cursor on the screen
                                 * if necessary */
-#ifdef MOVE_TEXT
                                view->update(0);
-#else
-                               view->buffer_->update(0);
-#endif
                        }
                }
                break;
@@ -955,26 +805,14 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
                if (view->buffer_ && view->screen && ev->xbutton.button == 1) {
                        view->screen->HideCursor(); 
                        view->screen->ToggleSelection();
-#ifdef MOVE_TEXT
                        view->text->CursorHome();
                        view->text->sel_cursor = view->text->cursor;
                        view->text->CursorEnd();
                        view->text->SetSelection();
-#else
-                       view->buffer_->text->CursorHome();
-                       view->buffer_->text->sel_cursor = 
-                               view->buffer_->text->cursor;
-                       view->buffer_->text->CursorEnd();
-                       view->buffer_->text->SetSelection();
-#endif
                        view->screen->ToggleSelection(false); 
                        /* This will fit the cursor on the screen
                         * if necessary */
-#ifdef MOVE_TEXT
                        view->update(0);
-#else
-                       view->buffer_->update(0);
-#endif
                }
                break;
        case FL_OTHER:
@@ -988,7 +826,7 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
 
 int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
                                     int /*w*/, int /*h*/,
-                                    XEvent *ev, void */*d*/)
+                                    XEvent * ev, void */*d*/)
 {
 
        if (buffer_ == 0) return 0;
@@ -996,11 +834,7 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
 
        // Check for inset locking
        if (buffer_->the_locking_inset) {
-#ifdef MOVE_TEXT
                LyXCursor cursor = text->cursor;
-#else
-               LyXCursor cursor = buffer_->text->cursor;
-#endif
                buffer_->the_locking_inset->
                        InsetMotionNotify(ev->xbutton.x - ob->x - cursor.x,
                                          ev->xbutton.y - ob->y -
@@ -1018,7 +852,6 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
        if (selection_possible) {
                screen->HideCursor();
 
-#ifdef MOVE_TEXT
                text->SetCursorFromCoordinates(ev->xbutton.x - ob->x,
                                               ev->xbutton.y - ob->y +
                                               screen->first);
@@ -1027,17 +860,6 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
                        update(-3); // Maybe an empty line was deleted
       
                text->SetSelection();
-#else
-               buffer_->text->
-                       SetCursorFromCoordinates(ev->xbutton.x - ob->x,
-                                                ev->xbutton.y - ob->y +
-                                                screen->first);
-      
-               if (!buffer_->text->selection)
-                   buffer_->update(-3); // Maybe an empty line was deleted
-      
-               buffer_->text->SetSelection();
-#endif
                screen->ToggleToggle();
                if (screen->FitCursor())
                        updateScrollbar(); 
@@ -1049,10 +871,10 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
 
 extern int bibitemMaxWidth(LyXFont const &);
 
-#ifdef MOVE_TEXT
 // Single-click on work area
-int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
-                       int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
+int BufferView::WorkAreaButtonPress(FL_OBJECT * ob, Window,
+                                   int /*w*/, int /*h*/,
+                                   XEvent * ev, void */*d*/)
 {
        last_click_x = -1;
        last_click_y = -1;
@@ -1075,307 +897,151 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
 
        {
                
-       if (buffer_->the_locking_inset) {
-               // We are in inset locking mode
+               if (buffer_->the_locking_inset) {
+                       // We are in inset locking mode
                
-               /* Check whether the inset was hit. If not reset mode,
-                  otherwise give the event to the inset */
-               if (inset_hit != 0) {
-                       buffer_->the_locking_inset->
-                               InsetButtonPress(inset_x, inset_y, button);
-                       return 0;
-               } else {
-                       UnlockInset(buffer_->the_locking_inset);
+                       /* Check whether the inset was hit. If not reset mode,
+                          otherwise give the event to the inset */
+                       if (inset_hit != 0) {
+                               buffer_->the_locking_inset->
+                                       InsetButtonPress(inset_x, inset_y,
+                                                        button);
+                               return 0;
+                       } else {
+                               UnlockInset(buffer_->the_locking_inset);
+                       }
                }
-       }
        
-       selection_possible = true;
-       screen->HideCursor();
+               selection_possible = true;
+               screen->HideCursor();
        
-       // Right button mouse click on a table
-       if (button == 3 &&
-           (text->cursor.par->table ||
-            text->MouseHitInTable(x, y + screen->first))) {
-               // Set the cursor to the press-position
-               text->SetCursorFromCoordinates(x, y + screen->first);
-               bool doit = true;
+               // Right button mouse click on a table
+               if (button == 3 &&
+                   (text->cursor.par->table ||
+                    text->MouseHitInTable(x, y + screen->first))) {
+                       // Set the cursor to the press-position
+                       text->SetCursorFromCoordinates(x, y + screen->first);
+                       bool doit = true;
                
-               // Only show the table popup if the hit is in the table, too
-               if (!text->HitInTable(text->cursor.row, x))
-                       doit = false;
+                       // Only show the table popup if the hit is in
+                       // the table, too
+                       if (!text->HitInTable(text->cursor.row, x))
+                               doit = false;
                
-               // Hit above or below the table?
-               if (doit) {
-                       if (!text->selection) {
-                               screen->ToggleSelection();
-                               text->ClearSelection();
-                               text->FullRebreak();
-                               screen->Update();
-                               updateScrollbar();
+                       // Hit above or below the table?
+                       if (doit) {
+                               if (!text->selection) {
+                                       screen->ToggleSelection();
+                                       text->ClearSelection();
+                                       text->FullRebreak();
+                                       screen->Update();
+                                       updateScrollbar();
+                               }
+                               // Popup table popup when on a table.
+                               // This is obviously temporary, since we
+                               // should be able to popup various
+                               // context-sensitive-menus with the
+                               // the right mouse. So this should be done more
+                               // general in the future. Matthias.
+                               selection_possible = false;
+                               owner_->getLyXFunc()
+                                       ->Dispatch(LFUN_LAYOUT_TABLE,
+                                                  "true");
+                               return 0;
                        }
-                       // Popup table popup when on a table.
-                       // This is obviously temporary, since we should be
-                       // able to 
-                       // popup various context-sensitive-menus with the
-                       // the right mouse. So this should be done more
-                       // general in the future. Matthias.
-                       selection_possible = false;
-                       owner_->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
-                                                      "true");
-                       return 0;
                }
-       }
-       
-       int screen_first = screen->first;
        
-       // Middle button press pastes if we have a selection
-       bool paste_internally = false;
-       if (button == 2  // && !buffer_->the_locking_inset
-           && text->selection) {
-               owner_->getLyXFunc()->Dispatch(LFUN_COPY);
-               paste_internally = true;
-       }
-       
-       // Clear the selection
-       screen->ToggleSelection();
-       text->ClearSelection();
-       text->FullRebreak();
-       screen->Update();
-       updateScrollbar();
-               
-       // Single left click in math inset?
-       if (inset_hit != 0 && inset_hit->Editable() == 2) {
-               // Highly editable inset, like math
-               selection_possible = false;
-               owner_->updateLayoutChoice();
-               owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
-               inset_hit->Edit(inset_x, inset_y);
-               return 0;
-       } 
-
-       // Right click on a footnote flag opens float menu
-       if (button == 3) { 
-               selection_possible = false;
-               return 0;
-       }
+               int screen_first = screen->first;
        
-       text->SetCursorFromCoordinates(x, y + screen_first);
-       text->FinishUndo();
-       text->sel_cursor = text->cursor;
-       text->cursor.x_fix = text->cursor.x;
+               // Middle button press pastes if we have a selection
+               bool paste_internally = false;
+               if (button == 2  // && !buffer_->the_locking_inset
+                   && text->selection) {
+                       owner_->getLyXFunc()->Dispatch(LFUN_COPY);
+                       paste_internally = true;
+               }
        
-       owner_->updateLayoutChoice();
-       if (screen->FitCursor()){
+               // Clear the selection
+               screen->ToggleSelection();
+               text->ClearSelection();
+               text->FullRebreak();
+               screen->Update();
                updateScrollbar();
-               selection_possible = false;
-       }
-
-       // Insert primary selection with middle mouse
-       // if there is a local selection in the current buffer, insert this
-       if (button == 2) { //  && !buffer_->the_locking_inset){
-               if (paste_internally)
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
-               else
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
-                                                      "paragraph");
-               selection_possible = false;
-               return 0;
-       }
-       }
-       goto out;
- wheel: {
-       // I am not quite sure if this is the correct place to put this,
-       // but it will not cause any harm.
-       // Patch from Mark Huang (markman@mit.edu) to make LyX recognise
-       // button 4 and 5. This enables LyX use use the scrollwhell on
-       // certain mice for something useful. (Lgb)
-       // Added wheel acceleration detection code. (Rvdk)
-       static Time lastTime = 0;
-       int diff = ev->xbutton.time - lastTime;
-       int scroll = int(1.0 + (4.0/(abs(diff)+1.0))*200.0);
-       switch (button) {
-       case 4:
-               ScrollUp(scroll);
-               break;
-       case 5:
-               ScrollDown(scroll);
-               break;
-       }
-       lastTime = ev->xbutton.time;
-       return 0;
-       }
- out:
-       last_click_x = x;
-       last_click_y = y;
-       
-       return 0;
-}
-#else
-// Single-click on work area
-int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
-                       int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
-{
-       last_click_x = -1;
-       last_click_y = -1;
-
-       if (buffer_ == 0) return 0;
-       if (!screen) return 0;
-
-       int const x = ev->xbutton.x - ob->x;
-       int const y = ev->xbutton.y - ob->y;
-       // If we hit an inset, we have the inset coordinates in these
-       // and inset_hit points to the inset.  If we do not hit an
-       // inset, inset_hit is 0, and inset_x == x, inset_y == y.
-       int inset_x = x;
-       int inset_y = y;
-       Inset * inset_hit = checkInsetHit(inset_x, inset_y);
-
-       // ok ok, this is a hack.
-       int button = ev->xbutton.button;
-       if (button == 4 || button == 5) goto wheel;
-
-       {
                
-       if (buffer_->the_locking_inset) {
-               // We are in inset locking mode
-               
-               /* Check whether the inset was hit. If not reset mode,
-                  otherwise give the event to the inset */
-               if (inset_hit != 0) {
-                       buffer_->the_locking_inset->
-                               InsetButtonPress(inset_x, inset_y, button);
+               // Single left click in math inset?
+               if (inset_hit != 0 && inset_hit->Editable() == 2) {
+                       // Highly editable inset, like math
+                       selection_possible = false;
+                       owner_->updateLayoutChoice();
+                       owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
+                       inset_hit->Edit(inset_x, inset_y);
                        return 0;
-               } else {
-                       UnlockInset(buffer_->the_locking_inset);
-               }
-       }
-       
-       selection_possible = true;
-       screen->HideCursor();
-       
-       // Right button mouse click on a table
-       if (button == 3 &&
-           (buffer_->text->cursor.par->table ||
-            buffer_->text->MouseHitInTable(x, y+screen->first))) {
-               // Set the cursor to the press-position
-               buffer_->text->SetCursorFromCoordinates(x, y + screen->first);
-               bool doit = true;
-               
-               // Only show the table popup if the hit is in the table, too
-               if (!buffer_->text->HitInTable(buffer_->text->cursor.row, x))
-                       doit = false;
-               
-               // Hit above or below the table?
-               if (doit) {
-                       if (!buffer_->text->selection) {
-                               screen->ToggleSelection();
-                               buffer_->text->ClearSelection();
-                               buffer_->text->FullRebreak();
-                               screen->Update();
-                               updateScrollbar();
-                       }
-                       // Popup table popup when on a table.
-                       // This is obviously temporary, since we should be
-                       // able to 
-                       // popup various context-sensitive-menus with the
-                       // the right mouse. So this should be done more
-                       // general in the future. Matthias.
+               } 
+
+               // Right click on a footnote flag opens float menu
+               if (button == 3) { 
                        selection_possible = false;
-                       owner_->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
-                                                      "true");
                        return 0;
                }
-       }
        
-       int screen_first = screen->first;
-       
-       // Middle button press pastes if we have a selection
-       bool paste_internally = false;
-       if (button == 2  // && !buffer_->the_locking_inset
-           && buffer_->text->selection) {
-               owner_->getLyXFunc()->Dispatch(LFUN_COPY);
-               paste_internally = true;
-       }
+               text->SetCursorFromCoordinates(x, y + screen_first);
+               text->FinishUndo();
+               text->sel_cursor = text->cursor;
+               text->cursor.x_fix = text->cursor.x;
        
-       // Clear the selection
-       screen->ToggleSelection();
-       buffer_->text->ClearSelection();
-       buffer_->text->FullRebreak();
-       screen->Update();
-       updateScrollbar();
-               
-       // Single left click in math inset?
-       if (inset_hit != 0 && inset_hit->Editable() == 2) {
-               // Highly editable inset, like math
-               selection_possible = false;
                owner_->updateLayoutChoice();
-               owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
-               inset_hit->Edit(inset_x, inset_y);
-               return 0;
-       } 
-
-       // Right click on a footnote flag opens float menu
-       if (button == 3) { 
-               selection_possible = false;
-               return 0;
-       }
-       
-       buffer_->text->SetCursorFromCoordinates(x, y + screen_first);
-       buffer_->text->FinishUndo();
-       buffer_->text->sel_cursor = buffer_->text->cursor;
-       buffer_->text->cursor.x_fix = buffer_->text->cursor.x;
-       
-       owner_->updateLayoutChoice();
-       if (screen->FitCursor()){
-               updateScrollbar();
-               selection_possible = false;
-       }
+               if (screen->FitCursor()){
+                       updateScrollbar();
+                       selection_possible = false;
+               }
 
-       // Insert primary selection with middle mouse
-       // if there is a local selection in the current buffer, insert this
-       if (button == 2) { //  && !buffer_->the_locking_inset){
-               if (paste_internally)
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
-               else
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
-                                                      "paragraph");
-               selection_possible = false;
-               return 0;
-       }
+               // Insert primary selection with middle mouse
+               // if there is a local selection in the current buffer,
+               // insert this
+               if (button == 2) { //  && !buffer_->the_locking_inset){
+                       if (paste_internally)
+                               owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
+                       else
+                               owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
+                                                              "paragraph");
+                       selection_possible = false;
+                       return 0;
+               }
        }
        goto out;
- wheel: {
-       // I am not quite sure if this is the correct place to put this,
-       // but it will not cause any harm.
-       // Patch from Mark Huang (markman@mit.edu) to make LyX recognise
-       // button 4 and 5. This enables LyX use use the scrollwhell on
-       // certain mice for something useful. (Lgb)
-       // Added wheel acceleration detection code. (Rvdk)
-       static Time lastTime = 0;
-       int diff = ev->xbutton.time - lastTime;
-       int scroll = int(1.0 + (4.0/(abs(diff)+1.0))*200.0);
-       switch (button) {
-       case 4:
-               ScrollUp(scroll);
-               break;
-       case 5:
-               ScrollDown(scroll);
-               break;
-       }
-       lastTime = ev->xbutton.time;
-       return 0;
+  wheel:
+       {
+               // I am not quite sure if this is the correct place to put
+               // this, but it will not cause any harm.
+               // Patch from Mark Huang (markman@mit.edu) to make LyX
+               // recognise button 4 and 5. This enables LyX use use
+               // the scrollwhell on certain mice for something useful. (Lgb)
+               // Added wheel acceleration detection code. (Rvdk)
+               static Time lastTime = 0;
+               int diff = ev->xbutton.time - lastTime;
+               int scroll = int(1.0 + (4.0 / (abs(diff) + 1.0)) * 200.0);
+               switch (button) {
+               case 4:
+                       ScrollUp(scroll);
+                       break;
+               case 5:
+                       ScrollDown(scroll);
+                       break;
+               }
+               lastTime = ev->xbutton.time;
+               return 0;
        }
- out:
 out:
        last_click_x = x;
        last_click_y = y;
        
        return 0;
 }
-#endif
 
-#ifdef MOVE_TEXT
+
 int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window ,
-                         int /*w*/, int /*h*/, XEvent * ev, void * /*d*/)
+                                     int /*w*/, int /*h*/,
+                                     XEvent * ev, void * /*d*/)
 {
        if (buffer_ == 0 || screen == 0) return 0;
 
@@ -1511,7 +1177,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window ,
                    text->cursor.row->baseline
                    && y + screen_first < text->cursor.y -
                    text->cursor.row->baseline
-                   + font.maxAscent()*1.2 + font.maxDescent()*1.2) {
+                   + font.maxAscent() * 1.2 + font.maxDescent() * 1.2) {
                        ToggleFloat();
                        selection_possible = false;
                        return 0;
@@ -1520,175 +1186,21 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window ,
 
        // Maybe we want to edit a bibitem ale970302
        if (text->cursor.par->bibkey && x < 20 + 
-           bibitemMaxWidth(textclasslist.TextClass(buffer_->
-                                       params.textclass).defaultfont())) {
+           bibitemMaxWidth(textclasslist
+                           .TextClass(buffer_->
+                                      params.textclass).defaultfont())) {
                text->cursor.par->bibkey->Edit(0, 0);
        }
 
        return 0;
 }
-#else
-int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
-                         int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
-{
-       if (buffer_ == 0 || screen == 0) return 0;
 
-       int const x = ev->xbutton.x - ob->x;
-       int const y = ev->xbutton.y - ob->y;
-
-       // If we hit an inset, we have the inset coordinates in these
-       // and inset_hit points to the inset.  If we do not hit an
-       // inset, inset_hit is 0, and inset_x == x, inset_y == y.
-       int inset_x = x;
-       int inset_y = y;
-       Inset * inset_hit = checkInsetHit(inset_x, inset_y);
-
-       if (buffer_->the_locking_inset) {
-               // We are in inset locking mode.
-
-               /* LyX does a kind of work-area grabbing for insets.
-                  Only a ButtonPress Event outside the inset will 
-                  force a InsetUnlock. */
-               buffer_->the_locking_inset->
-                       InsetButtonRelease(inset_x, inset_y, 
-                                          ev->xbutton.button);
-               return 0;
-       }
-  
-       selection_possible = false;
-        if (buffer_->text->cursor.par->table) {
-                int cell = buffer_->text->
-                        NumberOfCell(buffer_->text->cursor.par,
-                                     buffer_->text->cursor.pos);
-                if (buffer_->text->cursor.par->table->IsContRow(cell) &&
-                    buffer_->text->cursor.par->table->
-                    CellHasContRow(buffer_->text->cursor.par->table->
-                                   GetCellAbove(cell))<0) {
-                        buffer_->text->CursorUp();
-                }
-        }
-       
-       if (ev->xbutton.button >= 2)
-               return 0;
-
-       // Make sure that the press was not far from the release
-       if ((abs(last_click_x - x) >= 5) ||
-           (abs(last_click_y - y) >= 5)) {
-               return 0;
-       }
-
-       // Did we hit an editable inset?
-       if (inset_hit != 0) {
-               // Inset like error, notes and figures
-               selection_possible = false;
-#ifdef WITH_WARNINGS
-#warning fix this proper in 0.13
-#endif
-               // Following a ref shouldn't issue
-               // a push on the undo-stack
-               // anylonger, now that we have
-               // keybindings for following
-               // references and returning from
-               // references.  IMHO though, it
-               // should be the inset's own business
-               // to push or not push on the undo
-               // stack. They don't *have* to
-               // alter the document...
-               // (Joacim)
-               // ...or maybe the SetCursorParUndo()
-               // below isn't necessary at all anylonger?
-               if (inset_hit->LyxCode() == Inset::REF_CODE) {
-                       buffer_->text->SetCursorParUndo();
-               }
-
-               owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
-               inset_hit->Edit(inset_x, inset_y);
-               return 0;
-       }
-
-       // check whether we want to open a float
-       if (buffer_->text) {
-               bool hit = false;
-               char c = ' ';
-               if (buffer_->text->cursor.pos <
-                   buffer_->text->cursor.par->Last()) {
-                       c = buffer_->text->cursor.par->
-                               GetChar(buffer_->text->cursor.pos);
-               }
-               if (c == LyXParagraph::META_FOOTNOTE
-                   || c == LyXParagraph::META_MARGIN
-                   || c == LyXParagraph::META_FIG
-                   || c == LyXParagraph::META_TAB
-                   || c == LyXParagraph::META_WIDE_FIG
-                   || c == LyXParagraph::META_WIDE_TAB
-                    || c == LyXParagraph::META_ALGORITHM){
-                       hit = true;
-               } else if (buffer_->text->cursor.pos - 1 >= 0) {
-                       c = buffer_->text->cursor.par->
-                               GetChar(buffer_->text->cursor.pos - 1);
-                       if (c == LyXParagraph::META_FOOTNOTE
-                           || c == LyXParagraph::META_MARGIN
-                           || c == LyXParagraph::META_FIG
-                           || c == LyXParagraph::META_TAB
-                           || c == LyXParagraph::META_WIDE_FIG 
-                           || c == LyXParagraph::META_WIDE_TAB
-                           || c == LyXParagraph::META_ALGORITHM){
-                               // We are one step too far to the right
-                               buffer_->text->CursorLeft();
-                               hit = true;
-                       }
-               }
-               if (hit == true) {
-                       ToggleFloat();
-                       selection_possible = false;
-                       return 0;
-               }
-       }
-
-       // Do we want to close a float? (click on the float-label)
-       if (buffer_->text->cursor.row->par->footnoteflag == 
-           LyXParagraph::OPEN_FOOTNOTE
-           && buffer_->text->cursor.pos == 0
-           && buffer_->text->cursor.row->previous &&
-           buffer_->text->cursor.row->previous->par->
-           footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
-               LyXFont font (LyXFont::ALL_SANE);
-               font.setSize(LyXFont::SIZE_SMALL);
-
-               int box_x = 20; // LYX_PAPER_MARGIN;
-               box_x += font.textWidth("Mwide-figM", 10);
-
-               int screen_first = screen->first;
-
-               if (x < box_x
-                   && y + screen_first > buffer_->text->cursor.y -
-                   buffer_->text->cursor.row->baseline
-                   && y + screen_first < buffer_->text->cursor.y -
-                   buffer_->text->cursor.row->baseline
-                   + font.maxAscent()*1.2 + font.maxDescent()*1.2) {
-                       ToggleFloat();
-                       selection_possible = false;
-                       return 0;
-               }
-       }
-
-       // Maybe we want to edit a bibitem ale970302
-       if (buffer_->text->cursor.par->bibkey && x < 20 + 
-           bibitemMaxWidth(textclasslist.TextClass(buffer_->
-                                       params.textclass).defaultfont())) {
-               buffer_->text->cursor.par->bibkey->Edit(0, 0);
-       }
-
-       return 0;
-}
-#endif
 
 /* 
  * Returns an inset if inset was hit. 0 otherwise.
  * If hit, the coordinates are changed relative to the inset. 
  * Otherwise coordinates are not changed, and false is returned.
  */
-#ifdef MOVE_TEXT
 Inset * BufferView::checkInsetHit(int & x, int & y)
 {
        if (!getScreen())
@@ -1729,48 +1241,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
        }
        return 0;
 }
-#else
-Inset * BufferView::checkInsetHit(int & x, int & y)
-{
-       if (!getScreen())
-               return 0;
-  
-       int y_tmp = y + getScreen()->first;
-  
-       LyXCursor cursor = buffer_->text->cursor;
-       if (cursor.pos < cursor.par->Last() 
-           && cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
-           && cursor.par->GetInset(cursor.pos)
-           && cursor.par->GetInset(cursor.pos)->Editable()) {
 
-               // Check whether the inset really was hit
-               Inset * tmpinset = cursor.par->GetInset(cursor.pos);
-               LyXFont font = buffer_->text->GetFont(cursor.par, cursor.pos);
-               if (x > cursor.x
-                   && x < cursor.x + tmpinset->Width(font) 
-                   && y_tmp > cursor.y - tmpinset->Ascent(font)
-                   && y_tmp < cursor.y + tmpinset->Descent(font)) {
-                       x = x - cursor.x;
-                       // The origin of an inset is on the baseline
-                       y = y_tmp - (cursor.y); 
-                       return tmpinset;
-               }
-       } else if (cursor.pos - 1 >= 0 
-                  && cursor.par->GetChar(cursor.pos - 1) == LyXParagraph::META_INSET
-                  && cursor.par->GetInset(cursor.pos - 1)
-                  && cursor.par->GetInset(cursor.pos - 1)->Editable()) {
-               buffer_->text->CursorLeft();
-               Inset * result = checkInsetHit(x, y);
-               if (result == 0) {
-                       buffer_->text->CursorRight();
-                       return 0;
-               } else {
-                       return result;
-               }
-       }
-       return 0;
-}
-#endif
 
 int BufferView::workAreaExpose()
 {
@@ -1827,7 +1298,7 @@ int BufferView::workAreaExpose()
 // Callback for cursor timer
 void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
 {
-       BufferView *view = static_cast<BufferView*>(ob->u_vdata);
+       BufferView * view = static_cast<BufferView*>(ob->u_vdata);
        
        /* quite a nice place for asyncron Inset updating, isn't it? */
        // actually no! This is run even if no buffer exist... so (Lgb)
@@ -1864,12 +1335,12 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
 
        // these comments posted to lyx@via
        {
-       int status = 1;
-       int pid = waitpid(static_cast<pid_t>(0), &status, WNOHANG);
-       if (pid == -1) // error find out what is wrong
-               ; // ignore it for now.
-       else if (pid > 0)
-               sigchldhandler(pid, &status);
+               int status = 1;
+               int pid = waitpid(static_cast<pid_t>(0), &status, WNOHANG);
+               if (pid == -1) // error find out what is wrong
+                       ; // ignore it for now.
+               else if (pid > 0)
+                       sigchldhandler(pid, &status);
        }
        if (InsetUpdateList) 
                UpdateInsetUpdateList();
@@ -1900,7 +1371,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
                Window tmpwin;
                int tmp;
                XGetInputFocus(fl_display, &tmpwin, &tmp);
-               if (lyxerr.debugging()) {
+               if (lyxerr.debugging(Debug::INFO)) {
                        lyxerr << "tmpwin: " << tmpwin
                               << "\nwindow: " << view->owner_->getForm()->window
                               << "\nwork_area_focus: " << view->work_area_focus
@@ -1927,7 +1398,8 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
 
 
 int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
-                           int /*w*/, int /*h*/, XEvent *event, void */*d*/)
+                                       int /*w*/, int /*h*/,
+                                       XEvent * event, void */*d*/)
 {
        if (buffer_ == 0) return 0;
        if (event->type != SelectionNotify)
@@ -1984,37 +1456,22 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
                }
                XFlush(fl_display);
         
-               if (uc){
-#ifdef MOVE_TEXT
+               if (uc) {
                        if (!ascii_type) {
                                text->InsertStringA(reinterpret_cast<char*>(uc));
                        } else {
                                text->InsertStringB(reinterpret_cast<char*>(uc));
                        }
-#else
-                       if (!ascii_type) {
-                               buffer_->text->
-                                       InsertStringA(reinterpret_cast<char*>(uc));
-                       } else {
-                               buffer_->text->
-                                       InsertStringB(reinterpret_cast<char*>(uc));
-                       }
-#endif
                        free(uc);
                        uc = 0;
                }
 
-#ifdef MOVE_TEXT
                update(1);
-#else
-               buffer_->update(1);
-#endif
        }
        return 0;
 }
 
 
-#ifdef MOVE_TEXT
 void BufferView::cursorPrevious()
 {
        if (!text->cursor.row->previous) return;
@@ -2052,74 +1509,20 @@ void BufferView::cursorNext()
                getScreen()->Draw(text->cursor.y
                                  - text->cursor.row->baseline);
 }
-#else
-void BufferView::cursorPrevious()
-{
-       if (!buffer()->text->cursor.row->previous) return;
-       
-       long y = getScreen()->first;
-       Row * cursorrow = buffer()->text->cursor.row;
-       buffer()->text->
-         SetCursorFromCoordinates(buffer()->text->
-                                  cursor.x_fix,
-                                  y);
-       buffer()->text->FinishUndo();
-       // this is to allow jumping over large insets
-       if ((cursorrow == buffer()->text->cursor.row))
-         buffer()->text->CursorUp();
-       
-       if (buffer()->text->cursor.row->height < work_area->h)
-         getScreen()->Draw(buffer()->text->cursor.y
-                           - buffer()->text->cursor.row->baseline
-                           + buffer()->text->cursor.row->height
-                           - work_area->h +1 );
-}
 
 
-void BufferView::cursorNext()
-{
-       if (!buffer()->text->cursor.row->next) return;
-       
-       long y = getScreen()->first;
-       buffer()->text->GetRowNearY(y);
-       Row * cursorrow = buffer()->text->cursor.row;
-       buffer()->text->
-               SetCursorFromCoordinates(buffer()->text->
-                                        cursor.x_fix, 
-                                        y + work_area->h);
-       buffer()->text->FinishUndo();
-       /* this is to allow jumping over large insets */
-       if ((cursorrow == buffer()->text->cursor.row))
-         buffer()->text->CursorDown();
-       
-       if (buffer()->text->cursor.row->height < work_area->h)
-         getScreen()->Draw(buffer()->text->cursor.y
-                           - buffer()->text->cursor.row->baseline);
-}
-#endif
-
 bool BufferView::available() const
 {
-#ifdef MOVE_TEXT
        if (buffer_ && text) return true;
-#else
-       if (buffer_ && buffer_->text) return true;
-#endif
        return false;
 }
 
 
 void BufferView::savePosition()
 {
-#ifdef MOVE_TEXT
        backstack.push(buffer()->fileName(),
-                       text->cursor.x,
-                       text->cursor.y);
-#else
-       backstack.push(buffer()->getFileName(),
-                       buffer()->text->cursor.x,
-                       buffer()->text->cursor.y);
-#endif
+                      text->cursor.x,
+                      text->cursor.y);
 }
 
 
@@ -2131,20 +1534,15 @@ void BufferView::restorePosition()
        string fname = backstack.pop(&x, &y);
        
        BeforeChange();
-       Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
+       Buffer * b = bufferlist.exists(fname) ?
+               bufferlist.getBuffer(fname) :
                bufferlist.loadLyXFile(fname); // don't ask, just load it
        buffer(b);
-#ifdef MOVE_TEXT
        text->SetCursorFromCoordinates(x, y);
        update(0);
-#else
-       buffer()->text->SetCursorFromCoordinates(x, y);
-       buffer()->update(0);
-#endif
 } 
 
 
-#ifdef MOVE_TEXT
 // candidate for move to BufferView
 void BufferView::update(signed char f)
 {
@@ -2172,4 +1570,3 @@ void BufferView::update(signed char f)
                }
        }
 }
-#endif
index e89b6b2cfea1886952ba3fbb29469f26483780a0..45e4cce06be4fc8dc434bb7dfde64c37f1812334 100644 (file)
@@ -20,7 +20,6 @@
 #include "BackStack.h"
 #include "lyxtext.h"
 
-#define MOVE_TEXT 1
 
 class LyXView;
 class Buffer;
@@ -48,10 +47,8 @@ public:
        void fitCursor();
        ///
        void update();
-#ifdef MOVE_TEXT
        ///
        void update(signed char f);
-#endif
        ///
        void updateScrollbar();
        ///
@@ -70,20 +67,18 @@ public:
        LyXView * owner() const { return owner_; }
        ///
        LyXScreen * getScreen()
-       {
-               fl_set_timer(timer_cursor, 0.4);
-               return screen;
-       }
+               {
+                       fl_set_timer(timer_cursor, 0.4);
+                       return screen;
+               }
         ///
         void savePosition();
         ///
         void restorePosition();
-#ifdef MOVE_TEXT
        /** This holds the mapping between buffer paragraphs and screen rows.
            This should be private...but not yet. (Lgb)
        */
        LyXText * text;
-#endif
 private:
        /// Update pixmap of screen
        void updateScreen();
index f9a10c2a9aaecbbdfae6d05938f1b38a98fee504..95f44c8f2eb90f04ed42adb59c0f90d40be04341 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1997 Asger Alstrup
+ *         Copyright 1997 Asger Alstrup
  *           and the LyX Team.
  *
  * ====================================================== */
@@ -67,32 +67,30 @@ string FontInfo::getFontname(int size)
        return strings[closestind];
 }
 
+
 /// Build newly sized font string 
-string FontInfo::resize(string const & font, int size) const {
+string FontInfo::resize(string const & font, int size) const
+{
+       string ret(font);
        // Find the position of the size spec
-#ifdef WITH_WARNINGS
-#warning rewrite to use std::string constructs
-#endif
-       int cut = 0, before = 0, after = 0;
-       for (string::size_type i = 0; i < font.length(); ++i) {
-               if (font[i] == '-') {
+       int cut = 0;
+       string::iterator before = 0;
+       string::iterator after = 0;
+       for (string::iterator sit = ret.begin();
+            sit != ret.end(); ++sit)
+               if ((*sit) == '-') {
                        ++cut;
-                       if (cut == 7) {
-                               before = i;
-                       } else if (cut == 8) {
-                               after = i;
+                       if (cut == 7) before = sit + 1;
+                       else if (cut == 8) {
+                               after = sit;
                                break;
                        }
                }
-       }
-
-       string head = font;
-       head.erase(before + 1, string::npos);
-       string tail = font;
-       tail.erase(0, after);
-       return head + tostr(size) + tail;
+       ret.replace(before, after, tostr(size));
+       return ret;
 }
 
+
 /// Set new pattern
 void FontInfo::setPattern(string const & pat)
 {
@@ -101,6 +99,7 @@ void FontInfo::setPattern(string const & pat)
        pattern = pat;
 }
 
+
 /// Query font in X11
 void FontInfo::query()
 {
@@ -108,7 +107,8 @@ void FontInfo::query()
                return;
 
        if (pattern.empty()) {
-               lyxerr << "Can not use empty font name for font query." << endl;
+               lyxerr << "Can not use empty font name for font query."
+                      << endl;
                queried = true;
                return;
        }
@@ -141,6 +141,7 @@ void FontInfo::query()
        queried = true;
 }
 
+
 /// Release allocated stuff
 void FontInfo::release()
 {
index bea0dab4a4cd9863b7ad65baaca4cd15996fd652..9f2dbf5756dfaf2c330b4bb01bf6761b70b50ade 100644 (file)
@@ -19,7 +19,7 @@
 #include "gettext.h"
 #include "support/lstrings.h"
 
- /*  
+/*  
      NAMING RULES FOR USER-COMMANDS
      Here's the set of rules to apply when a new command name is introduced:
  
@@ -71,281 +71,300 @@ void LyXAction::init()
        if (init) return;
 
        lfun_item items[] = {
-       { LFUN_ACUTE, "accent-acute", "", Noop },
-       { LFUN_BREVE, "accent-breve", "", Noop },
-       { LFUN_CARON, "accent-caron", "", Noop },
-       { LFUN_CEDILLA, "accent-cedilla", "", Noop },
-       { LFUN_CIRCLE, "accent-circle", "", Noop },
-       { LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop },
-       { LFUN_DOT, "accent-dot", "", Noop },
-       { LFUN_GRAVE, "accent-grave", "", Noop },
-       { LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop },
-       { LFUN_MACRON, "accent-macron", "", Noop },
-       { LFUN_OGONEK, "accent-ogonek", "", Noop },
-       { LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop },
-       { LFUN_TIE, "accent-tie", "", Noop },
-       { LFUN_TILDE, "accent-tilde", "", Noop },
-       { LFUN_UMLAUT, "accent-umlaut", "", Noop },
-       { LFUN_UNDERBAR, "accent-underbar", "", Noop },
-       { LFUN_UNDERDOT, "accent-underdot", "", Noop },
-       { LFUN_VECTOR, "accent-vector", "", Noop },
-       { LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop },
-       { LFUN_APROPOS, "apropos", N_("Describe command"), NoBuffer|ReadOnly },
-       { LFUN_LEFTSEL, "backward-select",
-         N_("Select previous char"), ReadOnly },
-       { LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
-       { LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
-       { LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"), Noop },
-       { LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
-       { LFUN_BREAKLINE, "break-line", "", Noop },
-       { LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
-       { LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout",
-         "", Noop },
-       { LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop },
-       { LFUN_BUILDPROG, "build-program", _("Build program"), Noop },
-       { LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop },
-       { LFUN_BEGINNINGBUF, "buffer-begin",
-         N_("Go to beginning of document"), ReadOnly },
-       { LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
-         N_("Select to beginning of document"), ReadOnly },
-       { LFUN_CHILDINSERT, "buffer-child-insert", "", Noop },
-       { LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
-       { LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
-       { LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
-       { LFUN_ENDBUF, "buffer-end",
-         N_("Go to end of document"), ReadOnly },
-       { LFUN_ENDBUFSEL, "buffer-end-select",
-         N_("Select to end of document"), ReadOnly },
-       { LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly },
-       { LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly },
-       { LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop },
-       { LFUN_IMPORT, "buffer-import",
-         N_("Import document"), NoBuffer },
-       { LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
-         "", Noop },
-       { LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
-       { LFUN_MENUNEWTMPLT,"buffer-new-template",
-         N_("New document from template"), NoBuffer },
-       { LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
-       { LFUN_PREVBUFFER, "buffer-previous",
-         N_("Switch to previous document"), ReadOnly },
-       { LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
-       { LFUN_MENURELOAD, "buffer-reload",
-         N_("Revert to saved"), ReadOnly },
-       { LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only",
-         N_("Toggle read-only"), ReadOnly },
-       { LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"), ReadOnly },
-       { LFUN_RUNDVIPS, "buffer-typeset-ps",
-         N_("Update PostScript"), ReadOnly },
-       { LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly },
-       { LFUN_PREVIEWPS, "buffer-view-ps",
-         N_("View PostScript") , ReadOnly },
-       { LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
-       { LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"), ReadOnly },
-       { LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
-       { LFUN_LEFT, "char-backward", N_("Go one char back"), ReadOnly },
-       { LFUN_RIGHT, "char-forward", N_("Go one char forward"), ReadOnly },
-       { LFUN_INSERT_CITATION, "citation-insert",
-         N_("Insert citation"), Noop },
-       { LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
-       { LFUN_PREFIX, "command-prefix",
-         N_("Execute command"), NoBuffer },
-       { LFUN_SEQUENCE, "command-sequence", "", Noop },
-       { LFUN_COPY, "copy", N_("Copy"), ReadOnly },
-       { LFUN_CUT, "cut", N_("Cut"), Noop },
-       { LFUN_BACKSPACE, "delete-backward", "", Noop },
-       { LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop },
-       { LFUN_DELETE, "delete-forward", "", Noop },
-       { LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop },
-       { LFUN_DEPTH_MIN, "depth-decrement",
-               N_("Decrement environment depth"), Noop },
-       { LFUN_DEPTH_PLUS, "depth-increment",
-               N_("Increment environment depth"), Noop },
-       { LFUN_DEPTH, "depth-next", 
-               N_("Change environment depth"), Noop },
-       { LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop },
-       { LFUN_DOWN, "down", N_("Go down"), ReadOnly },
-       { LFUN_DOWNSEL, "down-select",
-               N_("Select next line"), ReadOnly },
-       { LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice",
-               N_("Choose Paragraph Environment"), ReadOnly },
-       { LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert",
-               N_("Insert end of sentence period"), Noop },
-       { LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop },
-       { LFUN_REMOVEERRORS, "error-remove-all",
-               N_("Remove all error boxes"), ReadOnly },
-       { LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
-       { LFUN_FILE_INSERT, "file-insert", "", Noop },
-       { LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
-       { LFUN_FILE_NEW, "file-new", "", NoBuffer },
-       { LFUN_FILE_OPEN, "file-open", "", NoBuffer },
-       { LFUN_MENUSEARCH, "find-replace", N_("Find & Replace") , Noop },
-       { LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
-       { LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
-       { LFUN_DEFAULT, "font-default", N_("Default font style"), Noop },
-       { LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
-       { LFUN_FREE, "font-free", N_("Toggle user defined style"), Noop },
-       { LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
-       { LFUN_ROMAN, "font-roman", N_("Toggle roman font style"), Noop },
-       { LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop },
-       { LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop },
-       { LFUN_FONT_STATE, "font-state", N_("Show font state"), ReadOnly },
-       { LFUN_UNDERLINE, "font-underline",
-         N_("Toggle font underline"), Noop },
-       { LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"), Noop },
-       { LFUN_RIGHTSEL, "forward-select", N_("Select next char"), ReadOnly },
-       { LFUN_HFILL, "hfill-insert",
-         N_("Insert horizontal fill"), Noop },
-       { LFUN_HTMLURL, "html-insert", "", Noop },
-       { LFUN_HYPHENATION, "hyphenation-point-insert",
-         N_("Insert hyphenation point"), Noop },
-       { LFUN_INDEX_INSERT, "index-insert",
-         N_("Insert index item"), Noop },
-       { LFUN_INDEX_INSERT_LAST, "index-insert-last",
-         N_("Insert last index item"), Noop },
-       { LFUN_INDEX_PRINT, "index-print", N_("Insert index list"), Noop },
-       { LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"), ReadOnly },
-       { LFUN_KMAP_PRIM, "keymap-primary",
-         N_("Use primary keymap"), ReadOnly },
-       { LFUN_KMAP_SEC, "keymap-secondary",
-         N_("Use secondary keymap"), ReadOnly },
-       { LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"), ReadOnly },
-       { LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"), Noop },
-       { LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"), ReadOnly },
-       { LFUN_LAYOUT, "layout", "", Noop },
-       { LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop },
-       { LFUN_LAYOUT_COPY, "layout-copy",
-         N_("Copy paragraph environment type"), Noop },
-       { LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },
-       { LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only
-       { LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly },
-       { LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly },
-       { LFUN_LAYOUT_PASTE, "layout-paste",
-         N_("Paste paragraph environment type"), Noop },
-       { LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly },
-       { LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly },
-       { LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "", ReadOnly },
-       { LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
-       { LFUN_HOME, "line-begin",
-         N_("Go to beginning of line"), ReadOnly },
-       { LFUN_HOMESEL, "line-begin-select",
-         N_("Select to beginning of line"), ReadOnly },
-       { LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop },
-       { LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
-       { LFUN_ENDSEL, "line-end-select",
-         N_("Select to end of line"), ReadOnly },
-       { LFUN_LOA_INSERT, "loa-insert",
-         N_("Insert list of algorithms"), Noop },
-       { LFUN_LOF_INSERT, "lof-insert",
-         N_("Insert list of figures"), Noop },
-       { LFUN_LOT_INSERT, "lot-insert",
-         N_("Insert list of tables"), Noop },
-       { LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
-       { LFUN_MARGINMELT, "marginpar-insert",
-         N_("Insert Margin note"), Noop },
-       { LFUN_MARK_OFF, "mark-off", "", ReadOnly },
-       { LFUN_MARK_ON, "mark-on", "", ReadOnly },
-       { LFUN_SETMARK, "mark-toggle", "", ReadOnly },
-       { LFUN_MATH_DELIM, "math-delim", "", Noop },
-       { LFUN_MATH_DISPLAY, "math-display", "", Noop },
-       { LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },
-       { LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
-       { LFUN_INSERT_MATH, "math-insert",
-         N_("Insert math symbol"), Noop },
-       { LFUN_MATH_LIMITS, "math-limits", "", Noop },
-       { LFUN_MATH_MACRO, "math-macro", "", Noop },
-       { LFUN_MATH_MACROARG, "math-macro-arg", "", Noop },
-       { LFUN_INSERT_MATRIX, "math-matrix", "", Noop },
-       { LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop },
-       { LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
-       { LFUN_MATH_NUMBER, "math-number", "", Noop },
-       { LFUN_MATH_SIZE, "math-size", "", Noop },
-       { LFUN_MELT, "melt", N_("Melt"), Noop },
-       { LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
-       { LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop },
-       { LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
-       { LFUN_INSERT_NOTE, "note-insert", "", Noop },
-       { LFUN_GOTONOTE, "note-next", "", ReadOnly },
-       { LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
-       { LFUN_DOWN_PARAGRAPH, "paragraph-down",
-         N_("Go one paragraph down"), ReadOnly },
-       { LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
-         N_("Select next paragraph"), ReadOnly },
-       { LFUN_UP_PARAGRAPH, "paragraph-up",
-         N_("Go one paragraph up"), ReadOnly },
-       { LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
-         N_("Select previous paragraph"), ReadOnly },
-       { LFUN_PARENTINSERT, "parent-insert", "", Noop },
-       { LFUN_PASTE, "paste", N_("Paste") , Noop },
-       { LFUN_SAVEPREFERENCES, "preferences-save",
-         "Save Preferences", NoBuffer },
-       { LFUN_PASTESELECTION, "primary-selection-paste", "", Noop },
-       { LFUN_PROTECTEDSPACE, "protected-space-insert",
-         N_("Insert protected space"), Noop },
-       { LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop },
-       { LFUN_RECONFIGURE, "reconfigure",
-         N_("Reconfigure"), NoBuffer },
-       { LFUN_REDO, "redo", N_("Redo"), Noop },
-       { LFUN_REFBACK, "reference-back", "", ReadOnly },
-       { LFUN_REFGOTO, "reference-goto", "", ReadOnly },
-       { LFUN_INSERT_REF, "reference-insert",
-         N_("Insert cross reference"), Noop },
-       { LFUN_REFTOGGLE, "reference-toggle", "", Noop },
-       { LFUN_NEXT, "screen-down", "", ReadOnly },
-       { LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
-       { LFUN_CENTER, "screen-recenter", "", ReadOnly },
-       { LFUN_PRIOR, "screen-up", "", ReadOnly },
-       { LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
-       { LFUN_SELFINSERT, "self-insert", "", Noop },
-       { LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
-       { LFUN_GETFONT, "server-get-font", "", ReadOnly },
-       { LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
-       { LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
-       { LFUN_GETNAME, "server-get-name", "", ReadOnly },
-       { LFUN_GETTIP, "server-get-tip", "", ReadOnly },
-       { LFUN_GETXY, "server-get-xy", "", ReadOnly },
-       { LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
-       { LFUN_NOTIFY, "server-notify", "", ReadOnly },
-       { LFUN_SETXY, "server-set-xy", "", ReadOnly },
-       { LFUN_SPELLCHECK, "spellchecker", "", Noop },
-       { LFUN_INSERT_MATH, "symbol-insert", "", Noop },
-       { LFUN_TAB, "tab-forward", "", Noop },
-       { LFUN_TABINSERT, "tab-insert", "", Noop },
-       { LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
-       { LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
-       { LFUN_TOC_INSERT, "toc-insert",
-         N_("Insert table of contents"), Noop },
-       { LFUN_TOCVIEW, "toc-view",
-         N_("View table of contents"), ReadOnly },
-       { LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
-         N_("Toggle cursor does/doesn't follow the scrollbar"),
-         ReadOnly },
-       { LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
-       { LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer },
-       { LFUN_UNDO, "undo", N_("Undo"), Noop },
-       { LFUN_UP, "up", "", ReadOnly },
-       { LFUN_UPSEL, "up-select", "", ReadOnly },
-       { LFUN_URL, "url-insert", "", Noop },
-       { LFUN_VC_CHECKIN, "vc-check-in", "", ReadOnly },
-       { LFUN_VC_CHECKOUT, "vc-check-out", "", ReadOnly },
-       { LFUN_VC_HISTORY, "vc-history", "", ReadOnly },
-       { LFUN_VC_REGISTER, "vc-register",
-         N_("Register document under version control"), ReadOnly },
-       { LFUN_VC_REVERT, "vc-revert", "", ReadOnly },
-       { LFUN_VC_UNDO, "vc-undo-last", "", ReadOnly },
-       { LFUN_WORDLEFT, "word-backward", "", ReadOnly },
-       { LFUN_WORDLEFTSEL, "word-backward-select", "", ReadOnly },
-       { LFUN_CAPITALIZE_WORD, "word-capitalize", "", Noop },
-       { LFUN_DELETE_WORD_BACKWARD, "word-delete-backward",
-         "", Noop },
-       { LFUN_DELETE_WORD_FORWARD, "word-delete-forward", "", Noop },
-       { LFUN_WORDFINDBACKWARD, "word-find-backward", "", ReadOnly },
-       { LFUN_WORDFINDFORWARD, "word-find-forward", "", ReadOnly },
-       { LFUN_WORDRIGHT, "word-forward", "", ReadOnly },
-       { LFUN_WORDRIGHTSEL, "word-forward-select", "", ReadOnly },
-       { LFUN_LOWCASE_WORD, "word-lowcase", "", Noop },
-       { LFUN_UPCASE_WORD, "word-upcase", "", Noop },
-       { LFUN_NOACTION, "", "", Noop }
+               { LFUN_ACUTE, "accent-acute", "", Noop },
+               { LFUN_BREVE, "accent-breve", "", Noop },
+               { LFUN_CARON, "accent-caron", "", Noop },
+               { LFUN_CEDILLA, "accent-cedilla", "", Noop },
+               { LFUN_CIRCLE, "accent-circle", "", Noop },
+               { LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop },
+               { LFUN_DOT, "accent-dot", "", Noop },
+               { LFUN_GRAVE, "accent-grave", "", Noop },
+               { LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop },
+               { LFUN_MACRON, "accent-macron", "", Noop },
+               { LFUN_OGONEK, "accent-ogonek", "", Noop },
+               { LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop },
+               { LFUN_TIE, "accent-tie", "", Noop },
+               { LFUN_TILDE, "accent-tilde", "", Noop },
+               { LFUN_UMLAUT, "accent-umlaut", "", Noop },
+               { LFUN_UNDERBAR, "accent-underbar", "", Noop },
+               { LFUN_UNDERDOT, "accent-underdot", "", Noop },
+               { LFUN_VECTOR, "accent-vector", "", Noop },
+               { LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop },
+               { LFUN_APROPOS, "apropos", N_("Describe command"),
+                 NoBuffer|ReadOnly },
+               { LFUN_LEFTSEL, "backward-select",
+                 N_("Select previous char"), ReadOnly },
+               { LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
+               { LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
+               { LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"),
+                 Noop },
+               { LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
+               { LFUN_BREAKLINE, "break-line", "", Noop },
+               { LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
+               { LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout",
+                 "", Noop },
+               { LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop },
+               { LFUN_BUILDPROG, "build-program", _("Build program"), Noop },
+               { LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop },
+               { LFUN_BEGINNINGBUF, "buffer-begin",
+                 N_("Go to beginning of document"), ReadOnly },
+               { LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
+                 N_("Select to beginning of document"), ReadOnly },
+               { LFUN_CHILDINSERT, "buffer-child-insert", "", Noop },
+               { LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
+               { LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
+               { LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
+               { LFUN_ENDBUF, "buffer-end",
+                 N_("Go to end of document"), ReadOnly },
+               { LFUN_ENDBUFSEL, "buffer-end-select",
+                 N_("Select to end of document"), ReadOnly },
+               { LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly },
+               { LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly },
+               { LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop },
+               { LFUN_IMPORT, "buffer-import",
+                 N_("Import document"), NoBuffer },
+               { LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
+                 "", Noop },
+               { LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
+               { LFUN_MENUNEWTMPLT,"buffer-new-template",
+                 N_("New document from template"), NoBuffer },
+               { LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
+               { LFUN_PREVBUFFER, "buffer-previous",
+                 N_("Switch to previous document"), ReadOnly },
+               { LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
+               { LFUN_MENURELOAD, "buffer-reload",
+                 N_("Revert to saved"), ReadOnly },
+               { LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only",
+                 N_("Toggle read-only"), ReadOnly },
+               { LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"),
+                 ReadOnly },
+               { LFUN_RUNDVIPS, "buffer-typeset-ps",
+                 N_("Update PostScript"), ReadOnly },
+               { LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly },
+               { LFUN_PREVIEWPS, "buffer-view-ps",
+                 N_("View PostScript") , ReadOnly },
+               { LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
+               { LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"),
+                 ReadOnly },
+               { LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
+               { LFUN_LEFT, "char-backward", N_("Go one char back"),
+                 ReadOnly },
+               { LFUN_RIGHT, "char-forward", N_("Go one char forward"),
+                 ReadOnly },
+               { LFUN_INSERT_CITATION, "citation-insert",
+                 N_("Insert citation"), Noop },
+               { LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
+               { LFUN_PREFIX, "command-prefix",
+                 N_("Execute command"), NoBuffer },
+               { LFUN_SEQUENCE, "command-sequence", "", Noop },
+               { LFUN_COPY, "copy", N_("Copy"), ReadOnly },
+               { LFUN_CUT, "cut", N_("Cut"), Noop },
+               { LFUN_BACKSPACE, "delete-backward", "", Noop },
+               { LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop },
+               { LFUN_DELETE, "delete-forward", "", Noop },
+               { LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop },
+               { LFUN_DEPTH_MIN, "depth-decrement",
+                 N_("Decrement environment depth"), Noop },
+               { LFUN_DEPTH_PLUS, "depth-increment",
+                 N_("Increment environment depth"), Noop },
+               { LFUN_DEPTH, "depth-next", 
+                 N_("Change environment depth"), Noop },
+               { LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop },
+               { LFUN_DOWN, "down", N_("Go down"), ReadOnly },
+               { LFUN_DOWNSEL, "down-select",
+                 N_("Select next line"), ReadOnly },
+               { LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice",
+                 N_("Choose Paragraph Environment"), ReadOnly },
+               { LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert",
+                 N_("Insert end of sentence period"), Noop },
+               { LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop },
+               { LFUN_REMOVEERRORS, "error-remove-all",
+                 N_("Remove all error boxes"), ReadOnly },
+               { LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
+               { LFUN_FILE_INSERT, "file-insert", "", Noop },
+               { LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
+               { LFUN_FILE_NEW, "file-new", "", NoBuffer },
+               { LFUN_FILE_OPEN, "file-open", "", NoBuffer },
+               { LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
+                 Noop },
+               { LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
+               { LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
+               { LFUN_DEFAULT, "font-default", N_("Default font style"),
+                 Noop },
+               { LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
+               { LFUN_FREE, "font-free", N_("Toggle user defined style"),
+                 Noop },
+               { LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
+               { LFUN_ROMAN, "font-roman", N_("Toggle roman font style"),
+                 Noop },
+               { LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop },
+               { LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop },
+               { LFUN_FONT_STATE, "font-state", N_("Show font state"),
+                 ReadOnly },
+               { LFUN_UNDERLINE, "font-underline",
+                 N_("Toggle font underline"), Noop },
+               { LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"),
+                 Noop },
+               { LFUN_RIGHTSEL, "forward-select", N_("Select next char"),
+                 ReadOnly },
+               { LFUN_HFILL, "hfill-insert",
+                 N_("Insert horizontal fill"), Noop },
+               { LFUN_HTMLURL, "html-insert", "", Noop },
+               { LFUN_HYPHENATION, "hyphenation-point-insert",
+                 N_("Insert hyphenation point"), Noop },
+               { LFUN_INDEX_INSERT, "index-insert",
+                 N_("Insert index item"), Noop },
+               { LFUN_INDEX_INSERT_LAST, "index-insert-last",
+                 N_("Insert last index item"), Noop },
+               { LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
+                 Noop },
+               { LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"),
+                 ReadOnly },
+               { LFUN_KMAP_PRIM, "keymap-primary",
+                 N_("Use primary keymap"), ReadOnly },
+               { LFUN_KMAP_SEC, "keymap-secondary",
+                 N_("Use secondary keymap"), ReadOnly },
+               { LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"),
+                 ReadOnly },
+               { LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"),
+                 Noop },
+               { LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
+                 ReadOnly },
+               { LFUN_LAYOUT, "layout", "", Noop },
+               { LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop },
+               { LFUN_LAYOUT_COPY, "layout-copy",
+                 N_("Copy paragraph environment type"), Noop },
+               { LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },
+               { LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only
+               { LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly },
+               { LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly },
+               { LFUN_LAYOUT_PASTE, "layout-paste",
+                 N_("Paste paragraph environment type"), Noop },
+               { LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly },
+               { LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly },
+               { LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "",
+                 ReadOnly },
+               { LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
+               { LFUN_HOME, "line-begin",
+                 N_("Go to beginning of line"), ReadOnly },
+               { LFUN_HOMESEL, "line-begin-select",
+                 N_("Select to beginning of line"), ReadOnly },
+               { LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop },
+               { LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
+               { LFUN_ENDSEL, "line-end-select",
+                 N_("Select to end of line"), ReadOnly },
+               { LFUN_LOA_INSERT, "loa-insert",
+                 N_("Insert list of algorithms"), Noop },
+               { LFUN_LOF_INSERT, "lof-insert",
+                 N_("Insert list of figures"), Noop },
+               { LFUN_LOT_INSERT, "lot-insert",
+                 N_("Insert list of tables"), Noop },
+               { LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
+               { LFUN_MARGINMELT, "marginpar-insert",
+                 N_("Insert Margin note"), Noop },
+               { LFUN_MARK_OFF, "mark-off", "", ReadOnly },
+               { LFUN_MARK_ON, "mark-on", "", ReadOnly },
+               { LFUN_SETMARK, "mark-toggle", "", ReadOnly },
+               { LFUN_MATH_DELIM, "math-delim", "", Noop },
+               { LFUN_MATH_DISPLAY, "math-display", "", Noop },
+               { LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },
+               { LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
+               { LFUN_INSERT_MATH, "math-insert",
+                 N_("Insert math symbol"), Noop },
+               { LFUN_MATH_LIMITS, "math-limits", "", Noop },
+               { LFUN_MATH_MACRO, "math-macro", "", Noop },
+               { LFUN_MATH_MACROARG, "math-macro-arg", "", Noop },
+               { LFUN_INSERT_MATRIX, "math-matrix", "", Noop },
+               { LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop },
+               { LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
+               { LFUN_MATH_NUMBER, "math-number", "", Noop },
+               { LFUN_MATH_SIZE, "math-size", "", Noop },
+               { LFUN_MELT, "melt", N_("Melt"), Noop },
+               { LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
+               { LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop },
+               { LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
+               { LFUN_INSERT_NOTE, "note-insert", "", Noop },
+               { LFUN_GOTONOTE, "note-next", "", ReadOnly },
+               { LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
+               { LFUN_DOWN_PARAGRAPH, "paragraph-down",
+                 N_("Go one paragraph down"), ReadOnly },
+               { LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
+                 N_("Select next paragraph"), ReadOnly },
+               { LFUN_UP_PARAGRAPH, "paragraph-up",
+                 N_("Go one paragraph up"), ReadOnly },
+               { LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
+                 N_("Select previous paragraph"), ReadOnly },
+               { LFUN_PARENTINSERT, "parent-insert", "", Noop },
+               { LFUN_PASTE, "paste", N_("Paste") , Noop },
+               { LFUN_SAVEPREFERENCES, "preferences-save",
+                 "Save Preferences", NoBuffer },
+               { LFUN_PASTESELECTION, "primary-selection-paste", "", Noop },
+               { LFUN_PROTECTEDSPACE, "protected-space-insert",
+                 N_("Insert protected space"), Noop },
+               { LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop },
+               { LFUN_RECONFIGURE, "reconfigure",
+                 N_("Reconfigure"), NoBuffer },
+               { LFUN_REDO, "redo", N_("Redo"), Noop },
+               { LFUN_REFBACK, "reference-back", "", ReadOnly },
+               { LFUN_REFGOTO, "reference-goto", "", ReadOnly },
+               { LFUN_INSERT_REF, "reference-insert",
+                 N_("Insert cross reference"), Noop },
+               { LFUN_REFTOGGLE, "reference-toggle", "", Noop },
+               { LFUN_NEXT, "screen-down", "", ReadOnly },
+               { LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
+               { LFUN_CENTER, "screen-recenter", "", ReadOnly },
+               { LFUN_PRIOR, "screen-up", "", ReadOnly },
+               { LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
+               { LFUN_SELFINSERT, "self-insert", "", Noop },
+               { LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
+               { LFUN_GETFONT, "server-get-font", "", ReadOnly },
+               { LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
+               { LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
+               { LFUN_GETNAME, "server-get-name", "", ReadOnly },
+               { LFUN_GETTIP, "server-get-tip", "", ReadOnly },
+               { LFUN_GETXY, "server-get-xy", "", ReadOnly },
+               { LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
+               { LFUN_NOTIFY, "server-notify", "", ReadOnly },
+               { LFUN_SETXY, "server-set-xy", "", ReadOnly },
+               { LFUN_SPELLCHECK, "spellchecker", "", Noop },
+               { LFUN_INSERT_MATH, "symbol-insert", "", Noop },
+               { LFUN_TAB, "tab-forward", "", Noop },
+               { LFUN_TABINSERT, "tab-insert", "", Noop },
+               { LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
+               { LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
+               { LFUN_TOC_INSERT, "toc-insert",
+                 N_("Insert table of contents"), Noop },
+               { LFUN_TOCVIEW, "toc-view",
+                 N_("View table of contents"), ReadOnly },
+               { LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
+                 N_("Toggle cursor does/doesn't follow the scrollbar"),
+                 ReadOnly },
+               { LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
+               { LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer },
+               { LFUN_UNDO, "undo", N_("Undo"), Noop },
+               { LFUN_UP, "up", "", ReadOnly },
+               { LFUN_UPSEL, "up-select", "", ReadOnly },
+               { LFUN_URL, "url-insert", "", Noop },
+               { LFUN_VC_CHECKIN, "vc-check-in", "", ReadOnly },
+               { LFUN_VC_CHECKOUT, "vc-check-out", "", ReadOnly },
+               { LFUN_VC_HISTORY, "vc-history", "", ReadOnly },
+               { LFUN_VC_REGISTER, "vc-register",
+                 N_("Register document under version control"), ReadOnly },
+               { LFUN_VC_REVERT, "vc-revert", "", ReadOnly },
+               { LFUN_VC_UNDO, "vc-undo-last", "", ReadOnly },
+               { LFUN_WORDLEFT, "word-backward", "", ReadOnly },
+               { LFUN_WORDLEFTSEL, "word-backward-select", "", ReadOnly },
+               { LFUN_CAPITALIZE_WORD, "word-capitalize", "", Noop },
+               { LFUN_DELETE_WORD_BACKWARD, "word-delete-backward",
+                 "", Noop },
+               { LFUN_DELETE_WORD_FORWARD, "word-delete-forward", "", Noop },
+               { LFUN_WORDFINDBACKWARD, "word-find-backward", "", ReadOnly },
+               { LFUN_WORDFINDFORWARD, "word-find-forward", "", ReadOnly },
+               { LFUN_WORDRIGHT, "word-forward", "", ReadOnly },
+               { LFUN_WORDRIGHTSEL, "word-forward-select", "", ReadOnly },
+               { LFUN_LOWCASE_WORD, "word-lowcase", "", Noop },
+               { LFUN_UPCASE_WORD, "word-upcase", "", Noop },
+               { LFUN_NOACTION, "", "", Noop }
        };
 
        int i = 0;
@@ -376,7 +395,8 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
        if (pit == lyx_arg_map.end()) {
                // the action does not have any pseudoactions
                lyxerr[Debug::ACTION] << "Action " << action
-                                   << " does not have any pseudo actions.\n";
+                                     << " does not have any pseudo actions."
+                                     << endl;
                return LFUN_UNKNOWN_ACTION;
        }
        
@@ -387,14 +407,14 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
                lyxerr[Debug::ACTION] 
                        << "Action " << action
                        << "does not have any pseudoactions with arg "
-                       << arg << '\n';
+                       << arg << endl;
                return LFUN_UNKNOWN_ACTION;
        }
 
        // pseudo action exist
        lyxerr[Debug::ACTION] << "Pseudoaction exist[" 
-                           << action << '|' 
-                           << arg << "] = " << (*aci).second << '\n';
+                             << action << '|' 
+                             << arg << "] = " << (*aci).second << endl;
 
        return (*aci).second;
 }
@@ -423,8 +443,8 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const
        (*ami).second[arg] = pseudo_counter;
 
        lyxerr[Debug::ACTION] << "Creating new pseudoaction "
-                           << pseudo_counter << " for [" << action
-                           << '|' << arg << "]\n";
+                             << pseudo_counter << " for [" << action
+                             << '|' << arg << "]\n";
        
        return pseudo_counter;
 }
@@ -438,8 +458,8 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
 
        if (pit != lyx_pseudo_map.end()) {
                lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
-                                   << (*pit).second.action << '|'
-                                   << (*pit).second.arg << '\n';
+                                     << (*pit).second.action << '|'
+                                     << (*pit).second.arg << '\n';
                arg = (*pit).second.arg;
                return (*pit).second.action;
        } else {
@@ -509,17 +529,18 @@ int LyXAction::getApproxFunc(string const & func) const
 
 string LyXAction::getApproxFuncName(string const & func) const
 {
-    int f = getApproxFunc(func);
-    // This will return empty string if f isn't an action.
-    return getActionName(f);
+       int f = getApproxFunc(func);
+       // This will return empty string if f isn't an action.
+       return getActionName(f);
 }
 
 
 string LyXAction::getActionName(int action) const
 {
-    info_map::const_iterator iit = lyx_info_map.find(static_cast<kb_action>(action));
+       info_map::const_iterator iit =
+               lyx_info_map.find(static_cast<kb_action>(action));
 
-    return iit != lyx_info_map.end() ? (*iit).second.name : string();
+       return iit != lyx_info_map.end() ? (*iit).second.name : string();
 }
 
 
@@ -565,15 +586,15 @@ string LyXAction::helpText(int pseudoaction) const
 bool LyXAction::funcHasFlag(kb_action action, 
                             LyXAction::func_attrib flag) const 
 {
-    info_map::const_iterator ici = lyx_info_map.find(action);
-
-    if (ici != lyx_info_map.end()) {
-           return (*ici).second.attrib & flag;
-    } else {
-           // it really should exist, but...
-           lyxerr << "No info about kb_action: " << action << '\n';
-           return false;
-    }
+       info_map::const_iterator ici = lyx_info_map.find(action);
+
+       if (ici != lyx_info_map.end()) {
+               return (*ici).second.attrib & flag;
+       } else {
+               // it really should exist, but...
+               lyxerr << "No info about kb_action: " << action << '\n';
+               return false;
+       }
 
 }
 
index 04d99bcc5845d67bc2deeec61ec349cd798ffd1a..1c94b4c2f35650b37dc637476d4aa4a292416285 100644 (file)
 
 extern FD_form_document * fd_form_document;
 FD_form_main * fd_form_main; /* a pointer to the one in LyXView
-                              should be removed as soon as possible */
+                               should be removed as soon as possible */
 
 MiniBuffer * minibuffer;/* a pointer to the one in LyXView
-                         should be removed as soon as possible */
+                          should be removed as soon as possible */
 
 extern void AutoSave();
 extern char updatetimer;
@@ -68,6 +68,7 @@ LyXView::~LyXView()
        delete intl;
 }
 
+
 /// Redraw the main form.
 void LyXView::redraw() {
        lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
@@ -86,23 +87,21 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
                return;
 
        view->view()->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
        view->view()->update(-2);
-#else
-       view->buffer()->update(-2);
-#endif
+
        /* This update can happen, even when the work area has lost
         * the focus. So suppress the cursor in that case */
        updatetimer = 0;
 }
 
+
 // Wrapper for the above
-extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data) {
+extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data)
+{
        LyXView::UpdateTimerCB(ob, data);
 }
 
 
-
 // Callback for autosave timer
 void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
 {
@@ -110,8 +109,10 @@ void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
        AutoSave();
 }
 
+
 // Wrapper for the above
-extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) {
+extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data)
+{
        LyXView::AutosaveTimerCB(ob, data);
 }
 
@@ -133,7 +134,8 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
 
 
 // Wrapper for the above
-extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) {
+extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
+{
        return LyXView::atCloseMainFormCB(form, p);
 }
 
@@ -209,10 +211,9 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
        //
 
        minibuffer = new MiniBuffer(this, air, height-(25+air), 
-                                         width-(2*air), 25);
+                                   width-(2*air), 25);
        ::minibuffer = minibuffer; // to be removed later
 
-
        //
        // TIMERS
        //
@@ -253,6 +254,7 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
        return fdui;
 }
 
+
 extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
 
 void LyXView::init()
@@ -300,7 +302,7 @@ void LyXView::updateLayoutChoice()
                toolbar->combox->clear();
                for (int i = 0;
                     textclasslist.NameOfLayout(buffer()->
-                                          params.textclass, i) != "@@end@@";
+                                               params.textclass, i) != "@@end@@";
                     i++) {
                        LyXLayout const & layout = textclasslist.
                                Style(buffer()->params.textclass, i);
@@ -315,11 +317,7 @@ void LyXView::updateLayoutChoice()
        // we need to do this.
        toolbar->combox->Redraw();
 
-#ifdef MOVE_TEXT
        char layout = bufferview->text->cursor.par->GetLayout();
-#else
-       char layout = buffer()->text->cursor.par->GetLayout();
-#endif
 
        if (layout != current_layout){
                toolbar->combox->select(layout + 1);
@@ -331,10 +329,10 @@ void LyXView::updateLayoutChoice()
 void LyXView::UpdateDocumentClassChoice()
 {
        // update the document class display in the document form
-       int i;
        if (fd_form_document) {
                fl_clear_choice(fd_form_document->choice_class);
-               for (i = 0; textclasslist.DescOfClass (i)!= "@@end@@"; i++) {
+               for (int i = 0;
+                    textclasslist.DescOfClass(i) != "@@end@@"; ++i) {
                        fl_addto_choice(fd_form_document->choice_class,
                                        textclasslist.DescOfClass(i).c_str());
                }
@@ -344,7 +342,7 @@ void LyXView::UpdateDocumentClassChoice()
 
 // This is necessary, since FL_FREE-Objects doesn't get all keypress events
 // as FL_KEYBOARD events :-(   Matthias 280596
-int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
+int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
 {
        LyXView * view = static_cast<LyXView*>(fl->u_vdata);
        int retval = 0;  // 0 means XForms should have a look at this event
@@ -360,14 +358,17 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
        return retval;
 }
 
+
 // wrapper for the above
 extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
 {
        return LyXView::KeyPressMask_raw_callback(fl, xev);
 }
 
+
 // Updates the title of the window with the filename of the current document
-void LyXView::updateWindowTitle() {
+void LyXView::updateWindowTitle()
+{
        static string last_title = "LyX";
        string title = "LyX";
 
index 636f6721116252212428a35945259a94ffc146d4..58c6fd83a7aedbe43f01e04d46aae629b0c94e61 100644 (file)
@@ -50,7 +50,6 @@ lyx_SOURCES = \
        bibforms.h \
        bmtable.C \
        bmtable.h \
-       broken_const.h \
        broken_headers.h \
        buffer.C \
        buffer.h \
index 68556bd83ceecc5f3e49aa97ffd3e04dda43ee77..72c322b3934953b74710da6409ec7ad9ea66a310 100644 (file)
@@ -73,254 +73,242 @@ inline void EnableParagraphExtra ()
 
 bool UpdateParagraphExtra()
 {
-    bool update = false;
-    if (current_view->getScreen() && current_view->available()) {
-        update = true;
-#ifdef MOVE_TEXT
-        LyXParagraph * par = current_view->text->cursor.par;
-#else
-        LyXParagraph * par = current_view->buffer()->text->cursor.par;
-#endif
+       bool update = false;
+       if (current_view->getScreen() && current_view->available()) {
+               update = true;
+               LyXParagraph * par = current_view->text->cursor.par;
 
-       EnableParagraphExtra();
+               EnableParagraphExtra();
 
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-        fl_set_input(fd_form_paragraph_extra->input_pextra_width,
-                     par->pextra_width.c_str());
-        fl_set_input(fd_form_paragraph_extra->input_pextra_widthp,
-                     par->pextra_widthp.c_str());
-        switch(par->pextra_alignment) {
-          case LyXParagraph::MINIPAGE_ALIGN_TOP:
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1);
-            break;
-          case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1);
-            break;
-          case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1);
-            break;
-        }
-        fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill,
-                      par->pextra_hfill);
-        fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp,
-                      par->pextra_start_minipage);
-        CheckInputWidth();
-        if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 1);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 1);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 1);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        }
-        if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
-            ActivateParagraphExtraButtons();
-    }
-    fl_hide_object(fd_form_paragraph_extra->text_warning);
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+               fl_set_input(fd_form_paragraph_extra->input_pextra_width,
+                            par->pextra_width.c_str());
+               fl_set_input(fd_form_paragraph_extra->input_pextra_widthp,
+                            par->pextra_widthp.c_str());
+               switch(par->pextra_alignment) {
+               case LyXParagraph::MINIPAGE_ALIGN_TOP:
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1);
+                       break;
+               case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1);
+                       break;
+               case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1);
+                       break;
+               }
+               fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill,
+                             par->pextra_hfill);
+               fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp,
+                             par->pextra_start_minipage);
+               CheckInputWidth();
+               if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 1);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 1);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 1);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               }
+               if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
+                       ActivateParagraphExtraButtons();
+       }
+       fl_hide_object(fd_form_paragraph_extra->text_warning);
 
-    if (current_view->buffer()->isReadonly()) {
-      DisableParagraphExtra();
-      fl_set_object_label(fd_form_paragraph_extra->text_warning,
-                         _("Document is read-only. "
-                           "No changes to layout permitted."));
-      fl_show_object(fd_form_paragraph_extra->text_warning);
-    }
-    if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) {
-      fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
-    }
-    return update;
+       if (current_view->buffer()->isReadonly()) {
+               DisableParagraphExtra();
+               fl_set_object_label(fd_form_paragraph_extra->text_warning,
+                                   _("Document is read-only. "
+                                     "No changes to layout permitted."));
+               fl_show_object(fd_form_paragraph_extra->text_warning);
+       }
+       if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) {
+               fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
+       }
+       return update;
 }
 
 
 void ParagraphExtraOpen(FL_OBJECT *, long)
 {
-    if (UpdateParagraphExtra()) {
-        if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
-            fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra);
-        } else {
-            fl_show_form(fd_form_paragraph_extra->form_paragraph_extra,
-                         FL_PLACE_MOUSE, FL_FULLBORDER,
-                         _("ParagraphExtra Layout"));
-        }
-    }
+       if (UpdateParagraphExtra()) {
+               if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
+                       fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra);
+               } else {
+                       fl_show_form(fd_form_paragraph_extra->form_paragraph_extra,
+                                    FL_PLACE_MOUSE, FL_FULLBORDER,
+                                    _("ParagraphExtra Layout"));
+               }
+       }
 }
 
 
 void ParagraphExtraApplyCB(FL_OBJECT *, long)
 {
-    if (current_view->getScreen() && current_view->available()) {
-        FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
-        char const * width = fl_get_input(fd->input_pextra_width);
-        char const * widthp = fl_get_input(fd->input_pextra_widthp);
-#ifdef MOVE_TEXT
-        LyXText * text = current_view->text;
-#else
-        LyXText * text = current_view->buffer()->text;
-#endif
-        int type = LyXParagraph::PEXTRA_NONE;
-       LyXParagraph::MINIPAGE_ALIGNMENT alignment =
-               LyXParagraph::MINIPAGE_ALIGN_TOP;
-        bool
-            hfill = false,
-            start_minipage = false;
+       if (current_view->getScreen() && current_view->available()) {
+               FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
+               char const * width = fl_get_input(fd->input_pextra_width);
+               char const * widthp = fl_get_input(fd->input_pextra_widthp);
+               LyXText * text = current_view->text;
+               int type = LyXParagraph::PEXTRA_NONE;
+               LyXParagraph::MINIPAGE_ALIGNMENT alignment =
+                       LyXParagraph::MINIPAGE_ALIGN_TOP;
+               bool
+                       hfill = false,
+                       start_minipage = false;
 
-        if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) {
-            type = LyXParagraph::PEXTRA_INDENT;
-        } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) {
-            type = LyXParagraph::PEXTRA_MINIPAGE;
-            hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill);
-            start_minipage = 
-                fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp);
-            if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top))
-                alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
-            else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle))
-                alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
-            else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom))
-                alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
-        } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
-            type = LyXParagraph::PEXTRA_FLOATFLT;
-        }
-        text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
-                                   start_minipage);
-#ifdef MOVE_TEXT
-       current_view->update(1);
-#else
-       current_view->buffer()->update(1);
-#endif
-       minibuffer->Set(_("ParagraphExtra layout set"));
-    }
-    return;
+               if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) {
+                       type = LyXParagraph::PEXTRA_INDENT;
+               } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) {
+                       type = LyXParagraph::PEXTRA_MINIPAGE;
+                       hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill);
+                       start_minipage = 
+                               fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp);
+                       if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top))
+                               alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
+                       else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle))
+                               alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
+                       else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom))
+                               alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
+               } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
+                       type = LyXParagraph::PEXTRA_FLOATFLT;
+               }
+               text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
+                                          start_minipage);
+               current_view->update(1);
+               minibuffer->Set(_("ParagraphExtra layout set"));
+       }
+       return;
 }
 
 
 void ParagraphExtraCancelCB(FL_OBJECT *, long)
 {
-    fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
+       fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
 }
 
 
 void ParagraphExtraOKCB(FL_OBJECT * ob, long data)
 {
-    ParagraphExtraCancelCB(ob, data);
-    ParagraphExtraApplyCB(ob, data);
+       ParagraphExtraCancelCB(ob, data);
+       ParagraphExtraApplyCB(ob, data);
 }
 
 
 void CheckPExtraOptCB(FL_OBJECT * ob, long)
 {
-    ActivateParagraphExtraButtons();
-    CheckInputWidth();
-    if (ob == fd_form_paragraph_extra->radio_pextra_indent) {
-        int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent);
-        if (n) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else {
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            ActivateParagraphExtraButtons();
-        }
-    } else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) {
-        int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage);
-        if (n) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else {
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-            ActivateParagraphExtraButtons();
-        }
-    } else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) {
-        int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt);
-        if (n) {
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
-            fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-        } else {
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
-            fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
-            fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
-            ActivateParagraphExtraButtons();
-        }
-    }
-    return;
+       ActivateParagraphExtraButtons();
+       CheckInputWidth();
+       if (ob == fd_form_paragraph_extra->radio_pextra_indent) {
+               int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent);
+               if (n) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else {
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       ActivateParagraphExtraButtons();
+               }
+       } else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) {
+               int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage);
+               if (n) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else {
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+                       ActivateParagraphExtraButtons();
+               }
+       } else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) {
+               int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt);
+               if (n) {
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
+                       fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+               } else {
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
+                       fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
+                       fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
+                       ActivateParagraphExtraButtons();
+               }
+       }
+       return;
 }
 
 
 static bool CheckInputWidth()
 {
-    string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);
-    string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp);
-    if (s1.empty() && s2.empty()) {
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-        fl_hide_object(fd_form_paragraph_extra->text_warning);
-        DeactivateParagraphExtraButtons();
-        return false;
-    }
-    if (!s1.empty()) { // LyXLength parameter
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
-        fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
-        if (!isValidLength(s1)) {
-            DeactivateParagraphExtraButtons();
-            fl_set_object_label(fd_form_paragraph_extra->text_warning,
-                                _("Warning: Invalid Length (valid example: 10mm)"));
-            fl_show_object(fd_form_paragraph_extra->text_warning);
-            return false;
-        }
-    } else { // !s2.empty() % parameter
-        fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
-        fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
-        if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
-            DeactivateParagraphExtraButtons();
-            fl_set_object_label(fd_form_paragraph_extra->text_warning,
-                                _("Warning: Invalid percent value (0-100)"));
-            fl_show_object(fd_form_paragraph_extra->text_warning);
-            return false;
-        }
-    }
-    fl_hide_object(fd_form_paragraph_extra->text_warning);
-    return true;
+       string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);
+       string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp);
+       if (s1.empty() && s2.empty()) {
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+               fl_hide_object(fd_form_paragraph_extra->text_warning);
+               DeactivateParagraphExtraButtons();
+               return false;
+       }
+       if (!s1.empty()) { // LyXLength parameter
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
+               fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
+               if (!isValidLength(s1)) {
+                       DeactivateParagraphExtraButtons();
+                       fl_set_object_label(fd_form_paragraph_extra->text_warning,
+                                           _("Warning: Invalid Length (valid example: 10mm)"));
+                       fl_show_object(fd_form_paragraph_extra->text_warning);
+                       return false;
+               }
+       } else { // !s2.empty() % parameter
+               fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
+               fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
+               if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
+                       DeactivateParagraphExtraButtons();
+                       fl_set_object_label(fd_form_paragraph_extra->text_warning,
+                                           _("Warning: Invalid percent value (0-100)"));
+                       fl_show_object(fd_form_paragraph_extra->text_warning);
+                       return false;
+               }
+       }
+       fl_hide_object(fd_form_paragraph_extra->text_warning);
+       return true;
 }
index a0ff8eb436aacffb1dd42b27d64508b55284c0e7..e73655bf0a5f36049438eddeae3f8bf52a80f52e 100644 (file)
@@ -28,15 +28,16 @@ static int Confirmed = false;
 static int ActCell;
 
 // hack to keep the cursor from jumping to the end of the text in the Extra
-// form input fields during editing. The values in LyXTable itself is changed in
-// real-time, but we have no callbacks for the input fields, so I simply
-// store and restore the cursor position for now. (too much of a hazzle to
-// do it proper; we'll trash all this code in 1.1 anyway)
+// form input fields during editing. The values in LyXTable itself is
+// changed in real-time, but we have no callbacks for the input fields,
+// so I simply store and restore the cursor position for now.
+// (too much of a hazzle to do it proper; we'll trash all this code
+// in 1.1 anyway)
 static int extra_col_cursor_x; // need no y's, one-line input fields
 static int extra_multicol_cursor_x;
 // Joacim
 
-#ifdef MOVE_TEXT
+
 bool UpdateLayoutTable(int flag)
 {
     bool update = true;
@@ -219,190 +220,7 @@ bool UpdateLayoutTable(int flag)
     }
     return update;
 }
-#else
-bool UpdateLayoutTable(int flag)
-{
-    bool update = true;
-    if (!current_view->getScreen() || !current_view->available())
-        update = false;
-    
-    if (update && current_view->buffer()->text->cursor.par->table) {
-        char buf[12];
-        string pwidth, special;
-   
-        LyXTable * table = current_view->buffer()->text->cursor.par->table;
 
-        int cell = current_view->buffer()->text->
-            NumberOfCell(current_view->buffer()->text->cursor.par, 
-                         current_view->buffer()->text->cursor.pos);
-        ActCell = cell;
-        int column = table->column_of_cell(cell)+1;
-        fl_set_object_label(fd_form_table_options->text_warning, "");
-        Confirmed = false;
-        fl_activate_object(fd_form_table_extra->input_special_alignment);
-        fl_activate_object(fd_form_table_extra->input_special_multialign);
-        fl_activate_object(fd_form_table_options->input_column_width);
-        sprintf(buf, "%d", column);
-        fl_set_input(fd_form_table_options->input_table_column, buf);
-        fl_deactivate_object(fd_form_table_options->input_table_column);
-        int row = table->row_of_cell(cell)+1;
-        sprintf(buf, "%d", row);
-        fl_set_input(fd_form_table_options->input_table_row, buf);
-        fl_deactivate_object(fd_form_table_options->input_table_row);
-        if (table->IsMultiColumn(cell))
-            fl_set_button(fd_form_table_options->radio_multicolumn, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_multicolumn, 0);
-        if (table->RotateCell(cell))
-            fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
-        if (table->TopLine(cell))
-            fl_set_button(fd_form_table_options->radio_border_top, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_border_top, 0);
-        if (table->BottomLine(cell))
-            fl_set_button(fd_form_table_options->radio_border_bottom, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_border_bottom, 0);
-        if (table->LeftLine(cell))
-            fl_set_button(fd_form_table_options->radio_border_left, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_border_left, 0);
-        if (table->RightLine(cell))
-            fl_set_button(fd_form_table_options->radio_border_right, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_border_right, 0);
-        int align = table->GetAlignment(cell);
-        fl_set_button(fd_form_table_options->radio_align_left, 0);
-        fl_set_button(fd_form_table_options->radio_align_right, 0);
-        fl_set_button(fd_form_table_options->radio_align_center, 0);
-        special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN);
-        if (flag)
-       {
-            fl_set_input(fd_form_table_extra->input_special_alignment,
-                         special.c_str());
-           fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
-                   extra_col_cursor_x, 0); // restore the cursor
-       }
-        if (current_view->buffer()->isReadonly()) 
-            fl_deactivate_object(fd_form_table_extra->input_special_alignment);
-        special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_MULTI);
-        if (flag)
-       {
-            fl_set_input(fd_form_table_extra->input_special_multialign,
-                         special.c_str());
-           fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
-                   extra_multicol_cursor_x, 0); // restore the cursor
-       }
-        if (current_view->buffer()->isReadonly()) 
-            fl_deactivate_object(fd_form_table_extra->input_special_multialign);
-        pwidth = table->GetPWidth(cell);
-        if (flag)
-            fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str());
-        if (current_view->buffer()->isReadonly()) 
-            fl_deactivate_object(fd_form_table_options->input_column_width);
-        if (!pwidth.empty()) {
-            fl_activate_object(fd_form_table_options->radio_linebreak_cell);
-           fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
-                              FL_BLACK);
-            fl_set_button(fd_form_table_options->radio_linebreak_cell,
-                          table->Linebreaks(table->FirstVirtualCell(cell)));
-        } else {
-            fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
-           fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
-                              FL_INACTIVE);
-            fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
-        }
-        if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
-            (align == LYX_ALIGN_LEFT))
-            fl_set_button(fd_form_table_options->radio_align_left, 1);
-        else if (align == LYX_ALIGN_RIGHT)
-            fl_set_button(fd_form_table_options->radio_align_right, 1);
-        else
-            fl_set_button(fd_form_table_options->radio_align_center, 1);
-        if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
-            fl_deactivate_object(fd_form_table_options->radio_align_left);
-            fl_deactivate_object(fd_form_table_options->radio_align_right);
-            fl_deactivate_object(fd_form_table_options->radio_align_center);
-           fl_set_object_lcol(fd_form_table_options->radio_align_left,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_align_right,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_align_center,
-                              FL_INACTIVE);
-        } else {
-            fl_activate_object(fd_form_table_options->radio_align_left);
-            fl_activate_object(fd_form_table_options->radio_align_right);
-            fl_activate_object(fd_form_table_options->radio_align_center);
-           fl_set_object_lcol(fd_form_table_options->radio_align_left,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_align_right,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_align_center,
-                              FL_BLACK);
-        }
-        fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTable());
-        if (table->IsLongTable()) {
-            fl_activate_object(fd_form_table_options->radio_lt_firsthead);
-            fl_activate_object(fd_form_table_options->radio_lt_head);
-            fl_activate_object(fd_form_table_options->radio_lt_foot);
-            fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
-            fl_activate_object(fd_form_table_options->radio_lt_newpage);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_head,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
-                              FL_BLACK);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
-                              FL_BLACK);
-            fl_set_button(fd_form_table_options->radio_lt_firsthead,
-                          table->RowOfLTFirstHead(cell));
-            fl_set_button(fd_form_table_options->radio_lt_head,
-                          table->RowOfLTHead(cell));
-            fl_set_button(fd_form_table_options->radio_lt_foot,
-                          table->RowOfLTFoot(cell));
-            fl_set_button(fd_form_table_options->radio_lt_lastfoot,
-                          table->RowOfLTLastFoot(cell));
-            fl_set_button(fd_form_table_options->radio_lt_newpage,
-                          table->LTNewPage(cell));
-        } else {
-            fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
-            fl_deactivate_object(fd_form_table_options->radio_lt_head);
-            fl_deactivate_object(fd_form_table_options->radio_lt_foot);
-            fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
-            fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
-            fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
-            fl_set_button(fd_form_table_options->radio_lt_head, 0);
-            fl_set_button(fd_form_table_options->radio_lt_foot, 0);
-            fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
-            fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_head,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
-                              FL_INACTIVE);
-           fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
-                              FL_INACTIVE);
-        }
-        fl_set_button(fd_form_table_options->radio_rotate_table,
-                     table->RotateTable());
-       fl_set_focus_object(fd_form_table_options->form_table_options,
-                           fd_form_table_options->button_table_delete);
-    } else if (fd_form_table_options->form_table_options->visible) {
-       fl_set_focus_object(fd_form_table_options->form_table_options,
-                           fd_form_table_options->button_table_delete);
-        fl_hide_form(fd_form_table_options->form_table_options);
-    }
-    return update;
-}
-#endif
 
 void OpenLayoutTableExtra()
 {
@@ -445,7 +263,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
     int s, num = 0;
     string special, str;
 
-#ifdef MOVE_TEXT
     if (!current_view->available()
        || !(table = current_view->text->cursor.par->table)) {
         MenuLayoutTable(0);
@@ -463,26 +280,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
        extra_multicol_cursor_x = 0;
         return;
     }
-#else
-    if (!current_view->available()
-       ||
-       !(table = current_view->buffer()->text->cursor.par->table)) {
-        MenuLayoutTable(0);
-       return;
-      }
-    int cell = current_view->buffer()->text->
-        NumberOfCell(current_view->buffer()->text->cursor.par, 
-                     current_view->buffer()->text->cursor.pos);
-    if (ActCell != cell) {
-        MenuLayoutTable(0);
-        fl_set_object_label(fd_form_table_options->text_warning,
-                            _("Warning: Wrong Cursor position, updated window"));
-        fl_show_object(fd_form_table_options->text_warning);
-       extra_col_cursor_x = 0; // would rather place it at the end, but...
-       extra_multicol_cursor_x = 0;
-        return;
-    }
-#endif
+
     // No point in processing directives that you can't do anything with
     // anyhow, so exit now if the buffer is read-only.
     if (current_view->buffer()->isReadonly()) {
@@ -622,9 +420,8 @@ void TableOptionsCB(FL_OBJECT * ob, long)
         num = LyXTable::SET_SPECIAL_MULTI;
     } else
         return;
-    if (current_view->available()){
+    if (current_view->available()) {
         current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
         if (!current_view->text->selection){
             BeforeChange(); 
             current_view->update(-2);
@@ -635,18 +432,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
         else
             current_view->text->TableFeatures(num);
         current_view->update(1);
-#else
-        if (!current_view->buffer()->text->selection){
-            BeforeChange(); 
-            current_view->buffer()->update(-2);
-        }
-        if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
-            (num == LyXTable::SET_SPECIAL_MULTI))
-            current_view->buffer()->text->TableFeatures(num, special);
-        else
-            current_view->buffer()->text->TableFeatures(num);
-        current_view->buffer()->update(1);
-#endif
     }
     if (num == LyXTable::DELETE_TABLE) {
        fl_set_focus_object(fd_form_table_options->form_table_options,
@@ -657,6 +442,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
     return;
 }
 
+
 void TableOptCloseCB(FL_OBJECT *, long)
 {
     fl_set_focus_object(fd_form_table_options->form_table_options,
@@ -673,37 +459,26 @@ void TableSpeCloseCB(FL_OBJECT *, long)
     return;
 }
 
-void SetPWidthCB(FL_OBJECT *ob, long)
+void SetPWidthCB(FL_OBJECT * ob, long)
 {
     fl_set_object_label(fd_form_table_options->text_warning, "");
     Confirmed = false;
     if (ob == fd_form_table_options->input_column_width) {
-        string
-            str;
-        str = fl_get_input(ob);
+        string str = fl_get_input(ob);
         if (!str.empty() && !isValidLength(str)) {
             fl_set_object_label(fd_form_table_options->text_warning,
-                            _("Warning: Invalid Length (valid example: 10mm)"));
+                           _("Warning: Invalid Length (valid example: 10mm)"));
             fl_show_object(fd_form_table_options->text_warning);
             return;
         }
         if (current_view->available()){
             current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
-            if (!current_view->text->selection){
+            if (!current_view->text->selection) {
                 BeforeChange(); 
                 current_view->update(-2);
             }
             current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
             current_view->update(1);
-#else
-            if (!current_view->buffer()->text->selection){
-                BeforeChange(); 
-                current_view->buffer()->update(-2);
-            }
-            current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH, str);
-            current_view->buffer()->update(1);
-#endif
         }
         MenuLayoutTable(0); // update for alignment
     }
index 155949a5668157a4f31da27d67f41b44b3c11e63..7f0986cf43e18b32093f6d5afce9ee2be0fa3413 100644 (file)
@@ -122,9 +122,6 @@ Buffer::Buffer(string const & file, LyXRC * lyxrc, bool ronly)
        filename = file;
        filepath = OnlyPath(file);
        paragraph = 0;
-#ifndef MOVE_TEXT
-       text = 0;
-#endif
        the_locking_inset = 0;
        lyx_clean = true;
        bak_clean = true;
@@ -164,9 +161,6 @@ Buffer::~Buffer()
                par = tmppar;
        }
        paragraph = 0;
-#ifndef MOVE_TEXT
-       delete text;
-#endif
 }
 
 
@@ -217,11 +211,7 @@ void Buffer::InsetUnlock()
        if (the_locking_inset) {
                if (!inset_slept) the_locking_inset->InsetUnlock();
                the_locking_inset = 0;
-#ifdef MOVE_TEXT
                users->text->FinishUndo();
-#else
-               text->FinishUndo();
-#endif
                inset_slept = false;
        }
 }
@@ -268,7 +258,6 @@ bool Buffer::insertLyXFile(string const & filen)
 
        bool res = true;
 
-#ifdef MOVE_TEXT
        if (c == '#') {
                lyxerr.debug() << "Will insert file with header" << endl;
                res = readFile(lex, users->text->cursor.par);
@@ -276,15 +265,7 @@ bool Buffer::insertLyXFile(string const & filen)
                lyxerr.debug() << "Will insert file without header" << endl;
                res = readLyXformat2(lex, users->text->cursor.par);
        }
-#else
-       if (c == '#') {
-               lyxerr.debug() << "Will insert file with header" << endl;
-               res = readFile(lex, text->cursor.par);
-       } else {
-               lyxerr.debug() << "Will insert file without header" << endl;
-               res = readLyXformat2(lex, text->cursor.par);
-       }
-#endif
+
        resize();
        return res;
 }
@@ -319,13 +300,8 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
        if(!par) {
                par = new LyXParagraph;
        } else {
-#ifdef MOVE_TEXT
                users->text->BreakParagraph();
                return_par = users->text->FirstParagraph();
-#else
-               text->BreakParagraph();
-               return_par = text->FirstParagraph();
-#endif
                pos = 0;
                markDirty();
                // We don't want to adopt the parameters from the
@@ -3160,13 +3136,9 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
 // candidate for move to BufferView
 bool Buffer::removeAutoInsets()
 {
-       LyXParagraph *par = paragraph;
+       LyXParagraph * par = paragraph;
 
-#ifdef MOVE_TEXT
        LyXCursor cursor = users->text->cursor;
-#else
-       LyXCursor cursor = text->cursor;
-#endif
        LyXCursor tmpcursor = cursor;
        cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
        cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
@@ -3176,19 +3148,11 @@ bool Buffer::removeAutoInsets()
                if (par->AutoDeleteInsets()){
                        a = true;
                        if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
-#ifdef MOVE_TEXT
                                /* this is possible now, since SetCursor takes
                                   care about footnotes */
                                users->text->SetCursorIntern(par, 0);
                                users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next());
                                users->text->FullRebreak();
-#else
-                               /* this is possible now, since SetCursor takes
-                                  care about footnotes */
-                               text->SetCursorIntern(par, 0);
-                               text->RedoParagraphs(text->cursor, text->cursor.par->Next());
-                               text->FullRebreak();
-#endif
                        }
                }
                par = par->next;
@@ -3196,11 +3160,7 @@ bool Buffer::removeAutoInsets()
        /* avoid forbidden cursor positions caused by error removing */ 
        if (cursor.pos > cursor.par->Last())
                cursor.pos = cursor.par->Last();
-#ifdef MOVE_TEXT
        users->text->SetCursorIntern(cursor.par, cursor.pos);
-#else
-       text->SetCursorIntern(cursor.par, cursor.pos);
-#endif
 
        return a;
 }
@@ -3208,11 +3168,7 @@ bool Buffer::removeAutoInsets()
 
 int Buffer::runLaTeX()
 {
-#ifdef MOVE_TEXT
        if (!users->text) return 0;
-#else
-       if (!text) return 0;
-#endif
 
        ProhibitInput();
 
@@ -3275,11 +3231,7 @@ int Buffer::runLaTeX()
 
 int Buffer::runLiterate()
 {
-#ifdef MOVE_TEXT
        if (!users->text) return 0;
-#else
-       if (!text) return 0;
-#endif
 
        ProhibitInput();
 
@@ -3348,11 +3300,7 @@ int Buffer::runLiterate()
 
 int Buffer::buildProgram()
 {
-#ifdef MOVE_TEXT
         if (!users->text) return 0;
-#else
-        if (!text) return 0;
-#endif
  
         ProhibitInput();
  
@@ -3423,11 +3371,7 @@ int Buffer::buildProgram()
 // Other flags: -wall -v0 -x
 int Buffer::runChktex()
 {
-#ifdef MOVE_TEXT
        if (!users->text) return 0;
-#else
-       if (!text) return 0;
-#endif
 
        ProhibitInput();
 
@@ -3483,13 +3427,8 @@ extern void AllFloats(char, char);
 // candidate for move to BufferView
 void Buffer::insertErrors(TeXErrors & terr)
 {
-#ifdef MOVE_TEXT
        // Save the cursor position
        LyXCursor cursor = users->text->cursor;
-#else
-       // Save the cursor position
-       LyXCursor cursor = text->cursor;
-#endif
 
        // This is drastic, but it's the only fix, I could find. (Asger)
        AllFloats(1, 0);
@@ -3511,41 +3450,23 @@ void Buffer::insertErrors(TeXErrors & terr)
 
                LyXParagraph * texrowpar = 0;
 
-#ifdef MOVE_TEXT
                if (tmpid == -1) {
                        texrowpar = users->text->FirstParagraph();
                        tmppos = 0;
                } else {
                        texrowpar = users->text->GetParFromID(tmpid);
                }
-#else
-               if (tmpid == -1) {
-                       texrowpar = text->FirstParagraph();
-                       tmppos = 0;
-               } else {
-                       texrowpar = text->GetParFromID(tmpid);
-               }
-#endif
 
                if (texrowpar == 0)
                        continue;
 
                InsetError * new_inset = new InsetError(msgtxt);
-#ifdef MOVE_TEXT
                users->text->SetCursorIntern(texrowpar, tmppos);
                users->text->InsertInset(new_inset);
                users->text->FullRebreak();
        }
        // Restore the cursor position
        users->text->SetCursorIntern(cursor.par, cursor.pos);
-#else
-               text->SetCursorIntern(texrowpar, tmppos);
-               text->InsertInset(new_inset);
-               text->FullRebreak();
-       }
-       // Restore the cursor position
-       text->SetCursorIntern(cursor.par, cursor.pos);
-#endif
 }
 
 
@@ -3559,7 +3480,6 @@ void Buffer::setCursorFromRow (int row)
 
        LyXParagraph * texrowpar;
 
-#ifdef MOVE_TEXT
        if (tmpid == -1) {
                texrowpar = users->text->FirstParagraph();
                tmppos = 0;
@@ -3567,15 +3487,6 @@ void Buffer::setCursorFromRow (int row)
                texrowpar = users->text->GetParFromID(tmpid);
        }
        users->text->SetCursor(texrowpar, tmppos);
-#else
-       if (tmpid == -1) {
-               texrowpar = text->FirstParagraph();
-               tmppos = 0;
-       } else {
-               texrowpar = text->GetParFromID(tmpid);
-       }
-       text->SetCursor(texrowpar, tmppos);
-#endif
 }
 
 
@@ -3726,37 +3637,6 @@ void Buffer::markDviDirty()
 }
 
 
-#ifndef MOVE_TEXT
-// candidate for move to BufferView
-void Buffer::update(signed char f)
-{
-       if (!users) return;
-       
-       users->owner()->updateLayoutChoice();
-       if (!text->selection && f > -3)
-               text->sel_cursor = text->cursor;
-       
-       FreeUpdateTimer();
-       text->FullRebreak();
-
-       users->update();
-
-       if (f != 3 && f != -3) {
-               users->fitCursor();
-               users->updateScrollbar();
-       }
-
-       if (f == 1 || f == -1) {
-               if (isLyxClean()) {
-                       markDirty();
-                       users->owner()->getMiniBuffer()->setTimer(4);
-               } else {
-                       markDirty();
-               }
-       }
-}
-#endif
-
 void Buffer::validate(LaTeXFeatures & features)
 {
        LyXParagraph * par = paragraph;
@@ -3868,7 +3748,7 @@ void Buffer::setOldPaperStuff()
 }
 #endif
 
-#ifdef MOVE_TEXT
+
 // candidate for move to BufferView
 void Buffer::insertInset(Inset * inset, string const & lout,
                         bool no_table)
@@ -3921,79 +3801,18 @@ void Buffer::insertInset(Inset * inset, string const & lout,
 
        users->text->UnFreezeUndo();    
 }
-#else
-void Buffer::insertInset(Inset * inset, string const & lout,
-                        bool no_table)
-{
-       // check for table/list in tables
-       if (no_table && text->cursor.par->table){
-               WriteAlert(_("Impossible Operation!"),
-                          _("Cannot insert table/list in table."),
-                          _("Sorry."));
-               return;
-       }
-       // not quite sure if we want this...
-       text->SetCursorParUndo();
-       text->FreezeUndo();
-       
-       BeforeChange();
-       if (!lout.empty()) {
-               update(-2);
-               text->BreakParagraph();
-               update(-1);
-               
-               if (text->cursor.par->Last()) {
-                       text->CursorLeft();
-                       
-                       text->BreakParagraph();
-                       update(-1);
-               }
-
-               int lay = textclasslist.NumberOfLayout(params.textclass,
-                                                      lout).second;
-               if (lay == -1) // layout not found
-                       // use default layout "Standard" (0)
-                       lay = 0;
-               
-               text->SetLayout(lay);
-               
-               text->SetParagraph(0, 0,
-                                  0, 0,
-                                  VSpace(VSpace::NONE), VSpace(VSpace::NONE),
-                                  LYX_ALIGN_LAYOUT, 
-                                  string(),
-                                  0);
-               update(-1);
-               
-               text->current_font.setLatex(LyXFont::OFF);
-       }
-       
-       text->InsertInset(inset);
-       update(-1);
 
-       text->UnFreezeUndo();   
-}
-#endif
 
 // Open and lock an updatable inset
 // candidate for move to BufferView
 void Buffer::open_new_inset(UpdatableInset * new_inset)
 {
-#ifdef MOVE_TEXT
        BeforeChange();
        users->text->FinishUndo();
        insertInset(new_inset);
        users->text->CursorLeft();
        users->update(1);
        new_inset->Edit(0, 0);
-#else
-       BeforeChange();
-       text->FinishUndo();
-       insertInset(new_inset);
-       text->CursorLeft();
-       update(1);
-       new_inset->Edit(0, 0);
-#endif
 }
 
 
@@ -4129,19 +3948,11 @@ bool Buffer::gotoLabel(string const & label)
                 while ((inset = par->ReturnNextInsetPointer(pos))){     
                         for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
                                if (label == inset->getLabel(i)) {
-#ifdef MOVE_TEXT
                                        BeforeChange();
                                        users->text->SetCursor(par, pos);
                                        users->text->sel_cursor = users->text->cursor;
                                        users->update(0);
                                        return true;
-#else
-                                       BeforeChange();
-                                       text->SetCursor(par, pos);
-                                       text->sel_cursor = text->cursor;
-                                       update(0);
-                                       return true;
-#endif
                                }
                        }
                         pos++;
index 870d697cdcbf6b50f7ee0c161701070d7ecac9fb..d27e1222c1995ba9791d93f2658751e8a705ef5d 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 /* This file is part of
-* ====================================================== 
+ * ====================================================== 
 * 
 *           LyX, The Document Processor         
 *          Copyright (C) 1995 Matthias Ettrich
@@ -34,7 +34,6 @@
 #include "lyxtext.h"
 #include "support/filetools.h"
 
-#define MOVE_TEXT 1
 
 class LyXRC;
 class TeXErrors;
@@ -73,16 +72,16 @@ public:
        //@{
 
        /** save the buffer's parameters as user default
-         This function saves a file user_lyxdir/templates/defaults.lyx 
-         which parameters are those of the current buffer. This file
-         is used as a default template when creating a new
-         file. Returns true on success.
-         */
+           This function saves a file user_lyxdir/templates/defaults.lyx 
+           which parameters are those of the current buffer. This file
+           is used as a default template when creating a new
+           file. Returns true on success.
+       */
        bool saveParamsAsDefaults();
 
        /** high-level interface to buffer functionality
-         This function parses a command string and executes it
-         */
+           This function parses a command string and executes it
+       */
        void Dispatch(const string & command);
 
        /// Maybe we know the function already by number...
@@ -90,17 +89,11 @@ public:
 
        /// should be changed to work for a list.
        void resize()
-       {
-               if (users) {
-                       users->resize();
+               {
+                       if (users) {
+                               users->resize();
+                       }
                }
-#ifndef MOVE_TEXT
-               else if (text) {
-                       delete text;
-                       text = 0;
-               }
-#endif
-       }
 
        /// Update window titles of all users
        void updateTitles();
@@ -109,26 +102,21 @@ public:
        void resetAutosaveTimers();
 
        /** Adds the BufferView to the users list.
-         Later this func will insert the BufferView into a real list,
-         not just setting a pointer.
-         */
+           Later this func will insert the BufferView into a real list,
+           not just setting a pointer.
+       */
        void addUser(BufferView * u) { users = u; }
 
        /** Removes the BufferView from the users list.
-         Since we only can have one at the moment, we just reset it.
-         */
+           Since we only can have one at the moment, we just reset it.
+       */
        void delUser(BufferView *){ users = 0; }
        
-#ifndef MOVE_TEXT
-       ///
-       void update(signed char f);
-#endif
-
        ///
        void redraw() {
-              users->redraw(); 
-              users->fitCursor(); 
-              users->updateScrollbar();
+               users->redraw(); 
+               users->fitCursor(); 
+               users->updateScrollbar();
        }
 
         /// Open and lock an updatable inset
@@ -263,16 +251,16 @@ public:
 
        /// Set buffer read-only flag
        void setReadonly(bool flag = true) 
-       {
-               if (read_only != flag) {
-                       read_only = flag; 
-                       updateTitles();
-                       updateAllVisibleBufferRelatedPopups();
+               {
+                       if (read_only != flag) {
+                               read_only = flag; 
+                               updateTitles();
+                               updateAllVisibleBufferRelatedPopups();
+                       }
+                       if (read_only) {
+                               WarnReadonly();
+                       }
                }
-               if (read_only) {
-                       WarnReadonly();
-               }
-       }
 
        /// returns true if the buffer contains a LaTeX document
        bool isLatex() const;
@@ -294,19 +282,19 @@ public:
 #endif
        
        /** Validate a buffer for LaTeX.
-         This validates the buffer, and returns a struct for use by
-         makeLaTeX and others. Its main use is to figure out what commands
-         and packages need to be included in the LaTeX file. It (should)
-         also check that the needed constructs are there (i.e. that the \refs
-         points to coresponding \labels). It should perhaps inset "error"
-         insets to help the user correct obvious mistakes.
-        */
+           This validates the buffer, and returns a struct for use by
+           makeLaTeX and others. Its main use is to figure out what commands
+           and packages need to be included in the LaTeX file. It (should)
+           also check that the needed constructs are there (i.e. that the \refs
+           points to coresponding \labels). It should perhaps inset "error"
+           insets to help the user correct obvious mistakes.
+       */
        void validate(LaTeXFeatures &); //the correct parameters to be
-                                       //included later 
+       //included later 
 
        /** Insert an inset into the buffer
-         Insert inset into buffer, placing it in a layout of lout,
-         if no_table make sure that it doesn't end up in a table. */
+           Insert inset into buffer, placing it in a layout of lout,
+           if no_table make sure that it doesn't end up in a table. */
        void insertInset(Inset *, string const & lout = string(), 
                         bool no_table = false);
 
@@ -326,7 +314,7 @@ public:
        bool removeAutoInsets();
 
        /** This will clearly have to change later. Later we can have more
-         than one user per buffer. */
+           than one user per buffer. */
        BufferView * getUser() const { return users; }
 
         //@}
@@ -344,12 +332,6 @@ public:
         */
        LyXParagraph * paragraph;
 
-#ifndef MOVE_TEXT
-       /** This holds the mapping between buffer paragraphs and screen rows.
-           Should be moved to BufferView. (Asger)
-        */
-       LyXText * text;
-#endif
        /// per view not per buffer?
        UpdatableInset * the_locking_inset;
 
@@ -453,12 +435,12 @@ private:
        float format;
        
        /** A list of views using this buffer.
-         Why not keep a list of the BufferViews that use this buffer?
+           Why not keep a list of the BufferViews that use this buffer?
 
-         At least then we don't have to do a lot of magic like:
-         buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
-         of the buffers in the list of users to do a updateLayoutChoice.
-         */
+           At least then we don't have to do a lot of magic like:
+           buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
+           of the buffers in the list of users to do a updateLayoutChoice.
+       */
        BufferView * users;
 
        /// Used when typesetting to place errorboxes.
@@ -469,28 +451,28 @@ private:
 inline  
 void Buffer::InsetSleep()
 {
-    if (the_locking_inset && !inset_slept) {
-       the_locking_inset->GetCursorPos(slx, sly);
-        the_locking_inset->InsetUnlock();
-       inset_slept = true;
-    }
+       if (the_locking_inset && !inset_slept) {
+               the_locking_inset->GetCursorPos(slx, sly);
+               the_locking_inset->InsetUnlock();
+               inset_slept = true;
+       }
 }
 
 
 inline  
 void Buffer::InsetWakeup()
 {
-    if (the_locking_inset && inset_slept) {
-       the_locking_inset->Edit(slx, sly);
-       inset_slept = false;
-    }  
+       if (the_locking_inset && inset_slept) {
+               the_locking_inset->Edit(slx, sly);
+               inset_slept = false;
+       }       
 }
 
 
 inline  
 void Buffer::setParentName(string const & name)
 {
-    params.parentname = name;    
+       params.parentname = name;    
 }
 
 #endif
index cb0ca686376cc486f261bdaab020ebef2e985fad..7532c2ac846b6e72f0263a395ed3c0601e5d6bfc 100644 (file)
@@ -58,8 +58,8 @@ void BufferStorage::release(Buffer * buf)
 
 
 Buffer * BufferStorage::newBuffer(string const & s,
-                                LyXRC * lyxrc,
-                                bool ronly)
+                                 LyXRC * lyxrc,
+                                 bool ronly)
 {
        Buffer * tmpbuf = new Buffer(s, lyxrc, ronly);
        tmpbuf->params.useClassDefaults();
@@ -104,7 +104,8 @@ bool BufferList::QwriteAll()
                                break;
                        case 2: // No
                                askMoreConfirmation = true;
-                               unsaved += MakeDisplayPath((*it)->fileName(), 50);
+                               unsaved += MakeDisplayPath((*it)->fileName(),
+                                                          50);
                                unsaved += "\n";
                                break;
                        case 3: // Cancel
@@ -152,7 +153,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
                   chmod("LyXVC3.lyx", 0100644)                    = 0
                   lseek(0, 0, SEEK_CUR)                           = 46440
                   _exit(0)
-                */
+               */
 
                // Should proabaly have some more error checking here.
                // Should be cleaned up in 0.13, at least a bit.
@@ -178,7 +179,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
                                        c_read = fread(cbuf, 1, blksize, fin);
                                        if (c_read != 0)
                                                c_write = 
-                                                       fwrite(cbuf, 1, c_read, fout);
+                                                       fwrite(cbuf, 1,
+                                                              c_read, fout);
                                } while (c_read);
                                fin.close();
                                fout.close();
@@ -189,7 +191,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
                                }
                                delete [] cbuf;
                        } else {
-                               lyxerr << "LyX was not able to make backupcopy. Beware." << endl;
+                               lyxerr << "LyX was not able to make "
+                                       "backupcopy. Beware." << endl;
                        }
                        delete[] times;
                }
@@ -253,8 +256,8 @@ bool BufferList::close(Buffer * buf)
        if (buf->paragraph && !buf->isLyxClean() && !quitting) {
                ProhibitInput();
                 switch(AskConfirmation(_("Changes in document:"),
-                              MakeDisplayPath(buf->fileName(), 50),
-                                      _("Save document?"))){
+                                      MakeDisplayPath(buf->fileName(), 50),
+                                      _("Save document?"))){
                case 1: // Yes
                        if (write(buf)) {
                                lastfiles->newFile(buf->fileName());
@@ -309,19 +312,12 @@ void BufferList::updateInset(Inset * inset, bool mark_dirty)
 {
        for (BufferStorage::iterator it = bstore.begin();
             it != bstore.end(); ++it) {
-#ifdef MOVE_TEXT
-               if ((*it)->getUser() && (*it)->getUser()->text->UpdateInset(inset)) {
+               if ((*it)->getUser()
+                   && (*it)->getUser()->text->UpdateInset(inset)) {
                        if (mark_dirty)
                                (*it)->markDirty();
                        break;
                }
-#else
-               if ((*it)->text && (*it)->text->UpdateInset(inset)) {
-                       if (mark_dirty)
-                               (*it)->markDirty();
-                       break;
-               }
-#endif
        }
 }
 
@@ -352,7 +348,6 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
                        (*it)->makeLaTeXFile(writefile, mastertmpdir,
                                             false, true);
                        (*it)->markDepClean(mastertmpdir);
-                                                    
                }
        }
 }
@@ -366,7 +361,7 @@ void BufferList::emergencyWriteAll()
                        bool madeit = false;
                        
                        lyxerr <<_("lyx: Attempting to save"
-                                     " document ")
+                                  " document ")
                               << (*it)->fileName()
                               << _(" as...") << endl;
                        
@@ -382,7 +377,9 @@ void BufferList::emergencyWriteAll()
                                } else if (i == 1) {
                                        s = AddName(GetEnvPath("HOME"),
                                                    (*it)->fileName());
-                               } else { // MakeAbsPath to prepend the current drive letter on OS/2
+                               } else {
+                                       // MakeAbsPath to prepend the current
+                                       // drive letter on OS/2
                                        s = AddName(MakeAbsPath("/tmp/"),
                                                    (*it)->fileName());
                                }
@@ -399,7 +396,9 @@ void BufferList::emergencyWriteAll()
                                        lyxerr << _("  Save failed! Trying...")
                                               << endl;
                                } else {
-                                       lyxerr << _("  Save failed! Bummer. Document is lost.") << endl;
+                                       lyxerr << _("  Save failed! Bummer. "
+                                                   "Document is lost.")
+                                              << endl;
                                }
                        }
                }
@@ -599,10 +598,10 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                if (AskQuestion(_("Cannot open specified file:"), 
                                MakeDisplayPath(s, 50),
                                _("Create new document with this name?")))
-               {
-                       // Find a free buffer
-                       b = newFile(s, string());
-               }
+                       {
+                               // Find a free buffer
+                               b = newFile(s, string());
+                       }
                break;
        }
 
index 60c935e41fc4b39ea1d431338f78299369ed1198..66cfb09b1b41f79a68ef10d6eec61fa80a5e610b 100644 (file)
@@ -35,6 +35,10 @@ bool CharacterSet::loadFile(string const & fname)
        string str;
        int n;
        string line;
+       // Ok, I'll be the first to admit that this is probably not
+       // the fastest way to parse the cdef files, but I though it
+       // was a bit neat. Anyway it is wrong to use the lyxlex parse
+       // without the use of a keyword table.     
        LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
        while(getline(ifs, line)) {
                if (reg.exact_match(line)) {
@@ -53,11 +57,20 @@ bool CharacterSet::loadFile(string const & fname)
 }
 
 
-bool CharacterSet::encodeString(string & str) const
+pair<bool, int> CharacterSet::encodeString(string & str) const
 {
+       lyxerr[Debug::KBMAP] << "Checking if we know [" << str << "]" << endl;
+       bool ret = false;
+       int val = 0;
        Cdef::const_iterator cit = map_.find(str);
-       if (cit != map_.end()) return true;
-       return false;
+       if (cit != map_.end()) {
+               ret =  true;
+               val = (*cit).second;
+       }
+       lyxerr[Debug::KBMAP] << "   "
+                            << (ret ? "yes we" : "no we don't")
+                            <<  " know [" << str << "]" << endl;
+       return make_pair(ret, val);
 }
 
 
index 30df042b0c937b61eff59e4fb2cbae60da79c838..b6256c26a34c0a3f39f1863f0f11d63f06b6b50b 100644 (file)
@@ -19,7 +19,7 @@ public:
        ///
        string const & getName() const;
        ///
-       bool encodeString(string &) const;
+       pair<bool, int> encodeString(string &) const;
 private:
        ///
        string name_;
index aa2a7f51d97d35060681c4bb025dfb36298fc489..18db37def68d80d99cd57c6379e98898c07310e4 100644 (file)
@@ -77,8 +77,8 @@ void PutInsetIntoInsetUpdateList(Inset * inset);
 extern void ProhibitInput();
 extern void AllowInput();
 
-#define DEG2PI 57.295779513
-#define figallocchunk 32
+static float const DEG2PI = 57.295779513;
+static int const figallocchunk = 32;
 
 static int figinsref = 0;      /* number of figures */
 static int figarrsize = 0;     /* current max number of figures */
@@ -97,7 +97,7 @@ struct pidwait {
        pidwait * next; /* next */
 };
 
-#define MAXGS 3                        /* maximum 3 gs's at a time */
+static int const MAXGS = 3;                    /* maximum 3 gs's at a time */
 
 static Figref ** figures;      /* all the figures */
 static figdata ** bitmaps;     /* all the bitmaps */
@@ -141,7 +141,7 @@ void addpidwait(int pid)
 
 
 extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
-                  XEvent * ev, void *)
+                             XEvent * ev, void *)
 {
        char tmp[128];
 
@@ -153,6 +153,7 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
        }
 
        // just kill gs, that way it will work for sure
+       // This loop looks like S**T so it probably is...
        for (int i = 0; i < bmpinsref; ++i)
                if ((long)bitmaps[i]->bitmap == (long)e->data.l[1]) {
                        // found the one
@@ -160,7 +161,8 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
                        p->gsdone = true;
 
                        // first update p->bitmap, if necessary
-                       if (p->bitmap != None && p->flags > (1|8) && gs_color && p->wid) {
+                       if (p->bitmap != None
+                           && p->flags > (1|8) && gs_color && p->wid) {
                                // query current colormap and re-render
                                // the pixmap with proper colors
                                //XColor * cmap;
@@ -172,8 +174,10 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
                                Display * tmpdisp;
                                GC gc = getGC(gc_copy);
 
-                               XGetWindowAttributes(fl_display, fl_get_canvas_id(
-                                       figinset_canvas), &wa);
+                               XGetWindowAttributes(fl_display,
+                                                    fl_get_canvas_id(
+                                                            figinset_canvas),
+                                                    &wa);
                                XFlush(fl_display);
                                if (lyxerr.debugging()) {
                                        lyxerr << "Starting image translation "
@@ -217,36 +221,39 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
                                {
                                // query current colormap
                                //cmap = (XColor *) malloc(gs_allcolors*sizeof(XColor));
-                               XColor * cmap = new XColor[gs_allcolors];
-                               for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
-                               XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
-                               XFlush(tmpdisp);
-                               wid1 = p->wid - 1;
+                                       XColor * cmap = new XColor[gs_allcolors];
+                                       for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
+                                       XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
+                                       XFlush(tmpdisp);
+                                       wid1 = p->wid - 1;
                                // now we process all the image
-                               for (y = 0; y < p->hgh; ++y) {
-                                       for (int x = 0; x < wid; ++x) {
-                                               XColor * pc = cmap +
-                                                       XGetPixel(im, x, y);
-                                               XFlush(tmpdisp);
-                                               XPutPixel(im, x, y,
-                                                         gs_pixels[((pc->red+6553)*
-                                                                              spc1/65535)*spc2+((pc->green+6553)*
-                                                                                                spc1/65535)*gs_spc+((pc->blue+6553)*
-                                                                                                                    spc1/65535)]);
-                                               XFlush(tmpdisp);
+                                       for (y = 0; y < p->hgh; ++y) {
+                                               for (int x = 0; x < wid; ++x) {
+                                                       XColor * pc = cmap +
+                                                               XGetPixel(im, x, y);
+                                                       XFlush(tmpdisp);
+                                                       XPutPixel(im, x, y,
+                                                                 gs_pixels[((pc->red+6553)*
+                                                                            spc1/65535)*spc2+((pc->green+6553)*
+                                                                                              spc1/65535)*gs_spc+((pc->blue+6553)*
+                                                                                                                  spc1/65535)]);
+                                                       XFlush(tmpdisp);
+                                               }
                                        }
-                               }
                                // This must be correct.
-                               delete [] cmap;
-                               if (lyxerr.debugging()) {
-                                       lyxerr << "Putting image back" << endl;
-                               }
-                               XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0,
-                                         0, 0, p->wid, p->hgh);
-                               XDestroyImage(im);
-                               if (lyxerr.debugging()) {
-                                       lyxerr << "Done translation" << endl;
-                               }
+                                       delete [] cmap;
+                                       if (lyxerr.debugging()) {
+                                               lyxerr << "Putting image back"
+                                                      << endl;
+                                       }
+                                       XPutImage(tmpdisp, p->bitmap,
+                                                 gc, im, 0, 0,
+                                                 0, 0, p->wid, p->hgh);
+                                       XDestroyImage(im);
+                                       if (lyxerr.debugging()) {
+                                               lyxerr << "Done translation"
+                                                      << endl;
+                                       }
                                }
                          noim:
                                if (lyxerr.debugging()) {
@@ -284,9 +291,6 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
 static void AllocColors(int num)
 // allocate color cube numxnumxnum, if possible
 {
-       XColor xcol;
-       int i;
-
        if (lyxerr.debugging()) {
                lyxerr << "Allocating color cube " << num
                       << 'x' << num << 'x' << num << endl;
@@ -298,10 +302,11 @@ static void AllocColors(int num)
                return;
        }
        if (num > 5) num = 5;
-       for (i = 0; i < num*num*num; ++i) {
-               xcol.red = 65535*(i/(num*num))/(num-1);
-               xcol.green = 65535*((i/num) % num)/(num-1);
-               xcol.blue = 65535*(i % num)/(num-1);
+       XColor xcol;
+       for (int i = 0; i < num * num * num; ++i) {
+               xcol.red = 65535 * (i / (num * num)) / (num - 1);
+               xcol.green = 65535 * ((i / num) % num) / (num - 1);
+               xcol.blue = 65535 * (i % num) / (num - 1);
                xcol.flags = DoRed | DoGreen | DoBlue;
                if (!XAllocColor(fl_display, color_map, &xcol)) {
                        if (i) XFreeColors(fl_display, color_map,
@@ -310,7 +315,7 @@ static void AllocColors(int num)
                                lyxerr << "Cannot allocate color cube "
                                       << num << endl;;
                        }
-                       AllocColors(num-1);
+                       AllocColors(num - 1);
                        return;
                }
                gs_pixels[i] = xcol.pixel;
@@ -318,18 +323,16 @@ static void AllocColors(int num)
        gs_color = true;
        gs_gray = false;
        gs_spc = num;
-       gs_num_pixels = num*num*num;
+       gs_num_pixels = num * num * num;
 }
 
 
-static void AllocGrays(int num)
 // allocate grayscale ramp
+static
+void AllocGrays(int num)
 {
-       XColor xcol;
-       int i;
-
        if (lyxerr.debugging()) {
-               lyxerr << "Allocating grayscale ramp "
+               lyxerr << "Allocating grayscale colormap "
                       << num << endl;
        }
 
@@ -339,8 +342,9 @@ static void AllocGrays(int num)
                return;
        }
        if (num > 128) num = 128;
-       for (i = 0; i < num; ++i) {
-               xcol.red = xcol.green = xcol.blue = 65535*i/(num-1);
+       XColor xcol;
+       for (int i = 0; i < num; ++i) {
+               xcol.red = xcol.green = xcol.blue = 65535 * i / (num - 1);
                xcol.flags = DoRed | DoGreen | DoBlue;
                if (!XAllocColor(fl_display, color_map, &xcol)) {
                        if (i) XFreeColors(fl_display, color_map,
@@ -349,7 +353,7 @@ static void AllocGrays(int num)
                                lyxerr << "Cannot allocate grayscale " 
                                       << num << endl;
                        }
-                       AllocGrays(num/2);
+                       AllocGrays(num / 2);
                        return;
                }
                gs_pixels[i] = xcol.pixel;
@@ -362,16 +366,16 @@ static void AllocGrays(int num)
 
 void InitFigures()
 {
-       unsigned int i, j, k;
-       Visual *vi;
-
        bmparrsize = figarrsize = figallocchunk;
-       figures = static_cast<Figref**>(malloc(sizeof(Figref*)*figallocchunk));
-       bitmaps = static_cast<figdata**>(malloc(sizeof(figdata*)*figallocchunk));
+       figures = static_cast<Figref**>
+               (malloc(sizeof(Figref*) * figallocchunk));
+       bitmaps = static_cast<figdata**>
+               (malloc(sizeof(figdata*) * figallocchunk));
 
-       for (i = 0; i < 256; ++i) {
+       unsigned int k;
+       for (unsigned int i = 0; i < 256; ++i) {
                k = 0;
-               for (j = 0; j < 8; ++j)
+               for (unsigned int j = 0; j < 8; ++j)
                        if (i & (1 << (7-j))) k |= 1 << j;
                bittable[i] = char(~k);
        }
@@ -386,16 +390,16 @@ void InitFigures()
        // first get visual
        gs_color = false;
 
-       vi = DefaultVisual(fl_display, DefaultScreen(fl_display));
+       Visual * vi = DefaultVisual(fl_display, DefaultScreen(fl_display));
        if (lyxerr.debugging()) {
                printf("Visual ID: %ld, class: %d, bprgb: %d, mapsz: %d\n", 
                       vi->visualid, vi->c_class, 
                       vi->bits_per_rgb, vi->map_entries);
        }
        color_visual = ( (vi->c_class == StaticColor) ||
-               (vi->c_class == PseudoColor) ||
-               (vi->c_class == TrueColor) ||
-               (vi->c_class == DirectColor) );
+                        (vi->c_class == PseudoColor) ||
+                        (vi->c_class == TrueColor) ||
+                        (vi->c_class == DirectColor) );
        if ((vi->c_class & 1) == 0) return;
        // now allocate colors
        if (vi->c_class == GrayScale) {
@@ -404,7 +408,7 @@ void InitFigures()
        } else {
                // allocate normal color
                int i = 5;
-               while (i*i*i*2 > vi->map_entries) --i;
+               while (i * i * i * 2 > vi->map_entries) --i;
                AllocColors(i);
        }
        gs_allcolors = vi->map_entries;
@@ -432,7 +436,7 @@ void DoneFigures()
 }
 
 
-int FindBmpIndex(figdata *tmpdata)
+int FindBmpIndex(figdata * tmpdata)
 {
        int i = 0;
        while (i < bmpinsref) {
@@ -456,7 +460,7 @@ static void chpixmap(Pixmap, int, int)
 }
 
 
-static void freefigdata(figdata *tmpdata)
+static void freefigdata(figdata * tmpdata)
 {
        tmpdata->ref--;
        if (tmpdata->ref) return;
@@ -478,7 +482,7 @@ static void freefigdata(figdata *tmpdata)
        int i = FindBmpIndex(tmpdata);
        --bmpinsref;
        while (i < bmpinsref) {
-               bitmaps[i] = bitmaps[i+1];
+               bitmaps[i] = bitmaps[i + 1];
                ++i;
        }
 }
@@ -557,7 +561,8 @@ static void runqueue()
                        // now set up ghostview property on a window
                        sprintf(tbuf, "0 0 0 0 %d %d 72 72 0 0 0 0",
                                p->data->wid, p->data->hgh);
-//#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer!
+                       // #warning BUG seems that the only bug here
+                       // might be the hardcoded dpi.. Bummer!
                        
                        if (lyxerr.debugging()) {
                                lyxerr << "Will set GHOSTVIEW property to ["
@@ -566,35 +571,37 @@ static void runqueue()
                        // wait until property is deleted if executing multiple
                        // ghostscripts
                        for (;;) {
-                               // grab server to prevent other child interfering
-                               // with setting GHOSTVIEW property
+                               // grab server to prevent other child
+                               // interfering with setting GHOSTVIEW property
                                if (lyxerr.debugging()) {
-                                       lyxerr << "Grabbing the server" << endl;
+                                       lyxerr << "Grabbing the server"
+                                              << endl;
                                }
                                XGrabServer(tempdisp);
-                               prop = XListProperties(tempdisp, fl_get_canvas_id(
+                               prop = XListProperties(tempdisp,
+                                                      fl_get_canvas_id(
                                        figinset_canvas), &nprop);
                                if (!prop) break;
 
                                bool err = true;
                                for (i = 0; i < nprop; ++i) {
-                                       char * p = XGetAtomName(tempdisp, prop[i]);
+                                       char * p = XGetAtomName(tempdisp,
+                                                               prop[i]);
                                        if (strcmp(p, "GHOSTVIEW") == 0) {
                                                err = false;
                                                break;
                                        }
                                        XFree(p);
                                }
-                               XFree(reinterpret_cast<char *>(prop));    /* jc: */
+                               XFree(reinterpret_cast<char *>(prop)); // jc:
                                if (err) break;
                                // release the server
                                XUngrabServer(tempdisp);
                                XFlush(tempdisp);
-                               // ok, property found, we must wait until ghostscript
-                               // deletes it
+                               // ok, property found, we must wait until
+                               // ghostscript deletes it
                                if (lyxerr.debugging()) {
-                                       lyxerr << "Releasing the server" << endl;
-                                       lyxerr << "["
+                                       lyxerr << "Releasing the server\n["
                                               << getpid()
                                               << "] GHOSTVIEW property"
                                                " found. Waiting." << endl;
@@ -644,7 +651,8 @@ static void runqueue()
 
                        XChangeProperty(tempdisp, 
                                        fl_get_canvas_id(figinset_canvas),
-                                       XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false),
+                                       XInternAtom(tempdisp,
+                                                   "GHOSTVIEW_COLORS", false),
                                        XInternAtom(tempdisp, "STRING", false),
                                        8, PropModeReplace, 
                                        reinterpret_cast<unsigned char*>(tbuf),
@@ -658,9 +666,10 @@ static void runqueue()
 
                        // set up environment
                        while (environ[ne]) ++ne;
-                       env = static_cast<char **>(malloc(sizeof(char*)*(ne+2)));
+                       env = static_cast<char **>
+                               (malloc(sizeof(char*) * (ne + 2)));
                        env[0] = tbuf2;
-                       memcpy(&env[1], environ, sizeof(char*)*(ne+1));
+                       memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
                        environ = env;
 
                        // now make gs command
@@ -676,8 +685,9 @@ static void runqueue()
                        sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
                                int(getpid()));
                        if (lyxerr.debugging()) {
-                               printf("starting gs %s %s, pid: %d\n", tbuf,
-                                      p->data->fname.c_str(), int(getpid()));
+                               lyxerr << "starting gs " << tbuf << " "
+                                      << p->data->fname
+                                      << ", pid: " << getpid() << endl;
                        }
 
                        int err = execlp(lyxrc->ps_command.c_str(), 
@@ -710,14 +720,14 @@ static void runqueue()
 }
 
 
-static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data)
+static void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
 {
        // recompute the stuff and put in the queue
        queue * p = new queue;
        p->ofsx = psx;
        p->ofsy = psy;
-       p->rx = (float(data->raw_wid) * 72.0)/pswid;
-       p->ry = (float(data->raw_hgh) * 72.0)/pshgh;
+       p->rx = (float(data->raw_wid) * 72.0) / pswid;
+       p->ry = (float(data->raw_hgh) * 72.0) / pshgh;
 
        p->data = data;
        p->next = 0;
@@ -758,8 +768,10 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
        if (bmpinsref > bmparrsize) {
                // allocate more space
                bmparrsize += figallocchunk;
-               figdata ** tmp = static_cast<figdata**>(malloc(sizeof(figdata*)*bmparrsize));
-               memcpy(tmp, bitmaps, sizeof(figdata*)*(bmparrsize-figallocchunk));
+               figdata ** tmp = static_cast<figdata**>
+                       (malloc(sizeof(figdata*) * bmparrsize));
+               memcpy(tmp, bitmaps,
+                      sizeof(figdata*) * (bmparrsize - figallocchunk));
                free(bitmaps);
                bitmaps = tmp;
        }
@@ -804,13 +816,13 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
 }
 
 
-static void getbitmap(figdata *p)
+static void getbitmap(figdata * p)
 {
        p->gspid = -1;
 }
 
 
-static void makeupdatelist(figdata *p)
+static void makeupdatelist(figdata * p)
 {
        for (int i = 0; i < figinsref; ++i)
                if (figures[i]->data == p) {
@@ -933,8 +945,10 @@ static void RegisterFigure(InsetFig *fi)
        if (figinsref > figarrsize) {
                // allocate more space
                figarrsize += figallocchunk;
-               Figref **tmp = static_cast<Figref**>(malloc(sizeof(Figref*)*figarrsize));
-               memcpy(tmp, figures, sizeof(Figref*)*(figarrsize-figallocchunk));
+               Figref ** tmp = static_cast<Figref**>
+                       (malloc(sizeof(Figref*)*figarrsize));
+               memcpy(tmp, figures,
+                      sizeof(Figref*)*(figarrsize-figallocchunk));
                free(figures);
                figures = tmp;
        }
@@ -1082,12 +1096,12 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
                               int(x),
                               baseline - hgh - 1, wid+1, hgh+1);
                if (figure && figure->data) {
-                 if (figure->data->broken)  msg = _("[render error]");
-                 else if (figure->data->reading) msg = _("[rendering ... ]");
+                       if (figure->data->broken)  msg = _("[render error]");
+                       else if (figure->data->reading) msg = _("[rendering ... ]");
                } else 
-                 if (fname.empty()) msg = _("[no file]");
-                 else if ((flags & 3) == 0) msg = _("[not displayed]");
-                 else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
+                       if (fname.empty()) msg = _("[no file]");
+                       else if ((flags & 3) == 0) msg = _("[not displayed]");
+                       else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
 
                if (!msg) msg = _("[unknown error]");
                
@@ -1095,8 +1109,8 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
                font.setSize (LyXFont::SIZE_FOOTNOTE);
                string justname = OnlyFilename (fname);
                font.drawString(justname, pm,
-                              baseline - font.maxAscent() - 4,
-                              int(x) + 8);
+                               baseline - font.maxAscent() - 4,
+                               int(x) + 8);
                font.setSize (LyXFont::SIZE_TINY);
                font.drawText (msg, strlen(msg), pm,
                               baseline - 4,
@@ -1112,9 +1126,9 @@ void InsetFig::Write(ostream & os)
        Regenerate();
        os << "Figure size " << wid << " " << hgh << "\n";
        if (!fname.empty()) {
-         string buf1 = OnlyPath(owner->fileName());
-         string fname2 = MakeRelPath(fname, buf1);
-         os << "file " << fname2 << "\n";
+               string buf1 = OnlyPath(owner->fileName());
+               string fname2 = MakeRelPath(fname, buf1);
+               os << "file " << fname2 << "\n";
        }
        if (!subcaption.empty())
                os << "subcaption " << subcaption << "\n";
@@ -1234,7 +1248,7 @@ int InsetFig::Linuxdoc(string &/*file*/)
 
 int InsetFig::DocBook(string & file)
 {
-       string figurename= fname;
+       string figurename = fname;
 
        if(suffixIs(figurename, ".eps"))
                figurename.erase(fname.length() - 5);
@@ -1320,7 +1334,8 @@ Inset * InsetFig::Clone() const
        tmp->pshgh = pshgh;
        tmp->fname = fname;
        if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) { 
-         // do not display if there is "do not display" chosen (Matthias 260696)
+               // do not display if there is
+               // "do not display" chosen (Matthias 260696)
                tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy,
                                               pswid, pshgh, raw_wid, raw_hgh,
                                               angle, flags & (3|8));
@@ -1453,7 +1468,7 @@ void InsetFig::Regenerate()
        if (subfigure) {
                if (!subcaption.empty())
                        cmdbuf = "\\subfigure[" + subcaption +
-                         "]{" + cmdbuf + "}";
+                               "]{" + cmdbuf + "}";
                else
                        cmdbuf = "\\subfigure{" + cmdbuf + "}";
        }
@@ -1584,7 +1599,7 @@ void InsetFig::TempRegenerate()
        if (!recmd.empty()) cmdbuf += '}';
        if (psubfigure && !tsubcap.empty()) {
                cmdbuf = string("\\subfigure{") + tsubcap
-                 + string("}{") + cmdbuf + "}";
+                       + string("}{") + cmdbuf + "}";
        }
 }
 
@@ -1646,7 +1661,8 @@ void InsetFig::Recompute()
                        // compiler warnings.  
                         break;
                }
-               if (htype && !wtype && frame_hgh) newx = newy*frame_wid/frame_hgh;
+               if (htype && !wtype && frame_hgh)
+                       newx = newy*frame_wid/frame_hgh;
        } else {
                newx = wid;
                newy = hgh;
@@ -1682,7 +1698,8 @@ void InsetFig::Recompute()
                figdata * pf = figure->data;
 
                // get new data
-               if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) {
+               if (!fname.empty() && (flags & 3)
+                   && !lyxrc->ps_command.empty()) {
                        // do not display if there is "do not display"
                        // chosen (Matthias 260696)
                        figure->data = getfigdata(wid, hgh, fname,
@@ -1779,7 +1796,7 @@ void InsetFig::CallbackFig(long arg)
        char const * p;
 
        if (lyxerr.debugging()) {
-               printf("Figure callback, arg %ld\n", arg);
+               lyxerr << "Figure callback, arg " << arg << endl;
        }
 
        switch (arg) {
@@ -2123,15 +2140,15 @@ void InsetFig::BrowseFile()
                buf = MakeAbsPath(p, buf2);
                buf = OnlyPath(buf);
        } else {
-         buf = OnlyPath(owner->fileName().c_str());
+               buf = OnlyPath(owner->fileName().c_str());
        }
        
        // Does user clipart directory exist?
        string bufclip = AddName (user_lyxdir, "clipart");      
        FileInfo fileInfo(bufclip);
        if (!(fileInfo.isOK() && fileInfo.isDir()))
-         // No - bail out to system clipart directory
-         bufclip = AddName (system_lyxdir, "clipart"); 
+               // No - bail out to system clipart directory
+               bufclip = AddName (system_lyxdir, "clipart");   
 
 
        fileDlg.SetButton(0, _("Clipart"), bufclip); 
@@ -2141,7 +2158,8 @@ void InsetFig::BrowseFile()
        do {
                ProhibitInput();
                if (once) {
-                       p = fileDlg.Select(_("EPS Figure"), current_figure_path,
+                       p = fileDlg.Select(_("EPS Figure"),
+                                          current_figure_path,
                                           "*ps", string());
                } else {
                        p = fileDlg.Select(_("EPS Figure"), buf,
@@ -2157,11 +2175,13 @@ void InsetFig::BrowseFile()
                
                if (contains(p, "#") || contains(p, "~") || contains(p, "$")
                    || contains(p, "%") || contains(p, " ")) 
-               {
-                       WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format
-                                  _("space, '#', '~', '$' or '%'.")); 
-                       error = true;
-               }
+                       {
+                               WriteAlert(_("Filename can't contain any "
+                                            "of these characters:"),
+                                          // xgettext:no-c-format
+                                          _("space, '#', '~', '$' or '%'.")); 
+                               error = true;
+                       }
        } while (error);
 
        if (form) fl_set_input(form->EpsFile, buf.c_str());
index d20d627ec41a32e78c74ca8305631ecf3f4cb770..19f9100170538b30244b03223f433ddd76ca6006 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include <fstream>
@@ -28,7 +27,7 @@ FD_citation_form * citation_form = 0;
 FD_bibitem_form * bibitem_form = 0;
 static Combox * bibcombox = 0;
 
-extern void UpdateInset(Inset* inset, bool mark_dirty = true);
+extern void UpdateInset(Inset * inset, bool mark_dirty = true);
 void BibitemUpdate(Combox *);
 FD_citation_form * create_form_citation_form(void);
 FD_bibitem_form * create_form_bibitem_form(void);
@@ -56,18 +55,13 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
        case 3: // OK, bibitem
         {
                if(!current_view->buffer()->isReadonly()) {
-                       InsetCommand *inset = static_cast<InsetCommand*>(bibitem_form->bibitem_form->u_vdata);
+                       InsetCommand * inset = static_cast<InsetCommand*>(bibitem_form->bibitem_form->u_vdata);
                        inset->setContents(fl_get_input(bibitem_form->key));
                        inset->setOptions(fl_get_input(bibitem_form->label));
                        fl_hide_form(bibitem_form->bibitem_form);
                        // Does look like a hack? It is! (but will change at 0.13)
-#ifdef MOVE_TEXT
                        current_view->text->RedoParagraph();
                        current_view->update(1);
-#else
-                       current_view->buffer()->text->RedoParagraph();
-                       current_view->buffer()->update(1);
-#endif
                        break;
                } // fall through to Cancel on RO-mode
         }
@@ -81,27 +75,27 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
 FD_citation_form * create_form_citation_form(void)
 {
        FL_OBJECT * obj;
-       FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation_form));
+       FD_citation_form * fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation_form));
 
        fdui->citation_form = fl_bgn_form(FL_NO_BOX, 220, 130);
        obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, "");
        fdui->key = obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 60, 30, _("Key:"));
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-         fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
 
        bibcombox = new Combox(FL_COMBOX_INPUT);
        bibcombox->add(80, 10, 130, 30, 120);
 
        obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-         fl_set_object_callback(obj, bibitem_cb, 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_callback(obj, bibitem_cb, 1);
        obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
-         fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-         fl_set_object_callback(obj, bibitem_cb, 0);
+       fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_callback(obj, bibitem_cb, 0);
        fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Remark:|#R")));
-         fl_set_input_shortcut(obj, scex(_("Remark:|#R")), 1);
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_input_shortcut(obj, scex(_("Remark:|#R")), 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
        fl_end_form();
 
        //fdui->citation_form->fdui = fdui;
@@ -113,23 +107,23 @@ FD_citation_form * create_form_citation_form(void)
 FD_bibitem_form * create_form_bibitem_form(void)
 {
        FL_OBJECT * obj;
-       FD_bibitem_form *fdui = (FD_bibitem_form *) fl_calloc(1, sizeof(FD_bibitem_form));
+       FD_bibitem_form * fdui = (FD_bibitem_form *) fl_calloc(1, sizeof(FD_bibitem_form));
 
        fdui->bibitem_form = fl_bgn_form(FL_NO_BOX, 220, 130);
        obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, "");
        fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 80, 10, 130, 30, idex(_("Key:|#K")));
-         fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1);
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
        obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-         fl_set_object_callback(obj, bibitem_cb, 3);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_callback(obj, bibitem_cb, 3);
        obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
-         fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-         fl_set_object_callback(obj, bibitem_cb, 2);
+       fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_callback(obj, bibitem_cb, 2);
        fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Label:|#L")));
-         fl_set_input_shortcut(obj, scex(_("Label:|#L")), 1);
-         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_input_shortcut(obj, scex(_("Label:|#L")), 1);
+       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
        fl_end_form();
 
        //fdui->bibitem_form->fdui = fdui;
@@ -175,7 +169,8 @@ void InsetCitation::Edit(int, int)
        if (citation_form->citation_form->visible) {
                fl_raise_form(citation_form->citation_form);
        } else {
-               fl_show_form(citation_form->citation_form, FL_PLACE_MOUSE, FL_FULLBORDER,
+               fl_show_form(citation_form->citation_form,
+                            FL_PLACE_MOUSE, FL_FULLBORDER,
                             _("Citation"));
        }   
 }
@@ -215,7 +210,7 @@ InsetBibKey::~InsetBibKey()
 {
        if(bibitem_form && bibitem_form->bibitem_form
           && bibitem_form->bibitem_form->visible)
-                               fl_hide_form(bibitem_form->bibitem_form);
+               fl_hide_form(bibitem_form->bibitem_form);
 }
 
 void InsetBibKey::setCounter(int c) 
@@ -484,7 +479,7 @@ int bibitemMaxWidth(LyXFont const & font)
        while (par) {
                if (par->bibkey) {
                        int wx = par->bibkey->Width(font);
-                       if (wx>w) w = wx;
+                       if (wx > w) w = wx;
                }
                par = par->next;
        }
@@ -504,7 +499,7 @@ string bibitemWidthest()
        while (par) {
                if (par->bibkey) {
                        int wx = par->bibkey->Width(font);
-                       if (wx>w) {
+                       if (wx > w) {
                                w = wx;
                                bkey = par->bibkey;
                        }
index 8b018478a1b5bce07392a864c462395ddbd3db15..53df124be154231dec531760ec1b2188e8fc6323 100644 (file)
@@ -24,7 +24,7 @@ extern LyXRC * lyxrc;
 
 /* LatexAccent. Proper handling of accented characters */
 /* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
-/* Later modified by Lars G. Bjonnes, larsbj@ifi.uio.no */
+/* Later modified by Lars G. Bjønnes, larsbj@lyx.org */
 
 InsetLatexAccent::InsetLatexAccent()
 {
@@ -33,13 +33,13 @@ InsetLatexAccent::InsetLatexAccent()
 
 
 InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
-    : Inset(), contents(other.contents),
-      candisp(other.candisp),
-      modtype(other.modtype),
-      remdot(other.remdot),
-      plusasc(other.plusasc),
-      plusdesc(other.plusdesc),
-      ic(other.ic)
+       : Inset(), contents(other.contents),
+         candisp(other.candisp),
+         modtype(other.modtype),
+         remdot(other.remdot),
+         plusasc(other.plusasc),
+         plusdesc(other.plusdesc),
+         ic(other.ic)
 {}
 
 
@@ -199,7 +199,7 @@ void InsetLatexAccent::checkContents()
 
        // special clause for \i{}, \j{} \l{} and \L{}
        if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J
-               || modtype == lSLASH || modtype == LSLASH)
+            || modtype == lSLASH || modtype == LSLASH)
            && contents[3] == '}' ) {
                switch (modtype) {
                case DOT_LESS_I: ic = 'i'; break;
@@ -218,7 +218,7 @@ void InsetLatexAccent::checkContents()
                               << ", bot: " << plusdesc 
                               << ", dot: " << remdot 
                               << ", mod: " << modtype << endl;
-       // Special case for space
+               // Special case for space
        } else if (contents[3] == '}') {
                ic = ' ';
        } else {
@@ -235,15 +235,16 @@ void InsetLatexAccent::checkContents()
                        else
                                return;
                } else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') {
-                   // Do a rewrite: \<foo>{i} --> \<foo>{\i}
-                   string temp = contents;
-                   temp.erase(3, string::npos);
-                   temp += '\\';
-                   temp += char(ic);
-                   for(string::size_type j = 4; j < contents.length(); ++j)
+                       // Do a rewrite: \<foo>{i} --> \<foo>{\i}
+                       string temp = contents;
+                       temp.erase(3, string::npos);
+                       temp += '\\';
+                       temp += char(ic);
+                       for(string::size_type j = 4;
+                           j < contents.length(); ++j)
                                temp+= contents[j];
-                   contents= temp;
-                   ++i;
+                       contents= temp;
+                       ++i;
                        remdot = true;
                }    
 
@@ -320,9 +321,9 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
 
 
 bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
-                           LyXScreen & scr,
-                           int baseline, 
-                           float & x)
+                                       LyXScreen & scr,
+                                       int baseline, 
+                                       float & x)
 {
        unsigned char tmpic = ic;
        
@@ -337,8 +338,8 @@ bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
        }
        case BREVE:
        {       if (ic == 'g') tmpic = 0xf0;
-               if (ic == 'G') tmpic = 0xd0;
-               break;
+       if (ic == 'G') tmpic = 0xd0;
+       break;
        }
        case UMLAUT:
        {
@@ -476,7 +477,7 @@ void InsetLatexAccent::Draw(LyXFont font,
                case UNDERDOT:     // underdot
                case DOT:    // dot
                {
-                       scr.drawArc(pgc, int(x2), y + (hg / 2.0),
+                       scr.fillArc(pgc, int(x2), y + (hg / 2.0),
                                    1, 1, 0, 360*64); 
                        break;
                }
@@ -541,9 +542,9 @@ void InsetLatexAccent::Draw(LyXFont font,
                {
                        float tmpadd = y;
                        tmpadd += (remdot) ?
-                               asc/3.0 :
-                               asc/5.0; // if (remdot) -> i or j
-                       float rad = ((hg * 4.0) / 8.0);
+                               asc / 3.0 :
+                               asc / 5.0; // if (remdot) -> i or j
+                       float rad = hg / 2.0;
                        if (rad <= 1.0) {
                                scr.drawPoint(pgc,
                                              int(x2 - ((4.0 * hg) / 7.0)),
@@ -552,12 +553,15 @@ void InsetLatexAccent::Draw(LyXFont font,
                                              int(x2 + ((4.0 * hg) / 7.0)),
                                              tmpadd);
                        } else {
-                               scr.drawArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
+                               rad += .5; // this ensures that f.ex. 1.5 will
+                               // not be rounded down to .5 and then
+                               // converted to int = 0
+                               scr.fillArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
                                            tmpadd,
-                                           rad - 1, rad - 1, 0, 360*64);
-                               scr.drawArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
+                                           rad, rad, 0, 360*64);
+                               scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
                                            tmpadd,
-                                           rad - 1, rad - 1, 0, 360*64);
+                                           rad, rad, 0, 360*64);
                        }
                        break;
                }
index f59e997cba1391a92adbc7614aa3e78cfed1b541..eebc879f390c03aa9e04f27248228f06c83a3252 100644 (file)
@@ -37,8 +37,8 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code);
 
 Intl::Intl()
        : prim_lang(lyxrc->primary_kbmap), 
-         sec_lang(lyxrc->secondary_kbmap),
-         trans(new TransManager)
+       sec_lang(lyxrc->secondary_kbmap),
+       trans(new TransManager)
 {
        keymapon = lyxrc->use_kbmap;
        chsetcode = 0;
index 4b04792a8d5e39387aec09ca7890d6d55bd5f848..ca24e92654a4f0d081e2156682944eec3cb2033d 100644 (file)
@@ -39,31 +39,17 @@ enum { ModsMask = ShiftMask | ControlMask | Mod1Mask};
               maxlen - length of string (including '\0')
    Returns   : length of printed string if ok, 0 otherwise.
 \* ---F------------------------------------------------------------------- */
-
 static
-int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
+void printKeysym( KeySym key, unsigned int mod, string & buf)
 {
        mod &= ModsMask;
 
-       // calc required length;
-       int len = 0;
-       if ( mod & ShiftMask )   len += 2;
-       if ( mod & ControlMask ) len += 2;
-       if ( mod & Mod1Mask )    len += 2;
+       char * s = XKeysymToString(key);
        
-       char * s = XKeysymToString( key );
-       if ( s ) len += strlen( s );
-       if ( len < maxlen ) {
-               if ( mod & ShiftMask ) {
-                       *buf++ = 'S'; *buf++ = '-'; }
-               if ( mod & ControlMask ) {
-                       *buf++ = 'C'; *buf++ = '-'; }
-               if ( mod & Mod1Mask ) {
-                       *buf++ = 'M'; *buf++ = '-'; }
-               if ( s ) strcpy( buf, s );
-               return len;
-       } else 
-               return 0;
+       if (mod & ShiftMask) buf += "S-";
+       if (mod & ControlMask) buf += "C-";
+       if (mod & Mod1Mask) buf += "M-";
+       if (s) buf += s;
 }
 
 
@@ -78,41 +64,23 @@ int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
 \* ---F------------------------------------------------------------------- */
 
 static
-int printKeyTab( kb_key * tabPt, char *buf, int maxLen )
+void printKeyTab( kb_key * tabPt, string & buf)
 {
-       int len, doneLen = 0;
        unsigned int ksym, mod;
        
        /* -------> Print each of the slots into buf. */
        for( ; (tabPt->code & 0xffff) != NoSymbol; ++tabPt) {
-               if ( maxLen <= 0 ) break;
-               
                ksym =  tabPt->code;
                mod  =  tabPt->mod & 0xffff;
                
-               len = printKeysym( ksym, mod, buf, maxLen );
-               if ( len <= 0 ) break;
-               buf     += len;
-               maxLen  -= len;
-               doneLen += len;
-               
-               /* -------> Add space when possible. */
-               if ( maxLen > 0 ) {
-                       *buf++ = ' ';
-                       *buf = '\0';
-                       maxLen--;
-                       doneLen++;
-               }
+               printKeysym(ksym, mod, buf);
+               buf += ' ';
        }
-       return doneLen;
 }
 
 
-
 // === kb_sequence methods ================================================ 
 
-
-
 /* ---F+------------------------------------------------------------------ *\
     Function  : kb_sequence::addkey
     Called by : [user]
@@ -123,12 +91,13 @@ int printKeyTab( kb_key * tabPt, char *buf, int maxLen )
     Returns   : action or -1 if error (no map defined or key not found)
 \* ---F------------------------------------------------------------------- */
 
-int kb_sequence::addkey(KeySym key, unsigned int mod, unsigned int nmod /*= 0*/)
+int kb_sequence::addkey(KeySym key,
+                       unsigned int mod, unsigned int nmod /*= 0*/)
 {
        if(length < 0) length = 0;
 
        if(length + 1 >= size) {
-               unsigned int * nseq = new unsigned int[size+KB_PREALLOC];
+               unsigned int * nseq = new unsigned int[size + KB_PREALLOC];
                size += KB_PREALLOC;
                memcpy(nseq, sequence, length * sizeof(unsigned int));
                if(sequence != staticseq) delete sequence;
@@ -209,7 +178,7 @@ int kb_sequence::parse(char const * s)
                        }
                } else {
                        int j = 0;
-                       for(j = i; s[j] && (s[j])>' '; ++j)
+                       for(j = i; s[j] && s[j] > ' '; ++j)
                                tbuf[j-i] = s[j];    // (!!!check bounds :-)
                        
                        tbuf[j-i] = '\0';
@@ -242,11 +211,10 @@ int kb_sequence::parse(char const * s)
     Returns   : 0, if ok, -1 if string too long
 \* ---F------------------------------------------------------------------- */
 
-int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
+int kb_sequence::print(string & buf, bool when_defined) const
 {
        KeySym key;
        unsigned int mod;
-       int len;
        int l = length;
        if ( l < 0 && !when_defined ) l = -l;
        
@@ -254,21 +222,12 @@ int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
                key = sequence[i];
                mod = modifiers[i] & 0xffff;
 
-               len = printKeysym( key, mod, buf, maxlen );  // RVDK_PATCH_5
-               buf += len;
-               maxlen -= len;
-               
-               if ( len == 0 ) {
-                       *buf = '\0';
-                       return -1;
-               }
+               printKeysym(key, mod, buf);  // RVDK_PATCH_5
 
-               if(i+1<l && maxlen>1) {  // append a blank
-                       *buf++ = ' ';
-                       maxlen--;
+               if(i + 1 < l) {  // append a blank
+                       buf += ' ';
                }
        }
-       *buf = '\0';
        return 0;
 }
 
@@ -283,24 +242,13 @@ int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
     Returns   : 0, if ok, -1 if string too long
 \* ---F------------------------------------------------------------------- */
 
-int kb_sequence::printOptions(char * buf, int maxlen) const
+int kb_sequence::printOptions(string & buf) const
 {
-       print(buf, maxlen, true);
-       int len = strlen(buf);
-       maxlen -= len;
-       buf    += len;
+       print(buf, true);
        
-       if ( maxlen < 20 || !curmap ) return -1;
-#ifdef WITH_WARNINGS
-#warning reimplement kb_sequence using string
-#endif
-       char s[20];
-       strcpy(s, _("   options: "));
-       strcpy( buf, s);
-       buf += strlen(s);
-       maxlen -= strlen(s);
-
-       curmap->print(buf, maxlen);
+       if (!curmap) return -1;
+       buf += _("   options: ");
+       curmap->print(buf);
        return 0;
 }
 
@@ -402,7 +350,10 @@ int kb_keymap::bind(char const * seq, int action)
 
 int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
 {
-       unsigned int hashval, ksym, msk1, msk0;
+#ifndef NO_HASH
+       unsigned int hashval;
+#endif
+       unsigned int ksym, msk1, msk0;
        kb_key * tab;
 
        //suppress modifier bits we do not handle
@@ -415,6 +366,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
                return -1;
        }
 
+#ifndef NO_HASH
        if(size < 0) {               // --- if hash table ---
                hashval = ((key&0xff) ^ ((key>>8)&0xff)) % KB_HASHSIZE;
                tab = htable[hashval];
@@ -424,6 +376,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
                        return -1;
                }
        } else                       // --- else: linear list ---
+#endif
                tab = table;
 
        // --- now search the list of keys ---
@@ -436,11 +389,11 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
                if(ksym == key && (mod & ~msk0) == msk1) {
                        // match found:
                        if(tab->table) {
-                                // this is a prefix key - set new map
+                               // this is a prefix key - set new map
                                seq->curmap = tab->table;
                                return 0;
                        } else {
-                                 // final key - reset map
+                               // final key - reset map
                                seq->curmap = seq->stdmap;
                                seq->delseq();
                                return tab->action; // ... and return action
@@ -464,31 +417,22 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
     Returns   : updated maxLen.
 \* ---F------------------------------------------------------------------- */
 
-int kb_keymap::print(char * buf, int maxLen) const
+void kb_keymap::print(string & buf) const
 {
- /* -----> Return when running out of string space or when keymap has no table.
-     Else, place a terminating newline in case no other output is generated. */
-
-       if ( maxLen <= 3 || !buf ) return maxLen;
-       if ( !table ) return maxLen;
-       *buf   = '\0';
+       // Return when keymap has no table.
+       if (!table) return;
    
- /* -------> Hash table. Process each of its slots recursively and return. */
-       if ( size < 0 ) {   
-               for ( int ix = 0; (ix < KB_HASHSIZE) && (maxLen > 1); ++ix ) {
+       // Process each of its slots recursively and return.
+#ifndef NO_HASH
+       if ( size < 0 ) {   // Hash table
+               for ( int ix = 0; ix < KB_HASHSIZE; ++ix ) {
                        if ( htable[ix] ) {
-                               int len = printKeyTab( htable[ix], buf, maxLen );
-                               maxLen -= len;
-                               buf    += len;
+                               printKeyTab(htable[ix], buf);
                        }
                }
-       } else {
-               /* -------> Normal table. */
-               int len = printKeyTab( table, buf, maxLen ); 
-               maxLen -= len;
-               buf    += len;
-       }
-       return maxLen;
+       } else // Normal table
+#endif
+               printKeyTab(table, buf);
 }
 
 
@@ -502,13 +446,13 @@ int kb_keymap::print(char * buf, int maxLen) const
     Returns   : 0 if ok.
 \* ---F------------------------------------------------------------------- */
 
-int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
+int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
 {
        unsigned int code = seq->sequence[idx];
        if(code == NoSymbol) return -1;
 
        unsigned int modmsk = seq->modifiers[idx];
-       kb_key  *tab, **ptab;
+       kb_key  * tab, ** ptab;
        // --- get list------------------------------------------------------
        if(!table) {
                // If we don't have any yet, make an empty one
@@ -517,10 +461,11 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
                tab   =  table;
                ptab  = &table;
                size  = KB_PREALLOC;
-       } else if(size<0) {
+#ifndef NO_HASH
+       } else if(size < 0) {
                // Hash table.
-               int hashval = (code&0xffff);
-               hashval = ((hashval&0xff) ^ ((hashval>>8)&0xff)) % KB_HASHSIZE;
+               int hashval = code & 0xffff;
+               hashval = ((hashval & 0xff) ^ ((hashval >> 8) & 0xff)) % KB_HASHSIZE;
                tab  = htable[hashval];
                ptab = htable+hashval;
                if(!tab) {
@@ -528,6 +473,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
                        tab[0].code = NoSymbol;
                        *ptab = tab;
                }
+#endif
        } else {
                tab  =  table;
                ptab = &table;
@@ -540,8 +486,8 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
        for(t = tab, tsize = 1; t->code != NoSymbol; ++t, ++tsize) {
                if(code == t->code && modmsk == t->mod) { // -- overwrite binding ---
                        if(idx+1 == seq->length) {
-                               char buf[20]; buf[0] = 0;
-                               seq->print(buf, 20, true);
+                               string buf;
+                               seq->print(buf, true);
                                lyxerr[Debug::KEY]
                                        << "Warning: New binding for '"
                                        << buf 
@@ -555,28 +501,28 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
                                t->action = action;
                                return 0;
                        } else if (!t->table) {
-                               char buf[20]; buf[0] = 0;
-                               seq->print(buf, 20, true);
+                               string buf;
+                               seq->print(buf, true);
                                lyxerr << "Error: New binding for '" << buf
                                       << "' is overriding old binding..."
                                       << endl;
                                return -1;
                        } else
-                               return t->table->defkey(seq, action, idx+1);
+                               return t->table->defkey(seq, action, idx + 1);
                }
        }
 
        // --- extend list if necessary -------------------------------------
 
        if(tsize % KB_PREALLOC == 0) {
-               kb_key * nt = new kb_key[tsize+KB_PREALLOC];
+               kb_key * nt = new kb_key[tsize + KB_PREALLOC];
                // Set to 0 as table is used uninitialised later (thornley)
                nt[tsize].table = 0;
                memcpy(nt, tab, tsize * sizeof(kb_key));
                *ptab = nt;
                delete[] tab;
                tab = nt;
-               if(size>= 0) size = tsize + KB_PREALLOC;
+               if(size >= 0) size = tsize + KB_PREALLOC;
        }
 
        // --- add action ---------------------------------------------------
@@ -588,6 +534,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
        
        // --- convert list to hash table if necessary ----------------------
 
+#ifndef NO_HASH
        if(size >= 0 && tsize >= 32) {
                kb_key * oldtab = tab;
                kb_key ** nht = new kb_key*[KB_HASHSIZE];
@@ -630,7 +577,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
                }
                delete[] oldtab;
        }
-       
+#endif
        // --- define rest of sequence --------------------------------------
 
        if(idx+1 == seq->length) {
@@ -656,6 +603,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
 kb_keymap::~kb_keymap()
 {
        if(!table) return;
+#ifndef NO_HASH
        if(size < 0) {
                for(int i = 0; i < KB_HASHSIZE; ++i) {
                        if(htable[i]) {
@@ -668,25 +616,32 @@ kb_keymap::~kb_keymap()
                }
                delete htable;
        } else {
+#endif
                for(kb_key * t = table; t->code != NoSymbol; ++t)
                        if(t->table)
                                delete t->table;
                delete table;
+#ifndef NO_HASH
        }
+#endif
 }
 
-string keyname(kb_key k) {
-       char buf[100];
-       printKeysym(k.code, k.mod, buf, 100);
+
+string keyname(kb_key k)
+{
+       string buf;
+       printKeysym(k.code, k.mod, buf);
        return buf;
 }
 
+
 // Finds a key for a keyaction, if possible
-string kb_keymap::findbinding(int act) const {
+string kb_keymap::findbinding(int act) const
+{
        string res;
-       if (!table)
-               return res;
+       if (!table) return res;
 
+#ifndef NO_HASH
        if (size < 0) {
                for(int i = 0; i < KB_HASHSIZE; ++i) {
                        if(htable[i]) {
@@ -707,6 +662,7 @@ string kb_keymap::findbinding(int act) const {
                        }
                }
        } else {
+#endif
                for(kb_key * t = table; t->code != NoSymbol; ++t) {
                        if(t->table) {
                                string suffix = t->table->findbinding(act);
@@ -720,7 +676,9 @@ string kb_keymap::findbinding(int act) const {
                                res += "[" + keyname(*t) + "] ";
                        }
                }
+#ifndef NO_HASH
        }
+#endif
        return res;
 }
 
index d61f539695f9aaa34d9aea042ff558c3333eab6a..3cb9a69f299bffbd7d68f9294bf91ffd649e21cf 100644 (file)
 
 #include "LString.h"
 
+#define NO_HASH 1
+
 #define KB_PREALLOC  16
+#ifndef NO_HASH
 #define KB_HASHSIZE 128   // yes, yes - I know. 128 is not exactly prime :-)
 // ... but we are dealing with ASCII chars mostly.
-
+#endif
 class kb_keymap;
 class kb_sequence;
 
@@ -53,11 +56,11 @@ public:
        
        /// Bind a key-sequence to an action
        /** Returns 0 on success. Otherwise, position in string where
-         error occured. */
+           error occured. */
        int bind(char const * seq, int action);
-       
+
        ///
-       int print(char * buf, int maxlen) const;
+       void print(string & buf) const;
        
        /// Look up a key in the keymap
        int lookup(KeySym key, unsigned mod, kb_sequence * seq);
@@ -69,18 +72,21 @@ private:
        int defkey(kb_sequence * seq, int action, int idx = 0);
        
        /// Size of the table (<0: hashtab)
-       int size;
+       int size;
        
        /// Holds the defined keys
        /** Both kinds of tables ends with NoSymbol */
+#ifndef NO_HASH
        union
        {
+#endif
                /// Table for linear array
                kb_key * table;
-               
+#ifndef NO_HASH        
                /// Hash table holding key lists
                kb_key ** htable;
        };
+#endif
 };
 
 
@@ -101,23 +107,23 @@ public:
        
        ///
        ~kb_sequence()
-       {
-               if (sequence != staticseq) {
-                       delete sequence;
-                       delete modifiers;
+               {
+                       if (sequence != staticseq) {
+                               delete sequence;
+                               delete modifiers;
+                       }
                }
-       }
        
        /// Add a key to the key sequence and look it up in the curmap
        /** Add a key to the key sequence and look it up in the curmap
-         if the latter is defined. */
+           if the latter is defined. */
        int addkey(KeySym key, unsigned mod, unsigned nmod = 0);
-       
+
        ///
-       int print(char * buf, int maxlen, bool when_defined = false) const; //RVDK_PATCH_5
+       int print(string & buf, bool when_defined = false) const;
        
         ///
-       int printOptions(char * buf, int maxlen) const;
+       int printOptions(string & buf) const;
        
        /// Make length negative to mark the sequence as deleted
        void delseq();
index 69c358a4167e3da87e58ccc06185f40270b06bd8..ad4c598b4c97960d9cc5426d70a0a1ae6f398db0 100644 (file)
@@ -82,6 +82,8 @@ enum LyXAlignment {
        ///
         LYX_ALIGN_SPECIAL = 32
 };
+
+
 inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
        la1 = static_cast<LyXAlignment>(la1 | la2);
 }
@@ -187,7 +189,9 @@ public:
        string const & labelstring() const { return labelstring_; }
        string const & preamble() const { return preamble_; }
        string const & latexparam() const { return latexparam_; }
-       string const & labelstring_appendix() const { return labelstring_appendix_; }
+       string const & labelstring_appendix() const {
+               return labelstring_appendix_;
+       }
        /** Default font for this layout/environment.
            The main font for this kind of environment. If an attribute has
            LyXFont::INHERITED_*, it means that the value is specified by
@@ -290,7 +294,7 @@ public:
        }
        ///
        bool isCommand() const { 
-           return latextype == LATEX_COMMAND;
+               return latextype == LATEX_COMMAND;
        }
        ///
        bool isEnvironment() const {
@@ -475,12 +479,14 @@ private:
        bool loaded;
 };
 
+
 ///
 inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
 {
        p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
 }
 
+
 ///
 inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
 {
@@ -495,6 +501,7 @@ inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
        return os;
 }
 
+
 ///
 class LyXTextClassList {
 public:
index 72f6bc6a48a30e66c0210cfbfe0e7158c50af3f1..be0845da3044e268e43f7316f93b4f947017e2f9 100644 (file)
@@ -296,11 +296,7 @@ void SetUpdateTimer(float time)
 void BeforeChange()
 {
        current_view->getScreen()->ToggleSelection();
-#ifdef MOVE_TEXT
        current_view->text->ClearSelection();
-#else
-       current_view->buffer()->text->ClearSelection();
-#endif
        FreeUpdateTimer();
 }
 
@@ -310,27 +306,17 @@ void SmallUpdate(signed char f)
 {
        current_view->getScreen()->SmallUpdate();
        if (current_view->getScreen()->TopCursorVisible()
-           != current_view->getScreen()->first){
-#ifdef MOVE_TEXT
+           != current_view->getScreen()->first) {
                current_view->update(f);
-#else
-               current_view->buffer()->update(f);
-#endif
                return;
        }
 
        current_view->fitCursor();
        current_view->updateScrollbar();
 
-#ifdef MOVE_TEXT
        if (!current_view->text->selection)
                current_view->text->sel_cursor = 
                        current_view->text->cursor;
-#else
-       if (!current_view->buffer()->text->selection)
-               current_view->buffer()->text->sel_cursor = 
-                       current_view->buffer()->text->cursor;
-#endif
 
        if (f == 1 || f == -1) {
                if (current_view->buffer()->isLyxClean()) {
@@ -360,8 +346,8 @@ void MenuWrite(Buffer * buf)
                string fname = buf->fileName();
                string s = MakeAbsPath(fname);
                if (AskQuestion(_("Save failed. Rename and try again?"),
-                                MakeDisplayPath(s, 50),
-                                _("(If not, document is not saved.)"))) {
+                               MakeDisplayPath(s, 50),
+                               _("(If not, document is not saved.)"))) {
                        MenuWriteAs(buf);
                }
        } else {
@@ -373,11 +359,7 @@ void MenuWrite(Buffer * buf)
 // should be moved to BufferView.C
 void MenuWriteAs(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text) return;
-#else
-       if (!buffer->text) return;
-#endif
 
        string fname = buffer->fileName();
        string oldname = fname;
@@ -543,13 +525,8 @@ int MenuRunChktex(Buffer * buffer)
  
 int MakeDVIOutput(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!(current_view->text))
                return 1;
-#else
-       if (!(buffer->text))
-               return 1;
-#endif
 
        int ret = 0;
 
@@ -631,7 +608,7 @@ bool RunScript(Buffer * buffer, bool wait,
        } else {
                minibuffer->Set(_("Executing command:"), cmd);
                result = one.startscript(wait ? Systemcalls::Wait
-                                       : Systemcalls::DontWait, cmd);
+                                        : Systemcalls::DontWait, cmd);
        }
        return (result == 0);
 }
@@ -640,13 +617,8 @@ bool RunScript(Buffer * buffer, bool wait,
 // Returns false if we fail
 bool MenuRunDvips(Buffer * buffer, bool wait = false)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return false;
-#else
-       if (!buffer->text)
-               return false;
-#endif
 
        ProhibitInput();
 
@@ -657,7 +629,7 @@ bool MenuRunDvips(Buffer * buffer, bool wait = false)
         }
        // Generate postscript file
        string psname = ChangeExtension (buffer->fileName(),
-                                     ".ps_tmp", true);
+                                        ".ps_tmp", true);
 
        string paper;
        
@@ -731,13 +703,8 @@ bool MenuRunDvips(Buffer * buffer, bool wait = false)
 // Returns false if we fail
 bool MenuPreviewPS(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return false;
-#else
-       if (!buffer->text)
-               return false;
-#endif
 
        // Generate postscript file
        if (!MenuRunDvips(buffer, true)) {
@@ -747,7 +714,7 @@ bool MenuPreviewPS(Buffer * buffer)
        // Start postscript viewer
        ProhibitInput();
        string ps = ChangeExtension (buffer->fileName(),
-                                     ".ps_tmp", true);
+                                    ".ps_tmp", true);
        // push directorypath, if necessary 
         string path = OnlyPath(buffer->fileName());
         if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
@@ -762,13 +729,8 @@ bool MenuPreviewPS(Buffer * buffer)
 
 void MenuFax(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return;
-#else
-       if (!buffer->text)
-               return;
-#endif
 
        // Generate postscript file
        if (!MenuRunDvips(buffer, true)) {
@@ -794,13 +756,9 @@ void MenuFax(Buffer * buffer)
 // Returns false if we fail
 bool MenuPreview(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return false;
-#else
-       if (!buffer->text)
-               return false;
-#endif
+
        string paper;
        
        char real_papersize = buffer->params.papersize;
@@ -859,13 +817,8 @@ bool MenuPreview(Buffer * buffer)
 
 void MenuMakeLaTeX(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return;
-#else
-       if (!buffer->text)
-               return;
-#endif
        
        // Get LaTeX-Filename
        string s = buffer->getLatexName();
@@ -877,7 +830,7 @@ void MenuMakeLaTeX(Buffer * buffer)
                         _("Do you want to overwrite the file?"))) {
                minibuffer->Set(_("Canceled"));
                return;
-               }
+       }
        
        if (buffer->isDocBook())
                minibuffer->Set(_("DocBook does not have a latex backend"));
@@ -895,11 +848,7 @@ void MenuMakeLaTeX(Buffer * buffer)
 
 void MenuMakeLinuxDoc(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text) return;
-#else
-       if (!buffer->text) return;
-#endif
        
        if (!buffer->isLinuxDoc()) {
                WriteAlert(_("Error!"), _("Document class must be linuxdoc."));
@@ -931,11 +880,7 @@ void MenuMakeLinuxDoc(Buffer * buffer)
 
 void MenuMakeDocBook(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text) return;
-#else
-       if (!buffer->text) return;
-#endif
        
        if (!buffer->isDocBook()) {
                WriteAlert(_("Error!"),
@@ -968,11 +913,7 @@ void MenuMakeDocBook(Buffer * buffer)
 
 void MenuMakeAscii(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text) return;
-#else
-       if (!buffer->text) return;
-#endif
        
        /* get LaTeX-Filename */
        string s = ChangeExtension (buffer->fileName(),
@@ -995,16 +936,12 @@ void MenuMakeAscii(Buffer * buffer)
 
 void MenuPrint(Buffer * buffer)
 {
-#ifdef MOVE_TEXT
        if (!current_view->text)
                return;
-#else
-       if (!buffer->text)
-               return;
-#endif
+
        string input_file = ChangeExtension(buffer->fileName(),
-                                    lyxrc->print_file_extension,
-                                    true);
+                                           lyxrc->print_file_extension,
+                                           true);
        fl_set_input(fd_form_print->input_file, input_file.c_str());
        
        if (fd_form_print->form_print->visible) {
@@ -1050,7 +987,7 @@ void MenuExport(Buffer * buffer, string const & extyp)
 {
        // latex
        if (extyp == "latex") {
-       // make sure that this buffer is not linuxdoc
+               // make sure that this buffer is not linuxdoc
                MenuMakeLaTeX(buffer);
        }
        // linuxdoc
@@ -1060,16 +997,16 @@ void MenuExport(Buffer * buffer, string const & extyp)
        }
        // docbook
        else if (extyp == "docbook") {
-       // make sure that this buffer is not latex or linuxdoc
+               // make sure that this buffer is not latex or linuxdoc
                MenuMakeDocBook(buffer);
        }
        // dvi
        else if (extyp == "dvi") {
-       // Run LaTeX as "Update dvi..." Bernhard.
-       // We want the dvi in the current directory. This
-       // is achieved by temporarily disabling use of
-       // temp directory. As a side-effect, we get
-       // *.log and *.aux files also. (Asger)
+               // Run LaTeX as "Update dvi..." Bernhard.
+               // We want the dvi in the current directory. This
+               // is achieved by temporarily disabling use of
+               // temp directory. As a side-effect, we get
+               // *.log and *.aux files also. (Asger)
                bool flag = lyxrc->use_tempdir;
                lyxrc->use_tempdir = false;
                MenuRunLaTeX(buffer);
@@ -1077,7 +1014,7 @@ void MenuExport(Buffer * buffer, string const & extyp)
        }
        // postscript
        else if (extyp == "postscript") {
-       // Start Print-dialog. Not as good as dvi... Bernhard.
+               // Start Print-dialog. Not as good as dvi... Bernhard.
                MenuPrint(buffer);
                // Since the MenuPrint is a pop-up, we can't use
                // the same trick as above. (Asger)
@@ -1272,21 +1209,12 @@ void InsertAsciiFile(string const & f, bool asParagraph)
        
        // clear the selection
        BeforeChange();
-#ifdef MOVE_TEXT
        if (!asParagraph)
                current_view->text->InsertStringA(tmppar->text);
        else
                current_view->text->InsertStringB(tmppar->text);
        delete tmppar;
        current_view->update(1);
-#else
-       if (!asParagraph)
-               current_view->buffer()->text->InsertStringA(tmppar->text);
-       else
-               current_view->buffer()->text->InsertStringB(tmppar->text);
-       delete tmppar;
-       current_view->buffer()->update(1);
-#endif
 }
 
 
@@ -1373,15 +1301,9 @@ extern "C" void FootCB(FL_OBJECT *, long)
        
        minibuffer->Set(_("Inserting Footnote..."));
        current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
        current_view->update(-2);
        current_view->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
        current_view->update(1);
-#else
-       current_view->buffer()->update(-2);
-       current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
-       current_view->buffer()->update(1);
-#endif
 }
 
 
@@ -1390,7 +1312,7 @@ void LayoutsCB(int sel, void *)
 {
        string tmp = tostr(sel);
        current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
-                                                        tmp.c_str());
+                                                     tmp.c_str());
 }
 
 
@@ -1534,11 +1456,7 @@ void AllFloats(char flag, char figmar)
        if (!current_view->available())
                return;
 
-#ifdef MOVE_TEXT
        LyXCursor cursor = current_view->text->cursor;
-#else
-       LyXCursor cursor = current_view->buffer()->text->cursor;
-#endif
 
        if (!flag && cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE
            && ((figmar 
@@ -1577,17 +1495,11 @@ void AllFloats(char flag, char figmar)
                                if (par->previous
                                    && par->previous->footnoteflag != 
                                    LyXParagraph::CLOSED_FOOTNOTE){ /* should be */ 
-#ifdef MOVE_TEXT
                                        current_view->text
                                                ->SetCursorIntern(par
                                                                  ->previous,
                                                                  0);
                                        current_view->text->OpenFootnote();
-#else
-                                       current_view->buffer()->text->SetCursorIntern(par->previous,
-                                                                     0);
-                                       current_view->buffer()->text->OpenFootnote();
-#endif
                                }
                        }
                }
@@ -1614,24 +1526,15 @@ void AllFloats(char flag, char figmar)
                                     par->footnotekind != LyXParagraph::ALGORITHM
                                            )
                                    )
-                               ){
-#ifdef MOVE_TEXT
+                               ) {
                                current_view->text->SetCursorIntern(par, 0);
                                current_view->text->CloseFootnote();
-#else
-                               current_view->buffer()->text->SetCursorIntern(par, 0);
-                               current_view->buffer()->text->CloseFootnote();
-#endif
                        }
                }
                par = par->next;
        }
 
-#ifdef MOVE_TEXT
        current_view->text->SetCursorIntern(cursor.par, cursor.pos);
-#else
-       current_view->buffer()->text->SetCursorIntern(cursor.par, cursor.pos);
-#endif
        current_view->redraw();
        current_view->fitCursor();
        current_view->updateScrollbar();
@@ -1721,7 +1624,6 @@ inline void EnableParagraphLayout ()
 }
 
 
-#ifdef MOVE_TEXT
 bool UpdateLayoutParagraph()
 {
        if (!current_view->getScreen() || !current_view->available()) {
@@ -1742,7 +1644,7 @@ bool UpdateLayoutParagraph()
        int align = current_view->text->cursor.par->GetAlign();
        if (align == LYX_ALIGN_LAYOUT)
                align = textclasslist.Style(buf->params.textclass,
-                                 current_view->text->cursor.par->GetLayout()).align;
+                                           current_view->text->cursor.par->GetLayout()).align;
         
        switch (align) {
        case LYX_ALIGN_RIGHT:
@@ -1844,130 +1746,7 @@ bool UpdateLayoutParagraph()
        }
        return true;
 }
-#else
-bool UpdateLayoutParagraph()
-{
-       if (!current_view->getScreen() || !current_view->available()) {
-               if (fd_form_paragraph->form_paragraph->visible) 
-                       fl_hide_form(fd_form_paragraph->form_paragraph);
-               return false;
-       }
-
-       Buffer * buf = current_view->buffer();
-
-       fl_set_input(fd_form_paragraph->input_labelwidth,
-                    buf->text->cursor.par->GetLabelWidthString().c_str());
-       fl_set_button(fd_form_paragraph->radio_align_right, 0);
-       fl_set_button(fd_form_paragraph->radio_align_left, 0);
-       fl_set_button(fd_form_paragraph->radio_align_center, 0);
-       fl_set_button(fd_form_paragraph->radio_align_block, 0);
-
-       int align = buf->text->cursor.par->GetAlign();
-       if (align == LYX_ALIGN_LAYOUT)
-               align = textclasslist.Style(buf->params.textclass,
-                                 buf->text->cursor.par->GetLayout()).align;
-        
-       switch (align) {
-       case LYX_ALIGN_RIGHT:
-               fl_set_button(fd_form_paragraph->radio_align_right, 1);
-               break;
-       case LYX_ALIGN_LEFT:
-               fl_set_button(fd_form_paragraph->radio_align_left, 1);
-               break;
-       case LYX_ALIGN_CENTER:
-               fl_set_button(fd_form_paragraph->radio_align_center, 1);
-               break;
-       default:
-               fl_set_button(fd_form_paragraph->radio_align_block, 1);
-               break;
-       }
-        
-       fl_set_button(fd_form_paragraph->check_lines_top,
-                     buf->text->cursor.par->FirstPhysicalPar()->line_top);
-       fl_set_button(fd_form_paragraph->check_lines_bottom,
-                     buf->text->cursor.par->FirstPhysicalPar()->line_bottom);
-       fl_set_button(fd_form_paragraph->check_pagebreaks_top,
-                     buf->text->cursor.par->FirstPhysicalPar()->pagebreak_top);
-       fl_set_button(fd_form_paragraph->check_pagebreaks_bottom,
-                     buf->text->cursor.par->FirstPhysicalPar()->pagebreak_bottom);
-       fl_set_button(fd_form_paragraph->check_noindent,
-                     buf->text->cursor.par->FirstPhysicalPar()->noindent);
-       fl_set_input (fd_form_paragraph->input_space_above, "");
-       
-       switch (buf->text->cursor.par->FirstPhysicalPar()->added_space_top.kind()) {
-       case VSpace::NONE:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 1);
-               break;
-       case VSpace::DEFSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 2);
-               break;
-       case VSpace::SMALLSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 3);
-               break;
-       case VSpace::MEDSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 4);
-               break;
-       case VSpace::BIGSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 5);
-               break;
-       case VSpace::VFILL:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 6);
-               break;
-       case VSpace::LENGTH:
-               fl_set_choice (fd_form_paragraph->choice_space_above, 7); 
-               fl_set_input  (fd_form_paragraph->input_space_above, 
-                              buf->text->cursor.par->FirstPhysicalPar()->added_space_top.length().asString().c_str());
-               break;
-       }
-       fl_set_button (fd_form_paragraph->check_space_above,
-                      buf->text->cursor.par->FirstPhysicalPar()->added_space_top.keep());
-       fl_set_input (fd_form_paragraph->input_space_below, "");
-       switch (buf->text->cursor.par->FirstPhysicalPar()->added_space_bottom.kind()) {
-       case VSpace::NONE:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              1);
-               break;
-       case VSpace::DEFSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              2);
-               break;
-       case VSpace::SMALLSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              3);
-               break;
-       case VSpace::MEDSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              4);
-               break;
-       case VSpace::BIGSKIP:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              5);
-               break;
-       case VSpace::VFILL:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              6);
-               break;
-       case VSpace::LENGTH:
-               fl_set_choice (fd_form_paragraph->choice_space_below,
-                              7); 
-               fl_set_input  (fd_form_paragraph->input_space_below, 
-                              buf->text->cursor.par->FirstPhysicalPar()->added_space_bottom.length().asString().c_str());
-               break;
-       }
-       fl_set_button (fd_form_paragraph->check_space_below,
-                      buf->text->cursor.par->FirstPhysicalPar()->added_space_bottom.keep());
 
-       fl_set_button(fd_form_paragraph->check_noindent,
-                     buf->text->cursor.par->FirstPhysicalPar()->noindent);
-
-       if (current_view->buffer()->isReadonly()) {
-               DisableParagraphLayout();
-       } else {
-               EnableParagraphLayout();
-       }
-       return true;
-}
-#endif
 
 void MenuLayoutParagraph()
 {
@@ -2248,7 +2027,7 @@ bool UpdateLayoutQuotes()
        
        if (update) {
                fl_set_choice(fd_form_quotes->choice_quotes_language,
-                     current_view->buffer()->params.quotes_language + 1);
+                             current_view->buffer()->params.quotes_language + 1);
                fl_set_button(fd_form_quotes->radio_single, 0);
                fl_set_button(fd_form_quotes->radio_double, 0);
        
@@ -2281,25 +2060,25 @@ bool UpdateLayoutPreamble()
 {
        bool update = true;
        if (!current_view->getScreen() || ! current_view->available())
-           update = false;
+               update = false;
 
        if (update) {
                fl_set_input(fd_form_preamble->input_preamble,
-                    current_view->buffer()->params.preamble.c_str());
+                            current_view->buffer()->params.preamble.c_str());
 
                if (current_view->buffer()->isReadonly()) {
-                 fl_deactivate_object(fd_form_preamble->input_preamble);
-                 fl_deactivate_object(fd_form_preamble->button_ok);
-                 fl_deactivate_object(fd_form_preamble->button_apply);
-                 fl_set_object_lcol(fd_form_preamble->button_ok, FL_INACTIVE);
-                 fl_set_object_lcol(fd_form_preamble->button_apply, FL_INACTIVE);
+                       fl_deactivate_object(fd_form_preamble->input_preamble);
+                       fl_deactivate_object(fd_form_preamble->button_ok);
+                       fl_deactivate_object(fd_form_preamble->button_apply);
+                       fl_set_object_lcol(fd_form_preamble->button_ok, FL_INACTIVE);
+                       fl_set_object_lcol(fd_form_preamble->button_apply, FL_INACTIVE);
                }
                else {
-                 fl_activate_object(fd_form_preamble->input_preamble);
-                 fl_activate_object(fd_form_preamble->button_ok);
-                 fl_activate_object(fd_form_preamble->button_apply);
-                 fl_set_object_lcol(fd_form_preamble->button_ok, FL_BLACK);
-                 fl_set_object_lcol(fd_form_preamble->button_apply, FL_BLACK);
+                       fl_activate_object(fd_form_preamble->input_preamble);
+                       fl_activate_object(fd_form_preamble->button_ok);
+                       fl_activate_object(fd_form_preamble->button_apply);
+                       fl_set_object_lcol(fd_form_preamble->button_ok, FL_BLACK);
+                       fl_set_object_lcol(fd_form_preamble->button_apply, FL_BLACK);
                }
        } else if (fd_form_preamble->form_preamble->visible) {
                fl_hide_form(fd_form_preamble->form_preamble);
@@ -2333,7 +2112,7 @@ void MenuLayoutPreamble()
 void MenuLayoutSave()
 {
        if (!current_view->getScreen() || ! current_view->available())
-           return;
+               return;
 
        if (AskQuestion(_("Do you want to save the current settings"),
                        _("for Character, Document, Paper and Quotes"),
@@ -2358,15 +2137,9 @@ void OpenStuff()
                minibuffer->Set(_("Open/Close..."));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->OpenStuff();
                current_view->update(0);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->OpenStuff();
-               current_view->buffer()->update(0);
-#endif
        }
 }
 
@@ -2378,15 +2151,9 @@ void ToggleFloat()
                minibuffer->Set(_("Open/Close..."));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->ToggleFootnote();
                current_view->update(0);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->ToggleFootnote();
-               current_view->buffer()->update(0);
-#endif
        }
 }
 
@@ -2395,27 +2162,19 @@ void ToggleFloat()
 void MenuUndo()
 {
 /*     if (current_view->buffer()->the_locking_inset) {
-               minibuffer->Set(_("Undo not yet supported in math mode"));
-               return;
+       minibuffer->Set(_("Undo not yet supported in math mode"));
+       return;
        }*/
    
        if (current_view->available()) {
                minibuffer->Set(_("Undo"));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                if (!current_view->text->TextUndo())
                        minibuffer->Set(_("No further undo information"));
                else
                        current_view->update(-1);
-#else
-               current_view->buffer()->update(-2);
-               if (!current_view->buffer()->text->TextUndo())
-                       minibuffer->Set(_("No further undo information"));
-               else
-                       current_view->buffer()->update(-1);
-#endif
        }
 }
 
@@ -2432,19 +2191,11 @@ void MenuRedo()
                minibuffer->Set(_("Redo"));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                if (!current_view->text->TextRedo())
                        minibuffer->Set(_("No further redo information"));
                else
                        current_view->update(-1);
-#else
-               current_view->buffer()->update(-2);
-               if (!current_view->buffer()->text->TextRedo())
-                       minibuffer->Set(_("No further redo information"));
-               else
-                       current_view->buffer()->update(-1);
-#endif
        }
 }
 
@@ -2454,11 +2205,7 @@ void HyphenationPoint()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
-#else
-               current_view->buffer()->update(-2);
-#endif
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
                current_view->buffer()->insertInset(new_inset);
@@ -2471,11 +2218,7 @@ void Ldots()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
-#else
-               current_view->buffer()->update(-2);
-#endif
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::LDOTS);
                current_view->buffer()->insertInset(new_inset);
@@ -2486,13 +2229,9 @@ void Ldots()
 // candidate for move to BufferView
 void EndOfSentenceDot()
 {
-       if (current_view->available())  {
+       if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
-#else
-               current_view->buffer()->update(-2);
-#endif
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
                current_view->buffer()->insertInset(new_inset);
@@ -2503,13 +2242,9 @@ void EndOfSentenceDot()
 // candidate for move to BufferView
 void MenuSeparator()
 {
-       if (current_view->available())  {
+       if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
-#else
-               current_view->buffer()->update(-2);
-#endif
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
                current_view->buffer()->insertInset(new_inset);
@@ -2520,17 +2255,11 @@ void MenuSeparator()
 // candidate for move to BufferView
 void Newline()
 {
-       if (current_view->available())  {
+       if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->InsertChar(LyXParagraph::META_NEWLINE);
                current_view->update(-1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->InsertChar(LyXParagraph::META_NEWLINE);
-               current_view->buffer()->update(-1);
-#endif
        }
 }
 
@@ -2538,17 +2267,11 @@ void Newline()
 // candidate for move to BufferView
 void ProtectedBlank()
 {
-       if (current_view->available())  {
+       if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
                current_view->update(-1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
-               current_view->buffer()->update(-1);
-#endif
        }
 }
 
@@ -2556,17 +2279,11 @@ void ProtectedBlank()
 // candidate for move to BufferView
 void HFill()
 {
-       if (current_view->available())  {
+       if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->InsertChar(LyXParagraph::META_HFILL);
                current_view->update(-1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->InsertChar(LyXParagraph::META_HFILL);
-               current_view->buffer()->update(-1);
-#endif
        }
 }
 
@@ -2661,7 +2378,6 @@ void StyleResetCB()
  * future perhaps we could try to implement a callback to the button-bar.
  * That is, `light' the bold button when the font is currently bold, etc.
  */
-#ifdef MOVE_TEXT
 string CurrentState()
 {
        string state;
@@ -2671,7 +2387,7 @@ string CurrentState()
                Buffer * buffer = current_view->buffer();
                LyXFont font = current_view->text->real_current_font;
                LyXFont defaultfont = textclasslist.TextClass(buffer->
-                                                        params.textclass).defaultfont();
+                                                             params.textclass).defaultfont();
                font.reduce(defaultfont);
                state = _("Font: ") + font.stateText();
 
@@ -2681,27 +2397,7 @@ string CurrentState()
        }
        return state;
 }
-#else
-string CurrentState()
-{
-       string state;
-       if (current_view->available()) { 
-               // I think we should only show changes from the default
-               // font. (Asger)
-               Buffer * buffer = current_view->buffer();
-               LyXFont font = buffer->text->real_current_font;
-               LyXFont defaultfont = textclasslist.TextClass(buffer->
-                                                        params.textclass).defaultfont();
-               font.reduce(defaultfont);
-               state = _("Font: ") + font.stateText();
 
-               int depth = buffer->text->GetDepth();
-               if (depth>0) 
-                       state += string(_(", Depth: ")) + tostr(depth);
-       }
-       return state;
-}
-#endif
 
 // candidate for move to BufferView
 /* -------> Does the actual toggle job of the XxxCB() calls above.
@@ -2712,15 +2408,9 @@ void ToggleAndShow(LyXFont const & font)
 {
        if (current_view->available()) { 
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->ToggleFree(font, toggleall);
                current_view->update(1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->ToggleFree(font, toggleall);
-               current_view->buffer()->update(1);
-#endif
        }
        // removed since it overrides the ToggleFree Message about the style
        // Since Styles are more "High Level" than raw fonts I think the user
@@ -2735,15 +2425,9 @@ extern "C" void MarginCB(FL_OBJECT *, long)
        if (current_view->available()) {
                minibuffer->Set(_("Inserting margin note..."));
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
                current_view->update(1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
-               current_view->buffer()->update(1);
-#endif
        }
 }
 
@@ -2776,21 +2460,12 @@ extern "C" void TableCB(FL_OBJECT *, long)
 void CopyEnvironmentCB()
 {
        if (current_view->available()) {
-#ifdef MOVE_TEXT
                current_view->text->copyEnvironmentType();
                /* clear the selection, even if mark_set */ 
                current_view->getScreen()->ToggleSelection();
                current_view->text->ClearSelection();
                current_view->update(-2);
                minibuffer->Set(_("Paragraph environment type copied"));
-#else
-               current_view->buffer()->text->copyEnvironmentType();
-               /* clear the selection, even if mark_set */ 
-               current_view->getScreen()->ToggleSelection();
-               current_view->buffer()->text->ClearSelection();
-               current_view->buffer()->update(-2);
-               minibuffer->Set(_("Paragraph environment type copied"));
-#endif
        }
 }
 
@@ -2799,15 +2474,9 @@ void CopyEnvironmentCB()
 void PasteEnvironmentCB()
 {
        if (current_view->available()) {
-#ifdef MOVE_TEXT
                current_view->text->pasteEnvironmentType();
                minibuffer->Set(_("Paragraph environment type set"));
                current_view->update(1);
-#else
-               current_view->buffer()->text->pasteEnvironmentType();
-               minibuffer->Set(_("Paragraph environment type set"));
-               current_view->buffer()->update(1);
-#endif
        }
 }
 
@@ -2816,21 +2485,12 @@ void PasteEnvironmentCB()
 void CopyCB()
 {
        if (current_view->available()) {
-#ifdef MOVE_TEXT
                current_view->text->CopySelection();
                /* clear the selection, even if mark_set */ 
                current_view->getScreen()->ToggleSelection();
                current_view->text->ClearSelection();
                current_view->update(-2);
                minibuffer->Set(_("Copy"));
-#else
-               current_view->buffer()->text->CopySelection();
-               /* clear the selection, even if mark_set */ 
-               current_view->getScreen()->ToggleSelection();
-               current_view->buffer()->text->ClearSelection();
-               current_view->buffer()->update(-2);
-               minibuffer->Set(_("Copy"));
-#endif
        }
 }
 
@@ -2840,15 +2500,9 @@ void CutCB()
 {
        if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                current_view->text->CutSelection();
                current_view->update(1);
-#else
-               current_view->buffer()->update(-2);
-               current_view->buffer()->text->CutSelection();
-               current_view->buffer()->update(1);
-#endif
                minibuffer->Set(_("Cut"));
        }
 }
@@ -2862,7 +2516,6 @@ void PasteCB()
        minibuffer->Set(_("Paste"));
        current_view->getScreen()->HideCursor();
        /* clear the selection */
-#ifdef MOVE_TEXT
        current_view->getScreen()->ToggleSelection();
        current_view->text->ClearSelection();
        current_view->update(-2);
@@ -2875,20 +2528,6 @@ void PasteCB()
        current_view->getScreen()->ToggleSelection();
        current_view->text->ClearSelection();
        current_view->update(-2);
-#else
-       current_view->getScreen()->ToggleSelection();
-       current_view->buffer()->text->ClearSelection();
-       current_view->buffer()->update(-2);
-       
-       /* paste */ 
-       current_view->buffer()->text->PasteSelection();
-       current_view->buffer()->update(1);
-       
-       /* clear the selection */ 
-       current_view->getScreen()->ToggleSelection();
-       current_view->buffer()->text->ClearSelection();
-       current_view->buffer()->update(-2);
-#endif
 }
 
 
@@ -2900,15 +2539,9 @@ extern "C" void MeltCB(FL_OBJECT *, long)
        minibuffer->Set(_("Melt"));
        current_view->getScreen()->HideCursor();
        BeforeChange();
-#ifdef MOVE_TEXT
        current_view->update(-2);
        current_view->text->MeltFootnoteEnvironment();
        current_view->update(1);
-#else
-       current_view->buffer()->update(-2);
-       current_view->buffer()->text->MeltFootnoteEnvironment();
-       current_view->buffer()->update(1);
-#endif
 }
 
 
@@ -2932,21 +2565,12 @@ extern "C" void DepthCB(FL_OBJECT * ob, long decInc)
   
        if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-2);
                if (button == 1)
                        current_view->text->IncDepth();
                else
                        current_view->text->DecDepth();
                current_view->update(1);
-#else
-               current_view->buffer()->update(-2);
-               if (button == 1)
-                       current_view->buffer()->text->IncDepth();
-               else
-                       current_view->buffer()->text->DecDepth();
-               current_view->buffer()->update(1);
-#endif
                minibuffer->Set(_("Changed environment depth"
                                  " (in possible range, maybe not)"));
        }
@@ -3149,7 +2773,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
        case 7: space_top = VSpace(LyXGlueLength (fl_get_input (fd_form_paragraph->input_space_above))); break;
        }
        if (fl_get_button (fd_form_paragraph->check_space_above))
-         space_top.setKeep (true);
+               space_top.setKeep (true);
        switch (fl_get_choice (fd_form_paragraph->choice_space_below)) {
        case 1: space_bottom = VSpace(VSpace::NONE); break;
        case 2: space_bottom = VSpace(VSpace::DEFSKIP); break;
@@ -3160,7 +2784,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
        case 7: space_bottom = VSpace(LyXGlueLength (fl_get_input (fd_form_paragraph->input_space_below))); break;
        }
        if (fl_get_button (fd_form_paragraph->check_space_below))
-         space_bottom.setKeep (true);
+               space_bottom.setKeep (true);
 
        if (fl_get_button(fd_form_paragraph->radio_align_left))
                align = LYX_ALIGN_LEFT;
@@ -3174,7 +2798,6 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
        labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
        noindent = fl_get_button(fd_form_paragraph->check_noindent);
 
-#ifdef MOVE_TEXT
        current_view->text->SetParagraph(line_top,
                                         line_bottom,
                                         pagebreak_top,
@@ -3185,18 +2808,6 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
                                         labelwidthstring,
                                         noindent);
        current_view->update(1);
-#else
-       current_view->buffer()->text->SetParagraph(line_top,
-                                                         line_bottom,
-                                                         pagebreak_top,
-                                                         pagebreak_bottom,
-                                                         space_top,
-                                                         space_bottom,
-                                                         align, 
-                                                         labelwidthstring,
-                                                         noindent);
-       current_view->buffer()->update(1);
-#endif
        minibuffer->Set(_("Paragraph layout set"));
 }
 
@@ -3381,24 +2992,14 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
                        // successfully loaded
                        redo = true;
                        minibuffer->Set(_("Converting document to new document class..."));
-#ifdef MOVE_TEXT
                        int ret = current_view->text->
                                SwitchLayoutsBetweenClasses(current_view->buffer()->
                                                            params.textclass,
                                                            new_class,
                                                            current_view->buffer()->
                                                            paragraph);
-#else
-                       int ret = current_view->buffer()->
-                               text->
-                               SwitchLayoutsBetweenClasses(current_view->buffer()->
-                                                           params.textclass,
-                                                           new_class,
-                                                           current_view->buffer()->
-                                                           paragraph);
-#endif
 
-                       if (ret){
+                       if (ret) {
                                string s;
                                if (ret == 1)
                                        s = _("One paragraph couldn't be converted");
@@ -3523,7 +3124,6 @@ extern "C" void DocumentBulletsCB(FL_OBJECT *, long)
 
 
 // candidate for move to BufferView
-#ifdef MOVE_TEXT
 void GotoNote()
 {
        if (!current_view->getScreen())
@@ -3557,41 +3157,7 @@ void GotoNote()
        current_view->text->sel_cursor = 
                current_view->text->cursor;
 }
-#else
-void GotoNote()
-{
-       if (!current_view->getScreen())
-               return;
-   
-       current_view->getScreen()->HideCursor();
-       BeforeChange();
-       current_view->buffer()->update(-2);
-       LyXCursor tmp;
-   
-       if (!current_view->buffer()->text->GotoNextNote()) {
-               if (current_view->buffer()->text->cursor.pos 
-                   || current_view->buffer()->text->cursor.par != 
-                   current_view->buffer()->text->FirstParagraph())
-                       {
-                               tmp = current_view->buffer()->text->cursor;
-                               current_view->buffer()->text->cursor.par = 
-                                       current_view->buffer()->text->FirstParagraph();
-                               current_view->buffer()->text->cursor.pos = 0;
-                               if (!current_view->buffer()->text->GotoNextNote()) {
-                                       current_view->buffer()->text->cursor = tmp;
-                                       minibuffer->Set(_("No more notes"));
-                                       LyXBell();
-                               }
-                       } else {
-                               minibuffer->Set(_("No more notes"));
-                               LyXBell();
-                       }
-       }
-       current_view->buffer()->update(0);
-       current_view->buffer()->text->sel_cursor = 
-               current_view->buffer()->text->cursor;
-}
-#endif
+
 
 // candidate for move to BufferView
 void InsertCorrectQuote()
@@ -3599,17 +3165,10 @@ void InsertCorrectQuote()
        Buffer * cbuffer = current_view->buffer();
        char c;
 
-#ifdef MOVE_TEXT
        if  (current_view->text->cursor.pos )
                c = current_view->text->cursor.par->GetChar(current_view->text->cursor.pos - 1);
        else 
                c = ' ';
-#else
-       if  (cbuffer->text->cursor.pos )
-               c = cbuffer->text->cursor.par->GetChar(cbuffer->text->cursor.pos - 1);
-       else 
-               c = ' ';
-#endif
 
        cbuffer->insertInset(new InsetQuotes(c, cbuffer->params));
 }
@@ -3699,7 +3258,6 @@ extern "C" void PreambleOKCB(FL_OBJECT * ob, long data)
 
 /* callbacks for form form_table */
 
-#ifdef MOVE_TEXT
 extern "C" void TableApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->getScreen())
@@ -3777,85 +3335,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
        current_view->update(1);
        minibuffer->Set(_("Table inserted"));
 }
-#else
-extern "C" void TableApplyCB(FL_OBJECT *, long)
-{
-       if (!current_view->getScreen())
-               return;
-   
-       // check for tables in tables
-       if (current_view->buffer()->text->cursor.par->table){
-               WriteAlert(_("Impossible Operation!"),
-                          _("Cannot insert table in table."),
-                          _("Sorry."));
-               return;
-       }
-       minibuffer->Set(_("Inserting table..."));
-
-       int ysize = int(fl_get_slider_value(fd_form_table->slider_columns) + 0.5);
-       int xsize = int(fl_get_slider_value(fd_form_table->slider_rows) + 0.5);
-   
-   
-       current_view->getScreen()->HideCursor();
-       BeforeChange();
-       current_view->buffer()->update(-2);
-   
-       current_view->buffer()->text->SetCursorParUndo(); 
-       current_view->buffer()->text->FreezeUndo();
 
-       current_view->buffer()->text->BreakParagraph();
-       current_view->buffer()->update(-1);
-   
-       if (current_view->buffer()->text->cursor.par->Last()) {
-               current_view->buffer()->text->CursorLeft();
-      
-               current_view->buffer()->text->BreakParagraph();
-               current_view->buffer()->update(-1);
-       }
-
-       current_view->buffer()->text->current_font.setLatex(LyXFont::OFF);
-       //if (!fl_get_button(fd_form_table->check_latex)){
-       // insert the new wysiwy table
-       current_view->buffer()->text->SetLayout(0); // standard layout
-       if (current_view->buffer()->text->cursor.par->footnoteflag == 
-           LyXParagraph::NO_FOOTNOTE) {
-               current_view->buffer()->
-                       text->SetParagraph(0, 0,
-                                          0, 0,
-                                          VSpace (0.3 * current_view->buffer()->
-                                                  params.spacing.getValue(),
-                                                  LyXLength::CM),
-                                          VSpace (0.3 * current_view->buffer()->
-                                                  params.spacing.getValue(),
-                                                  LyXLength::CM),
-                                          LYX_ALIGN_CENTER,
-                                          string(),
-                                          0);
-       }
-       else
-               current_view->buffer()->
-                       text->SetParagraph(0, 0,
-                                          0, 0,
-                                          VSpace(VSpace::NONE),
-                                          VSpace(VSpace::NONE),
-                                          LYX_ALIGN_CENTER, 
-                                          string(),
-                                          0);
-
-       current_view->buffer()->text->cursor.par->table =
-               new LyXTable(xsize, ysize);
-
-       for (int i = 0; i < xsize * ysize - 1; ++i)
-               current_view->buffer()->text->cursor.par->InsertChar(0, LyXParagraph::META_NEWLINE);
-       current_view->buffer()->text->RedoParagraph();
-   
-       current_view->buffer()->text->UnFreezeUndo();
-     
-       current_view->buffer()->update(1);
-       minibuffer->Set(_("Table inserted"));
-}
-#endif
 
 extern "C" void TableCancelCB(FL_OBJECT *, long)
 {
@@ -3910,7 +3390,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
                piece = frontStrip(piece) ;
                if ( !stringOnlyContains (piece, "0123456789-") ) {
                        WriteAlert(_("ERROR!  Unable to print!"),
-                               _("Check 'range of pages'!"));
+                                  _("Check 'range of pages'!"));
                        return;
                }
                if (piece.find('-') == string::npos) { // not found
@@ -3928,7 +3408,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
        if (!copies.empty()) { // a number of copies was given
                if ( !stringOnlyContains (copies, "0123456789") ) {
                        WriteAlert(_("ERROR!  Unable to print!"),
-                               _("Check 'number of copies'!"));
+                                  _("Check 'number of copies'!"));
                        return;
                }
                if (fl_get_button(fd_form_print->do_unsorted))
@@ -4011,7 +3491,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
        }
        if (fl_get_button(fd_form_print->radio_file))
                command += lyxrc->print_to_file 
-                          + QuoteName(MakeAbsPath(ps_file, path));
+                       + QuoteName(MakeAbsPath(ps_file, path));
        else if (!lyxrc->print_spool_command.empty())
                command += lyxrc->print_to_file 
                        + QuoteName(ps_file);
@@ -4028,7 +3508,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
                string command2 = lyxrc->print_spool_command + ' ';
                if (!printer.empty())
                        command2 += lyxrc->print_spool_printerprefix 
-                                   + printer;
+                               + printer;
                // First run dvips and, if succesful, then spool command
                if ((result = RunScript(buffer, true, command))) {
                        result = RunScript(buffer, false, command2, ps_file);
@@ -4051,7 +3531,6 @@ extern "C" void PrintOKCB(FL_OBJECT * ob, long data)
 
 
 /* callbacks for form form_figure */
-#ifdef MOVE_TEXT
 extern "C" void FigureApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
@@ -4104,12 +3583,12 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
                                     LYX_ALIGN_CENTER, string(), 0);
        } else
                current_view->text->SetParagraph(0, 0,
-                                          0, 0,
-                                          VSpace(VSpace::NONE),
-                                          VSpace(VSpace::NONE),
-                                          LYX_ALIGN_CENTER, 
-                                          string(),
-                                          0);
+                                                0, 0,
+                                                VSpace(VSpace::NONE),
+                                                VSpace(VSpace::NONE),
+                                                LYX_ALIGN_CENTER, 
+                                                string(),
+                                                0);
        
        current_view->update(-1);
       
@@ -4120,77 +3599,8 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
        minibuffer->Set(_("Figure inserted"));
        current_view->text->UnFreezeUndo();
 }
-#else
-extern "C" void FigureApplyCB(FL_OBJECT *, long)
-{
-       if (!current_view->available())
-               return;
 
-       Buffer * buffer = current_view->buffer();
-       if(buffer->isReadonly()) // paranoia
-               return;
-       
-       minibuffer->Set(_("Inserting figure..."));
-       if (fl_get_button(fd_form_figure->radio_inline)
-           || buffer->text->cursor.par->table) {
-               InsetFig * new_inset = new InsetFig(100, 20, buffer);
-               buffer->insertInset(new_inset);
-               minibuffer->Set(_("Figure inserted"));
-               new_inset->Edit(0, 0);
-               return;
-       }
-       
-       current_view->getScreen()->HideCursor();
-       buffer->update(-2);
-       BeforeChange();
-      
-       buffer->text->SetCursorParUndo(); 
-       buffer->text->FreezeUndo();
 
-       buffer->text->BreakParagraph();
-       buffer->update(-1);
-      
-       if (buffer->text->cursor.par->Last()) {
-               buffer->text->CursorLeft();
-        
-               buffer->text->BreakParagraph();
-               buffer->update(-1);
-       }
-
-       // The standard layout should always be numer 0;
-       buffer->text->SetLayout(0);
-       
-       if (buffer->text->cursor.par->footnoteflag == 
-           LyXParagraph::NO_FOOTNOTE) {
-               buffer->text->
-                       SetParagraph(0, 0,
-                                    0, 0,
-                                    VSpace (0.3 * buffer->params.spacing.getValue(),
-                                            LyXLength::CM),
-                                    VSpace (0.3 *
-                                            buffer->params.spacing.getValue(),
-                                            LyXLength::CM),
-                                    LYX_ALIGN_CENTER, string(), 0);
-       } else
-               buffer->text->SetParagraph(0, 0,
-                                          0, 0,
-                                          VSpace(VSpace::NONE),
-                                          VSpace(VSpace::NONE),
-                                          LYX_ALIGN_CENTER, 
-                                          string(),
-                                          0);
-       
-       buffer->update(-1);
-      
-       Inset * new_inset = new InsetFig(100, 100, buffer);
-       buffer->insertInset(new_inset);
-       new_inset->Edit(0, 0);
-       buffer->update(0);
-       minibuffer->Set(_("Figure inserted"));
-       buffer->text->UnFreezeUndo();
-}
-#endif
-   
 extern "C" void FigureCancelCB(FL_OBJECT *, long)
 {
        fl_hide_form(fd_form_figure->form_figure);
@@ -4260,7 +3670,7 @@ void Reconfigure()
        // Run configure in user lyx directory
        Path p(user_lyxdir);
        Systemcalls one(Systemcalls::System, 
-                          AddName(system_lyxdir, "configure"));
+                       AddName(system_lyxdir, "configure"));
        p.pop();
        minibuffer->Set(_("Reloading configuration..."));
        lyxrc->read(LibFileSearch(string(), "lyxrc.defaults"));
@@ -4279,11 +3689,7 @@ char * NextWord(float & value)
                return 0;
        }
 
-#ifdef MOVE_TEXT
        char * string =  current_view->text->SelectNextWord(value);
-#else
-       char * string =  current_view->buffer()->text->SelectNextWord(value);
-#endif
 
        return string;
 }
@@ -4297,15 +3703,9 @@ void SelectLastWord()
    
        current_view->getScreen()->HideCursor();
        BeforeChange();
-#ifdef MOVE_TEXT
        current_view->text->SelectSelectedWord();
        current_view->getScreen()->ToggleSelection(false);
        current_view->update(0);
-#else
-       current_view->buffer()->text->SelectSelectedWord();
-       current_view->getScreen()->ToggleSelection(false);
-       current_view->buffer()->update(0);
-#endif
 }
 
 
@@ -4317,15 +3717,9 @@ void EndOfSpellCheck()
    
        current_view->getScreen()->HideCursor();
        BeforeChange();
-#ifdef MOVE_TEXT
        current_view->text->SelectSelectedWord();
        current_view->text->ClearSelection();
        current_view->update(0);
-#else
-       current_view->buffer()->text->SelectSelectedWord();
-       current_view->buffer()->text->ClearSelection();
-       current_view->buffer()->update(0);
-#endif
 }
 
 
@@ -4336,7 +3730,6 @@ void ReplaceWord(string const & replacestring)
                return;
 
        current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
        current_view->update(-2);
    
        /* clear the selection (if there is any) */ 
@@ -4355,27 +3748,6 @@ void ReplaceWord(string const & replacestring)
                current_view->text->CursorLeftIntern();
        }
        current_view->update(1);
-#else
-       current_view->buffer()->update(-2);
-   
-       /* clear the selection (if there is any) */ 
-       current_view->getScreen()->ToggleSelection(false);
-
-       current_view->buffer()->update(-2);
-   
-       /* clear the selection (if there is any) */ 
-       current_view->getScreen()->ToggleSelection(false);
-       current_view->buffer()->text->
-               ReplaceSelectionWithString(replacestring.c_str());
-   
-       current_view->buffer()->text->SetSelectionOverString(replacestring.c_str());
-
-       // Go back so that replacement string is also spellchecked
-       for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
-               current_view->buffer()->text->CursorLeftIntern();
-       }
-       current_view->buffer()->update(1);
-#endif
 }
 // End of spellchecker stuff
 
@@ -4422,19 +3794,11 @@ extern "C" void TocSelectCB(FL_OBJECT * ob, long)
        }
    
        if (par) {
-#ifdef MOVE_TEXT
                BeforeChange();
                current_view->text->SetCursor(par, 0);
                current_view->text->sel_cursor = 
                        current_view->text->cursor;
                current_view->update(0);
-#else
-               BeforeChange();
-               current_view->buffer()->text->SetCursor(par, 0);
-               current_view->buffer()->text->sel_cursor = 
-                       current_view->buffer()->text->cursor;
-               current_view->buffer()->update(0);
-#endif
        }
        else {
                WriteAlert(_("Error"), 
@@ -4489,7 +3853,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
    
        while (par) {
                labeltype = textclasslist.Style(current_view->buffer()->params.textclass, 
-                                          par->GetLayout()).labeltype;
+                                               par->GetLayout()).labeltype;
       
                if (labeltype >= LABEL_COUNTER_CHAPTER
                    && labeltype <= LABEL_COUNTER_CHAPTER +
@@ -4500,7 +3864,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
                        for (pos = 0; 
                             pos < (labeltype - 
                                    textclasslist.TextClass(current_view->buffer()->
-                                                      params.textclass).maxcounter()) * 4 + 2;
+                                                           params.textclass).maxcounter()) * 4 + 2;
                             pos++)
                                line[pos] = ' ';
                        
@@ -4602,7 +3966,7 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
 
        // Get the current line, in order to restore it later
        char const * const btmp = fl_get_browser_line(brow,
-                                                    fl_get_browser(brow));
+                                                     fl_get_browser(brow));
        string currentstr = btmp ? btmp : "";
 
        fl_clear_browser(brow);
@@ -4672,7 +4036,6 @@ void UpdateInset(Inset * inset, bool mark_dirty)
 
        /* very first check for locking insets*/
        if (current_view->buffer()->the_locking_inset == inset){
-#ifdef MOVE_TEXT
                if (current_view->text->UpdateInset(inset)){
                        current_view->update();
                        if (mark_dirty){
@@ -4683,24 +4046,11 @@ void UpdateInset(Inset * inset, bool mark_dirty)
                        current_view->updateScrollbar();
                        return;
                }
-#else
-               if (current_view->buffer()->text->UpdateInset(inset)){
-                       current_view->update();
-                       if (mark_dirty){
-                               if (current_view->buffer()->isLyxClean())
-                                       minibuffer->setTimer(4);
-                               current_view->buffer()->markDirty();
-                       }
-                       current_view->updateScrollbar();
-                       return;
-               }
-#endif
        }
   
        /* first check the current buffer */
        if (current_view->available()){
                current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
                current_view->update(-3);
                if (current_view->text->UpdateInset(inset)){
                        if (mark_dirty)
@@ -4709,16 +4059,6 @@ void UpdateInset(Inset * inset, bool mark_dirty)
                                current_view->update(3);
                        return;
                }
-#else
-               current_view->buffer()->update(-3);
-               if (current_view->buffer()->text->UpdateInset(inset)){
-                       if (mark_dirty)
-                               current_view->buffer()->update(1);
-                       else 
-                               current_view->buffer()->update(3);
-                       return;
-               }
-#endif
        }
   
        // check all buffers
@@ -4745,11 +4085,7 @@ void ShowLockedInsetCursor(long x, long y, int asc, int desc)
 {
        if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-#ifdef MOVE_TEXT
                y += current_view->text->cursor.y;
-#else
-               y += current_view->buffer()->text->cursor.y;
-#endif
                current_view->getScreen()->ShowManualCursor(x, y,
                                                            asc, desc);
        }
@@ -4761,11 +4097,7 @@ void HideLockedInsetCursor(long x, long y, int asc, int desc)
 {
        if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-#ifdef MOVE_TEXT
                y += current_view->text->cursor.y;
-#else
-               y += current_view->buffer()->text->cursor.y;
-#endif
                current_view->getScreen()->HideManualCursor(x, y,
                                                            asc, desc);
        }
@@ -4777,11 +4109,7 @@ void FitLockedInsetCursor(long x, long y, int asc, int desc)
 {
        if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-#ifdef MOVE_TEXT
                y += current_view->text->cursor.y;
-#else
-               y += current_view->buffer()->text->cursor.y;
-#endif
                if (current_view->getScreen()->FitManualCursor(x, y, asc, desc))
                        current_view->updateScrollbar();
        }
@@ -4795,11 +4123,7 @@ int UnlockInset(UpdatableInset * inset)
            current_view->buffer()->the_locking_inset == inset){
                inset->InsetUnlock();
                current_view->buffer()->the_locking_inset = 0;
-#ifdef MOVE_TEXT
                current_view->text->FinishUndo();
-#else
-               current_view->buffer()->text->FinishUndo();
-#endif
                return 0;
        }
        return bufferlist.unlockInset(inset);
@@ -4813,19 +4137,11 @@ void LockedInsetStoreUndo(Undo::undo_kind kind)
                return; // shouldn't happen
        if (kind == Undo::EDIT) // in this case insets would not be stored!
                kind = Undo::FINISH;
-#ifdef MOVE_TEXT
        current_view->text->SetUndo(kind,
-                             current_view->text->cursor.par->
-                             ParFromPos(current_view->text->cursor.pos)->previous, 
-                             current_view->text->cursor.par->
-                             ParFromPos(current_view->text->cursor.pos)->next);
-#else
-       current_view->buffer()->text->SetUndo(kind,
-                             current_view->buffer()->text->cursor.par->
-                             ParFromPos(current_view->buffer()->text->cursor.pos)->previous, 
-                             current_view->buffer()->text->cursor.par->
-                             ParFromPos(current_view->buffer()->text->cursor.pos)->next);
-#endif
+                                   current_view->text->cursor.par->
+                                   ParFromPos(current_view->text->cursor.pos)->previous, 
+                                   current_view->text->cursor.par->
+                                   ParFromPos(current_view->text->cursor.pos)->next);
 }
 
 
@@ -4867,6 +4183,6 @@ void UpdateInsetUpdateList()
 // code is indented in the right way!!!
 void addNewlineAndDepth(string & file, int const depth)
 {
-       file += '\n';
-       file.append(depth, ' ');
+       file += '\n';
+       file.append(depth, ' ');
 }
index 9385f7482c2d3dd17236c3be7a42ca2bcf74e7c6..ae05fe64475e4bfd0d4cd64b664cc8176e549807 100644 (file)
@@ -63,12 +63,13 @@ bool setForegroundColor(char const * const color, XGCValues & val)
        if (!mono_video) {
                if (XParseColor(fl_display, color_map, color, &xcol)
                    && XAllocColor(fl_display, color_map, &xcol))
-               {
-                       val.foreground = xcol.pixel;
-               } else {
-                       lyxerr << "LyX: Couldn't get color " << color << endl;
-                       return false;
-               }
+                       {
+                               val.foreground = xcol.pixel;
+                       } else {
+                               lyxerr << "LyX: Couldn't get color "
+                                      << color << endl;
+                               return false;
+                       }
        }
        return true;
 }
@@ -79,14 +80,14 @@ void do_reverse_video(XGCValues &val)
 {
        if (reverse_video) {
                val.foreground= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.background= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        } else {
                val.foreground= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.background= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        }
 }
 
@@ -145,17 +146,22 @@ GC GetLatexGC()
 
        XGCValues val;
        if (reverse_video ^ mono_video) {
-               val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display));
-               val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
+               val.foreground= WhitePixel(fl_display,
+                                          DefaultScreen(fl_display));
+               val.background= BlackPixel(fl_display,
+                                          DefaultScreen(fl_display));
        } else {
-               val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display));
-               val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
+               val.foreground= BlackPixel(fl_display,
+                                          DefaultScreen(fl_display));
+               val.background= WhitePixel(fl_display,
+                                          DefaultScreen(fl_display));
        }
        val.function= GXcopy;
        val.graphics_exposures = false;
        setForegroundColor(latex_color, val);
        latex_gc = XCreateGC(fl_display, fl_root, GCBackground 
-                            | GCForeground | GCFunction | GCGraphicsExposures, 
+                            | GCForeground | GCFunction
+                            | GCGraphicsExposures, 
                             &val);
        XFlush(fl_display);
        
@@ -216,14 +222,14 @@ GC GetClearGC()
 
        if (reverse_video) {
                val.foreground= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.background= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        } else {
                val.background= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.foreground= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        }
        val.function = GXcopy;
        val.graphics_exposures = false;
@@ -233,7 +239,8 @@ GC GetClearGC()
        background_pixels = val.foreground;
        
        clear_gc = XCreateGC(fl_display, fl_root, GCBackground 
-                            | GCForeground | GCFunction | GCGraphicsExposures, 
+                            | GCForeground | GCFunction
+                            | GCGraphicsExposures, 
                             &val);
        XFlush(fl_display);
        
@@ -276,7 +283,8 @@ GC GetThickLineGC()
        val.line_width = 2;
        val.line_style = LineSolid;
        thick_line_gc = XCreateGC(fl_display, fl_root, GCBackground 
-                                 | GCForeground | GCFunction | GCGraphicsExposures
+                                 | GCForeground | GCFunction
+                                 | GCGraphicsExposures
                                  | GCLineWidth | GCLineStyle , &val);
        XFlush(fl_display);
        
@@ -339,7 +347,7 @@ GC GetSelectGC()
        val.function= GXinvert;
        select_gc = XCreateGC(fl_display, fl_root,
                              GCFunction | GCGraphicsExposures | GCPlaneMask
-                                     | GCLineWidth | GCLineStyle , &val);
+                             | GCLineWidth | GCLineStyle , &val);
        XFlush(fl_display);
 
        return select_gc; 
@@ -355,14 +363,14 @@ GC GetSelectionGC()
 
        if (!reverse_video) {
                val.foreground= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.background= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        } else {
                val.background= BlackPixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
                val.foreground= WhitePixel(fl_display,
-                                         DefaultScreen(fl_display));
+                                          DefaultScreen(fl_display));
        }
        
        val.function= GXcopy;
@@ -389,9 +397,11 @@ GC GetLightedGC()
        if (lighted_gc) return lighted_gc;
        XGCValues val;
        if (reverse_video) {
-               val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
+               val.background= BlackPixel(fl_display,
+                                          DefaultScreen(fl_display));
        } else {
-               val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
+               val.background= WhitePixel(fl_display,
+                                          DefaultScreen(fl_display));
        }
        val.foreground= val.background;
        val.function= GXcopy;
@@ -400,7 +410,8 @@ GC GetLightedGC()
        val.line_width = 0;
        setForegroundColor(lighted_color, val);
        lighted_gc = XCreateGC(fl_display, fl_root, GCBackground
-                              | GCForeground | GCFunction | GCGraphicsExposures
+                              | GCForeground | GCFunction
+                              | GCGraphicsExposures
                               | GCLineWidth | GCLineStyle , &val);
        XFlush(fl_display);
 
index f495367466fed13d61edfdea57c6b7a96a22ebf9..668cdde652f5fd2332a3bd874ae9278101290934 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1995 Matthias Ettrich
+ *         Copyright 1995 Matthias Ettrich
  *
  * ====================================================== */
 
@@ -24,7 +24,7 @@
 // for us, since we use these names below. But of course this is due
 // to some old compilers. Than is broken when it comes to C++ scoping.
 #include "gettext.h" // so that we are sure tht it won't be included
-                    // later. 
+// later. 
 #ifdef ON
 #undef ON
 #endif
@@ -39,11 +39,11 @@ class LyXLex;
 class LyXFont {
 public:
        /** The value INHERIT_* means that the font attribute is
-         inherited from the layout. In the case of layout fonts, the
-         attribute is inherited from the default font.
-         The value IGNORE_* is used with LyXFont::update() when the
-         attribute should not be changed.
-         */
+           inherited from the layout. In the case of layout fonts, the
+           attribute is inherited from the default font.
+           The value IGNORE_* is used with LyXFont::update() when the
+           attribute should not be changed.
+       */
        enum FONT_FAMILY {
                ///
                ROMAN_FAMILY, // fontstruct rely on this to be 0
@@ -272,7 +272,7 @@ public:
        string latexSize() const;
  
        /** Updates font settings according to request. If an
-         attribute is IGNORE, the attribute is left as it is. */
+           attribute is IGNORE, the attribute is left as it is. */
        /* 
         * When toggleall = true, all properties that matches the font in use
         * will have the effect that the properties is reset to the
@@ -284,7 +284,7 @@ public:
        void update(LyXFont const & newfont, bool toggleall = false);
  
        /** Reduce font to fall back to template where possible.
-         Equal fields are reduced to INHERIT */
+           Equal fields are reduced to INHERIT */
        void reduce(LyXFont const & tmplt);
  
        /// Realize font from a template (INHERIT are realized)
@@ -307,7 +307,7 @@ public:
        int latexWriteStartChanges(string &, LyXFont const & base) const;
 
        /** Writes tha tail of the LaTeX needed to chagne to this font.
-         Returns number of chars written. Base is the font state we want
+           Returns number of chars written. Base is the font state we want
            to achieve.
        */
        int latexWriteEndChanges(string &, LyXFont const & base) const;
@@ -374,15 +374,15 @@ private:
        typedef unsigned int ui32;
 
        /** Representation: bit table
-         Layout of bit table:
-                  11 1111 111 122 222 222 2233
-         Bit 012 34 567 8901 2345 678 901 234 567 8901
-             FFF SS SSS SSSS CCCC EEE UUU NNN LLL
-             aaa ee hhh iiii oooo mmm nnn ooo aaa
-             mmm rr aaa zzzz llll ppp ddd uuu ttt
-
-         Some might think this is a dirty representation, but it gives
-         us at least 25% speed-up, so why not?
+           Layout of bit table:
+           11 1111 111 122 222 222 2233
+           Bit 012 34 567 8901 2345 678 901 234 567 8901
+           FFF SS SSS SSSS CCCC EEE UUU NNN LLL
+           aaa ee hhh iiii oooo mmm nnn ooo aaa
+           mmm rr aaa zzzz llll ppp ddd uuu ttt
+
+           Some might think this is a dirty representation, but it gives
+           us at least 25% speed-up, so why not?
        */
        ui32 bits;
 
@@ -437,25 +437,25 @@ private:
  
        /// All inherit font
        enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
-               | ui32(INHERIT_SERIES) << Ser_Pos
-               | ui32(INHERIT_SHAPE) << Sha_Pos
-               | ui32(INHERIT_SIZE) << Siz_Pos
-               | ui32(INHERIT_COLOR) << Col_Pos
-               | ui32(INHERIT) << Emp_Pos
-               | ui32(INHERIT) << Und_Pos
-               | ui32(INHERIT) << Nou_Pos
-               | ui32(INHERIT) << Lat_Pos};
+                     | ui32(INHERIT_SERIES) << Ser_Pos
+                     | ui32(INHERIT_SHAPE) << Sha_Pos
+                     | ui32(INHERIT_SIZE) << Siz_Pos
+                     | ui32(INHERIT_COLOR) << Col_Pos
+                     | ui32(INHERIT) << Emp_Pos
+                     | ui32(INHERIT) << Und_Pos
+                     | ui32(INHERIT) << Nou_Pos
+                     | ui32(INHERIT) << Lat_Pos};
  
        /// All ignore font
        enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
-              | ui32(IGNORE_SERIES) << Ser_Pos
-              | ui32(IGNORE_SHAPE) << Sha_Pos
-              | ui32(IGNORE_SIZE) << Siz_Pos
-              | ui32(IGNORE_COLOR) << Col_Pos
-              | ui32(IGNORE) << Emp_Pos
-              | ui32(IGNORE) << Und_Pos
-              | ui32(IGNORE) << Nou_Pos
-              | ui32(IGNORE) << Lat_Pos};
+                     | ui32(IGNORE_SERIES) << Ser_Pos
+                     | ui32(IGNORE_SHAPE) << Sha_Pos
+                     | ui32(IGNORE_SIZE) << Siz_Pos
+                     | ui32(IGNORE_COLOR) << Col_Pos
+                     | ui32(IGNORE) << Emp_Pos
+                     | ui32(IGNORE) << Und_Pos
+                     | ui32(IGNORE) << Nou_Pos
+                     | ui32(IGNORE) << Lat_Pos};
  
        /// Updates a misc setting according to request
        LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
@@ -507,8 +507,8 @@ inline LyXFont & LyXFont::operator=(LyXFont const & x)
 }
 
 
- // You don't have to understand the stuff below :-)
- // It works, and it's bloody fast. (Asger)
+// You don't have to understand the stuff below :-)
+// It works, and it's bloody fast. (Asger)
 inline LyXFont::FONT_FAMILY LyXFont::family() const 
 {
        return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
index ea73c58e69e2fa09620383ba920438e59ba7ac67..eaeae2856b726a4c8d71a80c165044a9150f74e5 100644 (file)
@@ -35,8 +35,8 @@
 #include "support/lstrings.h"
 #include "support/textutils.h"
 
-extern BufferView *current_view; // called too many times in this file...
-extern MiniBuffer *minibuffer;
+extern BufferView * current_view; // called too many times in this file...
+extern MiniBuffer * minibuffer;
 
 // Maximum length copied from the current selection to the search string
 const int LYXSEARCH_MAXLEN =  128;
@@ -46,15 +46,15 @@ const int LYXSEARCH_MAXLEN =  128;
 // If nothing selected, select the word at the cursor.
 // Returns the current selection
 // Note: this function should be in LyXText!
-string const GetSelectionOrWordAtCursor(LyXText *lt);
+string const GetSelectionOrWordAtCursor(LyXText * lt);
 
 // Returns the current selection. If nothing is selected or if the selection
 // spans 2 paragraphs, an empty string is returned.
-string const GetCurrentSelectionAsString(LyXText *lt);
+string const GetCurrentSelectionAsString(LyXText * lt);
 
 // This is a copy of SetSelectionOverString from text.C
 // It does the same, but uses only the length as a parameter
-void SetSelectionOverLenChars(LyXText *lt, int len);
+void SetSelectionOverLenChars(LyXText * lt, int len);
 
 //-------------------------------------------------------------
 
@@ -64,9 +64,9 @@ void SetSelectionOverLenChars(LyXText *lt, int len);
 // spans 2 paragraphs, an empty string is returned.
 string const GetCurrentSelectionAsString(LyXText * lt) 
 {
-       char            sz[LYXSEARCH_MAXLEN];
-
+       char sz[LYXSEARCH_MAXLEN];
        sz[0] = 0;
+       
        LyXParagraph * par = lt->cursor.par;
        if (lt->selection && (lt->sel_cursor.par == par)) {
                // (selected) and (begin/end in same paragraph)
@@ -77,15 +77,15 @@ string const GetCurrentSelectionAsString(LyXText * lt)
                int i = 0;
                bool fPrevIsSpace = false;
                char ch;
-               while ((i < LYXSEARCH_MAXLEN-2) && 
-                       (pos < par->Last()) && (pos < endpos)) {
+               while ((i < LYXSEARCH_MAXLEN - 2) && 
+                      (pos < par->Last()) && (pos < endpos)) {
                        ch = par->GetChar(pos);
 
                        //HB??: Maybe (ch <= ' ') 
                        if ((ch == ' ') || (ch <= LyXParagraph::META_INSET)) {
                                // consecutive spaces --> 1 space char
                                if (fPrevIsSpace) {
-                                       pos++;          // Next text pos
+                                       ++pos;          // Next text pos
                                        continue;       // same search pos
                                }
                                sz[i] = ' ';
@@ -94,8 +94,8 @@ string const GetCurrentSelectionAsString(LyXText * lt)
                                sz[i] = ch;
                                fPrevIsSpace = false;
                        }
-                       pos++;
-                       i++;
+                       ++pos;
+                       ++i;
                } 
                sz[i] = 0;
        }
@@ -105,7 +105,7 @@ string const GetCurrentSelectionAsString(LyXText * lt)
 
 // If nothing selected, select the word at the cursor.
 // Returns the current selection
-string const GetSelectionOrWordAtCursor(LyXText *lt) 
+string const GetSelectionOrWordAtCursor(LyXText * lt) 
 {
        lt->SelectWordWhenUnderCursor();
        return GetCurrentSelectionAsString(lt);
@@ -114,11 +114,10 @@ string const GetSelectionOrWordAtCursor(LyXText *lt)
 
 // This is a copy of SetSelectionOverString from text.C
 // It does the same, but uses only the length as a parameter
-void SetSelectionOverLenChars(LyXText *lt, int len)
+void SetSelectionOverLenChars(LyXText * lt, int len)
 {
        lt->sel_cursor = lt->cursor;
-       int i;
-       for (i= 0; i < len; i++)
+       for (int i = 0; i < len; ++i)
                lt->CursorRight();
        lt->SetSelection();
 }
@@ -131,23 +130,17 @@ void LyXFindReplace1::StartSearch()
        LyXFindReplace0::StartSearch();
        SetReplaceEnabled(!current_view->buffer()->isReadonly());
        searchForward = true;
-#ifdef MOVE_TEXT
        if (lsSearch.empty()) 
                SetSearchString(GetSelectionOrWordAtCursor(current_view->text));
-#else
-       if (lsSearch.empty()) 
-               SetSearchString(GetSelectionOrWordAtCursor(current_view->buffer()->text));
-#endif
 }      
 
 
-// TODO?: the user can insert multiple spaces with this routine (1999-01-11, dnaber)
+// TODO?: the user can insert multiple spaces with this
+// routine (1999-01-11, dnaber)
 void LyXFindReplace1::SearchReplaceCB()
 {
-       if (!current_view->getScreen())
-               return;
-       if (current_view->buffer()->isReadonly())
-               return;
+       if (!current_view->getScreen()) return;
+       if (current_view->buffer()->isReadonly()) return;
        
        // CutSelection cannot cut a single space, so we have to stop
        // in order to avoid endless loop :-(
@@ -162,7 +155,6 @@ void LyXFindReplace1::SearchReplaceCB()
        string const replacestring = ReplaceString();
 
        current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
        current_view->update(-2);
 
        LyXText * ltCur = current_view->text;   
@@ -175,20 +167,6 @@ void LyXFindReplace1::SearchReplaceCB()
                        SetSelectionOverString(replacestring.c_str());
                current_view->update(1);
        }
-#else
-       current_view->buffer()->update(-2);
-
-       LyXText * ltCur = current_view->buffer()->text; 
-       if (ltCur->selection) {
-               // clear the selection (if there is any) 
-               current_view->getScreen()->ToggleSelection(false);
-               current_view->buffer()->text->
-                       ReplaceSelectionWithString(replacestring.c_str());
-               current_view->buffer()->text->
-                       SetSelectionOverString(replacestring.c_str());
-               current_view->buffer()->update(1);
-       }
-#endif
        
        // jump to next match:
        SearchCB( searchForward );
@@ -198,12 +176,8 @@ void LyXFindReplace1::SearchReplaceCB()
 // replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
 void LyXFindReplace1::SearchReplaceAllCB()
 {
-       LyXText * ltCur;
-
-       if (!current_view->getScreen())
-               return;
-       if (current_view->buffer()->isReadonly())
-               return;
+       if (!current_view->getScreen()) return;
+       if (current_view->buffer()->isReadonly()) return;
 
        // CutSelection cannot cut a single space, so we have to stop
        // in order to avoid endless loop :-(
@@ -212,19 +186,19 @@ void LyXFindReplace1::SearchReplaceAllCB()
                                             && SearchString()[0] == ' ') ) {
                WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
                                          "nor an empty character."));
-               return;
-       }
+               return;
+       }
 
        string const replacestring = ReplaceString();
 
        current_view->getScreen()->HideCursor();
 
-#ifdef MOVE_TEXT
        // start at top
        current_view->text->ClearSelection();
        current_view->text->CursorTop();
 
        int replace_count = 0;
+       LyXText * ltCur;
        do {
                ltCur = current_view->text;     
                if (ltCur->selection) {
@@ -238,26 +212,6 @@ void LyXFindReplace1::SearchReplaceAllCB()
                        ++replace_count;
                }
        } while( SearchCB(true) );
-#else
-       // start at top
-       current_view->buffer()->text->ClearSelection();
-       current_view->buffer()->text->CursorTop();
-
-       int replace_count = 0;
-       do {
-               ltCur = current_view->buffer()->text;   
-               if (ltCur->selection) {
-                       current_view->buffer()->update(-2);
-                       current_view->getScreen()->ToggleSelection(false);
-                       current_view->buffer()->text->
-                               ReplaceSelectionWithString(replacestring.c_str());
-                       current_view->buffer()->text->
-                               SetSelectionOverString(replacestring.c_str());
-                       current_view->buffer()->update(1); 
-                       replace_count++;
-               }
-       } while( SearchCB(true) );
-#endif
        if( replace_count == 0 ) {
                LyXBell();      
                minibuffer->Set(_("String not found!"));
@@ -275,33 +229,25 @@ void LyXFindReplace1::SearchReplaceAllCB()
 
 bool LyXFindReplace1::SearchCB(bool fForward)
 {
-       LyXText * ltCur;
-       bool result;
-
        // store search direction
        searchForward = fForward;
        
        if (!current_view->getScreen())
-               return(false);
+               return false;
    
        current_view->getScreen()->HideCursor();
-#ifdef MOVE_TEXT
        current_view->update(-2);
-       ltCur = current_view->text;
-#else
-       current_view->buffer()->update(-2);
-       ltCur = current_view->buffer()->text;
-#endif
+       LyXText * ltCur = current_view->text;
        if (ltCur->selection) 
                ltCur->cursor = fForward ? ltCur->sel_end_cursor :
-                                                 ltCur->sel_start_cursor;
+               ltCur->sel_start_cursor;
 
        ReInitFromForm();
        iLenSelected = SearchString().length();
+       bool result;
    
        if (!ValidSearchData() ||
            (fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
-#ifdef MOVE_TEXT
                current_view->update(-2);
 
                // clear the selection (if there is any) 
@@ -310,16 +256,6 @@ bool LyXFindReplace1::SearchCB(bool fForward)
 
                // set the new selection 
                SetSelectionOverLenChars(current_view->text, iLenSelected);
-#else
-               current_view->buffer()->update(-2);
-
-               // clear the selection (if there is any) 
-               current_view->getScreen()->ToggleSelection();
-               current_view->buffer()->text->ClearSelection();
-
-               // set the new selection 
-               SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
-#endif
                current_view->getScreen()->ToggleSelection(false);
                minibuffer->Set(_("Found."));
                result = true;
@@ -332,7 +268,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
        if (current_view->getWorkArea()->focus)
                current_view->getScreen()->ShowCursor();
 
-       return(result);
+       return result;
 }
 
 
@@ -345,8 +281,8 @@ bool LyXFindReplace1::SearchForward(LyXText * lt)
        LyXParagraph::size_type pos = lt->cursor.pos;
 
        while (par && !IsSearchStringInText(par, pos)) {
-               if (pos<par->Last()-1)
-                       pos++;
+               if (pos < par->Last() - 1)
+                       ++pos;
                else {
                        pos = 0;
                        par = par->Next();
@@ -363,21 +299,21 @@ bool LyXFindReplace1::SearchForward(LyXText * lt)
 // if the string can be found: return true and set the cursor to
 // the new position 
 // (was: LyXText::SearchBackward(char const* string) in text2.C )
-bool LyXFindReplace1::SearchBackward(LyXText *lt)
+bool LyXFindReplace1::SearchBackward(LyXText * lt)
 {
-       LyXParagraph *par = lt->cursor.par;
+       LyXParagraph * par = lt->cursor.par;
        int pos = lt->cursor.pos;
 
        do {
-               if (pos>0)
-                       pos--;
+               if (pos > 0)
+                       --pos;
                else {
                        // We skip empty paragraphs (Asger)
                        do {
                                par = par->Previous();
                                if (par)
-                                       pos = par->Last()-1;
-                       } while (par && pos<0);
+                                       pos = par->Last() - 1;
+                       } while (par && pos < 0);
                }
        } while (par && !IsSearchStringInText(par, pos));
   
@@ -408,12 +344,10 @@ int LyXFindReplace1::CompareChars(char chSearch, char chText)
 bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
                                           LyXParagraph::size_type pos)
 {
-       char            chSrch = 0;
-       char            chText;
-
-       if (!par) 
-               return false;
+       if (!par) return false;
 
+       char chSrch = 0;
+       char chText;
        bool fPrevIsSpace = false;
        int iText = 0;
        string::size_type iSrch = 0;
@@ -423,7 +357,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
                chText = par->GetChar(pos+iText);
                if (chText == ' ') {
                        if (fPrevIsSpace) {
-                               iText++;  // next Text pos
+                               ++iText;  // next Text pos
                                continue; // same search pos
                        }
                        fPrevIsSpace = true;
@@ -440,7 +374,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
                return false;
 
        if (!MatchWord() 
-           || ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos-1)))
+           || ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
                && (pos + iText >= par->Last() 
                    || !IsLetterCharOrDigit(par->GetChar(pos + iText))))) {
                iLenSelected = iText;
index f44b4ec0f978a45025040d712ac37021a88d24fd..526963a5601ab7e93cc5cc21a5b609d7a3be1aaf 100644 (file)
@@ -69,7 +69,7 @@
 extern bool cursor_follows_scrollbar;
 
 extern void InsertAsciiFile(string const &, bool);
-extern void math_insert_symbol(char const*);
+extern void math_insert_symbol(char const *);
 extern Bool math_insert_greek(char const); // why "Bool"?
 extern BufferList bufferlist;
 extern LyXServer * lyxserver;
@@ -80,13 +80,13 @@ extern bool selection_possible;
 extern kb_keymap * toplevel_keymap;
 
 extern void BeforeChange();
-extern void MenuWrite(Buffer*);
-extern void MenuWriteAs(Buffer*);
-extern int  MenuRunLaTeX(Buffer*);
-extern int  MenuBuildProg(Buffer*);
-extern int  MenuRunChktex(Buffer*);
+extern void MenuWrite(Buffer *);
+extern void MenuWriteAs(Buffer *);
+extern int  MenuRunLaTeX(Buffer *);
+extern int  MenuBuildProg(Buffer *);
+extern int  MenuRunChktex(Buffer *);
 extern bool MenuRunDvips(Buffer *, bool);
-extern void MenuPrint(Buffer*);
+extern void MenuPrint(Buffer *);
 extern void MenuSendto();
 extern void QuitLyX();
 extern void MenuFax(Buffer *);
@@ -112,10 +112,10 @@ extern void HFill();
 extern void MenuUndo();
 extern void MenuRedo();
 extern void SmallUpdate(signed char);
-extern void SetUpdateTimer(float timer= 0.3);
+extern void SetUpdateTimer(float timer = 0.3);
 extern void FreeUpdateTimer();
-extern bool MenuPreview(Buffer*);
-extern bool MenuPreviewPS(Buffer*);
+extern bool MenuPreview(Buffer *);
+extern bool MenuPreviewPS(Buffer *);
 extern void MenuInsertLabel(char const *);
 extern void MenuInsertRef();
 extern void MenuLayoutCharacter();
@@ -147,7 +147,7 @@ bool LyXFunc::show_sc = true;
 
 
 LyXFunc::LyXFunc(LyXView * o)
-       :owner(o)
+       : owner(o)
 {
        meta_fake_bit = 0;
        lyx_dead_action = LFUN_NOACTION;
@@ -164,7 +164,6 @@ LyXFunc::LyXFunc(LyXView * o)
 inline
 void LyXFunc::moveCursorUpdate(bool selecting)
 {
-#ifdef MOVE_TEXT
        if (selecting || owner->view()->text->mark_set) {
                owner->view()->text->SetSelection();
                owner->view()->getScreen()->ToggleToggle();
@@ -173,16 +172,7 @@ void LyXFunc::moveCursorUpdate(bool selecting)
                owner->view()->update(-2); // this IS necessary
                // (Matthias) 
        }
-#else
-       if (selecting || owner->buffer()->text->mark_set) {
-               owner->buffer()->text->SetSelection();
-               owner->view()->getScreen()->ToggleToggle();
-               owner->buffer()->update(0);
-       } else {
-               owner->buffer()->update(-2); // this IS necessary
-               // (Matthias) 
-       }
-#endif
+
        owner->view()->getScreen()->ShowCursor();
        
        /* ---> Everytime the cursor is moved, show the current font state. */
@@ -195,13 +185,11 @@ int LyXFunc::processKeyEvent(XEvent * ev)
 {
        char s_r[10];
        s_r[9] = '\0';
-       int num_bytes;
-       int action; 
        string argument;
        XKeyEvent * keyevent = &ev->xkey;
        KeySym keysym_return;
 
-       num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
+       int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
 
        if (lyxerr.debugging(Debug::KEY)) {
                lyxerr << "KeySym is "
@@ -225,11 +213,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
            owner->buffer()->the_locking_inset &&
            keysym_return == XK_Escape) {
                UnlockInset(owner->buffer()->the_locking_inset);
-#ifdef MOVE_TEXT
                owner->view()->text->CursorRight();
-#else
-               owner->buffer()->text->CursorRight();
-#endif
                return 0;
        }
 
@@ -245,9 +229,9 @@ int LyXFunc::processKeyEvent(XEvent * ev)
        // cancel and meta-fake keys. RVDK_PATCH_5
        cancel_meta_seq.reset();
 
-       action = cancel_meta_seq.addkey(keysym_return, keyevent->state
-                                       &(ShiftMask|ControlMask
-                                         |Mod1Mask)); 
+       int action = cancel_meta_seq.addkey(keysym_return, keyevent->state
+                                           &(ShiftMask|ControlMask
+                                             |Mod1Mask)); 
 
        // When not cancel or meta-fake, do the normal lookup. 
        // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
@@ -266,8 +250,8 @@ int LyXFunc::processKeyEvent(XEvent * ev)
        if (action == 0) action = LFUN_PREFIX;
 
        if (lyxerr.debugging(Debug::KEY)) {
-               char buf[100];
-               keyseq.print(buf, 100);
+               string buf;
+               keyseq.print(buf);
                lyxerr << "Key ["
                       << action << "]["
                       << buf << "]["
@@ -278,17 +262,17 @@ int LyXFunc::processKeyEvent(XEvent * ev)
        // why not return already here if action == -1 and
        // num_bytes == 0? (Lgb)
 
-       if(keyseq.length>1 || keyseq.length<-1){
-               char buf[100];
-               keyseq.print(buf, 100);
+       if(keyseq.length > 1 || keyseq.length < -1){
+               string buf;
+               keyseq.print(buf);
                owner->getMiniBuffer()->Set(buf);
        }
 
        if (action == -1) {
-               if (keyseq.length<-1) { // unknown key sequence...
-                       char buf[100];
+               if (keyseq.length < -1) { // unknown key sequence...
+                       string buf;
                        LyXBell();
-                       keyseq.print(buf, 100);
+                       keyseq.print(buf);
                        owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf);
                        return 0;
                }
@@ -363,64 +347,56 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
         static bool noLaTeX = lyxrc->latex_command == "none";
         bool disable = false;
         switch (action) {
-          case LFUN_PREVIEW:
-                  disable = noLaTeX || lyxrc->view_dvi_command == "none";
-                  break;       
-          case LFUN_PREVIEWPS: 
-                  disable = noLaTeX || lyxrc->view_ps_command == "none";
-                  break;
-          case LFUN_RUNLATEX:
-          case LFUN_RUNDVIPS:
-                  disable = noLaTeX;
-                  break;
-          case LFUN_MENUPRINT:
-                  disable = noLaTeX || lyxrc->print_command == "none";
-                  break;
-          case LFUN_FAX:
-                  disable = noLaTeX || lyxrc->fax_command == "none"; 
-                  break;
-          case LFUN_IMPORT:
-                  if (argument == "latex")
-                          disable = lyxrc->relyx_command == "none";
-                  break;
-          case LFUN_EXPORT:
-                  if (argument == "dvi" || argument == "postscript")
-                          disable = noLaTeX;
-                 if (argument == "html")
-                         disable = lyxrc->html_command == "none";
-                  break;
-         case LFUN_UNDO:
-                 disable = buf->undostack.empty();
-                 break;
-         case LFUN_REDO:
-                 disable = buf->redostack.empty();
-                 break;
-         case LFUN_SPELLCHECK:
-                 disable = lyxrc->isp_command == "none";
-                 break;
-         case LFUN_RUNCHKTEX:
-                 disable = lyxrc->chktex_command == "none";
-                 break;
-         case LFUN_LAYOUT_TABLE:
-#ifdef MOVE_TEXT
-                 disable = ! owner->view()->text->cursor.par->table;
-#else
-                 disable = ! buf->text->cursor.par->table;
-#endif
-                 break;
-         default:
-                  break;
+       case LFUN_PREVIEW:
+               disable = noLaTeX || lyxrc->view_dvi_command == "none";
+               break;  
+       case LFUN_PREVIEWPS: 
+               disable = noLaTeX || lyxrc->view_ps_command == "none";
+               break;
+       case LFUN_RUNLATEX:
+       case LFUN_RUNDVIPS:
+               disable = noLaTeX;
+               break;
+       case LFUN_MENUPRINT:
+               disable = noLaTeX || lyxrc->print_command == "none";
+               break;
+       case LFUN_FAX:
+               disable = noLaTeX || lyxrc->fax_command == "none"; 
+               break;
+       case LFUN_IMPORT:
+               if (argument == "latex")
+                       disable = lyxrc->relyx_command == "none";
+               break;
+       case LFUN_EXPORT:
+               if (argument == "dvi" || argument == "postscript")
+                       disable = noLaTeX;
+               if (argument == "html")
+                       disable = lyxrc->html_command == "none";
+               break;
+       case LFUN_UNDO:
+               disable = buf->undostack.empty();
+               break;
+       case LFUN_REDO:
+               disable = buf->redostack.empty();
+               break;
+       case LFUN_SPELLCHECK:
+               disable = lyxrc->isp_command == "none";
+               break;
+       case LFUN_RUNCHKTEX:
+               disable = lyxrc->chktex_command == "none";
+               break;
+       case LFUN_LAYOUT_TABLE:
+               disable = ! owner->view()->text->cursor.par->table;
+               break;
+       default:
+               break;
         }
         if (disable)
                 flag |= LyXFunc::Disabled;
 
        if (buf) {
                func_status box = LyXFunc::ToggleOff;
-#ifdef MOVE_TEXT
                LyXFont font = owner->view()->text->real_current_font;
-#else
-               LyXFont font = buf->text->real_current_font;
-#endif
                switch (action) {
                case LFUN_EMPH:
                        if (font.emph() == LyXFont::ON)
@@ -445,7 +421,6 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                flag |= box;
        }
 
-
        return flag;
 }
 
@@ -460,9 +435,8 @@ string LyXFunc::Dispatch(string const & s)
 }
 
 
-#ifdef MOVE_TEXT
 string LyXFunc::Dispatch(int ac,
-                         char const * do_not_use_this_arg)
+                        char const * do_not_use_this_arg)
 {
        string argument;
        kb_action action;
@@ -549,8 +523,10 @@ string LyXFunc::Dispatch(int ac,
        if (owner->view()->available() &&
            owner->buffer()->the_locking_inset) {
                if (action > 1
-                   || (action == LFUN_UNKNOWN_ACTION && keyseq.length>= -1)) {
-                       if (action == LFUN_UNKNOWN_ACTION && argument.empty()) {
+                   || (action == LFUN_UNKNOWN_ACTION
+                       && keyseq.length >= -1)) {
+                       if (action == LFUN_UNKNOWN_ACTION
+                           && argument.empty()) {
                                argument = keyseq.getiso();
                        }
                        // Undo/Redo pre 0.13 is a bit tricky for insets.
@@ -642,8 +618,8 @@ string LyXFunc::Dispatch(int ac,
                    && owner->view()->getScreen()) {
                        owner->view()->update(-2);
                }
-               char buf[100];
-               keyseq.print(buf, 100, true);
+               string buf;
+               keyseq.print(buf, true);
                owner->getMiniBuffer()->Set(buf, string(), string(), 1);
        }
        break;
@@ -665,8 +641,8 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_META_FAKE:                                 // RVDK_PATCH_5
        {
                meta_fake_bit = Mod1Mask;
-               char buf[100];
-               keyseq.print(buf, 98, true);
+               string buf;
+               keyseq.print(buf, true);
                string res = string("M-") + buf;
                setMessage(buf); // RVDK_PATCH_5
        }
@@ -687,7 +663,7 @@ string LyXFunc::Dispatch(int ac,
                    owner->view()->getWorkArea()->h / 2)        {
                        owner->view()->getScreen()->
                                Draw(owner->view()->text->cursor.y -
-                                    owner->view()->getWorkArea()->h/2);
+                                    owner->view()->getWorkArea()->h / 2);
                } else { // <= 
                        owner->view()->getScreen()->
                                Draw(0);
@@ -703,7 +679,7 @@ string LyXFunc::Dispatch(int ac,
                }
                break;
 
-       // --- Menus -----------------------------------------------
+               // --- Menus -----------------------------------------------
        case LFUN_MENUNEW:
                MenuNew(false);
                break;
@@ -782,7 +758,7 @@ string LyXFunc::Dispatch(int ac,
                        doImportASCII(false);
                } else if (imtyp == "asciiparagraph") {
                        doImportASCII(true);
-               // noweb
+                       // noweb
                } else if (imtyp == "noweb") {
                        doImportLaTeX(true);
                } else {
@@ -967,10 +943,10 @@ string LyXFunc::Dispatch(int ac,
                    && !owner->view()->text->selection
                    && owner->view()->text->cursor.par->footnoteflag
                    != LyXParagraph::NO_FOOTNOTE)
-               { // only melt footnotes with FOOTMELT, not margins etc
-                 if(owner->view()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
-                       MeltCB(ob, 0);
-               }
+                       { // only melt footnotes with FOOTMELT, not margins etc
+                               if(owner->view()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
+                                       MeltCB(ob, 0);
+                       }
                else
                        FootCB(ob, 0); 
                break;
@@ -1067,11 +1043,10 @@ string LyXFunc::Dispatch(int ac,
                if (tmpbuf)
                        owner->view()->buffer(tmpbuf);
        }
-               break;
+       break;
                        
        case LFUN_FILE_OPEN:
-               owner->view()->buffer(
-                       bufferlist.loadLyXFile(argument));
+               owner->view()->buffer(bufferlist.loadLyXFile(argument));
                break;
 
        case LFUN_LATEX_LOG:
@@ -1093,9 +1068,9 @@ string LyXFunc::Dispatch(int ac,
                // Pretend we got the name instead.
                Dispatch(int(LFUN_LAYOUT), 
                         textclasslist.NameOfLayout(owner->view()->
-                                              text->parameters->
-                                              textclass,
-                                              sel).c_str());
+                                                   text->parameters->
+                                                   textclass,
+                                                   sel).c_str());
                return string();
        }
                
@@ -1108,10 +1083,10 @@ string LyXFunc::Dispatch(int ac,
                // and current buffer's textclass (number). */    
                int layoutno = 
                        textclasslist.NumberOfLayout(owner->
-                                               view()->
-                                               text->parameters->
-                                               textclass,
-                                               argument).second;
+                                                    view()->
+                                                    text->parameters->
+                                                    textclass,
+                                                    argument).second;
 
                // see if we found the layout number:
                if (layoutno == -1) {
@@ -1861,7 +1836,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_CHARATCURSOR:
        {
                LyXParagraph::size_type pos = 
-                 owner->view()->text->cursor.pos;
+                       owner->view()->text->cursor.pos;
                if(pos < owner->view()->text->cursor.par->size())
                        dispatch_buffer = owner->view()->text->
                                cursor.par->text[pos];
@@ -1872,7 +1847,7 @@ string LyXFunc::Dispatch(int ac,
        
        case LFUN_GETXY:
                dispatch_buffer = 
-                        tostr(owner->view()->text->cursor.x) + ' '
+                       tostr(owner->view()->text->cursor.x) + ' '
                        + tostr(owner->view()->text->cursor.y);
                break;
                
@@ -1892,7 +1867,7 @@ string LyXFunc::Dispatch(int ac,
                        
        case LFUN_GETFONT:
        {
-               LyXFont *font = &(owner->view()->text->current_font);
+               LyXFont * font = &(owner->view()->text->current_font);
                 if(font->shape() == LyXFont::ITALIC_SHAPE)
                        dispatch_buffer = 'E';
                 else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
@@ -1905,7 +1880,7 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_GETLATEX:
        {
-               LyXFont *font = &(owner->view()->text->current_font);
+               LyXFont * font = &(owner->view()->text->current_font);
                 if(font->latex() == LyXFont::ON)
                        dispatch_buffer = 'L';
                 else
@@ -1922,8 +1897,8 @@ string LyXFunc::Dispatch(int ac,
                
        case LFUN_NOTIFY:
        {
-               char buf[100];
-               keyseq.print(buf, 100);
+               string buf;
+               keyseq.print(buf);
                dispatch_buffer = buf;
                lyxserver->notifyClient(dispatch_buffer);
        }
@@ -1993,10 +1968,10 @@ string LyXFunc::Dispatch(int ac,
        {
                char c;
                
-               if (keyseq.length == -1 && keyseq.getiso()!= 0) 
-                       c= keyseq.getiso();
+               if (keyseq.length == -1 && keyseq.getiso() != 0) 
+                       c = keyseq.getiso();
                else
-                       c= 0;
+                       c = 0;
                
                owner->getIntl()->getTrans()->
                        deadkey(c, get_accent(action).accent, 
@@ -2005,7 +1980,7 @@ string LyXFunc::Dispatch(int ac,
                // Need to reset, in case the minibuffer calls these
                // actions
                keyseq.reset();
-               keyseq.length= 0;
+               keyseq.length = 0;
                
                // copied verbatim from do_accent_char
                SmallUpdate(1);
@@ -2058,7 +2033,7 @@ string LyXFunc::Dispatch(int ac,
 #if 0
        case LFUN_INSERT_INSET_LATEX:
        {
-               Inset *new_inset = new InsetLatex(argument);
+               Inset * new_inset = new InsetLatex(argument);
                owner->buffer()->insertInset(new_inset);
        }
        break;
@@ -2079,7 +2054,7 @@ string LyXFunc::Dispatch(int ac,
        // Greek keyboard      
        case LFUN_GREEK_TOGGLE:
        {
-               greek_kb_flag = (greek_kb_flag) ? 0: 2;
+               greek_kb_flag = greek_kb_flag ? 0 : 2;
                if (greek_kb_flag) {
                        setMessage(N_("Math greek keyboard on"));
                } else {
@@ -2118,12 +2093,12 @@ string LyXFunc::Dispatch(int ac,
                if (owner->view()->available()) {
                        string s(argument);
                        if (s.empty())
-                           setErrorMessage(N_("Missing argument"));
+                               setErrorMessage(N_("Missing argument"));
                        else {
-                           string s1 = token(s, ' ', 1);
-                           int na = s1.empty() ? 0: atoi(s1.c_str());
-                           owner->buffer()->
-                             open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
+                               string s1 = token(s, ' ', 1);
+                               int na = s1.empty() ? 0: atoi(s1.c_str());
+                               owner->buffer()->
+                                       open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
                        }
                }
        }
@@ -2222,7 +2197,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_INDEX_INSERT_LAST:
        {
                // Can't do that at the beginning of a paragraph.
-               if (owner->view()->text->cursor.pos - 1 <0)
+               if (owner->view()->text->cursor.pos - 1 < 0)
                        break;
 
                InsetIndex * new_inset = new InsetIndex();
@@ -2231,37 +2206,37 @@ string LyXFunc::Dispatch(int ac,
                        new_inset->setContents(lsarg);
                        owner->buffer()->insertInset(new_inset);
                } else {
-                 //reh 98/09/21
-                 //get the current word for an argument
-                 LyXParagraph::size_type lastpos = 
-                         owner->view()->text->cursor.pos - 1;
-                 // Get the current word. note that this must be done
-                 // before inserting the inset, or the inset will
-                 // break the word
-                 string curstring(owner->view()
-                                  ->text->cursor.par->GetWord(lastpos));
-
-                 //make the new inset and write the current word into it
-                 InsetIndex * new_inset = new InsetIndex();
-
-                 new_inset->setContents(curstring);
-
-                 //don't edit it if the call was to INSERT_LAST
-                 if(action!= LFUN_INDEX_INSERT_LAST) {
-                     new_inset->Edit(0, 0);
-                 } else {
-                     //it looks blank on the screen unless
-                     //we do  something.  put it here.
-
-                     // move the cursor to the returned value of lastpos
-                     // but only for the auto-insert
-                     owner->view()->text->cursor.pos= lastpos;
-                 }
-
-                 //put the new inset into the buffer.
-                 // there should be some way of knowing the user
-                 //cancelled & avoiding this, but i don't know how
-                 owner->buffer()->insertInset(new_inset);
+                       //reh 98/09/21
+                       //get the current word for an argument
+                       LyXParagraph::size_type lastpos = 
+                               owner->view()->text->cursor.pos - 1;
+                       // Get the current word. note that this must be done
+                       // before inserting the inset, or the inset will
+                       // break the word
+                       string curstring(owner->view()
+                                        ->text->cursor.par->GetWord(lastpos));
+
+                       //make the new inset and write the current word into it
+                       InsetIndex * new_inset = new InsetIndex();
+
+                       new_inset->setContents(curstring);
+
+                       //don't edit it if the call was to INSERT_LAST
+                       if(action != LFUN_INDEX_INSERT_LAST) {
+                               new_inset->Edit(0, 0);
+                       } else {
+                               //it looks blank on the screen unless
+                               //we do  something.  put it here.
+
+                               // move the cursor to the returned value of lastpos
+                               // but only for the auto-insert
+                               owner->view()->text->cursor.pos = lastpos;
+                       }
+
+                       //put the new inset into the buffer.
+                       // there should be some way of knowing the user
+                       //cancelled & avoiding this, but i don't know how
+                       owner->buffer()->insertInset(new_inset);
                }
        }
        break;
@@ -2299,9 +2274,9 @@ string LyXFunc::Dispatch(int ac,
                           MakeDisplayPath(filename) + "...");
                owner->view()->savePosition();
                if (bufferlist.exists(filename))
-                 owner->view()->buffer(bufferlist.getBuffer(filename));
+                       owner->view()->buffer(bufferlist.getBuffer(filename));
                else
-                 owner->view()->buffer(bufferlist.loadLyXFile(filename));
+                       owner->view()->buffer(bufferlist.loadLyXFile(filename));
        }
        break;
 
@@ -2465,2199 +2440,115 @@ string LyXFunc::Dispatch(int ac,
 
        return res;
 }
-#else
-string LyXFunc::Dispatch(int ac,
-                         char const * do_not_use_this_arg)
-{
-       string argument;
-       kb_action action;
-        
-       FL_OBJECT * ob = 0;  // This will disapear soon
-    
-        // we have not done anything wrong yet.
-        errorstat = false;
-       dispatch_buffer.clear();
-       
-       // if action is a pseudo-action, we need the real action
-       if (lyxaction.isPseudoAction(ac)) {
-               string tmparg;
-               action = static_cast<kb_action>
-                       (lyxaction.retrieveActionArg(ac, tmparg));
-               if (!tmparg.empty())
-                       argument = tmparg;
-       } else {
-               action = static_cast<kb_action>(ac);
-               if (do_not_use_this_arg)
-                       argument = do_not_use_this_arg; // except here
-       }
-    
-       selection_possible = false;
-       
-       if (owner->view()->available() 
-           && owner->view()->getScreen())
-               owner->view()->getScreen()->HideCursor();
-
-       // We cannot use this function here
-       if (getStatus(action) & Disabled)
-               goto exit_with_message;
 
-       commandshortcut.clear();
-       
-       if (lyxrc->display_shortcuts && show_sc) {
-               if (action != LFUN_SELFINSERT) {
-                       // Put name of command and list of shortcuts
-                       // for it in minibuffer
-                       string comname = lyxaction.getActionName(action);
 
-                       int pseudoaction = action;
-                       bool argsadded = false;
+void LyXFunc::setupLocalKeymap()
+{
+       keyseq.stdmap = keyseq.curmap = toplevel_keymap;
+       cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap;
+}
 
-                       if (!argument.empty()) {
-                               // If we have the command with argument, 
-                               // this is better
-                               pseudoaction = 
-                                       lyxaction.searchActionArg(action,
-                                                                 argument.c_str());
 
-                               if (pseudoaction == -1) {
-                                       pseudoaction = action;
-                               } else {
-                                       comname += " " + argument;
-                                       argsadded = true;
-                               }
-                       }
+void LyXFunc::MenuNew(bool fromTemplate)
+{
+       string fname, initpath = lyxrc->document_path;
+       LyXFileDlg fileDlg;
 
-                       string shortcuts = toplevel_keymap->findbinding(pseudoaction);
+       if (owner->view()->available()) {
+               string trypath = owner->buffer()->filepath;
+               // If directory is writeable, use this as default.
+               if (IsDirWriteable(trypath) == 1)
+                       initpath = trypath;
+       }
 
-                       if (!shortcuts.empty()) {
-                               comname += ": " + shortcuts;
-                       } else if (!argsadded) {
-                               comname += " " + argument;
-                       }
+       ProhibitInput();
+       fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
+       fileDlg.SetButton(1, _("Templates"), lyxrc->template_path);
+       fname = fileDlg.Select(_("Enter Filename for new document"), 
+                              initpath, "*.lyx", _("newfile"));
+       AllowInput();
+       
+       if (fname.empty()) {
+               owner->getMiniBuffer()->Set(_("Canceled."));
+               lyxerr.debug() << "New Document Cancelled." << endl;
+               return;
+       }
+        
+       // get absolute path of file and make sure the filename ends
+       // with .lyx
+       string s = MakeAbsPath(fname);
+       if (!IsLyXFilename(s))
+               s += ".lyx";
 
-                       if (!comname.empty()) {
-                               comname = strip(comname);
-                               commandshortcut = "(" + comname + ')';
-                               owner->getMiniBuffer()->Set(commandshortcut);
-                               // Here we could even add a small pause,
-                               // to annoy the user and make him learn
-                               // the shortcuts.
-                               // No! That will just annoy, not teach
-                               // anything. The user will read the messages
-                               // if they are interested. (Asger)
+       // Check if the document already is open
+       if (bufferlist.exists(s)){
+               switch(AskConfirmation(_("Document is already open:"), 
+                                      MakeDisplayPath(s, 50),
+                                      _("Do you want to close that document now?\n"
+                                        "('No' will just switch to the open version)")))
+                       {
+                       case 1: // Yes: close the document
+                               if (!bufferlist.close(bufferlist.getBuffer(s)))
+                               // If close is canceled, we cancel here too.
+                                       return;
+                               break;
+                       case 2: // No: switch to the open document
+                               owner->view()->buffer(bufferlist.getBuffer(s));
+                               return;
+                       case 3: // Cancel: Do nothing
+                               owner->getMiniBuffer()->Set(_("Canceled."));
+                               return;
                        }
+       }
+        
+       // Check whether the file already exists
+       if (IsLyXFilename(s)) {
+               FileInfo fi(s);
+               if (fi.readable() &&
+                   AskQuestion(_("File already exists:"), 
+                               MakeDisplayPath(s, 50),
+                               _("Do you want to open the document?"))) {
+                       // loads document
+                       owner->getMiniBuffer()->Set(_("Opening document"), 
+                                                   MakeDisplayPath(s), "...");
+                       XFlush(fl_display);
+                       owner->view()->buffer(
+                               bufferlist.loadLyXFile(s));
+                       owner->getMiniBuffer()->Set(_("Document"),
+                                                   MakeDisplayPath(s),
+                                                   _("opened."));
+                       return;
                }
-        }
+       }
 
-       // If in math mode pass the control to
-       // the math inset [asierra060396]
-       if (owner->view()->available() &&
-           owner->buffer()->the_locking_inset) {
-               if (action > 1
-                   || (action == LFUN_UNKNOWN_ACTION && keyseq.length>= -1)) {
-                       if (action == LFUN_UNKNOWN_ACTION && argument.empty()) {
-                               argument = keyseq.getiso();
-                       }
-                       // Undo/Redo pre 0.13 is a bit tricky for insets.
-                       if (action == LFUN_UNDO) {
-                               int slx, sly;
-                               UpdatableInset * inset = 
-                                       owner->buffer()->the_locking_inset;
-                               inset->GetCursorPos(slx, sly);
-                               UnlockInset(inset);
-                               MenuUndo();
-                               inset = static_cast<UpdatableInset*>(owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos));
-                               if (inset) 
-                                       inset->Edit(slx, sly);
-                               return string();
-                       } else 
-                               if (action == LFUN_REDO) {
-                                       int slx, sly;
-                                       UpdatableInset * inset = owner->buffer()->the_locking_inset;
-                                       inset->GetCursorPos(slx, sly);
-                                       UnlockInset(inset);
-                                       MenuRedo();
-                                       inset = static_cast<UpdatableInset*>(owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos));
-                                       if (inset)
-                                               inset->Edit(slx, sly);
-                                       return string();
-                               } else
-                                       if (owner->buffer()->the_locking_inset->LocalDispatch(action, argument.c_str()))
-                                               return string();
-                                       else {
-                                               setMessage(N_("Text mode"));
-                                               if (action == LFUN_RIGHT || action == -1)
-                                                       owner->buffer()->text->CursorRight();
-                                               if (action == LFUN_LEFT || action == LFUN_RIGHT)
-                                                       return string();
-                                       }
-               }
+       // The template stuff
+       string templname;
+       if (fromTemplate) {
+               ProhibitInput();
+               fname = fileDlg.Select(_("Choose template"),
+                                      lyxrc->template_path,
+                                      "*.lyx");
+                templname = fname;
+               AllowInput();
        }
+  
+       // find a free buffer
+       lyxerr.debug() << "Find a free buffer." << endl;
+       owner->view()->buffer(bufferlist.newFile(s, templname));
+}
 
-       switch(action) {
-               // --- Misc -------------------------------------------
-       case LFUN_WORDFINDFORWARD  : 
-       case LFUN_WORDFINDBACKWARD : {
-               static string last_search;
-               string searched_string;
-           
-               if (!argument.empty()) {
-                       last_search = argument;
-                       searched_string = argument;
-               } else {
-                       searched_string = last_search;
-               }
 
-               LyXText * ltCur = owner->view()->buffer()->text ;
-
-               if (!searched_string.empty() &&
-                   ((action == LFUN_WORDFINDBACKWARD) ? 
-                    ltCur->SearchBackward(searched_string.c_str()) :
-                    ltCur->SearchForward(searched_string.c_str()))) {
-
-                       // ??? What is that ???
-                       owner->view()->buffer()->update(-2);
-
-                       // ??? Needed ???
-                       // clear the selection (if there is any) 
-                       owner->view()->getScreen()->ToggleSelection();
-                       owner->view()->buffer()->text->ClearSelection();
-
-                       // Move cursor so that successive C-s 's will not stand in place. 
-                       if( action == LFUN_WORDFINDFORWARD ) 
-                               owner->buffer()->text->CursorRightOneWord();
-                       owner->buffer()->text->FinishUndo();
-                       moveCursorUpdate(false);
-
-                       // ??? Needed ???
-                       // set the new selection 
-                       // SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
-                       owner->view()->getScreen()->ToggleSelection(false);
-               } else 
-                       LyXBell();      
-        
-               // REMOVED : if (owner->view()->getWorkArea()->focus)
-               owner->view()->getScreen()->ShowCursor();
-       }
-       break;
-
-       case LFUN_PREFIX:
-       {
-               if (owner->view()->available()
-                   && owner->view()->getScreen()) {
-                       owner->buffer()->update(-2);
-               }
-               char buf[100];
-               keyseq.print(buf, 100, true);
-               owner->getMiniBuffer()->Set(buf, string(), string(), 1);
-       }
-       break;
-
-       // --- Misc -------------------------------------------
-       case LFUN_EXEC_COMMAND:
-               owner->getMiniBuffer()->ExecCommand(); 
-               break;
-               
-       case LFUN_CANCEL:                   // RVDK_PATCH_5
-               keyseq.reset();
-               meta_fake_bit = 0;
-               if(owner->view()->available())
-                       // cancel any selection
-                       Dispatch(LFUN_MARK_OFF, 0);
-               setMessage(N_("Cancel"));
-               break;
-
-       case LFUN_META_FAKE:                                 // RVDK_PATCH_5
-       {
-               meta_fake_bit = Mod1Mask;
-               char buf[100];
-               keyseq.print(buf, 98, true);
-               string res = string("M-") + buf;
-               setMessage(buf); // RVDK_PATCH_5
-       }
-       break;  
-
-       case LFUN_READ_ONLY_TOGGLE:
-               if (owner->buffer()->lyxvc.inUse()) {
-                       owner->buffer()->lyxvc.toggleReadOnly();
-               } else {
-                       owner->buffer()->setReadonly(
-                               !owner->buffer()->isReadonly());
-               }
-               break;
-               
-       case LFUN_CENTER: // this is center and redraw.
-               BeforeChange();
-               if (owner->buffer()->text->cursor.y >
-                   owner->view()->getWorkArea()->h / 2)        {
-                       owner->view()->getScreen()->
-                               Draw(owner->buffer()->text->cursor.y -
-                                    owner->view()->getWorkArea()->h/2);
-               } else { // <= 
-                       owner->view()->getScreen()->
-                               Draw(0);
-               }
-               owner->buffer()->update(0);
-               owner->view()->redraw();
-               break;
-               
-       case LFUN_APPENDIX:
-               if (owner->view()->available()) {
-                       owner->buffer()->text->toggleAppendix();
-                       owner->buffer()->update(1);
-               }
-               break;
-
-       // --- Menus -----------------------------------------------
-       case LFUN_MENUNEW:
-               MenuNew(false);
-               break;
-               
-       case LFUN_MENUNEWTMPLT:
-               MenuNew(true);
-               break;
-               
-       case LFUN_MENUOPEN:
-               MenuOpen();
-               break;
-               
-       case LFUN_CLOSEBUFFER:
-               CloseBuffer();
-               break;
-               
-       case LFUN_MENUWRITE:
-               MenuWrite(owner->buffer());
-               break;
-               
-       case LFUN_MENUWRITEAS:
-               MenuWriteAs(owner->buffer());
-               break;
-               
-       case LFUN_MENURELOAD:
-               reloadBuffer();
-               break;
-               
-       case LFUN_PREVIEW:
-               MenuPreview(owner->buffer());
-               break;
-                       
-       case LFUN_PREVIEWPS:
-               MenuPreviewPS(owner->buffer());
-               break;
-               
-       case LFUN_RUNLATEX:
-               MenuRunLaTeX(owner->buffer());
-               break;
-               
-        case LFUN_BUILDPROG:
-                MenuBuildProg(owner->buffer());
-                break;
-                
-       case LFUN_RUNCHKTEX:
-               MenuRunChktex(owner->buffer());
-               break;
-               
-       case LFUN_RUNDVIPS:
-               MenuRunDvips(owner->buffer(), false);
-               break;
-               
-       case LFUN_MENUPRINT:
-               MenuPrint(owner->buffer());
-               break;
-               
-       case LFUN_FAX:
-               MenuFax(owner->buffer());
-               break;
-                       
-       case LFUN_EXPORT:
-       {
-               //needs argument as string
-               string extyp = argument;
-               
-               // latex
-               if (extyp == "latex") {
-                       // make sure that this buffer is not linuxdoc
-                       MenuMakeLaTeX(owner->buffer());
-               }
-               // linuxdoc
-               else if (extyp == "linuxdoc") {
-                       // make sure that this buffer is not latex
-                       MenuMakeLinuxDoc(owner->buffer());
-               }
-               // docbook
-               else if (extyp == "docbook") {
-                       // make sure that this buffer is not latex or linuxdoc
-                       MenuMakeDocBook(owner->buffer());
-               }
-               // dvi
-               else if (extyp == "dvi") {
-                       // Run LaTeX as "Update dvi..." Bernhard.
-                       // We want the dvi in the current directory. This
-                       // is achieved by temporarily disabling use of
-                       // temp directory. As a side-effect, we get
-                       // *.log and *.aux files also. (Asger)
-                       bool flag = lyxrc->use_tempdir;
-                       lyxrc->use_tempdir = false;
-                       MenuRunLaTeX(owner->buffer());
-                       lyxrc->use_tempdir = flag;
-               }
-               // postscript
-               else if (extyp == "postscript") {
-                       // Start Print-dialog. Not as good as dvi... Bernhard.
-                       MenuPrint(owner->buffer());
-                       // Since the MenuPrint is a pop-up, we can't use
-                       // the same trick as above. (Asger)
-                       // MISSING: Move of ps-file :-(
-               }
-               // ascii
-               else if (extyp == "ascii") {
-                       MenuMakeAscii(owner->buffer());
-               }
-               else if (extyp == "custom") {
-                       MenuSendto();
-                       break;
-               }
-               // HTML
-               else if (extyp == "html" && lyxrc->html_command != "none") {
-                       // First, create LaTeX file
-                       MenuMakeLaTeX(owner->buffer());
-
-                       // And now, run the converter
-                       string file = owner->buffer()->getFileName();
-                       Path path(OnlyPath(file));
-                       // the tex file name has to be correct for
-                       // latex, but the html file name can be
-                       // anything.
-                       string result = ChangeExtension(file, ".html", false);
-                       string infile = owner->buffer()->getLatexName();
-                       string tmp = lyxrc->html_command;
-                       tmp = subst(tmp, "$$FName", infile);
-                       tmp = subst(tmp, "$$OutName", result);
-                       Systemcalls one;
-                       int res = one.startscript(Systemcalls::System, tmp);
-                       if (res == 0) {
-                               setMessage(N_("Document exported as HTML to file `")
-                                          + MakeDisplayPath(result) +'\'');
-                       } else {
-                               setErrorMessage(N_("Unable to convert to HTML the file `")
-                                               + MakeDisplayPath(infile) 
-                                               + '\'');
-                       }
-               }
-               else {
-                       setErrorMessage(N_("Unknown export type: ")
-                                       + extyp);
-               }
-       }
-       break;
-
-       case LFUN_IMPORT:
-       {
-               //needs argument as string
-               string imtyp = argument;
-               
-               // latex
-               if (imtyp == "latex") {
-                       doImportLaTeX(false);
-               }
-               // ascii
-               else if (imtyp == "ascii") {
-                       doImportASCII(false);
-               } else if (imtyp == "asciiparagraph") {
-                       doImportASCII(true);
-               // noweb
-               } else if (imtyp == "noweb") {
-                       doImportLaTeX(true);
-               } else {
-                       setErrorMessage(string(N_("Unknown import type: "))
-                                       + imtyp);
-               }
-               break;
-       }
-               
-       case LFUN_QUIT:
-               QuitLyX();
-               break;
-               
-       case LFUN_TOCVIEW:
-               TocUpdateCB(ob, 0);
-               if (fd_form_toc->form_toc->visible) {
-                       fl_raise_form(fd_form_toc->form_toc);
-               } else {
-                       static int ow = -1, oh;
-                       fl_show_form(fd_form_toc->form_toc,
-                                    FL_PLACE_MOUSE |
-                                    FL_FREE_SIZE, FL_FULLBORDER,
-                                    _("Table of Contents"));
-                       if (ow < 0) {
-                               ow = fd_form_toc->form_toc->w;
-                               oh = fd_form_toc->form_toc->h;
-                       }
-                       fl_set_form_minsize(fd_form_toc->form_toc, ow, oh);
-               }
-               break;
-               
-       case LFUN_TOC_INSERT:
-       {
-               Inset * new_inset = new InsetTOC(owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-               break;
-       }
-       
-       case LFUN_LOF_INSERT:
-       {
-               Inset * new_inset = new InsetLOF(owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-               break;
-       }
-       
-       case LFUN_LOA_INSERT:
-       {
-               Inset * new_inset = new InsetLOA(owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-               break;
-       }
-
-       case LFUN_LOT_INSERT:
-       {
-               Inset * new_inset = new InsetLOT(owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-               break;
-       }
-               
-       case LFUN_TABLE:
-               TableCB(ob, 0);
-               break;
-               
-       case LFUN_FIGURE:
-               FigureCB(ob, 0);
-               break;
-               
-       case LFUN_AUTOSAVE:
-               AutoSave();
-               break;
-               
-       case LFUN_UNDO:
-               MenuUndo();
-               break;
-               
-       case LFUN_REDO:
-               MenuRedo();
-               break;
-               
-       case LFUN_MENUSEARCH:
-               MenuSearch();
-               break;
-               
-       case LFUN_PASTE:
-               PasteCB();
-               break;
-               
-       case LFUN_PASTESELECTION:
-       {
-               bool asPara = false;
-               if (argument == "paragraph") asPara = true;
-               MenuPasteSelection(asPara);
-               break;
-       }
-
-       case LFUN_CUT:
-               CutCB();
-               break;
-               
-       case LFUN_COPY:
-               CopyCB();
-               break;
-               
-       case LFUN_LAYOUT_COPY:
-               CopyEnvironmentCB();
-               break;
-               
-       case LFUN_LAYOUT_PASTE:
-               PasteEnvironmentCB();
-               break;
-               
-       case LFUN_GOTOERROR:
-               owner->view()->gotoError();
-               break;
-               
-       case LFUN_REMOVEERRORS:
-               if (owner->buffer()->removeAutoInsets()) {
-                       owner->view()->redraw();
-                       owner->view()->fitCursor();
-                       owner->view()->updateScrollbar();
-               }
-               break;
-               
-       case LFUN_GOTONOTE:
-               GotoNote();
-               break;
-               
-       case LFUN_OPENSTUFF:
-               OpenStuff();
-               break;
-               
-       case LFUN_HYPHENATION:
-               HyphenationPoint();
-               break;
-               
-       case LFUN_LDOTS:
-               Ldots();
-               break;
-               
-       case LFUN_END_OF_SENTENCE:
-               EndOfSentenceDot();
-               break;
-
-       case LFUN_MENU_SEPARATOR:
-               MenuSeparator();
-               break;
-               
-       case LFUN_HFILL:
-               HFill();
-               break;
-               
-       case LFUN_DEPTH:
-               DepthCB(ob, 0);
-               break;
-               
-       case LFUN_DEPTH_MIN:
-               DepthCB(ob, -1);
-               break;
-               
-       case LFUN_DEPTH_PLUS:
-               DepthCB(ob, 1);
-               break;
-               
-       case LFUN_FREE:
-               FreeCB();
-               break;
-               
-       case LFUN_TEX:
-               TexCB();
-               break;
-               
-       case LFUN_MELT:
-               MeltCB(ob, 0);
-               break;
-               
-       case LFUN_RECONFIGURE:
-               Reconfigure();
-               break;
-
-       case LFUN_FOOTMELT:
-               if (owner->view()->available()
-                   && !owner->buffer()->text->selection
-                   && owner->buffer()->text->cursor.par->footnoteflag
-                   != LyXParagraph::NO_FOOTNOTE)
-               { // only melt footnotes with FOOTMELT, not margins etc
-                 if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
-                       MeltCB(ob, 0);
-               }
-               else
-                       FootCB(ob, 0); 
-               break;
-
-       case LFUN_MARGINMELT:
-               if (owner->view()->available()
-                   && !owner->buffer()->text->selection
-                   && owner->buffer()->text->cursor.par->footnoteflag
-                   != LyXParagraph::NO_FOOTNOTE) {
-                       // only melt margins
-                       if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
-                               MeltCB(ob, 0);
-               }
-               else
-                       MarginCB(ob, 0); 
-               break;
-               
-               // --- version control -------------------------------
-       case LFUN_VC_REGISTER:
-       {
-               if (!owner->buffer()->lyxvc.inUse())
-                       owner->buffer()->lyxvc.registrer();
-       }
-       break;
-               
-       case LFUN_VC_CHECKIN:
-       {
-               if (owner->buffer()->lyxvc.inUse()
-                   && !owner->buffer()->isReadonly())
-                       owner->buffer()->lyxvc.checkIn();
-       }
-       break;
-               
-       case LFUN_VC_CHECKOUT:
-       {
-               if (owner->buffer()->lyxvc.inUse()
-                   && owner->buffer()->isReadonly())
-                       owner->buffer()->lyxvc.checkOut();
-       }
-       break;
-       
-       case LFUN_VC_REVERT:
-       {
-               owner->buffer()->lyxvc.revert();
-       }
-       break;
-               
-       case LFUN_VC_UNDO:
-       {
-               owner->buffer()->lyxvc.undoLast();
-       }
-       break;
-               
-       case LFUN_VC_HISTORY:
-       {
-               owner->buffer()->lyxvc.showLog();
-               break;
-       }
-       
-       // --- buffers ----------------------------------------
-       case LFUN_PREVBUFFER:
-#ifdef WITH_WARNINGS
-#warning fix this please
-#endif
-               // it is the LyXView or the BufferView that should
-               // remember the previous buffer, not bufferlist.
-//                     if (owner->view()->available()){          
-//                             BeforeChange();
-//                             owner->buffer()->update(-2);
-//                     }
-//                     owner->view()->setBuffer(bufferlist.prev());
-
-//                     owner->view()->
-//                             resizeCurrentBufferPseudoExpose();
-               break;
-                       
-       case LFUN_FILE_INSERT:
-       {
-               MenuInsertLyXFile(argument);
-       }
-       break;
-       
-       case LFUN_FILE_INSERT_ASCII:
-       {
-               bool asPara = (argument == "paragraph");
-               InsertAsciiFile(string(), asPara);
-       }
-       break;
-       
-       case LFUN_FILE_NEW:
-       {
-               // servercmd: argument must be <file>:<template>
-               Buffer * tmpbuf = NewLyxFile(argument);
-               if (tmpbuf)
-                       owner->view()->buffer(tmpbuf);
-       }
-               break;
-                       
-       case LFUN_FILE_OPEN:
-               owner->view()->buffer(
-                       bufferlist.loadLyXFile(argument));
-               break;
-
-       case LFUN_LATEX_LOG:
-               ShowLatexLog();
-               break;
-               
-       case LFUN_LAYOUTNO:
-       {
-               lyxerr.debug() << "LFUN_LAYOUTNO: (arg) " << argument << endl;
-               int sel = strToInt(argument);
-               lyxerr.debug() << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
-               
-               // Should this give a setMessage instead?
-               if (sel == 0) 
-                       return string(); // illegal argument
-
-               sel--; // sel 1..., but layout 0...
-
-               // Pretend we got the name instead.
-               Dispatch(int(LFUN_LAYOUT), 
-                        textclasslist.NameOfLayout(owner->buffer()->
-                                              text->parameters->
-                                              textclass,
-                                              sel).c_str());
-               return string();
-       }
-               
-       case LFUN_LAYOUT:
-       {
-               lyxerr.debug() << "LFUN_LAYOUT: (arg) "
-                              << argument << endl;
-               
-               // Derive layout number from given argument (string)
-               // and current buffer's textclass (number). */    
-               int layoutno = 
-                       textclasslist.NumberOfLayout(owner->
-                                               buffer()->
-                                               text->parameters->
-                                               textclass,
-                                               argument).second;
-
-               // see if we found the layout number:
-               if (layoutno == -1) {
-                       setErrorMessage(string(N_("Layout ")) + argument + 
-                                       N_(" not known"));
-                       break;
-               }
-                       
-               if (current_layout != layoutno) {
-                       owner->view()->getScreen()->HideCursor();
-                       current_layout = layoutno;
-                       owner->buffer()->update(-2);
-                       owner->buffer()->text->
-                               SetLayout(layoutno);
-                       owner->getToolbar()->combox->
-                               select(owner->buffer()->
-                                      text->cursor.par->
-                                      GetLayout() + 1);
-                       owner->buffer()->update(1);
-               }
-       }
-       break;
-
-       case LFUN_LAYOUT_DOCUMENT:
-               MenuLayoutDocument();
-               break;
-               
-       case LFUN_LAYOUT_PARAGRAPH:
-               MenuLayoutParagraph();
-               break;
-               
-       case LFUN_LAYOUT_CHARACTER:
-               MenuLayoutCharacter();
-               break;
-               
-       case LFUN_LAYOUT_TABLE:
-       {
-               int flag = 0;
-               if (argument == "true") flag = 1;
-               MenuLayoutTable(flag);
-       }
-       break;
-               
-       case LFUN_LAYOUT_PAPER:
-               MenuLayoutPaper();
-               break;
-               
-       case LFUN_LAYOUT_QUOTES:
-               MenuLayoutQuotes();
-               break;
-               
-       case LFUN_LAYOUT_PREAMBLE:
-               MenuLayoutPreamble();
-               break;
-               
-       case LFUN_LAYOUT_SAVE_DEFAULT:
-               MenuLayoutSave();
-               break;
-               
-       case LFUN_DROP_LAYOUTS_CHOICE:
-               owner->getToolbar()->combox->Show();
-               break;
-
-       case LFUN_EMPH:
-               EmphCB();
-               break;
-               
-       case LFUN_BOLD:
-               BoldCB();
-               break;
-               
-       case LFUN_NOUN:
-               NounCB();
-               break;
-               
-       case LFUN_CODE:
-               CodeCB();
-               break;
-               
-       case LFUN_SANS:
-               SansCB();
-               break;
-               
-       case LFUN_ROMAN:
-               RomanCB();
-               break;
-               
-       case LFUN_DEFAULT:
-               StyleResetCB();
-               break;
-               
-       case LFUN_UNDERLINE:
-               UnderlineCB();
-               break;
-               
-       case LFUN_FONT_SIZE:
-               FontSizeCB(argument);
-               break;
-               
-       case LFUN_FONT_STATE:
-               setMessage(CurrentState());
-               break;
-               
-       case LFUN_UPCASE_WORD:
-               owner->buffer()->update(-2);
-               FreeUpdateTimer();
-               owner->buffer()->text->ChangeWordCase(LyXText::text_uppercase);
-               owner->buffer()->update(1);
-               SetUpdateTimer();
-               break;
-               
-       case LFUN_LOWCASE_WORD:
-               owner->buffer()->update(-2);
-               FreeUpdateTimer();
-               owner->buffer()->text->ChangeWordCase(LyXText::text_lowercase);
-               owner->buffer()->update(1);
-               SetUpdateTimer();
-               break;
-               
-       case LFUN_CAPITALIZE_WORD:
-               owner->buffer()->update(-2);
-               FreeUpdateTimer();
-               owner->buffer()->text->ChangeWordCase(LyXText::text_capitalization);
-               owner->buffer()->update(1);
-               SetUpdateTimer();
-               break;
-               
-       case LFUN_INSERT_LABEL:
-               MenuInsertLabel(argument.c_str());
-               break;
-               
-       case LFUN_INSERT_REF:
-               MenuInsertRef();
-               break;
-               
-       case LFUN_REFTOGGLE:
-       {
-               InsetRef * inset = 
-                       static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
-               if (inset) {
-                       if (inset->getFlag() == InsetRef::REF)
-                               inset->setFlag(InsetRef::PAGE_REF);
-                       else
-                               inset->setFlag(InsetRef::REF);
-                       UpdateInset(inset);
-               } else {
-                       setErrorMessage(N_("No cross-reference to toggle"));
-               }
-       }
-       break;
-       
-       case LFUN_REFBACK:
-       {
-               owner->view()->restorePosition();
-       }
-       break;
-
-       case LFUN_REFGOTO:
-       {
-               string label(argument);
-               if (label.empty()) {
-                       InsetRef * inset = 
-                               static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
-                       if (inset)
-                                label = inset->getContents();
-               }
-               
-               if (!label.empty()) {
-                       owner->view()->savePosition();
-                       owner->buffer()->gotoLabel(label.c_str());
-               }
-       }
-       break;
-               
-       case LFUN_MENU_OPEN_BY_NAME:
-               owner->getMenus()->openByName(argument);
-               break; // RVDK_PATCH_5
-               
-       case LFUN_SPELLCHECK:
-               if (lyxrc->isp_command != "none")
-                       ShowSpellChecker();
-               break; // RVDK_PATCH_5
-               
-               // --- Cursor Movements -----------------------------
-       case LFUN_RIGHT:
-       {
-               Buffer * tmpbuffer = owner->buffer();
-               LyXText * tmptext = owner->buffer()->text;
-               if(!tmptext->mark_set)
-                       BeforeChange();
-               tmpbuffer->update(-2);
-               if (tmptext->cursor.pos < tmptext->cursor.par->Last()
-                   && tmptext->cursor.par->GetChar(tmptext->cursor.pos)
-                   == LyXParagraph::META_INSET
-                   && tmptext->cursor.par->GetInset(tmptext->cursor.pos)
-                   && tmptext->cursor.par->GetInset(tmptext->cursor.pos)->Editable() == 2){
-                       Inset * tmpinset = tmptext->cursor.par->GetInset(tmptext->cursor.pos);
-                       setMessage(tmpinset->EditMessage());
-                       tmpinset->Edit(0, 0);
-                       break;
-               }
-               tmptext->CursorRight();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-       }
-       break;
-               
-       case LFUN_LEFT:
-       {
-               // This is soooo ugly. Isn`t it possible to make
-               // it simpler? (Lgb)
-               LyXText * txt = owner->buffer()->text;
-               if(!txt->mark_set) BeforeChange();
-               owner->buffer()->update(-2);
-               txt->CursorLeft();
-               if (txt->cursor.pos < txt->cursor.par->Last()
-                   && txt->cursor.par->GetChar(txt->cursor.pos)
-                   == LyXParagraph::META_INSET
-                   && txt->cursor.par->GetInset(txt->cursor.pos)
-                   && txt->cursor.par->GetInset(txt->cursor.pos)->Editable() == 2) {
-                       Inset * tmpinset = txt->cursor.par->GetInset(txt->cursor.pos);
-                       setMessage(tmpinset->EditMessage());
-                       tmpinset->Edit(tmpinset->Width(txt->GetFont(txt->cursor.par,
-                                                                   txt->cursor.pos)), 0);
-                       break;
-               }
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-       }
-       break;
-               
-       case LFUN_UP:
-               if(!owner->buffer()->text->mark_set) BeforeChange();
-               owner->buffer()->update(-3);
-               owner->buffer()->text->CursorUp();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_DOWN:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-3);
-               owner->buffer()->text->CursorDown();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-
-       case LFUN_UP_PARAGRAPH:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-3);
-               owner->buffer()->text->CursorUpParagraph();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_DOWN_PARAGRAPH:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-3);
-               owner->buffer()->text->CursorDownParagraph();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_PRIOR:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-3);
-               owner->view()->cursorPrevious();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_NEXT:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-3);
-               owner->view()->cursorNext();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_HOME:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorHome();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_END:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorEnd();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_TAB:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorTab();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_WORDRIGHT:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorRightOneWord();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_WORDLEFT:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorLeftOneWord();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_BEGINNINGBUF:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorTop();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_ENDBUF:
-               if(!owner->buffer()->text->mark_set)
-                       BeforeChange();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorBottom();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-
-      
-               /* cursor selection ---------------------------- */
-       case LFUN_RIGHTSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorRight();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_LEFTSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorLeft();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_UPSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorUp();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_DOWNSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorDown();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-
-       case LFUN_UP_PARAGRAPHSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorUpParagraph();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_DOWN_PARAGRAPHSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorDownParagraph();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_PRIORSEL:
-               owner->buffer()->update(-2);
-               owner->view()->cursorPrevious();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_NEXTSEL:
-               owner->buffer()->update(-2);
-               owner->view()->cursorNext();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_HOMESEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorHome();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_ENDSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorEnd();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_WORDRIGHTSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorRightOneWord();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_WORDLEFTSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorLeftOneWord();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_BEGINNINGBUFSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorTop();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-               
-       case LFUN_ENDBUFSEL:
-               owner->buffer()->update(-2);
-               owner->buffer()->text->CursorBottom();
-               owner->buffer()->text->FinishUndo();
-               moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState());
-               break;
-
-               // --- text changing commands ------------------------
-       case LFUN_BREAKLINE:
-               BeforeChange();
-               owner->buffer()->text->InsertChar(LyXParagraph::META_NEWLINE);
-               SmallUpdate(1);
-               SetUpdateTimer(0.01);
-               moveCursorUpdate(false);
-               break;
-               
-       case LFUN_PROTECTEDSPACE:
-               BeforeChange();
-               owner->buffer()->text->
-                       InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
-               SmallUpdate(1);
-               SetUpdateTimer();
-                moveCursorUpdate(false);
-               break;
-               
-       case LFUN_SETMARK:
-               if(owner->buffer()->text->mark_set) {
-                       BeforeChange();
-                       owner->buffer()->update(0);
-                       setMessage(N_("Mark removed"));
-               } else {
-                       BeforeChange();
-                       owner->buffer()->text->mark_set = 1;
-                       owner->buffer()->update(0);
-                       setMessage(N_("Mark set"));
-               }
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               break;
-               
-       case LFUN_DELETE:
-               FreeUpdateTimer();
-               if (!owner->buffer()->text->selection) {
-                       owner->buffer()->text->Delete();
-                       owner->buffer()->text->sel_cursor = 
-                               owner->buffer()->text->cursor;
-                       SmallUpdate(1);
-                       // It is possible to make it a lot faster still
-                       // just comment out the lone below...
-                       owner->view()->getScreen()->ShowCursor();
-               } else {
-                       CutCB();
-               }
-               SetUpdateTimer();
-               break;
-
-       case LFUN_DELETE_SKIP:
-       {
-               // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
-               
-               LyXCursor cursor = owner->buffer()->text->cursor;
-
-               FreeUpdateTimer();
-               if (!owner->buffer()->text->selection) {
-                       if (cursor.pos == cursor.par->Last()) {
-                               owner->buffer()->text->CursorRight();
-                               cursor = owner->buffer()->text->cursor;
-                               if (cursor.pos == 0
-                                   && !(cursor.par->added_space_top 
-                                        == VSpace (VSpace::NONE))) {
-                                       owner->buffer()->text->SetParagraph
-                                               (cursor.par->line_top,
-                                                cursor.par->line_bottom,
-                                                cursor.par->pagebreak_top, 
-                                                cursor.par->pagebreak_bottom,
-                                                VSpace(VSpace::NONE), 
-                                                cursor.par->added_space_bottom,
-                                                cursor.par->align, 
-                                                cursor.par->labelwidthstring, 0);
-                                       owner->buffer()->text->CursorLeft();
-                                       owner->buffer()->update (1);
-                               } else {
-                                       owner->buffer()->text->CursorLeft();
-                                       owner->buffer()->text->Delete();
-                                       owner->buffer()->text->sel_cursor = 
-                                               owner->buffer()->text->cursor;
-                                       SmallUpdate(1);
-                               }
-                       } else {
-                               owner->buffer()->text->Delete();
-                               owner->buffer()->text->sel_cursor = 
-                                       owner->buffer()->text->cursor;
-                               SmallUpdate(1);
-                       }
-               } else {
-                       CutCB();
-               }
-               SetUpdateTimer();
-       }
-       break;
-
-       /* -------> Delete word forward. */
-       case LFUN_DELETE_WORD_FORWARD:
-               owner->buffer()->update(-2);
-               FreeUpdateTimer();
-               owner->buffer()->text->DeleteWordForward();
-               owner->buffer()->update( 1 );
-               SetUpdateTimer();
-               moveCursorUpdate(false);
-               break;
-
-               /* -------> Delete word backward. */
-       case LFUN_DELETE_WORD_BACKWARD:
-               owner->buffer()->update(-2);
-               FreeUpdateTimer();
-               owner->buffer()->text->DeleteWordBackward();
-               owner->buffer()->update( 1 );
-               SetUpdateTimer();
-               moveCursorUpdate(false);
-               break;
-               
-               /* -------> Kill to end of line. */
-       case LFUN_DELETE_LINE_FORWARD:
-               FreeUpdateTimer();
-               owner->buffer()->update(-2);
-               owner->buffer()->text->DeleteLineForward();
-               owner->buffer()->update( 1 );
-               SetUpdateTimer();
-               moveCursorUpdate(false);
-               break;
-               
-               /* -------> Set mark off. */
-       case LFUN_MARK_OFF:
-               BeforeChange();
-               owner->buffer()->update(0);
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               setMessage(N_("Mark off"));
-               break;
-
-               /* -------> Set mark on. */
-       case LFUN_MARK_ON:
-               BeforeChange();
-               owner->buffer()->text->mark_set = 1;
-               owner->buffer()->update( 0 );
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               setMessage(N_("Mark on"));
-               break;
-               
-       case LFUN_BACKSPACE:
-       {
-               FreeUpdateTimer();
-               if (!owner->buffer()->text->selection) {
-                       if (owner->getIntl()->getTrans()->backspace()) {
-                               owner->buffer()->text->Backspace();
-                               owner->buffer()->text->sel_cursor = 
-                                       owner->buffer()->text->cursor;
-                               SmallUpdate(1);
-                               // It is possible to make it a lot faster still
-                               // just comment out the lone below...
-                               owner->view()->getScreen()->ShowCursor();
-                       }
-               } else {
-                       CutCB();
-               }
-               SetUpdateTimer();
-       }
-       break;
-
-       case LFUN_BACKSPACE_SKIP:
-       {
-               // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
-               
-               LyXCursor cursor = owner->buffer()->text->cursor;
-               
-               FreeUpdateTimer();
-               if (!owner->buffer()->text->selection) {
-                       if (cursor.pos == 0 
-                           && !(cursor.par->added_space_top 
-                                == VSpace (VSpace::NONE))) {
-                               owner->buffer()->text->SetParagraph 
-                                       (cursor.par->line_top,      
-                                        cursor.par->line_bottom,
-                                        cursor.par->pagebreak_top, 
-                                        cursor.par->pagebreak_bottom,
-                                        VSpace(VSpace::NONE), cursor.par->added_space_bottom,
-                                        cursor.par->align, 
-                                        cursor.par->labelwidthstring, 0);
-                               owner->buffer()->update (1);
-                       } else {
-                               owner->buffer()->text->Backspace();
-                               owner->buffer()->text->sel_cursor 
-                                       = cursor;
-                               SmallUpdate (1);
-                       }
-               } else
-                       CutCB();
-               SetUpdateTimer();
-       }
-       break;
-
-       case LFUN_BREAKPARAGRAPH:
-       {
-               BeforeChange();
-               owner->buffer()->text->BreakParagraph(0);
-               SmallUpdate(1);
-               SetUpdateTimer(0.01);
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               break;
-       }
-
-       case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
-       {
-               BeforeChange();
-               owner->buffer()->text->BreakParagraph(1);
-               SmallUpdate(1);
-               SetUpdateTimer(0.01);
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               break;
-       }
-       
-       case LFUN_BREAKPARAGRAPH_SKIP:
-       {
-               // When at the beginning of a paragraph, remove
-               // indentation and add a "defskip" at the top.
-               // Otherwise, do the same as LFUN_BREAKPARAGRAPH.
-               
-               LyXCursor cursor = owner->buffer()->text->cursor;
-               
-               BeforeChange();
-               if (cursor.pos == 0) {
-                       if (cursor.par->added_space_top == VSpace(VSpace::NONE)) {
-                               owner->buffer()->text->SetParagraph
-                                       (cursor.par->line_top,      
-                                        cursor.par->line_bottom,
-                                        cursor.par->pagebreak_top, 
-                                        cursor.par->pagebreak_bottom,
-                                        VSpace(VSpace::DEFSKIP), cursor.par->added_space_bottom,
-                                        cursor.par->align, 
-                                        cursor.par->labelwidthstring, 1);
-                               owner->buffer()->update(1);
-                       } 
-               }
-               else {
-                       owner->buffer()->text->BreakParagraph(0);
-                       SmallUpdate(1);
-               }
-               SetUpdateTimer(0.01);
-               owner->buffer()->text->sel_cursor = cursor;
-       }
-       break;
-       
-       case LFUN_QUOTE:
-               BeforeChange();
-               owner->buffer()->text->InsertChar('\"');  // This " matches the single quote in the code
-               SmallUpdate(1);
-               SetUpdateTimer();
-                moveCursorUpdate(false);
-               break;
-
-       case LFUN_HTMLURL:
-       case LFUN_URL:
-       {
-               InsetCommand * new_inset;
-               if (action == LFUN_HTMLURL)
-                       new_inset = new InsetUrl("htmlurl", "", "");
-               else
-                       new_inset = new InsetUrl("url", "", "");
-               owner->buffer()->insertInset(new_inset);
-               new_inset->Edit(0, 0);
-       }
-       break;
-
-       // --- lyxserver commands ----------------------------
-
-       case LFUN_CHARATCURSOR:
-       {
-               LyXParagraph::size_type pos = 
-                 owner->buffer()->text->cursor.pos;
-               if(pos < owner->buffer()->text->cursor.par->size())
-                       dispatch_buffer = owner->buffer()->text->
-                               cursor.par->text[pos];
-               else
-                       dispatch_buffer = "EOF";
-       }
-       break;
-       
-       case LFUN_GETXY:
-               dispatch_buffer = 
-                        tostr(owner->buffer()->text->cursor.x) + ' '
-                       + tostr(owner->buffer()->text->cursor.y);
-               break;
-               
-       case LFUN_SETXY:
-       {
-               int  x;
-               long y;
-               sscanf(argument.c_str(), " %d %ld", &x, &y);
-               owner->buffer()->text->SetCursorFromCoordinates(x, y);
-       }
-       break;
-       
-       case LFUN_GETLAYOUT:
-               dispatch_buffer =  
-                       tostr(owner->buffer()->text->cursor.par->layout);
-               break;
-                       
-       case LFUN_GETFONT:
-       {
-               LyXFont *font = &(owner->buffer()->text->current_font);
-                if(font->shape() == LyXFont::ITALIC_SHAPE)
-                       dispatch_buffer = 'E';
-                else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
-                       dispatch_buffer = 'N';
-                else
-                       dispatch_buffer = '0';
-
-       }
-       break;
-
-       case LFUN_GETLATEX:
-       {
-               LyXFont *font = &(owner->buffer()->text->current_font);
-                if(font->latex() == LyXFont::ON)
-                       dispatch_buffer = 'L';
-                else
-                       dispatch_buffer = '0';
-       }
-       break;
-
-       case LFUN_GETNAME:
-               setMessage(owner->buffer()->getFileName());
-               lyxerr.debug() << "FNAME["
-                              << owner->buffer()->getFileName()
-                              << "] " << endl;
-               break;
-               
-       case LFUN_NOTIFY:
-       {
-               char buf[100];
-               keyseq.print(buf, 100);
-               dispatch_buffer = buf;
-               lyxserver->notifyClient(dispatch_buffer);
-       }
-       break;
-
-       case LFUN_GOTOFILEROW:
-       {
-               char file_name[100];
-               int  row;
-               sscanf(argument.c_str(), " %s %d", file_name, &row);
-
-               // Must replace extension of the file to be .lyx and get full path
-               string s = ChangeExtension(string(file_name), ".lyx", false);
-
-               // Either change buffer or load the file
-               if (bufferlist.exists(s))
-                       owner->view()->buffer(bufferlist.getBuffer(s));
-               else
-                       owner->view()->buffer(bufferlist.loadLyXFile(s));
-
-               // Set the cursor  
-               owner->buffer()->setCursorFromRow(row);
-
-               // Recenter screen
-               BeforeChange();
-               if (owner->buffer()->text->cursor.y >
-                   owner->view()->getWorkArea()->h / 2)        {
-                       owner->view()->getScreen()->
-                               Draw(owner->buffer()->text->cursor.y -
-                                    owner->view()->getWorkArea()->h/2);
-               } else { // <= 
-                       owner->view()->getScreen()->
-                               Draw(0);
-               }
-               owner->buffer()->update(0);
-               owner->view()->redraw();
-       }
-       break;
-
-       case LFUN_APROPOS:
-       case LFUN_GETTIP:
-       {
-               int qa = lyxaction.LookupFunc(argument.c_str());
-               setMessage(lyxaction.helpText((kb_action)qa));
-       }
-       break;
-
-       // --- accented characters ---------------------------
-               
-       case LFUN_UMLAUT:
-       case LFUN_CIRCUMFLEX:
-       case LFUN_GRAVE:
-       case LFUN_ACUTE:
-       case LFUN_TILDE:
-       case LFUN_CEDILLA:
-       case LFUN_MACRON:
-       case LFUN_DOT:
-       case LFUN_UNDERDOT:
-       case LFUN_UNDERBAR:
-       case LFUN_CARON:
-       case LFUN_SPECIAL_CARON:
-       case LFUN_BREVE:
-       case LFUN_TIE:
-       case LFUN_HUNG_UMLAUT:
-       case LFUN_CIRCLE:
-       case LFUN_OGONEK:
-       {
-               char c;
-               
-               if (keyseq.length == -1 && keyseq.getiso()!= 0) 
-                       c= keyseq.getiso();
-               else
-                       c= 0;
-               
-               owner->getIntl()->getTrans()->
-                       deadkey(c, get_accent(action).accent, 
-                               owner->buffer()->text);
-               
-               // Need to reset, in case the minibuffer calls these
-               // actions
-               keyseq.reset();
-               keyseq.length= 0;
-               
-               // copied verbatim from do_accent_char
-               SmallUpdate(1);
-               SetUpdateTimer();
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-       }   
-       break;
-       
-       // --- toolbar ----------------------------------
-       case LFUN_PUSH_TOOLBAR:
-       {
-               int nth = strToInt(argument);
-               if (lyxerr.debugging(Debug::TOOLBAR)) {
-                       lyxerr << "LFUN_PUSH_TOOLBAR: argument = `"
-                              << argument << "'\n"
-                              << "LFUN_PUSH_TOOLBAR: nth = `"
-                              << nth << "'" << endl;
-               }
-               
-               if (nth <= 0) {
-                       LyXBell();
-                       setErrorMessage(N_("Push-toolbar needs argument > 0"));
-               } else {
-                       owner->getToolbar()->push(nth);
-               }
-       }
-       break;
-       
-       case LFUN_ADD_TO_TOOLBAR:
-       {
-               if (lyxerr.debugging(Debug::TOOLBAR)) {
-                       lyxerr << "LFUN_ADD_TO_TOOLBAR:"
-                               "argument = `" << argument << '\'' << endl;
-               }
-               string tmp(argument);
-               //lyxerr <<string("Argument: ") + argument);
-               //lyxerr <<string("Tmp     : ") + tmp);
-               if (tmp.empty()) {
-                       LyXBell();
-                       setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
-               } else {
-                       owner->getToolbar()->add(argument, false);
-                       owner->getToolbar()->set();
-               }
-       }
-       break;
-       
-       // --- insert characters ----------------------------------------
-#if 0
-       case LFUN_INSERT_INSET_LATEX:
-       {
-               Inset *new_inset = new InsetLatex(argument);
-               owner->buffer()->insertInset(new_inset);
-       }
-       break;
-#endif
-       // ---  Mathed stuff. If we are here, there is no locked inset yet.
-       
-       // Greek mode     
-       case LFUN_GREEK:
-       {
-               if (!greek_kb_flag) {
-                       greek_kb_flag = 1;
-                       setMessage(N_("Math greek mode on"));
-               } else
-                       greek_kb_flag = 0;
-       }  
-       break;
-      
-       // Greek keyboard      
-       case LFUN_GREEK_TOGGLE:
-       {
-               greek_kb_flag = (greek_kb_flag) ? 0: 2;
-               if (greek_kb_flag) {
-                       setMessage(N_("Math greek keyboard on"));
-               } else {
-                       setMessage(N_("Math greek keyboard off"));
-               }
-       }
-       break;
-       
-       case LFUN_MATH_DELIM:     
-       case LFUN_INSERT_MATRIX:
-       {          
-               if (owner->view()->available()) { 
-                       owner->buffer()->
-                               open_new_inset(new InsetFormula(false));
-                       owner->buffer()->
-                               the_locking_inset->LocalDispatch(action, argument.c_str());
-               }
-       }          
-       break;
-              
-       case LFUN_INSERT_MATH:
-       {
-               math_insert_symbol(argument.c_str());
-       }
-       break;
-       
-       case LFUN_MATH_DISPLAY:
-       {
-               if (owner->view()->available())
-                       owner->buffer()->open_new_inset(new InsetFormula(true));
-               break;
-       }
-                   
-       case LFUN_MATH_MACRO:
-       {
-               if (owner->view()->available()) {
-                       string s(argument);
-                       if (s.empty())
-                           setErrorMessage(N_("Missing argument"));
-                       else {
-                           string s1 = token(s, ' ', 1);
-                           int na = s1.empty() ? 0: atoi(s1.c_str());
-                           owner->buffer()->
-                             open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
-                       }
-               }
-       }
-       break;
-
-       case LFUN_MATH_MODE:   // Open or create a math inset
-       {
-               
-               if (owner->view()->available())
-                       owner->buffer()->open_new_inset(new InsetFormula);
-               setMessage(N_("Math editor mode"));
-       }
-       break;
-         
-       case LFUN_MATH_NUMBER:
-       case LFUN_MATH_LIMITS:
-       {
-               setErrorMessage(N_("This is only allowed in math mode!"));
-       }
-       break;
-       
-       case LFUN_INSERT_CITATION:
-       {   
-               InsetCitation * new_inset = new InsetCitation();
-               // ale970405
-               // The note, if any, must be after the key, delimited
-               // by a | so both key and remark can have spaces.
-               if (!argument.empty()) {
-                       string lsarg(argument);
-                       if (contains(lsarg, "|")) {
-                               new_inset->setContents(token(lsarg, '|', 0));
-                               new_inset->setOptions(token(lsarg, '|', 1));
-                       } else
-                               new_inset->setContents(lsarg);
-                       owner->buffer()->insertInset(new_inset);
-               } else {
-                       owner->buffer()->insertInset(new_inset);
-                       new_inset->Edit(0, 0);
-               }
-       }
-       break;
-                   
-       case LFUN_INSERT_BIBTEX:
-       {   
-               // ale970405+lasgoutt970425
-               // The argument can be up to two tokens separated 
-               // by a space. The first one is the bibstyle.
-               string lsarg(argument);
-               string bibstyle = token(lsarg, ' ', 1);
-               if (bibstyle.empty())
-                       bibstyle = "plain";
-               InsetBibtex * new_inset 
-                       = new InsetBibtex(token(lsarg, ' ', 0),
-                                         bibstyle,
-                                         owner->buffer());
-               
-               owner->buffer()->insertInset(new_inset);
-               if (lsarg.empty()) {
-                       new_inset->Edit(0, 0);
-               }
-       }
-       break;
-               
-       // BibTeX data bases
-       case LFUN_BIBDB_ADD:
-       {
-               InsetBibtex * inset = 
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset) {
-                       inset->addDatabase(argument);
-               }
-       }
-       break;
-                   
-       case LFUN_BIBDB_DEL:
-       {
-               InsetBibtex * inset = 
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset) {
-                       inset->delDatabase(argument);
-               }
-       }
-       break;
-       
-       case LFUN_BIBTEX_STYLE:
-       {
-               InsetBibtex * inset = 
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset) {
-                       inset->setOptions(argument);
-               }
-       }
-       break;
-               
-       case LFUN_INDEX_INSERT:
-       case LFUN_INDEX_INSERT_LAST:
-       {
-               // Can't do that at the beginning of a paragraph.
-               if (owner->buffer()->text->cursor.pos - 1 <0)
-                       break;
-
-               InsetIndex * new_inset = new InsetIndex();
-               if (!argument.empty()) {
-                       string lsarg(argument);
-                       new_inset->setContents(lsarg);
-                       owner->buffer()->insertInset(new_inset);
-               } else {
-                 //reh 98/09/21
-                 //get the current word for an argument
-                 LyXParagraph::size_type lastpos = 
-                         owner->buffer()->text->cursor.pos - 1;
-                 // Get the current word. note that this must be done
-                 // before inserting the inset, or the inset will
-                 // break the word
-                 string curstring(owner->buffer()
-                                  ->text->cursor.par->GetWord(lastpos));
-
-                 //make the new inset and write the current word into it
-                 InsetIndex * new_inset = new InsetIndex();
-
-                 new_inset->setContents(curstring);
-
-                 //don't edit it if the call was to INSERT_LAST
-                 if(action!= LFUN_INDEX_INSERT_LAST) {
-                     new_inset->Edit(0, 0);
-                 } else {
-                     //it looks blank on the screen unless
-                     //we do  something.  put it here.
-
-                     // move the cursor to the returned value of lastpos
-                     // but only for the auto-insert
-                     owner->buffer()->text->cursor.pos= lastpos;
-                 }
-
-                 //put the new inset into the buffer.
-                 // there should be some way of knowing the user
-                 //cancelled & avoiding this, but i don't know how
-                 owner->buffer()->insertInset(new_inset);
-               }
-       }
-       break;
-
-       case LFUN_INDEX_PRINT:
-       {
-               Inset * new_inset = new InsetPrintIndex(owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-       }
-       break;
-
-       case LFUN_PARENTINSERT:
-       {
-               lyxerr << "arg " << argument << endl;
-               Inset * new_inset = new InsetParent(argument, owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-       }
-       break;
-
-       case LFUN_CHILDINSERT:
-       {
-               Inset * new_inset = new InsetInclude(argument,
-                                                    owner->buffer());
-               owner->buffer()->insertInset(new_inset, "Standard", true);
-               new_inset->Edit(0, 0);
-       }
-       break;
-
-       case LFUN_CHILDOPEN:
-       {
-               string filename =
-                       MakeAbsPath(argument, 
-                                   OnlyPath(owner->buffer()->getFileName()));
-               setMessage(N_("Opening child document ") +
-                          MakeDisplayPath(filename) + "...");
-               owner->view()->savePosition();
-               if (bufferlist.exists(filename))
-                 owner->view()->buffer(bufferlist.getBuffer(filename));
-               else
-                 owner->view()->buffer(bufferlist.loadLyXFile(filename));
-       }
-       break;
-
-       case LFUN_INSERT_NOTE:
-               NoteCB();
-               break;
-               
-       case LFUN_INSERTFOOTNOTE: 
-       {
-               LyXParagraph::footnote_kind kind;
-               if (argument == "footnote")
-                       { kind = LyXParagraph::FOOTNOTE; }
-               else if (argument == "margin")
-                       { kind = LyXParagraph::MARGIN; }
-               else if (argument == "figure")
-                       { kind = LyXParagraph::FIG; }
-               else if (argument == "table")
-                       { kind = LyXParagraph::TAB; }
-               else if (argument == "wide-fig")
-                       { kind = LyXParagraph::WIDE_FIG; }
-               else if (argument == "wide-tab")
-                       { kind = LyXParagraph::WIDE_TAB; }
-               else if (argument == "algorithm")
-                       { kind = LyXParagraph::ALGORITHM; }
-               else {
-                       setErrorMessage(N_("Unknown kind of footnote"));
-                       break;
-               }
-               owner->buffer()->text->InsertFootnoteEnvironment(kind);
-               owner->buffer()->update(1);
-       }
-       break;
-       
-       case LFUN_BUFFERBULLETSSELECT:
-               bulletForm();
-               break;
-               
-       case LFUN_TOGGLECURSORFOLLOW:
-               cursor_follows_scrollbar = !cursor_follows_scrollbar;
-               break;
-               
-       case LFUN_KMAP_OFF:             // keymap off
-               owner->getIntl()->KeyMapOn(false);
-               break;
-               
-       case LFUN_KMAP_PRIM:    // primary keymap
-               owner->getIntl()->KeyMapPrim();
-               break;
-               
-       case LFUN_KMAP_SEC:             // secondary keymap
-               owner->getIntl()->KeyMapSec();
-               break;
-               
-       case LFUN_KMAP_TOGGLE:  // toggle keymap
-               owner->getIntl()->ToggleKeyMap();
-               break;
-
-       case LFUN_SELFINSERT:
-       {
-               for (string::size_type i = 0; i < argument.length(); ++i) {
-                       owner->buffer()->text->InsertChar(argument[i]);
-                       // This needs to be in the loop, or else we
-                       // won't break lines correctly. (Asger)
-                       SmallUpdate(1);
-               }
-               SetUpdateTimer();
-               owner->buffer()->text->sel_cursor = 
-                       owner->buffer()->text->cursor;
-               moveCursorUpdate(false);
-       }
-       break;
-
-       case LFUN_SEQUENCE: 
-       {
-               // argument contains ';'-terminated commands
-               while (argument.find(';') != string::npos) {
-                       string first;
-                       argument = split(argument, first, ';');
-                       Dispatch(first);
-               }
-       }
-       break;
-
-       case LFUN_SAVEPREFERENCES:
-       {
-               Path p(user_lyxdir);
-               lyxrc->write("preferences");
-       }
-       break;
-       
-       case LFUN_UNKNOWN_ACTION:
-       {
-               if (owner->buffer()->isReadonly()) {
-                       LyXBell();
-                       setErrorMessage(N_("Document is read only"));
-                       break;
-               }
-                        
-               if (!argument.empty()) {
-                       
-                       /* Automatically delete the currently selected
-                        * text and replace it with what is being
-                        * typed in now. Depends on lyxrc settings
-                        * "auto_region_delete", which defaults to
-                        * true (on). */
-               
-                       if ( lyxrc->auto_region_delete ) {
-                               if (owner->buffer()->text->selection){
-                                       owner->buffer()->text->CutSelection(false);
-                                       owner->buffer()->update(-1);
-                               }
-                       }
-                       
-                       BeforeChange();
-                       for (string::size_type i = 0;
-                            i < argument.length(); ++i) {
-                               if (greek_kb_flag) {
-                                       if (!math_insert_greek(argument[i]))
-                                               owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
-                               } else
-                                       owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
-                       }
-                       
-                       SmallUpdate(1);
-                       SetUpdateTimer();
-
-                       owner->buffer()->text->sel_cursor = 
-                               owner->buffer()->text->cursor;
-                       moveCursorUpdate(false);
-                       return string();
-               } else {
-                       // why is an "Unknown action" with empty
-                       // argument even dispatched in the first
-                       // place? I`ll probably change that. (Lgb)
-                       LyXBell();
-                       setErrorMessage(N_("Unknown action"));
-               }
-               break;
-       default:
-               lyxerr << "A truly unknown func!" << endl;
-               break;
-       }
-       } // end of switch
-  exit_with_message:
-
-       string res = getMessage();
-
-       if (res.empty()) {
-               if (!commandshortcut.empty()) {
-                       string newbuf = owner->getMiniBuffer()->GetText();
-                       if (newbuf != commandshortcut) {
-                               owner->getMiniBuffer()->Set(newbuf
-                                                           + " " +
-                                                           commandshortcut);
-                       }
-               }
-       } else {
-               owner->getMiniBuffer()->Set(string(_(res.c_str()))
-                                           + " " + commandshortcut);
-       }
-
-       return res;
-}
-#endif     
-
-void LyXFunc::setupLocalKeymap()
-{
-       keyseq.stdmap = keyseq.curmap = toplevel_keymap;
-       cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap;
-}
-
-
-void LyXFunc::MenuNew(bool fromTemplate)
-{
-       string fname, initpath = lyxrc->document_path;
-       LyXFileDlg fileDlg;
-
-       if (owner->view()->available()) {
-               string trypath = owner->buffer()->filepath;
-               // If directory is writeable, use this as default.
-               if (IsDirWriteable(trypath) == 1)
-                       initpath = trypath;
-       }
-
-       ProhibitInput();
-       fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
-       fileDlg.SetButton(1, _("Templates"), lyxrc->template_path);
-       fname = fileDlg.Select(_("Enter Filename for new document"), 
-                              initpath, "*.lyx", _("newfile"));
-       AllowInput();
-       
-       if (fname.empty()) {
-               owner->getMiniBuffer()->Set(_("Canceled."));
-               lyxerr.debug() << "New Document Cancelled." << endl;
-               return;
-       }
-        
-       // get absolute path of file and make sure the filename ends
-       // with .lyx
-       string s = MakeAbsPath(fname);
-       if (!IsLyXFilename(s))
-               s += ".lyx";
-
-       // Check if the document already is open
-       if (bufferlist.exists(s)){
-               switch(AskConfirmation(_("Document is already open:"), 
-                                      MakeDisplayPath(s, 50),
-                                      _("Do you want to close that document now?\n"
-                                        "('No' will just switch to the open version)")))
-               {
-               case 1: // Yes: close the document
-                       if (!bufferlist.close(bufferlist.getBuffer(s)))
-                               // If close is canceled, we cancel here too.
-                               return;
-                       break;
-               case 2: // No: switch to the open document
-                       owner->view()->buffer(bufferlist.getBuffer(s));
-                       return;
-               case 3: // Cancel: Do nothing
-                       owner->getMiniBuffer()->Set(_("Canceled."));
-                       return;
-               }
-       }
-        
-       // Check whether the file already exists
-       if (IsLyXFilename(s)) {
-               FileInfo fi(s);
-               if (fi.readable() &&
-                   AskQuestion(_("File already exists:"), 
-                               MakeDisplayPath(s, 50),
-                               _("Do you want to open the document?"))) {
-                       // loads document
-                       owner->getMiniBuffer()->Set(_("Opening document"), 
-                                                   MakeDisplayPath(s), "...");
-                       XFlush(fl_display);
-                       owner->view()->buffer(
-                               bufferlist.loadLyXFile(s));
-                       owner->getMiniBuffer()->Set(_("Document"),
-                                                   MakeDisplayPath(s),
-                                                   _("opened."));
-                       return;
-               }
-       }
-
-       // The template stuff
-       string templname;
-       if (fromTemplate) {
-               ProhibitInput();
-               fname = fileDlg.Select(_("Choose template"),
-                                      lyxrc->template_path,
-                                      "*.lyx");
-                templname = fname;
-               AllowInput();
-       }
-  
-       // find a free buffer
-       lyxerr.debug() << "Find a free buffer." << endl;
-       owner->view()->buffer(bufferlist.newFile(s, templname));
-}
-
-
-void LyXFunc::MenuOpen()
-{
-       string initpath = lyxrc->document_path;
-       LyXFileDlg fileDlg;
-  
-       if (owner->view()->available()) {
-               string trypath = owner->buffer()->filepath;
-               // If directory is writeable, use this as default.
-               if (IsDirWriteable(trypath) == 1)
-                       initpath = trypath;
-       }
+void LyXFunc::MenuOpen()
+{
+       string initpath = lyxrc->document_path;
+       LyXFileDlg fileDlg;
+  
+       if (owner->view()->available()) {
+               string trypath = owner->buffer()->filepath;
+               // If directory is writeable, use this as default.
+               if (IsDirWriteable(trypath) == 1)
+                       initpath = trypath;
+       }
 
        // launches dialog
        ProhibitInput();
@@ -4665,7 +2556,7 @@ void LyXFunc::MenuOpen()
        fileDlg.SetButton(1, _("Examples"), 
                          AddPath(system_lyxdir, "examples"));
        string filename = fileDlg.Select(_("Select Document to Open"),
-                                         initpath, "*.lyx");
+                                        initpath, "*.lyx");
        AllowInput();
  
        // check selected filename
@@ -4714,7 +2605,7 @@ void LyXFunc::doImportASCII(bool linorpar)
        fileDlg.SetButton(1, _("Examples"), 
                          AddPath(system_lyxdir, "examples"));
        string filename = fileDlg.Select(_("Select ASCII file to Import"),
-                                         initpath, "*.txt");
+                                        initpath, "*.txt");
        AllowInput();
  
        // check selected filename
@@ -4729,24 +2620,24 @@ void LyXFunc::doImportASCII(bool linorpar)
        string s = ChangeExtension(filename, ".lyx", false);
 
        // Check if the document already is open
-       if (bufferlist.exists(s)){
+       if (bufferlist.exists(s)) {
                switch(AskConfirmation(_("Document is already open:"), 
                                       MakeDisplayPath(s, 50),
                                       _("Do you want to close that document now?\n"
                                         "('No' will just switch to the open version)")))
-               {
-               case 1: // Yes: close the document
-                       if (!bufferlist.close(bufferlist.getBuffer(s)))
+                       {
+                       case 1: // Yes: close the document
+                               if (!bufferlist.close(bufferlist.getBuffer(s)))
                                // If close is canceled, we cancel here too.
+                                       return;
+                               break;
+                       case 2: // No: switch to the open document
+                               owner->view()->buffer(bufferlist.getBuffer(s));
                                return;
-                       break;
-               case 2: // No: switch to the open document
-                       owner->view()->buffer(bufferlist.getBuffer(s));
-                       return;
-               case 3: // Cancel: Do nothing
-                       owner->getMiniBuffer()->Set(_("Canceled."));
-                       return;
-               }
+                       case 3: // Cancel: Do nothing
+                               owner->getMiniBuffer()->Set(_("Canceled."));
+                               return;
+                       }
        }
 
        // Check if a LyX document by the same root exists in filesystem
@@ -4813,20 +2704,20 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
                                       MakeDisplayPath(LyXfilename, 50),
                                       _("Do you want to close that document now?\n"
                                         "('No' will just switch to the open version)")))
-               {
-               case 1: // Yes: close the document
-                       if (!bufferlist.close(bufferlist.getBuffer(LyXfilename)))
+                       {
+                       case 1: // Yes: close the document
+                               if (!bufferlist.close(bufferlist.getBuffer(LyXfilename)))
                                // If close is canceled, we cancel here too.
+                                       return;
+                               break;
+                       case 2: // No: switch to the open document
+                               owner->view()->buffer(
+                                       bufferlist.getBuffer(LyXfilename));
                                return;
-                       break;
-               case 2: // No: switch to the open document
-                       owner->view()->buffer(
-                               bufferlist.getBuffer(LyXfilename));
-                       return;
-               case 3: // Cancel: Do nothing
-                       owner->getMiniBuffer()->Set(_("Canceled."));
-                       return;
-               }
+                       case 3: // Cancel: Do nothing
+                               owner->getMiniBuffer()->Set(_("Canceled."));
+                               return;
+                       }
        }
 
        // Check if a LyX document by the same root exists in filesystem
@@ -4947,11 +2838,7 @@ Inset * LyXFunc::getInsetByCode(Inset::Code code)
 {
        bool found = false;
        Inset * inset = 0;
-#ifdef MOVE_TEXT
        LyXCursor cursor = owner->view()->text->cursor;
-#else
-       LyXCursor cursor = owner->buffer()->text->cursor;
-#endif
        LyXParagraph::size_type pos = cursor.pos;
        LyXParagraph * par = cursor.par;
        
@@ -4961,11 +2848,11 @@ Inset * LyXFunc::getInsetByCode(Inset::Code code)
                                found = true;
                                break;
                        }
-                       pos++;
+                       ++pos;
                } 
                par = par->next;
        }
-       return (found) ? inset: 0;
+       return found ? inset : 0;
 }
 
 
index 8f6738de34dfc014fd5d65c965431c0af4b90a9f..065683f54e5687dfd1d92903f665a287797a09a9 100644 (file)
@@ -47,15 +47,16 @@ public:
        /// The last key was meta
        bool wasMetaKey() const;
 
-       // These can't be global because are part of the internat state (ale970227)
+       // These can't be global because are part of the
+       // internal state (ale970227)
        /// Get the current keyseq string
-       string keyseqStr(int l = 190) const;
+       string keyseqStr() const;
 
        /// Is the key sequence uncomplete?
        bool keyseqUncomplete() const;
 
        /// get options for the current keyseq
-       string keyseqOptions(int l = 190) const;
+       string keyseqOptions() const;
 
         /// True if lyxfunc reports an error
         bool errorStat() const { return errorstat; }
@@ -70,7 +71,6 @@ public:
        
        /// Should a hint message be displayed?
        void setHintMessage(bool);
-
 private:
        ///
        LyXView * owner;
@@ -94,8 +94,8 @@ private:
         mutable bool errorstat;
 
         /** Buffer to store messages and result data. Is there a
-         good reason to have this one as static in Dispatch? (Ale)
-         */
+           good reason to have this one as static in Dispatch? (Ale)
+       */
         mutable string dispatch_buffer;
        /// Command name and shortcut information
        string commandshortcut;
@@ -136,22 +136,22 @@ bool LyXFunc::wasMetaKey() const
      
 
 inline
-string LyXFunc::keyseqStr(int l) const
+string LyXFunc::keyseqStr() const
 {
-       char text[200];
-       keyseq.print(text, l, true);
-       string tmp(text);
-       return tmp;
+       // Why not just remove this function
+       string text;
+       keyseq.print(text, true);
+       return text;
 } 
 
 
 inline
-string LyXFunc::keyseqOptions(int l) const
+string LyXFunc::keyseqOptions() const
 {
-       char text[200];
-       keyseq.printOptions(text, l);
-       string tmp(text);
-       return tmp;
+       // Why not just remove this function
+       string text;
+       keyseq.printOptions(text);
+       return text;
 } 
 
 
@@ -161,12 +161,14 @@ bool LyXFunc::keyseqUncomplete() const
        return (keyseq.length > 0);
 }
 
+
 inline
 void LyXFunc::setHintMessage(bool hm) 
 { 
        show_sc = hm;
 }
 
+
 inline
 void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
 {
index a4d72f1942afa47c0ff469e74becb876b41314f5..0af68c5d0c84ff9f150810f4cfaa478ecb4b3e09 100644 (file)
@@ -130,6 +130,7 @@ enum LyXRCTags {
        RC_LAST 
 };
 
+
 static keyword_item lyxrcTags[] = {
        { "\\accept_compound", RC_ACCEPT_COMPOUND },
        { "\\alternate_language", RC_ALT_LANG },
@@ -547,7 +548,7 @@ int LyXRC::read(string const & filename)
                                                BufferParams::PAPER_LEGALPAPER;
                                else if (size == "executive")
                                        default_papersize =
-                                           BufferParams::PAPER_EXECUTIVEPAPER;
+                                               BufferParams::PAPER_EXECUTIVEPAPER;
                                else if (size == "a3")
                                        default_papersize =
                                                BufferParams::PAPER_A3PAPER;
index 9d60bf11c869d4f8fd2eb53b34a073aa5b53493d..22731d3268dd2f00a2baadd70492cecb96c886eb 100644 (file)
@@ -42,13 +42,13 @@ public:
        ~LyXScreen();
 
        /** Return the forground pixmap. This function is a _hack_,
-         we should be rid of it as soon as possible. But to do that
-         a lot in the mathcode and the figinset has to be rewritten.
-         Tasks for 0.13. */
+           we should be rid of it as soon as possible. But to do that
+           a lot in the mathcode and the figinset has to be rewritten.
+           Tasks for 0.13. */
        Pixmap getForeground() { return foreground; };
        
        /** Draws the screen form textposition y. Uses as much of
-         the already printed pixmap as possible */
+           the already printed pixmap as possible */
        void Draw(long y );
 
        /// Redraws the screen, without using existing pixmap
@@ -76,27 +76,27 @@ public:
        void ToggleToggle();
        
        /** Updates part of the screen. If text->status is
-         LyXText::NEED_MORE_REFRESH, we update from the
-         point of change and to the end of the screen.
-         If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
-         we only update the current row. */
+           LyXText::NEED_MORE_REFRESH, we update from the
+           point of change and to the end of the screen.
+           If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
+           we only update the current row. */
        void Update();
 
        /** Updates part of the screen. Updates till row with cursor,
-         or only current row */
+           or only current row */
        void SmallUpdate();
 
        /** Functions for drawing into the LyXScreen. The number of
-         drawing functions should be minimized, now there
-         is too many. And also there is mixed X and XForms drawing
-         functions called. Not good. */
+           drawing functions should be minimized, now there
+           is too many. And also there is mixed X and XForms drawing
+           functions called. Not good. */
        void drawPoint(GC gc, int x, int y);
        ///
        void drawLine(gc_type t, int baseline, int x, int length);
        ///
        void drawLine(GC gc, int a, int b, int c, int d);
        ///
-       void drawLines(GC gc, XPoint *p, int np);
+       void drawLines(GC gc, XPoint * p, int np);
        ///
        void drawVerticalLine(gc_type t, int x, int y1, int y2);
        ///
@@ -110,11 +110,15 @@ public:
        ///
        void drawVerticalOnOffLine(int x, int y1, int y2);
        ///
+       void fillArc(GC gc, int x, int y,
+                    unsigned int w, unsigned int h,
+                    int a1, int a2);
+       ///
        void drawArc(GC gc, int x, int y,
                     unsigned int w, unsigned int h,
                     int a1, int a2);
        ///
-       void drawSegments(GC gc, XSegment *s, int ns);
+       void drawSegments(GC gc, XSegment * s, int ns);
        ///
        void fillRectangle(gc_type t, int, int, int, int);
        ///
@@ -123,11 +127,11 @@ public:
        void drawFrame(int ft, int x, int y, int w, int h,
                       FL_COLOR col, int b); 
        ///
-       int drawText(LyXFont const &font, char const*,
-                     int n, int baseline, int x);
+       int drawText(LyXFont const & font, char const *,
+                    int n, int baseline, int x);
        ///
-       int drawString(LyXFont const &font, string const &str,
-                       int baseline, int x);
+       int drawString(LyXFont const & font, string const & str,
+                      int baseline, int x);
                
        /// first visible pixel-row
        long first;
@@ -142,10 +146,10 @@ private:
        void DrawFromTo(int y1, int y2);
    
        /// y is a coordinate of the text
-       void DrawOneRow(Row* row, long &y_text);
+       void DrawOneRow(Row * row, long & y_text);
 
        ///
-       LyXText *text;
+       LyXText * text;
 
        ///
        Pixmap foreground;
@@ -172,39 +176,44 @@ private:
        ///
        long screen_refresh_y;
        ///
-       Row *screen_refresh_row;
+       Row * screen_refresh_row;
        ///
        friend class InsetFormula;  
 };
 
 // Some of the easy to inline draw methods:
 
-inline void LyXScreen::drawPoint(GC gc, int x, int y)
+inline
+void LyXScreen::drawPoint(GC gc, int x, int y)
 {
        XDrawPoint(fl_display, foreground, gc,
                   x, y);
 }
 
 
-inline void LyXScreen::drawLine(GC gc, int a, int b, int c, int d)
+inline
+void LyXScreen::drawLine(GC gc, int a, int b, int c, int d)
 {
        XDrawLine(fl_display, foreground, gc, a, b, c, d);
 }
 
 
-inline void LyXScreen::drawLine(gc_type t, int baseline, int x, int length)
+inline
+void LyXScreen::drawLine(gc_type t, int baseline, int x, int length)
 {
        drawLine(getGC(t), x, baseline, x + length, baseline);
 }
 
 
-inline void LyXScreen::drawLines(GC gc, XPoint *p, int np)
+inline
+void LyXScreen::drawLines(GC gc, XPoint * p, int np)
 {
        XDrawLines(fl_display, foreground, gc, p, np, CoordModeOrigin);
 }
 
 
-inline void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
+inline
+void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
 {
        drawLine(getGC(t),
                 x,
@@ -214,7 +223,8 @@ inline void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
 }
 
 
-inline void LyXScreen::drawOnOffLine(int baseline, int x, int length)
+inline
+void LyXScreen::drawOnOffLine(int baseline, int x, int length)
 {
        drawLine(getGC(gc_on_off_line),
                 x,
@@ -224,7 +234,8 @@ inline void LyXScreen::drawOnOffLine(int baseline, int x, int length)
 }
 
        
-inline void LyXScreen::drawThickLine(int baseline, int x, int length)
+inline
+void LyXScreen::drawThickLine(int baseline, int x, int length)
 {
        drawLine(getGC(gc_thick_line),
                 x,
@@ -234,7 +245,8 @@ inline void LyXScreen::drawThickLine(int baseline, int x, int length)
 }
 
 
-inline void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
+inline
+void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
 {
        drawLine(getGC(gc_fill),
                 x,
@@ -244,7 +256,19 @@ inline void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
 }      
 
 
-inline void LyXScreen::drawArc(GC gc, int x, int y,
+inline
+void LyXScreen::fillArc(GC gc, int x, int y,
+                       unsigned int w, unsigned int h,
+                       int a1, int a2)
+{
+       XFillArc(fl_display, foreground, gc,
+                x, y,
+                w, h, a1, a2);
+}
+
+
+inline
+void LyXScreen::drawArc(GC gc, int x, int y,
                        unsigned int w, unsigned int h,
                        int a1, int a2)
 {
@@ -254,35 +278,40 @@ inline void LyXScreen::drawArc(GC gc, int x, int y,
 }
 
 
-inline void LyXScreen::drawSegments(GC gc, XSegment *s, int ns)
+inline
+void LyXScreen::drawSegments(GC gc, XSegment * s, int ns)
 {
        XDrawSegments(fl_display, foreground, gc, s, ns);
 }
 
 
-inline void LyXScreen::fillRectangle(gc_type t, int a, int b, int c, int d)
+inline
+void LyXScreen::fillRectangle(gc_type t, int a, int b, int c, int d)
 {
        XFillRectangle(fl_display, foreground, getGC(t),
                       a, b, c, d);
 }
 
 
-inline void LyXScreen::drawRectangle(gc_type t, int x, int y, int width, int height)
+inline
+void LyXScreen::drawRectangle(gc_type t, int x, int y, int width, int height)
 {
        XDrawRectangle(fl_display, foreground, getGC(t),
                       x, y, width, height);
 }
 
 
-inline int LyXScreen::drawText(LyXFont const &font, char const*fs,
-                        int n, int baseline, int x)
+inline
+int LyXScreen::drawText(LyXFont const & font, char const * fs,
+                       int n, int baseline, int x)
 {
        return font.drawText(fs, n, foreground, baseline, x);
 }
 
 
-inline int LyXScreen::drawString(LyXFont const &font, string const &str,
-                          int baseline, int x)
+inline
+int LyXScreen::drawString(LyXFont const & font, string const & str,
+                         int baseline, int x)
 {
        return font.drawString(str, foreground, baseline, x);
 }
index a626ef6b96b4b787e9dbc02e9a51412e75061478..6487e557423c25b9e6f0dd69a8afecdd2bde4e97 100644 (file)
@@ -252,7 +252,7 @@ void Menus::create_menus(int air)
                                                  MENU_LABEL_SIZE,
                                                  _("Layout"),
                                                  strlen(_("Layout"))) + mbadd,
-                                         mbheight, _("Layout"));
+                             mbheight, _("Layout"));
        moffset += obj->w + air;
        fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
        fl_set_object_callback(obj, C_Menus_ShowLayoutMenu, 0);
@@ -486,27 +486,27 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
        int SubFileExport = 0;
        if (!LinuxDoc && !DocBook)
                SubFileExport= fl_defpup(FL_ObjWin(ob),
-                                       _("Export%t"
-                                         "|as LaTeX...%x40"
-                                         "|as DVI...%x41"
-                                         "|as PostScript...%x42"
-                                         "|as Ascii Text...%x43"
-                                         "|as HTML...%x44"
-                                         "|Custom...%x45"));
+                                        _("Export%t"
+                                          "|as LaTeX...%x40"
+                                          "|as DVI...%x41"
+                                          "|as PostScript...%x42"
+                                          "|as Ascii Text...%x43"
+                                          "|as HTML...%x44"
+                                          "|Custom...%x45"));
         else if(LinuxDoc)
                SubFileExport= fl_defpup(FL_ObjWin(ob),
-                                       _("Export%t"
-                                         "|as LinuxDoc...%x40"
-                                         "|as DVI...%x41"
-                                         "|as PostScript...%x42"
-                                         "|as Ascii Text...%x43"));
+                                        _("Export%t"
+                                          "|as LinuxDoc...%x40"
+                                          "|as DVI...%x41"
+                                          "|as PostScript...%x42"
+                                          "|as Ascii Text...%x43"));
         else if(DocBook)
                SubFileExport= fl_defpup(FL_ObjWin(ob),
-                                       _("Export%t"
-                                         "|as DocBook...%x40"
-                                         "|as DVI...%x41"
-                                         "|as PostScript...%x42"
-                                         "|as Ascii Text...%x43"));
+                                        _("Export%t"
+                                          "|as DocBook...%x40"
+                                          "|as DVI...%x41"
+                                          "|as PostScript...%x42"
+                                          "|as Ascii Text...%x43"));
 
        fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
        fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
@@ -674,7 +674,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
        default:
                men->currentView()
                        ->buffer(bufferlist
-                                   .loadLyXFile((*lastfiles)[choice - 18]));
+                                .loadLyXFile((*lastfiles)[choice - 18]));
                break;
        }
        fl_freepup(SubFileImport);
@@ -707,11 +707,11 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
        // Import sub-menu
        
        int SubFileImport = fl_defpup(FL_ObjWin(ob),
-                                    _("Import%t"
-                                      "|LaTeX...%x15"
-                                      "|Ascii Text as Lines...%x16"
-                                      "|Ascii Text as Paragraphs...%x17"
-                                      "|Noweb...%x18"));
+                                     _("Import%t"
+                                       "|LaTeX...%x15"
+                                       "|Ascii Text as Lines...%x16"
+                                       "|Ascii Text as Paragraphs...%x17"
+                                       "|Noweb...%x18"));
        
        fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
        fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
@@ -728,10 +728,10 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
        // This can be done cleaner later.
        int FileMenu = fl_defpup(FL_ObjWin(ob), 
                                 _("New..."
-                                "|New from template..."
-                                "|Open...%l"
-                                "|Import%m%l"
-                                "|Exit%l"), SubFileImport);
+                                  "|New from template..."
+                                  "|Open...%l"
+                                  "|Import%m%l"
+                                  "|Exit%l"), SubFileImport);
        
        fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N")));
        fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T")));
@@ -790,7 +790,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
        default:
                men->currentView()
                        ->buffer(bufferlist
-                                   .loadLyXFile((*lastfiles)[choice - 6]));
+                                .loadLyXFile((*lastfiles)[choice - 6]));
                break;
        }
 
@@ -800,7 +800,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
        return;
 }
 
-#ifdef MOVE_TEXT
+
 void Menus::ShowEditMenu(FL_OBJECT * ob, long)
 {
        Menus * men = static_cast<Menus*>(ob->u_vdata);
@@ -815,14 +815,14 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
 
        // Floats & Insets submenu
        int SubEditFloats= fl_defpup(FL_ObjWin(ob),
-                                   _("Floats & Insets%t"
-                                   "|Open/Close%x21"
-                                   "|Melt%x22"
-                                   "|Open All Footnotes/Margin Notes%x23"
-                                   "|Close All Footnotes/Margin Notes%x24"
-                                   "|Open All Figures/Tables%x25"
-                                   "|Close All Figures/Tables%x26%l"
-                                   "|Remove all Error Boxes%x27"));
+                                    _("Floats & Insets%t"
+                                      "|Open/Close%x21"
+                                      "|Melt%x22"
+                                      "|Open All Footnotes/Margin Notes%x23"
+                                      "|Close All Footnotes/Margin Notes%x24"
+                                      "|Open All Figures/Tables%x25"
+                                      "|Close All Figures/Tables%x26%l"
+                                      "|Remove all Error Boxes%x27"));
        
        fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
        fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
@@ -897,10 +897,10 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
 
                int align = men->currentView()->text->cursor.par->
                        table->GetAlignment(men->currentView()->text->
-                                    NumberOfCell(men->currentView()->
-                                                 text->cursor.par, 
-                                                 men->currentView()->
-                                                 text->cursor.pos));
+                                           NumberOfCell(men->currentView()->
+                                                        text->cursor.par, 
+                                                        men->currentView()->
+                                                        text->cursor.pos));
                if (align == LYX_ALIGN_LEFT)
                        fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
                else
@@ -979,24 +979,24 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
        fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H")));
 
        int EditMenu= fl_defpup(FL_ObjWin(ob),
-                              _("Undo"
-                              "|Redo %l"
-                              "|Cut"
-                              "|Copy"
-                              "|Paste%l"
-                              "|Find & Replace..."
-                              "|Go to Error"
-                              "|Go to Note"
-                              "|Floats & Insets%m"
-                              "|Table%m"
-                              "|Spellchecker...."
-                              "|Check TeX"
-                              "|Table of Contents...%l"
-                              "|Version Control%m%l"
-                              "|View LaTeX log file%l"
-                              "|Paste Primary Selection as Lines"
-                              "|Paste Primary Selection as Paragraphs"),
-                              SubEditFloats, SubEditTable, SubVersionControl);
+                               _("Undo"
+                                 "|Redo %l"
+                                 "|Cut"
+                                 "|Copy"
+                                 "|Paste%l"
+                                 "|Find & Replace..."
+                                 "|Go to Error"
+                                 "|Go to Note"
+                                 "|Floats & Insets%m"
+                                 "|Table%m"
+                                 "|Spellchecker...."
+                                 "|Check TeX"
+                                 "|Table of Contents...%l"
+                                 "|Version Control%m%l"
+                                 "|View LaTeX log file%l"
+                                 "|Paste Primary Selection as Lines"
+                                 "|Paste Primary Selection as Paragraphs"),
+                               SubEditFloats, SubEditTable, SubVersionControl);
 
        fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U")));
        fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R")));
@@ -1121,328 +1121,6 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
        fl_freepup(SubEditTable);
        fl_freepup(SubVersionControl);
 }
-#else
-void Menus::ShowEditMenu(FL_OBJECT * ob, long)
-{
-       Menus * men = static_cast<Menus*>(ob->u_vdata);
-       
-       // set the pseudo menu-button
-       fl_set_object_boxtype(ob, FL_UP_BOX);
-       fl_set_button(ob, 0);
-       fl_redraw_object(ob);
-
-       Buffer * tmpbuffer = men->_view->buffer();
-       LyXFunc * tmpfunc = men->_view->getLyXFunc();
-
-       // Floats & Insets submenu
-       int SubEditFloats= fl_defpup(FL_ObjWin(ob),
-                                   _("Floats & Insets%t"
-                                   "|Open/Close%x21"
-                                   "|Melt%x22"
-                                   "|Open All Footnotes/Margin Notes%x23"
-                                   "|Close All Footnotes/Margin Notes%x24"
-                                   "|Open All Figures/Tables%x25"
-                                   "|Close All Figures/Tables%x26%l"
-                                   "|Remove all Error Boxes%x27"));
-       
-       fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
-       fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
-       fl_setpup_shortcut(SubEditFloats, 23, scex(_("EMF|Aa#a#A")));
-       fl_setpup_shortcut(SubEditFloats, 24, scex(_("EMF|Cc#c#C")));
-       fl_setpup_shortcut(SubEditFloats, 25, scex(_("EMF|Ff#f#F")));
-       fl_setpup_shortcut(SubEditFloats, 26, scex(_("EMF|Tt#t#T")));
-       fl_setpup_shortcut(SubEditFloats, 27, scex(_("EMF|Rr#r#R")));
-
-       // Table submenu
-       int SubEditTable = fl_newpup(FL_ObjWin(ob));
-       if (men->currentView()->available() && 
-           tmpbuffer->text->cursor.par->table &&
-           !tmpbuffer->isReadonly()){
-
-               fl_addtopup(SubEditTable, _("Table%t"));
-
-               if (tmpbuffer->text->cursor.par->table->
-                   IsMultiColumn(tmpbuffer->text->
-                                 NumberOfCell(tmpbuffer->
-                                              text->cursor.par, 
-                                              tmpbuffer->
-                                              text->cursor.pos)))
-                       fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
-               else
-                       fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
-               fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
-     
-               if (tmpbuffer->text->cursor.par->table->
-                   TopLine(tmpbuffer->text->
-                           NumberOfCell(tmpbuffer->
-                                        text->cursor.par, 
-                                        tmpbuffer->text->
-                                        cursor.pos)))
-                       fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
-               else
-                       fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
-               fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
-     
-               if (tmpbuffer->text->cursor.par->table->
-                   BottomLine(tmpbuffer->text->
-                              NumberOfCell(tmpbuffer->
-                                           text->cursor.par, 
-                                           tmpbuffer->
-                                           text->cursor.pos)))
-                       fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
-               else
-                       fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
-               fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
-
-               if (tmpbuffer->text->cursor.par->table->
-                   LeftLine(tmpbuffer->text->
-                            NumberOfCell(tmpbuffer->
-                                         text->cursor.par, 
-                                         tmpbuffer->
-                                         text->cursor.pos)))
-                       fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
-               else
-                       fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
-               fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
-
-               if (tmpbuffer->text->cursor.par->table->
-                   RightLine(tmpbuffer->text->
-                             NumberOfCell(tmpbuffer->
-                                          text->cursor.par, 
-                                          tmpbuffer->
-                                          text->cursor.pos)))
-                       fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
-               else
-                       fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
-               fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
-
-               int align = tmpbuffer->text->cursor.par->
-                       table->GetAlignment(tmpbuffer->text->
-                                    NumberOfCell(tmpbuffer->
-                                                 text->cursor.par, 
-                                                 tmpbuffer->
-                                                 text->cursor.pos));
-               if (align == LYX_ALIGN_LEFT)
-                       fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
-               else
-                       fl_addtopup(SubEditTable, _("|Align Left%r%x40"));
-               fl_setpup_shortcut(SubEditTable, 40, scex(_("EMT|eE#e#E")));
-
-               if (align == LYX_ALIGN_RIGHT)
-                       fl_addtopup(SubEditTable, _("|Align Right%R%x41"));
-               else
-                       fl_addtopup(SubEditTable, _("|Align Right%r%x41"));
-               fl_setpup_shortcut(SubEditTable, 41, scex(_("EMT|iI#i#I")));
-
-               if (align == LYX_ALIGN_CENTER)
-                       fl_addtopup(SubEditTable, _("|Align Center%R%x42%l"));
-               else
-                       fl_addtopup(SubEditTable, _("|Align Center%r%x42%l"));
-               fl_setpup_shortcut(SubEditTable, 42, scex(_("EMT|Cc#c#C")));
-
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Append Row%x32"));
-               fl_setpup_shortcut(SubEditTable, 32, scex(_("EMT|oO#o#O")));
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Append Column%x33%l"));
-               fl_setpup_shortcut(SubEditTable, 33, scex(_("EMT|uU#u#U")));
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Delete Row%x34"));
-               fl_setpup_shortcut(SubEditTable, 34, scex(_("EMT|wW#w#W")));
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Delete Column%x35%l"));
-               fl_setpup_shortcut(SubEditTable, 35, scex(_("EMT|nN#n#N")));
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Delete Table%x43"));
-               fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
-       }
-       else {
-               fl_addtopup(SubEditTable, _("Table%t"));
-               // xgettext:no-c-format
-               fl_addtopup(SubEditTable, _("|Insert table%x31"));
-               fl_setpup_shortcut(SubEditTable, 31, scex(_("EMT|Ii#i#I")));
-       }
-
-       int SubVersionControl =         fl_newpup(FL_ObjWin(ob));
-       fl_addtopup(SubVersionControl, _("Version Control%t"));
-       if (tmpbuffer->lyxvc.inUse()) {
-               // xgettext:no-c-format
-               fl_addtopup(SubVersionControl, _("|Register%d%x51"));
-               if (tmpbuffer->isReadonly()) {
-                       // signifies that the file is not checked out
-                       // xgettext:no-c-format
-                       fl_addtopup(SubVersionControl, _("|Check In Changes%d%x52"));
-                       // xgettext:no-c-format
-                       fl_addtopup(SubVersionControl, _("|Check Out for Edit%x53"));
-               } else {
-                       // signifies that the file is checked out
-                       // xgettext:no-c-format
-                       fl_addtopup(SubVersionControl, _("|Check In Changes%x52"));
-                       // xgettext:no-c-format
-                       fl_addtopup(SubVersionControl, _("|Check Out for Edit%d%x53"));
-               }
-               // xgettext:no-c-format
-               fl_addtopup(SubVersionControl, _("|Revert to last version%x54"));
-               // xgettext:no-c-format
-               fl_addtopup(SubVersionControl, _("|Undo last check in%x55"));
-               // xgettext:no-c-format
-               fl_addtopup(SubVersionControl, _("|Show History%x56"));
-       } else {
-               // xgettext:no-c-format
-               fl_addtopup(SubVersionControl, _("|Register%x51"));
-       }
-       // the shortcuts are not good.
-       fl_setpup_shortcut(SubVersionControl, 51, scex(_("EMV|Rr#r#R")));
-       fl_setpup_shortcut(SubVersionControl, 52, scex(_("EMV|Ii#i#I")));
-       fl_setpup_shortcut(SubVersionControl, 53, scex(_("EMV|Oo#o#O")));
-       fl_setpup_shortcut(SubVersionControl, 54, scex(_("EMV|lL#l#l")));
-       fl_setpup_shortcut(SubVersionControl, 55, scex(_("EMV|Uu#u#U")));
-       fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H")));
-
-       int EditMenu= fl_defpup(FL_ObjWin(ob),
-                              _("Undo"
-                              "|Redo %l"
-                              "|Cut"
-                              "|Copy"
-                              "|Paste%l"
-                              "|Find & Replace..."
-                              "|Go to Error"
-                              "|Go to Note"
-                              "|Floats & Insets%m"
-                              "|Table%m"
-                              "|Spellchecker...."
-                              "|Check TeX"
-                              "|Table of Contents...%l"
-                              "|Version Control%m%l"
-                              "|View LaTeX log file%l"
-                              "|Paste Primary Selection as Lines"
-                              "|Paste Primary Selection as Paragraphs"),
-                              SubEditFloats, SubEditTable, SubVersionControl);
-
-       fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U")));
-       fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R")));
-       fl_setpup_shortcut(EditMenu, 3, scex(_("EM|Cc#c#C")));
-       fl_setpup_shortcut(EditMenu, 4, scex(_("EM|oO#o#O")));
-       fl_setpup_shortcut(EditMenu, 5, scex(_("EM|Pp#p#P")));
-       fl_setpup_shortcut(EditMenu, 6, scex(_("EM|Ff#f#F")));
-       fl_setpup_shortcut(EditMenu, 7, scex(_("EM|Ee#e#E")));
-       fl_setpup_shortcut(EditMenu, 8, scex(_("EM|Nn#n#N")));
-       fl_setpup_shortcut(EditMenu, 9, scex(_("EM|Ii#i#I")));
-       fl_setpup_shortcut(EditMenu, 10, scex(_("EM|Tt#t#T")));
-       fl_setpup_shortcut(EditMenu, 11, scex(_("EM|Ss#s#S")));
-       fl_setpup_shortcut(EditMenu, 12, scex(_("EM|hH#h#H")));
-       fl_setpup_shortcut(EditMenu, 13, scex(_("EM|aA#a#A")));
-       fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Vv#v#V")));
-       fl_setpup_shortcut(EditMenu, 15, scex(_("EM|wW#w#W")));
-       fl_setpup_shortcut(EditMenu, 16, scex(_("EM|Ll#l#L")));
-       fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
-      
-       // disable unavailable entries.
-       if(tmpbuffer->undostack.empty())
-               fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
-       if(tmpbuffer->redostack.empty())
-               fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
-       if(lyxrc->isp_command == "none") 
-               fl_setpup_mode(EditMenu, 11, FL_PUP_GREY);
-       if(lyxrc->chktex_command == "none") 
-               fl_setpup_mode(EditMenu, 12, FL_PUP_GREY);
-
-       if (tmpbuffer->isReadonly()) {
-                fl_setpup_mode(EditMenu, 1, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 2, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 3, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 5, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 16, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 17, FL_PUP_GREY);
-       }
-       
-       fl_setpup_position(men->_view->getForm()->x + ob->x,
-                          men->_view->getForm()->y + ob->y +
-                          ob->h + 10);   
-       int choice = fl_dopup(EditMenu);
-       XFlush(fl_display);
-   
-       // set the pseudo menu-button back
-       fl_set_object_boxtype(ob, FL_FLAT_BOX);
-       fl_redraw_object(ob);
-
-       switch (choice) {
-       case  1: tmpfunc->Dispatch(LFUN_UNDO); break;
-       case  2: tmpfunc->Dispatch(LFUN_REDO); break;
-       case  3: tmpfunc->Dispatch(LFUN_CUT); break;
-       case  4: tmpfunc->Dispatch(LFUN_COPY); break;
-       case  5: tmpfunc->Dispatch(LFUN_PASTE); break;
-       case  6: tmpfunc->Dispatch(LFUN_MENUSEARCH); break;
-       case  7: tmpfunc->Dispatch(LFUN_GOTOERROR); break;
-       case  8: tmpfunc->Dispatch(LFUN_GOTONOTE); break;
-       case  9: // floats & insets
-               break;
-       case 10:// table 
-               break;
-       case 11: tmpfunc->Dispatch(LFUN_SPELLCHECK); break;
-       case 12: tmpfunc->Dispatch(LFUN_RUNCHKTEX); break;
-       case 13: tmpfunc->Dispatch(LFUN_TOCVIEW); break;
-       case 14: // version control
-               break;
-       case 15: tmpfunc->Dispatch(LFUN_LATEX_LOG); break;
-       case 16: tmpfunc->Dispatch(LFUN_PASTESELECTION, "line"); break;
-       case 17: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break;
-
-               // floats & insets sub-menu
-       case 21: ToggleFloat(); break;
-       case 22: tmpfunc->Dispatch(LFUN_MELT); break;
-       case 23: AllFloats(1, 0); break;
-       case 24: AllFloats(0, 0); break;
-       case 25: AllFloats(1, 1); break;
-       case 26: AllFloats(0, 1); break;
-       case 27: tmpfunc->Dispatch(LFUN_REMOVEERRORS); break;
-
-       case 31: tmpfunc->Dispatch(LFUN_TABLE); break;
-               // this is really temporary. We need new function in keybind.C
-               // These should set the minibuffer, too.
-       case 32: case 33: case 34:
-       case 35: case 36: case 37:
-       case 38: case 39: case 40: 
-       case 41: case 42: case 43:
-       case 44: 
-               if (men->currentView()->available()){
-                       men->currentView()->getScreen()->HideCursor();
-                       if (!tmpbuffer->text->selection){
-                               BeforeChange(); 
-                               tmpbuffer->update(-2);
-                       }
-                       tmpbuffer->text->
-                               TableFeatures(choice - 32);
-                       tmpbuffer->update(1);
-               }
-               break;
-               // version control sub-menu
-       case 51: // register
-               tmpfunc->Dispatch(LFUN_VC_REGISTER);
-               break;
-       case 52: // check in
-               tmpfunc->Dispatch(LFUN_VC_CHECKIN);
-               break;
-       case 53: // check out
-               tmpfunc->Dispatch(LFUN_VC_CHECKOUT);
-               break;
-       case 54: // revert to last
-               tmpfunc->Dispatch(LFUN_VC_REVERT);
-               break;
-       case 55: // undo last
-               tmpfunc->Dispatch(LFUN_VC_UNDO);
-               break;
-       case 56: // show history
-               tmpfunc->Dispatch(LFUN_VC_HISTORY);
-               break;
-       }
-
-       fl_freepup(EditMenu);
-       fl_freepup(SubEditFloats);
-       fl_freepup(SubEditTable);
-       fl_freepup(SubVersionControl);
-}
-#endif
 
 
 void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
@@ -1489,11 +1167,7 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
        fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S")));
 
        // Set values of checkboxes according to font
-#ifdef MOVE_TEXT
        LyXFont font = men->currentView()->text->real_current_font;
-#else
-       LyXFont font = tmpbuffer->text->real_current_font;
-#endif
        if (font.emph() == LyXFont::ON)
                fl_setpup_mode(LayoutMenu, 7, FL_PUP_CHECK);
        if (font.noun() == LyXFont::ON)
@@ -1504,13 +1178,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
                fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
           
        // Grey out unavailable entries
-#ifdef MOVE_TEXT
        if (!men->currentView()->text->cursor.par->table)
                fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
-#else
-       if (!tmpbuffer->text->cursor.par->table)
-               fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
-#endif
 
        if (tmpbuffer->isReadonly()) {
                fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY);
@@ -1561,20 +1230,20 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
 
        int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
                                       _("Import ASCII file%t"
-                                      "|As Lines%x41"
-                                      "|As Paragraphs%x42"));
+                                        "|As Lines%x41"
+                                        "|As Paragraphs%x42"));
        
        fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L")));
        fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P")));
 
        int SubInsertTableList= fl_defpup(FL_ObjWin(ob),
-                                        _("Lists & TOC%t"
-                                          "|Table of Contents%x21"
-                                          "|List of Figures%x22"
-                                          "|List of Tables%x23"
-                                          "|List of Algorithms%x24"
-                                          "|Index List%x25"
-                                          "|BibTeX Reference%x26"));
+                                         _("Lists & TOC%t"
+                                           "|Table of Contents%x21"
+                                           "|List of Figures%x22"
+                                           "|List of Tables%x23"
+                                           "|List of Algorithms%x24"
+                                           "|Index List%x25"
+                                           "|BibTeX Reference%x26"));
        
        fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C")));
        fl_setpup_shortcut(SubInsertTableList, 22, scex(_("IMT|Ff#f#F")));
@@ -1584,12 +1253,12 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
        fl_setpup_shortcut(SubInsertTableList, 26, scex(_("IMT|Bb#b#B")));
 
        int SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
-                                      _("Floats%t"
-                                        "|Figure Float%x71"
-                                        "|Table Float%x72"
-                                        "|Wide Figure Float%x73"
-                                        "|Wide Table Float%l%x74"
-                                        "|Algorithm Float%x75"));
+                                          _("Floats%t"
+                                            "|Figure Float%x71"
+                                            "|Table Float%x72"
+                                            "|Wide Figure Float%x73"
+                                            "|Wide Table Float%l%x74"
+                                            "|Algorithm Float%x75"));
        
        fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G")));
        fl_setpup_shortcut(SubInsertFloatList, 72, scex(_("IMF|Tt#t#T")));
@@ -1598,15 +1267,15 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
        fl_setpup_shortcut(SubInsertFloatList, 75, scex(_("IMF|Aa#a#A")));
        
        int SubInsertSpecial = fl_defpup(FL_ObjWin(ob),
-                                      _("Special Character%t"
-                                        "|HFill%x31"
-                                        "|Hyphenation Point%x32"
-                                        "|Protected Blank%x33"
-                                        "|Linebreak%x34"
-                                        "|Ellipsis (...)%x35"
-                                        "|End of sentence period%x36"
-                                        "|Ordinary Quote (\")%x37"
-                                        "|Menu Separator %x38"));
+                                        _("Special Character%t"
+                                          "|HFill%x31"
+                                          "|Hyphenation Point%x32"
+                                          "|Protected Blank%x33"
+                                          "|Linebreak%x34"
+                                          "|Ellipsis (...)%x35"
+                                          "|End of sentence period%x36"
+                                          "|Ordinary Quote (\")%x37"
+                                          "|Menu Separator %x38"));
 
        fl_setpup_shortcut(SubInsertSpecial, 31, scex(_("IMS|Hh#h#H")));
        fl_setpup_shortcut(SubInsertSpecial, 32, scex(_("IMS|Pp#p#P")));
@@ -1691,10 +1360,10 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                        break;
 
                case 6: tmpfunc->Dispatch(LFUN_FOOTMELT); break
-;
+                                                                 ;
                case 7: tmpfunc->Dispatch(LFUN_MARGINMELT); break;
   
-               case 8: // Float sub-menu
+               case 8: // Float sub-menu
                 case 71:
                        tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "figure");
                        break;
@@ -1764,14 +1433,14 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
 
        int MathMenu = fl_defpup(FL_ObjWin(ob), 
                                 _("Fraction"
-                                "|Square root"
-                                "|Exponent"
-                                "|Index"
-                                "|Sum"
-                                "|Integral%l"
-                                "|Math mode"
-                                "|Display%l"
-                                "|Math Panel..."));
+                                  "|Square root"
+                                  "|Exponent"
+                                  "|Index"
+                                  "|Sum"
+                                  "|Integral%l"
+                                  "|Math mode"
+                                  "|Display%l"
+                                  "|Math Panel..."));
 
        fl_setpup_shortcut(MathMenu, 1, scex(_("MM|Ff#f#F")));
        fl_setpup_shortcut(MathMenu, 2, scex(_("MM|Ss#s#S")));
@@ -1848,10 +1517,10 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long)
 
        int OptionsMenu = fl_defpup(FL_ObjWin(ob),
                                    _("Screen Fonts..."
-                                   "|Spellchecker Options..."
-                                   "|Keyboard..."
-                                   "|LaTeX...%l"
-                                   "|Reconfigure" ));
+                                     "|Spellchecker Options..."
+                                     "|Keyboard..."
+                                     "|LaTeX...%l"
+                                     "|Reconfigure" ));
 
        fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ff#f#F")));
        fl_setpup_shortcut(OptionsMenu, 2, scex(_("OM|Ss#s#S")));
@@ -1927,16 +1596,16 @@ void Menus::ShowHelpMenu(FL_OBJECT * ob, long)
    
        int HelpMenu = fl_defpup(FL_ObjWin(ob),
                                 _("Introduction"
-                                "|Tutorial"
-                                "|User's Guide"
-                                "|Extended Features"
-                                "|Customization"
-                                "|Reference Manual"
-                                "|Known Bugs"
-                                "|LaTeX Configuration%l"
-                                "|Copyright and Warranty..."
-                                "|Credits..."
-                                "|Version..."));
+                                  "|Tutorial"
+                                  "|User's Guide"
+                                  "|Extended Features"
+                                  "|Customization"
+                                  "|Reference Manual"
+                                  "|Known Bugs"
+                                  "|LaTeX Configuration%l"
+                                  "|Copyright and Warranty..."
+                                  "|Credits..."
+                                  "|Version..."));
    
        fl_setpup_shortcut(HelpMenu,  1, scex(_("HM|Ii#I#i")));
        fl_setpup_shortcut(HelpMenu,  2, scex(_("HM|Tt#T#t")));
index d1c9b3ce7a2fdc8a0a16d8619bf13c004673e218..58c29f7177cc99726c1343ff6bc022fc71288c55 100644 (file)
@@ -329,7 +329,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
 {
        // this will be useful later
        LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(), 
-                                          GetLayout());
+                                                      GetLayout());
        
        // check the params.
        if (line_top || line_bottom)
@@ -954,7 +954,7 @@ LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) const
 {
        LyXFont tmpfont;
        LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(), 
-                                          GetLayout());
+                                                      GetLayout());
        LyXParagraph::size_type main_body = 0;
        if (layout.labeltype == LABEL_MANUAL)
                main_body = BeginningOfMainBody();
@@ -1136,9 +1136,9 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
 
 
 string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
-  //Added 98/9/21 by REH
-  // return an string of the current word, and the end of the word
-  // in lastpos.
+       //Added 98/9/21 by REH
+       // return an string of the current word, and the end of the word
+       // in lastpos.
 
   // the current word is defined as starting at the first character from
   // the immediate left of lastpospos which meets the definition of IsLetter(),
@@ -1206,8 +1206,8 @@ LyXParagraph::size_type LyXParagraph::Last() const
 {
        if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
                return text.size() + NextAfterFootnote()->Last() + 1;
-                                                  /* the 1 is the symbol
-                                                     for the footnote */
+       /* the 1 is the symbol
+          for the footnote */
        else
                return text.size();
 }
@@ -2279,8 +2279,8 @@ void LyXParagraph::readSimpleWholeFile(FILE * myfile)
 
 
 LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
-                                     string & foot, TexRow & foot_texrow,
-                                     int & foot_count)
+                                      string & foot, TexRow & foot_texrow,
+                                      int & foot_count)
 {
        lyxerr[Debug::LATEX] << "TeXOnePar...     " << this << endl;
        LyXParagraph * par = next;
@@ -2365,7 +2365,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
                }
                file += "\\par}";
        } else if (textclasslist.Style(GetCurrentTextClass(),
-                                 GetLayout()).isCommand()){
+                                      GetLayout()).isCommand()){
                if (style.resfont.size() != font.size()) {
                        file += '\\';
                        file += font.latexSize();
@@ -2674,7 +2674,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
        }
        current_cell_number = -1;
        tmp = table->TexEndOfCell(file, current_cell_number);
-       for (; tmp >0 ; --tmp)
+       for (; tmp > 0 ; --tmp)
                texrow.newline();
        
        texrow.start(this, 0);
@@ -2686,13 +2686,15 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
                                current_cell_number++;
                        continue;
                }
-               column++;
+               ++column;
                
                // Fully instantiated font
                LyXFont font = getFont(i);
 
-               // Spaces at end of font change are simulated to be outside font change.
-               // i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger)
+               // Spaces at end of font change are simulated to be
+               // outside font change.
+               // i.e. we write "\textXX{text} " rather than
+               // "\textXX{text }". (Asger)
                if (open_font && c == ' ' && i <= size() - 2
                    && getFont(i+1) != running_font && getFont(i+1) != font) {
                        font = getFont(i+1);
@@ -2725,9 +2727,11 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
                }
                if (c == LyXParagraph::META_NEWLINE) {
                        // special case for inside a table
-                       // different from default case in SimpleTeXSpecialChars()
+                       // different from default case in
+                       // SimpleTeXSpecialChars()
                        if (open_font) {
-                               column += running_font.latexWriteEndChanges(file, basefont);
+                               column += running_font
+                                       .latexWriteEndChanges(file, basefont);
                                open_font = false;
                        }
                        basefont = getFont(-1);
@@ -2742,8 +2746,8 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
                        // put the EndOfCell because it is put after the
                        // for(...)
                        if (table->ShouldBeVeryLastCell(current_cell_number)) {
-                            current_cell_number--;
-                            break;
+                               current_cell_number--;
+                               break;
                        }
                        int tmp = table->TexEndOfCell(file,
                                                      current_cell_number);
@@ -2801,7 +2805,7 @@ bool LyXParagraph::TeXContTableRows(string & file,
 
        size_type lastpos = i;
        int cell = table->CellHasContRow(current_cell_number);
-       current_cell_number++;
+       ++current_cell_number;
        while(cell >= 0) {
                // first find the right position
                i = lastpos;
@@ -2820,15 +2824,18 @@ bool LyXParagraph::TeXContTableRows(string & file,
                        file += ' ';
                }
 
-               for (; i < size() && (c = GetChar(i)) != LyXParagraph::META_NEWLINE;
+               for (; i < size()
+                            && (c = GetChar(i)) != LyXParagraph::META_NEWLINE;
                     ++i) {
                        ++column;
 
                        // Fully instantiated font
                        LyXFont font = getFont(i);
 
-                       // Spaces at end of font change are simulated to be outside font change.
-                       // i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger)
+                       // Spaces at end of font change are simulated to
+                       // be outside font change. i.e. we write
+                       // "\textXX{text} " rather than "\textXX{text }".
+                       // (Asger)
                        if (open_font && c == ' ' && i <= size() - 2 
                            && getFont(i + 1) != running_font
                            && getFont(i + 1) != font) {
@@ -2947,23 +2954,22 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
        return retval;
 }
 
+
 void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
                                            int & desc_on, int depth) 
 {
-       if (!table)
-               return;
+       if (!table) return;
        lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
-       int column, tmp;
-       int current_cell_number = -1;
+       int column;
        LyXFont font1, font2;
        char c;
-       Inset *inset;
+       Inset * inset;
        size_type main_body;
        string emph = "emphasis";
-       bool emph_flag= false;
-       int char_line_count= 0;
+       bool emph_flag = false;
        
-       LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout());
+       LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
+                                                     GetLayout());
        
        if (style.labeltype != LABEL_MANUAL)
                main_body = 0;
@@ -2976,24 +2982,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
        else
                font1 = style.font;
        
-       char_line_count = depth;
+       int char_line_count = depth;
        addNewlineAndDepth(file, depth);
        if (footnoteflag == LyXParagraph::NO_FOOTNOTE) {
                file += "<INFORMALTABLE>";
                addNewlineAndDepth(file, ++depth);
        }
-       current_cell_number = -1;
-       tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
+       int current_cell_number = -1;
+       int tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
        
        /* parsing main loop */
        for (size_type i = 0; i < size(); ++i) {
                c = GetChar(i);
                if (table->IsContRow(current_cell_number+1)) {
                        if (c == LyXParagraph::META_NEWLINE)
-                               current_cell_number++;
+                               ++current_cell_number;
                        continue;
                }
-               column++;
+               ++column;
                
                // Fully instantiated font
                font2 = getFont(i);
@@ -3029,7 +3035,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
                                break;
                        }
                        tmp= table->DocBookEndOfCell(file, current_cell_number,
-                                                   depth);
+                                                    depth);
                        
                        if (tmp > 0)
                                column = 0;
@@ -3040,19 +3046,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
                        //
                        // This code needs some explanation:
                        // Two insets are treated specially
-                       //   label if it is the first element in a command paragraph
+                       //   label if it is the first element in a
+                       //   command paragraph
                        //         desc_on == 3
-                       //   graphics inside tables or figure floats can't go on
-                               //   title (the equivalente in latex for this case is caption
+                       //   graphics inside tables or figure floats
+                       //   can't go on
+                       //   title (the equivalente in latex for this
+                       //   case is caption
                        //   and title should come first
                        //         desc_on == 4
                        //
                        if(desc_on != 3 || i != 0) {
                                if(tmp_out[0] == '@') {
                                        if(desc_on == 4)
-                                               extra += frontStrip(tmp_out, '@');
+                                               extra += frontStrip(tmp_out,
+                                                                   '@');
                                        else
-                                               file += frontStrip(tmp_out, '@');
+                                               file += frontStrip(tmp_out,
+                                                                  '@');
                                } else
                                        file += tmp_out;
                        }
@@ -3110,12 +3121,12 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
 
 
 void LyXParagraph::DocBookContTableRows(string & file, string & extra,
-                                        int & desc_on, LyXParagraph::size_type i,
+                                        int & desc_on,
+                                       LyXParagraph::size_type i,
                                         int current_cell_number, int &column) 
 
 {
-       if (!table)
-               return;
+       if (!table) return;
        
        lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
 
@@ -3145,7 +3156,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
        
        lastpos = i;
        cell = table->CellHasContRow(current_cell_number);
-       current_cell_number++;
+       ++current_cell_number;
        while(cell >= 0) {
                // first find the right position
                i = lastpos;
@@ -3243,6 +3254,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
        lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
 }
 
+
 void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow,
                                   LyXParagraph::size_type const i,
                                   int & column, LyXFont const & font,
@@ -3547,14 +3559,14 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
        string fname2 = TmpFileName(string(), "RAT2");
        int lastpos = i;
        int cell = table->CellHasContRow(actcell);
-       actcell++;
+       ++actcell;
        while(cell >= 0) {
                // first find the right position
                i = lastpos;
                for (; i < size() && actcell < cell; ++i) {
                        c = GetChar(i);
                        if (c == LyXParagraph::META_NEWLINE)
-                               actcell++;
+                               ++actcell;
                }
                lastpos = i;
                c = GetChar(i);
@@ -3572,7 +3584,8 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
                        switch (c) {
                        case LyXParagraph::META_INSET:
                                if ((inset = GetInset(i))) {
-                                       fstream fs(fname2.c_str(), ios::in|ios::out);
+                                       fstream fs(fname2.c_str(),
+                                                  ios::in|ios::out);
                                        if (!fs) {
                                                WriteAlert(_("LYX_ERROR:"),
                                                           _("Cannot open temporary file:"),
@@ -3605,7 +3618,9 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
                                if (c != '\0')
                                        os << c;
                                else
-                                       lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl;
+                                       lyxerr.debug() << "RoffAsciiTable: "
+                                               "NULL char in structure."
+                                                      << endl;
                                break;
                        }
                }
@@ -3626,7 +3641,7 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
                if (par->IsDummy())
                        lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
                if (textclasslist.Style(GetCurrentTextClass(), 
-                                  par->layout).isEnvironment()
+                                       par->layout).isEnvironment()
                    || par->pextra_type != PEXTRA_NONE) 
                        {
                                par = par->TeXEnvironment(file, texrow,
@@ -3645,12 +3660,12 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
 
 
 LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
-                                          string & foot, TexRow & foot_texrow,
-                                          int & foot_count)
+                                           string & foot, TexRow & foot_texrow,
+                                           int & foot_count)
 {
        bool eindent_open = false;
        bool foot_this_level = false;
-               // flags when footnotetext should be appended to file.
+       // flags when footnotetext should be appended to file.
         static bool minipage_open = false;
         static int minipage_open_depth = 0;
        char par_sep = current_view->buffer()->params.paragraph_separation;
@@ -3788,24 +3803,25 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
                 if (minipage_open && par && !style.isEnvironment() &&
                     (par->pextra_type == PEXTRA_MINIPAGE) &&
                     par->pextra_start_minipage) {
-                    file += "\\end{minipage}\n";
-                    texrow.newline();
-                    if (par_sep == BufferParams::PARSEP_INDENT) {
-                        file += "}\n";
+                       file += "\\end{minipage}\n";
                        texrow.newline();
-                    }
-                    minipage_open = false;
+                       if (par_sep == BufferParams::PARSEP_INDENT) {
+                               file += "}\n";
+                               texrow.newline();
+                       }
+                       minipage_open = false;
                 }
                if (par && par->depth > depth) {
                        if (textclasslist.Style(GetCurrentTextClass(),
-                                          par->layout).isParagraph()
+                                               par->layout).isParagraph()
                            && !par->table
                            && !suffixIs(file, "\n\n")) {
-                           // There should be at least one '\n' already
-                           // but we need there to be two for Standard 
-                           // paragraphs that are depth-increment'ed to be
-                           // output correctly.  However, tables can also be
-                           // paragraphs so don't adjust them.  ARRae
+                               // There should be at least one '\n' already
+                               // but we need there to be two for Standard 
+                               // paragraphs that are depth-increment'ed to be
+                               // output correctly.  However, tables can
+                               // also be paragraphs so don't adjust them.
+                               // ARRae
                                file += '\n';
                                texrow.newline();
                        }
@@ -3931,7 +3947,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
 
        LyXParagraph * par = this;
        LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), 
-                                          previous->GetLayout());
+                                                     previous->GetLayout());
        
        if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
                lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
@@ -3991,7 +4007,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
                                sprintf(bufr, "\\begin{floatingfigure}{%s}\n",
                                        pextra_width.c_str());
                        else
-                               sprintf(bufr, "\\begin{floatingfigure}{%f\\textwidth}\n",
+                               sprintf(bufr,
+                                       "\\begin{floatingfigure}{%f\\textwidth}\n",
                                        atoi(pextra_widthp.c_str())/100.0);
                        file += bufr;
                } else {
@@ -4045,16 +4062,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
            || !footer_in_body) {
                // Process text for all floats except footnotes in body
                do {
-                       LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
-                                                         par->layout);
+                       LyXLayout const & style =
+                               textclasslist.Style(GetCurrentTextClass(),
+                                                   par->layout);
                        if (par->IsDummy())
                                lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
                                       << endl;
                        if (style.isEnvironment()
                            || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
-                               // Allows the use of minipages within float environments.
-                               // Shouldn't be circular because we don't support
-                               // footnotes inside floats (yet). ARRae
+                               // Allows the use of minipages within float
+                               // environments. Shouldn't be circular because
+                               // we don't support footnotes inside
+                               // floats (yet). ARRae
                                par = par->TeXEnvironment(file, texrow,
                                                          foot, foot_texrow,
                                                          foot_count);
@@ -4078,16 +4097,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
                TexRow dummy_texrow;
                int dummy_count = 0;
                do {
-                       LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
-                                                         par->layout);
+                       LyXLayout const & style =
+                               textclasslist.Style(GetCurrentTextClass(),
+                                                   par->layout);
                        if (par->IsDummy())
                                lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
                                       << endl;
                        if (style.isEnvironment()
                            || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
-                               // Allows the use of minipages within float environments.
-                               // Shouldn't be circular because we don't support
-                               // footnotes inside floats (yet). ARRae
+                               // Allows the use of minipages within float
+                               // environments. Shouldn't be circular because
+                               // we don't support footnotes inside
+                               // floats (yet). ARRae
                                par = par->TeXEnvironment(foot, foot_texrow,
                                                          dummy, dummy_texrow,
                                                          dummy_count);
@@ -4102,7 +4123,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
                                                     dummy, dummy_texrow,
                                                     dummy_count);
                        }
-               } while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
+               } while (par
+                        && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
                if (dummy_count) {
                        lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
                                "Footnote in a Footnote -- not supported"
@@ -4163,80 +4185,84 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
 void LyXParagraph::SetPExtraType(int type, char const * width,
                                 char const * widthp)
 {
-    pextra_type = type;
-    pextra_width = width;
-    pextra_widthp = widthp;
-
-    if (textclasslist.Style(GetCurrentTextClass(), 
-                       layout).isEnvironment()) {
-        LyXParagraph
-            * par = this,
-            * ppar = par;
-
-        while (par && (par->layout == layout) && (par->depth == depth)) {
-            ppar = par;
-            par = par->Previous();
-            if (par)
-                par = par->FirstPhysicalPar();
-            while (par && par->depth > depth) {
-                par = par->Previous();
-                if (par)
-                    par = par->FirstPhysicalPar();
-            }
-        }
-        par = ppar;
-        while (par && (par->layout == layout) && (par->depth == depth)) {
-            par->pextra_type = type;
-            par->pextra_width = width;
-            par->pextra_widthp = widthp;
-            par = par->NextAfterFootnote();
-            if (par && (par->depth > depth))
-                par->SetPExtraType(type, width, widthp);
-            while (par && ((par->depth > depth) || par->IsDummy()))
-                par = par->NextAfterFootnote();
-        }
-    }
+       pextra_type = type;
+       pextra_width = width;
+       pextra_widthp = widthp;
+
+       if (textclasslist.Style(GetCurrentTextClass(), 
+                               layout).isEnvironment()) {
+               LyXParagraph
+                       * par = this,
+                       * ppar = par;
+
+               while (par && (par->layout == layout)
+                      && (par->depth == depth)) {
+                       ppar = par;
+                       par = par->Previous();
+                       if (par)
+                               par = par->FirstPhysicalPar();
+                       while (par && par->depth > depth) {
+                               par = par->Previous();
+                               if (par)
+                                       par = par->FirstPhysicalPar();
+                       }
+               }
+               par = ppar;
+               while (par && (par->layout == layout)
+                      && (par->depth == depth)) {
+                       par->pextra_type = type;
+                       par->pextra_width = width;
+                       par->pextra_widthp = widthp;
+                       par = par->NextAfterFootnote();
+                       if (par && (par->depth > depth))
+                               par->SetPExtraType(type, width, widthp);
+                       while (par && ((par->depth > depth) || par->IsDummy()))
+                               par = par->NextAfterFootnote();
+               }
+       }
 }
 
 
 void LyXParagraph::UnsetPExtraType()
 {
-    if (pextra_type == PEXTRA_NONE)
-        return;
+       if (pextra_type == PEXTRA_NONE)
+               return;
     
-    pextra_type = PEXTRA_NONE;
-    pextra_width.clear();
-    pextra_widthp.clear();
-
-    if (textclasslist.Style(GetCurrentTextClass(), 
-                       layout).isEnvironment()) {
-        LyXParagraph
-            * par = this,
-            * ppar = par;
-
-        while (par && (par->layout == layout) && (par->depth == depth)) {
-            ppar = par;
-            par = par->Previous();
-            if (par)
-                par = par->FirstPhysicalPar();
-            while (par && par->depth > depth) {
-                par = par->Previous();
-                if (par)
-                    par = par->FirstPhysicalPar();
-            }
-        }
-        par = ppar;
-        while (par && (par->layout == layout) && (par->depth == depth)) {
-            par->pextra_type = PEXTRA_NONE;
-            par->pextra_width.clear();
-            par->pextra_widthp.clear();
-            par = par->NextAfterFootnote();
-            if (par && (par->depth > depth))
-                par->UnsetPExtraType();
-            while (par && ((par->depth > depth) || par->IsDummy()))
-                par = par->NextAfterFootnote();
-        }
-    }
+       pextra_type = PEXTRA_NONE;
+       pextra_width.clear();
+       pextra_widthp.clear();
+
+       if (textclasslist.Style(GetCurrentTextClass(), 
+                               layout).isEnvironment()) {
+               LyXParagraph
+                       * par = this,
+                       * ppar = par;
+
+               while (par && (par->layout == layout)
+                      && (par->depth == depth)) {
+                       ppar = par;
+                       par = par->Previous();
+                       if (par)
+                               par = par->FirstPhysicalPar();
+                       while (par && par->depth > depth) {
+                               par = par->Previous();
+                               if (par)
+                                       par = par->FirstPhysicalPar();
+                       }
+               }
+               par = ppar;
+               while (par && (par->layout == layout)
+                      && (par->depth == depth)) {
+                       par->pextra_type = PEXTRA_NONE;
+                       par->pextra_width.clear();
+                       par->pextra_widthp.clear();
+                       par = par->NextAfterFootnote();
+                       if (par && (par->depth > depth))
+                               par->UnsetPExtraType();
+                       while (par && ((par->depth > depth) || par->IsDummy()))
+                               par = par->NextAfterFootnote();
+               }
+       }
 }
 
 
@@ -4305,5 +4331,5 @@ bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const
  
 bool LyXParagraph::IsWord(size_type pos ) const
 {
-       return IsWordChar( GetChar(pos) ) ;
+       return IsWordChar(GetChar(pos)) ;
 }
index cf8fc9caf004bc64ded0287676b2268f7d0f1bb7..d502a10ffd4da68cc44f28ee4ead2a69e6331899 100644 (file)
@@ -30,8 +30,8 @@ LyXScreen::LyXScreen(Window window,
                     Dimension offset_y,
                     LyXText *text_ptr)
        : text(text_ptr), _window(window), 
-         _width(width), _height(height),
-         _offset_x(offset_x), _offset_y(offset_y)
+       _width(width), _height(height),
+       _offset_x(offset_x), _offset_y(offset_y)
 {
        first = 0;
    
@@ -85,17 +85,13 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
 
 void LyXScreen::DrawFromTo(int y1, int y2)
 {
-       Row* row = 0;
-       long  y_text = 0;
-       long y = 0;
-       
-       y_text = first + y1;
+       long y_text = first + y1;
    
        /* get the first needed row */ 
-       row = text->GetRowNearY(y_text);
+       Row * row = text->GetRowNearY(y_text);
        /* y_text is now the real beginning of the row */
    
-       y = y_text - first;
+       long y = y_text - first;
        /* y1 is now the real beginning of row on the screen */
        
        while (row != 0 && y < y2) {
@@ -117,11 +113,9 @@ void LyXScreen::DrawFromTo(int y1, int y2)
 }
 
 
-void LyXScreen::DrawOneRow(Row *row, long &y_text)
+void LyXScreen::DrawOneRow(Row * row, long & y_text)
 {
-       long y = 0;
-   
-       y = y_text - first;
+       long y = y_text - first;
       
        if (y + row->height > 0 && y - row->height <= _height) {
                /* ok there is something visible */
@@ -137,7 +131,7 @@ void LyXScreen::Draw(long  y)
 {
        if (cursor_visible) HideCursor();
 
-       if (y<0) y = 0;
+       if (y < 0) y = 0;
        long old_first = first;
        first = y;
 
@@ -265,7 +259,8 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
 }
 
 
-void  LyXScreen::HideManualCursor(long x, long y, int asc, int desc){
+void  LyXScreen::HideManualCursor(long x, long y, int asc, int desc)
+{
        if (fast_selection || mono_video)
                ShowManualCursor(x, y, asc, desc);
        else
@@ -304,7 +299,7 @@ void  LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
                        cursor_pixmap_w = 1;
                        cursor_pixmap_h = y2 - y1 + 1;
                        cursor_pixmap_x = x,
-                       cursor_pixmap_y = y1;
+                               cursor_pixmap_y = y1;
                        cursor_pixmap = 
                                XCreatePixmap (fl_display,
                                               fl_root,
@@ -439,14 +434,14 @@ void LyXScreen::Update()
                DrawOneRow(text->refresh_row, y);
                text->status = LyXText::UNCHANGED;
                expose(0, text->refresh_y-first,
-                    _width, text->refresh_row->height);
+                      _width, text->refresh_row->height);
        }
 }
 
 
 void LyXScreen::SmallUpdate()
 {
-       Row *row = 0;
+       Row * row = 0;
        long y = 0;
        long y2 = 0;
        
@@ -486,12 +481,13 @@ void LyXScreen::SmallUpdate()
 
 void LyXScreen::ToggleSelection(bool kill_selection)
 {
-       long top = 0;
-       long bottom = 0;
-   
        /* only if there is a selection */ 
        if (!text->selection)
                return;
+
+       long top = 0;
+       long bottom = 0;
+   
        
        if (fast_selection || mono_video){
                
@@ -640,7 +636,7 @@ void LyXScreen::ToggleToggle()
            && text->toggle_cursor.pos == text->toggle_end_cursor.pos)
                return;
 
-       if (fast_selection || mono_video){
+       if (fast_selection || mono_video) {
                
                /* selection only in one row ?*/ 
                if (text->toggle_cursor.y == text->toggle_end_cursor.y) {
@@ -810,22 +806,24 @@ void LyXScreen::drawFrame(int /*ft*/, int x, int y, int w, int h,
        // I think these calls to fl_color might make xforms sometimes
        // draw the wrong color on other objects.
        fl_color(FL_TOP_BCOL);
-       XFillRectangle(fl_display, foreground, fl_gc, x-d, y-d, w+2*d, d);
+       XFillRectangle(fl_display, foreground, fl_gc,
+                      x - d, y - d, w + 2 * d, d);
        fl_color(FL_BOTTOM_BCOL);
-       XFillRectangle(fl_display, foreground, fl_gc, x-d, y+h, w+2*d, d);
+       XFillRectangle(fl_display, foreground, fl_gc,
+                      x - d, y + h, w + 2 * d, d);
  
        // Now a couple of trapezoids
        XPoint pl[4], pr[4]; 
  
-       pl[0].x = x-d;   pl[0].y = y-d;
-       pl[1].x = x-d;   pl[1].y = y+h+d;
-       pl[2].x = x;     pl[2].y = y+h;
+       pl[0].x = x - d;   pl[0].y = y - d;
+       pl[1].x = x - d;   pl[1].y = y + h + d;
+       pl[2].x = x;     pl[2].y = y + h;
        pl[3].x = x;     pl[3].y = y;
        
-       pr[0].x = x+w+d; pr[0].y = y-d;
-       pr[1].x = x+w+d; pr[1].y = y+h+d;
-       pr[2].x = x+w;   pr[2].y = y+h;
-       pr[3].x = x+w;   pr[3].y = y;
+       pr[0].x = x + w + d; pr[0].y = y - d;
+       pr[1].x = x + w + d; pr[1].y = y + h + d;
+       pr[2].x = x + w;   pr[2].y = y + h;
+       pr[3].x = x + w;   pr[3].y = y;
        
        fl_color(FL_LEFT_BCOL);
        XFillPolygon(fl_display,
index c3d1af12751ddb0589568a7e868a012c37478826..c9bcc64d5d7824f2e290989f21f8aebc3dbb7b53 100644 (file)
@@ -3,8 +3,8 @@
  * 
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1995 Matthias Ettrich
- *          Copyright (C) 1995-1999 The LyX Team.
+ *         Copyright 1995 Matthias Ettrich
+ *          Copyright 1995-1999 The LyX Team.
  *
  * ====================================================== */
 
@@ -114,7 +114,8 @@ private:
 
 lyxstring::Srep::Srep(lyxstring::size_type nsz, const value_type * p)
 {
-// can be called with p == 0 by lyxstring::assign(const value_type *, size_type)
+       // can be called with p == 0 by
+       // lyxstring::assign(const value_type *, size_type)
 
        sz = nsz;
        ref = 1;
@@ -148,7 +149,8 @@ lyxstring::Srep::Srep(lyxstring::size_type nsz, value_type ch)
 
 void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
 {
-// can be called with p == 0 by lyxstring::assign(const value_type *, size_type)
+       // can be called with p == 0
+       // by lyxstring::assign(const value_type *, size_type)
 
        if (res < nsz) {
                delete[] s;
@@ -223,7 +225,7 @@ void lyxstring::Srep::push_back(value_type c)
 
 
 void lyxstring::Srep::insert(lyxstring::size_type pos, const value_type * p,
-                          lyxstring::size_type n)
+                            lyxstring::size_type n)
 {
        if (res < n + sz) {
                do {
@@ -799,7 +801,7 @@ lyxstring & lyxstring::insert(size_type pos, lyxstring const & x)
 
 
 lyxstring & lyxstring::insert(size_type pos, lyxstring const & x,
-                         size_type pos2, size_type n)
+                             size_type pos2, size_type n)
 {
        Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
        TestlyxstringInvariant(this);
@@ -912,7 +914,7 @@ lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
 
 
 lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
-                                size_type n) const
+                                    size_type n) const
 {
        Assert(ptr); // OURS!
        if (!rep->sz || !*ptr || i >= rep->sz) return npos;
@@ -987,7 +989,7 @@ lyxstring::size_type lyxstring::rfind(lyxstring const & a, size_type i) const
 
 
 lyxstring::size_type lyxstring::rfind(value_type const * ptr, size_type i,
-                                 size_type n) const
+                                     size_type n) const
 {
        Assert(ptr); // OURS!
        TestlyxstringInvariant(this);
index a00a4e5d32c921851e19d14bde935eac1a4afe41..0c454dcb25c0d07ec3c2ec7813155bb7fbf68549 100644 (file)
@@ -21,9 +21,9 @@
 #pragma implementation
 #endif
 
-extern void addNewlineAndDepth(string &file, int const depth); // Jug 990923
+extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923
 
-#define WIDTH_OF_LINE 5
+static int const WIDTH_OF_LINE = 5;
 
 /* konstruktor */
 LyXTable::LyXTable(int rows_arg, int columns_arg)
@@ -34,18 +34,17 @@ LyXTable::LyXTable(int rows_arg, int columns_arg)
 
 LyXTable::LyXTable(LyXLex &lex)
 {
-       FILE *file = lex.getFile();
+       FILE * file = lex.getFile();
        Read(file);
 }
 
 
 LyXTable::~LyXTable() {
-       int i;
        delete[] rowofcell;
        delete[] columnofcell;
        delete[] column_info;
         delete[] row_info;
-       for (i = 0; i<rows; i++) {
+       for (int i = 0; i < rows; ++i) {
                delete[] cell_info[i]; // verify that this shoudn't be freed with delete
        }
        delete[] cell_info;
@@ -54,20 +53,20 @@ LyXTable::~LyXTable() {
 
 LyXTable * LyXTable::Clone()
 {
-    LyXTable *result = new LyXTable(rows, columns);
+    LyXTable * result = new LyXTable(rows, columns);
     int row, column;;
 
-    for (row = 0; row<rows; row++){
-        for (column = 0; column<columns;column++){
+    for (row = 0; row < rows; ++row) {
+        for (column = 0; column < columns; ++column) {
             result->cell_info[row][column] = cell_info[row][column];
         }
     }
 
-    for (row = 0; row<rows; row++){
+    for (row = 0; row < rows; ++row) {
         result->row_info[row] = row_info[row];
     }
 
-    for (column = 0; column<columns; column++){
+    for (column = 0; column < columns; ++column) {
         result->column_info[column].left_line = column_info[column].left_line;
         result->column_info[column].right_line = column_info[column].right_line;
         result->column_info[column].alignment = column_info[column].alignment;
@@ -85,21 +84,21 @@ LyXTable * LyXTable::Clone()
 /* activates all lines and sets all widths to 0 */ 
 void LyXTable::Init(int rows_arg, int columns_arg)
 {
-    int i, j, cellno;
+    int i, j;
     rows = rows_arg;
     columns = columns_arg;
     column_info = new columnstruct[columns];
     row_info = new rowstruct[rows];
     cell_info = new cellstruct*[rows];
 
-    cellno = 0;
-    for (i = 0; i<rows;i++) {
+    int cellno = 0;
+    for (i = 0; i < rows; ++i) {
         cell_info[i] = new cellstruct[columns];
         row_info[i].top_line = true;
         row_info[i].bottom_line = false;
         row_info[i].is_cont_row = false;
         row_info[i].newpage = false;
-        for (j = 0; j<columns; j++) {
+        for (j = 0; j < columns; ++j) {
             cell_info[i][j].cellno = cellno++;
             cell_info[i][j].width_of_cell = 0;
             cell_info[i][j].multicolumn = LyXTable::CELL_NORMAL;
@@ -114,7 +113,7 @@ void LyXTable::Init(int rows_arg, int columns_arg)
     row_info[i-1].bottom_line = true;
     row_info[0].bottom_line = true;
 
-    for (i = 0; i<columns;i++) {
+    for (i = 0; i < columns; ++i) {
         column_info[i].left_line = true;
         column_info[i].right_line = false;
         column_info[i].alignment = LYX_ALIGN_CENTER;
@@ -142,26 +141,26 @@ void LyXTable::Init(int rows_arg, int columns_arg)
 void LyXTable::AppendRow(int cell)
 {
     int row = row_of_cell(cell);
-    rowstruct *row_info2 = new rowstruct[rows+1];
-    cellstruct** cell_info2 = new cellstruct*[rows+1];
+    rowstruct * row_info2 = new rowstruct[rows + 1];
+    cellstruct ** cell_info2 = new cellstruct * [rows + 1];
     int i;
 
-    for (i = 0; i <= row; i++) {
+    for (i = 0; i <= row; ++i) {
         cell_info2[i] = cell_info[i];
         row_info2[i] = row_info[i];
     }
-    for (i = rows-1; i >= row; i--) {
-        cell_info2[i+1] = cell_info[i];
-        row_info2[i+1] = row_info[i];
+    for (i = rows - 1; i >= row; --i) {
+        cell_info2[i + 1] = cell_info[i];
+        row_info2[i + 1] = row_info[i];
     }
-    for (i = row;row_info[i].is_cont_row;i--);
-    if (((row+1)>= rows) || !row_info[row+1].is_cont_row)
-        row_info2[row+1].is_cont_row = false;
-    row_info2[row+1].top_line = row_info[i].top_line;
-    cell_info2[row+1] = new cellstruct[columns];
-    for (i = 0; i<columns; i++) {
-        cell_info2[row+1][i].width_of_cell = 0;
-        cell_info2[row+1][i] = cell_info2[row][i];
+    for (i = row; row_info[i].is_cont_row; --i);
+    if (((row + 1) >= rows) || !row_info[row + 1].is_cont_row)
+        row_info2[row + 1].is_cont_row = false;
+    row_info2[row + 1].top_line = row_info[i].top_line;
+    cell_info2[row + 1] = new cellstruct[columns];
+    for (i = 0; i < columns; ++i) {
+        cell_info2[row + 1][i].width_of_cell = 0;
+        cell_info2[row + 1][i] = cell_info2[row][i];
     }
    
     delete[] cell_info;
@@ -169,7 +168,7 @@ void LyXTable::AppendRow(int cell)
     delete[] row_info;
     row_info = row_info2;
    
-    rows++;
+    ++rows;
    
     Reinit();
 }
@@ -180,29 +179,28 @@ void LyXTable::DeleteRow(int cell)
        int row = row_of_cell(cell);
         while(!row_info[row].is_cont_row && RowHasContRow(cell))
             DeleteRow(cell_info[row+1][0].cellno);
-        rowstruct *row_info2 = new rowstruct[rows-1];
-       cellstruct** cell_info2 = new cellstruct*[rows-1];
-       int i;
+        rowstruct * row_info2 = new rowstruct[rows - 1];
+       cellstruct ** cell_info2 = new cellstruct * [rows - 1];
 
        delete[] cell_info[row];
-       for (i = 0; i < row; i++) {
+       int i = 0;
+       for (; i < row; ++i) {
                cell_info2[i] = cell_info[i];
                 row_info2[i] = row_info[i];
        }
         if (row_info[i].is_cont_row)
-            row_info2[i-1].bottom_line = row_info[i].bottom_line;
-       for (i = row; i < rows - 1; i++) {
-               cell_info2[i] = cell_info[i+1];
-                row_info2[i] = row_info[i+1];
+            row_info2[i - 1].bottom_line = row_info[i].bottom_line;
+       for (i = row; i < rows - 1; ++i) {
+               cell_info2[i] = cell_info[i + 1];
+                row_info2[i] = row_info[i + 1];
        }
-   
 
        delete[] cell_info;
        cell_info = cell_info2;
         delete[] row_info;
         row_info = row_info2;
    
-       rows--;
+       --rows;
 
        Reinit();
 }
@@ -210,63 +208,64 @@ void LyXTable::DeleteRow(int cell)
 
 void LyXTable::AppendColumn(int cell)
 {
-    int i, j;
-    columnstruct *column_info2 = new columnstruct[columns+1];
+    int j;
+    columnstruct * column_info2 = new columnstruct[columns + 1];
     int column = right_column_of_cell(cell);
-   
-    for (i = 0; i<= column; i++){
+
+    int i = 0;
+    for (; i <= column; ++i) {
         column_info2[i] = column_info[i];
     }
-    for (i = columns-1; i>= column; i--){
-        column_info2[i+1] = column_info[i];
+    for (i = columns - 1; i >= column; --i) {
+        column_info2[i + 1] = column_info[i];
     }
     
     delete[] column_info;
     column_info = column_info2;
     
-    for (i = 0; i<rows;i++){
-        cellstruct* tmp = cell_info[i];
-        cell_info[i] = new cellstruct[columns+1];
-        for (j = 0; j<= column; j++){
+    for (i = 0; i < rows; ++i) {
+        cellstruct * tmp = cell_info[i];
+        cell_info[i] = new cellstruct[columns + 1];
+        for (j = 0; j <= column; ++j) {
             cell_info[i][j] = tmp[j];
         }
-        for (j = column; j<columns; j++){
-            cell_info[i][j+1] = tmp[j];
+        for (j = column; j < columns; ++j) {
+            cell_info[i][j + 1] = tmp[j];
         }
         // care about multicolumns
-        if (cell_info[i][column+1].multicolumn
+        if (cell_info[i][column + 1].multicolumn
             == LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
-            cell_info[i][column+1].multicolumn = 
+            cell_info[i][column + 1].multicolumn = 
                 LyXTable::CELL_PART_OF_MULTICOLUMN;
         }
         if (column + 1 == columns
-            || cell_info[i][column+2].multicolumn
+            || cell_info[i][column + 2].multicolumn
             != LyXTable::CELL_PART_OF_MULTICOLUMN){
-            cell_info[i][column+1].multicolumn = 
+            cell_info[i][column + 1].multicolumn = 
                 LyXTable::CELL_NORMAL;
         }
-        
         delete[] tmp;
     }
     
-    columns++;
+    ++columns;
     Reinit();
 }
 
 
 void LyXTable::Reinit()
 {   
-       int i, j;
+       int j;
 
-       for (i = 0; i<rows;i++) {
-               for (j = 0; j<columns; j++) {
+       int i = 0;
+       for (; i < rows; ++i) {
+               for (j = 0; j < columns; ++j) {
                        cell_info[i][j].width_of_cell = 0;
-                        if ((i+1 < rows) && !row_info[i+1].is_cont_row)
+                        if ((i + 1 < rows) && !row_info[i+1].is_cont_row)
                             cell_info[i][j].has_cont_row = false;
                }
        }
   
-       for (i = 0; i<columns;i++) {
+       for (i = 0; i < columns; ++i) {
                calculate_width_of_column(i);
        }
        calculate_width_of_table();
@@ -277,11 +276,11 @@ void LyXTable::Reinit()
 
 void LyXTable::set_row_column_number_info()
 {
-       int row = 0;
        int c = 0;
        int column = 0;
        numberofcells = -1;
-       for (row = 0; row<rows; ++row) {
+       int row = 0;
+       for (; row < rows; ++row) {
                for (column = 0; column<columns; ++column) {
                        if (cell_info[row][column].multicolumn
                            != LyXTable::CELL_PART_OF_MULTICOLUMN)
@@ -303,15 +302,15 @@ void LyXTable::set_row_column_number_info()
        while (c < numberofcells && row < rows && column < columns) {
                rowofcell[c] = row;
                columnofcell[c] = column;
-               c++;
+               ++c;
                do{
-                       column++;
+                       ++column;
                } while (column < columns &&
                         cell_info[row][column].multicolumn
                         == LyXTable::CELL_PART_OF_MULTICOLUMN);
                if (column == columns){
                        column = 0;
-                       row++;
+                       ++row;
                }
        }
 }
@@ -321,12 +320,11 @@ void LyXTable::DeleteColumn(int cell)
 {
        int column1 = column_of_cell(cell);
        int column2 = right_column_of_cell(cell);
-       int column;
    
        if (column1 == 0 && column2 == columns - 1)
                return;
    
-       for (column = column1; column <= column2;column++){
+       for (int column = column1; column <= column2; ++column) {
                delete_column(column1);
        }
        Reinit();
@@ -342,11 +340,10 @@ int LyXTable::GetNumberOfCells()
 int LyXTable::NumberOfCellsInRow(int cell)
 {
        int row = row_of_cell(cell);
-       int i = 0;
        int result = 0;
-       for (i = 0; i<columns; i++){
+       for (int i = 0; i < columns; ++i) {
                if (cell_info[row][i].multicolumn != LyXTable::CELL_PART_OF_MULTICOLUMN)
-                       result++;
+                       ++result;
        }
        return result;
 }
@@ -405,6 +402,7 @@ bool LyXTable::LeftLine(int cell)
        return column_info[column_of_cell(cell)].left_line;
 }
 
+
 bool LyXTable::RightLine(int cell)
 {
        return column_info[right_column_of_cell(cell)].right_line;
@@ -434,7 +432,7 @@ bool LyXTable::TopAlreadyDrawed(int cell)
 
 bool LyXTable::VeryLastRow(int cell)
 {
-       return (row_of_cell(cell) == rows-1);
+       return (row_of_cell(cell) == rows - 1);
 }
 
 
@@ -875,8 +873,9 @@ void LyXTable::Read(FILE * file)
 #warning Insert a error message window here that this format is not supported anymore
 #endif
     if (version < 5) {
-       fprintf(stderr, "Tabular format < 5 is not supported anymore\n"
-               "Get an older version of LyX (< 1.1.x) for conversion!\n");
+           lyxerr << "Tabular format < 5 is not supported anymore\n"
+                   "Get an older version of LyX (< 1.1.x) for conversion!"
+                  << endl;
        return;
     }
     a = b = c = d = -1;
index 433ee6b9b5b78ca00225aed5c0096f18c5c758d7..5b9784cca87da0aac6e2f54ced0cb232acef596c 100644 (file)
@@ -94,7 +94,7 @@
 #include "build.xpm"
 
 // this one is not "C" because combox callbacks are really C++ %-|
-extern void LayoutsCB(int, void*);
+extern void LayoutsCB(int, void *);
 extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
 extern LyXAction lyxaction;
 
@@ -109,7 +109,7 @@ enum _tooltags {
 };
 
 
-struct keyword_item toolTags[TO_LAST-1] = {
+struct keyword_item toolTags[TO_LAST - 1] = {
        { "\\add", TO_ADD },
        { "\\end_toolbar", TO_ENDTOOLBAR },
         { "\\layouts", TO_LAYOUTS },
@@ -126,7 +126,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
        reset();
 
        // extracts the toolbar struct form rct.
-       toolbarItem *tmplist = rct.toollist;
+       toolbarItem * tmplist = rct.toollist;
        while (tmplist != 0) {
                add(tmplist->action);
                lyxerr[Debug::TOOLBAR] << "tool action: "
@@ -140,7 +140,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
 void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
 {
        FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
-       char* help = static_cast<char*>(ob->u_vdata);
+       char * help = static_cast<char*>(ob->u_vdata);
        fl_show_oneliner(help, ob->form->x + ob->x,
                         ob->form->y + ob->y + ob->h);
 }
@@ -154,7 +154,8 @@ extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
 
 // post_handler for bubble-help (Matthias)
 int Toolbar::BubblePost(FL_OBJECT *ob, int event,
-            FL_Coord /*mx*/, FL_Coord /*my*/, int /*key*/, void */*xev*/)
+                       FL_Coord /*mx*/, FL_Coord /*my*/,
+                       int /*key*/, void */*xev*/)
 {
        string help = static_cast<char *>(ob->u_vdata);
        Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
@@ -174,8 +175,8 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
 
 
 extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
-                                  FL_Coord /*mx*/, FL_Coord /*my*/, 
-                                  int key, void * xev)
+                                   FL_Coord /*mx*/, FL_Coord /*my*/, 
+                                   int key, void * xev)
 {
        return Toolbar::BubblePost(ob, event, 0, 0, key, xev);
 }
@@ -229,9 +230,9 @@ int Toolbar::get_toolbar_func(string const & func)
 {
        int action = lyxaction.LookupFunc(func.c_str());
        if (action == -1) {
-               if (func == "separator"){
-                       action = TOOL_SEPARATOR;
-               } else if (func == "layouts"){
+               if (func == "separator"){
+                       action = TOOL_SEPARATOR;
+               } else if (func == "layouts"){
                         action = TOOL_LAYOUTS;
                 } else action = 0;
        }
@@ -286,7 +287,7 @@ void Toolbar::set(bool doingmain)
                fl_addto_form(owner->getForm());
        }
 
-#if FL_REVISION <86
+#if FL_REVISION < 86
        // Ensure borderwidth is 2 to get visual feedback
        int bw = fl_get_border_width();
        fl_set_border_width(-2);
@@ -299,63 +300,63 @@ void Toolbar::set(bool doingmain)
        
        while(item != 0) {
                switch(item->action){
-                 case TOOL_SEPARATOR:
-                         xpos += sepspace;
-                         item = item->next;
-                         break;
-                 case TOOL_LAYOUTS:
-                         xpos += standardspacing;
-                         if (!combox)
-                                 combox = new Combox(FL_COMBOX_DROPLIST);
-                         combox->add(xpos, ypos, 135, height, 300);
-                         combox->setcallback(LayoutsCB);
-                         combox->resize(FL_RESIZE_ALL);
-                         combox->gravity(NorthWestGravity, NorthWestGravity);
-                         item = item->next;
-                         xpos += 135;
-                         break;
-                 default:
-                         xpos += standardspacing;
-                         item->icon = obj = 
-                                 fl_add_pixmapbutton(FL_NORMAL_BUTTON,
-                                                     xpos, ypos,
-                                                     buttonwidth,
-                                                     height, "");
-                         fl_set_object_boxtype(obj, FL_UP_BOX);
-                         fl_set_object_color(obj, FL_MCOL, FL_BLUE);
-                         fl_set_object_resize(obj, FL_RESIZE_ALL);
-                         fl_set_object_gravity(obj,
-                                               NorthWestGravity,
-                                               NorthWestGravity);
-                         fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
-                                                static_cast<long>(item->action));
+               case TOOL_SEPARATOR:
+                       xpos += sepspace;
+                       item = item->next;
+                       break;
+               case TOOL_LAYOUTS:
+                       xpos += standardspacing;
+                       if (!combox)
+                               combox = new Combox(FL_COMBOX_DROPLIST);
+                       combox->add(xpos, ypos, 135, height, 300);
+                       combox->setcallback(LayoutsCB);
+                       combox->resize(FL_RESIZE_ALL);
+                       combox->gravity(NorthWestGravity, NorthWestGravity);
+                       item = item->next;
+                       xpos += 135;
+                       break;
+               default:
+                       xpos += standardspacing;
+                       item->icon = obj = 
+                               fl_add_pixmapbutton(FL_NORMAL_BUTTON,
+                                                   xpos, ypos,
+                                                   buttonwidth,
+                                                   height, "");
+                       fl_set_object_boxtype(obj, FL_UP_BOX);
+                       fl_set_object_color(obj, FL_MCOL, FL_BLUE);
+                       fl_set_object_resize(obj, FL_RESIZE_ALL);
+                       fl_set_object_gravity(obj,
+                                             NorthWestGravity,
+                                             NorthWestGravity);
+                       fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
+                                              static_cast<long>(item->action));
 #if FL_REVISION >85
-                         // Remove the blue feedback rectangle
-                         fl_set_pixmapbutton_focus_outline(obj, 0);
+                       // Remove the blue feedback rectangle
+                       fl_set_pixmapbutton_focus_outline(obj, 0);
 #endif
 
-                         // set the bubble-help (Matthias)
+                       // set the bubble-help (Matthias)
 #warning This is dangerous!
-                         obj->u_vdata = const_cast<char*>(item->help.c_str());
-                         // we need to know what toolbar this item
-                         // belongs too. (Lgb)
-                         obj->u_ldata = reinterpret_cast<long>(this);
+                       obj->u_vdata = const_cast<char*>(item->help.c_str());
+                       // we need to know what toolbar this item
+                       // belongs too. (Lgb)
+                       obj->u_ldata = reinterpret_cast<long>(this);
                          
-                         fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
-
-                         fl_set_pixmapbutton_data(obj, const_cast<char**>(item->pixmap));
-                         item = item->next;
-                         // we must remember to update the positions
-                         xpos += buttonwidth;
-                         // ypos is constant
-                         /* Here will come a check to see if the new
-                          * pos is within the bounds of the main frame,
-                          * and perhaps wrap the toolbar if not.
-                          */
-                         break;
+                       fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
+
+                       fl_set_pixmapbutton_data(obj, const_cast<char**>(item->pixmap));
+                       item = item->next;
+                       // we must remember to update the positions
+                       xpos += buttonwidth;
+                       // ypos is constant
+                       /* Here will come a check to see if the new
+                        * pos is within the bounds of the main frame,
+                        * and perhaps wrap the toolbar if not.
+                        */
+                       break;
                }
        }
-#if FL_REVISION <86
+#if FL_REVISION < 86
        // Reset borderwidth to its default value.
        fl_set_border_width(bw);
 #endif
@@ -370,7 +371,7 @@ void Toolbar::set(bool doingmain)
 }
 
 
-char const **Toolbar::getPixmap(kb_action action, string const & arg)
+char const ** Toolbar::getPixmap(kb_action action, string const & arg)
 {
        char const ** pixmap = unknown_xpm; //0
        switch(action){
@@ -480,7 +481,8 @@ void Toolbar::add(int action, bool doclean)
 
        if (lyxaction.isPseudoAction(action)) {
                string arg;
-               kb_action act = static_cast<kb_action>(lyxaction.retrieveActionArg(action, arg));
+               kb_action act = static_cast<kb_action>
+                       (lyxaction.retrieveActionArg(action, arg));
                pixmap = getPixmap(act, arg);
                help = lyxaction.helpText(act);
                help += " ";
@@ -495,21 +497,21 @@ void Toolbar::add(int action, bool doclean)
        if (pixmap != 0
            || action == TOOL_SEPARATOR
            || action == TOOL_LAYOUTS)
-       {
-               newItem = new toolbarItem;
-               newItem->action = action;
-               newItem->pixmap = pixmap;
-               newItem->help = help;
-               // the new item is placed at the end of the list
-               tmp = toollist;
-               if (tmp != 0){
-                       while(tmp->next != 0)
-                               tmp = tmp->next;
-                       // here is tmp->next == 0
-                       tmp->next = newItem;
-               } else
-                       toollist = newItem;
-       }
+               {
+                       newItem = new toolbarItem;
+                       newItem->action = action;
+                       newItem->pixmap = pixmap;
+                       newItem->help = help;
+                       // the new item is placed at the end of the list
+                       tmp = toollist;
+                       if (tmp != 0){
+                               while(tmp->next != 0)
+                                       tmp = tmp->next;
+                               // here is tmp->next == 0
+                               tmp->next = newItem;
+                       } else
+                               toollist = newItem;
+               }
        //if (action == TOOL_LAYOUTS) {
        //      combox = new Combox(FL_COMBOX_DROPLIST);
        //}
@@ -566,7 +568,7 @@ void Toolbar::push(int nth)
        int count = 0;
        toolbarItem * tmp = toollist;
        while (tmp) {
-               count++;
+               ++count;
                if (count == nth) {
                        fl_trigger_object(tmp->icon);
                        return;
@@ -600,37 +602,37 @@ void Toolbar::read(LyXLex & lex)
                                       << lex.GetString() << '\'' << endl;
 
                switch(lex.lex()) {
-                 case TO_ADD:
-                         if (lex.EatLine()) {
-                                 func = lex.GetString();
-                                 lyxerr[Debug::TOOLBAR]
-                                         << "Toolbar::read TO_ADD func: `"
-                                         << func << "'" << endl;
-                                 add(func);
-                         }
-                         break;
+               case TO_ADD:
+                       if (lex.EatLine()) {
+                               func = lex.GetString();
+                               lyxerr[Debug::TOOLBAR]
+                                       << "Toolbar::read TO_ADD func: `"
+                                       << func << "'" << endl;
+                               add(func);
+                       }
+                       break;
                   
-                 case TO_SEPARATOR:
-                         add(TOOL_SEPARATOR);
-                         break;
+               case TO_SEPARATOR:
+                       add(TOOL_SEPARATOR);
+                       break;
                   
-                 case TO_LAYOUTS:
-                         add(TOOL_LAYOUTS);
-                         break;
+               case TO_LAYOUTS:
+                       add(TOOL_LAYOUTS);
+                       break;
                   
-                 case TO_NEWLINE:
-                         add(TOOL_NEWLINE);
-                         break;
+               case TO_NEWLINE:
+                       add(TOOL_NEWLINE);
+                       break;
                        
-                 case TO_ENDTOOLBAR:
-                         // should not set automatically
-                         //set();
-                         quit = true;
-                         break;
-                 default:
-                         lex.printError("Toolbar::read: "
-                                         "Unknown toolbar tag: `$$Token'");
-                         break;
+               case TO_ENDTOOLBAR:
+                       // should not set automatically
+                       //set();
+                       quit = true;
+                       break;
+               default:
+                       lex.printError("Toolbar::read: "
+                                      "Unknown toolbar tag: `$$Token'");
+                       break;
                }
        }
        lex.popTable();
index b738b63e9e39dad2809cc992fc3f618a5f76a2f3..ee3b985ff8b769081166059850969ce06dfc9949 100644 (file)
@@ -46,9 +46,8 @@ string DefaultTrans::process(char c, TransManager & k)
 
 Trans::Trans()
 {
-       int i;
-
-       for(i = 0; i < 256; ++i)
+       int i = 0;
+       for(; i < 256; ++i)
                keymap_[i] = 0;
 
        for(i = 0; i < TEX_MAX_ACCENT + 1; ++i)
@@ -81,9 +80,7 @@ void Trans::InsertException(Trans::keyexc & exclist, char c,
 
 void Trans::FreeException(Trans::keyexc & exclist)
 {
-       Trans::keyexc p;
-
-       p = exclist;
+       Trans::keyexc p = exclist;
        while (p) {
                p = exclist->next;
                delete exclist;
@@ -94,9 +91,8 @@ void Trans::FreeException(Trans::keyexc & exclist)
 
 void Trans::FreeKeymap()
 {
-       int i;
-
-       for(i = 0; i < 256; ++i)
+       int i = 0;
+       for(; i < 256; ++i)
                if (keymap_[i]) {
                        delete keymap_[i];
                        keymap_[i] = 0;
@@ -131,7 +127,7 @@ enum _kmaptags {
 };
 
 
-struct keyword_item kmapTags[K_LAST-1] = {
+struct keyword_item kmapTags[K_LAST - 1] = {
        {"\\kcomb", KCOMB },
        { "\\kmap", KMAP },
        { "\\kmod", KMOD },
@@ -235,7 +231,8 @@ int Trans::Load(LyXLex & lex)
                        tex_accent accent_2= getkeymod(str);
                        if (accent_2 == TEX_NOACCENT) return -1;
 
-                       if (kmod_list_[accent_1] == 0 || kmod_list_[accent_2] == 0)
+                       if (kmod_list_[accent_1] == 0
+                           || kmod_list_[accent_2] == 0)
                                return -1;
 
                        // Find what key accent_2 is on - should
@@ -317,7 +314,8 @@ int Trans::Load(LyXLex & lex)
                        } else
                                return -1;
 
-                       InsertException(kmod_list_[accent]->exception_list, key, str);
+                       InsertException(kmod_list_[accent]->exception_list,
+                                       key, str);
                        break;
                }
                case LyXLex::LEX_FEOF:
@@ -352,7 +350,8 @@ string Trans::process(char c, TransManager & k)
        if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){
                return k.normalkey(c, dt);
        } else {
-               return k.deadkey(c, *kmod_list_[static_cast<tex_accent>(t[1])]);
+               return k.deadkey(c,
+                                *kmod_list_[static_cast<tex_accent>(t[1])]);
        }
 }
 
@@ -388,7 +387,8 @@ tex_accent getkeymod(string const & p)
                               << "].name = `" << lyx_accent_table[i].name
                               << "'" << endl;
                
-               if ( lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) {
+               if ( lyx_accent_table[i].name
+                    && contains(p, lyx_accent_table[i].name)) {
                        lyxerr[Debug::KBMAP] << "Found it!" << endl;
                        return static_cast<tex_accent>(i);
                }
index 7ddf2843a56f76bcdcaba772207189099f483b9c..02b5719193dbcaa82d5e84002ab96442abc94b9c 100644 (file)
@@ -302,21 +302,26 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
 
 void TransManager::insert(string str, LyXText * text)
 {
-    // Go through the character encoding only if the current 
-    // encoding (chset_->name()) matches the current font_norm
-    // (lyrxc->font_norm
-
-    if (chset_.getName() != lyxrc->font_norm || 
-       ! chset_.encodeString(str)) {
-       // Could not find an encoding
-       InsetLatexAccent ins(str);
-       if (ins.CanDisplay()) {
-           text->InsertInset(new InsetLatexAccent(ins));
-           return;
+       // Go through the character encoding only if the current 
+       // encoding (chset_->name()) matches the current font_norm
+       // (lyrxc->font_norm
+
+       // Is false to speak about "only if" the current encoding will
+       // almost always be equal to font_norm.
+       pair<bool, int> enc = chset_.encodeString(str);
+       if (chset_.getName() != lyxrc->font_norm || 
+           !enc.first) {
+               // Could not find an encoding
+               InsetLatexAccent ins(str);
+               if (ins.CanDisplay()) {
+                       text->InsertInset(new InsetLatexAccent(ins));
+               } else {
+                       insertVerbatim(str, text);
+               }
+               return;
        }
-    }
-    
-    insertVerbatim(str, text);
+       string tmp; tmp += static_cast<char>(enc.second);
+       insertVerbatim(tmp, text);
 }
 
 
index 2ed02b39e05ff29e17a040e18db26c646d8995bb..2a06de412bec9ede5a5e1bc7c8a3688071fc311c 100644 (file)
 #include "support/lstrings.h"
 
 extern LyXRC * lyxrc;
-extern BufferView *current_view;
+extern BufferView * current_view;
 
 /*  length units
  */
 
-static const int   num_units            = LyXLength::UNIT_NONE;
+static const int num_units = LyXLength::UNIT_NONE;
 
 // I am not sure if "mu" should be possible to select (Lgb)
 static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
-                                           "mm", "pc", "cc", "cm",
-                                           "in", "ex", "em", "mu" }; 
+                                            "mm", "pc", "cc", "cm",
+                                            "in", "ex", "em", "mu" }; 
 
 
 LyXLength::UNIT unitFromString (string const & data)
@@ -121,7 +121,7 @@ static char nextToken (string & data)
 static struct {
        char const * pattern;
        int   plus_val_index, minus_val_index,
-             plus_uni_index, minus_uni_index;
+               plus_uni_index, minus_uni_index;
 } table[] = { { "nu",       0, 0, 0, 0 },
              { "nu+nu",    2, 0, 2, 0 },
              { "nu+nu-nu", 2, 3, 2, 3 },
@@ -202,12 +202,12 @@ bool isValidGlueLength (string const & data, LyXGlueLength * result)
        // is zero, the corresponding array value is zero or UNIT_NONE,
        // so we needn't check this.
        if (result) {
-           result->val = number[1] * val_sign;
-           result->uni = unit[1];
-           result->plus_val  = number[table[table_index].plus_val_index];
-           result->minus_val = number[table[table_index].minus_val_index];
-           result->plus_uni  = unit  [table[table_index].plus_uni_index];
-           result->minus_uni = unit  [table[table_index].minus_uni_index];
+               result->val = number[1] * val_sign;
+               result->uni = unit[1];
+               result->plus_val  = number[table[table_index].plus_val_index];
+               result->minus_val = number[table[table_index].minus_val_index];
+               result->plus_uni  = unit  [table[table_index].plus_uni_index];
+               result->minus_uni = unit  [table[table_index].minus_uni_index];
        }
        return true;
 }
@@ -258,8 +258,8 @@ bool isValidLength(string const & data, LyXLength * result)
        // It _was_ a correct length string.  
        // Store away the values we found.
        if (result) {
-           result->val = number[1]*val_sign;
-           result->uni = unit[1];
+               result->val = number[1] * val_sign;
+               result->uni = unit[1];
        }
        return true;
 }
@@ -473,17 +473,17 @@ string VSpace::asLatexCommand() const
        switch (kin) {
        case NONE:      return string();
        case DEFSKIP:   
-         return current_view->buffer()->params.getDefSkip().asLatexCommand();
+               return current_view->buffer()->params.getDefSkip().asLatexCommand();
        case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
-                                 : "\\smallskip{}";
+                               : "\\smallskip{}";
        case MEDSKIP:   return kp ? "\\vspace*{\\medskipamount}"
-                                 : "\\medskip{}";
+                               : "\\medskip{}";
        case BIGSKIP:   return kp ? "\\vspace*{\\bigskipamount}"
-                                 : "\\bigskip{}";
+                               : "\\bigskip{}";
        case VFILL:     return kp ? "\\vspace*{\\fill}"
-                                 : "\\vfill{}";
+                               : "\\vfill{}";
        case LENGTH:    return kp ? "\\vspace*{" + len.asLatexString() + '}'
-                                 : "\\vspace{" + len.asLatexString() + '}';
+                               : "\\vspace{" + len.asLatexString() + '}';
        }
        return string();  // should never be reached
 }
@@ -492,11 +492,7 @@ string VSpace::asLatexCommand() const
 int VSpace::inPixels() const
 {
        // Height of a normal line in pixels (zoom factor considered)
-#ifdef MOVE_TEXT
        int height = current_view->text->DefaultHeight(); // [pixels]
-#else
-       int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
-#endif
 
        // Zoom factor specified by user in percent
        float const zoom = lyxrc->zoom / 100.0; // [percent]
@@ -511,16 +507,16 @@ int VSpace::inPixels() const
        case NONE: return 0;
 
        case DEFSKIP:
-         return current_view->buffer()->params.getDefSkip().inPixels();
+               return current_view->buffer()->params.getDefSkip().inPixels();
 
-       // This is how the skips are normally defined by
-       // LateX.  But there should be some way to change
-       // this per document.
+               // This is how the skips are normally defined by
+               // LateX.  But there should be some way to change
+               // this per document.
        case SMALLSKIP: return height/4;
        case MEDSKIP:   return height/2;
        case BIGSKIP:   return height;
        case VFILL:     return 3*height;
-                       // leave space for the vfill symbol
+               // leave space for the vfill symbol
        case LENGTH:
                // Pixel values are scaled so that the ratio
                // between lengths and font sizes on the screen
@@ -551,7 +547,7 @@ int VSpace::inPixels() const
                case LyXLength::DD:
                        // Didot: 1157dd = 1238 pt?
                        result = zoom * dpi * value
-                               / (72.27/(0.376 * 2.845)); // 67.559735
+                               / (72.27 / (0.376 * 2.845)); // 67.559735
                        break;
                case LyXLength::MM:
                        // Millimeter: 1 mm = 1/25.4 inch
@@ -561,12 +557,12 @@ int VSpace::inPixels() const
                case LyXLength::PC:
                        // Pica: 1 pc = 12 pt
                        result = zoom * dpi * value
-                               / (72.27/12); // 6.0225
+                               / (72.27 / 12); // 6.0225
                        break;
                case LyXLength::CC:
                        // Cicero: 1 cc = 12 dd
                        result = zoom * dpi * value
-                               / (72.27/ (12*0.376*2.845)); // 5.6299779
+                               / (72.27 / (12 * 0.376 * 2.845)); // 5.6299779
                        break;
                case LyXLength::CM:
                        // Centimeter: 1 cm = 1/2.54 inch
@@ -586,7 +582,7 @@ int VSpace::inPixels() const
                        result = zoom * value * height / 2; // Why 2?
                        break;
                case LyXLength::MU: // This is probably only allowed in
-                                   // math mode
+                       // math mode
                        result = zoom * value * height;
                        break;
                case LyXLength::UNIT_NONE: