+ switch (cmd.action()) {
+
+ case LFUN_INSET_MODIFY: {
+ InsetCommandParams p(LINE_CODE);
+ // FIXME UNICODE
+ InsetCommand::string2params(to_utf8(cmd.argument()), p);
+ if (p.getCmdName().empty()) {
+ cur.noScreenUpdate();
+ break;
+ }
+ cur.recordUndo();
+ setParams(p);
+ break;
+ }
+
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ break;
+ }
+}
+
+
+bool InsetLine::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action()) {
+ case LFUN_INSET_DIALOG_UPDATE:
+ case LFUN_INSET_MODIFY:
+ status.setEnabled(true);
+ return true;
+ default:
+ return InsetCommand::getStatus(cur, cmd, status);
+ }
+}
+
+
+void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
+ int const max_width = mi.base.textwidth;
+
+ Length const width(to_ascii(getParam("width")));
+ dim.wid = width.inPixels(mi.base);
+
+ // assure that the line inset is not outside of the window
+ // check that it doesn't exceed the outer boundary
+ if (dim.wid > max_width)
+ dim.wid = max_width;
+
+ // set a minimal width
+ int const minw = (dim.wid < 0) ? 24 : 4;
+ dim.wid = max(minw, abs(dim.wid));
+
+ Length height = Length(to_ascii(getParam("height")));
+ height_ = height.inPixels(mi.base);
+
+ // get the length of the parameters in pixels
+ Length offset = Length(to_ascii(getParam("offset")));
+ offset_ = offset.inPixels(mi.base);
+
+ dim.asc = max(fm.maxAscent(), offset_ + height_);
+ dim.des = max(fm.maxDescent(), - offset_);
+
+ // Cache the inset dimension
+ setDimCache(mi, dim);
+}
+
+
+Dimension const InsetLine::dimension(BufferView const & bv) const
+{
+ // We cannot use InsetCommand::dimension() as this returns the dimension
+ // of the button, which is not used here.
+ return Inset::dimension(bv);