-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cameron Adamez
committed
Mar 21, 2010
0 parents
commit 5d86c14
Showing
36 changed files
with
8,069 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Controller.rb | ||
# mister t | ||
# | ||
# Created by Cameron Adamez on 3/18/10. | ||
|
||
class Controller | ||
|
||
attr_writer :fontListView, :fontSampleView | ||
attr_accessor :fonts | ||
|
||
def awakeFromNib | ||
|
||
@fonts = [] | ||
@fontListView.setDataSource self | ||
@fontListView.reloadData | ||
|
||
@dummytext = "This is some dummy text" | ||
|
||
NSNotificationCenter.defaultCenter.addObserver self, | ||
selector:'fontSetChanged:', | ||
name:NSFontSetChangedNotification, | ||
object: nil | ||
|
||
createFontList | ||
end | ||
|
||
def createFontList | ||
|
||
nameEnum = NSFontManager.new.availableFonts | ||
|
||
nameEnum.each do |name| | ||
theDict = {} | ||
font = NSFont.fontWithName(name, size:12) | ||
|
||
if font.displayName | ||
theDict["name"] = font.displayName | ||
else | ||
theDict["name"] = font.fontName | ||
end | ||
|
||
#theDict["gly"] = font.numberOfGlyphs.to_s | ||
#theDict["mono"] = font.isFixedPitch ? "YES" : "NO" | ||
|
||
@fonts << theDict | ||
end | ||
|
||
@fontListView.reloadData | ||
end | ||
|
||
def fontSetChanged(notification) | ||
@fontListView.reloadData | ||
end | ||
|
||
# TABLESSSS | ||
|
||
def numberOfRowsInTableView(view) | ||
@fonts ? @fonts.size : 0 | ||
end | ||
|
||
def tableView(view, objectValueForTableColumn:column, row:index) | ||
@fonts[index]["name"] | ||
end | ||
|
||
# Font sample part | ||
|
||
def viewItem(sender) | ||
ff = @fontListView.selectedRow["name"] | ||
end | ||
|
||
end |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.