aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/observer')
-rw-r--r--lib/observer/src/observer_defs.hrl6
-rw-r--r--lib/observer/src/observer_lib.erl15
-rw-r--r--lib/observer/src/observer_pro_wx.erl11
-rw-r--r--lib/observer/src/observer_sys_wx.erl25
-rw-r--r--lib/observer/src/observer_tv_table.erl2
-rw-r--r--lib/observer/src/observer_tv_wx.erl21
-rw-r--r--lib/observer/src/observer_wx.erl23
7 files changed, 50 insertions, 53 deletions
diff --git a/lib/observer/src/observer_defs.hrl b/lib/observer/src/observer_defs.hrl
index 567eb26e3b..9e68bd7f07 100644
--- a/lib/observer/src/observer_defs.hrl
+++ b/lib/observer/src/observer_defs.hrl
@@ -49,3 +49,9 @@
}).
-record(attrs, {even, odd, deleted, changed, searched}).
+-define(BG_EVEN, {230,230,250}).
+-define(BG_ODD, {255,255,255}).
+-define(BG_DELETED, {100,100,100}).
+-define(FG_DELETED, {240,30,30}).
+-define(BG_SEARCHED,{235,215,90}).
+-define(BG_CHANGED, {230,230,250}).
diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl
index 8bc79ffddd..b3a2dcf5ec 100644
--- a/lib/observer/src/observer_lib.erl
+++ b/lib/observer/src/observer_lib.erl
@@ -255,12 +255,15 @@ create_menu_item(separator, Menu, Index) ->
create_attrs() ->
Font = wxSystemSettings:getFont(?wxSYS_DEFAULT_GUI_FONT),
- Text = wxSystemSettings:getColour(?wxSYS_COLOUR_LISTBOXTEXT),
- #attrs{even = wxListItemAttr:new(Text, {255,255,255}, Font),
- odd = wxListItemAttr:new(Text, {240,240,255}, Font),
- deleted = wxListItemAttr:new({240,30,30}, {100,100,100}, Font),
- changed = wxListItemAttr:new(Text, {255,215,0}, Font),
- searched = wxListItemAttr:new(Text, {235,215,90}, Font)
+ Text = case wxSystemSettings:getColour(?wxSYS_COLOUR_LISTBOXTEXT) of
+ {255,255,255,_} -> {10,10,10}; %% Is white on Mac for some reason
+ Color -> Color
+ end,
+ #attrs{even = wxListItemAttr:new(Text, ?BG_EVEN, Font),
+ odd = wxListItemAttr:new(Text, ?BG_ODD, Font),
+ deleted = wxListItemAttr:new(?FG_DELETED, ?BG_DELETED, Font),
+ changed = wxListItemAttr:new(Text, ?BG_CHANGED, Font),
+ searched = wxListItemAttr:new(Text, ?BG_SEARCHED, Font)
}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/observer/src/observer_pro_wx.erl b/lib/observer/src/observer_pro_wx.erl
index 4bc6da6476..1c0b3ed5ec 100644
--- a/lib/observer/src/observer_pro_wx.erl
+++ b/lib/observer/src/observer_pro_wx.erl
@@ -182,7 +182,7 @@ create_popup_menu(ParentFrame) ->
MiniFrame.
create_list_box(Panel, Holder) ->
- Style = ?wxLC_REPORT bor ?wxLC_VIRTUAL,
+ Style = ?wxLC_REPORT bor ?wxLC_VIRTUAL bor ?wxLC_HRULES,
ListCtrl = wxListCtrl:new(Panel, [{style, Style},
{onGetItemText,
fun(_, Row, Col) ->
@@ -296,11 +296,10 @@ handle_info({node, Node}, #state{holder=Holder}=State) ->
{noreply, State};
handle_info(Info, State) ->
- io:format("~p, ~p, Handled unexpected info: ~p~n", [?MODULE, ?LINE, Info]),
+ io:format("~p:~p, Unexpected info: ~p~n", [?MODULE, ?LINE, Info]),
{noreply, State}.
-terminate(Reason, #state{holder=Holder}) ->
- io:format("~p terminating. Reason: ~p~n", [?MODULE, Reason]),
+terminate(_Reason, #state{holder=Holder}) ->
Holder ! stop,
etop:stop(),
ok.
@@ -310,12 +309,12 @@ code_change(_, _, State) ->
handle_call(Msg, _From, State) ->
- io:format("~p~p: Got Call ~p~n",[?MODULE, ?LINE, Msg]),
+ io:format("~p:~p: Unhandled call ~p~n",[?MODULE, ?LINE, Msg]),
{reply, ok, State}.
handle_cast(Msg, State) ->
- io:format("~p ~p: Unhandled cast ~p~n", [?MODULE, ?LINE, Msg]),
+ io:format("~p:~p: Unhandled cast ~p~n", [?MODULE, ?LINE, Msg]),
{noreply, State}.
%%%%%%%%%%%%%%%%%%%%LOOP%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/observer/src/observer_sys_wx.erl b/lib/observer/src/observer_sys_wx.erl
index 36aa226bd1..ddedcf3829 100644
--- a/lib/observer/src/observer_sys_wx.erl
+++ b/lib/observer/src/observer_sys_wx.erl
@@ -47,14 +47,7 @@ start_link(Notebook, Parent) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-init(Args) ->
- try
- init2(Args)
- catch E:R ->
- io:format("~p:~p ~p~n",[E,R, erlang:get_stacktrace()])
- end.
-
-init2([Notebook, Parent]) ->
+init([Notebook, Parent]) ->
SysInfo = sys_info(),
{Info, Stat} = info_fields(),
Panel = wxPanel:new(Notebook),
@@ -80,16 +73,11 @@ create_sys_menu(Parent) ->
observer_wx:create_menus(Parent, [View]).
update_syspage(#sys_wx_state{node = Node, fields=Fields, sizer=Sizer}) ->
- try
SysInfo = observer_wx:try_rpc(Node, ?MODULE, sys_info, []),
{Info, Stat} = info_fields(),
observer_lib:update_info(Fields, observer_lib:fill_info(Info, SysInfo) ++
observer_lib:fill_info(Stat, SysInfo)),
- wxSizer:layout(Sizer)
- catch E:R ->
- io:format("~p:~p ~p~n",[E,R, erlang:get_stacktrace()])
- end,
- ok.
+ wxSizer:layout(Sizer).
info_fields() ->
Info = [{"System and Architecture",
@@ -165,18 +153,17 @@ handle_info(not_active, #sys_wx_state{timer = Timer} = State) ->
{noreply, State#sys_wx_state{timer = observer_lib:stop_timer(Timer)}};
handle_info(Info, State) ->
- io:format("~p, ~p, Handle info: ~p~n", [?MODULE, ?LINE, Info]),
+ io:format("~p:~p: Unhandled info: ~p~n", [?MODULE, ?LINE, Info]),
{noreply, State}.
-terminate(Reason, _State) ->
- io:format("~p terminating. Reason: ~p~n", [?MODULE, Reason]),
+terminate(_Reason, _State) ->
ok.
code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
handle_call(Msg, _From, State) ->
- io:format("~p~p: Got Call ~p~n",[?MODULE, ?LINE, Msg]),
+ io:format("~p~p: Unhandled Call ~p~n",[?MODULE, ?LINE, Msg]),
{reply, ok, State}.
handle_cast(Msg, State) ->
@@ -199,7 +186,7 @@ handle_event(#wx{id = ?ID_REFRESH_INTERVAL,
{noreply, State#sys_wx_state{timer=Timer}};
handle_event(Event, State) ->
- io:format("handle event ~p\n", [Event]),
+ io:format("~p:~p: Unhandled event ~p\n", [?MODULE,?LINE,Event]),
{noreply, State}.
diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl
index d4990ec0ff..f744623960 100644
--- a/lib/observer/src/observer_tv_table.erl
+++ b/lib/observer/src/observer_tv_table.erl
@@ -43,7 +43,7 @@
-define(SEARCH_ENTRY, 420).
-define(GOTO_ENTRY, 421).
--define(DEFAULT_COL_WIDTH, 100).
+-define(DEFAULT_COL_WIDTH, 150).
-record(state,
{
diff --git a/lib/observer/src/observer_tv_wx.erl b/lib/observer/src/observer_tv_wx.erl
index dbf573151f..191faf73ff 100644
--- a/lib/observer/src/observer_tv_wx.erl
+++ b/lib/observer/src/observer_tv_wx.erl
@@ -173,16 +173,13 @@ handle_event(Event, State) ->
io:format("~p:~p, handle event ~p\n", [?MODULE, ?LINE, Event]),
{noreply, State}.
-handle_sync_event(Event, _Obj, _State) ->
- io:format("~p:~p, handle sync_event ~p\n", [?MODULE, ?LINE, Event]),
+handle_sync_event(_Event, _Obj, _State) ->
ok.
-handle_call(Event, From, State) ->
- io:format("~p:~p, handle call (~p) ~p\n", [?MODULE, ?LINE, From, Event]),
+handle_call(_Event, _From, State) ->
{noreply, State}.
-handle_cast(Event, State) ->
- io:format("~p:~p, handle cast ~p\n", [?MODULE, ?LINE, Event]),
+handle_cast(_Event, State) ->
{noreply, State}.
handle_info(refresh_interval, State = #state{node=Node, grid=Grid, opt=Opt}) ->
@@ -213,12 +210,10 @@ handle_info({error, Error}, State) ->
handle_error(Error),
{noreply, State};
-handle_info(Event, State) ->
- io:format("~p:~p, handle info ~p\n", [?MODULE, ?LINE, Event]),
+handle_info(_Event, State) ->
{noreply, State}.
-terminate(Event, _State) ->
- io:format("~p:~p, terminate ~p\n", [?MODULE, ?LINE, Event]),
+terminate(_Event, _State) ->
ok.
code_change(_, _, State) ->
@@ -339,7 +334,8 @@ display_table_info(Parent0, Node, Source, Table) ->
Parent = observer_lib:get_wx_parent(Parent0),
Title = "Table Info: " ++ atom_to_list(Table#tab.name),
Frame = wxMiniFrame:new(Parent, ?wxID_ANY, Title,
- [{style, ?wxCAPTION bor ?wxCLOSE_BOX}]),
+ [{style, ?wxSYSTEM_MENU bor ?wxCAPTION
+ bor ?wxCLOSE_BOX bor ?wxRESIZE_BORDER}]),
IdInfo = {"Identification and Owner",
[{"Name", Table#tab.name},
@@ -452,7 +448,7 @@ update_grid2(Grid, #opt{sort_key=Sort,sort_incr=Dir}, Tables) ->
protection = Protection, reg_name = RegName}, Row) ->
_Item = wxListCtrl:insertItem(Grid, Row, ""),
if (Row rem 2) =:= 0 ->
- wxListCtrl:setItemBackgroundColour(Grid, Row, {240,240,255});
+ wxListCtrl:setItemBackgroundColour(Grid, Row, ?BG_EVEN);
true -> ignore
end,
if Protection == private ->
@@ -466,7 +462,6 @@ update_grid2(Grid, #opt{sort_key=Sort,sort_incr=Dir}, Tables) ->
end,
[{0,Name}, {1,Id}, {2,Size}, {3, Memory div 1024},
{4,Owner}, {5,RegName}]),
- %% wxListCtrl:setItemData(Grid, Item, Item),
Row + 1
end,
ProcInfo = case Dir of
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl
index b39b34c240..45725f03b5 100644
--- a/lib/observer/src/observer_wx.erl
+++ b/lib/observer/src/observer_wx.erl
@@ -70,8 +70,9 @@ get_attrib(What) ->
init(_Args) ->
wx:new(),
- Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Observer", [{size, {1000, 500}},
- {style, ?wxDEFAULT_FRAME_STYLE}]),
+ catch wxSystemOptions:setOption("mac.listctrl.always_use_generic", 1),
+ Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Observer",
+ [{size, {1000, 500}}, {style, ?wxDEFAULT_FRAME_STYLE}]),
IconFile = filename:join(code:priv_dir(observer), "erlang_observer.png"),
Icon = wxIcon:new(IconFile, [{type,?wxBITMAP_TYPE_PNG}]),
wxFrame:setIcon(Frame, Icon),
@@ -162,7 +163,15 @@ handle_event(#wx{id = ?wxID_EXIT, event = #wxCommand{type = command_menu_selecte
{stop, normal, State};
handle_event(#wx{id = ?wxID_HELP, event = #wxCommand{type = command_menu_selected}}, State) ->
- io:format("~p ~p, you clicked help", [?MODULE, ?LINE]),
+ External = "http://www.erlang.org/doc/apps/observer/index.html",
+ Internal = filename:join([code:lib_dir(observer),"doc", "html", "index.html"]),
+ Help = case filelib:is_file(Internal) of
+ true -> Internal;
+ false -> External
+ end,
+ wx_misc:launchDefaultBrowser(Help) orelse
+ create_txt_dialog(State#state.frame, "Could not launch browser: ~n " ++ Help,
+ "Error", ?wxICON_ERROR),
{noreply, State};
handle_event(#wx{id = ?wxID_ABOUT, event = #wxCommand{type = command_menu_selected}},
@@ -483,11 +492,9 @@ get_nodes() ->
Nodes = [node()| nodes()],
{_, Menues} =
lists:foldl(fun(Node, {Id, Acc}) when Id < ?LAST_NODES_MENU_ID ->
- {Id + 1, [#create_menu{id = Id + ?FIRST_NODES_MENU_ID,
- text = atom_to_list(Node)} | Acc]}
- end,
- {1, []},
- Nodes),
+ {Id + 1, [#create_menu{id=Id + ?FIRST_NODES_MENU_ID,
+ text=atom_to_list(Node)} | Acc]}
+ end, {1, []}, Nodes),
{Nodes, lists:reverse(Menues)}.
update_node_list(State = #state{menubar=MenuBar}) ->