Skip to content

Commit

Permalink
Merge pull request #83 from hpi-swa-teaching/US64
Browse files Browse the repository at this point in the history
Add indentation attribute
  • Loading branch information
sirkrypt0 committed Jun 1, 2020
2 parents 718a92d + 80ed47f commit 586322c
Show file tree
Hide file tree
Showing 23 changed files with 83 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
initialListStructure

^ TextStructure newWith: #list withEmphasis: (self defaultStyles union: {#indented})
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ initialTextStructures
self initialFootnoteStructure.
self initialHeading1Structure.
self initialHeading2Structure.
self initialHeading3Structure.} asOrderedCollection
self initialHeading3Structure.
self initialListStructure} asOrderedCollection
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"initialHeading2Structure" : "tok 5/22/2020 13:18",
"initialHeading3Structure" : "tok 5/22/2020 13:18",
"initialItalicStructure" : "tok 5/22/2020 12:32",
"initialTextStructures" : "tok 5/22/2020 12:35",
"initialListStructure" : "tok 5/31/2020 21:15",
"initialTextStructures" : "tok 5/31/2020 21:15",
"initialUnderlinedStructure" : "tok 5/22/2020 12:33" },
"instance" : {
"addAttribute:from:to:" : "AG 7/25/2019 13:08",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
constants
textStyles

textStyles ifNil: [textStyles := {#bold . #italic . #underlined . #struckOut . #extendable} asOrderedCollection].

^ textStyles
^ {#bold .
#italic .
#underlined .
#struckOut .
#extendable .
#indented} asOrderedCollection

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"class" : {
"openWith:" : "AG 7/25/2019 13:15",
"textStyles" : "AG 7/25/2019 13:15" },
"textStyles" : "tok 5/28/2020 10:19" },
"instance" : {
"addColor" : "ls 7/24/2019 21:51",
"addFont" : "ls 7/24/2019 21:16",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"category" : "RichTextEditing-Core",
"classinstvars" : [
"textStyles" ],
],
"classvars" : [
],
"commentStamp" : "ls 7/25/2019 13:53",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
amount
"A textIndent attribute has to provide a amount method specifying the indentationAmount"
^ 2
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ emphasizeScanner: aScanner
self color ifNotNil: [
aScanner textColor: self color].
self font ifNotNil: [
aScanner setActualFont: self font]
aScanner setActualFont: self font].
self isTextIndent ifTrue: [
aScanner indentationLevel: self amount]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ initialize
unsetItalic;
unsetUnderlined;
unsetStruckOut;
unsetExtendable;
unsetExtendable;
unsetIndented;
color: nil;
font: nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isIndented

^ indented
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isTextIndent

^ indented
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
setIIndented

indented := true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
unsetIndented

indented := false
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ updateStyles: aSet
ifTrue: [self setExtendable]
ifFalse: [self unsetExtendable].

(aSet includes: #indented)
ifTrue: [self setIIndented]
ifFalse: [self unsetIndented].

self styleSet: aSet

Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
"newWith:withEmphasis:" : "AG 7/25/2019 13:17" },
"instance" : {
"=" : "lh 7/24/2019 20:24",
"amount" : "tok 6/1/2020 13:32",
"color" : "AG 6/19/2019 19:03",
"color:" : "ls 7/24/2019 21:55",
"emphasisCode" : "lh 7/24/2019 22:50",
"emphasizeScanner:" : "lh 7/24/2019 20:17",
"emphasizeScanner:" : "tok 6/1/2020 13:31",
"font" : "SR 6/26/2019 18:05",
"font:" : "ls 7/24/2019 21:22",
"getFont" : "ls 7/24/2019 21:19",
"hash" : "lh 7/24/2019 20:47",
"initialize" : "lh 6/26/2019 18:47",
"initialize" : "tok 5/28/2020 10:08",
"isBold" : "ls 5/29/2019 17:55",
"isExtendable" : "lh 6/5/2019 17:47",
"isIndented" : "tok 5/28/2020 10:09",
"isItalic" : "ls 5/29/2019 17:57",
"isStruckOut" : "ls 5/29/2019 17:55",
"isTextIndent" : "tok 5/28/2020 10:09",
"isTextStructure" : "ls 5/29/2019 17:41",
"isUnderlined" : "ls 5/29/2019 17:56",
"mayBeExtended" : "ls 6/12/2019 18:49",
Expand All @@ -30,6 +33,7 @@
"setBold" : "ls 5/29/2019 17:55",
"setColor:" : "ls 7/24/2019 21:56",
"setExtendable" : "lh 6/5/2019 17:47",
"setIIndented" : "tok 5/28/2020 10:09",
"setItalic" : "ls 5/29/2019 17:58",
"setStruckOut" : "ls 5/29/2019 17:56",
"setUnderlined" : "ls 5/29/2019 17:57",
Expand All @@ -39,7 +43,8 @@
"styleSet:" : "ls 6/26/2019 21:28",
"unsetBold" : "ls 5/29/2019 17:55",
"unsetExtendable" : "lh 6/5/2019 17:48",
"unsetIndented" : "tok 5/28/2020 10:09",
"unsetItalic" : "ls 5/29/2019 17:58",
"unsetStruckOut" : "ls 5/29/2019 17:56",
"unsetUnderlined" : "ls 5/29/2019 17:57",
"updateStyles:" : "ls 6/26/2019 21:30" } }
"updateStyles:" : "tok 5/28/2020 10:09" } }
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"extendable",
"color",
"font",
"styleSet" ],
"styleSet",
"indented" ],
"name" : "TextStructure",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
utilities
listTextStructure

