Skip to content

Commit

Permalink
Spacing/indenting fixes for ttk
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Nov 7, 2024
1 parent d6f17ca commit d512d40
Show file tree
Hide file tree
Showing 30 changed files with 1,019 additions and 1,017 deletions.
26 changes: 13 additions & 13 deletions generic/ttk/ttk.decls
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library ttk
interface ttk
epoch 0
library ttk
interface ttk
epoch 0
scspec TTKAPI

declare 0 {
Expand Down Expand Up @@ -56,23 +56,23 @@ declare 8 {
#
declare 10 {
int Ttk_GetStateSpecFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn)
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn)
}
declare 11 {
Tcl_Obj *Ttk_NewStateSpecObj(
unsigned int onbits, unsigned int offbits)
unsigned int onbits, unsigned int offbits)
}
declare 12 {
Ttk_StateMap Ttk_GetStateMapFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr)
Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 13 {
Tcl_Obj *Ttk_StateMapLookup(
Tcl_Interp *interp, Ttk_StateMap map, Ttk_State state)
}
declare 14 {
int Ttk_StateTableLookup(
const Ttk_StateTable *map, Ttk_State state)
const Ttk_StateTable *map, Ttk_State state)
}


Expand All @@ -81,35 +81,35 @@ declare 14 {
#
declare 20 {
int Ttk_GetPaddingFromObj(
Tcl_Interp *interp,
Tcl_Interp *interp,
Tk_Window tkwin,
Tcl_Obj *objPtr,
Ttk_Padding *pad_rtn)
}
declare 21 {
int Ttk_GetBorderFromObj(
Tcl_Interp *interp,
Tcl_Interp *interp,
Tcl_Obj *objPtr,
Ttk_Padding *pad_rtn)
}
declare 22 {
int Ttk_GetStickyFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn)
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn)
}
declare 23 {
Ttk_Padding Ttk_MakePadding(
short l, short t, short r, short b)
short l, short t, short r, short b)
}
declare 24 {
Ttk_Padding Ttk_UniformPadding(
short borderWidth)
short borderWidth)
}
declare 25 {
Ttk_Padding Ttk_AddPadding(Ttk_Padding pad1, Ttk_Padding pad2)
}
declare 26 {
Ttk_Padding Ttk_RelievePadding(
Ttk_Padding padding, int relief, int n)
Ttk_Padding padding, int relief, int n)
}
declare 27 {
Ttk_Box Ttk_MakeBox(int x, int y, int width, int height)
Expand Down
44 changes: 22 additions & 22 deletions generic/ttk/ttkBlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright 2004, Joe English.
*
* Usage:
* TtkBlinkCursor(corePtr), usually called in a widget's Init hook,
* arranges to periodically toggle the corePtr->flags CURSOR_ON bit
* on and off (and schedule a redisplay) whenever the widget has focus.
* TtkBlinkCursor(corePtr), usually called in a widget's Init hook,
* arranges to periodically toggle the corePtr->flags CURSOR_ON bit
* on and off (and schedule a redisplay) whenever the widget has focus.
*
* Note: Widgets may have additional logic to decide whether
* to display the cursor or not (e.g., readonly or disabled states);
* TtkBlinkCursor() does not account for this.
* Note: Widgets may have additional logic to decide whether
* to display the cursor or not (e.g., readonly or disabled states);
* TtkBlinkCursor() does not account for this.
*
*/

Expand All @@ -23,14 +23,14 @@
*/
typedef struct
{
WidgetCore *owner; /* Widget that currently has cursor */
WidgetCore *owner; /* Widget that currently has cursor */
Tcl_TimerToken timer; /* Blink timer */
int onTime; /* #milliseconds to blink cursor on */
int offTime; /* #milliseconds to blink cursor off */
int onTime; /* #milliseconds to blink cursor on */
int offTime; /* #milliseconds to blink cursor off */
} CursorManager;

/* CursorManagerDeleteProc --
* InterpDeleteProc for cursor manager.
* InterpDeleteProc for cursor manager.
*/
static void CursorManagerDeleteProc(
void *clientData,
Expand All @@ -45,7 +45,7 @@ static void CursorManagerDeleteProc(
}

/* GetCursorManager --
* Look up and create if necessary the interp's cursor manager.
* Look up and create if necessary the interp's cursor manager.
*/
static CursorManager *GetCursorManager(Tcl_Interp *interp)
{
Expand Down Expand Up @@ -108,7 +108,7 @@ CursorBlinkProc(void *clientData)
}

/* LoseCursor --
* Turn cursor off, disable blink timer.
* Turn cursor off, disable blink timer.
*/
static void LoseCursor(CursorManager *cm, WidgetCore *corePtr)
{
Expand All @@ -126,7 +126,7 @@ static void LoseCursor(CursorManager *cm, WidgetCore *corePtr)
}

/* ClaimCursor --
* Claim ownership of the insert cursor and blink on.
* Claim ownership of the insert cursor and blink on.
*/
static void ClaimCursor(CursorManager *cm, WidgetCore *corePtr)
{
Expand All @@ -144,9 +144,9 @@ static void ClaimCursor(CursorManager *cm, WidgetCore *corePtr)

/*
* CursorEventProc --
* Event handler for FocusIn and FocusOut events;
* claim/lose ownership of the insert cursor when the widget
* acquires/loses keyboard focus.
* Event handler for FocusIn and FocusOut events;
* claim/lose ownership of the insert cursor when the widget
* acquires/loses keyboard focus.
*/

#define CursorEventMask (FocusChangeMask|StructureNotifyMask)
Expand Down Expand Up @@ -195,10 +195,10 @@ void TtkSetBlinkCursorOffTime(Tcl_Interp* interp, int offTime)

/*
* TtkSetBlinkCursorTimes --
* Set cursor blink on and off times from the "." style defaults
* -insertontime and -insertofftime - For instance to set cursor
* blinking off:
* ttk::style configure . -insertofftime 0
* Set cursor blink on and off times from the "." style defaults
* -insertontime and -insertofftime - For instance to set cursor
* blinking off:
* ttk::style configure . -insertofftime 0
*/
void TtkSetBlinkCursorTimes(Tcl_Interp* interp)
{
Expand All @@ -222,8 +222,8 @@ void TtkSetBlinkCursorTimes(Tcl_Interp* interp)
}
/*
* TtkBlinkCursor (main routine) --
* Arrange to blink the cursor on and off whenever the
* widget has focus.
* Arrange to blink the cursor on and off whenever the
* widget has focus.
*/
void TtkBlinkCursor(WidgetCore *corePtr)
{
Expand Down
54 changes: 28 additions & 26 deletions generic/ttk/ttkButton.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/* Bit fields for OptionSpec mask field:
*/
#define STATE_CHANGED (0x100) /* -state option changed */
#define STATE_CHANGED (0x100) /* -state option changed */
#define DEFAULTSTATE_CHANGED (0x200) /* -default option changed */

/*------------------------------------------------------------------------
Expand Down Expand Up @@ -135,10 +135,12 @@ static void
BaseCleanup(void *recordPtr)
{
Base *basePtr = (Base *)recordPtr;
if (basePtr->base.textVariableTrace)
if (basePtr->base.textVariableTrace) {
Ttk_UntraceVariable(basePtr->base.textVariableTrace);
if (basePtr->base.imageSpec)
TtkFreeImageSpec(basePtr->base.imageSpec);
}
if (basePtr->base.imageSpec) {
TtkFreeImageSpec(basePtr->base.imageSpec);
}
}

static void
Expand Down Expand Up @@ -272,7 +274,7 @@ static const Ttk_Ensemble LabelCommands[] = {
{ "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
Expand All @@ -287,8 +289,8 @@ static const WidgetSpec LabelWidgetSpec =
BaseCleanup, /* cleanupProc */
BaseConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
Expand Down Expand Up @@ -356,7 +358,7 @@ static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
}

/* $button invoke --
* Evaluate the button's -command.
* Evaluate the button's -command.
*/
static int
ButtonInvokeCommand(
Expand All @@ -379,7 +381,7 @@ static const Ttk_Ensemble ButtonCommands[] = {
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "invoke", ButtonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
Expand All @@ -395,7 +397,7 @@ static const WidgetSpec ButtonWidgetSpec =
ButtonConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
Expand Down Expand Up @@ -540,7 +542,7 @@ CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)

/*
* Checkbutton 'invoke' subcommand:
* Toggles the checkbutton state.
* Toggles the checkbutton state.
*/
static int
CheckbuttonInvokeCommand(
Expand Down Expand Up @@ -587,7 +589,7 @@ static const Ttk_Ensemble CheckbuttonCommands[] = {
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "invoke", CheckbuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect, toggle */
{ 0,0,0 }
Expand All @@ -603,8 +605,8 @@ static const WidgetSpec CheckbuttonWidgetSpec =
CheckbuttonCleanup, /* cleanupProc */
CheckbuttonConfigure, /* configureProc */
CheckbuttonPostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
Expand Down Expand Up @@ -728,7 +730,7 @@ RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)

/*
* Radiobutton 'invoke' subcommand:
* Sets the radiobutton -variable to the -value, evaluates the -command.
* Sets the radiobutton -variable to the -value, evaluates the -command.
*/
static int
RadiobuttonInvokeCommand(
Expand Down Expand Up @@ -764,7 +766,7 @@ static const Ttk_Ensemble RadiobuttonCommands[] = {
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "invoke", RadiobuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect */
{ 0,0,0 }
Expand All @@ -780,8 +782,8 @@ static const WidgetSpec RadiobuttonWidgetSpec =
RadiobuttonCleanup, /* cleanupProc */
RadiobuttonConfigure, /* configureProc */
RadiobuttonPostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
Expand Down Expand Up @@ -832,7 +834,7 @@ static const Ttk_Ensemble MenubuttonCommands[] = {
{ "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
Expand All @@ -841,15 +843,15 @@ static const Ttk_Ensemble MenubuttonCommands[] = {
static const WidgetSpec MenubuttonWidgetSpec =
{
"TMenubutton", /* className */
sizeof(Menubutton), /* recordSize */
MenubuttonOptionSpecs, /* optionSpecs */
MenubuttonCommands, /* subcommands */
BaseInitialize, /* initializeProc */
sizeof(Menubutton), /* recordSize */
MenubuttonOptionSpecs, /* optionSpecs */
MenubuttonCommands, /* subcommands */
BaseInitialize, /* initializeProc */
BaseCleanup, /* cleanupProc */
BaseConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
BasePostConfigure, /* postConfigureProc */
TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
Expand Down
Loading

0 comments on commit d512d40

Please sign in to comment.