macosx: Split into VLCTextfieldPanelController and VLCPopupPanelController
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Thu, 1 Sep 2016 15:25:49 +0000 (17:25 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Thu, 1 Sep 2016 22:03:43 +0000 (00:03 +0200)
extras/package/macosx/Resources/English.lproj/CoreDialogs.xib
extras/package/macosx/Resources/English.lproj/PopupPanel.xib
extras/package/macosx/vlc.xcodeproj/project.pbxproj
modules/gui/macosx/Makefile.am
modules/gui/macosx/SharedDialogs.h [deleted file]
modules/gui/macosx/SharedDialogs.m [deleted file]
modules/gui/macosx/VLCAudioEffectsWindowController.m
modules/gui/macosx/VLCConvertAndSaveWindowController.m
modules/gui/macosx/VLCTextfieldPanelController.h [new file with mode: 0644]
modules/gui/macosx/VLCTextfieldPanelController.m [new file with mode: 0644]
modules/gui/macosx/VLCVideoEffectsWindowController.m

index 0a8e196..c6c13d5 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G24b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
index e692dbc..75edae7 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCPopupPanelController">
@@ -22,7 +22,7 @@
             <windowStyleMask key="styleMask" titled="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="265" y="520" width="612" height="159"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
             <value key="minSize" type="size" width="612" height="159"/>
             <value key="maxSize" type="size" width="612" height="159"/>
             <view key="contentView" id="14">
index fbf5417..d7d44a2 100644 (file)
@@ -33,6 +33,7 @@
                1C67C8AB1D58EC290079E1C1 /* VLCPLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF812F41B5599E40052293C /* VLCPLModel.m */; };
                1C7CB9181D787C4A00388902 /* VLCKeyboardBacklightControl.h in Sources */ = {isa = PBXBuildFile; fileRef = 7DF812EF1B555C8E0052293C /* VLCKeyboardBacklightControl.h */; };
                1C7CB9191D787C4A00388902 /* VLCKeyboardBacklightControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF812F01B555C8E0052293C /* VLCKeyboardBacklightControl.m */; };
+               1C7CB91C1D787E7600388902 /* VLCPopupPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */; };
                1C88BA5419DC7B2200645190 /* yosemite-window-close-graphite.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C88BA2419DC7B2200645190 /* yosemite-window-close-graphite.png */; };
                1C88BA5519DC7B2200645190 /* yosemite-window-close-graphite@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C88BA2519DC7B2200645190 /* yosemite-window-close-graphite@2x.png */; };
                1C88BA5619DC7B2200645190 /* yosemite-window-close-on-graphite.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C88BA2619DC7B2200645190 /* yosemite-window-close-on-graphite.png */; };
                1CCB5F821A62A724004C3E90 /* prefs_widgets.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E9CA1A406D7DEE800B7186C /* prefs_widgets.m */; };
                1CCB5F831A62A724004C3E90 /* prefs.h in Sources */ = {isa = PBXBuildFile; fileRef = 8ED6C28503E2EB1C0059A3A7 /* prefs.h */; };
                1CCB5F841A62A724004C3E90 /* prefs.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ED6C28603E2EB1C0059A3A7 /* prefs.m */; };
