private void ImportButton_Click(object sender, EventArgs e) { try { if (ImportFileDialog.ShowDialog() != DialogResult.OK) { return; } Texture = new Bitmap(ImportFileDialog.FileName); if (Texture != null) { BaseZoom = Math.Min((float)PreviewPanel.ClientSize.Width / Texture.Width, (float)PreviewPanel.ClientSize.Height / Texture.Height); PropertiesTextBox.Text = "[" + Texture.PixelFormat + "] " + Texture.Width + " x " + Texture.Height; ExportButton.Enabled = true; } else { ExportButton.Enabled = false; } RepairOffset(); PreviewPanel.Invalidate(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: Can not import texture."); } }
private void DoSort() { for (int i = 0; i < 256; i++) { PreviewPanel.PalSource[(byte)i] = OrigionPal[(byte)i]; } PreviewPanel.Selections = OriginSelections; List <byte> sortSelections = new List <byte>(); List <int> sortValues = new List <int>(); if (IsAll) { for (int i = 0; i < 256; i++) { sortSelections.Add((byte)i); sortValues.Add(OrigionPal[(byte)i]); } } else { foreach (byte j in PreviewPanel.Selections) { sortSelections.Add(j); sortValues.Add(OrigionPal[j]); } } DoSort(sortValues); for (int i = 0; i < sortSelections.Count; i++) { PreviewPanel.PalSource[sortSelections[i]] = sortValues[IsIncrease ? i : sortSelections.Count - 1 - i]; } PreviewPanel.Refresh(); }
private void UpdatePreviewPanel() { Misc.DeepCopy(SourceColorList, PreviewPanel.PalSource.Data); int startingIdx = (int)nudStartingIdx.Value; List <byte> WorkingList = SortByteList((byte)startingIdx, PreviewPanel.Selections); if (WorkingList == null) { PreviewPanel.Refresh(); return; } int steps = (int)nudSteps.Value; Color startingColor = StartingPreview.BackColor; Color endingColor = EndingPreview.BackColor; decimal deltaR = (decimal)(endingColor.R - startingColor.R) / steps; decimal deltaG = (decimal)(endingColor.G - startingColor.G) / steps; decimal deltaB = (decimal)(endingColor.B - startingColor.B) / steps; int i = 0; decimal LastR = startingColor.R, LastG = startingColor.G, LastB = startingColor.B; while (i < steps) { LastR += deltaR; LastG += deltaG; LastB += deltaB; PreviewPanel.PalSource[WorkingList[(byte)i]] = Color.FromArgb(252, Misc.GetRound(LastR), Misc.GetRound(LastG), Misc.GetRound(LastB)).ToArgb(); ++i; } PreviewPanel.Refresh(); }
private void PreviewPanel_MouseUp(object sender, MouseEventArgs e) { Drag.EndDrag(); CommitCorrection(); Drag.Init(); PreviewPanel.Invalidate(); }
private void PreviewPanel_MouseWheel(object sender, MouseEventArgs e) { float OldZoom = Zoom; if (e.Delta > 0) { Zoom *= 2.0f; } if (e.Delta < 0) { Zoom /= 2.0f; } if (BaseZoom * Zoom < 0.01f) { Zoom = OldZoom; } if (BaseZoom * Zoom > 100.0f) { Zoom = OldZoom; } RepairOffset(); PreviewPanel.Invalidate(); }
public void RemovePreview() { if (Preview == null) { return; } Editor.AvailableContent = true; ComponentPool.Free(Preview); Preview = null; }
private void LaserComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.CommitCorrection(); CurrentLaserIndex = this.LaserComboBox.Items.Count == 0 ? -1 : this.LaserComboBox.SelectedIndex; if (loading) { return; } LoadFromSettings(); PreviewPanel.Invalidate(); }
private void TextureForm_Resize(object sender, EventArgs e) { if (Texture != null) { BaseZoom = Math.Min((float)PreviewPanel.ClientSize.Width / Texture.Width, (float)PreviewPanel.ClientSize.Height / Texture.Height); } RepairOffset(); PreviewPanel.Invalidate(); }
private void NudNewCount_ValueChanged(object sender, EventArgs e) { if (PreviewPanel.PalSource == null) { btnApply.Enabled = false; return; } btnApply.Enabled = true; Image img = Pal2Bmp(srcPal.Data); Misc.GetIndexedItem(img, PreviewPanel.PalSource, (int)nudNewCount.Value); PreviewPanel.Refresh(); }
private void Undo() { if (process.Count > 0) { process.RemoveAt(process.Count - 1); HistoryTextBox.Items.RemoveAt(HistoryTextBox.Items.Count - 1); previewProg.RemoveAt(previewProg.Count - 1); preview = previewProg[previewProg.Count - 1]; PreviewPanel.BackgroundImage = new Bitmap(Effects.ResizeImage(preview, 100, 100)); PreviewPanel.Refresh(); } }
public Sort(PalFile pal, List <byte> selects) { InitializeComponent(); Misc.SetLanguage(this); OrigionPal = pal; OriginSelections = selects; PreviewPanel.PalSource = new PalFile(); for (int i = 0; i < 256; i++) { PreviewPanel.PalSource[(byte)i] = OrigionPal[(byte)i]; } PreviewPanel.Selections = OriginSelections; PreviewPanel.Refresh(); InitializeRadioButtons(); }
private void lvTemplates_AfterSelect(object sender, TreeViewEventArgs e) { if (lvTemplates.SelectedNode.Tag == null) { return; } List <int> curTag = (List <int>)lvTemplates.SelectedNode.Tag; if (PreviewPanel.PalSource == null) { PreviewPanel.PalSource = new FileSystem.PalFile(); } PreviewPanel.PalSource.Data = curTag; PreviewPanel.Refresh(); }
private void PreviewPanel_MouseMove(object sender, MouseEventArgs e) { if (!MouseHold) { return; } OffsetX += e.Location.X - MousePt.X; OffsetY += e.Location.Y - MousePt.Y; RepairOffset(); MousePt = e.Location; PreviewPanel.Invalidate(); }
public AutoCompleteForm() { InitializeComponent(); listBox1.DrawMode = DrawMode.OwnerDrawFixed; listBox1.DrawItem += new DrawItemEventHandler(ListBox1_DrawItem); listBox1.ItemHeight = 35; listBox1.SelectedIndexChanged += new System.EventHandler(ListBox1_SelectedIndexChanged); previewPanel = new PreviewPanel(); previewPanel.Location = new Point(-1000, -1000); previewPanel.Show(this.Owner); BackColor = Color.Lime; panel1.BackColor = Color.Lime; TransparencyKey = Color.Lime; this.displaySuggestion = new List<Suggestion>(); }
// 事件 private void TilesView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Container.IsInfoPanelOpen && e.AddedItems.First() is StorageEntry infoPanelEntry) { switch (infoPanelEntry.EntryType) { case StorageEntryType.File: PreviewPanel.SwitchPreviewSource(infoPanelEntry); break; case StorageEntryType.Folder: break; } } if (PrevisualView.IsPrevisualExtend && e.AddedItems.First() is StorageEntry previsualEntry) { switch (previsualEntry.EntryType) { case StorageEntryType.File: PrevisualView.TogglePrevisual(previsualEntry); break; case StorageEntryType.Folder: PrevisualView.IsPrevisualExtend = false; break; } } }
private void AddPreview(IntersectionTemplateItem item) { if (item == SelectItem) { return; } Editor.AvailableContent = false; var root = GetRootContainer(); Preview = ComponentPool.Get <PreviewPanel>(root, nameof(Preview)); Preview.Init(365f); var info = ComponentPool.Get <PreviewIntersectionTemplateInfo>(Preview, "Info"); info.Init(item.Object); var x = item.absolutePosition.x + item.width; var y = Mathf.Min(item.absolutePosition.y, root.absolutePosition.y + root.height - Preview.height); Preview.absolutePosition = new Vector2(x, y); }
public BitmapForm(Bitmap bitmap = null) { InitializeComponent(); PreviewPanel.MouseWheel += PreviewPanel_MouseWheel; Texture = bitmap; MouseHold = false; MousePt = new PointF(); OffsetX = PreviewPanel.ClientSize.Width / 2; OffsetY = PreviewPanel.ClientSize.Height / 2; Zoom = 1.0f; BaseZoom = 1.0f; if (Texture != null) { BaseZoom = Math.Min((float)PreviewPanel.ClientSize.Width / Texture.Width, (float)PreviewPanel.ClientSize.Height / Texture.Height); PropertiesTextBox.Text = "[" + Texture.PixelFormat + "] " + Texture.Width + " x " + Texture.Height; ExportButton.Enabled = true; } else { ExportButton.Enabled = false; } typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, PreviewPanel, new object[] { true }); RepairOffset(); PreviewPanel.Invalidate(); }
private void InitializeComponent() { trackBar1 = new CustomTrackBar(); btnPlay = new Button(); btnRewind = new Button(); chkLoop = new CheckBox(); lblProgress = new Label(); previewPanel1 = new PreviewPanel(); ((ISupportInitialize)trackBar1).BeginInit(); SuspendLayout(); // // trackBar1 // trackBar1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; trackBar1.Location = new System.Drawing.Point(0, 212); trackBar1.Name = "trackBar1"; trackBar1.Size = new System.Drawing.Size(378, 45); trackBar1.TabIndex = 0; trackBar1.TickFrequency = 2; trackBar1.UserSeek += new EventHandler(trackBar1_UserSeek); trackBar1.ValueChanged += new EventHandler(trackBar1_ValueChanged); // // btnPlay // btnPlay.Anchor = AnchorStyles.Bottom; btnPlay.Location = new System.Drawing.Point(152, 263); btnPlay.Name = "btnPlay"; btnPlay.Size = new System.Drawing.Size(75, 20); btnPlay.TabIndex = 1; btnPlay.Text = "Play"; btnPlay.UseVisualStyleBackColor = true; btnPlay.Click += new EventHandler(btnPlay_Click); // // btnRewind // btnRewind.Anchor = AnchorStyles.Bottom; btnRewind.Location = new System.Drawing.Point(122, 263); btnRewind.Name = "btnRewind"; btnRewind.Size = new System.Drawing.Size(24, 20); btnRewind.TabIndex = 2; btnRewind.Text = "|<"; btnRewind.UseVisualStyleBackColor = true; btnRewind.Click += new EventHandler(btnRewind_Click); // // chkLoop // chkLoop.Anchor = AnchorStyles.Bottom; chkLoop.Location = new System.Drawing.Point(54, 263); chkLoop.Name = "chkLoop"; chkLoop.Size = new System.Drawing.Size(62, 20); chkLoop.TabIndex = 3; chkLoop.Text = "Loop"; chkLoop.UseVisualStyleBackColor = true; chkLoop.CheckedChanged += new EventHandler(chkLoop_CheckedChanged); // // lblProgress // lblProgress.Anchor = AnchorStyles.Bottom; lblProgress.Location = new System.Drawing.Point(-79, 239); lblProgress.Name = "lblProgress"; lblProgress.Size = new System.Drawing.Size(536, 23); lblProgress.TabIndex = 4; lblProgress.Text = "0/0"; lblProgress.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // previewPanel1 // previewPanel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; previewPanel1.CurrentIndex = 0; previewPanel1.DisposeImage = true; previewPanel1.Location = new System.Drawing.Point(3, 3); previewPanel1.Name = "previewPanel1"; previewPanel1.RenderingTarget = null; previewPanel1.Size = new System.Drawing.Size(372, 203); previewPanel1.TabIndex = 5; // // VideoPlaybackPanel // Controls.Add(previewPanel1); Controls.Add(lblProgress); Controls.Add(chkLoop); Controls.Add(btnRewind); Controls.Add(btnPlay); Controls.Add(trackBar1); Name = "VideoPlaybackPanel"; Size = new System.Drawing.Size(378, 289); ((ISupportInitialize)trackBar1).EndInit(); ResumeLayout(false); PerformLayout(); }
private void ReInitButton_Click(object sender, EventArgs e) { ClearCorrection(); PreviewPanel.Invalidate(); }
private void TestForm_Load(object sender, EventArgs e) { if (Environment.Is64BitProcess) { Text += " (64-bit)"; } else { Text += " (32-bit)"; } presentation = new Presentation(); // Bindings // Scene SceneListBox.DisplayMember = "Name"; SceneListBox.ValueMember = "Items"; SceneListBox.DataSource = presentation.Scenes; // Item ItemListBox.DisplayMember = "Name"; // Source SourceListBox.DisplayMember = "Name"; SourceListBox.DataSource = presentation.Sources; presentation.AddScene(); ItemListBox.DataSource = SceneListBox.SelectedValue; var source = presentation.CreateSource("random", "some random source"); presentation.AddSource(source); var item = presentation.CreateItem(source); presentation.AddItem(item); presentation.SetScene(SceneListBox.SelectedIndex); presentation.SetItem(ItemListBox.SelectedIndex); presentation.SetSource(SourceListBox.SelectedIndex); HideItemCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged)); EnableSourceCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedSource, "Enabled", false, DataSourceUpdateMode.OnPropertyChanged)); MuteSourceCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedSource, "Muted", false, DataSourceUpdateMode.OnPropertyChanged)); // setup scene preview panel previewPanel = new PreviewPanel(); previewPanel.Dock = DockStyle.Fill; topPanel.Controls.Add(previewPanel); previewPanel.Show(); previewPanel.SetScene(presentation.SelectedScene); }
private void imageButton1_Click(object sender, EventArgs e) { ClearCurrentLaserCorrection(); PreviewPanel.Invalidate(); }
private void imageButton2_Click(object sender, EventArgs e) { Drag.Init(); PreviewPanel.Invalidate(); }
private void PreviewPanel_SizeChanged(object sender, EventArgs e) { PreviewPanel.Invalidate(); }
private void ckbVisible_CheckedChanged(object sender, EventArgs e) { PreviewPanel.IsSelectVisible = ckbVisible.Checked; PreviewPanel.Refresh(); }
private void TestForm_Load(object sender, EventArgs e) { if (Environment.Is64BitProcess) Text += " (64-bit)"; else Text += " (32-bit)"; presentation = new Presentation(); // Bindings // Scene SceneListBox.DisplayMember = "Name"; SceneListBox.ValueMember = "Items"; SceneListBox.DataSource = presentation.Scenes; // Item ItemListBox.DisplayMember = "Name"; // Source SourceListBox.DisplayMember = "Name"; SourceListBox.DataSource = presentation.Sources; presentation.AddScene(); ItemListBox.DataSource = SceneListBox.SelectedValue; var source = presentation.CreateSource("monitor_capture", "Monitor Capture Source"); presentation.AddSource(source); var item = presentation.CreateItem(source); item.Name = "Monitor Capture SceneItem"; presentation.AddItem(item); presentation.SetScene(SceneListBox.SelectedIndex); presentation.SetItem(ItemListBox.SelectedIndex); presentation.SetSource(SourceListBox.SelectedIndex); HideItemCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged)); EnableSourceCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedSource, "Enabled", false, DataSourceUpdateMode.OnPropertyChanged)); MuteSourceCheckBox.DataBindings.Add( new Binding("Checked", presentation.SelectedSource, "Muted", false, DataSourceUpdateMode.OnPropertyChanged)); // setup scene preview panel previewPanel = new PreviewPanel(); previewPanel.Dock = DockStyle.Fill; topPanel.Controls.Add(previewPanel); previewPanel.Show(); previewPanel.SetScene(presentation.SelectedScene); }
private void ApplyChanges(object sender, EventArgs e) { if (PreviewPane.BackgroundImage == null) { MessageBox.Show("No changes were made.", "Operation Aborted"); return; } ACResult result = ApplyConfirmation.ShowConfirmation(); if (result == ACResult.IGNORE) { return; } StartProgress(); int width = int.Parse(tbCWidth.Text); int height = int.Parse(tbCHeight.Text); if (width < 640 || width > 7680) { width = 800; } if (height < 480 || height > 4320) { height = 600; } string newBGPath = PreviewPane.BackgroundLocation + "\\background"; ChangeProgress(loaddlg, 25); if (!Directory.Exists(newBGPath)) { Directory.CreateDirectory(newBGPath); } newBGPath += "\\HLBC"; if (!Directory.Exists(newBGPath)) { Directory.CreateDirectory(newBGPath); } Bitmap[,] newBmps = PreviewPane.ChopNewImage(width, height); ChangeProgress(loaddlg, 50); string[] newBmpsLocations = PreviewPane.NewBitmapLocations; ChangeProgress(loaddlg, 75); int bmpWCount = newBmps.GetLength(0); int bmpHCount = newBmps.Length; int x = 0; int y = 0; string backgroundLayoutContents = "resolution\t" + width + "\t" + height + "\n"; string errorMsg = string.Empty; foreach (var bmpLoc in newBmpsLocations) { string bmpRelPath = PreviewPanel.RemoveExtraSpaces(bmpLoc).Split()[0]; string bmpPath = PreviewPane.BackgroundLocation.Remove(PreviewPane.BackgroundLocation.Length - 9, 9) + "\\" + bmpRelPath; backgroundLayoutContents += bmpLoc + "\n"; try { newBmps[x, y].Save(bmpPath + ".bmp"); Surface surf = Surface.LoadFromFile(bmpPath + ".bmp", ImageLoadFlags.TARGA_LoadRGB888); surf.SaveToFile(ImageFormat.TARGA, bmpPath, ImageSaveFlags.Default); } catch { errorMsg += "File has been probably corrupted: " + bmpPath + "\n"; } // cleanup!!! File.Delete(bmpPath + ".bmp"); if (++x >= bmpWCount) { x = 0; if (++y >= bmpHCount) { break; } } } ChangeProgress(loaddlg, 100); if (errorMsg.Length > 0) { Activate(); MessageBox.Show("Background Change Failed! Permission to write to file was denied.\n" + errorMsg, "File IO Error"); return; } switch (result) { case ACResult.BACKUP: if (File.Exists(PreviewPane.BackgroundLocation + "\\BackgroundLayout.txt")) { int cr = 1; while (File.Exists(PreviewPane.BackgroundLocation + "\\BackgroundLayout_v" + cr + ".txt")) { cr++; } string bgLines = File.ReadAllText(PreviewPane.BackgroundLocation + "\\BackgroundLayout.txt"); File.WriteAllText(PreviewPane.BackgroundLocation + "\\BackgroundLayout_v" + cr + ".txt", bgLines); MessageBox.Show("Backup saved as: BackgroundLayout_v" + cr + ".txt", "Backup Saved"); } else { MessageBox.Show("BackgroundLayout.txt was not found inside the resources folder. Backup is unnecessary.", "Backup Skipped"); } File.WriteAllText(PreviewPane.BackgroundLocation + "\\BackgroundLayout.txt", backgroundLayoutContents); break; case ACResult.OVERWRITE: File.WriteAllText(PreviewPane.BackgroundLocation + "\\BackgroundLayout.txt", backgroundLayoutContents); break; } MessageBox.Show("Successfully Changed Background Layout!\r\nDon't forget to match the in-game resolution with your newly created background.", "Changes Saved"); Activate(); }
public MainForm(string strOpenFileName) { // // Required for Windows Form Designer support // InitializeComponent(); m_dkm = new DockingManager(this, VisualStyle.IDE); Globals.ActiveDocumentChanged += new EventHandler(OnActiveDocumentChanged); m_doc = Globals.ActiveDocument; Globals.MainForm = this; // Create all the "Contents" used to display the various animation components m_ctlPreviewPanel = new PreviewPanel(m_doc); Globals.PreviewControl = m_ctlPreviewPanel.PreviewControl; m_ctlPreviewPanel.Dock = DockStyle.Fill; Controls.Add(m_ctlPreviewPanel); m_dkm.InnerControl = m_ctlPreviewPanel; m_frmStrips = new StripsForm(m_doc); Globals.StripsForm = m_frmStrips; m_tntStrips = m_dkm.Contents.Add(m_frmStrips, m_frmStrips.Text); m_tntStrips.DisplaySize = new Size(ClientSize.Width / 4, ClientSize.Height / 2); m_wcStrips = m_dkm.AddContentWithState(m_tntStrips, State.DockLeft); m_frmBitmaps = new BitmapsForm(m_doc); m_tntBitmaps = m_dkm.Contents.Add(m_frmBitmaps, m_frmBitmaps.Text); m_tntBitmaps.DisplaySize = new Size(ClientSize.Width / 4, ClientSize.Height / 2); m_dkm.AddContentWithState(m_tntBitmaps, State.DockTop); // Add the Bitmaps form to the StripForm's Zone m_dkm.AddContentToZone(m_tntBitmaps, m_wcStrips.ParentZone, 1); m_frmFrames = new StripForm(m_doc); Globals.StripForm = m_frmFrames; m_tntFrames = m_dkm.Contents.Add(m_frmFrames, m_frmFrames.Text); m_frmFrames.Content = m_tntFrames; int cx = ClientSize.Width - (ClientSize.Width / 4); int cy = ClientSize.Height / 3; m_tntFrames.DisplaySize = new Size(cx, cy); m_dkm.AddContentWithState(m_tntFrames, State.DockBottom); m_frmCombiner = new CombinerForm(); m_tntCombiner = m_dkm.Contents.Add(m_frmCombiner, m_frmCombiner.Text); m_tntCombiner.DisplaySize = new Size(ClientSize.Width / 2, ClientSize.Height / 2); // m_dkm.AddContentWithState(m_tntCombiner, State.Floating); // m_dkm.HideContent(m_tntCombiner); // Do a little wiring ((StripControl)Globals.StripControl).FrameOffsetChanged += new FrameOffsetEventHandler(((PreviewControl)Globals.PreviewControl).OnFrameOffsetChanged); ((PreviewControl)Globals.PreviewControl).FrameOffsetChanged += new FrameOffsetEventHandler(((StripControl)Globals.StripControl).OnFrameOffsetChanged); // We always have a document around if (strOpenFileName == null) NewDocument(); else OpenDocument(strOpenFileName); }