CatNiP -test sprint-4-interim
catnip
|
00001 // 00002 // CatNiPViewController.h 00003 // CatNiP 00004 // 00005 // Main UIViewController for application. Contains scores toolbar and 00006 // library search elements. 00007 // 00008 // 00009 // Created by Simo M Linkola, tkol on 5/23/11. 00010 // Copyright 2011 com.helsinki.fi. All rights reserved. 00011 // 00012 00013 #import <UIKit/UIKit.h> 00014 #import "UIScoreView.h" 00015 #import "IMSLPScoreData.h" 00016 #import "IMSLPCompositionData.h" 00017 #import "NotesPopoverController.h" 00018 #import "Playlist.h" 00019 #import "IMSLPDelegateDataSource.h" 00020 #import "LocalDelegateDataSource.h" 00021 #import "PlaylistsDelegateDataSource.h" 00022 #import "LocalScoreData.h" 00023 #import "LocalCompositionData.h" 00024 #import "LocalDataHandler.h" 00025 00026 // Library types 00027 #define LIBRARYTYPE _libType.selectedSegmentIndex 00028 #define IMSLP 0 00029 #define LOCAL 1 00030 #define PLAYLISTS 2 00031 00032 // some "clarifying" macros to make code more readable 00033 #define TLEFT _libTabL 00034 #define TRIGHT _libTabR 00035 #define SLEFT _libSearchL 00036 #define SRIGHT _libSearchR 00037 #define VLEFT _libViewL 00038 #define VRIGHT _libViewR 00039 00040 #define SELECTED_COMPOSER [_composers objectAtIndex:[[_libTabL indexPathForSelectedRow] row]] 00041 #define SELECTED_COMPOSITION [_compositions objectAtIndex:[[_libTabR indexPathForSelectedRow] row]] 00042 00043 #define SELECTED_PATH_AT_LEFT_TABLE [_libTabL indexPathForSelectedRow] 00044 #define SELECTED_ROW_AT_LEFT_TABLE [[_libTabL indexPathForSelectedRow] row] 00045 #define SELECTED_SECTION_AT_LEFT_TABLE [[_libTabL indexPathForSelectedRow] section] 00046 #define SELECTED_PATH_AT_RIGHT_TABLE [_libTabR indexPathForSelectedRow] 00047 #define SELECTED_ROW_AT_RIGHT_TABLE [[_libTabR indexPathForSelectedRow] row] 00048 #define SELECTED_SECTION_AT_RIGHT_TABLE [[_libTabR indexPathForSelectedRow] section] 00049 00050 @interface CatNiPViewController : UIViewController { 00051 00052 // toolbar and its contents 00053 UIView *_toolbarView; 00054 UIToolbar *_toolbar; 00055 UIBarButtonItem *_libraryButton; 00056 UISegmentedControl *_libType; 00057 UISegmentedControl *_searchType; // not currently implemented 00058 UIBarButtonItem *_notesButton; 00059 00060 // left side of library elements 00061 UIView *_libViewL; 00062 UITableView *_libTabL; 00063 UISearchBar *_libSearchL; 00064 UIActivityIndicatorView *_activityIndicatorL; 00065 00066 // right side of library elements 00067 UIView *_libViewR; 00068 UITableView *_libTabR; 00069 UISearchBar *_libSearchR; 00070 00071 // popover for showing all scores of selected composition 00072 UIPopoverController *scorePop; 00073 00074 // default UIFont. Initialized in controller's init. 00075 UIFont *defaultFont; 00076 00077 // arrays for storing composers and compositions. 00078 NSMutableArray *_composers; 00079 NSMutableArray *_compositions; 00080 NSMutableArray *IMSLPcomposers; 00081 NSMutableArray *localcomposers; 00082 00083 // array for user created playlists. loaded from local memory. 00084 NSMutableArray *playlists; 00085 00086 // popover and its view for user's own notes about currently selected sheets 00087 UIPopoverController *notesPop; 00088 UITextView *notesTextView; 00089 00090 // view for showing currently selected sheets for details check ScoreViewer-group 00091 UIScoreView *_scoreView; 00092 00093 // 00094 IMSLPCompositionData *_readComposition; 00095 00096 IMSLPDelegateDataSource *IMSLPdds; 00097 LocalDelegateDataSource *LOCALdds; 00098 PlaylistsDelegateDataSource *PLAYLISTSdds; 00099 00100 Playlist *dummyPlaylist; 00101 00102 // for deleting all downloaded pdf:s while application is still in developing state 00103 NSMutableArray *downloadedFiles; 00104 } 00105 00106 00107 /********************** for prototype ****************************/ 00108 00109 // for performance test 00110 //-(NSMutableArray *)sumCrashTestDummiesPlz:(void *)a; 00111 00112 00113 /*****************************************************************/ 00114 00115 00116 /*** Array for storing data of selected LIBRARYTYPE ***/ 00117 /* Array's contents will change in the span of application's life as user */ 00118 /* selects local or IMSLP library to search for notes. If library type is */ 00119 /* changed, the array's contents are removed and new objects (NSStrings) */ 00120 /* are inserted based on user's selection. */ 00121 @property (retain) NSMutableArray *libraryDataTableLeft; 00122 @property (retain) NSMutableArray *libraryDataTableRight; 00123 00124 /*** Toolbar for all teh fun, yeh? ***/ 00125 @property (nonatomic, retain) IBOutlet UIToolbar *toolbar; 00126 /*** which has a home in some view ***/ 00127 @property (nonatomic, retain) IBOutlet UIView *toolbarView; 00128 /*** and some fancy button in there ***/ 00129 @property (nonatomic, retain) IBOutlet UIBarButtonItem *libraryButton; 00130 00131 /*** Scrollview for sheets ***/ 00132 @property (nonatomic, retain) IBOutlet UIScoreView *scoreView; 00133 00134 /*** delegates and datasources for different library types ***/ 00135 @property (nonatomic, retain) IMSLPDelegateDataSource *imslpDelegateAndDataSource; 00136 @property (nonatomic, retain) LocalDelegateDataSource *localDelegateAndDataSource; 00137 @property (nonatomic, retain) PlaylistsDelegateDataSource *playlistsDelegateAndDataSource; 00138 00139 /*** Control for searching local or IMSLP(net) files ***/ 00140 /* IMSLP = 0 - LOCAL = 1 - PLAYLIST = 2 */ 00141 @property (nonatomic, retain) IBOutlet UISegmentedControl *libraryType; 00142 00143 /*** NOT SHOWN IN UI AT THE MOMENT. Control for searchType. Only composer search implemented yet. ***/ 00144 @property (nonatomic, retain) IBOutlet UISegmentedControl *searchType; 00145 00146 /*** libraryViewX contains librarySearchbarX,libraryTableViewX and activityIndicatorX ***/ 00147 @property (nonatomic, retain) IBOutlet UIView *libraryViewRight; 00148 @property (nonatomic, retain) IBOutlet UIView *libraryViewLeft; 00149 @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicatorLeft; 00150 00151 // composer search and results 00152 @property (nonatomic, retain) IBOutlet UISearchBar *librarySearchbarLeft; 00153 @property (nonatomic, retain) IBOutlet UITableView *libraryTableViewLeft; 00154 00155 // composition search and results 00156 @property (nonatomic, retain) IBOutlet UISearchBar *librarySearchbarRight; 00157 @property (nonatomic, retain) IBOutlet UITableView *libraryTableViewRight; 00158 00159 // button for showing notes about the open score 00160 @property (nonatomic, retain) IBOutlet UIBarButtonItem *notesButton; 00161 00162 /*** UISearchBarDelegate protocol's functions ***/ 00163 - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; 00164 - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; 00165 00166 /*** UIGestureRecognizer functions. Gesture recognizers are initialized in viewDidLoad ***/ 00167 -(void)scoreView_tapped:(UIGestureRecognizer *)recognizer; 00168 00169 /*** Custom functions for application ***/ 00170 - (IBAction)fitToWidth:(id)sender; 00171 00172 // shows and hides notesPop 00173 - (IBAction)showHideNotes:(id)sender; 00174 00175 // shows and hides libViews 00176 - (IBAction)showHideLibrary:(id)sender; 00177 00178 // gief animations plox 00179 -(void)showToolbarWithAnimation; 00180 -(void)hideToolbarWithAnimation; 00181 -(void)hideViewWithAnimation:(UIView *)view; 00182 -(void)showViewWithAnimation:(UIView *)view; 00183 00184 // lazy LCP search function for searchbars 00185 - (NSInteger)arrayToSearch:(NSArray *)array textToSearch:(NSString *)text ; 00186 00187 // shows score sheets that are clicked in scorePopover 00188 -(void)showScoreSheets:(NSIndexPath *)indexPath; 00189 00190 // gives cell a default appearance 00191 -(UITableViewCell *)tableView:(UITableView *)tb createCellWithIdentifier:(NSString *)identifier; 00192 -(void)configureCell: (UITableViewCell *)cell; 00193 00194 // open ScorePopoverController's content in a new UIPopoverController 00195 -(void)openScorePopoverWithIMSLPCompositionData:(IMSLPCompositionData *)scores; 00196 -(void)openScorePopoverWithLocalCompositionData:(LocalCompositionData *)scores; 00197 00198 @end