-               1CCB5F851A62A724004C3E90 /* SharedDialogs.h in Sources */ = {isa = PBXBuildFile; fileRef = CC461F6C160078340022423C /* SharedDialogs.h */; };
-               1CCB5F861A62A724004C3E90 /* SharedDialogs.m in Sources */ = {isa = PBXBuildFile; fileRef = CC461F6D160078340022423C /* SharedDialogs.m */; };
+               1CCB5F851A62A724004C3E90 /* VLCTextfieldPanelController.h in Sources */ = {isa = PBXBuildFile; fileRef = CC461F6C160078340022423C /* VLCTextfieldPanelController.h */; };
+               1CCB5F861A62A724004C3E90 /* VLCTextfieldPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = CC461F6D160078340022423C /* VLCTextfieldPanelController.m */; };
                1CCB5F871A62A724004C3E90 /* simple_prefs.h in Sources */ = {isa = PBXBuildFile; fileRef = CCB24D5E0D54BBAE004D780C /* simple_prefs.h */; };
                1CCB5F881A62A724004C3E90 /* simple_prefs.m in Sources */ = {isa = PBXBuildFile; fileRef = CCB24D5D0D54BBAE004D780C /* simple_prefs.m */; };
                1CCB5F891A62A724004C3E90 /* VLCStringUtility.h in Sources */ = {isa = PBXBuildFile; fileRef = CC269A4615E7947F00F2FDC9 /* VLCStringUtility.h */; };
                1C67C8A41D58C0980079E1C1 /* VLCHelpWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCHelpWindowController.m; path = ../../../modules/gui/macosx/VLCHelpWindowController.m; sourceTree = "<group>"; };
                1C67C8A61D58C0A40079E1C1 /* VLCAboutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCAboutWindowController.h; path = ../../../modules/gui/macosx/VLCAboutWindowController.h; sourceTree = "<group>"; };
                1C67C8A71D58C0A40079E1C1 /* VLCAboutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCAboutWindowController.m; path = ../../../modules/gui/macosx/VLCAboutWindowController.m; sourceTree = "<group>"; };
+               1C7CB91A1D787E7600388902 /* VLCPopupPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPopupPanelController.h; path = ../../../modules/gui/macosx/VLCPopupPanelController.h; sourceTree = "<group>"; };
+               1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPopupPanelController.m; path = ../../../modules/gui/macosx/VLCPopupPanelController.m; sourceTree = "<group>"; };
                1C88BA2419DC7B2200645190 /* yosemite-window-close-graphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "yosemite-window-close-graphite.png"; sourceTree = "<group>"; };
                1C88BA2519DC7B2200645190 /* yosemite-window-close-graphite@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "yosemite-window-close-graphite@2x.png"; sourceTree = "<group>"; };
                1C88BA2619DC7B2200645190 /* yosemite-window-close-on-graphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "yosemite-window-close-on-graphite.png"; sourceTree = "<group>"; };
                CC448A6113B68A0B009F72E0 /* VLCCoreInteraction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = VLCCoreInteraction.m; path = ../../../modules/gui/macosx/VLCCoreInteraction.m; sourceTree = SOURCE_ROOT; };
                CC448A6213B68A0B009F72E0 /* VLCMainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VLCMainWindow.h; path = ../../../modules/gui/macosx/VLCMainWindow.h; sourceTree = SOURCE_ROOT; };
                CC448A6313B68A0B009F72E0 /* VLCMainWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = VLCMainWindow.m; path = ../../../modules/gui/macosx/VLCMainWindow.m; sourceTree = SOURCE_ROOT; };
-               CC461F6C160078340022423C /* SharedDialogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = SharedDialogs.h; path = ../../../modules/gui/macosx/SharedDialogs.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
-               CC461F6D160078340022423C /* SharedDialogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SharedDialogs.m; path = ../../../modules/gui/macosx/SharedDialogs.m; sourceTree = SOURCE_ROOT; };
+               CC461F6C160078340022423C /* VLCTextfieldPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = VLCTextfieldPanelController.h; path = ../../../modules/gui/macosx/VLCTextfieldPanelController.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+               CC461F6D160078340022423C /* VLCTextfieldPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCTextfieldPanelController.m; path = ../../../modules/gui/macosx/VLCTextfieldPanelController.m; sourceTree = SOURCE_ROOT; };
                CC4A33210F8CB017000FC4A7 /* VLCCoreDialogProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCoreDialogProvider.m; path = ../../../modules/gui/macosx/VLCCoreDialogProvider.m; sourceTree = SOURCE_ROOT; };
                CC4A33220F8CB017000FC4A7 /* VLCCoreDialogProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCoreDialogProvider.h; path = ../../../modules/gui/macosx/VLCCoreDialogProvider.h; sourceTree = SOURCE_ROOT; };
                CC4D67F71348F601003FCC5B /* specific.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = specific.c; path = ../../../src/darwin/specific.c; sourceTree = "<group>"; };
                                8ED6C28603E2EB1C0059A3A7 /* prefs.m */,
                                633121CA1B51122700E636DA /* VLCResumeDialogController.h */,
                                633121CB1B51122700E636DA /* VLCResumeDialogController.m */,
