summaryrefslogtreecommitdiffstats
path: root/macosx
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
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')
-rw-r--r--macosx/HBQueueController.h29
-rw-r--r--macosx/HBQueueController.mm102
-rw-r--r--macosx/HandBrake.xcodeproj/project.pbxproj6
3 files changed, 20 insertions, 117 deletions
diff --git a/macosx/HBQueueController.h b/macosx/HBQueueController.h
index 19266ed40..4a366224f 100644
--- a/macosx/HBQueueController.h
+++ b/macosx/HBQueueController.h
@@ -10,30 +10,6 @@
@class HBController;
-//------------------------------------------------------------------------------------
-// As usual, we need to subclass NSOutlineView to handle a few special cases:
-//
-// (1) variable row heights during live resizes
-// HBQueueOutlineView exists solely to get around a bug in variable row height outline
-// views in which row heights get messed up during live resizes. See this discussion:
-// http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00871.html
-// However, the recommeneded fix (override drawRect:) does not work. Instead, this
-// subclass implements viewDidEndLiveResize in order to recalculate all row heights.
-//
-// (2) prevent expanding of items during drags
-// During dragging operations, we don't want outline items to expand, since a queue
-// doesn't really have children items.
-//
-// (3) generate a drag image that incorporates more than just the first column
-// By default, NSTableView only drags an image of the first column. Change this to
-// drag an image of the queue's icon and desc columns.
-
-@interface HBQueueOutlineView : NSOutlineView
-
-@property (nonatomic, readonly) BOOL isDragging;
-
-@end
-
@interface HBQueueController : NSWindowController <NSToolbarDelegate, NSWindowDelegate>
- (void)setPidNum: (int)myPidnum;
@@ -50,9 +26,4 @@
- (IBAction)showQueueWindow: (id)sender;
-/* control encodes in the window */
-- (IBAction)removeSelectedQueueItem: (id)sender;
-- (IBAction)revealSelectedQueueItem: (id)sender;
-- (IBAction)editSelectedQueueItem: (id)sender;
-
@end
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.
diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj
index b8094601f..fc05ebfd5 100644
--- a/macosx/HandBrake.xcodeproj/project.pbxproj
+++ b/macosx/HandBrake.xcodeproj/project.pbxproj
@@ -157,6 +157,7 @@
A9E1468316BC2AD800C307BC /* prev-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467F16BC2AD800C307BC /* prev-p.pdf */; };
A9E2FD271A21BC4A000E8D3F /* HBAddPresetController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */; };
A9E2FD2B1A21BC6F000E8D3F /* AddPreset.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */; };
+ A9EA43681A2210C400785E95 /* HBQueueOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EA43671A2210C400785E95 /* HBQueueOutlineView.m */; };
A9F2EB6F196F12C800066546 /* Audio.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F2EB6D196F12C800066546 /* Audio.xib */; };
A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */; };
A9F4728D1976BAA70009EC65 /* HBSubtitlesDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F4728C1976BAA70009EC65 /* HBSubtitlesDefaults.m */; };
@@ -402,6 +403,8 @@
A9E2FD241A21BC4A000E8D3F /* HBAddPresetController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAddPresetController.h; sourceTree = "<group>"; };
A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAddPresetController.m; sourceTree = "<group>"; };
A9E2FD2A1A21BC6F000E8D3F /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AddPreset.xib; sourceTree = "<group>"; };
+ A9EA43661A2210C400785E95 /* HBQueueOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBQueueOutlineView.h; sourceTree = "<group>"; };
+ A9EA43671A2210C400785E95 /* HBQueueOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBQueueOutlineView.m; sourceTree = "<group>"; };
A9F2EB6E196F12C800066546 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Audio.xib; sourceTree = "<group>"; };
A9F472861976B7F30009EC65 /* HBSubtitlesDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitlesDefaultsController.h; sourceTree = "<group>"; };
A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitlesDefaultsController.m; sourceTree = "<group>"; };
@@ -888,6 +891,8 @@
A9B34D711976844500871B7D /* UI Views */ = {
isa = PBXGroup;
children = (
+ A9EA43661A2210C400785E95 /* HBQueueOutlineView.h */,
+ A9EA43671A2210C400785E95 /* HBQueueOutlineView.m */,
46AB433315F98A2B009C0961 /* DockTextField.h */,
46AB433415F98A2B009C0961 /* DockTextField.m */,
A9F7102419A475EC00F61301 /* HBDockTile.h */,
@@ -1130,6 +1135,7 @@
273F20BA14ADBE670021BE6D /* PictureController.m in Sources */,
A9CF25F71990D6820023F727 /* HBPresetsViewController.m in Sources */,
273F20BE14ADC09F0021BE6D /* main.mm in Sources */,
+ A9EA43681A2210C400785E95 /* HBQueueOutlineView.m in Sources */,
A91726E7197291BC00D1AFEF /* HBChapterTitlesController.m in Sources */,
A9C9F88919A733FE00DC8923 /* HBHUDView.m in Sources */,
A932E26F198833920047D13E /* HBAudioDefaultsController.m in Sources */,