Skip to content

Commit

Permalink
Merge branch 'dev' into US67
Browse files Browse the repository at this point in the history
  • Loading branch information
konradh committed Jun 1, 2020
2 parents e1b6189 + 25fc7c2 commit 6d1b543
Show file tree
Hide file tree
Showing 61 changed files with 338 additions and 42 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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)
# 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 Down
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 @@
constants
initialBoldStructure

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

^ (TextStructure
newWith: #footnote
withEmphasis: 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
withEmphasis: (self defaultStyles union: {#bold}))
font: (StrikeFont createDejaVuDark: 20)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
constants
initialHeading2Structure

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

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

^ TextStructure newWith: #italic withEmphasis: (self defaultStyles union: {#italic})
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
@@ -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
withEmphasis: (self defaultStyles union: {#underlined})
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,8 @@
count
charcountExcept: aListOfBytecodes

| byteString count|
count := 0.
byteString := self text string asByteArray.

^ byteString count: [:each | (aListOfBytecodes includes: each) not]
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
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,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
Expand Up @@ -3,11 +3,22 @@
"defaultStyles" : "ls 6/26/2019 22:02",
"editorClass" : "ls 6/26/2019 17:33",
"fromText:withStructures:" : "ls 6/26/2019 17:31",
"initialTextStructures" : "MB 7/22/2019 20:46" },
"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",
"initialTextStructures" : "tok 5/31/2020 21:15",
"initialUnderlinedStructure" : "tok 5/22/2020 12:33" },
"instance" : {
"addAttribute:from:to:" : "AG 7/25/2019 13:08",
"charcount" : "frc 5/25/2020 16:02",
"charcountExcept:" : "frc 6/1/2020 10:14",
"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",
Expand All @@ -19,7 +30,7 @@
"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 +42,5 @@
"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" } }
"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
@@ -0,0 +1,22 @@
accessing
yellowButtonMenuItems
"Returns the standard yellow button menu items"
^{
#-.
{'find...(f)' translated. #find}.
{'find again (g)' translated. #findAgain}.
{'find and replace ...' translated. #findReplace}.
{'do/replace again (j)' translated. #again}.
#-.
{'undo (z)' translated. #undo}.
{'redo (Z)' translated. #redo}.
#-.
{'copy (c)' translated. #copySelection}.
{'cut (x)' translated. #cut}.
{'paste (v)' translated. #paste}.
{'paste...' translated. #pasteRecent}.
#-.
{'save (s)' translated. #saveText}.
{'save as' translated. #saveDocumentInSaverWithNamePrompt}.
{'cancel (l)' translated. #cancel}.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
toolbuilder
buildFooterWith: aBuilder

^ aBuilder pluggableTextSpec new
name: 'footer';
model: self;
frame: (0 @ 0.9 corner: 1 @ 1);
readOnly: true;
getText: #footerText;
minimumHeight: 20;
indicateUnacceptedChanges: false;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
toolbuilder
buildInfoButtonWith: aBuilder

^ aBuilder pluggableButtonSpec new
model: self;
frame: (0.75 @ 0 corner: 0.875 @ 0.1);
label: 'Info';
action: #showInfo;
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildManageStructuresButtonWith: aBuilder

^ aBuilder pluggableButtonSpec new
model: self;
frame: (0 @ 0.9 corner: 0.3 @ 1);
frame: (0 @ 0.8 corner: 0.3 @ 0.9);
label: 'Manage Structures';
action: #openStructureEditor;
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ buildTextFieldWith: aBuilder
^ aBuilder pluggableTextSpec new
name: 'textView';
model: self;
frame: (0.3 @ 0.1 corner: 1 @ 1);
frame: (0.3 @ 0.1 corner: 1 @ 0.9);
readOnly: false;
getText: #text;
setText: #saveText:;
editText: #text:;
menu: #codePaneMenu:shifted:;
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ buildWith: aBuilder
self buildManageStructuresButtonWith: aBuilder.
self buildNewButtonWith: aBuilder.
self buildInspectDocumentButtonWith: aBuilder.
self buildHelpButtonWith: aBuilder}.
self buildHelpButtonWith: aBuilder.
self buildInfoButtonWith: aBuilder.
self buildFooterWith: aBuilder}.
result := aBuilder build: windowSpec.
self textView: (aBuilder widgetAt: 'textView').
self footer: (aBuilder widgetAt: 'footer').
self editor model: self.

^ result
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
footer: aFooter

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

^ footer
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document information
footerText

| footerString|
footerString := 'You are using SquidWord · '.
footerString := (footerString, self bufferDocument wordcount), ' words'.
^ footerString
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
document information
showInfo

| window infoText|
infoText := 'Word count: ', self bufferDocument wordcount.
infoText := infoText , String crlf, 'Total characters: ', (self bufferDocument charcountExcept: #()).
infoText := infoText, String crlf, 'Non-blank characters: ', self bufferDocument charcount.
window := UserDialogBoxMorph inform: infoText title: self label
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ textChanged

self changed: #text;
unacceptedEdits;
fitParagraphs
fitParagraphs;
updateFooter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
document information
updateFooter

self footer ifNotNil: [self footer setText: self footerText]
Loading

0 comments on commit 6d1b543

Please sign in to comment.