Tk Source Code

Check-in [008f3c62]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:-selectfgstipple tag configuration option: implementation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-443
Files: files | file ages | folders
SHA1:008f3c626bdc7a433f0d13466e3ad7a88ae4f772
User & Date: fvogel 2016-02-09 21:36:19
Context
2016-03-08
21:55
Backed out anything dealing with stippling, in accordance with discussion about TIP #443 check-in: 0f9dcbfa user: fvogel tags: tip-443
2016-02-09
21:36
-selectfgstipple tag configuration option: documentation (+ polished doc of the previously developed new tag options) check-in: 305ec969 user: fvogel tags: tip-443
21:36
-selectfgstipple tag configuration option: implementation check-in: 008f3c62 user: fvogel tags: tip-443
21:33
-selectbgstipple tag configuration option: tests check-in: 5324041d user: fvogel tags: tip-443
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkText.c.

2288
2289
2290
2291
2292
2293
2294

2295
2296
2297
2298
2299
2300
2301
	    || (textPtr->selTagPtr->selBorder != NULL)
	    || (textPtr->selTagPtr->reliefString != NULL)
	    || (textPtr->selTagPtr->bgStipple != None)
	    || (textPtr->selTagPtr->selBgStipple != None)
	    || (textPtr->selTagPtr->fgColor != NULL)
	    || (textPtr->selTagPtr->selFgColor != NULL)
	    || (textPtr->selTagPtr->fgStipple != None)

	    || (textPtr->selTagPtr->overstrikeString != NULL)
	    || (textPtr->selTagPtr->underlineString != NULL)) {
	textPtr->selTagPtr->affectsDisplay = 1;
    }
    TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1);

    /*







>







2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
	    || (textPtr->selTagPtr->selBorder != NULL)
	    || (textPtr->selTagPtr->reliefString != NULL)
	    || (textPtr->selTagPtr->bgStipple != None)
	    || (textPtr->selTagPtr->selBgStipple != None)
	    || (textPtr->selTagPtr->fgColor != NULL)
	    || (textPtr->selTagPtr->selFgColor != NULL)
	    || (textPtr->selTagPtr->fgStipple != None)
	    || (textPtr->selTagPtr->selFgStipple != None)
	    || (textPtr->selTagPtr->overstrikeString != NULL)
	    || (textPtr->selTagPtr->underlineString != NULL)) {
	textPtr->selTagPtr->affectsDisplay = 1;
    }
    TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1);

    /*

Changes to generic/tkText.h.

364
365
366
367
368
369
370



371
372
373
374
375
376
377
				 * valid if rMarginString is non-NULL. */
    Tk_3DBorder selBorder;	/* Used for drawing background for selected text.
				 * NULL means no value specified here. */
    Pixmap selBgStipple;	/* Stipple bitmap for background of selected text.
				 * None means no value specified here. */
    XColor *selFgColor;		/* Foreground color for selected text. NULL means
				 * no value specified here. */



    char *spacing1String;	/* -spacing1 option string (malloc-ed). NULL
				 * means option not specified. */
    int spacing1;		/* Extra spacing above first display line for
				 * text line. Only valid if spacing1String is
				 * non-NULL. */
    char *spacing2String;	/* -spacing2 option string (malloc-ed). NULL
				 * means option not specified. */







>
>
>







364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
				 * valid if rMarginString is non-NULL. */
    Tk_3DBorder selBorder;	/* Used for drawing background for selected text.
				 * NULL means no value specified here. */
    Pixmap selBgStipple;	/* Stipple bitmap for background of selected text.
				 * None means no value specified here. */
    XColor *selFgColor;		/* Foreground color for selected text. NULL means
				 * no value specified here. */
    Pixmap selFgStipple;	/* Stipple bitmap for text and other
				 * foreground stuff when selected. None means
				 * no value specified here.*/
    char *spacing1String;	/* -spacing1 option string (malloc-ed). NULL
				 * means option not specified. */
    int spacing1;		/* Extra spacing above first display line for
				 * text line. Only valid if spacing1String is
				 * non-NULL. */
    char *spacing2String;	/* -spacing2 option string (malloc-ed). NULL
				 * means option not specified. */

