tweaked project mode layout +unsaved detection
This commit is contained in:
parent
024c8579f6
commit
d5c5ab9dba
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "calcifer"
|
name = "calcifer"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
@ -48,5 +48,6 @@ Real Ui
|
||||||
Better error handling
|
Better error handling
|
||||||
|
|
||||||
|
|
||||||
# releases :
|
#1.2.0 :
|
||||||
latest : command can fetch multiple lines in the buffer in one frame
|
Project mode (when opening a .project file)
|
||||||
|
Support for js
|
||||||
|
|
1
calcifer.project
Normal file
1
calcifer.project
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"categories":[{"name":"to do","content":[{"name":"clean up","description":"using the feedback from ourstory discord","id":1},{"name":"be able to delete item","description":"in project mode add a button in item edit window to delete an item","id":4},{"name":"be able to delete category","description":"in project mode, if no focus and name is empty => delete category\n\nalready did xD I am a geniius\nfor clarification, I had a loong pause in develompent, and had forgotten I had this implemented, and while looking for where to code it, i found at the exact right place, the exact code needed","id":5},{"name":"update category layout","description":"take inspo form tab layout (number of column is max( min col, n_col +1)\nor scroll ?","id":6},{"name":"keep tree in save","description":"keep track of the opened tabs and reopens them\n","id":1},{"name":"u","description":"// Hello there","id":2},{"name":"less enter trigger (project)","description":"if in a textbox, don't open the item window when enter is pressed","id":3}]},{"name":"in progress","content":[]},{"name":"done","content":[{"name":"mark tab as unsaved (project)","description":"when modifying a project, mark it as unsaved","id":2},{"name":"fix + color in project","description":"the '+' to add an item has a wrong color if last item in list is selected","id":3}]},{"name":"bugs","content":[]},{"name":"+","content":[]}]}
|
|
@ -357,7 +357,12 @@ impl Calcifer {
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.project_content.save_to_code() {
|
match self.project_content.save_to_code() {
|
||||||
Ok(code) => current_tab.code = code,
|
Ok(code) => {
|
||||||
|
if current_tab.code != code {
|
||||||
|
current_tab.code = code;
|
||||||
|
current_tab.saved = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Err(_err) => (),
|
Err(_err) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ use eframe::egui;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::min,
|
cmp::min,
|
||||||
|
cmp::max,
|
||||||
sync::atomic::{AtomicUsize, Ordering},
|
sync::atomic::{AtomicUsize, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,10 +55,8 @@ impl Project {
|
||||||
fn add_category(&mut self) {
|
fn add_category(&mut self) {
|
||||||
let last = self.categories.len() - 1;
|
let last = self.categories.len() - 1;
|
||||||
self.categories[last].initialize();
|
self.categories[last].initialize();
|
||||||
if self.categories.len() < MAX_PROJECT_COLUMNS {
|
|
||||||
self.categories.push(Category::create());
|
self.categories.push(Category::create());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn delete_category(&mut self, index: usize) {
|
fn delete_category(&mut self, index: usize) {
|
||||||
self.categories.remove(index);
|
self.categories.remove(index);
|
||||||
|
@ -125,7 +124,7 @@ fn get_id() -> usize {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project) {
|
pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project) {
|
||||||
ui.columns(MAX_PROJECT_COLUMNS, |uis| {
|
ui.columns(max(MAX_PROJECT_COLUMNS, project.categories.len() + 1) , |uis| {
|
||||||
for (category_index, category) in project.categories.clone().into_iter().enumerate() {
|
for (category_index, category) in project.categories.clone().into_iter().enumerate() {
|
||||||
let ui = &mut uis[category_index];
|
let ui = &mut uis[category_index];
|
||||||
|
|
||||||
|
@ -172,6 +171,8 @@ pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ui.style_mut().visuals.override_text_color =
|
||||||
|
Some(hex_str_to_color(theme.literals));
|
||||||
if category.name != "+" && ui.add(egui::Button::new("+")).clicked() {
|
if category.name != "+" && ui.add(egui::Button::new("+")).clicked() {
|
||||||
project.categories[category_index]
|
project.categories[category_index]
|
||||||
.content
|
.content
|
||||||
|
|
Loading…
Reference in a new issue