diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-05-26 15:56:13 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-05-26 15:56:13 +0200 |
commit | b9fde31513f41aa51c3ebe2b7ab7696b4714f501 (patch) | |
tree | 98469795ab9b2ee9626bf6dddccf163024eb5abe /lib | |
parent | 4d7b24dcb8f10ea8ddaa002601916fb389f0e87e (diff) | |
download | otp-b9fde31513f41aa51c3ebe2b7ab7696b4714f501.tar.gz otp-b9fde31513f41aa51c3ebe2b7ab7696b4714f501.tar.bz2 otp-b9fde31513f41aa51c3ebe2b7ab7696b4714f501.zip |
et: Fix unmatched return warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/et/src/et_collector.erl | 29 | ||||
-rw-r--r-- | lib/et/src/et_wx_contents_viewer.erl | 109 | ||||
-rw-r--r-- | lib/et/src/et_wx_viewer.erl | 136 |
3 files changed, 133 insertions, 141 deletions
diff --git a/lib/et/src/et_collector.erl b/lib/et/src/et_collector.erl index b8916c0eb9..aba90b0be1 100644 --- a/lib/et/src/et_collector.erl +++ b/lib/et/src/et_collector.erl @@ -27,8 +27,7 @@ -behaviour(gen_server). %% External exports --export([ - start_link/1, +-export([start_link/1, stop/1, report/2, @@ -55,8 +54,7 @@ dict_delete/2, dict_lookup/2, dict_match/2, - multicast/2 - ]). + multicast/2]). %% Internal export -export([monitor_trace_port/2]). @@ -258,7 +256,7 @@ parse_opt(BadList, _S, _Dict, _Clients) -> {error, {bad_option_list, BadList}}. start_clients(CollectorPid, [{Type, Parameters} | T]) -> - start_trace_client(CollectorPid, Type, Parameters), + _ = start_trace_client(CollectorPid, Type, Parameters), start_clients(CollectorPid, T); start_clients(CollectorPid, []) -> {ok, CollectorPid}. @@ -892,7 +890,7 @@ init([InitialS, Dict]) -> process_flag(trap_exit, true), case InitialS#state.parent_pid of undefined -> - ignore; + ok; Pid when is_pid(Pid) -> link(Pid) end, @@ -914,7 +912,7 @@ init_global(S) -> Spec = trace_spec_wrapper(EventFun, EndFun, {ok, self()}), dbg:tracer(process, Spec), et_selector:change_pattern(S#state.trace_pattern), - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), lists:foreach(fun(N) -> self() ! {nodeup, N} end, nodes()), S#state{trace_nodes = [node()]}; false -> @@ -1001,7 +999,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> %% insert() -> %% case S2#state.file of %% undefined -> - %% ignore; + %% ok; %% F -> %% Fd = F#file.desc, %% ok = disk_log:log(Fd, Event) @@ -1010,7 +1008,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> Fun = fun({_, E}, A) -> ok = disk_log:log(Fd, E), A end, Tab = S#state.event_tab, Reply = tab_iterate(Fun, Tab, ets:first(Tab), ok), - disk_log:close(Fd), + ok = disk_log:close(Fd), {Reply, S} %% all -> %% Reply = tab_iterate(WriteFun, Tab, ok), @@ -1033,7 +1031,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> handle_call({change_pattern, Pattern}, _From, S) -> Ns = S#state.trace_nodes, - rpc:multicall(Ns, et_selector, change_pattern, [Pattern]), + {_,[]} = rpc:multicall(Ns, et_selector, change_pattern, [Pattern]), Reply = {old_pattern, S#state.trace_pattern}, S2 = S#state{trace_pattern = Pattern}, reply(Reply, S2); @@ -1045,8 +1043,9 @@ handle_call(clear_table, _From, S) -> handle_call(stop, _From, S) -> do_multicast(S#state.subscribers, close), case S#state.trace_global of - true -> rpc:multicall(S#state.trace_nodes, dbg, stop_clear, []); - false -> ignore + true -> {_,[]} = rpc:multicall(S#state.trace_nodes, dbg, stop_clear, []), + ok; + false -> ok end, {stop, shutdown, ok, S}; handle_call(Request, From, S) -> @@ -1239,8 +1238,8 @@ tab_iterate(Fun, Tab, Key, Acc) -> file_open(F) -> Fd = make_ref(), case F#file.file_opt of - write -> file:rename(F#file.name, F#file.name ++ ".OLD"); - append -> ignore + write -> ok = file:rename(F#file.name, F#file.name ++ ".OLD"); + append -> ok end, Args = [{file, F#file.name}, {name, Fd}, {repair, true}, {mode, read_write}], @@ -1278,7 +1277,7 @@ do_multicast([], _Msg) -> opt_unlink(Pid) -> if Pid =:= undefined -> - ignore; + ok; true -> unlink(Pid) end. diff --git a/lib/et/src/et_wx_contents_viewer.erl b/lib/et/src/et_wx_contents_viewer.erl index d5347a43db..247dd4c7ba 100644 --- a/lib/et/src/et_wx_contents_viewer.erl +++ b/lib/et/src/et_wx_contents_viewer.erl @@ -89,7 +89,7 @@ start_link(Options) -> S#state.parent_pid =/= self() -> unlink(Pid); true -> - ignore + ok end, {ok, Pid} catch @@ -242,11 +242,12 @@ handle_event(#wx{id = Id, S) -> case proplists:get_value(Id, S#state.menu_data) of undefined -> - ignore; + ok; Data when is_record(Data, filter) -> F = Data, - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; {hide, Actors} -> send_viewer_event(S, {delete_actors, Actors}); {show, Actors} -> @@ -267,7 +268,7 @@ handle_event(#wx{id = Id, TimeStamp = case S#state.event_order of trace_ts -> Event#event.trace_ts; - event_ts -> Event#event.event_ts + event_ts -> Event#event.event_ts end, FileName = lists:flatten(["et_contents_viewer_", now_to_string(TimeStamp), ".txt"]), Style = ?wxFD_SAVE bor ?wxFD_OVERWRITE_PROMPT, @@ -275,7 +276,7 @@ handle_event(#wx{id = Id, case select_file(S#state.frame, Msg, filename:absname(FileName), Style) of {ok, FileName2} -> Bin = list_to_binary(event_to_string(Event, S#state.event_order)), - file:write_file(FileName2, Bin); + ok = file:write_file(FileName2, Bin); cancel -> ok end, @@ -351,19 +352,21 @@ handle_event(#wx{event = #wxKey{rawCode = KeyCode}}, S) -> $0 -> case lists:keysearch(?DEFAULT_FILTER_NAME, #filter.name, S#state.filters) of {value, F} when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; false -> - ignore + ok end, {noreply, S}; Int when is_integer(Int), Int > $0, Int =< $9 -> case catch lists:nth(Int-$0, S#state.filters) of F when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; {'EXIT', _} -> - ignore + ok end, {noreply, S}; @@ -443,11 +446,11 @@ create_window(S) -> Title = lists:concat([?MODULE, " (filter: ", Name, ")"]), WinOpt = [{size, {W,H}}], Frame = wxFrame:new(wx:null(), ?wxID_ANY, Title, WinOpt), - wxFrame:createStatusBar(Frame), + _ = wxFrame:createStatusBar(Frame), Panel = wxPanel:new(Frame, []), Bar = wxMenuBar:new(), - wxFrame:setMenuBar(Frame,Bar), + _ = wxFrame:setMenuBar(Frame,Bar), create_file_menu(Bar), Editor = wxTextCtrl:new(Panel, ?wxID_ANY, [{style, 0 bor ?wxDEFAULT @@ -457,21 +460,21 @@ create_window(S) -> bor ?wxTE_DONTWRAP}]), Font = wxFont:new(10, ?wxFONTFAMILY_TELETYPE, ?wxNORMAL, ?wxNORMAL,[]), TextAttr = wxTextAttr:new(?wxBLACK, [{font, Font}]), - wxTextCtrl:setDefaultStyle(Editor, TextAttr), + _ = wxTextCtrl:setDefaultStyle(Editor, TextAttr), Sizer = wxBoxSizer:new(?wxHORIZONTAL), - wxSizer:add(Sizer, Editor, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(Sizer, Editor, [{flag, ?wxEXPAND}, {proportion, 1}]), FilteredEvent = config_editor(Editor, S), S2 = S#state{win = Frame, panel = Panel, filtered_event = FilteredEvent}, HideData = create_hide_menu(Bar, S2), SearchData = create_search_menu(Bar, S2), FilterData = create_filter_menu(Bar, S#state.filters), - wxFrame:connect(Frame, command_menu_selected, []), - wxFrame:connect(Frame, key_up), - wxFrame:connect(Frame, close_window, [{skip,true}]), - wxFrame:setFocus(Frame), - wxPanel:setSizer(Panel, Sizer), - wxSizer:fit(Sizer, Panel), - wxFrame:show(Frame), + _ = wxFrame:connect(Frame, command_menu_selected, []), + _ = wxFrame:connect(Frame, key_up), + _ = wxFrame:connect(Frame, close_window, [{skip,true}]), + _ = wxFrame:setFocus(Frame), + _ = wxPanel:setSizer(Panel, Sizer), + _ = wxSizer:fit(Sizer, Panel), + _ = wxFrame:show(Frame), S2#state{menu_data = HideData++SearchData++FilterData, editor = Editor, frame = Frame}. menuitem(Menu, Id, Text, UserData) -> @@ -480,16 +483,17 @@ menuitem(Menu, Id, Text, UserData) -> create_file_menu(Bar) -> Menu = wxMenu:new([]), - wxMenu:append(Menu, ?wxID_SAVE, "Save"), - wxMenu:append(Menu, ?wxID_PRINT,"Print"), - wxMenu:appendSeparator(Menu), - wxMenu:append(Menu, ?wxID_EXIT, "Close"), - wxMenuBar:append(Bar, Menu, "File"). + _ = wxMenu:append(Menu, ?wxID_SAVE, "Save"), + _ = wxMenu:append(Menu, ?wxID_PRINT,"Print"), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenu:append(Menu, ?wxID_EXIT, "Close"), + _ = wxMenuBar:append(Bar, Menu, "File"), + ok. create_filter_menu(Bar, Filters) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Select Filter"), [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Select Filter"), [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Item = fun(F, {N,Acc}) when F#filter.name =:= ?DEFAULT_FILTER_NAME-> Label = lists:concat([pad_string(F#filter.name, 20, $\ , right), "(0)"]), MenuItem = menuitem(Menu, ?wxID_ANY, Label, F), @@ -502,7 +506,7 @@ create_filter_menu(Bar, Filters) -> end, Filters2 = lists:keysort(#filter.name, Filters), {_,MenuData} = lists:foldl(Item, {1, []}, Filters2), - wxMenuBar:append(Bar, Menu, "Filters"), + _ = wxMenuBar:append(Bar, Menu, "Filters"), MenuData. create_hide_menu(Bar, S) -> @@ -515,33 +519,33 @@ create_hide_menu(Bar, S) -> S#state.viewer_pid =:= undefined -> ignore; From =:= To -> - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Hide = menuitem(Menu, ?wxID_ANY, "From=To (f|t|b)", {hide, [From]}), - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Show = menuitem(Menu, ?wxID_ANY, "From=To (F|T|B)", {show, [From]}), [Show,Hide]; true -> - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Hide = [menuitem(Menu, ?wxID_ANY, "From (f)", {hide, [From]}), menuitem(Menu, ?wxID_ANY, "To (t)", {hide, [To]}), menuitem(Menu, ?wxID_ANY, "Both (b)", {hide, [From, To]})], - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Show = [menuitem(Menu, ?wxID_ANY, "From (F)", {show, [From]}), menuitem(Menu, ?wxID_ANY, "To (T)", {show, [To]}), menuitem(Menu, ?wxID_ANY, "Both (B)", {show, [From, To]})], Show++Hide end, - wxMenuBar:append(Bar, Menu, "Hide"), + _ = wxMenuBar:append(Bar, Menu, "Hide"), MenuData. create_search_menu(Bar, S) -> @@ -549,9 +553,9 @@ create_search_menu(Bar, S) -> E = S#state.filtered_event, From = E#event.from, To = E#event.to, - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Search in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Search in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), MenuData = if S#state.viewer_pid =:= undefined -> @@ -571,7 +575,7 @@ create_search_menu(Bar, S) -> menuitem(Menu, ?wxID_ANY, "Reverse from this event (r)", {mode, ModeR}), menuitem(Menu, ?wxID_ANY, "Abort search. Display all (a)", {mode, all})] end, - wxMenuBar:append(Bar, Menu, "Search"), + _ = wxMenuBar:append(Bar, Menu, "Search"), MenuData. config_editor(Editor, S) -> @@ -668,9 +672,10 @@ pad_string(String, MinLen, Char, Dir) when is_integer(MinLen), MinLen >= 0 -> send_viewer_event(S, Event) -> case S#state.viewer_pid of ViewerPid when is_pid(ViewerPid) -> - ViewerPid ! {et, Event}; + ViewerPid ! {et, Event}, + ok; undefined -> - ignore + ok end. select_file(Frame, Message, DefaultFile, Style) -> diff --git a/lib/et/src/et_wx_viewer.erl b/lib/et/src/et_wx_viewer.erl index 0fc10cb37b..9613299e6b 100644 --- a/lib/et/src/et_wx_viewer.erl +++ b/lib/et/src/et_wx_viewer.erl @@ -320,8 +320,8 @@ init([S]) when is_record(S, state) -> undefined -> ok; ParentPid -> link(ParentPid) end, - wx:new(), - wx:debug(S#state.wx_debug), + _ = wx:new(), + _ = wx:debug(S#state.wx_debug), et_collector:dict_insert(S#state.collector_pid, {subscriber, self()}, ?MODULE), @@ -532,26 +532,25 @@ handle_info(#wx{id=Id, event = #wxCommand{type = command_menu_selected}}, S=#sta load_all -> Style = ?wxFD_OPEN bor ?wxFD_OVERWRITE_PROMPT, Msg = "Select a file to load events from", - S2 = - case select_file(S#state.frame, Msg, S#state.event_file, Style) of - {ok, NewFile} -> - et_collector:start_trace_client(CollectorPid, event_file, NewFile), - S#state{event_file = NewFile}; - cancel -> - S - end, + S2 = case select_file(S#state.frame, Msg, S#state.event_file, Style) of + {ok, NewFile} -> + _ = et_collector:start_trace_client(CollectorPid, event_file, NewFile), + S#state{event_file = NewFile}; + cancel -> + S + end, noreply(S2); save_all -> Style = ?wxFD_SAVE bor ?wxFD_OVERWRITE_PROMPT, Msg = "Select a file to save events to", - S2 = - case select_file(S#state.frame, Msg, S#state.event_file, Style) of - {ok, NewFile} -> - et_collector:save_event_file(CollectorPid, NewFile, [existing, write, keep]), - S#state{event_file = NewFile}; - cancel -> - S - end, + S2 = case select_file(S#state.frame, Msg, S#state.event_file, Style) of + {ok, NewFile} -> + ok = et_collector:save_event_file(CollectorPid, NewFile, + [existing, write, keep]), + S#state{event_file = NewFile}; + cancel -> + S + end, noreply(S2); print_setup -> S2 = print_setup(S), @@ -787,7 +786,7 @@ handle_info(#wx{event = #wxKey{keyCode = KeyCode, shiftDown = SD}}, S) -> noreply(S) end; handle_info(#wx{event = #wxScroll{type = scroll_changed}} = Wx, S) -> - get_latest_scroll(Wx), + _ = get_latest_scroll(Wx), Pos = wxScrollBar:getThumbPosition(S#state.scroll_bar), {_, LineTopY, LineBotY} = calc_y(S), Range = LineBotY - LineTopY, @@ -1107,7 +1106,7 @@ pick_n([Head | Tail], N, Acc) when N > 0 -> pick_n(Tail, N - 1, [Head | Acc]). close_all(S) -> - close_all_others(S), + _ = close_all_others(S), wxFrame:destroy(S#state.frame), opt_unlink(S#state.parent_pid), {stop, shutdown, S}. @@ -1115,12 +1114,12 @@ close_all(S) -> close_all_others(S) -> Fun = fun({{subscriber, Pid}, _}) -> - if - Pid =:= self() -> - ignore; + if Pid =:= self() -> + ok; true -> unlink(Pid), - Pid ! {et, close} + Pid ! {et, close}, + ok end end, All = et_collector:dict_match(S#state.collector_pid, @@ -1208,9 +1207,9 @@ create_main_window(S) -> CheckBoxData = [{wxCheckBox:getId(HideActions), hide_actions}, {wxCheckBox:getId(HideActors), hide_actors}], wxPanel:connect(Panel, command_checkbox_clicked), - wxSizer:add(CheckSizer, HideActions), - wxSizer:add(CheckSizer,HideActors), - wxSizer:add(OptSizer, CheckSizer, [{border, 10}, {flag, ?wxALL}]), + _ = wxSizer:add(CheckSizer, HideActions), + _ = wxSizer:add(CheckSizer,HideActors), + _ = wxSizer:add(OptSizer, CheckSizer, [{border, 10}, {flag, ?wxALL}]), DetailLevelBox = wxStaticBoxSizer:new(?wxHORIZONTAL, Panel, [{label, "Detail level"}]), @@ -1222,22 +1221,21 @@ create_main_window(S) -> {size, {200,-1}}]), wxStatusBar:setStatusText(StatusBar, where_text(S)), wxFrame:connect(Frame, command_slider_updated), - wxSizer:add(DetailLevelBox, DetailLevel), - wxSizer:add(OptSizer, DetailLevelBox, [{border, 10}, {flag, ?wxALL}]), - wxSizer:addStretchSpacer(OptSizer), - wxSizer:add(MainSizer, OptSizer), - wxSizer:add(MainSizer, - wxStaticLine:new(Panel, [{style, ?wxLI_HORIZONTAL}]), - [{flag, ?wxEXPAND}]), + _ = wxSizer:add(DetailLevelBox, DetailLevel), + _ = wxSizer:add(OptSizer, DetailLevelBox, [{border, 10}, {flag, ?wxALL}]), + _ = wxSizer:addStretchSpacer(OptSizer), + _ = wxSizer:add(MainSizer, OptSizer), + _ = wxSizer:add(MainSizer, wxStaticLine:new(Panel, [{style, ?wxLI_HORIZONTAL}]), + [{flag, ?wxEXPAND}]), CanvasSizer = wxBoxSizer:new(?wxHORIZONTAL), Canvas = wxPanel:new(Panel, [{style, ?wxFULL_REPAINT_ON_RESIZE}]), {CanvasW,CanvasH} = wxPanel:getSize(Canvas), ScrollBar = wxScrollBar:new(Panel, ?wxID_ANY, [{style, ?wxSB_VERTICAL}]), - wxSizer:add(CanvasSizer, Canvas, [{flag, ?wxEXPAND}, {proportion, 1}]), - wxSizer:add(CanvasSizer, ScrollBar, [{flag, ?wxEXPAND}]), - wxSizer:add(MainSizer, CanvasSizer, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(CanvasSizer, Canvas, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(CanvasSizer, ScrollBar, [{flag, ?wxEXPAND}]), + _ = wxSizer:add(MainSizer, CanvasSizer, [{flag, ?wxEXPAND}, {proportion, 1}]), wxPanel:connect(Canvas, left_down), wxPanel:connect(Canvas, left_up), wxPanel:connect(Canvas, right_up), @@ -1337,8 +1335,7 @@ menuitem(Menu, Id, Text, UserData) -> create_file_menu(Bar) -> Menu = wxMenu:new([]), - Data = [ - menuitem(Menu, ?wxID_ANY, "Clear all events in the Collector", clear_all), + Data = [menuitem(Menu, ?wxID_ANY, "Clear all events in the Collector", clear_all), menuitem(Menu, ?wxID_ANY, "Load events to the Collector from file", load_all), menuitem(Menu, ?wxID_ANY, "Save all events in the Collector to file", save_all), @@ -1348,51 +1345,44 @@ create_file_menu(Bar) -> menuitem(Menu, ?wxID_ANY, "Close this Viewer", close), menuitem(Menu, ?wxID_ANY, "Close all other Viewers, but this (c)", close_all_others), - menuitem(Menu, ?wxID_ANY, "Close all Viewers and the Collector) (C) ", close_all) - ], - wxMenu:insertSeparator(Menu, 3), - wxMenu:insertSeparator(Menu, 7), + menuitem(Menu, ?wxID_ANY, "Close all Viewers and the Collector) (C) ", close_all)], + _ = wxMenu:insertSeparator(Menu, 3), + _ = wxMenu:insertSeparator(Menu, 7), wxMenuBar:append(Bar, Menu, "File"), Data. create_viewer_menu(Bar) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll this Viewer"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), - D1 = [ - menuitem(Menu, ?wxID_ANY, "First (f)", first), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll this Viewer"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), + D1 = [menuitem(Menu, ?wxID_ANY, "First (f)", first), menuitem(Menu, ?wxID_ANY, "Last (l)", last), menuitem(Menu, ?wxID_ANY, "Prev (p)", prev), menuitem(Menu, ?wxID_ANY, "Next (n)", next), - menuitem(Menu, ?wxID_ANY, "Refresh (r)", refresh) - ], - wxMenu:appendSeparator(Menu), - D2 = [ - menuitem(Menu, ?wxID_ANY, "Up 5 (Up)", up), - menuitem(Menu, ?wxID_ANY, "Down 5 (Down)", down) - ], - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Actor visibility in this Viewer"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + menuitem(Menu, ?wxID_ANY, "Refresh (r)", refresh)], + _ = wxMenu:appendSeparator(Menu), + D2 = [menuitem(Menu, ?wxID_ANY, "Up 5 (Up)", up), + menuitem(Menu, ?wxID_ANY, "Down 5 (Down)", down)], + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Actor visibility in this Viewer"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), D3 = [menuitem(Menu, ?wxID_ANY, "Display all actors (a)", display_all)], - wxMenuBar:append(Bar, Menu, "Viewer"), + _ = wxMenuBar:append(Bar, Menu, "Viewer"), [D1,D2,D3]. create_collector_menu(Bar) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll all Viewers"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), - Data = [ - menuitem(Menu, ?wxID_ANY, "First (F)", first_all), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll all Viewers"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), + Data = [menuitem(Menu, ?wxID_ANY, "First (F)", first_all), menuitem(Menu, ?wxID_ANY, "Last (L)", last_all), menuitem(Menu, ?wxID_ANY, "Prev (P)", prev_all), menuitem(Menu, ?wxID_ANY, "Next (N)", next_all), - menuitem(Menu, ?wxID_ANY, "Refresh (R)", refresh_all) - ], - wxMenuBar:append(Bar, Menu, "Collector"), + menuitem(Menu, ?wxID_ANY, "Refresh (R)", refresh_all)], + _ = wxMenuBar:append(Bar, Menu, "Collector"), Data. create_filter_menu(S=#state{filter_menu = {Menu,Data}}, ActiveFilterName, Filters) -> @@ -1421,21 +1411,19 @@ create_filter_menu(S=#state{filter_menu = {Menu,Data}}, ActiveFilterName, Filter Same = lists:concat([pad_string(ActiveFilterName, 20), "(=) same scale"]), Larger = lists:concat([pad_string(ActiveFilterName, 20), "(+) bigger scale"]), Smaller = lists:concat([pad_string(ActiveFilterName, 20), "(-) smaller scale"]), - D2 = [ - menuitem(Menu, ?wxID_ANY, Same, {data, Filter, 0}), + D2 = [menuitem(Menu, ?wxID_ANY, Same, {data, Filter, 0}), menuitem(Menu, ?wxID_ANY, Smaller, {data, Filter, -1}), menuitem(Menu, ?wxID_ANY, Larger, {data, Filter, 1}), wxMenu:appendSeparator(Menu), I2 = wxMenu:append(Menu, ?wxID_ANY, "New Filter Same Scale"), - wxMenu:appendSeparator(Menu) - ], - wxMenuItem:enable(I2, [{enable,false}]), + wxMenu:appendSeparator(Menu)], + _ = wxMenuItem:enable(I2, [{enable,false}]), {_,D3} = lists:foldl(Item, {1,[]}, Filters), S#state{filter_menu = {Menu, lists:flatten([D1,D2,D3])}}. create_help_menu(Bar) -> Menu = wxMenu:new([]), - menuitem(Menu, ?wxID_HELP, "Info", help), + _ = menuitem(Menu, ?wxID_HELP, "Info", help), wxMenuBar:append(Bar, Menu, "Help"). clear_canvas(S) -> |