diff --git a/ChangeLog b/ChangeLog index 65da35043b..c893aaa30a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +1999-12-01 Lars Gullik Bjønnes + + * src/support/filetools.C (ExpandPath): removed an over eager + Assert. + (ReplaceEnvironmentPath): ditto + + * src/toolbar.C (BubbleTimerCB): use C++ style casts. This clearly + shows that we are doing something fishy in our code... + (BubblePost): ditto + (ToolbarCB): ditto + + * src/lyxrc.C (read): use a double switch trick to get more help + from the compiler. (the same trick is used in layout.C) + (write): new function. opens a ofstream and pass that to output + (output): new function, takes a ostream and writes the lyxrc + elemts to it. uses a dummy switch to make sure no elements are + forgotten. + + * src/lyxlex.h: added a struct pushpophelper for use in functions + with more than one exit point. + + * src/lyxlex.[Ch] (GetInteger): made it const + (GetFloat): ditto + (GetBool): ditto + + * src/lyxfunc.C (Dispatch): added case for LFUN_SAVEPREFERENCES + + * src/layout.[hC] : LayoutTags splitted into several enums, new + methods created, better error handling cleaner use of lyxlex. Read + the diff. + + * src/bmtable.[Ch]: change some member prototypes because of the + image const changes. + + * commandtags.h, src/LyXAction.C (init): new function: + "preferences-save", saves the lyxrc entries into .lyx/preferences. + This file is not read automatically but you can add \input + preferences to your lyxrc if you want to. We need to discuss how + to handle this. + + * src/LaTeX.C (runBibTeX): use regex to match for the needed lines + in .aux, also remove .bib and .bst files from dependencies when + running bibtex. + + * src/BufferView.C, src/LyXView.C: add const_cast several places + because of changes to images. + + * lib/images/*: same change as for images/* + + * lib/lyxrc.example: Default for accept_compound is false not no. + + * images/*: changed to be const, however I have som misgivings + about this change so it might be changed back. + 1999-11-26 Jean-Marc Lasgouttes * lib/configure, po/POTFILES.in: regenerated diff --git a/images/arrows.xbm b/images/arrows.xbm index e258322213..3b5a3cbd36 100644 --- a/images/arrows.xbm +++ b/images/arrows.xbm @@ -1,6 +1,6 @@ #define arrow_width 185 #define arrow_height 143 -static unsigned char arrow_bits[] = { +static unsigned char const arrow_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -232,7 +232,7 @@ static unsigned char arrow_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe}; #define darrow_width 73 #define darrow_height 73 -static unsigned char darrow_bits[] = { +static unsigned char const darrow_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, @@ -284,7 +284,7 @@ static unsigned char darrow_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe}; #define larrow_width 103 #define larrow_height 126 -static unsigned char larrow_bits[] = { +static unsigned char const larrow_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/images/banner.xpm b/images/banner.xpm index ec82c130aa..422ec2d579 100644 --- a/images/banner.xpm +++ b/images/banner.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *banner[] = { +static char const * banner[] = { /* width height num_colors chars_per_pixel */ " 424 289 16 1", /* colors */ diff --git a/images/banner_bw.xbm b/images/banner_bw.xbm index 8bd089e332..8fd8ca1bf6 100644 --- a/images/banner_bw.xbm +++ b/images/banner_bw.xbm @@ -1,6 +1,6 @@ #define banner_bw_width 424 #define banner_bw_height 289 -static unsigned char banner_bw_bits[] = { +static unsigned char const banner_bw_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, diff --git a/images/bold_bw.xpm b/images/bold_bw.xpm index 467bd7d2b0..d484d886d2 100644 --- a/images/bold_bw.xpm +++ b/images/bold_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * bold_xpm[] = { +static char const * bold_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/bop.xbm b/images/bop.xbm index d4b43979f2..9783aa9b70 100644 --- a/images/bop.xbm +++ b/images/bop.xbm @@ -1,6 +1,6 @@ #define bop_width 118 #define bop_height 259 -static unsigned char bop_bits[] = { +static unsigned char const bop_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, diff --git a/images/brel.xbm b/images/brel.xbm index b67d064ecd..e9acc3968e 100644 --- a/images/brel.xbm +++ b/images/brel.xbm @@ -1,6 +1,6 @@ #define brel_width 123 #define brel_height 291 -static unsigned char brel_bits[] = { +static unsigned char const brel_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/images/build.xpm b/images/build.xpm index caf50d240b..6f091d5b0c 100644 --- a/images/build.xpm +++ b/images/build.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *build_xpm[] = { +static char const * build_xpm[] = { "20 20 4 1", ". c black", " c #BFBFBFBFBFBF", diff --git a/images/close.xpm b/images/close.xpm index df60955c4c..752a72c8e0 100644 --- a/images/close.xpm +++ b/images/close.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * close_xpm[] = { +static char const * close_xpm[] = { "20 20 5 1", " c #BFBFBFBFBFBF", ". c #7B7B00000000", diff --git a/images/close_bw.xpm b/images/close_bw.xpm index e1a7b6999d..aa5f54423b 100644 --- a/images/close_bw.xpm +++ b/images/close_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * close_xpm[] = { +static char const * close_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/copy.xpm b/images/copy.xpm index 2e2a16bd32..f6e7abae1f 100644 --- a/images/copy.xpm +++ b/images/copy.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * copy_xpm[] = { +static char const * copy_xpm[] = { "20 20 5 1", " c #000000000000", ". c #BFBFBFBFBFBF", diff --git a/images/copy_bw.xpm b/images/copy_bw.xpm index 48778e6611..296e842944 100644 --- a/images/copy_bw.xpm +++ b/images/copy_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * copy_xpm[] = { +static char const * copy_xpm[] = { "20 20 5 1", " c black", ". c #BFBFBFBFBFBF", diff --git a/images/cut.xpm b/images/cut.xpm index 4848412b30..0ea70262b0 100644 --- a/images/cut.xpm +++ b/images/cut.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * cut_xpm[] = { +static char const * cut_xpm[] = { "20 20 3 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/cut_bw.xpm b/images/cut_bw.xpm index 82d189a48f..9c303975fc 100644 --- a/images/cut_bw.xpm +++ b/images/cut_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * cut_xpm[] = { +static char const * cut_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/deco.xbm b/images/deco.xbm index 1e3c70554c..e975cd335a 100644 --- a/images/deco.xbm +++ b/images/deco.xbm @@ -1,6 +1,6 @@ #define deco_width 137 #define deco_height 90 -static unsigned char deco_bits[] = { +static unsigned char const deco_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, diff --git a/images/deco.xpm b/images/deco.xpm index 30232848e7..8b068be061 100644 --- a/images/deco.xpm +++ b/images/deco.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * deco[] = { +static char const * deco[] = { "20 20 3 1", " c #BEFBBEFBBEFB", ". c #000000000000", diff --git a/images/delim.xbm b/images/delim.xbm index 2f81b46c31..04283fe1dc 100644 --- a/images/delim.xbm +++ b/images/delim.xbm @@ -1,6 +1,6 @@ #define delim_width 164 #define delim_height 136 -static unsigned char delim_bits[] = { +static unsigned char const delim_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/images/delim.xpm b/images/delim.xpm index 73fdf6bc39..f875f548e5 100644 --- a/images/delim.xpm +++ b/images/delim.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *delim[] = { +static char const * delim[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ diff --git a/images/delim0.xpm b/images/delim0.xpm index 0b6d87521c..91369eda80 100644 --- a/images/delim0.xpm +++ b/images/delim0.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *delim0[] = { +static char const * delim0[] = { /* width height num_colors chars_per_pixel */ " 31 31 2 1", /* colors */ @@ -10,8 +10,8 @@ static char *delim0[] = { "###############################", "###############################", "###############################", -"#######a#######################", -"######a#############aa#########", +"#######a###########a###########", +"######a#############a##########", "#####a###############a#########", "#####a################a########", "####a##################a#######", diff --git a/images/depth.xpm b/images/depth.xpm index bdaab372c6..1acee58000 100644 --- a/images/depth.xpm +++ b/images/depth.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * depth_xpm[] = { +static char const * depth_xpm[] = { "20 20 5 1", " c gray60", ". c #000000000000", diff --git a/images/depth_bw.xpm b/images/depth_bw.xpm index 08cc4cf761..ea51b3c86d 100644 --- a/images/depth_bw.xpm +++ b/images/depth_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * depth_xpm[] = { +static char const * depth_xpm[] = { "20 20 3 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/dots.xbm b/images/dots.xbm index a5520abbf0..e94cfe5f40 100644 --- a/images/dots.xbm +++ b/images/dots.xbm @@ -1,6 +1,6 @@ #define dots_width 72 #define dots_height 18 -static unsigned char dots_bits[] = { +static unsigned char const dots_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/images/down.xpm b/images/down.xpm index c6c90b78fb..7d2be365c5 100644 --- a/images/down.xpm +++ b/images/down.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *down_xpm[] = { +static char const * down_xpm[] = { /* width height num_colors chars_per_pixel */ " 11 11 4 1", /* colors */ diff --git a/images/emph.xpm b/images/emph.xpm index 03e15ff1da..15439b3c42 100644 --- a/images/emph.xpm +++ b/images/emph.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * emph_xpm[] = { +static char const * emph_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/emph_bw.xpm b/images/emph_bw.xpm index 03e15ff1da..15439b3c42 100644 --- a/images/emph_bw.xpm +++ b/images/emph_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * emph_xpm[] = { +static char const * emph_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/equation.xpm b/images/equation.xpm index 39d9991fa8..bcdfcf812c 100644 --- a/images/equation.xpm +++ b/images/equation.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *equation[] = { +static char const * equation[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ diff --git a/images/fig.xpm b/images/fig.xpm index 9f8a0fb0fd..6a7c9bcf9e 100644 --- a/images/fig.xpm +++ b/images/fig.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * fig_xpm[] = { +static char const * fig_xpm[] = { "20 20 4 1", " c #000000000000", ". c #FFFFFFFFFFFF", diff --git a/images/fig_bw.xpm b/images/fig_bw.xpm index 45f7449ad7..a7c63848dd 100644 --- a/images/fig_bw.xpm +++ b/images/fig_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * fig_xpm[] = { +static char const * fig_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/foot.xpm b/images/foot.xpm index f27888b372..7972a0f485 100644 --- a/images/foot.xpm +++ b/images/foot.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * foot_xpm[] = { +static char const * foot_xpm[] = { "20 20 4 1", " c gray60", ". c #000000000000", diff --git a/images/frac.xpm b/images/frac.xpm index 30696d5f09..9ab90164c2 100644 --- a/images/frac.xpm +++ b/images/frac.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *frac[] = { +static char const * frac[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ diff --git a/images/free.xpm b/images/free.xpm index 1a81e962b5..3377eab419 100644 --- a/images/free.xpm +++ b/images/free.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * free_xpm[] = { +static char const * free_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/free_bw.xpm b/images/free_bw.xpm index 0e2a58e207..570ca15a0b 100644 --- a/images/free_bw.xpm +++ b/images/free_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * free_xpm[] = { +static char const * free_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/greek.xbm b/images/greek.xbm index ce4e98645a..2a8ee67605 100644 --- a/images/greek.xbm +++ b/images/greek.xbm @@ -1,6 +1,6 @@ #define Greek_width 182 #define Greek_height 60 -static unsigned char Greek_bits[] = { +static unsigned char const Greek_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/images/layout_code.xpm b/images/layout_code.xpm index d5be2fc409..9d0f6bf640 100644 --- a/images/layout_code.xpm +++ b/images/layout_code.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * layout_code_xpm[] = { +static char const * layout_code_xpm[] = { "20 20 4 1", " c gray50", ". c black", diff --git a/images/layout_latex.xpm b/images/layout_latex.xpm index b541b8ad92..f38f2620f1 100644 --- a/images/layout_latex.xpm +++ b/images/layout_latex.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * layout_latex_xpm[] = { +static char const * layout_latex_xpm[] = { "20 20 4 1", " c gray60", ". c #000000000000", diff --git a/images/layout_scrap.xpm b/images/layout_scrap.xpm index 13f98e75e1..49b0c5d701 100644 --- a/images/layout_scrap.xpm +++ b/images/layout_scrap.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *layout_scrap_xpm[] = { +static char const * layout_scrap_xpm[] = { " 20 20 3 1", ". c gray30", " c #BFBFBFBFBFBF", diff --git a/images/layout_sec.xpm b/images/layout_sec.xpm index 2c2568e3ec..022d46dca1 100644 --- a/images/layout_sec.xpm +++ b/images/layout_sec.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * layout_sec_xpm[] = { +static char const * layout_sec_xpm[] = { "20 20 4 1", " c gray60", ". c #000000000000", diff --git a/images/layout_std.xpm b/images/layout_std.xpm index a689d7d97d..8ff7965ef8 100644 --- a/images/layout_std.xpm +++ b/images/layout_std.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * layout_std_xpm[] = { +static char const * layout_std_xpm[] = { "20 20 3 1", " c gray50", ". c #000000000000", diff --git a/images/lyx.xpm b/images/lyx.xpm index 7ebf4d4dee..8a8911afe0 100644 --- a/images/lyx.xpm +++ b/images/lyx.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *lyx_xpm[] = { +static char const * lyx_xpm[] = { /* width height num_colors chars_per_pixel */ " 48 48 7 1", /* colors */ diff --git a/images/make_ascii_bw.xpm b/images/make_ascii_bw.xpm index ce13a18615..a75398fd3d 100644 --- a/images/make_ascii_bw.xpm +++ b/images/make_ascii_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * make_ascii_xpm[] = { +static char const * make_ascii_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c black", diff --git a/images/make_latex_bw.xpm b/images/make_latex_bw.xpm index 737366c4b5..088c96699b 100644 --- a/images/make_latex_bw.xpm +++ b/images/make_latex_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * make_latex_xpm[] = { +static char const * make_latex_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c black", diff --git a/images/margin.xpm b/images/margin.xpm index c5af2f1612..874e3d7b89 100644 --- a/images/margin.xpm +++ b/images/margin.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * margin_xpm[] = { +static char const * margin_xpm[] = { "20 20 5 1", " c gray60", ". c #000000000000", diff --git a/images/margin_bw.xpm b/images/margin_bw.xpm index bc63ad6873..4f038ce667 100644 --- a/images/margin_bw.xpm +++ b/images/margin_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * margin_xpm[] = { +static char const * margin_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/math.xpm b/images/math.xpm index cfa9f0d936..89a3d14f41 100644 --- a/images/math.xpm +++ b/images/math.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * math_xpm[] = { +static char const * math_xpm[] = { "20 20 4 1", " c #BFBFBFBFBFBF", ". c #242423238E8E", diff --git a/images/math_bw.xpm b/images/math_bw.xpm index e520016eaf..65083cca27 100644 --- a/images/math_bw.xpm +++ b/images/math_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * math_xpm[] = { +static char const * math_xpm[] = { /**/ "20 20 2 1", /*33333333333*/ diff --git a/images/matrix.xpm b/images/matrix.xpm index d64b69fb32..0809afbef1 100644 --- a/images/matrix.xpm +++ b/images/matrix.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *matrix[] = { +static char const * matrix[] = { /* width height num_colors chars_per_pixel */ " 20 20 2 1", /* colors */ diff --git a/images/melt.xpm b/images/melt.xpm index b12cd5f551..f2af564901 100644 --- a/images/melt.xpm +++ b/images/melt.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * melt_xpm[] = { +static char const * melt_xpm[] = { "20 20 5 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/melt_bw.xpm b/images/melt_bw.xpm index a929502bed..41e30f2433 100644 --- a/images/melt_bw.xpm +++ b/images/melt_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * melt_xpm[] = { +static char const * melt_xpm[] = { /**/ "20 20 2 1", /*33333333333*/ diff --git a/images/misc.xbm b/images/misc.xbm index ce861e978a..ff1b50eaac 100644 --- a/images/misc.xbm +++ b/images/misc.xbm @@ -1,6 +1,6 @@ #define misc_width 150 #define misc_height 193 -static unsigned char misc_bits[] = { +static unsigned char const misc_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/images/noun.xpm b/images/noun.xpm index 693e56f676..0b0f40701c 100644 --- a/images/noun.xpm +++ b/images/noun.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * noun_xpm[] = { +static char const * noun_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/noun_bw.xpm b/images/noun_bw.xpm index eb3207d137..511a2f2416 100644 --- a/images/noun_bw.xpm +++ b/images/noun_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * noun_xpm[] = { +static char const * noun_xpm[] = { /**/ "20 20 2 1", /*÷F¼÷FÃd÷FÄD÷FÆôges/delim.xbm*/ diff --git a/images/open.xpm b/images/open.xpm index 71e599a0a0..591c8bcfad 100644 --- a/images/open.xpm +++ b/images/open.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * open_xpm[] = { +static char const * open_xpm[] = { "20 20 5 1", " c #BFBFBFBFBFBF", ". c navy", diff --git a/images/open_bw.xpm b/images/open_bw.xpm index 075d78dc6e..89c6813555 100644 --- a/images/open_bw.xpm +++ b/images/open_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * open_xpm[] = { +static char const * open_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/paste.xpm b/images/paste.xpm index f2a8b010e5..17eae2594f 100644 --- a/images/paste.xpm +++ b/images/paste.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * paste_xpm[] = { +static char const * paste_xpm[] = { "20 20 6 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/paste_bw.xpm b/images/paste_bw.xpm index d6c8e43de6..b502a22d71 100644 --- a/images/paste_bw.xpm +++ b/images/paste_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * paste_xpm[] = { +static char const * paste_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/print1.xpm b/images/print1.xpm index 00fb398dfc..21d823790b 100644 --- a/images/print1.xpm +++ b/images/print1.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * print1_xpm[] = { +static char const * print1_xpm[] = { "24 20 7 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/print1_bw.xpm b/images/print1_bw.xpm index fbad75f38b..3b230baf44 100644 --- a/images/print1_bw.xpm +++ b/images/print1_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * print1_xpm[] = { +static char const * print1_xpm[] = { /* width height num_colors chars_per_pixel */ "24 20 2 1", /* colors */ diff --git a/images/quit.xpm b/images/quit.xpm index 9b02c5f7ac..c07adfde5d 100644 --- a/images/quit.xpm +++ b/images/quit.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *quit_xpm[] = { +static char const * quit_xpm[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ diff --git a/images/quit_bw.xpm b/images/quit_bw.xpm index a546cc4ca8..092fbdbe3c 100644 --- a/images/quit_bw.xpm +++ b/images/quit_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * quit_xpm[] = { +static char const * quit_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /* colors */ diff --git a/images/run_latex_bw.xpm b/images/run_latex_bw.xpm index ab4a3d5c8b..6986dc6a78 100644 --- a/images/run_latex_bw.xpm +++ b/images/run_latex_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * run_latex_xpm[] = { +static char const * run_latex_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/sans_bw.xpm b/images/sans_bw.xpm index 11e6dbf453..3ec1a95833 100644 --- a/images/sans_bw.xpm +++ b/images/sans_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * sans_xpm[] = { +static char const * sans_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/save.xpm b/images/save.xpm index dc0004b773..b60de22668 100644 --- a/images/save.xpm +++ b/images/save.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * save_xpm[] = { +static char const * save_xpm[] = { "20 20 5 1", " c #BFBFBFBFBFBF", ". c black", diff --git a/images/save_bw.xpm b/images/save_bw.xpm index e1e439fdcd..85590e382c 100644 --- a/images/save_bw.xpm +++ b/images/save_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * save_xpm[] = { +static char const * save_xpm[] = { /*€*/ "20 20 2 1", /**/ diff --git a/images/smallcaps.xpm b/images/smallcaps.xpm index 53219c4ddc..c408cf105b 100644 --- a/images/smallcaps.xpm +++ b/images/smallcaps.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * smallcaps_xpm[] = { +static char const * smallcaps_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/smallcaps_bw.xpm b/images/smallcaps_bw.xpm index 4534ce795e..4f3b339ed1 100644 --- a/images/smallcaps_bw.xpm +++ b/images/smallcaps_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * smallcaps_xpm[] = { +static char const * smallcaps_xpm[] = { /**/ "20 20 2 1", /**/ diff --git a/images/space.xpm b/images/space.xpm index de5c74b4ac..8fe7e7ff61 100644 --- a/images/space.xpm +++ b/images/space.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * space_xpm[] = { +static char const * space_xpm[] = { "20 20 2 1", " c #BEFBBEFBBEFB", ". c #FBEE14514103", diff --git a/images/sqrt.xpm b/images/sqrt.xpm index 1278646a8f..a1dda93f72 100644 --- a/images/sqrt.xpm +++ b/images/sqrt.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *sqrt[] = { +static char const * sqrt[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ diff --git a/images/tab.xpm b/images/tab.xpm index 56e8c447fd..bd7e66e5aa 100644 --- a/images/tab.xpm +++ b/images/tab.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * tab_xpm[] = { +static char const * tab_xpm[] = { "20 20 3 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/tab_bw.xpm b/images/tab_bw.xpm index 3096b09776..742c40e5cc 100644 --- a/images/tab_bw.xpm +++ b/images/tab_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * tab_xpm[] = { +static char const * tab_xpm[] = { /*.e:*/ "20 20 2 1", /**/ diff --git a/images/tex.xpm b/images/tex.xpm index 3656594213..d107cf90ab 100644 --- a/images/tex.xpm +++ b/images/tex.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * tex_xpm[] = { +static char const * tex_xpm[] = { "20 20 2 1", " c #BEFBBEFBBEFB", ". c #7B7B00000000", diff --git a/images/tex_bw.xpm b/images/tex_bw.xpm index 692654b3ef..f7e904795b 100644 --- a/images/tex_bw.xpm +++ b/images/tex_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * tex_xpm[] = { +static char const * tex_xpm[] = { /*.e:*/ "20 20 2 1", /**/ diff --git a/images/typeset_ps.xpm b/images/typeset_ps.xpm index eeb4fee6bd..1deb0b0192 100644 --- a/images/typeset_ps.xpm +++ b/images/typeset_ps.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * update_ps_xpm[] = { +static char const * update_ps_xpm[] = { "20 20 3 1", " c #BFBFBFBFBFBF", ".c navy", diff --git a/images/typeset_ps_bw.xpm b/images/typeset_ps_bw.xpm index 7462c52a4c..98f2eb1f36 100644 --- a/images/typeset_ps_bw.xpm +++ b/images/typeset_ps_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * update_ps_xpm[] = { +static char const * update_ps_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c black", diff --git a/images/unknown.xpm b/images/unknown.xpm index 4f1b8aad47..4771cca01f 100644 --- a/images/unknown.xpm +++ b/images/unknown.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *unknown_xpm[] = { +static char const * unknown_xpm[] = { /* width height num_colors chars_per_pixel */ " 20 20 2 1", /* colors */ diff --git a/images/unknown_bw.xpm b/images/unknown_bw.xpm index d4df02a830..8cfa0594fa 100644 --- a/images/unknown_bw.xpm +++ b/images/unknown_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * unknown_xpm[] = { +static char const * unknown_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 2 1", /**/ diff --git a/images/up.xpm b/images/up.xpm index c98b1986d6..411fd83ea9 100644 --- a/images/up.xpm +++ b/images/up.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *up_xpm[] = { +static char const * up_xpm[] = { /* width height num_colors chars_per_pixel */ " 11 11 4 1", /* colors */ diff --git a/images/varsz.xbm b/images/varsz.xbm index 7f6d55c170..d2291c57b7 100644 --- a/images/varsz.xbm +++ b/images/varsz.xbm @@ -1,6 +1,6 @@ #define varsz_width 110 #define varsz_height 192 -static unsigned char varsz_bits[] = { +static unsigned char const varsz_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00, diff --git a/images/view_dvi_bw.xpm b/images/view_dvi_bw.xpm index 6d0805f34a..d1b71b313f 100644 --- a/images/view_dvi_bw.xpm +++ b/images/view_dvi_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * view_dvi_xpm[] = { +static char const * view_dvi_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/images/view_ps_bw.xpm b/images/view_ps_bw.xpm index 5cdc5dcaac..090086b1fa 100644 --- a/images/view_ps_bw.xpm +++ b/images/view_ps_bw.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * view_ps_xpm[] = { +static char const * view_ps_xpm[] = { "20 20 2 1", " c #BFBFBFBFBFBF", ". c #000000000000", diff --git a/lib/images/amssymb.xbm b/lib/images/amssymb.xbm index 49db34d917..404fb01e19 100644 --- a/lib/images/amssymb.xbm +++ b/lib/images/amssymb.xbm @@ -1,6 +1,6 @@ #define amssymb_width 264 #define amssymb_height 174 -static char amssymb_bits[] = { +static char const amssymb_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/amssymb.xpm b/lib/images/amssymb.xpm index 164db267c1..50e81704c3 100644 --- a/lib/images/amssymb.xpm +++ b/lib/images/amssymb.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *amssymb[] = { +static char const * amssymb[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/images/psnfss1.xbm b/lib/images/psnfss1.xbm index 7498b56e43..f321ab3c63 100644 --- a/lib/images/psnfss1.xbm +++ b/lib/images/psnfss1.xbm @@ -1,6 +1,6 @@ #define psnfss1_width 264 #define psnfss1_height 174 -static char psnfss1_bits[] = { +static char const psnfss1_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/psnfss1.xpm b/lib/images/psnfss1.xpm index 6e932b2e51..deb02b95a5 100644 --- a/lib/images/psnfss1.xpm +++ b/lib/images/psnfss1.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *psnfss1[] = { +static char const * psnfss1[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/images/psnfss2.xbm b/lib/images/psnfss2.xbm index 60aaf59f48..c69d3257c1 100644 --- a/lib/images/psnfss2.xbm +++ b/lib/images/psnfss2.xbm @@ -1,6 +1,6 @@ #define psnfss2_width 264 #define psnfss2_height 174 -static char psnfss2_bits[] = { +static char const psnfss2_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/psnfss2.xpm b/lib/images/psnfss2.xpm index 6cc00fc3e2..ed1fa33bfa 100644 --- a/lib/images/psnfss2.xpm +++ b/lib/images/psnfss2.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *psnfss2[] = { +static char const * psnfss2[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/images/psnfss3.xbm b/lib/images/psnfss3.xbm index 69e0e59537..56a5c7581f 100644 --- a/lib/images/psnfss3.xbm +++ b/lib/images/psnfss3.xbm @@ -1,6 +1,6 @@ #define psnfss3_width 264 #define psnfss3_height 174 -static char psnfss3_bits[] = { +static char const psnfss3_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/psnfss3.xpm b/lib/images/psnfss3.xpm index 544e6ac54d..5fc491715b 100644 --- a/lib/images/psnfss3.xpm +++ b/lib/images/psnfss3.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *psnfss3[] = { +static char const * psnfss3[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/images/psnfss4.xbm b/lib/images/psnfss4.xbm index 04f7c5e16f..76b687a2e0 100644 --- a/lib/images/psnfss4.xbm +++ b/lib/images/psnfss4.xbm @@ -1,6 +1,6 @@ #define psnfss4_width 264 #define psnfss4_height 174 -static char psnfss4_bits[] = { +static char const psnfss4_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/psnfss4.xpm b/lib/images/psnfss4.xpm index 55ea13b80a..5d91ef5a43 100644 --- a/lib/images/psnfss4.xpm +++ b/lib/images/psnfss4.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *psnfss4[] = { +static char const * psnfss4[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/images/standard.xbm b/lib/images/standard.xbm index 11775f6b00..4950f9113a 100644 --- a/lib/images/standard.xbm +++ b/lib/images/standard.xbm @@ -1,6 +1,6 @@ #define standard_width 264 #define standard_height 174 -static char standard_bits[] = { +static char const standard_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/lib/images/standard.xpm b/lib/images/standard.xpm index 235f465bc0..6b2b23dc8d 100644 --- a/lib/images/standard.xpm +++ b/lib/images/standard.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *standard[] = { +static char const * standard[] = { /* width height num_colors chars_per_pixel */ " 264 174 16 1", /* colors */ diff --git a/lib/lyxrc.example b/lib/lyxrc.example index 36d8e5df0d..4f1aab670b 100644 --- a/lib/lyxrc.example +++ b/lib/lyxrc.example @@ -521,7 +521,7 @@ #\spell_command aspell # Consider run-together words, such as "notthe" for "not the", as legal -# words? Default is no. +# words? Default is false. #\accept_compound true # Specify an alternate language. The default is to use the language of diff --git a/src/BufferView.C b/src/BufferView.C index 852ab7d016..1db4d7fd70 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -437,7 +437,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) fl_set_object_gravity(obj, NorthEastGravity, NorthEastGravity); fl_set_object_callback(obj, C_BufferView_UpCB, 0); obj->u_vdata = this; - fl_set_pixmapbutton_data(obj, up_xpm); + fl_set_pixmapbutton_data(obj, const_cast(up_xpm)); #if FL_REVISION > 85 // Remove the blue feedback rectangle @@ -473,7 +473,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity); fl_set_object_callback(obj, C_BufferView_DownCB, 0); obj->u_vdata = this; - fl_set_pixmapbutton_data(obj, down_xpm); + fl_set_pixmapbutton_data(obj, const_cast(down_xpm)); fl_set_border_width(-bw); #if FL_REVISION >85 diff --git a/src/LaTeX.C b/src/LaTeX.C index 2689756f61..5bd72091c8 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -379,14 +379,17 @@ bool LaTeX::runBibTeX(string const & file, DepTable & dep) ifstream ifs(file.c_str()); string token; bool using_bibtex = false; + LRegex reg1("\\\\bibdata{([^}]+)}"); + LRegex reg2("\\\\bibstyle{([^}]+)}"); while (getline(ifs, token)) { - if (contains(token, "\\bibdata{")) { + if (reg1.exact_match(token)) { using_bibtex = true; - string::size_type a = token.find("\\bibdata{") + 9; - string::size_type b = token.find_first_of("}", a); - string data = token.substr(a, b - a); + LRegex::SubMatches const & sub = reg1.exec(token); + string data = LSubstring(token, sub[1].first, + sub[2].second); // data is now all the bib files separated by ',' // get them one by one and pass them to the helper + string::size_type b; do { b = data.find_first_of(',', 0); string l; @@ -400,26 +403,26 @@ bool LaTeX::runBibTeX(string const & file, DepTable & dep) findtexfile( ChangeExtension(l, "bib", false), "bib"); - lyxerr << "data = `" - << full_l << "'" << endl; + lyxerr[Debug::LATEX] << "Bibtex database: `" + << full_l << "'" << endl; if (!full_l.empty()) { // add full_l to the dep file. dep.insert(full_l, true); } } while (b != string::npos); - } else if (contains(token, "\\bibstyle{")) { + } else if (reg2.exact_match(token)) { using_bibtex = true; - string::size_type a = token.find("\\bibstyle{") + 10; - string::size_type b = token.find_first_of("}", a); - string style = token.substr(a, b - a); + LRegex::SubMatches const & sub = reg2.exec(token); + string style = LSubstring(token, sub[1].first, + sub[1].second); // token is now the style file // pass it to the helper string full_l = findtexfile( ChangeExtension(style, "bst", false), "bst"); - lyxerr << "style = `" - << full_l << "'" << endl; + lyxerr[Debug::LATEX] << "Bibtex style: `" + << full_l << "'" << endl; if (!full_l.empty()) { // add full_l to the dep file. dep.insert(full_l, true); diff --git a/src/LyXAction.C b/src/LyXAction.C index c817c01c9a..78822779fa 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -138,8 +138,6 @@ void LyXAction::init() _("Export to"), ReadOnly); newFunc(LFUN_FAX,"buffer-fax", _("Fax"), ReadOnly); - //newFunc(LFUN_INSERTFLOAT,"float-insert", - // "", Noop); newFunc(LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop); newFunc(LFUN_IMPORT,"buffer-import", _("Import document"), NoBuffer); @@ -153,8 +151,6 @@ void LyXAction::init() _("Open"), NoBuffer); newFunc(LFUN_PREVBUFFER,"buffer-previous", _("Switch to previous document"), ReadOnly); - //newFunc(LFUN_SWITCHBUFFER,"buffer-switch", - // _("Switch to an open document"), ReadOnly); newFunc(LFUN_MENUPRINT,"buffer-print", _("Print"), ReadOnly); newFunc(LFUN_MENURELOAD,"buffer-reload", @@ -348,8 +344,6 @@ void LyXAction::init() "", Noop); newFunc(LFUN_MATH_MODE,"math-mode", _("Math mode"), Noop); - //newFunc(LFUN_MATH_PANEL,"math-panel", - // _("Math panel"), Noop); newFunc(LFUN_MATH_NONUMBER,"math-nonumber", "", Noop); newFunc(LFUN_MATH_NUMBER,"math-number", @@ -379,8 +373,10 @@ void LyXAction::init() _("Select previous paragraph"), ReadOnly); newFunc(LFUN_PARENTINSERT,"parent-insert", "", Noop); - newFunc( LFUN_PASTE,"paste", + newFunc(LFUN_PASTE,"paste", _("Paste") , Noop); + newFunc(LFUN_SAVEPREFERENCES, "preferences-save", + "Save Preferences", NoBuffer); newFunc(LFUN_PASTESELECTION,"primary-selection-paste", "", Noop); newFunc(LFUN_PROTECTEDSPACE,"protected-space-insert", diff --git a/src/LyXView.C b/src/LyXView.C index 7124619326..ad9e37c922 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -232,7 +232,7 @@ FD_form_main * LyXView::create_form_form_main(int width, int height) unsigned int w, h; Pixmap lyx_p, lyx_mask; lyx_p = fl_create_from_pixmapdata(fl_root, - lyx_xpm, + const_cast(lyx_xpm), &w, &h, &lyx_mask, diff --git a/src/bmtable.C b/src/bmtable.C index 63a6c945f1..6b218f21e1 100644 --- a/src/bmtable.C +++ b/src/bmtable.C @@ -224,10 +224,10 @@ extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, * * The user could change these later. See below. */ -void fl_set_bmtable_data(FL_OBJECT *ob, int nx, int ny, int bw, int bh, - unsigned char * bdata) +void fl_set_bmtable_data(FL_OBJECT * ob, int nx, int ny, int bw, int bh, + unsigned char const * bdata) { - BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; if (sp) { sp->nx = nx; sp->ny = ny; @@ -244,10 +244,10 @@ void fl_set_bmtable_data(FL_OBJECT *ob, int nx, int ny, int bw, int bh, } -void fl_set_bmtable_pixmap_data(FL_OBJECT *ob, int nx, int ny, - char **pdata) +void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny, + char ** pdata) { - BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; extern Colormap color_map; if (sp) { sp->nx = nx; diff --git a/src/bmtable.h b/src/bmtable.h index 7b26b692ca..937b8c112b 100644 --- a/src/bmtable.h +++ b/src/bmtable.h @@ -47,7 +47,7 @@ int fl_get_bmtable_numb(FL_OBJECT *ob); void fl_set_bmtable(FL_OBJECT *, int pushed, int pos); /** Number of columns and rows, and the background bitmap */ -void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char *); +void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char const *); /// void fl_set_bmtable_pixmap_data(FL_OBJECT *, int, int, char **); /// diff --git a/src/bufferparams.C b/src/bufferparams.C index f475b97410..435f7e8310 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -200,13 +200,11 @@ void BufferParams::readPreamble(LyXLex & lex) void BufferParams::readLanguage(LyXLex & lex) { - string tmptok; - string test; - int n = 0; - if (!lex.next()) return; - tmptok = lex.GetString(); + string tmptok = lex.GetString(); + string test; + int n = 0; // check if tmptok is part of tex_babel in tex-defs.h while (true) { test = tex_babel[n++]; diff --git a/src/commandtags.h b/src/commandtags.h index 271805279b..5cbe5a0350 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -237,10 +237,11 @@ enum kb_action { LFUN_URL, // CFO-G 971121 LFUN_WORDFINDFORWARD, // Etienne 980216 LFUN_WORDFINDBACKWARD, // Etienne 980220 - LFUN_APPENDIX, // ettrich 980505 + LFUN_APPENDIX, // ettrich 980505 LFUN_IMPORT, // Asger 980724 LFUN_MENU_SEPARATOR, // Asger 990220 - LFUN_SEQUENCE, // Andre' 991111 + LFUN_SEQUENCE, // Andre' 991111 + LFUN_SAVEPREFERENCES, // Lgb 991127 LFUN_LASTACTION /* this marks the end of the table */ }; diff --git a/src/insets/figinset.C b/src/insets/figinset.C index d1b55bd76a..fd8ab26689 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -714,8 +714,7 @@ static void runqueue() static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data) { // recompute the stuff and put in the queue - queue *p, *p2; - p = new queue; + queue * p = new queue; p->ofsx = psx; p->ofsy = psy; p->rx = ((float)data->raw_wid*72)/pswid; @@ -725,7 +724,7 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data) p->next = 0; // now put into queue - p2 = gsqueue; + queue * p2 = gsqueue; if (!gsqueue) gsqueue = p; else { while (p2->next) p2 = p2->next; @@ -737,17 +736,15 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data) } -static figdata *getfigdata(int wid, int hgh, string const & fname, - int psx, int psy, int pswid, int pshgh, - int raw_wid, int raw_hgh, float angle, char flags) +static figdata * getfigdata(int wid, int hgh, string const & fname, + int psx, int psy, int pswid, int pshgh, + int raw_wid, int raw_hgh, float angle, char flags) { /* first search for an exact match with fname and width/height */ - int i = 0; - figdata *p; - XWindowAttributes wa; if (fname.empty()) return 0; + int i = 0; while (i < bmpinsref) { if (bitmaps[i]->wid == wid && bitmaps[i]->hgh == hgh && bitmaps[i]->flags == flags && bitmaps[i]->fname == fname && @@ -762,12 +759,12 @@ static figdata *getfigdata(int wid, int hgh, string const & fname, if (bmpinsref > bmparrsize) { // allocate more space bmparrsize += figallocchunk; - figdata **tmp = (figdata**) malloc(sizeof(figdata*)*bmparrsize); + figdata ** tmp = (figdata**) malloc(sizeof(figdata*)*bmparrsize); memcpy(tmp, bitmaps, sizeof(figdata*)*(bmparrsize-figallocchunk)); free(bitmaps); bitmaps = tmp; } - p = new figdata; + figdata * p = new figdata; bitmaps[bmpinsref-1] = p; p->wid = wid; p->hgh = hgh; @@ -776,6 +773,7 @@ static figdata *getfigdata(int wid, int hgh, string const & fname, p->angle = angle; p->fname = fname; p->flags = flags; + XWindowAttributes wa; XGetWindowAttributes(fl_display, fl_get_canvas_id( figinset_canvas), &wa); @@ -815,34 +813,29 @@ static void getbitmap(figdata *p) static void makeupdatelist(figdata *p) { - int i; - - for (i = 0; i < figinsref; ++i) if (figures[i]->data == p) { - if (lyxerr.debugging()) { - lyxerr << "Updating inset " << figures[i]->inset - << endl; + for (int i = 0; i < figinsref; ++i) + if (figures[i]->data == p) { + if (lyxerr.debugging()) { + lyxerr << "Updating inset " + << figures[i]->inset + << endl; + } + //UpdateInset(figures[i]->inset); + // add inset figures[i]->inset into to_update list + PutInsetIntoInsetUpdateList(figures[i]->inset); } - //UpdateInset(figures[i]->inset); - // add inset figures[i]->inset into to_update list - PutInsetIntoInsetUpdateList(figures[i]->inset); - } } -void sigchldchecker(pid_t pid, int *status) +void sigchldchecker(pid_t pid, int * status) { - int i; - figdata *p; - - bool pid_handled = false; - lyxerr.debug() << "Got pid = " << pid << endl; - pid_handled = false; - for (i = bmpinsref - 1; i >= 0; --i) { + bool pid_handled = false; + for (int i = bmpinsref - 1; i >= 0; --i) { if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) { lyxerr.debug() << "Found pid in bitmaps" << endl; // now read the file and remove it from disk - p = bitmaps[i]; + figdata * p = bitmaps[i]; p->reading = false; if (bitmaps[i]->gsdone) *status = 0; if (*status == 0) { @@ -877,7 +870,7 @@ void sigchldchecker(pid_t pid, int *status) } if (!pid_handled) { lyxerr.debug() << "Checking pid in pidwait" << endl; - pidwait *p = pw, *prev = 0; + pidwait * p = pw, * prev = 0; while (p) { if (pid == p->pid) { lyxerr.debug() << "Found pid in pidwait" << endl; @@ -926,9 +919,8 @@ void sigchldchecker(pid_t pid, int *status) static void getbitmaps() { - int i; bitmap_waiting = false; - for (i = 0; i < bmpinsref; ++i) + for (int i = 0; i < bmpinsref; ++i) if (bitmaps[i]->gspid > 0 && !bitmaps[i]->reading) getbitmap(bitmaps[i]); } @@ -936,8 +928,6 @@ static void getbitmaps() static void RegisterFigure(InsetFig *fi) { - Figref *tmpfig; - if (figinsref == 0) InitFigures(); fi->form = 0; ++figinsref; @@ -949,7 +939,7 @@ static void RegisterFigure(InsetFig *fi) free(figures); figures = tmp; } - tmpfig = new Figref; + Figref * tmpfig = new Figref; tmpfig->data = 0; tmpfig->inset = fi; figures[figinsref-1] = tmpfig; @@ -962,7 +952,7 @@ static void RegisterFigure(InsetFig *fi) } -int FindFigIndex(Figref *tmpfig) +int FindFigIndex(Figref * tmpfig) { int i = 0; while (i < figinsref) { @@ -973,10 +963,9 @@ int FindFigIndex(Figref *tmpfig) } -static void UnregisterFigure(InsetFig *fi) +static void UnregisterFigure(InsetFig * fi) { - Figref *tmpfig = fi->figure; - int i; + Figref * tmpfig = fi->figure; if (tmpfig->data) freefigdata(tmpfig->data); if (tmpfig->inset->form) { @@ -993,7 +982,7 @@ static void UnregisterFigure(InsetFig *fi) tmpfig->inset->form = 0; #endif } - i = FindFigIndex(tmpfig); + int i = FindFigIndex(tmpfig); --figinsref; while (i < figinsref) { figures[i] = figures[i+1]; @@ -1005,9 +994,9 @@ static void UnregisterFigure(InsetFig *fi) } -static char* NextToken(FILE *myfile) +static char * NextToken(FILE * myfile) { - char* token = 0; + char * token = 0; char c; int i = 0; @@ -1024,7 +1013,7 @@ static char* NextToken(FILE *myfile) } -InsetFig::InsetFig(int tmpx, int tmpy, Buffer *o) +InsetFig::InsetFig(int tmpx, int tmpy, Buffer * o) : owner(o) { wid = tmpx; @@ -1051,25 +1040,25 @@ InsetFig::~InsetFig() } -int InsetFig::Ascent(LyXFont const&) const +int InsetFig::Ascent(LyXFont const &) const { return hgh + 3; } -int InsetFig::Descent(LyXFont const&) const +int InsetFig::Descent(LyXFont const &) const { return 1; } -int InsetFig::Width(LyXFont const&) const +int InsetFig::Width(LyXFont const &) const { return wid + 2; } -void InsetFig::Draw(LyXFont font, LyXScreen &scr, int baseline, float &x) +void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x) { if (bitmap_waiting) getbitmaps(); @@ -1119,7 +1108,7 @@ void InsetFig::Draw(LyXFont font, LyXScreen &scr, int baseline, float &x) } -void InsetFig::Write(FILE *file) +void InsetFig::Write(FILE * file) { Regenerate(); fprintf(file, "Figure size %d %d\n", wid, hgh); @@ -1138,7 +1127,7 @@ void InsetFig::Write(FILE *file) } -void InsetFig::Read(LyXLex &lex) +void InsetFig::Read(LyXLex & lex) { string buf; bool finished = false; @@ -1222,7 +1211,7 @@ void InsetFig::Read(LyXLex &lex) } -int InsetFig::Latex(FILE *file, signed char /* fragile*/ ) +int InsetFig::Latex(FILE * file, signed char /* fragile*/ ) { Regenerate(); if (!cmd.empty()) fprintf(file, "%s ", cmd.c_str()); @@ -1230,7 +1219,7 @@ int InsetFig::Latex(FILE *file, signed char /* fragile*/ ) } -int InsetFig::Latex(string &file, signed char /* fragile*/ ) +int InsetFig::Latex(string & file, signed char /* fragile*/ ) { Regenerate(); file += cmd + ' '; @@ -1244,7 +1233,7 @@ int InsetFig::Linuxdoc(string &/*file*/) } -int InsetFig::DocBook(string &file) +int InsetFig::DocBook(string & file) { string figurename= fname; @@ -1256,7 +1245,7 @@ int InsetFig::DocBook(string &file) } -void InsetFig::Validate(LaTeXFeatures &features) const +void InsetFig::Validate(LaTeXFeatures & features) const { features.graphics = true; if (subfigure) features.subfigure = true; @@ -1354,7 +1343,6 @@ Inset::Code InsetFig::LyxCode() const void InsetFig::Regenerate() { string cmdbuf; - string gcmd; string resizeW, resizeH; string rotate, recmd; @@ -1369,7 +1357,7 @@ void InsetFig::Regenerate() string buf1 = OnlyPath(owner->getFileName()); string fname2 = MakeRelPath(fname, buf1); - gcmd = "\\includegraphics{" + fname2 + '}'; + string gcmd = "\\includegraphics{" + fname2 + '}'; switch (wtype) { case DEF: @@ -1479,20 +1467,15 @@ void InsetFig::Regenerate() void InsetFig::TempRegenerate() { - string gcmd; string cmdbuf; string resizeW, resizeH; string rotate, recmd; - string tsubcap; - char const *tfname; // *textra; - float tangle, txwid, txhgh; - - tfname = fl_get_input(form->EpsFile); - tsubcap = fl_get_input(form->Subcaption); - tangle = atof(fl_get_input(form->Angle)); - txwid = atof(fl_get_input(form->Width)); - txhgh = atof(fl_get_input(form->Height)); + char const * tfname = fl_get_input(form->EpsFile); + string tsubcap = fl_get_input(form->Subcaption); + float tangle = atof(fl_get_input(form->Angle)); + float txwid = atof(fl_get_input(form->Width)); + float txhgh = atof(fl_get_input(form->Height)); if (!tfname || !*tfname) { //fl_set_object_label(form->cmd, ""); @@ -1506,7 +1489,7 @@ void InsetFig::TempRegenerate() string buf1 = OnlyPath(owner->getFileName()); string fname2 = MakeRelPath(tfname, buf1); // \includegraphics*[][]{file} - gcmd = "\\includegraphics{" + fname2 + '}'; + string gcmd = "\\includegraphics{" + fname2 + '}'; switch (twtype) { case DEF: @@ -1604,25 +1587,20 @@ void InsetFig::TempRegenerate() cmdbuf = string("\\subfigure{") + tsubcap + string("}{") + cmdbuf + "}"; } - - - //fl_set_object_label(form->cmd, cmdbuf.c_str()); - //fl_redraw_object(form->cmd); } void InsetFig::Recompute() { bool changed = changedfname; - int newx, newy, nraw_x, nraw_y, frame_wid, frame_hgh; - float sin_a, cos_a; + int newx, newy, nraw_x, nraw_y; if (changed) GetPSSizes(); - sin_a = sin (angle / DEG2PI); /* rotation; H. Zeller 021296 */ - cos_a = cos (angle / DEG2PI); - frame_wid = (int) ceil (fabs(cos_a * pswid) + fabs(sin_a * pshgh)); - frame_hgh= (int) ceil (fabs(cos_a * pshgh) + fabs(sin_a * pswid)); + float sin_a = sin (angle / DEG2PI); /* rotation; H. Zeller 021296 */ + float cos_a = cos (angle / DEG2PI); + int frame_wid = (int) ceil (fabs(cos_a * pswid) + fabs(sin_a * pshgh)); + int frame_hgh= (int) ceil (fabs(cos_a * pshgh) + fabs(sin_a * pswid)); /* now recompute wid and hgh, and if that is changed, set changed */ /* this depends on chosen size of the picture and its bbox */ @@ -1702,7 +1680,7 @@ void InsetFig::Recompute() subfigure = psubfigure; if (changed) { - figdata *pf = figure->data; + figdata * pf = figure->data; // get new data if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) { @@ -1726,7 +1704,6 @@ void InsetFig::GetPSSizes() { #warning rewrite this method to use ifstream /* get %%BoundingBox: from postscript file */ - int lastchar, c; char * p = 0; /* defaults to associated size @@ -1749,9 +1726,9 @@ void InsetFig::GetPSSizes() pswid = 595; pshgh = 842; - lastchar = fgetc(f); + int lastchar = fgetc(f); for (;;) { - c = fgetc(f); + int c = fgetc(f); if (c == EOF) { lyxerr.debug() << "End of (E)PS file reached and" " no BoundingBox!" << endl; @@ -1798,7 +1775,7 @@ void InsetFig::GetPSSizes() void InsetFig::CallbackFig(long arg) { bool regen = false; - char const *p; + char const * p; if (lyxerr.debugging()) { printf("Figure callback, arg %ld\n", arg); @@ -1907,8 +1884,7 @@ void InsetFig::CallbackFig(long arg) break; case 7: /* apply */ case 8: /* ok (apply and close) */ - if(!current_view->buffer()->isReadonly()) - { + if(!current_view->buffer()->isReadonly()) { wtype = twtype; htype = thtype; xwid = atof(fl_get_input(form->Width)); @@ -1968,6 +1944,7 @@ void InsetFig::CallbackFig(long arg) if (regen) TempRegenerate(); } + inline void DisableFigurePanel(FD_Figure * const form) { fl_deactivate_object(form->EpsFile); @@ -2003,6 +1980,7 @@ inline void DisableFigurePanel(FD_Figure * const form) fl_set_object_lcol (form->ApplyBtn, FL_INACTIVE); } + inline void EnableFigurePanel(FD_Figure * const form) { fl_activate_object(form->EpsFile); @@ -2038,10 +2016,10 @@ inline void EnableFigurePanel(FD_Figure * const form) fl_set_object_lcol (form->ApplyBtn, FL_BLACK); } + void InsetFig::RestoreForm() { char buf[32]; - int pflags; EnableFigurePanel(form); @@ -2070,7 +2048,7 @@ void InsetFig::RestoreForm() fl_activate_object(form->Height); } - pflags = flags & 3; + int pflags = flags & 3; fl_set_button(form->Wysiwyg0, (pflags == 0)); fl_set_button(form->Wysiwyg1, (pflags == 1)); fl_set_button(form->Wysiwyg2, (pflags == 2)); @@ -2100,11 +2078,9 @@ void InsetFig::RestoreForm() } -void InsetFig::Preview(char const *p) +void InsetFig::Preview(char const * p) { - int pid; - - pid = fork(); + int pid = fork(); if (pid == -1) { lyxerr << "Cannot fork process!" << endl; @@ -2129,7 +2105,6 @@ void InsetFig::Preview(char const *p) void InsetFig::BrowseFile() { - string buf, buf2, bufclip; static string current_figure_path; static int once = 0; LyXFileDlg fileDlg; @@ -2140,8 +2115,8 @@ void InsetFig::BrowseFile() } string p = fl_get_input(form->EpsFile); - buf = MakeAbsPath(owner->getFileName()); - buf2 = OnlyPath(buf); + string buf = MakeAbsPath(owner->getFileName()); + string buf2 = OnlyPath(buf); if (!p.empty()) { buf = MakeAbsPath(p, buf2); buf = OnlyPath(buf); @@ -2150,7 +2125,7 @@ void InsetFig::BrowseFile() } // Does user clipart directory exist? - bufclip = AddName (user_lyxdir, "clipart"); + string bufclip = AddName (user_lyxdir, "clipart"); FileInfo fileInfo(bufclip); if (!(fileInfo.isOK() && fileInfo.isDir())) // No - bail out to system clipart directory @@ -2191,7 +2166,7 @@ void InsetFig::BrowseFile() } -void GraphicsCB(FL_OBJECT *obj, long arg) +void GraphicsCB(FL_OBJECT * obj, long arg) { /* obj->form contains the form */ diff --git a/src/layout.C b/src/layout.C index a90d2ecb49..899f10baa0 100644 --- a/src/layout.C +++ b/src/layout.C @@ -47,35 +47,48 @@ void LyXSetStyle() // The order of the LayoutTags enum is no more important. [asierra300396] // Tags indexes. enum LayoutTags { - LT_ALIGN, LT_ALIGNPOSSIBLE, - LT_BLOCK, LT_MARGIN, - LT_BOTTOMSEP, LT_CENTER, LT_CENTERED_TOP_ENVIRONMENT, LT_COLUMNS, - LT_COPYSTYLE, LT_OBSOLETEDBY, - LT_COMMAND, LT_COUNTER_CHAPTER, LT_COUNTER_ENUMI, LT_COUNTER_ENUMII, - LT_COUNTER_ENUMIII, LT_COUNTER_ENUMIV, LT_COUNTER_PARAGRAPH, - LT_COUNTER_SECTION, LT_COUNTER_SUBPARAGRAPH, LT_COUNTER_SUBSECTION, - LT_COUNTER_SUBSUBSECTION, LT_DEFAULTFONT, LT_DYNAMIC, LT_EMPTY, - LT_END, LT_ENVIRONMENT, LT_ENVIRONMENT_DEFAULT, - LT_FANCYHDR, LT_FILL_BOTTOM, LT_FILL_TOP, LT_FIRST_COUNTER, - LT_FIRST_DYNAMIC, LT_FONT, LT_FREE_SPACING, LT_HEADINGS, LT_INPUT, - LT_ITEM_ENVIRONMENT, LT_ITEMSEP, LT_KEEPEMPTY, - LT_LABEL_BOTTOMSEP, LT_LABELFONT, LT_TEXTFONT, - LT_LABELINDENT, LT_LABELSEP, LT_LABELSTRING, - LT_LABELSTRING_APPENDIX, LT_LABELTYPE, - LT_LATEXNAME, LT_LATEXPARAM, LT_LATEXTYPE, LT_LAYOUT, LT_LEFT, - LT_LEFTMARGIN, - LT_LIST_ENVIRONMENT , LT_MANUAL, LT_MAXCOUNTER, - LT_NEED_PROTECT, LT_NEWLINE, - LT_NEXTNOINDENT, LT_NO_LABEL, LT_NOSTYLE, - LT_PAGESTYLE, LT_PARAGRAPH, - LT_PARINDENT, LT_PARSEP, LT_PARSKIP, LT_PLAIN, LT_PREAMBLE, - LT_PROVIDESAMSMATH, LT_PROVIDESMAKEIDX, LT_PROVIDESURL, LT_RIGHT, - LT_RIGHT_ADDRESS_BOX, LT_RIGHTMARGIN, LT_SENSITIVE, LT_SIDES, - LT_SPACING, LT_SPACING_SINGLE, LT_SPACING_ONEHALF, - LT_SPACING_DOUBLE, LT_OTHER, LT_CLASSOPTIONS, LT_FONTSIZE, - LT_STATIC, LT_STYLE, LT_TOP_ENVIRONMENT, LT_TOPSEP, LT_BIBLIO, - LT_INTITLE, LT_SECNUMDEPTH, LT_TOCDEPTH, - LT_OUTPUTTYPE, LT_OTLATEX, LT_OTLINUXDOC, LT_OTDOCBOOK, LT_OTLITERATE + LT_ALIGN = 1, + LT_ALIGNPOSSIBLE, + LT_MARGIN, + LT_BOTTOMSEP, + LT_COPYSTYLE, + LT_OBSOLETEDBY, + //LT_EMPTY, + LT_END, + //LT_ENVIRONMENT_DEFAULT, + //LT_FANCYHDR, + LT_FILL_BOTTOM, + LT_FILL_TOP, + //LT_FIRST_COUNTER, + LT_FONT, + LT_FREE_SPACING, + //LT_HEADINGS, + LT_ITEMSEP, + LT_KEEPEMPTY, + LT_LABEL_BOTTOMSEP, + LT_LABELFONT, + LT_TEXTFONT, + LT_LABELINDENT, + LT_LABELSEP, + LT_LABELSTRING, + LT_LABELSTRING_APPENDIX, + LT_LABELTYPE, + LT_LATEXNAME, + LT_LATEXPARAM, + LT_LATEXTYPE, + LT_LEFTMARGIN, + LT_NEED_PROTECT, + LT_NEWLINE, + LT_NEXTNOINDENT, + LT_PARINDENT, + LT_PARSEP, + LT_PARSKIP, + //LT_PLAIN, + LT_PREAMBLE, + LT_RIGHTMARGIN, + LT_SPACING, + LT_TOPSEP, + LT_INTITLE }; @@ -83,45 +96,14 @@ enum LayoutTags { static keyword_item layoutTags[] = { { "align", LT_ALIGN }, { "alignpossible", LT_ALIGNPOSSIBLE }, - { "bibliography", LT_BIBLIO }, - { "block", LT_BLOCK }, { "bottomsep", LT_BOTTOMSEP }, - { "center", LT_CENTER }, - { "centered_top_environment", LT_CENTERED_TOP_ENVIRONMENT }, - { "classoptions", LT_CLASSOPTIONS }, - { "columns", LT_COLUMNS }, - { "command", LT_COMMAND }, { "copystyle", LT_COPYSTYLE }, - { "counter_chapter", LT_COUNTER_CHAPTER }, - { "counter_enumi", LT_COUNTER_ENUMI }, - { "counter_enumii", LT_COUNTER_ENUMII }, - { "counter_enumiii", LT_COUNTER_ENUMIII }, - { "counter_enumiv", LT_COUNTER_ENUMIV }, - { "counter_paragraph", LT_COUNTER_PARAGRAPH }, - { "counter_section", LT_COUNTER_SECTION }, - { "counter_subparagraph", LT_COUNTER_SUBPARAGRAPH }, - { "counter_subsection", LT_COUNTER_SUBSECTION }, - { "counter_subsubsection", LT_COUNTER_SUBSUBSECTION }, - { "defaultfont", LT_DEFAULTFONT }, - { "docbook", LT_OTDOCBOOK }, - { "double", LT_SPACING_DOUBLE }, - { "dynamic", LT_DYNAMIC }, - { "empty", LT_EMPTY }, { "end", LT_END }, - { "environment", LT_ENVIRONMENT }, - { "environment_default", LT_ENVIRONMENT_DEFAULT }, - { "fancyhdr", LT_FANCYHDR }, { "fill_bottom", LT_FILL_BOTTOM }, { "fill_top", LT_FILL_TOP }, - { "first_counter", LT_FIRST_COUNTER }, - { "first_dynamic", LT_FIRST_DYNAMIC }, { "font", LT_FONT }, - { "fontsize", LT_FONTSIZE }, { "freespacing", LT_FREE_SPACING }, - { "headings", LT_HEADINGS }, - { "input", LT_INPUT }, { "intitle", LT_INTITLE }, - { "item_environment", LT_ITEM_ENVIRONMENT }, { "itemsep", LT_ITEMSEP }, { "keepempty", LT_KEEPEMPTY }, { "labelbottomsep", LT_LABEL_BOTTOMSEP }, @@ -131,51 +113,22 @@ static keyword_item layoutTags[] = { { "labelstring", LT_LABELSTRING }, { "labelstringappendix", LT_LABELSTRING_APPENDIX }, { "labeltype", LT_LABELTYPE }, - { "latex", LT_OTLATEX }, { "latexname", LT_LATEXNAME }, - { "latexparam", LT_LATEXPARAM }, //arrae970411 + { "latexparam", LT_LATEXPARAM }, { "latextype", LT_LATEXTYPE }, - { "layout", LT_LAYOUT }, - { "left", LT_LEFT }, { "leftmargin", LT_LEFTMARGIN }, - { "linuxdoc", LT_OTLINUXDOC }, - { "list_environment", LT_LIST_ENVIRONMENT }, - { "literate", LT_OTLITERATE }, - { "manual", LT_MANUAL }, { "margin", LT_MARGIN }, - { "maxcounter", LT_MAXCOUNTER }, { "needprotect", LT_NEED_PROTECT }, { "newline", LT_NEWLINE }, { "nextnoindent", LT_NEXTNOINDENT }, - { "no_label", LT_NO_LABEL }, - { "nostyle", LT_NOSTYLE }, { "obsoletedby", LT_OBSOLETEDBY }, - { "onehalf", LT_SPACING_ONEHALF }, - { "other", LT_OTHER }, - { "outputtype", LT_OUTPUTTYPE }, - { "pagestyle", LT_PAGESTYLE }, - { "paragraph", LT_PARAGRAPH }, { "parindent", LT_PARINDENT }, { "parsep", LT_PARSEP }, { "parskip", LT_PARSKIP }, - { "plain", LT_PLAIN }, { "preamble", LT_PREAMBLE }, - { "providesamsmath", LT_PROVIDESAMSMATH }, - { "providesmakeidx", LT_PROVIDESMAKEIDX }, - { "providesurl", LT_PROVIDESURL }, - { "right", LT_RIGHT }, - { "right_address_box", LT_RIGHT_ADDRESS_BOX }, { "rightmargin", LT_RIGHTMARGIN }, - { "secnumdepth", LT_SECNUMDEPTH }, - { "sensitive", LT_SENSITIVE }, - { "sides", LT_SIDES }, - { "single", LT_SPACING_SINGLE }, { "spacing", LT_SPACING }, - { "static", LT_STATIC }, - { "style", LT_STYLE }, { "textfont", LT_TEXTFONT }, - { "tocdepth", LT_TOCDEPTH }, - { "top_environment", LT_TOP_ENVIRONMENT }, { "topsep", LT_TOPSEP } }; @@ -218,19 +171,22 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) { bool error = false; bool finished = false; - + lexrc.pushTable(layoutTags, LT_INTITLE); // parse style section while (!finished && lexrc.IsOK() && !error) { - switch(lexrc.lex()) { + int le = lexrc.lex(); + // See comment in lyxrc.C. + switch(le) { + case LyXLex::LEX_FEOF: + continue; break; - case -2: - break; - - case -1: // parse error - lexrc.printError("Unknown tag `$$Token'"); + case LyXLex::LEX_UNDEF: // parse error + lexrc.printError("Unknown layout tag `$$Token'"); error = true; - break; - + continue; break; + default: break; + } + switch(static_cast(le)) { case LT_END: // end of structure finished = true; break; @@ -265,50 +221,11 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_MARGIN: // Margin style definition. - - switch(lexrc.lex()) { - case LT_STATIC: - margintype = MARGIN_STATIC; - break; - case LT_MANUAL: - margintype = MARGIN_MANUAL; - break; - case LT_DYNAMIC: - margintype = MARGIN_DYNAMIC; - break; - case LT_FIRST_DYNAMIC: - margintype = MARGIN_FIRST_DYNAMIC; - break; - case LT_RIGHT_ADDRESS_BOX: - margintype = MARGIN_RIGHT_ADDRESS_BOX; - break; - default: - lexrc.printError("Unknown margin type `$$Token'"); - break; - } + readMargin(lexrc); break; case LT_LATEXTYPE: // Latex style definition. - switch (lexrc.lex()) { - case LT_PARAGRAPH: - latextype= LATEX_PARAGRAPH; - break; - case LT_COMMAND: - latextype= LATEX_COMMAND; - break; - case LT_ENVIRONMENT: - latextype= LATEX_ENVIRONMENT; - break; - case LT_ITEM_ENVIRONMENT: - latextype= LATEX_ITEM_ENVIRONMENT; - break; - case LT_LIST_ENVIRONMENT: - latextype= LATEX_LIST_ENVIRONMENT; - break; - default: - lexrc.printError("Unknown latextype `$$Token'"); - break; - } + readLatexType(lexrc); break; case LT_INTITLE: @@ -358,63 +275,9 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_LABELTYPE: - switch (lexrc.lex()) { - case LT_NO_LABEL: - labeltype = LABEL_NO_LABEL; - break; - case LT_MANUAL: - labeltype = LABEL_MANUAL; - break; - case LT_TOP_ENVIRONMENT: - labeltype = LABEL_TOP_ENVIRONMENT; - break; - case LT_CENTERED_TOP_ENVIRONMENT: - labeltype = LABEL_CENTERED_TOP_ENVIRONMENT; - break; - case LT_STATIC: - labeltype = LABEL_STATIC; - break; - case LT_SENSITIVE: - labeltype = LABEL_SENSITIVE; - break; - case LT_COUNTER_CHAPTER: - labeltype = LABEL_COUNTER_CHAPTER; - break; - case LT_COUNTER_SECTION: - labeltype = LABEL_COUNTER_SECTION; - break; - case LT_COUNTER_SUBSECTION: - labeltype = LABEL_COUNTER_SUBSECTION; - break; - case LT_COUNTER_SUBSUBSECTION: - labeltype = LABEL_COUNTER_SUBSUBSECTION; - break; - case LT_COUNTER_PARAGRAPH: - labeltype = LABEL_COUNTER_PARAGRAPH; - break; - case LT_COUNTER_SUBPARAGRAPH: - labeltype = LABEL_COUNTER_SUBPARAGRAPH; - break; - case LT_COUNTER_ENUMI: - labeltype = LABEL_COUNTER_ENUMI; - break; - case LT_COUNTER_ENUMII: - labeltype = LABEL_COUNTER_ENUMII; - break; - case LT_COUNTER_ENUMIII: - labeltype = LABEL_COUNTER_ENUMIII; - break; - case LT_COUNTER_ENUMIV: - labeltype = LABEL_COUNTER_ENUMIV; - break; - case LT_BIBLIO: - labeltype = LABEL_BIBLIO; - break; - default: - lexrc.printError("Unknown labeltype `$$Token'"); - } + readLabelType(lexrc); break; - + case LT_LEFTMARGIN: // left margin type if (lexrc.next()) leftmargin = lexrc.GetString(); @@ -487,55 +350,11 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_ALIGN: // paragraph align - switch (lexrc.lex()) { - case LT_BLOCK: - align = LYX_ALIGN_BLOCK; - break; - case LT_LEFT: - align = LYX_ALIGN_LEFT; - break; - case LT_RIGHT: - align = LYX_ALIGN_RIGHT; - break; - case LT_CENTER: - align = LYX_ALIGN_CENTER; - break; - case LT_LAYOUT: - align = LYX_ALIGN_LAYOUT; - break; - default: - lexrc.printError("Unknown alignment `$$Token'"); - } + readAlign(lexrc); break; - case LT_ALIGNPOSSIBLE: // paragraph allowed align - { alignpossible = LYX_ALIGN_NONE; - - int lineno = lexrc.GetLineNo(); - do { - switch (lexrc.lex()) { - case LT_BLOCK: - alignpossible |= LYX_ALIGN_BLOCK; - break; - case LT_LEFT: - alignpossible |= LYX_ALIGN_LEFT; - break; - case LT_RIGHT: - alignpossible |= LYX_ALIGN_RIGHT; - break; - case LT_CENTER: - alignpossible |= LYX_ALIGN_CENTER; - break; - case LT_LAYOUT: - alignpossible |= LYX_ALIGN_LAYOUT; - break; - default: - lexrc.printError("Unknown alignment `$$Token'"); - - } - } while (lineno == lexrc.GetLineNo()); - break; - } + readAlignPossible(lexrc); + break; case LT_LABELSTRING: // label string definition if (lexrc.next()) @@ -553,35 +372,330 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_SPACING: // setspace.sty - switch(lexrc.lex()) { - case LT_SPACING_SINGLE: - spacing.set(Spacing::Single); - break; - case LT_SPACING_ONEHALF: - spacing.set(Spacing::Onehalf); - break; - case LT_SPACING_DOUBLE: - spacing.set(Spacing::Double); - break; - case LT_OTHER: - lexrc.next(); - spacing.set(Spacing::Other, lexrc.GetFloat()); - break; - default: - lexrc.printError("Unknown spacing `$$Token'"); - } - break; - default: /* context error */ - lexrc.printError("Tag `$$Token' is not " - "allowed in layout"); - error = true; + readSpacing(lexrc); break; } } - + lexrc.popTable(); return error; } +enum AlignTags { + AT_BLOCK = 1, + AT_LEFT, + AT_RIGHT, + AT_CENTER, + AT_LAYOUT +}; + +static keyword_item alignTags[] = { + { "block", AT_BLOCK }, + { "center", AT_CENTER }, + { "layout", AT_LAYOUT }, + { "left", AT_LEFT }, + { "right", AT_RIGHT } +}; + + +void LyXLayout::readAlign(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, alignTags, AT_LAYOUT); + int le = lexrc.lex(); + switch (le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown alignment `$$Token'"); + return; break; + default: break; + }; + switch(static_cast(le)) { + case AT_BLOCK: + align = LYX_ALIGN_BLOCK; + break; + case AT_LEFT: + align = LYX_ALIGN_LEFT; + break; + case AT_RIGHT: + align = LYX_ALIGN_RIGHT; + break; + case AT_CENTER: + align = LYX_ALIGN_CENTER; + break; + case AT_LAYOUT: + align = LYX_ALIGN_LAYOUT; + break; + } +} + + +void LyXLayout::readAlignPossible(LyXLex & lexrc) +{ + lexrc.pushTable(alignTags, AT_LAYOUT); + alignpossible = LYX_ALIGN_NONE; + int lineno = lexrc.GetLineNo(); + do { + int le = lexrc.lex(); + switch (le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown alignment `$$Token'"); + continue; break; + default: break; + }; + switch (static_cast(le)) { + case AT_BLOCK: + alignpossible |= LYX_ALIGN_BLOCK; + break; + case AT_LEFT: + alignpossible |= LYX_ALIGN_LEFT; + break; + case AT_RIGHT: + alignpossible |= LYX_ALIGN_RIGHT; + break; + case AT_CENTER: + alignpossible |= LYX_ALIGN_CENTER; + break; + case AT_LAYOUT: + alignpossible |= LYX_ALIGN_LAYOUT; + break; + } + } while (lineno == lexrc.GetLineNo()); + lexrc.popTable(); +} + +enum LabelTypeTags { + LA_NO_LABEL = 1, + LA_MANUAL, + LA_TOP_ENVIRONMENT, + LA_CENTERED_TOP_ENVIRONMENT, + LA_STATIC, + LA_SENSITIVE, + LA_COUNTER_CHAPTER, + LA_COUNTER_SECTION, + LA_COUNTER_SUBSECTION, + LA_COUNTER_SUBSUBSECTION, + LA_COUNTER_PARAGRAPH, + LA_COUNTER_SUBPARAGRAPH, + LA_COUNTER_ENUMI, + LA_COUNTER_ENUMII, + LA_COUNTER_ENUMIII, + LA_COUNTER_ENUMIV, + LA_BIBLIO +}; + +static keyword_item labelTypeTags[] = { + { "bibliography", LA_BIBLIO }, + { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, + { "counter_chapter", LA_COUNTER_CHAPTER }, + { "counter_enumi", LA_COUNTER_ENUMI }, + { "counter_enumii", LA_COUNTER_ENUMII }, + { "counter_enumiii", LA_COUNTER_ENUMIII }, + { "counter_enumiv", LA_COUNTER_ENUMIV }, + { "counter_paragraph", LA_COUNTER_PARAGRAPH }, + { "counter_section", LA_COUNTER_SECTION }, + { "counter_subparagraph", LA_COUNTER_SUBPARAGRAPH }, + { "counter_subsection", LA_COUNTER_SUBSECTION }, + { "counter_subsubsection", LA_COUNTER_SUBSUBSECTION }, + { "manual", LA_MANUAL }, + { "no_label", LA_NO_LABEL }, + { "sensitive", LA_SENSITIVE }, + { "static", LA_STATIC }, + { "top_environment", LA_TOP_ENVIRONMENT } +}; + +void LyXLayout::readLabelType(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, labelTypeTags, LA_BIBLIO); + int le = lexrc.lex(); + switch (le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown labeltype tag `$$Token'"); + return; break; + default: break; + } + switch (static_cast(le)) { + case LA_NO_LABEL: + labeltype = LABEL_NO_LABEL; + break; + case LA_MANUAL: + labeltype = LABEL_MANUAL; + break; + case LA_TOP_ENVIRONMENT: + labeltype = LABEL_TOP_ENVIRONMENT; + break; + case LA_CENTERED_TOP_ENVIRONMENT: + labeltype = LABEL_CENTERED_TOP_ENVIRONMENT; + break; + case LA_STATIC: + labeltype = LABEL_STATIC; + break; + case LA_SENSITIVE: + labeltype = LABEL_SENSITIVE; + break; + case LA_COUNTER_CHAPTER: + labeltype = LABEL_COUNTER_CHAPTER; + break; + case LA_COUNTER_SECTION: + labeltype = LABEL_COUNTER_SECTION; + break; + case LA_COUNTER_SUBSECTION: + labeltype = LABEL_COUNTER_SUBSECTION; + break; + case LA_COUNTER_SUBSUBSECTION: + labeltype = LABEL_COUNTER_SUBSUBSECTION; + break; + case LA_COUNTER_PARAGRAPH: + labeltype = LABEL_COUNTER_PARAGRAPH; + break; + case LA_COUNTER_SUBPARAGRAPH: + labeltype = LABEL_COUNTER_SUBPARAGRAPH; + break; + case LA_COUNTER_ENUMI: + labeltype = LABEL_COUNTER_ENUMI; + break; + case LA_COUNTER_ENUMII: + labeltype = LABEL_COUNTER_ENUMII; + break; + case LA_COUNTER_ENUMIII: + labeltype = LABEL_COUNTER_ENUMIII; + break; + case LA_COUNTER_ENUMIV: + labeltype = LABEL_COUNTER_ENUMIV; + break; + case LA_BIBLIO: + labeltype = LABEL_BIBLIO; + break; + } +} + +enum MarginTags { + MT_STATIC = 1, + MT_MANUAL, + MT_DYNAMIC, + MT_FIRST_DYNAMIC, + MT_RIGHT_ADDRESS_BOX +}; + +static keyword_item marginTags[] = { + { "dynamic", MT_DYNAMIC }, + { "first_dynamic", MT_FIRST_DYNAMIC }, + { "manual", MT_MANUAL }, + { "right_address_box", MT_RIGHT_ADDRESS_BOX }, + { "static", MT_STATIC } +}; + +void LyXLayout::readMargin(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, marginTags, MT_RIGHT_ADDRESS_BOX); + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown margin type tag `$$Token'"); + return; break; + default: break; + } + switch(static_cast(le)) { + case MT_STATIC: + margintype = MARGIN_STATIC; + break; + case MT_MANUAL: + margintype = MARGIN_MANUAL; + break; + case MT_DYNAMIC: + margintype = MARGIN_DYNAMIC; + break; + case MT_FIRST_DYNAMIC: + margintype = MARGIN_FIRST_DYNAMIC; + break; + case MT_RIGHT_ADDRESS_BOX: + margintype = MARGIN_RIGHT_ADDRESS_BOX; + break; + } +} + +enum LatexTypeTags { + LX_PARAGRAPH = 1, + LX_COMMAND, + LX_ENVIRONMENT, + LX_ITEM_ENVIRONMENT, + LX_LIST_ENVIRONMENT +}; + +static keyword_item latexTypeTags[] = { + { "command", LX_COMMAND }, + { "environment", LX_ENVIRONMENT }, + { "item_environment", LX_ITEM_ENVIRONMENT }, + { "list_environment", LX_LIST_ENVIRONMENT }, + { "paragraph", LX_PARAGRAPH } +}; + +void LyXLayout::readLatexType(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, latexTypeTags, LX_LIST_ENVIRONMENT); + int le = lexrc.lex(); + switch (le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown latextype tag `$$Token'"); + return; break; + default: break; + } + switch (static_cast(le)) { + case LX_PARAGRAPH: + latextype= LATEX_PARAGRAPH; + break; + case LX_COMMAND: + latextype= LATEX_COMMAND; + break; + case LX_ENVIRONMENT: + latextype= LATEX_ENVIRONMENT; + break; + case LX_ITEM_ENVIRONMENT: + latextype= LATEX_ITEM_ENVIRONMENT; + break; + case LX_LIST_ENVIRONMENT: + latextype= LATEX_LIST_ENVIRONMENT; + break; + } +} + +enum SpacingTags { + ST_SPACING_SINGLE = 1, + ST_SPACING_ONEHALF, + ST_SPACING_DOUBLE, + ST_OTHER +}; + +static keyword_item spacingTags[] = { + {"double", ST_SPACING_DOUBLE }, + {"onehalf", ST_SPACING_ONEHALF }, + {"other", ST_OTHER }, + {"single", ST_SPACING_SINGLE } +}; + +void LyXLayout::readSpacing(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, spacingTags, ST_OTHER); + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown spacing token `$$Token'"); + return; break; + default: break; + } + switch(static_cast(le)) { + case ST_SPACING_SINGLE: + spacing.set(Spacing::Single); + break; + case ST_SPACING_ONEHALF: + spacing.set(Spacing::Onehalf); + break; + case ST_SPACING_DOUBLE: + spacing.set(Spacing::Double); + break; + case ST_OTHER: + lexrc.next(); + spacing.set(Spacing::Other, lexrc.GetFloat()); + break; + } +} /* ******************************************************************* */ @@ -620,6 +734,48 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay) } +enum TextClassTags { + TC_OUTPUTTYPE = 1, + TC_INPUT, + TC_STYLE, + TC_NOSTYLE, + TC_COLUMNS, + TC_SIDES, + TC_PAGESTYLE, + TC_DEFAULTFONT, + TC_MAXCOUNTER, + TC_SECNUMDEPTH, + TC_TOCDEPTH, + TC_CLASSOPTIONS, + TC_PREAMBLE, + TC_PROVIDESAMSMATH, + TC_PROVIDESMAKEIDX, + TC_PROVIDESURL, + TC_LEFTMARGIN, + TC_RIGHTMARGIN +}; + +static keyword_item textClassTags[] = { + { "classoptions", TC_CLASSOPTIONS }, + { "columns", TC_COLUMNS }, + { "defaultfont", TC_DEFAULTFONT }, + { "input", TC_INPUT }, + { "leftmargin", TC_LEFTMARGIN }, + { "maxcounter", TC_MAXCOUNTER }, + { "nostyle", TC_NOSTYLE }, + { "outputtype", TC_OUTPUTTYPE }, + { "pagestyle", TC_PAGESTYLE }, + { "preamble", TC_PREAMBLE }, + { "providesamsmath", TC_PROVIDESAMSMATH }, + { "providesmakeidx", TC_PROVIDESMAKEIDX }, + { "providesurl", TC_PROVIDESURL }, + { "rightmargin", TC_RIGHTMARGIN }, + { "secnumdepth", TC_SECNUMDEPTH }, + { "sides", TC_SIDES }, + { "style", TC_STYLE }, + { "tocdepth", TC_TOCDEPTH } +}; + // Reads a textclass structure from file. bool LyXTextClass::Read(string const & filename, bool merge) { @@ -632,7 +788,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) << MakeDisplayPath(filename) << endl; - LyXLex lexrc(layoutTags, sizeof(layoutTags)/sizeof(keyword_item)); + LyXLex lexrc(textClassTags, TC_RIGHTMARGIN); bool error = false; lexrc.setFile(filename); @@ -640,36 +796,23 @@ bool LyXTextClass::Read(string const & filename, bool merge) // parsing while (lexrc.IsOK() && !error) { - switch(lexrc.lex()) { - case -2: - break; + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_FEOF: + continue; break; - case -1: - lexrc.printError("Unknown tag `$$Token'"); + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown TextClass tag `$$Token'"); error = true; - break; - - case LT_OUTPUTTYPE: // output type definition - switch(lexrc.lex()) { - case LT_OTLATEX: - outputType_ = LATEX; - break; - case LT_OTLINUXDOC: - outputType_ = LINUXDOC; - break; - case LT_OTDOCBOOK: - outputType_ = DOCBOOK; - break; - case LT_OTLITERATE: - outputType_ = LITERATE; - break; - default: - lexrc.printError("Unknown output type `$$Token'"); - break; - } + continue; break; + default: break; + } + switch(static_cast(le)) { + case TC_OUTPUTTYPE: // output type definition + readOutputType(lexrc); break; - case LT_INPUT: // Include file + case TC_INPUT: // Include file if (lexrc.next()) { string tmp = LibFileSearch("layouts", lexrc.GetString(), @@ -683,7 +826,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; - case LT_STYLE: + case TC_STYLE: if (lexrc.next()) { string name = subst(lexrc.GetString(), '_', ' '); @@ -703,7 +846,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; - case LT_NOSTYLE: + case TC_NOSTYLE: if (lexrc.next()) { string style = subst(lexrc.GetString(), '_', ' '); @@ -713,12 +856,12 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; - case LT_COLUMNS: + case TC_COLUMNS: if (lexrc.next()) columns_ = lexrc.GetInteger(); break; - case LT_SIDES: + case TC_SIDES: if (lexrc.next()) { switch(lexrc.GetInteger()) { case 1: sides_ = OneSide; break; @@ -733,12 +876,12 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; - case LT_PAGESTYLE: + case TC_PAGESTYLE: lexrc.next(); pagestyle_ = strip(lexrc.GetString()); break; - case LT_DEFAULTFONT: + case TC_DEFAULTFONT: defaultfont_.lyxRead(lexrc); if (!defaultfont_.resolved()) { lexrc.printError("Warning: defaultfont should " @@ -747,110 +890,53 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; - case LT_MAXCOUNTER: - switch (lexrc.lex()) { - case LT_COUNTER_CHAPTER: - maxcounter_ = LABEL_COUNTER_CHAPTER; - break; - case LT_COUNTER_SECTION: - maxcounter_ = LABEL_COUNTER_SECTION; - break; - case LT_COUNTER_SUBSECTION: - maxcounter_ = LABEL_COUNTER_SUBSECTION; - break; - case LT_COUNTER_SUBSUBSECTION: - maxcounter_ = LABEL_COUNTER_SUBSUBSECTION; - break; - case LT_COUNTER_PARAGRAPH: - maxcounter_ = LABEL_COUNTER_PARAGRAPH; - break; - case LT_COUNTER_SUBPARAGRAPH: - maxcounter_ = LABEL_COUNTER_SUBPARAGRAPH; - break; - case LT_COUNTER_ENUMI: - maxcounter_ = LABEL_COUNTER_ENUMI; - break; - case LT_COUNTER_ENUMII: - maxcounter_ = LABEL_COUNTER_ENUMII; - break; - case LT_COUNTER_ENUMIII: - maxcounter_ = LABEL_COUNTER_ENUMIII; - break; - case LT_COUNTER_ENUMIV: - maxcounter_ = LABEL_COUNTER_ENUMIV; - break; - } + case TC_MAXCOUNTER: + readMaxCounter(lexrc); break; - case LT_SECNUMDEPTH: + case TC_SECNUMDEPTH: lexrc.next(); secnumdepth_ = lexrc.GetInteger(); break; - case LT_TOCDEPTH: + case TC_TOCDEPTH: lexrc.next(); tocdepth_ = lexrc.GetInteger(); break; // First step to support options - case LT_CLASSOPTIONS: - { - bool getout = true; - while (getout && lexrc.IsOK()) { - switch (lexrc.lex()) { - case LT_FONTSIZE: - lexrc.next(); - opt_fontsize_ = strip(lexrc.GetString()); - break; - case LT_PAGESTYLE: - lexrc.next(); - opt_pagestyle_ = strip(lexrc.GetString()); - break; - case LT_OTHER: - lexrc.next(); - options_ = lexrc.GetString(); - break; - case LT_END: getout = false; break; - default: - lexrc.printError("Out of context tag `$$Token'"); - break; - } - } + case TC_CLASSOPTIONS: + readClassOptions(lexrc); break; - } - case LT_PREAMBLE: + case TC_PREAMBLE: preamble_ = lexrc.getLongString("EndPreamble"); break; - case LT_PROVIDESAMSMATH: + case TC_PROVIDESAMSMATH: if (lexrc.next() && lexrc.GetInteger()) provides_ |= amsmath; break; - case LT_PROVIDESMAKEIDX: + case TC_PROVIDESMAKEIDX: if (lexrc.next() && lexrc.GetInteger()) provides_ |= makeidx; break; - case LT_PROVIDESURL: + case TC_PROVIDESURL: if (lexrc.next() && lexrc.GetInteger()) provides_ = url; break; - case LT_LEFTMARGIN: // left margin type + case TC_LEFTMARGIN: // left margin type if (lexrc.next()) leftmargin_ = lexrc.GetString(); break; - case LT_RIGHTMARGIN: // right margin type + case TC_RIGHTMARGIN: // right margin type if (lexrc.next()) rightmargin_ = lexrc.GetString(); break; - - default: - lexrc.printError("Out of context tag `$$Token'"); - break; } } @@ -866,6 +952,163 @@ bool LyXTextClass::Read(string const & filename, bool merge) return error; } +enum OutputTypeTags { + OT_OTLATEX = 1, + OT_OTLINUXDOC, + OT_OTDOCBOOK, + OT_OTLITERATE +}; + +static keyword_item outputTypeTags[] = { + { "docbook", OT_OTDOCBOOK }, + { "latex", OT_OTLATEX }, + { "linuxdoc", OT_OTLINUXDOC }, + { "literate", OT_OTLITERATE } +}; + +void LyXTextClass::readOutputType(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, outputTypeTags, OT_OTLITERATE); + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown output type `$$Token'"); + return; break; + default: break; + } + switch(static_cast(le)) { + case OT_OTLATEX: + outputType_ = LATEX; + break; + case OT_OTLINUXDOC: + outputType_ = LINUXDOC; + break; + case OT_OTDOCBOOK: + outputType_ = DOCBOOK; + break; + case OT_OTLITERATE: + outputType_ = LITERATE; + break; + } +} + +enum MaxCounterTags { + MC_COUNTER_CHAPTER = 1, + MC_COUNTER_SECTION, + MC_COUNTER_SUBSECTION, + MC_COUNTER_SUBSUBSECTION, + MC_COUNTER_PARAGRAPH, + MC_COUNTER_SUBPARAGRAPH, + MC_COUNTER_ENUMI, + MC_COUNTER_ENUMII, + MC_COUNTER_ENUMIII, + MC_COUNTER_ENUMIV +}; + +static keyword_item maxCounterTags[] = { + {"counter_chapter", MC_COUNTER_CHAPTER }, + {"counter_enumi", MC_COUNTER_ENUMI }, + {"counter_enumii", MC_COUNTER_ENUMII }, + {"counter_enumiii", MC_COUNTER_ENUMIII }, + {"counter_enumiv", MC_COUNTER_ENUMIV }, + {"counter_paragraph", MC_COUNTER_PARAGRAPH }, + {"counter_section", MC_COUNTER_SECTION }, + {"counter_subparagraph", MC_COUNTER_SUBPARAGRAPH }, + {"counter_subsection", MC_COUNTER_SUBSECTION }, + {"counter_subsubsection", MC_COUNTER_SUBSUBSECTION } +}; + +void LyXTextClass::readMaxCounter(LyXLex & lexrc) +{ + pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV); + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown MaxCounter tag `$$Token'"); + return; break; + default: break; + } + switch (static_cast(le)) { + case MC_COUNTER_CHAPTER: + maxcounter_ = LABEL_COUNTER_CHAPTER; + break; + case MC_COUNTER_SECTION: + maxcounter_ = LABEL_COUNTER_SECTION; + break; + case MC_COUNTER_SUBSECTION: + maxcounter_ = LABEL_COUNTER_SUBSECTION; + break; + case MC_COUNTER_SUBSUBSECTION: + maxcounter_ = LABEL_COUNTER_SUBSUBSECTION; + break; + case MC_COUNTER_PARAGRAPH: + maxcounter_ = LABEL_COUNTER_PARAGRAPH; + break; + case MC_COUNTER_SUBPARAGRAPH: + maxcounter_ = LABEL_COUNTER_SUBPARAGRAPH; + break; + case MC_COUNTER_ENUMI: + maxcounter_ = LABEL_COUNTER_ENUMI; + break; + case MC_COUNTER_ENUMII: + maxcounter_ = LABEL_COUNTER_ENUMII; + break; + case MC_COUNTER_ENUMIII: + maxcounter_ = LABEL_COUNTER_ENUMIII; + break; + case MC_COUNTER_ENUMIV: + maxcounter_ = LABEL_COUNTER_ENUMIV; + break; + } +} + +enum ClassOptionsTags { + CO_FONTSIZE = 1, + CO_PAGESTYLE, + CO_OTHER, + CO_END +}; + +static keyword_item classOptionsTags[] = { + {"end", CO_END }, + {"fontsize", CO_FONTSIZE }, + {"other", CO_OTHER }, + {"pagestyle", CO_PAGESTYLE } +}; + +void LyXTextClass::readClassOptions(LyXLex & lexrc) +{ + lexrc.pushTable(classOptionsTags, CO_END); + bool getout = false; + while (!getout && lexrc.IsOK()) { + int le = lexrc.lex(); + switch (le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown ClassOption tag `$$Token'"); + continue; break; + default: break; + } + switch (static_cast(le)) { + case CO_FONTSIZE: + lexrc.next(); + opt_fontsize_ = strip(lexrc.GetString()); + break; + case CO_PAGESTYLE: + lexrc.next(); + opt_pagestyle_ = strip(lexrc.GetString()); + break; + case CO_OTHER: + lexrc.next(); + options_ = lexrc.GetString(); + break; + case CO_END: + getout = true; + break; + } + } + lexrc.popTable(); +} + bool LyXTextClass::hasLayout(string const & name) const { @@ -1099,7 +1342,7 @@ bool LyXTextClassList::Read () if (!lex.IsOK()) { lyxerr << "LyXTextClassList::Read: unable to open " "textclass file `" << MakeDisplayPath(real_file, 1000) - << "\'\nCheck your installation. LyX can't continue." + << "'\nCheck your installation. LyX can't continue." << endl; return false; } diff --git a/src/layout.h b/src/layout.h index 6996913e72..b10bdcccee 100644 --- a/src/layout.h +++ b/src/layout.h @@ -174,7 +174,12 @@ public: /// bool Read (LyXLex &, LyXTextClass const &); - + void readAlign(LyXLex &); + void readAlignPossible(LyXLex &); + void readLabelType(LyXLex &); + void readMargin(LyXLex &); + void readLatexType(LyXLex &); + void readSpacing(LyXLex &); string const & name() const { return name_; } void name(string const & n) { name_ = n; } string const & obsoleted_by() const { return obsoleted_by_; } @@ -342,7 +347,9 @@ public: /// bool Read(string const & filename, bool merge = false); - + void readOutputType(LyXLex &); + void readMaxCounter(LyXLex &); + void readClassOptions(LyXLex &); /// bool hasLayout(string const & name) const; diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 4a51cb3c7a..dea5453b86 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -3561,7 +3561,7 @@ void Reconfigure() AddName(system_lyxdir, "configure")); p.pop(); minibuffer->Set(_("Reloading configuration...")); - lyxrc->Read(LibFileSearch(string(), "lyxrc.defaults")); + lyxrc->read(LibFileSearch(string(), "lyxrc.defaults")); WriteAlert(_("The system has been reconfigured."), _("You need to restart LyX to make use of any"), _("updated document class specifications.")); diff --git a/src/lyx_main.C b/src/lyx_main.C index 4d4fe085a9..a20a9cc14e 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -339,7 +339,7 @@ void LyX::init(int */*argc*/, char **argv) lyxrc->ReadBindFile(); if (lyxerr.debugging(Debug::LYXRC)) { - lyxrc->Print(); + lyxrc->print(); } // Create temp directory @@ -414,7 +414,7 @@ void LyX::ReadRcFile(string const & name) if (!lyxrc_path.empty()){ lyxerr[Debug::INIT] << "Found " << name << " in " << lyxrc_path << endl; - if (lyxrc->Read(lyxrc_path) < 0) { + if (lyxrc->read(lyxrc_path) < 0) { WriteAlert(_("LyX Warning!"), _("Error while reading ")+lyxrc_path+".", _("Using built-in defaults.")); @@ -425,13 +425,13 @@ void LyX::ReadRcFile(string const & name) // Set debugging level and report result to user -void setDebuggingLevel(string const &dbgLevel) +void setDebuggingLevel(string const & dbgLevel) { lyxerr << _("Setting debug level to ") << dbgLevel << endl; lyxerr.level(Debug::value(dbgLevel)); lyxerr[Debug::INFO] << "Debugging INFO #" << Debug::INFO << endl; lyxerr[Debug::INIT] << "Debugging INIT #" << Debug::INIT << endl; - lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl; + lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl; lyxerr[Debug::TOOLBAR] << "Debugging TOOLBAR #" << Debug::TOOLBAR << endl; lyxerr[Debug::PARSER] << "Debugging LEX and PARSER #" << Debug::PARSER << endl; lyxerr[Debug::LYXRC] << "Debugging LYXRC #" << Debug::LYXRC << endl; diff --git a/src/lyxfont.C b/src/lyxfont.C index 6bd290ead5..d894bc149f 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -553,7 +553,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex) error = true; } } - return *this; + return * this; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 06980bb084..c923e5d3e6 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -138,11 +138,11 @@ extern void Reconfigure(); extern int current_layout; extern int getISOCodeFromLaTeX(char *); -extern int UnlockInset(UpdatableInset*); +extern int UnlockInset(UpdatableInset *); extern void ShowLatexLog(); -extern void UpdateInset(Inset* inset, bool mark_dirty = true); +extern void UpdateInset(Inset * inset, bool mark_dirty = true); /* === globals =========================================================== */ @@ -395,7 +395,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const break; } if (disable) - flag = func_status(flag | LyXFunc::Disabled); + flag |= LyXFunc::Disabled; func_status box = LyXFunc::ToggleOff; // LyXFont font = buf->text->real_current_font; @@ -2441,6 +2441,13 @@ string LyXFunc::Dispatch(int ac, } break; + case LFUN_SAVEPREFERENCES: + { + Path p(user_lyxdir); + lyxrc->write("preferences"); + } + break; + case LFUN_UNKNOWN_ACTION: { if (owner->buffer()->isReadonly()) { diff --git a/src/lyxlex.C b/src/lyxlex.C index 00a488341b..c35caaca7b 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -56,7 +56,7 @@ void LyXLex::popTable() void LyXLex::printTable() { lyxerr << "\nNumber of tags: " << no_items << endl; - for(int i= 0; i' ') + if (buff[0] > ' ') return atoi(buff); else { printError("Bad integer `$$Token'"); @@ -115,10 +116,10 @@ int LyXLex::GetInteger() } -float LyXLex::GetFloat() +float LyXLex::GetFloat() const { - if (buff[0]>' ') - return (float)strtod(buff, (char**)0); + if (buff[0] > ' ') + return atof(buff); else { printError("Bad float `$$Token'"); return -1; @@ -182,7 +183,7 @@ string LyXLex::getLongString(string const & endtoken) } -bool LyXLex::GetBool() +bool LyXLex::GetBool() const { if (compare(buff, "true") == 0) return true; @@ -194,7 +195,7 @@ bool LyXLex::GetBool() bool LyXLex::EatLine() { - int i= 0; + int i = 0; int c = '\0'; // getc() returns an int while (!feof(file) && c!= '\n' && i!= (LEX_MAX_BUFF-1)) { @@ -222,10 +223,10 @@ bool LyXLex::EatLine() int LyXLex::search_kw(char const * const tag) const { - int m, k= 0 , l= 0, r= no_items; + int m, k = 0 , l = 0, r = no_items; while (l < r) { - m = (l+r)/2; + m = (l + r) / 2; if (lyxerr.debugging(Debug::PARSER)) { lyxerr << "LyXLex::search_kw: elem " << m @@ -239,19 +240,16 @@ int LyXLex::search_kw(char const * const tag) const if (k == 0) return table[m].code; else - if (k<0) l = m+1; else r = m; + if (k < 0) l = m + 1; else r = m; } - return -1; + return LEX_UNDEF; } bool LyXLex::next(bool esc) { - if (!esc) { int c; // getc() returns an int - //int i; - status = 0; while (!feof(file) && !status) { @@ -325,8 +323,6 @@ bool LyXLex::next(bool esc) return false; } else { int c; // getc() returns an int - //int i; - status = 0; while (!feof(file) && !status) { @@ -433,15 +429,12 @@ bool LyXLex::next(bool esc) bool LyXLex::nextToken() { - int c; // getc() returns an int - int i; - status = 0; while (!feof(file) && !status) { - c = getc(file); + int c = getc(file); // getc() returns an int if (c >= ' ' && !feof(file)) { - i = 0; + int i = 0; if (c == '\\') { // first char == '\\' do { buff[i++] = c; @@ -500,7 +493,7 @@ int LyXLex::CheckToken(char const * str[], int print_error) int i = -1; if (compare(buff, "default")) { - for (i = 0; str[i][0] && compare(str[i], buff); i++); + for (i = 0; str[i][0] && compare(str[i], buff); ++i); if (!str[i][0]) { if (print_error) printError("Unknown argument `$$Token'"); diff --git a/src/lyxlex.h b/src/lyxlex.h index 39809e476a..b581a7bb36 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -4,20 +4,20 @@ // texclass and others to come. [asierra30/03/96] // // (C) 1996 Lyx Team. -#ifndef _LYXLEX_H -#define _LYXLEX_H +#ifndef LYXLEX_H +#define LYXLEX_H #ifdef __GNUG__ #pragma interface #endif -#include +#include #include "LString.h" /// struct keyword_item { /// - char const* tag; + char const * tag; /// short code; }; @@ -31,7 +31,7 @@ struct keyword_item { class LyXLex { public: /// - LyXLex (keyword_item*, int); + LyXLex (keyword_item *, int); /// ~LyXLex() { if (file && owns_file) fclose(file); }; @@ -48,15 +48,15 @@ public: }; /// file is open and end of file is not reached - bool IsOK(); + bool IsOK() const; /// return true if able to open file, else false bool setFile(string const & filename); /// if file is already read from, line numbers will be wrong. // should be removed - void setFile(FILE *f); + void setFile(FILE * f); /// // should be removed - FILE *getFile() { return file; } + FILE * getFile() { return file; } /// Danger! Don't use it unless you know what you are doing. void setLineNo(int l) { lineno = l; } /// returns a lex code @@ -73,32 +73,32 @@ public: bool nextToken(); /// - int GetLineNo() { return lineno; } + int GetLineNo() const { return lineno; } /// - int GetInteger(); + int GetInteger() const; /// - bool GetBool(); + bool GetBool() const; /// - float GetFloat(); + float GetFloat() const; /// string GetString() const; /// get a long string, ended by the tag `endtag' - string getLongString(string const &endtoken); + string getLongString(string const & endtoken); /// bool EatLine(); /// - int FindToken(char const* string[]); + int FindToken(char const * string[]); /// - int CheckToken(char const* string[], int print_error); + int CheckToken(char const * string[], int print_error); /// - char const *text() const { return &buff[0]; } + char const * text() const { return &buff[0]; } /** Pushes a token list on a stack and replaces it with a new one. */ - void pushTable(keyword_item*, int); + void pushTable(keyword_item *, int); /** Pops a token list into void and replaces it with the one now on top of the stack. @@ -109,7 +109,7 @@ public: and file name. If message contains the substring `$$Token', it is replaced with the value of GetString() */ - void printError(string const & message); + void printError(string const & message) const; /** Prints the current token table on cerr. @@ -118,7 +118,7 @@ public: protected: /// enum { - /// + /// LEX_MAX_BUFF = 2048 }; @@ -130,15 +130,15 @@ protected: table_elem= 0; } /// - pushed_table *next; + pushed_table * next; /// - keyword_item *table_elem; + keyword_item * table_elem; /// int table_siz; }; /// - FILE *file; + FILE * file; /// bool owns_file; /// @@ -146,13 +146,13 @@ protected: /// int lineno; /// - keyword_item *table; + keyword_item * table; /// int no_items; /// char buff[LEX_MAX_BUFF]; /// - pushed_table *pushed; + pushed_table * pushed; /// int search_kw(char const * const) const; /// @@ -161,9 +161,22 @@ protected: inline -bool LyXLex::IsOK() +bool LyXLex::IsOK() const { return (file && !feof(file)); } +// This is needed to ensure that the pop is done upon exit from methods +// with more than one exit point or that can return as a response to +// exceptions. (Lgb) +struct pushpophelper { + pushpophelper(LyXLex & lexrc, keyword_item * i, int s) : lex(lexrc) { + lex.pushTable(i, s); + } + ~pushpophelper() { + lex.popTable(); + } + LyXLex & lex; +}; + #endif diff --git a/src/lyxrc.C b/src/lyxrc.C index ae33b10370..a60c9cd2bc 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -14,6 +14,9 @@ #pragma implementation "lyxrc.h" #endif +#include +#include + #include "debug.h" #include "lyxrc.h" @@ -33,10 +36,10 @@ extern int fast_selection; extern string background_color; extern char selection_color[]; extern bool cursor_follows_scrollbar; -extern kb_keymap *toplevel_keymap; +extern kb_keymap * toplevel_keymap; extern LyXAction lyxaction; -enum _LyXRCTags { +enum LyXRCTags { RC_BEGINTOOLBAR = 1, RC_FONT_ENCODING, RC_PRINTER, @@ -215,7 +218,7 @@ static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item); // Should this be moved inside LyXAction? static inline -int bindKey(char const* seq, int action) +int bindKey(char const * seq, int action) { return toplevel_keymap->bind(seq, action); } @@ -304,47 +307,61 @@ int LyXRC::ReadBindFile(string const & name) hasBindFile = true; string tmp = i18nLibFileSearch("bind", name, "bind"); lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl; - int result = Read(tmp); + int result = read(tmp); if (result) { lyxerr << "Error reading bind file: " << tmp << endl; } return result; } -int LyXRC::Read(string const &filename) +int LyXRC::read(string const & filename) { // Default bindfile. string bindFile = "cua"; - + LyXLex lexrc(lyxrcTags, lyxrcCount); if (lyxerr.debugging(Debug::PARSER)) lexrc.printTable(); lexrc.setFile(filename); if (!lexrc.IsOK()) return -2; - + lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl; while (lexrc.IsOK()) { + // By using two switches we take advantage of the compiler + // telling us if we have missed a LyXRCTags element in + // the second switch. + // Note that this also shows a problem with LyXLex since it + // helps us avoid taking advantage of the strictness of the + // compiler. - switch(lexrc.lex()) { + int le = lexrc.lex(); + switch(le) { + case LyXLex::LEX_UNDEF: + lexrc.printError("Unknown tag `$$Token'"); + continue; break; case LyXLex::LEX_FEOF: - break; + continue; break; + default: break; + } + switch (static_cast(le)) { case RC_INPUT: // Include file if (lexrc.next()) { string tmp = LibFileSearch(string(), lexrc.GetString()); - if (Read(tmp)) { + if (read(tmp)) { lexrc.printError("Error reading " - "included file: "+tmp); + "included file: "+tmp); } } break; case RC_BINDFILE: // RVDK_PATCH_5 - if (lexrc.next()) + if (lexrc.next()) { ReadBindFile(lexrc.GetString()); + } break; - + case RC_BEGINTOOLBAR: // this toolbar should be changed to be a completely // non gui toolbar. (Lgb) @@ -355,27 +372,27 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) use_kbmap = lexrc.GetBool(); break; - + case RC_EXIT_CONFIRMATION: if (lexrc.next()) exit_confirmation = lexrc.GetBool(); break; - + case RC_DISPLAY_SHORTCUTS: if (lexrc.next()) display_shortcuts = lexrc.GetBool(); break; - + case RC_KBMAP_PRIMARY: if (lexrc.next()) primary_kbmap = lexrc.GetString(); break; - + case RC_KBMAP_SECONDARY: if (lexrc.next()) secondary_kbmap = lexrc.GetString(); break; - + case RC_FONT_ENCODING: if (lexrc.next()) fontenc = lexrc.GetString(); @@ -405,12 +422,12 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) print_pagerange_flag = lexrc.GetString(); break; - + case RC_PRINTCOPIESFLAG: if (lexrc.next()) print_copies_flag = lexrc.GetString(); break; - + case RC_PRINTCOLLCOPIESFLAG: if (lexrc.next()) print_collcopies_flag = lexrc.GetString(); @@ -460,12 +477,12 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) print_spool_printerprefix = lexrc.GetString(); break; - + case RC_PRINTPAPERDIMENSIONFLAG: if (lexrc.next()) print_paper_dimension_flag = lexrc.GetString(); break; - + case RC_PRINTPAPERFLAG: if (lexrc.next()) print_paper_flag = lexrc.GetString(); @@ -475,7 +492,7 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) custom_export_command = lexrc.GetString(); break; - + case RC_CUSTOM_EXPORT_FORMAT: if (lexrc.next()) custom_export_format = lexrc.GetString(); @@ -485,96 +502,103 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) latex_command = lexrc.GetString(); break; - + case RC_LITERATE_COMMAND: if (lexrc.next()) literate_command = lexrc.GetString(); break; - + case RC_LITERATE_EXTENSION: if (lexrc.next()) literate_extension = lexrc.GetString(); break; - + case RC_LITERATE_ERROR_FILTER: if (lexrc.next()) literate_error_filter = lexrc.GetString(); break; - + case RC_BUILD_COMMAND: if (lexrc.next()) build_command = lexrc.GetString(); break; - + case RC_BUILD_ERROR_FILTER: if (lexrc.next()) build_error_filter = lexrc.GetString(); - break; - + break; + case RC_RELYX_COMMAND: if (lexrc.next()) relyx_command = lexrc.GetString(); break; - + case RC_DEFAULT_PAPERSIZE: if (lexrc.next()) { string size = lowercase(lexrc.GetString()); if (size == "usletter") - default_papersize = BufferParams::PAPER_USLETTER; + default_papersize = + BufferParams::PAPER_USLETTER; else if (size == "legal") - default_papersize = BufferParams::PAPER_LEGALPAPER; + default_papersize = + BufferParams::PAPER_LEGALPAPER; else if (size == "executive") - default_papersize = BufferParams::PAPER_EXECUTIVEPAPER; + default_papersize = + BufferParams::PAPER_EXECUTIVEPAPER; else if (size == "a3") - default_papersize = BufferParams::PAPER_A3PAPER; + default_papersize = + BufferParams::PAPER_A3PAPER; else if (size == "a4") - default_papersize = BufferParams::PAPER_A4PAPER; + default_papersize = + BufferParams::PAPER_A4PAPER; else if (size == "a5") - default_papersize = BufferParams::PAPER_A5PAPER; + default_papersize = + BufferParams::PAPER_A5PAPER; else if (size == "b5") - default_papersize = BufferParams::PAPER_B5PAPER; + default_papersize = + BufferParams::PAPER_B5PAPER; } break; case RC_VIEWDVI_COMMAND: if (lexrc.next()) view_dvi_command = lexrc.GetString(); break; - + case RC_PS_COMMAND: if (lexrc.next()) ps_command = lexrc.GetString(); break; - + case RC_VIEWPS_COMMAND: if (lexrc.next()) view_ps_command = lexrc.GetString(); break; - + case RC_VIEWPSPIC_COMMAND: if (lexrc.next()) view_pspic_command = lexrc.GetString(); break; - + case RC_CHKTEX_COMMAND: if (lexrc.next()) chktex_command = lexrc.GetString(); break; - + case RC_HTML_COMMAND: if (lexrc.next()) html_command = lexrc.GetString(); break; - + case RC_SCREEN_DPI: if (lexrc.next()) dpi = lexrc.GetInteger(); break; - + case RC_SCREEN_ZOOM: if (lexrc.next()) zoom = lexrc.GetInteger(); break; - + case RC_SCREEN_FONT_SIZES: if (lexrc.next()) font_sizes[LyXFont::SIZE_TINY] = @@ -607,12 +631,12 @@ int LyXRC::Read(string const &filename) font_sizes[LyXFont::SIZE_HUGER] = lexrc.GetFloat(); break; - + case RC_SCREEN_FONT_SCALABLE: if (lexrc.next()) use_scalable_fonts = lexrc.GetBool(); break; - + case RC_AUTOSAVE: if (lexrc.next()) autosave = lexrc.GetInteger(); @@ -622,18 +646,18 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) sgml_extra_options = lexrc.GetString(); break; - + case RC_DOCUMENTPATH: if (lexrc.next()) { document_path = ExpandPath(lexrc.GetString()); } break; - + case RC_TEMPLATEPATH: if (lexrc.next()) template_path = ExpandPath(lexrc.GetString()); break; - + case RC_TEMPDIRPATH: if (lexrc.next()) tempdir_path = ExpandPath(lexrc.GetString()); @@ -643,32 +667,32 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) use_tempdir = lexrc.GetBool(); break; - + case RC_LASTFILES: if (lexrc.next()) lastfiles = ExpandPath(lexrc.GetString()); break; - + case RC_NUMLASTFILES: if (lexrc.next()) num_lastfiles = lexrc.GetInteger(); break; - + case RC_CHECKLASTFILES: if (lexrc.next()) check_lastfiles = lexrc.GetBool(); break; - + case RC_SCREEN_FONT_ROMAN: if (lexrc.next()) roman_font_name = lexrc.GetString(); break; - + case RC_SCREEN_FONT_SANS: if (lexrc.next()) sans_font_name = lexrc.GetString(); break; - + case RC_SCREEN_FONT_TYPEWRITER: if (lexrc.next()) typewriter_font_name = lexrc.GetString(); @@ -702,25 +726,25 @@ int LyXRC::Read(string const &filename) // the default bind file. if (!hasBindFile) ReadBindFile(); - + // !!!chb, dynamic key binding... int action, res = 0; string seq, cmd; - + if (lexrc.lex() == LyXLex::LEX_DATA) { seq = lexrc.GetString(); } else { lexrc.printError("Bad key sequence: `$$Token'"); break; } - + if (lexrc.lex() == LyXLex::LEX_DATA) { cmd = lexrc.GetString(); } else { lexrc.printError("Bad command: `$$Token'"); break; } - + if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) { if (lyxerr.debugging(Debug::KEY)) { lyxerr << "RC_BIND: Sequence `" @@ -731,12 +755,12 @@ int LyXRC::Read(string const &filename) res = bindKey(seq.c_str(), action); if (res != 0) { lexrc.printError( - "Invalid key sequence `" - + seq + '\''); + "Invalid key sequence `" + + seq + '\''); } } else {// cmd is the last token read. lexrc.printError( - "Unknown LyX function `$$Token'"); + "Unknown LyX function `$$Token'"); } break; } @@ -781,13 +805,13 @@ int LyXRC::Read(string const &filename) break; case RC_ASCIIROFF_COMMAND: if (lexrc.next()) - ascii_roff_command = lexrc.GetString(); + ascii_roff_command = lexrc.GetString(); break; case RC_ASCII_LINELEN: if (lexrc.next()) - ascii_linelen = lexrc.GetInteger(); + ascii_linelen = lexrc.GetInteger(); break; - // Spellchecker settings: + // Spellchecker settings: case RC_SPELL_COMMAND: if (lexrc.next()) isp_command = lexrc.GetString(); @@ -824,10 +848,7 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) isp_esc_chars = lexrc.GetString(); break; - - default: - lexrc.printError("Unknown tag `$$Token'"); - break; + case RC_LAST: break; // this is just a dummy } } @@ -835,9 +856,278 @@ int LyXRC::Read(string const &filename) } -void LyXRC::Print() +void LyXRC::write(string const & filename) const { - lyxerr << "The current internal LyXRC:" << endl; + ofstream ofs(filename.c_str()); + if (ofs) + output(ofs); +} + + +void LyXRC::print() const +{ + if (lyxerr.debugging()) + output(lyxerr); + else + output(cout); +} + + +void LyXRC::output(ostream & os) const +{ + os << "### This file is part of\n" + << "### ========================================================\n" + << "### LyX, The Document Processor\n" + << "###\n" + << "### Copyright 1995 Matthias Ettrich\n" + << "### Copyright 1995-1998 The LyX Team.\n" + << "###\n" + << "### ========================================================\n" + << "\n" + << "# This file is written by LyX, if you want to make your own\n" + << "# modifications you should do them from inside LyX and save\n" + << "# your preferences, or you can also make your modifications\n" + << "# to lyxrc by hand. It is not advisable to edit this file.\n" + << "\n"; + + // Why the switch you might ask. It is a trick to ensure that all + // the elements in the LyXRCTags enum is handled. As you can see + // there are no breaks at all. So it is just a huge fall-through. + // The nice thing is that we will get a warning from the compiler + // if we forget an element. + LyXRCTags tag = RC_LAST; + switch(tag) { + case RC_LAST: + case RC_INPUT: + // input/include files are not done here + case RC_BIND: + // bindings is not written to the preferences file. + case RC_BINDFILE: + // bind files are not done here. + case RC_BEGINTOOLBAR: + // Toolbar is not written here (yet). + case RC_FONT_ENCODING: + os << "\\font_encoding \"" << fontenc << "\"\n"; + case RC_PRINTER: + os << "\\printer \"" << printer << "\"\n"; + case RC_PRINT_COMMAND: + os << "\\print_command \"" << print_command << "\"\n"; + case RC_PRINTEVENPAGEFLAG: + os << "\\print_evenpage_flag \"" << print_evenpage_flag + << "\"\n"; + case RC_PRINTODDPAGEFLAG: + os << "\\print_oddpage_flag \"" << print_oddpage_flag + << "\"\n"; + case RC_PRINTPAGERANGEFLAG: + os << "\\print_pagerange_flag \"" << print_pagerange_flag + << "\"\n"; + case RC_PRINTCOPIESFLAG: + os << "\\print_copies_flag \"" << print_copies_flag << "\"\n"; + case RC_PRINTCOLLCOPIESFLAG: + os << "\\print_collcopies_flag \"" << print_collcopies_flag + << "\"\n"; + case RC_PRINTREVERSEFLAG: + os << "\\print_reverse_flag \"" << print_reverse_flag + << "\"\n"; + case RC_PRINTLANDSCAPEFLAG: + os << "\\print_landscape_flag \"" << print_landscape_flag + << "\"\n"; + case RC_PRINTTOPRINTER: + os << "\\print_to_printer \"" << print_to_printer << "\"\n"; + case RC_PRINT_ADAPTOUTPUT: + os << "\\print_adapt_output " << tostr(print_adapt_output) + << "\n"; + case RC_PRINTTOFILE: + os << "\\print_to_file \"" << print_to_file << "\"\n"; + case RC_PRINTFILEEXTENSION: + os << "\\print_file_extension \"" << print_file_extension + << "\"\n"; + case RC_PRINTEXSTRAOPTIONS: + os << "\\print_extra_options \"" << print_extra_options + << "\"\n"; + case RC_PRINTSPOOL_COMMAND: + os << "\\print_spool_command \"" << print_spool_command + << "\"\n"; + case RC_PRINTSPOOL_PRINTERPREFIX: + os << "\\print_spool_printerprefix \"" + << print_spool_printerprefix << "\"\n"; + case RC_PRINTPAPERDIMENSIONFLAG: + os << "\\print_paper_dimension_flag \"" + << print_paper_dimension_flag << "\"\n"; + case RC_PRINTPAPERFLAG: + os << "\\print_paper_flag \"" << print_paper_flag << "\"\n"; + case RC_CUSTOM_EXPORT_COMMAND: + os << "\\custom_export_command \"" << custom_export_command + << "\"\n"; + case RC_CUSTOM_EXPORT_FORMAT: + os << "\\custom_export_format \"" << custom_export_format + << "\"\n"; + case RC_LATEX_COMMAND: + os << "\\latex_command \"" << latex_command << "\"\n"; + case RC_LITERATE_COMMAND: + os << "\\literate_command \"" << literate_command << "\"\n"; + case RC_LITERATE_EXTENSION: + os << "\\literate_extension \"" << literate_extension + << "\"\n"; + case RC_LITERATE_ERROR_FILTER: + os << "\\literate_error_filter \"" << literate_error_filter + << "\"\n"; + case RC_BUILD_COMMAND: + os << "\\build_command \"" << build_command << "\"\n"; + case RC_BUILD_ERROR_FILTER: + os << "\\build_error_filter \"" << build_error_filter + << "\"\n"; + case RC_SCREEN_DPI: + os << "\\screen_dpi " << dpi << "\n"; + case RC_SCREEN_ZOOM: + os << "\\screen_zoom " << zoom << "\n"; + case RC_SCREEN_FONT_SIZES: + os.setf(ios::fixed); + os.precision(2); + os << "\\screen_font_sizes"; + os << " " << font_sizes[LyXFont::SIZE_TINY]; + os << " " << font_sizes[LyXFont::SIZE_SCRIPT]; + os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]; + os << " " << font_sizes[LyXFont::SIZE_SMALL]; + os << " " << font_sizes[LyXFont::SIZE_NORMAL]; + os << " " << font_sizes[LyXFont::SIZE_LARGE]; + os << " " << font_sizes[LyXFont::SIZE_LARGER]; + os << " " << font_sizes[LyXFont::SIZE_LARGEST]; + os << " " << font_sizes[LyXFont::SIZE_HUGE]; + os << " " << font_sizes[LyXFont::SIZE_HUGER]; + os << "\n"; + case RC_AUTOREGIONDELETE: + os << "\\auto_region_delete " << tostr(auto_region_delete) + << "\n"; + case RC_AUTOSAVE: + os << "\\autosave " << autosave << "\n"; + case RC_EXIT_CONFIRMATION: + os << "\\exit_confirmation " << tostr(exit_confirmation) + << "\n"; + case RC_DISPLAY_SHORTCUTS: + os << "\\display_shortcuts " << tostr(display_shortcuts) + << "\n"; + case RC_VIEWDVI_COMMAND: + os << "\\view_dvi_command \"" << view_dvi_command << "\"\n"; + case RC_DEFAULT_PAPERSIZE: + os << "\\default_papersize \""; + switch (default_papersize) { + case BufferParams::PAPER_USLETTER: + os << "usletter"; break; + case BufferParams::PAPER_LEGALPAPER: + os << "legal"; break; + case BufferParams::PAPER_EXECUTIVEPAPER: + os << "executive"; break; + case BufferParams::PAPER_A3PAPER: + os << "a3"; break; + case BufferParams::PAPER_A4PAPER: + os << "a4"; break; + case BufferParams::PAPER_A5PAPER: + os << "a5"; break; + case BufferParams::PAPER_B5PAPER: + os << "b5"; break; + case BufferParams::PAPER_DEFAULT: break; + } + os << "\"\n"; + case RC_VIEWPS_COMMAND: + os << "\\view_ps_command \"" << view_ps_command << "\"\n"; + case RC_VIEWPSPIC_COMMAND: + os << "\\view_pspic_command \"" << view_pspic_command + << "\"\n"; + case RC_PS_COMMAND: + os << "\\ps_command \"" << ps_command << "\"\n"; + case RC_CHKTEX_COMMAND: + os << "\\chktex_command \"" << chktex_command << "\"\n"; + case RC_HTML_COMMAND: + os << "\\html_command \"" << html_command << "\"\n"; + case RC_SGML_EXTRA_OPTIONS: + os << "\\sgml_extra_options \"" << sgml_extra_options + << "\"\n"; + case RC_KBMAP: + os << "\\kbmap " << tostr(use_kbmap) << "\n"; + case RC_KBMAP_PRIMARY: + os << "\\kbmap_primary \"" << primary_kbmap << "\"\n"; + case RC_KBMAP_SECONDARY: + os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n"; + case RC_SERVERPIPE: + os << "\\serverpipe \"" << lyxpipes << "\"\n"; + case RC_RELYX_COMMAND: + os << "\\relyx_command \"" << relyx_command << "\"\n"; + case RC_DOCUMENTPATH: + os << "\\document_path \"" << document_path << "\"\n"; + case RC_TEMPLATEPATH: + os << "\\template_path \"" << template_path << "\"\n"; + case RC_TEMPDIRPATH: + os << "\\tempdir_path \"" << tempdir_path << "\"\n"; + case RC_USETEMPDIR: + os << "\\use_tempdir " << tostr(use_tempdir) << "\n"; + case RC_LASTFILES: + os << "\\lastfiles \"" << lastfiles << "\"\n"; + case RC_NUMLASTFILES: + os << "\\num_lastfiles " << num_lastfiles << "\n"; + case RC_CHECKLASTFILES: + os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n"; + case RC_SCREEN_FONT_ROMAN: + os << "\\screen_font_roman \"" << roman_font_name << "\"\n"; + case RC_SCREEN_FONT_SANS: + os << "\\screen_font_sans \"" << sans_font_name << "\"\n"; + case RC_SCREEN_FONT_TYPEWRITER: + os << "\\screen_font_typewriter \"" + << typewriter_font_name << "\"\n"; + case RC_SCREEN_FONT_MENU: + os << "\\screen_font_menu \"" << menu_font_name << "\"\n"; + case RC_SCREEN_FONT_POPUP: + os << "\\screen_font_popup \"" << popup_font_name << "\"\n"; + case RC_SCREEN_FONT_ENCODING: + os << "\\screen_font_encoding \"" << font_norm << "\"\n"; + case RC_SCREEN_FONT_SCALABLE: + os << "\\screen_font_scalable " << tostr(use_scalable_fonts) + << "\n"; + case RC_CURSOR_FOLLOWS_SCROLLBAR: + os << "\\cursor_follows_scrollbar " + << tostr(cursor_follows_scrollbar) << "\n"; + case RC_FAST_SELECTION: + os << "\\fast_selection " + << tostr(static_cast(fast_selection)) << "\n"; + case RC_BACKGROUND_COLOR: + os << "\\background_color \"" << background_color << "\"\n"; + case RC_SELECTION_COLOR: + os << "\\selection_color \"" << selection_color << "\"\n"; + case RC_FAX_COMMAND: + os << "\\fax_command \"" << fax_command << "\"\n"; + case RC_FAXPROGRAM: + os << "\\fax_program \"" << fax_program << "\"\n"; + case RC_PHONEBOOK: + os << "\\phone_book \"" << phone_book << "\"\n"; + case RC_ASCIIROFF_COMMAND: + os << "\\ascii_roff_command \"" << ascii_roff_command + << "\"\n"; + case RC_ASCII_LINELEN: + os << "\\ascii_linelen " << ascii_linelen << "\n"; + case RC_SPELL_COMMAND: + os << "\\spell_command \"" << isp_command << "\"\n"; + case RC_ACCEPT_COMPOUND: + os << "\\accept_compound " << tostr(isp_accept_compound) + << "\n"; + case RC_USE_INP_ENC: + os << "\\use_input_encoding " << tostr(isp_use_input_encoding) + << "\n"; + case RC_USE_ALT_LANG: + os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n"; + case RC_USE_PERS_DICT: + os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict) + << "\n"; + case RC_USE_ESC_CHARS: + os << "\\use_escape_chars " << tostr(isp_use_esc_chars) + << "\n"; + case RC_ALT_LANG: + os << "\\alternate_language \"" << isp_alt_lang << "\"\n"; + case RC_PERS_DICT: + os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n"; + case RC_ESC_CHARS: + os << "\\escape_chars \"" << isp_esc_chars << "\"\n"; + } + os.flush(); } @@ -848,17 +1138,17 @@ void LyXRC::defaultKeyBindings() bindKey("Left", LFUN_LEFT); bindKey("Up", LFUN_UP); bindKey("Down", LFUN_DOWN); - + bindKey("Tab", LFUN_TAB); - + bindKey("Home", LFUN_HOME); bindKey("End", LFUN_END); bindKey("Prior", LFUN_PRIOR); bindKey("Next", LFUN_NEXT); - + bindKey("Return", LFUN_BREAKPARAGRAPH); bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE); - + bindKey("Delete", LFUN_DELETE); bindKey("BackSpace", LFUN_BACKSPACE); // bindKeyings for transparent handling of deadkeys @@ -882,7 +1172,7 @@ void LyXRC::defaultKeyBindings() bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT); bindKey("~C-~S-~M-dead_tie", LFUN_TIE); bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK); - + // bindings to utilize the use of the numeric keypad // e.g. Num Lock set bindKey("KP_0", LFUN_SELFINSERT); @@ -901,11 +1191,11 @@ void LyXRC::defaultKeyBindings() bindKey("KP_Divide", LFUN_SELFINSERT); bindKey("KP_Multiply", LFUN_SELFINSERT); bindKey("KP_Subtract", LFUN_SELFINSERT); - + /* Most self-insert keys are handled in the 'default:' section of * WorkAreaKeyPress - so we don't have to define them all. * However keys explicit decleared as self-insert are * handled seperatly (LFUN_SELFINSERT.) Lgb. */ - + bindKey("C-Tab", LFUN_TABINSERT); // ale970515 } diff --git a/src/lyxrc.h b/src/lyxrc.h index 25d0cbdf6e..551fd9278d 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -25,9 +25,13 @@ public: /// LyXRC(); /// - int Read (string const & filename); + int read (string const & filename); /// - void Print(); + void write(string const & filename) const; + /// + void print() const; + /// + void output(ostream & os) const; /// Is a bind file already (or currently) read? bool hasBindFile; /// diff --git a/src/mathed/array.h b/src/mathed/array.h index 7562df412a..9b10bd54df 100644 --- a/src/mathed/array.h +++ b/src/mathed/array.h @@ -39,15 +39,15 @@ public: }; /// - LyxArrayBase(int size= ARRAY_STEP); + LyxArrayBase(int size = ARRAY_STEP); /// - LyxArrayBase(const LyxArrayBase&); + LyxArrayBase(LyxArrayBase const &); /// ~LyxArrayBase(); /// - int Empty() { return (last == 0); } + int empty() const { return (last == 0); } /// int Last() { return last; } @@ -62,16 +62,16 @@ public: void Remove(int pos, int dx); /// Merge dx elements from array a at pos. Changes the size if necessary. - void Merge(LyxArrayBase *a, int pos, int dx); + void Merge(LyxArrayBase * a, int pos, int dx); /// Same as Merge but doesn't changes the size (dangerous) - void MergeF(LyxArrayBase *a, int pos, int dx); + void MergeF(LyxArrayBase * a, int pos, int dx); /// Copy dx byts from an array at position pos void Copy(void *, int pos, int dx); /// Constructs a new array with dx elements starting at pos - LyxArrayBase* Extract(int pos, int dx); + LyxArrayBase * Extract(int pos, int dx); /// Insert a character at position pos void Insert(int pos, byte); @@ -83,7 +83,7 @@ public: byte operator[](const int); /// Constructs a new array with dx elements starting at pos - LyxArrayBase& operator= (const LyxArrayBase&); + LyxArrayBase & operator= (LyxArrayBase const &); protected: /// @@ -92,7 +92,7 @@ protected: bool Move(int p, int shift); /// Buffer - byte *bf; + byte * bf; /// Last position inserted. int last; /// Max size of the array. diff --git a/src/mathed/math_draw.C b/src/mathed/math_draw.C index 95f01c853f..c55c194c7d 100644 --- a/src/mathed/math_draw.C +++ b/src/mathed/math_draw.C @@ -59,7 +59,7 @@ MathParInset::Draw(int x, int y) bool limits = false; xo = x; yo = y; - if (!array || array->Empty()) { + if (!array || array->empty()) { mathed_set_font(LM_TC_VAR, 1); if (array) { MathedXIter data(this); @@ -155,7 +155,7 @@ MathParInset::Metrics() width = df_width; descent = 0; if (!array) return; - if (array->Empty()) return; + if (array->empty()) return; ascent = 0; MathedXIter data(this); diff --git a/src/mathed/math_iter.C b/src/mathed/math_iter.C index 2ea46c45b0..2f9a13d2e6 100644 --- a/src/mathed/math_iter.C +++ b/src/mathed/math_iter.C @@ -866,7 +866,7 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent) descent = ascent = width = 0; if (!array) return; - if (array->Empty()) return; + if (array->empty()) return; // if (pos2 > array->last) return; x1 = x; while (poslast<= 1; } + int Empty() { return array->Last()<= 1; } /// - int OK() { return array && (pos < array->last); } + int OK() { return array && (pos < array->Last()); } /// int IsFirst() { return (pos == 0); } /// @@ -268,48 +268,48 @@ class MathedXIter: public MathedIter { inline bool MathedIter::IsInset() { - return MathIsInset(array->bf[pos]); + return MathIsInset((*array)[pos]); } inline bool MathedIter::IsActive() { - return MathIsActive(array->bf[pos]); + return MathIsActive((*array)[pos]); } inline bool MathedIter::IsFont() { - return MathIsFont(array->bf[pos]); + return MathIsFont((*array)[pos]); } inline bool MathedIter::IsScript() { - return MathIsScript(array->bf[pos]); + return MathIsScript((*array)[pos]); } inline bool MathedIter::IsTab() { - return (array->bf[pos] == LM_TC_TAB); + return ((*array)[pos] == LM_TC_TAB); } inline bool MathedIter::IsCR() { - return (array->bf[pos] == LM_TC_CR); + return ((*array)[pos] == LM_TC_CR); } inline -MathedIter::MathedIter(LyxArrayBase *d): array(d) +MathedIter::MathedIter(LyxArrayBase * d): array(d) { pos = 0; row = col = 0; - fcode = (array && IsFont()) ? array->bf[0]: 0; + fcode = (array && IsFont()) ? (*array)[0]: 0; } diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C index 3cfdf86f47..cedcde2c4b 100644 --- a/src/mathed/math_panel.C +++ b/src/mathed/math_panel.C @@ -268,7 +268,7 @@ extern "C" int align_filter(FL_OBJECT *, char const *, char const * cur, int c) } -char ** mathed_get_pixmap_from_icon(int d) +char const ** mathed_get_pixmap_from_icon(int d) { switch (d) { case MM_FRAC: return frac; @@ -293,20 +293,20 @@ FD_panel * create_math_panel( ) /* fill-in form initialization code */ fl_set_button(fd_delim->left, 1); - fl_set_pixmap_data(fd_delim->pix, delim0); + fl_set_pixmap_data(fd_delim->pix, const_cast(delim0)); fl_set_bmtable_data(fd_delim->menu, 6, 4, delim_width, delim_height, delim_bits); fl_set_bmtable_maxitems(fd_delim->menu, 23); - fl_set_pixmap_data(fd_panel->sqrt, sqrt); - fl_set_pixmap_data(fd_panel->frac, frac); - fl_set_pixmap_data(fd_panel->delim, delim); - fl_set_pixmap_data(fd_panel->deco, deco); - fl_set_pixmap_data(fd_panel->space, space_xpm); - fl_set_pixmap_data(fd_panel->matrix, matrix); - fl_set_pixmap_data(fd_panel->equation, equation); + fl_set_pixmap_data(fd_panel->sqrt, const_cast(sqrt)); + fl_set_pixmap_data(fd_panel->frac, const_cast(frac)); + fl_set_pixmap_data(fd_panel->delim, const_cast(delim)); + fl_set_pixmap_data(fd_panel->deco, const_cast(deco)); + fl_set_pixmap_data(fd_panel->space, const_cast(space_xpm)); + fl_set_pixmap_data(fd_panel->matrix, const_cast(matrix)); + fl_set_pixmap_data(fd_panel->equation, const_cast(equation)); - for (int i= 0; i<32; i++) { + for (int i = 0; i < 32; ++i) { fl_add_browser_line(fd_panel->func_browse, func_code[i]); } diff --git a/src/mathed/math_panel.h b/src/mathed/math_panel.h index 4d33d0aba7..de617892cf 100644 --- a/src/mathed/math_panel.h +++ b/src/mathed/math_panel.h @@ -65,8 +65,9 @@ protected: ~BitmapMenu(); /// FL_OBJECT * AddBitmap(int id, - int nx, int ny, int bw, int bh, - unsigned char * data, Bool vert= True); // Why Bool? + int nx, int ny, int bw, int bh, + unsigned char const * data, + Bool vert= True); // Why Bool? /// void Create(); /// diff --git a/src/mathed/math_symbols.C b/src/mathed/math_symbols.C index 347424bf3e..c8df4a9b45 100644 --- a/src/mathed/math_symbols.C +++ b/src/mathed/math_symbols.C @@ -42,11 +42,11 @@ using std::max; extern void SmallUpdate(signed char); extern void BeforeChange(); extern void Update(signed char); -extern int UnlockInset(UpdatableInset*); +extern int UnlockInset(UpdatableInset *); extern short greek_kb_flag; -extern MiniBuffer *minibuffer; +extern MiniBuffer * minibuffer; -extern BufferView *current_view; +extern BufferView * current_view; /* Bitmaps */ #include "greek.xbm" @@ -58,7 +58,7 @@ extern BufferView *current_view; #include "dots.xbm" /* Latex code for those bitmaps */ -static char const *latex_greek[] = { +static char const * latex_greek[] = { "Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", "Sigma", "Upsilon", "Phi", "Psi", "Omega", "alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta", @@ -67,7 +67,7 @@ static char const *latex_greek[] = { "tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", "" }; -static char const *latex_brel[] = { +static char const * latex_brel[] = { "leq", "geq", "equiv", "models", "prec", "succ", "sim", "perp", "preceq", "succeq", "simeq", "mid", @@ -79,7 +79,7 @@ static char const *latex_brel[] = { "vdash", "dashv", "bowtie", "" }; -static char const* latex_arrow[] = { +static char const * latex_arrow[] = { "downarrow", "leftarrow", "Downarrow", "Leftarrow", "hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow", "hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup", @@ -90,7 +90,7 @@ static char const* latex_arrow[] = { "nwarrow", "nearrow", "swarrow", "searrow", "", }; -char const* latex_varsz[] = { +char const * latex_varsz[] = { "sum", "int", "oint", "prod", "coprod", "bigsqcup", "bigotimes", "bigodot", "bigoplus", @@ -98,7 +98,7 @@ char const* latex_varsz[] = { "bigvee", "bigwedge", "" }; -static char const* latex_bop[] = { +static char const * latex_bop[] = { "pm", "cap", "diamond", "oplus", "mp", "cup", "bigtriangleup", "ominus", "times", "uplus", "bigtriangledown", "otimes", @@ -109,7 +109,7 @@ static char const* latex_bop[] = { "bullet", "wr", "ddagger", "" }; -static char const* latex_misc[] = { +static char const * latex_misc[] = { "nabla", "partial", "infty", "prime", "ell", "emptyset", "exists", "forall", "imath", "jmath", "Re", "Im", "aleph", "wp", "hbar", @@ -118,7 +118,7 @@ static char const* latex_misc[] = { "diamondsuit", "heartsuit", "clubsuit", "spadesuit", "" }; -static char const* latex_dots[] = { +static char const * latex_dots[] = { "ldots", "cdots", "vdots", "ddots" }; @@ -132,15 +132,16 @@ static signed char Latin2Greek[] = { 5, 2, -1, 6, -1, 7, -1, 10, 4, 9, -1 }; -extern char** mathed_get_pixmap_from_icon(int d); +extern char const ** mathed_get_pixmap_from_icon(int d); extern "C" void math_cb(FL_OBJECT*, long); -static char** pixmapFromBitmapData(char const *, int, int); -void math_insert_symbol(char const* s); +static char const ** pixmapFromBitmapData(char const *, int, int); +void math_insert_symbol(char const * s); Bool math_insert_greek(char const c); -BitmapMenu *BitmapMenu::active = 0; +BitmapMenu * BitmapMenu::active = 0; -BitmapMenu::BitmapMenu(int n, FL_OBJECT* bt, BitmapMenu* prevx): nb(n) { +BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx): nb(n) +{ w = h = 0; form = 0; i = 0; @@ -156,20 +157,26 @@ BitmapMenu::BitmapMenu(int n, FL_OBJECT* bt, BitmapMenu* prevx): nb(n) { prev->next = this; } -BitmapMenu::~BitmapMenu() { + +BitmapMenu::~BitmapMenu() +{ if (next) delete next; if (form->visible) Hide(); fl_free_form(form); delete[] bitmap; } -void BitmapMenu::Hide() { + +void BitmapMenu::Hide() +{ fl_hide_form(form); fl_set_button(button, 0); active = 0; } -void BitmapMenu::Show() { + +void BitmapMenu::Show() +{ if (active) active->Hide(); active = this; @@ -179,15 +186,15 @@ void BitmapMenu::Show() { fl_show_form(form, FL_PLACE_MOUSE, FL_NOBORDER, ""); } -FL_OBJECT* -BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char* data, Bool vert) +FL_OBJECT * +BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char const * data, Bool vert) { - if (i>= nb) + if (i >= nb) return 0; - int wx= bw+ww/2, wy= bh+ww/2; + int wx = bw+ww/2, wy = bh+ww/2; wx += (wx % nx); wy += (wy % ny); - FL_OBJECT *obj = fl_create_bmtable(1, x, y, wx, wy, ""); + FL_OBJECT * obj = fl_create_bmtable(1, x, y, wx, wy, ""); fl_set_object_callback(obj, math_cb, id); fl_set_object_lcol(obj, FL_BLUE); fl_set_object_boxtype(obj, FL_UP_BOX); @@ -308,10 +315,10 @@ extern "C" void math_cb(FL_OBJECT* ob, long data) menu->Hide(); } -char** get_pixmap_from_symbol(char const *arg, int wx, int hx) +char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx) { - char** data= 0; - latexkeys *l = in_word_set (arg, strlen(arg)); + char const ** data = 0; + latexkeys * l = in_word_set (arg, strlen(arg)); if (!l) return 0; @@ -337,10 +344,10 @@ char** get_pixmap_from_symbol(char const *arg, int wx, int hx) Bool math_insert_greek(char const c) { int i; - char const *s= 0; + char const * s= 0; - if ('A'<= c && c<= 'Z') { - if ((i= Latin2Greek[c - 'A'])>= 0) + if ('A' <= c && c <= 'Z') { + if ((i = Latin2Greek[c - 'A']) >= 0) s = latex_greek[i]; } if ('a'<= c && c<= 'z') { @@ -430,15 +437,15 @@ void create_symbol_menues(FD_panel * symb_form) } static -char** pixmapFromBitmapData(char const *s, int wx, int hx) +char const ** pixmapFromBitmapData(char const * s, int wx, int hx) { - int i, id; - char** data= 0; + int i; + char const ** data = 0; - id= -1; + int id = -1; - for (i= 0; i<6; i++) { - char const **latex_str = 0; + for (i = 0; i < 6; ++i) { + char const ** latex_str = 0; switch (i) { case 0: latex_str = latex_greek; break; case 1: latex_str = latex_bop; break; @@ -454,10 +461,10 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx) break; } } - if (id>= 0) break; + if (id >= 0) break; } - if (i<6 && id>= 0) { - unsigned char *bdata = 0; + if (i < 6 && id >= 0) { + unsigned char const * bdata = 0; int w = 0, h = 0, dw = 0, dh = 0; lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl; @@ -523,21 +530,21 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx) } int ww = w/dw, hh = h/dh, x, y; - XImage *xima = XCreateImage(fl_display, 0, 1, XYBitmap, 0, - reinterpret_cast(bdata), w, h, 8, 0); + XImage * xima = XCreateImage(fl_display, 0, 1, XYBitmap, 0, + const_cast(reinterpret_cast(bdata)), w, h, 8, 0); xima->byte_order = LSBFirst; xima->bitmap_bit_order = LSBFirst; x = (id % dw)*ww; y = (id/dw)*hh; - if (ww>wx) ww = wx; - if (hh>hx) hh = hx; - XImage *sbima = XSubImage(xima, x, y, ww, hh); - XpmCreateDataFromImage(fl_display, &data, sbima, sbima, 0); + if (ww > wx) ww = wx; + if (hh > hx) hh = hx; + XImage * sbima = XSubImage(xima, x, y, ww, hh); + XpmCreateDataFromImage(fl_display, const_cast(&data), sbima, sbima, 0); // Dirty hack to get blue symbols quickly - char *sx = strstr(data[2], "FFFFFFFF"); + char * sx = strstr(data[2], "FFFFFFFF"); if (sx) { - for (int k= 0; k<8; k++) sx[k] = '0'; + for (int k = 0; k < 8; ++k) sx[k] = '0'; } // XDestroyImage(xima); diff --git a/src/support/filetools.C b/src/support/filetools.C index e8baacf306..e29bbcdd02 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -616,7 +616,6 @@ bool AbsolutePath(string const & path) // Supports ./ and ~/. Later we can add support for ~logname/. (Asger) string ExpandPath(string const & path) { - Assert(!path.empty()); // We don't allow empty path. (Lgb) // checks for already absolute path string RTemp = ReplaceEnvironmentPath(path); if (AbsolutePath(RTemp)) @@ -700,7 +699,6 @@ string CleanupPath(string const & path) string ReplaceEnvironmentPath(string const & path) { - Assert(!path.empty()); // We don't allow empty path. (Lgb) // // CompareChar: Environmentvariables starts with this character // PathChar: Next path component start with this character diff --git a/src/toolbar.C b/src/toolbar.C index c63d8fa9f0..c950b4579f 100644 --- a/src/toolbar.C +++ b/src/toolbar.C @@ -95,7 +95,7 @@ // this one is not "C" because combox callbacks are really C++ %-| extern void LayoutsCB(int, void*); -extern char** get_pixmap_from_symbol(char const *arg, int, int); +extern char const ** get_pixmap_from_symbol(char const * arg, int, int); extern LyXAction lyxaction; @@ -139,23 +139,25 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y) // timer-cb for bubble-help (Matthias) void Toolbar::BubbleTimerCB(FL_OBJECT *, long data) { - FL_OBJECT* ob = (FL_OBJECT*) data; - char* help = (char*) ob->u_vdata; + FL_OBJECT * ob = reinterpret_cast(data); + char* help = static_cast(ob->u_vdata); fl_show_oneliner(help, ob->form->x + ob->x, ob->form->y + ob->y + ob->h); } -extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT *ob, long data) + +extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data) { Toolbar::BubbleTimerCB(ob, 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*/) { - string help = (char *)ob->u_vdata; - Toolbar *t = (Toolbar*)ob->u_ldata; + string help = static_cast(ob->u_vdata); + Toolbar * t = reinterpret_cast(ob->u_ldata); if(event == FL_ENTER && !help.empty()){ fl_set_object_callback(t->bubble_timer, @@ -169,17 +171,19 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event, return 0; } -extern "C" int C_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) + int key, void * xev) { return Toolbar::BubblePost(ob, event, 0, 0, key, xev); } + void Toolbar::activate() { - toolbarItem *item, *tmp= 0; - item = toollist; + toolbarItem * tmp= 0; + toolbarItem * item = toollist; while(item){ tmp = item->next; if (item->icon) { @@ -192,8 +196,8 @@ void Toolbar::activate() void Toolbar::deactivate() { - toolbarItem *item, *tmp= 0; - item = toollist; + toolbarItem * tmp= 0; + toolbarItem * item = toollist; while(item){ tmp = item->next; if (item->icon) { @@ -204,20 +208,22 @@ void Toolbar::deactivate() } -void Toolbar::ToolbarCB(FL_OBJECT *ob, long ac) +void Toolbar::ToolbarCB(FL_OBJECT * ob, long ac) { - Toolbar *t = (Toolbar*)ob->u_ldata; + Toolbar * t = reinterpret_cast(ob->u_ldata); string res = t->owner->getLyXFunc()->Dispatch(int(ac)); if(!res.empty()) lyxerr[Debug::TOOLBAR] << res << endl; } -extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT *ob, long data) + +extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data) { Toolbar::ToolbarCB(ob, data); } + int Toolbar::get_toolbar_func(string const & func) { int action = lyxaction.LookupFunc(func.c_str()); @@ -271,9 +277,8 @@ void Toolbar::set(bool doingmain) // we shouldn't set if we have not cleaned if (!cleaned) return; - toolbarItem *item; - FL_OBJECT *obj; - item = toollist; + FL_OBJECT * obj; + toolbarItem * item = toollist; if (!doingmain) { fl_freeze_form(owner->getForm()); @@ -336,7 +341,7 @@ void Toolbar::set(bool doingmain) fl_set_object_posthandler(obj, C_Toolbar_BubblePost); - fl_set_pixmapbutton_data(obj, item->pixmap); + fl_set_pixmapbutton_data(obj, const_cast(item->pixmap)); item = item->next; // we must remember to update the positions xpos += buttonwidth; @@ -363,9 +368,9 @@ void Toolbar::set(bool doingmain) } -char **Toolbar::getPixmap(kb_action action, string const & arg) +char const **Toolbar::getPixmap(kb_action action, string const & arg) { - char **pixmap = unknown_xpm; //0 + char const ** pixmap = unknown_xpm; //0 switch(action){ case LFUN_MENUOPEN: pixmap = open_xpm; break; case LFUN_CLOSEBUFFER: pixmap = close_xpm; break; @@ -442,8 +447,8 @@ void Toolbar::add(int action, bool doclean) // first «hide» the toolbar buttons. This is not a real hide // actually it deletes and frees the button altogether. lyxerr << "Toolbar::add: «hide» the toolbar buttons." << endl; - toolbarItem *item, *tmp= 0; - item = toollist; + toolbarItem * tmp= 0; + toolbarItem * item = toollist; lightReset(); @@ -466,10 +471,10 @@ void Toolbar::add(int action, bool doclean) // there exist some special actions not part of // kb_action: SEPARATOR, LAYOUTS - char **pixmap = 0; + char const ** pixmap = 0; string help; - toolbarItem *newItem,*tmp; + toolbarItem * newItem, * tmp; if (lyxaction.isPseudoAction(action)) { string arg; @@ -524,8 +529,8 @@ void Toolbar::add(string const & func, bool doclean) void Toolbar::clean() { - toolbarItem *item, *tmp= 0; - item = toollist; + toolbarItem * tmp = 0; + toolbarItem * item = toollist; reset(); @@ -556,8 +561,8 @@ void Toolbar::push(int nth) if (nth == 0) return; - int count= 0; - toolbarItem *tmp = toollist; + int count = 0; + toolbarItem * tmp = toollist; while (tmp) { count++; if (count == nth) { @@ -571,7 +576,7 @@ void Toolbar::push(int nth) } -void Toolbar::read(LyXLex &lex) +void Toolbar::read(LyXLex & lex) { //consistency check if (lex.GetString() != "\\begin_toolbar") diff --git a/src/toolbar.h b/src/toolbar.h index 574bd5d12f..f610f5c746 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -1,14 +1,14 @@ // -*- C++ -*- /* This file is part of * ====================================================== -* -* LyX, The Document Processor -* Copyright (C) 1995 Matthias Ettrich -* -* This file is Copyright (C) 1996-1998 -* Lars Gullik Bjønnes -* -* ====================================================== */ + * + * LyX, The Document Processor + * Copyright (C) 1995 Matthias Ettrich + * + * This file is Copyright (C) 1996-1999 + * Lars Gullik Bjønnes + * + * ====================================================== */ #ifndef TOOLBAR_H #define TOOLBAR_H @@ -30,7 +30,7 @@ class Toolbar { public: /// - Toolbar(Toolbar const &, LyXView *o, int x, int y); + Toolbar(Toolbar const &, LyXView * o, int x, int y); /// Toolbar() @@ -63,22 +63,22 @@ public: }; /// - Combox *combox; + Combox * combox; /// - void read(LyXLex&); + void read(LyXLex &); /// sets up the default toolbar void init(); /// (re)sets the toolbar - void set(bool doingmain= false); + void set(bool doingmain = false); /** this is to be the entry point to the toolbar frame, where you can change the toolbar realtime. */ void edit(); /// add a new button to the toolbar. - void add(int , bool doclean= true); + void add(int , bool doclean = true); /// name of func instead of kb_action - void add(string const & , bool doclean= true); + void add(string const & , bool doclean = true); /// invokes the n'th icon in the toolbar void push(int); /// activates the toolbar @@ -87,29 +87,29 @@ public: void deactivate(); /// - static void ToolbarCB(FL_OBJECT*, long); + static void ToolbarCB(FL_OBJECT *, long); /// static void BubbleTimerCB(FL_OBJECT *, long); /// - static int BubblePost(FL_OBJECT *ob, int event, - FL_Coord mx, FL_Coord my, int key, void *xev); + static int BubblePost(FL_OBJECT * ob, int event, + FL_Coord mx, FL_Coord my, int key, void * xev); private: /// struct toolbarItem { /// - toolbarItem *next; + toolbarItem * next; /// int action; /// string help; /// - FL_OBJECT *icon; + FL_OBJECT * icon; /// bool IsBitmap; /// - char **pixmap; + char const ** pixmap; /// toolbarItem(){ next = 0; @@ -129,11 +129,11 @@ private: }; /// a list containing all the buttons - toolbarItem *toollist; + toolbarItem * toollist; /// - LyXView *owner; + LyXView * owner; /// - FL_OBJECT *bubble_timer; + FL_OBJECT * bubble_timer; /// Starting position int sxpos, sypos; /// @@ -152,7 +152,7 @@ private: bool cleaned; /// - char **getPixmap(kb_action, string const & arg = string()); + char const ** getPixmap(kb_action, string const & arg = string()); /// removes all toolbar buttons from the toolbar. void clean();