]> git.lyx.org Git - features.git/commitdiff
toolbar cleanup. JMarc, Lars, please see the fIXME. I haven't introduced the problem
authorJohn Levon <levon@movementarian.org>
Mon, 22 Jul 2002 20:52:40 +0000 (20:52 +0000)
committerJohn Levon <levon@movementarian.org>
Mon, 22 Jul 2002 20:52:40 +0000 (20:52 +0000)
but we are leaking icons on every vector resize ...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4751 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/LyXAction.C
src/commandtags.h
src/frontends/ChangeLog
src/frontends/Toolbar.C
src/frontends/Toolbar.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Toolbar_pimpl.C
src/frontends/xforms/Toolbar_pimpl.h
src/frontends/xforms/XFormsView.C
src/lyxfunc.C

index 87fdcb028a068307f6b4d40693f4294acd245733..cacc762abce871b1be956a5622d21d36399dbbca 100644 (file)
        * buffer.C (readFile): Run the lyxconvert script in order to read
        old files.
 
+2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
+
+       * LyXAction.C:
+       * commandtags.h:
+       * lyxfunc.C: remove LFUN_ADD_TO_TOOLBAR
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * LyXAction.C:
index 5a3439d205800bd92b2a750365e06cef662df219..d4b3381a3bab4719b28a476c0eb2347d907901c9 100644 (file)
@@ -382,7 +382,6 @@ void LyXAction::init()
                { LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
                  N_("Toggle cursor does/doesn't follow the scrollbar"),
                  ReadOnly },
