mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-18 17:35:24 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2dd3dd60a8 | |||
| f4757b8d92 | |||
| 52f8c5d4f9 |
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -2457,7 +2457,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objdiff"
|
name = "objdiff"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -4053,9 +4053,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webpki"
|
name = "webpki"
|
||||||
version = "0.22.1"
|
version = "0.22.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e"
|
checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring",
|
"ring",
|
||||||
"untrusted",
|
"untrusted",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "objdiff"
|
name = "objdiff"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.65"
|
rust-version = "1.65"
|
||||||
authors = ["Luke Street <luke@street.dev>"]
|
authors = ["Luke Street <luke@street.dev>"]
|
||||||
|
|||||||
39
src/app.rs
39
src/app.rs
@@ -54,23 +54,39 @@ pub struct ObjectConfig {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn bool_true() -> bool { true }
|
fn bool_true() -> bool { true }
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn default_watch_patterns() -> Vec<Glob> {
|
||||||
|
DEFAULT_WATCH_PATTERNS.iter().map(|s| Glob::new(s).unwrap()).collect()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||||
pub struct AppConfig {
|
pub struct AppConfig {
|
||||||
// TODO: https://github.com/ron-rs/ron/pull/455
|
// TODO: https://github.com/ron-rs/ron/pull/455
|
||||||
// #[serde(flatten)]
|
// #[serde(flatten)]
|
||||||
// pub version: AppConfigVersion,
|
// pub version: AppConfigVersion,
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
#[serde(default)]
|
||||||
pub custom_make: Option<String>,
|
pub custom_make: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
pub selected_wsl_distro: Option<String>,
|
pub selected_wsl_distro: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
pub project_dir: Option<PathBuf>,
|
pub project_dir: Option<PathBuf>,
|
||||||
|
#[serde(default)]
|
||||||
pub target_obj_dir: Option<PathBuf>,
|
pub target_obj_dir: Option<PathBuf>,
|
||||||
|
#[serde(default)]
|
||||||
pub base_obj_dir: Option<PathBuf>,
|
pub base_obj_dir: Option<PathBuf>,
|
||||||
|
#[serde(default)]
|
||||||
pub selected_obj: Option<ObjectConfig>,
|
pub selected_obj: Option<ObjectConfig>,
|
||||||
|
#[serde(default)]
|
||||||
pub build_target: bool,
|
pub build_target: bool,
|
||||||
#[serde(default = "bool_true")]
|
#[serde(default = "bool_true")]
|
||||||
pub rebuild_on_changes: bool,
|
pub rebuild_on_changes: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub auto_update_check: bool,
|
pub auto_update_check: bool,
|
||||||
|
#[serde(default = "default_watch_patterns")]
|
||||||
pub watch_patterns: Vec<Glob>,
|
pub watch_patterns: Vec<Glob>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub recent_projects: Vec<PathBuf>,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub objects: Vec<ProjectObject>,
|
pub objects: Vec<ProjectObject>,
|
||||||
@@ -102,6 +118,7 @@ impl Default for AppConfig {
|
|||||||
rebuild_on_changes: true,
|
rebuild_on_changes: true,
|
||||||
auto_update_check: true,
|
auto_update_check: true,
|
||||||
watch_patterns: DEFAULT_WATCH_PATTERNS.iter().map(|s| Glob::new(s).unwrap()).collect(),
|
watch_patterns: DEFAULT_WATCH_PATTERNS.iter().map(|s| Glob::new(s).unwrap()).collect(),
|
||||||
|
recent_projects: vec![],
|
||||||
objects: vec![],
|
objects: vec![],
|
||||||
object_nodes: vec![],
|
object_nodes: vec![],
|
||||||
watcher_change: false,
|
watcher_change: false,
|
||||||
@@ -115,6 +132,11 @@ impl Default for AppConfig {
|
|||||||
|
|
||||||
impl AppConfig {
|
impl AppConfig {
|
||||||
pub fn set_project_dir(&mut self, path: PathBuf) {
|
pub fn set_project_dir(&mut self, path: PathBuf) {
|
||||||
|
self.recent_projects.retain(|p| p != &path);
|
||||||
|
if self.recent_projects.len() > 9 {
|
||||||
|
self.recent_projects.truncate(9);
|
||||||
|
}
|
||||||
|
self.recent_projects.insert(0, path.clone());
|
||||||
self.project_dir = Some(path);
|
self.project_dir = Some(path);
|
||||||
self.target_obj_dir = None;
|
self.target_obj_dir = None;
|
||||||
self.base_obj_dir = None;
|
self.base_obj_dir = None;
|
||||||
@@ -351,6 +373,23 @@ impl eframe::App for App {
|
|||||||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||||
egui::menu::bar(ui, |ui| {
|
egui::menu::bar(ui, |ui| {
|
||||||
ui.menu_button("File", |ui| {
|
ui.menu_button("File", |ui| {
|
||||||
|
let recent_projects = if let Ok(guard) = config.read() {
|
||||||
|
guard.recent_projects.clone()
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
if recent_projects.is_empty() {
|
||||||
|
ui.add_enabled(false, egui::Button::new("Recent Projects…"));
|
||||||
|
} else {
|
||||||
|
ui.menu_button("Recent Projects…", |ui| {
|
||||||
|
for path in recent_projects {
|
||||||
|
if ui.button(format!("{}", path.display())).clicked() {
|
||||||
|
config.write().unwrap().set_project_dir(path);
|
||||||
|
ui.close_menu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if ui.button("Appearance…").clicked() {
|
if ui.button("Appearance…").clicked() {
|
||||||
*show_appearance_config = !*show_appearance_config;
|
*show_appearance_config = !*show_appearance_config;
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
|
|||||||
Reference in New Issue
Block a user