3 This file is part of the HandBrake source code.
4 Homepage: <http://handbrake.m0k.org/>.
5 It may be used under the terms of the GNU General Public License. */
7 #include "ChapterTitles.h"
10 @implementation ChapterTitles
22 - (void)resetWithTitle:(hb_title_t *)title
25 NSString *chapterString;
26 int count = hb_list_count( title->list_chapter );
28 for( i = 0; i < count; i++ )
30 hb_chapter_t *chapter = hb_list_item( title->list_chapter, i );
32 if( chapter != NULL && chapter->title[0] == '\0' )
34 chapterString = [NSString stringWithFormat:@"Chapter %2d",(i+1)];
36 strncpy( chapter->title, [chapterString UTF8String], 1023);
37 chapter->title[1023] = '\0';
44 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
52 return hb_list_count( fTitle->list_chapter );
56 - (void)tableView:(NSTableView *)aTableView
57 setObjectValue:(id)anObject
58 forTableColumn:(NSTableColumn *)aTableColumn
61 if(aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
63 hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
67 strncpy( chapter->title, [anObject UTF8String], 1023);
68 chapter->title[1023] = '\0';
73 - (id)tableView:(NSTableView *)aTableView
74 objectValueForTableColumn:(NSTableColumn *)aTableColumn
79 if([[aTableColumn identifier] intValue] == 1)
81 cellEntry = [NSString stringWithFormat:@"%d",rowIndex+1];
85 hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
89 cellEntry = [NSString stringWithUTF8String:chapter->title];
93 cellEntry = @"__DATA ERROR__";