/* Copyright (c) 2004, Noah Sorscher
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 	¥ 	Redistributions of source code must retain the above copyright
 * 	notice, this list of conditions and the following disclaimer.
 * 	¥ 	Redistributions in binary form must reproduce the above copyright
 * 	notice, this list of conditions and the following disclaimer in the
 * 	documentation and/or other materials provided with the distribution.
 * 	¥ 	Neither the name of the Noah Sorscher nor the names of its
 * 	contributors may be used to endorse or promote products derived from
 * 	this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
/* tController */

#import <Cocoa/Cocoa.h>
#import "MHUtil.h"
#import "tPlaylist.h"
#import "tPlayback.h"
#import "defaults.h"
#import "tLanguages.h"
#import "MHSprite.h"
#import "Object.h"
#import "MFClickThroughDisabler.h"
#import "MHToolbarItem.h"
#import "MHTableView.h"
#import "tFileSave.h"
#import "tTextView.h"
#import "MHWebInput.h"

@interface tController : NSObject
{
    IBOutlet id addColumnView, addComboBox,
                askMovies,
                autoColumns, customIcon, doubleClick,
                //editBox, editSplitView,
                editWarning,
                ffSpeed, floatWindow, highlightColor, iconCheckbox,
                iconDrawer, iconSelect,
                iconText, iconIndText, imageSplitView, imageView, infoText,
                init, lang,
                mainTabView, mainWindow, movieController, movieControls,
                movieView,
                navChapters, navInfo, navMain, navTracks, navPrevious, navNext,
                openingFileText,
                openingProgBar,
                openingWindow,
                openSize2, optIcon,
                pathLevels, picView,
                player, playlistSplitView, playlistTable, playlistAdd, playlistRemove,
                playOn,
                prefs,
                rememberSwitch, rowColoring,
                save,
                saveBeep, saveBrowseButton,
                saveButton,
                saveDirPath, saveInSourceFolder,
                saveSize,
                saveType,
                savingProg,
                savingText, searchContentView,
                searchField2, smartPLWindow,
                sprite, summaryTable,
                theChapters,
                theTable,
                theSaveTable, timeLine,
                timerInterval, tracks, tracksTable,
                totalMB,
                urlText,
                urlWindow, viewMenu,
                viewWindow, www;
    
    
    NSString *openPath;
    NSLock *openLock;
    BOOL cancelled;
    int moviesOpen;
    NSMutableArray *thePlaylists;
    NSMutableArray *movieChangeListeners;
    tFileSave *theSave;
    MFClickThroughDisabler *toolbarDisabler;
    BOOL opening;
    NSImageView *artworkView;
    int rightClickCol;
    tTextView *tableEditTextView, *tracksEditTextView, *summaryEditTextView;
    BOOL makeDupes;
}


///////////////////////////
//
//  Methods
//
///////////////////////


//+ (void)initialize;
- (MHMovie *)currentMovie;
- (MHMovie *)playingMovie;
- (void)setPlayingMovie:(MHMovie *)movie;
- (void)addMovieChangeListener:(id)listener; // movieChangeListeners must respond to the methods movieDidChangeTo:(MHMovie *)aMovie
- (void)setCurrentMovie:(MHMovie *)aMovie;
- (void)willDisposeMovie:(MHMovie *)aMovie sender:(id)sender;
//- (NSMatrix *)saveSize;
- (NSTableView *)mainTable;
- (NSTableView *)summaryTable;
- (IBAction)copyMetadataFromMenu:(id)sender;

- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
- (BOOL) tableView: (NSTableView *) tableView shouldSelectRow: (int) rowIndex;
- (void)setTableModel:(tPlaylist *)aModel;
- (void)addPlaylist:(tPlaylist *)newPlaylist;
- (IBAction)newPlaylist:(id)sender;
- (IBAction)newSmartPlaylist:(id)sender;
- (IBAction)editSmartPlaylist:(id)sender;
- (IBAction)removePlaylist:(id)sender;
- (NSArray *)playlists;

- (NSToolbarItem *)toolbar:(NSToolbar *)tb itemForItemIdentifier:(NSString *)tbit willBeInsertedIntoToolbar:(BOOL)flag;
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar;
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar;
- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem;
- (IBAction)customizeToolbar:(id)sender;
- (void)toolbarChanged;
- (void)refreshToolbarItems:(NSArray *)items;

