Martin Vermeer wrote:

> On Mon, Sep 29, 2003 at 09:47:17AM +0100, Angus Leeming spake thusly:
>  
> Next version. Hit it hard. Unless bad bugs come up, I think this is
> about ready to go in.

> BTW I think this should replace the existing minipage

stdmenus.ui will need the minipage entry removed.


This default arg seems out of sync with those in stdmenus.ui. Do you mean 
"Boxed"?
Index: src/factory.C
+       case LFUN_INSERT_BOX:
+                       if (arg.empty())
+                               arg = "Box";


Really?
Index: src/frontends/controllers/ControlBox.C
Index: src/frontends/controllers/ControlBox.h
+ * \author Angus Leeming


You can replace string("box") with plain old "box". The conversion is 
implicit.
Index: src/frontends/controllers/ControlBox.C
+       string const lfun = InsetBoxMailer::params2string(string("b
ox"), params());

Perhaps more to the point, do you need to pass "box" to 
InsetBoxMailer::params2string at all? InsetBoxMailer knows it is mailing 
boxes.


Put the new files in in alphabetical order please:
Index: src/frontends/controllers/Makefile.am
Index: src/frontends/xforms/Makefile.am
Index: src/insets/Makefile.am


This line is way too long...
Index: src/frontends/xforms/Dialogs.C
+char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", 
"branch", "box", "changes",


This stuff belongs in the InsetBoxParams constructor.
Index: src/insets/insetbox.C
+InsetBox::InsetBox(BufferParams const & bp, string const & label)
+       : InsetCollapsable(bp)
+{
+       params_.type = label;
+       params_.inner_box = true;
+       params_.use_parbox = false;
+       params_.pos ='t';
+       params_.hor_pos ='c';
+       params_.inner_pos ='t';
+       params_.width = LyXLength("100col%");
+       params_.special = "none";
+       params_.height = LyXLength("1in");
+       params_.height_special = "totalheight"; // default is 1\\totalheight


There is a class Translator (support/translator.h) that does exactly this:
+       typedef std::map<string, BoxType> BoxMapType;
+       static BoxMapType boxmap;
Please use it. Also, get this out of the header file and place it in 
namespace anonymous in the .C file.


Ditto, this:
+void InsetBox::setButtonLabel()
+       unsigned btype = boxmap[params_.type];
+       switch (btype) {
+       case Frameless:
+               params_.inner_box = "true";
+               if (params_.use_parbox)
+                       setLabel(_("Parbox"));
+               else
+                       setLabel(_("Minipage"));
+               break;
+       case Boxed:
+               setLabel(_("Boxed"));
+               break;
+       case ovalbox:
+               setLabel(_("ovalbox"));
+               break;
+       case Ovalbox:
+               setLabel(_("Ovalbox"));
+               break;

might well become
        setLabel(_(boxlabel_translator.find(params_.type)));


Surely it is up to InsetCollapsable to decide what to do on a button3 
press? I think that the whole case can go, so that control falls through 
to default.
+       case LFUN_INSET_EDIT:
+               if (cmd.button() == mouse_button::button3)
+                       return UNDISPATCHED;
+               return InsetCollapsable::localDispatch(cmd);


Replace this
+int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os) const
+{
+       int i = 0;
+       string const pt = params_.type;
+
+       i = inset.linuxdoc(buf, os);
+       return i;
+}
with this
+int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os) const
+{
+       return inset.linuxdoc(buf, os);;
+}

Ditto for docbook.


Don't need the name arg here:
+       InsetBoxMailer(string const & name, InsetBox & inset);

insetbox.h:
+class InsetBoxMailer : public MailInset {
+       static string const name_;
}

insetbox.C:
string const InsetBoxMailer::name_ = "box".


How about replacing those
+void InsetBoxParams::read(LyXLex & lex)
        if (lex.isOK()) {
                ...
        }
with
        if (!lex.isOK())
                return;
        ...
Just a thought.

Do you need the '[0]' bit. Suggests a broken data file.
+                       hor_pos = lex.getString()[0];




-- 
Angus

Reply via email to