CatNiP docutest
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
|
00001 00010 #import <UIKit/UIKit.h> 00011 00012 #import "UIScoreView.h" 00013 00014 #import "NotesPopoverController.h" 00015 #import "ScorePopoverController.h" 00016 #import "DetailPopoverController.h" 00017 #import "PlaylistPopoverController.h" 00018 00019 #import "IMSLPQueryHelper.h" 00020 00021 #import "IMSLPDelegateDataSource.h" 00022 #import "LocalDelegateDataSource.h" 00023 #import "PlaylistsDelegateDataSource.h" 00024 00025 #import "ScoreData.h" 00026 #import "CompositionData.h" 00027 00028 #import "LocalDataHandler.h" 00029 #import "LocalScoreData.h" 00030 #import "Playlist.h" 00031 00032 #import "CatNiPErrorConsumer.h" 00033 #import "CatNiPErrorManager.h" 00034 00035 // Library types 00036 00037 #define IMSLP 0 00038 #define LOCAL 1 00039 #define PLAYLISTS 2 00040 00041 @interface CatNiPViewController : UIViewController <CatNiPErrorConsumer> { 00042 00043 // toolbar and its contents 00044 UIView *toolbarView; 00045 UIToolbar *toolbar; 00046 UIBarButtonItem *libraryButton; 00047 UISegmentedControl *libraryType; 00048 UISegmentedControl *searchType; // not currently implemented 00049 UIBarButtonItem *notesButton; 00050 00051 // left side of library elements 00052 UIView *libraryViewLeft; 00053 UITableView *libraryTableViewLeft; 00054 UISearchBar *librarySearchbarLeft; 00055 UIActivityIndicatorView *libraryActivityIndicatorLeft; 00056 00057 // right side of library elements 00058 UIView *libraryViewRight; 00059 UITableView *libraryTableViewRight; 00060 UIBarButtonItem *fitToWidthButton; 00061 UISearchBar *librarySearchbarRight; 00062 00063 // default UIFont. Initialized in controller's init. 00064 UIFont *defaultFont; 00065 00066 // popover for showing all scores of selected composition 00067 UIPopoverController *scorePop; 00068 00069 // popover for showing detail info about score 00070 UIPopoverController *detailPop; 00071 00072 // popover and its view for user's own notes about currently selected sheets 00073 UIPopoverController *notesPop; 00074 UITextView *notesTextView; 00075 00076 // popover for selecting (creating) playlist 00077 UIPopoverController *playlistPop; 00078 00079 // popovers' contentviews' controllers 00080 DetailPopoverController *dpc; 00081 NotesPopoverController *npc; 00082 ScorePopoverController *spc; 00083 PlaylistPopoverController *ppc; 00084 00085 // 00086 CompositionData *_readComposition; 00087 00088 // delegates and datasources for different librarytypes 00089 IMSLPDelegateDataSource *IMSLPdds; 00090 LocalDelegateDataSource *LOCALdds; 00091 PlaylistsDelegateDataSource *PLAYLISTSdds; 00092 00093 Playlist *dummyPlaylist; 00094 00095 Playlist *_currentPlaylist; 00096 LocalScoreData *currentScore; 00097 //NSString *currentlyOpenedFile; 00098 NSInteger currentPlaylistIndex; 00099 00100 // view for showing currently selected sheets for details check ScoreViewer-group 00101 UIScoreView *scoreView; 00102 } 00103 00104 /*** Toolbar for all teh fun, yeh? ***/ 00105 @property (nonatomic, retain) IBOutlet UIToolbar *toolbar; 00106 /*** which has a home in some view ***/ 00107 @property (nonatomic, retain) IBOutlet UIView *toolbarView; 00108 /*** and some fancy button in there ***/ 00109 @property (nonatomic, retain) IBOutlet UIBarButtonItem *libraryButton; 00110 /*** previous/next score in playlist button ***/ 00111 @property (nonatomic, retain) IBOutlet UIBarButtonItem *playlistNavigateButton; 00112 /*** view for sheets ***/ 00113 @property (nonatomic, retain) IBOutlet UIScoreView *scoreView; 00114 00115 /*** delegates and datasources for different library types ***/ 00116 @property (nonatomic, retain) IMSLPDelegateDataSource *imslpDelegateAndDataSource; 00117 @property (nonatomic, retain) LocalDelegateDataSource *localDelegateAndDataSource; 00118 @property (nonatomic, retain) PlaylistsDelegateDataSource *playlistsDelegateAndDataSource; 00119 00120 /*** Control for searching local or IMSLP(net) files ***/ 00121 /* IMSLP = 0 - LOCAL = 1 - PLAYLIST = 2 */ 00122 @property (nonatomic, retain) IBOutlet UISegmentedControl *libraryType; 00123 00124 @property (nonatomic, retain) IBOutlet UISegmentedControl *playlistNavigateSControl; 00125 00126 /*** NOT SHOWN IN UI AT THE MOMENT. Control for searchType. Only composer search implemented yet. ***/ 00127 @property (nonatomic, retain) IBOutlet UISegmentedControl *searchType; 00128 00129 /*** libraryViewX contains librarySearchbarX,libraryTableViewX and activityIndicatorX ***/ 00130 @property (nonatomic, retain) IBOutlet UIView *libraryViewRight; 00131 @property (nonatomic, retain) IBOutlet UIView *libraryViewLeft; 00132 @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *libraryActivityIndicatorLeft; 00133 00134 // composer search and results 00135 @property (nonatomic, retain) IBOutlet UISearchBar *librarySearchbarLeft; 00136 @property (nonatomic, retain) IBOutlet UITableView *libraryTableViewLeft; 00137 00138 // composition search and results 00139 @property (nonatomic, retain) IBOutlet UISearchBar *librarySearchbarRight; 00140 @property (nonatomic, retain) IBOutlet UITableView *libraryTableViewRight; 00141 00142 // button for resizing the score view to fit-to-width 00143 @property (nonatomic, retain) IBOutlet UIBarButtonItem *fitToWidthButton; 00144 00145 // button for showing notes about the open score 00146 @property (nonatomic, retain) IBOutlet UIBarButtonItem *notesButton; 00147 00148 // popovers 00149 @property (nonatomic, retain) IBOutlet NotesPopoverController *npc; 00150 @property (nonatomic, retain) IBOutlet ScorePopoverController *spc; 00151 @property (nonatomic, retain) IBOutlet DetailPopoverController *dpc; 00152 @property (nonatomic, retain) IBOutlet PlaylistPopoverController *ppc; 00153 00154 @property (nonatomic, retain) UIFont *defaultFont; 00155 @property (retain) Playlist* currentPlaylist; 00156 @property (retain) LocalScoreData *currentScore; 00157 @property (copy) NSString* currentlyOpenedFile; 00158 @property (assign) NSInteger currentPlaylistIndex; 00159 00160 /*** UISearchBarDelegate protocol's functions ***/ 00161 - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; 00162 - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; 00163 00164 /*** UIGestureRecognizer functions. Gesture recognizers are initialized in viewDidLoad ***/ 00165 -(void)scoreView_tapped:(UIGestureRecognizer *)recognizer; 00166 00167 /*** Custom functions for application ***/ 00168 - (IBAction)fitToWidth:(id)sender; 00169 00170 // shows and hides notesPop 00171 - (IBAction)showHideNotes:(id)sender; 00172 00173 // shows and hides libViews 00174 - (IBAction)showHideLibrary:(id)sender; 00175 00176 // gief animations plox 00177 -(void)showToolbarWithAnimation; 00178 -(void)hideToolbarWithAnimation; 00179 -(void)hideViewWithAnimation:(UIView *)view; 00180 -(void)showViewWithAnimation:(UIView *)view; 00181 00182 // lazy LCP search function for searchbars 00183 - (NSInteger)arrayToSearch:(NSArray *)array textToSearch:(NSString *)text; 00184 -(NSInteger)compositionDatasToSearch:(NSArray *)array textToSearch:(NSString *)text; 00185 00186 // shows score sheets that are clicked in scorePopover 00187 -(void)showScoreSheets:(LocalScoreData *)score; 00188 // score sheet opening from a file, both for a single sheet or when navigating a playlist 00189 -(BOOL)openScoreSheet:(LocalScoreData *)score; 00190 // gives cell default appearance 00191 -(UITableViewCell *)tableView:(UITableView *)tb createCellWithIdentifier:(NSString *)identifier; 00192 00193 // open ScorePopoverController's content in a new UIPopoverController 00194 -(void)openScorePopover:(CompositionData *)scores editable:(BOOL)ed; 00195 -(void)dismissScorePopover; 00196 00197 // open DetailPopoverController's content in a new UIPopoverController with given parameters 00198 -(void)openDetailPopoverFromRect:(CGRect)rect inView:(UIView *)view withScore:(ScoreData *)score ofComposer:(NSString *)composer andComposition:(NSString *)composition; 00199 00200 -(void)openPlaylistPopover:(LocalScoreData *)score; 00201 -(void)dismissPlaylistPopover; 00202 00203 @end