diff options
author | Dan Gudmundsson <[email protected]> | 2013-11-11 15:00:13 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-11-11 15:00:13 +0100 |
commit | 560f73141afbc1ef41d6c8acb3974b3632ad6f25 (patch) | |
tree | ec545369e7f6639ace71c2d42de9c2b872124c63 /lib/debugger/src/dbg_ui_edit_win.erl | |
parent | 918a6182f99441d6f864a330eee561ead6ce834a (diff) | |
download | otp-560f73141afbc1ef41d6c8acb3974b3632ad6f25.tar.gz otp-560f73141afbc1ef41d6c8acb3974b3632ad6f25.tar.bz2 otp-560f73141afbc1ef41d6c8acb3974b3632ad6f25.zip |
Remove gs parts of the debugger
Diffstat (limited to 'lib/debugger/src/dbg_ui_edit_win.erl')
-rw-r--r-- | lib/debugger/src/dbg_ui_edit_win.erl | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/lib/debugger/src/dbg_ui_edit_win.erl b/lib/debugger/src/dbg_ui_edit_win.erl deleted file mode 100644 index 2e9a685b57..0000000000 --- a/lib/debugger/src/dbg_ui_edit_win.erl +++ /dev/null @@ -1,128 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2012. 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_ui_edit_win). --compile([{nowarn_deprecated_function,{gs,button,2}}, - {nowarn_deprecated_function,{gs,config,2}}, - {nowarn_deprecated_function,{gs,entry,2}}, - {nowarn_deprecated_function,{gs,label,2}}, - {nowarn_deprecated_function,{gs,read,2}}, - {nowarn_deprecated_function,{gs,window,2}}]). - -%% External exports --export([create_win/5, get_window/1, - handle_event/2]). - --record(winInfo, {window, % gsobj() - entry, % gsobj() - button, % gsobj() - type % atom() - }). - -%%==================================================================== -%% External exports -%%==================================================================== - -%%-------------------------------------------------------------------- -%% create_win(GS, Pos, Title, Prompt, {Type, Value}) -> #winInfo{} -%% GS = graphics system identifier -%% Pos = {X, Y} -%% X = Y = integer() -%% Title = string() -%% Prompt = atom() -%% Type = term | atom | float | integer | string -%% Value = term() -%%-------------------------------------------------------------------- -create_win(GS, {X, Y}, Title, Prompt, {Type, Value}) -> - Pad=8, - - Font = dbg_ui_win:font(normal), - - %% Window - Win = gs:window(GS, [{title, Title}, {x, X}, {y, Y}, - {destroy, true}]), - - %% Label - {Wlbl, Hlbl} = dbg_ui_win:min_size([Prompt], 50, 30), - gs:label(Win, [{x, Pad}, {y, Pad}, {width, Wlbl}, {height, Hlbl}, - {align, e}, {label, {text, Prompt}}, {font, Font}]), - - - %% Entry - {Went, _Hent} = dbg_ui_win:min_size([Value], 100, 20), - Ent = gs:entry(Win, [{x, Pad+Wlbl}, {y, Pad}, - {width, Went}, {height, Hlbl}, - {text, Value}, - {keypress, true}]), - - %% OK and Cancel buttons - W = Pad + Wlbl + Went + Pad, - {Wbtn, Hbtn} = dbg_ui_win:min_size(["Cancel"], 70, 30), - Ybtn = Pad + Hlbl + Pad, - Btn = gs:button(Win, [{x, Pad}, {y, Ybtn}, - {width, Wbtn}, {height, Hbtn}, - {label, {text,"OK"}}, {font, Font}]), - gs:button(Win, [{x, W-Pad-Wbtn}, {y, Ybtn}, - {width, Wbtn}, {height, Hbtn}, - {label, {text,"Cancel"}}, {font, Font}]), - - H = Ybtn + Hbtn + Pad, - gs:config(Win, [{width, W}, {height, H}, {map, true}]), - - #winInfo{window=Win, entry=Ent, button=Btn, type=Type}. - -%%-------------------------------------------------------------------- -%% get_window(WinInfo) -> Window -%% WinInfo = #winInfo{} -%% Window = gsobj() -%%-------------------------------------------------------------------- -get_window(WinInfo) -> - WinInfo#winInfo.window. - -%%-------------------------------------------------------------------- -%% handle_event(GSEvent, WinInfo) -> Command -%% GSEvent = {gs, Id, Event, Data, Arg} -%% WinInfo = #winInfo{} -%% Command = ignore -%% | stopped -%% | {edit, Value} -%%-------------------------------------------------------------------- -handle_event({gs, _Id, destroy, _Data, _Arg}, _WinInfo) -> - stopped; -handle_event({gs, Id, keypress, Data, ['Return'|_]}, WinInfo) -> - gs:config(WinInfo#winInfo.button, flash), - handle_event({gs, Id, click, Data, ["OK"]}, WinInfo); -handle_event({gs, _Id, click, _Data, ["OK"|_]}, WinInfo) -> - Ent = WinInfo#winInfo.entry, - Str = gs:read(Ent, text), - Type = WinInfo#winInfo.type, - case erl_scan:string(Str) of - {ok, Tokens, _EndLine} when Type==term -> - case erl_parse:parse_term(Tokens++[{dot, 1}]) of - {ok, Value} -> {edit, Value}; - _Error -> ignore - end; - {ok, [{Type, _Line, Value}], _EndLine} when Type/=term -> - {edit, Value}; - _ -> - ignore - end; -handle_event({gs, _Id, click, _Data, ["Cancel"|_]}, _WinInfo) -> - stopped; -handle_event(_GSEvent, _WinInfo) -> - ignore. |