| 
    CatNiP docutest 
   Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11 
   | 
 
#import <ScorePopoverController.h>

Public Member Functions | |
| (void) | - addToPlaylist: | 
| Opens playlist popover to select playlist in which the score associated with given button will be added.   | |
| (void) | - cancelDownload: | 
| Cancel's download of pdf associated with this button.   | |
| (UIView *) | - createAccessoryViewForIndexPath: | 
| creates accessory view depending on current LIBRARYTYPE   | |
| (ScoreListButton *) | - createAddToPlaylistButtonForScore: | 
| Create add to playlist button which sends actions to addToPlaylist:   | |
| (ScoreListButton *) | - createCancelButtonForScore: | 
| Create cancel button which sends actions to cancelDownload:   | |
| (ScoreListButton *) | - createDetailButtonForScore: | 
| Create detail button which sends actions to showDetailsForScore:   | |
| (ScoreListButton *) | - createDownloadButtonForScore: | 
| Create download button which sends actions to downloadScore:   | |
| (void) | - dealloc [implementation] | 
| (void) | - didReceiveMemoryWarning [implementation] | 
| (UIView *) | - downloadableAccessoryViewForIndexPath: | 
| Creates accessoryview for IMSLP score which can be downloaded.   | |
| (UIView *) | - downloadedAccessoryViewForIndexPath: | 
| Creates accessoryview for IMSLP score which is already downloaded.   | |
| (UIView *) | - downloadingAccessoryViewForIndexPath: | 
| Creates accessoryview for IMSLP score which is downloading at the moment.   | |
| (void) | - downloadScore: | 
| Starts downloading score's pdf associated with button and changes button's cell's accessoryview.   | |
| (UIView *) | - IMSLPAccessoryViewForIndexPath: | 
| Creates accessoryview for IMSLP scorecell in indexPath.   | |
| (id) | - initWithStyle:masterController:compositionData:editable: | 
| Basic init for ScorePopoverController, sets masterController = controller.   | |
| (UIView *) | - LocalAccessoryViewForIndexPath: | 
| Creates accessoryview for local score.   | |
| (NSInteger) | - numberOfSectionsInTableView: | 
| UITableViewDataSource protocol function's implementation.   | |
| (BOOL) | - shouldAutorotateToInterfaceOrientation: [implementation] | 
| (void) | - showDetailsForScore: | 
| Shows details popover about the score associated with given button.   | |
| (BOOL) | - tableView:canEditRowAtIndexPath: | 
| UITableViewDataSource protocol function's implementation.   | |
| (UITableViewCell *) | - tableView:cellForRowAtIndexPath: | 
| UITableViewDataSource protocol function's implementation.   | |
| (void) | - tableView:commitEditingStyle:forRowAtIndexPath: | 
| UITableViewDataSource protocol function's implementation.   | |
| (void) | - tableView:didSelectRowAtIndexPath: | 
| UITableViewDelegate protocol function's implementation.   | |
| (UITableViewCellEditingStyle) | - tableView:editingStyleForRowAtIndexPath: | 
| UITableViewDelegate protocol function's implementation.   | |
| (CGFloat) | - tableView:heightForHeaderInSection: | 
| UITableViewDelegate protocol function's implementation.   | |
| (CGFloat) | - tableView:heightForRowAtIndexPath: | 
| UITableViewDelegate protocol function's implementation.   | |
| (NSInteger) | - tableView:numberOfRowsInSection: [implementation] | 
| UITableViewDataSource protocol function's implementation.   | |
| (UIView *) | - tableView:viewForHeaderInSection: | 
| tableViewDelegate protocol function's implementation.   | |
| (void) | - updateProgressView: | 
| Updates UIProgressview associated with this NSTimer.   | |
| (void) | - viewDidAppear: [implementation] | 
| (void) | - viewDidDisappear: [implementation] | 
| (void) | - viewDidLoad [implementation] | 
| (void) | - viewDidUnload [implementation] | 
| (void) | - viewWillAppear: [implementation] | 
| (void) | - viewWillDisappear: [implementation] | 
Protected Attributes | |
| CatNiPViewController * | master | 
Properties | |
| NSString * | composer | 
| NSString * | composition | 
| CompositionData * | compositionData | 
| BOOL | editable | 
| IBOutlet CatNiPViewController * | master | 
| - (void) addToPlaylist: | (id) | button | 
Opens playlist popover to select playlist in which the score associated with given button will be added.
| addToPlaylist | sender of the action. Only ScoreListButtons allowed. | 
| - (void) cancelDownload: | (id) | button | 
Cancel's download of pdf associated with this button.
Accessoryview of this cell is updated after cancel.
| cancelDownload | sender of the action. Only ScoreListButtons allowed. | 

