Skip to content

Commit

Permalink
Re-do contextual menu in code only.
Browse files Browse the repository at this point in the history
… rather than using a combination of a nib file and code.

Makes things easier to understand and add to for me.
  • Loading branch information
ssp committed Sep 8, 2009
1 parent dbdd0c1 commit 9553bf2
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 1,271 deletions.
16 changes: 0 additions & 16 deletions ClickToFlash.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
0038DE240FC0CCF0007B54E9 /* MATrackingArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 0038DE230FC0CCF0007B54E9 /* MATrackingArea.m */; };
0038DE320FC0CE7B007B54E9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0038DE310FC0CE7B007B54E9 /* Carbon.framework */; };
00FBE92F0FCD68CE00BC0995 /* NSActionTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 00FBE92E0FCD68CE00BC0995 /* NSActionTemplate.png */; };
072189BE0F30D9C3008C8944 /* ContextualMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 072189BA0F30D9C3008C8944 /* ContextualMenu.xib */; };
072189BF0F30D9C3008C8944 /* WhitelistPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 072189BC0F30D9C3008C8944 /* WhitelistPanel.xib */; };
55EB70480E04A8850016593D /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 55EB703D0E04A84F0016593D /* Plugin.m */; };
55EB70580E04A8B80016593D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55EB70560E04A8B80016593D /* Cocoa.framework */; };
Expand Down Expand Up @@ -136,7 +135,6 @@
0038DE230FC0CCF0007B54E9 /* MATrackingArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MATrackingArea.m; path = Plugin/MATrackingArea.m; sourceTree = "<group>"; };
0038DE310FC0CE7B007B54E9 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
00FBE92E0FCD68CE00BC0995 /* NSActionTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = NSActionTemplate.png; path = Plugin/NSActionTemplate.png; sourceTree = "<group>"; };
072189BB0F30D9C3008C8944 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Plugin/English.lproj/ContextualMenu.xib; sourceTree = "<group>"; };
072189BD0F30D9C3008C8944 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Plugin/English.lproj/WhitelistPanel.xib; sourceTree = "<group>"; };
55EB703C0E04A84F0016593D /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = Plugin/Plugin.h; sourceTree = "<group>"; };
55EB703D0E04A84F0016593D /* Plugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Plugin.m; path = Plugin/Plugin.m; sourceTree = "<group>"; };
Expand All @@ -161,14 +159,12 @@
6C4B659E1051B29D00412F09 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = Plugin/de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6C4B65D11051B6EF00412F09 /* Credits.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = Credits.css; sourceTree = "<group>"; };
6C4B686210532BA400412F09 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/AboutBox.xib; sourceTree = "<group>"; };
6C4B686510532BB200412F09 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/ContextualMenu.xib; sourceTree = "<group>"; };
6C4B686810532BC500412F09 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = fr; path = fr.lproj/Credits.html; sourceTree = "<group>"; };
6C4B686910532BCD00412F09 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6C4B686A10532BD700412F09 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/MenubarMenu.xib; sourceTree = "<group>"; };
6C4B686B10532BDF00412F09 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/WhitelistPanel.xib; sourceTree = "<group>"; };
6C4B686C10532BED00412F09 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
6C575A2F1050754D008C5B23 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = Plugin/de.lproj/MenubarMenu.xib; sourceTree = "<group>"; };
6C575A311050759C008C5B23 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = Plugin/de.lproj/ContextualMenu.xib; sourceTree = "<group>"; };
6C575A3310507740008C5B23 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = Plugin/de.lproj/WhitelistPanel.xib; sourceTree = "<group>"; };
79166CBB0FF69E1800B1F69B /* CTGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTGradient.m; path = Plugin/CTGradient.m; sourceTree = "<group>"; };
79166CBC0FF69E1800B1F69B /* CTGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTGradient.h; path = Plugin/CTGradient.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -257,7 +253,6 @@
6C4B652B1051A58800412F09 /* AboutBox.xib */,
6C4B65D11051B6EF00412F09 /* Credits.css */,
6C4B651810519F3F00412F09 /* Credits.html */,
072189BA0F30D9C3008C8944 /* ContextualMenu.xib */,
072189BC0F30D9C3008C8944 /* WhitelistPanel.xib */,
A494CC2B0F9F2446007D5EEB /* ctf.icns */,
D9566C2B0F37EA0800358646 /* deSIFR Resources */,
Expand Down Expand Up @@ -406,7 +401,6 @@
files = (
D9566D8C0F380C9F00358646 /* sifr2-addons.js in Resources */,
D9566D8D0F380C9F00358646 /* sifr3-addons.js in Resources */,
072189BE0F30D9C3008C8944 /* ContextualMenu.xib in Resources */,
072189BF0F30D9C3008C8944 /* WhitelistPanel.xib in Resources */,
6953E43C0F3EDEB50014ECF7 /* MenubarMenu.xib in Resources */,
A494CC2C0F9F2446007D5EEB /* ctf.icns in Resources */,
Expand Down Expand Up @@ -507,16 +501,6 @@
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
072189BA0F30D9C3008C8944 /* ContextualMenu.xib */ = {
isa = PBXVariantGroup;
children = (
072189BB0F30D9C3008C8944 /* English */,
6C575A311050759C008C5B23 /* de */,
6C4B686510532BB200412F09 /* fr */,
);
name = ContextualMenu.xib;
sourceTree = "<group>";
};
072189BC0F30D9C3008C8944 /* WhitelistPanel.xib */ = {
isa = PBXVariantGroup;
children = (
Expand Down
2 changes: 2 additions & 0 deletions Plugin/CTFMenubarMenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extern NSInteger maxInvisibleDimension;
- (IBAction) showSettingsWindow: (id) sender;
- (IBAction) showAboutBox: (id) sender;

- (BOOL) multipleFlashViewsExistForWindow: (NSWindow*) window;

- (void) registerView: (NSView*) view;
- (void) unregisterView: (NSView*) view;

Expand Down
17 changes: 17 additions & 0 deletions Plugin/CTFMenubarMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,23 @@ - (BOOL) _invisibleFlashViewExistsForKeyWindow;
return [ self _flashViewExistsForKeyWindowWithInvisibleOnly: YES ];
}

- (BOOL) multipleFlashViewsExistForWindow: (NSWindow*) window
{
int count = 0;

NSHashEnumerator enumerator = NSEnumerateHashTable( _views );
CTFClickToFlashPlugin* item;

while( ( item = NSNextHashEnumeratorItem( &enumerator ) ) ) {
if( [ item window ] == window ) {
count++;
}
}
NSEndHashTableEnumeration( &enumerator );

return (count > 1);
}

- (BOOL) validateMenuItem: (NSMenuItem*) item
{
if ( [ item action ] == @selector( loadAllFlash: ) ) {
Expand Down
Loading

0 comments on commit 9553bf2

Please sign in to comment.