From e8056974d6ff66419811aefcfa7dccf1e9ce037a Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 25 Mar 2009 23:39:34 +0000 Subject: Eliminate a few compiler warnings on mingw spacing --- ChangeLog | 2 ++ win/tkWinMenu.c | 8 +++--- win/ttkWinXPTheme.c | 76 ++++++++++++++++++++++++++--------------------------- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4adc51d..5d5f549 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * library/demos/tcolor * library/demos/timer * library/demos/widget + * win/tkWinMenu.c Eliminate a few compiler warnings on mingw + * win/ttkWinXPTheme.c spacing 2009-03-25 Donal K. Fellows diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 7dffe80..1a54fd7 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinMenu.c,v 1.65 2009/03/01 21:54:40 patthoyts Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.66 2009/03/25 23:39:35 nijtmans Exp $ */ #define OEMRESOURCE @@ -2437,9 +2437,9 @@ TkpDrawMenuEntry( int adjustedHeight = height - 2 * padY; TkWinDrawable memWinDraw; TkWinDCState dcState; - HBITMAP oldBitmap; + HBITMAP oldBitmap = NULL; Drawable d; - HDC memDc, menuDc; + HDC memDc = NULL, menuDc = NULL; /* * If the menu entry includes an image then draw the entry into a @@ -2557,7 +2557,7 @@ TkpDrawMenuEntry( fmPtr, adjustedX, adjustedY, width, adjustedHeight); } } - + /* * Copy the entry contents from the temporary bitmap to the menu. */ diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 5930481..b4e35f2 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.23 2009/02/21 11:38:56 patthoyts Exp $ + * $Id: ttkWinXPTheme.c,v 1.24 2009/03/25 23:39:34 nijtmans Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -43,7 +43,7 @@ typedef HRESULT (STDAPICALLTYPE GetThemePartSizeProc)(HTHEME,HDC, int iPartId, int iStateId, RECT *prc, enum THEMESIZE eSize, SIZE *psz); typedef int (STDAPICALLTYPE GetThemeSysSizeProc)(HTHEME,int); -/* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */ +/* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */ typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, const RECT *pBoundingRect, RECT *pExtent); @@ -93,7 +93,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) { /* * Load the library "uxtheme.dll", where the native widget - * drawing routines are implemented. This will only succeed + * drawing routines are implemented. This will only succeed * if we are running at least on Windows XP. */ HINSTANCE handle; @@ -228,7 +228,7 @@ static Ttk_StateTable groupbox_statemap[] = /* * Edit fields (tk: "entry") */ -static Ttk_StateTable edittext_statemap[] = +static Ttk_StateTable edittext_statemap[] = { { ETS_DISABLED, TTK_STATE_DISABLED, 0 }, { ETS_READONLY, TTK_STATE_READONLY, 0 }, @@ -239,11 +239,11 @@ static Ttk_StateTable edittext_statemap[] = }; /* - * Combobox text field statemap: - * Same as edittext_statemap, but doesn't use ETS_READONLY + * Combobox text field statemap: + * Same as edittext_statemap, but doesn't use ETS_READONLY * (fixes: #1032409) */ -static Ttk_StateTable combotext_statemap[] = +static Ttk_StateTable combotext_statemap[] = { { ETS_DISABLED, TTK_STATE_DISABLED, 0 }, { ETS_FOCUSED, TTK_STATE_FOCUS, 0 }, @@ -317,13 +317,13 @@ static Ttk_StateTable rightarrow_statemap[] = { ABS_RIGHTNORMAL, 0, 0 } }; -static Ttk_StateTable spinbutton_statemap[] = +static Ttk_StateTable spinbutton_statemap[] = { { DNS_DISABLED, TTK_STATE_DISABLED, 0 }, { DNS_PRESSED, TTK_STATE_PRESSED, 0 }, { DNS_HOT, TTK_STATE_ACTIVE, 0 }, { DNS_NORMAL, 0, 0 }, -}; +}; /* * Trackbar thumb: (Tk: "scale slider") @@ -355,7 +355,7 @@ static Ttk_StateTable tabitem_statemap[] = * to most elements in this theme. It contains data relevant * to a single XP Theme "part". * - * <>: + * <>: * In theory, we should be call GetThemeMargins(...TMT_CONTENTRECT...) * to calculate the internal padding. In practice, this routine * only seems to work properly for BP_PUSHBUTTON. So we hardcode @@ -364,7 +364,7 @@ static Ttk_StateTable tabitem_statemap[] = * The PAD_MARGINS flag bit determines whether the padding * should be added on the inside (0) or outside (1) of the element. * - * <>: + * <>: * This gives bogus metrics for some parts (in particular, * BP_PUSHBUTTONS). Set the IGNORE_THEMESIZE flag to skip this call. */ @@ -372,13 +372,13 @@ static Ttk_StateTable tabitem_statemap[] = typedef struct /* XP element specifications */ { const char *elementName; /* Tk theme engine element name */ - Ttk_ElementSpec *elementSpec; + Ttk_ElementSpec *elementSpec; /* Element spec (usually GenericElementSpec) */ LPCWSTR className; /* Windows window class name */ int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */ Ttk_StateTable *statemap; /* Map Tk states to XP states */ Ttk_Padding padding; /* See NOTE-GetThemeMargins */ - int flags; + int flags; # define IGNORE_THEMESIZE 0x80000000 /* See NOTE-GetThemePartSize */ # define PAD_MARGINS 0x40000000 /* See NOTE-GetThemeMargins */ # define HEAP_ELEMENT 0x20000000 /* ElementInfo is on heap */ @@ -428,7 +428,7 @@ static void DestroyElementData(void *clientData) ckfree((char *)elementData->info->statemap); ckfree((char *)elementData->info->className); ckfree((char *)elementData->info->elementName); - ckfree((char *)elementData->info); + ckfree((char *)elementData->info); } ckfree(clientData); } @@ -482,7 +482,7 @@ FreeElementData(ElementData *elementData) /*---------------------------------------------------------------------- * +++ Generic element implementation. - * + * * Used for elements which are handled entirely by the XP Theme API, * such as radiobutton and checkbutton indicators, scrollbar arrows, etc. */ @@ -511,10 +511,10 @@ static void GenericElementSize( if (SUCCEEDED(result)) { *widthPtr = size.cx; *heightPtr = size.cy; - } + } } - /* See NOTE-GetThemeMargins + /* See NOTE-GetThemeMargins */ *paddingPtr = elementData->info->padding; if (elementData->info->flags & PAD_MARGINS) { @@ -561,7 +561,7 @@ static Ttk_ElementSpec GenericElementSpec = /*---------------------------------------------------------------------- * +++ Sized element implementation. - * + * * Used for elements which are handled entirely by the XP Theme API, * but that require a fixed size adjustment. * Note that GetThemeSysSize calls through to GetSystemMetrics @@ -665,7 +665,7 @@ static Ttk_ElementSpec ThumbElementSpec = /*---------------------------------------------------------------------- * +++ Progress bar element. * Increases the requested length of PP_CHUNK and PP_CHUNKVERT parts - * so that indeterminate progress bars show 3 bars instead of 1. + * so that indeterminate progress bars show 3 bars instead of 1. */ static void PbarElementSize( @@ -698,14 +698,14 @@ static Ttk_ElementSpec PbarElementSpec = * +++ Notebook tab element. * Same as generic element, with additional logic to select * proper iPartID for the leftmost tab. - * - * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE, + * + * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE, * which appears to be identical) should be used if the * tab is exactly at the right edge of the notebook, but * not if it's simply the rightmost tab. This information * is not available. * - * The TIS_* and TILES_* definitions are identical, so + * The TIS_* and TILES_* definitions are identical, so * we can use the same statemap no matter what the partId. */ static void TabElementDraw( @@ -744,14 +744,14 @@ static Ttk_ElementSpec TabElementSpec = #define TTK_STATE_OPEN TTK_STATE_USER1 #define TTK_STATE_LEAF TTK_STATE_USER2 -static Ttk_StateTable header_statemap[] = +static Ttk_StateTable header_statemap[] = { { HIS_PRESSED, TTK_STATE_PRESSED, 0 }, { HIS_HOT, TTK_STATE_ACTIVE, 0 }, { HIS_NORMAL, 0,0 }, }; -static Ttk_StateTable treeview_statemap[] = +static Ttk_StateTable treeview_statemap[] = { { TREIS_DISABLED, TTK_STATE_DISABLED, 0 }, { TREIS_SELECTED, TTK_STATE_SELECTED, 0}, @@ -759,7 +759,7 @@ static Ttk_StateTable treeview_statemap[] = { TREIS_NORMAL, 0,0 }, }; -static Ttk_StateTable tvpglyph_statemap[] = +static Ttk_StateTable tvpglyph_statemap[] = { { GLPS_OPENED, TTK_STATE_OPEN, 0 }, { GLPS_CLOSED, 0,0 }, @@ -789,11 +789,11 @@ static Ttk_ElementSpec TreeIndicatorElementSpec = *---------------------------------------------------------------------- * Text element (does not work yet). * - * According to "Using Windows XP Visual Styles", we need to select + * According to "Using Windows XP Visual Styles", we need to select * a font into the DC before calling DrawThemeText(). * There's just no easy way to get an HFONT out of a Tk_Font. * Maybe GetThemeFont() would work? - * + * */ typedef struct @@ -888,7 +888,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, - TTK_GROUP("Button.focus", TTK_FILL_BOTH, + TTK_GROUP("Button.focus", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH))))) @@ -915,7 +915,7 @@ TTK_LAYOUT("Vertical.TScrollbar", TTK_LAYOUT("Horizontal.TScale", TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, - TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) + TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) TTK_LAYOUT("Vertical.TScale", @@ -927,7 +927,7 @@ TTK_LAYOUT("Vertical.TScale", TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- - * +++ XP element info table: + * +++ XP element info table: */ #define PAD(l,t,r,b) {l,t,r,b} @@ -995,7 +995,7 @@ static ElementInfo ElementInfoTable[] = { /* ttk::notebook */ { "tab", &TabElementSpec, L"TAB", TABP_TABITEM, tabitem_statemap, PAD(3,3,3,0), 0 }, - { "client", &GenericElementSpec, L"TAB", + { "client", &GenericElementSpec, L"TAB", TABP_PANE, null_statemap, PAD(1,1,3,3), 0 }, { "NotebookPane.background", &GenericElementSpec, L"TAB", TABP_BODY, null_statemap, NOPAD, 0 }, @@ -1009,11 +1009,11 @@ static ElementInfo ElementInfoTable[] = { TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), 0 }, { "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW", TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS }, - { "Treeheading.border", &GenericElementSpec, L"HEADER", + { "Treeheading.border", &GenericElementSpec, L"HEADER", HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 }, - { "sizegrip", &GenericElementSpec, L"STATUS", + { "sizegrip", &GenericElementSpec, L"STATUS", SP_GRIPPER, null_statemap, NOPAD,0 }, - { "Spinbox.field", &GenericElementSpec, L"EDIT", + { "Spinbox.field", &GenericElementSpec, L"EDIT", EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 }, { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN", SPNP_UP, spinbutton_statemap, NOPAD, @@ -1023,7 +1023,7 @@ static ElementInfo ElementInfoTable[] = { PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) }, #if BROKEN_TEXT_ELEMENT - { "Labelframe.text", &TextElementSpec, L"BUTTON", + { "Labelframe.text", &TextElementSpec, L"BUTTON", BP_GROUPBOX, groupbox_statemap, NOPAD,0 }, #endif @@ -1034,7 +1034,7 @@ static ElementInfo ElementInfoTable[] = { /*---------------------------------------------------------------------- * Windows Visual Styles API Element Factory * - * The Vista release has shown that the Windows Visual Styles can be + * The Vista release has shown that the Windows Visual Styles can be * extended with additional elements. This element factory can permit * the programmer to create elements for use with script-defined layouts * @@ -1064,7 +1064,7 @@ Ttk_CreateVsapiElement( char *name; LPWSTR wname; - const char *optionStrings[] = + const char *optionStrings[] = { "-padding","-width","-height","-margins",NULL }; enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS }; @@ -1078,7 +1078,7 @@ Ttk_CreateVsapiElement( return TCL_ERROR; } className = Tcl_GetUnicodeFromObj(objv[0], &length); - + /* flags or padding */ if (objc > 3) { int i = 3, option = 0; -- cgit v0.12