|
1 | 1 | using System; |
2 | 2 | using System.Windows.Forms; |
3 | 3 | using System.IO; |
| 4 | +using System.Linq; |
4 | 5 | using SmartSystemMenu.Settings; |
| 6 | +using SmartSystemMenu.Controls; |
5 | 7 |
|
6 | 8 | namespace SmartSystemMenu.Forms |
7 | 9 | { |
@@ -87,6 +89,71 @@ private void InitializeControls(SmartSystemMenuSettings settings) |
87 | 89 |
|
88 | 90 | cmbLanguage.DataSource = languageItems; |
89 | 91 | cmbLanguage.SelectedValue = settings.LanguageName; |
| 92 | + |
| 93 | + FillGridViewRowHotkey(gvHotkeys, settings, "information"); |
| 94 | + FillGridViewRowHotkey(gvHotkeys, settings, "roll_up"); |
| 95 | + FillGridViewRowHotkey(gvHotkeys, settings, "aero_glass"); |
| 96 | + FillGridViewRowHotkey(gvHotkeys, settings, "always_on_top"); |
| 97 | + FillGridViewRowHotkey(gvHotkeys, settings, "send_to_bottom"); |
| 98 | + FillGridViewRowHotkey(gvHotkeys, settings, "save_screenshot"); |
| 99 | + FillGridViewRowHotkey(gvHotkeys, settings, "open_file_in_explorer"); |
| 100 | + FillGridViewRowHotkey(gvHotkeys, settings, "copy_text_to_clipboard"); |
| 101 | + FillGridViewRowHotkey(gvHotkeys, settings, "drag_by_mouse"); |
| 102 | + FillGridViewGroupHotkey(gvHotkeys, settings, "size"); |
| 103 | + FillGridViewRowHotkey(gvHotkeys, settings, "640_480", "640x480", true); |
| 104 | + FillGridViewRowHotkey(gvHotkeys, settings, "720_480", "720x480", true); |
| 105 | + FillGridViewRowHotkey(gvHotkeys, settings, "720_576", "720x576", true); |
| 106 | + FillGridViewRowHotkey(gvHotkeys, settings, "800_600", "800x600", true); |
| 107 | + FillGridViewRowHotkey(gvHotkeys, settings, "1024_768", "1024x768", true); |
| 108 | + FillGridViewRowHotkey(gvHotkeys, settings, "1152_864", "1024x768", true); |
| 109 | + FillGridViewRowHotkey(gvHotkeys, settings, "1280_800", "1280x800", true); |
| 110 | + FillGridViewRowHotkey(gvHotkeys, settings, "1280_960", "1280x960", true); |
| 111 | + FillGridViewRowHotkey(gvHotkeys, settings, "1280_1024", "1280x1024", true); |
| 112 | + FillGridViewRowHotkey(gvHotkeys, settings, "1440_900", "1440x900", true); |
| 113 | + FillGridViewRowHotkey(gvHotkeys, settings, "1600_900", "1600x900", true); |
| 114 | + FillGridViewRowHotkey(gvHotkeys, settings, "1680_1050", "1680x1050", true); |
| 115 | + FillGridViewRowHotkey(gvHotkeys, settings, "size_default", null, true); |
| 116 | + FillGridViewRowHotkey(gvHotkeys, settings, "size_custom", null, true); |
| 117 | + FillGridViewGroupHotkey(gvHotkeys, settings, "move_to"); |
| 118 | + FillGridViewGroupHotkey(gvHotkeys, settings, "alignment"); |
| 119 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_top_left", null, true); |
| 120 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_top_center", null, true); |
| 121 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_top_right", null, true); |
| 122 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_middle_left", null, true); |
| 123 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_middle_center", null, true); |
| 124 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_middle_right", null, true); |
| 125 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_bottom_left", null, true); |
| 126 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_bottom_center", null, true); |
| 127 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_bottom_right", null, true); |
| 128 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_default", null, true); |
| 129 | + FillGridViewRowHotkey(gvHotkeys, settings, "align_custom", null, true); |
| 130 | + FillGridViewGroupHotkey(gvHotkeys, settings, "transparency"); |
| 131 | + FillGridViewRowHotkey(gvHotkeys, settings, "trans_opaque", "0%" + settings.LanguageSettings.GetValue("trans_opaque"), true); |
| 132 | + FillGridViewRowHotkey(gvHotkeys, settings, "10%", "10%", true); |
| 133 | + FillGridViewRowHotkey(gvHotkeys, settings, "20%", "20%", true); |
| 134 | + FillGridViewRowHotkey(gvHotkeys, settings, "30%", "30%", true); |
| 135 | + FillGridViewRowHotkey(gvHotkeys, settings, "40%", "40%", true); |
| 136 | + FillGridViewRowHotkey(gvHotkeys, settings, "50%", "50%", true); |
| 137 | + FillGridViewRowHotkey(gvHotkeys, settings, "60%", "60%", true); |
| 138 | + FillGridViewRowHotkey(gvHotkeys, settings, "70%", "70%", true); |
| 139 | + FillGridViewRowHotkey(gvHotkeys, settings, "80%", "80%", true); |
| 140 | + FillGridViewRowHotkey(gvHotkeys, settings, "90%", "90%", true); |
| 141 | + FillGridViewRowHotkey(gvHotkeys, settings, "trans_invisible", "100%" + settings.LanguageSettings.GetValue("trans_invisible"), true); |
| 142 | + FillGridViewRowHotkey(gvHotkeys, settings, "trans_default", null, true); |
| 143 | + FillGridViewRowHotkey(gvHotkeys, settings, "trans_custom", null, true); |
| 144 | + FillGridViewGroupHotkey(gvHotkeys, settings, "priority"); |
| 145 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_real_time", null, true); |
| 146 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_high", null, true); |
| 147 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_above_normal", null, true); |
| 148 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_normal", null, true); |
| 149 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_below_normal", null, true); |
| 150 | + FillGridViewRowHotkey(gvHotkeys, settings, "priority_idle", null, true); |
| 151 | + FillGridViewGroupHotkey(gvHotkeys, settings, "system_tray"); |
| 152 | + FillGridViewRowHotkey(gvHotkeys, settings, "minimize_to_systemtray", null, true); |
| 153 | + FillGridViewRowHotkey(gvHotkeys, settings, "minimize_always_to_systemtray", null, true); |
| 154 | + FillGridViewGroupHotkey(gvHotkeys, settings, "other_windows"); |
| 155 | + FillGridViewRowHotkey(gvHotkeys, settings, "minimize_other_windows", null, true); |
| 156 | + FillGridViewRowHotkey(gvHotkeys, settings, "close_other_windows", null, true); |
90 | 157 | } |
91 | 158 |
|
92 | 159 | private void GridViewProcessExclusionsCellContentClick(object sender, DataGridViewCellEventArgs e) |
@@ -154,6 +221,32 @@ private void GridViewProcessExclusionsCellDoubleClick(object sender, DataGridVie |
154 | 221 | } |
155 | 222 | } |
156 | 223 |
|
| 224 | + private void GridViewHotkeysCellContentClick(object sender, DataGridViewCellEventArgs e) |
| 225 | + { |
| 226 | + var grid = (DataGridView)sender; |
| 227 | + if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) |
| 228 | + { |
| 229 | + var row = grid.Rows[e.RowIndex]; |
| 230 | + if (row.Tag != null) |
| 231 | + { |
| 232 | + MessageBox.Show("Hotkeys1"); |
| 233 | + } |
| 234 | + } |
| 235 | + } |
| 236 | + |
| 237 | + private void GridViewHotkeysCellDoubleClick(object sender, DataGridViewCellEventArgs e) |
| 238 | + { |
| 239 | + var grid = (DataGridView)sender; |
| 240 | + if ((e.ColumnIndex == 0 || e.ColumnIndex == 1) && e.RowIndex >= 0) |
| 241 | + { |
| 242 | + var row = grid.Rows[e.RowIndex]; |
| 243 | + if (row.Tag != null) |
| 244 | + { |
| 245 | + MessageBox.Show("Hotkeys2"); |
| 246 | + } |
| 247 | + } |
| 248 | + } |
| 249 | + |
157 | 250 | private void GridViewStartProgramCellDoubleClick(object sender, DataGridViewCellEventArgs e) |
158 | 251 | { |
159 | 252 | var grid = (DataGridView)sender; |
@@ -286,6 +379,31 @@ private void KeyDownClick(object sender, KeyEventArgs e) |
286 | 379 | Close(); |
287 | 380 | } |
288 | 381 | } |
| 382 | + |
| 383 | + private void FillGridViewRowHotkey(DataGridView gridView, SmartSystemMenuSettings settings, string itemName, string title = null, bool isPadding = false) |
| 384 | + { |
| 385 | + var index = gridView.Rows.Add(); |
| 386 | + var row = gridView.Rows[index]; |
| 387 | + var menuItem = settings.MenuItems.Items.FirstOrDefault(x => x.Name == itemName); |
| 388 | + title = title != null ? title : settings.LanguageSettings.GetValue(itemName); |
| 389 | + row.Tag = menuItem; |
| 390 | + row.Cells[0].Value = title; |
| 391 | + row.Cells[1].Value = menuItem == null ? "" : menuItem.ToString(); |
| 392 | + if (isPadding) |
| 393 | + { |
| 394 | + var padding = row.Cells[0].Style.Padding; |
| 395 | + row.Cells[0].Style.Padding = new Padding(20, padding.Top, padding.Right, padding.Bottom); |
| 396 | + } |
| 397 | + } |
| 398 | + |
| 399 | + private void FillGridViewGroupHotkey(DataGridView gridView, SmartSystemMenuSettings settings, string itemName) |
| 400 | + { |
| 401 | + var index = gridView.Rows.Add(); |
| 402 | + var row = gridView.Rows[index]; |
| 403 | + row.Cells[0].Value = settings.LanguageSettings.GetValue(itemName); |
| 404 | + row.ReadOnly = true; |
| 405 | + ((DataGridViewDisableButtonCell)row.Cells[2]).Enabled = false; |
| 406 | + } |
289 | 407 | } |
290 | 408 |
|
291 | 409 | public class SmartSystemMenuSettingsEventArgs : EventArgs |
|
0 commit comments