From df6e463ad37ed8e9d88d0c78d142806575fc7447 Mon Sep 17 00:00:00 2001 From: Stephan Robinig Date: Wed, 16 Oct 2024 17:47:21 +0200 Subject: [PATCH] PR fixes * remove localized strings * removed dashed line code * renamed ASK_QUESTION to WRITE_FILENAME (as in android) --- .../Bricks/Plot/StartPlotBrick.swift | 2 +- .../Defines/LanguageTranslationDefines.h | 8 +++--- .../LanguageTranslationDefinesSwift.swift | 8 +++--- .../SpriteNode/CBSpriteNodePenExtension.swift | 27 +++++-------------- .../Plot/SavePlotSVGBrick+CBXMLHandler.swift | 4 +-- .../LanguageTranslationDefinesUI.swift | 8 +++--- 6 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/Catty/DataModel/Bricks/Plot/StartPlotBrick.swift b/src/Catty/DataModel/Bricks/Plot/StartPlotBrick.swift index c7edc8019..e12d692df 100644 --- a/src/Catty/DataModel/Bricks/Plot/StartPlotBrick.swift +++ b/src/Catty/DataModel/Bricks/Plot/StartPlotBrick.swift @@ -43,7 +43,7 @@ import Foundation } override func brickCell() -> BrickCellProtocol.Type! { - StartPlotBrickCell.self as BrickCellProtocol.Type //TODO + StartPlotBrickCell.self as BrickCellProtocol.Type } override func isDisabledForBackground() -> Bool { diff --git a/src/Catty/Defines/LanguageTranslationDefines.h b/src/Catty/Defines/LanguageTranslationDefines.h index a2b4194bd..faeb6d3ce 100644 --- a/src/Catty/Defines/LanguageTranslationDefines.h +++ b/src/Catty/Defines/LanguageTranslationDefines.h @@ -465,10 +465,10 @@ #define kLocalizedStamp NSLocalizedString(@"Stamp", nil) // plot bricks -#define kLocalizedStartPlot NSLocalizedString(@"Start plot", nil) -#define kLocalizedStopPlot NSLocalizedString(@"Stop plot", nil) -#define kLocalizedSavePlot NSLocalizedString(@"Save plot to SVG", nil) -#define kLocalizedSavePlotDefaultFile NSLocalizedString(@"myplot.svg", nil) +#define kLocalizedStartPlot NSLocalizedString(@"Start to plot", nil) +#define kLocalizedStopPlot NSLocalizedString(@"Stop to plot", nil) +#define kLocalizedSavePlot NSLocalizedString(@"Save plot as SVG", nil) +#define kLocalizedSavePlotDefaultFile NSLocalizedString(@"plot.svg", nil) // sound bricks #define kLocalizedSound NSLocalizedString(@"Sound", nil) diff --git a/src/Catty/Defines/LanguageTranslationDefinesSwift.swift b/src/Catty/Defines/LanguageTranslationDefinesSwift.swift index 7a800e72b..8cd816279 100644 --- a/src/Catty/Defines/LanguageTranslationDefinesSwift.swift +++ b/src/Catty/Defines/LanguageTranslationDefinesSwift.swift @@ -465,10 +465,10 @@ let kLocalizedBlue = NSLocalizedString("blue", comment: "") let kLocalizedStamp = NSLocalizedString("Stamp", comment: "") // plot bricks -let kLocalizedStartPlot = NSLocalizedString("Start plot", comment: "") -let kLocalizedStopPlot = NSLocalizedString("Stop plot", comment: "") -let kLocalizedSavePlot = NSLocalizedString("Save plot to SVG", comment: "") -let kLocalizedSavePlotDefaultFile = NSLocalizedString("myplot.svg", comment: "") +let kLocalizedStartPlot = NSLocalizedString("Start to plot", comment: "") +let kLocalizedStopPlot = NSLocalizedString("Stop to plot", comment: "") +let kLocalizedSavePlot = NSLocalizedString("Save plot as SVG", comment: "") +let kLocalizedSavePlotDefaultFile = NSLocalizedString("plot.svg", comment: "") // sound bricks let kLocalizedSound = NSLocalizedString("Sound", comment: "") diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/SpriteNode/CBSpriteNodePenExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/SpriteNode/CBSpriteNodePenExtension.swift index 50d68f10f..5244ec74a 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/SpriteNode/CBSpriteNodePenExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/SpriteNode/CBSpriteNodePenExtension.swift @@ -25,14 +25,14 @@ extension CBSpriteNode { @objc func drawPenLine() { //swiftlint:disable:next unused_enumerated for (_, positionLine) in self.penConfiguration.previousPositionLines.enumerated() { - drawLineFromConfiguration(with: positionLine, mode: false) + drawLineFromConfiguration(with: positionLine) } self.penConfiguration.previousPositionLines.removeAll() if self.penConfiguration.previousPositions.last != self.position && penConfiguration.penDown { self.penConfiguration.previousPositions.append(self.position) } let positions = self.penConfiguration.previousPositions - drawLineFromConfiguration(with: positions, mode: false) + drawLineFromConfiguration(with: positions) if positions.count > 1 { self.penConfiguration.previousPositions.removeSubrange(0.., mode dashed: Bool, start startIndex: Int = 0) { + private func drawLineFromConfiguration(with positions: SynchronizedArray, from startIndex: Int = 0) { let positionCount = positions.count if positionCount > 1 { for (index, point) in positions.enumerated() where index > startIndex && index > 0 { @@ -58,11 +58,8 @@ extension CBSpriteNode { fatalError("This should never happen") } let lineTo = point - if dashed { - self.addDashedLine(from: lineFrom, to: lineTo, withColor: penConfiguration.color, withSize: penConfiguration.size) - } else { - self.addLine(from: lineFrom, to: lineTo, withColor: penConfiguration.color, withSize: penConfiguration.size) - } + self.addLine(from: lineFrom, to: lineTo, withColor: penConfiguration.color, withSize: penConfiguration.size) + } } } @@ -76,14 +73,4 @@ extension CBSpriteNode { self.scene?.addChild(line) } - - private func addDashedLine(from startPoint: CGPoint, to endPoint: CGPoint, withColor color: UIColor, withSize size: CGFloat) { - let line = DashedLineShapeNode(pathStartPoint: startPoint, pathEndPoint: endPoint) - line.name = SpriteKitDefines.penShapeNodeName - line.strokeColor = color - line.lineWidth = size - line.zPosition = SpriteKitDefines.defaultPenZPosition - - self.scene?.addChild(line) - } } diff --git a/src/Catty/XML/XMLHandler/Bricks/Plot/SavePlotSVGBrick+CBXMLHandler.swift b/src/Catty/XML/XMLHandler/Bricks/Plot/SavePlotSVGBrick+CBXMLHandler.swift index 48d714cf8..2c3b0ac2c 100644 --- a/src/Catty/XML/XMLHandler/Bricks/Plot/SavePlotSVGBrick+CBXMLHandler.swift +++ b/src/Catty/XML/XMLHandler/Bricks/Plot/SavePlotSVGBrick+CBXMLHandler.swift @@ -24,7 +24,7 @@ extension SavePlotSVGBrick: CBXMLNodeProtocol { static func parse(from xmlElement: GDataXMLElement, with context: CBXMLParserContext) -> Self { CBXMLParserHelper.validate(xmlElement, forFormulaListWithTotalNumberOfFormulas: 1) let brick = self.init() - let formula = CBXMLParserHelper.formula(in: xmlElement, forCategoryName: "ASK_QUESTION", with: context) + let formula = CBXMLParserHelper.formula(in: xmlElement, forCategoryName: "WRITE_FILENAME", with: context) brick.filename = formula return brick } @@ -33,7 +33,7 @@ extension SavePlotSVGBrick: CBXMLNodeProtocol { let brick = super.xmlElement(for: "SavePlotSVGBrick", with: context) let formulaList = GDataXMLElement(name: "formulaList", context: context) let formula = self.filename?.xmlElement(with: context) - formula?.addAttribute(GDataXMLElement(name: "category", stringValue: "ASK_QUESTION", context: nil)) + formula?.addAttribute(GDataXMLElement(name: "category", stringValue: "WRITE_FILENAME", context: nil)) formulaList?.addChild(formula, context: context) brick?.addChild(formulaList, context: context) return brick diff --git a/src/CattyUITests/Defines/LanguageTranslationDefinesUI.swift b/src/CattyUITests/Defines/LanguageTranslationDefinesUI.swift index a245f3b76..43aa2f182 100644 --- a/src/CattyUITests/Defines/LanguageTranslationDefinesUI.swift +++ b/src/CattyUITests/Defines/LanguageTranslationDefinesUI.swift @@ -465,10 +465,10 @@ let kLocalizedBlue = NSLocalizedString("blue", bundle: Bundle(for: LanguageTrans let kLocalizedStamp = NSLocalizedString("Stamp", bundle: Bundle(for: LanguageTranslation.self), comment: "") // plot bricks -let kLocalizedStartPlot = NSLocalizedString("Start plot", bundle: Bundle(for: LanguageTranslation.self), comment: "") -let kLocalizedStopPlot = NSLocalizedString("Stop plot", bundle: Bundle(for: LanguageTranslation.self), comment: "") -let kLocalizedSavePlot = NSLocalizedString("Save plot to SVG", bundle: Bundle(for: LanguageTranslation.self), comment: "") -let kLocalizedSavePlotDefaultFile = NSLocalizedString("myplot.svg", bundle: Bundle(for: LanguageTranslation.self), comment: "") +let kLocalizedStartPlot = NSLocalizedString("Start to plot", bundle: Bundle(for: LanguageTranslation.self), comment: "") +let kLocalizedStopPlot = NSLocalizedString("Stop to plot", bundle: Bundle(for: LanguageTranslation.self), comment: "") +let kLocalizedSavePlot = NSLocalizedString("Save plot as SVG", bundle: Bundle(for: LanguageTranslation.self), comment: "") +let kLocalizedSavePlotDefaultFile = NSLocalizedString("plot.svg", bundle: Bundle(for: LanguageTranslation.self), comment: "") // sound bricks let kLocalizedSound = NSLocalizedString("Sound", bundle: Bundle(for: LanguageTranslation.self), comment: "")