未分類

main

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod grib2;
mod meteo_math;
mod processor;
mod scheduler;
mod storage;

use chrono::Local;
use eframe::egui::{self, Color32, Margin, RichText, Rounding, Stroke, Vec2};
use scheduler::{run_scan_cycle, ScanMode, WorkerMsg};
use serde::{Deserialize, Serialize};
use std::fs::{self, OpenOptions};
use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{self, Receiver};
use std::sync::Arc;
use std::thread::JoinHandle;
use std::time::{Duration, Instant};
use storage::{acquire_engine_lock, cleanup_tmp, release_engine_lock};

// ==========================================
// カラーパレット (旧PyQt6エンジン準拠)
// ==========================================
const COL_BG_DARK: Color32 = Color32::from_rgb(10, 25, 47); // #0A192F
const COL_PANEL_BG: Color32 = Color32::from_rgb(17, 34, 64); // #112240
const COL_BORDER: Color32 = Color32::from_rgb(69, 123, 157); // #457B9D
const COL_CYAN: Color32 = Color32::from_rgb(100, 255, 218); // #64FFDA
const COL_TEXT_MAIN: Color32 = Color32::from_rgb(224, 224, 224); // #E0E0E0
const COL_TEXT_MUTED: Color32 = Color32::from_rgb(136, 146, 176); // #8892B0

const COL_BTN_RED: Color32 = Color32::from_rgb(192, 57, 43); // #C0392B 停止
const COL_BTN_NAVY: Color32 = Color32::from_rgb(29, 53, 87); // #1D3557 スキャン/フォルダ
const COL_BTN_ORANGE: Color32 = Color32::from_rgb(211, 84, 0); // #D35400 最新12時間
const COL_BTN_GREEN: Color32 = Color32::from_rgb(39, 174, 96); // #27AE60 すべてのデータ
const COL_BTN_PURPLE: Color32 = Color32::from_rgb(142, 68, 173); // #8E44AD キャッシュ削除
const COL_BTN_BLUE: Color32 = Color32::from_rgb(41, 128, 185); // #2980B9 出力先設定
const COL_BTN_TEAL: Color32 = Color32::from_rgb(22, 160, 133); // #16A085 ログコピー
const COL_BTN_DARKRED: Color32 = Color32::from_rgb(139, 0, 0); // #8B0000 完全終了

const COL_PROGRESS_FILL: Color32 = Color32::from_rgb(46, 184, 172);
const COL_LOG_WARN: Color32 = Color32::from_rgb(245, 176, 65);
const COL_LOG_ERR: Color32 = Color32::from_rgb(255, 107, 107);

#[derive(Serialize, Deserialize, Clone)]
struct AppConfig {
monitor_folders: [String; 6],
output_dir: String,
scan_mode_all: bool,
}

impl Default for AppConfig {
fn default() -> Self {
let default_out = std::env::current_dir()
.unwrap_or_else(|_| PathBuf::from("."))
.join("gpv_cache_safetensors")
.to_string_lossy()
.to_string();
Self {
monitor_folders: Default::default(),
output_dir: default_out,
scan_mode_all: false,
}
}
}

fn config_file_path() -> PathBuf {
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.join("gpv_engine_config.json")))
.unwrap_or_else(|| PathBuf::from("gpv_engine_config.json"))
}

fn load_config() -> AppConfig {
fs::read_to_string(config_file_path())
.ok()
.and_then(|s| serde_json::from_str(&s).ok())
.unwrap_or_default()
}

fn save_config(cfg: &AppConfig) {
if let Ok(json) = serde_json::to_string_pretty(cfg) {
let _ = fs::write(config_file_path(), json);
}
}

