Skip to content

Commit

Permalink
Add paragraph formatting and update edit controls (#28)
Browse files Browse the repository at this point in the history
* Add block formatting buttons to toolbar
* Add block format doc actions
* Split up doc actions and add sub/sup script
* Connect remaining editor toolbar actions
* Optimise and extend SVG icon classes
* Add a tab width setting
* Add tracking of document changes
  • Loading branch information
vkbo authored Feb 10, 2022
1 parent 29b2e57 commit ff29dfa
Show file tree
Hide file tree
Showing 20 changed files with 588 additions and 208 deletions.
76 changes: 63 additions & 13 deletions i18n/collett_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,107 @@
<context>
<name>Collett::GuiEditToolBar</name>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="41"/>
<location filename="../src/editor/edittoolbar.cpp" line="51"/>
<source>Header 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="55"/>
<source>Header 2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="59"/>
<source>Header 3</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="63"/>
<source>Header 4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="67"/>
<source>Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="71"/>
<source>Block Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="77"/>
<source>Format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="87"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="42"/>
<location filename="../src/editor/edittoolbar.cpp" line="90"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="43"/>
<location filename="../src/editor/edittoolbar.cpp" line="93"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="44"/>
<source>Strikethrough</source>
<location filename="../src/editor/edittoolbar.cpp" line="96"/>
<source>Strike Out</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="101"/>
<source>Superscript</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="58"/>
<location filename="../src/editor/edittoolbar.cpp" line="104"/>
<source>Subscript</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="115"/>
<source>Align Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="59"/>
<location filename="../src/editor/edittoolbar.cpp" line="119"/>
<source>Align Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="60"/>
<location filename="../src/editor/edittoolbar.cpp" line="123"/>
<source>Align Centre</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="61"/>
<location filename="../src/editor/edittoolbar.cpp" line="127"/>
<source>Align Justify</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="75"/>
<location filename="../src/editor/edittoolbar.cpp" line="136"/>
<source>Text Segment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="139"/>
<source>First Line Indent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="76"/>
<location filename="../src/editor/edittoolbar.cpp" line="142"/>
<source>Indent Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="77"/>
<location filename="../src/editor/edittoolbar.cpp" line="143"/>
<source>Outdent Paragraph</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -191,7 +241,7 @@
<context>
<name>Collett::Project</name>
<message>
<location filename="../src/project/project.cpp" line="188"/>
<location filename="../src/project/project.cpp" line="189"/>
<source>Unnamed Project</source>
<translation type="unfinished"></translation>
</message>
Expand Down
76 changes: 63 additions & 13 deletions i18n/collett_nb_NO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,107 @@
<context>
<name>Collett::GuiEditToolBar</name>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="41"/>
<location filename="../src/editor/edittoolbar.cpp" line="51"/>
<source>Header 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="55"/>
<source>Header 2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="59"/>
<source>Header 3</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="63"/>
<source>Header 4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="67"/>
<source>Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="71"/>
<source>Block Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="77"/>
<source>Format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="87"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="42"/>
<location filename="../src/editor/edittoolbar.cpp" line="90"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="43"/>
<location filename="../src/editor/edittoolbar.cpp" line="93"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="44"/>
<source>Strikethrough</source>
<location filename="../src/editor/edittoolbar.cpp" line="96"/>
<source>Strike Out</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="101"/>
<source>Superscript</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="58"/>
<location filename="../src/editor/edittoolbar.cpp" line="104"/>
<source>Subscript</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="115"/>
<source>Align Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="59"/>
<location filename="../src/editor/edittoolbar.cpp" line="119"/>
<source>Align Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="60"/>
<location filename="../src/editor/edittoolbar.cpp" line="123"/>
<source>Align Centre</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="61"/>
<location filename="../src/editor/edittoolbar.cpp" line="127"/>
<source>Align Justify</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="75"/>
<location filename="../src/editor/edittoolbar.cpp" line="136"/>
<source>Text Segment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="139"/>
<source>First Line Indent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="76"/>
<location filename="../src/editor/edittoolbar.cpp" line="142"/>
<source>Indent Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="77"/>
<location filename="../src/editor/edittoolbar.cpp" line="143"/>
<source>Outdent Paragraph</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -191,7 +241,7 @@
<context>
<name>Collett::Project</name>
<message>
<location filename="../src/project/project.cpp" line="188"/>
<location filename="../src/project/project.cpp" line="189"/>
<source>Unnamed Project</source>
<translation type="unfinished"></translation>
</message>
Expand Down
13 changes: 6 additions & 7 deletions sample/content/7e5a1a98-d1a3-44a1-ab4e-2b5d21d92201.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"c:format": "document",
"m:created": "2022-01-29T18:22:54",
"m:updated": "2022-01-29T18:23:42",
"m:updated": "2022-02-10T22:57:01",
"x:content": [
{
"u:fmt": "h3:al",
Expand All @@ -23,7 +24,9 @@
{
"u:fmt": "p:al:ti",
"x:txt": [
"t|Here is a paragraph with no formatting whatsoever.\nThis is a second line in the same ",
"t|Here is a paragraph",
"t:sup|23",
"t| with no formatting whatsoever.\nThis is a second line in the same ",
"t:s|silly",
"t| paragraph."
]
Expand All @@ -45,11 +48,7 @@
"u:txt": "t|This text belongs to a second section of the text document."
},
{
"u:fmt": "p:al",
"u:txt": "t|"
},
{
"u:fmt": "p:al",
"u:fmt": "h4:al",
"u:txt": "t:b|Song time!"
},
{
Expand Down
9 changes: 5 additions & 4 deletions sample/content/e709ba3f-3141-4b4b-95df-4a8d3e91a8ba.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"c:format": "document",
"m:created": "2022-01-30T18:54:49",
"m:updated": "2022-01-30T21:17:06",
"m:updated": "2022-02-10T22:39:18",
"x:content": [
{
"u:fmt": "p:ac",
"u:txt": "t|My Novel"
"u:fmt": "h1:ac",
"u:txt": "t:b|My Novel"
},
{
"u:fmt": "p:ac",
"u:txt": "t|"
"u:txt": "t|By Jane Doe"
}
]
}
5 changes: 3 additions & 2 deletions sample/project/project.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"c:format": "project",
"c:meta": {
"m:created": "2021-12-14T22:24:25",
"m:updated": "2022-01-30T21:17:06"
"m:updated": "2022-02-10T22:59:27"
},
"c:project": {
"s:last-doc-main": "e709ba3f-3141-4b4b-95df-4a8d3e91a8ba",
"s:last-doc-main": "7e5a1a98-d1a3-44a1-ab4e-2b5d21d92201",
"u:project-name": "Sample Project"
},
"c:settings": {
Expand Down
14 changes: 0 additions & 14 deletions src/collett.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@

namespace Collett {

enum DocAction {
FormatBold,
FormatItalic,
FormatUnderline,
FormatStrikethrough,
TextAlignLeft,
TextAlignCentre,
TextAlignRight,
TextAlignJustify,
TextIndent,
BlockIndent,
BlockOutdent,
};

enum Severity {
Information,
Warning,
Expand Down
Loading

0 comments on commit ff29dfa

Please sign in to comment.