~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/debugger/src/dbg_ui_mon_win.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%% 
4
 
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
4
%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
5
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
224
224
%%--------------------------------------------------------------------
225
225
add_module(WinInfo, Menu, Mod) ->
226
226
    Modules = WinInfo#winInfo.modules,
227
 
    case lists:keysearch(Mod, #moduleInfo.module, Modules) of
228
 
        {value, _ModInfo} -> WinInfo;
 
227
    case lists:keymember(Mod, #moduleInfo.module, Modules) of
229
228
        false ->
230
229
            %% Create a menu for the module
231
230
            Font = dbg_ui_win:font(normal),
244
243
            gs:config(WinInfo#winInfo.listbox, {add, Mod}),
245
244
 
246
245
            ModInfo = #moduleInfo{module=Mod, menubtn=MenuBtn},
247
 
            WinInfo#winInfo{modules=[ModInfo | Modules]}
 
246
            WinInfo#winInfo{modules=[ModInfo | Modules]};
 
247
        true -> WinInfo
248
248
    end.
249
249
    
250
250
%%--------------------------------------------------------------------
491
491
 
492
492
%% Process grid
493
493
handle_event({gs, _Id, keypress, _Data, [Key|_]}, WinInfo) when
494
 
  Key=='Up'; Key=='Down' ->
495
 
    Dir = if Key=='Up' -> up; Key=='Down' -> down end,
 
494
  Key =:= 'Up'; Key =:= 'Down' ->
 
495
    Dir = if Key =:= 'Up' -> up; Key =:= 'Down' -> down end,
496
496
    Row = move(WinInfo, Dir),
497
 
 
498
497
    if Row>1 ->
499
498
            WinInfo2 = highlight(WinInfo, Row),
500
 
            {value, #procInfo{pid=Pid}} =
501
 
                lists:keysearch(Row, #procInfo.row, WinInfo#winInfo.processes),
 
499
            #procInfo{pid=Pid} =
 
500
                lists:keyfind(Row, #procInfo.row, WinInfo#winInfo.processes),
502
501
            {focus, Pid, WinInfo2};
503
502
       true ->
504
503
            ignore
515
514
move(WinInfo, Dir) ->
516
515
    Row = WinInfo#winInfo.focus,
517
516
    Last = WinInfo#winInfo.row,
518
 
 
519
517
    if
520
 
        Dir==up, Row>1 -> Row-1;
521
 
        Dir==down, Row<Last -> Row+1;
 
518
        Dir =:= up, Row > 1 -> Row-1;
 
519
        Dir =:= down, Row < Last -> Row+1;
522
520
        true -> Row
523
521
    end.
524
522
 
533
531
    GridLine2 = gs:read(Grid, {obj_at_row, Row}),
534
532
    gs:config(GridLine2, {fg, white}),
535
533
    WinInfo#winInfo{focus=Row}.
536
 
    
537
534
 
538
535
%%====================================================================
539
536
%% Internal functions
545
542
    Dx = NewW - gs:read(Grid, width),
546
543
    Dy = H-42 - gs:read(Grid, height),
547
544
    if
548
 
        (Dx+Dy)=/=0 ->
 
545
        (Dx+Dy) =/= 0 ->
549
546
            gs:config(Grid, [{width, NewW}, {height, H-30}]),
550
547
            Cols = calc_columnwidths(NewW),
551
548
            gs:config(Grid, Cols);
555
552
 
556
553
calc_columnwidths(Width) ->
557
554
    W = if
558
 
            Width=<?Wg -> ?Wg;
 
555
            Width =< ?Wg -> ?Wg;
559
556
            true -> Width
560
557
        end,
561
 
    First = lists:map(fun (X) -> round(X) end,
562
 
                      [0.13*W, 0.27*W, 0.18*W, 0.18*W]),
 
558
    First = [round(X) || X <- [0.13*W, 0.27*W, 0.18*W, 0.18*W]],
563
559
    Last = W - lists:sum(First) - 30,
564
560
    {columnwidths, First++[Last]}.