+ p.setCmdName("url");
+ owner->getDialogs()->createUrl( p.getAsString() );
+ }
+ break;
+
+ case LFUN_INSERT_URL:
+ {
+ InsetCommandParams p;
+ p.setFromString( argument );
+
+ InsetUrl * inset = new InsetUrl( p );
+ if (!owner->view()->insertInset(inset))
+ delete inset;
+ else
+ owner->view()->updateInset( inset, true );
+ }
+ break;
+
+ case LFUN_INSET_TEXT:
+ {
+ InsetText * new_inset = new InsetText;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_ERT:
+ {
+ InsetERT * new_inset = new InsetERT;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_EXTERNAL:
+ {
+ InsetExternal * new_inset = new InsetExternal;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_FOOTNOTE:
+ {
+ InsetFoot * new_inset = new InsetFoot;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_MARGINAL:
+ {
+ InsetMarginal * new_inset = new InsetMarginal;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_MINIPAGE:
+ {
+ InsetMinipage * new_inset = new InsetMinipage;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_FLOAT:
+ {
+ // check if the float type exist
+ if (floatList.typeExist(argument)) {
+ InsetFloat * new_inset = new InsetFloat(argument);
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ } else {
+ lyxerr << "Non-existant float type: "
+ << argument << endl;
+ }
+
+ }
+ break;
+
+ case LFUN_INSET_LIST:
+ {
+ InsetList * new_inset = new InsetList;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_THEOREM:
+ {
+ InsetTheorem * new_inset = new InsetTheorem;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_CAPTION:
+ {
+ // Do we have a locking inset...
+ if (owner->view()->the_locking_inset) {
+ lyxerr << "Locking inset code: "
+ << static_cast<int>(owner->view()->the_locking_inset->LyxCode());
+ InsetCaption * new_inset = new InsetCaption;
+ new_inset->setOwner(owner->view()->the_locking_inset);
+ new_inset->SetAutoBreakRows(true);
+ new_inset->SetDrawFrame(0, InsetText::LOCKED);
+ new_inset->SetFrameColor(0, LColor::footnoteframe);
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ }
+ break;
+
+ case LFUN_INSET_TABULAR:
+ {
+ int r = 2, c = 2;
+ if (!argument.empty())
+ sscanf(argument.c_str(),"%d%d", &r, &c);
+ InsetTabular * new_inset =
+ new InsetTabular(owner->buffer(), r, c);
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;