%
% anyremote configuration file for image viewing on the screen of cellphone (Server-mode)
% prerequisites: ImageMagic
%

% STATUS stable
% XTEST no
% SOUND no
% ENV no
% FBROWSER v.4i

GuiAppName=ImageViewer
GuiAppIcon=redo.png
GuiAppType=Custom
GuiAppBinary=true
GuiAppProtocols=Server
GuiAppDesc=Allows to view images from PC on the phone screen. Beware: Can cause J2ME client crash on some Nokia's and Samsung's

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v4i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Macro(TEST_IMAGEMAGIC);\
	Make(var,wm_rotate,by_value,);

(Exit)=\
	Macro(FBROWSER_IC_EXIT);
	
(Connect)=\
	Set(icons,ImageViewer,\
		1,folder,2,plus,3,default,\
		4,default,5,default,6,default,\
		7,default,8,default,9,default,\
		*,question,0,no,#,default);\
	Set(hints,\
		1,file manager,\
        *,help (press twice));\
	Set(title,);\
	Set(status,);\
	Set(image,nocursor);\
    Macro(FBROWSER_IC_FILL_LIST);\
    Macro(UpdateMenu);

Cancel=\
	Make(exit);

Back=\
	Set(text,close);\
	Set(image,close);\
	Set(menu,replace,);
	
%Back($$)=\
%    Macro(FBROWSER_IC_GO_UP);

Back($$)=\
	Set(list,close);
	
UpdateMenu=\
	Set(menu,replace,GoTo,Open,Go Home);

Open($$)=\
	Make(var,view_idx,echo $(Index));\
    Make(var,view_file,by_value,$(Param));\
    Make(mode,file_viewer);

Open=\
	Make(var,view_idx,echo $(Index));\
    Make(var,view_file,by_value,$(Param));\
    Make(mode,file_viewer);
	
GoTo($$)=\
	Macro(FBROWSER_IC_GO_TO);
	
Go Home($$)=\
	Macro(FBROWSER_IC_GO_HOME);
	
%Push($$) use from aliases-server-fbrowser-v4i.cfg

1=\
    Macro(FBROWSER_IC_FILL_LIST);\
    Macro(UpdateMenu);

2=\
    Set(fullscreen,toggle);\
    Get(screen_size);

* *=\
    Set(text,replace,Help, Image viewer.\n1 - File browser\n2 - Toggle Fullscreen);\
    Set(menu,replace,);

0=\
    Make(exit);

[Mode]=file_viewer

(EnterMode)=\
	Macro(SHOW);

Back=\
	Macro(List);

% Android gestures support
ImageSlideLeft=\
	Macro(Next);
	
ImageSlideRight=\
	Macro(Previous);

WINMENU=\
	Set(menu,replace,Next,Previous,Update,List);

SHOW=\
	Macro(SHOW2);
	
SHOW2=\
	Set(popup,show,Loading...);\
	Set(image,window,$(fbrowser_dir)/$(view_file));\
	Set(popup,hide);\
	Macro(WINMENU);

Update=\
    Macro(SHOW2);

Next=\
	Make(var,view_idx,expr $(view_idx) + 1);\
	Make(var,view_file,ls -1 "$(fbrowser_dir)"|head -$(view_idx)|tail -1);\
	Macro(SHOW2);

Previous=\
	Make(var,view_idx,J=`expr $(view_idx) - 1`;echo $J);\
	Make(var,view_file,ls -1 "$(fbrowser_dir)"|head -$(view_idx)|tail -1);\
	Macro(SHOW2);

List=\
    Make(mode,default);\
	Macro(FBROWSER_IC_FILL_LIST);\
	Macro(UpdateMenu);
    
[ModeEnd]

[End]
