]> git.lyx.org Git - features.git/commitdiff
Rob's followup (nr. 1 ;)
authorJohn Levon <levon@movementarian.org>
Tue, 27 Aug 2002 20:30:20 +0000 (20:30 +0000)
committerJohn Levon <levon@movementarian.org>
Tue, 27 Aug 2002 20:30:20 +0000 (20:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5127 a592a061-630c-0410-9148-cb99ea01b6c8

27 files changed:
lib/ChangeLog
lib/bind/cua.bind
lib/lyx2lyx/lyx2lyx
po/POTFILES.in
src/ChangeLog
src/buffer.C
src/bufferview_funcs.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QLImage.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/forms/form_graphics.fd
src/frontends/xforms/forms/form_preferences.fd
src/graphics/ChangeLog
src/graphics/GraphicsImage.C
src/graphics/GraphicsTypes.C [new file with mode: 0644]
src/graphics/GraphicsTypes.h
src/graphics/Makefile.am
src/insets/ChangeLog
src/insets/insetcite.C
src/insets/insetgraphicsParams.C
src/lyx_main.C
src/lyxrc.C
src/lyxrc.h
src/undo_funcs.h

index 2bbc2ba89f54fbdce563845310f07ef3ba74600a..de1db1616e78775f8c922ae76c2a3c736f8afcc7 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-28  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * lyx2lyx/lyx2lyx: add new format number "221"
+
 2002-08-25  John Levon  <levon@movementarian.org>
 
        * images/find-replace.xpm: add
index d602b3e2c2f1486ffa7076080e7486d7640c0fcf..a21316ccedcc994bef8efe411e65f489d0de40b1 100644 (file)
@@ -65,7 +65,7 @@
 \bind "C-S-V"                  "layout-paste"
 
 \bind "C-z"                    "undo"
-\bind "C-S-Z"                  "redo"
+\bind "C-S-z"                  "redo"
 
 \bind "~S-C-quotedbl"          "self-insert \""
 \bind "C-minus"                        "hyphenation-point-insert"
index 9d8a4ff00ef0fd2ad02650774b9cfa75fca42fec..f87b7ed77d350d6155edacbc4ba5a18eb74a6f53 100755 (executable)
@@ -37,7 +37,7 @@ opt.quiet = 0
 
 format = re.compile(r"(\d)[\.,]?(\d\d)")
 fileformat = re.compile(r"\\lyxformat\s*(\S*)")
-lst_ft = ["210", "215", "216", "217", "218", "220"]
+lst_ft = ["210", "215", "216", "217", "218", "220", "221"]
 
 def usage():
     print """Usage: lyx2lyx [options] file1
index ca6ca71010c61182409b0fd7fcb5b657ebb642e5..0736ed59c6c5fdd18cace8a490e7fb0e134d63d6 100644 (file)
@@ -8,7 +8,6 @@ src/converter.C
 src/CutAndPaste.C
 src/debug.C
 src/exporter.C
-src/ext_l10n.h
 src/FloatList.C
 src/frontends/controllers/biblio.C
 src/frontends/controllers/ButtonController.h
index 415aad0a8da73cc28dfce15433623069feb083c9..77b6d4cd9fdb7c730fd4cea433434cc2682100d0 100644 (file)
@@ -1,3 +1,13 @@
+2002-08-28  Rob Lahaye  <lahaye@snu.ac.kr>
+       * buffer.C: increment LYX_FORMAT to 221
+
+       * lyxrc.[Ch]: declare display_graphics as grfx::DisplayType and use
+       grfx::displayTranslator.find(foo); include graphics/GraphicsTypes.h.
+       
+       * lyxrc.C: use more "if (...) { } else { }" style (John's advice).
+
+       * lyx_main.C: call once the setDisplayTranslator(); is that okay here?
+       
 2002-08-27  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * factory.C (createInset): use LyXTextClass::floats
index 7ca44140d41768b8e67df6c6e8ff7e28f09fd5da..335037aa3de68bc79a34249505dec109b7fb2883 100644 (file)
@@ -147,7 +147,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-const int LYX_FORMAT = 220;
+const int LYX_FORMAT = 221;
 
 } // namespace anon
 
index 123ad1e70110b1e117db2648255c469d7ce413f3..7a9ebed408843a1319cfb44510f7aacb0bbd40aa 100644 (file)
@@ -88,10 +88,8 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc)
        else
                text->decDepth(bv);
        if (text->inset_owner)
-           bv->updateInset((Inset *)text->inset_owner, true);
+               bv->updateInset((Inset *)text->inset_owner, true);
        bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-       bv->owner()->message(_("Changed environment depth "
-                              "(in possible range, maybe not)"));
 }
 
 
index 5183adced2854aa60dacaf1858f9eb6a8350511f..6e0f345b3152315875af3bb52a8b4d33f39a97f4 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-25  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * QLImage.C: replace redundant xoffset_l and yoffset_t
+       calculation by something better.
+
 2002-08-25  John Levon  <levon@movementarian.org>
 
        * FileDialog.C:
index 7ff7a00f62365a1f41822932d6c19dcfafa8bed4..317a14475c83c2049f500c5a6aa9897c98f2eba9 100644 (file)
@@ -214,8 +214,9 @@ void QLImage::clip(Params const & params)
        if (new_width == pixmap_.width() && new_height == pixmap_.height())
                return;
 
-       int const xoffset_l = std::max(0, int(params.bb.xl));
-       int const yoffset_t = std::max(0, pixmap_.height() - int(params.bb.yt));
+       int const xoffset_l = params.bb.xl;
+       int const yoffset_t = ( pixmap_.height() > params.bb.yt ?
+                               pixmap_.height() - params.bb.yt : 0 );
 
        xformed_pixmap_.resize(new_width, new_height);
        QPainter p;
index dce80b7369ff4a4f4cfce3673bb7a94cd6322683..541d1e7488aec104ad3dd4e5f4eb7ac190f6c93e 100644 (file)
@@ -1,3 +1,14 @@
+2002-08-28  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * forms/form_graphics.fd:
+       * FormGraphics.C: re-implement the use of text_warning box.
+       
+       * forms/form_preferences.fd:
+       * FormPreferences.C: use displayTranslator, change display mode
+       from four radio buttons into one choice button.
+
+        * FormBibtex.C: fix SIGSEGV with [Choose] when no style is selected.
 2002-08-24  John Levon  <levon@movementarian.org>
 
        * xformsImage.C: fix build, add FIXME for Rob
index f4789cba6bd1a8d1d9b1f1fc8c16feb86766d591..9aae13e8c07c2f9a9ca46a35fd08331c00f6ef36 100644 (file)
@@ -116,10 +116,13 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
                }
        } else if (ob == dialog_->button_style_choose) {
                unsigned int selection = fl_get_browser(dialog_->browser_styles);
-               string const out_name =
-                       fl_get_browser_line(dialog_->browser_styles, selection);
+               if (!selection)
+                       return ButtonPolicy::SMI_NOOP;
+               
+               string const out_name = fl_get_browser_line(dialog_->browser_styles,
+                                                               selection);
                fl_set_input(dialog_->input_style,
-                       ChangeExtension(out_name, string()).c_str());
+                               ChangeExtension(out_name, string()).c_str());
        } else if (ob == dialog_->button_rescan) {
                fl_clear_browser(dialog_->browser_styles);
                controller().rescanBibStyles();
index ed4469a3ad4eaf2c867be501489082fa2cdcb4fb..befc213ac9da98478abac41e5f01c1394a70e53f 100644 (file)
@@ -36,6 +36,7 @@ using std::vector;
 namespace {
 
 // Bound the number of input characters
+int const SIZE_MAXDIGITS = 10;
 int const FILENAME_MAXCHARS = 1024;
 
 string defaultUnit("cm");
@@ -99,10 +100,15 @@ void FormGraphics::build()
 
         // width default is scaling, thus unsigned integer input
        fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
-       fl_set_input_filter(file_->input_height, fl_unsigned_float_filter);
+       fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
+
+
+       string const display_List = _("Default|Monochrome|Grayscale|Color|Do not display");
+       fl_addto_choice(file_->choice_display, display_List.c_str());
+       
+       string const width_list = _("Scale%%|") + choice_Length_All;
+       fl_addto_choice(file_->choice_width, width_list.c_str());
 
-       fl_addto_choice(file_->choice_display, _("Default|Monochrome|Grayscale|Color|Do not display")); 
-       fl_addto_choice(file_->choice_width, (_("Scale%%|") + choice_Length_All).c_str());
        fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
 
        bc().addReadOnly(file_->button_browse);   
@@ -250,7 +256,9 @@ void FormGraphics::apply()
        igp.filename = getString(file_->input_filename);
 
        igp.lyxscale = strToInt(getString(file_->input_lyxscale));
-       if (igp.lyxscale == 0) igp.lyxscale = 100;
+       if (igp.lyxscale == 0) {
+               igp.lyxscale = 100;
+       }
        
        switch (fl_get_choice(file_->choice_display)) {
                case 5: igp.display = grfx::NoDisplay; break;
@@ -264,10 +272,11 @@ void FormGraphics::apply()
        // first item in choice_width means scaling
        if (fl_get_choice(file_->choice_width) == 1) {
                igp.scale = strToInt(getString(file_->input_width));
-               if (igp.scale == 0) igp.scale = 100;
+               if (igp.scale == 0) {
+                       igp.scale = 100;
+               }
                igp.width = LyXLength();
-       }
-       else {
+       } else {
                igp.scale = 0;
                igp.width = getLyXLengthFromWidgets(file_->input_width,
                                                    file_->choice_width);
@@ -280,9 +289,9 @@ void FormGraphics::apply()
        igp.noUnzip = fl_get_button(file_->check_nounzip);
 
        // the bb section
-       if (!controller().bbChanged)    // different to the original one?
-               igp.bb = string();      // don't write anything
-       else {
+       if (!controller().bbChanged) { // different to the original one?
+               igp.bb = string();     // don't write anything
+       else {
                string bb;
                if (getString(bbox_->input_bb_x0).empty())
                        bb = "0 ";
@@ -312,8 +321,12 @@ void FormGraphics::apply()
        igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
        
        // map angle into -360 (clock-wise) to +360 (counter clock-wise)
-       while (igp.rotateAngle <= -360.0) igp.rotateAngle += 360.0;
-       while (igp.rotateAngle >=  360.0) igp.rotateAngle -= 360.0;
+       while (igp.rotateAngle <= -360.0) {
+               igp.rotateAngle += 360.0;
+       }
+       while (igp.rotateAngle >=  360.0) {
+               igp.rotateAngle -= 360.0;
+       }
        fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
 
        int const origin_pos = fl_get_choice(extra_->choice_origin);
@@ -350,11 +363,12 @@ void FormGraphics::update() {
        // set width input fields according to scaling or width/height input
        if (igp.scale) {
                fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+               fl_set_input_maxchars(file_->input_width, 0);
                fl_set_input(file_->input_width, tostr(igp.scale).c_str());
                fl_set_choice(file_->choice_width, 1);
-       }
-       else {
-               fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
+       } else {
+               fl_set_input_filter(file_->input_width, NULL);
+               fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
                updateWidgetsFromLength(file_->input_width,
                                        file_->choice_width, igp.width, defaultUnit);
        }
@@ -382,11 +396,10 @@ void FormGraphics::update() {
        // the extra section
        fl_set_input(extra_->input_rotate_angle,
                     tostr(igp.rotateAngle).c_str());
-       if (igp.rotateOrigin.empty())
-               fl_set_choice(extra_->choice_origin, 1);
-       else
-               fl_set_choice(extra_->choice_origin,
-                             1 + int(findPos(origins_, igp.rotateOrigin)) );
+
+       int const origin_pos = findPos(origins_, igp.rotateOrigin);
+       fl_set_choice(extra_->choice_origin, 1 + origin_pos);
+
        fl_set_button(extra_->check_subcaption, igp.subcaption);
        fl_set_input(extra_->input_subcaption, igp.subcaptionText.c_str());
        setEnabled(extra_->input_subcaption,
@@ -394,7 +407,9 @@ void FormGraphics::update() {
        fl_set_input(extra_->input_special, igp.special.c_str());
 
        // open dialog in the file-tab, whenever filename is empty
-       if (igp.filename.empty()) fl_set_folder(dialog_->tabfolder, file_->form);
+       if (igp.filename.empty()) {
+               fl_set_folder(dialog_->tabfolder, file_->form);
+       }
 }
 
 
@@ -405,7 +420,7 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
        // path, because the controller knows nothing about the doc-dir
        controller().bbChanged = false;
        if (bb_inset.empty()) {
-               lyxerr[Debug::GRAPHICS] << "update:: no BoundingBox" << endl;
+               lyxerr[Debug::GRAPHICS] << "FormGraphics::updateBB() [no BoundingBox]" << endl;
                string const bb = controller().readBB(filename);
                if (!bb.empty()) {
                        // get the values from the file
@@ -431,9 +446,11 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
 
        } else {
                // get the values from the inset
-               lyxerr[Debug::GRAPHICS] << "update:: igp has BoundingBox"
+               lyxerr[Debug::GRAPHICS] << "FormGraphics::updateBB(): igp has BoundingBox"
+                                       << " ["<< bb_inset << "]"
                                        << endl;
                controller().bbChanged = true;
+
                LyXLength anyLength;
                anyLength = LyXLength(token(bb_inset,' ',0));
                updateWidgetsFromLength(bbox_->input_bb_x0,
@@ -450,6 +467,7 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
        }
 }
 
+
 namespace {
 
 bool isValid(FL_OBJECT * ob)
@@ -474,8 +492,9 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                        fl_set_input(file_->input_filename, out_name.c_str());
                }
                if (controller().isFilenameValid(out_name) &&
-                   !controller().bbChanged)
+                   !controller().bbChanged) {
                        updateBB(out_name, string());
+               }
        } else if (ob == file_->input_width || ob == file_->input_height) {
                // disable aspectratio button in case of scaling or one of width/height is empty
                bool const disable = fl_get_choice(file_->choice_width) == 1 ||
@@ -489,11 +508,13 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                setEnabled(file_->choice_height, !scaling);
                
                // allow only integer intput for scaling; float otherwise
-               if (scaling)
+               if (scaling) {
                        fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
-               else
-                       fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
-
+                       fl_set_input_maxchars(file_->input_width, 0);
+               } else {
+                       fl_set_input_filter(file_->input_width, NULL);
+                       fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
+               }
 
                // disable aspectratio button in case of scaling or height input is empty
                bool const disable_aspectratio = scaling || getString(file_->input_height).empty();
@@ -530,18 +551,15 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
 
        }
 
-       // deactivate OK/ Apply buttons and
-       // spit out warnings if invalid
-       if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
-           ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
-           ob == file_->input_width || ob == file_->input_height) {
-               if (isValid(ob))
-                       clearMessage();
-               else {
-                       postWarning(_("Invalid Length!"));
-                       return ButtonPolicy::SMI_INVALID;
-               }
-       }
+       // check if the input is valid
+       bool const invalid = !isValid(file_->input_width) || !isValid(file_->input_height);
 
-       return ButtonPolicy::SMI_VALID;
+       // deactivate OK / Apply buttons and spit out warnings if invalid
+       if (invalid) {
+               postWarning(_("Invalid Length in Output size!"));
+               return ButtonPolicy::SMI_INVALID;
+       } else {
+               clearMessage();
+               return ButtonPolicy::SMI_VALID;
+       }
 }
index 0a317e270eb297a8a52188d46a979416633460da..6223b4f6ddc1bd02b02f5b7c99a4774f42b5155e 100644 (file)
@@ -42,6 +42,7 @@
 #include "support/LAssert.h"
 
 #include "graphics/GraphicsCache.h"
+#include "graphics/GraphicsTypes.h"
 
 #include <boost/bind.hpp>
 
@@ -1824,15 +1825,14 @@ void FormPreferences::LnFmisc::apply() const
        lyxrc.wheel_jump = static_cast<unsigned int>
                (fl_get_counter_value(dialog_->counter_wm_jump));
 
-       string const old_value = lyxrc.display_graphics;
-       if (fl_get_button(dialog_->radio_display_monochrome)) {
-               lyxrc.display_graphics = "monochrome";
-       } else if (fl_get_button(dialog_->radio_display_grayscale)) {
-               lyxrc.display_graphics = "grayscale";
-       } else if (fl_get_button(dialog_->radio_display_color)) {
-               lyxrc.display_graphics = "color";
-       } else {
-               lyxrc.display_graphics = "none";
+       // See FIXME below
+       // grfx::DisplayType old_value = lyxrc.display_graphics;
+       switch (fl_get_choice(dialog_->choice_display)) {
+               case 4: lyxrc.display_graphics = grfx::NoDisplay; break;
+               case 3: lyxrc.display_graphics = grfx::ColorDisplay; break;
+               case 2: lyxrc.display_graphics = grfx::GrayscaleDisplay; break;
+               case 1: lyxrc.display_graphics = grfx::MonochromeDisplay; break;
+               default: lyxrc.display_graphics = grfx::ColorDisplay; break;
        }
 
 #ifdef WITH_WARNINGS
@@ -1864,10 +1864,8 @@ void FormPreferences::LnFmisc::build()
        setPrehandler(dialog_->check_dialogs_iconify_with_main);
        setPrehandler(dialog_->check_preview_latex);
        setPrehandler(dialog_->counter_wm_jump);
-       setPrehandler(dialog_->radio_display_monochrome);
-       setPrehandler(dialog_->radio_display_grayscale);
-       setPrehandler(dialog_->radio_display_color);
-       setPrehandler(dialog_->radio_no_display);
+       
+       fl_addto_choice(dialog_->choice_display, _("Monochrome|Grayscale|Color|Do not display"));
 }
 
 
@@ -1886,10 +1884,7 @@ FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
                return lyxrc.getDescription(LyXRC::RC_AUTOSAVE);
        if (ob == dialog_->counter_wm_jump)
                return lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP);
-       if (ob == dialog_->radio_display_monochrome ||
-                ob == dialog_->radio_display_grayscale ||
-                ob == dialog_->radio_display_color ||
-                ob == dialog_->radio_no_display)
+       if (ob == dialog_->choice_display)
                return lyxrc.getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
        return string();
 }
@@ -1908,14 +1903,12 @@ void FormPreferences::LnFmisc::update()
        fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
        fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
 
-       if (lyxrc.display_graphics == "monochrome") {
-               fl_set_button(dialog_->radio_display_monochrome, 1);
-       } else if (lyxrc.display_graphics == "grayscale") {
-               fl_set_button(dialog_->radio_display_grayscale, 1);
-       } else if (lyxrc.display_graphics == "color") {
-               fl_set_button(dialog_->radio_display_color, 1);
-       } else {
-               fl_set_button(dialog_->radio_no_display, 1);
+       switch (lyxrc.display_graphics) {
+               case grfx::NoDisplay:           fl_set_choice(dialog_->choice_display, 4); break;
+               case grfx::ColorDisplay:        fl_set_choice(dialog_->choice_display, 3); break;
+               case grfx::GrayscaleDisplay:    fl_set_choice(dialog_->choice_display, 2); break;
+               case grfx::MonochromeDisplay:   fl_set_choice(dialog_->choice_display, 1); break;
+               default:                        fl_set_choice(dialog_->choice_display, 3); break;
        }
 }
 
index c3e41270b27fba73e00472e87bb87ad8eb263e39..91b3282b0ca85b28fea3b76a84645af61b1c2cb4 100644 (file)
@@ -10,13 +10,13 @@ SnapGrid: 5
 =============== FORM ===============
 Name: form_graphics
 Width: 510
-Height: 345
+Height: 340
 Number of Objects: 7
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 510 345
+box: 0 0 510 340
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -52,7 +52,7 @@ argument:
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 5 310 100 30
+box: 5 305 100 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -70,7 +70,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: RETURN_BUTTON
-box: 225 310 90 30
+box: 225 305 90 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -88,7 +88,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 415 310 90 30
+box: 415 305 90 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -106,7 +106,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 320 310 90 30
+box: 320 305 90 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -124,7 +124,7 @@ argument: 0
 --------------------
 class: FL_TEXT
 type: NORMAL_TEXT
-box: 5 280 500 25
+box: 5 275 500 25
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@@ -263,7 +263,7 @@ alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Don't unzip, when\nexporting to LaTeX|#u
+label: Do not unzip|#u
 shortcut: 
 resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
@@ -346,14 +346,14 @@ argument: 0
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 95 205 30 30
+box: 175 205 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: keep Aspect ratio|#A
+label: Maintain aspect ratio|#M
 shortcut: 
 resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
@@ -400,7 +400,7 @@ argument:
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 315 75 115 30
+box: 315 75 100 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
index 1a5b8c323365b4e9af43c5fd80c16c1031bace6e..1f400581a3651e986bc5943ada7a142cb35ce384 100644 (file)
@@ -1101,7 +1101,7 @@ argument: 0
 Name: form_preferences_lnf_misc
 Width: 450
 Height: 350
-Number of Objects: 16
+Number of Objects: 8
 
 --------------------
 class: FL_BOX
@@ -1121,24 +1121,6 @@ name:
 callback: 
 argument: 
 
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 15 15 255 210
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
@@ -1168,9 +1150,9 @@ alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Cursor follows scrollbar|#f
+label: Cursor follows scrollbar|#C
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: check_cursor_follows_scrollbar
 callback: C_FormBaseDeprecatedInputCB
@@ -1187,9 +1169,9 @@ alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Dialogs iconify with main window|#i
+label: Dialogs iconify with main window|#D
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: check_dialogs_iconify_with_main
 callback: C_FormBaseDeprecatedInputCB
@@ -1199,16 +1181,16 @@ argument: 0
 --------------------
 class: FL_COUNTER
 type: NORMAL_COUNTER
-box: 20 235 115 30
+box: 310 190 115 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_BLUE
-alignment: FL_ALIGN_RIGHT
+alignment: FL_ALIGN_TOP
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Wheel mouse jump
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: counter_wm_jump
 callback: C_FormBaseDeprecatedInputCB
@@ -1221,16 +1203,16 @@ argument: 0
 --------------------
 class: FL_COUNTER
 type: NORMAL_COUNTER
-box: 20 270 115 30
+box: 310 115 115 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_BLUE
-alignment: FL_ALIGN_RIGHT
+alignment: FL_ALIGN_TOP
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Autosave interval
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: counter_autosave
 callback: C_FormBaseDeprecatedInputCB
@@ -1241,168 +1223,41 @@ argument: 0
   sstep: 1
 
 --------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 10 10 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 285 35 30 30
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 15 185 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: in Monochrome|#M
+label: Instant Preview|#P
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: radio_display_monochrome
+name: check_preview_latex
 callback: C_FormBaseDeprecatedInputCB
 argument: 0
        value: 1
 
 --------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 285 65 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: in Grayscale|#G
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_display_grayscale
-callback: C_FormBaseDeprecatedInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 285 95 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: in Color|#C
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_display_color
-callback: C_FormBaseDeprecatedInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 285 125 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: Don't display|#D
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_no_display
-callback: C_FormBaseDeprecatedInputCB
-argument: 0
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 275 15 160 210
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: Display Graphics
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 15 230 420 75
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 305 40 130 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 15 185 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Instant Preview|#P
+label: Graphics display|#G
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_preview_latex
+name: choice_display
 callback: C_FormBaseDeprecatedInputCB
 argument: 0
-       value: 1
 
 =============== FORM ===============
 Name: form_preferences_spelloptions
index f247e47c848e3f9df5ef4f23025a7121ab6b4bbe..22281bbe1a5b41f8da25b7b3a4cf475a3ac93d06 100644 (file)
@@ -1,3 +1,12 @@
+2002-08-28  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * GraphicsImage.C: small style fix to width/height setting.
+
+       * GraphicsTypes.h: have a displayTranslator here.
+
+       * Makefile.am:
+       * GraphicsTypes.C: new file added for the setDisplayTranslator();
+
 2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
 
        * GraphicsImage.C:
index 96052c708ef91324cdb3a68673679fb76755195e..1a4a13193b9d4d7b7974d2a67720efa29eb1b2e7 100644 (file)
@@ -34,13 +34,15 @@ boost::function0<Image::FormatList> Image::loadableFormats;
 std::pair<unsigned int, unsigned int>
 Image::getScaledDimensions(Params const & params) const
 {
-       unsigned int width = getWidth();
-       unsigned int height = getHeight();
-
-       // scale only when value makes sense, i.e. not zero
+       // scale only when value > 0
+       unsigned int width;
+       unsigned int height;
        if (params.scale) {
-               width  = (width * params.scale) / 100;
-               height = (height * params.scale) / 100;
+               width  = (getWidth() * params.scale) / 100;
+               height = (getHeight() * params.scale) / 100;
+       } else {
+               width = getWidth();
+               height = getHeight();
        }
 
        lyxerr[Debug::GRAPHICS]
diff --git a/src/graphics/GraphicsTypes.C b/src/graphics/GraphicsTypes.C
new file mode 100644 (file)
index 0000000..0b49ed4
--- /dev/null
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+/**
+ *  \file GraphicsTypes.C
+ *  Copyright 2002 the LyX Team
+ *  Read the file COPYING
+ */
+
+#include "graphics/GraphicsTypes.h"
+
+namespace grfx {
+
+/// The translator between the Display enum and corresponding lyx string.
+Translator< DisplayType, string > displayTranslator(DefaultDisplay, "default");
+
+void setDisplayTranslator()
+{
+       /// This variable keeps a tab on whether the translator is set.
+       static bool done = false;
+
+       if (!done) {
+               done = true;
+
+               // Fill the display translator
+               displayTranslator.addPair(DefaultDisplay, "default");
+               displayTranslator.addPair(MonochromeDisplay, "monochrome");
+               displayTranslator.addPair(GrayscaleDisplay, "grayscale");
+               displayTranslator.addPair(ColorDisplay, "color");
+               displayTranslator.addPair(NoDisplay, "none");
+               
+               // backward compatibility for old lyxrc.display_graphics
+               displayTranslator.addPair(MonochromeDisplay, "mono");
+               displayTranslator.addPair(GrayscaleDisplay, "gray");
+               displayTranslator.addPair(NoDisplay, "no");
+       }
+}
+
+} // namespace grfx
index 053bcae5279926035618c04b512a0d2ebe4c5357..2fa791da8db58a560204398e8c54d086c71c252c 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef GRAPHICSTYPES_H
 #define GRAPHICSTYPES_H
 
+#include "support/translator.h"
+
 #ifdef __GNUG__
 #pragma interface
 #endif
@@ -60,6 +62,12 @@ namespace grfx {
                ///
                NoDisplay
        };
-}
+       
+       /// The translator between the Display enum and corresponding lyx string.
+       extern Translator< DisplayType, string > displayTranslator;
+
+       void setDisplayTranslator();
+       
+} // namespace grfx
 
 #endif // GRAPHICSTYPES_H
index f1c2982a4a93396a1eed76d108b618ac837b9e65..e2cec2ed04246ba4c7b3279ae93b2be2eab9b65e 100644 (file)
@@ -26,6 +26,7 @@ libgraphics_la_SOURCES = \
        GraphicsSupport.h \
        GraphicsSupport.C \
        GraphicsTypes.h \
+       GraphicsTypes.C \
        PreviewImage.h \
        PreviewImage.C \
        PreviewLoader.h \
index e32525a51e7bf5cc4460f711f09ab195c5809c89..bd0f37c9543556d1d20c139d4f72f47fd45be1ef 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-28  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * insetgraphicsParams.C: remove local displayTranslator and use
+       the one from graphics/GraphicsTypes.h.
+
 2002-08-27  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * insetfloat.C (wide): add BufferParams parameter
index 0105ddac3650503b22e5b667a38000360f7c55bf..f294cde0e60b632a7291ef2bc1969426f9d352ff 100644 (file)
@@ -353,6 +353,8 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os,
                os << "cite";
 
 #warning What is this code supposed to do? (Lgb)
+// my guess is that this is just waiting for when we support before,
+// so it's a oneliner. But this is very silly ! - jbl
 
 #if 1
        // The current strange code
index eb7d423074722edcd4d85b9edd43b99580420730..59e8269d03aab499704fbc90317d81de5770895c 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "graphics/GraphicsParams.h"
 
-#include "support/translator.h"
 #include "support/filetools.h"
 #include "support/lyxlib.h"
 #include "support/LOstream.h"
 
 using std::ostream;
 
-
-namespace {
-
-/// This variable keeps a tab on whether the translator was set with the
-/// translations.
-bool translatorsSet = false;
-
-/// This is the translator between the Display enum and corresponding lyx
-/// file strings.
-Translator< grfx::DisplayType, string >
-displayTranslator(grfx::DefaultDisplay, "default");
-
-} // namespace anon
-
-
 InsetGraphicsParams::InsetGraphicsParams()
 {
        init();
-       // Set translators
-       if (! translatorsSet) {
-               translatorsSet = true;
-               // Fill the display translator
-               displayTranslator.addPair(grfx::DefaultDisplay, "default");
-               displayTranslator.addPair(grfx::MonochromeDisplay, "monochrome");
-               displayTranslator.addPair(grfx::GrayscaleDisplay, "grayscale");
-               displayTranslator.addPair(grfx::ColorDisplay, "color");
-               displayTranslator.addPair(grfx::NoDisplay, "none");
-               
-               // backward compatibility for old lyxrc.display_graphics
-               displayTranslator.addPair(grfx::MonochromeDisplay, "mono");
-               displayTranslator.addPair(grfx::GrayscaleDisplay, "gray");
-               displayTranslator.addPair(grfx::NoDisplay, "no");
-       }
 }
 
 InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
@@ -173,7 +142,7 @@ void InsetGraphicsParams::Write(ostream & os) const
        if (lyxscale != 100)
                os << "\tlyxscale " << lyxscale << '\n';
        if (display != grfx::DefaultDisplay)
-               os << "\tdisplay " << displayTranslator.find(display) << '\n';
+               os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n';
        if (scale) {
                if (scale != 100)
                        os << "\tscale " << scale << '\n';
@@ -220,7 +189,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
        } else if (token == "display") {
                lex.next();
                string const type = lex.getString();
-               display = displayTranslator.find(type);
+               display = grfx::displayTranslator.find(type);
        } else if (token == "scale") {
                lex.next();
                scale = lex.getInteger();
@@ -325,12 +294,11 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
                }
        }
        
-       string mode;
-       if (display != grfx::DefaultDisplay)
-               mode = displayTranslator.find(display);
-       else
-               mode = displayTranslator.find(lyxrc.display_graphics);
-       pars.display = displayTranslator.find(mode);
+       if (display == grfx::DefaultDisplay) {
+               pars.display = lyxrc.display_graphics;
+       } else {
+               pars.display = display;
+       }
        
        // Override the above if we're not using a gui
        if (!lyxrc.use_gui) {
index d29b23455096cdaf9a50cd2f0e48143b183f80a2..6a8b7de19f5d15b200f7d02e4b6bc7e0158c7d2e 100644 (file)
@@ -24,6 +24,8 @@
 #include "gettext.h"
 #include "lyxlex.h"
 
+#include "graphics/GraphicsTypes.h"
+
 #include "bufferlist.h"
 #include "buffer.h"
 #include "lyxserver.h"
@@ -85,6 +87,11 @@ LyX::LyX(int & argc, char * argv[])
        toplevel_keymap.reset(new kb_keymap);
        defaultKeyBindings(toplevel_keymap.get());
 
+       // set the DisplayTranslator only once; should that be done here??
+       // if this should not be in this file, please also remove
+       // #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
+       grfx::setDisplayTranslator();
+       
        if (want_gui) {
                lyx_gui::parse_init(argc, argv);
        }
index 5fba5fd1348660fe57e42a31c7201575d4815008..a6cb86e308bd0506666c31df0d2a0d9f27d73124 100644 (file)
@@ -225,7 +225,7 @@ void LyXRC::setDefaults() {
        check_lastfiles = true;
        make_backup = true;
        backupdir_path.erase();
-       display_graphics = "color";
+       display_graphics = grfx::ColorDisplay;
        // Spellchecker settings:
 #ifdef USE_PSPELL
        use_pspell = true;
@@ -328,16 +328,17 @@ int LyXRC::read(string const & filename)
                case RC_BINDFILE:                     // RVDK_PATCH_5
                        if (lexrc.next()) {
                                string const tmp(lexrc.getString());
-                               if (hasBindFile)
+                               if (hasBindFile) {
                                        // We are already in the
                                        // "actually read bind file"
                                        // mode.
                                        ReadBindFile(tmp);
-                               else
+                               } else {
                                        // We are still in the "just
                                        // remember the name of the
                                        // bind file" mode.
                                        bind_file = tmp;
+                               }
                        }
                        break;
 
@@ -348,23 +349,21 @@ int LyXRC::read(string const & filename)
                        break;
 
                case RC_AUTORESET_OPTIONS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                auto_reset_options = lexrc.getBool();
+                       }
                        break;
 
                case RC_DISPLAY_GRAPHICS:
                        if (lexrc.next()) {
-                               display_graphics = lexrc.getString();
-                               // backward compatibility
-                               if (display_graphics == "mono") display_graphics = "monochrome";
-                               else if (display_graphics == "gray") display_graphics = "grayscale";
-                               else if (display_graphics == "no") display_graphics = "none";
+                               display_graphics = grfx::displayTranslator.find(lexrc.getString());
                        }
                        break;
 
                case RC_KBMAP:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                use_kbmap = lexrc.getBool();
+                       }
                        break;
 
                case RC_KBMAP_PRIMARY:
@@ -373,10 +372,11 @@ int LyXRC::read(string const & filename)
                                if (kmap.empty()) {
                                        // nothing
                                } else if (!LibFileSearch("kbd", kmap,
-                                                         "kmap").empty())
+                                                         "kmap").empty()) {
                                        primary_kbmap = kmap;
-                               else
+                               } else {
                                        lexrc.printError("LyX: Keymap `$$Token' not found");
+                               }
                        }
                        break;
 
@@ -386,116 +386,138 @@ int LyXRC::read(string const & filename)
                                if (kmap.empty()) {
                                        // nothing
                                } else if (!LibFileSearch("kbd", kmap,
-                                                         "kmap").empty())
+                                                         "kmap").empty()) {
                                        secondary_kbmap = kmap;
-                               else
+                               } else {
                                        lexrc.printError("LyX: Keymap `$$Token' not found");
+                               }
                        }
                        break;
 
                case RC_FONT_ENCODING:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                fontenc = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTER:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                printer = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINT_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_command = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTEVENPAGEFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_evenpage_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTODDPAGEFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_oddpage_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTPAGERANGEFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_pagerange_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTCOPIESFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_copies_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTCOLLCOPIESFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_collcopies_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTREVERSEFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_reverse_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTLANDSCAPEFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_landscape_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTTOPRINTER:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_to_printer = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINT_ADAPTOUTPUT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_adapt_output = lexrc.getBool();
+                       }
                        break;
 
                case RC_PRINTTOFILE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_to_file = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTFILEEXTENSION:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_file_extension = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTEXSTRAOPTIONS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_extra_options = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTSPOOL_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_spool_command = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTSPOOL_PRINTERPREFIX:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_spool_printerprefix = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTPAPERDIMENSIONFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_paper_dimension_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_PRINTPAPERFLAG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                print_paper_flag = lexrc.getString();
+                       }
                        break;
 
                case RC_CUSTOM_EXPORT_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                custom_export_command = lexrc.getString();
+                       }
                        break;
 
                case RC_CUSTOM_EXPORT_FORMAT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                custom_export_format = lexrc.getString();
+                       }
                        break;
 
                case RC_DEFAULT_PAPERSIZE:
@@ -527,78 +549,96 @@ int LyXRC::read(string const & filename)
                        break;
 
                case RC_VIEWDVI_PAPEROPTION:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                view_dvi_paper_option = lexrc.getString();
-                       else
+                       } else {
                                view_dvi_paper_option.erase();
+                       }
                        break;
 
                case RC_PS_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                ps_command = lexrc.getString();
+                       }
                        break;
 
                case RC_CHKTEX_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                chktex_command = lexrc.getString();
+                       }
                        break;
 
                case RC_SCREEN_DPI:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                dpi = lexrc.getInteger();
+                       }
                        break;
 
                case RC_SCREEN_ZOOM:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                zoom = lexrc.getInteger();
+                       }
                        break;
 
                case RC_WHEEL_JUMP:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                wheel_jump = lexrc.getInteger();
+                       }
                        break;
 
                case RC_SCREEN_FONT_SIZES:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_TINY] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_SCRIPT] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_FOOTNOTE] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_SMALL] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_NORMAL] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_LARGE] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_LARGER] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_LARGEST] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_HUGE] =
                                        lexrc.getFloat();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                font_sizes[LyXFont::SIZE_HUGER] =
                                        lexrc.getFloat();
+                       }
                        break;
 
                case RC_SCREEN_FONT_SCALABLE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                use_scalable_fonts = lexrc.getBool();
+                       }
                        break;
 
                case RC_AUTOSAVE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                autosave = lexrc.getInteger();
+                       }
                        break;
 
                case RC_DOCUMENTPATH:
@@ -608,48 +648,57 @@ int LyXRC::read(string const & filename)
                        break;
 
                case RC_TEMPLATEPATH:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                template_path = ExpandPath(lexrc.getString());
+                       }
                        break;
 
                case RC_TEMPDIRPATH:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                tempdir_path = ExpandPath(lexrc.getString());
+                       }
                        break;
 
                case RC_USETEMPDIR:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                use_tempdir = lexrc.getBool();
+                       }
                        break;
 
                case RC_LASTFILES:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                lastfiles = ExpandPath(lexrc.getString());
+                       }
                        break;
 
                case RC_NUMLASTFILES:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                num_lastfiles = lexrc.getInteger();
+                       }
                        break;
 
                case RC_CHECKLASTFILES:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                check_lastfiles = lexrc.getBool();
+                       }
                        break;
 
                case RC_SCREEN_FONT_ROMAN:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                roman_font_name = lexrc.getString();
+                       }
                        break;
 
                case RC_SCREEN_FONT_SANS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                sans_font_name = lexrc.getString();
+                       }
                        break;
 
                case RC_SCREEN_FONT_TYPEWRITER:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                typewriter_font_name = lexrc.getString();
+                       }
                        break;
 
                case RC_SCREEN_FONT_ENCODING:
@@ -660,18 +709,21 @@ int LyXRC::read(string const & filename)
                        break;
 
                case RC_POPUP_BOLD_FONT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                popup_bold_font = lexrc.getString();
+                       }
                        break;
 
                case RC_POPUP_NORMAL_FONT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                popup_normal_font = lexrc.getString();
+                       }
                        break;
 
                case RC_POPUP_FONT_ENCODING:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                popup_font_encoding = lexrc.getString();
+                       }
                        break;
 
                case RC_SET_COLOR:
@@ -692,16 +744,18 @@ int LyXRC::read(string const & filename)
                                break;
                        }
 
-                       if (!lcolor.setColor(lyx_name, x11_name))
+                       if (!lcolor.setColor(lyx_name, x11_name)) {
                                lyxerr << "Bad lyxrc set_color for "
                                        << lyx_name << endl;
 
+                       }
                        break;
                }
                case RC_AUTOREGIONDELETE:
                        // Auto region delete defaults to true
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                auto_region_delete = lexrc.getBool();
+                       }
                        break;
 
                case RC_BIND:
@@ -752,208 +806,256 @@ int LyXRC::read(string const & filename)
                        break;
                }
                case RC_OVERRIDE_X_DEADKEYS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                override_x_deadkeys = lexrc.getBool();
+                       }
                        break;
 
                case RC_SERVERPIPE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                lyxpipes = ExpandPath(lexrc.getString());
+                       }
                        break;
 
                case RC_CURSOR_FOLLOWS_SCROLLBAR:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                cursor_follows_scrollbar = lexrc.getBool();
+                       }
                        break;
 
                case RC_DIALOGS_ICONIFY_WITH_MAIN:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                dialogs_iconify_with_main = lexrc.getBool();
+                       }
                        break;
 
                case RC_ASCIIROFF_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                ascii_roff_command = lexrc.getString();
+                       }
                        break;
                case RC_ASCII_LINELEN:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                ascii_linelen = lexrc.getInteger();
+                       }
                        break;
                        // Spellchecker settings:
 #ifdef USE_PSPELL
                case RC_USE_PSPELL:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                use_pspell = lexrc.getBool();
+                       }
                        break;
 #endif
                case RC_SPELL_COMMAND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_command = lexrc.getString();
+                       }
                        break;
                case RC_ACCEPT_COMPOUND:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_accept_compound = lexrc.getBool();
+                       }
                        break;
                case RC_USE_INP_ENC:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_use_input_encoding = lexrc.getBool();
+                       }
                        break;
                case RC_USE_ALT_LANG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_use_alt_lang = lexrc.getBool();
+                       }
                        break;
                case RC_USE_PERS_DICT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_use_pers_dict = lexrc.getBool();
+                       }
                        break;
                case RC_USE_ESC_CHARS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_use_esc_chars = lexrc.getBool();
+                       }
                        break;
                case RC_ALT_LANG:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_alt_lang = lexrc.getString();
+                       }
                        break;
                case RC_PERS_DICT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_pers_dict = lexrc.getString();
+                       }
                        break;
                case RC_ESC_CHARS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                isp_esc_chars = lexrc.getString();
+                       }
                        break;
                case RC_MAKE_BACKUP:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                make_backup = lexrc.getBool();
+                       }
                        break;
                case RC_BACKUPDIR_PATH:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                backupdir_path = ExpandPath(lexrc.getString());
+                       }
                        break;
                case RC_DATE_INSERT_FORMAT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                date_insert_format = lexrc.getString();
+                       }
                        break;
                case RC_LANGUAGE_PACKAGE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_package = lexrc.getString();
+                       }
                        break;
                case RC_LANGUAGE_AUTO_BEGIN:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_auto_begin = lexrc.getBool();
+                       }
                        break;
                case RC_LANGUAGE_AUTO_END:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_auto_end = lexrc.getBool();
+                       }
                        break;
                case RC_LANGUAGE_GLOBAL_OPTIONS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_global_options = lexrc.getBool();
+                       }
                        break;
                case RC_LANGUAGE_USE_BABEL:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_use_babel = lexrc.getBool();
+                       }
                        break;
                case RC_LANGUAGE_COMMAND_BEGIN:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_command_begin = lexrc.getString();
+                       }
                        break;
                case RC_LANGUAGE_COMMAND_END:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_command_end = lexrc.getString();
+                       }
                        break;
                case RC_LANGUAGE_COMMAND_LOCAL:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                language_command_local = lexrc.getString();
+                       }
                        break;
                case RC_RTL_SUPPORT:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                rtl_support = lexrc.getBool();
+                       }
                        break;
                case RC_AUTO_NUMBER:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                auto_number = lexrc.getBool();
+                       }
                        break;
                case RC_MARK_FOREIGN_LANGUAGE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                mark_foreign_language = lexrc.getBool();
+                       }
                        break;
 
                case RC_CONVERTER: {
                        string from, to, command, flags;
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                from = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                to = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                command = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                flags = lexrc.getString();
-                       if (command.empty() || command == "none")
+                       }
+                       if (command.empty() || command == "none") {
                                converters.erase(from, to);
-                       else
+                       } else {
                                converters.add(from, to, command, flags);
+                       }
                        break;
                }
                case RC_VIEWER: {
                        string format, command;
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                format = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                command = lexrc.getString();
+                       }
                        formats.setViewer(format, command);
                        break;
                }
                case RC_FORMAT: {
                        string format, extension, prettyname, shortcut;
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                format = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                extension = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                prettyname = lexrc.getString();
-                       if (lexrc.next())
+                       }
+                       if (lexrc.next()) {
                                shortcut = lexrc.getString();
+                       }
                        if (prettyname.empty()) {
-                               if (converters.formatIsUsed(format))
+                               if (converters.formatIsUsed(format)) {
                                        lyxerr << "Can't delete format "
                                               << format << endl;
-                               else
+                               } else {
                                        formats.erase(format);
-
-                       } else
+                               }
+                       } else {
                                formats.add(format, extension, prettyname,
                                            shortcut);
+                       }
                        break;
                }
                case RC_DEFAULT_LANGUAGE:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                default_language = lexrc.getString();
+                       }
                        break;
 
                case RC_LABEL_INIT_LENGTH:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                label_init_length = lexrc.getInteger();
+                       }
                        break;
 
                case RC_SHOW_BANNER:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                show_banner = lexrc.getBool();
+                       }
                        break;
 
                case RC_PREVIEW:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                preview = lexrc.getBool();
+                       }
                        break;
 
                case RC_PREVIEW_HASHED_LABELS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                preview_hashed_labels = lexrc.getBool();
+                       }
                        break;
 
                case RC_PREVIEW_SCALE_FACTOR:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                preview_scale_factor = lexrc.getFloat();
+                       }
                        break;
 
                case RC_LAST: break; // this is just a dummy
@@ -1051,7 +1153,7 @@ void LyXRC::output(ostream & os) const
                if (display_graphics != system_lyxrc.display_graphics) {
                        os << "# Display graphics within LyX\n"
                           << "# monochrome|grayscale|color|none\n"
-                          << "\\display_graphics " << display_graphics
+                          << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
                           << "\n";
                }
 
index 33312a8f1bd42e3ff899861bacb9efb26ad548e3..a8a1951aebd7ebd1619ae84adf7ef1c58513bc64 100644 (file)
@@ -17,6 +17,7 @@
 #endif
 
 #include "bufferparams.h" // Just to get the enum BufferParams::PAPER_SIZE (sic)
+#include "graphics/GraphicsTypes.h"
 
 // #include <boost/utility.hpp>
 
@@ -341,7 +342,7 @@ enum LyXRCTags {
        ///
        int label_init_length;
        ///
-       string display_graphics;
+       grfx::DisplayType display_graphics;
        ///
        bool show_banner;
        ///
index 9f18ceb9700ec4c3d9a36826a1143c30166ecc5f..35e35443bcb42576a22d8ef710465d5334e0f972 100644 (file)
@@ -26,9 +26,10 @@ extern bool textUndo(BufferView *);
 extern bool textRedo(BufferView *);
 /// makes sure the next operation will be stored
 extern void finishUndo();
-/// this is dangerous and for internal use only
+/// Whilst undo is frozen, all actions do not get added
+/// to the undo stack
 extern void freezeUndo();
-/// this is dangerous and for internal use only
+/// Track undos again
 extern void unFreezeUndo();
 /// FIXME
 extern void setUndo(BufferView *, Undo::undo_kind kind,
@@ -39,8 +40,7 @@ extern void setRedo(BufferView *, Undo::undo_kind kind,
 /// FIXME
 extern void setCursorParUndo(BufferView *);
 
-// This is only used in one place. Need a nicer way.
-/// is the undo frozen
+/// Are we avoiding tracking undos currently ?
 extern bool undo_frozen;
 
 #endif // UNDO_FUNCS_H