Start project config file support & rework UI

This commit is contained in:
Luke Street
2023-08-07 20:11:56 -04:00
parent b02e32f2b7
commit f5f6869029
13 changed files with 789 additions and 210 deletions
Generated
+78 -4
View File
@@ -508,6 +508,16 @@ dependencies = [
"log",
]
[[package]]
name = "bstr"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
dependencies = [
"memchr",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.12.0"
@@ -885,7 +895,16 @@ version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys",
"dirs-sys 0.3.7",
]
[[package]]
name = "dirs"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
"dirs-sys 0.4.1",
]
[[package]]
@@ -899,6 +918,18 @@ dependencies = [
"winapi",
]
[[package]]
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.48.0",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
@@ -1455,6 +1486,20 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "globset"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
dependencies = [
"aho-corasick",
"bstr",
"fnv",
"log",
"regex",
"serde",
]
[[package]]
name = "glow"
version = "0.12.1"
@@ -2421,11 +2466,13 @@ dependencies = [
"console_error_panic_hook",
"const_format",
"cwdemangle",
"dirs 5.0.1",
"eframe",
"egui",
"egui_extras",
"exec",
"flagset",
"globset",
"log",
"memmap2 0.7.1",
"notify",
@@ -2438,6 +2485,8 @@ dependencies = [
"rfd",
"self_update",
"serde",
"serde_json",
"serde_yaml",
"tempfile",
"thiserror",
"time",
@@ -2519,6 +2568,12 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "orbclient"
version = "0.3.45"
@@ -3131,9 +3186,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.100"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c"
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
dependencies = [
"itoa",
"ryu",
@@ -3172,6 +3227,19 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_yaml"
version = "0.9.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
dependencies = [
"indexmap 2.0.0",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "sha1"
version = "0.10.5"
@@ -3701,6 +3769,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "unsafe-libyaml"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
[[package]]
name = "untrusted"
version = "0.7.1"
@@ -3965,7 +4039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579cc485bd5ce5bfa0d738e4921dd0b956eca9800be1fd2e5257ebe95bc4617e"
dependencies = [
"core-foundation",
"dirs",
"dirs 4.0.0",
"jni",
"log",
"ndk-context",
+5 -1
View File
@@ -23,14 +23,17 @@ wgpu = ["eframe/wgpu"]
[dependencies]
anyhow = "1.0.71"
byteorder = "1.4.3"
bytes = "1.4.0"
cfg-if = "1.0.0"
const_format = "0.2.31"
cwdemangle = "0.1.5"
dirs = "5.0.1"
eframe = { version = "0.22.0", features = ["persistence"] }
egui = "0.22.0"
egui_extras = "0.22.0"
flagset = "0.4.3"
globset = { version = "0.4.13", features = ["serde1"] }
log = "0.4.19"
memmap2 = "0.7.1"
notify = "6.0.1"
@@ -40,12 +43,13 @@ ppc750cl = { git = "https://github.com/terorie/ppc750cl", rev = "9ae36eef34aa6d7
rabbitizer = "1.7.4"
rfd = { version = "0.11.4" } #, default-features = false, features = ['xdg-portal']
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.104"
serde_yaml = "0.9.25"
tempfile = "3.6.0"
thiserror = "1.0.41"
time = { version = "0.3.22", features = ["formatting", "local-offset"] }
toml = "0.7.6"
twox-hash = "1.6.3"
byteorder = "1.4.3"
# For Linux static binaries, use rustls
[target.'cfg(target_os = "linux")'.dependencies]
+118 -109
View File
@@ -1,6 +1,5 @@
use std::{
default::Default,
ffi::OsStr,
path::{Path, PathBuf},
rc::Rc,
sync::{
@@ -11,17 +10,24 @@ use std::{
};
use egui::{Color32, FontFamily, FontId, TextStyle};
use globset::{Glob, GlobSet, GlobSetBuilder};
use notify::{RecursiveMode, Watcher};
use time::{OffsetDateTime, UtcOffset};
use crate::{
config::{build_globset, load_project_config, ProjectUnit, ProjectUnitNode, CONFIG_FILENAMES},
jobs::{
check_update::{queue_check_update, CheckUpdateResult},
objdiff::{queue_build, BuildStatus, ObjDiffResult},
Job, JobResult, JobState, JobStatus,
},
views::{
config::config_ui, data_diff::data_diff_ui, function_diff::function_diff_ui, jobs::jobs_ui,
appearance::{appearance_window, DEFAULT_COLOR_ROTATION},
config::{config_ui, project_window},
data_diff::data_diff_ui,
demangle::demangle_window,
function_diff::function_diff_ui,
jobs::jobs_ui,
symbol_diff::symbol_diff_ui,
},
};
@@ -49,18 +55,6 @@ pub struct DiffConfig {
// pub mapped_symbols: HashMap<String, String>,
}
const DEFAULT_COLOR_ROTATION: [Color32; 9] = [
Color32::from_rgb(255, 0, 255),
Color32::from_rgb(0, 255, 255),
Color32::from_rgb(0, 128, 0),
Color32::from_rgb(255, 0, 0),
Color32::from_rgb(255, 255, 0),
Color32::from_rgb(255, 192, 203),
Color32::from_rgb(0, 0, 255),
Color32::from_rgb(0, 255, 0),
Color32::from_rgb(213, 138, 138),
];
#[derive(serde::Deserialize, serde::Serialize)]
#[serde(default)]
pub struct ViewConfig {
@@ -123,12 +117,16 @@ pub struct ViewState {
#[serde(skip)]
pub current_view: View,
#[serde(skip)]
pub show_config: bool,
pub show_view_config: bool,
#[serde(skip)]
pub show_project_config: bool,
#[serde(skip)]
pub show_demangle: bool,
#[serde(skip)]
pub demangle_text: String,
#[serde(skip)]
pub watch_pattern_text: String,
#[serde(skip)]
pub diff_config: DiffConfig,
#[serde(skip)]
pub search: String,
@@ -149,9 +147,11 @@ impl Default for ViewState {
highlighted_symbol: None,
selected_symbol: None,
current_view: Default::default(),
show_config: false,
show_view_config: false,
show_project_config: false,
show_demangle: false,
demangle_text: String::new(),
watch_pattern_text: String::new(),
diff_config: Default::default(),
search: Default::default(),
utc_offset: UtcOffset::UTC,
@@ -162,7 +162,7 @@ impl Default for ViewState {
}
}
#[derive(Default, Clone, serde::Deserialize, serde::Serialize)]
#[derive(Clone, serde::Deserialize, serde::Serialize)]
#[serde(default)]
pub struct AppConfig {
pub custom_make: Option<String>,
@@ -179,21 +179,53 @@ pub struct AppConfig {
// Whole binary
pub left_obj: Option<PathBuf>,
pub right_obj: Option<PathBuf>,
#[serde(skip)]
pub project_dir_change: bool,
pub watcher_change: bool,
pub watcher_enabled: bool,
#[serde(skip)]
pub queue_update_check: bool,
pub auto_update_check: bool,
// Project config
#[serde(skip)]
pub config_change: bool,
#[serde(skip)]
pub watch_patterns: Vec<Glob>,
#[serde(skip)]
pub load_error: Option<String>,
#[serde(skip)]
pub units: Vec<ProjectUnit>,
#[serde(skip)]
pub unit_nodes: Vec<ProjectUnitNode>,
#[serde(skip)]
pub config_window_open: bool,
}
#[derive(Default, Clone, serde::Deserialize)]
#[serde(default)]
pub struct ProjectConfig {
pub custom_make: Option<String>,
pub project_dir: Option<PathBuf>,
pub target_obj_dir: Option<PathBuf>,
pub base_obj_dir: Option<PathBuf>,
pub build_target: bool,
impl Default for AppConfig {
fn default() -> Self {
Self {
custom_make: None,
available_wsl_distros: None,
selected_wsl_distro: None,
project_dir: None,
target_obj_dir: None,
base_obj_dir: None,
obj_path: None,
build_target: false,
left_obj: None,
right_obj: None,
config_change: false,
watcher_change: false,
watcher_enabled: true,
queue_update_check: false,
auto_update_check: false,
watch_patterns: vec![],
load_error: None,
units: vec![],
unit_nodes: vec![],
config_window_open: false,
}
}
}
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
@@ -206,6 +238,8 @@ pub struct App {
#[serde(skip)]
modified: Arc<AtomicBool>,
#[serde(skip)]
config_modified: Arc<AtomicBool>,
#[serde(skip)]
watcher: Option<notify::RecommendedWatcher>,
#[serde(skip)]
relaunch_path: Rc<Mutex<Option<PathBuf>>>,
@@ -219,6 +253,7 @@ impl Default for App {
view_state: ViewState::default(),
config: Arc::new(Default::default()),
modified: Arc::new(Default::default()),
config_modified: Arc::new(Default::default()),
watcher: None,
relaunch_path: Default::default(),
should_relaunch: false,
@@ -244,7 +279,9 @@ impl App {
let mut app: App = eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
let mut config: AppConfig = eframe::get_value(storage, CONFIG_KEY).unwrap_or_default();
if config.project_dir.is_some() {
config.project_dir_change = true;
config.config_change = true;
config.watcher_change = true;
app.modified.store(true, Ordering::Relaxed);
}
config.queue_update_check = config.auto_update_check;
app.config = Arc::new(RwLock::new(config));
@@ -313,15 +350,15 @@ impl eframe::App for App {
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
egui::menu::bar(ui, |ui| {
ui.menu_button("File", |ui| {
if ui.button("Show config").clicked() {
view_state.show_config = !view_state.show_config;
if ui.button("Appearance…").clicked() {
view_state.show_view_config = !view_state.show_view_config;
}
if ui.button("Quit").clicked() {
frame.close();
}
});
ui.menu_button("Tools", |ui| {
if ui.button("Demangle").clicked() {
if ui.button("Demangle…").clicked() {
view_state.show_demangle = !view_state.show_demangle;
}
});
@@ -367,69 +404,9 @@ impl eframe::App for App {
});
}
egui::Window::new("Config").open(&mut view_state.show_config).show(ctx, |ui| {
egui::ComboBox::from_label("Theme")
.selected_text(format!("{:?}", view_state.view_config.theme))
.show_ui(ui, |ui| {
ui.selectable_value(
&mut view_state.view_config.theme,
eframe::Theme::Dark,
"Dark",
);
ui.selectable_value(
&mut view_state.view_config.theme,
eframe::Theme::Light,
"Light",
);
});
ui.label("UI font:");
egui::introspection::font_id_ui(ui, &mut view_state.view_config.ui_font);
ui.separator();
ui.label("Code font:");
egui::introspection::font_id_ui(ui, &mut view_state.view_config.code_font);
ui.separator();
ui.label("Diff colors:");
if ui.button("Reset").clicked() {
view_state.view_config.diff_colors = DEFAULT_COLOR_ROTATION.to_vec();
}
let mut remove_at: Option<usize> = None;
let num_colors = view_state.view_config.diff_colors.len();
for (idx, color) in view_state.view_config.diff_colors.iter_mut().enumerate() {
ui.horizontal(|ui| {
ui.color_edit_button_srgba(color);
if num_colors > 1 && ui.small_button("-").clicked() {
remove_at = Some(idx);
}
});
}
if let Some(idx) = remove_at {
view_state.view_config.diff_colors.remove(idx);
}
if ui.small_button("+").clicked() {
view_state.view_config.diff_colors.push(Color32::BLACK);
}
});
egui::Window::new("Demangle").open(&mut view_state.show_demangle).show(ctx, |ui| {
ui.text_edit_singleline(&mut view_state.demangle_text);
ui.add_space(10.0);
if let Some(demangled) =
cwdemangle::demangle(&view_state.demangle_text, &Default::default())
{
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(TextStyle::Monospace);
ui.colored_label(view_state.view_config.replace_color, &demangled);
});
if ui.button("Copy").clicked() {
ui.output_mut(|output| output.copied_text = demangled);
}
} else {
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(TextStyle::Monospace);
ui.colored_label(view_state.view_config.replace_color, "[invalid]");
});
}
});
project_window(ctx, config, view_state);
appearance_window(ctx, view_state);
demangle_window(ctx, view_state);
// Windows + request_repaint_after breaks dialogs:
// https://github.com/emilk/egui/issues/2003
@@ -535,15 +512,42 @@ impl eframe::App for App {
}
if let Ok(mut config) = self.config.write() {
if config.project_dir_change {
let config = &mut *config;
if self.config_modified.load(Ordering::Relaxed) {
self.config_modified.store(false, Ordering::Relaxed);
config.config_change = true;
}
if config.config_change {
config.config_change = false;
if let Err(e) = load_project_config(config) {
log::error!("Failed to load project config: {e}");
config.load_error = Some(format!("{e}"));
}
}
if config.watcher_change {
drop(self.watcher.take());
if let Some(project_dir) = &config.project_dir {
match create_watcher(self.modified.clone(), project_dir) {
Ok(watcher) => self.watcher = Some(watcher),
Err(e) => log::error!("Failed to create watcher: {e}"),
if !config.watch_patterns.is_empty() {
match build_globset(&config.watch_patterns)
.map_err(anyhow::Error::new)
.and_then(|globset| {
create_watcher(
self.modified.clone(),
self.config_modified.clone(),
project_dir,
globset,
)
.map_err(anyhow::Error::new)
}) {
Ok(watcher) => self.watcher = Some(watcher),
Err(e) => log::error!("Failed to create watcher: {e}"),
}
}
config.project_dir_change = false;
self.modified.store(true, Ordering::Relaxed);
config.watcher_change = false;
}
}
@@ -572,22 +576,27 @@ impl eframe::App for App {
fn create_watcher(
modified: Arc<AtomicBool>,
config_modified: Arc<AtomicBool>,
project_dir: &Path,
patterns: GlobSet,
) -> notify::Result<notify::RecommendedWatcher> {
let mut config_patterns = GlobSetBuilder::new();
for filename in CONFIG_FILENAMES {
config_patterns.add(Glob::new(&format!("**/{filename}")).unwrap());
}
let config_patterns = config_patterns.build().unwrap();
let mut watcher =
notify::recommended_watcher(move |res: notify::Result<notify::Event>| match res {
Ok(event) => {
if matches!(event.kind, notify::EventKind::Modify(..)) {
let watch_extensions = &[
Some(OsStr::new("c")),
Some(OsStr::new("cp")),
Some(OsStr::new("cpp")),
Some(OsStr::new("h")),
Some(OsStr::new("hpp")),
Some(OsStr::new("s")),
];
if event.paths.iter().any(|p| watch_extensions.contains(&p.extension())) {
modified.store(true, Ordering::Relaxed);
for path in &event.paths {
if config_patterns.is_match(path) {
config_modified.store(true, Ordering::Relaxed);
}
if patterns.is_match(path) {
modified.store(true, Ordering::Relaxed);
}
}
}
}
+123
View File
@@ -0,0 +1,123 @@
use std::{
fs::File,
path::{Component, Path, PathBuf},
};
use anyhow::{Context, Result};
use globset::{Glob, GlobSet, GlobSetBuilder};
use crate::app::AppConfig;
#[derive(Default, Clone, serde::Deserialize)]
#[serde(default)]
pub struct ProjectConfig {
pub custom_make: Option<String>,
pub target_dir: Option<PathBuf>,
pub base_dir: Option<PathBuf>,
pub build_target: bool,
pub watch_patterns: Vec<Glob>,
pub units: Vec<ProjectUnit>,
}
#[derive(Default, Clone, serde::Deserialize)]
pub struct ProjectUnit {
pub name: String,
pub path: PathBuf,
#[serde(default)]
pub reverse_fn_order: bool,
}
#[derive(Clone)]
pub enum ProjectUnitNode {
File(String, ProjectUnit),
Dir(String, Vec<ProjectUnitNode>),
}
fn find_dir<'a>(name: &str, nodes: &'a mut Vec<ProjectUnitNode>) -> &'a mut Vec<ProjectUnitNode> {
if let Some(index) = nodes
.iter()
.position(|node| matches!(node, ProjectUnitNode::Dir(dir_name, _) if dir_name == name))
{
if let ProjectUnitNode::Dir(_, children) = &mut nodes[index] {
return children;
}
} else {
nodes.push(ProjectUnitNode::Dir(name.to_string(), vec![]));
if let Some(ProjectUnitNode::Dir(_, children)) = nodes.last_mut() {
return children;
}
}
unreachable!();
}
fn build_nodes(units: &[ProjectUnit]) -> Vec<ProjectUnitNode> {
let mut nodes = vec![];
for unit in units {
let mut out_nodes = &mut nodes;
let path = Path::new(&unit.name);
if let Some(parent) = path.parent() {
for component in parent.components() {
if let Component::Normal(name) = component {
let name = name.to_str().unwrap();
out_nodes = find_dir(name, out_nodes);
}
}
}
let filename = path.file_name().unwrap().to_str().unwrap().to_string();
out_nodes.push(ProjectUnitNode::File(filename, unit.clone()));
}
nodes
}
pub const CONFIG_FILENAMES: [&str; 3] = ["objdiff.yml", "objdiff.yaml", "objdiff.json"];
pub fn load_project_config(config: &mut AppConfig) -> Result<()> {
let Some(project_dir) = &config.project_dir else {
return Ok(());
};
if let Some(result) = try_project_config(project_dir) {
let project_config = result?;
config.custom_make = project_config.custom_make;
config.target_obj_dir = project_config.target_dir.map(|p| project_dir.join(p));
config.base_obj_dir = project_config.base_dir.map(|p| project_dir.join(p));
config.build_target = project_config.build_target;
config.watch_patterns = project_config.watch_patterns;
config.watcher_change = true;
config.units = project_config.units;
config.unit_nodes = build_nodes(&config.units);
}
Ok(())
}
fn try_project_config(dir: &Path) -> Option<Result<ProjectConfig>> {
for filename in CONFIG_FILENAMES.iter() {
let config_path = dir.join(filename);
if config_path.is_file() {
return match filename.contains("json") {
true => Some(read_json_config(&config_path)),
false => Some(read_yml_config(&config_path)),
};
}
}
None
}
fn read_yml_config(config_path: &Path) -> Result<ProjectConfig> {
let mut reader = File::open(config_path)
.with_context(|| format!("Failed to open config file '{}'", config_path.display()))?;
Ok(serde_yaml::from_reader(&mut reader)?)
}
fn read_json_config(config_path: &Path) -> Result<ProjectConfig> {
let mut reader = File::open(config_path)
.with_context(|| format!("Failed to open config file '{}'", config_path.display()))?;
Ok(serde_json::from_reader(&mut reader)?)
}
pub fn build_globset(vec: &[Glob]) -> std::result::Result<GlobSet, globset::Error> {
let mut builder = GlobSetBuilder::new();
for glob in vec {
builder.add(glob.clone());
}
builder.build()
}
+1
View File
@@ -3,6 +3,7 @@
pub use app::App;
mod app;
mod config;
mod diff;
mod editops;
mod jobs;
+1 -1
View File
@@ -181,7 +181,7 @@ fn find_section_symbol(
fn relocations_by_section(
arch: ObjArchitecture,
obj_file: &File<'_>,
section: &mut ObjSection,
section: &ObjSection,
) -> Result<Vec<ObjReloc>> {
let obj_section = obj_file.section_by_index(SectionIndex(section.index))?;
let mut relocations = Vec::<ObjReloc>::new();
+56
View File
@@ -0,0 +1,56 @@
use egui::Color32;
use crate::app::ViewState;
pub const DEFAULT_COLOR_ROTATION: [Color32; 9] = [
Color32::from_rgb(255, 0, 255),
Color32::from_rgb(0, 255, 255),
Color32::from_rgb(0, 128, 0),
Color32::from_rgb(255, 0, 0),
Color32::from_rgb(255, 255, 0),
Color32::from_rgb(255, 192, 203),
Color32::from_rgb(0, 0, 255),
Color32::from_rgb(0, 255, 0),
Color32::from_rgb(213, 138, 138),
];
pub fn appearance_window(ctx: &egui::Context, view_state: &mut ViewState) {
egui::Window::new("Appearance").open(&mut view_state.show_view_config).show(ctx, |ui| {
egui::ComboBox::from_label("Theme")
.selected_text(format!("{:?}", view_state.view_config.theme))
.show_ui(ui, |ui| {
ui.selectable_value(&mut view_state.view_config.theme, eframe::Theme::Dark, "Dark");
ui.selectable_value(
&mut view_state.view_config.theme,
eframe::Theme::Light,
"Light",
);
});
ui.label("UI font:");
egui::introspection::font_id_ui(ui, &mut view_state.view_config.ui_font);
ui.separator();
ui.label("Code font:");
egui::introspection::font_id_ui(ui, &mut view_state.view_config.code_font);
ui.separator();
ui.label("Diff colors:");
if ui.button("Reset").clicked() {
view_state.view_config.diff_colors = DEFAULT_COLOR_ROTATION.to_vec();
}
let mut remove_at: Option<usize> = None;
let num_colors = view_state.view_config.diff_colors.len();
for (idx, color) in view_state.view_config.diff_colors.iter_mut().enumerate() {
ui.horizontal(|ui| {
ui.color_edit_button_srgba(color);
if num_colors > 1 && ui.small_button("-").clicked() {
remove_at = Some(idx);
}
});
}
if let Some(idx) = remove_at {
view_state.view_config.diff_colors.remove(idx);
}
if ui.small_button("+").clicked() {
view_state.view_config.diff_colors.push(Color32::BLACK);
}
});
}
+375 -91
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -213,7 +213,7 @@ pub fn data_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
ui.label("Building...");
ui.colored_label(view_state.view_config.replace_color, "Building…");
} else {
ui.label("Last built:");
let format =
+26
View File
@@ -0,0 +1,26 @@
use egui::TextStyle;
use crate::app::ViewState;
pub fn demangle_window(ctx: &egui::Context, view_state: &mut ViewState) {
egui::Window::new("Demangle").open(&mut view_state.show_demangle).show(ctx, |ui| {
ui.text_edit_singleline(&mut view_state.demangle_text);
ui.add_space(10.0);
if let Some(demangled) =
cwdemangle::demangle(&view_state.demangle_text, &Default::default())
{
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(TextStyle::Monospace);
ui.colored_label(view_state.view_config.replace_color, &demangled);
});
if ui.button("Copy").clicked() {
ui.output_mut(|output| output.copied_text = demangled);
}
} else {
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(TextStyle::Monospace);
ui.colored_label(view_state.view_config.replace_color, "[invalid]");
});
}
});
}
+1 -1
View File
@@ -446,7 +446,7 @@ pub fn function_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
ui.label("Building...");
ui.colored_label(view_state.view_config.replace_color, "Building…");
} else {
ui.label("Last built:");
let format =
+2 -2
View File
@@ -35,14 +35,14 @@ pub fn jobs_ui(ui: &mut egui::Ui, view_state: &mut ViewState) {
ui.colored_label(
view_state.view_config.delete_color,
if err_string.len() > STATUS_LENGTH - 10 {
format!("Error: {}...", &err_string[0..STATUS_LENGTH - 10])
format!("Error: {}", &err_string[0..STATUS_LENGTH - 10])
} else {
format!("Error: {:width$}", err_string, width = STATUS_LENGTH - 7)
},
);
} else {
ui.label(if status.status.len() > STATUS_LENGTH - 3 {
format!("{}...", &status.status[0..STATUS_LENGTH - 3])
format!("{}", &status.status[0..STATUS_LENGTH - 3])
} else {
format!("{:width$}", &status.status, width = STATUS_LENGTH)
});
+2
View File
@@ -1,7 +1,9 @@
use egui::{text::LayoutJob, Color32, FontId, TextFormat};
pub(crate) mod appearance;
pub(crate) mod config;
pub(crate) mod data_diff;
pub(crate) mod demangle;
pub(crate) mod function_diff;
pub(crate) mod jobs;
pub(crate) mod symbol_diff;