%
% anyremote configuration file for DjView management  (Server-mode)
%  http://djvu.sourceforge.net/djview4.html package

% STATUS stable
% XTEST yes
% SOUND no
% ENV no
% FBROWSER v.3i
% DEF_PRESENTATION   
% ALL_IN_ONE 
% MEDIACENTER presentation

GuiAppName=DjVuLibre
GuiAppBinary=djview
GuiAppRun=echo 'U=`id -u`;P=`pgrep -l -u $U djview`; if [ "x$P" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=A standalone DjVu viewer for Unix under X11 (based on the Qt library).

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-presentation.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v3i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Make(var,open_file,by_value,);\
	Make(var,app_name,by_value,DjVuLibre);\
	Make(var,app_manage_mode,by_value,djview_manage);

(Exit)=\
	Macro(FBROWSER_IC_EXIT);

(Connect)=\
	Make(mode,djview);

[Mode]=djview : default_presentation_init

APP_IS_RUN=\
	Make(var,app_run,pgrep -l -u `id -u` djview|head -1|wc -l);

[ModeEnd]

[Mode]=djview_manage : default_presentation

SETUP_DEFAULT_PRESENTATION=\
	Set(layout,default);\
 	Set(icons,$(app_name),\
		1,folder,2,plus,3,none,\
		4,rewind,5,fit,6,forward,\
		7,none,8,minus,9,none,\
		*,question,0,none,#,no);\
	Set(status,$(app_name));\
	Set(title,$(open_file));

APP_SETUP=\
	Make(none);

* *=Set(text,replace,Help,1 File Browser\n2 Zoom In\n3 None\n4 Previous Page\n5 Fit\n6 Next Page\n7 None\n8 Zoom Out\n9 None\n ** Help\n0 None\n# Quit $(app_name)\n);

APP_START_IF=\
	Make(var,app_run,pgrep -l -u `id -u` djview|head -1|wc -l);\
    Make(var,screen_resolution,xdpyinfo |grep dimensions|cut -f 2 -d : |cut -f 1 -d p|tr -d ' ');\
	Exec(if [ "x$(app_run)" = "x0" ]; then cd "$(fbrowser_dir)";djview -fs -geometry $(screen_resolution) $(open_file)& fi 2> /dev/null);
	
APP_RAISE=\
	Exec($(CfgDir)/Utils/run-or-switch-to.sh -switch djview);

APP_QUIT=\
	Exec(pkill djview);\
	Set(title, );

Up=\
    Emulate(key,Page_Up);

Down=\
    Emulate(key,Page_Down);

PRES_START=\
	Make(none);

PRES_PREV_PAGE=\
	Emulate(key,Page_Up);
	
PRES_NEXT_PAGE=\
	Emulate(key,Page_Down);

PRES_ZOOM_IN=\
	EEmulate(key,plus);
	
PRES_ZOOM_OUT=\
	Emulate(key,minus);

PRES_FIRST_PAGE=\
	Make(none);
	
PRES_LAST_PAGE=\
	Make(none);

# Fit	
PRES_TOGGLE_FULLSCREEN=\
	Emulate(key,p);
	
PRES_REFRESH=\
	Make(none);

[ModeEnd]

[End]
