X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBox.cpp;h=25911bc985f4f0b0612c1a0b4b8a0cc56e818652;hb=4a1be58591ea5a7431d9426abb27d8b946c634cb;hp=254f9ea840b4c84e825e6152df8b5f843cd2d314;hpb=7677e9487c1669735a2aa9b2356199c2f608fe15;p=lyx.git diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 254f9ea840..25911bc985 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -178,13 +178,13 @@ void InsetBox::metrics(MetricsInfo & m, Dimension & dim) const bool InsetBox::forceEmptyLayout(idx_type) const { - return !params_.inner_box; + return !params_.inner_box && params_.type != "Framed"; } bool InsetBox::showInsetDialog(BufferView * bv) const { - bv->showDialog("box", params2string(params_), + bv->showDialog("box", params2string(params_), const_cast(this)); return true; } @@ -223,18 +223,17 @@ bool InsetBox::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_INSET_MODIFY: if (cmd.getArg(0) == "changetype") flag.setOnOff(cmd.getArg(1) == params_.type); - else - flag.enabled(true); + flag.setEnabled(true); return true; case LFUN_INSET_DIALOG_UPDATE: - flag.enabled(true); + flag.setEnabled(true); return true; case LFUN_BREAK_PARAGRAPH: - if (params_.inner_box) + if (params_.inner_box || params_.type == "Framed") return InsetCollapsable::getStatus(cur, cmd, flag); - flag.enabled(false); + flag.setEnabled(false); return true; default: @@ -584,126 +583,19 @@ void InsetBoxParams::write(ostream & os) const void InsetBoxParams::read(Lexer & lex) { - if (!lex.isOK()) - return; - - lex.next(); - type = lex.getString(); - - if (!lex) - return; - - lex.next(); - string token; - token = lex.getString(); - if (!lex) - return; - if (token == "position") { - lex.next(); - // The [0] is needed. We need the first and only char in - // this string -- MV - pos = lex.getString()[0]; - } else { - lyxerr << "InsetBox::Read: Missing 'position'-tag!" << token << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "hor_pos") { - lex.next(); - hor_pos = lex.getString()[0]; - } else { - lyxerr << "InsetBox::Read: Missing 'hor_pos'-tag!" << token << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "has_inner_box") { - lex.next(); - inner_box = lex.getInteger(); - } else { - lyxerr << "InsetBox::Read: Missing 'has_inner_box'-tag!" << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "inner_pos") { - lex.next(); - inner_pos = lex.getString()[0]; - } else { - lyxerr << "InsetBox::Read: Missing 'inner_pos'-tag!" - << token << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "use_parbox") { - lex.next(); - use_parbox = lex.getInteger(); - } else { - lyxerr << "InsetBox::Read: Missing 'use_parbox'-tag!" << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "width") { - lex.next(); - width = Length(lex.getString()); - } else { - lyxerr << "InsetBox::Read: Missing 'width'-tag!" << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "special") { - lex.next(); - special = lex.getString(); - } else { - lyxerr << "InsetBox::Read: Missing 'special'-tag!" << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "height") { - lex.next(); - height = Length(lex.getString()); - } else { - lyxerr << "InsetBox::Read: Missing 'height'-tag!" << endl; - lex.pushToken(token); - } - - lex.next(); - token = lex.getString(); - if (!lex) - return; - if (token == "height_special") { - lex.next(); - height_special = lex.getString(); - } else { - lyxerr << "InsetBox::Read: Missing 'height_special'-tag!" << endl; - lex.pushToken(token); - } + lex.setContext("InsetBoxParams::read"); + lex >> type; + lex >> "position" >> pos; + lex >> "hor_pos" >> hor_pos; + lex >> "has_inner_box" >> inner_box; + if (type == "Framed") + inner_box = false; + lex >> "inner_pos" >> inner_pos; + lex >> "use_parbox" >> use_parbox; + lex >> "width" >> width; + lex >> "special" >> special; + lex >> "height" >> height; + lex >> "height_special" >> height_special; }