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

Frontier Kernel
Frontier/Common/source/cancoonwindow.c

Version: ~ [ 10.0 ] ~

** Warning: Cannot open xref database.

1 2 /* $Id: cancoonwindow.c,v 1.4 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 "memory.h" 32 #include "bitmaps.h" 33 #include "cursor.h" 34 #include "file.h" 35 #include "font.h" 36 #include "icon.h" 37 #include "kb.h" 38 #include "mouse.h" 39 #include "ops.h" 40 #include "popup.h" 41 #include "quickdraw.h" 42 #include "search.h" 43 #include "smallicon.h" 44 #include "sounds.h" 45 #include "strings.h" 46 #include "textedit.h" 47 #include "frontierwindows.h" 48 #include "windowlayout.h" 49 #include "zoom.h" 50 #include "shell.h" 51 #include "shellprivate.h" 52 #include "shellbuttons.h" 53 #include "cancoon.h" 54 #include "cancooninternal.h" 55 #include "tableformats.h" 56 #include "tablestructure.h" 57 #include "tableverbs.h" 58 #include "command.h" 59 60 /* 61 implements the "home" window in CanCoon -- the topmost window, the one with a flag to 62 lift the hood, and buttons that zoom you to neat places. 63 */ 64 65 66 67 static boolean ccrun (short idscript) { 68 69 bigstring bsscript; 70 bigstring bsresult; 71 72 if (!getsystemtablescript (idscript, bsscript)) { 73 74 sysbeep (); 75 76 return (false); 77 } 78 79 return (langrunstringnoerror (bsscript, bsresult)); 80 } /*ccrun*/ 81 82 83 boolean cchelpcommand (void) { 84 85 return (ccrun (idtechsupportscript)); 86 } /*cchelpcommand*/ 87 88 89 boolean ccflipflag (void) { 90 91 return (false); 92 } /*ccflipflag*/ 93 94 /* 95 ccwindowsetglobals is the site of a crashing bug. 96 97 http://linux2.userland.com/users/admin/static/drWatsonLogs/SUPERHONKER/24593835.txt 98 http://linux2.userland.com/users/admin/static/drWatsonLogs/SUPERHONKER/24629842.txt 99 http://linux2.userland.com/users/admin/static/drWatsonLogs/SUPERHONKER/24817036.txt 100 101 function: ccwindowstart (actually: ccwindowsetglobals) 102 00405d00 7459 jz ccwindowstart+0x1e9 (00405d5b) 103 104 00405d02 8b4dfc mov ecx,[ebp-0x4] ss:011785be=???????? 105 00405d05 8b11 mov edx,[ecx] ds:022df948=022df950 106 00405d07 83baf600000000 cmp dword ptr [edx+0xf6],0x0 ds:95e000f6=00f6ba83 107 00405d0e 744b jz ccwindowstart+0x1e9 (00405d5b) 108 109 00405d10 8b45fc mov eax,[ebp-0x4] ss:011785be=???????? 110 00405d13 8b08 mov ecx,[eax] ds:95e00000=???????? 111 00405d15 8b91f6000000 mov edx,[ecx+0xf6] ds:022dfa3e=95e00000 112 00405d1b 891524405300 mov [cancoondata (00534024)],edx ds:00534024=95e00000 113 114 00405d21 a124405300 mov eax,[cancoondata (00534024)] ds:00534024=95e00000 115 FAULT ->00405d26 8b08 mov ecx,[eax] ds:95e00000=518b088b 116 00405d28 8b5104 mov edx,[ecx+0x4] ds:0332e34e=???????? 117 00405d2b 8b02 mov eax,[edx] ds:95e00000=???????? 118 00405d2d 8b0d9c595300 ds:0053599c=022df8e0 119 mov ecx,[tableformatsdata (0053599c)] 120 00405d33 3b4842 cmp ecx,[eax+0x42] ds:96e4ea06=7542483b 121 00405d36 7509 jnz ccwindowstart+0x1cf (00405d41) 122 123 00405d38 c745f800000000 mov dword ptr [ebp-0x8],0x0 ss:011785be=???????? 124 00405d3f eb1a jmp ccwindowstart+0x1e9 (00405d5b) 125 126 00405d41 6a52 push 0x52 127 00405d43 68ac735200 push 0x5273ac 128 00405d48 68dc735200 push 0x5273dc 129 00405d4d e82ecfffff call __assert (00402c80) 130 131 132 The crash occurs when we dereference (*cancoondata) in the assert. 133 134 135 Theory 1: cancoondata was disposed somewhere but not set to nil. 136 137 Theory 2: cancoondata was set to an uninitialized value. 138 139 140 Note: cancoondata = (**tableformatsdata).refcon 141 142 (**shellwindowinfo).hdata == tableformatsdata (?) 143 144 cancooncallbacks.dataholder = &tableformatsdata 145 146 tablecallbacks.dataholder = &tableformatsdata 147 148 See tablepushformats, tablepopformats in tableformats.c: 149 only used in tablepacktable in tablepack.c [not a likely candiate] 150 151 See tablenewformatsrecord in tableformats.c 152 --> tableverbsetupdisplay in tableexternal.c 153 --> ccwindowsetuptableview in cancoonwindow.c [cancoondata is linked to (**hf).refcon] 154 --> tableedit in tableexternal.c [site of cmd-enter-period crash on Mac!!!] 155 */ 156 157 static boolean ccwindowsetglobals (void) { 158 159 register hdltableformats hf = tableformatsdata; 160 161 if (hf && (**hf).refcon) { // cancoon record has been linked 162 163 cancoondata = (hdlcancoonrecord) (**hf).refcon; 164 165 assert (tableformatsdata == (**(**cancoondata).hroottable).hashtableformats); 166 } 167 168 tableformatswindow = cancoonwindow; 169 170 tableformatswindowinfo = cancoonwindowinfo; 171 172 return (tableverbsetglobals ()); 173 174 } /*ccwindowsetglobals*/ 175 176 177 void ccwindowsetup (boolean flbigwindow, boolean floldversion) { 178 179 /* 180 called when cc is booting, the window hasn't shown up on the screen yet, 181 we get a chance to change the size of the window. we don't remember whether 182 the flag was up or down, the window always comes up with the flag up. 183 184 1/21/91 dmb: routine now works for new files. someone didn't do enough 185 testing... 186 187 9/10/91 dmb: don't reset the height of the window; we save the state of 188 flbigwindow now. 189 190 12/20/91 dmb: to support new files, we set the bottom again, but now take 191 flbigwindow parameter 192 */ 193 194 (**cancoondata).fldirty = floldversion; 195 } /*ccwindowsetup*/ 196 197 198 boolean cctoggleflag (void) { 199 200 register hdlcancoonrecord hc = cancoondata; 201 202 (**hc).flflagdisabled = !(**hc).flflagdisabled; 203 204 windowinval (cancoonwindow); 205 206 return (true); 207 } /*cctoggleflag*/ 208 209 210 boolean cctoggleagentspopup (void) { 211 212 register hdlcancoonrecord hc = cancoondata; 213 214 (**hc).flpopupdisabled = !(**hc).flpopupdisabled; 215 216 windowinval (cancoonwindow); 217 218 return (true); 219 } /*cctoggleagentspopup*/ 220 221 222 static boolean ccwindowpreclose (WindowPtr w) { 223 224 /* 225 5.0a23 dmb: if we're a conditions are right, just hide the root window 226 227 6.2b16 AR: No longer treat guest roots any different from the main root 228 */ 229 230 if (!keyboardstatus.flshiftkey // shift disables root hiding 231 && (w == cancoonwindow) // a root window 232 && !flshellclosingall // not quitting 233 /*&& !(**cancoondata).flguestroot*/) { // not a guest root 234 235 assert (w == shellwindow); 236 237 opcloseoutline (); //prepare for dormancy, not in a window anymore 238 239 shellhidewindow (shellwindowinfo); 240 241 return (false); 242 } 243 244 return (ccpreclose (w)); 245 } /*ccpreclose*/ 246 247 248 static boolean ccwindowclose (void) { 249 250 /* 251 5.0d16 dmb: if we're a beginner and Frontier isn't quitting, 252 just hide the window 253 */ 254 255 if (!tableverbclose ()) 256 return (false); 257 258 return (ccclose ()); 259 } /*ccwindowclose*/ 260 261 262 static boolean ccwindowsetuptableview (void) { 263 264 /* 265 in order to function correctly as a table window, the window info record 266 must be linked to a tableformats record, not a cancoon record. we're called 267 after initially loading a cancoon record. we set up the table formats and 268 make the cancoon record hang off of it (as well as vice-versa), so the 269 tableformatsrecord can be the master, windowinfo-wise 270 271 5.0a5 dmb: move and reize the window according to the tableformats windowrect 272 (the Mac version was relying on the shell's window resource, which we should 273 omit now, since it's not xplat. must save and restore colwidths, since the 274 window will be resized semi-randomly before the correct size. 275 276 5.0a20: finishing touches (?) of guest databases, make them children of the host 277 */ 278 279 register hdlcancoonrecord hc = cancoondata; 280 hdlhashtable ht; 281 hdltableformats hf; 282 short colwidths [maxtablecols]; 283 284 ht = (**hc).hroottable; 285 286 hf = (**ht).hashtableformats; 287 288 if (hf == nil) 289 colwidths [0] = 0; 290 else 291 moveleft ((**hf).colwidths, colwidths, maxtablecols * sizeof (short)); 292 293 tableverbsetupdisplay (ht, cancoonwindowinfo); 294 295 if (hf == nil) // just created 296 hf = (**ht).hashtableformats; 297 else 298 moveleft (colwidths, (**hf).colwidths, maxtablecols * sizeof (short)); 299 300 (**hf).refcon = (long) hc; /*link cancoonglobals to tableformats*/ 301 302 /* 303 (**cancoonwindowinfo).hdata = (Handle) hf; //link tableformats to windowinfo 304 305 shellsetglobals (cancoonwindow); 306 307 tableresetformatsrects (); 308 */ 309 310 (**outlinedata).flwindowopen = true; 311 312 (**ht).flwindowopen = true; 313 314 shellmoveandsizewindow (cancoonwindowinfo, (**hf).windowrect); 315 316 if ((**hc).fldirty) 317 shellzoomwindow (cancoonwindowinfo, true); 318 319 if ((**hc).flguestroot) { 320 321 /* 322 hdlwindowinfo hroot; 323 324 if (!ccfindrootwindow (&hroot)) 325 return (false); 326 327 (**cancoonwindowinfo).parentwindow = hroot; 328 */ 329 330 langexternalregisterwindow ((hdlexternalvariable) (**hc).hrootvariable); 331 } 332 333 return (true); 334 } /*ccwindowsetuptableview*/ 335 336 337 static boolean ccwindowloadfile (hdlfilenum fnum, short rnum) { 338 339 if (!ccloadfile (fnum, rnum)) 340 return (false); 341 342 return (ccwindowsetuptableview ()); 343 } /*ccwindowloadfile*/ 344 345 346 static boolean ccwindownewrecord (void) { 347 348 if (!ccnewrecord ()) 349 return (false); 350 351 return (ccwindowsetuptableview ()); 352 } /*ccwindownewrecord*/ 353 354 355 static boolean ccwindowdisposerecord (void) { 356 357 /* 358 5.1.5 dmb: call new purgefrommenubarlist to get rid of any installed menus 359 */ 360 register hdlcancoonrecord hc = cancoondata; 361 362 if (hc == NULL) 363 return (true); 364 365 if ((**hc).flguestroot) { 366 367 langexternalunregisterwindow (cancoonwindowinfo); 368 369 purgefrommenubarlist ((long) (**hc).hdatabase); 370 } 371 372 ccdisposerecord (); 373 374 //shellexitmaineventloop (); 375 376 return (true); 377 } /*ccwindowdisposerecord*/ 378 379 380 static boolean findrootvisit (WindowPtr w, ptrvoid refcon) { 381 382 hdlwindowinfo hinfo; 383 384 if (getwindowinfo (w, &hinfo)) { 385 386 hdltableformats hf = (hdltableformats) (**hinfo).hdata; 387 388 if (hf && ((**hf).refcon == (long) cancoonglobals)) { // got it 389 390 WindowPtr *pw = (WindowPtr *) refcon; 391 392 *pw = w; 393 394 return (false); 395 } 396 } 397 398 return (true); // keep visiting 399 } /*findrootvisit*/ 400 401 402 boolean ccfindrootwindow (hdlwindowinfo *hinfo) { 403 404 WindowPtr w; 405 406 if (hinfo == nil) // a convenience for our callers, handle nil for don't care 407 return (true); 408 409 *hinfo = nil; 410 411 if (shellvisittypedwindows (idcancoonconfig, findrootvisit, &w)) 412 return (false); 413 414 return (getwindowinfo (w, hinfo)); 415 } /*ccfindrootwindow*/ 416 417 418 hdldatabaserecord ccwindowgetdatabase (WindowPtr w) { 419 420 /* 421 5.1.5b15 dmb: a useful piece of abstraction, used for updating in tableexternal.c 422 */ 423 424 hdlwindowinfo hinfo; 425 hdltableformats hf; 426 427 if (getwindowinfo (w, &hinfo)) { 428 429 hf = (hdltableformats) (**hinfo).hdata; 430 431 if (hf != nil) 432 return (tablegetdatabase ((**hf).htable)); 433 } 434 435 return (nil); 436 } /*ccwindowgetdatabase*/ 437 438 439 boolean ccwindowstart (void) { 440 441 /* 442 set up callback routines record, and link our data into the shell's 443 data structure. 444 */ 445 446 ptrcallbacks cancooncallbacks; 447 register ptrcallbacks cb; 448 short ixtableconfig; 449 450 ccinitverbs (); 451 452 /* 453 langcallbacks.msgverbcallback = (callback) &ccmsg; 454 */ 455 456 langcallbacks.codereplacedcallback = &cccodereplaced; 457 458 shellnewcallbacks (&cancooncallbacks); 459 460 cb = cancooncallbacks; /*copy into register*/ 461 462 if (!shellfindcallbacks (idtableconfig, &ixtableconfig)) 463 shellerrormessage ("\x24" "must initialize table before cancoon"); 464 465 *cb = globalsarray [ixtableconfig]; // start with table callbacks 466 467 loadconfigresource (idcancoonconfig, &(*cb).config); 468 469 (*cb).configresnum = idcancoonconfig; 470 471 (*cb).windowholder = &cancoonwindow; 472 473 (*cb).dataholder = (Handle *) &tableformatsdata; 474 475 (*cb).infoholder = &cancoonwindowinfo; 476 477 (*cb).loadroutine = &ccwindowloadfile; 478 479 (*cb).loadspecialroutine = &ccloadspecialfile; 480 481 (*cb).saveroutine = &ccsavefile; 482 483 (*cb).newrecordroutine = &ccwindownewrecord; 484 485 (*cb).disposerecordroutine = &ccwindowdisposerecord; 486 487 (*cb).setdatabaseroutine = &ccsetdatabase; 488 489 (*cb).getdatabaseroutine = &ccgetdatabase; 490 491 (*cb).setsuperglobalsroutine = &ccsetsuperglobals; 492 493 (*cb).backgroundroutine = &ccbackground; 494 495 (*cb).fnumchangedroutine = &ccfnumchanged; 496 497 (*cb).findusedblocksroutine = &ccfindusedblocks; 498 499 (*cb).precloseroutine = &ccwindowpreclose; 500 501 (*cb).closeroutine = &ccwindowclose; 502 503 (*cb).childcloseroutine = &ccchildclose; 504 505 (*cb).setglobalsroutine = &ccwindowsetglobals; 506 507 (*cb).pushroutine = &oppushglobals; 508 509 (*cb).poproutine = &oppopglobals; 510 511 /* 512 (*cb).getvariableroutine = &tablegetvariableroutine; 513 514 (*cb).updateroutine = &tableverbupdate; 515 516 (*cb).activateroutine = &tableverbactivate; 517 518 (*cb).getcontentsizeroutine = &tableverbgetcontentsize; 519 520 (*cb).resetrectsroutine = &tableverbresetrects; 521 522 (*cb).resizeroutine = &tableverbresize; 523 524 (*cb).scrollroutine = &opscroll; 525 526 (*cb).setscrollbarroutine = &opresetscrollbars; 527 528 (*cb).mouseroutine = &tableverbmousedown; 529 530 (*cb).keystrokeroutine = &tableverbkeystroke; 531 532 (*cb).titleclickroutine = &tableverbtitleclick; 533 534 (*cb).cutroutine = &opcut; 535 536 (*cb).copyroutine = &opcopy; 537 538 (*cb).pasteroutine = &tableverbpaste; 539 540 (*cb).clearroutine = &opclear; 541 542 (*cb).selectallroutine = &opselectall; 543 544 (*cb).getundoglobalsroutine = &tableeditgetundoglobals; 545 546 (*cb).setundoglobalsroutine = &tableeditsetundoglobals; 547 548 (*cb).idleroutine = &tableverbidle; 549 550 (*cb).adjustcursorroutine = &tableverbadjustcursor; 551 552 (*cb).gettargetdataroutine = &tableverbgettargetdata; 553 554 (*cb).settextmoderoutine = &opsettextmode; 555 556 (*cb).fontroutine = &tableverbsetfont; 557 558 (*cb).sizeroutine = &tableverbsetsize; 559 560 (*cb).setselectioninforoutine = &tablesetselectioninfo; 561 562 (*cb).searchroutine = &tableverbsearch; 563 564 (*cb).executeroutine = &tableverbruncursor; 565 566 (*cb).setprintinfoproutine = &opsetprintinfo; 567 568 (*cb).printroutine = &opprint; 569 */ 570 571 return (true); 572 } /*ccwindowstart*/ 573 574 575

~ [ 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.