summaryrefslogtreecommitdiffstats
path: root/macosx/HBQueueController.mm
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-11-23 12:56:03 +0000
committerritsuka <[email protected]>2014-11-23 12:56:03 +0000
commit3ddf9cdc8af9d3586fe118038980462dbccdac01 (patch)
treec396e9fb9a702e6e64d663e3698ff1a698302ab0 /macosx/HBQueueController.mm
parent9e0dcb82bdbf0801b79b84241ab67088c2fb0553 (diff)
MacGui: moved the HBQueueOutlineView class to its own file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6539 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBQueueController.mm')
-rw-r--r--macosx/HBQueueController.mm102
1 files changed, 14 insertions, 88 deletions
diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm
index 19fc8a37a..d81870793 100644
--- a/macosx/HBQueueController.mm
+++ b/macosx/HBQueueController.mm
@@ -6,6 +6,8 @@
#import "HBQueueController.h"
#import "Controller.h"
+
+#import "HBQueueOutlineView.h"
#import "HBImageAndTextCell.h"
#import "HBUtilities.h"
@@ -33,96 +35,9 @@
}
@end
-
-@implementation HBQueueOutlineView
-
-- (void)viewDidEndLiveResize
-{
- // Since we disabled calculating row heights during a live resize, force them to
- // recalculate now.
- [self noteHeightOfRowsWithIndexesChanged:
- [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [self numberOfRows])]];
- [super viewDidEndLiveResize];
-}
-
-/* This should be for dragging, we take this info from the presets right now */
-- (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows
- tableColumns:(NSArray *)tableColumns
- event:(NSEvent *)dragEvent
- offset:(NSPointPointer)dragImageOffset
-{
- _isDragging = YES;
-
- // By default, NSTableView only drags an image of the first column. Change this to
- // drag an image of the queue's icon and desc and action columns.
- NSArray * cols = @[[self tableColumnWithIdentifier:@"desc"], [self tableColumnWithIdentifier:@"icon"],[self tableColumnWithIdentifier:@"action"]];
- return [super dragImageForRowsWithIndexes:dragRows tableColumns:cols event:dragEvent offset:dragImageOffset];
-}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
- [super mouseDown:theEvent];
- _isDragging = NO;
-}
-
-- (void)keyDown:(NSEvent *)event
-{
- id delegate = [self delegate];
-
- unichar key = [[event charactersIgnoringModifiers] characterAtIndex:0];
- if ((key == NSDeleteCharacter || key == NSDeleteFunctionKey) &&
- [delegate respondsToSelector:@selector(removeSelectedQueueItem:)])
- {
- if ([self selectedRow] == -1)
- {
- NSBeep();
- }
- else
- {
- [delegate removeSelectedQueueItem:self];
- }
- return;
- }
- else
- {
- [super keyDown:event];
- }
-}
-
-/**
- * An index set containing the indexes of the targeted rows.
- * If the selected row indexes contain the clicked row index, it returns every selected row,
- * otherwise it returns only the clicked row index.
- */
-- (NSIndexSet *)targetedRowIndexes
-{
- NSMutableIndexSet *rowIndexes = [NSMutableIndexSet indexSet];
- NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
- NSInteger clickedRow = [self clickedRow];
-
- if (clickedRow != -1)
- {
- [rowIndexes addIndex:clickedRow];
-
- // If we clicked on a selected row, then we want to consider all rows in the selection. Otherwise, we only consider the clicked on row.
- if ([selectedRowIndexes containsIndex:clickedRow])
- {
- [rowIndexes addIndexes:selectedRowIndexes];
- }
- }
- else
- {
- [rowIndexes addIndexes:selectedRowIndexes];
- }
-
- return [[rowIndexes copy] autorelease];
-}
-
-@end
-
#pragma mark -
-@interface HBQueueController ()
+@interface HBQueueController () <HBQueueOutlineViewDelegate>
{
hb_handle_t *fQueueEncodeLibhb; // reference to libhb
HBController *fHBController; // reference to HBController
@@ -155,6 +70,11 @@
NSDictionary *shortHeightAttr;
}
+/* control encodes in the window */
+- (IBAction)removeSelectedQueueItem: (id)sender;
+- (IBAction)revealSelectedQueueItem: (id)sender;
+- (IBAction)editSelectedQueueItem: (id)sender;
+
@end
@implementation HBQueueController
@@ -414,6 +334,12 @@
#pragma mark Queue Item Controls
+
+- (void)HB_deleteSelectionFromTableView:(NSTableView *)tableView
+{
+ [self removeSelectedQueueItem:tableView];
+}
+
//------------------------------------------------------------------------------------
// Delete encodes from the queue window and accompanying array
// Also handling first cancelling the encode if in fact its currently encoding.