- (IBAction)versionCheck:(id)sender;
- (void)openMovie;
//- (IBAction)editingDrawer:(id)sender;
- (void)timeline;
- (void)sprite;
- (void)www;
//- (BOOL)windowShouldClose:(id)sender;
- (IBAction)saveWarning:(id)sender;
- (void)controlTextDidChange:(NSNotification *)aNotification;
- (IBAction)okay:(id)sender;
//- (IBAction)testMethod:(id)sender;
- (IBAction)replaceMovieWith:(id)sender;
- (IBAction)openPlaylist:(id)sender;
- (IBAction)openFiles:(id)sender;
- (IBAction)openURL:(id)sender;
- (IBAction)openData:(id)sender;
- (IBAction)openDivx:(id)sender;
- (void)getMp3:(NSArray *)args;
//- (void)openMpegsFromArray:(NSArray *)paths;
- (void)openFilesFromArray:(NSArray *)paths;
- (void)openFilesFromArray:(NSArray *)paths model:(tPlaylist *)theModel;
- (IBAction)cancel:(id)sender;
- (void)updateTotals;
- (NSString *)getDisplayMovie:(int)movies;
//- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
- (IBAction)shuffle:(id)sender;
- (IBAction)setFloating:(id)sender;
//- (IBAction)getTimePoint:(id)sender;
- (IBAction)remove:(id)sender;
- (void)removeColumn:(id)sender;
- (void)removeRow:(id)sender;
- (IBAction)removeAll:(id)sender;
- (IBAction)showAllCols:(id)sender;
- (IBAction)play:(id)sender;
- (IBAction)openChapters:(id)sender;
- (void)savePrefs;
- (IBAction)nextMovie:(id)sender;
- (IBAction)prevMovie:(id)sender;
- (IBAction) changeMainTabViewSetting:(id)sender;
- (void)    setMainTabViewIndex:(int)index;
- (void)    setMainTabViewName:(NSString *)name;
- (IBAction)saveInSource:(id)sender;
- (IBAction)saveBox:(id)sender;
- (IBAction)selectChanged:(id)sender;
- (IBAction)saveFiles:(id)sender;
//- (void)saveFilesDir:(NSString *)path;
//- (IBAction)saveEdit:(id)sender;
- (IBAction)browseSaveDir:(id)sender;
- (IBAction)saveAsText:(id)sender;
- (NSDictionary *)parseTabDoc:(NSString *)path;
- (IBAction)saveAsXML:(id)sender;
- (void)awakeFromNib;
- (IBAction)addColumn:(id)sender;
- (IBAction)addColumnFromMenu:(id)sender;
- (void)setRightClickColumn:(int)aCol;
- (void)resizeColumns;
- (IBAction)search;
- (IBAction)unSearch:(id)sender;
- (IBAction)summary:(id)sender;
- (void)setMainWindow:(NSWindow *)newWindow;
- (NSWindow *)mainWindow;
- (void)setModel:(tPlaylist *)model;
- (tPlaylist *)getModel;
- (tPlaylist *)getTrueModel;
- (id)getChapters;
- (id)getPlayer;
- (NSTableView *)getTable;
- (NSComboBox *)getAddColumnBox;
- (NSImageView *)getArtworkView;
- (IBAction)toggleArtworkView:(id)sender;
- (int)getSaveType;
- (NSTextField *)getInfoText;
- (NSTextField *)getSummaryText;
- (NSColor *)getHighlightColor;
//- (BOOL)getRowColoring;
//- (NSButton *)editWarning;
//- (NSButton *)doubleClick;
- (IBAction)showInFinder:(id)sender;
//- (BOOL)beepOnSave;
//- (BOOL)askMovies;
//- (NSTextView *)getEditBox;
//- (NSTextField *)getEditPaneText;
- (int)getPathLevels;
- (IBAction)toggleIconDrawer:(id)sender;
//- (BOOL)setIcon;
//- (NSImage *)iconImage;
- (NSString *)iconPath;
- (IBAction)setIconFile:(id)sender;
- (IBAction)iconViewCheckbox:(id)sender;
- (IBAction)setIndIcon:(id)sender;
- (IBAction)setPicViewPic:(NSImage *)image;
//- (void)setOpenLock:(NSLock *)aLock;
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
//- (void) openFileAtPath:(NSString *)path;
- (NSArray *)expandURLFolders:(NSArray *)theArray;
- (NSArray *)expandStringFolder:(NSString *)thePathString;
- (BOOL)isMPEG:(NSString *)path;
- (double)stringToNSeconds: (NSString *)input;
@end
