CraftSynth.ImageEditor – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Windows.Forms; |
||
4 | |||
5 | namespace CraftSynth.ImageEditor |
||
6 | { |
||
7 | public partial class LayerDialog : Form |
||
8 | { |
||
9 | public List<LayerEdit> layerList = new List<LayerEdit>(); |
||
10 | |||
11 | public LayerDialog(Layers _layers) |
||
12 | { |
||
13 | InitializeComponent(); |
||
14 | for (int i = 0; i < _layers.Count; i++) |
||
15 | { |
||
16 | LayerEdit le = new LayerEdit(); |
||
17 | le.LayerName = _layers[i].LayerName; |
||
18 | le.LayerVisible = _layers[i].IsVisible; |
||
19 | le.LayerActive = _layers[i].IsActive; |
||
20 | |||
21 | layerList.Add(le); |
||
22 | } |
||
23 | SetDataGrid(); |
||
24 | } |
||
25 | |||
26 | private void SetDataGrid() |
||
27 | { |
||
28 | dgvLayers.DataSource = layerList; |
||
29 | dgvLayers.Columns[0].HeaderText = "Layer Name"; |
||
30 | dgvLayers.Columns[1].HeaderText = "Visible"; |
||
31 | dgvLayers.Columns[2].HeaderText = "Active"; |
||
32 | dgvLayers.Columns[3].HeaderText = "New"; |
||
33 | dgvLayers.Columns[4].HeaderText = "Deleted"; |
||
34 | } |
||
35 | |||
36 | private void btnAddLayer_Click(object sender, EventArgs e) |
||
37 | { |
||
38 | LayerEdit le = new LayerEdit(); |
||
39 | le.LayerName = "New Layer"; |
||
40 | le.LayerNew = true; |
||
41 | layerList.Add(le); |
||
42 | dgvLayers.DataSource = null; |
||
43 | SetDataGrid(); |
||
44 | } |
||
45 | |||
46 | private void btnClose_Click(object sender, EventArgs e) |
||
47 | { |
||
48 | int active = 0; |
||
49 | for (int i = 0; i < layerList.Count; i++) |
||
50 | if (layerList[i].LayerActive) |
||
51 | active++; |
||
52 | if (active > 1) |
||
53 | MessageBox.Show("There can be only one Active layer at a time\nCorrect this by only checking the Active box on one layer."); |
||
54 | else |
||
55 | Close(); |
||
56 | } |
||
57 | } |
||
58 | } |