rename submodules to reprTree & editTree

This commit is contained in:
Michael Sippel 2023-11-27 04:18:46 +01:00
parent b1c17da75f
commit f3ad5c78d7
Signed by: senvas
GPG key ID: F96CF119C34B64A6
27 changed files with 61 additions and 87 deletions

View file

@ -1,35 +1,24 @@
extern crate r3vi;
extern crate cgmath;
extern crate nested;
extern crate nested_tty;
extern crate r3vi;
extern crate termion;
extern crate cgmath;
use {
r3vi::view::{
ViewPort,
port::UpdateTask
},
nested::{
tree::{NestedNode},
type_system::{Context, ReprTree}
},
nested_tty::{
Terminal, TerminalView, TerminalEvent,
TerminalStyle,
TerminalCompositor
},
cgmath::Vector2,
nested::reprTree::Context,
nested_tty::{Terminal, TerminalCompositor, TerminalEvent, TerminalStyle, TerminalView},
r3vi::view::{port::UpdateTask, ViewPort},
std::sync::{Arc, RwLock},
termion::event::{Event, Key},
std::sync::{Arc, RwLock}
};
/* this task handles all terminal events (e.g. key press, resize)
*/
pub async fn event_loop(
mut term: Terminal,
term_port: ViewPort<dyn TerminalView>,
portmutex: Arc<RwLock<()>>
portmutex: Arc<RwLock<()>>,
) {
loop {
let ev = term.next_event().await;
@ -46,10 +35,7 @@ pub async fn event_loop(
* all notifications which are influencing
* the view in `term_port`
*/
pub async fn update_loop(
term_port: ViewPort<dyn TerminalView>,
portmutex: Arc<RwLock<()>>
) {
pub async fn update_loop(term_port: ViewPort<dyn TerminalView>, portmutex: Arc<RwLock<()>>) {
loop {
{
let _l = portmutex.write().unwrap();
@ -64,7 +50,7 @@ async fn main() {
/* initialize our terminal
*/
let term_port = ViewPort::new();
let mut term = Terminal::new(term_port.outer());
let term_writer = term.get_writer();
@ -72,30 +58,28 @@ async fn main() {
/* spawn event-handling & updating tasks
*/
async_std::task::spawn(
update_loop(term_port.clone(), portmutex.clone()));
async_std::task::spawn(update_loop(term_port.clone(), portmutex.clone()));
async_std::task::spawn(
event_loop(term, term_port.clone(), portmutex.clone()));
async_std::task::spawn(event_loop(term, term_port.clone(), portmutex.clone()));
/* populate the view in `term_port`
*/
let compositor = TerminalCompositor::new(term_port.inner());
compositor.write().unwrap().push(
nested_tty::make_label("test")
.offset(Vector2::new(7,2)));
compositor
.write()
.unwrap()
.push(nested_tty::make_label("test").offset(Vector2::new(7, 2)));
compositor.write().unwrap().push(
nested_tty::make_label("Hello World")
.map_item(|p,a|
a.add_style_back(
TerminalStyle::fg_color(( (25*p.x%255) as u8, 200, 0 )) ))
.offset(Vector2::new(5, 3)));
.map_item(|p, a| {
a.add_style_back(TerminalStyle::fg_color(((25 * p.x % 255) as u8, 200, 0)))
})
.offset(Vector2::new(5, 3)),
);
/* write the changes in the view of `term_port` to the terminal
*/
term_writer.show().await.expect("output error!");
}

View file

@ -7,5 +7,5 @@ version = "0.1.0"
[dependencies]
r3vi = { path = "../../lib-r3vi" }
laddertypes = { path = "../../lib-laddertypes" }
cgmath = { version = "0.18.0", features = ["serde"] }
cgmath = { version = "0.18.0", features = ["serde"] }

View file

@ -4,7 +4,7 @@ use {
buffer::{vec::*, index_hashmap::*}
},
crate::{
type_system::ReprTree
reprTree::ReprTree
},
std::sync::{Arc, RwLock},
cgmath::Point2

View file

@ -15,7 +15,7 @@ use {
},
crate::{
editors::list::ListCursorMode,
tree::TreeCursor
editTree::TreeCursor
},
cgmath::Vector2,
};

View file

@ -7,8 +7,8 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{ReprTree, Context},
tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}},
reprTree::{ReprTree, Context},
editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}},
editors::{list::{ListCursorMode}, ObjCommander}
}
};

View file

@ -2,7 +2,7 @@
use {
laddertypes::{TypeTerm, TypeID},
crate::{
tree::{TreeAddr}
editTree::{TreeAddr}
}
};

View file

@ -8,8 +8,8 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{Context, ReprTree},
tree::{NestedNode, TreeNavResult},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNavResult},
editors::ObjCommander,
},
std::sync::Arc,

View file

@ -5,12 +5,12 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{Context},
reprTree::{Context},
reprTree::{MorphismTypePattern},
editors::{
list::*,
integer::*
},
type_system::{MorphismTypePattern},
},
std::sync::{Arc, RwLock}
};

