Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch spjuth-gridscroll Excluding Merge-Ins
This is equivalent to a diff from 2a868d77ab to 3798a95cb6
2015-03-02
| ||
08:56 | Deleted Win95/98-specific documentation as those platforms have long been unsupported. check-in: e4a9133b19 user: ashok tags: trunk | |
2015-03-01
| ||
13:57 | Merge from trunk Leaf check-in: 9e988ea8e5 user: pspjuth tags: spjuth-cleanpack | |
13:45 | Merge from trunk Leaf check-in: 3798a95cb6 user: pspjuth tags: spjuth-gridscroll | |
13:43 | Merge from trunk Leaf check-in: 9065bb83fd user: pspjuth tags: spjuth-gridpeer | |
2015-02-28
| ||
03:17 | merge mark check-in: 2a868d77ab user: kevin_walzer tags: trunk | |
02:59 | Fix for 5824a992df, images not displaying in Cocoa in label with sunken relief check-in: c4051e7ad3 user: kevin_walzer tags: core-8-5-branch | |
02:59 | Fix for 5824a992df, images not displaying in Cocoa in label with sunken relief check-in: 2f9e63f890 user: kevin_walzer tags: trunk | |
2011-04-06
| ||
23:33 | Merge from trunk check-in: 8fa6d9debe user: pspjuth tags: spjuth-gridscroll (unpublished) | |
Changes to generic/tkGrid.c.
︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | + + + + + + + + + | * row constraints. */ int startX; /* Pixel offset of this layout within its * master. */ int startY; /* Pixel offset of this layout within its * master. */ Tk_Anchor anchor; /* Value of anchor option: specifies where a * grid without weight should be placed. */ char *xScrollCmd; /* Command prefix for communicating with * horizontal scrollbar. NULL means no * horizontal scrollbar. Malloc'ed*/ char *yScrollCmd; /* Command prefix for communicating with * vertical scrollbar. NULL means no * vertical scrollbar. Malloc'ed*/ int xOrigin, yOrigin; int xUsed, yUsed; Tcl_Interp *interp; } GridMaster; /* * For each window that the grid cares about (either because the window is * managed by the grid or because the window has slaves that are managed by * the grid), there is a structure of the following type: */ |
︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | + + + | static void ArrangeGrid(ClientData clientData); static int CheckSlotData(Gridder *masterPtr, int slot, int slotType, int checkOnly); static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyGrid(void *memPtr); static Gridder * GetGrid(Tk_Window tkwin); static int GridXYScrollcommandCommand(Tk_Window tkwin, Tcl_Interp *interp, int y, int objc, Tcl_Obj *CONST objv[]); static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int GridForgetRemoveCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); |
︙ | |||
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); static void InitMasterData(Gridder *masterPtr); static Tcl_Obj * NewPairObj(int, int); static Tcl_Obj * NewQuadObj(int, int, int, int); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static Tcl_Obj * ScrollFractions(int screen1, int screen2, int object1, int object2); static void SetGridSize(Gridder *gridPtr); static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, int column, int numCols); static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, int row, int numRows); static Tcl_Obj * StickyToObj(int flags); static int StringToSticky(const char *string); static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { "grid", /* name */ GridReqProc, /* requestProc */ GridLostSlaveProc, /* lostSlaveProc */ }; static CONST char ** TkGetStringsFromObjs(argc, objv) int argc; Tcl_Obj *CONST objv[]; { register int i; CONST char **argv; if (argc <= 0) { return NULL; } argv = (CONST char **) ckalloc((argc+1) * sizeof(char *)); for (i = 0; i < argc; i++) { argv[i]=Tcl_GetStringFromObj(objv[i], (int *) NULL); } argv[argc] = 0; return argv; } static void GridSetOrigin(masterPtr, xOrigin, yOrigin) Gridder *masterPtr; /* Information about master. */ int xOrigin; /* New X origin. */ int yOrigin; /* New Y origin. */ { GridMaster *gridPtr = masterPtr->masterDataPtr; if ((xOrigin == gridPtr->xOrigin) && (yOrigin == gridPtr->yOrigin)) { return; } gridPtr->xOrigin = xOrigin; gridPtr->yOrigin = yOrigin; if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); } } /* *---------------------------------------------------------------------- * * Tk_GridCmd -- * * This procedure is invoked to process the "grid" Tcl command. See the |
︙ | |||
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = clientData; static const char *const optionStrings[] = { "xscrollcommand", "yscrollcommand", "xview", "yview", "anchor", "bbox", "columnconfigure", "configure", "forget", "info", "location", "propagate", "remove", "rowconfigure", "size", "slaves", NULL }; enum options { GRID_XSCROLLCOMMAND, GRID_YSCROLLCOMMAND, GRID_XVIEW, GRID_YVIEW, GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES }; int index; if (objc >= 2) { const char *argv1 = Tcl_GetString(objv[1]); |
︙ | |||
402 403 404 405 406 407 408 409 410 411 412 413 414 415 | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } /* This should not happen */ Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", -1)); Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * ScrollFractions -- * * Given the range that's visible in the window and the "100% * range" for what's in the canvas, return a list of two * doubles representing the scroll fractions. This procedure * is used for both x and y scrolling. * * Results: * The memory pointed to by string is modified to hold * two real numbers containing the scroll fractions (between * 0 and 1) corresponding to the other arguments. * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * ScrollFractions( int screen1, /* Lowest coordinate visible in the window. */ int screen2, /* Highest coordinate visible in the window. */ int object1, /* Lowest coordinate in the object. */ int object2) /* Highest coordinate in the object. */ { double range, f1, f2; char buffer[2*TCL_DOUBLE_SPACE+2]; range = object2 - object1; if (range <= 0) { f1 = 0; f2 = 1.0; } else { f1 = (screen1 - object1)/range; if (f1 < 0) { f1 = 0.0; } f2 = (screen2 - object1)/range; if (f2 > 1.0) { f2 = 1.0; } if (f2 < f1) { f2 = f1; } } sprintf(buffer, "%g %g", f1, f2); return Tcl_NewStringObj(buffer, -1); } static void GridUpdateScrollbars(masterPtr) Gridder *masterPtr; /* Information about grid. */ { int result; int xOrigin, yOrigin, xUsed, yUsed, viewX, viewY; char *xScrollCmd, *yScrollCmd; GridMaster *gridPtr = masterPtr->masterDataPtr; Tcl_Interp *interp = gridPtr->interp; /* * Save all the relevant values from the canvasPtr, because it might be * deleted as part of either of the two calls to Tcl_VarEval below. */ Tcl_Preserve((ClientData) interp); xScrollCmd = gridPtr->xScrollCmd; if (xScrollCmd != (char *) NULL) { Tcl_Preserve((ClientData) xScrollCmd); } yScrollCmd = gridPtr->yScrollCmd; if (yScrollCmd != (char *) NULL) { Tcl_Preserve((ClientData) yScrollCmd); } xOrigin = gridPtr->xOrigin; yOrigin = gridPtr->yOrigin; xUsed = gridPtr->xUsed; yUsed = gridPtr->yUsed; viewX = Tk_Width(masterPtr->tkwin) - Tk_InternalBorderLeft(masterPtr->tkwin) - Tk_InternalBorderRight(masterPtr->tkwin); viewY = Tk_Height(masterPtr->tkwin) - Tk_InternalBorderTop(masterPtr->tkwin) - Tk_InternalBorderBottom(masterPtr->tkwin); if (xScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions( gridPtr->xOrigin, gridPtr->xOrigin + viewX, 0, gridPtr->xUsed); result = Tcl_VarEval(interp, xScrollCmd, " ", Tcl_GetString(fractions), (char *) NULL); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { Tcl_BackgroundError(interp); } Tcl_ResetResult(interp); Tcl_Release((ClientData) xScrollCmd); } if (yScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions( gridPtr->yOrigin, gridPtr->yOrigin + viewY, 0, gridPtr->yUsed); result = Tcl_VarEval(interp, yScrollCmd, " ", Tcl_GetString(fractions), (char *) NULL); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { Tcl_BackgroundError(interp); } Tcl_ResetResult(interp); Tcl_Release((ClientData) yScrollCmd); } Tcl_Release((ClientData) interp); } static int GridXYScrollcommandCommand(tkwin, interp, y, objc, objv) Tk_Window tkwin; /* Main window of the application. */ Tcl_Interp *interp; /* Current interpreter. */ int y; /* True if y, false if x. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; GridMaster *gridPtr; int length; char *value, **cmdPtr; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?command?"); return TCL_ERROR; } if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { return TCL_ERROR; } masterPtr = GetGrid(master); if (objc == 3) { gridPtr = masterPtr->masterDataPtr; cmdPtr = y ? &gridPtr->yScrollCmd : &gridPtr->xScrollCmd; Tcl_SetResult(interp, *cmdPtr == NULL ? "" : *cmdPtr, TCL_VOLATILE); return TCL_OK; } InitMasterData(masterPtr); gridPtr = masterPtr->masterDataPtr; gridPtr->interp = interp; cmdPtr = y ? &gridPtr->yScrollCmd : &gridPtr->xScrollCmd; if (*cmdPtr != NULL) { ckfree(*cmdPtr); } value = Tcl_GetStringFromObj(objv[3], &length); if (length == 0) { *cmdPtr = NULL; } else { *cmdPtr = ckalloc((unsigned) (length + 1)); strcpy(*cmdPtr, value); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GridAnchorCommand -- * * Implementation of the [grid anchor] subcommand. See the user |
︙ | |||
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 | + + + + + + + + + + + + + + + + + + + + | Tk_InternalBorderBottom(masterPtr->tkwin); usedX = AdjustOffsets(realWidth, MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr); usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax), slotPtr->rowPtr); TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin, 0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY); /* Scrolling */ if ((slotPtr->xScrollCmd != NULL) || (slotPtr->yScrollCmd != NULL)) { if (usedX > realWidth) { slotPtr->startX = -slotPtr->xOrigin; slotPtr->xUsed = usedX; } else { slotPtr->xOrigin = 0; slotPtr->xUsed = realWidth; } if (usedY > realHeight) { slotPtr->startY = -slotPtr->yOrigin; slotPtr->yUsed = usedY; } else { slotPtr->yOrigin = 0; slotPtr->yUsed = realHeight; } GridUpdateScrollbars(masterPtr); } /* * Now adjust the actual size of the slave to its cavity by computing the * cavity size, and adjusting the widget according to its stickyness. */ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; |
︙ | |||
2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 | 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | + + + + + + + | gridPtr->rowEnd = 0; gridPtr->rowMax = 0; gridPtr->rowPtr = ckalloc(size); gridPtr->rowSpace = TYPICAL_SIZE; gridPtr->startX = 0; gridPtr->startY = 0; gridPtr->anchor = GRID_DEFAULT_ANCHOR; gridPtr->xScrollCmd = NULL; gridPtr->yScrollCmd = NULL; gridPtr->xOrigin = 0; gridPtr->yOrigin = 0; gridPtr->xUsed = 0; gridPtr->yUsed = 0; gridPtr->interp = NULL; memset(gridPtr->columnPtr, 0, size); memset(gridPtr->rowPtr, 0, size); } } /* |
︙ |
Added gs.tcl.
|