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;
32 int count = hb_list_count( title->list_chapter );
34 for( i = 0; i < count; i++ )
36 hb_chapter_t *chapter = hb_list_item( title->list_chapter, i );
38 if( chapter != NULL && chapter->title[0] == '\0' )
40 chapterString = [NSString stringWithFormat:@"Chapter %2d",(i+1)];
42 strncpy( chapter->title, [chapterString UTF8String], 1023);
43 chapter->title[1023] = '\0';
49 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
57 return hb_list_count( fTitle->list_chapter );
61 - (void)tableView:(NSTableView *)aTableView
62 setObjectValue:(id)anObject
63 forTableColumn:(NSTableColumn *)aTableColumn
66 if(aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
68 hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
72 strncpy( chapter->title, [anObject UTF8String], 1023);
73 chapter->title[1023] = '\0';
78 - (id)tableView:(NSTableView *)aTableView
79 objectValueForTableColumn:(NSTableColumn *)aTableColumn
84 if([[aTableColumn identifier] intValue] == 1)
86 cellEntry = [NSString stringWithFormat:@"%d",rowIndex+1];
90 hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
94 cellEntry = [NSString stringWithUTF8String:chapter->title];
98 cellEntry = @"__DATA ERROR__";