OK ... a more broad picture of what I did to "see more" ...
Now it looks ugly ... but is less of a fail.
And even after that ... I made these changes ... adding lots of lists:flatten(io_lib:format( ) )
To ensure a readable STRING. After this ... I have a very very long session of cutting triangles with not even a dialog popping up.
Code:
build(Ask, {label, Label, Flags}, Parent, Sizer, In)
when Ask =/= false ->
Limit = proplists:get_value(break, Flags, infinite),
{_,Lines} = wings_text:break_lines([Label], Limit),
Text = wxStaticText:new(Parent, ?wxID_ANY, Lines),
add_sizer(label, Sizer, Text, Flags),
MinSize = case proplists:get_value(min_wsz, Flags, -1) of
Sz when Sz > 0 -> Sz;
Sz ->
case proplists:get_value(width, Flags) of
undefined -> Sz;
Chars ->
{W, _, _, _} = wxWindow:getTextExtent(Parent, "W"),
Chars*W
end
end,
wxSizer:setItemMinSize(Sizer, Text, MinSize, -1),
In;
Now it looks ugly ... but is less of a fail.
And even after that ... I made these changes ... adding lots of lists:flatten(io_lib:format( ) )
To ensure a readable STRING. After this ... I have a very very long session of cutting triangles with not even a dialog popping up.
Code:
handle_error(Ev, Cmd) ->
Key = bindkey(Ev, Cmd),
KeyName =
case Key of
{bindkey,_MODE,KEY_OR_TUPLE} ->
lists:flatten(io_lib:format("~p",[{bindkey,KEY_OR_TUPLE}]));
_ -> lists:flatten(io_lib:format("~p",[Key])) % Prob never happens but OK if does.
end,
CmdStr = cmd_to_string(Cmd),
Msg1 = "Executing the command " ++ CmdStr ++ " bound to the hotkey " ++
KeyName ++ " caused an error.",
Msg2 = "Possible causes:",
Msg3 = "The hotkey was defined in a previous version of Wings,"
" and the command that it refers to has been changed,"
" removed, or renamed in this version of Wings.",
Msg4 = "The hotkey refers to a command in a "
" plug-in that is currently disabled,"
" or to a previous version of a plug-in.",
Msg5 = "A bug in the command itself. Try executing the command"
" from the menu directly (i.e. not through a hotkey) -"
"if it crashes it IS a bug. (Please report it.)",
Msg6 = "Delete Hotkey: " ++ KeyName ++ " or press cancel to avoid any changes",
Qs = {vframe_dialog,
[{label,Msg1}, separator,
{label,Msg2},
{label,Msg3},
{label,Msg4},
{label,Msg5}, separator,
{label,Msg6}],
[{buttons, [ok, cancel], {key, result}}]},
wings_dialog:dialog("Delete HotKey", Qs,
fun([{result, ok}]) -> unbind(Key);
(_) -> ignore
end).
cmd_to_string(X) when is_atom(X) -> atom_to_list(X);
cmd_to_string({X,Tuple}) when is_atom(X), is_tuple(Tuple) ->
"{" ++ atom_to_list(X) ++ "," ++ cmd_to_string(Tuple) ++ "}";
cmd_to_string({X,Y}) when is_atom(X),is_atom(Y) ->
"{" ++ atom_to_list(X) ++ "," ++ atom_to_list(Y) ++ "}".