Index: .travis.yml ================================================================== --- .travis.yml +++ .travis.yml @@ -179,57 +179,35 @@ os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern" - - name: "macOS/Xcode 12/Shared" - os: osx - osx_image: xcode12 - env: - - BUILD_DIR=unix - - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: &mactest - - make all tktest - name: "macOS/Xcode 12/Static" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 12/Debug" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 12/Shared/XQuartz" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest # Older MacOS versions - name: "macOS/Xcode 11/Shared" os: osx osx_image: xcode11.7 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 addons: homebrew: @@ -237,13 +215,10 @@ - tcl-tk update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 addons: homebrew: @@ -251,13 +226,10 @@ - tcl-tk update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest # Test on Windows with MSVC native # - name: "Windows/MSVC/Shared" # os: windows # compiler: cl # env: &vcenv Index: doc/ttk_button.n ================================================================== --- doc/ttk_button.n +++ doc/ttk_button.n @@ -46,12 +46,14 @@ .\" .OP \-anchor anchor Anchor .\" .OP \-relief relief Relief .SH "WIDGET COMMAND" .PP In addition to the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -commands, buttons support the following additional widget commands: +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +button widgets support the following additional commands: .TP \fIpathName \fBinvoke\fR Invokes the command associated with the button. .SH "STANDARD STYLES" .PP Index: doc/ttk_checkbutton.n ================================================================== --- doc/ttk_checkbutton.n +++ doc/ttk_checkbutton.n @@ -35,13 +35,14 @@ The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified. .SH "WIDGET COMMAND" .PP In addition to the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -commands, checkbuttons support the following additional -widget commands: +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +checkbutton widgets support the following additional commands: .TP \fIpathname\fB invoke\fR Toggles between the selected and deselected states and evaluates the associated \fB\-command\fR. If the widget is currently selected, sets the \fB\-variable\fR Index: doc/ttk_combobox.n ================================================================== --- doc/ttk_combobox.n +++ doc/ttk_combobox.n @@ -53,19 +53,15 @@ .OP \-width width Width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font. .SH "WIDGET COMMAND" .PP -The following subcommands are possible for combobox widgets: -'\".TP -'\"\fIpathName \fBcget\fR \fIoption\fR -'\"Returns the current value of the specified \fIoption\fR. -'\"See \fIttk::widget(n)\fR. -'\".TP -'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -'\"Modify or query widget options. -'\"See \fIttk::widget(n)\fR. +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +combobox widgets support the following additional commands: .TP \fIpathName \fBcurrent\fR ?\fInewIndex\fR? If \fInewIndex\fR is supplied, sets the combobox value to the element at position \fInewIndex\fR in the list of \fB\-values\fR (in addition to integers, the \fBend\fR index is supported and indicates @@ -73,41 +69,22 @@ Otherwise, returns the index of the current value in the list of \fB\-values\fR or \fB\-1\fR if the current value does not appear in the list. .TP \fIpathName \fBget\fR Returns the current value of the combobox. -'\".TP -'\"\fIpathName \fBidentify \fIx y\fR -'\"Returns the name of the element at position \fIx\fR, \fIy\fR. -'\"See \fIttk::widget(n)\fR. -'\".TP -'\"\fIpathName \fBinstate \fIstateSpec\fR ?\fIscript\fR? -'\"Test the widget state. -'\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBset\fR \fIvalue\fR Sets the value of the combobox to \fIvalue\fR. -'\".TP -'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR? -'\"Modify or query the widget state. -'\"See \fIttk::widget(n)\fR. .PP The combobox widget also supports the following \fBttk::entry\fR -widget subcommands (see \fIttk::entry(n)\fR for details): +widget commands: .DS .ta 5.5c 11c \fBbbox\fR \fBdelete\fR \fBicursor\fR \fBindex\fR \fBinsert\fR \fBselection\fR \fBxview\fR .DE -The combobox widget also supports the following generic \fBttk::widget\fR -widget subcommands (see \fIttk::widget(n)\fR for details): -.DS -.ta 5.5c 11c -\fBcget\fR \fBconfigure\fR \fBidentify\fR -\fBinstate\fR \fBstate\fR -.DE .SH "VIRTUAL EVENTS" .PP The combobox widget generates a \fB<>\fR virtual event when the user selects an element from the list of values. If the selection action unposts the listbox, Index: doc/ttk_entry.n ================================================================== --- doc/ttk_entry.n +++ doc/ttk_entry.n @@ -137,11 +137,15 @@ .QW \fBsel.l\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. .SH "WIDGET COMMAND" .PP -The following subcommands are possible for entry widgets: +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR, \fBstyle\fR and \fBxview\fR +commands (see \fBttk::widget\fR), +entry widgets support the following additional commands: .TP \fIpathName \fBbbox \fIindex\fR Returns a list of four numbers describing the bounding box of the character given by \fIindex\fR. The first two elements of the list give the x and y coordinates of @@ -148,18 +152,10 @@ the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window. -'\".TP -'\"\fIpathName \fBcget\fR \fIoption\fR -'\"Returns the current value of the specified \fIoption\fR. -'\"See \fIttk::widget(n)\fR. -'\".TP -'\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -'\"Modify or query widget options. -'\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR? Delete one or more elements of the entry. \fIFirst\fR is the index of the first character to delete, and \fIlast\fR is the index of the character just after the last @@ -172,25 +168,17 @@ Returns the entry's string. .TP \fIpathName \fBicursor \fIindex\fR Arrange for the insert cursor to be displayed just before the character given by \fIindex\fR. Returns the empty string. -'\".TP -'\"\fIpathName \fBidentify \fIx y\fR -'\"Returns the name of the element at position \fIx\fR, \fIy\fR, -'\"or the empty string if the coordinates are outside the window. .TP \fIpathName \fBindex\fI index\fR Returns the numerical index corresponding to \fIindex\fR. .TP \fIpathName \fBinsert \fIindex string\fR Insert \fIstring\fR just before the character indicated by \fIindex\fR. Returns the empty string. -'\".TP -'\"\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? -'\"Test the widget state. -'\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBselection \fIoption arg\fR This command is used to adjust the selection within an entry. It has several forms, depending on \fIoption\fR: .RS @@ -209,29 +197,17 @@ the one indexed by \fIstart\fR and ending with the one just before \fIend\fR. If \fIend\fR refers to the same character as \fIstart\fR or an earlier one, then the entry's selection is cleared. .RE -'\".TP -'\"\fIpathName \fBstate\fR ?\fIstateSpec\fR? -'\"Modify or query the widget state. -'\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBvalidate\fR Force revalidation, independent of the conditions specified by the \fB\-validate\fR option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the \fBinvalid\fR state accordingly. See \fBVALIDATION\fR below for more details. -.PP -The entry widget also supports the following generic \fBttk::widget\fR -widget subcommands (see \fIttk::widget(n)\fR for details): -.DS -.ta 5.5c 11c -\fBcget\fR \fBconfigure\fR \fBidentify\fR -\fBinstate\fR \fBstate\fR \fBxview\fR -.DE .SH VALIDATION .PP The \fB\-validate\fR, \fB\-validatecommand\fR, and \fB\-invalidcommand\fR options are used to enable entry widget validation. .SS "VALIDATION MODES" Index: doc/ttk_frame.n ================================================================== --- doc/ttk_frame.n +++ doc/ttk_frame.n @@ -33,13 +33,14 @@ If specified, the widget's requested width in pixels. .OP \-height height Height If specified, the widget's requested height in pixels. .SH "WIDGET COMMAND" .PP -Supports the standard widget commands -\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR; -see \fIttk::widget(n)\fR. +Frame widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .SH "NOTES" .PP Note that if the \fBpack\fR, \fBgrid\fR, or other geometry managers are used to manage the children of the \fBframe\fR, by the GM's requested size will normally take precedence Index: doc/ttk_label.n ================================================================== --- doc/ttk_label.n +++ doc/ttk_label.n @@ -40,13 +40,14 @@ then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value. .SH "WIDGET COMMAND" .PP -Supports the standard widget commands -\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR; -see \fIttk::widget(n)\fR. +Label widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .SH "STYLING OPTIONS" .PP The class name for a \fBttk::label\fP is \fBTLabel\fP. .PP Dynamic states: \fBdisabled\fP, \fBreadonly\fP. Index: doc/ttk_labelframe.n ================================================================== --- doc/ttk_labelframe.n +++ doc/ttk_labelframe.n @@ -60,13 +60,14 @@ sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget. .OP \-width width Width If specified, the widget's requested width in pixels. .SH "WIDGET COMMAND" .PP -Supports the standard widget commands -\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR; -see \fIttk::widget(n)\fR. +Labelframe widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .SH "STYLING OPTIONS" .PP The class name for a \fBttk::labelframe\fP is \fBTLabelframe\fP. The text label has a class of \fBTLabelframe.Label\fP. Index: doc/ttk_menubutton.n ================================================================== --- doc/ttk_menubutton.n +++ doc/ttk_menubutton.n @@ -36,13 +36,14 @@ .\" not documented: may go away: .\" .OP \-anchor anchor Anchor .\" .OP \-padding padding Pad .SH "WIDGET COMMAND" .PP -Menubutton widgets support the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -methods. No other widget methods are used. +Menubutton widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .SH "STANDARD STYLES" .PP \fBTtk::menubutton\fR widgets support the \fBToolbutton\fR style in all standard themes, which is useful for creating widgets for toolbars. .SH "STYLING OPTIONS" Index: doc/ttk_notebook.n ================================================================== --- doc/ttk_notebook.n +++ doc/ttk_notebook.n @@ -100,23 +100,23 @@ .QW \fBend\fR , which returns the number of tabs (only valid for .QW "\fIpathname \fBindex\fR" ). .SH "WIDGET COMMAND" +.PP +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +notebook widgets support the following additional commands: .TP \fIpathname \fBadd \fIwindow\fR ?\fIoptions...\fR? Adds a new tab to the notebook. See \fBTAB OPTIONS\fR for the list of available \fIoptions\fR. If \fIwindow\fR is currently managed by the notebook but hidden, it is restored to its previous position. .TP -\fIpathname \fBconfigure\fR ?\fIoptions\fR? -See \fIttk::widget(n)\fR. -.TP -\fIpathname \fBcget \fIoption\fR -See \fIttk::widget(n)\fR. -.TP \fIpathname \fBforget \fItabid\fR Removes the tab specified by \fItabid\fR, unmaps and unmanages the associated window. .TP \fIpathname \fBhide \fItabid\fR @@ -149,23 +149,17 @@ or the name of a managed subwindow. If \fIsubwindow\fR is already managed by the notebook, moves it to the specified position. See \fBTAB OPTIONS\fR for the list of available options. .TP -\fIpathname \fBinstate \fIstatespec \fR?\fIscript...\fR? -See \fIttk::widget(n)\fR. -.TP \fIpathname \fBselect\fR ?\fItabid\fR? Selects the specified tab. The associated content window will be displayed, and the previously-selected window (if different) is unmapped. If \fItabid\fR is omitted, returns the widget name of the currently selected pane. .TP -\fIpathname \fBstate\fR ?\fIstatespec\fR? -See \fIttk::widget(n)\fR. -.TP \fIpathname \fBtab \fItabid\fR ?\fI\-option \fR?\fIvalue ...\fR Query or modify the options of the specific tab. If no \fI\-option\fR is specified, returns a dictionary of the tab option values. If one \fI\-option\fR is specified, Index: doc/ttk_panedwindow.n ================================================================== --- doc/ttk_panedwindow.n +++ doc/ttk_panedwindow.n @@ -46,13 +46,16 @@ .OP \-weight weight Weight An integer specifying the relative stretchability of the pane. When the paned window is resized, the extra space is added or subtracted to each pane proportionally to its \fB\-weight\fR. .SH "WIDGET COMMAND" -Supports the standard \fBconfigure\fR, \fBcget\fR, \fBstate\fR, -and \fBinstate\fR commands; see \fIttk::widget(n)\fR for details. -Additional commands: +.PP +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +panedwindow widgets support the following additional commands: .TP \fIpathname \fBadd \fIsubwindow options...\fR Adds a new pane to the window. See \fBPANE OPTIONS\fR for the list of available options. .TP @@ -104,18 +107,10 @@ .\" Full story: "total size" is either the -height (resp -width), .\" or the actual window height (resp actual window width), .\" depending on which changed most recently. Returns the new position of sash number \fIindex\fR. .\" Full story: new position may be different than the requested position. -.PP -The panedwindow widget also supports the following generic \fBttk::widget\fR -widget subcommands (see \fIttk::widget(n)\fR for details): -.DS -.ta 5.5c 11c -\fBcget\fR \fBconfigure\fR -\fBinstate\fR \fBstate\fR -.DE .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<>\fR virtual event on LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts for events when the pointer crosses from a parent to a child. The Index: doc/ttk_progressbar.n ================================================================== --- doc/ttk_progressbar.n +++ doc/ttk_progressbar.n @@ -64,33 +64,22 @@ If specified to an existing variable, the \fB\-value\fR of the progress bar is automatically set to the value of the variable whenever the latter is modified. .SH "WIDGET COMMAND" .PP -.TP -\fIpathName \fBcget \fIoption\fR -Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR. -.TP -\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -Modify or query widget options; see \fIttk::widget(n)\fR. -.TP -\fIpathName \fBidentify \fIx y\fR -Returns the name of the element at position \fIx\fR, \fIy\fR. -See \fIttk::widget(n)\fR. -.TP -\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? -Test the widget state; see \fIttk::widget(n)\fR. +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +progressbar widgets support the following additional commands: .TP \fIpathName \fBstart\fR ?\fIinterval\fR? Begin autoincrement mode: schedules a recurring timer event that calls \fBstep\fR every \fIinterval\fR milliseconds. If omitted, \fIinterval\fR defaults to 50 milliseconds (20 steps/second). .TP -\fIpathName \fBstate\fR ?\fIstateSpec\fR? -Modify or query the widget state; see \fIttk::widget(n)\fR. -.TP \fIpathName \fBstep\fR ?\fIamount\fR? Increments the \fB\-value\fR by \fIamount\fR. \fIamount\fR defaults to 1.0 if omitted. .TP \fIpathName \fBstop\fR Index: doc/ttk_radiobutton.n ================================================================== --- doc/ttk_radiobutton.n +++ doc/ttk_radiobutton.n @@ -35,13 +35,14 @@ The name of a global variable whose value is linked to the widget. Default value is \fB::selectedButton\fR. .SH "WIDGET COMMAND" .PP In addition to the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -commands, radiobuttons support the following additional -widget commands: +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +radiobutton widgets support the following additional commands: .TP \fIpathname\fB invoke\fR Sets the \fB\-variable\fR to the \fB\-value\fR, selects the widget, and evaluates the associated \fB\-command\fR. Returns the result of the \fB\-command\fR, or the empty Index: doc/ttk_scale.n ================================================================== --- doc/ttk_scale.n +++ doc/ttk_scale.n @@ -49,49 +49,30 @@ value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value. .SH "WIDGET COMMAND" .PP -.TP -\fIpathName \fBcget \fIoption\fR -. -Returns the current value of the specified \fIoption\fR; see -\fIttk::widget(n)\fR. -.TP -\fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR? -. -Modify or query widget options; see \fIttk::widget(n)\fR. +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +scale widgets support the following additional commands: .TP \fIpathName \fBget \fR?\fIx y\fR? -. Get the current value of the \fB\-value\fR option, or the value corresponding to the coordinates \fIx,y\fR if they are specified. \fIX\fR and \fIy\fR are pixel coordinates relative to the scale widget origin. .TP -\fIpathName \fBidentify \fIx y\fR -Returns the name of the element at position \fIx\fR, \fIy\fR. -See \fIttk::widget(n)\fR. -.TP -\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? -. -Test the widget state; see \fIttk::widget(n)\fR. -.TP \fIpathName \fBset \fIvalue\fR -. Set the value of the widget (i.e. the \fB\-value\fR option) to \fIvalue\fR. The value will be clipped to the range given by the \fB\-from\fR and \fB\-to\fR options. Note that setting the linked variable (i.e. the variable named in the \fB\-variable\fR option) does not cause such clipping. -.TP -\fIpathName \fBstate\fR ?\fIstateSpec\fR? -. -Modify or query the widget state; see \fIttk::widget(n)\fR. .SH "INTERNAL COMMANDS" .PP .TP \fIpathName \fBcoords \fR?\fIvalue\fR? -. Get the coordinates corresponding to \fIvalue\fR, or the coordinates corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR is omitted. .SH "STYLING OPTIONS" .PP Index: doc/ttk_scrollbar.n ================================================================== --- doc/ttk_scrollbar.n +++ doc/ttk_scrollbar.n @@ -45,36 +45,25 @@ .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the scrollbar. .SH "WIDGET COMMAND" .PP -.TP -\fIpathName \fBcget \fIoption\fR -Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR. -.TP -\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -Modify or query widget options; see \fIttk::widget(n)\fR. +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +commands (see \fBttk::widget\fR), +scrollbar widgets support the following additional commands: .TP \fIpathName \fBget\fR Returns the scrollbar settings in the form of a list whose elements are the arguments to the most recent \fBset\fR widget command. .TP -\fIpathName \fBidentify \fIx y\fR -Returns the name of the element at position \fIx\fR, \fIy\fR. -See \fIttk::widget(n)\fR. -.TP -\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? -Test the widget state; see \fIttk::widget(n)\fR. -.TP \fIpathName \fBset \fIfirst last\fR This command is normally invoked by the scrollbar's associated widget from an \fB\-xscrollcommand\fR or \fB\-yscrollcommand\fR callback. Specifies the visible range to be displayed. \fIfirst\fR and \fIlast\fR are real fractions between 0 and 1. -.TP -\fIpathName \fBstate\fR ?\fIstateSpec\fR? -Modify or query the widget state; see \fIttk::widget(n)\fR. .SH "INTERNAL COMMANDS" .PP The following widget commands are used internally by the \fBTScrollbar\fP widget class bindings. .TP Index: doc/ttk_separator.n ================================================================== --- doc/ttk_separator.n +++ doc/ttk_separator.n @@ -24,13 +24,14 @@ .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the separator. .SH "WIDGET COMMAND" .PP -Separator widgets support the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -methods. No other widget methods are used. +Separator widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .PP .SH "STYLING OPTIONS" .PP The class name for a \fBttk::separator\fP is \fBTSeparator\fP. .PP Index: doc/ttk_sizegrip.n ================================================================== --- doc/ttk_sizegrip.n +++ doc/ttk_sizegrip.n @@ -21,13 +21,14 @@ \-class \-cursor \-style \-takefocus .SE .SH "WIDGET COMMAND" .PP -Sizegrip widgets support the standard -\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR -methods. No other widget methods are used. +Sizegrip widgets support the standard commands +\fBcget\fR, \fBconfigure\fR, \fBidentify element\fR, \fBinstate\fR, +\fBstate\fR and \fBstyle\fR +(see \fBttk::widget\fR). .SH "PLATFORM-SPECIFIC NOTES" .PP On Mac OSX, toplevel windows automatically include a built-in size grip by default. Adding a \fBttk::sizegrip\fR there is harmless, since Index: doc/ttk_style.n ================================================================== --- doc/ttk_style.n +++ doc/ttk_style.n @@ -25,16 +25,24 @@ By default, the style name is the same as the widget's class; this may be overridden by the \fB\-style\fR option. .PP A \fItheme\fR is a collection of elements and styles which controls the overall look and feel of an application. +The +.QW . +style is the theme root style on which derived styles are based. .SH DESCRIPTION .PP The \fBttk::style\fR command takes the following arguments: .TP \fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ? Sets the default value of the specified option(s) in \fIstyle\fR. +If \fIstyle\fR does not exist, it is created. +If only \fIstyle\fR and \fI-option\fR are specified, get the default value +for option \fI-option\fR of style \fIstyle\fR. +If only \fIstyle\fR is specified, get the default value for all options +of style \fIstyle\fR. .TP \fBttk::style element\fR \fIargs\fR .RS .TP \fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR? @@ -66,16 +74,22 @@ .QW normal state). If the \fIdefault\fR argument is present, it is used as a fallback value in case no specification for \fI\-option\fR is found. .\" Otherwise -- signal error? return empty string? Leave unspecified for now. +If \fIstyle\fR does not exist, it is created. .TP \fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR? -Sets dynamic values of the specified option(s) in \fIstyle\fR. +Sets dynamic (state dependent) values of the specified option(s) in \fIstyle\fR. Each \fIstatespec / value\fR pair is examined in order; the value corresponding to the first matching \fIstatespec\fR is used. +If \fIstyle\fR does not exist, it is created. +If only \fIstyle\fR and \fI-option\fR are specified, get the dynamic values +for option \fI-option\fR of style \fIstyle\fR. +If only \fIstyle\fR is specified, get the dynamic values for all options +of style \fIstyle\fR. .TP \fBttk::style theme\fR \fIargs\fR .RS .TP \fBttk::style theme create\fR \fIthemeName\fR ?\fB\-parent \fIbasedon\fR? ?\fB\-settings \fIscript...\fR ? @@ -91,10 +105,14 @@ \fBttk::style theme settings \fIthemeName\fR \fIscript\fR Temporarily sets the current theme to \fIthemeName\fR, evaluate \fIscript\fR, then restore the previous theme. Typically \fIscript\fR simply defines styles and elements, though arbitrary Tcl code may appear. +.TP +\fBttk::style theme styles\fR ?\fIthemeName\fR? +Returns a list of all styles in \fIthemeName\fR. If \fIthemeName\fR +is omitted, the current theme is used. .TP \fBttk::style theme use\fR ?\fIthemeName\fR? Without an argument the result is the name of the current theme. Otherwise this command sets the current theme to \fIthemeName\fR, and refreshes all widgets. Index: doc/ttk_treeview.n ================================================================== --- doc/ttk_treeview.n +++ doc/ttk_treeview.n @@ -90,10 +90,15 @@ \fBNOTE:\fR Column #0 always refers to the tree column, even if \fB\-show tree\fR is not specified. .RE .SH "WIDGET COMMAND" .PP +In addition to the standard +\fBcget\fR, \fBconfigure\fR, \fBinstate\fR, +\fBstate\fR, \fBstyle\fR, \fBxview\fR and \fByview\fR +commands (see \fBttk::widget\fR), +treeview widgets support the following additional commands: .TP \fIpathname \fBbbox \fIitem\fR ?\fIcolumn\fR? Returns the bounding box (relative to the treeview widget's window) of the specified \fIitem\fR in the form \fIx y width height\fR. @@ -100,13 +105,10 @@ If \fIcolumn\fR is specified, returns the bounding box of that cell. If the \fIitem\fR is not visible (i.e., if it is a descendant of a closed item or is scrolled offscreen), returns the empty list. .TP -\fIpathname \fBcget \fIoption\fR -Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR. -.TP \fIpathname \fBchildren \fIitem\fR ?\fInewchildren\fR? If \fInewchildren\fR is not specified, returns the list of children belonging to \fIitem\fR. .RS .PP @@ -158,13 +160,10 @@ column separator. .PP Use \fIpathname column #0\fR to configure the tree column. .RE .TP -\fIpathname \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -Modify or query widget options; see \fIttk::widget(n)\fR. -.TP \fIpathname \fBdelete \fIitemList\fR Deletes each of the items in \fIitemList\fR and all of their descendants. The root item may not be deleted. See also: \fBdetach\fR. .TP @@ -270,13 +269,10 @@ \fIpathname \fBinsert\fR returns the item identifier of the newly created item. See \fBITEM OPTIONS\fR for the list of available options. .RE .TP -\fIpathname \fBinstate \fIstatespec\fR ?\fIscript\fR? -Test the widget state; see \fIttk::widget(n)\fR. -.TP \fIpathname \fBitem \fIitem\fR ?\fI\-option \fR?\fIvalue \-option value...\fR? Query or modify the options for the specified \fIitem\fR. If no \fI\-option\fR is specified, returns a dictionary of option/value pairs. If a single \fI\-option\fR is specified, @@ -336,13 +332,10 @@ With two arguments, returns the current value of the specified \fIcolumn\fR. With three arguments, sets the value of column \fIcolumn\fR in item \fIitem\fR to the specified \fIvalue\fR. See also \fBCOLUMN IDENTIFIERS\fR. .TP -\fIpathname \fBstate\fR ?\fIstateSpec\fR? -Modify or query the widget state; see \fIttk::widget(n)\fR. -.TP \fIpathName \fBtag \fIargs...\fR .RS .TP \fIpathName \fBtag add \fItag items\fR Adds the specified \fItag\fR to each of the listed \fIitems\fR. @@ -396,17 +389,10 @@ Removes the specified \fItag\fR from each of the listed \fIitems\fR. If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree. If \fItag\fR is not present for a particular item, then the \fB\-tags\fR for that item are unchanged. .RE -.PP -The treeview widget also supports the following generic \fBttk::widget\fR -widget subcommands (see \fIttk::widget(n)\fR for details): -.DS -.ta 5.5c 11c -\fBxview\fR \fByview\fR -.DE .SH "ITEM OPTIONS" .PP The following item options may be specified for items in the \fBinsert\fR and \fBitem\fR widget commands. .OP \-text text Text Index: doc/ttk_widget.n ================================================================== --- doc/ttk_widget.n +++ doc/ttk_widget.n @@ -172,16 +172,14 @@ but the \fBstate\fR widget command does not affect the \fB\-state\fR option. .SH COMMANDS .TP \fIpathName \fBcget \fIoption\fR -. Returns the current value of the configuration option given by \fIoption\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? -. Query or modify the configuration options of the widget. If one or more \fIoption\-value\fR pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. @@ -193,29 +191,27 @@ .\" Note: Ttk widgets don't use TK_OPTION_SYNONYM. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR. .TP \fIpathName \fBidentify element \fIx y\fR -. Returns the name of the element under the point given by \fIx\fR and \fIy\fR, or an empty string if the point does not lie within any element. \fIx\fR and \fIy\fR are pixel coordinates relative to the widget. -Some widgets accept other \fBidentify\fR subcommands. +Some widgets accept other \fBidentify\fR subcommands described +in these widgets documentation. .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? -. Test the widget's state. If \fIscript\fR is not specified, returns 1 if the widget state matches \fIstatespec\fR and 0 otherwise. If \fIscript\fR is specified, equivalent to .CS if {[\fIpathName\fR instate \fIstateSpec\fR]} \fIscript\fR .CE .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? -. Modify or inquire widget state. If \fIstateSpec\fR is present, sets the widget state: for each flag in \fIstateSpec\fR, sets the corresponding flag or clears it if prefixed by an exclamation point. .RS @@ -227,10 +223,13 @@ will restore \fIpathName\fR to the original state. If \fIstateSpec\fR is not specified, returns a list of the currently-enabled state flags. .RE .TP +\fIpathName \fBstyle\fR +Return the style used by the widget. +.TP \fIpathName \fBxview \fIargs\fR This command is used to query and change the horizontal position of the content in the widget's window. It can take any of the following forms: .RS Index: generic/nanosvg.h ================================================================== --- generic/nanosvg.h +++ generic/nanosvg.h @@ -31,26 +31,27 @@ #ifdef __cplusplus extern "C" { #endif -// NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes. -// -// The library suits well for anything from rendering scalable icons in your editor application to prototyping a game. -// -// NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request! -// -// The shapes in the SVG images are transformed by the viewBox and converted to specified units. -// That is, you should get the same looking data as your designed in your favorite app. -// -// NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose -// to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. -// -// The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. -// DPI (dots-per-inch) controls how the unit conversion is done. -// -// If you don't know or care about the units stuff, "px" and 96 should get you going. +/* NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes. + * + * The library suits well for anything from rendering scalable icons in your editor application to prototyping a game. + * + * NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request! + * + * The shapes in the SVG images are transformed by the viewBox and converted to specified units. + * That is, you should get the same looking data as your designed in your favorite app. + * + * NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose + * to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. + * + * The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. + * DPI (dots-per-inch) controls how the unit conversion is done. + * + * If you don't know or care about the units stuff, "px" and 96 should get you going. + */ /* Example Usage: // Load SVG NSVGimage* image; @@ -83,11 +84,11 @@ #ifndef NANOSVG_free #define NANOSVG_free free #endif -// float emulation for MS VC6++ compiler +/* float emulation for MS VC6++ compiler */ #if defined(_MSC_VER) && (_MSC_VER == 1200) #define tanf(a) (float)tan(a) #define cosf(a) (float)cos(a) #define sinf(a) (float)sin(a) #define sqrtf(a) (float)sqrt(a) @@ -96,11 +97,11 @@ #define atan2f(a,b) (float)atan2(a,b) #define ceilf(a) (float)ceil(a) #define fmodf(a,b) (float)fmod(a,b) #define floorf(a) (float)floor(a) #endif -// float emulation for MS VC8++ compiler +/* float emulation for MS VC8++ compiler */ #if defined(_MSC_VER) && (_MSC_VER == 1400) #define fabsf(a) (float)fabs(a) #endif enum NSVGpaintType { @@ -158,68 +159,68 @@ }; } NSVGpaint; typedef struct NSVGpath { - float* pts; // Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... - int npts; // Total number of bezier points. - char closed; // Flag indicating if shapes should be treated as closed. - float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy]. - struct NSVGpath* next; // Pointer to next path, or NULL if last element. + float* pts; /* Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... */ + int npts; /* Total number of bezier points. */ + char closed; /* Flag indicating if shapes should be treated as closed. */ + float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */ + struct NSVGpath* next; /* Pointer to next path, or NULL if last element. */ } NSVGpath; typedef struct NSVGshape { - char id[64]; // Optional 'id' attr of the shape or its group - NSVGpaint fill; // Fill paint - NSVGpaint stroke; // Stroke paint - float opacity; // Opacity of the shape. - float strokeWidth; // Stroke width (scaled). - float strokeDashOffset; // Stroke dash offset (scaled). - float strokeDashArray[8]; // Stroke dash array (scaled). - char strokeDashCount; // Number of dash values in dash array. - char strokeLineJoin; // Stroke join type. - char strokeLineCap; // Stroke cap type. - float miterLimit; // Miter limit - char fillRule; // Fill rule, see NSVGfillRule. - unsigned char flags; // Logical or of NSVG_FLAGS_* flags - float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy]. - NSVGpath* paths; // Linked list of paths in the image. - struct NSVGshape* next; // Pointer to next shape, or NULL if last element. + char id[64]; /* Optional 'id' attr of the shape or its group */ + NSVGpaint fill; /* Fill paint */ + NSVGpaint stroke; /* Stroke paint */ + float opacity; /* Opacity of the shape. */ + float strokeWidth; /* Stroke width (scaled). */ + float strokeDashOffset; /* Stroke dash offset (scaled). */ + float strokeDashArray[8]; /* Stroke dash array (scaled). */ + char strokeDashCount; /* Number of dash values in dash array. */ + char strokeLineJoin; /* Stroke join type. */ + char strokeLineCap; /* Stroke cap type. */ + float miterLimit; /* Miter limit */ + char fillRule; /* Fill rule, see NSVGfillRule. */ + unsigned char flags; /* Logical or of NSVG_FLAGS_* flags */ + float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */ + NSVGpath* paths; /* Linked list of paths in the image. */ + struct NSVGshape* next; /* Pointer to next shape, or NULL if last element. */ } NSVGshape; typedef struct NSVGimage { - float width; // Width of the image. - float height; // Height of the image. - NSVGshape* shapes; // Linked list of shapes in the image. + float width; /* Width of the image. */ + float height; /* Height of the image. */ + NSVGshape* shapes; /* Linked list of shapes in the image. */ } NSVGimage; -// Parses SVG file from a file, returns SVG image as paths. +/* Parses SVG file from a file, returns SVG image as paths. */ NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi); -// Parses SVG file from a null terminated string, returns SVG image as paths. -// Important note: changes the string. +/* Parses SVG file from a null terminated string, returns SVG image as paths. */ +/* Important note: changes the string. */ NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi); -// Deletes list of paths. +/* Deletes list of paths. */ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image); #ifdef __cplusplus } #endif -#endif // NANOSVG_H +#endif /* NANOSVG_H */ #ifdef NANOSVG_IMPLEMENTATION #include #include #include #define NSVG_PI (3.14159265358979323846264338327f) -#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs. +#define NSVG_KAPPA90 (0.5522847493f) /* Length proportional to radius of a cubic bezier handle for 90deg arcs. */ #define NSVG_ALIGN_MIN 0 #define NSVG_ALIGN_MID 1 #define NSVG_ALIGN_MAX 2 #define NSVG_ALIGN_NONE 0 @@ -228,18 +229,18 @@ #define NSVG_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0) #define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16)) #ifdef _MSC_VER - #pragma warning (disable: 4996) // Switch off security warnings - #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings + #pragma warning (disable: 4996) /* Switch off security warnings */ + #pragma warning (disable: 4100) /* Switch off unreferenced formal parameter warnings */ #ifdef __cplusplus #define NSVG_INLINE inline #else #define NSVG_INLINE #endif - #if !defined(strtoll) // old MSVC versions do not have strtoll() + #if !defined(strtoll) /* old MSVC versions do not have strtoll() */ #define strtoll _strtoi64 #endif #else #define NSVG_INLINE inline #endif @@ -257,21 +258,21 @@ static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } -// Simple XML parser +/* Simple XML parser */ #define NSVG_XML_TAG 1 #define NSVG_XML_CONTENT 2 #define NSVG_XML_MAX_ATTRIBS 256 static void nsvg__parseContent(char* s, void (*contentCb)(void* ud, const char* s), void* ud) { - // Trim start white spaces + /* Trim start white spaces */ while (*s && nsvg__isspace(*s)) s++; if (!*s) return; if (contentCb) (*contentCb)(ud, s); @@ -287,68 +288,68 @@ char* cbname; int start = 0; int end = 0; char quote; - // Skip white space after the '<' + /* Skip white space after the '<' */ while (*s && nsvg__isspace(*s)) s++; - // Check if the tag is end tag + /* Check if the tag is end tag */ if (*s == '/') { s++; end = 1; } else { start = 1; } - // Skip comments, data and preprocessor stuff. + /* Skip comments, data and preprocessor stuff. */ if (!*s || *s == '?' || *s == '!') return; - // Get tag name + /* Get tag name */ cbname = s; while (*s && !nsvg__isspace(*s)) s++; if (*s) { *s++ = '\0'; } - // Get attribs + /* Get attribs */ while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) { char* name = NULL; char* value = NULL; - // Skip white space before the attrib name + /* Skip white space before the attrib name */ while (*s && nsvg__isspace(*s)) s++; if (!*s) break; if (*s == '/') { end = 1; break; } name = s; - // Find end of the attrib name. + /* Find end of the attrib name. */ while (*s && !nsvg__isspace(*s) && *s != '=') s++; if (*s) { *s++ = '\0'; } - // Skip until the beginning of the value. + /* Skip until the beginning of the value. */ while (*s && *s != '\"' && *s != '\'') s++; if (!*s) break; quote = *s; s++; - // Store value and find the end of it. + /* Store value and find the end of it. */ value = s; while (*s && *s != quote) s++; if (*s) { *s++ = '\0'; } - // Store only well formed attributes + /* Store only well formed attributes */ if (name && value) { attr[nattr++] = name; attr[nattr++] = value; } } - // List terminator + /* List terminator */ attr[nattr++] = 0; attr[nattr++] = 0; - // Call callbacks. + /* Call callbacks. */ if (start && startelCb) (*startelCb)(ud, cbname, attr); if (end && endelCb) (*endelCb)(ud, cbname); } @@ -363,17 +364,17 @@ char* s = input; char* mark = s; int state = NSVG_XML_CONTENT; while (*s) { if (*s == '<' && state == NSVG_XML_CONTENT) { - // Start of a tag + /* Start of a tag */ *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); mark = s; state = NSVG_XML_TAG; } else if (*s == '>' && state == NSVG_XML_TAG) { - // Start of a content or new tag. + /* Start of a content or new tag. */ *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); nsvg__parseElement(mark, startelCb, endelCb, ud); mark = s; state = NSVG_XML_CONTENT; @@ -613,22 +614,22 @@ float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; - // Start the bounding box by end points + /* Start the bounding box by end points */ bounds[0] = nsvg__minf(v0[0], v3[0]); bounds[1] = nsvg__minf(v0[1], v3[1]); bounds[2] = nsvg__maxf(v0[0], v3[0]); bounds[3] = nsvg__maxf(v0[1], v3[1]); - // Bezier curve fits inside the convex hull of it's control points. - // If control points are inside the bounds, we're done. + /* Bezier curve fits inside the convex hull of it's control points. */ + /* If control points are inside the bounds, we're done. */ if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds)) return; - // Add bezier curve inflection points in X and Y. + /* Add bezier curve inflection points in X and Y. */ for (i = 0; i < 2; i++) { a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i]; b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i]; c = 3.0 * v1[i] - 3.0 * v0[i]; count = 0; @@ -666,11 +667,11 @@ p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); - // Init style + /* Init style */ nsvg__xformIdentity(p->attr[0].xform); memset(p->attr[0].id, 0, sizeof p->attr[0].id); p->attr[0].fillColor = NSVG_RGB(0,0,0); p->attr[0].strokeColor = NSVG_RGB(0,0,0); p->attr[0].opacity = 1; @@ -852,11 +853,11 @@ case NSVG_UNITS_PC: return c.value / 6.0f * p->dpi; case NSVG_UNITS_MM: return c.value / 25.4f * p->dpi; case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi; case NSVG_UNITS_IN: return c.value * p->dpi; case NSVG_UNITS_EM: return c.value * attr->fontSize; - case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; // x-height of Helvetica. + case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; /* x-height of Helvetica. */ case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length; default: return c.value; } return c.value; } @@ -886,11 +887,11 @@ int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; - // TODO: use ref to fill in all unset values too. + /* TODO: use ref to fill in all unset values too. */ ref = data; refIter = 0; while (ref != NULL) { NSVGgradientData* nextRef = NULL; if (stops == NULL && ref->stops != NULL) { @@ -897,21 +898,21 @@ stops = ref->stops; nstops = ref->nstops; break; } nextRef = nsvg__findGradientData(p, ref->ref); - if (nextRef == ref) break; // prevent infite loops on malformed data + if (nextRef == ref) break; /* prevent infite loops on malformed data */ ref = nextRef; refIter++; - if (refIter > 32) break; // prevent infite loops on malformed data + if (refIter > 32) break; /* prevent infite loops on malformed data */ } if (stops == NULL) return NULL; grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1)); if (grad == NULL) return NULL; - // The shape width and height. + /* The shape width and height. */ if (data->units == NSVG_OBJECT_SPACE) { ox = localBounds[0]; oy = localBounds[1]; sw = localBounds[2] - localBounds[0]; sh = localBounds[3] - localBounds[1]; @@ -927,11 +928,11 @@ float x1, y1, x2, y2, dx, dy; x1 = nsvg__convertToPixels(p, data->linear.x1, ox, sw); y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh); x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw); y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh); - // Calculate transform aligned to the line + /* Calculate transform aligned to the line */ dx = x2 - x1; dy = y2 - y1; grad->xform[0] = dy; grad->xform[1] = -dx; grad->xform[2] = dx; grad->xform[3] = dy; grad->xform[4] = x1; grad->xform[5] = y1; @@ -940,11 +941,11 @@ cx = nsvg__convertToPixels(p, data->radial.cx, ox, sw); cy = nsvg__convertToPixels(p, data->radial.cy, oy, sh); fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw); fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh); r = nsvg__convertToPixels(p, data->radial.r, 0, sl); - // Calculate transform aligned to the circle + /* Calculate transform aligned to the circle */ grad->xform[0] = r; grad->xform[1] = 0; grad->xform[2] = 0; grad->xform[3] = r; grad->xform[4] = cx; grad->xform[5] = cy; grad->fx = fx / r; grad->fy = fy / r; @@ -1028,11 +1029,11 @@ shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; - // Calculate shape bounds + /* Calculate shape bounds */ shape->bounds[0] = shape->paths->bounds[0]; shape->bounds[1] = shape->paths->bounds[1]; shape->bounds[2] = shape->paths->bounds[2]; shape->bounds[3] = shape->paths->bounds[3]; for (path = shape->paths->next; path != NULL; path = path->next) { @@ -1040,11 +1041,11 @@ shape->bounds[1] = nsvg__minf(shape->bounds[1], path->bounds[1]); shape->bounds[2] = nsvg__maxf(shape->bounds[2], path->bounds[2]); shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]); } - // Set fill + /* Set fill */ if (attr->hasFill == 0) { shape->fill.type = NSVG_PAINT_NONE; } else if (attr->hasFill == 1) { shape->fill.type = NSVG_PAINT_COLOR; shape->fill.color = attr->fillColor; @@ -1057,11 +1058,11 @@ if (shape->fill.gradient == NULL) { shape->fill.type = NSVG_PAINT_NONE; } } - // Set stroke + /* Set stroke */ if (attr->hasStroke == 0) { shape->stroke.type = NSVG_PAINT_NONE; } else if (attr->hasStroke == 1) { shape->stroke.type = NSVG_PAINT_COLOR; shape->stroke.color = attr->strokeColor; @@ -1073,14 +1074,14 @@ shape->stroke.gradient = nsvg__createGradient(p, attr->strokeGradient, localBounds, &shape->stroke.type); if (shape->stroke.gradient == NULL) shape->stroke.type = NSVG_PAINT_NONE; } - // Set flags + /* Set flags */ shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00); - // Add to tail + /* Add to tail */ if (p->image->shapes == NULL) p->image->shapes = shape; else p->shapesTail->next = shape; p->shapesTail = shape; @@ -1103,11 +1104,11 @@ return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); - // Expect 1 + N*3 points (N = number of cubic bezier segments). + /* Expect 1 + N*3 points (N = number of cubic bezier segments). */ if ((p->npts % 3) != 1) return; path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath)); if (path == NULL) goto error; @@ -1116,15 +1117,15 @@ path->pts = (float*)NANOSVG_malloc(p->npts*2*sizeof(float)); if (path->pts == NULL) goto error; path->closed = closed; path->npts = p->npts; - // Transform path. + /* Transform path. */ for (i = 0; i < p->npts; ++i) nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform); - // Find bounds + /* Find bounds */ for (i = 0; i < path->npts-1; i += 3) { curve = &path->pts[i*2]; nsvg__curveBounds(bounds, curve); if (i == 0) { path->bounds[0] = bounds[0]; @@ -1149,11 +1150,11 @@ if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); } } -// We roll our own string to float because the std library one uses locale and messes things up. +/* We roll our own string to float because the std library one uses locale and messes things up. */ static double nsvg__atof(const char* s) { char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; @@ -1162,21 +1163,21 @@ #else long long intPart = 0, fracPart = 0; #endif char hasIntPart = 0, hasFracPart = 0; - // Parse optional sign + /* Parse optional sign */ if (*cur == '+') { cur++; } else if (*cur == '-') { sign = -1; cur++; } - // Parse integer part + /* Parse integer part */ if (nsvg__isdigit(*cur)) { - // Parse digit sequence + /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) intPart = strtol(cur, &end, 10); #else intPart = strtoll(cur, &end, 10); #endif @@ -1185,15 +1186,15 @@ hasIntPart = 1; cur = end; } } - // Parse fractional part. + /* Parse fractional part. */ if (*cur == '.') { - cur++; // Skip '.' + cur++; /* Skip '.' */ if (nsvg__isdigit(*cur)) { - // Parse digit sequence + /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) fracPart = strtol(cur, &end, 10); #else fracPart = strtoll(cur, &end, 10); #endif @@ -1203,19 +1204,19 @@ cur = end; } } } - // A valid number should have integer or fractional part. + /* A valid number should have integer or fractional part. */ if (!hasIntPart && !hasFracPart) return 0.0; - // Parse optional exponent + /* Parse optional exponent */ if (*cur == 'e' || *cur == 'E') { int expPart = 0; - cur++; // skip 'E' - expPart = strtol(cur, &end, 10); // Parse digit sequence with sign + cur++; /* skip 'E' */ + expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */ if (cur != end) { res *= pow(10.0, (double)expPart); } } @@ -1226,31 +1227,31 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size) { const int last = size-1; int i = 0; - // sign + /* sign */ if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } - // integer part + /* integer part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } if (*s == '.') { - // decimal point + /* decimal point */ if (i < last) it[i++] = *s; s++; - // fraction part + /* fraction part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } - // exponent + /* exponent */ if (*s == 'e' || *s == 'E') { if (i < last) it[i++] = *s; s++; if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; @@ -1267,17 +1268,17 @@ } static const char* nsvg__getNextPathItem(const char* s, char* it) { it[0] = '\0'; - // Skip white spaces and commas + /* Skip white spaces and commas */ while (*s && (nsvg__isspace(*s) || *s == ',')) s++; if (!*s) return s; if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) { s = nsvg__parseNumber(s, it, 64); } else { - // Parse command + /* Parse command */ it[0] = *s++; it[1] = '\0'; return s; } @@ -1286,12 +1287,12 @@ static unsigned int nsvg__parseColorHex(const char* str) { unsigned int c = 0, r = 0, g = 0, b = 0; int n = 0; - str++; // skip # - // Calculate number of characters. + str++; /* skip # */ + /* Calculate number of characters. */ while(str[n] && !nsvg__isspace(str[n])) n++; if (n == 6) { sscanf(str, "%x", &c); } else if (n == 3) { @@ -1541,14 +1542,14 @@ return NSVG_UNITS_USER; } static int nsvg__isCoordinate(const char* s) { - // optional sign + /* optional sign */ if (*s == '-' || *s == '+') s++; - // must have at least one digit + /* must have at least one digit */ return nsvg__isdigit(*s); } static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { @@ -1721,11 +1722,11 @@ } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; - str += 4; // "url("; + str += 4; /* "url("; */ if (*str == '#') str++; while (i < 63 && *str != ')') { id[i] = *str++; i++; @@ -1739,11 +1740,11 @@ return NSVG_CAP_BUTT; else if (strcmp(str, "round") == 0) return NSVG_CAP_ROUND; else if (strcmp(str, "square") == 0) return NSVG_CAP_SQUARE; - // TODO: handle inherit. + /* TODO: handle inherit. */ return NSVG_CAP_BUTT; } static char nsvg__parseLineJoin(const char* str) { @@ -1751,31 +1752,31 @@ return NSVG_JOIN_MITER; else if (strcmp(str, "round") == 0) return NSVG_JOIN_ROUND; else if (strcmp(str, "bevel") == 0) return NSVG_JOIN_BEVEL; - // TODO: handle inherit. + /* TODO: handle inherit. */ return NSVG_JOIN_MITER; } static char nsvg__parseFillRule(const char* str) { if (strcmp(str, "nonzero") == 0) return NSVG_FILLRULE_NONZERO; else if (strcmp(str, "evenodd") == 0) return NSVG_FILLRULE_EVENODD; - // TODO: handle inherit. + /* TODO: handle inherit. */ return NSVG_FILLRULE_NONZERO; } static const char* nsvg__getNextDashItem(const char* s, char* it) { int n = 0; it[0] = '\0'; - // Skip white spaces and commas + /* Skip white spaces and commas */ while (*s && (nsvg__isspace(*s) || *s == ',')) s++; - // Advance until whitespace, comma or end. + /* Advance until whitespace, comma or end. */ while (*s && (!nsvg__isspace(*s) && *s != ',')) { if (n < 63) it[n++] = *s; s++; } @@ -1787,15 +1788,15 @@ { char item[64]; int count = 0, i; float sum = 0.0f; - // Handle "none" + /* Handle "none" */ if (str[0] == 'n') return 0; - // Parse dashes + /* Parse dashes */ while (*str) { str = nsvg__getNextDashItem(str, item); if (!*item) break; if (count < NSVG_MAX_DASHES) strokeDashArray[count++] = fabsf(nsvg__parseCoordinate(p, item, 0.0f, nsvg__actualLength(p))); @@ -1820,11 +1821,11 @@ if (strcmp(name, "style") == 0) { nsvg__parseStyle(p, value); } else if (strcmp(name, "display") == 0) { if (strcmp(value, "none") == 0) attr->visible &= ~NSVG_VIS_DISPLAY; - // Don't reset ->visible on display:inline, one display:none hides the whole subtree + /* Don't reset ->visible on display:inline, one display:none hides the whole subtree */ } else if (strcmp(name, "visibility") == 0) { if (strcmp(value, "hidden") == 0) { attr->visible &= ~NSVG_VIS_VISIBLE; } else if (strcmp(value, "visible") == 0) { @@ -1912,11 +1913,11 @@ str = start; while (str < end && *str != ':') ++str; val = str; - // Right Trim + /* Right Trim */ while (str > start && (*str == ':' || nsvg__isspace(*str))) --str; ++str; n = (int)(str - start); if (n > 511) n = 511; @@ -1937,17 +1938,17 @@ { const char* start; const char* end; while (*str) { - // Left Trim + /* Left Trim */ while(*str && nsvg__isspace(*str)) ++str; start = str; while(*str && *str != ';') ++str; end = str; - // Right Trim + /* Right Trim */ while (end > start && (*end == ';' || nsvg__isspace(*end))) --end; ++end; nsvg__parseNameValue(p, start, end); if (*str) ++str; @@ -2118,11 +2119,11 @@ cy = args[1]; x2 = args[2]; y2 = args[3]; } - // Convert to cubic bezier + /* Convert to cubic bezier */ cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); @@ -2151,11 +2152,11 @@ } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; - // Convert to cubix bezier + /* Convert to cubix bezier */ cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); @@ -2183,11 +2184,11 @@ return ((ux*vy < uy*vx) ? -1.0f : 1.0f) * acosf(r); } static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { - // Ported from canvg (https://code.google.com/p/canvg/) + /* Ported from canvg (https://code.google.com/p/canvg/) */ float rx, ry, rotx; float x1, y1, x2, y2, cx, cy, dx, dy, d; float x1p, y1p, cxp, cyp, s, sa, sb; float ux, uy, vx, vy, a1, da; float x, y, tanx, tany, a, px = 0, py = 0, ptanx = 0, ptany = 0, t[6]; @@ -2194,18 +2195,18 @@ float sinrx, cosrx; int fa, fs; int i, ndivs; float hda, kappa; - rx = fabsf(args[0]); // y radius - ry = fabsf(args[1]); // x radius - rotx = args[2] / 180.0f * NSVG_PI; // x rotation angle - fa = fabsf(args[3]) > 1e-6 ? 1 : 0; // Large arc - fs = fabsf(args[4]) > 1e-6 ? 1 : 0; // Sweep direction - x1 = *cpx; // start point + rx = fabsf(args[0]); /* y radius */ + ry = fabsf(args[1]); /* x radius */ + rotx = args[2] / 180.0f * NSVG_PI; /* x rotation angle */ + fa = fabsf(args[3]) > 1e-6 ? 1 : 0; /* Large arc */ + fs = fabsf(args[4]) > 1e-6 ? 1 : 0; /* Sweep direction */ + x1 = *cpx; /* start point */ y1 = *cpy; - if (rel) { // end point + if (rel) { /* end point */ x2 = *cpx + args[5]; y2 = *cpy + args[6]; } else { x2 = args[5]; y2 = args[6]; @@ -2213,32 +2214,32 @@ dx = x1 - x2; dy = y1 - y2; d = sqrtf(dx*dx + dy*dy); if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) { - // The arc degenerates to a line + /* The arc degenerates to a line */ nsvg__lineTo(p, x2, y2); *cpx = x2; *cpy = y2; return; } sinrx = sinf(rotx); cosrx = cosf(rotx); - // Convert to center point parameterization. - // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes - // 1) Compute x1', y1' + /* Convert to center point parameterization. */ + /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */ + /* 1) Compute x1', y1' */ x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f; y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f; d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry); if (d > 1) { d = sqrtf(d); rx *= d; ry *= d; } - // 2) Compute cx', cy' + /* 2) Compute cx', cy' */ s = 0.0f; sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p); sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p); if (sa < 0.0f) sa = 0.0f; if (sb > 0.0f) @@ -2246,37 +2247,37 @@ if (fa == fs) s = -s; cxp = s * rx * y1p / ry; cyp = s * -ry * x1p / rx; - // 3) Compute cx,cy from cx',cy' + /* 3) Compute cx,cy from cx',cy' */ cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp; cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp; - // 4) Calculate theta1, and delta theta. + /* 4) Calculate theta1, and delta theta. */ ux = (x1p - cxp) / rx; uy = (y1p - cyp) / ry; vx = (-x1p - cxp) / rx; vy = (-y1p - cyp) / ry; - a1 = nsvg__vecang(1.0f,0.0f, ux,uy); // Initial angle - da = nsvg__vecang(ux,uy, vx,vy); // Delta angle + a1 = nsvg__vecang(1.0f,0.0f, ux,uy); /* Initial angle */ + da = nsvg__vecang(ux,uy, vx,vy); /* Delta angle */ -// if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; -// if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; +/* if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; */ +/* if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; */ if (fs == 0 && da > 0) da -= 2 * NSVG_PI; else if (fs == 1 && da < 0) da += 2 * NSVG_PI; - // Approximate the arc using cubic spline segments. + /* Approximate the arc using cubic spline segments. */ t[0] = cosrx; t[1] = sinrx; t[2] = -sinrx; t[3] = cosrx; t[4] = cx; t[5] = cy; - // Split arc into max 90 degree segments. - // The loop assumes an iteration per end point (including start and end), this +1. + /* Split arc into max 90 degree segments. */ + /* The loop assumes an iteration per end point (including start and end), this +1. */ ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f); hda = (da / (float)ndivs) / 2.0f; kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda)); if (da < 0.0f) kappa = -kappa; @@ -2283,12 +2284,12 @@ for (i = 0; i <= ndivs; i++) { a = a1 + da * ((float)i/(float)ndivs); dx = cosf(a); dy = sinf(a); - nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); // position - nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); // tangent + nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); /* position */ + nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); /* tangent */ if (i > 0) nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y); px = x; py = y; ptanx = tanx; @@ -2342,12 +2343,12 @@ if (nargs >= rargs) { switch (cmd) { case 'm': case 'M': nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0); - // Moveto can be followed by multiple coordinate pairs, - // which should be treated as linetos. + /* Moveto can be followed by multiple coordinate pairs, */ + /* which should be treated as linetos. */ cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; initPoint = 1; break; @@ -2398,46 +2399,46 @@ nargs = 0; } } else { cmd = item[0]; if (cmd == 'M' || cmd == 'm') { - // Commit path. + /* Commit path. */ if (p->npts > 0) nsvg__addPath(p, closedFlag); - // Start new subpath. + /* Start new subpath. */ nsvg__resetPath(p); closedFlag = 0; nargs = 0; } else if (initPoint == 0) { - // Do not allow other commands until initial point has been set (moveTo called once). + /* Do not allow other commands until initial point has been set (moveTo called once). */ cmd = '\0'; } if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; - // Commit path. + /* Commit path. */ if (p->npts > 0) { - // Move current point to first point + /* Move current point to first point */ cpx = p->pts[0]; cpy = p->pts[1]; cpx2 = cpx; cpy2 = cpy; nsvg__addPath(p, closedFlag); } - // Start new subpath. + /* Start new subpath. */ nsvg__resetPath(p); nsvg__moveTo(p, cpx, cpy); closedFlag = 0; nargs = 0; } rargs = nsvg__getArgsPerElement(cmd); if (rargs == -1) { - // Command not recognized + /* Command not recognized */ cmd = '\0'; rargs = 0; } } } - // Commit path. + /* Commit path. */ if (p->npts) nsvg__addPath(p, closedFlag); } nsvg__addShape(p); @@ -2447,11 +2448,11 @@ { float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; - float rx = -1.0f; // marks not set + float rx = -1.0f; /* marks not set */ float ry = -1.0f; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { @@ -2478,11 +2479,11 @@ nsvg__moveTo(p, x, y); nsvg__lineTo(p, x+w, y); nsvg__lineTo(p, x+w, y+h); nsvg__lineTo(p, x, y+h); } else { - // Rounded rectangle + /* Rounded rectangle */ nsvg__moveTo(p, x+rx, y); nsvg__lineTo(p, x+w-rx, y); nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry); nsvg__lineTo(p, x+w, y+h-ry); nsvg__cubicBezTo(p, x+w, y+h-ry*(1-NSVG_KAPPA90), x+w-rx*(1-NSVG_KAPPA90), y+h, x+w-rx, y+h); @@ -2635,28 +2636,28 @@ p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "viewBox") == 0) { sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight); } else if (strcmp(attr[i], "preserveAspectRatio") == 0) { if (strstr(attr[i + 1], "none") != 0) { - // No uniform scaling + /* No uniform scaling */ p->alignType = NSVG_ALIGN_NONE; } else { - // Parse X align + /* Parse X align */ if (strstr(attr[i + 1], "xMin") != 0) p->alignX = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "xMid") != 0) p->alignX = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "xMax") != 0) p->alignX = NSVG_ALIGN_MAX; - // Parse X align + /* Parse X align */ if (strstr(attr[i + 1], "yMin") != 0) p->alignY = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "yMid") != 0) p->alignY = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "yMax") != 0) p->alignY = NSVG_ALIGN_MAX; - // Parse meet/slice + /* Parse meet/slice */ p->alignType = NSVG_ALIGN_MEET; if (strstr(attr[i + 1], "slice") != 0) p->alignType = NSVG_ALIGN_SLICE; } } @@ -2747,19 +2748,19 @@ for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } - // Add stop to the last gradient. + /* Add stop to the last gradient. */ grad = p->gradients; if (grad == NULL) return; grad->nstops++; grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops); if (grad->stops == NULL) return; - // Insert + /* Insert */ idx = grad->nstops-1; for (i = 0; i < grad->nstops-1; i++) { if (curAttr->stopOffset < grad->stops[i].offset) { idx = i; break; @@ -2779,11 +2780,11 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr) { NSVGparser* p = (NSVGparser*)ud; if (p->defsFlag) { - // Skip everything but gradients in defs + /* Skip everything but gradients in defs */ if (strcmp(el, "linearGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT); } else if (strcmp(el, "radialGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT); } else if (strcmp(el, "stop") == 0) { @@ -2794,11 +2795,11 @@ if (strcmp(el, "g") == 0) { nsvg__pushAttr(p); nsvg__parseAttribs(p, attr); } else if (strcmp(el, "path") == 0) { - if (p->pathFlag) // Do not allow nested paths. + if (p->pathFlag) /* Do not allow nested paths. */ return; nsvg__pushAttr(p); nsvg__parsePath(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "rect") == 0) { @@ -2947,11 +2948,11 @@ { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; - // mid + /* mid */ return (container - content) * 0.5f; } static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy) { @@ -2969,11 +2970,11 @@ NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; - // Guess image size if not set completely. + /* Guess image size if not set completely. */ nsvg__imageBounds(p, bounds); if (p->viewWidth == 0) { if (p->image->width > 0) { p->viewWidth = p->image->width; @@ -2997,27 +2998,27 @@ tx = -p->viewMinx; ty = -p->viewMiny; sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0; sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0; - // Unit scaling + /* Unit scaling */ us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f); - // Fix aspect ratio + /* Fix aspect ratio */ if (p->alignType == NSVG_ALIGN_MEET) { - // fit whole image into viewbox + /* fit whole image into viewbox */ sx = sy = nsvg__minf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } else if (p->alignType == NSVG_ALIGN_SLICE) { - // fill whole viewbox with image + /* fill whole viewbox with image */ sx = sy = nsvg__maxf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } - // Transform + /* Transform */ sx *= us; sy *= us; avgs = (sx+sy) / 2.0f; for (shape = p->image->shapes; shape != NULL; shape = shape->next) { shape->bounds[0] = (shape->bounds[0] + tx) * sx; @@ -3066,11 +3067,11 @@ } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); - // Scale to viewBox + /* Scale to viewBox */ nsvg__scaleToViewbox(p, units); ret = p->image; p->image = NULL; @@ -3093,11 +3094,11 @@ size = ftell(fp); fseek(fp, 0, SEEK_SET); data = (char*)NANOSVG_malloc(size+1); if (data == NULL) goto error; if (fread(data, 1, size, fp) != size) goto error; - data[size] = '\0'; // Must be null terminated. + data[size] = '\0'; /* Must be null terminated. */ fclose(fp); image = nsvgParse(data, units, dpi); NANOSVG_free(data); return image; Index: generic/nanosvgrast.h ================================================================== --- generic/nanosvgrast.h +++ generic/nanosvgrast.h @@ -57,35 +57,36 @@ unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ -// Allocated rasterizer context. +/* Allocated rasterizer context. */ NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void); -// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) -// r - pointer to rasterizer context -// image - pointer to image to rasterize -// tx,ty - image offset (applied after scaling) -// scale - image scale -// dst - pointer to destination image data, 4 bytes per pixel (RGBA) -// w - width of the image to render -// h - height of the image to render -// stride - number of bytes per scaleline in the destination buffer +/* Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) + * r - pointer to rasterizer context + * image - pointer to image to rasterize + * tx,ty - image offset (applied after scaling) + * scale - image scale + * dst - pointer to destination image data, 4 bytes per pixel (RGBA) + * w - width of the image to render + * h - height of the image to render + * stride - number of bytes per scaleline in the destination buffer NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r, NSVGimage* image, float tx, float ty, float scale, unsigned char* dst, int w, int h, int stride); + */ -// Deletes rasterizer context. +/* Deletes rasterizer context. */ NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*); #ifdef __cplusplus } #endif -#endif // NANOSVGRAST_H +#endif /* NANOSVGRAST_H */ #ifdef NANOSVGRAST_IMPLEMENTATION #include @@ -200,21 +201,21 @@ static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; - // If using existing chain, return the next page in chain + /* If using existing chain, return the next page in chain */ if (cur != NULL && cur->next != NULL) { return cur->next; } - // Alloc new page + /* Alloc new page */ newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage)); if (newp == NULL) return NULL; memset(newp, 0, sizeof(NSVGmemPage)); - // Add to linked list + /* Add to linked list */ if (cur != NULL) cur->next = newp; else r->pages = newp; @@ -300,11 +301,11 @@ static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; - // Skip horizontal edges + /* Skip horizontal edges */ if (y0 == y1) return; if (r->nedges+1 > r->cedges) { r->cedges = r->cedges > 0 ? r->cedges * 2 : 64; @@ -386,19 +387,19 @@ int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; - // Flatten path + /* Flatten path */ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0); } - // Close path + /* Close path */ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); - // Build edges + /* Build edges */ for (i = 0, j = r->npoints-1; i < r->npoints; j = i++) nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y); } } @@ -617,24 +618,24 @@ return divs; } static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth) { - int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); // Calculate divisions per half circle. + int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); /* Calculate divisions per half circle. */ NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0}; NSVGpoint* p0, *p1; int j, s, e; - // Build stroke edges + /* Build stroke edges */ if (closed) { - // Looping + /* Looping */ p0 = &points[npoints-1]; p1 = &points[0]; s = 0; e = npoints; } else { - // Add cap + /* Add cap */ p0 = &points[0]; p1 = &points[1]; s = 1; e = npoints-1; } @@ -642,11 +643,11 @@ if (closed) { nsvg__initClosed(&left, &right, p0, p1, lineWidth); firstLeft = left; firstRight = right; } else { - // Add cap + /* Add cap */ float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &left, &right, p0, dx, dy, lineWidth, 0); @@ -669,15 +670,15 @@ } p0 = p1++; } if (closed) { - // Loop it + /* Loop it */ nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y); nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y); } else { - // Add cap + /* Add cap */ float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); @@ -694,28 +695,28 @@ NSVGpoint* p0, *p1; p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (i = 0; i < r->npoints; i++) { - // Calculate segment direction and length + /* Calculate segment direction and length */ p0->dx = p1->x - p0->x; p0->dy = p1->y - p0->y; p0->len = nsvg__normalize(&p0->dx, &p0->dy); - // Advance + /* Advance */ p0 = p1++; } - // calculate joins + /* calculate joins */ p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (j = 0; j < r->npoints; j++) { float dlx0, dly0, dlx1, dly1, dmr2, cross; dlx0 = p0->dy; dly0 = -p0->dx; dlx1 = p1->dy; dly1 = -p1->dx; - // Calculate extrusions + /* Calculate extrusions */ p1->dmx = (dlx0 + dlx1) * 0.5f; p1->dmy = (dly0 + dly1) * 0.5f; dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy; if (dmr2 > 0.000001f) { float s2 = 1.0f / dmr2; @@ -724,19 +725,19 @@ } p1->dmx *= s2; p1->dmy *= s2; } - // Clear flags, but keep the corner. + /* Clear flags, but keep the corner. */ p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0; - // Keep track of left turns. + /* Keep track of left turns. */ cross = p1->dx * p0->dy - p0->dx * p1->dy; if (cross > 0.0f) p1->flags |= NSVG_PT_LEFT; - // Check to see if the corner needs to be beveled. + /* Check to see if the corner needs to be beveled. */ if (p1->flags & NSVG_PT_CORNER) { if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) { p1->flags |= NSVG_PT_BEVEL; } } @@ -754,11 +755,11 @@ int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { - // Flatten path + /* Flatten path */ r->npoints = 0; nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER); @@ -766,11 +767,11 @@ if (r->npoints < 2) continue; closed = path->closed; - // If the first and last points are the same, remove the last, mark as closed path. + /* If the first and last points are the same, remove the last, mark as closed path. */ p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) { r->npoints--; p0 = &r->points[r->npoints-1]; @@ -783,24 +784,24 @@ NSVGpoint cur; if (closed) nsvg__appendPathPoint(r, r->points[0]); - // Duplicate points -> points2. + /* Duplicate points -> points2. */ nsvg__duplicatePoints(r); r->npoints = 0; cur = r->points2[0]; nsvg__appendPathPoint(r, cur); - // Figure out dash offset. + /* Figure out dash offset. */ allDashLen = 0; for (j = 0; j < shape->strokeDashCount; j++) allDashLen += shape->strokeDashArray[j]; if (shape->strokeDashCount & 1) allDashLen *= 2.0f; - // Find location inside pattern + /* Find location inside pattern */ dashOffset = fmodf(shape->strokeDashOffset, allDashLen); if (dashOffset < 0.0f) dashOffset += allDashLen; while (dashOffset > shape->strokeDashArray[idash]) { @@ -813,26 +814,26 @@ float dx = r->points2[j].x - cur.x; float dy = r->points2[j].y - cur.y; float dist = sqrtf(dx*dx + dy*dy); if ((totalDist + dist) > dashLen) { - // Calculate intermediate point + /* Calculate intermediate point */ float d = (dashLen - totalDist) / dist; float x = cur.x + dx * d; float y = cur.y + dy * d; nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER); - // Stroke + /* Stroke */ if (r->npoints > 1 && dashState) { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } - // Advance dash pattern + /* Advance dash pattern */ dashState = !dashState; idash = (idash+1) % shape->strokeDashCount; dashLen = shape->strokeDashArray[idash] * scale; - // Restart + /* Restart */ cur.x = x; cur.y = y; cur.flags = NSVG_PT_CORNER; totalDist = 0.0f; r->npoints = 0; @@ -842,11 +843,11 @@ cur = r->points2[j]; nsvg__appendPathPoint(r, cur); j++; } } - // Stroke any leftover path + /* Stroke any leftover path */ if (r->npoints > 1 && dashState) nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } else { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, closed, lineJoin, lineCap, lineWidth); @@ -869,28 +870,28 @@ { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { - // Restore from freelist. + /* Restore from freelist. */ z = r->freelist; r->freelist = z->next; } else { - // Alloc new edge. + /* Alloc new edge. */ z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge)); if (z == NULL) return NULL; } dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); -// STBTT_assert(e->y0 <= start_point); - // round dx down to avoid going too far +/* STBTT_assert(e->y0 <= start_point); */ + /* round dx down to avoid going too far */ if (dxdy < 0) z->dx = (int)(-floorf(NSVG__FIX * -dxdy)); else z->dx = (int)floorf(NSVG__FIX * dxdy); z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0))); -// z->x -= off_x * FIX; +/* z->x -= off_x * FIX; */ z->ey = e->y1; z->next = 0; z->dir = e->dir; return z; @@ -908,56 +909,57 @@ int j = x1 >> NSVG__FIXSHIFT; if (i < *xmin) *xmin = i; if (j > *xmax) *xmax = j; if (i < len && j >= 0) { if (i == j) { - // x0,x1 are the same pixel, so compute combined coverage + /* x0,x1 are the same pixel, so compute combined coverage */ scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT)); } else { - if (i >= 0) // add antialiasing for x0 + if (i >= 0) /* add antialiasing for x0 */ scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT)); else - i = -1; // clip + i = -1; /* clip */ - if (j < len) // add antialiasing for x1 + if (j < len) /* add antialiasing for x1 */ scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT)); else - j = len; // clip + j = len; /* clip */ - for (++i; i < j; ++i) // fill pixels between x0 and x1 + for (++i; i < j; ++i) /* fill pixels between x0 and x1 */ scanline[i] = (unsigned char)(scanline[i] + maxWeight); } } } -// note: this routine clips fills that extend off the edges... ideally this -// wouldn't happen, but it could happen if the truetype glyph bounding boxes -// are wrong, or if the user supplies a too-small bitmap +/* note: this routine clips fills that extend off the edges... ideally this + * wouldn't happen, but it could happen if the truetype glyph bounding boxes + * are wrong, or if the user supplies a too-small bitmap + */ static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule) { - // non-zero winding fill + /* non-zero winding fill */ int x0 = 0, w = 0; if (fillRule == NSVG_FILLRULE_NONZERO) { - // Non-zero + /* Non-zero */ while (e != NULL) { if (w == 0) { - // if we're currently at zero, we need to record the edge start point + /* if we're currently at zero, we need to record the edge start point */ x0 = e->x; w += e->dir; } else { int x1 = e->x; w += e->dir; - // if we went to zero, we need to draw + /* if we went to zero, we need to draw */ if (w == 0) nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } } else if (fillRule == NSVG_FILLRULE_EVENODD) { - // Even-odd + /* Even-odd */ while (e != NULL) { if (w == 0) { - // if we're currently at zero, we need to record the edge start point + /* if we're currently at zero, we need to record the edge start point */ x0 = e->x; w = 1; } else { int x1 = e->x; w = 0; nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } @@ -1011,16 +1013,16 @@ for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; - // Premultiply + /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); - // Blend over + /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); @@ -1031,12 +1033,12 @@ cover++; dst += 4; } } else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) { - // TODO: spread modes. - // TODO: plenty of opportunities to optimize. + /* TODO: spread modes. */ + /* TODO: plenty of opportunities to optimize. */ float fx, fy, dx, gy; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; @@ -1054,16 +1056,16 @@ ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; - // Premultiply + /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); - // Blend over + /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); @@ -1075,13 +1077,13 @@ cover++; dst += 4; fx += dx; } } else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) { - // TODO: spread modes. - // TODO: plenty of opportunities to optimize. - // TODO: focus (fx,fy) + /* TODO: spread modes. */ + /* TODO: plenty of opportunities to optimize. */ + /* TODO: focus (fx,fy) */ float fx, fy, dx, gx, gy, gd; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; @@ -1101,16 +1103,16 @@ ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; - // Premultiply + /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); - // Blend over + /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); @@ -1129,37 +1131,37 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule) { NSVGactiveEdge *active = NULL; int y, s; int e = 0; - int maxWeight = (255 / NSVG__SUBSAMPLES); // weight per vertical scanline + int maxWeight = (255 / NSVG__SUBSAMPLES); /* weight per vertical scanline */ int xmin, xmax; for (y = 0; y < r->height; y++) { memset(r->scanline, 0, r->width); xmin = r->width; xmax = 0; for (s = 0; s < NSVG__SUBSAMPLES; ++s) { - // find center of pixel for this scanline + /* find center of pixel for this scanline */ float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f; NSVGactiveEdge **step = &active; - // update all active edges; - // remove all active edges that terminate before the center of this scanline + /* update all active edges; */ + /* remove all active edges that terminate before the center of this scanline */ while (*step) { NSVGactiveEdge *z = *step; if (z->ey <= scany) { - *step = z->next; // delete from list -// NSVG__assert(z->valid); + *step = z->next; /* delete from list */ +/* NSVG__assert(z->valid); */ nsvg__freeActive(r, z); } else { - z->x += z->dx; // advance to position for current scanline - step = &((*step)->next); // advance through list + z->x += z->dx; /* advance to position for current scanline */ + step = &((*step)->next); /* advance through list */ } } - // resort the list if needed + /* resort the list if needed */ for (;;) { int changed = 0; step = &active; while (*step && (*step)->next) { if ((*step)->x > (*step)->next->x) { @@ -1173,40 +1175,40 @@ step = &(*step)->next; } if (!changed) break; } - // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline + /* insert all edges that start before the center of this scanline -- omit ones that also end on this scanline */ while (e < r->nedges && r->edges[e].y0 <= scany) { if (r->edges[e].y1 > scany) { NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany); if (z == NULL) break; - // find insertion point + /* find insertion point */ if (active == NULL) { active = z; } else if (z->x < active->x) { - // insert at front + /* insert at front */ z->next = active; active = z; } else { - // find thing to insert AFTER + /* find thing to insert AFTER */ NSVGactiveEdge* p = active; while (p->next && p->next->x < z->x) p = p->next; - // at this point, p->next->x is NOT < z->x + /* at this point, p->next->x is NOT < z->x */ z->next = p->next; p->next = z; } } e++; } - // now process all active edges in non-zero fashion + /* now process all active edges in non-zero fashion */ if (active != NULL) nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule); } - // Blit + /* Blit */ if (xmin < 0) xmin = 0; if (xmax > r->width-1) xmax = r->width-1; if (xmin <= xmax) { nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache); } @@ -1216,11 +1218,11 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int stride) { int x,y; - // Unpremultiply + /* Unpremultiply */ for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = row[0], g = row[1], b = row[2], a = row[3]; if (a != 0) { @@ -1230,11 +1232,11 @@ } row += 4; } } - // Defringe + /* Defringe */ for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = 0, g = 0, b = 0, a = row[3], n = 0; if (a == 0) { @@ -1409,23 +1411,23 @@ r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); - // Scale and translate edges + /* Scale and translate edges */ for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } - // Rasterize edges + /* Rasterize edges */ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); - // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule + /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */ nsvg__initPaint(&cache, &shape->fill, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule); } if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) { @@ -1433,25 +1435,25 @@ r->freelist = NULL; r->nedges = 0; nsvg__flattenShapeStroke(r, shape, scale); -// dumpEdges(r, "edge.svg"); +/* dumpEdges(r, "edge.svg"); */ - // Scale and translate edges + /* Scale and translate edges */ for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } - // Rasterize edges + /* Rasterize edges */ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); - // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule + /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */ nsvg__initPaint(&cache, &shape->stroke, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO); } } Index: generic/tkCanvUtil.c ================================================================== --- generic/tkCanvUtil.c +++ generic/tkCanvUtil.c @@ -772,11 +772,11 @@ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* - * Backward compatability hack. + * Backward compatibility hack. */ if (strncmp(value, "bezier", length) == 0) { smooth = &tkBezierSmoothMethod; } Index: generic/tkDecls.h ================================================================== --- generic/tkDecls.h +++ generic/tkDecls.h @@ -1793,7 +1793,9 @@ #undef Tk_CreateOldPhotoImageFormat #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT + +#undef TkUnusedStubEntry #endif /* _TKDECLS */ Index: generic/tkImgPhoto.c ================================================================== --- generic/tkImgPhoto.c +++ generic/tkImgPhoto.c @@ -4080,11 +4080,11 @@ /* *---------------------------------------------------------------------- * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * - * These backward-compatability functions just exist to fill slots in stubs + * These backward-compatibility functions just exist to fill slots in stubs * table. For the behaviour of *_NoComposite, refer to the corresponding * function without the extra suffix, except that the compositing rule is * always "overlay" and the function always panics on memory-allocation * failure. * @@ -4121,11 +4121,11 @@ *---------------------------------------------------------------------- * * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * - * Backward compatability functions for preserving the old behaviour (i.e. + * Backward compatibility functions for preserving the old behaviour (i.e. * panic on memory allocation failure) so that extensions do not need to be * significantly updated to take account of TIP #116. These call the new * interface (i.e. the interface without the extra suffix), but panic if an * error condition is returned. * Index: generic/ttk/ttkButton.c ================================================================== --- generic/ttk/ttkButton.c +++ generic/ttk/ttkButton.c @@ -271,15 +271,16 @@ WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static const Ttk_Ensemble LabelCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec LabelWidgetSpec = { @@ -376,16 +377,17 @@ } return Tcl_EvalObjEx(interp, buttonPtr->button.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble ButtonCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, - { "invoke", ButtonInvokeCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, + { "invoke", ButtonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec ButtonWidgetSpec = { @@ -583,16 +585,17 @@ return Tcl_EvalObjEx(interp, checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble CheckbuttonCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, - { "invoke", CheckbuttonInvokeCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, + { "invoke", CheckbuttonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, /* MISSING: select, deselect, toggle */ { 0,0,0 } }; static const WidgetSpec CheckbuttonWidgetSpec = @@ -759,16 +762,17 @@ return Tcl_EvalObjEx(interp, radioPtr->radiobutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble RadiobuttonCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, - { "invoke", RadiobuttonInvokeCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, + { "invoke", RadiobuttonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, /* MISSING: select, deselect */ { 0,0,0 } }; static const WidgetSpec RadiobuttonWidgetSpec = @@ -833,10 +837,11 @@ { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec MenubuttonWidgetSpec = { Index: generic/ttk/ttkEntry.c ================================================================== --- generic/ttk/ttkEntry.c +++ generic/ttk/ttkEntry.c @@ -1743,10 +1743,11 @@ { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; @@ -1911,12 +1912,13 @@ { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, - { "state", TtkWidgetStateCommand,0 }, { "set", EntrySetCommand,0 }, + { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; @@ -2023,12 +2025,13 @@ { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, - { "state", TtkWidgetStateCommand,0 }, { "set", EntrySetCommand,0 }, + { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; Index: generic/ttk/ttkFrame.c ================================================================== --- generic/ttk/ttkFrame.c +++ generic/ttk/ttkFrame.c @@ -46,15 +46,16 @@ WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble FrameCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, - { "identify", TtkWidgetIdentifyCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * FrameMargins -- Index: generic/ttk/ttkNotebook.c ================================================================== --- generic/ttk/ttkNotebook.c +++ generic/ttk/ttkNotebook.c @@ -1240,20 +1240,21 @@ /* Subcommand table: */ static const Ttk_Ensemble NotebookCommands[] = { { "add", NotebookAddCommand,0 }, - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "forget", NotebookForgetCommand,0 }, { "hide", NotebookHideCommand,0 }, { "identify", NotebookIdentifyCommand,0 }, { "index", NotebookIndexCommand,0 }, { "insert", NotebookInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "select", NotebookSelectCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { "tab", NotebookTabCommand,0 }, { "tabs", NotebookTabsCommand,0 }, { 0,0,0 } }; Index: generic/ttk/ttkPanedwindow.c ================================================================== --- generic/ttk/ttkPanedwindow.c +++ generic/ttk/ttkPanedwindow.c @@ -880,20 +880,21 @@ return TCL_OK; } static const Ttk_Ensemble PanedCommands[] = { { "add", PanedAddCommand,0 }, - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "forget", PanedForgetCommand,0 }, { "identify", PanedIdentifyCommand,0 }, { "insert", PanedInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "pane", PanedPaneCommand,0 }, { "panes", PanedPanesCommand,0 }, { "sashpos", PanedSashposCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /*------------------------------------------------------------------------ * +++ Widget specification. Index: generic/ttk/ttkProgress.c ================================================================== --- generic/ttk/ttkProgress.c +++ generic/ttk/ttkProgress.c @@ -516,18 +516,19 @@ return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } static const Ttk_Ensemble ProgressbarCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "start", ProgressbarStartCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "step", ProgressbarStepCommand,0 }, { "stop", ProgressbarStopCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * Widget specification: Index: generic/ttk/ttkScale.c ================================================================== --- generic/ttk/ttkScale.c +++ generic/ttk/ttkScale.c @@ -481,18 +481,19 @@ } return pt; } static const Ttk_Ensemble ScaleCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, - { "state", TtkWidgetStateCommand,0 }, - { "instate", TtkWidgetInstateCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, + { "coords", ScaleCoordsCommand,0 }, + { "get", ScaleGetCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, + { "instate", TtkWidgetInstateCommand,0 }, { "set", ScaleSetCommand,0 }, - { "get", ScaleGetCommand,0 }, - { "coords", ScaleCoordsCommand,0 }, + { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec ScaleWidgetSpec = { Index: generic/ttk/ttkScrollbar.c ================================================================== --- generic/ttk/ttkScrollbar.c +++ generic/ttk/ttkScrollbar.c @@ -280,19 +280,20 @@ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction)); return TCL_OK; } static const Ttk_Ensemble ScrollbarCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "delta", ScrollbarDeltaCommand,0 }, { "fraction", ScrollbarFractionCommand,0 }, { "get", ScrollbarGetCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "set", ScrollbarSetCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /*------------------------------------------------------------------------ * +++ Widget specification. Index: generic/ttk/ttkSeparator.c ================================================================== --- generic/ttk/ttkSeparator.c +++ generic/ttk/ttkSeparator.c @@ -46,15 +46,16 @@ /* * Widget commands: */ static const Ttk_Ensemble SeparatorCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * Widget specification: @@ -87,15 +88,16 @@ WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble SizegripCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec SizegripWidgetSpec = { Index: generic/ttk/ttkSquare.c ================================================================== --- generic/ttk/ttkSquare.c +++ generic/ttk/ttkSquare.c @@ -127,15 +127,16 @@ * subcommands are listed here. Ttk provides default implementations * that are sufficient for our needs. */ static const Ttk_Ensemble SquareCommands[] = { - { "configure", TtkWidgetConfigureCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, + { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * The Widget specification structure holds all the implementation Index: generic/ttk/ttkTheme.c ================================================================== --- generic/ttk/ttkTheme.c +++ generic/ttk/ttkTheme.c @@ -93,11 +93,11 @@ return 0; } /* * Ttk_StyleDefault -- - * Look up default resource setting the in the specified style. + * Look up default resource setting in the specified style. */ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) { while (style) { Tcl_HashEntry *entryPtr = @@ -1260,14 +1260,14 @@ } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); - if (objc == 3) { /* style default $styleName */ + if (objc == 3) { /* style configure $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable)); return TCL_OK; - } else if (objc == 4) { /* style default $styleName -option */ + } else if (objc == 4) { /* style configure $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName); if (entryPtr) { Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr)); @@ -1313,13 +1313,11 @@ Tcl_WrongNumArgs(interp, 2, objv, "style -option ?state? ?default?"); return TCL_ERROR; } style = Ttk_GetStyle(theme, Tcl_GetString(objv[2])); - if (!style) { - return TCL_ERROR; - } + optionName = Tcl_GetString(objv[3]); if (objc >= 5) { Ttk_StateSpec stateSpec; /* @@@ SB: Ttk_GetStateFromObj(); 'offbits' spec is ignored */ @@ -1609,10 +1607,35 @@ Ttk_RegisterLayoutTemplate(theme, layoutName, layoutTemplate); ThemeChanged(pkgPtr); } return TCL_OK; } + +/* + style theme styles ?$theme? -- + * Return list of styles available in $theme. + * Use the current theme if $theme is omitted. + */ +static int StyleThemeStylesCmd( + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) +{ + Ttk_Theme themePtr; + + if (objc < 3 || objc > 4) { + Tcl_WrongNumArgs(interp, 3, objv, "?theme?"); + return TCL_ERROR; + } + + if (objc == 3) { + themePtr = Ttk_GetCurrentTheme(interp); + } else { + themePtr = Ttk_GetTheme(interp, Tcl_GetString(objv[3])); + } + if (!themePtr) + return TCL_ERROR; + + return TtkEnumerateHashTable(interp, &themePtr->styleTable); +} /* + style theme use $theme -- * Sets the current theme to $theme */ static int @@ -1649,10 +1672,11 @@ static const Ttk_Ensemble StyleThemeEnsemble[] = { { "create", StyleThemeCreateCmd, 0 }, { "names", StyleThemeNamesCmd, 0 }, { "settings", StyleThemeSettingsCmd, 0 }, + { "styles", StyleThemeStylesCmd, 0 }, { "use", StyleThemeUseCmd, 0 }, { NULL, 0, 0 } }; static const Ttk_Ensemble StyleElementEnsemble[] = { Index: generic/ttk/ttkTreeview.c ================================================================== --- generic/ttk/ttkTreeview.c +++ generic/ttk/ttkTreeview.c @@ -3293,21 +3293,22 @@ { "exists", TreeviewExistsCommand,0 }, { "focus", TreeviewFocusCommand,0 }, { "heading", TreeviewHeadingCommand,0 }, { "identify", TreeviewIdentifyCommand,0 }, { "index", TreeviewIndexCommand,0 }, - { "instate", TtkWidgetInstateCommand,0 }, { "insert", TreeviewInsertCommand,0 }, + { "instate", TtkWidgetInstateCommand,0 }, { "item", TreeviewItemCommand,0 }, { "move", TreeviewMoveCommand,0 }, { "next", TreeviewNextCommand,0 }, { "parent", TreeviewParentCommand,0 }, { "prev", TreeviewPrevCommand,0 }, { "see", TreeviewSeeCommand,0 }, { "selection" , TreeviewSelectionCommand,0 }, { "set", TreeviewSetCommand,0 }, { "state", TtkWidgetStateCommand,0 }, + { "style", TtkWidgetStyleCommand,0 }, { "tag", 0,TreeviewTagCommands }, { "xview", TreeviewXViewCommand,0 }, { "yview", TreeviewYViewCommand,0 }, { 0,0,0 } }; Index: generic/ttk/ttkWidget.c ================================================================== --- generic/ttk/ttkWidget.c +++ generic/ttk/ttkWidget.c @@ -3,11 +3,11 @@ * * Core widget utilities. */ #include "tkInt.h" -#include "ttkTheme.h" +#include "ttkThemeInt.h" #include "ttkWidget.h" #ifdef MAC_OSX_TK #define TK_NO_DOUBLE_BUFFERING 1 #endif @@ -792,9 +792,29 @@ if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1)); } + return TCL_OK; +} + +/* $w style + * Return the style currently applied to the widget. + */ + +int TtkWidgetStyleCommand( + void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) +{ + WidgetCore *corePtr = (WidgetCore *)recordPtr; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 2, objv, ""); + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, Tcl_NewStringObj( + Ttk_StyleName(Ttk_LayoutStyle(corePtr->layout)), -1)); + return TCL_OK; } /*EOF*/ Index: generic/ttk/ttkWidget.h ================================================================== --- generic/ttk/ttkWidget.h +++ generic/ttk/ttkWidget.h @@ -87,19 +87,21 @@ MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask); /* Common widget commands: */ +MODULE_SCOPE int TtkWidgetCgetCommand( + void *,Tcl_Interp *, int, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetConfigureCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); -MODULE_SCOPE int TtkWidgetCgetCommand( +MODULE_SCOPE int TtkWidgetIdentifyCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetInstateCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetStateCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); -MODULE_SCOPE int TtkWidgetIdentifyCommand( +MODULE_SCOPE int TtkWidgetStyleCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); /* Widget constructor: */ MODULE_SCOPE int TtkWidgetConstructorObjCmd( Index: macosx/tkMacOSXDialog.c ================================================================== --- macosx/tkMacOSXDialog.c +++ macosx/tkMacOSXDialog.c @@ -21,11 +21,11 @@ #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 -#define modalOther -1 // indicates that the -command option was used. +#define modalOther -1 // indicates that the -command option was used. #define modalError -2 /* * Vars for filtering in "open file" and "save file" dialogs. */ @@ -373,11 +373,11 @@ } else { modalReturnCode = [NSApp runModalForWindow:panel]; } } else { - /* + /* * For the standalone file dialog, completion handlers do not work * at all on macOS 10.14 and earlier. */ if ([NSApp macOSVersion] > 101400) { Index: macosx/tkMacOSXWm.c ================================================================== --- macosx/tkMacOSXWm.c +++ macosx/tkMacOSXWm.c @@ -1801,11 +1801,11 @@ } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* - * On the Macintosh all of this is just an excercise in compatability as + * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ return TCL_OK; } @@ -5182,11 +5182,11 @@ topPtr->wmInfoPtr->cmapList = newPtr; topPtr->wmInfoPtr->cmapCount = count+1; /* - * On the Macintosh all of this is just an excercise in compatability as + * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ } /* Index: tests/ttk/checkbutton.test ================================================================== --- tests/ttk/checkbutton.test +++ tests/ttk/checkbutton.test @@ -69,6 +69,20 @@ .cbev invoke } -cleanup { destroy .cbev } -result {} +test checkbutton-2.1 "style command" -body { + ttk::checkbutton .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TCheckbutton TCheckbutton} +test checkbutton-2.2 "style command" -body { + ttk::style configure customStyle.TCheckbutton + ttk::checkbutton .w -style customStyle.TCheckbutton + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TCheckbutton customStyle.TCheckbutton TCheckbutton} + tcltest::cleanupTests Index: tests/ttk/combobox.test ================================================================== --- tests/ttk/combobox.test +++ tests/ttk/combobox.test @@ -84,6 +84,20 @@ set result } -result [list Start 0 {} Post 1 {} Select 0 b Event 0 b] -cleanup { destroy .cb } +test combobox-4.1 "style command" -body { + ttk::combobox .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TCombobox TCombobox} +test combobox-4.2 "style command" -body { + ttk::style configure customStyle.TCombobox + ttk::combobox .w -style customStyle.TCombobox + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TCombobox customStyle.TCombobox TCombobox} + tcltest::cleanupTests Index: tests/ttk/entry.test ================================================================== --- tests/ttk/entry.test +++ tests/ttk/entry.test @@ -367,6 +367,20 @@ lappend res [.e state] } -result {invalid invalid} -cleanup { destroy .e } +test entry-12.1 "style command" -body { + ttk::entry .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TEntry TEntry} +test entry-12.2 "style command" -body { + ttk::style configure customStyle.TEntry + ttk::entry .w -style customStyle.TEntry + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TEntry customStyle.TEntry TEntry} + tcltest::cleanupTests Index: tests/ttk/labelframe.test ================================================================== --- tests/ttk/labelframe.test +++ tests/ttk/labelframe.test @@ -126,6 +126,20 @@ winfo children .t } -cleanup { destroy .t } -result [list .t.x1 .t.lf .t.lb .t.x2] +test labelframe-7.1 "style command" -body { + ttk::labelframe .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TLabelframe TLabelframe} +test labelframe-7.2 "style command" -body { + ttk::style configure customStyle.TLabelframe + ttk::labelframe .w -style customStyle.TLabelframe + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TLabelframe customStyle.TLabelframe TLabelframe} + tcltest::cleanupTests Index: tests/ttk/notebook.test ================================================================== --- tests/ttk/notebook.test +++ tests/ttk/notebook.test @@ -510,6 +510,20 @@ destroy .nb update set ::history } -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3] +test notebook-8.1 "style command" -body { + ttk::notebook .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TNotebook TNotebook} +test notebook-8.2 "style command" -body { + ttk::style configure customStyle.TNotebook + ttk::notebook .w -style customStyle.TNotebook + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TNotebook customStyle.TNotebook TNotebook} + tcltest::cleanupTests Index: tests/ttk/panedwindow.test ================================================================== --- tests/ttk/panedwindow.test +++ tests/ttk/panedwindow.test @@ -287,6 +287,24 @@ list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] } -result [list 100 155 100] test paned-propagation-cleanup "Clean up." -body { destroy .pw } +test panedwindow-6.1 "style command" -body { + # Contrary to ttk::scrollbar, ttk::progressbar and ttk::scale, + # ttk::panedwindow has same style TPanedwindow whatever -orient is + ttk::panedwindow .wv ; # default is -orient vertical + ttk::panedwindow .wh -orient horizontal + list [.wv cget -style] [.wv style] [winfo class .wv]\ + [.wh cget -style] [.wh style] [winfo class .wh] +} -cleanup { + destroy .wv .wh +} -result {{} TPanedwindow TPanedwindow {} TPanedwindow TPanedwindow} +test panedwindow-6.2 "style command" -body { + ttk::style configure customStyle.TPanedwindow + ttk::panedwindow .w -style customStyle.TPanedwindow + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TPanedwindow customStyle.TPanedwindow TPanedwindow} + tcltest::cleanupTests Index: tests/ttk/progressbar.test ================================================================== --- tests/ttk/progressbar.test +++ tests/ttk/progressbar.test @@ -120,6 +120,22 @@ } -cleanup { unset res thefont destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} +test progressbar-4.1 "style command" -body { + ttk::progressbar .wh ; # default is -orient horizontal + ttk::progressbar .wv -orient vertical + list [.wh cget -style] [.wh style] [winfo class .wh]\ + [.wv cget -style] [.wv style] [winfo class .wv] +} -cleanup { + destroy .wh .wv +} -result {{} Horizontal.TProgressbar TProgressbar {} Vertical.TProgressbar TProgressbar} +test progressbar-4.2 "style command" -body { + ttk::style configure customStyle.Vertical.TProgressbar + ttk::progressbar .w -orient vertical -style customStyle.Vertical.TProgressbar + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Vertical.TProgressbar Vertical.customStyle.Vertical.TProgressbar TProgressbar} + tcltest::cleanupTests Index: tests/ttk/radiobutton.test ================================================================== --- tests/ttk/radiobutton.test +++ tests/ttk/radiobutton.test @@ -44,6 +44,20 @@ test radiobutton-1.8 "Reset radiobutton variable" -body { set ::choice 2 list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate] } -result {1 0 0} +test radiobutton-2.1 "style command" -body { + ttk::radiobutton .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TRadiobutton TRadiobutton} +test radiobutton-2.2 "style command" -body { + ttk::style configure customStyle.TRadiobutton + ttk::radiobutton .w -style customStyle.TRadiobutton + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TRadiobutton customStyle.TRadiobutton TRadiobutton} + tcltest::cleanupTests ADDED tests/ttk/scale.test Index: tests/ttk/scale.test ================================================================== --- /dev/null +++ tests/ttk/scale.test @@ -0,0 +1,53 @@ +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* +loadTestedCommands + +test scale-1.0 "Self-destruction" -body { + trace variable v w { destroy .s ;# } + ttk::scale .s -variable v + pack .s ; update + .s set 1 ; update +} -returnCodes error -match glob -result "*" + +test scale-2.1 "-state option" -setup { + ttk::scale .s + set res "" +} -body { + # defaults + lappend res [.s instate disabled] [.s cget -state] + # set -state: instate returns accordingly + .s configure -state disabled + lappend res [.s instate disabled] [.s cget -state] + # back to normal + .s configure -state normal + lappend res [.s instate disabled] [.s cget -state] + # use state command: -state does NOT reflect it + .s state disabled + lappend res [.s instate disabled] [.s cget -state] + # further use state command + .s state readonly + lappend res [.s state] [.s cget -state] +} -cleanup { + destroy .s + unset -nocomplain res +} -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal} + +test scale-3.1 "style command" -body { + ttk::scale .wh ; # default is -orient horizontal + ttk::scale .wv -orient vertical + list [.wh cget -style] [.wh style] [winfo class .wh] \ + [.wv cget -style] [.wv style] [winfo class .wv] +} -cleanup { + destroy .wh .wv +} -result {{} Horizontal.TScale TScale {} Vertical.TScale TScale} +test scale-3.2 "style command" -body { + ttk::style configure customStyle.Vertical.TScale + ttk::scale .w -orient vertical -style customStyle.Vertical.TScale + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Vertical.TScale Vertical.customStyle.Vertical.TScale TScale} + +tcltest::cleanupTests + Index: tests/ttk/scrollbar.test ================================================================== --- tests/ttk/scrollbar.test +++ tests/ttk/scrollbar.test @@ -113,41 +113,23 @@ .t index @0,0 } -cleanup { destroy .t .s } -result {1.4} -# -# Scale tests: -# - -test scale-1.0 "Self-destruction" -body { - trace variable v w { destroy .s ;# } - ttk::scale .s -variable v - pack .s ; update - .s set 1 ; update -} -returnCodes error -match glob -result "*" - -test scale-2.1 "-state option" -setup { - ttk::scale .s - set res "" -} -body { - # defaults - lappend res [.s instate disabled] [.s cget -state] - # set -state: instate returns accordingly - .s configure -state disabled - lappend res [.s instate disabled] [.s cget -state] - # back to normal - .s configure -state normal - lappend res [.s instate disabled] [.s cget -state] - # use state command: -state does NOT reflect it - .s state disabled - lappend res [.s instate disabled] [.s cget -state] - # further use state command - .s state readonly - lappend res [.s state] [.s cget -state] +test scrollbar-11.1 "style command" -body { + ttk::scrollbar .wv ; # default is -orient vertical + ttk::scrollbar .wh -orient horizontal + list [.wv cget -style] [.wv style] [winfo class .wv] \ + [.wh cget -style] [.wh style] [winfo class .wh] +} -cleanup { + destroy .wv .wh +} -result {{} Vertical.TScrollbar TScrollbar {} Horizontal.TScrollbar TScrollbar} +test scrollbar-11.2 "style command" -body { + ttk::style configure customStyle.Horizontal.TScrollbar + ttk::scrollbar .w -orient horizontal -style customStyle.Horizontal.TScrollbar + list [.w cget -style] [.w style] [winfo class .w] } -cleanup { - destroy .s - unset -nocomplain res -} -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal} + destroy .w +} -result {customStyle.Horizontal.TScrollbar Horizontal.customStyle.Horizontal.TScrollbar TScrollbar} tcltest::cleanupTests Index: tests/ttk/spinbox.test ================================================================== --- tests/ttk/spinbox.test +++ tests/ttk/spinbox.test @@ -356,10 +356,24 @@ event generate .sb <> ; lappend result [.sb get] } -result [list asdfasdf 000 asdfasdf 000] -cleanup { destroy .sb } +test spinbox-5.1 "style command" -body { + ttk::spinbox .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TSpinbox TSpinbox} +test spinbox-5.2 "style command" -body { + ttk::style configure customStyle.TSpinbox + ttk::spinbox .w -style customStyle.TSpinbox + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TSpinbox customStyle.TSpinbox TSpinbox} + tcltest::cleanupTests # Local variables: # mode: tcl # End: Index: tests/ttk/treeview.test ================================================================== --- tests/ttk/treeview.test +++ tests/ttk/treeview.test @@ -833,6 +833,20 @@ [expr {[winfo width .tv] < $origTreeWidth}] } -cleanup { destroy .tv } -result {60 50 60 50 60 50 1} +test treeview-11.1 "style command" -body { + ttk::treeview .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} Treeview Treeview} +test treeview-11.2 "style command" -body { + ttk::style configure customStyle.Treeview + ttk::treeview .w -style customStyle.Treeview + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Treeview customStyle.Treeview Treeview} + tcltest::cleanupTests Index: tests/ttk/ttk.test ================================================================== --- tests/ttk/ttk.test +++ tests/ttk/ttk.test @@ -652,10 +652,21 @@ } -returnCodes error -result [wrong#args theme ?element?] test ttk-ensemble-5 "style element create: valid" -body { ttk::style element create plain.background from default } -returnCodes 0 -result "" + +test ttk-16.1 {ttk::style theme styles - no such theme} -body { + ttk::style theme styles noSuchTheme +} -returnCodes 1 -result {theme "noSuchTheme" doesn't exist} +test ttk-16.2 {ttk::style theme styles - theme exists} -body { + # simply check this produces a list with some style names, + # without checking exact content (not needed, and may vary + # depending on platform, versions, improvements...) + expr {[llength [ttk::style theme styles alt]] > 0} +} -result 1 + eval destroy [winfo children .] tcltest::cleanupTests Index: win/Makefile.in ================================================================== --- win/Makefile.in +++ win/Makefile.in @@ -124,24 +124,26 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ +VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ +DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} -TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${LIBSUFFIX} +TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX} SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) STATIC_LIBRARIES = $(TK_LIB_FILE) WISH = wish$(VER)${EXESUFFIX} -TKTEST = tktest.exe -CAT32 = cat32.exe -MAN2TCL = man2tcl.exe +TKTEST = tktest${EXESUFFIX} +CAT32 = cat32${EXESUFFIX} +MAN2TCL = man2tcl${EXESUFFIX} @SET_MAKE@ # Setting the VPATH variable to a list of paths will cause the # makefile to look into these paths when resolving .c to .obj @@ -163,11 +165,11 @@ # To change the compiler switches, for example to change from optimization to # debugging symbols, change the following line: #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0 # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ AR = @AR@ @@ -185,12 +187,10 @@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ -VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ -DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@ RMDIR = rm -rf MKDIR = mkdir -p SHELL = @SHELL@ RM = rm -f Index: win/configure ================================================================== --- win/configure +++ win/configure @@ -4242,11 +4242,11 @@ # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \ - -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\$@)" + -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)" # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX=".dll" LIBSUFFIX=".a" LIBFLAGSUFFIX="" @@ -4900,11 +4900,15 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" -eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}" +if test ${SHARED_BUILD} = 0 ; then + eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" +else + eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" +fi eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" # FIXME: All of this var junk needs to be done in tcl.m4 !!!! # I left out the other vars that also need to get defined here. # we also need to double check about spaces in path names Index: win/configure.ac ================================================================== --- win/configure.ac +++ win/configure.ac @@ -158,11 +158,15 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" -eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}" +if test ${SHARED_BUILD} = 0 ; then + eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" +else + eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" +fi eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" # FIXME: All of this var junk needs to be done in tcl.m4 !!!! # I left out the other vars that also need to get defined here. # we also need to double check about spaces in path names Index: win/tcl.m4 ================================================================== --- win/tcl.m4 +++ win/tcl.m4 @@ -659,11 +659,11 @@ # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ - -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)" + -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)" # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX=".dll" LIBSUFFIX=".a" LIBFLAGSUFFIX="" Index: win/tkWin32Dll.c ================================================================== --- win/tkWin32Dll.c +++ win/tkWin32Dll.c @@ -133,11 +133,11 @@ */ "leaq %[registration], %%rdx" "\n\t" "movq %%gs:0, %%rax" "\n\t" "movq %%rax, 0x0(%%rdx)" "\n\t" /* link */ - "leaq 1f, %%rax" "\n\t" + "leaq 1f(%%rip), %%rax" "\n\t" "movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */ "movq %%rbp, 0x10(%%rdx)" "\n\t" /* rbp */ "movq %%rsp, 0x18(%%rdx)" "\n\t" /* rsp */ "movl %[error], 0x20(%%rdx)" "\n\t" /* status */ Index: win/tkWinCursor.c ================================================================== --- win/tkWinCursor.c +++ win/tkWinCursor.c @@ -102,11 +102,11 @@ const char **argv = NULL; (void)tkwin; /* * All cursor names are valid lists of one element (for - * Unix-compatability), even unadorned system cursor names. + * Unix-compatibility), even unadorned system cursor names. */ if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; } Index: win/tkWinDialog.c ================================================================== --- win/tkWinDialog.c +++ win/tkWinDialog.c @@ -1084,11 +1084,11 @@ case OFN_DIR_CHOOSE: options = dirOptions; break; case OFN_FILE_OPEN: options = openOptions; break; } ZeroMemory(optsPtr, sizeof(*optsPtr)); - // optsPtr->forceXPStyle = 1; + /* optsPtr->forceXPStyle = 1; */ optsPtr->tkwin = (Tk_Window)clientData; optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */ Tcl_DStringInit(&optsPtr->utfDirString); optsPtr->file[0] = 0; @@ -2709,14 +2709,14 @@ * Not called when user changes edit box directly. */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); - // enable the OK button + /* enable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { - // disable the OK button + /* disable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; Index: win/ttkWinXPTheme.c ================================================================== --- win/ttkWinXPTheme.c +++ win/ttkWinXPTheme.c @@ -845,11 +845,11 @@ elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_UtfToWCharDString(src, len, &ds), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, NULL, &rc); if (SUCCEEDED(hr)) { *widthPtr = rc.right - rc.left; @@ -884,11 +884,11 @@ elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_UtfToWCharDString(src, len, &ds), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); Tcl_DStringFree(&ds); FreeElementData(elementData);