View file

@ -12,9 +12,9 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{Context, ReprTree},
editors::{list::{ListCmd}, ObjCommander},
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}},
},
std::sync::Arc,
std::sync::RwLock,

View file

@ -4,8 +4,8 @@ use {
},
crate::{
editors::{list::{ListEditor, ListCursor, ListCursorMode}, ObjCommander},
type_system::{Context, ReprTree},
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
},
std::sync::{Arc, RwLock}
};

View file

@ -2,7 +2,7 @@ use {
r3vi::{view::{OuterViewPort, singleton::*}},
laddertypes::{TypeTerm},
crate::{
type_system::{Context},
reprTree::{Context},
editors::list::{ListEditor}//, PTYListController, PTYListStyle}
},
std::sync::{Arc, RwLock}

View file

@ -5,9 +5,9 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{Context, ReprTree},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics},
editors::{list::{ListCursor, ListCursorMode, ListCmd}, ObjCommander},
tree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics},
},
std::sync::{Arc, RwLock}
};
@ -117,8 +117,7 @@ impl ListEditor {
.set_diag(e
.get_data_port()
.enumerate()
.map(
|(idx, item_editor)| {
.map(|(idx, item_editor)| {
let idx = *idx;
item_editor
.get_msg_port()
@ -129,8 +128,7 @@ impl ListEditor {
msg
}
)
}
)
})
.flatten()
);

View file

@ -11,7 +11,7 @@ use {
ListCursor, ListCursorMode,
editor::ListEditor
},
tree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp}
editTree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp}
},
cgmath::Vector2
};

View file

@ -9,7 +9,7 @@ use {
},
crate::{
editors::list::{ListCursor, ListCursorMode},
tree::{NestedNode}
editTree::{NestedNode}
},
std::sync::Arc,
std::sync::RwLock,

View file

@ -16,8 +16,8 @@ pub trait Commander {
use std::sync::{Arc, RwLock};
use crate::{
type_system::ReprTree,
tree::{nav::TreeNavResult}
reprTree::ReprTree,
editTree::nav::TreeNavResult
};
pub trait ObjCommander {

View file

@ -9,8 +9,8 @@ use {
laddertypes::{TypeTerm},
crate::{
editors::{list::ListCursorMode, ObjCommander},
type_system::{Context, ReprTree},
tree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode},
reprTree::{Context, ReprTree},
editTree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode},
},
cgmath::{Vector2},
std::sync::{Arc, RwLock}

View file

@ -3,9 +3,9 @@ use {
view::{singleton::*}
},
crate::{
type_system::{Context, ReprTree},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
editors::{list::{ListEditor, ListCmd, ListCursorMode}, ObjCommander},
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
},
std::{sync::{Arc, RwLock}},

View file

@ -4,7 +4,7 @@ use {
},
laddertypes::{TypeTerm},
crate::{
type_system::{Context, MorphismTypePattern},
reprTree::{Context, MorphismTypePattern},
editors::{
list::{ListEditor, ListSegmentSequence},
typeterm::{State, TypeTermEditor}

View file

@ -11,9 +11,9 @@ use {
},
laddertypes::{TypeID, TypeTerm},
crate::{
type_system::{Context, ReprTree},
reprTree::{Context, ReprTree},
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
editors::{list::{ListCursorMode, ListEditor, ListCmd}, ObjCommander},
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
},
std::{sync::{Arc, RwLock}}
};

View file

@ -7,7 +7,7 @@ use {
}
},
crate::{
tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp},
editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp},
editors::{typeterm::TypeTermEditor, list::ListCursorMode}
},
cgmath::Vector2

View file

@ -1,8 +1,5 @@
pub mod utils;
pub mod editors;
pub mod tree;
pub mod type_system;
pub mod editTree;
pub mod reprTree;
pub fn magic_header() {
eprintln!("<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>");
}

View file

@ -2,8 +2,8 @@ use {
r3vi::{view::{OuterViewPort, singleton::*}, buffer::{singleton::*}},
laddertypes::{TypeDict, TypeTerm, TypeID},
crate::{
type_system::{ReprTree},
tree::NestedNode
reprTree::{ReprTree},
editTree::NestedNode
},
std::{
collections::HashMap,

View file

@ -1,9 +1,12 @@
pub mod context;
pub use {
context::{Context, MorphismMode, MorphismType, MorphismTypePattern},
};
use {
r3vi::view::{AnyOuterViewPort, OuterViewPort, View},
laddertypes::{TypeTerm},
crate::{
type_system::{Context}
},
std::{
collections::HashMap,
sync::{Arc, RwLock},

View file

@ -1,8 +0,0 @@
pub mod context;
pub mod repr_tree;
pub use {
context::{Context, MorphismMode, MorphismType, MorphismTypePattern},
repr_tree::ReprTree
};