^ TextStructure newWith: #list withEmphasis: ({#indented})

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests
testUS32StructureIsRendered

self assert: self textHasNoStyle.
self assert: self textHasNoStyle.
self editorText addAttribute: self combinedTextStructure.
self assert: self textHasCombinedStyle

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testUS64IndentedStructureIsRendered

self enterStringOntoTextField: 'test'.
self assert: ((self editorText indentationAmountAt: (1 to: self editorText size)) = 0).
self editorText addAttribute: self listTextStructure from: 1 to: self editorText size.
self assert: ((self editorText indentationAmountAt: (1 to: self editorText size)) = self listTextStructure amount)
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
"combinedEmphasisCode" : "MB 5/29/2019 22:04",
"combinedTextStructure" : "AG 5/30/2019 12:33",
"emphasisCodeNoStyle" : "AG 6/5/2019 18:56",
"listTextStructure" : "tok 6/1/2020 13:27",
"menu" : "ls 6/18/2019 16:37",
"selectOptionBold" : "lh 7/24/2019 21:31",
"setUpHalfBoldTestText" : "lh 7/24/2019 20:04",
"testUS18SelectionStyleIsAppliedToSelection" : "MB 7/25/2019 12:28",
"testUS18TextStyleIsSelectedInList" : "MB 7/25/2019 12:27",
"testUS32StructureIsRendered" : "AG 6/21/2019 14:47",
"testUS32StructureIsRendered" : "tok 6/1/2020 13:15",
"testUS44OldButtonsHaveBeenRemoved" : "ls 6/18/2019 15:57",
"testUS44SelectedStructureIsAssigned" : "ls 6/18/2019 16:00",
"testUS44SelectedStylesChangeAccordingToSelectedText" : "lh 7/24/2019 21:38",
"testUS44StructureListExists" : "AG 6/18/2019 15:22",
"testUS64IndentedStructureIsRendered" : "tok 6/1/2020 13:35",
"textHasCombinedStyle" : "AG 7/25/2019 13:22",
"textHasNoStyle" : "AG 7/25/2019 13:22" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testUS32CheckAllStylesAreAvailable

| styleList essentialStyles |
styleList := self structureEditorView findByClass: PluggableListMorphOfMany.
essentialStyles := {#bold . #italic . #underlined . #struckOut . #extendable}.
essentialStyles := {#bold . #italic . #underlined . #struckOut . #extendable} asSet.

self assert: essentialStyles asSet equals: styleList list asSet
self assert: (essentialStyles allSatisfy: [:each | styleList list asSet includes: each])

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests
testUS64IndentationStyleAvailable

| styleList |
styleList := self structureEditorView findByClass: PluggableListMorphOfMany.

self assert: (styleList list asSet includes: #indented)

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"secondIndex" : "lh 7/24/2019 20:06",
"setStructureAt:toColor:" : "lh 7/24/2019 19:00",
"symbolAt:" : "lh 7/3/2019 22:46",
"testUS32CheckAllStylesAreAvailable" : "MB 7/24/2019 18:46",
"testUS32CheckAllStylesAreAvailable" : "tok 6/1/2020 13:12",
"testUS43PreviewTextfieldExists" : "ls 6/6/2019 00:27",
"testUS43PreviewTextfieldHasSelectedStructureApplied" : "lh 7/24/2019 17:50",
"testUS58StructurePriorityCanBeDecreased" : "lh 7/24/2019 20:07",
"testUS58StructurePriorityCanBeIncreased" : "lh 7/24/2019 20:07",
"testUS58StructureWithHighestPriorityWins" : "ls 7/25/2019 12:53",
"testUS64IndentationStyleAvailable" : "tok 6/1/2020 13:10",
"textPreviewLabel" : "MB 6/12/2019 20:29" } }

0 comments on commit 586322c

Please sign in to comment.