| - (UIView *) createAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
creates accessory view depending on current LIBRARYTYPE
Calls IMSLPAccessoryViewForIndexPath: or LocalAccessoryViewForIndexPath:
| IcreateAccessoryViewForIndexPath | indexpath for cell | 


| - (ScoreListButton *) createAddToPlaylistButtonForScore: | (ScoreData *) | score | 
Create add to playlist button which sends actions to addToPlaylist:

| - (ScoreListButton *) createCancelButtonForScore: | (ScoreData *) | score | 
Create cancel button which sends actions to cancelDownload:

| - (ScoreListButton *) createDetailButtonForScore: | (ScoreData *) | score | 
Create detail button which sends actions to showDetailsForScore:

| - (ScoreListButton *) createDownloadButtonForScore: | (ScoreData *) | score | 
Create download button which sends actions to downloadScore:

| - (void) dealloc |  [implementation] | 
        
| - (void) didReceiveMemoryWarning |  [implementation] | 
        
| - (UIView *) downloadableAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
Creates accessoryview for IMSLP score which can be downloaded.
Accessoryview has download button and detail button.
| downloadableAccessoryViewForIndexPath | indexpath for cell | 


| - (UIView *) downloadedAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
Creates accessoryview for IMSLP score which is already downloaded.
Accessoryview has 'check-mark' instead of download button and detail button.
| downloadedAccessoryViewForIndexPath | indexpath for cell | 


| - (UIView *) downloadingAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
Creates accessoryview for IMSLP score which is downloading at the moment.
Accessoryview has progressbar, cancel button and detail button.
| downloadingAccessoryViewForIndexPath | indexpath for cell | 


| - (void) downloadScore: | (id) | button | 
Starts downloading score's pdf associated with button and changes button's cell's accessoryview.
| downloadScore | sender of the action. Only ScoreListButtons allowed. | 

| - (UIView *) IMSLPAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
Creates accessoryview for IMSLP scorecell in indexPath.
Accessoryview created is based on score associated with cell and score's pdf. If pdf is already downloading downloadingAccessoryViewForIndexPath: is called. If it's already stored locally downloadedAccessoryViewForIndexPath: is called. If it's not either downloadableAccessoryViewForIndexPath: is called.
| IMSLPAccessoryViewForIndexPath | indexpath for cell | 


| - (id) initWithStyle: | (UITableViewStyle) | style | |
| masterController: | (CatNiPViewController *) | controller | |
| compositionData: | (CompositionData *) | compData | |
| editable: | (BOOL) | ed | |
Basic init for ScorePopoverController, sets masterController = controller.
| initWithStyle,: | check framework's API for UITableViewStyles | 
| masterController | master viewController in which this popover is represented. | 
| IMSLPCompositionData | IMSLPCompositionData object of given composition | 
| - (UIView *) LocalAccessoryViewForIndexPath: | (NSIndexPath *) | indexPath | 
Creates accessoryview for local score.
Accessoryview has addToPlaylist button and detail button.
| LocalAccessoryViewForIndexPath | indexpath for cell | 


| - (NSInteger) numberOfSectionsInTableView: | (UITableView *) | tableView | 
UITableViewDataSource protocol function's implementation.
Returns 1
| numberOfSectionsInTableView | self.tableView | 
| - (BOOL) shouldAutorotateToInterfaceOrientation: | (UIInterfaceOrientation) | interfaceOrientation |  [implementation] | 
        
