Permalink
Browse files

Merge branch 'mv/bugs1.4.1.a'

  • Loading branch information...
2 parents 9c969db + 2cec85d commit 2ff45e07784c5255d3fc2fe15f024a6f84ed64e7 @dgud dgud committed Dec 16, 2012
Showing with 55 additions and 40 deletions.
  1. +9 −4 src/wings.erl
  2. +3 −2 src/wings_ask.erl
  3. +42 −33 src/wings_menu.erl
  4. +1 −1 src/wings_we_build.erl
View
@@ -1807,13 +1807,18 @@ get_object_info(Id, Shapes) ->
Volume =lists:sum([V || {_,V} <- Both]),
ToString = fun(Item) ->
case Item of
+ Item when is_float(Item), Item < 1.0 ->
+ Decimals = 1 - round(math:log10(Item)-0.5),
+ if Decimals > 8 -> "0.00000";
+ true -> lists:flatten(io_lib:format("~10.*f", [Decimals, Item]))
+ end;
Item when is_float(Item) ->
- lists:concat(hd(io_lib:fwrite("~12f", [Item])));
+ lists:flatten(io_lib:format("~10.2f", [Item]));
Item when is_integer(Item) ->
- integer_to_list(Item);
+ integer_to_list(Item);
Item when is_list(Item) ->
- Item
- end
+ Item
+ end
end,
[Id2,Name2,Area2,Volume2] = lists:map(ToString, [Id,Name,Area,Volume]),
{{Id,Id2},{Name,Name2},{Area,Area2},{Volume,Volume2}}.
View
@@ -1049,8 +1049,9 @@ find_eyepicker(Fi, Sto) ->
field_type(I, Store) ->
case gb_trees:lookup(-I, Store) of
- {value,F} -> element(1, F);
- none -> undefined
+ {value,F} when is_tuple(F) ->
+ element(1, F);
+ _ -> undefined
end.
%% Search tree to find field matching a predicate using reverse linear scan.
View
@@ -79,7 +79,7 @@ menu(X, Y, Owner, Name, Menu) ->
popup_menu(X, Y, Name, Menu) ->
menu_setup(popup, X, Y, Name, Menu, #mi{owner=wings_wm:this()}).
-menu_setup(Type, X0, Y0, Name, Menu0, #mi{ns=Names0}=Mi0) ->
+menu_setup(Type, X0, Y0, Name, Menu0, #mi{ns=Names0,level=Level0}=Mi0) ->
Menu = case Name of
more ->
Names = Names0,
@@ -91,39 +91,48 @@ menu_setup(Type, X0, Y0, Name, Menu0, #mi{ns=Names0}=Mi0) ->
Toolbar = wings_pref:get_value(menu_toolbar),
Menu1 = wings_plugin:menu(list_to_tuple(reverse(Names)), Menu0),
AddToolbar = menu_toolbar_allowed(Toolbar, Type, Names),
- Menu2 = if AddToolbar -> [menu_toolbar|Menu1]; true -> Menu1 end,
- Hotkeys = wings_hotkey:matching(Names),
- normalize_menu(Menu2, Hotkeys, Type =:= popup)
+ case Menu1 of
+ [] -> empty;
+ _ ->
+ Menu2 = if AddToolbar -> [menu_toolbar|Menu1]; true -> Menu1 end,
+ Hotkeys = wings_hotkey:matching(Names),
+ normalize_menu(Menu2, Hotkeys, Type =:= popup)
+ end
end,
- {MwL,MwM,MwR,Hs} = menu_dims(Menu),
- ToolbarSize = wings_pref:get_value(menu_toolbar_size),
- Cw = ?CHAR_WIDTH,
- TotalW = total_width(AddToolbar, MwL + MwM + MwR + 8*Cw, ToolbarSize),
- Mh = lists:sum(Hs),
- Margin = 3,
- InfoLine = ?CHAR_HEIGHT + 14,
- {X1,Y1} = case Type of
- plain ->
- {X0,Y0};
- popup when ToolbarSize =:= big ->
- % snap mouse to space between Repeat and Vertex icon
- {(X0-TotalW div 2)+22*3, Y0 - Margin - ?CHAR_HEIGHT};
- popup when ToolbarSize =:= small ->
- % snap mouse to space between Repeat and Vertex icon
- {(X0-TotalW div 2)+15*3, Y0 - Margin - ?CHAR_HEIGHT}
- end,
- {X,Y} = move_if_outside(X1, Y1, TotalW, Mh+2*Margin+InfoLine, Mi0),
- move_cursor_to_toolbar(AddToolbar, Type, Y),
- W = TotalW-10,
- Mi = Mi0#mi{ymarg=Margin,shortcut=MwL+Cw,w=W,h=Mh,hs=Hs,
- sel=none,ns=Names,menu=Menu,type=Type,orig_xy={X0,Y0}},
- #mi{level=Level} = Mi,
- setup_menu_killer(Mi),
- Op = {seq,push,get_menu_event(Mi)},
- WinName = {menu,Level},
- wings_wm:delete({menu,Level}),
- wings_wm:new(WinName, {X,Y,highest}, {W,Mh+10}, Op),
- delete_from(Level+1).
+ Level = case Menu of
+ empty -> Level0;
+ _ ->
+ {MwL,MwM,MwR,Hs} = menu_dims(Menu),
+ ToolbarSize = wings_pref:get_value(menu_toolbar_size),
+ Cw = ?CHAR_WIDTH,
+ TotalW = total_width(AddToolbar, MwL + MwM + MwR + 8*Cw, ToolbarSize),
+ Mh = lists:sum(Hs),
+ Margin = 3,
+ InfoLine = ?CHAR_HEIGHT + 14,
+ {X1,Y1} = case Type of
+ plain ->
+ {X0,Y0};
+ popup when ToolbarSize =:= big ->
+ % snap mouse to space between Repeat and Vertex icon
+ {(X0-TotalW div 2)+22*3, Y0 - Margin - ?CHAR_HEIGHT};
+ popup when ToolbarSize =:= small ->
+ % snap mouse to space between Repeat and Vertex icon
+ {(X0-TotalW div 2)+15*3, Y0 - Margin - ?CHAR_HEIGHT}
+ end,
+ {X,Y} = move_if_outside(X1, Y1, TotalW, Mh+2*Margin+InfoLine, Mi0),
+ move_cursor_to_toolbar(AddToolbar, Type, Y),
+ W = TotalW-10,
+ Mi = Mi0#mi{ymarg=Margin,shortcut=MwL+Cw,w=W,h=Mh,hs=Hs,
+ sel=none,ns=Names,menu=Menu,type=Type,orig_xy={X0,Y0}},
+ #mi{level=Level1} = Mi,
+ setup_menu_killer(Mi),
+ Op = {seq,push,get_menu_event(Mi)},
+ WinName = {menu,Level1},
+ wings_wm:delete({menu,Level1}),
+ wings_wm:new(WinName, {X,Y,highest}, {W,Mh+10}, Op),
+ Level1+1
+ end,
+ delete_from(Level).
total_width(true, W, Size) ->
case Size of
View
@@ -191,7 +191,7 @@ combine_half_edges([], Good, Bad) ->
{reverse(Good),reverse(Bad)}.
number_edges(Es) ->
- number_edges(Es, 1, []).
+ number_edges(Es, 0, []).
number_edges([{Name,{_Ldata,_Rdata}=Data}|Es], Edge, Tab0) ->
Tab = [{Name,{Edge,Data}}|Tab0],

0 comments on commit 2ff45e0

Please sign in to comment.