-                               CC461F6C160078340022423C /* SharedDialogs.h */,
-                               CC461F6D160078340022423C /* SharedDialogs.m */,
+                               CC461F6C160078340022423C /* VLCTextfieldPanelController.h */,
+                               CC461F6D160078340022423C /* VLCTextfieldPanelController.m */,
+                               1C7CB91A1D787E7600388902 /* VLCPopupPanelController.h */,
+                               1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */,
                                CCB24D5E0D54BBAE004D780C /* simple_prefs.h */,
                                CCB24D5D0D54BBAE004D780C /* simple_prefs.m */,
                                CC269A4615E7947F00F2FDC9 /* VLCStringUtility.h */,
                                1CCB5F651A62A724004C3E90 /* VLCCoreDialogProvider.m in Sources */,
                                1CCB5F661A62A724004C3E90 /* VLCCoreInteraction.h in Sources */,
                                6BBBB8AA1D108A17001BD9BA /* VLCRendererDialog.m in Sources */,
+                               1C7CB91C1D787E7600388902 /* VLCPopupPanelController.m in Sources */,
                                1CCB5F671A62A724004C3E90 /* VLCCoreInteraction.m in Sources */,
                                1CCB5F681A62A724004C3E90 /* VLCDebugMessageWindowController.h in Sources */,
                                1CCB5F691A62A724004C3E90 /* VLCDebugMessageWindowController.m in Sources */,
                                1CCB5F821A62A724004C3E90 /* prefs_widgets.m in Sources */,
                                1CCB5F831A62A724004C3E90 /* prefs.h in Sources */,
                                1CCB5F841A62A724004C3E90 /* prefs.m in Sources */,
-                               1CCB5F851A62A724004C3E90 /* SharedDialogs.h in Sources */,
-                               1CCB5F861A62A724004C3E90 /* SharedDialogs.m in Sources */,
+                               1CCB5F851A62A724004C3E90 /* VLCTextfieldPanelController.h in Sources */,
+                               1CCB5F861A62A724004C3E90 /* VLCTextfieldPanelController.m in Sources */,
                                1CCB5F871A62A724004C3E90 /* simple_prefs.h in Sources */,
                                1CCB5F881A62A724004C3E90 /* simple_prefs.m in Sources */,
                                1CCB5F891A62A724004C3E90 /* VLCStringUtility.h in Sources */,
index 866a514..d8c3678 100644 (file)
@@ -57,7 +57,8 @@ libmacosx_plugin_la_SOURCES = \
        PXSourceList.h PXSourceList.m \
        PXSourceListDataSource.h PXSourceListDelegate.h \
        SideBarItem.h SideBarItem.m \
-       SharedDialogs.h SharedDialogs.m \
+       VLCPopupPanelController.h VLCPopupPanelController.m \
+       VLCTextfieldPanelController.h VLCTextfieldPanelController.m \
        simple_prefs.h simple_prefs.m \
        SPInvocationGrabbing.h SPInvocationGrabbing.m \
        SPMediaKeyTap.h SPMediaKeyTap.m \