fn setup_fonts_and_theme(ctx: &egui::Context) {
// 日本語フォント + 記号フォールバック読み込み
let mut fonts = egui::FontDefinitions::default();
let jp_candidates = [
r"C:\Windows\Fonts\meiryo.ttc",
r"C:\Windows\Fonts\YuGothM.ttc",
r"C:\Windows\Fonts\msgothic.ttc",
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
];
for p in jp_candidates {
if let Ok(bytes) = fs::read(p) {
fonts
.font_data
.insert("jp".to_owned(), egui::FontData::from_owned(bytes));
fonts
.families
.entry(egui::FontFamily::Proportional)
.or_default()
.insert(0, "jp".to_owned());
fonts
.families
.entry(egui::FontFamily::Monospace)
.or_default()
.insert(0, "jp".to_owned());
break;
}
}

// 記号・アイコン用のフォールバック (Windows標準)
let sym_candidates = [
r"C:\Windows\Fonts\seguisym.ttf",
r"C:\Windows\Fonts\seguiemj.ttf",
];
for (idx, p) in sym_candidates.iter().enumerate() {
if let Ok(bytes) = fs::read(p) {
let key = format!("sym_{idx}");
fonts
.font_data
.insert(key.clone(), egui::FontData::from_owned(bytes));
fonts
.families
.entry(egui::FontFamily::Proportional)
.or_default()
.push(key.clone());
fonts
.families
.entry(egui::FontFamily::Monospace)
.or_default()
.push(key);
}
}
ctx.set_fonts(fonts);

// ダークネイビーテーマ適用
let mut visuals = egui::Visuals::dark();
visuals.panel_fill = COL_BG_DARK;
visuals.window_fill = COL_PANEL_BG;
visuals.window_stroke = Stroke::new(1.5, COL_CYAN);
visuals.window_rounding = Rounding::same(8.0);
visuals.extreme_bg_color = COL_PANEL_BG;
visuals.faint_bg_color = COL_PANEL_BG;
visuals.override_text_color = Some(COL_TEXT_MAIN);
visuals.widgets.noninteractive.bg_fill = COL_PANEL_BG;
visuals.widgets.noninteractive.bg_stroke = Stroke::new(1.0, COL_BORDER);
visuals.widgets.inactive.bg_fill = COL_BTN_NAVY;
visuals.widgets.inactive.bg_stroke = Stroke::new(1.0, COL_BORDER);
visuals.widgets.hovered.bg_fill = COL_BORDER;
visuals.widgets.hovered.bg_stroke = Stroke::new(1.2, COL_CYAN);
visuals.widgets.active.bg_fill = COL_BORDER;
visuals.selection.bg_fill = COL_BORDER;
ctx.set_visuals(visuals);

let mut style = (*ctx.style()).clone();
style.spacing.item_spacing = Vec2::new(8.0, 8.0);
style.spacing.button_padding = Vec2::new(10.0, 6.0);
ctx.set_style(style);
}

/// 旧PyQt6風のスタイル付きボタン描画ヘルパー
fn styled_button(
ui: &mut egui::Ui,
size: Vec2,
label: &str,
bg: Color32,
border: Option<Color32>,
text_color: Color32,
font_size: f32,
) -> egui::Response {
let stroke = match border {
Some(c) => Stroke::new(1.2, c),
None => Stroke::NONE,
};
let btn = egui::Button::new(
RichText::new(label)
.size(font_size)
.strong()
.color(text_color),
)
.fill(bg)
.stroke(stroke)
.rounding(Rounding::same(6.0));
ui.add_sized(size, btn)
}

struct EngineApp {
cfg: AppConfig,
status_text: String,
progress: f32,
logs: Vec<String>,
auto_scan: bool,
last_scan_check: Instant,
lock_ok: bool,
is_processing: bool,
abort_flag: Arc<AtomicBool>,
worker_handle: Option<JoinHandle<()>>,
rx: Option<Receiver<WorkerMsg>>,
confirm_clear_cache: bool,
confirm_exit: bool,
copied_until: Option<Instant>,
thread_count: usize,
}

