aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/dbg_wx_src_view.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/debugger/src/dbg_wx_src_view.erl
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/debugger/src/dbg_wx_src_view.erl')
-rw-r--r--lib/debugger/src/dbg_wx_src_view.erl66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/debugger/src/dbg_wx_src_view.erl b/lib/debugger/src/dbg_wx_src_view.erl
new file mode 100644
index 0000000000..5337ec2aac
--- /dev/null
+++ b/lib/debugger/src/dbg_wx_src_view.erl
@@ -0,0 +1,66 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(dbg_wx_src_view).
+
+-export([code_area/2]).
+-include_lib("wx/include/wx.hrl").
+
+-define(stc, wxStyledTextCtrl).
+
+code_area(Parent, Sizer) ->
+ FixedFont = wxFont:new(10, ?wxFONTFAMILY_TELETYPE, ?wxNORMAL, ?wxNORMAL,[]),
+ Ed = wxStyledTextCtrl:new(Parent, [{size, {400, 500}}]),
+ ?stc:styleClearAll(Ed),
+ ?stc:styleSetFont(Ed, ?wxSTC_STYLE_DEFAULT, FixedFont),
+ ?stc:setLexer(Ed, ?wxSTC_LEX_ERLANG),
+ ?stc:setMarginType(Ed, 0, ?wxSTC_MARGIN_NUMBER),
+ LW = ?stc:textWidth(Ed, ?wxSTC_STYLE_LINENUMBER, "999"),
+ ?stc:setMarginWidth(Ed, 0, LW),
+
+ ?stc:setReadOnly(Ed, true),
+
+ Styles = [{?wxSTC_ERLANG_DEFAULT, {0,0,0}},
+ {?wxSTC_ERLANG_COMMENT, {222,53,35}},
+ {?wxSTC_ERLANG_VARIABLE, {170,110,50}},
+ {?wxSTC_ERLANG_NUMBER, {5,5,100}},
+ {?wxSTC_ERLANG_KEYWORD, {238,80,239}},
+ {?wxSTC_ERLANG_STRING, {236,155,172}},
+ {?wxSTC_ERLANG_OPERATOR, {30,0,0}},
+ {?wxSTC_ERLANG_ATOM, {0,0,0}},
+ {?wxSTC_ERLANG_FUNCTION_NAME, {64,102,244}},
+ {?wxSTC_ERLANG_CHARACTER,{236,155,172}},
+ {?wxSTC_ERLANG_MACRO, {92,194,241}},
+ {?wxSTC_ERLANG_RECORD, {60,150,40}},
+ {?wxSTC_ERLANG_SEPARATOR,{0,0,0}},
+ {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}],
+ SetStyle = fun({Style, Color}) ->
+ ?stc:styleSetFont(Ed, Style, FixedFont),
+ ?stc:styleSetForeground(Ed, Style, Color)
+ end,
+ [SetStyle(Style) || Style <- Styles],
+ ?stc:setKeyWords(Ed, 0, keyWords()),
+ wxSizer:add(Sizer, Ed, [{proportion,1}, {flag, ?wxEXPAND}]),
+ Ed.
+
+
+keyWords() ->
+ L = ["after","begin","case","try","cond","catch","andalso","orelse",
+ "end","fun","if","let","of","query","receive","when","bnot","not",
+ "div","rem","band","and","bor","bxor","bsl","bsr","or","xor"],
+ lists:flatten([K ++ " " || K <- L] ++ [0]).