Skip to content

Commit

Permalink
Add GitNubView, prepping for custom drag and drop operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Palmer committed Aug 28, 2008
1 parent add5c94 commit 864414b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 48 deletions.
66 changes: 27 additions & 39 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9D34</string>
<string key="IBDocument.InterfaceBuilderVersion">644</string>
<string key="IBDocument.SystemVersion">9E17</string>
<string key="IBDocument.InterfaceBuilderVersion">670</string>
<string key="IBDocument.AppKitVersion">949.33</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="517"/>
<integer value="2"/>
<integer value="344"/>
<integer value="517"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -37,6 +38,7 @@
<string key="NSWindowTitle">GitNub</string>
<string key="NSWindowClass">TexturedWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{400, 300}</string>
<object class="NSView" key="NSWindowView" id="831824449">
<reference key="NSNextResponder"/>
Expand Down Expand Up @@ -1067,7 +1069,7 @@
<string key="NSClassName">CommitsController</string>
</object>
<object class="NSCustomView" id="591982567">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -1104,6 +1106,7 @@
</object>
</object>
<string key="NSFrameSize">{481, 404}</string>
<reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomObject" id="498734212">
Expand Down Expand Up @@ -2326,7 +2329,6 @@
<string>21.ImportedFromIB2</string>
<string>21.NSWindowTemplate.visibleAtLaunch</string>
<string>21.editorWindowContentRectSynchronizationRect</string>
<string>21.lastResizeAction</string>
<string>21.windowTemplate.hasMaxSize</string>
<string>21.windowTemplate.hasMinSize</string>
<string>21.windowTemplate.maxSize</string>
Expand Down Expand Up @@ -2359,7 +2361,7 @@
<string>344.IBEditorWindowLastContentRect</string>
<string>344.IBPluginDependency</string>
<string>344.editorWindowContentRectSynchronizationRect</string>
<string>344.lastResizeAction</string>
<string>345.CustomClassName</string>
<string>345.IBPluginDependency</string>
<string>374.IBPluginDependency</string>
<string>374.IBSegmentedControlTracker.RoundRobinState</string>
Expand Down Expand Up @@ -2467,25 +2469,12 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{-19, 101}, {990, 682}}</string>
<string>{{-11, 125}, {990, 682}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{-19, 101}, {990, 682}}</string>
<string>{{-11, 125}, {990, 682}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{146, 174}, {990, 682}}</string>
<object class="NSDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBResizeActionFinalFrame</string>
<string>IBResizeActionInitialFrame</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{-17, 107}, {990, 682}}</string>
<string>{{-17, 193}, {820, 596}}</string>
</object>
</object>
<reference ref="9"/>
<reference ref="9"/>
<string>{3.40282e+38, 3.40282e+38}</string>
Expand Down Expand Up @@ -2518,22 +2507,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{393, 350}, {481, 404}}</string>
<string>{{340, 350}, {481, 404}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{261, 325}, {481, 404}}</string>
<object class="NSDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBResizeActionFinalFrame</string>
<string>IBResizeActionInitialFrame</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{0, 430}, {481, 404}}</string>
<string>{{0, 430}, {481, 404}}</string>
</object>
</object>
<string>GitNubWebView</string>
<string>com.apple.WebKitIBPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
Expand Down Expand Up @@ -2700,7 +2677,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">ApplicationController.rb</string>
<string key="minorKey">controllers/ApplicationController.rb</string>
</object>
</object>
<object class="IBPartialClassDescription">
Expand Down Expand Up @@ -2750,7 +2727,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">CommitsController.rb</string>
<string key="minorKey">controllers/CommitsController.rb</string>
</object>
</object>
<object class="IBPartialClassDescription">
Expand All @@ -2763,20 +2740,31 @@
</object>
<object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">GitNubWebView</string>
<string key="superclassName">WebView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">views/GitNubWebView.rb</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSButton</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedControl</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
Expand All @@ -2800,7 +2788,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">NetworkController.rb</string>
<string key="minorKey">controllers/NetworkController.rb</string>
</object>
</object>
<object class="IBPartialClassDescription">
Expand All @@ -2820,7 +2808,7 @@
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">TexturedWindow.rb</string>
<string key="minorKey">views/TexturedWindow.rb</string>
</object>
</object>
<object class="IBPartialClassDescription">
Expand Down
16 changes: 12 additions & 4 deletions GitNub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
281AEAC90E65412C00B48530 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = 281AEAC20E65412C00B48530 /* style.css */; };
281AEACC0E65418500B48530 /* ImageLoadOperation.rb in Resources */ = {isa = PBXBuildFile; fileRef = 281AEACB0E65418500B48530 /* ImageLoadOperation.rb */; };
281AEACE0E6541AB00B48530 /* Info.xib in Resources */ = {isa = PBXBuildFile; fileRef = 281AEACD0E6541AB00B48530 /* Info.xib */; };
281AECA70E6662B000B48530 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 281AECA60E6662B000B48530 /* WebKit.framework */; };
281AED6C0E6677B500B48530 /* GitNubWebView.rb in Resources */ = {isa = PBXBuildFile; fileRef = 281AED6B0E6677B500B48530 /* GitNubWebView.rb */; };
283254680D8B792500D99366 /* lib in Resources */ = {isa = PBXBuildFile; fileRef = 283254650D8B792500D99366 /* lib */; };
286F109E0D7A49380055A0D1 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 286F109D0D7A49380055A0D1 /* WebKit.framework */; };
288853050D7CE2E500862D67 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 288853040D7CE2E500862D67 /* LICENSE */; };
288CB41A0D8789DD0092B5CC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 288CB4180D8789DD0092B5CC /* MainMenu.xib */; };
4DDCA7070ACC9A6100E082CE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
Expand Down Expand Up @@ -70,8 +71,9 @@
281AEAC20E65412C00B48530 /* style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = style.css; sourceTree = "<group>"; };
281AEACB0E65418500B48530 /* ImageLoadOperation.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = ImageLoadOperation.rb; sourceTree = "<group>"; };
281AEACD0E6541AB00B48530 /* Info.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Info.xib; sourceTree = "<group>"; };
281AECA60E6662B000B48530 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
281AED6B0E6677B500B48530 /* GitNubWebView.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = GitNubWebView.rb; sourceTree = "<group>"; };
283254650D8B792500D99366 /* lib */ = {isa = PBXFileReference; lastKnownFileType = folder; path = lib; sourceTree = "<group>"; };
286F109D0D7A49380055A0D1 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
288853040D7CE2E500862D67 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
288CB4190D8789DD0092B5CC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand All @@ -91,8 +93,8 @@
files = (
4DDCA70C0ACC9A6100E082CE /* Cocoa.framework in Frameworks */,
4DDCA70D0ACC9A6100E082CE /* RubyCocoa.framework in Frameworks */,
286F109E0D7A49380055A0D1 /* WebKit.framework in Frameworks */,
DA8995E30D890D8A00CF2CDA /* Sparkle.framework in Frameworks */,
281AECA70E6662B000B48530 /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -111,6 +113,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
281AECA60E6662B000B48530 /* WebKit.framework */,
DA8995E20D890D8A00CF2CDA /* Sparkle.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
E8F5E24E03AEB6EC03A81C6F /* RubyCocoa.framework */,
Expand Down Expand Up @@ -149,6 +152,7 @@
281AEAA30E65405A00B48530 /* views */ = {
isa = PBXGroup;
children = (
281AED6B0E6677B500B48530 /* GitNubWebView.rb */,
281AEACD0E6541AB00B48530 /* Info.xib */,
281AEACB0E65418500B48530 /* ImageLoadOperation.rb */,
281AEAB60E65411300B48530 /* CommitSummaryCell.h */,
Expand Down Expand Up @@ -210,7 +214,6 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
286F109D0D7A49380055A0D1 /* WebKit.framework */,
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
Expand Down Expand Up @@ -293,6 +296,7 @@
281AEAC90E65412C00B48530 /* style.css in Resources */,
281AEACC0E65418500B48530 /* ImageLoadOperation.rb in Resources */,
281AEACE0E6541AB00B48530 /* Info.xib in Resources */,
281AED6C0E6677B500B48530 /* GitNubWebView.rb in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -355,8 +359,10 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../Desktop\"";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
Expand All @@ -377,8 +383,10 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../../Desktop\"";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
Expand Down
5 changes: 5 additions & 0 deletions controllers/ApplicationController.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def awakeFromNib
@search_field.setEnabled(true)
end
end

end
end

Expand All @@ -85,6 +86,10 @@ def repo
end
end

def draggingEntered(sender)
puts sender
end

ib_action :show_info_panel
def show_info_panel(sender)
@info_controller ||= InfoWindowController.alloc.init_with_repository(repo)
Expand Down
8 changes: 4 additions & 4 deletions controllers/CommitsController.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
require 'osx/cocoa'
require 'md5'
require 'cgi'

OSX.require_framework 'WebKit'

def gravatar_url(email, size=36, default="x-img://default")
hash = MD5.hexdigest(email.downcase)
Expand Down Expand Up @@ -46,6 +48,8 @@ def awakeFromNib
@commits_table.reloadData
end
end



ib_action :perform_utility_action
def perform_utility_action(segment)
Expand Down Expand Up @@ -126,10 +130,6 @@ def webView_contextMenuItemsForElement_defaultMenuItems(view, element, defaultMe
items << NSMenuItem.alloc.initWithTitle_action_keyEquivalent("Blame", :foo_bar, "")
end

def foo_bar(sender)
puts "FOO"
end

def imageLoadForURL_didFinishLoading(url, image)
email = @icon_url_map[url]
@icons[email] = image
Expand Down
2 changes: 1 addition & 1 deletion controllers/NetworkController.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def replace_github_header
def hide_github_shell
%w(header repo_menu repo_sub_menu repos footer triangle).each do |element|
element = @document.getElementById(element)
element.style.setProperty_value_priority("display", "none", nil)
element.style.setProperty_value_priority("display", "none", nil) if element
end
end
end
19 changes: 19 additions & 0 deletions views/GitNubWebView.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class GitNubWebView < WebView
def awakeFromNib
self.setUIDelegate(self)
end

def webView_dragDestinationActionMaskForDraggingInfo(view, info)
WebDragDestinationActionLoad
end

def webView_dragSourceActionMaskForPoint(view, point)
WebDragSourceActionLink
end

def performDragOperation(sender)
# str = sender.draggingPasteboard.stringForType("NSStringPboardType")
# puts NSURL.URLWithString(str).host
end

end
5 changes: 5 additions & 0 deletions views/TexturedWindow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ class TexturedWindow < OSX::NSWindow
def initWithContentRect_styleMask_backing_defer(rect, mask, backing, defer)
if super_initWithContentRect_styleMask_backing_defer(rect, mask, backing, defer)
self.setContentBorderThickness_forEdge(44.0, NSMinYEdge)
self.registerForDraggedTypes([NSURLPboardType, NSFilenamesPboardType])
end
return self
end

def draggingEntered(sender)
puts "WTF"
end
end

0 comments on commit 864414b

Please sign in to comment.