impl EngineApp {
fn new(cc: &eframe::CreationContext<'_>) -> Self {
setup_fonts_and_theme(&cc.egui_ctx);
let cfg = load_config();
let out_path = PathBuf::from(&cfg.output_dir);
let _ = fs::create_dir_all(&out_path);
let (lock_ok, other_pid) = acquire_engine_lock(&out_path);
let _ = fs::write(out_path.join("system_log.txt"), "");
let thread_count = rayon::current_num_threads();

let mut app = Self {
cfg,
status_text: "状態: 起動中...".into(),
progress: 0.0,
logs: Vec::new(),
auto_scan: true,
last_scan_check: Instant::now() - Duration::from_secs(10),
lock_ok,
is_processing: false,
abort_flag: Arc::new(AtomicBool::new(false)),
worker_handle: None,
rx: None,
confirm_clear_cache: false,
confirm_exit: false,
copied_until: None,
thread_count,
};

app.push_log("===============================");
app.push_log("システム起動: Ver 15.0 (純Rust高速エンジン / Safetensors出力 / 外部依存ゼロ)");
app.push_log(format!(
"⚡ 並列スレッド数: {thread_count} コア (rayon 有効)"
));
if !lock_ok {
app.push_log(format!(
"⛔ 別のエンジン(PID {other_pid})が同じ出力フォルダを処理中です。二重起動防止のため停止します。"
));
app.status_text = "状態: 二重起動ロックにより停止".into();
}
app.push_log("===============================");
app.start_worker();
app
}

fn push_log(&mut self, msg: impl Into<String>) {
let m = msg.into();
let line = format!("[{}] {m}", Local::now().format("%H:%M:%S"));
let log_path = Path::new(&self.cfg.output_dir).join("system_log.txt");
if let Ok(mut f) = OpenOptions::new().create(true).append(true).open(log_path) {
let _ = writeln!(f, "{line}");
}
self.logs.push(line);
if self.logs.len() > 2000 {
self.logs.drain(0..500);
}
}

fn stop_worker_blocking(&mut self) {
if self.is_processing {
self.push_log("⚠️ 現在の抽出処理を安全に中断しています...");
self.abort_flag.store(true, Ordering::Relaxed);
if let Some(h) = self.worker_handle.take() {
let _ = h.join();
}
self.is_processing = false;
self.rx = None;
let n = cleanup_tmp(Path::new(&self.cfg.output_dir), 0);
if n > 0 {
self.push_log(format!("🧹 中断で残った一時ファイルを{n}件削除しました"));
}
}
}

fn start_worker(&mut self) {
if self.is_processing || !self.lock_ok {
return;
}
let folders: Vec<PathBuf> = self
.cfg
.monitor_folders
.iter()
.filter(|s| !s.is_empty())
.map(PathBuf::from)
.collect();
if folders.is_empty() {
self.status_text = "状態: 読込元フォルダ未設定".into();
return;
}

let out_dir = PathBuf::from(&self.cfg.output_dir);
let _ = fs::create_dir_all(&out_dir);
let mode = if self.cfg.scan_mode_all {
ScanMode::All
} else {
ScanMode::Last12h
};

self.abort_flag = Arc::new(AtomicBool::new(false));
let abort_c = Arc::clone(&self.abort_flag);
let (tx, rx) = mpsc::channel();
self.rx = Some(rx);
self.is_processing = true;
self.progress = 0.0;
self.status_text = "状態: スキャン中...".into();

self.worker_handle = Some(std::thread::spawn(move || {
run_scan_cycle(folders, out_dir, mode, abort_c, tx);
}));
}

fn poll_worker(&mut self) {
let mut finished = false;
let mut had_new = false;
if let Some(rx) = &self.rx {
let mut msgs = Vec::new();
while let Ok(m) = rx.try_recv() {
msgs.push(m);
}
for m in msgs {
match m {
WorkerMsg::Log(s) => self.push_log(s),
WorkerMsg::Status(s) => self.status_text = format!("状態: {s}"),
WorkerMsg::Progress(p) => self.progress = p.clamp(0.0, 1.0),
WorkerMsg::Finished(new_data) => {
finished = true;
had_new = new_data;
}
}
}
}
if finished {
if let Some(h) = self.worker_handle.take() {
let _ = h.join();
}
self.is_processing = false;
self.rx = None;
self.last_scan_check = Instant::now();
if !self.abort_flag.load(Ordering::Relaxed) {
if had_new {
self.progress = 1.0;
}
self.status_text = if self.auto_scan {
"状態: 待機中 (自動スキャン継続中)".into()
} else {
"状態: 停止中".into()
};
}
}
}

fn clear_cache_exec(&mut self) {
self.auto_scan = false;
self.stop_worker_blocking();
self.push_log("🗑️ キャッシュデータのお掃除を開始します...");
let out_dir = Path::new(&self.cfg.output_dir);
if let Ok(rd) = fs::read_dir(out_dir) {
for e in rd.flatten() {
let name = e.file_name().to_string_lossy().to_string();
if name.ends_with(".safetensors")
|| name.ends_with(".npz")
|| name.ends_with(".bin")
|| name.starts_with("~tmp_")
{
let _ = fs::remove_file(e.path());
}
}
}
self.progress = 0.0;
self.push_log("✨ キャッシュを削除しました。再抽出を開始します!");
self.auto_scan = true;
self.start_worker();
}
}