diff --git a/modules/gui/macosx/SharedDialogs.h b/modules/gui/macosx/SharedDialogs.h
deleted file mode 100644 (file)
index ffe3efd..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * SharedDialogs.h: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012 Felix Paul Kühne
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-@interface VLCTextfieldPanelController : NSWindowController
-
-@property (weak) IBOutlet NSTextField *titleLabel;
-@property (weak) IBOutlet NSTextField *subtitleLabel;
-@property (weak) IBOutlet NSTextField *textField;
-@property (weak) IBOutlet NSButton *cancelButton;
-@property (weak) IBOutlet NSButton *okButton;
-
-@property (readwrite, assign) NSString *titleString;
-@property (readwrite, assign) NSString *subTitleString;
-@property (readwrite, assign) NSString *okButtonString;
-@property (readwrite, assign) NSString *cancelButtonString;
-
-/**
- * Completion handler for textfield panel
- * \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
- * \param resultingText Resulting text string entered in panel.
- */
-typedef void(^TextfieldPanelCompletionBlock)(NSInteger returnCode, NSString *resultingText);
-
-/**
- * Shows the panel as a modal dialog with window as its owner.
- * \param window Parent window for the dialog.
- * \param handler Completion block.
- */
-- (void)runModalForWindow:(NSWindow *)window completionHandler:(TextfieldPanelCompletionBlock)handler;
-
-- (IBAction)windowElementAction:(id)sender;
-
-@end
-
-
-@interface VLCPopupPanelController : NSWindowController
-
-@property (weak) IBOutlet NSTextField *titleLabel;
-@property (weak) IBOutlet NSTextField *subtitleLabel;
-@property (weak) IBOutlet NSPopUpButton *popupButton;
-@property (weak) IBOutlet NSButton *cancelButton;
-@property (weak) IBOutlet NSButton *okButton;
-
-@property (readwrite, assign) NSString *titleString;
-@property (readwrite, assign) NSString *subTitleString;
-@property (readwrite, assign) NSString *okButtonString;
-@property (readwrite, assign) NSString *cancelButtonString;
-@property (readwrite, assign) NSArray *popupButtonContent;
-
-/**
- * Completion handler for popup panel
- * \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
- * \param selectedIndex Selected index of the popup in panel.
- */
-typedef void(^PopupPanelCompletionBlock)(NSInteger returnCode, NSInteger selectedIndex);
-
-/**
- * Shows the panel as a modal dialog with window as its owner.
- * \param window Parent window for the dialog.
- * \param handler Completion block.
- */
-- (void)runModalForWindow:(NSWindow *)window completionHandler:(PopupPanelCompletionBlock)handler;
-
-- (IBAction)windowElementAction:(id)sender;
-
-@end
diff --git a/modules/gui/macosx/SharedDialogs.m b/modules/gui/macosx/SharedDialogs.m
deleted file mode 100644 (file)
index 695e7ed..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
- * SharedDialogs.m: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012 Felix Paul Kühne
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import "SharedDialogs.h"
-
-@interface VLCTextfieldPanelController()
-{
-    TextfieldPanelCompletionBlock _completionBlock;
-}
-
-@end
-
-@implementation VLCTextfieldPanelController
-
-
-- (id)init
-{
-    self = [super initWithWindowNibName:@"TextfieldPanel"];
-
-    return self;
-}
-
-- (IBAction)windowElementAction:(id)sender
-{
-    [self.window orderOut:sender];
-    [NSApp endSheet: self.window];
-
-    if (_completionBlock)
-        _completionBlock(sender == _okButton ? NSOKButton : NSCancelButton, [_textField stringValue]);
-}
-
-- (void)runModalForWindow:(NSWindow *)window completionHandler:(TextfieldPanelCompletionBlock)handler;
-{
-    [self window];
-
-    [_titleLabel setStringValue:self.titleString];
-    [_subtitleLabel setStringValue:self.subTitleString];
-    [_cancelButton setTitle:self.cancelButtonString];
-    [_okButton setTitle:self.okButtonString];
-    [_textField setStringValue:@""];
-
-    _completionBlock = [handler copy];
-
-    [NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:NULL contextInfo:nil];
-}
-
-@end
-
-@interface VLCPopupPanelController()
-{
-    PopupPanelCompletionBlock _completionBlock;
-}
-@end
-
-@implementation VLCPopupPanelController
-
-- (id)init
-{
-    self = [super initWithWindowNibName:@"PopupPanel"];
-
-    return self;
-}
-
-- (IBAction)windowElementAction:(id)sender
-{
-    [self.window orderOut:sender];
-    [NSApp endSheet: self.window];
-
-    if (_completionBlock)
-        _completionBlock(sender == _okButton ? NSOKButton : NSCancelButton, [_popupButton indexOfSelectedItem]);
-}
-
-- (void)runModalForWindow:(NSWindow *)window completionHandler:(PopupPanelCompletionBlock)handler;
-{
-    [self window];
-
-    [_titleLabel setStringValue:self.titleString];
-    [_subtitleLabel setStringValue:self.subTitleString];
-    [_cancelButton setTitle:self.cancelButtonString];
-    [_okButton setTitle:self.okButtonString];
-    [_popupButton removeAllItems];
-    for (NSString *value in self.popupButtonContent)
-        [[_popupButton menu] addItemWithTitle:value action:nil keyEquivalent:@""];
-
-    _completionBlock = [handler copy];
-
-    [NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:NULL contextInfo:nil];
-}
-
-@end
index 9e9bbc0..444edbb 100644 (file)
@@ -30,7 +30,8 @@
 #import "VLCAudioEffectsWindowController.h"
 #import "../../audio_filter/equalizer_presets.h"
 #import "CompatibilityFixes.h"
