private void UpdateData() { if (IsReady == false) { return; } CPCRawBitmap.Document.ItemType type = CPCRawBitmap.Document.ItemType.Raw; if (Raw.Checked) { type = CPCRawBitmap.Document.ItemType.Raw; } else if (VerticalRaw.Checked) { type = CPCRawBitmap.Document.ItemType.VerticalRaw; } CPCRawBitmap.Document.Item item = GetSelectedItem(); if (item == null) { return; } item.Type = type; RefreshUI(); SetModified(true); }
private CPCRawBitmap.Document.Item GetSelectedItem() { if (lvFiles.SelectedIndices.Count == 0) { return(null); } int index = lvFiles.SelectedIndices[0]; CPCRawBitmap.Document.Item item = Document.Items[index]; return(item); }
private void lvFiles_SelectedIndexChanged(object sender, EventArgs e) { if (lvFiles.SelectedIndices.Count == 0) { curSelIndexLabel.Text = ""; Preview.Image = null; GroupItemProperties.Enabled = false; Information.Text = ""; return; } int index = lvFiles.SelectedIndices[0]; if (index < 0) { GroupItemProperties.Enabled = false; } else { curSelIndexLabel.Text = "Selection index: " + (index + 1); GroupItemProperties.Enabled = true; CPCRawBitmap.Document.Item item = Document.Items[index]; PhactoryHost.Database.Resource bmpResource = Plugin.ControllerEditor.Host.GetResource(item.ResourceID); string filename = Plugin.ControllerEditor.Host.GetFileInfo(bmpResource).FullName; Preview.Image = Image.FromFile(filename); IsReady = false; CPCRawBitmap.Document.ItemType type = item.Type; switch (type) { case CPCRawBitmap.Document.ItemType.Raw: Raw.Checked = true; break; case CPCRawBitmap.Document.ItemType.VerticalRaw: VerticalRaw.Checked = true; break; } IsReady = true; } }
private void CompileInternally_Click(object sender, EventArgs e) { Document.CompileInternal(); if (lvFiles.Items.Count > 0) { CPCRawBitmap.Document.Item item = Document.Items[0]; Information.Text = "" + item.IntermediateImage.IndiceCount + " indices found"; } else { Information.Text = ""; } }
public void RefreshUI() { CPCRawBitmap.Document.Item selectedItem = GetSelectedItem(); ListViewItem selLvItem = null; List <Document.Item> toRemove = new List <Document.Item>(); lvFiles.Items.Clear(); foreach (Document.Item item in Document.Items) { PhactoryHost.Database.Resource resource = Plugin.ControllerEditor.Host.GetResource(item.ResourceID); if (resource == null) { Plugin.ControllerEditor.Host.Log("Unknown resource identifier : " + item.ResourceID); toRemove.Add(item); continue; } ListViewItem lvItem = AddListViewItem(resource); if (item == selectedItem) { selLvItem = lvItem; } } if (toRemove.Count > 0) { SetModified(true); MessageBox.Show("" + toRemove.Count + " resources were found as referenced but missing in the project !\n\nThese references have been automatically removed.", "Missing references", MessageBoxButtons.OK, MessageBoxIcon.Warning); } foreach (Document.Item removeItem in toRemove) { Document.Items.Remove(removeItem); } if (selLvItem != null) { selLvItem.Selected = true; } }