Skip to content

Commit

Permalink
Merge branch 'dev' into refactor-model
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Jul 6, 2020
2 parents 95a6b95 + ad36e97 commit 61d09ce
Show file tree
Hide file tree
Showing 361 changed files with 1,558 additions and 767 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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)
# 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=dev)](https://coveralls.io/github/hpi-swa-teaching/RichTextEditing?branch=dev)
## 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 @@ -12,10 +12,12 @@ Structures can be applied to portions of the text by selecting the particular te
Structures can be customized with regards to emphasis, color and font. For this purpose, one can use the **Structure Editor** which comes bundled with the Text Editor. In the structure Editor, it is also possible to add or remove completely custom structures and prioritize them (e.g. to determine which color should be displayed if multiple structures are applied to the same text). Custom structures will appear in the structure selection list on the right side of the respective editor.

## Saving and Loading
When the text is saved via the *Save* button or by pressing *Ctrl + s*, the changes regarding the text and structures are written into a **RichTextDocument** object. This object can be inspected by clicking the *Document* button in the editor. It is possible to open the document in another editor by sending the message *openInEditor* to it.
When the text is saved via the *Save* menu item or by pressing *Ctrl + s*, the changes regarding the text and structures are written into a **RichTextDocument** object. This object can be inspected by clicking the *Document* button in the editor. It is possible to open the document in another editor by sending the message *openInEditor* to it.

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.
The *Save as...* menu item 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* menu item.

## Import and Export
The document can be exported into a file and imported from a file. At the current moment, text structures can not be imported or exported.

