added project file recognition
This commit is contained in:
parent
415122ea30
commit
94ef5675b7
|
@ -6,6 +6,7 @@ use crate::tools;
|
||||||
use crate::Calcifer;
|
use crate::Calcifer;
|
||||||
use crate::MAX_TABS;
|
use crate::MAX_TABS;
|
||||||
use crate::PATH_ROOT;
|
use crate::PATH_ROOT;
|
||||||
|
use crate::PROJECT_EXTENSION;
|
||||||
use tools::hex_str_to_color;
|
use tools::hex_str_to_color;
|
||||||
|
|
||||||
pub mod code_editor;
|
pub mod code_editor;
|
||||||
|
@ -40,6 +41,11 @@ impl Calcifer {
|
||||||
self.shortcuts_menu.visible = self.toggle(ui, self.shortcuts_menu.visible, "⌨");
|
self.shortcuts_menu.visible = self.toggle(ui, self.shortcuts_menu.visible, "⌨");
|
||||||
ui.separator();
|
ui.separator();
|
||||||
self.profiler_visible = self.toggle(ui, self.profiler_visible, "⚡");
|
self.profiler_visible = self.toggle(ui, self.profiler_visible, "⚡");
|
||||||
|
|
||||||
|
if self.tabs[self.selected_tab.to_index()].language == PROJECT_EXTENSION {
|
||||||
|
ui.separator();
|
||||||
|
self.project_mode = self.toggle(ui, self.project_mode, "🛠");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -208,8 +214,11 @@ impl Calcifer {
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
if self.project_mode && self.tabs[self.selected_tab.to_index()].language == PROJECT_EXTENSION {
|
||||||
|
self.draw_project_file(ui);
|
||||||
|
} else {
|
||||||
self.draw_code_file(ui);
|
self.draw_code_file(ui);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +252,10 @@ impl Calcifer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn draw_project_file(&mut self, ui: &mut egui::Ui) {
|
||||||
|
ui.label("project mode");
|
||||||
|
}
|
||||||
|
|
||||||
pub fn draw_windows(&mut self, ctx: &egui::Context) {
|
pub fn draw_windows(&mut self, ctx: &egui::Context) {
|
||||||
if self.search_menu.visible {
|
if self.search_menu.visible {
|
||||||
self.search_menu
|
self.search_menu
|
||||||
|
|
|
@ -25,6 +25,7 @@ mod build {
|
||||||
use build::SAVE_PATH;
|
use build::SAVE_PATH;
|
||||||
use build::TITLE;
|
use build::TITLE;
|
||||||
|
|
||||||
|
const PROJECT_EXTENSION : &str = "project";
|
||||||
const TERMINAL_HEIGHT: f32 = 200.0;
|
const TERMINAL_HEIGHT: f32 = 200.0;
|
||||||
const TERMINAL_RANGE: Range<f32> = 100.0..500.0;
|
const TERMINAL_RANGE: Range<f32> = 100.0..500.0;
|
||||||
const RED: egui::Color32 = egui::Color32::from_rgb(235, 108, 99);
|
const RED: egui::Color32 = egui::Color32::from_rgb(235, 108, 99);
|
||||||
|
@ -73,6 +74,8 @@ struct Calcifer {
|
||||||
theme: ColorTheme,
|
theme: ColorTheme,
|
||||||
font_size: f32,
|
font_size: f32,
|
||||||
|
|
||||||
|
project_mode: bool,
|
||||||
|
|
||||||
tree_visible: bool,
|
tree_visible: bool,
|
||||||
profiler_visible: bool,
|
profiler_visible: bool,
|
||||||
terminal_visible: bool,
|
terminal_visible: bool,
|
||||||
|
@ -102,6 +105,8 @@ impl Default for Calcifer {
|
||||||
theme: DEFAULT_THEMES[0],
|
theme: DEFAULT_THEMES[0],
|
||||||
font_size: 14.0,
|
font_size: 14.0,
|
||||||
|
|
||||||
|
project_mode: true,
|
||||||
|
|
||||||
tree_visible: false,
|
tree_visible: false,
|
||||||
profiler_visible: false,
|
profiler_visible: false,
|
||||||
terminal_visible: false,
|
terminal_visible: false,
|
||||||
|
|
|
@ -57,6 +57,8 @@ impl Tab {
|
||||||
.and_then(|ext| ext.to_str())
|
.and_then(|ext| ext.to_str())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
println!("language : {}", extension);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
path: file_path.clone(),
|
path: file_path.clone(),
|
||||||
code: text,
|
code: text,
|
||||||
|
|
Loading…
Reference in a new issue