Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add images, use unicode, rework paragraphs and runs #32

Merged
merged 29 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
35b2dcb
editor: Add accessors for italic and underline styles
mjakeman Sep 4, 2022
c701388
display: Support italic and underline key shortcuts
mjakeman Sep 4, 2022
c578e1c
display: Add select all shortcut
mjakeman Sep 4, 2022
840ccab
model: Add new inline and image types
mjakeman Sep 4, 2022
8663b49
format: Support importing images
mjakeman Sep 4, 2022
20e1157
inspector: Add scrolling and refresh button
mjakeman Sep 5, 2022
911497f
inspector: Add styling information
mjakeman Sep 5, 2022
241334c
inspector: Add content tags for images
mjakeman Sep 5, 2022
822804d
engine: Implement images
mjakeman Sep 5, 2022
5ea8d6c
display: Fix picking and selection for images
mjakeman Sep 5, 2022
5e9e895
editor: Allow inserting runs "on-demand"
mjakeman Sep 5, 2022
68d0969
editor: Allow inserting inlines and handle deletion properly
mjakeman Sep 5, 2022
6d01812
model: Rename inline to fragment
mjakeman Sep 5, 2022
3082c63
editor: Rename additional functions to use 'fragment'
mjakeman Sep 5, 2022
9a8aaf4
opaque: Add new opaque fragment type
mjakeman Sep 5, 2022
16ab7d5
editor: Use TextOpaque instead of TextImage
mjakeman Sep 5, 2022
22ae33c
fragment: Make all fragments have textual content
mjakeman Sep 6, 2022
eb77dad
engine: Unicode everywhere
mjakeman Sep 6, 2022
7f671b0
editor: Fix fragment insertion positioning
mjakeman Sep 6, 2022
668b316
layout: Add styling to replacement character for inline objects
mjakeman Sep 6, 2022
221a5f9
layout: Separate into build and layout passes
mjakeman Sep 6, 2022
04877bf
layout: Fix scrolling and minor cleanup
mjakeman Sep 9, 2022
eeecadf
editor: Fix deletion tests
mjakeman Sep 9, 2022
68313af
editor: Make mark tests pass
mjakeman Sep 9, 2022
7a4e4f4
display: Fix wrong item in signal
mjakeman Sep 9, 2022
40fb38b
editor: Fix _length_between_marks helper function
mjakeman Sep 9, 2022
23ee414
layoutblock: Split out paragraph rendering from LayoutBox
mjakeman Sep 9, 2022
be5def2
layout: Split off inline elements into new InlineBox
mjakeman Sep 10, 2022
dfee7f6
layoutblock: Cleanup inline vs block child layouts
mjakeman Sep 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion demo/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <ui/display.h>
#include <format/import.h>
#include <model/image.h>

#define DEMO_TYPE_WINDOW demo_window_get_type ()
G_DECLARE_FINAL_TYPE (DemoWindow, demo_window, DEMO, WINDOW, AdwApplicationWindow)
Expand Down Expand Up @@ -138,7 +139,25 @@ demo_window_init (DemoWindow *self)
}

// test = "<p>There was an <b>Old Man</b> with a <i>beard</i></p><p>Who said, &quot;<u>It is just as I feared!</u></p><p> &gt; Two Owls and a Hen,<br> &gt; Four Larks and a Wren,</p><p>Have all built their nests <b><u><i>in my beard!</i></u></b>&quot;</p>";
frame = format_parse_html (contents);
// frame = format_parse_html (contents);
frame = text_frame_new ();

TextParagraph *paragraph = text_paragraph_new ();
text_paragraph_append_fragment(paragraph, TEXT_FRAGMENT(text_run_new("Hello World. ")));
text_paragraph_append_fragment(paragraph, TEXT_FRAGMENT(text_run_new("This is some text")));
text_frame_append_block (frame, TEXT_BLOCK (paragraph));

paragraph = text_paragraph_new ();
// text_paragraph_append_fragment (paragraph, TEXT_FRAGMENT (text_run_new ("")));
text_paragraph_append_fragment(paragraph, TEXT_FRAGMENT(text_image_new("screenshot.png")));
// text_paragraph_append_fragment (paragraph, TEXT_FRAGMENT (text_run_new ("")));
text_frame_append_block (frame, TEXT_BLOCK (paragraph));

paragraph = text_paragraph_new ();
text_paragraph_append_fragment(paragraph, TEXT_FRAGMENT(text_run_new("And some more text... ")));
text_paragraph_append_fragment(paragraph, TEXT_FRAGMENT(text_run_new(":)")));
text_frame_append_block (frame, TEXT_BLOCK (paragraph));

document = text_document_new ();
document->frame = frame;

Expand Down
3 changes: 2 additions & 1 deletion demo/demo.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html><body lang="en-NZ"><p><b>GNOME</b> (<u>/ɡəˈnoʊm, ˈnoʊm/</u>), originally an acronym for <i>GNU Network Object Model Environment</i>, is a <u>free and open-source</u> <u>desktop environment</u> for <u>Linux</u> and other <u>Unix-like</u> <u>operating systems</u>. </p> <p>GNOME is developed by the <u>GNOME Project</u>, which is composed of both volunteers and paid contributors, the largest corporate contributor being <u>Red Hat</u>.</p>
<html><body lang="en-NZ"><p><b>GNOME</b> (<u>/ɡəˈnoʊm, ˈnoʊm/</u>), originally an acronym for <i>GNU Network Object Model Environment</i>, is a <u>free and open-source</u> <u>desktop environment</u> for <u>Linux</u> and other <u>Unix-like</u> <u>operating systems</u>. GNOME is developed by the <u>GNOME Project</u>, which is composed of both volunteers and paid contributors, the largest corporate contributor being <u>Red Hat</u>.</p>
<p>It is an international project that aims to develop <u>frameworks</u> for software development, to program end-user applications based on these frameworks, and to coordinate efforts for <u>internationalization and localization</u> and <u>accessibility</u> of that software.</p>
<p>a<img src="screenshot.png" alt="this is some alt text"/>b</p>
<p>GNOME is the default desktop environment of many major <u>Linux distributions</u>, including <u>Debian</u>, <u>Endless OS</u>, <u>Fedora Linux</u>, <u>Red Hat Enterprise Linux</u>, <u>SUSE Linux Enterprise</u>, <u>Ubuntu</u>, and <u>Tails</u>; it is also the default of <u>Solaris</u>, a <u>Unix</u> operating system.</p>
<p><i>This text is sourced from Wikipedia under the CC BY-SA 3.0 license. The original document can be found here: <u>https://en.wikipedia.org/wiki/GNOME</u>.</i></p></body></html>
Loading