Repository: johnno1962/RefactoratorApp Branch: master Commit: 4c41d15f1d87 Files: 32 Total size: 432.4 KB Directory structure: gitextract_cm_vpaff/ ├── .gitignore ├── LICENSE ├── README.md ├── Refactorator/ │ ├── App.icns │ ├── AppController.swift │ ├── AppDelegate.swift │ ├── Assets.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Base.lproj/ │ │ └── MainMenu.xib │ ├── Common.swift │ ├── Coverage.swift │ ├── Credits.rtf │ ├── Formatter.swift │ ├── Info.plist │ ├── Integration.swift │ ├── Intro.html │ ├── Project.swift │ ├── Refactorator-Bridging-Header.h │ ├── Source.html │ ├── Utils.h │ ├── Utils.m │ ├── Xcode.h │ ├── canviz.html │ ├── canviz2.html │ └── coverage.rb ├── Refactorator.xcodeproj/ │ ├── project.pbxproj │ └── project.xcworkspace/ │ └── contents.xcworkspacedata └── canviz-0.1/ ├── LICENSE.txt ├── README.txt ├── canviz.css ├── canviz.js ├── path/ │ └── path.js └── prototype/ └── prototype.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *html/* *xcuserdata* *xccheckout* ================================================ FILE: LICENSE ================================================ Copyright (c) 2017 John Holdsworth Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Refactorator II, The App Due to chnages in the index databaase format in Xcode 10, this program no longer works properly. This is the source for the App version of the [Refactorator plugin](https://github.com/johnno1962/Refactorator) for refactoring Swift (well, renaming actually.) One of the features of app is it can convert a project into a standalone website of navigable code for example [this project](http://johnholdsworth.com/refactorator). To build, clone this *and the code for the Refactorator plugin* next to each other the build this project. Help is available [here](http://johnholdsworth.com/refactorator.html) where you can download a [pre-built binary](http://johnholdsworth.com/Refactorator.app.zip).  The project now draws interactive dependecncy graphs between sources in a project if you have Graphviz installed.  Refactorator now takes into account membership of protocols and overrides in the main target if you augment the index db by using the "File/Index Protocols" menu item. This project is an experiment in "Beerware" there is a "donate" button on the Help Menu ;) ## MIT Licensed Copyright (C) 2016 John Holdsworth refactorator@johnholdsworth.com [@Injection4Xcode](https://twitter.com/@Injection4Xcode) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This release includes the canviz, path amd prototype JavaScript libraries which are distributed under the terms of their respective licenses. ================================================ FILE: Refactorator/AppController.swift ================================================ // // AppState.swift // Refactorator // // Created by John Holdsworth on 13/12/2016. // Copyright © 2016 John Holdsworth. All rights reserved. // import Foundation import WebKit class AppController: NSObject, AppGui, WebUIDelegate, WebFrameLoadDelegate, WebPolicyDelegate { @IBOutlet weak var window: NSWindow! @IBOutlet weak var sourceView: WebView! @IBOutlet weak var changesView: WebView! weak var printWebView: WebView! let canvizEntity = Entity(file: "[Dependencies]") var canvizView: WebView! @IBOutlet weak var replacement: NSTextField! @IBOutlet weak var findText: NSTextField! @IBOutlet var backItem: NSMenuItem! @IBOutlet var forwardItem: NSMenuItem! @IBOutlet var reloadItem: NSMenuItem! @IBOutlet var dependsItem: NSMenuItem! @IBOutlet var searchItem: NSMenuItem! var history = [Entity]() var future = [Entity]() var project: Project? var html = "", oldValue = "", changes = "" var wasSearch = false var entitiesByFile = [[Entity]]() var originals = [String:NSData]() var modified = [String:NSData]() var linecounts = [String:Int]() var formatter = Formatter() func log( _ msg: String ) { appendSource(title: "", text: "
\(reference.replacingOccurrences(of: "\n", with: ""))
Cross Reference can be found here." sources += "
Dependencies Graph can be found here." let index = htmlDir+"index.html" try sources.write(toFile: index, atomically: false, encoding: .utf8) DispatchQueue.main.async { state.appendSource(title: "", text: "Wrote \(index)\n") } sources = common+"
================================================ FILE: Refactorator/Utils.h ================================================ // // Utils.h // Refactorator // // Created by John Holdsworth on 19/11/2016. // Copyright © 2016 John Holdsworth. All rights reserved. // #import@interface Utils : NSObject + (NSString *)hashStringForPath:(NSString *)path; @end ================================================ FILE: Refactorator/Utils.m ================================================ // // Utils.m // Refactorator // // Created by John Holdsworth on 19/11/2016. // Copyright © 2016 John Holdsworth. All rights reserved. // #import "Utils.h" #import @implementation Utils // Thanks to: http://samdmarshall.com/blog/xcode_deriveddata_hashes.html // this function is used to swap byte ordering of a 64bit integer uint64_t swap_uint64(uint64_t val) { val = ((val << 8) & 0xFF00FF00FF00FF00ULL ) | ((val >> 8) & 0x00FF00FF00FF00FFULL ); val = ((val << 16) & 0xFFFF0000FFFF0000ULL ) | ((val >> 16) & 0x0000FFFF0000FFFFULL ); return (val << 32) | (val >> 32); } /*! @method hashStringForPath Create the unique identifier string for a Xcode project path @param path (input) string path to the ".xcodeproj" or ".xcworkspace" file @result NSString* of the identifier */ + (NSString *)hashStringForPath:(NSString *)path; { // using uint64_t[2] for ease of use, since it is the same size as char[CC_MD5_DIGEST_LENGTH] uint64_t digest[CC_MD2_DIGEST_LENGTH] = {0}; // char array that will contain the identifier unsigned char resultStr[28] = {0}; // setup md5 context CC_MD5_CTX md5; CC_MD5_Init(&md5); // get the UTF8 string of the path const char *c_path = [path UTF8String]; // get length of the path string unsigned long length = strlen(c_path); // update the md5 context with the full path string CC_MD5_Update (&md5, c_path, (CC_LONG)length); // finalize working with the md5 context and store into the digest CC_MD5_Final ( (unsigned char *)digest, &md5); // take the first 8 bytes of the digest and swap byte order uint64_t startValue = swap_uint64(digest[0]); // for indexes 13->0 int index = 13; do { // take 'startValue' mod 26 (restrict to alphabetic) and add based 'a' resultStr[index] = (char)((startValue % 26) + 'a'); // divide 'startValue' by 26 startValue /= 26; index--; } while (index >= 0); // The second loop, this time using the last 8 bytes // repeating the same process as before but over indexes 27->14 startValue = swap_uint64(digest[1]); index = 27; do { resultStr[index] = (char)((startValue % 26) + 'a'); startValue /= 26; index--; } while (index > 13); //return [[NSString alloc] initWithString:@"agyjsqofsyrdwafqcrbciitvnmmj"]; // create a new string from the 'resultStr' char array and return return [[NSString alloc] initWithBytes:resultStr length:28 encoding:NSUTF8StringEncoding]; } @end ================================================ FILE: Refactorator/Xcode.h ================================================ /* * Xcode.h -- extracted using: sdef /Applications/Xcode.app | sdp -fh --basename Xcode and slightly modified for Swift */ #import #import @class XcodeApplication, XcodeDocument, XcodeWindow, XcodeFileDocument, XcodeTextDocument, XcodeSourceDocument, XcodeWorkspaceDocument, XcodeSchemeActionResult, XcodeSchemeActionIssue, XcodeBuildError, XcodeBuildWarning, XcodeAnalyzerIssue, XcodeTestFailure, XcodeScheme, XcodeRunDestination, XcodeDevice, XcodeBuildConfiguration, XcodeProject, XcodeBuildSetting, XcodeResolvedBuildSetting, XcodeTarget; enum XcodeSaveOptions { XcodeSaveOptionsYes = 'yes ' /* Save the file. */, XcodeSaveOptionsNo = 'no ' /* Do not save the file. */, XcodeSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ }; typedef enum XcodeSaveOptions XcodeSaveOptions; // The status of a scheme action result object. enum XcodeSchemeActionResultStatus { XcodeSchemeActionResultStatusNotYetStarted = 'srsn' /* The action has not yet started. */, XcodeSchemeActionResultStatusRunning = 'srsr' /* The action is in progress. */, XcodeSchemeActionResultStatusCancelled = 'srsc' /* The action was cancelled. */, XcodeSchemeActionResultStatusFailed = 'srsf' /* The action ran but did not complete successfully. */, XcodeSchemeActionResultStatusErrorOccurred = 'srse' /* The action was not able to run due to an error. */, XcodeSchemeActionResultStatusSucceeded = 'srss' /* The action succeeded. */ }; typedef enum XcodeSchemeActionResultStatus XcodeSchemeActionResultStatus; @protocol XcodeGenericMethods - (void) closeSaving:(XcodeSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. - (void) delete; // Delete an object. - (void) moveTo:(SBObject *)to; // Move an object to a new location. - (XcodeSchemeActionResult *) build; // Invoke the "build" scheme action. This command should be sent to a workspace document. The build will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. - (XcodeSchemeActionResult *) clean; // Invoke the "clean" scheme action. This command should be sent to a workspace document. The clean will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. - (void) stop; // Stop the active scheme action, if one is running. This command should be sent to a workspace document. This command does not wait for the action to stop. - (XcodeSchemeActionResult *) runWithCommandLineArguments:(id)withCommandLineArguments withEnvironmentVariables:(id)withEnvironmentVariables; // Invoke the "run" scheme action. This command should be sent to a workspace document. The run action will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. - (XcodeSchemeActionResult *) testWithCommandLineArguments:(id)withCommandLineArguments withEnvironmentVariables:(id)withEnvironmentVariables; // Invoke the "test" scheme action. This command should be sent to a workspace document. The test action will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. @end /* * Standard Suite */ // The application's top-level scripting object. @interface SBApplication(XcodeApplication) - (SBElementArray *) documents; - (SBElementArray *) windows; @property (copy, readonly) NSString *name; // The name of the application. @property (readonly) BOOL frontmost; // Is this the active application? @property (copy, readonly) NSString *version; // The version number of the application. - (id) open:(id)x; // Open a document. - (void) quitSaving:(XcodeSaveOptions)saving; // Quit the application. - (BOOL) exists:(id)x; // Verify that an object exists. @end // A document. @interface XcodeDocument : SBObject @property (copy, readonly) NSString *name; // Its name. @property (readonly) BOOL modified; // Has it been modified since the last save? @property (copy, readonly) NSURL *file; // Its location on disk, if it has one. @end // A window. @interface SBObject(XcodeWindow) //: SBObject @property (copy, readonly) NSString *name; // The title of the window. - (NSInteger) id; // The unique identifier of the window. @property NSInteger index; // The index of the window, ordered front to back. @property NSRect bounds; // The bounding rectangle of the window. @property (readonly) BOOL closeable; // Does the window have a close button? @property (readonly) BOOL miniaturizable; // Does the window have a minimize button? @property BOOL miniaturized; // Is the window minimized right now? @property (readonly) BOOL resizable; // Can the window be resized? @property BOOL visible; // Is the window visible right now? @property (readonly) BOOL zoomable; // Does the window have a zoom button? @property BOOL zoomed; // Is the window zoomed right now? @property (copy, readonly) /*XcodeDocument*/ SBObject *document; // The document whose contents are displayed in the window. @end /* * Xcode Application Suite */ // The Xcode application. @interface SBApplication (XcodeApplicationSuite) - (SBElementArray *) fileDocuments; - (SBElementArray *) sourceDocuments; - (SBElementArray *) workspaceDocuments; @property (copy) /*XcodeWorkspaceDocument*/ SBObject *activeWorkspaceDocument; // The active workspace document in Xcode. @end /* * Xcode Document Suite */ // An Xcode-compatible document. @interface SBObject(XcodeDocument)// (XcodeDocumentSuite) @property (copy) NSString *path; // The document's path. @end // A document that represents a file on disk. It also provides access to the window it appears in. @interface XcodeFileDocument : XcodeDocument @end // A document that represents a text file on disk. It also provides access to the window it appears in. @interface SBObject(XcodeTextDocument)// : XcodeFileDocument @property (copy) NSArray *selectedCharacterRange; // The first and last character positions in the selection. @property (copy) NSArray *selectedParagraphRange; // The first and last paragraph positions that contain the selection. @property (copy) NSString *text; // The text of the text file referenced. @property BOOL notifiesWhenClosing; // Should Xcode notify other apps when this document is closed? @end // A document that represents a source file on disk. It also provides access to the window it appears in. @interface SBObject(XcodeSourceDocument)// : XcodeTextDocument @end // A document that represents a workspace on disk. Workspaces are the top-level container for almost all objects and commands in Xcode. @interface SBObject(XcodeWorkspaceDocument) // : XcodeDocument - (SBElementArray *) projects; - (SBElementArray *) schemes; - (SBElementArray *) runDestinations; @property BOOL loaded; // Whether the workspace document has finsished loading after being opened. Messages sent to a workspace document before it has loaded will result in errors. @property (copy) XcodeScheme *activeScheme; // The workspace's scheme that will be used for scheme actions. @property (copy) /*XcodeRunDestination*/ SBObject *activeRunDestination; // The workspace's run destination that will be used for scheme actions. @property (copy) XcodeSchemeActionResult *lastSchemeActionResult; // The scheme action result for the last scheme action command issued to the workspace document. @property (copy, readonly) NSURL *file; // Its location on disk, if it has one. @end /* * Xcode Scheme Suite */ // An object describing the result of performing a scheme action command. @interface XcodeSchemeActionResult : SBObject - (SBElementArray *) buildErrors; - (SBElementArray *) buildWarnings; - (SBElementArray *) analyzerIssues; - (SBElementArray *) testFailures; - (NSString *) id; // The unique identifier for the scheme. @property (readonly) BOOL completed; // Whether this scheme action has completed (sucessfully or otherwise) or not. @property XcodeSchemeActionResultStatus status; // Indicates the status of the scheme action. @property (copy) NSString *errorMessage; // If the result's status is "error occurred", this will be the error message; otherwise, this will be "missing value". @property (copy) NSString *buildLog; // If this scheme action performed a build, this will be the text of the build log. @end // An issue (like an error or warning) generated by a scheme action. @interface XcodeSchemeActionIssue : SBObject @property (copy) NSString *message; // The text of the issue. @property (copy) NSString *filePath; // The file path where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. @property NSInteger startingLineNumber; // The starting line number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. @property NSInteger endingLineNumber; // The ending line number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. @property NSInteger startingColumnNumber; // The starting column number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. @property NSInteger endingColumnNumber; // The ending column number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. @end // An error generated by a build. @interface XcodeBuildError : XcodeSchemeActionIssue @end // A warning generated by a build. @interface XcodeBuildWarning : XcodeSchemeActionIssue @end // A warning generated by the static analyzer. @interface XcodeAnalyzerIssue : XcodeSchemeActionIssue @end // A failure from a test. @interface XcodeTestFailure : XcodeSchemeActionIssue @end // A set of parameters for building, testing, launching or distributing the products of a workspace. @interface XcodeScheme : SBObject @property (copy, readonly) NSString *name; // The name of the scheme. - (NSString *) id; // The unique identifier for the scheme. @end // An object which specifies parameters such as the device and architecture for which to perform a scheme action. @interface SBObject(XcodeRunDestination)// : SBObject @property (copy, readonly) NSString *name; // The name of the run destination. @property (copy, readonly) NSString *architecture; // The architecture for which this run destination results in execution. @property (copy, readonly) NSString *platform; // The platform which this run destination targets. @property (copy, readonly) XcodeDevice *device; // The device which this run destination targets. @property (copy, readonly) XcodeDevice *companionDevice; // If the run destination's device has a companion (e.g. a paired watch for a phone) which it will use, this is that device. @end // A device which can be used as the target for a scheme action, as part of a run destination. @interface XcodeDevice : SBObject @property (copy, readonly) NSString *name; // The name of the run destination. @property (copy, readonly) NSString *deviceIdentifier; // The identifier of the device which this run destination targets. @property (copy, readonly) NSString *operatingSystemVersion; // The version of the operating system installed on the device which this run destination targets. @property (copy, readonly) NSString *deviceModel; // The model of device (e.g. "iPad Air") which this run destination targets. @property (readonly) BOOL generic; // Whether this run destination is generic instead of representing a specific device. @end /* * Xcode Project Suite */ // A set of build settings for a target or project. Each target in a project has the same named build configurations as the project. @interface XcodeBuildConfiguration : SBObject - (SBElementArray *) buildSettings; - (SBElementArray *) resolvedBuildSettings; - (NSString *) id; // The unique identifier for the build configuration. @property (copy, readonly) NSString *name; // The name of the build configuration. @end // An Xcode project. Projects represent project files on disk and are always open in the context of a workspace document. @interface XcodeProject : SBObject - (SBElementArray *) buildConfigurations; - (SBElementArray *) targets; @property (copy, readonly) NSString *name; // The name of the project - (NSString *) id; // The unique identifier for the project. @end // A setting that controls how products are built. @interface XcodeBuildSetting : SBObject @property (copy) NSString *name; // The unlocalized build setting name (e.g. DSTROOT). @property (copy) NSString *value; // A string value for the build setting. @end // An object that represents a resolved value for a build setting. @interface XcodeResolvedBuildSetting : SBObject @property (copy) NSString *name; // The unlocalized build setting name (e.g. DSTROOT). @property (copy) NSString *value; // A string value for the build setting. @end // A target is a blueprint for building a product. Targets inherit build settings from their project if not overridden in the target. @interface XcodeTarget : SBObject - (SBElementArray *) buildConfigurations; @property (copy) NSString *name; // The name of this target. - (NSString *) id; // The unique identifier for the target. @property (copy, readonly) XcodeProject *project; // The project that contains this target @end ================================================ FILE: Refactorator/canviz.html ================================================ Project Dependencies ================================================ FILE: Refactorator/canviz2.html ================================================Project Dependencies ================================================ FILE: Refactorator/coverage.rb ================================================ #!/usr/bin/ruby # coverage.rb # Refactorator # # Created by John Holdsworth on 03/03/2017. # Copyright © 2017 John Holdsworth. All rights reserved. profdata, source = ARGV objectdir = File.dirname( profdata ) classname = File.basename( source, ".swift" ) Dir.chdir(objectdir) object = Dir.glob("**/#{classname}.o").first coverage = `xcrun llvm-cov show -instr-profile '#{profdata}' '#{object}'` coverage.scan( /^\s+(\d+)\|\s+(\d+)\|/ ) do |covered, line| if covered != "0" puts( "#{line}\n" ) end end ================================================ FILE: Refactorator.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ BB04C8351E04423B00FDF253 /* canviz2.html in Resources */ = {isa = PBXBuildFile; fileRef = BB04C8341E04423B00FDF253 /* canviz2.html */; }; BB04C8381E045DF500FDF253 /* LineGenerators.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB04C8361E045DF500FDF253 /* LineGenerators.swift */; }; BB04C8391E045DF500FDF253 /* LogParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB04C8371E045DF500FDF253 /* LogParser.swift */; }; BB04C83B1E062FB200FDF253 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB04C83A1E062FB200FDF253 /* Common.swift */; }; BB1BE5AB1DE443A800BB802F /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = BB1BE5AA1DE443A800BB802F /* Credits.rtf */; }; BB1BE5AC1DE54D4100BB802F /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BBFFF4321DE13A0600398350 /* libsqlite3.tbd */; }; BB1BE5AE1DE801B700BB802F /* Intro.html in Resources */ = {isa = PBXBuildFile; fileRef = BB1BE5AD1DE801B600BB802F /* Intro.html */; }; BB2BAFDC1DEEDC36003715DB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = BB2BAFD91DEED26E003715DB /* README.md */; }; BB2CE5611E003A6A00BE0C52 /* Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2CE5601E003A6A00BE0C52 /* Formatter.swift */; }; BB2CE5631E005ECC00BE0C52 /* AppController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2CE5621E005ECC00BE0C52 /* AppController.swift */; }; BB2CE5711E01965E00BE0C52 /* canviz-0.1 in Resources */ = {isa = PBXBuildFile; fileRef = BB2CE5701E01965E00BE0C52 /* canviz-0.1 */; }; BB2CE5731E0197AB00BE0C52 /* canviz.html in Resources */ = {isa = PBXBuildFile; fileRef = BB2CE5721E0197AB00BE0C52 /* canviz.html */; }; BB356BE21E0C75A30056B10F /* Integration.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB356BE11E0C75A30056B10F /* Integration.swift */; }; BB3A5EEB1DE3A76C00184151 /* Xcode.h in Resources */ = {isa = PBXBuildFile; fileRef = BBFFF4281DE1311300398350 /* Xcode.h */; }; BB6528251E69730300B8FB95 /* Coverage.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6528241E69730300B8FB95 /* Coverage.swift */; }; BB6528291E69821200B8FB95 /* coverage.rb in Resources */ = {isa = PBXBuildFile; fileRef = BB6528261E6973CD00B8FB95 /* coverage.rb */; }; BB8E068B1DE869290006BB1D /* ByteRegex.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB8E06861DE869290006BB1D /* ByteRegex.swift */; }; BB8E068C1DE869290006BB1D /* Entity.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB8E06871DE869290006BB1D /* Entity.swift */; }; BB8E068D1DE869290006BB1D /* IndexDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB8E06881DE869290006BB1D /* IndexDB.swift */; }; BB8E068E1DE869290006BB1D /* IndexStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB8E06891DE869290006BB1D /* IndexStrings.swift */; }; BB8E068F1DE869290006BB1D /* SourceKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB8E068A1DE869290006BB1D /* SourceKit.swift */; }; BBFFF4061DE1083A00398350 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFFF4051DE1083A00398350 /* AppDelegate.swift */; }; BBFFF4081DE1083A00398350 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBFFF4071DE1083A00398350 /* Assets.xcassets */; }; BBFFF40B1DE1083A00398350 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFFF4091DE1083A00398350 /* MainMenu.xib */; }; BBFFF4131DE1086B00398350 /* App.icns in Resources */ = {isa = PBXBuildFile; fileRef = BBFFF4121DE1086B00398350 /* App.icns */; }; BBFFF4161DE109BC00398350 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBFFF4151DE109BC00398350 /* WebKit.framework */; }; BBFFF4201DE10C6400398350 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = BBFFF41F1DE10C6400398350 /* Utils.m */; }; BBFFF4241DE11DBB00398350 /* Source.html in Resources */ = {isa = PBXBuildFile; fileRef = BBFFF4231DE11DBB00398350 /* Source.html */; }; BBFFF4351DE1781800398350 /* Project.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFFF4341DE1781800398350 /* Project.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ BB04C8341E04423B00FDF253 /* canviz2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = canviz2.html; sourceTree = ""; }; BB04C8361E045DF500FDF253 /* LineGenerators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LineGenerators.swift; path = ../../Refactorator/refactord/LineGenerators.swift; sourceTree = " "; }; BB04C8371E045DF500FDF253 /* LogParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LogParser.swift; path = ../../Refactorator/refactord/LogParser.swift; sourceTree = " "; }; BB04C83A1E062FB200FDF253 /* Common.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Common.swift; sourceTree = " "; }; BB1BE5AA1DE443A800BB802F /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = " "; }; BB1BE5AD1DE801B600BB802F /* Intro.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Intro.html; sourceTree = " "; }; BB2BAFD91DEED26E003715DB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; BB2BAFDB1DEEDA85003715DB /* sourcekitd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sourcekitd.h; path = ../../Refactorator/refactord/sourcekitd.h; sourceTree = " "; }; BB2CE5601E003A6A00BE0C52 /* Formatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Formatter.swift; sourceTree = " "; }; BB2CE5621E005ECC00BE0C52 /* AppController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppController.swift; sourceTree = " "; }; BB2CE5701E01965E00BE0C52 /* canviz-0.1 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "canviz-0.1"; sourceTree = " "; }; BB2CE5721E0197AB00BE0C52 /* canviz.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = canviz.html; sourceTree = " "; }; BB356BE11E0C75A30056B10F /* Integration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Integration.swift; sourceTree = " "; }; BB6528241E69730300B8FB95 /* Coverage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Coverage.swift; sourceTree = " "; }; BB6528261E6973CD00B8FB95 /* coverage.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = coverage.rb; sourceTree = " "; }; BB8E06861DE869290006BB1D /* ByteRegex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ByteRegex.swift; path = ../../Refactorator/refactord/ByteRegex.swift; sourceTree = " "; }; BB8E06871DE869290006BB1D /* Entity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Entity.swift; path = ../../Refactorator/refactord/Entity.swift; sourceTree = " "; }; BB8E06881DE869290006BB1D /* IndexDB.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IndexDB.swift; path = ../../Refactorator/refactord/IndexDB.swift; sourceTree = " "; }; BB8E06891DE869290006BB1D /* IndexStrings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IndexStrings.swift; path = ../../Refactorator/refactord/IndexStrings.swift; sourceTree = " "; }; BB8E068A1DE869290006BB1D /* SourceKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SourceKit.swift; path = ../../Refactorator/refactord/SourceKit.swift; sourceTree = " "; }; BBFFF4021DE1083900398350 /* Refactorator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Refactorator.app; sourceTree = BUILT_PRODUCTS_DIR; }; BBFFF4051DE1083A00398350 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = " "; }; BBFFF4071DE1083A00398350 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = " "; }; BBFFF40A1DE1083A00398350 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = " "; }; BBFFF40C1DE1083A00398350 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = " "; }; BBFFF4121DE1086B00398350 /* App.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = App.icns; sourceTree = " "; }; BBFFF4151DE109BC00398350 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; BBFFF41D1DE10C6400398350 /* Refactorator-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Refactorator-Bridging-Header.h"; sourceTree = " "; }; BBFFF41E1DE10C6400398350 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = " "; }; BBFFF41F1DE10C6400398350 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = " "; }; BBFFF4211DE1130800398350 /* sourcekitd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = sourcekitd.framework; path = Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework; sourceTree = DEVELOPER_DIR; }; BBFFF4231DE11DBB00398350 /* Source.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Source.html; sourceTree = " "; }; BBFFF4281DE1311300398350 /* Xcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xcode.h; sourceTree = " "; }; BBFFF4321DE13A0600398350 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; BBFFF4341DE1781800398350 /* Project.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Project.swift; sourceTree = " "; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ BBFFF3FF1DE1083900398350 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( BBFFF4161DE109BC00398350 /* WebKit.framework in Frameworks */, BB1BE5AC1DE54D4100BB802F /* libsqlite3.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ BBFFF3F91DE1083900398350 = { isa = PBXGroup; children = ( BB2BAFD91DEED26E003715DB /* README.md */, BBFFF4041DE1083A00398350 /* Refactorator */, BB2CE5701E01965E00BE0C52 /* canviz-0.1 */, BBFFF4031DE1083900398350 /* Products */, BBFFF4141DE109BB00398350 /* Frameworks */, ); sourceTree = " "; }; BBFFF4031DE1083900398350 /* Products */ = { isa = PBXGroup; children = ( BBFFF4021DE1083900398350 /* Refactorator.app */, ); name = Products; sourceTree = " "; }; BBFFF4041DE1083A00398350 /* Refactorator */ = { isa = PBXGroup; children = ( BBFFF4051DE1083A00398350 /* AppDelegate.swift */, BB2CE5621E005ECC00BE0C52 /* AppController.swift */, BB2CE5601E003A6A00BE0C52 /* Formatter.swift */, BB04C83A1E062FB200FDF253 /* Common.swift */, BBFFF4341DE1781800398350 /* Project.swift */, BB6528241E69730300B8FB95 /* Coverage.swift */, BB356BE11E0C75A30056B10F /* Integration.swift */, BB04C8361E045DF500FDF253 /* LineGenerators.swift */, BB8E06891DE869290006BB1D /* IndexStrings.swift */, BB8E06861DE869290006BB1D /* ByteRegex.swift */, BB04C8371E045DF500FDF253 /* LogParser.swift */, BB8E068A1DE869290006BB1D /* SourceKit.swift */, BB8E06881DE869290006BB1D /* IndexDB.swift */, BB8E06871DE869290006BB1D /* Entity.swift */, BB2BAFDB1DEEDA85003715DB /* sourcekitd.h */, BBFFF4281DE1311300398350 /* Xcode.h */, BBFFF4071DE1083A00398350 /* Assets.xcassets */, BBFFF4091DE1083A00398350 /* MainMenu.xib */, BBFFF4231DE11DBB00398350 /* Source.html */, BB2CE5721E0197AB00BE0C52 /* canviz.html */, BB04C8341E04423B00FDF253 /* canviz2.html */, BB6528261E6973CD00B8FB95 /* coverage.rb */, BB1BE5AA1DE443A800BB802F /* Credits.rtf */, BB1BE5AD1DE801B600BB802F /* Intro.html */, BBFFF40C1DE1083A00398350 /* Info.plist */, BBFFF4121DE1086B00398350 /* App.icns */, BBFFF41E1DE10C6400398350 /* Utils.h */, BBFFF41F1DE10C6400398350 /* Utils.m */, BBFFF41D1DE10C6400398350 /* Refactorator-Bridging-Header.h */, ); path = Refactorator; sourceTree = " "; }; BBFFF4141DE109BB00398350 /* Frameworks */ = { isa = PBXGroup; children = ( BBFFF4321DE13A0600398350 /* libsqlite3.tbd */, BBFFF4211DE1130800398350 /* sourcekitd.framework */, BBFFF4151DE109BC00398350 /* WebKit.framework */, ); name = Frameworks; sourceTree = " "; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ BBFFF4011DE1083900398350 /* Refactorator */ = { isa = PBXNativeTarget; buildConfigurationList = BBFFF40F1DE1083A00398350 /* Build configuration list for PBXNativeTarget "Refactorator" */; buildPhases = ( BBFFF3FE1DE1083900398350 /* Sources */, BBFFF3FF1DE1083900398350 /* Frameworks */, BBFFF4001DE1083900398350 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = Refactorator; productName = Refactorator; productReference = BBFFF4021DE1083900398350 /* Refactorator.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ BBFFF3FA1DE1083900398350 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; LastUpgradeCheck = 0820; ORGANIZATIONNAME = "John Holdsworth"; TargetAttributes = { BBFFF4011DE1083900398350 = { CreatedOnToolsVersion = 8.1; DevelopmentTeam = 9V5A8WE85E; LastSwiftMigration = 0810; ProvisioningStyle = Manual; }; }; }; buildConfigurationList = BBFFF3FD1DE1083900398350 /* Build configuration list for PBXProject "Refactorator" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = BBFFF3F91DE1083900398350; productRefGroup = BBFFF4031DE1083900398350 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( BBFFF4011DE1083900398350 /* Refactorator */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ BBFFF4001DE1083900398350 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( BB2BAFDC1DEEDC36003715DB /* README.md in Resources */, BB6528291E69821200B8FB95 /* coverage.rb in Resources */, BBFFF4081DE1083A00398350 /* Assets.xcassets in Resources */, BB1BE5AB1DE443A800BB802F /* Credits.rtf in Resources */, BB04C8351E04423B00FDF253 /* canviz2.html in Resources */, BBFFF4131DE1086B00398350 /* App.icns in Resources */, BBFFF40B1DE1083A00398350 /* MainMenu.xib in Resources */, BB2CE5731E0197AB00BE0C52 /* canviz.html in Resources */, BB1BE5AE1DE801B700BB802F /* Intro.html in Resources */, BBFFF4241DE11DBB00398350 /* Source.html in Resources */, BB2CE5711E01965E00BE0C52 /* canviz-0.1 in Resources */, BB3A5EEB1DE3A76C00184151 /* Xcode.h in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ BBFFF3FE1DE1083900398350 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( BB8E068D1DE869290006BB1D /* IndexDB.swift in Sources */, BB04C8391E045DF500FDF253 /* LogParser.swift in Sources */, BB356BE21E0C75A30056B10F /* Integration.swift in Sources */, BB2CE5631E005ECC00BE0C52 /* AppController.swift in Sources */, BB8E068E1DE869290006BB1D /* IndexStrings.swift in Sources */, BB2CE5611E003A6A00BE0C52 /* Formatter.swift in Sources */, BB6528251E69730300B8FB95 /* Coverage.swift in Sources */, BB04C83B1E062FB200FDF253 /* Common.swift in Sources */, BBFFF4201DE10C6400398350 /* Utils.m in Sources */, BB8E068F1DE869290006BB1D /* SourceKit.swift in Sources */, BB8E068C1DE869290006BB1D /* Entity.swift in Sources */, BB8E068B1DE869290006BB1D /* ByteRegex.swift in Sources */, BBFFF4061DE1083A00398350 /* AppDelegate.swift in Sources */, BB04C8381E045DF500FDF253 /* LineGenerators.swift in Sources */, BBFFF4351DE1781800398350 /* Project.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ BBFFF4091DE1083A00398350 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( BBFFF40A1DE1083A00398350 /* Base */, ); name = MainMenu.xib; sourceTree = " "; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ BBFFF40D1DE1083A00398350 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; BBFFF40E1DE1083A00398350 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; BBFFF4101DE1083A00398350 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 9V5A8WE85E; FRAMEWORK_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib"; INFOPLIST_FILE = Refactorator/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.johnholdsworth.Refactorator; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Refactorator/Refactorator-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; }; name = Debug; }; BBFFF4111DE1083A00398350 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Developer ID Application"; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 9V5A8WE85E; FRAMEWORK_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib"; INFOPLIST_FILE = Refactorator/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.johnholdsworth.Refactorator; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Refactorator/Refactorator-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ BBFFF3FD1DE1083900398350 /* Build configuration list for PBXProject "Refactorator" */ = { isa = XCConfigurationList; buildConfigurations = ( BBFFF40D1DE1083A00398350 /* Debug */, BBFFF40E1DE1083A00398350 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; BBFFF40F1DE1083A00398350 /* Build configuration list for PBXNativeTarget "Refactorator" */ = { isa = XCConfigurationList; buildConfigurations = ( BBFFF4101DE1083A00398350 /* Debug */, BBFFF4111DE1083A00398350 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = BBFFF3FA1DE1083900398350 /* Project object */; } ================================================ FILE: Refactorator.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: canviz-0.1/LICENSE.txt ================================================ MIT-style software license for Canviz library Copyright (c) 2006-2009 Ryan Schmidt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: canviz-0.1/README.txt ================================================ CANVIZ ====== Introduction ------------ Canviz is a library for drawing Graphviz graphs to a web browser canvas. It is designed to be used by web applications that need to display or edit graphs, as a replacement for sending graphs as bitmapped images and image maps. For more information, please visit the Canviz web site at http://canviz.org/ . License ------- Canviz is provided under the terms of the MIT license. See the file LICENSE.txt. This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/). Use of the ColorBrewer color schemes is subject to a separate license. See the file LICENSE-ColorBrewer.txt. Canviz requires the use of some other software, including the Path, Prototype and Excanvas libraries, and the Graphviz software, which have licenses of their own. ================================================ FILE: canviz-0.1/canviz.css ================================================ /* * This file is part of Canviz. See http://www.canviz.org/ * $Id: canviz.css 246 2008-12-27 08:36:24Z ryandesign.com $ */ body { /* background: #eee; */ font: 10pt Arial; margin: 0; padding: 0; } #busy { position: fixed; z-index: 1; left: 50%; top: 50%; width: 10em; height: 2em; margin: -1em 0 0 -5em; line-height: 2em; text-align: center; background: #333; color: #fff; opacity: 0.95; } #graph_form { position: fixed; z-index: 2; left: 0; top: 0; background: #eee; border: solid #ccc; border-width: 0 1px 1px 0; opacity: 0.95; } #graph_form, #graph_form input, #graph_form select { font: 12px "Lucida Grande", Arial, Helvetica, sans-serif; } #graph_form fieldset { margin: 0.5em; padding: 0.5em 0; text-align: center; border: solid #ccc; border-width: 1px 0 0 0; } #graph_form legend { padding: 0 0.5em 0 0; } #graph_form input.little_button { width: 3em; } #graph_form select, #graph_form input.big_button { width: 15em; } #graph_container { background: #fff; margin: 0 auto; } #debug_output { margin: 1em; } ================================================ FILE: canviz-0.1/canviz.js ================================================ /* * This file is part of Canviz. See http://www.canviz.org/ * $Id: canviz.js 265 2009-05-19 13:35:13Z ryandesign.com $ */ var CanvizTokenizer = Class.create({ initialize: function(str) { this.str = str; }, takeChars: function(num) { if (!num) { num = 1; } var tokens = new Array(); while (num--) { var matches = this.str.match(/^(\S+)\s*/); if (matches) { this.str = this.str.substr(matches[0].length); tokens.push(matches[1]); } else { tokens.push(false); } } if (1 == tokens.length) { return tokens[0]; } else { return tokens; } }, takeNumber: function(num) { if (!num) { num = 1; } if (1 == num) { return Number(this.takeChars()); } else { var tokens = this.takeChars(num); while (num--) { tokens[num] = Number(tokens[num]); } return tokens; } }, takeString: function() { var byteCount = Number(this.takeChars()), charCount = 0, charCode; if ('-' != this.str.charAt(0)) { return false; } while (0 < byteCount) { ++charCount; charCode = this.str.charCodeAt(charCount); if (0x80 > charCode) { --byteCount; } else if (0x800 > charCode) { byteCount -= 2; } else { byteCount -= 3; } } var str = this.str.substr(1, charCount); this.str = this.str.substr(1 + charCount).replace(/^\s+/, ''); return str; } }); var edgePaths = {}; var edgeHeads = {}; var CanvizEntity = Class.create({ initialize: function(defaultAttrHashName, name, canviz, rootGraph, parentGraph, immediateGraph) { this.defaultAttrHashName = defaultAttrHashName; this.name = name; this.canviz = canviz; this.rootGraph = rootGraph; this.parentGraph = parentGraph; this.immediateGraph = immediateGraph; this.attrs = $H(); this.drawAttrs = $H(); }, initBB: function() { var matches = this.getAttr('pos').match(/([0-9.]+),([0-9.]+)/); var x = Math.round(matches[1]); var y = Math.round(this.canviz.height - matches[2]); this.bbRect = new Rect(x, y, x, y); }, getAttr: function(attrName, escString) { if (Object.isUndefined(escString)) escString = false; var attrValue = this.attrs.get(attrName); if (Object.isUndefined(attrValue)) { var graph = this.parentGraph; while (!Object.isUndefined(graph)) { attrValue = graph[this.defaultAttrHashName].get(attrName); if (Object.isUndefined(attrValue)) { graph = graph.parentGraph; } else { break; } } } if (attrValue && escString) { attrValue = attrValue.replace(this.escStringMatchRe, function(match, p1) { switch (p1) { case 'N': // fall through case 'E': return this.name; case 'T': return this.tailNode; case 'H': return this.headNode; case 'G': return this.immediateGraph.name; case 'L': return this.getAttr('label', true); } return match; }.bind(this)); } return attrValue; }, draw: function(ctx, ctxScale, redrawCanvasOnly) { var i, tokens, fillColor, strokeColor; if (!redrawCanvasOnly) { this.initBB(); var bbDiv = new Element('div'); this.canviz.elements.appendChild(bbDiv); } this.drawAttrs.each(function(drawAttr) { var command = drawAttr.value; // debug(command); var tokenizer = new CanvizTokenizer(command); var token = tokenizer.takeChars(); if (token) { var dashStyle = 'solid'; ctx.save(); while (token) { // debug('processing token ' + token); switch (token) { case 'E': // filled ellipse case 'e': // unfilled ellipse var filled = ('E' == token); var cx = tokenizer.takeNumber(); var cy = this.canviz.height - tokenizer.takeNumber(); var rx = tokenizer.takeNumber(); var ry = tokenizer.takeNumber(); var path = new Ellipse(cx, cy, rx, ry); break; case 'P': // filled polygon case 'p': // unfilled polygon case 'L': // polyline var filled = ('P' == token); var closed = ('L' != token); var numPoints = tokenizer.takeNumber(); tokens = tokenizer.takeNumber(2 * numPoints); // points var path = new Path(); for (i = 2; i < 2 * numPoints; i += 2) { path.addBezier([ new Point(tokens[i - 2], this.canviz.height - tokens[i - 1]), new Point(tokens[i], this.canviz.height - tokens[i + 1]) ]); } if (closed) { path.addBezier([ new Point(tokens[2 * numPoints - 2], this.canviz.height - tokens[2 * numPoints - 1]), new Point(tokens[0], this.canviz.height - tokens[1]) ]); } break; case 'B': // unfilled b-spline case 'b': // filled b-spline var filled = ('b' == token); var numPoints = tokenizer.takeNumber(); tokens = tokenizer.takeNumber(2 * numPoints); // points var path = new Path(); for (i = 2; i < 2 * numPoints; i += 6) { path.addBezier([ new Point(tokens[i - 2], this.canviz.height - tokens[i - 1]), new Point(tokens[i], this.canviz.height - tokens[i + 1]), new Point(tokens[i + 2], this.canviz.height - tokens[i + 3]), new Point(tokens[i + 4], this.canviz.height - tokens[i + 5]) ]); } break; case 'I': // image var l = tokenizer.takeNumber(); var b = this.canviz.height - tokenizer.takeNumber(); var w = tokenizer.takeNumber(); var h = tokenizer.takeNumber(); var src = tokenizer.takeString(); if (!this.canviz.images[src]) { this.canviz.images[src] = new CanvizImage(this.canviz, src); } this.canviz.images[src].draw(ctx, l, b - h, w, h); break; case 'T': // text var l = Math.round(ctxScale * tokenizer.takeNumber() + this.canviz.padding); var t = Math.round(ctxScale * this.canviz.height + 2 * this.canviz.padding - (ctxScale * (tokenizer.takeNumber() + this.canviz.bbScale * fontSize) + this.canviz.padding)); var textAlign = tokenizer.takeNumber(); var textWidth = Math.round(ctxScale * tokenizer.takeNumber()); var str = tokenizer.takeString(); if (!redrawCanvasOnly && !/^\s*$/.test(str)) { // debug('draw text ' + str + ' ' + l + ' ' + t + ' ' + textAlign + ' ' + textWidth); str = str.escapeHTML(); do { matches = str.match(/ ( +)/); if (matches) { var spaces = ' '; matches[1].length.times(function() { spaces += ' '; }); str = str.replace(/ +/, spaces); } } while (matches); var text; var href = this.getAttr('URL', true) || this.getAttr('href', true); if (href) { var target = this.getAttr('target', true) || '_self'; var tooltip = this.getAttr('tooltip', true) || this.getAttr('label', true); // debug(this.name + ', href ' + href + ', target ' + target + ', tooltip ' + tooltip); text = new Element('a', {href: href, target: target, title: tooltip}); // modified here to pass through an ID for the element ['id', 'onclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout'].each(function(attrName) { var attrValue = this.getAttr(attrName, true); if (attrValue) { text.writeAttribute(attrName, attrValue); } }.bind(this)); text.setStyle({ textDecoration: 'none' }); } else { text = new Element('span'); } text.update(str); text.setStyle({ fontSize: Math.round(fontSize * ctxScale * this.canviz.bbScale) + 'px', fontFamily: fontFamily, color: strokeColor.textColor, position: 'absolute', textAlign: (-1 == textAlign) ? 'left' : (1 == textAlign) ? 'right' : 'center', left: (l - (1 + textAlign) * textWidth) + 'px', top: t + 'px', width: (2 * textWidth) + 'px' }); if (1 != strokeColor.opacity) text.setOpacity(strokeColor.opacity); this.canviz.elements.appendChild(text); } break; case 'C': // set fill color case 'c': // set pen color var fill = ('C' == token); var color = this.parseColor(tokenizer.takeString()); if (fill) { fillColor = color; ctx.fillStyle = color.canvasColor; } else { strokeColor = color; ctx.strokeStyle = color.canvasColor; } break; case 'F': // set font fontSize = tokenizer.takeNumber(); fontFamily = tokenizer.takeString(); switch (fontFamily) { case 'Times-Roman': fontFamily = 'Times New Roman'; break; case 'Courier': fontFamily = 'Courier New'; break; case 'Helvetica': fontFamily = 'Arial'; break; default: // nothing } // debug('set font ' + fontSize + 'pt ' + fontFamily); break; case 'S': // set style var style = tokenizer.takeString(); switch (style) { case 'solid': case 'filled': // nothing break; case 'dashed': case 'dotted': dashStyle = style; break; case 'bold': ctx.lineWidth = 2; break; default: matches = style.match(/^setlinewidth\((.*)\)$/); if (matches) { ctx.lineWidth = Number(matches[1]); } else { debug('unknown style ' + style); } } break; default: debug('unknown token ' + token); return; } if (path) { this.canviz.drawPath(ctx, path, filled, dashStyle); if (!redrawCanvasOnly) this.bbRect.expandToInclude(path.getBB()); // store edge paths so they can be redrawn if ( drawAttr.key == '_draw_' ) edgePaths[this.getAttr("eid")] = path; if ( drawAttr.key == '_hdraw_' ) edgeHeads[this.getAttr("eid")] = path; path = undefined; } token = tokenizer.takeChars(); } if (!redrawCanvasOnly) { bbDiv.setStyle({ position: 'absolute', left: Math.round(ctxScale * this.bbRect.l + this.canviz.padding) + 'px', top: Math.round(ctxScale * this.bbRect.t + this.canviz.padding) + 'px', width: Math.round(ctxScale * this.bbRect.getWidth()) + 'px', height: Math.round(ctxScale * this.bbRect.getHeight()) + 'px' }); } ctx.restore(); } }.bind(this)); }, parseColor: function(color) { var parsedColor = {opacity: 1}; // rgb/rgba if (/^#(?:[0-9a-f]{2}\s*){3,4}$/i.test(color)) { return this.canviz.parseHexColor(color); } // hsv var matches = color.match(/^(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)$/); if (matches) { parsedColor.canvasColor = parsedColor.textColor = this.canviz.hsvToRgbColor(matches[1], matches[2], matches[3]); return parsedColor; } // named color var colorScheme = this.getAttr('colorscheme') || 'X11'; var colorName = color; matches = color.match(/^\/(.*)\/(.*)$/); if (matches) { if (matches[1]) { colorScheme = matches[1]; } colorName = matches[2]; } else { matches = color.match(/^\/(.*)$/); if (matches) { colorScheme = 'X11'; colorName = matches[1]; } } colorName = colorName.toLowerCase(); var colorSchemeName = colorScheme.toLowerCase(); var colorSchemeData = Canviz.prototype.colors.get(colorSchemeName); if (colorSchemeData) { var colorData = colorSchemeData[colorName]; if (colorData) { return this.canviz.parseHexColor('#' + colorData); } } colorData = Canviz.prototype.colors.get('fallback')[colorName]; if (colorData) { return this.canviz.parseHexColor('#' + colorData); } if (!colorSchemeData) { debug('unknown color scheme ' + colorScheme); } // unknown debug('unknown color ' + color + '; color scheme is ' + colorScheme); parsedColor.canvasColor = parsedColor.textColor = '#000000'; return parsedColor; } }); var CanvizNode = Class.create(CanvizEntity, { initialize: function($super, name, canviz, rootGraph, parentGraph) { $super('nodeAttrs', name, canviz, rootGraph, parentGraph, parentGraph); } }); Object.extend(CanvizNode.prototype, { escStringMatchRe: /\\([NGL])/g }); var CanvizEdge = Class.create(CanvizEntity, { initialize: function($super, name, canviz, rootGraph, parentGraph, tailNode, headNode) { $super('edgeAttrs', name, canviz, rootGraph, parentGraph, parentGraph); this.tailNode = tailNode; this.headNode = headNode; } }); Object.extend(CanvizEdge.prototype, { escStringMatchRe: /\\([EGTHL])/g }); var CanvizGraph = Class.create(CanvizEntity, { initialize: function($super, name, canviz, rootGraph, parentGraph) { $super('attrs', name, canviz, rootGraph, parentGraph, this); this.nodeAttrs = $H(); this.edgeAttrs = $H(); this.nodes = $A(); this.edges = $A(); this.subgraphs = $A(); }, initBB: function() { var coords = this.getAttr('bb').split(','); this.bbRect = new Rect(coords[0], this.canviz.height - coords[1], coords[2], this.canviz.height - coords[3]); }, draw: function($super, ctx, ctxScale, redrawCanvasOnly) { $super(ctx, ctxScale, redrawCanvasOnly); // modifed, was: // [this.subgraphs, this.nodes, this.edges].each(function(type) { [this.subgraphs, this.edges, this.nodes].each(function(type) { type.each(function(entity) { entity.draw(ctx, ctxScale, redrawCanvasOnly); }); }); } }); Object.extend(CanvizGraph.prototype, { escStringMatchRe: /\\([GL])/g }); var Canviz = Class.create({ maxXdotVersion: '1.2', colors: $H({ fallback:{ black:'000000', lightgrey:'d3d3d3', white:'ffffff' } }), initialize: function(container, url, urlParams) { // excanvas can't init the element if we use new Element() this.canvas = document.createElement('canvas'); Element.setStyle(this.canvas, { position: 'absolute' }); if (!Canviz.canvasCounter) Canviz.canvasCounter = 0; this.canvas.id = 'canviz_canvas_' + ++Canviz.canvasCounter; this.elements = new Element('div'); this.elements.setStyle({ position: 'absolute' }); this.container = $(container); this.container.setStyle({ position: 'relative' }); this.container.appendChild(this.canvas); if (Prototype.Browser.IE) { G_vmlCanvasManager.initElement(this.canvas); this.canvas = $(this.canvas.id); } this.container.appendChild(this.elements); this.ctx = this.canvas.getContext('2d'); this.scale = 1; this.padding = 8; this.dashLength = 6; this.dotSpacing = 4; this.graphs = $A(); this.images = new Hash(); this.numImages = 0; this.numImagesFinished = 0; if (url) { this.load(url, urlParams); } }, setScale: function(scale) { this.scale = scale; }, setImagePath: function(imagePath) { this.imagePath = imagePath; }, load: function(url, urlParams) { $('debug_output').innerHTML = ''; new Ajax.Request(url, { method: 'get', parameters: urlParams, onComplete: function(response) { this.parse(response.responseText); }.bind(this) }); }, parse: function(xdot) { this.graphs = $A(); this.width = 0; this.height = 0; this.maxWidth = false; this.maxHeight = false; this.bbEnlarge = false; this.bbScale = 1; this.dpi = 96; this.bgcolor = {opacity: 1}; this.bgcolor.canvasColor = this.bgcolor.textColor = '#ffffff'; var lines = xdot.split(/\r?\n/); var i = 0; var line, lastChar, matches, rootGraph, isGraph, entity, entityName, attrs, attrName, attrValue, attrHash, drawAttrHash; var containers = $A(); while (i < lines.length) { line = lines[i++].replace(/^\s+/, ''); if ('' != line && '#' != line.substr(0, 1)) { while (i < lines.length && ';' != (lastChar = line.substr(line.length - 1, line.length)) && '{' != lastChar && '}' != lastChar) { if ('\\' == lastChar) { line = line.substr(0, line.length - 1); } line += lines[i++]; } // debug(line); if (0 == containers.length) { matches = line.match(this.graphMatchRe); if (matches) { rootGraph = new CanvizGraph(matches[3], this); containers.unshift(rootGraph); containers[0].strict = !Object.isUndefined(matches[1]); containers[0].type = ('graph' == matches[2]) ? 'undirected' : 'directed'; containers[0].attrs.set('xdotversion', '1.0'); this.graphs.push(containers[0]); // debug('graph: ' + containers[0].name); } } else { matches = line.match(this.subgraphMatchRe); if (matches) { containers.unshift(new CanvizGraph(matches[1], this, rootGraph, containers[0])); containers[1].subgraphs.push(containers[0]); // debug('subgraph: ' + containers[0].name); } } if (matches) { // debug('begin container ' + containers[0].name); } else if ('}' == line) { // debug('end container ' + containers[0].name); containers.shift(); if (0 == containers.length) { break; } } else { matches = line.match(this.nodeMatchRe); if (matches) { entityName = matches[2]; attrs = matches[5]; drawAttrHash = containers[0].drawAttrs; isGraph = false; switch (entityName) { case 'graph': attrHash = containers[0].attrs; isGraph = true; break; case 'node': attrHash = containers[0].nodeAttrs; break; case 'edge': attrHash = containers[0].edgeAttrs; break; default: entity = new CanvizNode(entityName, this, rootGraph, containers[0]); attrHash = entity.attrs; drawAttrHash = entity.drawAttrs; containers[0].nodes.push(entity); } // debug('node: ' + entityName); } else { matches = line.match(this.edgeMatchRe); if (matches) { entityName = matches[1]; attrs = matches[8]; entity = new CanvizEdge(entityName, this, rootGraph, containers[0], matches[2], matches[5]); attrHash = entity.attrs; drawAttrHash = entity.drawAttrs; containers[0].edges.push(entity); // debug('edge: ' + entityName); } } if (matches) { do { if (0 == attrs.length) { break; } matches = attrs.match(this.attrMatchRe); if (matches) { attrs = attrs.substr(matches[0].length); attrName = matches[1]; attrValue = this.unescape(matches[2]); if (/^_.*draw_$/.test(attrName)) { drawAttrHash.set(attrName, attrValue); } else { attrHash.set(attrName, attrValue); } // debug(attrName + ' ' + attrValue); if (isGraph && 1 == containers.length) { switch (attrName) { case 'bb': var bb = attrValue.split(/,/); this.width = Number(bb[2]); this.height = Number(bb[3]); break; case 'bgcolor': this.bgcolor = rootGraph.parseColor(attrValue); break; case 'dpi': this.dpi = attrValue; break; case 'size': var size = attrValue.match(/^(\d+|\d*(?:\.\d+)),\s*(\d+|\d*(?:\.\d+))(!?)$/); if (size) { this.maxWidth = 72 * Number(size[1]); this.maxHeight = 72 * Number(size[2]); this.bbEnlarge = ('!' == size[3]); } else { debug('can\'t parse size'); } break; case 'xdotversion': if (0 > this.versionCompare(this.maxXdotVersion, attrHash.get('xdotversion'))) { debug('unsupported xdotversion ' + attrHash.get('xdotversion') + '; this script currently supports up to xdotversion ' + this.maxXdotVersion); } break; } } } else { debug('can\'t read attributes for entity ' + entityName + ' from ' + attrs); } } while (matches); } } } } /* if (this.maxWidth && this.maxHeight) { if (this.width > this.maxWidth || this.height > this.maxHeight || this.bbEnlarge) { this.bbScale = Math.min(this.maxWidth / this.width, this.maxHeight / this.height); this.width = Math.round(this.width * this.bbScale); this.height = Math.round(this.height * this.bbScale); } } */ // debug('done'); this.draw(); }, draw: function(redrawCanvasOnly) { if (Object.isUndefined(redrawCanvasOnly)) redrawCanvasOnly = false; var ctxScale = this.scale * this.dpi / 72; var width = Math.round(ctxScale * this.width + 2 * this.padding); var height = Math.round(ctxScale * this.height + 2 * this.padding); if (!redrawCanvasOnly) { this.canvas.width = width; this.canvas.height = height; this.canvas.setStyle({ width: width + 'px', height: height + 'px' }); this.container.setStyle({ width: width + 'px' }); while (this.elements.firstChild) { this.elements.removeChild(this.elements.firstChild); } } this.ctx.save(); this.ctx.lineCap = 'round'; this.ctx.fillStyle = this.bgcolor.canvasColor; this.ctx.fillRect(0, 0, width, height); this.ctx.translate(this.padding, this.padding); this.ctx.scale(ctxScale, ctxScale); this.graphs[0].draw(this.ctx, ctxScale, redrawCanvasOnly); this.ctx.restore(); }, drawPath: function(ctx, path, filled, dashStyle) { if (filled) { ctx.beginPath(); path.makePath(ctx); ctx.fill(); } if (ctx.fillStyle != ctx.strokeStyle || !filled) { switch (dashStyle) { case 'dashed': ctx.beginPath(); path.makeDashedPath(ctx, this.dashLength); break; case 'dotted': var oldLineWidth = ctx.lineWidth; ctx.lineWidth *= 2; ctx.beginPath(); path.makeDottedPath(ctx, this.dotSpacing); break; case 'solid': default: if (!filled) { ctx.beginPath(); path.makePath(ctx); } } ctx.stroke(); if (oldLineWidth) ctx.lineWidth = oldLineWidth; } }, unescape: function(str) { var matches = str.match(/^"(.*)"$/); if (matches) { return matches[1].replace(/\\"/g, '"'); } else { return str; } }, parseHexColor: function(color) { var matches = color.match(/^#([0-9a-f]{2})\s*([0-9a-f]{2})\s*([0-9a-f]{2})\s*([0-9a-f]{2})?$/i); if (matches) { var canvasColor, textColor = '#' + matches[1] + matches[2] + matches[3], opacity = 1; if (matches[4]) { // rgba opacity = parseInt(matches[4], 16) / 255; canvasColor = 'rgba(' + parseInt(matches[1], 16) + ',' + parseInt(matches[2], 16) + ',' + parseInt(matches[3], 16) + ',' + opacity + ')'; } else { // rgb canvasColor = textColor; } } return {canvasColor: canvasColor, textColor: textColor, opacity: opacity}; }, hsvToRgbColor: function(h, s, v) { var i, f, p, q, t, r, g, b; h *= 360; i = Math.floor(h / 60) % 6; f = h / 60 - i; p = v * (1 - s); q = v * (1 - f * s); t = v * (1 - (1 - f) * s); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; case 5: r = v; g = p; b = q; break; } return 'rgb(' + Math.round(255 * r) + ',' + Math.round(255 * g) + ',' + Math.round(255 * b) + ')'; }, versionCompare: function(a, b) { a = a.split('.'); b = b.split('.'); var a1, b1; while (a.length || b.length) { a1 = a.length ? a.shift() : 0; b1 = b.length ? b.shift() : 0; if (a1 < b1) return -1; if (a1 > b1) return 1; } return 0; }, // an alphanumeric string or a number or a double-quoted string or an HTML string idMatch: '([a-zA-Z\u0080-\uFFFF_][0-9a-zA-Z\u0080-\uFFFF_]*|-?(?:\\.\\d+|\\d+(?:\\.\\d*)?)|"(?:\\\\"|[^"])*"|<(?:<[^>]*>|[^<>]+?)+>)' }); Object.extend(Canviz.prototype, { // ID or ID:port or ID:compassPoint or ID:port:compassPoint nodeIdMatch: Canviz.prototype.idMatch + '(?::' + Canviz.prototype.idMatch + ')?(?::' + Canviz.prototype.idMatch + ')?' }); Object.extend(Canviz.prototype, { graphMatchRe: new RegExp('^(strict\\s+)?(graph|digraph)(?:\\s+' + Canviz.prototype.idMatch + ')?\\s*{$', 'i'), subgraphMatchRe: new RegExp('^(?:subgraph\\s+)?' + Canviz.prototype.idMatch + '?\\s*{$', 'i'), nodeMatchRe: new RegExp('^(' + Canviz.prototype.nodeIdMatch + ')\\s+\\[(.+)\\];$'), edgeMatchRe: new RegExp('^(' + Canviz.prototype.nodeIdMatch + '\\s*-[->]\\s*' + Canviz.prototype.nodeIdMatch + ')\\s+\\[(.+)\\];$'), attrMatchRe: new RegExp('^' + Canviz.prototype.idMatch + '=' + Canviz.prototype.idMatch + '(?:[,\\s]+|$)') }); var CanvizImage = Class.create({ initialize: function(canviz, src) { this.canviz = canviz; ++this.canviz.numImages; this.finished = this.loaded = false; this.img = new Image(); this.img.onload = this.onLoad.bind(this); this.img.onerror = this.onFinish.bind(this); this.img.onabort = this.onFinish.bind(this); this.img.src = this.canviz.imagePath + src; }, onLoad: function() { this.loaded = true; this.onFinish(); }, onFinish: function() { this.finished = true; ++this.canviz.numImagesFinished; if (this.canviz.numImages == this.canviz.numImagesFinished) { this.canviz.draw(true); } }, draw: function(ctx, l, t, w, h) { if (this.finished) { if (this.loaded) { ctx.drawImage(this.img, l, t, w, h); } else { debug('can\'t load image ' + this.img.src); this.drawBrokenImage(ctx, l, t, w, h); } } }, drawBrokenImage: function(ctx, l, t, w, h) { ctx.save(); ctx.beginPath(); new Rect(l, t, l + w, t + w).draw(ctx); ctx.moveTo(l, t); ctx.lineTo(l + w, t + w); ctx.moveTo(l + w, t); ctx.lineTo(l, t + h); ctx.strokeStyle = '#f00'; ctx.lineWidth = 1; ctx.stroke(); ctx.restore(); } }); function debug(str, escape) { str = String(str); if (Object.isUndefined(escape)) { escape = true; } if (escape) { str = str.escapeHTML(); } $('debug_output').innerHTML += '»' + str + '«
'; } ================================================ FILE: canviz-0.1/path/path.js ================================================ // $Id: path.js 262 2009-05-19 11:55:24Z ryandesign.com $ var Point = Class.create({ initialize: function(x, y) { this.x = x; this.y = y; }, offset: function(dx, dy) { this.x += dx; this.y += dy; }, distanceFrom: function(point) { var dx = this.x - point.x; var dy = this.y - point.y; return Math.sqrt(dx * dx + dy * dy); }, makePath: function(ctx) { ctx.moveTo(this.x, this.y); ctx.lineTo(this.x + 0.001, this.y); } }); var Bezier = Class.create({ initialize: function(points) { this.points = points; this.order = points.length; }, reset: function() { with (Bezier.prototype) { this.controlPolygonLength = controlPolygonLength; this.chordLength = chordLength; this.triangle = triangle; this.chordPoints = chordPoints; this.coefficients = coefficients; } }, offset: function(dx, dy) { this.points.each(function(point) { point.offset(dx, dy); }); this.reset(); }, getBB: function() { if (!this.order) return undefined; var l, t, r, b, p = this.points[0]; l = r = p.x; t = b = p.y; this.points.each(function(point) { l = Math.min(l, point.x); t = Math.min(t, point.y); r = Math.max(r, point.x); b = Math.max(b, point.y); }); var rect = new Rect(l, t, r, b); return (this.getBB = function() {return rect;})(); }, isPointInBB: function(x, y, tolerance) { if (Object.isUndefined(tolerance)) tolerance = 0; var bb = this.getBB(); if (0 < tolerance) { bb = Object.clone(bb); bb.inset(-tolerance, -tolerance); } return !(x < bb.l || x > bb.r || y < bb.t || y > bb.b); }, isPointOnBezier: function(x, y, tolerance) { if (Object.isUndefined(tolerance)) tolerance = 0; if (!this.isPointInBB(x, y, tolerance)) return false; var segments = this.chordPoints(); var p1 = segments[0].p; var p2, x1, y1, x2, y2, bb, twice_area, base, height; for (var i = 1; i < segments.length; ++i) { p2 = segments[i].p; x1 = p1.x; y1 = p1.y; x2 = p2.x; y2 = p2.y; bb = new Rect(x1, y1, x2, y2); if (bb.isPointInBB(x, y, tolerance)) { twice_area = Math.abs(x1 * y2 + x2 * y + x * y1 - x2 * y1 - x * y2 - x1 * y); base = p1.distanceFrom(p2); height = twice_area / base; if (height <= tolerance) return true; } p1 = p2; } return false; }, // Based on Oliver Steele's bezier.js library. controlPolygonLength: function() { var len = 0; for (var i = 1; i < this.order; ++i) { len += this.points[i - 1].distanceFrom(this.points[i]); } return (this.controlPolygonLength = function() {return len;})(); }, // Based on Oliver Steele's bezier.js library. chordLength: function() { var len = this.points[0].distanceFrom(this.points[this.order - 1]); return (this.chordLength = function() {return len;})(); }, // From Oliver Steele's bezier.js library. triangle: function() { var upper = this.points; var m = [upper]; for (var i = 1; i < this.order; ++i) { var lower = []; for (var j = 0; j < this.order - i; ++j) { var c0 = upper[j]; var c1 = upper[j + 1]; lower[j] = new Point((c0.x + c1.x) / 2, (c0.y + c1.y) / 2); } m.push(lower); upper = lower; } return (this.triangle = function() {return m;})(); }, // Based on Oliver Steele's bezier.js library. triangleAtT: function(t) { var s = 1 - t; var upper = this.points; var m = [upper]; for (var i = 1; i < this.order; ++i) { var lower = []; for (var j = 0; j < this.order - i; ++j) { var c0 = upper[j]; var c1 = upper[j + 1]; lower[j] = new Point(c0.x * s + c1.x * t, c0.y * s + c1.y * t); } m.push(lower); upper = lower; } return m; }, // Returns two beziers resulting from splitting this bezier at t=0.5. // Based on Oliver Steele's bezier.js library. split: function(t) { if ('undefined' == typeof t) t = 0.5; var m = (0.5 == t) ? this.triangle() : this.triangleAtT(t); var leftPoints = new Array(this.order); var rightPoints = new Array(this.order); for (var i = 0; i < this.order; ++i) { leftPoints[i] = m[i][0]; rightPoints[i] = m[this.order - 1 - i][i]; } return {left: new Bezier(leftPoints), right: new Bezier(rightPoints)}; }, // Returns a bezier which is the portion of this bezier from t1 to t2. // Thanks to Peter Zin on comp.graphics.algorithms. mid: function(t1, t2) { return this.split(t2).left.split(t1 / t2).right; }, // Returns points (and their corresponding times in the bezier) that form // an approximate polygonal representation of the bezier. // Based on the algorithm described in Jeremy Gibbons' dashed.ps.gz chordPoints: function() { var p = [{tStart: 0, tEnd: 0, dt: 0, p: this.points[0]}].concat(this._chordPoints(0, 1)); return (this.chordPoints = function() {return p;})(); }, _chordPoints: function(tStart, tEnd) { var tolerance = 0.001; var dt = tEnd - tStart; if (this.controlPolygonLength() <= (1 + tolerance) * this.chordLength()) { return [{tStart: tStart, tEnd: tEnd, dt: dt, p: this.points[this.order - 1]}]; } else { var tMid = tStart + dt / 2; var halves = this.split(); return halves.left._chordPoints(tStart, tMid).concat(halves.right._chordPoints(tMid, tEnd)); } }, // Returns an array of times between 0 and 1 that mark the bezier evenly // in space. // Based in part on the algorithm described in Jeremy Gibbons' dashed.ps.gz markedEvery: function(distance, firstDistance) { var nextDistance = firstDistance || distance; var segments = this.chordPoints(); var times = []; var t = 0; // time var dt; // delta t var segment; var remainingDistance; for (var i = 1; i < segments.length; ++i) { segment = segments[i]; segment.length = segment.p.distanceFrom(segments[i - 1].p); if (0 == segment.length) { t += segment.dt; } else { dt = nextDistance / segment.length * segment.dt; segment.remainingLength = segment.length; while (segment.remainingLength >= nextDistance) { segment.remainingLength -= nextDistance; t += dt; times.push(t); if (distance != nextDistance) { nextDistance = distance; dt = nextDistance / segment.length * segment.dt; } } nextDistance -= segment.remainingLength; t = segment.tEnd; } } return {times: times, nextDistance: nextDistance}; }, // Return the coefficients of the polynomials for x and y in t. // From Oliver Steele's bezier.js library. coefficients: function() { // This function deals with polynomials, represented as // arrays of coefficients. p[i] is the coefficient of n^i. // p0, p1 => p0 + (p1 - p0) * n // side-effects (denormalizes) p0, for convienence function interpolate(p0, p1) { p0.push(0); var p = new Array(p0.length); p[0] = p0[0]; for (var i = 0; i < p1.length; ++i) { p[i + 1] = p0[i + 1] + p1[i] - p0[i]; } return p; } // folds +interpolate+ across a graph whose fringe is // the polynomial elements of +ns+, and returns its TOP function collapse(ns) { while (ns.length > 1) { var ps = new Array(ns.length-1); for (var i = 0; i < ns.length - 1; ++i) { ps[i] = interpolate(ns[i], ns[i + 1]); } ns = ps; } return ns[0]; } // xps and yps are arrays of polynomials --- concretely realized // as arrays of arrays var xps = []; var yps = []; for (var i = 0, pt; pt = this.points[i++]; ) { xps.push([pt.x]); yps.push([pt.y]); } var result = {xs: collapse(xps), ys: collapse(yps)}; return (this.coefficients = function() {return result;})(); }, // Return the point at time t. // From Oliver Steele's bezier.js library. pointAtT: function(t) { var c = this.coefficients(); var cx = c.xs, cy = c.ys; // evaluate cx[0] + cx[1]t +cx[2]t^2 .... // optimization: start from the end, to save one // muliplicate per order (we never need an explicit t^n) // optimization: special-case the last element // to save a multiply-add var x = cx[cx.length - 1], y = cy[cy.length - 1]; for (var i = cx.length - 1; --i >= 0; ) { x = x * t + cx[i]; y = y * t + cy[i]; } return new Point(x, y); }, // Render the Bezier to a WHATWG 2D canvas context. // Based on Oliver Steele's bezier.js library. makePath: function (ctx, moveTo) { if ('undefined' == typeof moveTo) moveTo = true; if (moveTo) ctx.moveTo(this.points[0].x, this.points[0].y); var fn = this.pathCommands[this.order]; if (fn) { var coords = []; for (var i = 1 == this.order ? 0 : 1; i < this.points.length; ++i) { coords.push(this.points[i].x); coords.push(this.points[i].y); } fn.apply(ctx, coords); } }, // Wrapper functions to work around Safari, in which, up to at least 2.0.3, // fn.apply isn't defined on the context primitives. // Based on Oliver Steele's bezier.js library. pathCommands: [ null, // This will have an effect if there's a line thickness or end cap. function(x, y) { this.lineTo(x + 0.001, y); }, function(x, y) { this.lineTo(x, y); }, function(x1, y1, x2, y2) { this.quadraticCurveTo(x1, y1, x2, y2); }, function(x1, y1, x2, y2, x3, y3) { this.bezierCurveTo(x1, y1, x2, y2, x3, y3); } ], makeDashedPath: function(ctx, dashLength, firstDistance, drawFirst) { if (!firstDistance) firstDistance = dashLength; if ('undefined' == typeof drawFirst) drawFirst = true; var markedEvery = this.markedEvery(dashLength, firstDistance); if (drawFirst) markedEvery.times.unshift(0); var drawLast = (markedEvery.times.length % 2); if (drawLast) markedEvery.times.push(1); for (var i = 1; i < markedEvery.times.length; i += 2) { this.mid(markedEvery.times[i - 1], markedEvery.times[i]).makePath(ctx); } return {firstDistance: markedEvery.nextDistance, drawFirst: drawLast}; }, makeDottedPath: function(ctx, dotSpacing, firstDistance) { if (!firstDistance) firstDistance = dotSpacing; var markedEvery = this.markedEvery(dotSpacing, firstDistance); if (dotSpacing == firstDistance) markedEvery.times.unshift(0); markedEvery.times.each(function(t) { this.pointAtT(t).makePath(ctx); }.bind(this)); return markedEvery.nextDistance; } }); var Path = Class.create({ initialize: function(segments) { this.segments = segments || []; }, setupSegments: function() {}, // Based on Oliver Steele's bezier.js library. addBezier: function(pointsOrBezier) { this.segments.push(pointsOrBezier instanceof Array ? new Bezier(pointsOrBezier) : pointsOrBezier); }, offset: function(dx, dy) { if (0 == this.segments.length) this.setupSegments(); this.segments.each(function(segment) { segment.offset(dx, dy); }); }, getBB: function() { if (0 == this.segments.length) this.setupSegments(); var l, t, r, b, p = this.segments[0].points[0]; l = r = p.x; t = b = p.y; this.segments.each(function(segment) { segment.points.each(function(point) { l = Math.min(l, point.x); t = Math.min(t, point.y); r = Math.max(r, point.x); b = Math.max(b, point.y); }); }); var rect = new Rect(l, t, r, b); return (this.getBB = function() {return rect;})(); }, isPointInBB: function(x, y, tolerance) { if (Object.isUndefined(tolerance)) tolerance = 0; var bb = this.getBB(); if (0 < tolerance) { bb = Object.clone(bb); bb.inset(-tolerance, -tolerance); } return !(x < bb.l || x > bb.r || y < bb.t || y > bb.b); }, isPointOnPath: function(x, y, tolerance) { if (Object.isUndefined(tolerance)) tolerance = 0; if (!this.isPointInBB(x, y, tolerance)) return false; var result = false; this.segments.each(function(segment) { if (segment.isPointOnBezier(x, y, tolerance)) { result = true; throw $break; } }); return result; }, isPointInPath: function(x, y) { return false; }, // Based on Oliver Steele's bezier.js library. makePath: function(ctx) { if (0 == this.segments.length) this.setupSegments(); var moveTo = true; this.segments.each(function(segment) { segment.makePath(ctx, moveTo); moveTo = false; }); }, makeDashedPath: function(ctx, dashLength, firstDistance, drawFirst) { if (0 == this.segments.length) this.setupSegments(); var info = { drawFirst: ('undefined' == typeof drawFirst) ? true : drawFirst, firstDistance: firstDistance || dashLength }; this.segments.each(function(segment) { info = segment.makeDashedPath(ctx, dashLength, info.firstDistance, info.drawFirst); }); }, makeDottedPath: function(ctx, dotSpacing, firstDistance) { if (0 == this.segments.length) this.setupSegments(); if (!firstDistance) firstDistance = dotSpacing; this.segments.each(function(segment) { firstDistance = segment.makeDottedPath(ctx, dotSpacing, firstDistance); }); } }); var Polygon = Class.create(Path, { initialize: function($super, points) { this.points = points || []; $super(); }, setupSegments: function() { this.points.each(function(p, i) { var next = i + 1; if (this.points.length == next) next = 0; this.addBezier([ p, this.points[next] ]); }.bind(this)); } }); var Rect = Class.create(Polygon, { initialize: function($super, l, t, r, b) { this.l = l; this.t = t; this.r = r; this.b = b; $super(); }, inset: function (ix, iy) { this.l += ix; this.t += iy; this.r -= ix; this.b -= iy; return this; }, expandToInclude: function(rect) { this.l = Math.min(this.l, rect.l); this.t = Math.min(this.t, rect.t); this.r = Math.max(this.r, rect.r); this.b = Math.max(this.b, rect.b); }, getWidth: function() { return this.r - this.l; }, getHeight: function() { return this.b - this.t; }, setupSegments: function($super) { var w = this.getWidth(); var h = this.getHeight(); this.points = [ new Point(this.l, this.t), new Point(this.l + w, this.t), new Point(this.l + w, this.t + h), new Point(this.l, this.t + h) ]; $super(); } }); var Ellipse = Class.create(Path, { KAPPA: 0.5522847498, initialize: function($super, cx, cy, rx, ry) { this.cx = cx; // center x this.cy = cy; // center y this.rx = rx; // radius x this.ry = ry; // radius y $super(); }, setupSegments: function() { this.addBezier([ new Point(this.cx, this.cy - this.ry), new Point(this.cx + this.KAPPA * this.rx, this.cy - this.ry), new Point(this.cx + this.rx, this.cy - this.KAPPA * this.ry), new Point(this.cx + this.rx, this.cy) ]); this.addBezier([ new Point(this.cx + this.rx, this.cy), new Point(this.cx + this.rx, this.cy + this.KAPPA * this.ry), new Point(this.cx + this.KAPPA * this.rx, this.cy + this.ry), new Point(this.cx, this.cy + this.ry) ]); this.addBezier([ new Point(this.cx, this.cy + this.ry), new Point(this.cx - this.KAPPA * this.rx, this.cy + this.ry), new Point(this.cx - this.rx, this.cy + this.KAPPA * this.ry), new Point(this.cx - this.rx, this.cy) ]); this.addBezier([ new Point(this.cx - this.rx, this.cy), new Point(this.cx - this.rx, this.cy - this.KAPPA * this.ry), new Point(this.cx - this.KAPPA * this.rx, this.cy - this.ry), new Point(this.cx, this.cy - this.ry) ]); } }); ================================================ FILE: canviz-0.1/prototype/prototype.js ================================================ /* Prototype JavaScript framework, version 1.6.0.3 * (c) 2005-2008 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://www.prototypejs.org/ * *--------------------------------------------------------------------------*/ var Prototype = { Version: '1.6.0.3', Browser: { IE: !!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1), Opera: navigator.userAgent.indexOf('Opera') > -1, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) }, BrowserFeatures: { XPath: !!document.evaluate, SelectorsAPI: !!document.querySelector, ElementExtensions: !!window.HTMLElement, SpecificElementExtensions: document.createElement('div')['__proto__'] && document.createElement('div')['__proto__'] !== document.createElement('form')['__proto__'] }, ScriptFragment: '