Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | add selected tk upstream changes |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c281f0811156a267329733fbb1d9e766 |
User & Date: | chw 2016-05-19 20:26:14.528 |
Context
2016-05-20
| ||
05:18 | add TWAPI upstream changes check-in: 79e6860b17 user: chw tags: trunk | |
2016-05-19
| ||
20:26 | add selected tk upstream changes check-in: c281f08111 user: chw tags: trunk | |
17:21 | fix wrong package version in registry package index file check-in: 3ec5bec938 user: chw tags: trunk | |
Changes
Changes to jni/sdl2tk/generic/ttk/ttkClamTheme.c.
1 2 3 4 5 6 7 8 9 | /* * Copyright (C) 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ #include <tk.h> #include "ttkTheme.h" | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * Copyright (C) 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ #include <tk.h> #include "ttkTheme.h" /* * Under windows, the Tk-provided XDrawLine and XDrawArc have an * off-by-one error in the end point. This is especially apparent with this * theme. Defining this macro as true handles this case. */ #if defined(_WIN32) && !defined(WIN32_XDRAWLINE_HACK) # define WIN32_XDRAWLINE_HACK 1 #else # define WIN32_XDRAWLINE_HACK 0 |
︙ | ︙ | |||
130 131 132 133 134 135 136 | Tk_Offset(BorderElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; /* * <<NOTE-BORDERWIDTH>>: -borderwidth is only partially supported: * in this theme, borders are always exactly 2 pixels thick. | | | < | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | Tk_Offset(BorderElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; /* * <<NOTE-BORDERWIDTH>>: -borderwidth is only partially supported: * in this theme, borders are always exactly 2 pixels thick. * With -borderwidth 0, border is not drawn at all; * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *border = (BorderElement*)elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 1) ++borderWidth; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, |
︙ | ︙ | |||
417 418 419 420 421 422 423 | Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,sizeObj), STR(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, Tk_Offset(MenuIndicatorElement,colorObj), "black" }, { "-arrowpadding",TK_OPTION_STRING, Tk_Offset(MenuIndicatorElement,paddingObj), "3" }, |
︙ | ︙ | |||
630 631 632 633 634 635 636 | static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ScrollbarElement *sb = elementRecord; int size = FALLBACK_SCROLLBAR_THICKNESS; | < | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ScrollbarElement *sb = elementRecord; int size = FALLBACK_SCROLLBAR_THICKNESS; Tcl_GetInt(NULL, SCROLLBAR_THICKNESS, &size); Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, |
︙ | ︙ | |||
659 660 661 662 663 664 665 | /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + b.width / 2 - gripCount; y1 = b.y + 2; y2 = b.y + b.height - 3 + w; } else { dx = 0; dy = 1; |
︙ | ︙ | |||
741 742 743 744 745 746 747 | } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; | | | | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
813 814 815 816 817 818 819 | ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. | | | | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. * * Note: Tabs, except for the rightmost, overlap the neighbor to * their right by one pixel. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; |
︙ | ︙ | |||
842 843 844 845 846 847 848 | }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; | < | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth; paddingPtr->bottom = 0; } static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) |
︙ | ︙ | |||
898 899 900 901 902 903 904 | }; static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; | < | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | }; static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void ClientElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkClassicTheme.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 | HighlightElementOptions, HighlightElementSize, HighlightElementDraw }; /*------------------------------------------------------------------------ * +++ Button Border element: | | | | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | HighlightElementOptions, HighlightElementSize, HighlightElementDraw }; /*------------------------------------------------------------------------ * +++ Button Border element: * * The Motif-style button border on X11 consists of (from outside-in): * * + focus indicator (controlled by -highlightcolor and -highlightthickness), * + default ring (if -default active; blank if -default normal) * + shaded border (controlled by -background, -borderwidth, and -relief) */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, 0, 0, NULL } }; static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
116 117 118 119 120 121 122 | borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: * padding for default ring is drawn in the wrong color * when the button is active.) */ static void ButtonBorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ButtonBorderElement *bd = elementRecord; |
︙ | ︙ | |||
282 283 284 285 286 287 288 | ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * | | | | | | | | 282 283 284 285 286 287 288 289 290 291 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 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. * * Interpretation of -sashrelief 'groove' and 'ridge' are * swapped wrt. the core panedwindow, which (I think) has them backwards. * * Default -sashrelief is sunken; the core panedwindow has default * -sashrelief raised, but that looks wrong to me. */ static Ttk_Orient SashClientData[] = { TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL }; typedef struct { Tcl_Obj *borderObj; /* background color */ Tcl_Obj *sashReliefObj; /* sash relief */ Tcl_Obj *sashThicknessObj; /* overall thickness of sash */ Tcl_Obj *sashPadObj; /* padding on either side of handle */ Tcl_Obj *handleSizeObj; /* handle width and height */ Tcl_Obj *handlePadObj; /* handle's distance from edge */ } SashElement; static Ttk_ElementOptionSpec SashOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND }, { "-sashrelief", TK_OPTION_RELIEF, Tk_Offset(SashElement,sashReliefObj), "sunken" }, #ifdef ANDROID { "-sashthickness", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashThicknessObj), "10" }, { "-sashpad", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashPadObj), "4" }, { "-handlesize", TK_OPTION_PIXELS, Tk_Offset(SashElement,handleSizeObj), "12" }, { "-handlepad", TK_OPTION_PIXELS, Tk_Offset(SashElement,handlePadObj), "12" }, #else { "-sashthickness", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashThicknessObj), "6" }, { "-sashpad", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashPadObj), "2" }, { "-handlesize", TK_OPTION_PIXELS, Tk_Offset(SashElement,handleSizeObj), "8" }, { "-handlepad", TK_OPTION_PIXELS, Tk_Offset(SashElement,handlePadObj), "8" }, #endif { NULL, 0, 0, NULL } |
︙ | ︙ | |||
379 380 381 382 383 384 385 | gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; | | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; case TK_RELIEF_SOLID: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_FLAT: default: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); break; } /* Draw sash line: */ |
︙ | ︙ | |||
410 411 412 413 414 415 416 | if (horizontal) { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W); hb.x += handlePad; } else { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | if (horizontal) { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W); hb.x += handlePad; } else { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } Tk_Fill3DRectangle(tkwin, d, border, hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED); } } static Ttk_ElementSpec SashElementSpec = { TK_STYLE_VERSION_2, sizeof(SashElement), |
︙ | ︙ | |||
507 508 509 510 511 512 513 | Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "hsash", &SashElementSpec, &SashClientData[0]); Ttk_RegisterElement(interp, theme, "vsash", &SashElementSpec, &SashClientData[1]); /* * Register layouts: */ |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkLabel.c.
︙ | ︙ | |||
135 136 137 138 139 140 141 | gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); /* * Place text according to -anchor: */ Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor); b = Ttk_AnchorBox(b, text->width, text->height, anchor); /* * Clip text if it's too wide: |
︙ | ︙ | |||
338 339 340 341 342 343 344 | /* Completely clipped - bail out. */ return; } Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); | | | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | /* Completely clipped - bail out. */ return; } Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); /* If we're disabled there's no state-specific 'disabled' image, * stipple the image. * @@@ Possibly: Don't do disabled-stippling at all; * @@@ it's ugly and out of fashion. * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) { #ifndef MAC_OSX_TK StippleOver(image, tkwin, d, b.x,b.y); #endif } } |
︙ | ︙ | |||
578 579 580 581 582 583 584 | *heightPtr = label->totalHeight; /* Requested width based on -width option, not actual text width: */ if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); | | | | | 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 | *heightPtr = label->totalHeight; /* Requested width based on -width option, not actual text width: */ if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); switch (label->compound) { case TTK_COMPOUND_TEXT: *widthPtr = textReqWidth; break; case TTK_COMPOUND_IMAGE: *widthPtr = label->image.width; break; case TTK_COMPOUND_TOP: case TTK_COMPOUND_BOTTOM: case TTK_COMPOUND_CENTER: *widthPtr = MAX(label->image.width, textReqWidth); break; case TTK_COMPOUND_LEFT: case TTK_COMPOUND_RIGHT: *widthPtr = label->image.width + textReqWidth + label->space; break; case TTK_COMPOUND_NONE: break; /* Can't happen */ } LabelCleanup(label); } |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkManager.c.
︙ | ︙ | |||
316 317 318 319 320 321 322 | { Ttk_Manager *mgr = clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | { Ttk_Manager *mgr = clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( mgr->managerData, slaveIndex, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkManager.h.
︙ | ︙ | |||
18 19 20 21 22 23 24 | * * PlaceSlaves sets the position and size of all managed slaves * by calling Ttk_PlaceSlave(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * * PlaceSlaves sets the position and size of all managed slaves * by calling Ttk_PlaceSlave(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. * * SlaveRequest() is called when a slave requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkProgress.c.
︙ | ︙ | |||
398 399 400 401 402 403 404 | /* $sb step ?amount? */ static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | /* $sb step ?amount? */ static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; if (objc == 3) { if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) { return TCL_ERROR; } } else if (objc != 2) { Tcl_WrongNumArgs(interp, 2,objv, "?stepAmount?"); |
︙ | ︙ | |||
425 426 427 428 429 430 431 | } newValueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(newValueObj); TtkRedisplayWidget(&pb->core); | | | | 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 | } newValueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(newValueObj); TtkRedisplayWidget(&pb->core); /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { int result = Tcl_ObjSetVar2( interp, pb->progress.variableObj, 0, newValueObj, TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG) ? TCL_OK : TCL_ERROR; Tcl_DecrRefCount(newValueObj); return result; } /* Otherwise, change the -value directly: */ Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValueObj; CheckAnimation(pb); return TCL_OK; } /* $sb start|stop ?args? -- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *cmd = Tcl_NewListObj(objc, objv); Tcl_Obj *prefix[2]; |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkScale.c.
︙ | ︙ | |||
46 47 48 49 50 51 52 | WidgetCore core; ScalePart scale; } Scale; static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", | | | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | WidgetCore core; ScalePart scale; } Scale; static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Scale,scale.commandObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", Tk_Offset(Scale,scale.variableObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), Tk_Offset(Scale,scale.orient), 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); static double PointToValue(Scale *scalePtr, int x, int y); /* ScaleVariableChanged -- * Variable trace procedure for scale -variable; * Updates the scale's value. * If the linked variable is not a valid double, * sets the 'invalid' state. */ static void ScaleVariableChanged(void *recordPtr, const char *value) { Scale *scale = recordPtr; double v; |
︙ | ︙ | |||
172 173 174 175 176 177 178 | return status; } /* ScaleGetLayout -- * getLayout hook. */ | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | return status; } /* ScaleGetLayout -- * getLayout hook. */ static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scale *scalePtr = recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } |
︙ | ︙ | |||
236 237 238 239 240 241 242 | fraction = (value - from) / (to - from); return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; } /* $scale get ?x y? -- | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | fraction = (value - from) / (to - from); return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; } /* $scale get ?x y? -- * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int ScaleGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Scale *scalePtr = recordPtr; |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkScrollbar.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | int orient; Tcl_Obj *orientObj; double first; /* top fraction */ double last; /* bottom fraction */ | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | int orient; Tcl_Obj *orientObj; double first; /* top fraction */ double last; /* bottom fraction */ Ttk_Box troughBox; /* trough parcel */ int minSize; /* minimum size of thumb */ } ScrollbarPart; typedef struct { WidgetCore core; ScrollbarPart scrollbar; |
︙ | ︙ | |||
46 47 48 49 50 51 52 | WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Widget hooks. */ | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Widget hooks. */ static void ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) { Scrollbar *sb = recordPtr; sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; TtkTrackElementState(&sb->core); |
︙ | ︙ | |||
237 238 239 240 241 242 243 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta)); return TCL_OK; } /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta)); return TCL_OK; } /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Scrollbar *sb = recordPtr; Ttk_Box b = sb->scrollbar.troughBox; |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkSquare.c.
︙ | ︙ | |||
52 53 54 55 56 57 58 | { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj), -1, 0, 0, 0}, | | | | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", "50", Tk_Offset(Square,square.widthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_PIXELS, "-height", "height", "Height", "50", Tk_Offset(Square,square.heightObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Square,square.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Almost all of the widget functionality is handled by the default Ttk * widget code and the contained element. The one thing that we must handle |
︙ | ︙ | |||
134 135 136 137 138 139 140 | { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { 0,0,0 } }; /* | | | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { 0,0,0 } }; /* * The Widget specification structure holds all the implementation * information about this widget and this is what must be registered * with Tk in the package initialization code (see bottom). */ static WidgetSpec SquareWidgetSpec = { "TSquare", /* className */ sizeof(Square), /* recordSize */ SquareOptionSpecs, /* optionSpecs */ SquareCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ SquareDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; /* ---------------------------------------------------------------------- * Square element * * In this section we demonstrate what is required to create a new themed * element. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *foregroundObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; } SquareElement; static Ttk_ElementOptionSpec SquareElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj), DEFAULT_BORDERWIDTH }, |
︙ | ︙ | |||
244 245 246 247 248 249 250 | * Layout section. * * Every widget class needs a layout style that specifies which elements * are part of the widget and how they should be placed. The element layout * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will | | | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | * Layout section. * * Every widget class needs a layout style that specifies which elements * are part of the widget and how they should be placed. The element layout * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will * also need some padding to keep it away from the edges. */ TTK_BEGIN_LAYOUT(SquareLayout) TTK_NODE("Square.background", TTK_FILL_BOTH) TTK_GROUP("Square.padding", TTK_FILL_BOTH, TTK_NODE("Square.square", 0)) TTK_END_LAYOUT /* ---------------------------------------------------------------------- * * Widget initialization. * * This file defines a new element and a new widget. We need to register * the element with the themes that will need it. In this case we will * register with the default theme that is the root of the theme inheritance * tree. This means all themes will find this element. * We then need to register the widget class style. This is the layout * specification. If a different theme requires an alternative layout, we * could register that here. For instance, in some themes the scrollbars have * one uparrow, in other themes there are two uparrow elements. * Finally we register the widget itself. This step creates a tcl command so |
︙ | ︙ | |||
283 284 285 286 287 288 289 | /* public */ MODULE_SCOPE int TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); | | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | /* public */ MODULE_SCOPE int TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); /* register the layout for this theme */ Ttk_RegisterLayout(theme, "TSquare", SquareLayout); /* register the widget */ RegisterWidget(interp, "ttk::square", &SquareWidgetSpec); return TCL_OK; } #endif /* TTK_SQUARE_WIDGET */ |
Changes to jni/sdl2tk/generic/ttk/ttkStubLib.c.
︙ | ︙ | |||
63 64 65 66 67 68 69 | error: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", | | | 63 64 65 66 67 68 69 70 71 72 73 74 | error: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", errMsg, NULL); return NULL; } |
Changes to jni/sdl2tk/generic/ttk/ttkTagSet.c.
︙ | ︙ | |||
184 185 186 187 188 189 190 | { int i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; } } | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | { int i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; } } tagset->tags = ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; } /* Ttk_TagSetRemove -- remove a tag from a tag set. * |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkTrace.c.
1 2 3 4 5 | /* * Copyright 2003, Joe English * * Simplified interface to Tcl_TraceVariable. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Copyright 2003, Joe English * * Simplified interface to Tcl_TraceVariable. * * PROBLEM: Can't distinguish "variable does not exist" (which is OK) * from other errors (which are not). */ #include <tk.h> #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ |
Changes to jni/sdl2tk/generic/ttk/ttkWidget.h.
︙ | ︙ | |||
107 108 109 110 111 112 113 | #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- | | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- * Add one or the other of these to each OptionSpecs table * to indicate whether the widget should take focus * during keyboard traversal. */ #define WIDGET_TAKEFOCUS_TRUE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ "ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 } #define WIDGET_TAKEFOCUS_FALSE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ |
︙ | ︙ |
jni/sdl2tk/tests/winDialog.test became executable.
︙ | ︙ |
jni/sdl2tk/unix/configure.in became a regular file.
︙ | ︙ |
Changes to jni/sdl2tk/unix/tkUnixRFont.c.
︙ | ︙ | |||
774 775 776 777 778 779 780 | int i, last = -1, last2 = -1; XColor xcolor; for (i = fontPtr->firstColor; i >= 0; last2 = last, last = i, i = fontPtr->colors[i].next) { if (pixel == fontPtr->colors[i].color.pixel) { | | | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | int i, last = -1, last2 = -1; XColor xcolor; for (i = fontPtr->firstColor; i >= 0; last2 = last, last = i, i = fontPtr->colors[i].next) { if (pixel == fontPtr->colors[i].color.pixel) { /* * Color found in cache. Move it to the front of the list and return it. */ if (last >= 0) { fontPtr->colors[last].next = fontPtr->colors[i].next; fontPtr->colors[i].next = fontPtr->firstColor; fontPtr->firstColor = i; } |
︙ | ︙ | |||
798 799 800 801 802 803 804 | */ if (fontPtr->ncolors < MAX_CACHED_COLORS) { last2 = -1; last = fontPtr->ncolors++; } | | | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | */ if (fontPtr->ncolors < MAX_CACHED_COLORS) { last2 = -1; last = fontPtr->ncolors++; } /* * Translate the pixel value to a color. Needs a server round-trip. */ xcolor.pixel = pixel; XQueryColor(display, DefaultColormap(display, fontPtr->screen), &xcolor); fontPtr->colors[last].color.color.red = xcolor.red; fontPtr->colors[last].color.color.green = xcolor.green; |
︙ | ︙ |