Import Tk 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:54:10 +01:00
parent 42c69189d9
commit 070b8750b0
403 changed files with 21608 additions and 16269 deletions

View File

@@ -4,9 +4,7 @@
* ttk::scale widget.
*/
#include <tk.h>
#include <string.h>
#include <stdio.h>
#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -55,15 +53,15 @@ typedef struct
static Tk_OptionSpec ScaleOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
Tk_Offset(Scale,scale.commandObj), -1,
Tk_Offset(Scale,scale.commandObj), -1,
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-variable", "variable", "Variable", "",
Tk_Offset(Scale,scale.variableObj), -1,
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_Offset(Scale,scale.orient), 0,
(void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0},
@@ -72,7 +70,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] =
{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,
DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-state", "state", "State",
@@ -89,12 +87,12 @@ 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,
* If the linked variable is not a valid double,
* sets the 'invalid' state.
*/
static void ScaleVariableChanged(void *recordPtr, const char *value)
{
Scale *scale = recordPtr;
Scale *scale = (Scale *)recordPtr;
double v;
if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) {
@@ -112,15 +110,17 @@ static void ScaleVariableChanged(void *recordPtr, const char *value)
/* ScaleInitialize --
* Scale widget initialization hook.
*/
static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr)
static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr)
{
Scale *scalePtr = recordPtr;
Scale *scalePtr = (Scale *)recordPtr;
(void)dummy;
TtkTrackElementState(&scalePtr->core);
}
static void ScaleCleanup(void *recordPtr)
{
Scale *scale = recordPtr;
Scale *scale = (Scale *)recordPtr;
if (scale->scale.variableTrace) {
Ttk_UntraceVariable(scale->scale.variableTrace);
@@ -133,7 +133,7 @@ static void ScaleCleanup(void *recordPtr)
*/
static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
Scale *scale = recordPtr;
Scale *scale = (Scale *)recordPtr;
Tcl_Obj *varName = scale->scale.variableObj;
Ttk_TraceHandle *vt = 0;
@@ -163,10 +163,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook.
*/
static int ScalePostConfigure(
Tcl_Interp *interp, void *recordPtr, int mask)
Tcl_Interp *dummy, void *recordPtr, int mask)
{
Scale *scale = recordPtr;
Scale *scale = (Scale *)recordPtr;
int status = TCL_OK;
(void)dummy;
(void)mask;
if (scale->scale.variableTrace) {
status = Ttk_FireTrace(scale->scale.variableTrace);
@@ -189,10 +191,10 @@ static int ScalePostConfigure(
/* ScaleGetLayout --
* getLayout hook.
*/
static Ttk_Layout
static Ttk_Layout
ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
Scale *scalePtr = recordPtr;
Scale *scalePtr = (Scale *)recordPtr;
return TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, scalePtr->scale.orientObj);
}
@@ -253,14 +255,14 @@ static double ScaleFraction(Scale *scalePtr, double value)
}
/* $scale get ?x y? --
* Returns the current value of the scale widget, or if $x and
* 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;
Scale *scalePtr = (Scale *)recordPtr;
int x, y, r = TCL_OK;
double value = 0;
@@ -288,7 +290,7 @@ static int
ScaleSetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Scale *scalePtr = recordPtr;
Scale *scalePtr = (Scale *)recordPtr;
double from = 0.0, to = 1.0, value;
int result = TCL_OK;
@@ -356,7 +358,7 @@ static int
ScaleCoordsCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Scale *scalePtr = recordPtr;
Scale *scalePtr = (Scale *)recordPtr;
double value;
int r = TCL_OK;
@@ -383,7 +385,7 @@ ScaleCoordsCommand(
static void ScaleDoLayout(void *clientData)
{
WidgetCore *corePtr = clientData;
WidgetCore *corePtr = (WidgetCore *)clientData;
Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider");
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
@@ -391,7 +393,7 @@ static void ScaleDoLayout(void *clientData)
/* Adjust the slider position:
*/
if (slider) {
Scale *scalePtr = clientData;
Scale *scalePtr = (Scale *)clientData;
Ttk_Box troughBox = TroughBox(scalePtr);
Ttk_Box sliderBox = Ttk_ElementParcel(slider);
double value = 0.0;
@@ -418,8 +420,8 @@ static void ScaleDoLayout(void *clientData)
*/
static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr)
{
WidgetCore *corePtr = clientData;
Scale *scalePtr = clientData;
WidgetCore *corePtr = (WidgetCore *)clientData;
Scale *scalePtr = (Scale *)clientData;
int length;
Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);