/AppDelegate.m

http://mac-prop-terminal.googlecode.com/ · Objective C · 62 lines · 28 code · 9 blank · 25 comment · 3 complexity · d4dbb9aea968fb8c5b2c0abad44e03c5 MD5 · raw file

  1. //
  2. // AppDelegate.m
  3. // MacPropTerminal
  4. //
  5. // Created by Steve Nicholson on 6/5/11.
  6. // Copyright 2011 Harmony Ridge Software. All rights reserved.
  7. // Licensed under MIT License. See end of file for terms of use
  8. //
  9. #import "AppDelegate.h"
  10. #import "PreferenceController.h"
  11. @implementation AppDelegate
  12. @synthesize fontMenu;
  13. - (void)awakeFromNib {
  14. fontMenu = [[NSMenu alloc] initWithTitle:@"fonts"];
  15. NSFontManager *fontManager = [NSFontManager sharedFontManager];
  16. NSArray *fontNames = [fontManager availableFontFamilies];
  17. NSMutableArray *fixedPointFontNames = [[NSMutableArray alloc] initWithCapacity:[fontNames count]];
  18. for (NSString *fontName in fontNames) {
  19. if ([fontManager fontNamed:fontName hasTraits:NSFixedPitchFontMask]) {
  20. [fixedPointFontNames addObject:fontName];
  21. [fontMenu addItemWithTitle:fontName action:@selector(changeSelectedFont:) keyEquivalent:@""];
  22. }
  23. }
  24. }
  25. #pragma mark Accessors
  26. - (PreferenceController *)preferenceController {
  27. if (!preferenceController) {
  28. preferenceController = [[PreferenceController alloc] init];
  29. }
  30. return preferenceController;
  31. }
  32. #pragma mark IBAction methods
  33. - (IBAction)showPreferencePanel:(id)sender {
  34. [[self preferenceController] showWindow:self];
  35. }
  36. @end
  37. /*
  38. ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
  39. ? TERMS OF USE: MIT License ?
  40. ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
  41. ?Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation ?
  42. ?files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ?
  43. ?modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software?
  44. ?is furnished to do so, subject to the following conditions: ?
  45. ? ?
  46. ?The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.?
  47. ? ?
  48. ?THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ?
  49. ?WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ?
  50. ?COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ?
  51. ?ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ?
  52. ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
  53. */