forked from dgud/wings
/
wings_s.erl
98 lines (84 loc) · 2.65 KB
/
wings_s.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
%%
%% wings_s.erl --
%%
%% Common text strings.
%%
%% Copyright (c) 2004-2011 Bjorn Gustavsson
%%
%% See the file "license.terms" for information on usage and redistribution
%% of this file, and for a DISCLAIMER OF ALL WARRANTIES.
%%
%% $Id$
%%
-module(wings_s).
-export([yes/0,no/0,cancel/0,accept/0,
lmb/0,mmb/0,rmb/0,scroll/0,
modkey/1,mac_mod/1,shift/0,ctrl/0,alt/0,command/0,
key/1,dir/1,dir_axis/1,
camera_mode/1]).
-include("wings.hrl").
yes() -> ?__(1,"Yes").
no() -> ?__(1,"No").
cancel() -> ?__(1,"Cancel").
accept() -> ?__(1,"Accept").
%% Mouse buttons.
lmb() -> ?STR(mouse_b,l,"L").
mmb() -> ?STR(mouse_b,m,"M").
rmb() -> ?STR(mouse_b,r,"R").
scroll() -> ?__(scroll,"Scroll").
%% Modifier keys.
shift() -> str2char(shift, ?STR(mod,shift,"Shift")).
ctrl() -> str2char(ctrl, ?STR(mod,ctrl,"Ctrl")).
alt() -> str2char(alt, ?STR(mod,alt,"Alt")).
command() -> str2char(command, ?STR(mod,command,"Command")). %Command key on Mac.
str2char(Mod, Str) ->
case os:type() of
{unix, darwin} -> [mac_mod(Mod)];
_ -> Str
end.
mac_mod(shift) -> 8679;
mac_mod(alt) -> 8997;
mac_mod(ctrl) -> 8963;
mac_mod(command) -> 8984.
modkey(shift) -> shift();
modkey(ctrl) -> ctrl();
modkey(alt) -> alt();
modkey(command) -> command().
%% Returns key name within square brackets.
key(Key) ->
case os:type() of
{unix, darwin} -> [key_1(Key)];
_ -> [$[,key_1(Key),$]]
end.
key_1(shift) -> shift();
key_1(ctrl) -> ctrl();
key_1(alt) -> alt();
key_1(command) -> command();
key_1(Key) when is_atom(Key) -> atom_to_list(Key);
key_1(Key) when is_list(Key) -> Key.
%% All directions.
dir(x) -> ?__(x,"X");
dir(y) -> ?__(y,"Y");
dir(z) -> ?__(z,"Z");
dir(all) -> ?__(all,"All");
dir(last_axis) -> ?__(la,"last axis");
dir(default_axis) -> ?__(da,"default axis");
dir(normal) -> ?__(n,"Normal");
dir(free) -> ?__(f,"Free");
dir(uniform) -> ?__(u,"Uniform");
dir({radial,Axis}) -> ?__(r,"Radial") ++ " " ++ dir(Axis);
dir(radial_x) -> ?__(r,"Radial") ++ " " ++ dir(x);
dir(radial_y) -> ?__(r,"Radial") ++ " " ++ dir(y);
dir(radial_z) -> ?__(r,"Radial") ++ " " ++ dir(z).
dir_axis(Axis) ->
wings_util:format(?STR(dir,the_axis,"the ~s axis"), [dir(Axis)]).
%% Camera modes; probably don't need to be translated, but could
%% need to be transliterad for languages with non-Latin alphabets.
camera_mode(blender) -> ?__(blender,"Blender");
camera_mode(nendo) -> ?__(nendo,"Nendo");
camera_mode(mirai) -> ?__(mirai,"Mirai");
camera_mode(tds) -> ?__(tds,"3ds max");
camera_mode(maya) -> ?__(maya,"Maya");
camera_mode(mb) -> ?__(mb,"Motionbuilder");
camera_mode(sketchup) -> ?__(sketchup,"SketchUp");
camera_mode(wings_cam) -> ?__(wings_cam,"Wings 3D").