Rayburn Davis
2014-10-26 ae714216bd838702edd5430a9ea1071da6482904
commit | author | age
344044 1 ´╗┐using System;
RD 2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6
7 using System.Text;
8 using System.Windows.Forms;
9 using System.Runtime.InteropServices;
10
11 namespace DupliDelete
12 {
13     public partial class CheckAllInFolder : Form
14     {
15         ListViewItem[] folders;
16
17         public const int LVM_FIRST = 0x1000;
18         public const int LVM_GETTOPINDEX = (LVM_FIRST + 39);
19         public const int LVM_GETCOUNTPERPAGE = (LVM_FIRST + 40);
20
21         [DllImport("User32.dll", CharSet = CharSet.Unicode)]
22         static extern int SendMessage(IntPtr hwnd, int Msg, IntPtr wParam, IntPtr lParam);
23
24         public bool RuleMode = false;
25
26
27
28         public CheckAllInFolder()
29         {
30             InitializeComponent();
31         }
32
33         private void button2_Click(object sender, EventArgs e)
34         {
35             int i;
36
37             for (i = 0; i < listView1.Items.Count; i++)
38                 listView1.Items[i].Checked = true;
39
40             listView1.Invalidate();
41         }
42
43         private void button3_Click(object sender, EventArgs e)
44         {
45             int i;
46
47             for (i = 0; i < listView1.Items.Count; i++)
48                 listView1.Items[i].Checked = false;
49
50             listView1.Invalidate();
51         }
52
53         private void button1_Click(object sender, EventArgs e)
54         {
55             int i;
56             GlobalBuffers.folders_ok_clicked = true;
57
58             GlobalBuffers.CheckAllInFolderData = new CheckAllInFolderData();
59
60             GlobalBuffers.CheckAllInFolderData.CheckType = checkTypeCombobox.SelectedIndex == 0 ? CheckJobDialogData.CheckTypes.Check : CheckJobDialogData.CheckTypes.Uncheck;
61
62             GlobalBuffers.CheckAllInFolderData.Canceled = false;
63
64             GlobalBuffers.CheckAllInFolderData.PersistentCheck = checkBox1.Checked;
65
66             GlobalBuffers.CheckAllInFolderData.CheckOnlyOne = checkBox2.Checked;
67
68             GlobalBuffers.CheckAllInFolderData.FoldersToCheck.Clear();
69
70             for (i = 0; i < listView1.Items.Count; i++)
71             {
72                 if (listView1.Items[i].Checked == true)
73                     GlobalBuffers.CheckAllInFolderData.FoldersToCheck.Add((string)listView1.Items[i].Text);
74             }
75
76             this.Close();
77         }
78
79         private void CheckAllInFolder_Load(object sender, EventArgs e)
80         {
81             GlobalBuffers.folders_ok_clicked = false;
ae7142 82             MainForm f1 = (MainForm)this.Owner;
344044 83             int i;
RD 84
85             GlobalBuffers.folders_ok_clicked = false;
86
87             GlobalBuffers.check_by_folder_items.Clear();
88
89             for (i = 0; i < GlobalBuffers.folders.Count; i++)
90                 GlobalBuffers.check_by_folder_items.Add((ListViewItem)new ListViewItem((string)GlobalBuffers.folders[i]));
91
92             folders = (ListViewItem[])GlobalBuffers.check_by_folder_items.ToArray(typeof(ListViewItem));
93             listView1.VirtualListSize = GlobalBuffers.check_by_folder_items.Count;
94             listView1.Invalidate();
95
96             if (GlobalBuffers.SettingsManager.FindSettingStringSingleInt("persist_check") == 1)
97                 checkBox1.Checked = true;
98             else
99                 checkBox1.Checked = false;
100
101             searchBox.Focus();
102
103             checkTypeCombobox.SelectedIndex = 0;
104         }
105
106         private void listView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
107         {
108             e.Item = folders[e.ItemIndex];
109         }
110
111         private void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
112         {
113             e.DrawDefault = true;
114         }
115
116         private void listView1_MouseClick(object sender, MouseEventArgs e)
117         {
118             ListView lv = (ListView)sender;
119             ListViewItem lvi = lv.GetItemAt(e.X, e.Y);
120             if (lvi != null)
121             {
122                 if (e.X < (lvi.Bounds.Left + 16))
123                 {
124                     lvi.Checked = !lvi.Checked;
125                     lv.Invalidate(lvi.Bounds);
126                 }
127             }
128         }
129
130         private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
131         {
132             e.DrawDefault = true;
133             if (!e.Item.Checked)
134             {
135                 e.Item.Checked = true;
136                 e.Item.Checked = false;
137             }
138         }
139
140         private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
141         {
142             ListView lv = (ListView)sender;
143             ListViewItem lvi = lv.GetItemAt(e.X, e.Y);
144             if (lvi != null)
145                 lv.Invalidate(lvi.Bounds);
146         }
147
148         private void searchBox1_TextChanged(object sender, EventArgs e)
149         {
150
151         }
152
153         
154         private void button5_Click(object sender, EventArgs e)
155         {
156             int i;
157
158             for (i = 0; i < listView1.Items.Count; i++)
159             {
160                 if (listView1.Items[i].Selected == true)
161                     listView1.Items[i].Checked = true;
162             }
163
164             listView1.Invalidate();
165         }
166
167         private void button4_Click(object sender, EventArgs e)
168         {
169             int i;
170
171             for (i = 0; i < listView1.Items.Count; i++)
172             {
173                 if (listView1.Items[i].Selected == true)
174                     listView1.Items[i].Checked = false;
175             }
176
177             listView1.Invalidate();
178         }
179
180         private void groupBox1_Enter(object sender, EventArgs e)
181         {
182
183         }
184
185         private void toolStripButton1_Click(object sender, EventArgs e)
186         {
187
188         }
189
190         private void CheckAllInFolder_FormClosing(object sender, FormClosingEventArgs e)
191         {
192         }
193
194         private void searchBox_KeyDown(object sender, KeyEventArgs e)
195         {
196             
197         }
198
199         private void searchBox_OnLostFocusEvent(EventArgs e)
200         {
201         }
202     }
203 }