impl Drop for EngineApp {
fn drop(&mut self) {
self.stop_worker_blocking();
release_engine_lock(Path::new(&self.cfg.output_dir));
}
}

impl eframe::App for EngineApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.poll_worker();

if self.auto_scan
&& !self.is_processing
&& self.last_scan_check.elapsed() >= Duration::from_secs(10)
{
self.last_scan_check = Instant::now();
self.start_worker();
}

ctx.request_repaint_after(Duration::from_millis(250));

let panel_frame = egui::Frame::none()
.fill(COL_BG_DARK)
.inner_margin(Margin::same(14.0));

egui::CentralPanel::default()
.frame(panel_frame)
.show(ctx, |ui| {
let full_w = ui.available_width();

// --------------------------------------------------
// 1. ヘッダー (ステータス + 並列コアバッジ)
// --------------------------------------------------
ui.horizontal(|ui| {
let status_col = if !self.lock_ok {
COL_LOG_ERR
} else if !self.auto_scan && !self.is_processing {
COL_LOG_WARN
} else {
COL_CYAN
};
ui.label(
RichText::new(&self.status_text)
.size(18.0)
.strong()
.color(status_col),
);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
egui::Frame::none()
.fill(COL_PANEL_BG)
.stroke(Stroke::new(1.0, COL_BORDER))
.rounding(Rounding::same(5.0))
.inner_margin(Margin::symmetric(10.0, 4.0))
.show(ui, |ui| {
ui.label(
RichText::new(format!(
"⚡ {}コア並列 / Safetensors",
self.thread_count
))
.size(12.0)
.color(COL_TEXT_MAIN),
);
});
});
});

// 進捗バー
let pbar = egui::ProgressBar::new(self.progress)
.desired_height(16.0)
.fill(COL_PROGRESS_FILL)
.rounding(Rounding::same(5.0))
.show_percentage();
ui.add_sized([full_w, 16.0], pbar);
ui.add_space(4.0);

// --------------------------------------------------
// 2. コントロールボタン行 (4均等幅)
// --------------------------------------------------
let gap = 8.0;
let btn_w4 = ((full_w - gap * 3.0) / 4.0).max(120.0);
let btn_h = 38.0;

ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = gap;

if styled_button(
ui,
Vec2::new(btn_w4, btn_h),
"■ 抽出を即時停止",
COL_BTN_RED,
None,
Color32::WHITE,
13.5,
)
.clicked()
{
self.auto_scan = false;
self.stop_worker_blocking();
self.push_log(
"⏸ 処理を即時停止しました。再開するには手動強制スキャンを押してください。",
);
self.status_text = "状態: 停止中".into();
}

if styled_button(
ui,
Vec2::new(btn_w4, btn_h),
"▶ 手動強制スキャン",
COL_BTN_NAVY,
Some(COL_BORDER),
Color32::WHITE,
13.5,
)
.clicked()
{
self.auto_scan = true;
self.push_log("▶ 手動強制スキャンを開始します...");
self.stop_worker_blocking();
self.start_worker();
}

let (mode_label, mode_bg) = if self.cfg.scan_mode_all {
("🔄 モード: すべてのデータ", COL_BTN_GREEN)
} else {
("🔄 モード: 最新12時間 (推奨)", COL_BTN_ORANGE)
};
if styled_button(
ui,
Vec2::new(btn_w4, btn_h),
mode_label,
mode_bg,
None,
Color32::WHITE,
13.0,
)
.clicked()
{
self.stop_worker_blocking();
self.cfg.scan_mode_all = !self.cfg.scan_mode_all;
save_config(&self.cfg);
let new_desc = if self.cfg.scan_mode_all {
"すべてのデータ"
} else {
"最新12時間 (推奨)"
};
self.push_log(format!("🔄 モード変更 -> 再スキャンします ({new_desc})"));
self.auto_scan = true;
self.start_worker();
}

