%
% anyremote configuration file for customization of GUI of Java client. (Server-mode)
%

% STATUS stable
% XTEST no
% SOUND no
% ENV no

GuiAppName=Main screen layout setup example
GuiAppType=Example
GuiAppBinary=true
GuiAppProtocols=Server
GuiAppDesc=Example of anyRemote Android/J2ME clients main screen layout setup.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);
	
(Connect)=\
	Set(title,Layout Setup);\
	Set(parameter,debug,on);\
	Get(screen_size);\
	Set(icons,Layout Setup,\
		1,vol_down,2,mute,3,vol_up,\
		4,rewind,5,play,6,forward,\
		7,prev,8,stop,9,next,\
		*,question,0,pause,#,no);\
	Make(mode,init_setup);


[Mode]=init_setup

* *=Set(text,replace,Help,With this configuration file it is possible to setup icon size and distance beetween icons.\nPlease choose Android or J2ME);
Back=\
	Set(text,close);\
	Macro(M_MENU);

(EnterMode)=\
	Set(status,Please choose Android or J2ME);\
	Macro(M_MENU);

M_MENU=\
	Set(menu,replace,Android,J2ME);

Android=Make(mode,a_setup);
J2ME=Make(mode,j_setup);

[ModeEnd]

[Mode]=j_setup

(EnterMode)=\
	Make(var,isize,by_value,32);\
	Make(var,space,by_value,0);\
        Get(icon_size);\
        Get(icon_padding);\
	Macro(J_MENU);
	
J_MENU=\
	Set(menu,replace,Main,Default,16,32,48,64,96,128,Padding+,Padding-,Save Setup,Clear Setup);

Main=Make(mode,init_setup);

0=Macro(Default);
1=Macro(Padding-);
3=Macro(Padding+);

Default=\
	Make(var,isize,by_value,32);\
	Make(var,space,by_value,0);\
	Set(parameter,icon_size,$(isize));\
	Get(icon_size);\
	Set(parameter,icon_padding,$(space));\
	Get(icon_padding);

16=Make(var,isize,by_value,16);Set(parameter,icon_size,$(isize));Get(icon_size);
32=Make(var,isize,by_value,32);Set(parameter,icon_size,$(isize));Get(icon_size);
48=Make(var,isize,by_value,48);Set(parameter,icon_size,$(isize));Get(icon_size);
64=Make(var,isize,by_value,64);Set(parameter,icon_size,$(isize));Get(icon_size);
96=Make(var,isize,by_value,96);Set(parameter,icon_size,$(isize));Get(icon_size);
128=Make(var,isize,by_value,128);Set(parameter,icon_size,$(isize));Get(icon_size);

Padding+=Make(var,space,expr $(space) + 1);Set(parameter,icon_padding,$(space));Get(icon_padding);
Padding-=Make(var,space,expr $(space) - 1);Set(parameter,icon_padding,$(space));Get(icon_padding);

IconSize($$)   =Make(var,isize,by_value,$(Index));Set(status,$(isize) / $(space));
IconPadding($$)=Make(var,space,by_value,$(Index));Set(status,$(isize) / $(space));

Save Setup=\
	Make(var,dummy,touch $HOME/.anyRemote/hook_connect;mv $HOME/.anyRemote/hook_connect $HOME/.anyRemote/hook_connect.old;cat $HOME/.anyRemote/hook_connect.old|grep -v icon_size|grep -v icon_padding > $HOME/.anyRemote/hook_connect;echo "");\
	Exec(echo "Set(parameter,icon_size,$(isize))" >> $HOME/.anyRemote/hook_connect;echo "Set(parameter,icon_padding,$(space))" >> $HOME/.anyRemote/hook_connect);

Clear Setup=\
	Exec(touch $HOME/.anyRemote/hook_connect;mv $HOME/.anyRemote/hook_connect $HOME/.anyRemote/hook_connect.old;cat $HOME/.anyRemote/hook_connect.old|grep -v icon_size|grep -v icon_padding > $HOME/.anyRemote/hook_connect);
	
* *=Set(text,replace,Help,With this configuration file it is possible to setup icon size and distance beetween icons.\n0 - Defaults\n1 - Decrease Padding\n3 - Increase Padding\nTo be able to select icon size in J2ME client it needs to use J2ME client with full icons sets);
Back=\
	Set(text,close);\
	Macro(J_MENU);

[ModeEnd]

[Mode]=a_setup

(EnterMode)=\
	Make(var,isize,by_value,32);\
	Make(var,space,by_value,0);\
        Get(icon_size);\
        Get(icon_padding);\
	Macro(A_MENU);
	
A_MENU=\
	Set(menu,replace,Main,Default,Size+,Size-,Padding+,Padding-,Save Setup,Clear Setup);

Main=Make(mode,init_setup);

0=Macro(Default);
1=Macro(Padding-);
3=Macro(Padding+);
4=Macro(Size-);
6=Macro(Size+);

Default=\
	Make(var,isize,by_value,-1);\
	Make(var,space,by_value,0);\
	Set(parameter,icon_size,$(isize));\
	Get(icon_size);\
	Set(parameter,icon_padding,$(space));\
	Get(icon_padding);

Size+=Make(var,isize,expr $(isize) + 1);Set(parameter,icon_size,$(isize));Get(icon_size);
Size-=Make(var,isize,expr $(isize) - 1);Set(parameter,icon_size,$(isize));Get(icon_size);

Padding+=Make(var,space,expr $(space) + 1);Set(parameter,icon_padding,$(space));Get(icon_padding);
Padding-=Make(var,space,expr $(space) - 1);Set(parameter,icon_padding,$(space));Get(icon_padding);

IconSize($$)   =Make(var,isize,by_value,$(Index));Set(status,$(isize) / $(space));
IconPadding($$)=Make(var,space,by_value,$(Index));Set(status,$(isize) / $(space));

Save Setup=\
	Make(var,dummy,touch $HOME/.anyRemote/hook_connect;mv $HOME/.anyRemote/hook_connect $HOME/.anyRemote/hook_connect.old;cat $HOME/.anyRemote/hook_connect.old|grep -v icon_size|grep -v icon_padding > $HOME/.anyRemote/hook_connect;echo "");\
	Exec(echo "Set(parameter,icon_size,$(isize))" >> $HOME/.anyRemote/hook_connect;echo "Set(parameter,icon_padding,$(space))" >> $HOME/.anyRemote/hook_connect);

Clear Setup=\
	Exec(touch $HOME/.anyRemote/hook_connect;mv $HOME/.anyRemote/hook_connect $HOME/.anyRemote/hook_connect.old;cat $HOME/.anyRemote/hook_connect.old|grep -v icon_size|grep -v icon_padding > $HOME/.anyRemote/hook_connect);

* *=Set(text,replace,Help,With this configuration file it is possible to setup icon size and distance beetween icons.\n 0 - Defaults\n1 - Decrease Padding\n3 - Increase Padding\n4 - Decrease Icon Size\n6 - Increase Icon Size);
Back=\
	Set(text,close);\
	Macro(A_MENU)

[ModeEnd]

[End]
