summaryrefslogtreecommitdiffstats
path: root/win/C#/frmQueue.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-03-16 18:15:29 +0000
committersr55 <[email protected]>2009-03-16 18:15:29 +0000
commit7315884a151d06ee284bfebd294d151a9e59eb57 (patch)
tree2a9b04b372f4e3f75181212662e9d90ec4b98a0f /win/C#/frmQueue.cs
parentda30360f3e7d4c953e5ff9fe8f435db7a887596e (diff)
WinGui:
- Added right click menu to the queue with Move Up/Down and Delete options. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2262 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r--win/C#/frmQueue.cs60
1 files changed, 39 insertions, 21 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 769921691..4f8ac2c36 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -146,7 +146,7 @@ namespace Handbrake
Functions.QueryParser parsed = Functions.QueryParser.Parse(q_item);
// Get the DVD Title
- string title = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
+ string title = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
// Get the DVD Chapters
string chapters;
@@ -210,7 +210,7 @@ namespace Handbrake
lbl_title.Text = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
if (Equals(parsed.DVDChapterStart, 0))
- lbl_chapt.Text = "Auto";
+ lbl_chapt.Text = "Auto";
else
{
string chapters = parsed.DVDChapterStart.ToString();
@@ -251,7 +251,7 @@ namespace Handbrake
// Reverse the list to delete the items from last to first (preserves indices)
selectedIndices.Reverse();
-
+
// Remove each selected item
foreach (int selectedIndex in selectedIndices)
queue.remove(selectedIndex);
@@ -260,7 +260,7 @@ namespace Handbrake
updateUIElements();
// Select the item where the first deleted item was previously
- if (firstSelectedIndex < list_queue.Items.Count)
+ if (firstSelectedIndex < list_queue.Items.Count)
list_queue.Items[firstSelectedIndex].Selected = true;
}
@@ -268,10 +268,39 @@ namespace Handbrake
}
// Queue Management
+ private void mnu_up_Click(object sender, EventArgs e)
+ {
+ moveUp();
+ }
+ private void mnu_Down_Click(object sender, EventArgs e)
+ {
+ moveDown();
+ }
+ private void mnu_delete_Click(object sender, EventArgs e)
+ {
+ deleteSelectedItems();
+ }
private void btn_up_Click(object sender, EventArgs e)
{
+ moveUp();
+ }
+ private void btn_down_Click(object sender, EventArgs e)
+ {
+ moveDown();
+ }
+ private void btn_delete_Click(object sender, EventArgs e)
+ {
+ deleteSelectedItems();
+ }
+ private void list_queue_deleteKey(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ deleteSelectedItems();
+ }
+ private void moveUp()
+ {
// If there are selected items and the first item is not selected
- if (list_queue.SelectedIndices.Count > 0 && ! list_queue.SelectedIndices.Contains(0))
+ if (list_queue.SelectedIndices.Count > 0 && !list_queue.SelectedIndices.Contains(0))
{
// Copy the selected indices to preserve them during the movement
List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
@@ -293,11 +322,11 @@ namespace Handbrake
list_queue.Select(); // Activate the control to show the selected items
}
- private void btn_down_Click(object sender, EventArgs e)
+ private void moveDown()
{
// If there are selected items and the last item is not selected
- if (list_queue.SelectedIndices.Count > 0 &&
- ! list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count-1].Index))
+ if (list_queue.SelectedIndices.Count > 0 &&
+ !list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count - 1].Index))
{
// Copy the selected indices to preserve them during the movement
List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
@@ -310,27 +339,18 @@ namespace Handbrake
// Move down each selected item
foreach (int selectedIndex in selectedIndices)
queue.moveDown(selectedIndex);
-
+
queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
// Keep the selected item(s) selected, now moved down one index
foreach (int selectedIndex in selectedIndices)
if (selectedIndex + 1 < list_queue.Items.Count) // Defensive programming: ensure index is good
- list_queue.Items[selectedIndex + 1].Selected = true;
+ list_queue.Items[selectedIndex + 1].Selected = true;
}
list_queue.Select(); // Activate the control to show the selected items
}
- private void btn_delete_Click(object sender, EventArgs e)
- {
- deleteSelectedItems();
- }
- private void list_queue_deleteKey(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Delete)
- deleteSelectedItems();
- }
// Queue Import/Export Features
private void mnu_batch_Click(object sender, EventArgs e)
@@ -375,7 +395,5 @@ namespace Handbrake
base.OnClosing(e);
}
-
-
}
}