if styled_button(
ui,
Vec2::new(btn_w4, btn_h),
"🧹 キャッシュ全削除",
COL_BTN_PURPLE,
None,
Color32::WHITE,
13.5,
)
.clicked()
{
self.confirm_clear_cache = true;
}
});

// --------------------------------------------------
// 3. 出力先フォルダ設定行
// --------------------------------------------------
ui.horizontal(|ui| {
let out_btn_w = 220.0;
let out_h = 36.0;
if styled_button(
ui,
Vec2::new(out_btn_w, out_h),
"💾 出力先フォルダを設定",
COL_BTN_BLUE,
None,
Color32::WHITE,
13.5,
)
.clicked()
{
if let Some(dir) = rfd::FileDialog::new()
.set_directory(&self.cfg.output_dir)
.pick_folder()
{
self.stop_worker_blocking();
release_engine_lock(Path::new(&self.cfg.output_dir));
self.cfg.output_dir = dir.to_string_lossy().to_string();
save_config(&self.cfg);
let (ok, pid) = acquire_engine_lock(&dir);
self.lock_ok = ok;
if !ok {
self.push_log(format!(
"⛔ 別のエンジン(PID {pid})がこの出力フォルダを処理中です。"
));
}
self.push_log(format!(
"💾 出力先フォルダを更新しました: {}",
self.cfg.output_dir
));
self.start_worker();
}
}

let path_box_w = (ui.available_width()).max(100.0);
egui::Frame::none()
.fill(COL_PANEL_BG)
.stroke(Stroke::new(1.0, COL_BORDER))
.rounding(Rounding::same(5.0))
.inner_margin(Margin::symmetric(10.0, 8.0))
.show(ui, |ui| {
ui.set_min_width(path_box_w - 22.0);
ui.set_min_height(out_h - 18.0);
ui.add(
egui::Label::new(
RichText::new(&self.cfg.output_dir)
.size(13.0)
.color(COL_TEXT_MUTED),
)
.truncate(),
)
.on_hover_text(&self.cfg.output_dir);
});
});

// --------------------------------------------------
// 4. ログコンソール領域 (枠付きダークネイビーパネル)
// --------------------------------------------------
// 下部要素(コピーボタン + フォルダ2行 + 終了ボタン + 余白)の確保高さ
let bottom_reserved = 36.0 + 8.0 + (36.0 * 2.0 + 8.0) + 8.0 + 40.0 + 20.0;
let log_height = (ui.available_height() - bottom_reserved).max(160.0);

egui::Frame::none()
.fill(COL_PANEL_BG)
.stroke(Stroke::new(1.2, COL_BORDER))
.rounding(Rounding::same(6.0))
.inner_margin(Margin::same(10.0))
.show(ui, |ui| {
ui.set_min_width(full_w - 22.0);
ui.set_min_height(log_height);
egui::ScrollArea::vertical()
.id_salt("engine_log_scroll")
.max_height(log_height)
.auto_shrink([false, false])
.stick_to_bottom(true)
.show(ui, |ui| {
for line in &self.logs {
let col = if line.contains("⛔") || line.contains("ERROR") {
COL_LOG_ERR
} else if line.contains("⚠") || line.contains("WARN") {
COL_LOG_WARN
} else {
COL_CYAN
};
ui.label(
RichText::new(line)
.monospace()
.size(12.5)
.color(col),
);
}
});
});

// --------------------------------------------------
// 5. ログコピーボタン (横幅いっぱい)
// --------------------------------------------------
let is_copied = self
.copied_until
.map(|t| Instant::now() < t)
.unwrap_or(false);
let copy_label = if is_copied {
"✅ ログをクリップボードにコピーしました"
} else {
"📋 ログをコピー"
};
if styled_button(
ui,
Vec2::new(full_w, 34.0),
copy_label,
COL_BTN_TEAL,
None,
Color32::WHITE,
13.5,
)
.clicked()
{
ctx.copy_text(self.logs.join("\n"));
self.copied_until = Some(Instant::now() + Duration::from_secs(2));
}

// --------------------------------------------------
// 6. 読込元フォルダ 1〜6 (3列×2行 均等幅)
// --------------------------------------------------
let folder_w = ((full_w - gap * 2.0) / 3.0).max(120.0);
let folder_h = 36.0;

