Ejemplo n.º 1
0
        private void MoveDown_Click(object sender, EventArgs e)
        {
            if (lvFiles.SelectedIndices.Count == 0)
            {
                return;
            }

            foreach (int i in lvFiles.SelectedIndices)
            {
                CPCBigFile.Document.File item = Document.Files[i];
                if (item.ResourceCPCBigFileID != -1)
                {
                    MessageBox.Show("Can not modify external items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            int index = lvFiles.SelectedIndices[0];

            if (index < (lvFiles.Items.Count - 1))
            {
                CPCBigFile.Document.File item = Document.Files[index];

                Document.Files.RemoveAt(index);
                Document.Files.Insert(index + 1, item);

                SetModified(true);
                RefreshUI();

                lvFiles.SelectedIndices.Add(index + 1);
            }
        }
Ejemplo n.º 2
0
        private void lvFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvFiles.SelectedIndices.Count == 0)
            {
                this.cbItemAddress.Enabled = false;
                this.ItemAddress.Enabled   = false;
                return;
            }

            int index = lvFiles.SelectedIndices[0];

            if (index >= 0)
            {
                IsReady = false;

                CPCBigFile.Document.File item = Document.Files[index];

                this.cbItemAddress.Enabled = true;
                this.cbItemAddress.Checked = item.SetAddress;
                this.ItemAddress.Text      = "0x" + String.Format("{0:X4}", item.Address);
                ItemAddress.Enabled        = cbItemAddress.Checked;

                IsReady = true;
            }
        }
Ejemplo n.º 3
0
        private CPCBigFile.Document.File GetSelectedItem()
        {
            if (lvFiles.SelectedIndices.Count == 0)
            {
                return(null);
            }

            int index = lvFiles.SelectedIndices[0];

            CPCBigFile.Document.File item = Document.Files[index];
            return(item);
        }
Ejemplo n.º 4
0
        private void Remove_Click(object sender, EventArgs e)
        {
            foreach (int i in lvFiles.SelectedIndices)
            {
                CPCBigFile.Document.File item = Document.Files[i];
                if (item.ResourceCPCBigFileID != -1)
                {
                    MessageBox.Show("Can not modify external items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            List <int> indices = new List <int>();

            foreach (int index in lvFiles.SelectedIndices)
            {
                Document.File file = Document.Files[index];

                List <PhactoryHost.Database.Resource> otherReferencingResources = Plugin.ControllerEditor.Host.IsOutputResourcesReferencedByOtherResources(Plugin.ControllerEditor.Host.GetResource(file.ResourceID), Plugin.ControllerEditor.Host.GetResource(Resource.Id));
                if (otherReferencingResources.Count > 0)
                {
                    Plugin.ControllerEditor.Host.ShowCantRemoveBecauseOtherResources(Plugin.ControllerEditor.Host.GetResource(file.ResourceID), Plugin.ControllerEditor.Host.GetResource(Resource.Id), otherReferencingResources);
                    return;
                }
                else
                {
                    indices.Add(index);
                }
            }

            // reverse delete
            for (int iIndex = indices.Count - 1; iIndex >= 0; iIndex--)
            {
                int index = indices[iIndex];

                Document.Files.RemoveAt(index);
                lvFiles.Items.RemoveAt(index);
            }

            if (indices.Count > 0)
            {
                SetModified(true);
                RefreshUI();
            }
        }
Ejemplo n.º 5
0
        private void Add_Click(object sender, EventArgs e)
        {
            List <PhactoryHost.Database.Resource> resources = Plugin.ControllerEditor.Host.ShowResourceSelector(null, true);

            if (resources != null)
            {
                foreach (PhactoryHost.Database.Resource resource in resources)
                {
                    var file = new CPCBigFile.Document.File(resource.Id);
                    Document.Files.Add(file);
                }

                Document.Expand();

                SetModified(true);
                RefreshUI();
            }
        }
Ejemplo n.º 6
0
        private void Add_Click(object sender, EventArgs e)
        {
            List<PhactoryHost.Database.Resource> resources = Plugin.ControllerEditor.Host.ShowResourceSelector(null, true);
            if (resources != null)
            {
                foreach (PhactoryHost.Database.Resource resource in resources)
                {
                    var file = new CPCBigFile.Document.File(resource.Id);
                    Document.Files.Add(file);
                }

                Document.Expand();

                SetModified(true);
                RefreshUI();
            }
        }