-#import "SharedDialogs.h"
+#import "VLCPopupPanelController.h"
+#import "VLCTextfieldPanelController.h"
 
 #import <vlc_common.h>
 
index 94782bb..d4a5152 100644 (file)
@@ -26,7 +26,8 @@
 #import "VLCMain.h"
 #import "VLCPlaylist.h"
 #import "misc.h"
-#import "SharedDialogs.h"
+#import "VLCPopupPanelController.h"
+#import "VLCTextfieldPanelController.h"
 
 #import <vlc_common.h>
 #import <vlc_url.h>
diff --git a/modules/gui/macosx/VLCTextfieldPanelController.h b/modules/gui/macosx/VLCTextfieldPanelController.h
new file mode 100644 (file)
index 0000000..f21d5e3
--- /dev/null
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * VLCTextfieldPanelController.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@interface VLCTextfieldPanelController : NSWindowController
+
+@property (weak) IBOutlet NSTextField *titleLabel;
+@property (weak) IBOutlet NSTextField *subtitleLabel;
+@property (weak) IBOutlet NSTextField *textField;
+@property (weak) IBOutlet NSButton *cancelButton;
+@property (weak) IBOutlet NSButton *okButton;
+
+@property (readwrite, assign) NSString *titleString;
+@property (readwrite, assign) NSString *subTitleString;
+@property (readwrite, assign) NSString *okButtonString;
+@property (readwrite, assign) NSString *cancelButtonString;
+
+/**
+ * Completion handler for textfield panel
+ * \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
+ * \param resultingText Resulting text string entered in panel.
+ */
+typedef void(^TextfieldPanelCompletionBlock)(NSInteger returnCode, NSString *resultingText);
+
+/**
+ * Shows the panel as a modal dialog with window as its owner.
+ * \param window Parent window for the dialog.
+ * \param handler Completion block.
+ */
+- (void)runModalForWindow:(NSWindow *)window completionHandler:(TextfieldPanelCompletionBlock)handler;
+
+- (IBAction)windowElementAction:(id)sender;
+
+@end
diff --git a/modules/gui/macosx/VLCTextfieldPanelController.m b/modules/gui/macosx/VLCTextfieldPanelController.m
new file mode 100644 (file)
index 0000000..cab93a2
--- /dev/null
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * VLCTextfieldPanelController.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCTextfieldPanelController.h"
+
+@interface VLCTextfieldPanelController()
+{
+    TextfieldPanelCompletionBlock _completionBlock;
+}
+
+@end
+
+@implementation VLCTextfieldPanelController
+
+
+- (id)init
+{
+    self = [super initWithWindowNibName:@"TextfieldPanel"];
+
+    return self;
+}
+
+- (IBAction)windowElementAction:(id)sender
+{
+    [self.window orderOut:sender];
+    [NSApp endSheet: self.window];
+
+    if (_completionBlock)
+        _completionBlock(sender == _okButton ? NSOKButton : NSCancelButton, [_textField stringValue]);
+}
+
+- (void)runModalForWindow:(NSWindow *)window completionHandler:(TextfieldPanelCompletionBlock)handler;
+{
+    [self window];
+
+    [_titleLabel setStringValue:self.titleString];
+    [_subtitleLabel setStringValue:self.subTitleString];
+    [_cancelButton setTitle:self.cancelButtonString];
+    [_okButton setTitle:self.okButtonString];
+    [_textField setStringValue:@""];
+
+    _completionBlock = [handler copy];
+
+    [NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:NULL contextInfo:nil];
+}
+
+@end
index e84faa5..af2b337 100644 (file)
@@ -24,7 +24,8 @@
 #import "CompatibilityFixes.h"
 #import "VLCMain.h"
 #import "VLCVideoEffectsWindowController.h"
-#import "SharedDialogs.h"
+#import "VLCPopupPanelController.h"
+#import "VLCTextfieldPanelController.h"
 #import "VLCCoreInteraction.h"
 
 @interface VLCVideoEffectsWindowController()