Changeset 4114
- Timestamp:
- 05/10/06 00:29:22 (3 years ago)
- Files:
-
- WiredClient/trunk/English.lproj/ReleaseNotes.rtf (modified) (1 diff)
- WiredClient/trunk/English.lproj/SaveChat.nib (added)
- WiredClient/trunk/English.lproj/SaveChat.nib/classes.nib (added)
- WiredClient/trunk/English.lproj/SaveChat.nib/info.nib (added)
- WiredClient/trunk/English.lproj/SaveChat.nib/keyedobjects.nib (added)
- WiredClient/trunk/English.lproj/SaveChat.nib/objects.nib (added)
- WiredClient/trunk/WCChat.h (modified) (2 diffs)
- WiredClient/trunk/WCChat.m (modified) (5 diffs)
- WiredClient/trunk/WiredClient.xcodeproj/project.pbxproj (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/English.lproj/ReleaseNotes.rtf
r4111 r4114 30 30 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 31 31 32 \f1\b0 \cf0 - Add option to show a dialog for messages and broadcasts\ 32 \f1\b0 \cf0 - Can now save chat as RTF, and select encoding when saving as plain text\ 33 - Add option to show a dialog for messages and broadcasts\ 33 34 - Show tooltips in user list\ 34 35 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural WiredClient/trunk/WCChat.h
r3661 r4114 55 55 IBOutlet NSMenuItem *_getInfoMenuItem; 56 56 IBOutlet NSMenuItem *_ignoreMenuItem; 57 58 IBOutlet NSView *_saveChatView; 59 IBOutlet NSPopUpButton *_saveChatFileFormatPopUpButton; 60 IBOutlet NSPopUpButton *_saveChatPlainTextEncodingPopUpButton; 57 61 58 62 NSMutableArray *_commandHistory; … … 104 108 - (IBAction)unignore:(id)sender; 105 109 110 - (IBAction)fileFormat:(id)sender; 111 106 112 @end WiredClient/trunk/WCChat.m
r3988 r4114 42 42 #import "WCUserInfo.h" 43 43 44 #define WCLastChatFormat @"WCLastChatFormat" 45 #define WCLastChatEncoding @"WCLastChatEncoding" 46 47 48 enum _WCChatFormat { 49 WCChatPlainText, 50 WCChatRTF, 51 WCChatRTFD, 52 }; 53 typedef enum _WCChatFormat WCChatFormat; 54 55 44 56 @interface WCChat(Private) 45 57 46 58 - (void)_update; 47 59 - (void)_updateTopic; 60 - (void)_updateSaveChatForPanel:(NSSavePanel *)savePanel; 48 61 49 62 - (void)_printString:(NSString *)message; … … 140 153 [[_topic date] commonDateStringWithSeconds:NO relative:YES capitalized:YES]]]; 141 154 } 155 } 156 157 158 159 - (void)_updateSaveChatForPanel:(NSSavePanel *)savePanel { 160 WCChatFormat format; 161 162 format = [_saveChatFileFormatPopUpButton tagOfSelectedItem]; 163 164 switch(format) { 165 case WCChatPlainText: 166 [savePanel setRequiredFileType:@"txt"]; 167 break; 168 169 case WCChatRTF: 170 [savePanel setRequiredFileType:@"rtf"]; 171 break; 172 173 case WCChatRTFD: 174 [savePanel setRequiredFileType:@"rtfd"]; 175 break; 176 } 177 178 [_saveChatPlainTextEncodingPopUpButton setEnabled:(format == WCChatPlainText)]; 142 179 } 143 180 … … 608 645 - (void)dealloc { 609 646 [[NSNotificationCenter defaultCenter] removeObserver:self]; 647 648 [_saveChatView release]; 610 649 611 650 [_users release]; … … 1359 1398 1360 1399 - (IBAction)saveChat:(id)sender { 1361 NSSavePanel *savePanel; 1362 NSString *name, *path; 1363 NSData *data; 1400 const NSStringEncoding *encodings; 1401 NSSavePanel *savePanel; 1402 NSAttributedString *attributedString; 1403 NSString *name, *path, *string; 1404 WCChatFormat format; 1405 NSStringEncoding encoding; 1406 unsigned int i = 0; 1364 1407 1365 if([self chatID] == 1) { 1366 name = [NSSWF:NSLS(@"%@ Public Chat.txt", "Save chat file name (server)"), 1367 [[self connection] name]]; 1368 } else { 1369 name = [NSSWF:NSLS(@"%@ Private Chat.txt", "Save chat file name (server)"), 1370 [[self connection] name]]; 1371 } 1372 1373 path = [WCSettings objectForKey:WCDownloadFolder]; 1374 savePanel = [NSSavePanel savePanel]; 1375 [savePanel setCanSelectHiddenExtension:YES]; 1376 [savePanel setTitle:NSLS(@"Save Chat", @"Save chat save panel title")]; 1377 1378 if([savePanel runModalForDirectory:path file:name] == NSFileHandlingPanelOKButton) { 1379 data = [[_chatOutputTextView string] dataUsingEncoding:NSUTF8StringEncoding]; 1380 [data writeToFile:[savePanel filename] atomically:YES]; 1381 } 1408 format = [WCSettings intForKey:WCLastChatFormat]; 1409 encoding = [WCSettings intForKey:WCLastChatEncoding]; 1410 1411 if(encoding == 0) 1412 encoding = NSUTF8StringEncoding; 1413 1414 if(!_saveChatView) { 1415 [NSBundle loadNibNamed:@"SaveChat" owner:self]; 1416 1417 [_saveChatFileFormatPopUpButton removeAllItems]; 1418 [_saveChatFileFormatPopUpButton addItem: 1419 [NSMenuItem itemWithTitle:NSLS(@"Plain Text", @"Save chat format") tag:WCChatPlainText]]; 1420 1421 [_saveChatPlainTextEncodingPopUpButton removeAllItems]; 1422 1423 encodings = [NSString availableStringEncodings]; 1424 1425 while(encodings[i]) { 1426 if(encodings[i] <= NSMacOSRomanStringEncoding) { 1427 [_saveChatPlainTextEncodingPopUpButton addItem: 1428 [NSMenuItem itemWithTitle:[NSString localizedNameOfStringEncoding:encodings[i]] tag:encodings[i]]]; 1429 } 1430 1431 i++; 1432 } 1433 } 1434 1435 if([_saveChatFileFormatPopUpButton numberOfItems] > 1) 1436 [_saveChatFileFormatPopUpButton removeItemAtIndex:1]; 1437 1438 if([[_chatOutputTextView textStorage] containsAttachments]) { 1439 [_saveChatFileFormatPopUpButton addItem: 1440 [NSMenuItem itemWithTitle:NSLS(@"Rich Text With Graphics Format (RTFD)", @"Save chat format") tag:WCChatRTFD]]; 1441 1442 if(format == WCChatRTF) 1443 format = WCChatRTFD; 1444 } else { 1445 [_saveChatFileFormatPopUpButton addItem: 1446 [NSMenuItem itemWithTitle:NSLS(@"Rich Text Format (RTF)", @"Save chat format") tag:WCChatRTF]]; 1447 1448 if(format == WCChatRTFD) 1449 format = WCChatRTF; 1450 } 1451 1452 [_saveChatFileFormatPopUpButton selectItemWithTag:format]; 1453 [_saveChatPlainTextEncodingPopUpButton selectItemWithTag:encoding]; 1454 1455 if([self chatID] == 1) { 1456 name = [NSSWF:NSLS(@"%@ Public Chat", "Save chat file name (server)"), 1457 [[self connection] name]]; 1458 } else { 1459 name = [NSSWF:NSLS(@"%@ Private Chat", "Save chat file name (server)"), 1460 [[self connection] name]]; 1461 } 1462 1463 savePanel = [NSSavePanel savePanel]; 1464 [savePanel setAccessoryView:_saveChatView]; 1465 [savePanel setCanSelectHiddenExtension:YES]; 1466 [savePanel setTitle:NSLS(@"Save Chat", @"Save chat save panel title")]; 1467 1468 [self _updateSaveChatForPanel:savePanel]; 1469 1470 if([savePanel runModalForDirectory:[WCSettings objectForKey:WCDownloadFolder] file:name] == NSFileHandlingPanelOKButton) { 1471 path = [savePanel filename]; 1472 format = [_saveChatFileFormatPopUpButton tagOfSelectedItem]; 1473 encoding = [_saveChatPlainTextEncodingPopUpButton tagOfSelectedItem]; 1474 1475 switch(format) { 1476 case WCChatPlainText: 1477 string = [_chatOutputTextView string]; 1478 1479 [[string dataUsingEncoding:encoding] 1480 writeToFile:path atomically:YES]; 1481 break; 1482 1483 case WCChatRTF: 1484 attributedString = [_chatOutputTextView textStorage]; 1485 1486 [[attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:NULL] 1487 writeToFile:path atomically:YES]; 1488 break; 1489 1490 case WCChatRTFD: 1491 attributedString = [_chatOutputTextView textStorage]; 1492 1493 [[attributedString RTFDFileWrapperFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:NULL] 1494 writeToFile:path atomically:YES updateFilenames:YES]; 1495 break; 1496 } 1497 } 1498 1499 [WCSettings setInt:[_saveChatFileFormatPopUpButton tagOfSelectedItem] forKey:WCLastChatFormat]; 1500 [WCSettings setInt:[_saveChatPlainTextEncodingPopUpButton tagOfSelectedItem] forKey:WCLastChatEncoding]; 1382 1501 } 1383 1502 … … 1497 1616 1498 1617 [_userListTableView setNeedsDisplay:YES]; 1618 } 1619 1620 1621 1622 #pragma mark - 1623 1624 - (IBAction)fileFormat:(id)sender { 1625 [self _updateSaveChatForPanel:(NSSavePanel *) [sender window]]; 1499 1626 } 1500 1627 WiredClient/trunk/WiredClient.xcodeproj/project.pbxproj
r3644 r4114 110 110 A510F67C05D388890009F8AC /* WCTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = A510F67A05D388890009F8AC /* WCTracker.m */; }; 111 111 A521257E061393990009F296 /* Banner.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A521257D061393990009F296 /* Banner.tiff */; }; 112 A5239C750A112B15009DD940 /* SaveChat.nib in Resources */ = {isa = PBXBuildFile; fileRef = A5239C730A112B15009DD940 /* SaveChat.nib */; }; 112 113 A52B301C05E6F0A300C651A4 /* WCServerInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B301A05E6F0A300C651A4 /* WCServerInfo.m */; }; 113 114 A52B302105E6FCB100C651A4 /* ServerInfo.nib in Resources */ = {isa = PBXBuildFile; fileRef = A52B301F05E6FCB100C651A4 /* ServerInfo.nib */; }; … … 379 380 A510F67A05D388890009F8AC /* WCTracker.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = WCTracker.m; sourceTree = "<group>"; }; 380 381 A521257D061393990009F296 /* Banner.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Banner.tiff; sourceTree = "<group>"; }; 382 A5239C740A112B15009DD940 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/SaveChat.nib; sourceTree = "<group>"; }; 381 383 A52B301905E6F0A300C651A4 /* WCServerInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WCServerInfo.h; sourceTree = "<group>"; }; 382 384 A52B301A05E6F0A300C651A4 /* WCServerInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WCServerInfo.m; sourceTree = "<group>"; }; … … 726 728 A5DC7E3F057AAC1000736BBF /* PrivateChat.nib */, 727 729 A5DC7E61057AAC1100736BBF /* PublicChat.nib */, 730 A5239C730A112B15009DD940 /* SaveChat.nib */, 728 731 A5DC7E59057AAC1000736BBF /* UserInfo.nib */, 729 732 ); … … 1239 1242 A5DC7E67057AAC1100736BBF /* PrivateChat.nib in Resources */, 1240 1243 A5DC7E78057AAC1100736BBF /* PublicChat.nib in Resources */, 1244 A5239C750A112B15009DD940 /* SaveChat.nib in Resources */, 1241 1245 A5DC7E72057AAC1100736BBF /* Search.nib in Resources */, 1242 1246 A52B302105E6FCB100C651A4 /* ServerInfo.nib in Resources */, … … 1458 1462 1459 1463 /* Begin PBXVariantGroup section */ 1464 A5239C730A112B15009DD940 /* SaveChat.nib */ = { 1465 isa = PBXVariantGroup; 1466 children = ( 1467 A5239C740A112B15009DD940 /* English */, 1468 ); 1469 name = SaveChat.nib; 1470 sourceTree = "<group>"; 1471 }; 1460 1472 A52B301F05E6FCB100C651A4 /* ServerInfo.nib */ = { 1461 1473 isa = PBXVariantGroup;
