0.1.4
This commit is contained in:
+862
-111
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -11,7 +11,7 @@ use std::rc::Rc;
|
||||
|
||||
use convert::{ConvField, ConvPanel, Converter, Endian, RatioWidth};
|
||||
use crc::CrcTool;
|
||||
use engine::{Calculator, Op};
|
||||
use engine::{Calculator, Op, StdPanel};
|
||||
use programmer::{Base, ProgOp, Programmer};
|
||||
use slint::{ComponentHandle, ModelRc, VecModel};
|
||||
|
||||
@@ -55,6 +55,7 @@ fn main() -> Result<(), slint::PlatformError> {
|
||||
let ui = AppWindow::new()?;
|
||||
// Must match the .desktop basename (rcalc.desktop → "rcalc"), before show/run.
|
||||
slint::set_xdg_app_id("rcalc")?;
|
||||
ui.set_app_title(format!("Rcalc-{}", env!("APP_VERSION")).into());
|
||||
|
||||
let state = Rc::new(RefCell::new(State::default()));
|
||||
|
||||
@@ -170,6 +171,10 @@ fn refresh(ui: &AppWindow, state: &mut State) {
|
||||
ui.set_display_text(state.std.display().into());
|
||||
ui.set_expression_text(state.std.expression().into());
|
||||
ui.set_has_memory(state.std.has_memory());
|
||||
ui.set_std_panel(match state.std.panel() {
|
||||
StdPanel::Standard => 0,
|
||||
StdPanel::Formula => 1,
|
||||
});
|
||||
}
|
||||
Mode::Programmer => {
|
||||
ui.set_display_text(state.prog.display().into());
|
||||
@@ -266,6 +271,8 @@ fn handle_key(state: &mut State, id: &str) {
|
||||
|
||||
fn handle_standard(calc: &mut Calculator, id: &str) {
|
||||
match id {
|
||||
"panel:std" => calc.set_panel(StdPanel::Standard),
|
||||
"panel:formula" => calc.set_panel(StdPanel::Formula),
|
||||
"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" => {
|
||||
calc.input_digit(id.chars().next().unwrap());
|
||||
}
|
||||
@@ -276,9 +283,12 @@ fn handle_standard(calc: &mut Calculator, id: &str) {
|
||||
"/" | "÷" => calc.set_op(Op::Div),
|
||||
"=" => calc.equals(),
|
||||
"%" => calc.percent(),
|
||||
"(" => calc.paren_open(),
|
||||
")" => calc.paren_close(),
|
||||
"CE" => calc.clear_entry(),
|
||||
"C" => calc.clear_all(),
|
||||
"BS" => calc.backspace(),
|
||||
"1/x" | "x2" | "sqrt" if calc.panel() == StdPanel::Formula => {}
|
||||
"1/x" => calc.reciprocal(),
|
||||
"x2" => calc.square(),
|
||||
"sqrt" => calc.sqrt(),
|
||||
|
||||
Reference in New Issue
Block a user