WIP: De-kajiggering

This commit is contained in:
2026-05-01 14:03:07 +09:00
parent d1ee4c6a24
commit ac18ecc916
3 changed files with 61 additions and 57 deletions
+14 -25
View File
@@ -233,8 +233,8 @@ handle_cast({dryrun_result, ConID, CallInfo}, State) ->
ok = do_dryrun_result(State, ConID, CallInfo),
{noreply, State};
handle_cast({trouble, Info}, State) ->
ok = handle_troubling(State, Info),
{noreply, State};
NewState = handle_troubling(State, Info),
{noreply, NewState};
handle_cast(Unexpected, State) ->
ok = log(warning, "Unexpected cast: ~tp~n", [Unexpected]),
{noreply, State}.
@@ -287,8 +287,9 @@ handle_event(Event, State) ->
{noreply, State}.
handle_troubling(#s{frame = Frame}, Info) ->
zxw:show_message(Frame, Info).
handle_troubling(State = #s{frame = Frame}, Info) ->
ok = zxw:show_message(Frame, Info),
State.
code_change(_, State, _) ->
@@ -374,20 +375,16 @@ add_code_page2(State = #s{j = J}, {file, File}) ->
add_code_page(State, {file, File}, Code);
Error ->
Message = io_lib:format(J("Opening ~p failed with: ~p"), [File, Error]),
ok = handle_troubling(State, Message),
State
handle_troubling(State, Message)
end;
{error, Reason} ->
Message = io_lib:format(J("Opening ~p failed with: ~p"), [File, Reason]),
ok = handle_troubling(State, Message),
State
handle_troubling(State, Message)
end;
add_code_page2(State, {hash, Address}) ->
open_hash2(State, Address).
add_code_page(State = #s{tabs = TopBook, code = {Codebook, Pages}}, Location, Code) ->
Color = wxSystemSettings:getColour(?wxSYS_COLOUR_WINDOW),
tell("Color: ~p", [Color]),
Window = wxWindow:new(Codebook, ?wxID_ANY),
PageSz = wxBoxSizer:new(?wxHORIZONTAL),
@@ -612,8 +609,7 @@ open_hash2(State, Address) ->
{ok, Source} ->
open_hash3(State, Address, Source);
Error ->
ok = handle_troubling(State, Error),
State
handle_troubling(State, Error)
end.
open_hash3(State, Address, Source) ->
@@ -640,15 +636,11 @@ save(State = #s{prefs = Prefs, code = {Codebook, Pages}}) ->
case filelib:ensure_dir(Path) of
ok ->
case file:write_file(Path, Source) of
ok ->
State;
Error ->
ok = handle_troubling(State, Error),
State
ok -> State;
Error -> handle_troubling(State, Error)
end;
Error ->
ok = handle_troubling(State, Error),
State
handle_troubling(State, Error)
end;
Page = #p{path = {hash, Hash}, code = Widget} ->
DefDir =
@@ -718,12 +710,10 @@ save_dialog(State = #s{frame = Frame, j = J, prefs = Prefs, code = {Codebook, Pa
NewCode = {Codebook, NewPages},
State#s{prefs = NewPrefs, code = NewCode};
Error ->
ok = handle_troubling(State, Error),
State
handle_troubling(State, Error)
end;
Error ->
ok = handle_troubling(State, Error),
State
handle_troubling(State, Error)
end
end;
?wxID_CANCEL ->
@@ -773,8 +763,7 @@ load2(State, Address) ->
{ok, Source} ->
load3(State, Address, Source);
Error ->
ok = handle_troubling(State, Error),
State
handle_troubling(State, Error)
end.
load3(State = #s{tabs = TopBook, cons = {Consbook, Pages}, buttons = Buttons, j = J},