~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Frontier Kernel
Frontier/Common/source/cancoonverbs.c

Version: ~ [ 10.0 ] ~

** Warning: Cannot open xref database.

1 2 /* $Id: cancoonverbs.c,v 1.3 2005/01/11 22:48:04 andreradke Exp $ */ 3 4 /****************************************************************************** 5 6 UserLand Frontier(tm) -- High performance Web content management, 7 object database, system-level and Internet scripting environment, 8 including source code editing and debugging. 9 10 Copyright (C) 1992-2004 UserLand Software, Inc. 11 12 This program is free software; you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation; either version 2 of the License, or 15 (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 26 ******************************************************************************/ 27 28 #include "frontier.h" 29 #include "standard.h" 30 31 #include "resources.h" 32 #include "lang.h" 33 #include "langexternal.h" 34 #include "tablestructure.h" 35 #include "cancoon.h" 36 #include "cancooninternal.h" 37 #include "kernelverbdefs.h" 38 #include "about.h" 39 40 41 42 43 #define cancoonerrorlist 268 44 #define notimplementederror 3 45 46 47 typedef enum tycancoontoken { 48 49 showflagfunc, 50 51 hideflagfunc, 52 53 showpopupfunc, 54 55 hidepopupfunc, 56 57 showbuttonsfunc, 58 59 hidebuttonsfunc, 60 61 showserverstatsfunc, 62 63 /* 64 setmsgfunc, 65 */ 66 67 ctcancoonverbs 68 } tycancoontoken; 69 70 71 72 static boolean ccshowhideverb (hdltreenode hparam1, boolean flshow, boolean flshowing, callback toggleroutine, tyvaluerecord *vreturned) { 73 74 /* 75 set vreturned to false if the state of the flag is not changed. otherwise, 76 call the toggle routine and return true. 77 78 1/30/92 dmb: fixed typo; when toggling, set vreturned to true, not false! 79 80 5.6.97 dmb: can no longer assume that the "root" window is cancoon. globals 81 are now set in ccfunctionvalue 82 */ 83 84 if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/ 85 return (false); 86 87 if (flshowing != flshow) { /*changing*/ 88 89 // shellpushfrontrootglobals (); 90 91 (*toggleroutine) (); 92 93 // shellpopglobals (); 94 95 (*vreturned).data.flvalue = true; 96 } 97 98 return (true); 99 } /*ccshowhideverb*/ 100 101 102 static boolean ccshowflagverb (hdltreenode hparam1, boolean flshow, tyvaluerecord *vreturned) { 103 104 /* 105 set vreturned to false if the state of the flag is not changed. 106 */ 107 108 return (ccshowhideverb (hparam1, flshow, !(**cancoonglobals).flflagdisabled, (callback) &cctoggleflag, vreturned)); 109 } /*ccshowflagverb*/ 110 111 112 static boolean ccshowpopupverb (hdltreenode hparam1, boolean flshow, tyvaluerecord *vreturned) { 113 114 /* 115 set vreturned to false if the state of the popup is not changed. 116 */ 117 118 return (ccshowhideverb (hparam1, flshow, !(**cancoonglobals).flpopupdisabled, (callback) &cctoggleagentspopup, vreturned)); 119 } /*ccshowpopupverb*/ 120 121 122 static boolean ccshowbuttonsverb (hdltreenode hparam1, boolean flshow, tyvaluerecord *vreturned) { 123 124 /* 125 set vreturned to false if the state of the buttons is not changed. 126 */ 127 128 return (ccshowhideverb (hparam1, flshow, (**cancoonglobals).flbigwindow, (callback) &ccflipflag, vreturned)); 129 } /*ccshowbuttonsverb*/ 130 131 132 static boolean ccmsgverb (hdltreenode hparam1, tyvaluerecord *vreturned) { 133 134 bigstring bsmsg; 135 136 flnextparamislast = true; 137 138 if (!getstringvalue (hparam1, 1, bsmsg)) 139 return (false); 140 141 if (shellwindow != nil) 142 shellpushrootglobals (shellwindow); 143 else 144 shellpushfrontrootglobals (); 145 146 ccmsg (bsmsg, !processisoneshot (true)); 147 148 shellpopglobals (); 149 150 return (setbooleanvalue (true, vreturned)); 151 } /*ccmsgverb*/ 152 153 154 static boolean ccfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) { 155 156 /* 157 8/23/91 dmb: don't push front globals around entire switch, since that 158 would disable background processes while the parameter to "msg" is 159 evaluated. 160 161 8/25/92 dmb: commented-out setmsgfunc -- redundant & undocumented 162 */ 163 164 register tyvaluerecord *v = vreturned; 165 register boolean fl = false; 166 register short errornum = 0; 167 168 setbooleanvalue (false, v); /*by default, cancoon functions return false*/ 169 170 #ifdef version42orgreater 171 // can no longer assume that the "root" window is cancoon 172 if (!shellfindwindow (idcancoonconfig, &cancoonwindow, &cancoonwindowinfo, (Handle *) &cancoondata)) 173 return (true); 174 175 shellpushglobals (cancoonwindow); 176 #endif 177 178 switch (token) { 179 180 case showflagfunc: 181 fl = ccshowflagverb (hparam1, true, v); 182 183 break; 184 185 case hideflagfunc: 186 fl = ccshowflagverb (hparam1, false, v); 187 188 break; 189 190 case showpopupfunc: 191 fl = ccshowpopupverb (hparam1, true, v); 192 193 break; 194 195 case hidepopupfunc: 196 fl = ccshowpopupverb (hparam1, false, v); 197 198 break; 199 200 case showbuttonsfunc: 201 fl = ccshowbuttonsverb (hparam1, true, v); 202 203 break; 204 205 case hidebuttonsfunc: 206 fl = ccshowbuttonsverb (hparam1, false, v); 207 208 break; 209 210 case showserverstatsfunc: { 211 boolean flset; 212 213 flnextparamislast = true; 214 215 if (!getbooleanvalue (hparam1, 1, &flset)) 216 break; 217 218 aboutsetstatsflag (flset); 219 220 fl = setbooleanvalue (true, v); 221 } 222 223 break; 224 225 /* 226 case setmsgfunc: 227 fl = ccmsgverb (hparam1, v); 228 229 break; 230 */ 231 232 default: 233 fl = false; 234 235 errornum = notimplementederror; 236 237 break; 238 } /*switch*/ 239 240 #ifdef version42orgreater 241 shellpopglobals (); 242 #endif 243 244 if (fl) 245 return (true); 246 247 if (errornum != 0) /*get error string*/ 248 getstringlist (cancoonerrorlist, errornum, bserror); 249 250 return (false); 251 } /*ccfunctionvalue*/ 252 253 254 boolean ccinitverbs (void) { 255 256 langcallbacks.msgverbcallback = &ccmsgverb; 257 258 return (loadfunctionprocessor (idcancoonverbs, &ccfunctionvalue)); 259 } /*ccinitverbs*/ 260 261 262 263 264

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.