-               { LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
                { LFUN_UNDO, "undo", N_("Undo"), Noop },
                { LFUN_UP, "up", "", ReadOnly },
                { LFUN_UPSEL, "up-select", "", ReadOnly },
index 9a1f75175e3cf5e3a41abcbbb70d841c559aa2dc..b817dfc968ed86f449ef8c217f264bf1778e7b46 100644 (file)
@@ -175,7 +175,6 @@ enum kb_action {
        LFUN_CAPITALIZE_WORD,
        LFUN_INSERT_LABEL,
        LFUN_REF_INSERT,
-       LFUN_ADD_TO_TOOLBAR,
        LFUN_DEPTH_MIN,   // 150        // RVDK_PATCH_5
        LFUN_DEPTH_PLUS,                // RVDK_PATCH_5
        LFUN_MENU_OPEN_BY_NAME,         // RVDK_PATCH_5
index 333fb7c61d0ff9dd20bce26e1a7821d0d523d57c..b946f93e9c63ec1c9b09fecd33c2b70c2871669d 100644 (file)
@@ -2,6 +2,11 @@
 
        * lyx_gui.h: add exit()
  
+2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Toolbar.h:
+       * Toolbar.C: remove other unused code
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * Toolbar.h:
index e105311042fcb54930eebbc41e91ad813a669e71..ad2d95313a358f4891f6101143f17aa70944cce4 100644 (file)
@@ -29,14 +29,11 @@ Toolbar::Toolbar(LyXView * o, Dialogs & d,
 {
        pimpl_ = new Pimpl(o, d, x, y);
 
-       pimpl_->reset();
-
        // extracts the toolbar actions from tbd
        for (ToolbarDefaults::const_iterator cit = tbd.begin();
             cit != tbd.end(); ++cit) {
                pimpl_->add((*cit));
-               lyxerr[Debug::GUI] << "tool action: "
-                                      << (*cit) << endl;
+               lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
        }
 }
 
@@ -47,12 +44,6 @@ Toolbar::~Toolbar()
 }
 
 
-void Toolbar::set(bool doingmain)
-{
-       pimpl_->set(doingmain);
-}
-
-
 void Toolbar::update()
 {
        pimpl_->update();
@@ -90,16 +81,3 @@ void Toolbar::clearLayoutList()
 {
        pimpl_->clearLayoutList();
 }
-
-
-void Toolbar::add(string const & func, bool doclean)
-{
-       int const tf = lyxaction.LookupFunc(func);
-
-       if (tf == -1) {
-               lyxerr << "Toolbar::add: no LyX command called`"
-                      << func << "'exists!" << endl;
-       } else {
-               pimpl_->add(tf, doclean);
-       }
-}
index 7fe691d0e15c1a5d9f5f1c33c89085869577ce6d..77c1bd52d92caecb247201c478f6e1202c385565 100644 (file)
@@ -36,16 +36,6 @@ public:
        ///
        ~Toolbar();
 
-       /// (re)sets the toolbar
-       void set(bool doingmain = false);
-
-       /** this is to be the entry point to the toolbar
-         frame, where you can change the toolbar realtime. */
-       void edit();
-       /// add a new button to the toolbar.
-       void add(int , bool doclean = true);
-       /// name of func instead of kb_action
-       void add(string const & , bool doclean = true);
        /// update the state of the icons
        void update();
 
index 0881b799f4950dcd554ad8048a5369baf383f9e5..2ca2856e577385c206ed0719a521623b179711b6 100644 (file)
@@ -1,3 +1,11 @@
+2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
+
+       * XFormsView.C: don't call toolbar_->set() 
+
+       * Toolbar_pimpl.h:
+       * Toolbar_pimpl.C: rationalise code, remove half-working
+         update stuff into simple add()
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: add lyx_gui::exit()
index c00c5d2313f34a9a629308f70971d385112e66cc..4367ed6a82a253b32f0b3ce8c4ed69adc8435dbe 100644 (file)
@@ -46,21 +46,22 @@ const int buttonwidth = 30; // the standard button width
 const int height = 30; // the height of all items in the toolbar
 
 Toolbar::Pimpl::toolbarItem::toolbarItem()
+       : action(LFUN_NOACTION), icon(0)
 {
-       action = LFUN_NOACTION;
-       icon = 0;
 }
 
 
 Toolbar::Pimpl::toolbarItem::~toolbarItem()
 {
-       // It seems that now this is taken care of
-       // in the XFormsView destructor. (Lgb)
-       // clean();
+       // Lars said here that ~XFormsView() dealt with the icons.
+       // This is not true. But enabling this causes crashes,
+       // because somehow we kill the same icon twice :(
+       // FIXME
+       //kill_icon();
 }
 
 
-void Toolbar::Pimpl::toolbarItem::clean()
+void Toolbar::Pimpl::toolbarItem::kill_icon()
 {
        if (icon) {
                fl_delete_object(icon);
@@ -73,16 +74,14 @@ void Toolbar::Pimpl::toolbarItem::clean()
 Toolbar::Pimpl::toolbarItem &
 Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
 {
-       // Are we assigning the object onto itself?
        if (this == &ti)
                return *this;
 
        // If we already have an icon, release it.
-       clean();
-
-       // do we have to check icon too?
+       // But we don't copy the icon from ti
+       kill_icon();
        action = ti.action;
-       icon = 0; // locally we need to get the icon anew
 
        return *this;
 }
@@ -90,53 +89,65 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
 
 
 Toolbar::Pimpl::Pimpl(LyXView * o, Dialogs & d, int x, int y)
-       : owner(static_cast<XFormsView *>(o)), sxpos(x), sypos(y)
+       : owner_(static_cast<XFormsView *>(o)), xpos(x), ypos(y)
 {
-       combox = 0;
+       combox_ = 0;
        tooltip_ = new Tooltips(d);
 }
 
 
 Toolbar::Pimpl::~Pimpl()
 {
-       clean();
+       fl_freeze_form(owner_->getForm());
+
+       // G++ vector does not have clear defined
+       //toollist.clear();
+       toollist_.erase(toollist_.begin(), toollist_.end());
+
+       delete combox_;
+
+       fl_unfreeze_form(owner_->getForm());
        delete tooltip_;
 }
 
 
 void Toolbar::Pimpl::update()
 {
-       ToolbarList::const_iterator p = toollist.begin();
-       ToolbarList::const_iterator end = toollist.end();
+       ToolbarList::const_iterator p = toollist_.begin();
+       ToolbarList::const_iterator end = toollist_.end();
        for (; p != end; ++p) {
-               if (p->icon) {
-                       FuncStatus status = owner->getLyXFunc()->getStatus(p->action);
-                       if (status.onoff(true)) {
-                               // I'd like to use a different color
-                               // here, but then the problem is to
-                               // know how to use transparency with
-                               // Xpm library. It seems pretty
-                               // complicated to me (JMarc)
-                               fl_set_object_color(p->icon, FL_LEFT_BCOL, FL_BLUE);
-                               fl_set_object_boxtype(p->icon, FL_DOWN_BOX);
-                       } else {
-                               fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
-                               fl_set_object_boxtype(p->icon, FL_UP_BOX);
-                       }
-                       if (status.disabled()) {
-                               // Is there a way here to specify a
-                               // mask in order to show that the
-                               // button is disabled? (JMarc)
-                               fl_deactivate_object(p->icon);
-                       }
-                       else
-                               fl_activate_object(p->icon);
-               } else if (p->action == ToolbarDefaults::LAYOUTS && combox) {
-                       if (owner->getLyXFunc()->getStatus(LFUN_LAYOUT).disabled())
-                               combox->deactivate();
+               if (p->action == ToolbarDefaults::LAYOUTS && combox_) {
+                       if (owner_->getLyXFunc()->getStatus(LFUN_LAYOUT).disabled())
+                               combox_->deactivate();
                        else
-                               combox->activate();
+                               combox_->activate();
+                       continue;
                }
+
+               if (!p->icon)
+                       continue;
+               FuncStatus const status = owner_->getLyXFunc()->getStatus(p->action);
+               if (status.onoff(true)) {
+                       // I'd like to use a different color
+                       // here, but then the problem is to
+                       // know how to use transparency with
+                       // Xpm library. It seems pretty
+                       // complicated to me (JMarc)
+                       fl_set_object_color(p->icon, FL_LEFT_BCOL, FL_BLUE);
+                       fl_set_object_boxtype(p->icon, FL_DOWN_BOX);
+               } else {
+                       fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
+                       fl_set_object_boxtype(p->icon, FL_UP_BOX);
+               }
+               if (status.disabled()) {
+                       // Is there a way here to specify a
+                       // mask in order to show that the
+                       // button is disabled? (JMarc)
+                       fl_deactivate_object(p->icon);
+               }
+               else
+                       fl_activate_object(p->icon);
        }
 }
 
@@ -152,15 +163,15 @@ void Toolbar::Pimpl::layoutSelectedCB(int, void * arg, Combox *)
 
 void Toolbar::Pimpl::layoutSelected()
 {
-       string const & layoutguiname = combox->getline();
+       string const & layoutguiname = combox_->getline();
        LyXTextClass const & tc =
-               owner->buffer()->params.getLyXTextClass();
+               owner_->buffer()->params.getLyXTextClass();
 
        LyXTextClass::const_iterator end = tc.end();
        for (LyXTextClass::const_iterator cit = tc.begin();
             cit != end; ++cit) {
                if (_((*cit)->name()) == layoutguiname) {
-                       owner->getLyXFunc()->dispatch(LFUN_LAYOUT, (*cit)->name());
+                       owner_->getLyXFunc()->dispatch(LFUN_LAYOUT, (*cit)->name());
                        return;
                }
        }
@@ -171,10 +182,10 @@ void Toolbar::Pimpl::layoutSelected()
 
 void Toolbar::Pimpl::setLayout(string const & layout)
 {
-       if (combox) {
+       if (combox_) {
                LyXTextClass const & tc =
-                       owner->buffer()->params.getLyXTextClass();
-               combox->select(_(tc[layout]->name()));
+                       owner_->buffer()->params.getLyXTextClass();
+               combox_->select(_(tc[layout]->name()));
        }
 }
 
@@ -182,39 +193,39 @@ void Toolbar::Pimpl::setLayout(string const & layout)
 void Toolbar::Pimpl::updateLayoutList(bool force)
 {
        // Update the layout display
-       if (!combox) return;
+       if (!combox_) return;
 
        // If textclass is different, we need to update the list
-       if (combox->empty() || force) {
-               combox->clear();
+       if (combox_->empty() || force) {
+               combox_->clear();
                LyXTextClass const & tc =
-                       owner->buffer()->params.getLyXTextClass();
+                       owner_->buffer()->params.getLyXTextClass();
                LyXTextClass::const_iterator end = tc.end();
                for (LyXTextClass::const_iterator cit = tc.begin();
                     cit != end; ++cit) {
                        // ignore obsolete entries
                        if ((*cit)->obsoleted_by().empty())
-                               combox->addline(_((*cit)->name()));
+                               combox_->addline(_((*cit)->name()));
                }
        }
        // we need to do this.
-       combox->redraw();
+       combox_->redraw();
 }
 
 
 void Toolbar::Pimpl::clearLayoutList()
 {
-       if (combox) {
-               combox->clear();
-               combox->redraw();
+       if (combox_) {
+               combox_->clear();
+               combox_->redraw();
        }
 }
 
 
 void Toolbar::Pimpl::openLayoutList()
 {
-       if (combox)
-               combox->show();
+       if (combox_)
+               combox_->show();
 }
 
 
@@ -285,160 +296,63 @@ void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height)
 } // namespace anon
 
 
-void Toolbar::Pimpl::set(bool doingmain)
+void Toolbar::Pimpl::add(int action)
 {
-       // we shouldn't set if we have not cleaned
-       if (!cleaned) return;
-
        FL_OBJECT * obj;
 
-       if (!doingmain) {
-               fl_freeze_form(owner->getForm());
-               fl_addto_form(owner->getForm());
-       }
-
-       ToolbarList::iterator item = toollist.begin();
-       ToolbarList::iterator end = toollist.end();
-       for (; item != end; ++item) {
-               switch (item->action) {
-               case ToolbarDefaults::SEPARATOR:
-                       xpos += sepspace;
-                       break;
-               case ToolbarDefaults::NEWLINE:
-                       // Not supported yet.
-                       break;
-               case ToolbarDefaults::LAYOUTS:
-                       xpos += standardspacing;
-                       if (!combox)
-                               combox = new Combox(FL_COMBOX_DROPLIST);
-                       combox->add(xpos, ypos, 135, height, 400);
-                       combox->setcallback(layoutSelectedCB, this);
-                       combox->resize(FL_RESIZE_ALL);
-                       combox->gravity(NorthWestGravity, NorthWestGravity);
-                       xpos += 135;
-                       break;
-               default:
-                       xpos += standardspacing;
-                       item->icon = obj =
-                               fl_add_pixmapbutton(FL_NORMAL_BUTTON,
-                                                   xpos, ypos,
-                                                   buttonwidth,
-                                                   height, "");
-                       fl_set_object_resize(obj, FL_RESIZE_ALL);
-                       fl_set_object_gravity(obj,
-                                             NorthWestGravity,
-                                             NorthWestGravity);
-                       fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
-                                              static_cast<long>(item->action));
-                       // Remove the blue feedback rectangle
-                       fl_set_pixmapbutton_focus_outline(obj, 0);
-
-                       // initialise the tooltip
-                       string const tip = _(lyxaction.helpText(obj->argument));
-                       tooltip_->init(obj, tip);
-
-                       // The view that this object belongs to.
-                       obj->u_vdata = owner;
-
-                       setPixmap(obj, item->action, buttonwidth, height);
-                       // we must remember to update the positions
-                       xpos += buttonwidth;
-                       // ypos is constant
-                       /* Here will come a check to see if the new
-                        * pos is within the bounds of the main frame,
-                        * and perhaps wrap the toolbar if not.
-                        */
-                       break;
-               }
-       }
-
-       if (!doingmain) {
-               fl_end_form();
-               fl_unfreeze_form(owner->getForm());
-               // Should be safe to do this here.
-               owner->updateLayoutChoice();
-       }
-
-       // set the state of the icons
-       //update();
-
-       cleaned = false;
-}
-
-
-void Toolbar::Pimpl::add(int action, bool doclean)
-{
-       if (doclean && !cleaned) clean();
-
-       // this is what we do if we want to add to an existing
-       // toolbar.
-       if (!doclean && owner) {
-               // first "hide" the toolbar buttons. This is not a real hide
-               // actually it deletes and frees the button altogether.
-               lyxerr << "Toolbar::add: \"hide\" the toolbar buttons."
-                      << endl;
-
-               lightReset();
-
-               fl_freeze_form(owner->getForm());
-
-               ToolbarList::iterator p = toollist.begin();
-               ToolbarList::iterator end = toollist.end();
-               for (; p != end; ++p) {
-                       p->clean();
-               }
-
-               if (combox) {
-                       delete combox;
-                       combox = 0;
-               }
-               fl_unfreeze_form(owner->getForm());
-               cleaned = true; // this is not completely true, but OK anyway
+       toolbarItem item;
+       item.action = action;
+       switch (action) {
+       case ToolbarDefaults::SEPARATOR:
+               xpos += sepspace;
+               break;
+       case ToolbarDefaults::NEWLINE:
+               // Not supported yet.
+               break;
+       case ToolbarDefaults::LAYOUTS:
+               xpos += standardspacing;
+               if (!combox_)
+                       combox_ = new Combox(FL_COMBOX_DROPLIST);
+               combox_->add(xpos, ypos, 135, height, 400);
+               combox_->setcallback(layoutSelectedCB, this);
+               combox_->resize(FL_RESIZE_ALL);
+               combox_->gravity(NorthWestGravity, NorthWestGravity);
+               xpos += 135;
+               break;
+       default:
+               xpos += standardspacing;
+               item.icon = obj =
+                       fl_add_pixmapbutton(FL_NORMAL_BUTTON,
+                                           xpos, ypos,
+                                           buttonwidth,
+                                           height, "");
+               fl_set_object_resize(obj, FL_RESIZE_ALL);
+               fl_set_object_gravity(obj,
+                                     NorthWestGravity,
+                                     NorthWestGravity);
+               fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
+                                      static_cast<long>(action));
+               // Remove the blue feedback rectangle
+               fl_set_pixmapbutton_focus_outline(obj, 0);
+
+               // initialise the tooltip
+               string const tip = _(lyxaction.helpText(obj->argument));
+               tooltip_->init(obj, tip);
+
+               // The view that this object belongs to.
+               obj->u_vdata = owner_;
+
+               setPixmap(obj, action, buttonwidth, height);
+               // we must remember to update the positions
+               xpos += buttonwidth;
+               // ypos is constant
+               /* Here will come a check to see if the new
+                * pos is within the bounds of the main frame,
+                * and perhaps wrap the toolbar if not.
+                */
+               break;
        }
-
-       // there exist some special actions not part of
-       // kb_action: SEPARATOR, LAYOUTS
-
-       toolbarItem newItem;
-       newItem.action = action;
-       toollist.push_back(newItem);
-}
-
-
-void Toolbar::Pimpl::clean()
-{
-       //reset(); // I do not understand what this reset() is, anyway
-
-       //now delete all the objects..
-       if (owner)
-               fl_freeze_form(owner->getForm());
-
-       // G++ vector does not have clear defined
-       //toollist.clear();
-       toollist.erase(toollist.begin(), toollist.end());
-
-       lyxerr[Debug::GUI] << "Combox: " << combox << endl;
-       if (combox) {
-               delete combox;
-               combox = 0;
-       }
-
-       if (owner)
-               fl_unfreeze_form(owner->getForm());
-       lyxerr[Debug::GUI] << "toolbar cleaned" << endl;
-       cleaned = true;
-}
-
-
-void Toolbar::Pimpl::reset()
-{
-       //toollist = 0; // what is this supposed to do?
-       cleaned = false;
-       lightReset();
-}
-
-
-void Toolbar::Pimpl::lightReset() {
-       xpos = sxpos - standardspacing;
-       ypos = sypos;
+       toollist_.push_back(item);
 }
index 348a1c276251f5812af236ebaaeb459c7c97d690..a872e8bd0ae0449f84645c70b9b41ef5569ac988 100644 (file)
@@ -31,20 +31,15 @@ struct Toolbar::Pimpl {
 public:
        /// called when user selects a layout from combox
        static void layoutSelectedCB(int, void *, Combox *);
-       ///
+       /// create an empty toolbar
        Pimpl(LyXView * o, Dialogs &, int x, int y);
-       ///
-       ~Pimpl();
 
-       /// (re)sets the toolbar
-       void set(bool doingmain = false);
+       ~Pimpl();
 
-       /** this is to be the entry point to the toolbar
-           frame, where you can change the toolbar realtime.
-       */
-       void edit();
        /// add a new button to the toolbar.
-       void add(int, bool doclean = true);
+       void add(int action);
+
        /// update the state of the icons
        void update();
 
@@ -59,51 +54,38 @@ public:
        /// the non-static version of layoutSelectedCB
        void layoutSelected();
 
-       ///
+       /// an item on the toolbar
        struct toolbarItem
        {
-               ///
-               int action;
-               ///
-               FL_OBJECT * icon;
-               ///
                toolbarItem();
-               ///
-               void clean();
-               ///
+
                ~toolbarItem();
-               ///
                toolbarItem & operator=(toolbarItem const & ti);
+               /// deallocate icon
+               void kill_icon();
+               /// lyx action number
+               int action;
+               /// icon for this item
+               FL_OBJECT * icon;
        };
 
-       /// typedef to simplify things
        typedef std::vector<toolbarItem> ToolbarList;
        /// The list containing all the buttons
-       ToolbarList toollist;
-       ///
-       XFormsView * owner;
-       ///
+       ToolbarList toollist_;
+       /// owning view
+       XFormsView * owner_;
+       /// tooltips manager
        Tooltips * tooltip_;
-       ///
-       Combox * combox;
-       /// Starting position
-       int sxpos;
-       ///
-       int sypos;
-       ///
+       /// layout combo
+       Combox * combox_;
+       /// x position of end of toolbar
        int xpos;
-       ///
+       /// y position of end of toolbar
        int ypos;
-       ///
-       bool cleaned;
-
-       /// removes all toolbar buttons from the toolbar.
-       void clean();
-
-       /// more...
-       void reset();
-
-       /// more...
-       void lightReset();
 };
-#endif
+#endif // TOOLBAR_PIMPL_H
index 46d63349887b0164f5258604d01cbb72fcd78de5..4c867017c772922a3c1e41ed14e1d5f71c76395a 100644 (file)
@@ -148,7 +148,6 @@ void XFormsView::create_form_form_main(Dialogs & dia, int width, int height)
 
        toolbar_.reset(new Toolbar(this, dia,
                                   air, 30 + air + bw, toolbardefaults));
-       toolbar_->set(true);
 
        int const ywork = 60 + 2 * air + bw;
        int const workheight = height - ywork - (25 + 2 * air);
index c101311fc13429dd46d03d8da08a87c219f8de37..26344401ad76e20f6f8535821434b34d18dd21d9 100644 (file)
@@ -1329,24 +1329,6 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
        }
        break;
 
-       case LFUN_ADD_TO_TOOLBAR:
-       {
-               if (lyxerr.debugging(Debug::GUI)) {
-                       lyxerr << "LFUN_ADD_TO_TOOLBAR:"
-                               "argument = `" << argument << '\'' << endl;
-               }
-               string tmp(argument);
-               //lyxerr <<string("Argument: ") + argument);
-               //lyxerr <<string("Tmp     : ") + tmp);
-               if (tmp.empty()) {
-                       setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
-               } else {
-                       owner->getToolbar()->add(argument, false);
-                       owner->getToolbar()->set();
-               }
-       }
-       break;
-
        // --- insert characters ----------------------------------------
 
        // ---  Mathed stuff. If we are here, there is no locked inset yet.