for row in 0..2 {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = gap;
for col in 0..3 {
let i = row * 3 + col;
let is_set = !self.cfg.monitor_folders[i].is_empty();
let label = if !is_set {
format!("📁 未設定 {}", i + 1)
} else {
let base = Path::new(&self.cfg.monitor_folders[i])
.file_name()
.and_then(|s| s.to_str())
.unwrap_or(&self.cfg.monitor_folders[i]);
format!("📁 {base}")
};
let txt_col = if is_set {
Color32::WHITE
} else {
COL_TEXT_MUTED
};
let resp = styled_button(
ui,
Vec2::new(folder_w, folder_h),
&label,
COL_BTN_NAVY,
Some(COL_BORDER),
txt_col,
13.0,
);
let resp = if is_set {
resp.on_hover_text(&self.cfg.monitor_folders[i])
} else {
resp.on_hover_text(format!("クリックして読込元フォルダ {} を設定", i + 1))
};
if resp.clicked() {
if let Some(dir) = rfd::FileDialog::new().pick_folder() {
self.stop_worker_blocking();
self.cfg.monitor_folders[i] =
dir.to_string_lossy().to_string();
save_config(&self.cfg);
self.push_log(format!(
"フォルダ{}を更新: {}",
i + 1,
self.cfg.monitor_folders[i]
));
self.start_worker();
}
}
}
});
}

// --------------------------------------------------
// 7. 完全終了ボタン (横幅いっぱい)
// --------------------------------------------------
if styled_button(
ui,
Vec2::new(full_w, 40.0),
"🛑 システムを完全に終了",
COL_BTN_DARKRED,
None,
Color32::WHITE,
14.0,
)
.clicked()
{
self.confirm_exit = true;
}
});

// キャッシュ全削除確認ダイアログ
if self.confirm_clear_cache {
egui::Window::new("確認 - キャッシュ全削除")
.anchor(egui::Align2::CENTER_CENTER, Vec2::ZERO)
.collapsible(false)
.resizable(false)
.show(ctx, |ui| {
ui.add_space(4.0);
ui.label(
RichText::new(
"出力先のキャッシュ(.safetensors / .npz 等)をすべて削除し、再抽出しますか?",
)
.size(13.5),
);
ui.add_space(10.0);
ui.horizontal(|ui| {
if styled_button(
ui,
Vec2::new(180.0, 34.0),
"はい (削除して再抽出)",
COL_BTN_PURPLE,
None,
Color32::WHITE,
13.0,
)
.clicked()
{
self.confirm_clear_cache = false;
self.clear_cache_exec();
}
if styled_button(
ui,
Vec2::new(120.0, 34.0),
"キャンセル",
COL_BTN_NAVY,
Some(COL_BORDER),
Color32::WHITE,
13.0,
)
.clicked()
{
self.confirm_clear_cache = false;
}
});
});
}

// システム終了確認ダイアログ
if self.confirm_exit {
egui::Window::new("終了の確認")
.anchor(egui::Align2::CENTER_CENTER, Vec2::ZERO)
.collapsible(false)
.resizable(false)
.show(ctx, |ui| {
ui.add_space(4.0);
ui.label(
RichText::new("抽出処理を安全に停止し、エンジンを完全に終了しますか?")
.size(13.5),
);
ui.add_space(10.0);
ui.horizontal(|ui| {
if styled_button(
ui,
Vec2::new(140.0, 34.0),
"終了する",
COL_BTN_DARKRED,
None,
Color32::WHITE,
13.0,
)
.clicked()
{
self.confirm_exit = false;
self.stop_worker_blocking();
release_engine_lock(Path::new(&self.cfg.output_dir));
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
}
if styled_button(
ui,
Vec2::new(120.0, 34.0),
"キャンセル",
COL_BTN_NAVY,
Some(COL_BORDER),
Color32::WHITE,
13.0,
)
.clicked()
{
self.confirm_exit = false;
}
});
});
}
}
}

fn main() -> eframe::Result<()> {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size([920.0, 680.0])
.with_min_inner_size([760.0, 560.0]),
..Default::default()
};
eframe::run_native(
"GPV 統合解析エンジン (Rust Ver 15.0 / Safetensors)",
options,
Box::new(|cc| Ok(Box::new(EngineApp::new(cc)))),
)
}