Skip to content

Commit

Permalink
Flash help update. Re-commit.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.textmate.org/trunk/Bundles/ActionScript.tmbundle@2408 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information
simongregory committed Dec 7, 2005
1 parent 9457270 commit aede165
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 56 deletions.
32 changes: 22 additions & 10 deletions Commands/Show AS Function Signature.plist
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{
beforeRunningCommand = nop;
command = "\"$TM_BUNDLE_PATH/Tools/functionsig.pl\"";
input = none;
keyEquivalent = "^~@/";
name = "Show AS Function Signature";
output = showAsTooltip;
uuid = "7CDA9C8D-82C1-11D9-8357-000A95C5F126";
scope = "source.actionscript";
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>"$TM_BUNDLE_SUPPORT/Tools/asd.pl"</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^~@/</string>
<key>name</key>
<string>Show AS Function Signature</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.actionscript</string>
<key>uuid</key>
<string>7CDA9C8D-82C1-11D9-8357-000A95C5F126</string>
</dict>
</plist>
116 changes: 116 additions & 0 deletions Support/Tools/asd.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/perl

#Original by Roger Braunstein - http://www.partlyhuman.com/wordpress/archives/2005/03/10/textmate-actionscript-bundle/

#Updated by Simon Gregory - http://www.helvector.org - Known to work in TextMate 1.1b17 (513 to 790)

my $HELPDIR = $ENV{"TM_FLASH_HELP"};
my $HELPTOC = "help_toc.xml";
my $WORD = $ENV{"TM_CURRENT_WORD"};
my %RESULTS;

my $STYLE = "<style>
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: .7em;
padding: 5px;
background-color: #FFFFFF;
}
a:link {
color: #005FA9;
text-decoration: none;
}
a:visited {
color: #A367B1;
text-decoration: none;
}
a:hover, a:visited:hover {
background-color: #DDEEFF;
}
table {
font-size: 100%;
border-spacing: 0px 0px;
border-collapse: collapse;
border-bottom: solid 1px #B6C0C3;
border-right: solid 1px #B6C0C3;
}
th {
font-weight: bold;
color: #000000;
background-color: #DEDEDE;
text-align: left;
border-top: solid 1px #B6C0C3;
border-left: solid 1px #B6C0C3;
}
td {
border-top: solid 1px #B6C0C3;
border-left: solid 1px #B6C0C3;
}
table th, table td {
padding: 0.4em 10px;
vertical-align: top;
}
table.nav, table.nav th, table.nav td {
padding: 0px 0px;
border: 0px;
}
.nav {
margin-top: -3px;
margin-bottom: -3px;
}
</style>";

my $HEAD = "<html><head><title>ActionScript Dictonary Search Results</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">".$STYLE."</head>";
my $HTMLOUT = "";

