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