Changes to generic/tkTextDisp.c.

796
797
798
799
800
801
802

803
804
805
806
807

808
809
810
811
812
813
814
...
831
832
833
834
835
836
837




838
839
840
841
842
843
844
...
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
        }
    }

    for (i = 0 ; i < numTags; i++) {
	Tk_3DBorder border;
        Pixmap bgStipple;
        XColor *fgColor;


	tagPtr = tagPtrs[i];
	border = tagPtr->border;
        bgStipple = tagPtr->bgStipple;
        fgColor = tagPtr->fgColor;


	/*
	 * If this is the selection tag, and inactiveSelBorder is NULL (the
	 * default on Windows), then we need to skip it if we don't have the
	 * focus.
	 */

................................................................................
        if ((tagPtr->selBgStipple != None) && (isSelected)) {
            bgStipple = tagPtr->selBgStipple;
        }

        if ((tagPtr->selFgColor != None) && (isSelected)) {
            fgColor = tagPtr->selFgColor;
        }





	if ((border != NULL) && (tagPtr->priority > borderPrio)) {
	    styleValues.border = border;
	    borderPrio = tagPtr->priority;
	}
	if ((tagPtr->borderWidthPtr != NULL)
		&& (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0')
................................................................................
	    styleValues.fgColor = fgColor;
	    fgPrio = tagPtr->priority;
	}
	if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) {
	    styleValues.tkfont = tagPtr->tkfont;
	    fontPrio = tagPtr->priority;
	}
	if ((tagPtr->fgStipple != None)
		&& (tagPtr->priority > fgStipplePrio)) {
	    styleValues.fgStipple = tagPtr->fgStipple;
	    fgStipplePrio = tagPtr->priority;
	}
	if ((tagPtr->justifyString != NULL)
		&& (tagPtr->priority > justifyPrio)) {
	    styleValues.justify = tagPtr->justify;
	    justifyPrio = tagPtr->priority;
	}







>





>







 







>
>
>
>







 







|

|







796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
...
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
...
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
        }
    }

    for (i = 0 ; i < numTags; i++) {
	Tk_3DBorder border;
        Pixmap bgStipple;
        XColor *fgColor;
        Pixmap fgStipple;

	tagPtr = tagPtrs[i];
	border = tagPtr->border;
        bgStipple = tagPtr->bgStipple;
        fgColor = tagPtr->fgColor;
        fgStipple = tagPtr->fgStipple;

	/*
	 * If this is the selection tag, and inactiveSelBorder is NULL (the
	 * default on Windows), then we need to skip it if we don't have the
	 * focus.
	 */

................................................................................
        if ((tagPtr->selBgStipple != None) && (isSelected)) {
            bgStipple = tagPtr->selBgStipple;
        }

        if ((tagPtr->selFgColor != None) && (isSelected)) {
            fgColor = tagPtr->selFgColor;
        }

        if ((tagPtr->selFgStipple != None) && (isSelected)) {
            bgStipple = tagPtr->selFgStipple;
        }

	if ((border != NULL) && (tagPtr->priority > borderPrio)) {
	    styleValues.border = border;
	    borderPrio = tagPtr->priority;
	}
	if ((tagPtr->borderWidthPtr != NULL)
		&& (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0')
................................................................................
	    styleValues.fgColor = fgColor;
	    fgPrio = tagPtr->priority;
	}
	if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) {
	    styleValues.tkfont = tagPtr->tkfont;
	    fontPrio = tagPtr->priority;
	}
	if ((fgStipple != None)
		&& (tagPtr->priority > fgStipplePrio)) {
	    styleValues.fgStipple = fgStipple;
	    fgStipplePrio = tagPtr->priority;
	}
	if ((tagPtr->justifyString != NULL)
		&& (tagPtr->priority > justifyPrio)) {
	    styleValues.justify = tagPtr->justify;
	    justifyPrio = tagPtr->priority;
	}

Changes to generic/tkTextTag.c.

70
71
72
73
74
75
76


77
78
79
80
81
82
83
...
526
527
528
529
530
531
532

533
534
535
536
537
538
539
....
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046
	NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_STRING, "-rmargin", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
    {TK_OPTION_BORDER, "-selectbackground", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_BITMAP, "-selectbgstipple", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selBgStipple), TK_OPTION_NULL_OK, 0, 0},


    {TK_OPTION_COLOR, "-selectforeground", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_STRING, "-spacing1", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_STRING, "-spacing2", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_STRING, "-spacing3", NULL, NULL,
................................................................................
		    || (tagPtr->selBorder != NULL)
		    || (tagPtr->reliefString != NULL)
		    || (tagPtr->bgStipple != None)
		    || (tagPtr->selBgStipple != None)
		    || (tagPtr->fgColor != NULL)
		    || (tagPtr->selFgColor != NULL)
		    || (tagPtr->fgStipple != None)

		    || (tagPtr->overstrikeString != NULL)
		    || (tagPtr->underlineString != NULL)) {
		tagPtr->affectsDisplay = 1;
	    }
	    if (!newTag) {
		/*
		 * This line is not necessary if this is a new tag, since it
................................................................................
    tagPtr->overstrikeString = NULL;
    tagPtr->overstrike = 0;
    tagPtr->rMarginString = NULL;
    tagPtr->rMargin = 0;
    tagPtr->selBorder = NULL;
    tagPtr->selBgStipple = None;
    tagPtr->selFgColor = NULL;

    tagPtr->spacing1String = NULL;
    tagPtr->spacing1 = 0;
    tagPtr->spacing2String = NULL;
    tagPtr->spacing2 = 0;
    tagPtr->spacing3String = NULL;
    tagPtr->spacing3 = 0;
    tagPtr->tabStringPtr = NULL;







>
>







 







>







 







>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
....
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
	NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_STRING, "-rmargin", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
    {TK_OPTION_BORDER, "-selectbackground", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_BITMAP, "-selectbgstipple", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selBgStipple), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_BITMAP, "-selectfgstipple", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selFgStipple), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_COLOR, "-selectforeground", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_STRING, "-spacing1", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_STRING, "-spacing2", NULL, NULL,
	NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_STRING, "-spacing3", NULL, NULL,
................................................................................
		    || (tagPtr->selBorder != NULL)
		    || (tagPtr->reliefString != NULL)
		    || (tagPtr->bgStipple != None)
		    || (tagPtr->selBgStipple != None)
		    || (tagPtr->fgColor != NULL)
		    || (tagPtr->selFgColor != NULL)
		    || (tagPtr->fgStipple != None)
		    || (tagPtr->selFgStipple != None)
		    || (tagPtr->overstrikeString != NULL)
		    || (tagPtr->underlineString != NULL)) {
		tagPtr->affectsDisplay = 1;
	    }
	    if (!newTag) {
		/*
		 * This line is not necessary if this is a new tag, since it
................................................................................
    tagPtr->overstrikeString = NULL;
    tagPtr->overstrike = 0;
    tagPtr->rMarginString = NULL;
    tagPtr->rMargin = 0;
    tagPtr->selBorder = NULL;
    tagPtr->selBgStipple = None;
    tagPtr->selFgColor = NULL;
    tagPtr->selFgStipple = None;
    tagPtr->spacing1String = NULL;
    tagPtr->spacing1 = 0;
    tagPtr->spacing2String = NULL;
    tagPtr->spacing2 = 0;
    tagPtr->spacing3String = NULL;
    tagPtr->spacing3 = 0;
    tagPtr->tabStringPtr = NULL;