private void randomiseOrder_CheckToggled(object sender, RoutedPropertyChangedEventArgs <bool> e) { randomise = (bool)randomiseOrder.IsChecked; if (randomise) { seed++; } PaletteChanged?.Invoke(); }
/// <summary> /// Raises the PaletteChanged event. /// </summary> /// <param name="e">An EventArgs containing the event data.</param> protected virtual void OnPaletteChanged(EventArgs e) { // Update the redirector with latest palette Redirector.Target = _palette; // A new palette source means we need to layout and redraw OnNeedPaint(Palette, new NeedLayoutEventArgs(true)); PaletteChanged?.Invoke(this, e); }
/// <summary> /// Raises the PaletteChanged event. /// </summary> /// <param name="e">An EventArgs containing the event data.</param> protected virtual void OnPaletteChanged(EventArgs e) { // Update the redirector with latest palette _redirector.Target = _palette; // Layout and repaint with new settings NeedPaint(true); PaletteChanged?.Invoke(this, e); }
private void PaletteList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (paletteList.SelectedItem == null) { return; } try { SelectedImage = (string)((ListBoxItem)paletteList.SelectedItem).Content; selectedIndex = paletteList.SelectedIndex; PaletteChanged?.Invoke(); } catch { } }
public void SelectImage(string img) { bool set = false; foreach (var i in paletteList.Items) { if ((string)((ListBoxItem)i).Content == img) { paletteList.SelectedItem = i; set = true; break; } } if (!set) { paletteList.SelectedIndex = 0; } PaletteChanged?.Invoke(); }
private void DoClipboard(int row, int col, MouseButtons button) { if (button != MouseButtons.Left && button != MouseButtons.Right) { return; } bool entireRow = ModifierKeys.HasFlag(Keys.Alt); bool copy = button == MouseButtons.Left; if (!copy && clipboard == null) { return; } if (copy && entireRow) { clipboard = (Color[])Resources.Palette[row].Clone(); } else if (copy && !entireRow) { clipboard = new Color[1] { Resources.Palette[row][col] } } ; else if (!copy && entireRow && clipboard.Length != 1) { Resources.Palette[row] = (Color[])clipboard.Clone(); } else if (!copy && !entireRow && clipboard.Length == 1) { Resources.Palette[row][col] = clipboard[0]; } if (!copy) { DrawPalette(); PaletteChanged?.Invoke(this, new PaletteChangedEventArges(row, entireRow ? PaletteChangedEventArges.EntireRow : col)); } }
private void pcbDisplay_MouseDown(object sender, MouseEventArgs e) { int row = e.Y / (16 * Zoom); int col = e.X / (16 * Zoom); if (ModifierKeys.HasFlag(Keys.Control) || e.Button == MouseButtons.Right) { DoClipboard(row, col, e.Button); return; } ColorDialog cd = new ColorDialog(); cd.Color = Resources.Palette[row][col]; cd.FullOpen = true; if (cd.ShowDialog() != DialogResult.OK) { return; } Resources.Palette[row][col] = cd.Color; DrawPalette(); PaletteChanged?.Invoke(this, new PaletteChangedEventArges(row, col)); }
protected virtual void OnPaletteChanged(EventArgs e) { PaletteChanged?.Invoke(this, e); }
protected virtual void OnPaletteChanged(EventArgs e) { SetTileMapGridLength(); PaletteChanged?.Invoke(this, e); }