diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..82c807c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.pbxproj -crlf -diff -merge +*.xib -crlf -diff -merge diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c2c455 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +project.xcworkspace/ +xcuserdata/ +build/ +*.DS_Store diff --git a/MacOSX/BZEditorOSX/BZEditorOSX.xcodeproj/project.pbxproj b/MacOSX/BZEditorOSX/BZEditorOSX.xcodeproj/project.pbxproj new file mode 100644 index 0000000..12458a4 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX.xcodeproj/project.pbxproj @@ -0,0 +1,388 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 600FA8E11698968E001E7851 /* BZViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 600FA8E01698968E001E7851 /* BZViewController.xib */; }; + 601FAD73166A06F900DAEFF3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 601FAD72166A06F900DAEFF3 /* Cocoa.framework */; }; + 601FAD7D166A06F900DAEFF3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 601FAD7B166A06F900DAEFF3 /* InfoPlist.strings */; }; + 601FAD7F166A06F900DAEFF3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 601FAD7E166A06F900DAEFF3 /* main.m */; }; + 601FAD83166A06F900DAEFF3 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 601FAD81166A06F900DAEFF3 /* Credits.rtf */; }; + 601FAD86166A06FA00DAEFF3 /* Document.m in Sources */ = {isa = PBXBuildFile; fileRef = 601FAD85166A06FA00DAEFF3 /* Document.m */; }; + 601FAD89166A06FA00DAEFF3 /* BZWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 601FAD87166A06FA00DAEFF3 /* BZWindowController.xib */; }; + 601FAD8C166A06FA00DAEFF3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 601FAD8A166A06FA00DAEFF3 /* MainMenu.xib */; }; + 6021F74B1696C53900DA2B79 /* BZWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 6021F74A1696C53900DA2B79 /* BZWindow.m */; }; + 604EE0D6166E77D800D148A0 /* TextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 604EE0D5166E77D800D148A0 /* TextView.m */; }; + 604EE0D9166E780100D148A0 /* BZView.m in Sources */ = {isa = PBXBuildFile; fileRef = 604EE0D8166E780100D148A0 /* BZView.m */; }; + 60561B70169A20B300337094 /* BZViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 60561B6F169A20B300337094 /* BZViewController.m */; }; + 60561B73169B6E2C00337094 /* BZWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 60561B72169B6E2B00337094 /* BZWindowController.m */; }; + 6084EFBD16DB59E200B415AD /* BZBmpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6084EFBB16DB59E200B415AD /* BZBmpViewController.m */; }; + 6084EFBE16DB59E200B415AD /* BZBmpViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6084EFBC16DB59E200B415AD /* BZBmpViewController.xib */; }; + 6084EFC116DB5A1400B415AD /* BZBmpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6084EFC016DB5A1300B415AD /* BZBmpView.m */; }; + 60A43359167C8B970028D4DF /* BZOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 60A43358167C8B970028D4DF /* BZOptions.m */; }; + 60E45BFE16B637F300D0CAB0 /* BZGlobalFunc.m in Sources */ = {isa = PBXBuildFile; fileRef = 60E45BFD16B637F300D0CAB0 /* BZGlobalFunc.m */; }; + 60E45C0216B699FE00D0CAB0 /* BZEbcDic.m in Sources */ = {isa = PBXBuildFile; fileRef = 60E45C0116B699FE00D0CAB0 /* BZEbcDic.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 600FA8E01698968E001E7851 /* BZViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BZViewController.xib; sourceTree = ""; }; + 601FAD6E166A06F900DAEFF3 /* BZEditorOSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BZEditorOSX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 601FAD72166A06F900DAEFF3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 601FAD75166A06F900DAEFF3 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 601FAD76166A06F900DAEFF3 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 601FAD77166A06F900DAEFF3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 601FAD7A166A06F900DAEFF3 /* BZEditorOSX-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BZEditorOSX-Info.plist"; sourceTree = ""; }; + 601FAD7C166A06F900DAEFF3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 601FAD7E166A06F900DAEFF3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 601FAD80166A06F900DAEFF3 /* BZEditorOSX-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BZEditorOSX-Prefix.pch"; sourceTree = ""; }; + 601FAD82166A06F900DAEFF3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; + 601FAD84166A06F900DAEFF3 /* Document.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Document.h; sourceTree = ""; }; + 601FAD85166A06FA00DAEFF3 /* Document.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Document.m; sourceTree = ""; }; + 601FAD88166A06FA00DAEFF3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/BZWindowController.xib; sourceTree = ""; }; + 601FAD8B166A06FA00DAEFF3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; + 6021F7491696C53900DA2B79 /* BZWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZWindow.h; sourceTree = ""; }; + 6021F74A1696C53900DA2B79 /* BZWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZWindow.m; sourceTree = ""; }; + 604EE0D4166E77D800D148A0 /* TextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextView.h; sourceTree = ""; }; + 604EE0D5166E77D800D148A0 /* TextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextView.m; sourceTree = ""; }; + 604EE0D7166E780100D148A0 /* BZView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZView.h; sourceTree = ""; }; + 604EE0D8166E780100D148A0 /* BZView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZView.m; sourceTree = ""; }; + 60561B6E169A20B300337094 /* BZViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZViewController.h; sourceTree = ""; }; + 60561B6F169A20B300337094 /* BZViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZViewController.m; sourceTree = ""; }; + 60561B71169B6E2B00337094 /* BZWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZWindowController.h; sourceTree = ""; }; + 60561B72169B6E2B00337094 /* BZWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZWindowController.m; sourceTree = ""; }; + 6084EFBA16DB59E200B415AD /* BZBmpViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZBmpViewController.h; sourceTree = ""; }; + 6084EFBB16DB59E200B415AD /* BZBmpViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZBmpViewController.m; sourceTree = ""; }; + 6084EFBC16DB59E200B415AD /* BZBmpViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BZBmpViewController.xib; sourceTree = ""; }; + 6084EFBF16DB5A1300B415AD /* BZBmpView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZBmpView.h; sourceTree = ""; }; + 6084EFC016DB5A1300B415AD /* BZBmpView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZBmpView.m; sourceTree = ""; }; + 60A43357167C8B970028D4DF /* BZOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZOptions.h; sourceTree = ""; }; + 60A43358167C8B970028D4DF /* BZOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZOptions.m; sourceTree = ""; }; + 60E45BFC16B637F300D0CAB0 /* BZGlobalFunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZGlobalFunc.h; sourceTree = ""; }; + 60E45BFD16B637F300D0CAB0 /* BZGlobalFunc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZGlobalFunc.m; sourceTree = ""; }; + 60E45C0016B699FE00D0CAB0 /* BZEbcDic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BZEbcDic.h; sourceTree = ""; }; + 60E45C0116B699FE00D0CAB0 /* BZEbcDic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BZEbcDic.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 601FAD6B166A06F900DAEFF3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 601FAD73166A06F900DAEFF3 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 601FAD63166A06F900DAEFF3 = { + isa = PBXGroup; + children = ( + 601FAD78166A06F900DAEFF3 /* BZEditorOSX */, + 601FAD71166A06F900DAEFF3 /* Frameworks */, + 601FAD6F166A06F900DAEFF3 /* Products */, + ); + sourceTree = ""; + }; + 601FAD6F166A06F900DAEFF3 /* Products */ = { + isa = PBXGroup; + children = ( + 601FAD6E166A06F900DAEFF3 /* BZEditorOSX.app */, + ); + name = Products; + sourceTree = ""; + }; + 601FAD71166A06F900DAEFF3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 601FAD72166A06F900DAEFF3 /* Cocoa.framework */, + 601FAD74166A06F900DAEFF3 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 601FAD74166A06F900DAEFF3 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 601FAD75166A06F900DAEFF3 /* AppKit.framework */, + 601FAD76166A06F900DAEFF3 /* CoreData.framework */, + 601FAD77166A06F900DAEFF3 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 601FAD78166A06F900DAEFF3 /* BZEditorOSX */ = { + isa = PBXGroup; + children = ( + 601FAD84166A06F900DAEFF3 /* Document.h */, + 601FAD85166A06FA00DAEFF3 /* Document.m */, + 6021F7491696C53900DA2B79 /* BZWindow.h */, + 6021F74A1696C53900DA2B79 /* BZWindow.m */, + 60561B71169B6E2B00337094 /* BZWindowController.h */, + 60561B72169B6E2B00337094 /* BZWindowController.m */, + 601FAD87166A06FA00DAEFF3 /* BZWindowController.xib */, + 601FAD8A166A06FA00DAEFF3 /* MainMenu.xib */, + 601FAD79166A06F900DAEFF3 /* Supporting Files */, + 604EE0D7166E780100D148A0 /* BZView.h */, + 604EE0D8166E780100D148A0 /* BZView.m */, + 60561B6E169A20B300337094 /* BZViewController.h */, + 60561B6F169A20B300337094 /* BZViewController.m */, + 600FA8E01698968E001E7851 /* BZViewController.xib */, + 604EE0D4166E77D800D148A0 /* TextView.h */, + 604EE0D5166E77D800D148A0 /* TextView.m */, + 60A43357167C8B970028D4DF /* BZOptions.h */, + 60A43358167C8B970028D4DF /* BZOptions.m */, + 60E45BFC16B637F300D0CAB0 /* BZGlobalFunc.h */, + 60E45BFD16B637F300D0CAB0 /* BZGlobalFunc.m */, + 60E45C0016B699FE00D0CAB0 /* BZEbcDic.h */, + 60E45C0116B699FE00D0CAB0 /* BZEbcDic.m */, + 6084EFBA16DB59E200B415AD /* BZBmpViewController.h */, + 6084EFBB16DB59E200B415AD /* BZBmpViewController.m */, + 6084EFBC16DB59E200B415AD /* BZBmpViewController.xib */, + 6084EFBF16DB5A1300B415AD /* BZBmpView.h */, + 6084EFC016DB5A1300B415AD /* BZBmpView.m */, + ); + path = BZEditorOSX; + sourceTree = ""; + }; + 601FAD79166A06F900DAEFF3 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 601FAD7A166A06F900DAEFF3 /* BZEditorOSX-Info.plist */, + 601FAD7B166A06F900DAEFF3 /* InfoPlist.strings */, + 601FAD7E166A06F900DAEFF3 /* main.m */, + 601FAD80166A06F900DAEFF3 /* BZEditorOSX-Prefix.pch */, + 601FAD81166A06F900DAEFF3 /* Credits.rtf */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 601FAD6D166A06F900DAEFF3 /* BZEditorOSX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 601FAD8F166A06FA00DAEFF3 /* Build configuration list for PBXNativeTarget "BZEditorOSX" */; + buildPhases = ( + 601FAD6A166A06F900DAEFF3 /* Sources */, + 601FAD6B166A06F900DAEFF3 /* Frameworks */, + 601FAD6C166A06F900DAEFF3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BZEditorOSX; + productName = BZEditorOSX; + productReference = 601FAD6E166A06F900DAEFF3 /* BZEditorOSX.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 601FAD65166A06F900DAEFF3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = tamachanbinary; + }; + buildConfigurationList = 601FAD68166A06F900DAEFF3 /* Build configuration list for PBXProject "BZEditorOSX" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 601FAD63166A06F900DAEFF3; + productRefGroup = 601FAD6F166A06F900DAEFF3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 601FAD6D166A06F900DAEFF3 /* BZEditorOSX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 601FAD6C166A06F900DAEFF3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 601FAD7D166A06F900DAEFF3 /* InfoPlist.strings in Resources */, + 601FAD83166A06F900DAEFF3 /* Credits.rtf in Resources */, + 601FAD89166A06FA00DAEFF3 /* BZWindowController.xib in Resources */, + 601FAD8C166A06FA00DAEFF3 /* MainMenu.xib in Resources */, + 600FA8E11698968E001E7851 /* BZViewController.xib in Resources */, + 6084EFBE16DB59E200B415AD /* BZBmpViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 601FAD6A166A06F900DAEFF3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 601FAD7F166A06F900DAEFF3 /* main.m in Sources */, + 601FAD86166A06FA00DAEFF3 /* Document.m in Sources */, + 604EE0D6166E77D800D148A0 /* TextView.m in Sources */, + 604EE0D9166E780100D148A0 /* BZView.m in Sources */, + 60A43359167C8B970028D4DF /* BZOptions.m in Sources */, + 6021F74B1696C53900DA2B79 /* BZWindow.m in Sources */, + 60561B70169A20B300337094 /* BZViewController.m in Sources */, + 60561B73169B6E2C00337094 /* BZWindowController.m in Sources */, + 60E45BFE16B637F300D0CAB0 /* BZGlobalFunc.m in Sources */, + 60E45C0216B699FE00D0CAB0 /* BZEbcDic.m in Sources */, + 6084EFBD16DB59E200B415AD /* BZBmpViewController.m in Sources */, + 6084EFC116DB5A1400B415AD /* BZBmpView.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 601FAD7B166A06F900DAEFF3 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 601FAD7C166A06F900DAEFF3 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 601FAD81166A06F900DAEFF3 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 601FAD82166A06F900DAEFF3 /* en */, + ); + name = Credits.rtf; + sourceTree = ""; + }; + 601FAD87166A06FA00DAEFF3 /* BZWindowController.xib */ = { + isa = PBXVariantGroup; + children = ( + 601FAD88166A06FA00DAEFF3 /* en */, + ); + name = BZWindowController.xib; + sourceTree = ""; + }; + 601FAD8A166A06FA00DAEFF3 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 601FAD8B166A06FA00DAEFF3 /* en */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 601FAD8D166A06FA00DAEFF3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; + SDKROOT = macosx10.7; + }; + name = Debug; + }; + 601FAD8E166A06FA00DAEFF3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; + SDKROOT = macosx10.7; + }; + name = Release; + }; + 601FAD90166A06FA00DAEFF3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BZEditorOSX/BZEditorOSX-Prefix.pch"; + INFOPLIST_FILE = "BZEditorOSX/BZEditorOSX-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 601FAD91166A06FA00DAEFF3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BZEditorOSX/BZEditorOSX-Prefix.pch"; + INFOPLIST_FILE = "BZEditorOSX/BZEditorOSX-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 601FAD68166A06F900DAEFF3 /* Build configuration list for PBXProject "BZEditorOSX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 601FAD8D166A06FA00DAEFF3 /* Debug */, + 601FAD8E166A06FA00DAEFF3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 601FAD8F166A06FA00DAEFF3 /* Build configuration list for PBXNativeTarget "BZEditorOSX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 601FAD90166A06FA00DAEFF3 /* Debug */, + 601FAD91166A06FA00DAEFF3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 601FAD65166A06F900DAEFF3 /* Project object */; +} diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.h new file mode 100644 index 0000000..466f841 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.h @@ -0,0 +1,13 @@ +// +// BZBmpView.h +// TamaBinary +// +// Created by ad on 13/02/25. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import + +@interface BZBmpView : NSView + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.m new file mode 100644 index 0000000..0b90e7e --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpView.m @@ -0,0 +1,34 @@ +// +// BZBmpView.m +// TamaBinary +// +// Created by ad on 13/02/25. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZBmpView.h" + +@implementation BZBmpView + +- (id)initWithFrame:(NSRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // Initialization code here. + } + + return self; +} + +- (BOOL)isFlipped +{ + return YES; +} + +- (void)drawRect:(NSRect)dirtyRect +{ + // Drawing code here. + [@"BZBmpViewBZBmpViewBZBmpViewBZBmpViewBZBmpViewBZBmpViewBZBmpViewBZBmpView" drawAtPoint:NSMakePoint(0, 0) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:nil]]; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.h new file mode 100644 index 0000000..5aa69c2 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.h @@ -0,0 +1,13 @@ +// +// BZBmpViewController.h +// TamaBinary +// +// Created by ad on 13/02/25. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import + +@interface BZBmpViewController : NSViewController + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.m new file mode 100644 index 0000000..04a968c --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.m @@ -0,0 +1,27 @@ +// +// BZBmpViewController.m +// TamaBinary +// +// Created by ad on 13/02/25. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZBmpViewController.h" + +@interface BZBmpViewController () + +@end + +@implementation BZBmpViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Initialization code here. + } + + return self; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.xib b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.xib new file mode 100644 index 0000000..0f1f7de --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZBmpViewController.xib @@ -0,0 +1,161 @@ + + + + 1070 + 11G63 + 3084 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 3084 + + + NSCustomObject + NSCustomView + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + BZBmpViewController + + + FirstResponder + + + NSApplication + + + + 276 + + + + 290 + {236, 23} + + + _NS:9 + NSScroller + + + + 273 + {{235, 20}, {21, 243}} + + _NS:9 + NSScroller + + + + 274 + {{0, 20}, {236, 243}} + + + _NS:9 + BZBmpView + + + {256, 263} + + + NSView + + + + + + + view + + + + 2 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + + + + + + + + 8 + + + + + + 13 + + + + + 14 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 17 + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + YES + 3 + + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.h new file mode 100644 index 0000000..3c989c1 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.h @@ -0,0 +1,32 @@ +// +// BZDoc.h +// TamaBinary +// +// Created by ad on 12/12/26. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import + +@interface BZDoc : NSObject +{ +@private + __uint64_t m_dwTotal; + __uint64_t m_dwMapSize; + __uint8_t *m_pMapStart; + __uint64_t m_dwFileOffset; + BOOL m_bReadOnly; + int m_pFileMapping; + // void *m_hMapping; + __uint8_t *m_pData; + BZDoc *m_pDupDoc; + +} + +- (BOOL)OnOpenDocument:(NSURL *)url; +- (off_t)GetFileLength:(int)fd; +- (void)DeleteContents; +- (BOOL) IsFileMapping; +- (BOOL) MapView; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.m new file mode 100644 index 0000000..8ab4e5c --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZDoc.m @@ -0,0 +1,173 @@ +// +// BZDoc.m +// TamaBinary +// +// Created by ad on 12/12/26. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import "BZDoc.h" +#include + +#define MAXONMEMORY 1024*1024 +#define MAXMAPSIZE 64*1024*1024 +#define READONLY true + +@implementation BZDoc + +- (id)init +{ + if (self == [super init]) { + m_pData = NULL; + m_dwTotal = 0; + m_bReadOnly = READONLY; + //m_hMapping = NULL; + m_pFileMapping = 0; + m_pMapStart = 0; + m_dwFileOffset = 0; + m_dwMapSize = 0; + } + return self; +} + +- (void)DeleteContents +{ + if (m_pData) { + if ([self IsFileMapping]) { + munmap(m_pMapStart ? m_pMapStart : m_pData, m_dwMapSize); + m_pMapStart = NULL; + m_dwFileOffset = 0; + m_dwMapSize = 0; + } else { + free(m_pData); + } + m_pData = NULL; + m_dwTotal = 0; + /*m_dwBase = 0; + UpdateAllViews(NULL);*/ + } + if ([self IsFileMapping]) { + if (m_pDupDoc) { + m_pDupDoc->m_pDupDoc = nil; + m_pDupDoc = nil; + //m_hMapping = NULL; + m_pFileMapping = 0; + } else { + if (m_pFileMapping) { + close(m_pFileMapping); + m_pFileMapping = 0; + } + } + } + + /*if (m_pUndo) { + free(m_pUndo); + m_pUndo = NULL; + }*/ + m_bReadOnly = false; +} + +-(off_t)GetFileLength:(int)fd +{ + off_t fposOld = lseek(fd, 0, SEEK_CUR); //backup position + off_t fpos = lseek(fd, 0, SEEK_END); //seek to end + lseek(fd, fposOld, SEEK_SET); //restore position + if(fpos>0xffff) + { + return 0xffff; + } + return fpos; +} + +-(BOOL)IsFileMapping +{ + return m_pFileMapping != 0; +} + +- (BOOL)MapView +{ + m_dwMapSize = m_dwTotal; + m_pData = mmap(NULL, m_dwMapSize, m_bReadOnly?PROT_READ : PROT_READ|PROT_WRITE, MAP_SHARED, m_pFileMapping, 0); + if (m_pData==MAP_FAILED) {//Failed + m_dwMapSize = MAXMAPSIZE; + m_pData = mmap(NULL, m_dwMapSize, m_bReadOnly?PROT_READ : PROT_READ|PROT_WRITE, MAP_SHARED, m_pFileMapping, 0); + if (m_pData!=MAP_FAILED) {//Success + m_pMapStart = m_pData; + m_dwFileOffset = 0; + } else { + return false; + } + } + return true; +} + +-(BOOL)OnOpenDocument:(NSURL *)url +{ + int fd = open([[url path] fileSystemRepresentation], O_RDWR|O_EXLOCK/*|O_NONBLOCK*/); + if (fd==-1) { + m_bReadOnly = true; + } + close(fd); + + fd = open([[url path] fileSystemRepresentation], O_RDONLY|O_EXLOCK/*|O_NONBLOCK*/); + if(fd==-1) + { + return false;//err + } +// flock(fd, LOCK_EX|LOCK_NB); + + [self DeleteContents]; + + off_t fsize = [self GetFileLength:fd]; + if(fsize<0) + { + close(fd); + return false;//err + } + + if (fsize >= MAXONMEMORY) { //file-mpping + /*struct stat st; + if(fstat(fd, &st)==-1) + { + return false;//err + }*/ + //m_bReadOnly = /*options.bReadOnly||*/ st.mode; + if (m_bReadOnly==false) { + close(fd); + fd = open([[url path] fileSystemRepresentation], O_RDWR|O_EXLOCK/*|O_NONBLOCK*/); + if (fd == -1) { + return false;//err + } + } + m_pFileMapping = fd; + } + + m_dwTotal = fsize; + + if ([self IsFileMapping]) { + if([self MapView]==false) { + close(fd); + return false;//err + } + } else { + if (!(m_pData = malloc(m_dwTotal))) { + close(fd); + return false; + } + ssize_t totalRead = read(fd, m_pData, m_dwTotal); + if (totalRead < m_dwTotal) { + free(m_pData); + m_pData = NULL; + close(fd); + return false;//err + } + m_bReadOnly = READONLY; + } + + //munmap(data, m_dwMapSize); + close(fd); + + return true; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.h new file mode 100644 index 0000000..a843c7f --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.h @@ -0,0 +1,29 @@ +// +// BZEbcDic.h +// TamaBinary +// +// Created by ad on 13/01/28. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import +#import "BZGlobalFunc.h" + + +#define CHAR_NG '.' +#define CHAR_EBCDIC_NG 0xFF +#define EBCDIC_BASE 0x40 +#define EBCDIC_COUNT (256 - EBCDIC_BASE) + +@interface BZEbcDic : NSObject +{ +@public + NSData *m_EbcDic; + BOOL m_bLoaded; //set TRUE if failed +} + ++ (BZEbcDic*)sharedInstance; + +- (BOOL) LoadEbcDicTable; +- (unsigned char) ConvertEbcDic:(unsigned char)ch; +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.m new file mode 100644 index 0000000..4af4424 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZEbcDic.m @@ -0,0 +1,65 @@ +// +// BZEbcDic.m +// TamaBinary +// +// Created by ad on 13/01/28. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZEbcDic.h" + +@implementation BZEbcDic + +static BZEbcDic *_sharedInstance; + ++ (BZEbcDic *)sharedInstance +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _sharedInstance = [[BZEbcDic alloc] init]; + }); + return _sharedInstance; +} + +-(BOOL)LoadEbcDicTable +{ + if (m_bLoaded) return m_EbcDic!=nil; + m_bLoaded = TRUE; + NSData *rawData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:@"~/.BZ/EBCDIX.DEF"]]; + if (rawData==nil) return FALSE; +// __uint8_t *pTable = [BZGlobalFunc ReadFile:[NSURL fileURLWithPath:@"~/.BZ/EBCDIX.DEF"]]; +// if (!pTable) return FALSE; + const __int8_t *p = (const __int8_t*)[rawData bytes]; + __int8_t *pEbcDic = malloc(EBCDIC_COUNT+1); + memset(pEbcDic, CHAR_NG, EBCDIC_COUNT); + __int8_t *q = pEbcDic; + while (*p && q < pEbcDic + EBCDIC_COUNT) { + if (*p == ';') { + while (*p++ != 0x0A/*'¥n'*/) ; + continue; + } + while (*p++ != 0x09/*'¥t'*/) ; + for (int i=0; i<16; i++) { + *q++ = *p++; + } + while (*p++ != 0x0A/*'¥n'*/) ; + } + *q++ = 0;//'¥0'; + m_EbcDic = [NSData dataWithBytes:pEbcDic length:EBCDIC_COUNT+1]; + free(pEbcDic); + // free(pTable); + return TRUE; +} + +- (unsigned char)ConvertEbcDic:(unsigned char)ch +{ + if (m_EbcDic) { + const void *p = strchr([m_EbcDic bytes], ch); + if (p) { + return p - [m_EbcDic bytes] + EBCDIC_BASE; + } + } + return CHAR_EBCDIC_NG; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Info.plist b/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Info.plist new file mode 100644 index 0000000..8cfa550 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Info.plist @@ -0,0 +1,57 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + * + + CFBundleTypeIconFile + + CFBundleTypeName + DocumentType + CFBundleTypeOSTypes + + ???? + + CFBundleTypeRole + Editor + NSDocumentClass + Document + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + tamachan.soft.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.utilities + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + Copyright © 2013年 c.mos & devil.tamachan. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Prefix.pch b/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Prefix.pch new file mode 100644 index 0000000..05e4767 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZEditorOSX-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'TamaBinary' target in the 'TamaBinary' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.h new file mode 100644 index 0000000..a5dfb28 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.h @@ -0,0 +1,81 @@ +// +// BZGlobalFunc.h +// TamaBinary +// +// Created by ad on 13/01/28. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import +#import "BZOptions.h" + +#define DT_SJIS 1 +#define DT_JIS 2 +#define DT_UNICODE 4 +#define DT_EUC 8 +#define DT_UTF8 16 + + + +typedef struct _TAMASize { + union { + NSInteger width; + NSInteger cx; + NSInteger x; + }; + union { + NSInteger height; + NSInteger cy; + NSInteger y; + }; +} TAMASize; + +typedef struct _TAMARECT { + union { + NSInteger left; + NSInteger x1; + }; + union { + NSInteger top; + NSInteger y1; + }; + union { + NSInteger right; + NSInteger x2; + }; + union { + NSInteger bottom; + NSInteger y2; + }; +} TAMARect; + +NS_INLINE BOOL TAMAEqualSize(TAMASize s1, TAMASize s2) +{ + return (s1.width==s2.width) && (s1.height==s2.height); +} + +#define HIBYTE(w) (((__uint16_t)w) >> 8) + +#define LOWORDinLOQWORD(qw) ((__uint8_t)(((__uint64_t)qw) & 0xffff)) +#define HIWORDinLOQWORD(qw) ((__uint8_t)((((__uint64_t)qw) >> 16) & 0xffff)) + + +@interface BZGlobalFunc : NSObject + ++ (off_t)GetFileLength:(int)fd; ++ (__uint8_t*)ReadFile:(NSURL *)url; + ++ (TAMARect)NSRect2TAMARect:(NSRect*)rect; + ++ (enum CharSet)DetectCodeType:(__uint8_t*)p pEnd:(__uint8_t*)pEnd; ++ (BOOL)_ismbbleadSJIS932:(__uint8_t)ch; ++ (BOOL)_ismbbtrailSJIS932:(__uint8_t)ch; ++ (BOOL)IsMBS:(__uint8_t*)pTop ofs:(__uint64_t)ofs bTrail:(BOOL)bTrail; ++ (BOOL)_ismbsleadSJIS932:(__uint8_t*)str current:(__uint8_t*)current; ++ (BOOL)_ismbstrailSJIS932:(__uint8_t*)str current:(__uint8_t*)current; + ++ (BOOL)_ismbclegal:(__uint8_t)ch ch2:(__uint8_t)ch2; + ++ (__uint16_t)SwapWord:(__uint16_t)val; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.m new file mode 100644 index 0000000..32e43b7 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZGlobalFunc.m @@ -0,0 +1,185 @@ +// +// BZGlobalFunc.m +// TamaBinary +// +// Created by ad on 13/01/28. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZGlobalFunc.h" +#import "BZOptions.h" + + +@implementation BZGlobalFunc + + + ++ (off_t)GetFileLength:(int)fd +{ + off_t fposOld = lseek(fd, 0, SEEK_CUR); //backup position + off_t fpos = lseek(fd, 0, SEEK_END); //seek to end + lseek(fd, fposOld, SEEK_SET); //restore position + if(fpos>0xffff) + { + return 0xffff; + } + return fpos; +} + ++ (__uint8_t *)ReadFile:(NSURL *)url +{ + int fd = open([[url path] fileSystemRepresentation], O_RDONLY|O_EXLOCK/*|O_NONBLOCK*/); + if (fd==-1) + { + //MessageBox ERR: File Not Found + return NULL; + } + off_t fsize = [self GetFileLength:fd]; + if(fsize<0) + { + close(fd); + return NULL;//err + } + + __uint8_t *p = (__uint8_t *)malloc(fsize+1); + if (p==NULL) { + close(fd); + return NULL;//err + } + + ssize_t totalRead = read(fd, (void*)p, fsize); + if (totalRead < fsize) { + free(p); + close(fd); + return NULL;//err + } + + *(p+fsize) = 0; + + close(fd); + return p; +} + + + ++(enum CharSet)DetectCodeType:(__uint8_t*)p pEnd:(__uint8_t*)pEnd +{ + if (pEnd - p < 2) return CTYPE_BINARY; + + if(*(__uint16_t *)p == 0xFEFF) { + [BZOptions sharedInstance]->bByteOrder = FALSE;/*options.bByteOrder = FALSE;*/ + return CTYPE_UNICODE; + } + if(*(__uint16_t *)p == 0xFFFE) { + [BZOptions sharedInstance]->bByteOrder = TRUE;/*options.bByteOrder = TRUE;*/ + return CTYPE_UNICODE; + } + if(*(__uint16_t *)p == 0xBBEF && (pEnd - p) > 3 && *(p+2) == 0xBF) { + return CTYPE_UTF8; + } + + __uint8_t flag = DT_SJIS | DT_JIS | DT_EUC | DT_UTF8; + while (p < pEnd) { + __uint8_t c = *p++; + if(c == 0x0A/*'¥n'*/) + { + if(flag == DT_SJIS || flag == DT_EUC || flag & DT_UNICODE) break; + } + if (c >= 0x80) { + flag &= ~DT_JIS; + if (flag & DT_EUC) { + if (c != 0x8E && (c < 0xA1 || c > 0xFE)) + flag &= ~DT_EUC; + } + if (flag & DT_UTF8) { + if (c >= 0xC0 && p < pEnd) { + if ((*p & 0xC0) != 0x80) + flag &= ~DT_UTF8; + } + } + } + if (c >= 0x08 && c <= 0x0D || c >= 0x20 && c <= 0x7E || c >= 0x81 && c <= 0xFC) + { + if ([self _ismbbleadSJIS932:c]) { + c = *p++; + if (![self _ismbbtrailSJIS932:c]) { + flag &= ~DT_SJIS; + if ((c==0 || c==0xFF) && ((__uint64_t)p & 1)) + flag |= DT_UNICODE; + } + if (c >= 0x80 && c != 0x8E && (c < 0xA1 || c > 0xFE)) { + flag &= ~DT_EUC; + } + } + } else { + if (c == 0x1B) { + if(*p == '$' || *p == '(') + return CTYPE_JIS; + } else if ((c == 0 || c == 0xFF) && ((__uint64_t)p & 1) == 0) + flag |= DT_UNICODE; + else if (c < 0x20) + return CTYPE_BINARY; + } + if (flag == 0) return CTYPE_BINARY; + } + return (flag & DT_UNICODE) ? CTYPE_UNICODE + : (flag & DT_JIS) ? CTYPE_BINARY + : (flag & DT_EUC) ? CTYPE_EUC : (flag & DT_UTF8) ? CTYPE_UTF8 : CTYPE_SJIS; +} + ++ (BOOL)_ismbbleadSJIS932:(__uint8_t)ch +{ + if ((0x81 <= ch && ch <= 0x9F) || (0xE0 <= ch && ch <= 0xFC))return TRUE; + return FALSE; +} + ++ (BOOL)_ismbbtrailSJIS932:(__uint8_t)ch +{ + if ((0x40 <= ch && ch <= 0x7E) || (0x80 <= ch && ch <= 0xFC))return TRUE; + return FALSE; +} + ++(BOOL)IsMBS:(__uint8_t *)pTop ofs:(__uint64_t)ofs bTrail:(BOOL)bTrail +{ + __uint8_t *p, *p1; + p = p1 = pTop + ofs; + while (pTop < p) { + if (*(p-1) < 0x81) break; + p--; + } + return bTrail ? [BZGlobalFunc _ismbstrailSJIS932:p current:p1] : [BZGlobalFunc _ismbsleadSJIS932:p current:p1]; +} ++ (BOOL)_ismbsleadSJIS932:(__uint8_t *)str current:(__uint8_t *)current +{ + return [BZGlobalFunc _ismbbleadSJIS932:*current]; +} ++ (BOOL)_ismbstrailSJIS932:(__uint8_t *)str current:(__uint8_t *)current +{ + return [BZGlobalFunc _ismbbleadSJIS932:*(current-1)]; +} + ++ (BOOL)_ismbclegal:(__uint8_t)ch1 ch2:(__uint8_t)ch2 +{ + if ( ((0x81<=ch1 && ch1<=0x9F)||(0xE0<=ch1 && ch1<=0xFC)) && ((0x40<=ch2 && ch2<=0x7E)||(0x80<=ch2 && ch2<=0xFC)) ) { + return TRUE; + } + return FALSE; +} + ++(TAMARect)NSRect2TAMARect:(NSRect*)rect +{ + TAMARect tamaRect; + tamaRect.x1 = rect->origin.x; + tamaRect.y1 = rect->origin.y; + tamaRect.x2 = rect->origin.x + rect->size.width; + tamaRect.y2 = rect->origin.y + rect->size.height; + return tamaRect; +} + ++ (__uint16_t)SwapWord:(__uint16_t)val +{ + if ([BZOptions sharedInstance]->bByteOrder) return (val >> 8)|(val << 8); + return val; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.h new file mode 100644 index 0000000..e07d713 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.h @@ -0,0 +1,71 @@ +// +// BZOptions.h +// TamaBinary +// +// Created by ad on 12/12/15. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import + +enum CharSet { CTYPE_ASCII, CTYPE_SJIS, CTYPE_UNICODE, CTYPE_JIS, CTYPE_EUC, CTYPE_UTF8, CTYPE_EBCDIC, CTYPE_EPWING, CTYPE_COUNT, CTYPE_BINARY = -1 }; +enum TextColor{ TCOLOR_ADDRESS=0, TCOLOR_ADDRESS2, TCOLOR_TEXT, TCOLOR_SELECT, TCOLOR_MARK, TCOLOR_MISMATCH, TCOLOR_STRUCT, TCOLOR_MEMBER, TCOLOR_OVERBROTHER, TCOLOR_HORIZON, TCOLOR_COUNT }; +enum MemberColumn { MBRCOL_OFFSET, MBRCOL_LABEL, MBRCOL_VALUE, MBRCOL_MAX }; + +typedef unsigned long DWORD; + + +@interface BZOptions : NSObject +{ + @public + enum CharSet charset; + BOOL bAutoDetect; + NSString *sFontName; + int nFontSize; + int fFontStyle; + BOOL bByteOrder;//TRUE==Big Endian, FALSE==Little Endian, !!!! Tmp !!!! need copy to BZView + NSPoint ptFrame; + int nCmdShow; + int cyFrame; + int cyFrame2; + int cxFrame2; + int xSplit; + int ySplit; + int xSplitStruct; + BOOL bStructView; + unsigned int nSplitView; + int nComboHeight; + + NSColor *colors[TCOLOR_COUNT][2]; + //CGColorRef colors[TCOLOR_COUNT][2]; + int colWidth[MBRCOL_MAX]; + BOOL bLanguage; + NSRect rMargin; + DWORD dwDetectMax; + DWORD barState; + BOOL bReadOnlyOpen; + int nBmpWidth; + int nBmpZoom; + DWORD dwMaxOnMemory; + DWORD dwMaxMapSize; + BOOL bTagAll; + BOOL bSubCursor; + + NSString *sDumpHeader; + int nDumpPage; + BOOL bDWordAddr; + + BOOL bSyncScroll; + int iGrid; + int nBmpColorWidth; + + BOOL bInspectView; + BOOL bAnalyzerView; +} + ++ (BZOptions*)sharedInstance; + +- (void)InitDefaultValues; +- (void)Load; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.m new file mode 100644 index 0000000..361cb18 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZOptions.m @@ -0,0 +1,194 @@ +// +// BZOptions.m +// TamaBinary +// +// Created by ad on 12/12/15. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import "BZOptions.h" + + + +const CGFloat colorsDefault[TCOLOR_COUNT][2][3] = { + { {0.000000, 0.000000, 0.000000}, {0.890196078431373, 0.890196078431373, 0.890196078431373} }, + { {0.000000, 0.000000, 0.000000}, {1.0, 1.0, 1.0} }, + { {0.000000, 0.000000, 0.000000}, {1.0, 1.0, 1.0} }, + { {1.000000, 1.000000, 1.000000}, {0.2, 0.6, 1.0} }, + { {1.000000, 0.000000, 0.000000}, {1.0, 1.0, 1.0} }, + { {0.000000, 0.000000, 1.000000}, {1.0, 1.0, 1.0} }, + { {0.000000, 0.000000, 1.000000}, {1.0, 1.0, 1.0} }, + { {1.000000, 0.000000, 0.000000}, {1.0, 1.0, 1.0} }, + { {0.000000, 0.501960784313725, 0.000000}, {1.0, 1.0, 1.0} }, + { {1.0, 0.0, 0.0}, {0.243137254901961, 0.701960784313725, 0.43921568627451} } +}; + +@implementation BZOptions + +static BZOptions *_sharedInstance = nil; + ++ (BZOptions *)sharedInstance +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSLog(@"BZOption init"); + _sharedInstance = [[BZOptions alloc] init]; + [_sharedInstance InitDefaultValues];//configuration for default values + [_sharedInstance Load];//load configuration values + }); + return _sharedInstance; +} + +- (void)InitDefaultValues +{ + //memcpy(colors, colorsDefault, sizeof(colorsDefault)); + NSMutableArray *arrColors = [NSMutableArray arrayWithCapacity:TCOLOR_COUNT*2*3]; + for (int i=0; im_doc1 : bzwndCon->m_doc2; + return nil; +} + +- (BOOL)isFlipped +{ + return true; +} + +- (void)SetColorByDefault +{ + [self SetColorByTCOLOR:TCOLOR_TEXT]; +} + +- (void)SetColorByTCOLOR:(enum TextColor)n +{ + // [self SetColorByNSColor:[NSColor colorWithCalibratedRed:colorsDefaultcolors[n][0][0] green:colorsDefaultcolors[n][0][1] blue:colorsDefaultcolors[n][0][2] alpha:1.0] colBk:[NSColor colorWithCalibratedRed:colorsDefaultcolors[n][1][0] green:colorsDefaultcolors[n][1][1] blue:colorsDefaultcolors[n][1][2] alpha:1.0]]; + BZOptions *bzcfg = [BZOptions sharedInstance]; + [self SetColorByNSColor:bzcfg->colors[n][0] colBk:bzcfg->colors[n][1]]; +} + +-(void)SetHeaderColor +{ + BOOL bNoFocus = FALSE; + [self SetColorByTCOLOR:(bNoFocus ? TCOLOR_ADDRESS2 : TCOLOR_ADDRESS)]; +} + +-(void)DrawHeader +{ + if([self IsToFile]) + { + + } else { + [self SetHeaderColor]; + [self Locate:DUMP_X y:0]; + for (int i=0; i<16; i++) { + [self PutStr:[NSString stringWithFormat:@"+%1X ", i]]; + } + [self PutChar]; + for (int i=0; i<16; i++) { + [self PutStr:[NSString stringWithFormat:@"%1X", i]]; + } + } +} + +-(void)OnUpdate +{ + m_pDoc = [self GetDocument]; + NSLog(@"OnUpdate: %llX",m_pDoc); + if (!m_pDoc) return; + assert(m_pDoc); + if(m_pDoc) + [m_pDoc QueryMapView:[m_pDoc GetDocPtr] dwOffset:0]; + m_nColAddr = [m_pDoc IsFileMapping] ? ADDRCOLUMNS_MAP : ADDRCOLUMNS; + if ([self GetViewWidth] != VIEWCOLUMNS) { + [self SetViewSize:VIEWCOLUMNS]; + m_bResize = FALSE; + // ResizeFrame(); + } + + [self UpdateDocSize]; + [self ScrollToPos:0]; + TAMASize scrHome; + scrHome.width = 0; + scrHome.height = DUMP_Y; + [self SetScrollHome:scrHome]; + m_dwCaret = m_dwOldCaret = m_dwBlock = m_dwStruct = 0; + m_nMember = INVALID; + m_nBytes = 1; + m_bCaretOnChar = m_bBlock = m_bIns = FALSE; + NSLog(@"m_bBlock==FALSE"); + m_bEnterVal = FALSE; + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->bAutoDetect ? [self AutoDetectCharSet] : bzopt->charset; + if (m_charset == CTYPE_EBCDIC) + [[BZEbcDic sharedInstance] LoadEbcDicTable]; + + /* + if(GetMainFrame() && GetMainFrame()->m_bStructView) { + CBZFormView* pView = (CBZFormView*)GetNextWindow(GW_HWNDPREV); + if(pView != NULL) + pView->SelectTag(); + } + if(GetMainFrame()) { + CBZAnalyzerView * pView = (CBZAnalyzerView*)GetNextWindow(GW_HWNDPREV); + if(pView != NULL) + pView->Clear(); + }*/ + [self setNeedsDisplay:TRUE];//Invalidate(); + [self InitCaret];//InitCaret(); + [self StopCaret]; + [self DrawCaret];// DrawCaret(); +} + +- (BOOL)DrawCaret +{ + BOOL bDraw = FALSE; + TAMASize ptOrg = [self GetScrollPos]; + __uint64_t dwOrg = ptOrg.y * 16; + + TAMARect rClient; + rClient.x1 = _bounds.origin.x; + rClient.y1 = _bounds.origin.y; + rClient.x2 = _bounds.origin.x + _bounds.size.width; + rClient.y2 = _bounds.origin.y + _bounds.size.height; + [self PixelToGridFromTAMARect:&rClient]; + __uint64_t dwBottom = dwOrg + (rClient.y2 - DUMP_Y) * 16; + __uint64_t dwMax = m_dwTotal + 1; + if (dwBottom > dwOrg && dwBottom < dwMax) + dwMax = dwBottom; + + TAMASize pt; + __int64_t ptx2 = -1; + if (m_dwCaret < dwOrg || m_dwCaret >= dwMax) { + pt.x = pt.y = -1; + } else { + pt.x = (m_dwCaret - dwOrg)%16; + ptx2 = pt.x + CHAR_X; + pt.x = pt.x*3 + DUMP_X; + if (m_bCaretOnChar) { + __int64_t tmp = ptx2; + ptx2 = pt.x; + pt.x = tmp; + } + pt.x -= ptOrg.x; + ptx2 -= ptOrg.x; + pt.y = (m_dwCaret - dwOrg)/16 + DUMP_Y; + bDraw = TRUE; + } + [self MoveCaret:pt];//MoveCaret(pt); + pt.x = ptx2; + //MoveCaret2(pt); + +/* if(GetMainFrame() && GetMainFrame()->m_bInspectView) { + CBZInspectView* pView = (CBZInspectView*)GetNextWindow(GW_HWNDPREV); + pView->Update(); + }*/ + + return bDraw; +} + +- (__uint64_t)BlockBegin +{ + return MIN(m_dwBlock, m_dwCaret);//m_dwBlock < m_dwCaret ? m_dwBlock : m_dwCaret; +} +- (__uint64_t)BlockEnd +{ + return MAX(m_dwBlock, m_dwCaret);//m_dwBlock > m_dwCaret ? m_dwBlock : m_dwCaret; +} + + +-(void)DrawToFile:(NSURL*)outPath +{ + m_pFile = fopen([[outPath path] fileSystemRepresentation], "w"); + if (m_pFile) { + [self drawRect:NSMakeRect(0,0,0,0)]; + fclose(m_pFile); + m_pFile = NULL; + } + +} + +- (void)drawRect:(NSRect)dirtyRect +{ + // Drawing code here. + //NSLog(@"drawRect %f, %f", dirtyRect.size.width, dirtyRect.size.height); + + [[NSColor whiteColor] setFill]; + NSRectFill(dirtyRect); + + __uint8_t *p = [m_pDoc GetDocPtr]; + //if(!p) return;//tmp + + TAMARect rClip; + __uint64_t ofs; + __uint64_t dwBegin = [self BlockBegin]; + __uint64_t dwEnd = [self BlockEnd]; + __uint64_t dwTotal = m_dwTotal; + + DWORD dwTotalP1 = 0; + + NSInteger y; + + [self PutBegin]; + if ([self IsToFile]) + { + [self DrawHeader]; + rClip.y1 = DUMP_Y; + rClip.y2 = LONG_MAX; + ofs = 0; + if(m_bBlock) { + ofs = dwBegin & ~0xF; + dwTotal = dwEnd; + } + /*} else if(![NSGraphicsContext currentContextDrawingToScreen]) { // ### 1.54 + [self DrawHeader]; + rClip.y1 = DUMP_Y; + rClip.y2 = m_nPageLen; + ofs = m_dwPrint;*/ + } else { + rClip = [BZGlobalFunc NSRect2TAMARect:&dirtyRect]; + [self PixelToGridFromTAMARect:&rClip]; + if(rClip.y1 < DUMP_Y) { + [self DrawHeader]; + rClip.y1 += DUMP_Y; + } + TAMASize ptOrg = [self GetScrollPos]; + ofs = (ptOrg.y + rClip.y1 - DUMP_Y)*16; + } + + if(![self IsToFile] && (![NSGraphicsContext currentContextDrawingToScreen] && m_bBlock)) + dwTotal = dwEnd; + __uint8_t* p1 = NULL; + BZView* pView1 = [self GetBrotherView:self]; + if(pView1) + { + p1 = [pView1->m_pDoc GetDocPtr]; + dwTotalP1 = pView1->m_dwTotal; + } + + if (p && !(p = [m_pDoc QueryMapView:p dwOffset:ofs])) return; + + [self InitCharMode:p ofs:ofs]; + + int skipNum = 0; + BZOptions *bzopt = [BZOptions sharedInstance]; + + for(/*int */y = rClip.y1; y <= rClip.y2; y++) { + [self Locate:0 y:y]; + if(ofs > dwTotal) break; + if([self IsToFile] && bzopt->nDumpPage) { + if(y > DUMP_Y && ((y - DUMP_Y) % bzopt->nDumpPage) == 0) { + [self Locate:0 y:y]; // crlf + [self DrawHeader]; + [self Locate:0 y:y]; // crlf + } + } + [self SetHeaderColor]; + __uint64_t ofs1 = ofs + m_pDoc->m_dwBase; + if(p && !(p = [m_pDoc QueryMapView:p dwOffset:ofs1])) return; + if(p1 && !(p1 = [pView1->m_pDoc QueryMapView:p1 dwOffset:ofs1])) return; + + if(m_nColAddr > ADDRCOLUMNS) { + [self PutStr:[NSString stringWithFormat:@"%04X:%04X", HIWORDinLOQWORD(ofs1), LOWORDinLOQWORD(ofs1)]];//PutFormatStr("%04X:%04X", HIWORD(ofs1), LOWORD(ofs1)); + [self SetColorByDefault];//SetColor(); + [self PutStr:@" "]; + } else + { + if(ofs1 < 0x1000000) { // ###1.54 + [self PutStr:[NSString stringWithFormat:@"%06llX", ofs1]];//PutFormatStr("%06X", ofs1); + [self SetColorByDefault];//SetColor(); + [self PutStr:@" "]; + } else { + [self PutStr:[NSString stringWithFormat:@"%07llX", ofs1]];//PutFormatStr("%07X", ofs1); + [self SetColorByDefault];//SetColor(); + [self PutStr:@" "]; + } + } + __uint64_t ofs0 = ofs; + for(int i=0; i<16; i++) { + if(ofs >= dwTotal) { + [self SetColorByDefault];//SetColor(); + [self PutChar:@" " n:(16-i)*3-1];//PutChar(' ', (16-i)*3-1); + break; + } + if(m_bBlock && ofs >= dwBegin && ofs < dwEnd) + [self SetColorByTCOLOR:TCOLOR_SELECT];//SetColor(TCOLOR_SELECT); +// else if(m_pDoc->CheckMark(ofs)) +// [self SetColorByTCOLOR:TCOLOR_MARK];//SetColor(TCOLOR_MARK); + else if(m_dwStruct && ofs >= m_dwStructTag && ofs < m_dwStruct) { + if(m_nMember >= 0 && ofs >= m_dwStructTag + m_nMember && ofs < m_dwStructTag + m_nMember + m_nBytes * m_nBytesLength) + [self SetColorByTCOLOR:TCOLOR_MEMBER];//SetColor(TCOLOR_MEMBER); + else + [self SetColorByTCOLOR:TCOLOR_STRUCT];//SetColor(TCOLOR_STRUCT); + } + else if(p1 && (ofs < dwTotalP1 && (*(p+ofs) != *(p1+ofs)))) + [self SetColorByTCOLOR:TCOLOR_MISMATCH];//SetColor(TCOLOR_MISMATCH); + else if(p1 && ofs >= dwTotalP1) + [self SetColorByTCOLOR:TCOLOR_OVERBROTHER];//SetColor(TCOLOR_OVERBROTHER); + else + [self SetColorByDefault];//SetColor(); + [self PutStr:[NSString stringWithFormat:@"%02X", *(p + ofs++)]];//PutFormatStr("%02X", *(p + ofs++)); + if(i < 15) + [self PutStr:((i==7) ? @"-" : @" ")];//PutChar((i==7) ? '-' : ' '); + } + [self SetColorByDefault];//SetColor(); + [self PutStr:@" "]; + ofs = ofs0; + int skipNumOld=0; + if (skipNum!=0) { + skipNumOld=skipNum; ofs+=skipNum; [self PutChar:@" " n:skipNum];/*[self PutStr:@"" length:skipNum];*/ skipNum=0; + [self PutFlush]; + } + + for(int i=skipNumOld; i<16; i++) { + if(ofs >= dwTotal) { + [self SetColorByDefault]; + [self PutChar:@" " n:16-i];//PutChar(' ', 16-i); + ofs++; + break; + } + if(m_bBlock && ofs >= dwBegin && ofs < dwEnd) + [self SetColorByTCOLOR:TCOLOR_SELECT]; + else if(m_dwStruct && ofs >= m_dwStructTag && ofs < m_dwStruct) { // ###1.62 + if(m_nMember >= 0 && ofs >= m_dwStructTag + m_nMember && ofs < m_dwStructTag + m_nMember + m_nBytes * m_nBytesLength) + [self SetColorByTCOLOR:TCOLOR_MEMBER]; + else + [self SetColorByTCOLOR:TCOLOR_STRUCT]; + } + else + [self SetColorByDefault]; + + if(m_charset == CTYPE_UNICODE) { + __uint16_t w[2] = {[BZGlobalFunc SwapWord:(*((__uint16_t*)(p+ofs)))], 0}; + //NSLog(@"bByteOrder: %@", [BZOptions sharedInstance]->bByteOrder ? @"Big":@"Little"); + [self PutStr:[NSString stringWithCString:w encoding:NSUTF16BigEndianStringEncoding] length:2];//PutUnicodeChar(w); + ofs += 2; + i++; + } else { + /*if (i==0 && skipNum!=0) { + i+=skipNum; ofs+=skipNum; [self PutStr:@"" length:skipNum]; skipNum=0; + [self PutFlush]; + }*/ + __uint16_t c = *(p + ofs++); + switch(m_charset) { + case CTYPE_ASCII: + if(c < 0x20 || c > 0x7E) c = CHAR_NG; + [self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + break; + case CTYPE_SJIS: + if(c < 0x20) + { + [self PutStr:@"."/*CHAR_NG*/]; + } else if(i == 0 && [BZGlobalFunc IsMBS:p ofs:ofs-1 bTrail:TRUE]) + { + [self PutStr:@" "]; + } else if ([BZGlobalFunc IsMBS:p ofs:ofs-1 bTrail:FALSE]) + { + __uint8_t c1 = *(p + ofs); + if([BZGlobalFunc _ismbclegal:c ch2:c1])//_ismbclegal(MAKEWORD(c1, c))) + { + //[self PutStr:[NSString stringWithFormat:@"%c", (char)c]];//PutChar((char)c); + char outSJIS[3] = {c, *(p + ofs), 0}; + c = *(p + ofs); + if(i < 15) { + ofs++; + i++; + } + //[self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + NSString *sjisStr = [NSString stringWithCString:outSJIS encoding:NSShiftJISStringEncoding]; + [self PutStr:sjisStr?sjisStr:@".." length:2]; + } else { + c = CHAR_NG; + [self PutStr:@"."/*CHAR_NG*/]; + } + } else if(c > 0x7E && c < 0xA1 || c > 0xDF) + { + [self PutStr:@"."/*CHAR_NG*/]; + } else { + [self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + } + //[self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + break; + case CTYPE_JIS: + case CTYPE_EUC: + //case CTYPE_EPWING: + c = [self GetCharCode:c ofs:(ofs-1)];//GetCharCode(c, ofs - 1); + if (c < 0x20 || (c > 0x7E && c < 0xA1) || (c > 0xDF && c <= 0xFF)) + { + [self PutStr:@"."/*CHAR_NG*/]; + } else if (c & 0xFF00) { + if (ofs>=dwTotal) { + [self PutStr:@"."/*CHAR_NG*/]; + } else { + __uint8_t c1 = *(p + ofs); + c = (c | c1);// & 0x7F7F; + if (m_charset==CTYPE_JIS) c|=0x8080; + char outCStr[3] = {HIBYTE(c), c&0xFF, 0}; + NSString *eucStr = [NSString stringWithCString:outCStr encoding:NSJapaneseEUCStringEncoding]; + if (eucStr) { + if(i < 15) { + [self GetCharCode:c1&0x7F ofs:ofs];//GetCharCode(c1, ofs); + ofs++; + i++; + } + [self PutStr:eucStr length:2]; + } else {//fail convert char + m_mode = CMODE_ASCII; + [self PutStr:@"."/*CHAR_NG*/ length:1]; + } + } + } else { + [self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + } + break; + case CTYPE_UTF8: // ### 1.54b + { + if(c <= 0x7E) + { + if (0x20 <= c) { + [self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + } else { + [self PutStr:@"." /*CHAR_NG*/]; + } + break; + } + + __uint32_t dw32 = 0; + int n = 4; + if (dwTotal - ofs + 1 < 4) n = dwTotal - ofs + 1; + for (int i=0; i<4; i++) { + dw32 <<= 8; + if (i=16)skipNum = i-16+1; ofs+=1-skipNum; + } else { + [self PutStr:@"." /*CHAR_NG*/]; + } + } else if ((dw32 & 0xF0C0C000) == 0xE0808000) { + char outUtf8[4] = {c, *(p+ofs), *(p+ofs+1), 0}; + NSString *utf8Str = [NSString stringWithCString:outUtf8 encoding:NSUTF8StringEncoding]; + if (utf8Str) { + [self PutStr:utf8Str length:3]; + i+=2; if(i>=16)skipNum = i-16+1; ofs+=2-skipNum; + } else { + [self PutStr:@"." /*CHAR_NG*/]; + } + } else if ((dw32 & 0xF8C0C0C0) == 0xF0808080) { + char outUtf8[5] = {c, *(p+ofs), *(p+ofs+1), *(p+ofs+2), 0}; + NSString *utf8Str = [NSString stringWithCString:outUtf8 encoding:NSUTF8StringEncoding]; + if (utf8Str) { + [self PutStr:utf8Str length:4]; + i+=3; if(i>=16)skipNum = i-16+1; ofs+=3-skipNum; + } else { + [self PutStr:@"." /*CHAR_NG*/]; + } + } else { + [self PutStr:@"." /*CHAR_NG*/]; + } + } + break; + /*case CTYPE_EBCDIC: // ### 1.63 + void* m_pEbcDic = [[[BZEbcDic sharedInstance] m_EbcDic] data]; + if(m_pEbcDic == NULL || c < EBCDIC_BASE) + c = CHAR_NG; + else + c = *(m_pEbcDic + ((BYTE)c - EBCDIC_BASE)); + [self PutStr:[NSString stringWithFormat:@"%c", (char)c]]; + break;*/ + } + //[self PutStr:[NSString stringWithFormat:@"%c", (char)c]];//PutChar((char)c); + } + }//loop-end for string area + [self SetColorByDefault];//SetColor(); + // if(m_charset == CTYPE_SJIS)[self PutStr:@" "];//PutChar(' '); + } + if([self IsToFile]) { + [self PutEnd]; + } else { + if(y <= rClip.y2) { + [self SetColorByDefault];//SetColor(); + for(; y<=rClip.y2+1; y++) { + [self Locate:0 y:y]; + for(int j=0;j 0x7E) break; + } + while(n++ < ofs) { + [self GetCharCode:*p++]; + } + } else if(m_charset == CTYPE_EUC) { + [self GetCharCode:0]; + while(n) { + n--; + __uint8_t c = *(--p); + if(c < 0xA1 || c > 0xFE) break; + } + while(n++ < ofs) { + [self GetCharCode:*p++]; + } + } +} + +- (__uint16_t)GetCharCode:(__uint16_t)c +{ + return [self GetCharCode:c ofs:0]; +} + +- (__uint16_t)GetCharCode:(__uint16_t)c ofs:(__uint64_t)ofs +{ +// enum CharMode { CMODE_ASCII, CMODE_ESC, CMODE_ESC1, CMODE_ESC2, CMODE_ESC3, CMODE_KANJI1, CMODE_KANJI2, CMODE_KANA }; + //static enum CharMode mode; + //static __uint16_t c0; + if(m_charset == CTYPE_JIS) { + switch(c) { + case 0x1B: + m_mode = CMODE_ESC; + break; + case 0x0E: + m_mode = CMODE_KANA; + break; + case 0x0F: + m_mode = CMODE_ASCII; + break; + } + if(c < 0x21 || c > 0x7E || m_mode == CMODE_ASCII) return c; + switch(m_mode) { + case CMODE_ESC: + if(c == '(') m_mode = CMODE_ESC1; + else if(c == '$') m_mode = CMODE_ESC2; + else m_mode = CMODE_ASCII; + break; + case CMODE_ESC1: + if(c == 'I') m_mode = CMODE_KANA; + else m_mode = CMODE_ASCII; + break; + case CMODE_ESC2: + m_mode = CMODE_KANJI1; + break; + case CMODE_KANJI1: + c <<= 8; + m_c0 = c; + m_mode = CMODE_KANJI2; + //c |= 0x8000; //tamachan for MacOSX + break; + case CMODE_KANJI2: + c = ' '; + m_mode = CMODE_KANJI1; + //c |= 0x80; //tamachan for MacOSX + break; + case CMODE_KANA: + c |= 0x80; + break; + } + } else if(m_charset == CTYPE_EUC) { + if(c < 0x80) { + m_mode = CMODE_ASCII; + } else { + switch(m_mode) { + case CMODE_ASCII: + if(c >= 0xA1 && c <= 0xFE) { + m_mode = CMODE_KANJI1; + c <<= 8; + } else if(c == 0x8E) { + m_mode = CMODE_KANA; + c = CHAR_NG; + } else if(c > 0x7E) + c = CHAR_NG; + break; + case CMODE_KANJI1: + c = ' '; + m_mode = CMODE_ASCII; + break; + case CMODE_KANA: + m_mode = CMODE_ASCII; + break; + } + } + } else if(m_charset == CTYPE_EPWING) { + if(c == 0x1F) m_mode = CMODE_ESC3; + else if(m_mode == CMODE_ESC3) { + m_mode = CMODE_KANJI1; + c = CHAR_NG; + } else if(c < 0x21 || c > 0x7E) { + m_mode = CMODE_KANJI1; + c = CHAR_NG; + } else if(m_mode == CMODE_KANJI1) { + if(ofs == 0 || (ofs & 1) == 0) { + c <<= 8; + m_c0 = c; + m_mode = CMODE_KANJI2; + } else + c = CHAR_NG; + } else if(CMODE_KANJI2) { + c = ' '; + m_mode = CMODE_KANJI1; + } + } + return c; +} + +-(void)UpdateDocSize +{ + m_dwTotal = [m_pDoc GetDocSize]; + TAMASize cTotal; + cTotal.width = VIEWCOLUMNS; + cTotal.height = m_dwTotal / 16 + 2; + [self SetTextSize:cTotal]; + [self InitScrollBar];//settextsize:ctotal nPage kara ido + //Invalidate(); +} + +- (enum CharSet)AutoDetectCharSet +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + __uint8_t *p = [m_pDoc GetDocPtr]; + if(!p) return bzopt->charset; + __uint64_t dwSize = m_dwTotal; + if (dwSize > bzopt->dwDetectMax) dwSize = bzopt->dwDetectMax; + enum CharSet charset = [BZGlobalFunc DetectCodeType:p pEnd:p+dwSize]; + if (charset == CTYPE_BINARY) { + charset = bzopt->charset; + } + return charset; +} + +- (void)mouseDown:(NSEvent *)theEvent +//- (void)rightMouseDown:(NSEvent *)theEvent +{ + //NSLog(@"mouseDown"); + NSPoint pt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + [self OnLButtonDown:pt bShiftKey:[theEvent modifierFlags] & NSShiftKeyMask]; +} + +- (void)mouseDragged:(NSEvent *)theEvent +//- (void)rightMouseDragged:(NSEvent *)theEvent +{ + //NSLog(@"mouseDragged"); + NSPoint pt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + [self OnMouseDrag:pt]; + [self setNeedsDisplay:YES]; + +} + +-(void)mouseUp:(NSEvent *)theEvent +//- (void)rightMouseUp:(NSEvent *)theEvent +{ + //NSLog(@"mouseUp"); + [self OnLButtonUp]; + [self setNeedsDisplay:YES]; + + BZWindow *bzWnd = (BZWindow*)self.window; + if (bzWnd->m_isActiveView1 != m_isDoc1?TRUE:FALSE) { + bzWnd->m_isActiveView1 = m_isDoc1?TRUE:FALSE; + BZView *bzBrother = [bzWnd GetBrotherView:self]; + [bzBrother StopCaret]; + [self InitCaret]; + Document *doc = [self GetDocument]; + [bzWnd setTitle:(doc.fileURL)?doc.fileURL.lastPathComponent : @"Untitled"]; + } +} + +/* + -(void)mouseMoved:(NSEvent *)theEvent + { + NSLog(@"mouseMoved"); + // [self OnMouseMove]; + }*/ + +- (__uint64_t)PointToOffset:(NSPoint)pt +{ + //NSRect r; + //GetClientRect(&r); + if(!NSPointInRect(pt, _bounds))//if(!r.PtInRect(pt)) + return ULLONG_MAX;//UINT_MAX; + [self PixelToGridFromNSPoint:&pt];//PixelToGrid(pt); + //NSLog(@"PointToIffset: PixelToGridFromNSPoint:%f,%f",pt.x,pt.y); + TAMASize scrPos = [self GetScrollPos]; + pt.x += scrPos.x; pt.y += scrPos.y; + //pt += [self GetScrollPos]; + if(pt.y < DUMP_Y) // || pt.x == CHAR_X-1 || pt.x >= CHAR_X+16) // ###1.5 + return ULLONG_MAX;//UINT_MAX; + if(pt.x >= CHAR_X) { + if((pt.x -= CHAR_X) > 16) pt.x = 16; + m_bCaretOnChar = TRUE; + } else { + if(pt.x < DUMP_X) + pt.x = 0; + else + pt.x -= DUMP_X; + pt.x/=3; + m_bCaretOnChar = FALSE; + } + __uint64_t ofs = (pt.y - DUMP_Y)*16 + pt.x; + return (ofs > m_dwTotal) ? m_dwTotal : ofs; +} + +-(void)OnLButtonDown:(NSPoint)ptClick bShiftKey:(BOOL)bShiftKey +{ + if(m_bBlock) { + m_bBlock = FALSE; + NSLog(@"m_bBlock==FALSE"); + //Invalidate(FALSE); + } + BOOL bOnChar = m_bCaretOnChar; + __uint64_t ofs = [self PointToOffset:ptClick];//PointToOffset(point); + //NSLog(@"OnLButtonDown %f,%f ofs=%llu",ptClick.x, ptClick.y, ofs); + if(ofs != ULLONG_MAX/*UINT_MAX*/) { + if(m_dwCaret != ofs || bOnChar != m_bCaretOnChar) { + m_dwOldCaret = m_dwCaret; + if(bShiftKey) { + m_bBlock = TRUE; + NSLog(@"m_bBlock==TRUE"); + //Invalidate(FALSE); + } else + m_dwBlock = ofs; + [self setNeedsDisplayInRect:m_caretRect];m_bCaretOn = FALSE; + m_dwCaret = ofs; + [self DrawCaret];//DrawCaret(); + } + //SetCapture(); + } + m_bEnterVal = FALSE; + //CTextView::OnLButtonDown(nFlags, point); +} + +-(void)OnMouseDrag:(NSPoint)pt +{ + // if(nFlags & MK_LBUTTON) { + __uint64_t ofs = [self PointToOffset:pt];//PointToOffset(point); + if(ofs != ULLONG_MAX) {//UINT_MAX) { + if(m_draggingTimer) { + [m_draggingTimer invalidate];//KillTimer(m_timer); + m_draggingTimer = nil; + } + if(m_dwCaret != ofs && m_dwBlock != ofs) { + __uint64_t dwCaretOld = m_dwCaret; // ###1.5 + CGPoint ptCaretOld = m_caretRect.origin; + [self setNeedsDisplayInRect:m_caretRect];m_bCaretOn = FALSE; + m_dwCaret = ofs; + m_bBlock = TRUE; + NSLog(@"m_bBlock==TRUE"); + if([self DrawCaret]) + { + //Invalidate(FALSE); + } else { + m_dwCaret = dwCaretOld; + m_caretRect.origin = ptCaretOld; + } + } + } else { + //RECT r; + //GetClientRect(&r); + if((pt.y < 0 || pt.y > _bounds.size.height + _bounds.origin.y) && !m_draggingTimer) + m_draggingTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:pt.y < 0 ? @selector(OnTimerUp:):@selector(OnTimerDown:) userInfo:nil repeats:YES];//SetTimer(pt.y < 0 ? TIMER_UP : TIMER_DOWN, 50, NULL); + } +// } + //CTextView::OnMouseMove(nFlags, point); +} + +- (void)OnTimerUp:(NSTimer *)timer +{ + [self keyDownWithUnichar:NSUpArrowFunctionKey bCtrl:FALSE bShift:TRUE]; + [self OnCharWithUnichar:NSUpArrowFunctionKey]; +} +-(void)OnTimerDown:(NSTimer *)timer +{ + [self keyDownWithUnichar:NSDownArrowFunctionKey bCtrl:FALSE bShift:TRUE]; + [self OnCharWithUnichar:NSDownArrowFunctionKey]; +} + +- (void)OnLButtonUp +{ + //ReleaseCapture(); + if(m_draggingTimer) { + [m_draggingTimer invalidate];//KillTimer(m_timer); + m_draggingTimer = nil; + } + //CTextView::OnLButtonUp(nFlags, point); +} + +- (BOOL)acceptsFirstResponder {return YES;} + +- (void)keyDown:(NSEvent *)theEvent +{ + if ([[theEvent characters] length] == 0) return; + unichar key = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; + BOOL bCtrl = [theEvent modifierFlags] & NSControlKeyMask; + BOOL bShift = ([theEvent modifierFlags] & NSShiftKeyMask );//|| GetKeyState(VK_LBUTTON) < 0); + [self keyDownWithUnichar:key bCtrl:bCtrl bShift:bShift]; + [self OnCharWithUnichar:key]; +} + +- (void)keyDownWithUnichar:(unichar)key bCtrl:(BOOL)bCtrl bShift:(BOOL)bShift +{ + //NSLog(@"keyDownFromUnichar"); + __uint64_t dwNewCaret = m_dwCaret; + + switch (key) { + case NSRightArrowFunctionKey: + if(dwNewCaret0)dwNewCaret--; + break; + case NSDownArrowFunctionKey: + dwNewCaret += 16; + if(dwNewCaret < m_dwCaret) dwNewCaret = m_dwCaret; + break; + case NSUpArrowFunctionKey: + if(dwNewCaret>=16)dwNewCaret -= 16; + break; + + default: + //[super keyDown:theEvent]; + break; + } + m_bEnterVal = FALSE; + if(!m_bBlock && bShift) { + m_dwBlock = m_dwCaret; + m_bBlock = TRUE; + NSLog(@"m_bBlock==TRUE"); + } else if(m_bBlock && !bShift) { + NSLog(@"m_bBlock==FALSE"); + m_bBlock = FALSE; + //Invalidate(FALSE); + } + if(m_caretRect.origin.x == -1) { + if(dwNewCaret <= m_dwTotal) { // ### 1.62 + m_dwCaret = dwNewCaret; + [self GotoCaret];//GotoCaret(); + } + } else + [self MoveCaretTo:dwNewCaret];//MoveCaretTo(dwNewCaret); + + //[self setNeedsDisplay:YES]; + return; +Error: + //MessageBeep(MB_NOFOCUS); + return; +} + + +-(void)OnCharWithUnichar:(unichar)nChar +{ + static unichar preChar = 0; + __uint8_t* p; + + if (nChar < ' ' || nChar >= 256) + return; + if (m_pDoc->m_bReadOnly) + goto Error; + if (!m_bEnterVal && !preChar) { + __uint64_t dwSize = 1; + /* if(m_bCaretOnChar && (m_charset == CTYPE_UNICODE || (m_charset > CTYPE_UNICODE) && _ismbblead((BYTE)nChar))) { + if(m_charset == CTYPE_UTF8) // ### 1.54b + dwSize = 3; + else + dwSize = 2; + } + if(m_bIns || (m_dwCaret == m_dwTotal)) { + if([m_pDoc IsFileMapping]) goto Error; + m_pDoc->StoreUndo(m_dwCaret, dwSize, UNDO_DEL); + m_pDoc->InsertData(m_dwCaret, dwSize, TRUE); + [self UpdateDocSize];//UpdateDocSize(); + } else { + m_pDoc->StoreUndo(m_dwCaret, dwSize, UNDO_OVR); + }*/ + } + m_bBlock = FALSE; + p = [m_pDoc GetDocPtr] + m_dwCaret;//m_pDoc->GetDocPtr() + m_dwCaret; + if(!m_bCaretOnChar) { + if(nChar >= '0' && nChar <= '9') + nChar -= '0'; + else if(nChar >= 'A' && nChar <= 'F') + nChar -= 'A' - 10; + else if(nChar >= 'a' && nChar <= 'f') + nChar -= 'a' - 10; + else + goto Error; + if(m_bEnterVal) { + __uint8_t nVal = *p; + nChar |= nVal<<4; + m_bEnterVal = FALSE; + } else + m_bEnterVal = TRUE; + } else if(m_charset >= CTYPE_UNICODE) { + char mbs[4]; + char* pb = mbs; + if(preChar) { + *pb++ = preChar; + preChar = 0; + } /*else if(_ismbblead((BYTE)nChar)) { + preChar = nChar; + return; + }*/ + *pb++ = (char)nChar; + *pb++ = 0; + __uint8_t* buffer = NULL; + /* int len = ConvertCharSet(m_charset, mbs, buffer); + if(len) { + if(m_charset == CTYPE_UNICODE) len *= 2; + pb = (char*)buffer; + for (int i = 0; i m_dwTotal) { + dwNewCaret = m_dwTotal; + } + + [self setNeedsDisplayInRect:m_caretRect];m_bCaretOn = FALSE; + int dy = dwNewCaret/16 - m_dwCaret/16; + m_dwCaret = dwNewCaret; + if(![self DrawCaret])//DrawCaret()) + { + [self ScrollBy:0 dy:dy bScrl:!m_bBlock];//ScrollBy(0, dy, !m_bBlock); + } + //if(m_bBlock)Invalidate(FALSE); +} + +/*- (void)openDocument:(id)sender +{ + + NSDocumentController* dc = [NSDocumentController sharedDocumentController]; + [dc newDocument:sender]; + [dc openDocument:sender]; +}*/ + +//- (BOOL)validateUserInterfaceItem:(id )anItem +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + SEL theAction = [menuItem action]; + BZOptions *bzopt = [BZOptions sharedInstance]; + + if (theAction == @selector(OnCharmodeAscii:)) { + [menuItem setState:(m_charset==CTYPE_ASCII)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeSJIS:)) { + [menuItem setState:(m_charset==CTYPE_SJIS)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeUTF16:)) { + [menuItem setState:(m_charset==CTYPE_UNICODE)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeUTF8:)) { + [menuItem setState:(m_charset==CTYPE_UTF8)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeJIS:)) { + [menuItem setState:(m_charset==CTYPE_JIS)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeEUC:)) { + [menuItem setState:(m_charset==CTYPE_EUC)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeEBCDIC:)) { + [menuItem setState:(m_charset==CTYPE_EBCDIC)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeEPWING:)) { + [menuItem setState:(m_charset==CTYPE_EPWING)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnCharmodeAutoDetect:)) { + [menuItem setState:(bzopt->bAutoDetect)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnByteOrderIntel:)) { + [menuItem setState:!(bzopt->bByteOrder)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnByteOrderMotorola:)) { + [menuItem setState:(bzopt->bByteOrder)? NSOnState:NSOffState]; + } + return YES; +} + +- (IBAction)OnCharmodeAscii:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_ASCII; +// options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeSJIS:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_SJIS; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeUTF16:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_UNICODE; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeUTF8:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_UTF8; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeJIS:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_JIS; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeEUC:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_EUC; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeEBCDIC:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_EBCDIC; + [[BZEbcDic sharedInstance] LoadEbcDicTable];//LoadEbcDicTable(); + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +- (IBAction)OnCharmodeEPWING:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_charset = bzopt->charset = CTYPE_EPWING; + // options.Touch(); + [self setNeedsDisplay:YES];//Invalidate(TRUE); + BZView* pView = [self GetBrotherView:self]; + if(pView) { + pView->m_charset = m_charset; + [pView setNeedsDisplay:YES];//pView->Invalidate(TRUE); + } +} +-(void)OnCharmodeAutoDetect:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + bzopt->bAutoDetect = !bzopt->bAutoDetect; +} + +-(void)OnByteOrderIntel:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + bzopt->bByteOrder = FALSE; + //GetMainFrame()->UpdateInspectViewChecks(); +} +-(void)OnByteOrderMotorola:(id)sender +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + bzopt->bByteOrder = TRUE; + //GetMainFrame()->UpdateInspectViewChecks(); +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.h new file mode 100644 index 0000000..bff8454 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.h @@ -0,0 +1,15 @@ +// +// BZViewController.h +// TamaBinary +// +// Created by ad on 13/01/07. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import + +@interface BZViewController : NSViewController + +@property (assign) IBOutlet id bzview; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.m new file mode 100644 index 0000000..7aa14b2 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.m @@ -0,0 +1,25 @@ +// +// BZViewController.m +// TamaBinary +// +// Created by ad on 13/01/07. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZViewController.h" + +@implementation BZViewController + +@synthesize bzview; + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Initialization code here. + } + + return self; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.xib b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.xib new file mode 100644 index 0000000..40abf69 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZViewController.xib @@ -0,0 +1,302 @@ + + + + 1070 + 11G63 + 2844 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2844 + + + NSCustomObject + NSCustomView + NSStepper + NSStepperCell + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + BZViewController + + + FirstResponder + + + NSApplication + + + + 274 + + + + 289 + {{333, 12}, {19, 27}} + + + _NS:1099 + YES + + 786464 + 0 + _NS:1099 + + 100 + 1 + YES + + + + + 290 + {335, 15} + + + _NS:9 + NSScroller + + + + 273 + {{335, 39}, {15, 261}} + + + + _NS:9 + NSScroller + + + + 274 + {{0, 15}, {335, 285}} + + + + _NS:9 + BZView + + + {350, 300} + + + + NSView + + + + + + + view + + + + 22 + + + + bzview + + + + 23 + + + + onVScroll: + + + + 9 + + + + vScroller + + + + 6 + + + + onHScroll: + + + + 8 + + + + hScroller + + + + 7 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + + + + + + + + + 3 + + + + + 5 + + + + + 4 + + + + + 24 + + + + + + + + 25 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 25 + + + + + BZView + TextView + + IBProjectSource + ./Classes/BZView.h + + + + BZViewController + NSViewController + + bzview + id + + + bzview + + bzview + id + + + + IBProjectSource + ./Classes/BZViewController.h + + + + TextView + NSView + + id + id + + + + onHScroll: + id + + + onVScroll: + id + + + + id + id + + + + hScroller + id + + + vScroller + id + + + + IBProjectSource + ./Classes/TextView.h + + + + + 0 + IBCocoaFramework + YES + 3 + + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.h new file mode 100644 index 0000000..ab159a5 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.h @@ -0,0 +1,73 @@ +// +// BZWindow.h +// TamaBinary +// +// Created by ad on 13/01/04. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import +#import "BZViewController.h" +#import "BZView.h" +#import "BZBmpViewController.h" + +enum SplitType { SPLIT_NONE=0, SPLIT_H=1, SPLIT_V=2 }; + +@class BZView; + +@interface BZWindow : NSWindow +{ + @public + BZViewController *m_bzViewController1; + BZViewController *m_bzViewController2; + NSViewController *m_subViewController1; + NSViewController *m_subViewController2; + + NSSplitView *m_splitDoc; + NSSplitView *m_splitDoc1; + NSSplitView *m_splitDoc2; + + BOOL m_bBmpView; + BOOL m_bStructView; + BOOL m_bInspectView; + BOOL m_bAnalyzerView; + + enum SplitType m_nSplitView; + enum SplitType m_nSplitView0; + + BOOL m_isActiveView1; +} + +- (void)OnCreateClient; +- (BOOL)CreateClient; +- (void)RemoveAllBZViews; + +- (BZView*)GetBrotherView:(BZView*)view; +- (BZView*)GetActiveView; + +- (IBAction)OnViewBitmap:(id)sender; +- (IBAction)OnViewStruct:(id)sender; +- (IBAction)OnViewInspect:(id)sender; +- (IBAction)OnViewAnalyzer:(id)sender; + +- (IBAction)OnCharmodeAscii:(id)sender; +- (IBAction)OnCharmodeSJIS:(id)sender; +- (IBAction)OnCharmodeUTF16:(id)sender; +- (IBAction)OnCharmodeUTF8:(id)sender; +- (IBAction)OnCharmodeJIS:(id)sender; +- (IBAction)OnCharmodeEUC:(id)sender; +- (IBAction)OnCharmodeEBCDIC:(id)sender; +- (IBAction)OnCharmodeEPWING:(id)sender; +- (IBAction)OnCharmodeAutoDetect:(id)sender; + +- (IBAction)OnByteOrderIntel:(id)sender; +- (IBAction)OnByteOrderMotorola:(id)sender; + +- (IBAction)OnViewSplitH:(id)sender; +- (IBAction)OnViewSplitV:(id)sender; + +- (IBAction)OnFileSaveDumpList:(id)sender; + +- (IBAction)openDocumentWithClose:(id)sender; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.m new file mode 100644 index 0000000..b35d089 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindow.m @@ -0,0 +1,388 @@ +// +// BZWindow.m +// TamaBinary +// +// Created by ad on 13/01/04. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZWindow.h" + +@implementation BZWindow + +- (id)init +{ + self = [super init]; + if (self) { + // Add your subclass-specific initialization here. + m_bBmpView = m_bStructView = m_bInspectView = m_bAnalyzerView = FALSE; + m_nSplitView = m_nSplitView0 = SPLIT_NONE; + m_isActiveView1 = TRUE; + } + return self; +} +/* +- (BOOL)acceptsFirstResponder +{ + return YES; +} + */ + +- (void)OnCreateClient +{ + BZOptions *bzopt = [BZOptions sharedInstance]; + m_bStructView = bzopt->bStructView; + m_bInspectView = bzopt->bInspectView; + m_bAnalyzerView = bzopt->bAnalyzerView; + [self CreateClient]; +} + +- (BOOL)CreateClient +{ + [self RemoveAllBZViews]; + + m_isActiveView1 = true; + + BOOL bSubView = (m_bBmpView || m_bStructView || m_bInspectView || m_bAnalyzerView); + //BZOptions *bzopt = [BZOptions sharedInstance]; + + m_splitDoc1 = [[NSSplitView alloc] initWithFrame:[self.contentView bounds]]; + [m_splitDoc1 setVertical:YES]; + [m_splitDoc1 setAutoresizingMask:NSViewMinXMargin | NSViewWidthSizable | NSViewMaxXMargin | NSViewMinYMargin | NSViewHeightSizable | NSViewMaxYMargin]; + [m_splitDoc1 setAutoresizesSubviews:YES]; + + if (m_bBmpView) { + m_subViewController1 = [[BZBmpViewController alloc] initWithNibName:@"BZBmpViewController" bundle:[NSBundle mainBundle]]; + [m_subViewController1.view setFrame:NSMakeRect(0, 0, 100, 400)]; + [m_splitDoc1 addSubview:m_subViewController1.view]; + } + if(m_bzViewController1==nil) + { + m_bzViewController1 = [[BZViewController alloc] initWithNibName:@"BZViewController" bundle:[NSBundle mainBundle]]; + [m_splitDoc1/*self.contentView*/ addSubview:m_bzViewController1.view]; + ((BZView*)m_bzViewController1.bzview)->m_isDoc1 = true; + } + [m_splitDoc1 adjustSubviews]; + + if (m_nSplitView!=SPLIT_NONE) + { + m_splitDoc = [[NSSplitView alloc] initWithFrame:[self.contentView bounds]]; + [m_splitDoc setVertical:m_nSplitView==SPLIT_V]; + [m_splitDoc setAutoresizingMask:NSViewMinXMargin | NSViewWidthSizable | NSViewMaxXMargin | NSViewMinYMargin | NSViewHeightSizable | NSViewMaxYMargin]; + [m_splitDoc setAutoresizesSubviews:YES]; + + m_splitDoc2 = [[NSSplitView alloc] initWithFrame:[self.contentView bounds]]; + [m_splitDoc2 setVertical:YES]; + [m_splitDoc2 setAutoresizingMask:NSViewMinXMargin | NSViewWidthSizable | NSViewMaxXMargin | NSViewMinYMargin | NSViewHeightSizable | NSViewMaxYMargin]; + [m_splitDoc2 setAutoresizesSubviews:YES]; + + if (m_bBmpView) { + m_subViewController2 = [[BZBmpViewController alloc] initWithNibName:@"BZBmpViewController" bundle:[NSBundle mainBundle]]; + [m_subViewController2.view setFrame:NSMakeRect(0, 0, 100, 400)]; + [m_splitDoc2 addSubview:m_subViewController2.view]; + } + if(m_bzViewController2==nil) + { + m_bzViewController2 = [[BZViewController alloc] initWithNibName:@"BZViewController" bundle:[NSBundle mainBundle]]; + [m_splitDoc2/*self.contentView*/ addSubview:m_bzViewController2.view]; + ((BZView*)m_bzViewController2.bzview)->m_isDoc1 = false; + } + [m_splitDoc2 adjustSubviews]; + + + [self.contentView addSubview:m_splitDoc]; + [m_splitDoc addSubview:m_splitDoc1]; + [m_splitDoc addSubview:m_splitDoc2]; + + if (bSubView) + { + m_splitDoc1.delegate = self; + m_splitDoc2.delegate = self; + } + } else { + [self.contentView addSubview:m_splitDoc1]; + } + + [m_bzViewController1.bzview OnUpdate]; + if(m_bzViewController2) { + [m_bzViewController2.bzview OnUpdate]; + [m_bzViewController2.bzview StopCaret]; + } + return true; +} + +- (void)RemoveAllBZViews +{ + if(m_bzViewController1) + { + [m_bzViewController1.view removeFromSuperview]; + m_bzViewController1 = nil; + } + if(m_bzViewController2) + { + [m_bzViewController2.view removeFromSuperview]; + m_bzViewController2 = nil; + } + if(m_subViewController1) + { + [m_subViewController1.view removeFromSuperview]; + m_subViewController1 = nil; + } + if(m_subViewController2) + { + [m_subViewController2.view removeFromSuperview]; + m_subViewController2 = nil; + } + if(m_splitDoc1) + { + m_splitDoc1.delegate = nil; + [m_splitDoc1 removeFromSuperview]; + m_splitDoc1 = nil; + } + if(m_splitDoc2) + { + m_splitDoc2.delegate = nil; + [m_splitDoc2 removeFromSuperview]; + m_splitDoc2 = nil; + } + if(m_splitDoc) + { + [m_splitDoc removeFromSuperview]; + m_splitDoc = nil; + } +} + +- (BZView *)GetBrotherView:(BZView *)view +{ + BZView *bzview1 = [m_bzViewController1 bzview]; + BZView *bzview2 = [m_bzViewController2 bzview]; + if (view == bzview1) + return bzview2; + else if (view == bzview2) + return bzview1; + return nil; +} + +- (BZView *)GetActiveView +{ + if (m_isActiveView1) + return m_bzViewController1 ?m_bzViewController1.bzview:nil; + else + return m_bzViewController2 ?m_bzViewController2.bzview:nil; +} + + +//- (BOOL)validateUserInterfaceItem:(id )anItem +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + SEL theAction = [menuItem action]; + BZOptions *bzopt = [BZOptions sharedInstance]; + + if (theAction == @selector(OnViewBitmap:)) { + [menuItem setState:(m_bBmpView)? NSOnState:NSOffState]; + BZView *bzviewA = [self GetActiveView]; + if (bzviewA==nil) return NO; + Document *pDoc = [bzviewA GetDocument]; + return [pDoc GetDocSize] >= (bzopt->nBmpWidth * bzopt->nBmpColorWidth / 8); + } else if (theAction == @selector(OnViewStruct:)) { + [menuItem setState:(m_bStructView)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnViewInspect:)) { + [menuItem setState:(m_bInspectView)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnViewAnalyzer:)) { + [menuItem setState:(m_bAnalyzerView)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnViewSplitH:)) { + [menuItem setState:(m_nSplitView==SPLIT_H)? NSOnState:NSOffState]; + } else if (theAction == @selector(OnViewSplitV:)) { + [menuItem setState:(m_nSplitView==SPLIT_V)? NSOnState:NSOffState]; + } + return YES; +} + +- (IBAction)OnViewBitmap:(id)sender +{ + //GetSplitInfo(); + m_bBmpView = !m_bBmpView; + m_bStructView = m_bInspectView = m_bAnalyzerView = FALSE; + [self CreateClient]; +} +- (IBAction)OnViewStruct:(id)sender +{ + //GetSplitInfo(); + m_bStructView = !m_bStructView; + m_bBmpView = m_bInspectView = m_bAnalyzerView = FALSE; + [self CreateClient]; +} +- (IBAction)OnViewInspect:(id)sender +{ + //GetSplitInfo(); + m_bInspectView = !m_bInspectView; + m_bBmpView = m_bStructView = m_bAnalyzerView = FALSE; + [self CreateClient]; +} +- (IBAction)OnViewAnalyzer:(id)sender +{ + //GetSplitInfo(); + m_bAnalyzerView = !m_bAnalyzerView; + m_bBmpView = m_bStructView = m_bInspectView = FALSE; + [self CreateClient]; +} + + +//MenuItem Reflectors +- (IBAction)OnCharmodeAscii:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeAscii:sender]; +} +- (IBAction)OnCharmodeSJIS:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeJIS:sender]; +} +- (IBAction)OnCharmodeUTF16:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeUTF16:sender]; +} +- (IBAction)OnCharmodeUTF8:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeUTF8:sender]; +} +- (IBAction)OnCharmodeJIS:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeJIS:sender]; +} +- (IBAction)OnCharmodeEUC:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeEUC:sender]; +} +- (IBAction)OnCharmodeEBCDIC:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeEBCDIC:sender]; +} +- (IBAction)OnCharmodeEPWING:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeEPWING:sender]; +} +- (IBAction)OnCharmodeAutoDetect:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnCharmodeAutoDetect:sender]; +} + +- (IBAction)OnByteOrderIntel:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnByteOrderIntel:sender]; +} +- (IBAction)OnByteOrderMotorola:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) [bzviewA OnByteOrderMotorola:sender]; +} + +- (IBAction)OnViewSplitH:(id)sender +{ + //options.nCmdShow=SW_SHOWNORMAL; + //ShowWindow(options.nCmdShow); + + //GetSplitInfo(); + m_nSplitView0 = m_nSplitView; + if (m_nSplitView==SPLIT_H) { + m_nSplitView = SPLIT_NONE; + } else { + m_nSplitView = SPLIT_H; + BZWindowController *winController = self.windowController; + if (winController->m_doc2==nil) { + winController->m_doc2 = [[Document alloc] init]; + } + } + [self CreateClient]; + [m_bzViewController1.bzview InitCaret]; + m_nSplitView0 = m_nSplitView; +} +- (IBAction)OnViewSplitV:(id)sender +{ + //options.nCmdShow=SW_SHOWNORMAL; + //ShowWindow(options.nCmdShow); + + //GetSplitInfo(); + m_nSplitView0 = m_nSplitView; + if (m_nSplitView==SPLIT_V) { + m_nSplitView = SPLIT_NONE; + } else { + m_nSplitView = SPLIT_V; + BZWindowController *winController = self.windowController; + if (winController->m_doc2==nil) { + winController->m_doc2 = [[Document alloc] init]; + } + } + [self CreateClient]; + [m_bzViewController1.bzview InitCaret]; + m_nSplitView0 = m_nSplitView; +} +- (IBAction)OnFileSaveDumpList:(id)sender +{ + BZView *bzviewA = [self GetActiveView]; + if(bzviewA) + { + NSSavePanel *savePanel = [NSSavePanel savePanel]; + [savePanel setAllowedFileTypes:[NSArray arrayWithObjects:@"lst", @"lst", nil]]; + NSInteger retCode = [savePanel runModal]; + if (retCode==NSOKButton) { + [bzviewA DrawToFile:[savePanel URL]]; + } + } +} + +- (void)splitViewDidResizeSubviews:(NSNotification *)notification +{ + NSSplitView *splitView = (NSSplitView*)[notification object]; + if (splitView == m_splitDoc1) { + [m_subViewController2.view setFrame:m_subViewController1.view.frame]; + } else { + [m_subViewController1.view setFrame:m_subViewController2.view.frame]; + } +} + + +- (IBAction)openDocument:(id)sender +{ + NSLog(@"openDocumet"); + [Document setIsNewWindow:TRUE]; + NSDocumentController* dc = [NSDocumentController sharedDocumentController]; + // [dc newDocument:sender]; + [dc openDocument:sender]; +} + +- (IBAction)openDocumentWithClose:(id)sender +{ + NSLog(@"openDocumentWithClose"); + [Document setIsNewWindow:FALSE]; + NSDocumentController* dc = [NSDocumentController sharedDocumentController]; + [dc openDocument:sender]; +} + +- (void)becomeMainWindow +{ + if (m_isActiveView1 && m_bzViewController1) [m_bzViewController1.bzview InitCaret]; + else if (!m_isActiveView1 && m_bzViewController2) [m_bzViewController2.bzview InitCaret]; + //NSLog(@"becomeMainWindiw"); + [super becomeMainWindow]; +} + +- (void)resignMainWindow +{ + if (m_isActiveView1 && m_bzViewController1) [m_bzViewController1.bzview StopCaret]; + else if (!m_isActiveView1 && m_bzViewController2) [m_bzViewController2.bzview StopCaret]; + //NSLog(@"resignMainWindow"); + [super resignMainWindow]; +} + + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.h b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.h new file mode 100644 index 0000000..431899c --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.h @@ -0,0 +1,22 @@ +// +// BZWindowController.h +// TamaBinary +// +// Created by ad on 13/01/08. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import +#import "Document.h" + +@class Document; + +@interface BZWindowController : NSWindowController +{ +@public + Document *m_doc1; + Document *m_doc2; +} +- (void)setSuperDocumentIsDoc1:(BOOL)isDoc1; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.m b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.m new file mode 100644 index 0000000..dc0cbb2 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/BZWindowController.m @@ -0,0 +1,101 @@ +// +// BZWindowController.m +// TamaBinary +// +// Created by ad on 13/01/08. +// Copyright (c) 2013年 tamachanbinary. All rights reserved. +// + +#import "BZWindowController.h" + +@interface BZWindowController () + +@end + +@implementation BZWindowController + +- (id)initWithWindow:(NSWindow *)window +{ + self = [super initWithWindow:window]; + if (self) { + // Initialization code here. + } + + return self; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. + /*BZWindow *bzwnd = (BZWindow*)self.window; + [bzwnd OnCreateClient];*/ +} + +-(void)setDocument:(NSDocument *)document +{ + if (document==nil) { + return; + } + BZWindow *bzWnd = (BZWindow*)self.window; + NSLog(@"setDocment %llX, isNewWnd=%d, activeView=%d", document, [Document isNewWindow], bzWnd->m_isActiveView1?1:2); + [bzWnd RemoveAllBZViews]; + + if (![Document isNewWindow] && !(bzWnd->m_isActiveView1)) + { + if (m_doc2) { + [m_doc2 CloseDocument]; + [[NSDocumentController sharedDocumentController] removeDocument:m_doc2]; + //m_doc2 = nil; + } + m_doc2 = (Document*)document; + [super setDocument:document]; + } else { + if (m_doc1) { + [m_doc1 CloseDocument]; + [[NSDocumentController sharedDocumentController] removeDocument:m_doc1]; + //m_doc1 = nil; + } + m_doc1 = (Document*)document; + [super setDocument:document]; + } + + [bzWnd CreateClient]; + + /*if (m_doc1) + { + BZView* bzview1 = ((BZWindow*)self.window)->m_bzViewController1.bzview; + if (bzview1) [bzview1 OnUpdate]; + }*/ +} + +- (void)setSuperDocumentIsDoc1:(BOOL)isDoc1 +{ + if (isDoc1 && m_doc1) { + [super setDocument:m_doc1]; + } else if (!isDoc1 && m_doc2) { + [super setDocument:m_doc2]; + } +} + +-(id)document +{ + return m_doc1; +} + +- (void)dealloc +{ + if (m_doc1) { + [m_doc1 CloseDocument]; + [[NSDocumentController sharedDocumentController] removeDocument:m_doc1]; + m_doc1 = nil; + } + if (m_doc2) { + [m_doc2 CloseDocument]; + [[NSDocumentController sharedDocumentController] removeDocument:m_doc2]; + m_doc2 = nil; + } +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/Document.h b/MacOSX/BZEditorOSX/BZEditorOSX/Document.h new file mode 100644 index 0000000..7d81bd5 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/Document.h @@ -0,0 +1,59 @@ +// +// Document.h +// TamaBinary +// +// Created by ad on 12/12/01. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import +//#import "BZDoc.h" +#import "BZWindow.h" +#import "BZWindowController.h" +#import "BZGlobalFunc.h" + +@class BZWindowController; + +@interface Document : NSDocument +{ + +@private + //BZWindowController *mainWindowController; + __uint8_t *m_pData; + __uint64_t m_dwTotal; + + __uint64_t m_pagingSize; //m_dwAllocationGranularity +@public + BOOL m_bReadOnly; + int m_pFileMapping; + Document *m_pDupDoc; + __uint8_t *m_pMapStart; + __uint64_t m_dwFileOffset; + __uint64_t m_dwMapSize; + // void *m_hMapping; + __uint64_t m_dwBase; +} + +-(NSWindow*)GetActiveWindow; +-(void)CloseDocument; + +- (__uint8_t*)GetDocPtr; +- (__uint64_t)GetDocSize; + + +- (BOOL)OnOpenDocument:(NSURL *)url; +//- (off_t)GetFileLength:(int)fd; +- (void)DeleteContents; +- (BOOL) IsFileMapping; +- (BOOL) MapView; +- (__uint8_t*) QueryMapView:(__uint8_t*)pBegin dwOffset:(__uint64_t)dwOffset; +- (__uint8_t*) QueryMapView1:(__uint8_t*)pBegin dwOffset:(__uint64_t)dwOffset; +- (BOOL) IsOutOfMap1:(__uint8_t*)p; + +- (__uint64_t) GetFileOffsetFromFileMappingPointer:(__uint8_t*)pConv; +- (__uint8_t*) GetFileMappingPointerFromFileOffset:(__uint64_t)dwFileOffset; + ++ (void)setIsNewWindow:(BOOL)isNewWindow; ++ (BOOL)isNewWindow; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/Document.m b/MacOSX/BZEditorOSX/BZEditorOSX/Document.m new file mode 100644 index 0000000..0ab428e --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/Document.m @@ -0,0 +1,351 @@ +// +// Document.m +// TamaBinary +// +// Created by ad on 12/12/01. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import "Document.h" +#include + +#define MAXONMEMORY 1024*1024 +#define MAXMAPSIZE 64*1024*1024 +#define READONLY true + + +@implementation Document + +static BOOL g_isNewWindow = TRUE; + ++ (void)setIsNewWindow:(BOOL)isNewWindow +{ + g_isNewWindow = isNewWindow; +} ++ (BOOL)isNewWindow +{ + return g_isNewWindow; +} + +- (id)init +{ + self = [super init]; + if (self) { + // Add your subclass-specific initialization here. + NSLog(@"Document::init()"); + m_pData = NULL; + m_dwTotal = 0; + m_bReadOnly = READONLY; + //m_hMapping = NULL; + m_pFileMapping = 0; + m_pMapStart = 0; + m_dwFileOffset = 0; + m_dwMapSize = 0; + m_dwBase = 0; + + m_pagingSize = sysconf(_SC_PAGESIZE); + } + return self; +} + +/* +- (NSString *)windowNibName +{ + // Override returning the nib file name of the document + // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. + return @"Document"; +} + +- (void)windowControllerDidLoadNib:(NSWindowController *)aController +{ + [super windowControllerDidLoadNib:aController]; + // Add any code here that needs to be executed once the windowController has loaded the document's window. +} + */ + +- (void)makeWindowControllers +{ + NSLog(@"makeWindowControllers"); + NSWindow *activeWindow = [self GetActiveWindow]; + if (!g_isNewWindow && activeWindow) { + //recycle window + [self addWindowController:activeWindow.windowController]; + } else { + //new window + BZWindowController *mainWindowController = [[BZWindowController alloc] initWithWindowNibName:@"BZWindowController"]; + [self addWindowController:mainWindowController]; + } +} + ++ (BOOL)autosavesInPlace +{ + return YES; +} + +//writefromurl ka savefromurl kamo? +- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError +{ + // Insert code here to write your document to data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning nil. + // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. + NSException *exception = [NSException exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil]; + @throw exception; + return nil; +} + +-(NSWindow *)GetActiveWindow +{ + NSUInteger max = [[NSApp windows] count]; + for (NSUInteger i = 0; im_pDupDoc = nil; + m_pDupDoc = nil; + //m_hMapping = NULL; + m_pFileMapping = 0; + } else { + if (m_pFileMapping) { + close(m_pFileMapping); + m_pFileMapping = 0; + } + } + } + + /*if (m_pUndo) { + free(m_pUndo); + m_pUndo = NULL; + }*/ + m_bReadOnly = false; +} + +/* +-(off_t)GetFileLength:(int)fd +{ + off_t fposOld = lseek(fd, 0, SEEK_CUR); //backup position + off_t fpos = lseek(fd, 0, SEEK_END); //seek to end + lseek(fd, fposOld, SEEK_SET); //restore position + if(fpos>0xffff) + { + return 0xffff; + } + return fpos; +} + */ + +-(BOOL)IsFileMapping +{ + return m_pFileMapping != 0; +} + +- (BOOL)MapView +{ + m_dwMapSize = m_dwTotal; + m_pData = mmap(NULL, m_dwMapSize, m_bReadOnly?PROT_READ : PROT_READ|PROT_WRITE, MAP_SHARED, m_pFileMapping, 0); + if (m_pData==MAP_FAILED) {//Failed + m_dwMapSize = MAXMAPSIZE; + m_pData = mmap(NULL, m_dwMapSize, m_bReadOnly?PROT_READ : PROT_READ|PROT_WRITE, MAP_SHARED, m_pFileMapping, 0); + if (m_pData!=MAP_FAILED) {//Success + m_pMapStart = m_pData; + m_dwFileOffset = 0; + } else { + return false; + } + } + return true; +} + +-(BOOL)IsOutOfMap1:(__uint8_t *)p +{ + return (p < m_pMapStart || p >= (m_pMapStart + m_dwMapSize)); +} + +-(__uint8_t *)QueryMapView:(__uint8_t *)pBegin dwOffset:(__uint64_t)dwOffset +{ + __uint8_t *p = pBegin + dwOffset; + if (m_pMapStart && [self IsOutOfMap1:p]) + return [self QueryMapView1:pBegin dwOffset:dwOffset]; + else return pBegin; +} + +-(__uint8_t *)QueryMapView1:(__uint8_t *)pBegin dwOffset:(__uint64_t)dwOffset +{ + __uint8_t *p = pBegin + dwOffset; + + if (p == m_pData + m_dwTotal && p == m_pMapStart + m_dwMapSize) + return pBegin; + + __uint64_t dwBegin = [self GetFileOffsetFromFileMappingPointer:pBegin]; + munmap(m_pMapStart, m_dwMapSize); + uint64_t dwTmp1 = [self GetFileOffsetFromFileMappingPointer:p]; + m_dwFileOffset = dwTmp1 - (dwTmp1 % m_pagingSize); + m_dwMapSize = MIN(MAXMAPSIZE, m_dwTotal - m_dwFileOffset); + if (m_dwMapSize == 0) { + dwTmp1 = (m_dwTotal - m_pagingSize); + m_dwFileOffset = dwTmp1 - (dwTmp1 % m_pagingSize); + m_dwMapSize = m_dwTotal - m_dwFileOffset; + } + m_pMapStart = mmap(NULL, m_dwMapSize, m_bReadOnly?PROT_READ : PROT_READ|PROT_WRITE, MAP_SHARED, m_pFileMapping, m_dwFileOffset); + if (!m_pMapStart) { + NSLog(@"Error: Document::QueryMapView1"); + return NULL; + } + m_pData = m_pMapStart - m_dwFileOffset; + pBegin = [self GetFileMappingPointerFromFileOffset:dwBegin]; + return pBegin; +} + +-(__uint64_t)GetFileOffsetFromFileMappingPointer:(__uint8_t *)pConv +{ + return pConv - m_pData; +} + +-(__uint8_t *)GetFileMappingPointerFromFileOffset:(__uint64_t)dwFileOffset +{ + return dwFileOffset + m_pData; +} + +-(BOOL)OnOpenDocument:(NSURL *)url +{ + int fd = open([[url path] fileSystemRepresentation], O_RDWR|O_EXLOCK/*|O_NONBLOCK*/); + if (fd==-1) { + m_bReadOnly = true; + } + close(fd); + + fd = open([[url path] fileSystemRepresentation], O_RDONLY|O_EXLOCK/*|O_NONBLOCK*/); + if(fd==-1) + { + return false;//err + } + // flock(fd, LOCK_EX|LOCK_NB); + + [self DeleteContents]; + + off_t fsize = [BZGlobalFunc GetFileLength:fd]; + if(fsize<0) + { + close(fd); + return false;//err + } + + if (fsize >= MAXONMEMORY) { //file-mpping + /*struct stat st; + if(fstat(fd, &st)==-1) + { + return false;//err + }*/ + //m_bReadOnly = /*options.bReadOnly||*/ st.mode; + if (m_bReadOnly==false) { + close(fd); + fd = open([[url path] fileSystemRepresentation], O_RDWR|O_EXLOCK/*|O_NONBLOCK*/); + if (fd == -1) { + return false;//err + } + } + m_pFileMapping = fd; + } + + m_dwTotal = fsize; + + if ([self IsFileMapping]) { + if([self MapView]==false) { + close(fd); + return false;//err + } + } else { + if (!(m_pData = malloc(m_dwTotal))) { + close(fd); + return false; + } + ssize_t totalRead = read(fd, m_pData, m_dwTotal); + if (totalRead < m_dwTotal) { + free(m_pData); + m_pData = NULL; + close(fd); + return false;//err + } + m_bReadOnly = READONLY; + } + + //munmap(data, m_dwMapSize); + close(fd); + + return true; +} + + +-(void)CloseDocument +{ + NSLog(@"Document::CloseDocument"); + [self DeleteContents]; +} + +/*-(void)close + { + NSLog(@"close"); + // [self CloseDocument]; iranai ppoi + [super close]; + }*/ + +-(void)dealloc +{ + NSLog(@"Doument::dealloc"); +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/TextView.h b/MacOSX/BZEditorOSX/BZEditorOSX/TextView.h new file mode 100644 index 0000000..59a9324 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/TextView.h @@ -0,0 +1,102 @@ +// +// TextView.h +// TamaBinary +// +// Created by ad on 12/12/05. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import +#import "BZGlobalFunc.h" + +#define DUMP_Y 1 + +@interface TextView : NSView +{ +@public + BOOL m_isDoc1; + + BOOL m_bResize; + @protected + NSInteger m_cView; + NSFont *m_font; + BOOL m_bCaretOn; + NSRect m_caretRect; + NSTimer *m_caretTimer; + + BOOL m_bIns; + + NSColor* m_colText; + NSColor* m_colBk; + + TAMASize m_cTotal; + NSMutableString *m_pVText; + NSUInteger m_nText; + int m_nPages; + + TAMASize m_cell; + TAMASize m_ptHome; + + int m_xLoc, m_yLoc; + + FILE *m_pFile; + +@private + NSInteger m_scrollMin, m_scrollMax; +} + +@property (assign) IBOutlet id vScroller; +@property (assign) IBOutlet id hScroller; + +- (IBAction)onVScroll:(id)sender; +- (IBAction)onHScroll:(id)sender; + +- (TAMASize)GetScrollPos; +- (void)ScrollToPos:(NSInteger)vertPos; +//- (NSInteger)GetWinScrollPosWithMacScrollVal:(double)macPos; +//- (double)GetMacScrollValWithWinScrollPos:(NSInteger)winPos; +- (void)SetScrollHome:(TAMASize)ptHome; + +- (void)ScrlBarRange:(long*)val; +- (void)ScrollClient:(int)dx dy:(int)dy; +- (void)ScrollBy:(int)dx dy:(int)dy bScrl:(BOOL)bScrl; + +- (void)MyInitTextView; +- (BOOL)IsToFile; + +- (void)SetViewSize:(NSInteger)cView; +- (NSInteger)GetViewWidth; + +- (void)SetDefaultFont; +- (void)OnChangeFont; +- (void)InitCaret; +- (void)InitCaret:(BOOL)bShow; +- (void)BlinkCaret:(NSTimer*)timer; +- (void)StopCaret; + +- (void)SetTextSize:(TAMASize)cTotal; + +- (void)SetColorByNSColor:(NSColor*)colText colBk:(NSColor*)colBk; +- (void)PutChar; +- (void)PutChar:(NSString*)c; +- (void)PutChar:(NSString*)c n:(int)n; +- (void)PutStr:(NSString*)str; +- (void)PutStr:(NSString *)str length:(int)len; + +- (void)PutBegin; +- (void)PutEnd; +- (void)PutFlush; + +-(void)Locate:(int)x y:(int)y; + + +//-(void)PixelToGrid:(TAMASize*)pt; +-(void)PixelToGridFromNSPoint:(NSPoint*)pt; +-(void)PixelToGridFromTAMARect:(TAMARect*)rect; +-(void)GridToPixel:(TAMASize*)pt; + +-(void)InitScrollBar; + +- (void)MoveCaret:(TAMASize)pt; + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/TextView.m b/MacOSX/BZEditorOSX/BZEditorOSX/TextView.m new file mode 100644 index 0000000..caeb372 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/TextView.m @@ -0,0 +1,478 @@ +// +// TextView.m +// TamaBinary +// +// Created by ad on 12/12/05. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import "TextView.h" + +@implementation TextView + +@synthesize vScroller, hScroller; + + + +-(void)scrollWheel:(NSEvent *)theEvent +{ + //NSLog(@"scrollWheel deltaY = %f", theEvent.deltaY); + CGFloat y = [vScroller doubleValue]; + y -= theEvent.deltaY * 3.0 * 3.0 / m_cTotal.height; + if (y < 0.0) y = 0.0; + else if(y > 1.0) y = 1.0; + [vScroller setDoubleValue:y]; + + CGFloat x = [hScroller doubleValue]; + x -= theEvent.deltaX * 3.0 * 3.0 / m_cTotal.width; + if (x < 0.0) x = 0.0; + else if(x > 1.0) x = 1.0; + [hScroller setDoubleValue:x]; + + [self setNeedsDisplay:YES]; +} + +-(void)onVScroll:(id)sender +{ + double curVal = [sender doubleValue]; + NSScrollerPart part = [sender hitPart]; + switch (part) { + case NSScrollerKnob: + //curVal = [sender doubleValue]; + break; + case NSScrollerIncrementPage: + //curVal = (curVal*m_cTotal.height+16)/m_cTotal.height; + curVal += 16.0/m_cTotal.height; + break; + case NSScrollerDecrementPage: + //curVal = (curVal*m_cTotal.height-16)/m_cTotal.height; + curVal -= 16.0/m_cTotal.height; + break; + case NSScrollerIncrementLine: + curVal += 0.1; + break; + case NSScrollerDecrementLine: + curVal -= 0.1; + break; + + // case NSScrollerKnobSlot: + // NSLog(@"NSScrollerKnobSlot"); + // break; + default: + return; + } + + if (curVal < 0.0) curVal = 0.0; + else if(curVal > 1.0) curVal = 1.0; + + [sender setDoubleValue:curVal]; + [self setNeedsDisplay:YES]; +} + +-(void)onHScroll:(id)sender +{ + double curVal = [sender doubleValue]; + NSScrollerPart part = [sender hitPart]; + switch (part) { + case NSScrollerKnob: + //curVal = [sender doubleValue]; + break; + case NSScrollerIncrementPage: + //curVal = (curVal*m_cTotal.width+16)/m_cTotal.width; + curVal += 16.0/m_cTotal.width; + break; + case NSScrollerDecrementPage: + //curVal = (curVal*m_cTotal.width-16)/m_cTotal.width; + curVal -= 16.0/m_cTotal.width; + break; + case NSScrollerIncrementLine: + curVal += 0.1; + break; + case NSScrollerDecrementLine: + curVal -= 0.1; + break; + + // case NSScrollerKnobSlot: + // NSLog(@"NSScrollerKnobSlot"); + // break; + default: + return; + } + + if (curVal < 0.0) curVal = 0.0; + else if(curVal > 1.0) curVal = 1.0; + + [sender setDoubleValue:curVal]; + [self setNeedsDisplay:YES]; +} + +-(TAMASize)GetScrollPos +{ + TAMASize pt; + double maxlineW = _bounds.size.width / m_cell.width; + pt.x = [hScroller doubleValue]*MAX((double)m_cTotal.width-maxlineW, 0.0); + pt.y = [vScroller doubleValue]*MAX((double)(m_cTotal.height)-1.0-(double)DUMP_Y, 0.0); + //pt.width = [self GetWinScrollPosWithMacScrollVal:[hScroller doubleValue]]; + //pt.height = [self GetWinScrollPosWithMacScrollVal:[vScroller doubleValue]]; + + //NSLog(@"GetScrollPos:%ld,%ld",pt.x, pt.y); + + return pt; +} + +-(void)ScrollToPos:(NSInteger)vertPos +{ + //NSLog(@"ScrollToPos:%ld",vertPos); + double scrollPos = (double)vertPos / (double)(m_cTotal.height); + if (scrollPos > 1.0) scrollPos = 1.0; + else if (scrollPos < 0.0) scrollPos = 0.0; + //double scrollPos = [self GetMacScrollValWithWinScrollPos:vertPos]; + [vScroller setDoubleValue:scrollPos]; +} + +/* +-(NSInteger)GetWinScrollPosWithMacScrollVal:(double)macVal +{ + double scrollWidth = m_scrollMax - m_scrollMin; + return m_scrollMin + round(scrollWidth * macVal); +} +- (double)GetMacScrollValWithWinScrollPos:(NSInteger)winPos +{ + if (winPos < m_scrollMin)winPos = m_scrollMin; + else if (winPos > m_scrollMax)winPos = m_scrollMax; + + double scrollWidth = m_scrollMax - m_scrollMin; + double scrollVal = winPos - m_scrollMin; + return scrollVal / scrollWidth; +}*/ + +- (void)SetScrollHome:(TAMASize)ptHome +{ + m_ptHome = ptHome; +} + +-(void)ScrlBarRange:(long *)val +{ + //NSLog(@"ScrlBarRange:%ld",*val); + long nMax = m_cTotal.height - 16 + 1; + *val = MIN(MAX(*val, 0), nMax); + //NSLog(@" :%ld",*val); +} + +-(void)ScrollClient:(int)dx dy:(int)dy +{ + //NSRect rClient; + //rClient = _bounds; + //if(!dy) rClient.origin.x = m_ptHome.x*m_cell.cx; + //if(!dx) rClient.origin.y = m_ptHome.y*m_cell.cy; + //m_ptCaret2.x += dx; // ### 1.62 + //m_ptCaret2.y += dy; + //ScrollWindow(dx*m_cell.cx, dy*m_cell.cy, &rClient, &rClient); + + //NSLog(@"ScrollClient:%d,%d", dx,dy); + + double curVal = [hScroller doubleValue]; + curVal -= (double)dx/(double)(m_cTotal.width); + if (curVal < 0.0) curVal = 0.0; + else if(curVal > 1.0) curVal = 1.0; + [hScroller setDoubleValue:curVal]; + + curVal = [vScroller doubleValue]; + //NSLog(@" v_scr = %f,%f",[hScroller doubleValue],[vScroller doubleValue]); + curVal -= (double)dy/(double)(m_cTotal.height); + if (curVal < 0.0) curVal = 0.0; + else if(curVal > 1.0) curVal = 1.0; + //NSLog(@" v_scr = %f",curVal); + [vScroller setDoubleValue:curVal]; + + [self setNeedsDisplay:YES]; +} + +-(void)ScrollBy:(int)dx dy:(int)dy bScrl:(BOOL)bScrl +{ + //NSLog(@"ScrollBy:%d,%d,%d",dx,dy,bScrl); + //NSLog(@" scr1 = %f,%f",[hScroller doubleValue],[vScroller doubleValue]); + TAMASize pt = [self GetScrollPos]; + pt.x += dx; + pt.y += dy; + //NSLog(@" scr2 = %f,%f",[hScroller doubleValue],[vScroller doubleValue]); + //NSLog(@" :%ld",pt.y); + [self ScrlBarRange:&pt.y];//ScrlBarRange(SB_VERT, pt.y); + //NSLog(@" scr3 = %f,%f",[hScroller doubleValue],[vScroller doubleValue]); + [self ScrollToPos:pt.y];//ScrollToPos(pt); + //NSLog(@" scr4 = %f,%f",[hScroller doubleValue],[vScroller doubleValue]); + if(bScrl) [self ScrollClient:-dx dy:-dy];//ScrollClient(-dx, -dy); +} + +- (id)initWithFrame:(NSRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // Initialization code here. + [self MyInitTextView]; + } + + return self; +} +/* +- (void)awakeFromNib +{ + [super awakeFromNib]; + [self MyInit]; +}*/ + +-(void)MyInitTextView +{ + //m_cell.width = 12;m_cell.height = 30;//tmp + + m_bResize = FALSE; + m_scrollMin = 0; + m_scrollMax = 1; + m_pVText = [NSMutableString string]; + [self SetDefaultFont]; + + m_caretRect = NSMakeRect(0, 0, m_cell.width, m_cell.height); +// [self InitCaret:true]; + + m_isDoc1 = TRUE; + + m_pFile = NULL; +} + +-(BOOL)IsToFile +{ + return m_pFile!=NULL; +} + + +-(void)SetViewSize:(NSInteger)cView +{ + m_cView = cView; +} + +- (NSInteger)GetViewWidth +{ + return m_cView; +} + +- (void)SetDefaultFont +{ + m_font = [NSFont fontWithName:@"MigMix 1M" size:14];//fontsize==guusuu zya nai to zureru (relate dpi + //m_font = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"MigMix 1M" size:14], NSFontAttributeName, nil];//fontsize==guusuu zya nai to zureru (relate dpi + + [self OnChangeFont]; +} + +- (void) OnChangeFont +{ + NSSize fontsize = [@"0" sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:m_font, NSFontAttributeName, nil]]; + m_cell.width = fontsize.width;//5;//12; + m_cell.height = fontsize.height;//17;//21; +} + +- (void)setFrameSize:(NSSize)newSize +{ + [super setFrameSize:newSize]; + + if (newSize.width>0 && newSize.height>0) { + [self InitScrollBar]; + } +} + +- (void)InitScrollBar +{ + if (m_cTotal.width <= 0 || m_cTotal.height <= 0) return; + + m_scrollMin = 0; + m_scrollMax = m_cTotal.cx; + + CGFloat vDouble = _bounds.size.height / (m_cTotal.cy*m_cell.height); + CGFloat hDouble = _bounds.size.width / (m_cTotal.cx*m_cell.width); + [vScroller setEnabled:(vDouble < 1.0)]; + [vScroller setKnobProportion:vDouble]; + [hScroller setEnabled:(hDouble < 1.0)]; + [hScroller setKnobProportion:hDouble]; + + /* [vScroller setDoubleValue:0.5]; + [vScroller setKnobProportion:0.999]; + [vScroller setEnabled:YES]; + [hScroller setDoubleValue:0.1]; + [hScroller setKnobProportion:0.2]; + [hScroller setEnabled:YES];*/ + //[hScroller setHidden:YES]; +} + +- (void)InitCaret +{ + [self InitCaret:TRUE]; +} + +-(void)InitCaret:(BOOL)bShow +{ + m_caretRect.size.width = m_bIns ? 2 : m_cell.width; + if (m_caretTimer==nil) m_caretTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(BlinkCaret:) userInfo:nil repeats:YES]; + + // [self setNeedsDisplay:TRUE]; + NSLog(@"InitCaret!"); +} + +-(void)BlinkCaret:(NSTimer *)timer +{ + m_bCaretOn = !m_bCaretOn; + [self setNeedsDisplayInRect:m_caretRect]; +} + +-(void)StopCaret +{ + if (m_caretTimer) { + [m_caretTimer invalidate]; + m_caretTimer=nil; + m_bCaretOn = TRUE;//virtual-carret + [self setNeedsDisplayInRect:m_caretRect]; + } +} + +-(void)SetTextSize:(TAMASize)cTotal +{ + if(!m_pVText || !TAMAEqualSize(m_cTotal, cTotal)) + { + m_pVText = [NSMutableString stringWithCapacity:cTotal.width+1]; + m_cTotal = cTotal; + } +} + +- (void)PutChar +{ + [self PutChar:@" " n:1]; +} + +-(void)PutChar:(NSString *)c +{ + [self PutChar:c n:1]; +} + +-(void)PutChar:(NSString *)c n:(int)n +{ + if(n==0 || m_nText >= m_cTotal.width)return; + + for (int i=0; ix = floor(pt->x / m_cell.cx); + pt->y = floor(pt->y / m_cell.cy); +} + +- (void)PixelToGridFromTAMARect:(TAMARect*)rect +{ + rect->x1 /= m_cell.cx; + rect->x2 /= m_cell.cx; + rect->y1 /= m_cell.cy; + rect->y2 /= m_cell.cy; +} + +-(void)GridToPixel:(TAMASize *)pt +{ + pt->x *= m_cell.width; + pt->y *= m_cell.height; +} + +-(void)MoveCaret:(TAMASize)pt +{ + [self GridToPixel:&pt]; + m_caretRect.origin.x = pt.x; + m_caretRect.origin.y = pt.y; +} + +@end diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/BZWindowController.xib b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/BZWindowController.xib new file mode 100644 index 0000000..3378bbe --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/BZWindowController.xib @@ -0,0 +1,388 @@ + + + + 1070 + 11G63 + 2844 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2844 + + + NSCustomObject + NSToolbar + NSToolbarFlexibleSpaceItem + NSToolbarItem + NSToolbarSpaceItem + NSView + NSWindowTemplate + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + BZWindowController + + + FirstResponder + + + 15 + 2 + {{133, 235}, {350, 300}} + 1886912512 + Window + BZWindow + + + 6325A716-3EE2-42EA-9AA2-E28FFE1D0B13 + + + YES + YES + YES + NO + 1 + 1 + + + + C1A19D69-99E4-4710-891B-274E8A280F79 + + Toolbar Item + Toolbar Item + + + + NSImage + NSBluetoothTemplate + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarCustomizeToolbarItem + Customize + Customize + Customize Toolbar + + + NSImage + NSToolbarCustomize + + + runToolbarCustomizationPalette: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + + + + NSToolbarPrintItem + Print + Print + Print + + + NSImage + NSToolbarPrint + + + printDocument: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarShowColorsItem + Colors + Colors + Show Color Panel + + + + orderFrontColorPanel: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarShowFontsItem + Fonts + Fonts + Show Font Panel + + + NSImage + NSToolbarShowFonts + + + orderFrontFontPanel: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + + + + + + + + + + + + + + + {94, 86} + + + 256 + {350, 300} + + + + {{0, 0}, {1280, 778}} + {94, 164} + {10000000000000, 10000000000000} + YES + + + NSApplication + + + + + + + window + + + + 18 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + 5 + + + + + + + Window + + + 6 + + + + + + -3 + + + Application + + + 100120 + + + + + + + + + + + + + + 100121 + + + + + 100122 + + + + + 100123 + + + + + 100124 + + + + + 100125 + + + + + 100126 + + + + + 100127 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{133, 170}, {507, 413}} + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 100134 + + + 0 + IBCocoaFramework + YES + 3 + + {7, 14} + {11, 11} + {10, 3} + {32, 32} + {32, 32} + {32, 32} + + + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/Credits.rtf b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/Credits.rtf new file mode 100644 index 0000000..46576ef --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/Credits.rtf @@ -0,0 +1,29 @@ +{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw9840\paperh8400 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Engineering: +\b0 \ + Some people\ +\ + +\b Human Interface Design: +\b0 \ + Some other people\ +\ + +\b Testing: +\b0 \ + Hopefully not nobody\ +\ + +\b Documentation: +\b0 \ + Whoever\ +\ + +\b With special thanks to: +\b0 \ + Mom\ +} diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/InfoPlist.strings b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/MainMenu.xib b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/MainMenu.xib new file mode 100644 index 0000000..7d432e9 --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/en.lproj/MainMenu.xib @@ -0,0 +1,3732 @@ + + + + 1070 + 11G63 + 3084 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 3084 + + + NSCustomObject + NSMenu + NSMenuItem + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + + + BZEditorOSX + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + BZEditorOSX + + + + About BZEditorOSX + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide TamaBinary + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit BZEditorOSX + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + + + New Window + + 2147483647 + + + + + + New Document + + 2147483647 + + + + + + Open with New Window + o + 1048576 + 2147483647 + + + + + + Open after Close + + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save… + s + 1048576 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + Save Dump List... + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Byte Ordering + + 2147483647 + + + submenuAction: + + Byte Ordering + + + + Intel + + 2147483647 + + + + + + Motorola + + 2147483647 + + + + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find and Replace… + f + 1572864 + 2147483647 + + + 12 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + + + Font + + 2147483647 + + + submenuAction: + + Font + + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligatures + + 2147483647 + + + submenuAction: + + Ligatures + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + + + Character set + + 2147483647 + + + submenuAction: + + Character set + + + + Ascii + + 2147483647 + + + + + + Shift JIS + + 2147483647 + + + + + + Unicode (UTF-16) + + 2147483647 + + + + + + Unicode (UTF-8) + + 2147483647 + + + + + + JIS + + 2147483647 + + + + + + EUC + + 2147483647 + + + + + + EBCDIC + + 2147483647 + + + + + + EPWING + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + AutoDetect + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Bitmap View + + 2147483647 + + + + + + Structure View + + 2147483647 + + + + + + Inspect View + + 2147483647 + + + + + + Analyzer View + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Split Horizontally + + 2147483647 + + + + + + Split Vertically + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + + + TamaBinary Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + NSFontManager + + + + + + + terminate: + + + + 448 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + openDocument: + + + + 372 + + + + printDocument: + + + + 373 + + + + raiseBaseline: + + + + 425 + + + + lowerBaseline: + + + + 426 + + + + copyFont: + + + + 427 + + + + subscript: + + + + 428 + + + + superscript: + + + + 429 + + + + tightenKerning: + + + + 430 + + + + underline: + + + + 431 + + + + orderFrontColorPanel: + + + + 432 + + + + useAllLigatures: + + + + 433 + + + + loosenKerning: + + + + 434 + + + + pasteFont: + + + + 435 + + + + unscript: + + + + 436 + + + + useStandardKerning: + + + + 437 + + + + useStandardLigatures: + + + + 438 + + + + turnOffLigatures: + + + + 439 + + + + turnOffKerning: + + + + 440 + + + + capitalizeWord: + + + + 454 + + + + lowercaseWord: + + + + 455 + + + + uppercaseWord: + + + + 456 + + + + toggleAutomaticDashSubstitution: + + + + 460 + + + + orderFrontSubstitutionsPanel: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + toggleAutomaticSpellingCorrection: + + + + 466 + + + + performFindPanelAction: + + + + 467 + + + + performFindPanelAction: + + + + 468 + + + + performFindPanelAction: + + + + 469 + + + + pasteAsPlainText: + + + + 471 + + + + showHelp: + + + + 494 + + + + alignCenter: + + + + 517 + + + + pasteRuler: + + + + 518 + + + + toggleRuler: + + + + 519 + + + + alignRight: + + + + 520 + + + + copyRuler: + + + + 521 + + + + alignJustified: + + + + 522 + + + + alignLeft: + + + + 523 + + + + makeBaseWritingDirectionNatural: + + + + 524 + + + + makeBaseWritingDirectionLeftToRight: + + + + 525 + + + + makeBaseWritingDirectionRightToLeft: + + + + 526 + + + + makeTextWritingDirectionNatural: + + + + 527 + + + + makeTextWritingDirectionLeftToRight: + + + + 528 + + + + makeTextWritingDirectionRightToLeft: + + + + 529 + + + + performFindPanelAction: + + + + 533 + + + + OnCharmodeAscii: + + + + 551 + + + + OnCharmodeEBCDIC: + + + + 552 + + + + OnCharmodeEPWING: + + + + 553 + + + + OnCharmodeEUC: + + + + 554 + + + + OnCharmodeJIS: + + + + 555 + + + + OnCharmodeSJIS: + + + + 556 + + + + OnCharmodeUTF8: + + + + 557 + + + + OnCharmodeUTF16: + + + + 558 + + + + OnCharmodeAutoDetect: + + + + 559 + + + + OnByteOrderIntel: + + + + 566 + + + + OnByteOrderMotorola: + + + + 567 + + + + OnViewAnalyzer: + + + + 573 + + + + OnViewBitmap: + + + + 574 + + + + OnViewInspect: + + + + 575 + + + + OnViewStruct: + + + + 576 + + + + OnViewSplitH: + + + + 580 + + + + OnViewSplitV: + + + + 581 + + + + openDocumentWithClose: + + + + 582 + + + + OnFileSaveDumpList: + + + + 584 + + + + newDocument: + + + + 587 + + + + addFontTrait: + + + + 420 + + + + addFontTrait: + + + + 421 + + + + modifyFont: + + + + 422 + + + + orderFrontFontPanel: + + + + 423 + + + + modifyFont: + + + + 424 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + + + + + + + + + + + + 19 + + + + + + + + 56 + + + + + + + + 217 + + + + + + + + 83 + + + + + + + + 81 + + + + + + + + + + + + + + + + + + + + 75 + + + + + 78 + + + + + 72 + + + + + 124 + + + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + + + + + + 126 + + + + + 205 + + + + + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + + + + + + 216 + + + + + + + + 200 + + + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + + + + + + 296 + + + + + + + + + + + + + + + + + + + 297 + + + + + 298 + + + + + 211 + + + + + + + + 212 + + + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + + + + + + 349 + + + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 374 + + + + + + + + 375 + + + + + + + + + 376 + + + + + + + + 387 + + + + + + + + + + + + + + + + + + + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + + + + 397 + + + + + + + + 398 + + + + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + + + + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + + + + + + 411 + + + + + 412 + + + + + 413 + + + + + 414 + + + + + + + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 449 + + + + + + + + 450 + + + + + + + + + + 451 + + + + + 452 + + + + + 453 + + + + + 457 + + + + + 458 + + + + + 459 + + + + + 462 + + + + + 464 + + + + + 465 + + + + + 470 + + + + + 491 + + + + + + + + 492 + + + + + + + + 493 + + + + + 495 + + + + + + + + 496 + + + + + + + + + + + + + + + + + 497 + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + + + + 503 + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + + + + + + + + + + + + 508 + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 532 + + + + + 534 + + + + + 537 + + + + + 538 + + + + + + + + 539 + + + + + + + + + + + + + + + + + 540 + + + + + 541 + + + + + 542 + + + + + 543 + + + + + 544 + + + + + 545 + + + + + 546 + + + + + 547 + + + + + 548 + + + + + 549 + + + + + 561 + + + + + 562 + + + + + + + + 563 + + + + + + + + + 564 + + + + + 565 + + + + + 568 + + + + + 569 + + + + + 570 + + + + + 571 + + + + + 572 + + + + + 577 + + + + + 578 + + + + + 579 + + + + + 583 + + + + + 585 + + + + + 586 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 587 + + + + + FirstResponder + + duplicateDocument: + id + + + duplicateDocument: + + duplicateDocument: + id + + + + IBUserSource + + + + + + 0 + IBCocoaFramework + YES + 3 + + {11, 11} + {10, 3} + + YES + + diff --git a/MacOSX/BZEditorOSX/BZEditorOSX/main.m b/MacOSX/BZEditorOSX/BZEditorOSX/main.m new file mode 100644 index 0000000..eeeb3dd --- /dev/null +++ b/MacOSX/BZEditorOSX/BZEditorOSX/main.m @@ -0,0 +1,14 @@ +// +// main.m +// TamaBinary +// +// Created by ad on 12/12/01. +// Copyright (c) 2012年 tamachanbinary. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **)argv); +}