workspace2 is compiling

Co-Authored-By: Kirill <kirill@zed.dev>
This commit is contained in:
KCaverly 2023-10-31 11:14:43 -04:00
parent e315e1bb6c
commit 5550e80c4e
5 changed files with 184 additions and 94 deletions

View file

@ -9,11 +9,13 @@ use crate::{
GlobalPixels, GlyphId, InputEvent, LineLayout, Pixels, Point, RenderGlyphParams,
RenderImageParams, RenderSvgParams, Result, Scene, SharedString, Size,
};
use anyhow::anyhow;
use anyhow::{anyhow, bail};
use async_task::Runnable;
use futures::channel::oneshot;
use seahash::SeaHasher;
use serde::{Deserialize, Serialize};
use sqlez::bindable::{Bind, Column, StaticColumnCount};
use sqlez::statement::Statement;
use std::borrow::Cow;
use std::hash::{Hash, Hasher};
use std::time::Duration;
@ -368,6 +370,65 @@ pub enum WindowBounds {
Fixed(Bounds<GlobalPixels>),
}
impl StaticColumnCount for WindowBounds {
fn column_count() -> usize {
5
}
}
impl Bind for WindowBounds {
fn bind(&self, statement: &Statement, start_index: i32) -> Result<i32> {
let (region, next_index) = match self {
WindowBounds::Fullscreen => {
let next_index = statement.bind(&"Fullscreen", start_index)?;
(None, next_index)
}
WindowBounds::Maximized => {
let next_index = statement.bind(&"Maximized", start_index)?;
(None, next_index)
}
WindowBounds::Fixed(region) => {
let next_index = statement.bind(&"Fixed", start_index)?;
(Some(*region), next_index)
}
};
todo!()
// statement.bind(
// &region.map(|region| {
// (
// region.min_x(),
// region.min_y(),
// region.width(),
// region.height(),
// )
// }),
// next_index,
// )
}
}
impl Column for WindowBounds {
fn column(statement: &mut Statement, start_index: i32) -> Result<(Self, i32)> {
let (window_state, next_index) = String::column(statement, start_index)?;
let bounds = match window_state.as_str() {
"Fullscreen" => WindowBounds::Fullscreen,
"Maximized" => WindowBounds::Maximized,
"Fixed" => {
// let ((x, y, width, height), _) = Column::column(statement, next_index)?;
// WindowBounds::Fixed(RectF::new(
// Vector2F::new(x, y),
// Vector2F::new(width, height),
// ))
todo!()
}
_ => bail!("Window State did not have a valid string"),
};
Ok((bounds, next_index + 4))
}
}
#[derive(Copy, Clone, Debug)]
pub enum WindowAppearance {
Light,