Skip to content

Commit

Permalink
Merge branch 'dev' into US84
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Jun 15, 2020
2 parents d4d0fb8 + f352676 commit 35e9405
Show file tree
Hide file tree
Showing 75 changed files with 217 additions and 188 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
constants
defaultStyles

^ {#extendable} asSet
^ {TextStructure extendableStyle} asSet
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
constants
initialBoldStructure

^ TextStructure newWith: #bold withEmphasis: (self defaultStyles union: {#bold})
^ TextStructure
newWith: #bold
withStyles: (self defaultStyles union: {TextStructure boldStyle})
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ initialFootnoteStructure

^ (TextStructure
newWith: #footnote
withEmphasis: self defaultStyles)
withStyles: self defaultStyles)
font: (StrikeFont createDejaVuDark: 9)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ initialHeading1Structure

^ (TextStructure
newWith: #heading1
withEmphasis: (self defaultStyles union: {#bold}))
withStyles: (self defaultStyles union: {TextStructure boldStyle}))
font: (StrikeFont createDejaVuDark: 20)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ initialHeading2Structure

^ (TextStructure
newWith: #heading2
withEmphasis: (self defaultStyles union: {#bold}))
withStyles: (self defaultStyles union: {TextStructure boldStyle}))
font: (StrikeFont createDejaVuDark: 17)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ initialHeading3Structure

^ (TextStructure
newWith: #heading3
withEmphasis: (self defaultStyles union: {#bold}))
withStyles: (self defaultStyles union: {TextStructure boldStyle}))
font: (StrikeFont createDejaVuDark: 14)
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
constants
initialItalicStructure

^ TextStructure newWith: #italic withEmphasis: (self defaultStyles union: {#italic})
^ TextStructure
newWith: #italic
withStyles: (self defaultStyles union: {TextStructure italicStyle})
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
constants
initialListStructure

^ TextStructure newWith: #list withEmphasis: (self defaultStyles union: {#indented})
^ TextStructure
newWith: #list
withStyles: (self defaultStyles union: {TextStructure indentedStyle})
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ initialUnderlinedStructure

^ TextStructure
newWith: #underlined
withEmphasis: (self defaultStyles union: {#underlined})
withStyles: (self defaultStyles union: {TextStructure underlinedStyle})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
text structures
initializeStructure: aSymbol withEmphasis: aSet

self textStructures add: (TextStructure newWith: aSymbol withEmphasis: aSet)
self textStructures add: (TextStructure newWith: aSymbol withStyles: aSet)
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"class" : {
"defaultStyles" : "ls 6/26/2019 22:02",
"defaultStyles" : "tok 6/8/2020 12:21",
"editorClass" : "ls 6/26/2019 17:33",
"fromText:withStructures:" : "ls 6/26/2019 17:31",
"initialBoldStructure" : "tok 5/22/2020 12:32",
"initialFootnoteStructure" : "tok 5/22/2020 13:17",
"initialHeading1Structure" : "tok 5/22/2020 13:17",
"initialHeading2Structure" : "tok 5/22/2020 13:18",
"initialHeading3Structure" : "tok 5/22/2020 13:18",
"initialItalicStructure" : "tok 5/22/2020 12:32",
"initialListStructure" : "tok 5/31/2020 21:15",
"initialBoldStructure" : "tok 6/8/2020 12:22",
"initialFootnoteStructure" : "tok 6/8/2020 12:06",
"initialHeading1Structure" : "tok 6/8/2020 12:22",
"initialHeading2Structure" : "tok 6/8/2020 12:22",
"initialHeading3Structure" : "tok 6/8/2020 12:22",
"initialItalicStructure" : "tok 6/8/2020 12:22",
"initialListStructure" : "tok 6/8/2020 12:22",
"initialTextStructures" : "tok 5/31/2020 21:15",
"initialUnderlinedStructure" : "tok 5/22/2020 12:33" },
"initialUnderlinedStructure" : "tok 6/8/2020 12:23" },
"instance" : {
"addAttribute:from:to:" : "AG 7/25/2019 13:08",
"charcount" : "frc 5/25/2020 16:02",
Expand All @@ -22,7 +22,7 @@
"hasStructure:forText:from:to:" : "AG 7/25/2019 13:20",
"initialize" : "ls 7/24/2019 15:10",
"initializeStructure:" : "ls 7/24/2019 15:13",
"initializeStructure:withEmphasis:" : "ls 6/26/2019 22:07",
"initializeStructure:withEmphasis:" : "tok 6/8/2020 12:06",
"initializeStructures" : "ls 7/24/2019 15:12",
"name" : "ls 6/26/2019 17:28",
"name:" : "MB 7/3/2019 19:29",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ isNewCharacter: aKeyboardEvent
| character value |
character := aKeyboardEvent keyCharacter.
value := aKeyboardEvent keyValue.

^ aKeyboardEvent controlKeyPressed not and: (aKeyboardEvent commandKeyPressed not) and:
[character isAlphaNumeric or: [
character isSpecial] or: [
value = self spaceValue] or: [
value = self returnValue]]
^ aKeyboardEvent controlKeyPressed not
and: (aKeyboardEvent commandKeyPressed not)
and: [self isValidCharacter: character]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
input events
isSpecialCharacter: aCharacter

^ aCharacter isSpecial or: [self specialCharacters includes: aCharacter]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input events
isStructureShortcut: aKeyboardEvent

^aKeyboardEvent controlKeyPressed and: [
aKeyboardEvent shiftPressed] and: [
self class structureKeymap includes: aKeyboardEvent keyCharacter]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input events
isValidCharacter: aCharacter

^ aCharacter isAlphaNumeric
or: [self isSpecialCharacter: aCharacter]
or: [Character separators includes: aCharacter]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ keyStroke: aKeyboardEvent
returnValue := super keyStroke: aKeyboardEvent.
(self isNewCharacter: aKeyboardEvent)
ifTrue: [self model applyCurrentStructures].
self model unbufferStructures.
(self isStructureShortcut: aKeyboardEvent) ifFalse:
[self model unbufferStructures].
(self isCtrlA: aKeyboardEvent)
ifTrue: [self selectAll].
self model precedingStructuresChanged.
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
specialCharacters

^ '.$#^()_{}[]"`~:;''@%'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
input events
toggleStructureSelectionAt: aKeyboardEvent

| keyCode |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"crWithIndent:" : "lh 7/24/2019 22:30",
"getParagraphCharacter" : "LM 5/26/2019 22:52",
"isCtrlA:" : "lh 7/24/2019 16:59",
"isNewCharacter:" : "OS 6/1/2020 00:19",
"keyStroke:" : "OS 6/1/2020 00:20",
"isNewCharacter:" : "tok 6/13/2020 12:03",
"isSpecialCharacter:" : "OS 6/12/2020 12:03",
"isStructureShortcut:" : "OS 6/12/2020 12:09",
"isValidCharacter:" : "tok 6/13/2020 12:04",
"keyStroke:" : "OS 6/12/2020 12:09",
"mouseDown:" : "OS 6/1/2020 00:56",
"returnValue" : "ls 6/19/2019 19:14",
"setEmphasisHere" : "6/1/2020 14:03:21",
"spaceValue" : "AG 6/22/2019 11:51",
"specialCharacters" : "tok 6/13/2020 12:14",
"storeSelectionInParagraph" : "lh 7/24/2019 21:51",
"textSize" : "lh 6/26/2019 22:16",
"toggleStructureSelectionAt:" : "tok 5/18/2020 13:40" } }
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
constants
textStyles

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

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
initialize-release
newNullTextStructure

^ NullTextStructure newWith: #null withEmphasis: Set new
^ NullTextStructure newWith: #null withStyles: Set new
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"class" : {
"openWith:" : "AG 7/25/2019 13:15",
"textStyles" : "tok 5/28/2020 10:19" },
"textStyles" : "tok 6/8/2020 12:26" },
"instance" : {
"addColor" : "ls 7/24/2019 21:51",
"addFont" : "ls 7/24/2019 21:16",
Expand Down Expand Up @@ -36,7 +36,7 @@
"loremIpsum" : "ls 6/5/2019 22:07",
"loremIpsum:" : "ls 6/5/2019 22:07",
"loremIpsumDefault" : "lh 7/24/2019 16:16",
"newNullTextStructure" : "ls 7/24/2019 20:18",
"newNullTextStructure" : "tok 6/8/2020 12:06",
"removeStructure" : "lh 7/24/2019 20:16",
"resetColor" : "ls 7/24/2019 21:57",
"resetFont" : "ls 7/24/2019 21:24",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
I am a TextStructure. You can add me to a text just like every other TextAttribute (e.g. Text>>addAttribute:).
You can set my instance variables bold, italic, struckOut and underlined as true to have the text be rendered accordingly. You can set my instance variable color to color the text, analogously you can set my font.
If you set extendable to true and continue writing, the text will keep the current structure. I am using a null object (NullTextStructure) so you do not have to check for nil values.
You find all available Styles in my classes TextStructure>>availableStyles method.
The stylesActivated dictionary contains the information on which styles are active on me.

My instance variables are:
structureIdentifier - aSymbol
bold - aBoolean
italic - aBoolean
underlined - aBoolean
struckOut - aBoolean
extendable - aBoolean
color - aColor
font - aFont (e.g. StrikeFont)
styleSet - aSet
styleSet - aSet
stylesActived - aSet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
constants
availableStyles

^ {self boldStyle .self italicStyle . self underlinedStyle .
self struckOutStyle . self extendableStyle . self indentedStyle}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
boldStyle

^ #bold
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
extendableStyle

^ #extendable
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
indentedStyle

^ #indented
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
italicStyle

^ #italic
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
instance creation
newWith: aSymbol withEmphasis: aSet
newWith: aSymbol withStyles: aSet

| instance |
instance := self new structureIdentifier: aSymbol.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
struckOutStyle

^ #struckOut
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
underlinedStyle

^ #underlined
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ initialize

super initialize.
self
unsetBold;
unsetItalic;
unsetUnderlined;
unsetStruckOut;
unsetExtendable;
unsetIndented;
initializeStyles;
color: nil;
font: nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialize-release
initializeStyles

self stylesActivated: Dictionary new.
self class availableStyles do: [:style | self stylesActivated at: style put: false]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isBold

^ bold
^ self stylesActivated at: self class boldStyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isExtendable

^ extendable
^ self stylesActivated at: self class extendableStyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isIndented

^ indented
^ self stylesActivated at: self class indentedStyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isItalic

^ italic
^ self stylesActivated at: self class italicStyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isStruckOut

^ struckOut
^ self stylesActivated at: self class struckOutStyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isTextIndent

^ indented
^ self isIndented
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
isUnderlined

^ underlined
^ self stylesActivated at: self class underlinedStyle
Loading

0 comments on commit 35e9405

Please sign in to comment.