Skip to content

Commit

Permalink
Merge branch 'dev' into US60
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Jun 15, 2020
2 parents 72d9597 + e889dcd commit 570d9f2
Show file tree
Hide file tree
Showing 188 changed files with 971 additions and 258 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build":
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-18.04]
smalltalk: [ Squeak64-trunk ]
name: ${{ matrix.smalltalk }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-version: ${{ matrix.smalltalk }}
- run: smalltalkci -s ${{ matrix.smalltalk }}
timeout-minutes: 15
4 changes: 2 additions & 2 deletions .travis.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ os:
- osx

smalltalk:
- Squeak-5.2
- Squeak-5.1
- Squeak64-trunk
- Squeak64-5.3
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RichTextEditing [![Build Status](https://travis-ci.org/hpi-swa-teaching/RichTextEditing.svg?branch=master)](https://travis-ci.org/hpi-swa-teaching/RichTextEditing)[![Coverage Status](https://coveralls.io/repos/github/hpi-swa-teaching/RichTextEditing/badge.svg?branch=master)](https://coveralls.io/github/hpi-swa-teaching/RichTextEditing?branch=master)
## SWT 2019 - Group 11
# RichTextEditing ![CI](https://github.com/hpi-swa-teaching/RichTextEditing/workflows/CI/badge.svg?branch=dev)[![Build Status](https://travis-ci.org/hpi-swa-teaching/RichTextEditing.svg?branch=dev)](https://travis-ci.org/hpi-swa-teaching/RichTextEditing)[![Coverage Status](https://coveralls.io/repos/github/hpi-swa-teaching/RichTextEditing/badge.svg?branch=master)](https://coveralls.io/github/hpi-swa-teaching/RichTextEditing?branch=master)
## SWT 2020 - Group 10, SWT 2019 - Group 11
# SquidWord
This is an implementation of a text editor in Squeak, which is capable of writing structured text. This means that text can be divided into logical units. Paragraphs are used to structure the text into sections on a broad level and so-called "text structures" are used to assign certain meanings to particular parts of the text.

Expand All @@ -16,11 +16,6 @@ When the text is saved via the *Save* button or by pressing *Ctrl + s*, the chan

The *Save as...* button lets the user choose a name for the document. The document is then saved in the image (in it's current state, so make sure to save temporary changes to the document prior to that). It can be loaded in any other editor via the *Load* button.

# XP Practice
We used acceptance testing so we valued well-understandable tests. That's why we used code duplication in some tests so that the customer can follow the test steps in each test. For each acceptance criterium (you can find them in the userstories) we wrote one or more tests. We named the tests as follows: "testUS" + number of the user story + what is the test testing

# Outlook
In the future, it may also be possible to reflect over the text. Therefore, one would be able to easily export the text into different formats (e.g. Markdown, HTML, ...).

# Supported Versions
All Squeak versions >= 5.1 are supported.
Expand All @@ -33,3 +28,10 @@ Metacello new
repository: 'github://hpi-swa-teaching/RichTextEditing:master/packages';
load.
```

# SWT 2019
## XP Practice
We used acceptance testing so we valued well-understandable tests. That's why we used code duplication in some tests so that the customer can follow the test steps in each test. For each acceptance criterium (you can find them in the userstories) we wrote one or more tests. We named the tests as follows: "testUS" + number of the user story + what is the test testing

## Outlook
In the future, it may also be possible to reflect over the text. Therefore, one would be able to easily export the text into different formats (e.g. Markdown, HTML, ...).
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ baseline: spec
spec
for: #'common'
do: [
spec baseline: 'Project12' with: [
spec baseline: 'MorphicTestingFramework' with: [
spec
repository: 'github://hpi-swa-teaching/Morphic-Testing-Framework:master/packages'].
spec
package: 'RichTextEditing-Core' with: [spec postLoadDoIt: #initializeCharacterScanner];
package: 'RichTextEditing-Tests' with: [spec requires: #('RichTextEditing-Core' 'Project12')]
package: 'RichTextEditing-Tests' with: [spec requires: #('RichTextEditing-Core' 'MorphicTestingFramework')]
yourself.
spec
group: 'default' with: #('RichTextEditing-Core');
group: 'tests' with: #('RichTextEditing-Tests')]
group: 'tests' with: #('RichTextEditing-Tests')]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
warningText

^ 'Please select a structure'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning
noCurrentStructureWarning

UIManager default inform: 'Please select a structure'
UIManager default inform: self class warningText
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"class" : {
},
"warningText" : "tok 6/12/2020 12:41" },
"instance" : {
"noCurrentStructureWarning" : "ls 7/24/2019 20:38",
"noCurrentStructureWarning" : "tok 6/12/2020 12:41",
"openColorPicker" : "ls 7/24/2019 21:54",
"openFontChooser" : "ls 7/24/2019 21:22",
"resetColor" : "ls 7/24/2019 21:57",
Expand Down
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
@@ -0,0 +1,6 @@
constants
initialBoldStructure

^ TextStructure
newWith: #bold
withStyles: (self defaultStyles union: {TextStructure boldStyle})
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
constants
initialFootnoteStructure

^ (TextStructure
newWith: #footnote
withStyles: self defaultStyles)
font: (StrikeFont createDejaVuDark: 9)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
constants
initialHeading1Structure

^ (TextStructure
newWith: #heading1
withStyles: (self defaultStyles union: {TextStructure boldStyle}))
font: (StrikeFont createDejaVuDark: 20)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
constants
initialHeading2Structure

^ (TextStructure
newWith: #heading2
withStyles: (self defaultStyles union: {TextStructure boldStyle}))
font: (StrikeFont createDejaVuDark: 17)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
constants
initialHeading3Structure

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

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

^ TextStructure
newWith: #list
withStyles: (self defaultStyles union: {TextStructure indentedStyle})
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
constants
initialTextStructures

^ {TextStructure newWith: #bold withEmphasis: (self defaultStyles union: {#bold}).
TextStructure newWith: #italic withEmphasis: (self defaultStyles union: {#italic}).
TextStructure newWith: #underlined withEmphasis: (self defaultStyles union: {#underlined}).
TextStructure newWith: #footnote withEmphasis: self defaultStyles.
TextStructure newWith: #heading1 withEmphasis: self defaultStyles.
TextStructure newWith: #heading2 withEmphasis: self defaultStyles.
TextStructure newWith: #heading3 withEmphasis: self defaultStyles} asOrderedCollection
^ {self initialBoldStructure.
self initialItalicStructure.
self initialUnderlinedStructure.
self initialFootnoteStructure.
self initialHeading1Structure.
self initialHeading2Structure.
self initialHeading3Structure.
self initialListStructure} asOrderedCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
constants
initialUnderlinedStructure

^ TextStructure
newWith: #underlined
withStyles: (self defaultStyles union: {TextStructure underlinedStyle})
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
count
charcount

^ self charcountExcept: self emptyChars
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
count
charcountExcept: aListOfBytecodes

| byteString |
byteString := self text string asByteArray.

^ byteString count: [:each | (aListOfBytecodes includes: each) not]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copy: aRichTextDocument

self
name: aRichTextDocument name copy;
timeLastSaved: aRichTextDocument timeLastSaved;
text: aRichTextDocument text copy;
textStructures: aRichTextDocument textStructures copy;
changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
count
emptyChars
"9: Horizontal tab, 10: Line Feed, 13: Carriage return, 32: Space"

^ #(9 10 13 32)
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
@@ -0,0 +1,4 @@
accessing
isUnsavedDocument

^ self timeLastSaved = nil
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ sortRunsByPriority
self text runs: (self textRuns copy collect: [:attributes |
structureCopy := attributes copy select: [:attribute | attribute isTextStructure].
noStructureCopy := attributes copy reject: [:attribute | attribute isTextStructure].
structureCopy := structureCopy copy sortBy: [:a :b |
structureCopy := structureCopy sorted: [:a :b |
(self textStructureSymbols indexOf: a structureIdentifier) > (self textStructureSymbols indexOf: b structureIdentifier)].
attributes := noStructureCopy, structureCopy])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeLastSaved: aDateAndTime

timeLastSaved := aDateAndTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeLastSaved

^ timeLastSaved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
count
wordcount

| prev bool byteString|
byteString := self text string asByteArray.
prev := self emptyChars first.
^ (byteString count: [:each | bool := ((self emptyChars includes: each) not and: (self emptyChars includes: prev)). prev := each. bool ])
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
{
"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",
"initialTextStructures" : "MB 7/22/2019 20:46" },
"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 6/8/2020 12:23" },
"instance" : {
"addAttribute:from:to:" : "AG 7/25/2019 13:08",
"charcount" : "frc 5/25/2020 16:02",
"charcountExcept:" : "frc 6/13/2020 11:15",
"copy:" : "MB 7/3/2019 18:58",
"createNewStructure:" : "ls 7/24/2019 15:24",
"emptyChars" : "frc 6/1/2020 13:43",
"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",
"isUnsavedDocument" : "OS 6/14/2020 18:19",
"name" : "ls 6/26/2019 17:28",
"name:" : "MB 7/3/2019 19:29",
"openEditor" : "lh 7/24/2019 21:27",
"openInEditor" : "ls 7/24/2019 20:14",
"removeStructure:" : "ls 7/24/2019 17:28",
"removeTextAttribute:from:to:" : "MB 7/24/2019 20:40",
"sortRunsByPriority" : "lh 7/25/2019 11:05",
"sortRunsByPriority" : "JEH 5/20/2020 10:28",
"structuresChanged" : "ls 7/24/2019 14:46",
"stylesForStructure:" : "AG 7/25/2019 13:30",
"symbolToStructure:" : "ls 7/24/2019 14:24",
Expand All @@ -31,4 +43,7 @@
"textStructures" : "ls 6/26/2019 17:28",
"textStructures:" : "MB 7/3/2019 19:29",
"textStructuresDo:" : "ls 7/24/2019 21:29",
"updateStyle:withEmphasis:" : "ls 6/26/2019 22:44" } }
"timeLastSaved" : "OS 6/14/2020 11:16",
"timeLastSaved:" : "OS 6/15/2020 12:22",
"updateStyle:withEmphasis:" : "ls 6/26/2019 22:44",
"wordcount" : "frc 6/1/2020 13:46" } }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"instvars" : [
"textStructures",
"text",
"name" ],
"name",
"timeLastSaved" ],
"name" : "RichTextDocument",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
instance creation
initializeShiftCmdKeyShortcuts

super initializeShiftCmdKeyShortcuts
super initializeShiftCmdKeyShortcuts.
self structureKeymap do:
[:char | shiftCmdActions at: char asciiValue + 1 put: #toggleStructureSelectionAt: ]


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
structureKeymap
"adjust this to your keyboard layout"
^ '!@#$%^&*()'
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:
[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]
Loading

0 comments on commit 570d9f2

Please sign in to comment.