| - (void) showDetailsForScore: | (id) | button | 
Shows details popover about the score associated with given button.
| showDetailsForScore | sender of the action. Only ScoreListButtons allowed. | 
| - (BOOL) tableView: | (UITableView *) | tableView | |
| canEditRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDataSource protocol function's implementation.
| tableView | self.tableView | 
| canEditRowAtIndexPath | indexPath for cell | 
| - (UITableViewCell *) tableView: | (UITableView *) | tableView | |
| cellForRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDataSource protocol function's implementation.
| tableView | self.tableView | 
| cellForRowAtIndexPath | indexPath for cell to be created | 

| - (void) tableView: | (UITableView *) | tableView | |
| commitEditingStyle: | (UITableViewCellEditingStyle) | editingStyle | |
| forRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDataSource protocol function's implementation.
Assumes that all editing is deleting score represented in forRowAtIndexPath. Removes all local references to that score and finally deletes the pdf-file associated with the score.
| tableView | self.tableView | 
| commitEditingStyle | UITableViewCellEditingStyle | 
| forRowAtIndexPath | indexPath for cell | 

| - (void) tableView: | (UITableView *) | tableView | |
| didSelectRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDelegate protocol function's implementation.
Shows pdf associated with score. If LIBRARYTYPE is IMSLP then downloads it first if it's not already downloaded or currently downloading in which cases does nothing.
| tableView | self.tableView | 
| didSelectRowAtIndexPath | indexPath for selected cell | 

| - (UITableViewCellEditingStyle) tableView: | (UITableView *) | tableView | |
| editingStyleForRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDelegate protocol function's implementation.
| tableView | tableView of the cell | 
| editingStyleForRowAtIndexPath | indexPath of the cell | 
| - (CGFloat) tableView: | (UITableView *) | tableView | |
| heightForHeaderInSection: | (NSInteger) | section | |
UITableViewDelegate protocol function's implementation.
Calculate header's height based on it's content's length. Calculation formula is: ((int)(l / 45) +1) * 25 + 50 where l is |composer| + |composition| + 3.
| tableView | self.tableView | 
| heightForHeaderInSection | only one section (0) in this table. | 
| - (CGFloat) tableView: | (UITableView *) | tableView | |
| heightForRowAtIndexPath: | (NSIndexPath *) | indexPath | |
UITableViewDelegate protocol function's implementation.
Calculate table row's height dynamically based on string's length.
| tableView | self.tableView | 
| heightRowAtIndexPath | indexPath of the cell which height is being calculated | 
| - (NSInteger) tableView: | (UITableView *) | tableView | |
| numberOfRowsInSection: | (NSInteger) | section | |
 [implementation] | 
        
UITableViewDataSource protocol function's implementation.
| tableView | self.tableView | 
| numberOfRowsInSection | Only one section (0) in self.tableView | 
| - (UIView *) tableView: | (UITableView *) | tableView | |
| viewForHeaderInSection: | (NSInteger) | section | |
tableViewDelegate protocol function's implementation.
Creates an UILabel for self.tableView header (it has only one section) and sets its textLabel.text = "Scores for: composition". Header backgroundcolor has alpha component set to 0.4 so that text behind it can be seen.
| tableView | self.tableView | 
| section | only one section (0) in this table at the moment. | 
| - (void) updateProgressView: | (NSTimer *) | nt | 
Updates UIProgressview associated with this NSTimer.
Timer's userinfo (NSArray) has progressview (index:0) and pdf(index:1) of the file for which IMSLPQueryHelper's downloadProgressFor: function is called.
| updateProgressView | NSTimer object which makes the calls to this function. | 

| - (void) viewDidAppear: | (BOOL) | animated |  [implementation] | 
        
| - (void) viewDidDisappear: | (BOOL) | animated |  [implementation] | 
        
| - (void) viewDidLoad |  [implementation] | 
        
| - (void) viewDidUnload |  [implementation] | 
        
| - (void) viewWillAppear: | (BOOL) | animated |  [implementation] | 
        
| - (void) viewWillDisappear: | (BOOL) | animated |  [implementation] | 
        
- (CatNiPViewController*) master [protected] | 
        
- (NSString *) composer [read, write, retain] | 
        
- (NSString *) composition [read, write, retain] | 
        
- (CompositionData *) compositionData [read, write, retain] | 
        
- (BOOL) editable [read, write, assign] | 
        
- (IBOutlet CatNiPViewController*) master [read, write, retain] |