# Supported Versions
All Squeak versions >= 5.1 are supported.
Expand All @@ -28,6 +30,9 @@ Metacello new
repository: 'github://hpi-swa-teaching/RichTextEditing:master/packages';
load.
```
# SWT 2020
## XP Practice
We have used XP as a development method. In particular, we have used Resources, Scopes, Quality, Time to optimize the development process. Furthermore we continued the acceptance tests, but extended them with unit tests. As further practices we have introduced a style guide, which can be found at STYLEGUIDE.md. We also introduced the practice of "small releases" by publishing a github release every two weeks, and we established the practice of "planning game".

# SWT 2019
## XP Practice
Expand Down
75 changes: 75 additions & 0 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Styleguide

In this document the group of 2020 has formulated the idioms and general styling decisions which should be adhered to while coding on the RichTextEditor project.

### Methods
Style methods like:
```smalltalk
methodName: aParameter
"Here is a comment stating some useful information"
self doSomething.
^ returnValue
```
#### Naming
Indicate the type of parameter with the parameter name, use *a* and *an* if applicable. Use `camelCase` when naming methods.

When using multiple parameters, make sure to name the method in a way that indicates which kind of parameter should follow.

### Cascades
When calling the same object at least three times, use a cascade.
```smalltalk
object
method;
anotherMethod
```
Make sure to start each method on a newline and indent each by one.

### Blocks
Don't put spaces in between the blocks content and its paranthesis.
```smalltalk
self do: [:each | each doSomething]
```
When using loops that have only one iterator, use `each` as variable name. Loops that have multiple iterators should name each variable according to its meaning.
If the block is spanned over multiple lines indent as follows:
```smalltalk
self submorphs do: [:each |
code]
```
### Categorization
**Always** categorize new methods according to their function. Don't leave methods in the `yet unclassified` category.

### Commenting

Comment classes according to the Squeak standard class comments so start with `I am a ...` and write from the perspective of the class. Use `you` when adressing the developer.
If you want to comment a method, first consider rewriting it so that it needs no explanation. Consult others.

### Reuse

If you write the same code twice in similar situations, encapsulate it into a method.

### Misc

Use a newline after a super statement.
```smalltalk
super initialize.
self doSomethingWonderful
```

Write points as follows (using spaces):
```smalltalk
42 @ 42
```

Make sure that the last line of a method does not end with a dot.
Avoid null checks if possible. Use the NullObject pattern instead.

Avoid hardcoded constants and magic numbers. Instead create new methods on class site containing those with a readable name.

### Writing tests
Write tests. Do not merge when your code is not tested.

Tests should be specific. The title should relay what the test does. To achieve this goal only use one assertion or two assertions when checking before and after.
Try to place all non essential code outside of the test. Use utility methods for that, if applicable in parent classes.
Write tests that test unusual input/behaviour to make sure the system is well tested and edge cases are safe.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
baseline
projectClass

^ Smalltalk
at: #MetacelloCypressBaselineProject
ifAbsent: [super projectClass]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
},
"instance" : {
"baseline:" : "lh 7/24/2019 20:53",
"initializeCharacterScanner" : "LM 5/26/2019 22:58" } }
"initializeCharacterScanner" : "LM 5/26/2019 22:58",
"projectClass" : "frc 7/3/2020 10:18" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
adding
add: aTextAttribute
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
includes: aTextAttribute

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
removing
remove: aTextAttribute

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
color
resetColorOfCurrentStructure

self noCurrentStructureWarning

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
font
resetFontOfCurrentStructure

self noCurrentStructureWarning
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accessing
structureIdentifier: aSymbol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"class" : {
"warningText" : "tok 6/12/2020 12:41" },
"instance" : {
"add:" : "kh 6/18/2020 21:24",
"includes:" : "kh 6/18/2020 21:25",
"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",
"resetFont" : "ls 7/24/2019 21:23",
"structureIdentifier" : "ls 7/24/2019 22:17" } }
"remove:" : "kh 6/18/2020 21:24",
"resetColorOfCurrentStructure" : "kh 6/19/2020 18:05",
"resetFontOfCurrentStructure" : "kh 6/19/2020 18:07",
"structureIdentifier" : "ls 7/24/2019 22:17",
"structureIdentifier:" : "kh 6/18/2020 21:57" } }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
identifier

^ #default
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialBoldStructure

^ TextStructure
new: #bold
from: {TextStructure bold}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialFootnoteStructure

^ TextStructure
new: #footnote
from: {TextStructure fromFont: (StrikeFont createDejaVuDark: 9)}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialHeading1Structure

^ TextStructure
new: #heading1
from: {TextStructure fromFont: (StrikeFont createDejaVuDark: 20). TextStructure bold}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialHeading2Structure

^ TextStructure
new: #heading2
from: {TextStructure fromFont: (StrikeFont createDejaVuDark: 17). TextStructure bold}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialHeading3Structure

^ TextStructure
new: #heading3
from: {TextStructure fromFont: (StrikeFont createDejaVuDark: 14). TextStructure bold}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialItalicStructure

^ TextStructure
new: #italic
from: {TextStructure italic}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialListStructure

^ TextStructure
new: #list
from: {TextStructure indented}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
initial structures
initialTextStructures

^ {self initialBoldStructure.
self initialItalicStructure.
self initialUnderlinedStructure.
self initialHeading1Structure.
self initialHeading2Structure.
self initialHeading3Structure.
self initialFootnoteStructure.
self initialListStructure.
self initialURLStructure} asOrderedCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialURLStructure

^ TextStructure
new: #url
from: {TextStructure autohyperlink. TextStructure underlined. TextStructure notExtendable}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initial structures
initialUnderlinedStructure

^ TextStructure
new: #underlined
from: {TextStructure underlined}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"class" : {
"identifier" : "JEH 7/4/2020 11:17",
"initialBoldStructure" : "JEH 7/4/2020 11:15",
"initialFootnoteStructure" : "JEH 7/4/2020 11:15",
"initialHeading1Structure" : "JEH 7/4/2020 11:15",
"initialHeading2Structure" : "JEH 7/4/2020 11:15",
"initialHeading3Structure" : "JEH 7/4/2020 11:15",
"initialItalicStructure" : "JEH 7/4/2020 11:16",
"initialListStructure" : "JEH 7/4/2020 11:16",
"initialTextStructures" : "JEH 7/4/2020 11:16",
"initialURLStructure" : "JEH 7/4/2020 11:16",
"initialUnderlinedStructure" : "JEH 7/4/2020 11:16" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "RichTextEditing-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "RichTextDefaultTemplate",
"pools" : [
],
"super" : "RichTextStructureTemplate",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ I am a RichTextDocument. I represent the text someone wrote in order to improve

I am independent from the RichTextEditorModel, as the textStructures as well as my name and my text can be manipulated directly, so the RichTextEditorModel is not always needed, even though it can always be used.

You can add a new structure to the structures available in new instances of me by adding a new TextStructure to my initialTextStructures method on class side.

My instance variables are:
name - aString
text - aText
textStructures - anOrderedCollection
textStructures - anOrderedCollection
timeLastSaved - aDateAndTime

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

^ {} asSet

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 61d09ce

Please sign in to comment.