-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code improvements and release improvisations (#18)
* Initial develop commit * SVG Preview is rendered as PNG (#1) * Initial save of png file * Cleanup render warnings * Add file dialog for save file * Fixes * adapt svg_result * add logging * Eliminate compile errors. Update Readme * Add tests * Add Github Actions * Save a sized png * Fix compiler warnings * small fixes * more modular png module * refactor main view * img based preview * Use prelude * scaling of image and editor view * empty svg will not produce a png error. * add tabview * try view size in button * Refactoring the preview * add width to parsing * png preview * move buttons to dedicated module * small corrections * Better approach * fixing update behaviour of editor * cleanup * editor displays full size if no preview is around * No more crashes when try to render errors * correct display of error in preview * add save button * Activate Dependabot on develop * Correct typo in README.MD * Gh cicd setup (#6) * Setup github actions * Release Workflow * Cargo fmt * Cargo Clippy Fixes * fix fmt * Fix mainview (#7) * Fullsize svg preview container * Fix compiler messages * Fix tag extraction to stop after first version match (#9) * provide write access to tag job (#11) * Optimise pipeline (#13) * Optimise execution of unit tests * fix release action * Fix branch for release (#15) * Mainview refactor (#17) * refactoring subviews in own modules * fmt & clippy * update package version in toml * optimise release build
- Loading branch information
Showing
6 changed files
with
66 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use editor::command::{Command, CommandExecuted}; | ||
use editor::core::command::EditCommand; | ||
use editor::text::{default_dark_color, SimpleStyling}; | ||
use floem::prelude::*; | ||
|
||
pub const DFLT_TEXT: &str = r#"arrow right 200% "Markdown" "Source" | ||
box rad 10px "Markdown" "Formatter" "(markdown.c)" fit | ||
arrow right 200% "HTML+SVG" "Output" | ||
arrow <-> down 70% from last box.s | ||
box same "Pikchr" "Formatter" "(pikchr.c)" fit | ||
"#; | ||
|
||
pub fn textedit_view(i_editorstring: &RwSignal<String>) -> TextEditor { | ||
let hide_gutter_a = RwSignal::new(false); | ||
let rawdocstr = *i_editorstring; | ||
|
||
let editor = text_editor(DFLT_TEXT) | ||
.styling(SimpleStyling::new()) | ||
.style(|s| s.flex_col().size_full()) | ||
.editor_style(default_dark_color) | ||
.editor_style(move |s| s.hide_gutter(hide_gutter_a.get())) | ||
.pre_command(|ev| { | ||
if matches!(ev.cmd, Command::Edit(EditCommand::Undo)) { | ||
println!("Undo command executed on editor B, ignoring!"); | ||
return CommandExecuted::Yes; | ||
} | ||
CommandExecuted::No | ||
}) | ||
.update(move |dlta| { | ||
let txt = dlta.deltas().last().unwrap(); | ||
log::debug!("Editor changed \n new delta: {:?}", txt); | ||
let rawdoc = if txt.new_document_len() == 0 { | ||
String::from("") | ||
} else { | ||
String::from(dlta.editor.unwrap().text().clone()) | ||
}; | ||
rawdocstr.set(rawdoc); | ||
}) | ||
.placeholder("Some placeholder text"); | ||
editor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod edview; | ||
pub mod mainview; | ||
pub mod svgview; | ||
pub mod tabview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use floem::prelude::*; | ||
|
||
pub fn svgpreview_container(i_preview_sig: &RwSignal<Vec<u8>>) -> Scroll { | ||
let preview_sig = *i_preview_sig; | ||
dyn_container( | ||
move || preview_sig.get(), | ||
move |pv| img(move || pv.to_vec()), | ||
) | ||
.scroll() | ||
.style(|s| s.flex_col().size_full()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters