106 lines
1.6 KiB
Rust
106 lines
1.6 KiB
Rust
use std::path::Path;
|
|
use std::{fs::File, io::Write};
|
|
|
|
use cowgen::{CowError, Text};
|
|
use iced::Sandbox;
|
|
use iced::Settings;
|
|
|
|
fn main() -> Result<(), CowError> {
|
|
Cowmic::run(Settings::default())
|
|
}
|
|
|
|
struct Element {
|
|
position: (i32, i32),
|
|
dimensions: (i32, i32),
|
|
media: Media,
|
|
}
|
|
|
|
struct Text {}
|
|
|
|
struct Image {}
|
|
|
|
enum Media {
|
|
Image(Path),
|
|
Text(Text),
|
|
}
|
|
|
|
struct Template {
|
|
image_path: String,
|
|
elements: Vec<Element>
|
|
}
|
|
|
|
struct Cowmic {
|
|
templates: Vec<Template>,
|
|
view: View,
|
|
}
|
|
|
|
enum Message {}
|
|
|
|
impl Sandbox for Cowmic {
|
|
type Message = Message;
|
|
|
|
fn new() -> Self {
|
|
Self {
|
|
view: View::Library(Library::View::new()),
|
|
templates: vec![],
|
|
}
|
|
}
|
|
|
|
fn title(&self) -> String {
|
|
"Cowmic".to_string()
|
|
}
|
|
|
|
fn update(&mut self, message: Self::Message) {
|
|
todo!()
|
|
}
|
|
|
|
fn view(&self) -> iced::Element<'_, Self::Message> {
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
// library -> view template -> create image (fill out template) -> save to filesystem
|
|
// \-> new template
|
|
enum View {
|
|
Library(Library::View),
|
|
// Template(Template),
|
|
// Generate(Generate),
|
|
}
|
|
|
|
// features:
|
|
// import template
|
|
// delete template
|
|
// rename template
|
|
// autosave all templates
|
|
mod Library {
|
|
use super::Template;
|
|
|
|
pub struct View;
|
|
|
|
impl View {
|
|
pub fn new(templates: Vec<Template>) -> Self {
|
|
Self
|
|
}
|
|
|
|
fn update(&mut self, message: Message) {
|
|
todo!()
|
|
}
|
|
|
|
fn view(&self) -> iced::Element<'_, Message> {
|
|
todo!()
|
|
}
|
|
}
|
|
enum Message {}
|
|
}
|
|
|
|
mod NewTemplate {
|
|
struct View {
|
|
image: Image
|
|
};
|
|
enum Message {}
|
|
}
|
|
|
|
mod Generate {
|
|
enum Message {}
|
|
}
|