/// <summary>
        /// Resets the archive to the main position according to the
        /// selected box type and direction
        /// </summary>
        /// <param name="BoxCategory">Category of the box</param>
        /// <param name="BoxType">Boxes of which label (box type) should be
        /// taken</param>
        /// <param name="AlongDirection">
        /// True if the direction is along, false if against direction
        /// </param>
        public void ResetArchive(string BoxCategory, string BoxType, bool AlongDirection)
        {
            FerdaTreeNode treeNode;

            //clears all the nodes in the treeview
            TVArchive.Nodes.Clear();

            //clearing the images
            TVArchive.ImageList = null;
            ImageList list = new ImageList();
            iconDictionary = new Dictionary<string, int>();

            //getting the first icon to the list
            list.Images.Add(naIcon);
            iconDictionary.Add("naIcon", 0);

            archive.RefreshOrder();
            //getting all the boxes in the archive
            if (BoxCategory == ResManager.GetString("ArchiveAllText"))
            {
                foreach (ModulesManager.IBoxModule b in archive.SortedBoxes)
                {
                    treeNode = new FerdaTreeNode(b, AlongDirection,
                        Archive, this, iconDictionary, list, iconProvider, projectManager);
                    TVArchive.Nodes.Add(treeNode);
                }
            }
            //getting only boxes from one category
            else
            {
                IBoxModule[] boxesList;
                //all boxes in that category
                if (BoxType == ResManager.GetString("ArchiveAllText"))
                {
                    boxesList = archive.ListBoxesWithType(BoxCategory, null);
                }
                //a specified box type
                else
                {
                    boxesList = archive.ListBoxesWithType(BoxCategory, BoxType);
                }

                List<FerdaTreeNode> nodes = new List<FerdaTreeNode>(boxesList.Length);
                foreach (ModulesManager.IBoxModule b in boxesList)
                {
                    treeNode = new FerdaTreeNode(b, AlongDirection,
                        Archive, this, iconDictionary, list, iconProvider, projectManager);
                    nodes.Add(treeNode);
                }
                TVArchive.Nodes.AddRange(nodes.ToArray());
            }

            TVArchive.ImageList = list;
        }
 /// <summary>
 /// Renames a FerdaTreeNode in the parameter
 /// </summary>
 /// <param name="tn">node to be renamed</param>
 public void Rename(FerdaTreeNode tn)
 {
     tn.BeginEdit();
 }
        ///<summary>
        ///Forces the control to refresh its state
        ///</summary>
        ///<remarks>
        /// It also adapts the menu and toolbar
        ///</remarks>
        public void Adapt()
        {
            if (!IsDisposed)
            {
                mySelectedNode = null;

                int i;
                string oldCategory = CBCategories.SelectedItem.ToString();
                string oldType = CBTypes.SelectedItem.ToString();

                FillBoxTypes();

                //selecting the box category
                for (i = 0; i < CBCategories.Items.Count; i++)
                {
                    string item = CBCategories.Items[i].ToString();
                    if (item == oldCategory)
                    {
                        break;
                    }
                }

                CBCategories.SelectedIndexChanged -= new EventHandler(CBArchive_SelectedIndexChanged);

                if (i == CBCategories.Items.Count)
                {
                    CBCategories.SelectedIndex = 0;
                    //resets the archive to an "initial position"
                    ResetArchive(ResManager.GetString("ArchiveAllText"),
                        ResManager.GetString("ArchiveAllText"), true);
                }
                else
                {
                    CBCategories.SelectedIndex = i;
                    //resets the archive to an "initial position"
                    ResetArchive(oldCategory, oldType, true);
                }

                CBCategories.SelectedIndexChanged += new EventHandler(CBArchive_SelectedIndexChanged);

                //selecting the box type
                for (int j = 0; j < CBTypes.Items.Count; j++)
                {
                    string item = CBTypes.Items[j].ToString();
                    if (item == oldType)
                    {
                        CBTypes.SelectedIndex = j;
                        break;
                    }
                }
            }

            menuDisplayer.Adapt();
            toolBar.Adapt();
        }
        ///<summary>
        ///Localizes view in parameter in the archive
        ///</summary>
        ///<param name="box">
        /// Box to be localized
        ///</param>
        public void LocalizeInArchive(ModulesManager.IBoxModule box)
        {
            int i;
            string boxtype = string.Empty;
            List<string> types = new List<string>(box.MadeInCreator.BoxCategories);

            mySelectedNode = null;

            //indexing from one, because first group is all and every box belongs
            //to all group. We want to know a specific group
            for (i = 1; i < CBCategories.Items.Count; i++)
            {
                if (types.Contains(CBCategories.Items[i].ToString()))
                {
                    boxtype = CBCategories.Items[i].ToString();
                    break;
                }
            }

            //selecting the boxtype
            for (i = 0; i < CBCategories.Items.Count; i++)
            {
                string item = (string)CBCategories.Items[i];
                if (item == boxtype)
                {
                    break;
                }
            }
            CBCategories.SelectedIndex = i;

            //filling the labels in the second combo-box
            FillBoxLabels(boxtype);
            for (i = 0; i < CBTypes.Items.Count; i++)
            {
                string item = (string)CBTypes.Items[i];
                if (item == box.MadeInCreator.Label)
                {
                    break;
                }
            }
            CBTypes.SelectedIndex = i;

            //resetting the archive
            ResetArchive(boxtype, box.MadeInCreator.Label, true);

            //now we have to select the box in the list...
            foreach (FerdaTreeNode tn in TVArchive.Nodes)
            {
                if (tn.Box == box)
                {
                    TVArchive.SelectedNode = tn;
                    mySelectedNode = tn;
                    break;
                }
            }

            //setting the focus to the treeview
            TVArchive.Focus();
        }
 /// <summary>
 /// Reaction to a mouse down - the mySelectedNode gets initialized
 /// </summary>
 /// <param name="sender">Sender of the event</param>
 /// <param name="e">Event parameters</param>
 void TVArchive_MouseDown(object sender, MouseEventArgs e)
 {
     mySelectedNode = TVArchive.GetNodeAt(e.X, e.Y) as FerdaTreeNode;
     if (mySelectedNode != null)
     {
         mySelectedNode.SetContextMenu();
     }
 }