Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: src/views/mac/SkOptionsTableView.mm

Issue 147683003: fix more 64bit warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkLuaCanvas.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #import "SkOptionsTableView.h" 9 #import "SkOptionsTableView.h"
10 #import "SkTextFieldCell.h" 10 #import "SkTextFieldCell.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // the first menu is always assumed to be the static, the second is 59 // the first menu is always assumed to be the static, the second is
60 // repopulated every time over and over again 60 // repopulated every time over and over again
61 61
62 // seems pretty weird that we have to get rid of the const'ness here, 62 // seems pretty weird that we have to get rid of the const'ness here,
63 // but trying to propagate the const'ness through all the way to the fMenus 63 // but trying to propagate the const'ness through all the way to the fMenus
64 // vector was a non-starter. 64 // vector was a non-starter.
65 65
66 int menuIndex = fMenus->find(const_cast<SkOSMenu *>(menu)); 66 int menuIndex = fMenus->find(const_cast<SkOSMenu *>(menu));
67 if (menuIndex >= 0 && menuIndex < fMenus->count()) { 67 if (menuIndex >= 0 && menuIndex < fMenus->count()) {
68 NSUInteger first = 0; 68 NSUInteger first = 0;
69 for (NSInteger i = 0; i < menuIndex; ++i) { 69 for (int i = 0; i < menuIndex; ++i) {
70 first += (*fMenus)[i]->getCount(); 70 first += (*fMenus)[i]->getCount();
71 } 71 }
72 [fItems removeObjectsInRange:NSMakeRange(first, [fItems count] - first)] ; 72 [fItems removeObjectsInRange:NSMakeRange(first, [fItems count] - first)] ;
73 [self loadMenu:menu]; 73 [self loadMenu:menu];
74 } 74 }
75 [self reloadData]; 75 [self reloadData];
76 } 76 }
77 77
78 - (NSCellStateValue)triStateToNSState:(SkOSMenu::TriState)state { 78 - (NSCellStateValue)triStateToNSState:(SkOSMenu::TriState)state {
79 if (SkOSMenu::kOnState == state) 79 if (SkOSMenu::kOnState == state)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 [fItems addObject:option]; 141 [fItems addObject:option];
142 [option release]; 142 [option release];
143 } 143 }
144 } 144 }
145 145
146 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { 146 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
147 return [self.fItems count]; 147 return [self.fItems count];
148 } 148 }
149 149
150 - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum n *)tableColumn row:(NSInteger)row { 150 - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum n *)tableColumn row:(NSInteger)row {
151 int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]]; 151 NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identif ier]];
152 if (columnIndex == 0) { 152 if (columnIndex == 0) {
153 const SkOSMenu::Item* item = ((SkOptionItem*)[fItems objectAtIndex:row]) .fItem; 153 const SkOSMenu::Item* item = ((SkOptionItem*)[fItems objectAtIndex:row]) .fItem;
154 NSString* label = [NSString stringWithUTF8String:item->getLabel()]; 154 NSString* label = [NSString stringWithUTF8String:item->getLabel()];
155 if (fShowKeys) 155 if (fShowKeys)
156 return [NSString stringWithFormat:@"%@ (%c)", label, item->getKeyEqu ivalent()]; 156 return [NSString stringWithFormat:@"%@ (%c)", label, item->getKeyEqu ivalent()];
157 else 157 else
158 return label; 158 return label;
159 } 159 }
160 else 160 else
161 return nil; 161 return nil;
162 } 162 }
163 163
164 - (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableCo lumn *)tableColumn row:(NSInteger)row { 164 - (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableCo lumn *)tableColumn row:(NSInteger)row {
165 if (tableColumn) { 165 if (tableColumn) {
166 int columnIndex = [tableView columnWithIdentifier:[tableColumn identifie r]]; 166 NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn ide ntifier]];
167 if (columnIndex == 1) 167 if (columnIndex == 1)
168 return [((SkOptionItem*)[fItems objectAtIndex:row]).fCell copy]; 168 return [((SkOptionItem*)[fItems objectAtIndex:row]).fCell copy];
169 else 169 else
170 return [[[SkTextFieldCell alloc] init] autorelease]; 170 return [[[SkTextFieldCell alloc] init] autorelease];
171 } 171 }
172 return nil; 172 return nil;
173 } 173 }
174 174
175 - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColu mn:(NSTableColumn *)tableColumn row:(NSInteger)row { 175 - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColu mn:(NSTableColumn *)tableColumn row:(NSInteger)row {
176 int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]]; 176 NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identif ier]];
177 if (columnIndex == 1) { 177 if (columnIndex == 1) {
178 SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row]; 178 SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row];
179 NSCell* storedCell = option.fCell; 179 NSCell* storedCell = option.fCell;
180 const SkOSMenu::Item* item = option.fItem; 180 const SkOSMenu::Item* item = option.fItem;
181 switch (item->getType()) { 181 switch (item->getType()) {
182 case SkOSMenu::kAction_Type: 182 case SkOSMenu::kAction_Type:
183 break; 183 break;
184 case SkOSMenu::kList_Type: 184 case SkOSMenu::kList_Type:
185 [cell selectItemAtIndex:[(NSPopUpButtonCell*)storedCell indexOfS electedItem]]; 185 [cell selectItemAtIndex:[(NSPopUpButtonCell*)storedCell indexOfS electedItem]];
186 break; 186 break;
(...skipping 13 matching lines...) Expand all
200 default: 200 default:
201 break; 201 break;
202 } 202 }
203 } 203 }
204 else { 204 else {
205 [(SkTextFieldCell*)cell setEditable:NO]; 205 [(SkTextFieldCell*)cell setEditable:NO];
206 } 206 }
207 } 207 }
208 208
209 - (void)tableView:(NSTableView *)tableView setObjectValue:(id)anObject forTableC olumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 209 - (void)tableView:(NSTableView *)tableView setObjectValue:(id)anObject forTableC olumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
210 int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]]; 210 NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identif ier]];
211 if (columnIndex == 1) { 211 if (columnIndex == 1) {
212 SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row]; 212 SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row];
213 NSCell* cell = option.fCell; 213 NSCell* cell = option.fCell;
214 const SkOSMenu::Item* item = option.fItem; 214 const SkOSMenu::Item* item = option.fItem;
215 switch (item->getType()) { 215 switch (item->getType()) {
216 case SkOSMenu::kAction_Type: 216 case SkOSMenu::kAction_Type:
217 item->postEvent(); 217 item->postEvent();
218 break; 218 break;
219 case SkOSMenu::kList_Type: 219 case SkOSMenu::kList_Type:
220 [(NSPopUpButtonCell*)cell selectItemAtIndex:[anObject intValue]] ; 220 [(NSPopUpButtonCell*)cell selectItemAtIndex:[anObject intValue]] ;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 - (NSCell*)createTriState:(NSCellStateValue)state { 289 - (NSCell*)createTriState:(NSCellStateValue)state {
290 NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease]; 290 NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];
291 [cell setAllowsMixedState:TRUE]; 291 [cell setAllowsMixedState:TRUE];
292 [cell setTitle:@""]; 292 [cell setTitle:@""];
293 [cell setState:(NSInteger)state]; 293 [cell setState:(NSInteger)state];
294 [cell setButtonType:NSSwitchButton]; 294 [cell setButtonType:NSSwitchButton];
295 return cell; 295 return cell;
296 } 296 }
297 @end 297 @end
OLDNEW
« no previous file with comments | « src/utils/SkLuaCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698