disable NOP on AROS.
[AROS-Contrib.git] / bgui / RexxBGUI / bguimodes.awebrx
blobf85205a96bf04543329e3611675c62b604f84c65
1 /* REXX script for rexxbgui.library: AWeb modes */
3 if ~show('l','rexxbgui.library') then do
4         if ~addlib('rexxbgui.library',0,-30) then do
5                 exit(20)
6         end
7         else nop
8 end
9 else nop
11 options results
13 if substr(address(),1,5)~='AWEB.' then do
14    ports = show('P')
15    parse var ports dummy 'AWEB.' portnr .
16    address value 'AWEB.' || portnr
17    'GET ACTIVEPORT'
18    address value result
19 end
20 else nop
21 'JAVASCRIPT SOURCE "window.status=*"Opening window...*""'
23 parse arg '"' pubscrname '"'
24 if pubscrname='' then do
25         'GET SCREEN VAR pubscrname'
26 end
27 else nop
29 call bguiopen('AWebModes') /* causes error 12 if it did not work */
30 /* supply a second argument for a '0' return code instead of an ARexx
31    error */
33 signal on syntax /* important: bguiclose() MUST be called */
34 signal on halt
35 signal on break_c
37 esc='1B'x
38 lf='0A'x
39 cr='0D'x
40 grspace.narrow=-1
41 grspace.normal=-2
42 grspace.wide=-3
43 FixMinSize=bguilayout(LGO_FixMinWidth,1,LGO_FixMinHeight,1)
45 /* using ARexx feature: ,<newline> is translated to nothing */
46 /* the || are essential - any added space will cause trouble */
47 /* redefining the same ID makes previous buttons unaccessible */
48 /* do not redefine winclose etc. */
50 g=bguivgroup(,
51         bguivgroup(,
52                 bguicheckbox('gframes','HTML _frames usage',1)FixMinSize||,
53                 bguicheckbox('gnframe','_Nominal (fixed) frame size',0)FixMinSize||,
54                 bguicheckbox('gjs','_Javascript usage',0)FixMinSize||,
55                 bguicheckbox('ganon','_Browse anonymously (no HTTP referrer header)',0)FixMinSize||,
56                 bguicheckbox('gmime','_Ignore server MIME type',0)FixMinSize||,
57         '',-2,'F')||bguilayout(LGO_FixMinHeight,1)||,
58         bguihgroup(,
59                 bguihgroup(,
60                         bguivarspace(50)||,
61                         bguimx('ghtml',,bguilist('hmtx','_0 Strict','_1 Tolerant','_2 Compatible'),'R')||FixMinSize||,
62                         bguivarspace(50),
63                 ,,'F','HTML \ezm\e-zode')||,
64                 bguihgroup(,
65                         bguivarspace(50)||,
66                         bguimx('gspoof',,bguilist('snames','(AWeb)','MSIE/4.0','Mozilla/3.0','Mozilla/4.0'),'R')||FixMinSize||,
67                         bguivarspace(50),
68                 ,,'F','\ezS\e-zpoof as')||bguilayout(LGO_FixMinHeight,1),
69         )||bguilayout(LGO_FixMinHeight,1)||,
70         bguihgroup(,
71                 bguibutton('ok',esc'bOK_'cr)||,
72                 bguibutton('apply','_Apply')||,
73                 bguibutton('update','_Get')||,
74                 bguibutton('cancel','_Cancel'),
75         )||bguilayout(LGO_FixMinHeight,1),
76 ,grspace.normal,grspace.normal)
78 drop hmtx.
80 call bguiset(obj.ghtml,,BT_Key,'m')
81 call bguiset(obj.gspoof,,BT_Key,'s')
82 call bguiaddcondit(obj.gframes,obj.gnframe,GA_Selected,0,GA_Disabled,1,GA_Disabled,0)
84 'GET VERSION'
85 winobj=bguiwindow('AWeb v'result 'modes',g,'-','-',,pubscrname,'M')
86 call getsettings()
87 if bguiwinopen(winobj)=0 then bguierror(12)
88 'JAVASCRIPT SOURCE "window.status=*"*""'
89 id=0
90 do while bguiwinwaitevent(winobj,'ID')~=id.winclose
91         select
92                 when id=id.winactive then nop
93                 when id=id.wininactive then nop
94                 when id=id.update then call getsettings()
95                 when id=id.cancel then leave
96                 when id=id.ok then do; call setsettings(); leave; end
97                 when id=id.apply then call setsettings()
98                 when id=id.winclose then nop
99                 otherwise nop
100         end
102 rc=0
104 syntax:
105 if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
106 call bguiclose()
107 exit 0
109 break_c:
110 halt:
111 rc=0
112 say '+++ Break at line' sigl
113 signal syntax
115 getsettings:
116 'GetCFG HTMLMODE'; call bguiset(obj.ghtml,winobj,MX_Active,result)
117 'GetCFG FRAMES'; call bguiset(obj.gframes,winobj,GA_Selected,result)
118 'GetCFG NOMINALFRAME'; call bguiset(obj.gnframe,winobj,GA_Selected,result)
119 'GetCFG JAVASCRIPT'; call bguiset(obj.gjs,winobj,GA_Selected,result)
120 'GetCFG ANONYMOUS'; call bguiset(obj.ganon,winobj,GA_Selected,result)
121 'GetCFG IGNOREMIME'; call bguiset(obj.gmime,winobj,GA_Selected,result)
123 'GetCFG SPOOFAS'
124 select
125         when result='MSIE/4.0' then n=1
126         when result='Mozilla/3.0' then n=2
127         when result='Mozilla/4.0' then n=3
128         otherwise n=0
130 call bguiset(obj.gspoof,winobj,MX_Active,n)
131 return 1
133 setsettings:
134 call bguiwinbusy(winobj)
136 NEWCFG.i.ITEM=HTMLMODE; NEWCFG.i.VALUE=bguiget(obj.ghtml,MX_Active); i=i+1
137 NEWCFG.i.ITEM=FRAMES; NEWCFG.i.VALUE=bguiget(obj.gframes,GA_Selected); i=i+1
138 NEWCFG.i.ITEM=NOMINALFRAME; NEWCFG.i.VALUE=bguiget(obj.gnframe,GA_Selected); i=i+1
139 NEWCFG.i.ITEM=JAVASCRIPT; NEWCFG.i.VALUE=bguiget(obj.gjs,GA_Selected); i=i+1
140 NEWCFG.i.ITEM=ANONYMOUS; NEWCFG.i.VALUE=bguiget(obj.ganon,GA_Selected); i=i+1
141 NEWCFG.i.ITEM=IGNOREMIME; NEWCFG.i.VALUE=bguiget(obj.gmime,GA_Selected); i=i+1
143 NEWCFG.i.ITEM=SPOOFAS
144 n=bguiget(obj.gspoof,MX_Active)
145 if n=0 then NEWCFG.i.VALUE=''; else NEWCFG.i.VALUE=snames.n
146 i=i+1
148 NEWCFG.0=i-1
149 'SetCFG STEM NEWCFG'
150 'GetCFG HTMLMODE' /* wait */
151 call bguiwinready(winobj)
152 return 1