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

Set line border #267

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions crates/buildtools/src/generate.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use gents::FileGroup;
use logisheets_controller::controller::display::{
CellPosition, DisplayResponse, DisplaySheetRequest, DisplayWindowRequest,
DisplayWindowWithStartPoint, SheetInfo,
CellPosition, DisplayWindowRequest, DisplayWindowWithStartPoint, SheetInfo,
};
use logisheets_controller::edit_action::{ActionEffect, AsyncFuncResult, EditAction};
use logisheets_controller::{CellInfo, ErrorMessage, SheetDimension};

fn main() {
let path = "packages/web/src/bindings";
let mut file_group = FileGroup::new();
file_group.add::<DisplaySheetRequest>();
file_group.add::<DisplayWindowRequest>();
file_group.add::<DisplayResponse>();
file_group.add::<CellPosition>();
file_group.add::<DisplayWindowWithStartPoint>();
file_group.add::<EditAction>();
Expand Down
7 changes: 1 addition & 6 deletions crates/controller/src/api/workbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;

use super::{cell_positioner::CellPositioner, worksheet::Worksheet};
use crate::{
controller::display::{DisplayResponse, DisplaySheetRequest, SheetInfo},
controller::display::SheetInfo,
edit_action::{ActionEffect, StatusCode},
lock::{locked_write, new_locked, Locked},
Controller,
Expand Down Expand Up @@ -74,11 +74,6 @@ impl Workbook {
self.controller.redo()
}

#[inline]
pub fn get_display_sheet_response(&self, req: DisplaySheetRequest) -> Result<DisplayResponse> {
self.controller.get_display_sheet_response(req)
}

#[inline]
pub fn handle_async_calc_results(
&mut self,
Expand Down
22 changes: 0 additions & 22 deletions crates/controller/src/controller/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ use super::style::Style;
use logisheets_base::{BlockId, SheetId};
use serde::Serialize;

#[derive(Debug, Clone)]
#[cfg_attr(
feature = "gents",
gents_derives::gents_header(file_name = "display_response.ts")
)]
pub struct DisplayResponse {
pub incremental: bool,
pub patches: Vec<DisplayPatch>,
}

#[derive(Debug, Clone)]
#[cfg_attr(
feature = "gents",
Expand Down Expand Up @@ -109,18 +99,6 @@ pub struct BlockInfo {
pub col_cnt: usize,
}

#[derive(Debug, Clone, Serialize)]
#[cfg_attr(feature = "gents", derive(gents_derives::TS))]
#[cfg_attr(
feature = "gents",
ts(file_name = "display_sheet_request.ts", rename_all = "camelCase")
)]
#[serde(rename_all = "camelCase")]
pub struct DisplaySheetRequest {
pub sheet_idx: usize,
pub version: u32,
}

#[derive(Debug, Clone, Serialize)]
#[cfg_attr(feature = "gents", derive(gents_derives::TS))]
#[cfg_attr(
Expand Down
23 changes: 1 addition & 22 deletions crates/controller/src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub mod display;
mod executor;
pub mod status;
pub mod style;
mod viewer;
use crate::edit_action::{
ActionEffect, CreateSheet, EditAction, PayloadsAction, RecalcCell, StatusCode,
WorkbookUpdateType,
Expand All @@ -21,9 +20,8 @@ use crate::settings::Settings;
use crate::version_manager::VersionManager;
use executor::Executor;
use status::Status;
use viewer::SheetViewer;

use self::display::{DisplayResponse, DisplaySheetRequest, SheetInfo};
use self::display::SheetInfo;
use crate::async_func_manager::AsyncFuncManager;

pub struct Controller {
Expand Down Expand Up @@ -221,25 +219,6 @@ impl Controller {
self.handle_action(EditAction::Recalc(pending_cells))
}

pub fn get_display_sheet_response(&self, req: DisplaySheetRequest) -> Result<DisplayResponse> {
let viewer = SheetViewer::default();
if req.version == 0 {
return Ok(viewer.display_with_idx(self, req.sheet_idx));
}

let sheet_id = self
.get_sheet_id_by_idx(req.sheet_idx)
.ok_or(Error::UnavailableSheetIdx(req.sheet_idx))?;
if let Some(diff) = self
.version_manager
.get_sheet_diffs_from_version(sheet_id, req.version)
{
Ok(viewer.display_with_diff(self, sheet_id, diff))
} else {
Ok(viewer.display_with_idx(self, req.sheet_idx))
}
}

pub fn undo(&mut self) -> bool {
match self.version_manager.undo() {
Some(mut last_status) => {
Expand Down
Loading