open(IN, '<', "$HELPDIR/$HELPTOC") || exit print $HEAD."<body><table class=\"nav\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"100%\" align=\"left\"><p><b>ActionScript 2.0 Language&#160;Reference</b>&nbsp;</p></td></tr></table><br><hr align=\"left\" ><h1>Search failed for ".$WORD."</h1><div class=\"signature\"><p>In order for this command to work TextMate needs to know where to find the ActionScript Dictionary index file. This is set in <strong>Preferences > Advanced > Shell Variables</strong>. Click <strong>+</strong> and name the variable TM_FLASH_HELP with value of the path to the directory containing the help_toc.xml file on your system. Macromedia have made this tricky and the files aren\'t always in the same place.<br><br>Try clicking the following links:<br><br><a href=\"txmt://open?url=file:///Users/Shared/Library/Application Support/Macromedia/Flash 8/en/Configuration/HelpPanel/Help/ActionScriptLangRef/help_toc.xml\">//Users/Shared/Library/Application Support/Macromedia/Flash 8/en/Configuration/HelpPanel/Help/ActionScriptLangRef</a><br><br><a href=\"txmt://open?url=file:///Users/Shared/Library/Application Support/Macromedia/Flash MX 2004/en/Configuration/HelpPanel/Help/ActionScriptLangRef/help_toc.xml\">//Users/Shared/Library/Application Support/Macromedia/Flash MX 2004/en/Configuration/HelpPanel/Help/ActionScriptLangRef</a><br><br><a href=\"txmt://open?url=file:///Applications/Macromedia Flash MX 2004/First Run/HelpPanel/Help/ActionScriptDictionary\">/Applications/Macromedia Flash MX 2004/First Run/HelpPanel/Help/ActionScriptDictionary</a><br><br>If any of the links work (TextMate will open the help_toc.xml file) then copy and paste the link, omitting the /help_toc.xml on the end, to the path of the shell variable.<br><br>Help can be found on the TextMate mailing list.</p></div></body></html>";
while(<IN>)
{
if (m#href="([^"]+)"\s+name="([^"]+)"#)
{
my $url = $1;
my $term = $2;
if ($term =~ /$WORD/i)
{
if ($term)
{
$RESULTS{$term} = $url;
}
}
}
}

my @arr = sort(keys(%RESULTS));
if ($#arr == 0)
{
#This re-directs TextMate to the right page. Done this way the page assets are available.
print "<meta http-equiv=\"refresh\" content=\"0; tm-file://$HELPDIR/$RESULTS{$arr[0]}\">";

#The following will return the whole document as a string - doc root changes so linked assets are lost.
#system("cat $HELPDIR/$RESULTS{$arr[0]}");

#How to link so that TextMate opens the actual file.
#print "txmt://open?url=file://$HELPDIR/$RESULTS{$arr[0]}";

#Trace out the file name.
#print "file://$HELPDIR/$RESULTS{$arr[0]}";
#print "tm-file://$HELPDIR/$RESULTS{$arr[0]}";

}
elsif ($#arr > 0)
{
$HTMLOUT = $HEAD."<body><table class=\"nav\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"100%\" align=\"left\"><p><b>ActionScript 2.0 Language&#160;Reference</b>&nbsp;</p></td></tr></table><br><hr align=\"left\" ><h1>Search Results for ".$WORD."</h1><div class=\"signature\"><p>";
for $term (@arr)
{
#print qq#<a href="txmt://open?url=file://$HELPDIR/$RESULTS{$term}">$term</a><br/>#;
$HTMLOUT = $HTMLOUT.qq#<a href="tm-file://$HELPDIR/$RESULTS{$term}">$term</a><br/>#;
}
$HTMLOUT = $HTMLOUT."</p></div></body></html>";
print $HTMLOUT;
}
else
{
print $HEAD."<body><table class=\"nav\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"100%\" align=\"left\"><p><b>ActionScript 2.0 Language&#160;Reference</b>&nbsp;</p></td></tr></table><br><hr align=\"left\" ><h1>No Results for ".$WORD."</h1><div class=\"signature\"><p></p></div></body></html>";
}

close IN;
File renamed without changes.
44 changes: 0 additions & 44 deletions Tools/asd.pl

This file was deleted.

4 changes: 2 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<string>ActionScript</string>
<key>ordering</key>
<array>
<string>BE332E85-83B1-11D9-AD5A-000A95C5F126</string>
<string>2197A196-78E3-11D9-8177-000A95C5F126</string>
<string>6EE297DB-83BF-11D9-AD5A-000A95C5F126</string>
<string>022C9B78-88E9-11D9-9236-000A95C5F126</string>
<string>8B98F650-78F7-11D9-B2B4-000A95C5F126</string>
<string>6EE297DB-83BF-11D9-AD5A-000A95C5F126</string>
<string>7CDA9C8D-82C1-11D9-8357-000A95C5F126</string>
<string>BE332E85-83B1-11D9-AD5A-000A95C5F126</string>
<string>0C5DEEE1-7519-11D9-8FBA-00039398C572</string>
<string>23DD540E-7510-11D9-8FBA-00039398C572</string>
<string>21C84811-7519-11D9-8FBA-00039398C572</string>
Expand Down

0 comments on commit aede165

Please sign in to comment.